/**
 * My Account (SPEC §5.6): heading, tabs, Oversikt (ink card «ute nå», next order, order
 * rows, «Bedrift»), Ordre, Adresser, Konto, login landing. Order detail parts live in
 * css/order-view.css, buttons/fields in css/components.css. Tokens only.
 * Page template: templates/page-my-account.html.
 */

.dh-acct {
    display: grid;
    gap: 20px;
    min-width: 0;
}

.dh-acct > * {
    margin-block: 0 !important;
}

main.dh-account .woocommerce {
    max-width: none;
    margin: 0;
}

.dh-acct__content.woocommerce-MyAccount-content {
    width: auto;
    float: none;
}

.dh-acct__content {
    display: grid;
    gap: var(--dh-gap);
    min-width: 0;
}

/* WooCommerce wraps notices in this */
.dh-acct .woocommerce-notices-wrapper:empty {
    display: none;
}

/* «title» style for Ordre / Adresser / Konto */
.dh-acct__title {
    margin: 0;
    font: 600 clamp(1.75rem, 1.35rem + 1.2vw, 2.375rem)/1.1 var(--dh-font-heading);
    letter-spacing: -0.03em;
    color: var(--dh-foreground);
}

/* -----------------------------------------
   Tabs
   ----------------------------------------- */
.dh-acct-tabs {
    display: inline-flex;
    flex-wrap: wrap;
    justify-self: start;
    gap: 2px;
    padding: 3px;
    border-radius: var(--dh-radius-pill);
    background: var(--dh-muted);
}

.dh-acct-tabs a {
    display: inline-flex;
    align-items: center;
    height: 32px;
    padding: 0 14px;
    border-radius: var(--dh-radius-pill);
    color: var(--dh-muted-foreground);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: background-color var(--dh-ease), color var(--dh-ease);
}

.dh-acct-tabs a:hover {
    color: var(--dh-foreground);
}

.dh-acct-tabs a[aria-current="page"] {
    background: var(--dh-card);
    color: var(--dh-foreground);
    box-shadow: var(--dh-shadow-card);
}

.dh-acct-tabs a:focus-visible {
    outline: 3px solid color-mix(in oklch, var(--dh-ring) 50%, transparent);
}

/* -----------------------------------------
   Oversikt
   ----------------------------------------- */
.dh-dash {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 20rem;
    gap: var(--dh-gap);
    align-items: start;
}

.dh-dash__main {
    display: grid;
    gap: var(--dh-gap);
    min-width: 0;
}

.dh-dash__now {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
    gap: var(--dh-gap);
}

.dh-dash__now > :only-child {
    grid-column: 1 / -1;
}

.dh-dash__out {
    display: grid;
    gap: 18px;
    padding: 24px;
}

.dh-dash__big {
    font: 500 clamp(2rem, 1.4rem + 1.8vw, 2.9rem)/1.02 var(--dh-font-heading);
    letter-spacing: -0.045em;
}

.dh-dash__meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 12px;
    font-size: 0.875rem;
    color: color-mix(in oklch, var(--dh-ink-foreground) 78%, transparent);
}

.dh-dash__out .dh-btn {
    justify-self: start;
}

.dh-dash__next {
    display: grid;
    align-content: space-between;
    gap: 10px;
    padding: 24px;
}

.dh-dash__date {
    font: 600 1.625rem/1.15 var(--dh-font-sans);
    letter-spacing: -0.025em;
}

.dh-dash__next .dh-btn {
    justify-self: start;
}

/* Card head: title + link */
.dh-dash__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.dh-dash__head h2 {
    margin: 0;
    font: 600 1rem/1.5 var(--dh-font-heading);
}

.dh-dash__head .dh-link {
    margin-right: -8px;
}

.dh-dash__orders {
    overflow: hidden;
    padding: 0;
}

.dh-dash__orders > .dh-dash__head {
    padding: 20px 24px 8px;
}

.dh-dash__empty {
    padding: 8px 24px 24px;
}

.dh-dash__company {
    display: grid;
    gap: 12px;
    padding: 20px 24px;
}

/* Order rows */
.dh-orders {
    width: 100%;
    margin: 0;
    border: 0;
    border-collapse: collapse;
    font-size: 0.9375rem;
}

.dh-orders td {
    height: 52px;
    padding: 0 24px;
    border: 0;
    border-top: 1px solid var(--dh-border);
    vertical-align: middle;
}

.dh-dash__orders > .dh-orders:first-child tr:first-child td {
    border-top: 0;
}

.dh-orders tr {
    position: relative;
    transition: background-color var(--dh-ease);
}

.dh-orders tr:hover {
    background: var(--dh-accent);
}

.dh-orders__no a {
    color: var(--dh-foreground);
    font-weight: 500;
    text-decoration: none;
}

/* Whole row opens the order */
.dh-orders__no a::after {
    content: "";
    position: absolute;
    inset: 0;
}

.dh-orders__no a:focus-visible {
    outline: none;
}

.dh-orders tr:has(a:focus-visible) {
    outline: 3px solid color-mix(in oklch, var(--dh-ring) 50%, transparent);
    outline-offset: -3px;
}

.dh-orders__period {
    color: var(--dh-muted-foreground);
    font-size: 0.875rem;
    white-space: nowrap;
}

.dh-orders__sum {
    text-align: right;
    white-space: nowrap;
}

.dh-acct-pages {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    font-size: 0.875rem;
}

@media (max-width: 980px) {
    .dh-dash,
    .dh-dash__now {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 600px) {
    .dh-orders td { padding: 0 16px; }
    .dh-orders__period { display: none; }
    .dh-dash__out,
    .dh-dash__next { padding: 20px; }
}

/* -----------------------------------------
   Adresser
   ----------------------------------------- */
.dh-addr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--dh-gap);
    align-items: start;
}

.dh-addr__card {
    display: grid;
    gap: 12px;
    padding: 20px 24px;
}

.dh-addr__card address {
    font-style: normal;
    font-size: 0.9375rem;
    line-height: 1.5;
}

.dh-addr__card p {
    margin: 0;
}

.dh-addr__list {
    display: grid;
    margin: 0;
    padding: 0;
    list-style: none;
}

.dh-addr__list:empty {
    display: none;
}

.dh-addr__row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 52px;
    border-top: 1px solid var(--dh-border);
}

.dh-addr__row:first-child {
    border-top: 0;
}

.dh-addr__text {
    display: grid;
    flex: 1;
    min-width: 0;
    font-size: 0.9375rem;
}

.dh-addr__text .dh-muted {
    font-size: 0.8125rem;
}

.dh-addr__add {
    all: unset;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border: 1px dashed var(--dh-border);
    border-radius: 1.2rem;
    background: var(--dh-background);
    color: var(--dh-muted-foreground);
    font-size: 0.9375rem;
    cursor: pointer;
}

.dh-addr__add:hover {
    border-color: color-mix(in oklch, var(--dh-foreground) 25%, var(--dh-border));
    color: var(--dh-foreground);
}

.dh-addr__add:focus-visible {
    outline: 3px solid color-mix(in oklch, var(--dh-ring) 50%, transparent);
}

.dh-addr__add[hidden],
.dh-addr__form[hidden] {
    display: none;
}

.dh-addr__form {
    display: grid;
    gap: 12px;
}

.dh-addr__pair {
    display: grid;
    grid-template-columns: 8rem minmax(0, 1fr);
    gap: 12px;
}

@media (max-width: 860px) {
    .dh-addr { grid-template-columns: minmax(0, 1fr); }
}

/* -----------------------------------------
   Forms (Konto, edit address) — WooCommerce form-row markup
   ----------------------------------------- */
.dh-acct-form {
    display: grid;
    gap: 16px;
    max-width: 40rem;
    padding: 20px 24px 24px;
}

.dh-acct-form__fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 12px;
}

.dh-acct-form .form-row {
    display: grid;
    grid-column: 1 / -1;
    gap: 6px;
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    float: none !important;
}

.dh-acct-form .form-row-first {
    grid-column: 1;
}

.dh-acct-form .form-row-last {
    grid-column: 2;
}

.dh-acct-form .form-row label {
    margin: 0;
    color: var(--dh-foreground);
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.4;
}

.dh-acct-form .form-row .required,
.dh-acct-form .form-row .optional {
    display: none;
}

.dh-acct-form .woocommerce-input-wrapper {
    display: block;
}

.dh-acct-form input.input-text,
.dh-acct-form select,
.dh-acct-form textarea {
    box-sizing: border-box;
    width: 100%;
    height: 40px;
    margin: 0;
    padding: 0 16px;
    border: 1px solid var(--dh-input);
    border-radius: var(--dh-radius-pill);
    background: var(--dh-background);
    color: var(--dh-foreground);
    font: 400 0.9375rem/1 var(--dh-font-sans);
    outline: none;
    transition: border-color var(--dh-ease), box-shadow var(--dh-ease);
}

.dh-acct-form input.input-text:focus,
.dh-acct-form select:focus {
    border-color: var(--dh-ring);
    box-shadow: 0 0 0 3px color-mix(in oklch, var(--dh-ring) 50%, transparent);
}

.dh-acct-form .woocommerce-invalid input.input-text {
    border-color: var(--dh-status-bad);
}

.dh-acct-form__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

@media (max-width: 600px) {
    .dh-acct-form__fields { grid-template-columns: minmax(0, 1fr); }
    .dh-acct-form .form-row-first,
    .dh-acct-form .form-row-last { grid-column: 1; }
    .dh-acct-form input.input-text,
    .dh-acct-form select { font-size: 1rem; }
    .dh-addr__pair { grid-template-columns: minmax(0, 1fr); }
}

/* -----------------------------------------
   Login landing (not logged in)
   ----------------------------------------- */
.dh-login {
    display: grid;
    gap: 16px;
    justify-items: start;
    max-width: 40rem;
}

.dh-login h1 {
    margin: 0;
}

.dh-login__options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    width: 100%;
}

.dh-login__option {
    display: grid;
    gap: 6px;
    justify-items: start;
    padding: 20px;
}

.dh-login__option b {
    font-weight: 500;
}

.dh-login__option .dh-muted {
    font-size: 0.875rem;
}

.dh-login__option .dh-btn {
    margin-top: 6px;
}

@media (max-width: 600px) {
    .dh-login__options { grid-template-columns: minmax(0, 1fr); }
}
