/* ===================================================================
   Account — refined customer self-service portal.
   Editorial sidebar+topbar dashboard with a warm, premium-telco feel.
   Tokens-driven; brand colours can be overridden per tenant via :root.
   =================================================================== */

/* --- Tokens --------------------------------------------------------- */
:root {
    /* Brand — Mango orange, used surgically as accent (not gradient slop). */
    --brand-50:  #FFF1DF;
    --brand-100: #FFDFB3;
    --brand-300: #FFB05F;
    --brand-500: #FF7A00;
    --brand-600: #E26500;
    --brand-700: #B14C00;
    --brand-900: #4F2200;

    /* Warm ink — slight olive cast keeps the neutrals from feeling clinical. */
    --ink-900: #171513;
    --ink-800: #2A2622;
    --ink-700: #3F3933;
    --ink-500: #6B6359;
    --ink-400: #8E867A;
    --ink-300: #B6AE9F;
    --ink-200: #D8D1C0;
    --ink-100: #E9E2D0;
    --ink-50:  #F2ECDC;

    /* Surfaces */
    --paper:    #FFFFFF;
    --canvas:   #FBF6EA;     /* warm cream behind cards */
    --canvas-2: #F4ECD9;     /* deeper cream for chrome strips */

    /* Status (warmed) */
    --success: #1A7A4D;
    --warn:    #B7700C;
    --error:   #B53237;
    --info:    #2E5BB3;

    /* Typography — distinctive pairing.
       Fraunces: variable serif with SOFT axis (warmth) and italic optical sizing.
       DM Sans:  friendly geometric body sans.
       IBM Plex Mono: tabular numerals on amounts, account numbers, etc. */
    --font-display: 'Fraunces', 'Cormorant Garamond', ui-serif, Georgia, serif;
    --font-body:    'DM Sans', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    --font-mono:    'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;

    /* Radii — slightly softened, never pill-y on cards */
    --r-xs: 4px; --r-sm: 8px; --r-md: 12px; --r-lg: 18px; --r-pill: 999px;

    /* Shadows — warm, soft, layered (no slate-blue cast) */
    --shadow-sm: 0 1px 2px rgba(63, 32, 0, .04);
    --shadow-md: 0 1px 2px rgba(63, 32, 0, .04), 0 8px 22px -14px rgba(63, 32, 0, .12);
    --shadow-lg: 0 1px 2px rgba(63, 32, 0, .04), 0 24px 48px -20px rgba(63, 32, 0, .18);

    /* Spacing */
    --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px; --s-5: 20px;
    --s-6: 24px; --s-7: 28px; --s-8: 32px; --s-10: 40px; --s-12: 48px; --s-16: 64px;

    /* Layout */
    --sidebar-w: 272px;
    --topbar-h: 72px;
    --measure: 1180px;

    /* Motion */
    --ease: cubic-bezier(.2, .7, .2, 1);
    --ease-out: cubic-bezier(.16, 1, .3, 1);
}

/* --- Reset ---------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.55;
    color: var(--ink-900);
    background-color: var(--canvas);
    /* Subtle film-grain overlay — barely-there texture so flat surfaces don't look digital. */
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.09 0 0 0 0 0.08 0 0 0 0 0.07 0 0 0 0.05 0'/></filter><rect width='180' height='180' filter='url(%23n)'/></svg>");
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; height: auto; display: block; }
button { font: inherit; cursor: pointer; }
a { color: var(--brand-700); text-decoration: none; transition: color .15s; }
a:hover { color: var(--brand-900); }
input, select, textarea { font: inherit; }

::selection { background: var(--brand-100); color: var(--brand-900); }

.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 16px; top: 16px; background: var(--ink-900); color: white; padding: 12px 16px; z-index: 100; }

/* --- Typography ----------------------------------------------------- */
h1, h2, h3, h4 {
    font-family: var(--font-display);
    color: var(--ink-900);
    margin: 0 0 var(--s-3);
    line-height: 1.1;
    font-weight: 500;
    /* Fraunces upright: optical sizing scales detail to size, SOFT dials warmth. */
    font-variation-settings: 'opsz' 96, 'SOFT' 50, 'WONK' 0;
    letter-spacing: -0.018em;
}
h1 { font-size: clamp(2rem, 1.5rem + 1.4vw, 2.625rem); font-weight: 400; letter-spacing: -0.028em; }
h2 { font-size: 1.5rem; font-weight: 500; }
h3 { font-size: 1.125rem; font-weight: 600; font-variation-settings: 'opsz' 14, 'SOFT' 30; }
h4 { font-size: 1rem; font-weight: 600; font-family: var(--font-body); letter-spacing: -0.005em; }
p  { margin: 0 0 var(--s-3); color: var(--ink-700); }

.serif { font-family: var(--font-display); font-variation-settings: 'opsz' 96, 'SOFT' 50; }
.mono { font-family: var(--font-mono); font-feature-settings: 'tnum' 1; }

/* Tracked-uppercase small caps — the small-text counterpart to the serif
   display headings. Used for eyebrows, section labels, table headers. */
.eyebrow,
.smallcaps {
    display: inline-block;
    font-family: var(--font-body);
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--ink-500);
    letter-spacing: 0.18em;
    text-transform: uppercase;
}
.lede { font-size: 1.0625rem; line-height: 1.6; color: var(--ink-700); max-width: 56ch; }

/* --- Layout: sidebar + content ------------------------------------- */
.account-shell { min-height: 100vh; }

.sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w);
    background: var(--paper);
    border-right: 1px solid var(--ink-100);
    display: flex; flex-direction: column;
    z-index: 40;
    transition: transform .3s var(--ease-out);
}
.sidebar__brand {
    padding: 0 var(--s-6);
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid var(--ink-100);
    height: var(--topbar-h);
}
.sidebar__logo { height: 30px; width: auto; }
.sidebar__close {
    display: none; background: none; border: 0; padding: 4px;
    color: var(--ink-500); font-size: 28px; line-height: 1;
}
.sidebar__nav {
    flex: 1; overflow-y: auto;
    padding: var(--s-6) var(--s-4);
}
.sidebar__section { margin-bottom: var(--s-6); }
.sidebar__heading {
    display: block;
    padding: 0 var(--s-3) var(--s-3);
    font-family: var(--font-body);
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--ink-400);
    letter-spacing: 0.16em;
    text-transform: uppercase;
}
.sidebar__link {
    position: relative;
    display: flex; align-items: center; gap: var(--s-3);
    padding: 9px var(--s-3);
    margin-bottom: 2px;
    border-radius: var(--r-sm);
    color: var(--ink-700);
    font-weight: 500;
    font-size: 0.9375rem;
    transition: background .15s, color .15s, padding-left .2s var(--ease-out);
    text-decoration: none;
}
.sidebar__link::before {
    content: '';
    position: absolute; left: 0; top: 50%;
    transform: translate(-12px, -50%) scaleY(0);
    width: 3px; height: 22px;
    background: var(--brand-500);
    border-radius: 0 var(--r-xs) var(--r-xs) 0;
    transition: transform .2s var(--ease-out);
}
.sidebar__link:hover { background: var(--canvas); color: var(--ink-900); padding-left: calc(var(--s-3) + 4px); }
.sidebar__link.is-active {
    background: var(--brand-50);
    color: var(--brand-900);
    font-weight: 600;
}
.sidebar__link.is-active::before { transform: translate(-12px, -50%) scaleY(1); }
.sidebar__link-icon {
    width: 18px; height: 18px;
    background: currentColor;
    -webkit-mask-position: center; mask-position: center;
    -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
    -webkit-mask-size: contain; mask-size: contain;
    opacity: 0.6;
    flex-shrink: 0;
}
.sidebar__link.is-active .sidebar__link-icon,
.sidebar__link:hover .sidebar__link-icon { opacity: 1; }

.sidebar__footer {
    padding: var(--s-3) var(--s-4) var(--s-5);
    border-top: 1px solid var(--ink-100);
}
.sidebar__logout button { gap: var(--s-2); }

.content {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex; flex-direction: column;
}

/* --- Topbar -------------------------------------------------------- */
.topbar {
    position: sticky; top: 0; z-index: 30;
    height: var(--topbar-h);
    background: rgba(255, 255, 255, .82);
    backdrop-filter: saturate(180%) blur(18px);
    -webkit-backdrop-filter: saturate(180%) blur(18px);
    border-bottom: 1px solid var(--ink-100);
    padding: 0 var(--s-8);
    display: flex; align-items: center; gap: var(--s-4);
}
.topbar__menu {
    display: none;
    background: none; border: 0; padding: var(--s-2);
    color: var(--ink-900);
    border-radius: var(--r-sm);
}
.topbar__menu:hover { background: var(--canvas); }
.topbar__title { display: flex; flex-direction: column; gap: 0; line-height: 1; }
.topbar__eyebrow {
    font-family: var(--font-body);
    font-size: 0.625rem;
    font-weight: 600;
    color: var(--ink-400);
    letter-spacing: 0.18em;
    text-transform: uppercase;
}
.topbar__page {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 1.25rem;
    color: var(--ink-900);
    margin-top: 4px;
    letter-spacing: -0.018em;
    font-variation-settings: 'opsz' 24, 'SOFT' 50;
}
.topbar__right { margin-left: auto; }
.topbar__user {
    display: inline-flex; align-items: center; gap: var(--s-3);
    padding: 6px 6px 6px var(--s-4);
    border-radius: var(--r-pill);
    border: 1px solid transparent;
    color: var(--ink-700);
    font-size: 0.9375rem;
    font-weight: 500;
    transition: border-color .15s, background .15s;
}
.topbar__user:hover { border-color: var(--ink-100); background: var(--paper); color: var(--ink-900); }
.topbar__name { display: none; }
.topbar__hello {
    color: var(--ink-400);
    margin-right: 4px;
    font-weight: 400;
}
.topbar__who { font-weight: 600; color: var(--ink-900); }
.topbar__avatar {
    width: 36px; height: 36px; border-radius: var(--r-pill);
    background: linear-gradient(135deg, var(--brand-500) 0%, var(--brand-700) 100%);
    color: white;
    display: inline-flex; align-items: center; justify-content: center;
    font-family: var(--font-display);
    font-weight: 600; font-size: 0.8125rem;
    letter-spacing: 0.04em;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.18);
}
@media (min-width: 720px) { .topbar__name { display: inline; } }

.main {
    flex: 1;
    padding: var(--s-10) var(--s-8) var(--s-12);
    max-width: var(--measure);
    width: 100%;
}

@media (max-width: 880px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.is-open { transform: translateX(0); box-shadow: var(--shadow-lg); }
    .sidebar__close { display: block; }
    .content { margin-left: 0; }
    .topbar { padding: 0 var(--s-5); }
    .topbar__menu { display: inline-flex; align-items: center; justify-content: center; }
    .main { padding: var(--s-6) var(--s-5) var(--s-10); }
}

/* Backdrop when sidebar open on mobile */
.sidebar-backdrop {
    position: fixed; inset: 0; z-index: 35;
    background: rgba(23, 21, 19, .4);
    opacity: 0; pointer-events: none;
    transition: opacity .25s;
}
.sidebar-backdrop.is-visible { opacity: 1; pointer-events: auto; }

/* --- Public (login) state ------------------------------------------ */
.auth-main {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    padding: var(--s-8) var(--s-4);
    position: relative;
    background:
        radial-gradient(900px 600px at 85% -10%, rgba(255, 122, 0, .14), transparent 60%),
        radial-gradient(700px 500px at 0% 105%, rgba(177, 76, 0, .08), transparent 55%),
        var(--canvas);
}
.auth-card {
    background: var(--paper);
    width: 100%; max-width: 460px;
    border: 1px solid var(--ink-100);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    padding: var(--s-12) var(--s-10);
    position: relative;
}
.auth-card__logo { display: flex; justify-content: center; margin-bottom: var(--s-8); }
.auth-card__logo img { height: 38px; width: auto; }
.auth-card h1 {
    text-align: center;
    font-variation-settings: 'opsz' 96, 'SOFT' 50, 'WONK' 0;
    font-size: 2rem; font-weight: 400;
    margin-bottom: var(--s-2);
    letter-spacing: -0.028em;
}
.auth-card .lead { text-align: center; color: var(--ink-500); margin-bottom: var(--s-8); }

/* --- Buttons -------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
    font-family: var(--font-body); font-weight: 600; font-size: 0.9375rem;
    height: 44px; padding: 0 var(--s-5);
    border-radius: var(--r-sm); border: 1px solid transparent;
    text-decoration: none; cursor: pointer; white-space: nowrap;
    letter-spacing: -0.005em;
    transition: transform .12s var(--ease), box-shadow .2s var(--ease-out),
                background .15s, border-color .15s, color .15s;
}
.btn--sm { height: 34px; padding: 0 var(--s-4); font-size: 0.8125rem; }
.btn--lg { height: 52px; padding: 0 var(--s-7); font-size: 0.9375rem; }
.btn--block { display: flex; width: 100%; }

.btn--primary {
    background: var(--ink-900);
    color: var(--paper);
    box-shadow: 0 1px 0 rgba(255,255,255,.18) inset, 0 6px 16px -8px rgba(23,21,19,.4);
}
.btn--primary:hover {
    background: var(--brand-700);
    color: var(--paper);
    box-shadow: 0 1px 0 rgba(255,255,255,.18) inset, 0 10px 22px -10px rgba(177,76,0,.6);
    transform: translateY(-1px);
}
.btn--primary:active { transform: translateY(0); }

.btn--secondary { background: var(--canvas-2); color: var(--ink-900); }
.btn--secondary:hover { background: var(--ink-100); color: var(--ink-900); }

.btn--ghost { background: transparent; color: var(--ink-700); border-color: var(--ink-200); }
.btn--ghost:hover { background: var(--paper); border-color: var(--ink-300); color: var(--ink-900); }

.btn--brand {
    background: var(--brand-500);
    color: var(--paper);
    box-shadow: 0 1px 0 rgba(255,255,255,.25) inset, 0 8px 18px -8px rgba(255,122,0,.55);
}
.btn--brand:hover {
    background: var(--brand-600);
    color: var(--paper);
    transform: translateY(-1px);
}

.btn[disabled] { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* --- Forms ---------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
/* Vertical stacking inside a column flow only — never inside a grid (was the
   alignment bug: margin-top pushed the second grid column down by 16px). */
:not(.field-grid) > .field + .field { margin-top: var(--s-5); }

.field-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--s-5) var(--s-5);
    align-items: start;
}
@media (max-width: 600px) { .field-grid { grid-template-columns: 1fr; } }

.label {
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 0.8125rem;
    color: var(--ink-700);
    letter-spacing: 0.005em;
    display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3);
}
.label small {
    color: var(--ink-400);
    font-weight: 400;
    font-family: var(--font-body);
    font-size: 0.75rem;
    letter-spacing: 0;
}

.input, .select, .textarea {
    height: 46px;
    padding: 0 var(--s-4);
    background: var(--paper);
    border: 1px solid var(--ink-200);
    border-radius: var(--r-sm);
    font-size: 0.9375rem;
    color: var(--ink-900);
    transition: border-color .12s, box-shadow .15s, background .15s;
    width: 100%;
    font-family: var(--font-body);
}
.input::placeholder, .textarea::placeholder { color: var(--ink-400); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--ink-300); }
.input:focus, .select:focus, .textarea:focus {
    outline: 0;
    border-color: var(--brand-500);
    box-shadow: 0 0 0 4px rgba(255, 122, 0, .14);
    background: var(--paper);
}
.textarea { height: auto; padding: var(--s-3) var(--s-4); min-height: 96px; resize: vertical; line-height: 1.55; }
.help { font-size: 0.8125rem; color: var(--ink-500); line-height: 1.5; }
.help--error { color: var(--error); }

/* Numeric inputs use tabular figures for a calmer column. */
input[type="number"], input[inputmode="numeric"] {
    font-family: var(--font-mono);
    font-feature-settings: 'tnum' 1;
}

/* --- Cards ---------------------------------------------------------- */
.card {
    background: var(--paper);
    border: 1px solid var(--ink-100);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: box-shadow .25s var(--ease-out), border-color .15s;
}
.card:hover { box-shadow: var(--shadow-md); }

.card__head {
    padding: var(--s-5) var(--s-7);
    border-bottom: 1px solid var(--ink-100);
    display: flex; align-items: baseline; justify-content: space-between;
    gap: var(--s-3);
    background: linear-gradient(180deg, rgba(251,246,234,.4) 0%, transparent 100%);
}
.card__head h2, .card__head h3 {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 1.125rem;
    letter-spacing: -0.018em;
    font-variation-settings: 'opsz' 24, 'SOFT' 50;
}
.card__sub {
    font-family: var(--font-body);
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--ink-400);
    letter-spacing: 0.16em;
    text-transform: uppercase;
}
.card__body { padding: var(--s-7); }
.card__foot {
    padding: var(--s-5) var(--s-7);
    border-top: 1px solid var(--ink-100);
    background: var(--canvas);
    display: flex; justify-content: flex-end; gap: var(--s-3);
}

/* Hero card — the dominant "outstanding balance" / lead card. */
.card--hero {
    background:
        radial-gradient(600px 280px at 100% 0%, rgba(255, 176, 95, .18), transparent 60%),
        var(--paper);
    border-color: var(--ink-100);
}
.card--ink {
    background: var(--ink-900);
    border-color: var(--ink-900);
    color: var(--paper);
}
.card--ink h2, .card--ink h3 { color: var(--paper); }
.card--ink .card__sub { color: var(--ink-300); }

/* --- Stat cards (dashboard top row) -------------------------------- */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--s-5);
    margin-bottom: var(--s-8);
}
.stat {
    background: var(--paper);
    border: 1px solid var(--ink-100);
    border-radius: var(--r-md);
    padding: var(--s-6) var(--s-7);
    box-shadow: var(--shadow-sm);
    position: relative; overflow: hidden;
    transition: box-shadow .25s var(--ease-out), transform .2s var(--ease-out);
}
.stat:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat__label {
    font-family: var(--font-body);
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--ink-500);
    margin-bottom: var(--s-4);
    letter-spacing: 0.18em;
    text-transform: uppercase;
}
.stat__value {
    font-family: var(--font-display);
    font-size: 2.625rem;
    font-weight: 400;
    color: var(--ink-900);
    line-height: 1;
    letter-spacing: -0.038em;
    font-variation-settings: 'opsz' 144, 'SOFT' 50, 'WONK' 0;
    font-feature-settings: 'tnum' 1, 'lnum' 1;
}
.stat__value small {
    font-size: 0.42em;
    font-weight: 500;
    color: var(--ink-400);
    margin-left: 6px;
    font-family: var(--font-body);
    font-variation-settings: normal;
    letter-spacing: 0;
}
.stat__currency {
    font-size: 0.55em;
    color: var(--ink-500);
    margin-right: 4px;
    vertical-align: 0.22em;
    font-feature-settings: 'tnum' 1;
}
.stat__delta {
    margin-top: var(--s-3);
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 0.8125rem; font-weight: 600;
    color: var(--success);
    font-family: var(--font-mono);
}
.stat__delta--down { color: var(--error); }
.stat__icon {
    position: absolute; top: var(--s-6); right: var(--s-7);
    width: 32px; height: 32px;
    border-radius: var(--r-sm);
    background: var(--brand-50); color: var(--brand-700);
    display: inline-flex; align-items: center; justify-content: center;
}

/* The lead stat — used for outstanding balance to set the page tone. */
.stat--lead {
    grid-column: 1 / -1;
    background:
        radial-gradient(700px 320px at 100% 0%, rgba(255, 176, 95, .22), transparent 60%),
        var(--paper);
    padding: var(--s-8) var(--s-8);
}
.stat--lead .stat__value { font-size: clamp(2.75rem, 2rem + 4vw, 4.5rem); }
.stat--lead .stat__label { font-size: 0.75rem; }

/* --- Grid layouts -------------------------------------------------- */
.grid { display: grid; gap: var(--s-6); }
.grid--2 { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }
.grid--equal-2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 880px) {
    .grid--2, .grid--equal-2 { grid-template-columns: 1fr; }
}

/* --- Page heading -------------------------------------------------- */
.page-head {
    display: flex; align-items: flex-end; justify-content: space-between;
    gap: var(--s-5);
    margin-bottom: var(--s-8);
    flex-wrap: wrap;
    padding-bottom: var(--s-5);
    border-bottom: 1px solid var(--ink-100);
}
.page-head__copy { max-width: 56ch; }
.page-head__copy h1 {
    margin-bottom: var(--s-3);
    margin-top: var(--s-2);
    font-variation-settings: 'opsz' 144, 'SOFT' 50, 'WONK' 0;
    font-weight: 400;
    letter-spacing: -0.032em;
}
.page-head__copy p { margin: 0; color: var(--ink-500); font-size: 1rem; }
.page-head__actions { display: flex; gap: var(--s-3); }

/* --- Tables -------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
.table {
    width: 100%; border-collapse: collapse;
    font-size: 0.9375rem;
}
.table th, .table td {
    padding: var(--s-4) var(--s-5);
    text-align: left;
    border-bottom: 1px solid var(--ink-100);
    vertical-align: middle;
}
.table thead th {
    color: var(--ink-500);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.6875rem;
    background: transparent;
    border-bottom: 1px solid var(--ink-200);
    letter-spacing: 0.16em;
    text-transform: uppercase;
}
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--canvas); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num {
    text-align: right;
    font-family: var(--font-mono);
    font-feature-settings: 'tnum' 1;
    font-weight: 500;
    color: var(--ink-900);
}
.table .actions { text-align: right; white-space: nowrap; }

/* Rows behave like links — whole row clickable, hover hint via the actions cell. */
.table--clickable tbody tr { cursor: pointer; }
.table--clickable tbody tr:hover .actions a { color: var(--brand-700); border-color: var(--brand-300); }

/* --- Key/value list (service detail) ------------------------------ */
.kv { margin: 0; display: grid; gap: 0; }
.kv__row {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: var(--s-4);
    padding: var(--s-3) 0;
    border-bottom: 1px solid var(--ink-100);
    align-items: baseline;
}
.kv__row:first-child { padding-top: 0; }
.kv__row:last-child { border-bottom: 0; padding-bottom: 0; }
.kv dt {
    font-family: var(--font-body);
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--ink-500);
    letter-spacing: 0.16em;
    text-transform: uppercase;
    margin: 0;
}
.kv dd {
    margin: 0;
    color: var(--ink-900);
    font-size: 0.9375rem;
}
@media (max-width: 600px) {
    .kv__row { grid-template-columns: 1fr; gap: var(--s-1); }
}

/* --- Service summary (hero card on detail) ------------------------ */
.service-summary {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: var(--s-4);
    margin-top: var(--s-3);
    flex-wrap: wrap;
}
.service-summary__amount {
    font-family: var(--font-display);
    font-size: clamp(2.25rem, 1.5rem + 3vw, 3.25rem);
    font-weight: 400;
    line-height: 1;
    color: var(--ink-900);
    letter-spacing: -0.035em;
    font-variation-settings: 'opsz' 144, 'SOFT' 50, 'WONK' 0;
    font-feature-settings: 'tnum' 1, 'lnum' 1;
}
.service-summary__amount small {
    font-size: 0.32em;
    color: var(--ink-400);
    font-weight: 500;
    margin-left: 4px;
    font-family: var(--font-body);
    font-variation-settings: normal;
    letter-spacing: 0;
}
.service-summary__currency { font-size: 0.6em; color: var(--ink-500); margin-right: 4px; vertical-align: 0.18em; }

/* --- Tags / pills -------------------------------------------------- */
.tag {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px;
    border-radius: var(--r-pill);
    background: var(--ink-50); color: var(--ink-700);
    font-size: 0.6875rem; font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-family: var(--font-body);
}
.tag--success { background: rgba(26, 122, 77, .12);  color: #0e5e3a; }
.tag--warn    { background: rgba(183, 112, 12, .14); color: #7a4906; }
.tag--error   { background: rgba(181, 50, 55, .12);  color: #8a2429; }
.tag--info    { background: rgba(46, 91, 179, .12);  color: #234580; }
.tag--brand   { background: var(--brand-50);          color: var(--brand-900); }

/* --- Quick action list (dashboard) --------------------------------- */
.quick-list { display: grid; gap: var(--s-3); }
.quick-list__item {
    display: flex; align-items: center; gap: var(--s-4);
    padding: var(--s-4) var(--s-5);
    border: 1px solid var(--ink-100);
    border-radius: var(--r-md);
    background: var(--paper);
    color: var(--ink-900);
    transition: border-color .15s, transform .15s var(--ease-out), box-shadow .2s;
    position: relative;
}
.quick-list__item:hover {
    border-color: var(--brand-300);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
    color: var(--ink-900);
}
.quick-list__item::after {
    content: '→';
    margin-left: auto;
    color: var(--ink-300);
    font-family: var(--font-display);
    font-size: 1.125rem;
    transition: transform .2s var(--ease-out), color .15s;
}
.quick-list__item:hover::after { color: var(--brand-600); transform: translateX(4px); }
.quick-list__icon {
    width: 36px; height: 36px;
    border-radius: var(--r-sm);
    background: var(--canvas);
    color: var(--brand-700);
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.quick-list__title { font-weight: 600; font-size: 0.9375rem; }
.quick-list__sub { font-size: 0.8125rem; color: var(--ink-500); margin-top: 2px; }
.quick-list__copy { display: flex; flex-direction: column; }

/* --- Empty state --------------------------------------------------- */
.empty {
    text-align: center;
    padding: var(--s-12) var(--s-6);
    color: var(--ink-500);
}
.empty__icon {
    width: 56px; height: 56px; border-radius: var(--r-pill);
    background: var(--canvas);
    display: inline-flex; align-items: center; justify-content: center;
    margin-bottom: var(--s-5);
    color: var(--ink-300);
}
.empty p {
    font-family: var(--font-display);
    font-variation-settings: 'opsz' 24, 'SOFT' 50;
    font-size: 1.0625rem;
    color: var(--ink-500);
    margin: 0;
}

/* --- Utility wrappers --------------------------------------------- */
.stack > * + * { margin-top: var(--s-6); }
.stack-tight > * + * { margin-top: var(--s-3); }

.link { color: var(--brand-700); font-weight: 500; text-decoration: none; border-bottom: 1px solid currentColor; padding-bottom: 1px; }
.link:hover { color: var(--brand-900); }
.link--sm { font-size: 0.8125rem; }
.link--quiet { color: var(--ink-500); border-color: var(--ink-200); }
.link--quiet:hover { color: var(--ink-900); border-color: var(--ink-400); }

.muted { color: var(--ink-500); }
.divider { border: 0; height: 1px; background: var(--ink-100); margin: var(--s-7) 0; }
.text-right { text-align: right; }
.flex { display: flex; align-items: center; gap: var(--s-3); }
.flex--between { display: flex; align-items: center; justify-content: space-between; }

/* --- My Account form ---------------------------------------------- */
.account-form .field-grid { gap: var(--s-5); }

.avatar-field {
    display: flex; align-items: center; gap: var(--s-4);
}
.avatar-field__preview {
    flex: 0 0 auto;
    display: flex; align-items: center; justify-content: center;
    width: 56px; height: 56px;
    border-radius: 50%;
    overflow: hidden;
    background: linear-gradient(135deg, var(--brand-100), var(--brand-50));
    color: var(--brand-900);
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 1rem;
    font-variation-settings: 'opsz' 24, 'SOFT' 50;
    border: 2px solid var(--paper);
    box-shadow: 0 0 0 1px var(--ink-100), var(--shadow-sm);
}
.avatar-field__preview img { width: 100%; height: 100%; object-fit: cover; }
.avatar-field__initials { letter-spacing: 0.04em; }
.avatar-field__input { flex: 1; min-width: 0; padding-top: 11px; padding-bottom: 11px; height: auto; line-height: 1.2; }

.address-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-6); }
@media (max-width: 720px) { .address-grid { grid-template-columns: 1fr; } }
.address-block { display: flex; flex-direction: column; gap: var(--s-3); }
.address-block__title {
    margin: 0;
    font-family: var(--font-body);
    font-size: 0.6875rem;
    color: var(--ink-500);
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}
.address-block__title-row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); }
.address-block__widget {
    padding: var(--s-4);
    background: var(--canvas);
    border-radius: var(--r-sm);
    border: 1px solid var(--ink-100);
}
.address-block__widget input,
.address-block__widget select,
.address-block__widget textarea { font-family: inherit; }

.toggle {
    display: flex; align-items: flex-start; gap: var(--s-4);
    padding: var(--s-5);
    border: 1px solid var(--ink-100);
    border-radius: var(--r-md);
    cursor: pointer;
    transition: border-color .15s, background .15s;
    background: var(--paper);
}
.toggle:hover { border-color: var(--ink-200); background: var(--canvas); }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle__indicator {
    flex: 0 0 auto;
    width: 40px; height: 24px;
    background: var(--ink-200);
    border-radius: 999px;
    position: relative;
    transition: background .2s var(--ease-out);
    margin-top: 2px;
}
.toggle__indicator::after {
    content: '';
    position: absolute;
    top: 2px; left: 2px;
    width: 20px; height: 20px;
    background: var(--paper);
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(63,32,0,.18);
    transition: transform .2s var(--ease-out);
}
.toggle input:checked + .toggle__indicator { background: var(--brand-500); }
.toggle input:checked + .toggle__indicator::after { transform: translateX(16px); }
.toggle input:focus-visible + .toggle__indicator { box-shadow: 0 0 0 4px rgba(255,122,0,.2); }
.toggle__label { display: flex; flex-direction: column; gap: 2px; }
.toggle__title { font-weight: 600; color: var(--ink-900); font-size: 0.9375rem; }
.toggle__hint { font-size: 0.8125rem; color: var(--ink-500); line-height: 1.5; }

.account-status {
    display: flex; align-items: center; gap: var(--s-3);
    margin-top: var(--s-5);
    padding-top: var(--s-5);
    border-top: 1px solid var(--ink-100);
}
.account-status__label {
    font-family: var(--font-body);
    font-size: 0.6875rem;
    color: var(--ink-500);
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.form-actions {
    display: flex; gap: var(--s-3); justify-content: flex-end;
    padding-top: var(--s-3);
    align-items: center;
}
@media (max-width: 600px) {
    .form-actions { flex-direction: column-reverse; }
    .form-actions .btn { width: 100%; }
}

/* --- Page-load motion --------------------------------------------- */
@keyframes rise {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.main > * { animation: rise .55s var(--ease-out) both; }
.main > *:nth-child(1) { animation-delay: 0ms; }
.main > *:nth-child(2) { animation-delay: 60ms; }
.main > *:nth-child(3) { animation-delay: 120ms; }
.main > *:nth-child(4) { animation-delay: 180ms; }
.main > *:nth-child(5) { animation-delay: 240ms; }
.main > *:nth-child(6) { animation-delay: 300ms; }
.main > *:nth-child(7) { animation-delay: 360ms; }
@media (prefers-reduced-motion: reduce) {
    .main > * { animation: none; }
}

/* --- Sidebar nav icons (data-icon attribute) ----------------------- */
/* CSS-mask icon set keyed by sidebar label slug so colour follows text. */
[data-icon="dashboard"], [data-icon="home"]                 { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><path d='M10 2L2 9h2v8h5v-5h2v5h5V9h2L10 2z' fill='black'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><path d='M10 2L2 9h2v8h5v-5h2v5h5V9h2L10 2z' fill='black'/></svg>"); }
[data-icon^="list-account"], [data-icon^="account"]        { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><path d='M3 4h14v3H3zm0 5h14v3H3zm0 5h14v3H3z' fill='black'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><path d='M3 4h14v3H3zm0 5h14v3H3zm0 5h14v3H3z' fill='black'/></svg>"); }
[data-icon^="make-payment"], [data-icon^="payment"]        { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><path d='M2 5a2 2 0 012-2h12a2 2 0 012 2v10a2 2 0 01-2 2H4a2 2 0 01-2-2V5zm0 3v2h16V8H2z' fill='black'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><path d='M2 5a2 2 0 012-2h12a2 2 0 012 2v10a2 2 0 01-2 2H4a2 2 0 01-2-2V5zm0 3v2h16V8H2z' fill='black'/></svg>"); }
[data-icon^="services"], [data-icon^="service"]            { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><path d='M10 2a8 8 0 100 16 8 8 0 000-16zm0 3a5 5 0 110 10 5 5 0 010-10z' fill='black'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><path d='M10 2a8 8 0 100 16 8 8 0 000-16zm0 3a5 5 0 110 10 5 5 0 010-10z' fill='black'/></svg>"); }
[data-icon^="orders"], [data-icon^="order"]                { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><path d='M3 4h14l-2 12H5L3 4zm5 4v6m4-6v6' stroke='black' stroke-width='2' fill='none'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><path d='M3 4h14l-2 12H5L3 4zm5 4v6m4-6v6' stroke='black' stroke-width='2' fill='none'/></svg>"); }
[data-icon^="tickets"], [data-icon^="ticket"], [data-icon^="helpdesk"], [data-icon^="support"] {
    -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><path d='M2 6a2 2 0 012-2h12a2 2 0 012 2v3a2 2 0 100 2v3a2 2 0 01-2 2H4a2 2 0 01-2-2v-3a2 2 0 100-2V6zm6 1v6' stroke='black' stroke-width='1.5' fill='black' fill-opacity='0.1'/></svg>");
    mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><path d='M2 6a2 2 0 012-2h12a2 2 0 012 2v3a2 2 0 100 2v3a2 2 0 01-2 2H4a2 2 0 01-2-2v-3a2 2 0 100-2V6zm6 1v6' stroke='black' stroke-width='1.5' fill='black' fill-opacity='0.1'/></svg>");
}
[data-icon^="reports"], [data-icon^="report"]              { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><path d='M3 17V8m4 9V4m4 13v-7m4 7V10' stroke='black' stroke-width='2' fill='none'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><path d='M3 17V8m4 9V4m4 13v-7m4 7V10' stroke='black' stroke-width='2' fill='none'/></svg>"); }
[data-icon^="cards"], [data-icon^="payment-method"]        { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><path d='M2 5h16v3H2zm0 5h16v5H2z' fill='black'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><path d='M2 5h16v3H2zm0 5h16v5H2z' fill='black'/></svg>"); }
[data-icon^="voicemail"]                                   { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><circle cx='5' cy='12' r='3' fill='black'/><circle cx='15' cy='12' r='3' fill='black'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><circle cx='5' cy='12' r='3' fill='black'/><circle cx='15' cy='12' r='3' fill='black'/></svg>"); }
[data-icon^="sms"]                                         { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><path d='M2 4h16v10H6l-4 4V4z' fill='black'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><path d='M2 4h16v10H6l-4 4V4z' fill='black'/></svg>"); }
[data-icon^="profile"], [data-icon^="settings"], [data-icon^="my-account"] { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><circle cx='10' cy='7' r='3' fill='black'/><path d='M3 17a7 7 0 0114 0' stroke='black' stroke-width='2' fill='none'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><circle cx='10' cy='7' r='3' fill='black'/><path d='M3 17a7 7 0 0114 0' stroke='black' stroke-width='2' fill='none'/></svg>"); }

/* Fallback dot icon for any unmatched label */
.sidebar__link-icon {
    background: currentColor;
    -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><circle cx='10' cy='10' r='2' fill='black'/></svg>");
    mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><circle cx='10' cy='10' r='2' fill='black'/></svg>");
}
