/* ════════════════════════════════════════════════════════════════════════
   StrataByte Pay — design system
   Brand tokens taken verbatim from stratabyte.co.uk; layouts are original.
   ════════════════════════════════════════════════════════════════════════ */

:root {
    --charcoal:      #1A1A2E;
    --charcoal-mid:  #16213E;
    --charcoal-deep: #0D0D1A;
    --cyan:          #00D4FF;
    --cyan-2:        #00AACC;
    --cyan-dim:      rgba(0, 212, 255, 0.30);
    --cyan-glow:     rgba(0, 212, 255, 0.15);
    --white:         #FFFFFF;
    --grey:          #8892A4;
    --grey-light:    #C4CDD8;
    --card-bg:       rgba(255, 255, 255, 0.035);
    --card-border:   rgba(0, 212, 255, 0.14);
    --line:          rgba(255, 255, 255, 0.07);
    --success:       #4ADE80;
    --warning:       #F5A623;
    --error:         #F87171;
    --radius:        14px;
    --ease:          cubic-bezier(0.4, 0, 0.2, 1);
}

@font-face { font-family:'Rajdhani'; font-weight:500; font-display:optional; src:url('/assets/fonts/rajdhani-500.woff2') format('woff2'); }
@font-face { font-family:'Rajdhani'; font-weight:700; font-display:optional; src:url('/assets/fonts/rajdhani-700.woff2') format('woff2'); }
@font-face { font-family:'Share Tech Mono'; font-weight:400; font-display:swap; src:url('/assets/fonts/share-tech-mono-400.woff2') format('woff2'); }

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Rajdhani', sans-serif;
    background: var(--charcoal);
    color: var(--white);
    line-height: 1.6;
    font-weight: 500;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

/* Subtle brand grid */
.bg-grid::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(0,212,255,0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,212,255,0.025) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
    z-index: 0;
}

a { color: inherit; }
h1, h2, h3, h4 { font-family: 'Rajdhani', sans-serif; font-weight: 700; line-height: 1.15; }

::selection { background: rgba(0,212,255,0.25); }

/* ── Shared atoms ───────────────────────────────────────────────────────── */
.eyebrow {
    font-family: 'Share Tech Mono', monospace;
    font-size: .72rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--cyan);
}
.mono  { font-family: 'Share Tech Mono', monospace; }
.muted { color: var(--grey); }
.grad {
    background: linear-gradient(130deg, var(--cyan) 0%, var(--cyan-2) 45%, #fff 100%);
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}

/* ── Logo ───────────────────────────────────────────────────────────────── */
.logo-wrap { display: inline-flex; align-items: center; text-decoration: none; }
@keyframes blockPulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
.logo-svg { height: 30px; width: auto; display: block; }
.logo-svg text { font-family: 'Rajdhani', sans-serif; font-weight: 700; }
.logo-svg .lg-word { font-size: 20px; letter-spacing: 2px; }   /* matches stratabyte.co.uk wordmark */
.logo-svg .lg-sub { font-size: 9px; fill: var(--grey); }
.logo-svg .lg-grid rect { fill: var(--cyan); animation: blockPulse 2s ease-in-out infinite; }
.logo-svg .lg-grid rect.d { opacity: .3; animation-delay: .4s; }
.auth-wrap .logo-svg { height: 44px; }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    font-family: 'Rajdhani', sans-serif; font-weight: 700; font-size: 1rem;
    letter-spacing: 1px; text-transform: uppercase; text-decoration: none;
    padding: .82rem 1.7rem; border-radius: 8px; border: 1px solid transparent;
    cursor: pointer; transition: background .25s, box-shadow .25s, transform .2s, border-color .25s, color .25s;
    white-space: nowrap;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn svg { width: 1.05em; height: 1.05em; flex-shrink: 0; }
.btn-primary { background: var(--cyan); color: var(--charcoal); }
.btn-primary:hover:not(:disabled) { background: var(--white); box-shadow: 0 0 30px rgba(0,212,255,.4); transform: translateY(-2px); }
.btn-outline { background: transparent; color: var(--white); border-color: rgba(255,255,255,.2); }
.btn-outline:hover:not(:disabled) { border-color: var(--cyan); color: var(--cyan); transform: translateY(-2px); }
.btn-ghost { background: rgba(255,255,255,.04); color: var(--grey-light); border-color: var(--line); padding: .5rem 1rem; font-size: .8rem; }
.btn-ghost:hover:not(:disabled) { color: var(--cyan); border-color: var(--cyan-dim); }
.btn-sm { padding: .4rem .8rem; font-size: .72rem; border-radius: 6px; }
.btn-block { width: 100%; }
.btn-danger { background: rgba(248,113,113,.1); color: var(--error); border: 1px solid rgba(248,113,113,.3); }
.btn-danger:hover:not(:disabled) { background: rgba(248,113,113,.2); }

/* ── Forms ──────────────────────────────────────────────────────────────── */
.field { margin-bottom: 1.1rem; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
label {
    display: block; font-family: 'Share Tech Mono', monospace; font-size: .7rem;
    letter-spacing: 1px; text-transform: uppercase; color: var(--grey-light); margin-bottom: .45rem;
}
input, select, textarea {
    width: 100%; background: rgba(255,255,255,.045); border: 1px solid rgba(255,255,255,.09);
    border-radius: 8px; padding: .72rem 1rem; color: var(--white);
    font-family: 'Rajdhani', sans-serif; font-size: 1rem; font-weight: 500;
    outline: none; transition: border-color .25s, box-shadow .25s; -webkit-appearance: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(0,212,255,.09); }
input::placeholder, textarea::placeholder { color: rgba(255,255,255,.22); }
select { cursor: pointer; }
select option { background: var(--charcoal); }
.input-prefix { position: relative; }
.input-prefix > span { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); color: var(--cyan); font-weight: 700; pointer-events: none; }
.input-prefix input { padding-left: 1.9rem; }
.check-row { display: flex; align-items: center; gap: .55rem; font-family: 'Share Tech Mono', monospace; font-size: .72rem; letter-spacing: .3px; text-transform: none; color: var(--grey-light); margin: .2rem 0 1rem; cursor: pointer; }
.check-row input[type=checkbox] { width: auto; accent-color: var(--cyan); cursor: pointer; margin: 0; }

/* ── Invoice line-item editor ──────────────────────────────────────────── */
.line-items { display: flex; flex-direction: column; gap: .45rem; }
.li-row { display: grid; grid-template-columns: minmax(0,1fr) 58px 116px 76px 32px; gap: .4rem; align-items: center; }
.li-row > input, .li-unit input, .li-tax input { padding: .55rem .6rem; font-size: .9rem; width: 100%; }
.li-row input.li-qty { text-align: center; }
.li-unit { position: relative; display: flex; align-items: center; }
.li-unit > i { position: absolute; left: .6rem; color: var(--cyan); font-style: normal; font-weight: 700; font-size: .85rem; pointer-events: none; }
.li-unit input { padding-left: 1.7rem; }
.li-tax { position: relative; display: flex; align-items: center; }
.li-tax > i { position: absolute; right: .55rem; color: var(--grey); font-style: normal; font-size: .8rem; pointer-events: none; }
.li-tax input { padding-right: 1.2rem; }
.li-del { width: 30px; height: 30px; background: transparent; border: 1px solid var(--line); border-radius: 8px; color: var(--grey); font-size: 1.1rem; line-height: 1; cursor: pointer; padding: 0; justify-self: center; }
.li-del:hover { color: var(--error); border-color: var(--error); }
.line-items-foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: .7rem 0 1rem; }
.line-total { font-family: 'Share Tech Mono', monospace; font-size: .8rem; color: var(--grey); }
.line-total strong { color: var(--cyan); font-size: .95rem; margin-left: .3rem; }
.form-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.form-toggles { display: flex; flex-wrap: wrap; gap: .4rem 1.6rem; margin: .2rem 0 1rem; }
.form-toggles .check-row { margin: 0; }
@media (max-width: 620px) { .form-cols { grid-template-columns: 1fr; } }
#recurring-fields { padding: 1rem; margin-bottom: 1rem; background: rgba(0,212,255,.03); border: 1px solid var(--line); border-radius: 8px; }
#recurring-fields[hidden] { display: none; }
#recurring-fields .field:last-child { margin-bottom: 0; }

/* ── Cards ──────────────────────────────────────────────────────────────── */
.card { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: var(--radius); }
.card-head { padding: 1.1rem 1.4rem; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.card-title { font-family: 'Share Tech Mono', monospace; font-size: .72rem; letter-spacing: 1.5px; text-transform: uppercase; color: var(--grey-light); }
.card-body { padding: 1.4rem; }

/* ── Badges ─────────────────────────────────────────────────────────────── */
.badge {
    display: inline-block; font-family: 'Share Tech Mono', monospace; font-size: .62rem;
    letter-spacing: .08em; text-transform: uppercase; padding: .22rem .55rem; border-radius: 5px; white-space: nowrap;
}
.badge.pending  { color: var(--warning); background: rgba(245,166,35,.1); border: 1px solid rgba(245,166,35,.25); }
.badge.paid     { color: var(--success); background: rgba(74,222,128,.1); border: 1px solid rgba(74,222,128,.25); }
.badge.active   { color: var(--success); background: rgba(74,222,128,.1); border: 1px solid rgba(74,222,128,.25); }
.badge.failed   { color: var(--error);   background: rgba(248,113,113,.1); border: 1px solid rgba(248,113,113,.25); }
.badge.refunded,
.badge.partially_refunded { color: var(--grey-light); background: rgba(196,205,216,.08); border: 1px solid rgba(196,205,216,.2); }
.badge.void,
.badge.cancelled{ color: var(--grey); background: rgba(136,146,164,.1); border: 1px solid rgba(136,146,164,.22); }
.badge.past_due { color: var(--warning); background: rgba(245,166,35,.1); border: 1px solid rgba(245,166,35,.25); }
.badge.trialing { color: var(--cyan); background: rgba(0,212,255,.08); border: 1px solid var(--cyan-dim); }
.badge.disputed { color: var(--error);   background: rgba(248,113,113,.14); border: 1px solid rgba(248,113,113,.4); margin-left: 4px; }
.badge.fraud    { color: var(--warning); background: rgba(245,166,35,.14); border: 1px solid rgba(245,166,35,.4); margin-left: 4px; }

/* ── Billing page ───────────────────────────────────────────────────────── */
.sub-block { display: flex; align-items: center; gap: 1rem; padding: .9rem 0; border-bottom: 1px solid rgba(255,255,255,.06); }
.sub-block:last-child { border-bottom: 0; padding-bottom: 0; }
.sub-block:first-child { padding-top: 0; }
.sub-main { flex: 1 1 auto; min-width: 0; }
.sub-name { font-weight: 600; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.sub-meta { margin-top: .3rem; font-size: .8rem; color: var(--grey-light); display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.sub-meta .dot { opacity: .45; }
.sub-meta .amount { font-weight: 600; color: #fff; }
.sub-meta .per { color: var(--grey); font-weight: 400; }
.pm-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.pm-current { display: inline-flex; align-items: center; gap: .55rem; flex-wrap: wrap; padding: .55rem .85rem; background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.07); border-radius: 8px; }
.pm-brand { display: inline-flex; align-items: center; gap: .5rem; }
#pm-panel { margin-top: 1.1rem; }
.pm-actions { display: flex; gap: .6rem; align-items: center; margin-top: .9rem; }
.addr-3 { display: grid; grid-template-columns: 1.6fr 1fr .8fr; gap: 1rem; }
.bsec { padding: 1.6rem 0; border-top: 1px solid var(--line); }
.bsec:first-child { padding-top: 0; border-top: 0; }
.bsec:last-child { padding-bottom: 0; }
.bsec-head { display: flex; flex-direction: column; gap: .2rem; margin-bottom: 1.1rem; }
.section-gap { margin-top: 1.4rem; }
.link-sm { font-size: .78rem; color: var(--cyan); text-decoration: none; }
.link-sm:hover { text-decoration: underline; }

/* ── Tables ─────────────────────────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table thead th {
    font-family: 'Share Tech Mono', monospace; font-size: .6rem; letter-spacing: .1em;
    text-transform: uppercase; color: var(--grey); text-align: left; font-weight: 400;
    padding: .65rem .9rem; border-bottom: 1px solid var(--line);
}
.table tbody td { padding: .8rem .9rem; border-bottom: 1px solid rgba(255,255,255,.04); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: rgba(0,212,255,.022); }
.table .num { font-family: 'Share Tech Mono', monospace; color: var(--cyan); }
.table .date { font-family: 'Share Tech Mono', monospace; font-size: .72rem; color: var(--grey); }
.sub { display: block; font-size: .75rem; color: var(--grey); }
.empty { text-align: center; padding: 2.5rem; font-family: 'Share Tech Mono', monospace; font-size: .75rem; letter-spacing: .1em; color: rgba(136,146,164,.5); }
.table-scroll { overflow-x: auto; }

/* ── Flash messages ─────────────────────────────────────────────────────── */
.flash { display: flex; flex-direction: column; gap: .6rem; margin-bottom: 1.4rem; }
.flash-item { font-size: .92rem; padding: .75rem 1rem; border-radius: 8px; border: 1px solid; display: flex; gap: .6rem; align-items: center; }
.flash-item.success { color: var(--success); background: rgba(74,222,128,.08); border-color: rgba(74,222,128,.25); }
.flash-item.error   { color: var(--error);   background: rgba(248,113,113,.08); border-color: rgba(248,113,113,.25); }

/* ── KPI cards ──────────────────────────────────────────────────────────── */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1.1rem; margin-bottom: 1.6rem; }
.kpi { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 1.3rem 1.4rem; position: relative; overflow: hidden; }
.kpi::after { content: ''; position: absolute; inset: 0 auto 0 0; width: 3px; background: linear-gradient(var(--cyan), transparent); }
.kpi .k-label { font-family: 'Share Tech Mono', monospace; font-size: .64rem; letter-spacing: 1px; text-transform: uppercase; color: var(--grey); margin-bottom: .55rem; }
.kpi .k-value { font-size: 1.9rem; font-weight: 700; line-height: 1; color: var(--white); }
.kpi .k-value.cyan { color: var(--cyan); }
.kpi .k-sub { font-family: 'Share Tech Mono', monospace; font-size: .66rem; color: var(--grey); margin-top: .5rem; }

/* ════════════════ APP SHELL (portal + admin) ═══════════════════════════ */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; position: relative; z-index: 1; }
.sidebar {
    background: var(--charcoal-deep); border-right: 1px solid var(--line);
    padding: 1.5rem 1rem; display: flex; flex-direction: column; gap: 1.5rem;
    position: sticky; top: 0; height: 100vh;
}
.sidebar .brand { padding: .3rem .6rem 1.2rem; border-bottom: 1px solid var(--line); }
.sidebar .scope { font-family: 'Rajdhani', sans-serif; font-weight: 700; font-size: .66rem; letter-spacing: 1.6px; text-transform: uppercase; color: var(--grey); margin-top: .35rem; display: block; }
.side-nav { display: flex; flex-direction: column; gap: .25rem; flex: 1; }
.side-nav a {
    display: flex; align-items: center; gap: .75rem; padding: .65rem .8rem; border-radius: 9px;
    color: var(--grey-light); text-decoration: none; font-weight: 700; font-size: .92rem;
    letter-spacing: .5px; border-left: 2px solid transparent; transition: background .2s, color .2s;
}
.side-nav a svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .8; }
.side-nav a:hover { background: rgba(0,212,255,.05); color: var(--white); }
.side-nav a.active { background: rgba(0,212,255,.08); color: var(--cyan); border-left-color: var(--cyan); }
.side-foot { border-top: 1px solid var(--line); padding-top: 1rem; }
.user-chip { display: flex; align-items: center; gap: .6rem; padding: .4rem .6rem; margin-bottom: .6rem; }
.user-chip .avatar { width: 32px; height: 32px; border-radius: 8px; background: rgba(0,212,255,.12); border: 1px solid var(--cyan-dim); display: flex; align-items: center; justify-content: center; color: var(--cyan); font-weight: 700; flex-shrink: 0; }
.user-chip .who { min-width: 0; }
.user-chip .who strong { display: block; font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip .who span { font-size: .7rem; color: var(--grey); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }

.nav-toggle { display: none; flex-direction: column; align-items: center; justify-content: center; gap: 4px; width: 42px; height: 42px; background: transparent; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; flex-shrink: 0; }
.nav-toggle span { display: block; width: 18px; height: 2px; background: var(--grey-light); border-radius: 2px; transition: transform .25s ease, opacity .2s ease; }
.sidebar.nav-open .nav-toggle span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.sidebar.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
.sidebar.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.table tr.rowlink { cursor: pointer; }
.table tr.rowlink:hover td { background: rgba(0,212,255,.045); }
.table tr.rowlink:focus-visible { outline: 2px solid var(--cyan); outline-offset: -2px; }

.auth-scope { font-family: 'Rajdhani', sans-serif; font-weight: 700; font-size: .72rem; letter-spacing: 2px; text-transform: uppercase; color: var(--grey); text-align: center; margin: .55rem 0 0; }

.main { padding: 2rem 2.5rem 3rem; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.6rem; }
.page-head h1 { font-size: 1.8rem; letter-spacing: .5px; text-transform: uppercase; }
.page-head .eyebrow { display: block; margin-bottom: .35rem; }
.page-actions { display: flex; gap: .6rem; flex-wrap: wrap; }

.section-gap { margin-top: 1.6rem; }
.grid-2 { display: grid; grid-template-columns: 380px 1fr; gap: 1.4rem; align-items: start; }

/* Mobile: off-canvas drawer sidenav — top bar hamburger + slide-in panel + backdrop */
.mobile-bar { display: none; }
.nav-backdrop { display: none; }
@media (max-width: 900px) {
    .shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; align-content: start; }

    .mobile-bar {
        display: flex; align-items: center; justify-content: flex-start; gap: 1rem;
        height: 54px; box-sizing: border-box;
        position: sticky; top: 0; z-index: 90;
        padding: 0 1rem; background: var(--charcoal-deep);
        border-bottom: 1px solid var(--line);
    }
    .nav-toggle { display: flex; }           /* hamburger sits on the LEFT of the bar */

    /* sidebar → slide-in drawer that starts BELOW the bar so its logo stays visible */
    .sidebar {
        position: fixed; top: 54px; left: 0; height: calc(100dvh - 54px); width: min(82vw, 300px);
        z-index: 80; transform: translateX(-100%);
        transition: transform .28s ease;
        border-right: 1px solid var(--line); border-bottom: none;
        box-shadow: 0 0 60px rgba(0,0,0,.55);
        padding: 1.25rem 1rem 1.4rem; gap: 1.1rem; overflow-y: auto;
    }
    .shell.nav-open .sidebar { transform: translateX(0); }
    .sidebar .brand { display: block; padding: .1rem .4rem 1rem; }
    .side-nav { flex: 1; gap: .2rem; }
    .side-nav a { font-size: .95rem; padding: .8rem .85rem; }
    .side-foot { border-top: 1px solid var(--line); padding-top: 1rem; }

    /* dim backdrop behind the open drawer */
    .nav-backdrop {
        display: block; position: fixed; inset: 0; background: rgba(8,9,18,.6);
        opacity: 0; visibility: hidden; transition: opacity .28s ease; z-index: 75;
    }
    .shell.nav-open .nav-backdrop { opacity: 1; visibility: visible; }

    /* hamburger → X while open */
    .shell.nav-open .nav-toggle span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
    .shell.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
    .shell.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

    .main { padding: 1.4rem 1.05rem 2.5rem; }
    .grid-2 { grid-template-columns: 1fr; }
    .page-head h1 { font-size: 1.5rem; }
    .toolbar input[type=search] { max-width: 100%; }
    .table-scroll { -webkit-overflow-scrolling: touch; }
    .table { min-width: 520px; }          /* dense admin tables scroll horizontally */
    .table-tap { min-width: 0; }          /* portal tables fit; tap a row to open */
    .table-tap .col-hide-sm { display: none; }
}

@media (max-width: 600px) {
    .table { font-size: .82rem; }
    .table thead th { padding: .55rem .55rem; }
    .table tbody td { padding: .6rem .55rem; }
    .page-actions { width: 100%; }
    .page-actions .btn { flex: 1 1 auto; justify-content: center; }
}

/* ════════════════ CHECKOUT ═════════════════════════════════════════════ */
.center-screen { position: relative; z-index: 1; min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2.5rem 1.2rem; }
.orb { position: fixed; border-radius: 50%; filter: blur(90px); pointer-events: none; z-index: 0; }
.orb-1 { width: 560px; height: 560px; background: rgba(0,212,255,.06); top: -160px; right: -140px; animation: breathe 9s ease-in-out infinite; }
.orb-2 { width: 440px; height: 440px; background: rgba(0,212,255,.05); bottom: -140px; left: -100px; animation: breathe 11s ease-in-out infinite reverse; }
@keyframes breathe { 0%,100% { transform: scale(1); opacity: .7; } 50% { transform: scale(1.15); opacity: 1; } }

.checkout {
    position: relative; z-index: 1; width: 100%; max-width: 940px;
    display: grid; grid-template-columns: 1fr 1fr;
    background: var(--charcoal-mid); border: 1px solid var(--card-border);
    border-radius: 20px; overflow: hidden; box-shadow: 0 40px 120px rgba(0,0,0,.45);
}
.checkout.solo { grid-template-columns: 1fr; max-width: 460px; }
.checkout.solo .invoice-side { display: none; }
/* left: invoice document */
.invoice-side { background: var(--charcoal-deep); padding: 2.2rem; display: flex; flex-direction: column; gap: 1.6rem; border-right: 1px solid var(--line); }
.invoice-side .doc-head { display: flex; align-items: center; justify-content: space-between; }
.doc-stamp { font-family: 'Share Tech Mono', monospace; font-size: .62rem; letter-spacing: 1.5px; text-transform: uppercase; color: var(--cyan); border: 1px solid var(--cyan-dim); border-radius: 50px; padding: .25rem .7rem; }
.doc-meta { display: flex; flex-direction: column; gap: .9rem; }
.doc-line { display: flex; justify-content: space-between; gap: 1rem; font-size: .9rem; }
.doc-line .l { font-family: 'Share Tech Mono', monospace; font-size: .64rem; letter-spacing: 1px; text-transform: uppercase; color: var(--grey); }
.doc-line .v { color: var(--white); text-align: right; }
.doc-items { display: flex; flex-direction: column; gap: .55rem; margin-top: .2rem; }
.doc-item { display: flex; justify-content: space-between; gap: 1rem; font-size: .88rem; color: var(--white); }
.doc-item .di-d { color: var(--grey-light); }
.doc-item .di-d .q { color: var(--grey); font-family: 'Share Tech Mono', monospace; font-size: .8em; }
.doc-item .di-a { font-family: 'Share Tech Mono', monospace; color: var(--white); white-space: nowrap; }
.doc-total { margin-top: auto; padding-top: 1.4rem; border-top: 1px dashed rgba(255,255,255,.12); }
.doc-total .l { font-family: 'Share Tech Mono', monospace; font-size: .64rem; letter-spacing: 1.5px; text-transform: uppercase; color: var(--grey); margin-bottom: .3rem; }
.doc-total .amount { font-size: 2.6rem; font-weight: 700; line-height: 1; }
.doc-total .amount .cur { font-size: 1.3rem; color: var(--cyan); vertical-align: super; margin-right: 2px; }
/* right: pay panel */
.pay-side { padding: 2.2rem; display: flex; flex-direction: column; gap: 1.3rem; }
#payment-element { min-height: 44px; }

/* live auto-update indicator (admin tables — replaces the old Refresh button) */
.live-dot { display: inline-flex; align-items: center; gap: .4rem; font-family: 'Share Tech Mono', monospace; font-size: .62rem; letter-spacing: 1px; text-transform: uppercase; color: var(--grey); }
.live-dot::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--success); animation: livepulse 2s ease-in-out infinite; }
@keyframes livepulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(74,222,128,.5); opacity: 1; } 70% { box-shadow: 0 0 0 5px rgba(74,222,128,0); opacity: .65; } }
@media (prefers-reduced-motion: reduce) { .live-dot::before { animation: none; } }
.pay-error { font-family: 'Share Tech Mono', monospace; font-size: .78rem; color: var(--error); min-height: 1em; }
.state { text-align: center; padding: 2.5rem 1rem; display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.state .ic { width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.state .ic.ok { background: rgba(74,222,128,.1); border: 1px solid rgba(74,222,128,.3); color: var(--success); }
.state .ic.err { background: rgba(248,113,113,.1); border: 1px solid rgba(248,113,113,.3); color: var(--error); }
.state h3 { font-size: 1.15rem; letter-spacing: .5px; text-transform: uppercase; }
.state p { font-size: .9rem; color: var(--grey); font-family: 'Share Tech Mono', monospace; line-height: 1.6; }
.dots { display: inline-flex; gap: 5px; }
.dots span { width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); animation: dot .9s ease-in-out infinite; }
.dots span:nth-child(2) { animation-delay: .15s; } .dots span:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%,80%,100% { opacity: .2; transform: scale(.8); } 40% { opacity: 1; transform: scale(1); } }
.spinner { width: 18px; height: 18px; border: 2px solid rgba(0,0,0,.25); border-top-color: var(--charcoal); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.secure-line { display: flex; align-items: center; justify-content: center; gap: .5rem; font-family: 'Share Tech Mono', monospace; font-size: .66rem; letter-spacing: 1px; color: var(--grey); margin-top: .4rem; }
.secure-line svg { color: var(--cyan); width: 13px; height: 13px; flex-shrink: 0; }
.flash-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.state .ic svg { width: 26px; height: 26px; }

@media (max-width: 760px) {
    .checkout { grid-template-columns: 1fr; max-width: 460px; }
    .invoice-side { border-right: none; border-bottom: 1px solid var(--line); }
    .field-row { grid-template-columns: 1fr; }
    .addr-3 { grid-template-columns: 1fr 1fr; }
    .kpi-row { grid-template-columns: 1fr 1fr; }
}

/* ════════════════ AUTH SCREENS ════════════════════════════════════════ */
.auth-wrap { position: relative; z-index: 1; min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2.5rem 1.2rem; gap: 1.6rem; }
.auth-card { width: 100%; max-width: 410px; background: var(--charcoal-mid); border: 1px solid var(--card-border); border-radius: 18px; overflow: hidden; box-shadow: 0 30px 90px rgba(0,0,0,.4); }
.auth-card .head { padding: 1.6rem 1.8rem 1.2rem; border-bottom: 1px solid var(--line); }
.auth-card .head h1 { font-size: 1.4rem; letter-spacing: .5px; text-transform: uppercase; }
.auth-card .head p { color: var(--grey); font-size: .9rem; margin-top: .25rem; }
.auth-card .body { padding: 1.8rem; }
.auth-foot { text-align: center; font-size: .9rem; color: var(--grey); }
.auth-foot a { color: var(--cyan); text-decoration: none; font-weight: 700; }
.auth-foot a:hover { text-decoration: underline; }

/* ── Misc ───────────────────────────────────────────────────────────────── */
.invoice-doc { max-width: 760px; }
.row-actions { display: flex; gap: .4rem; flex-wrap: wrap; justify-content: flex-end; }
.toolbar { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-bottom: 1.2rem; }
.toolbar input[type=search] { max-width: 260px; }
.filter-tabs { display: inline-flex; gap: .3rem; flex-wrap: wrap; }
.filter-tabs a, .filter-tabs button { font-family: 'Share Tech Mono', monospace; font-size: .68rem; letter-spacing: 1px; text-transform: uppercase; color: var(--grey); padding: .35rem .7rem; border: 1px solid var(--line); border-radius: 6px; text-decoration: none; background: transparent; cursor: pointer; transition: color .2s, border-color .2s, background .2s; }
.filter-tabs a:hover, .filter-tabs button:hover { color: var(--grey-light); border-color: var(--cyan-dim); }
.filter-tabs a.active, .filter-tabs button.active { color: var(--cyan); border-color: var(--cyan-dim); background: rgba(0,212,255,.06); }
.spark { display: flex; align-items: flex-end; gap: 6px; height: 60px; }
.spark .bar { flex: 1; background: linear-gradient(var(--cyan), rgba(0,212,255,.15)); border-radius: 3px 3px 0 0; min-height: 3px; position: relative; }
.spark .bar span { position: absolute; bottom: -18px; left: 0; right: 0; text-align: center; font-family: 'Share Tech Mono', monospace; font-size: .58rem; color: var(--grey); }
.result-box { margin-top: 1rem; padding: 1rem; background: rgba(74,222,128,.05); border: 1px solid rgba(74,222,128,.2); border-radius: 8px; display: none; }
.result-box.show { display: block; }
.result-box .lbl { font-family: 'Share Tech Mono', monospace; font-size: .64rem; letter-spacing: 1px; color: var(--success); margin-bottom: .5rem; }
.copy-row { display: flex; gap: .5rem; }
.copy-row input { font-family: 'Share Tech Mono', monospace; font-size: .75rem; }
.form-error-line { font-family: 'Share Tech Mono', monospace; font-size: .75rem; color: var(--error); margin-top: .6rem; min-height: 1em; }

/* ── Invoice "letter" — StrataByte letterhead (white paper) ─────────────── */
.invoice-sheet { max-width: 820px; margin: 0 auto; background: #fff; color: #222433;
  border-radius: 18px; overflow: hidden; box-shadow: 0 18px 50px rgba(0,0,0,.45);
  font-family: 'Rajdhani','Segoe UI',sans-serif; padding: 24px; }

/* shared 3×3 logo grid (odd cells solid, even cells faded) */
.ish-grid { display: grid; grid-template-columns: repeat(3,19px); grid-auto-rows: 19px; gap: 7px; }
.ish-grid span { border-radius: 2px; background: #00D4FF; }
.ish-grid span:nth-child(even) { opacity: .3; }

/* header panel — proportioned to the letter (dark band ≈ 110px, cyan strip ≈ 19px) */
.ish-head { background: #1A1A2E; display: flex; justify-content: space-between; align-items: center;
  gap: 1.5rem; flex-wrap: nowrap; padding: 0 2rem; min-height: 110px; border-radius: 16px 16px 0 0; }
.ish-brand { display: flex; align-items: center; gap: 1.1rem; }
.ish-word { font-weight: 700; font-size: 4.1rem; line-height: 1; letter-spacing: .08em; }
.ish-no { white-space: nowrap; }
.ish-word b { color: #fff; font-weight: 700; }
.ish-word i { color: #00D4FF; font-style: normal; }
.ish-meta { text-align: right; }
.ish-doc { font-size: .72rem; letter-spacing: .35em; text-transform: uppercase; color: #00D4FF; font-weight: 700; }
.ish-no { font-family: ui-monospace,'Share Tech Mono',monospace; color: #fff; font-size: 1.05rem; margin: .2rem 0 .55rem; }
.ish-badge { display: inline-block; padding: .22rem .65rem; border-radius: 999px; font-size: .6rem;
  letter-spacing: .14em; font-weight: 700; color: #fff; }
.ish-badge--paid { background: #006680; }
.ish-badge--pending { background: #3c3e54; }
.ish-badge--refund { background: #966e23; }
.ish-badge--void { background: #4a4d63; }

/* tagline ribbon */
/* slogan strip — fused to the base of the header panel (one masthead), as on the letter */
.ish-ribbon { background: #00D4FF; color: #1A1A2E; font-weight: 700;
  font-size: .6rem; letter-spacing: .4em; text-transform: uppercase;
  display: flex; align-items: center; justify-content: center; min-height: 19px; padding: 0 1rem;
  border-radius: 0 0 16px 16px; }

/* body */
.ish-body { padding: 2rem 1.5rem 1.6rem; position: relative; }
.ish-body > * { position: relative; z-index: 1; }
.ish-mark { position: absolute; inset: 0; z-index: 0; display: flex; align-items: center; justify-content: center;
  pointer-events: none; opacity: .045; }
.ish-mark .ish-grid { grid-template-columns: repeat(3,56px); grid-auto-rows: 56px; gap: 14px; }
.ish-mark .ish-grid span { background: #1A1A2E; border-radius: 7px; }
/* watermark is for the printed letterhead only — hide it in the on-screen invoice */
@media screen { .ish-mark { display: none; } }

.ish-parties { display: flex; justify-content: space-between; gap: 1.5rem; flex-wrap: nowrap; margin-bottom: 1.9rem; }
.ish-dates { flex-shrink: 0; }
.ish-lbl { display: block; text-transform: uppercase; letter-spacing: .18em; font-size: .6rem;
  color: #9498a8; font-weight: 700; margin-bottom: .25rem; }
.ish-to strong { display: block; font-size: 1.15rem; color: #1A1A2E; }
.ish-to { color: #5a5e70; font-size: .92rem; line-height: 1.55; }
.ish-dates { text-align: right; display: flex; flex-direction: column; gap: .7rem; }
.ish-dates b { color: #222433; font-weight: 700; }

.ish-table { width: 100%; border-collapse: collapse; margin-bottom: 1.5rem; }
.ish-table thead th { background: #1A1A2E; color: #fff; text-align: left; font-size: .64rem;
  letter-spacing: .14em; text-transform: uppercase; padding: .65rem .9rem; }
.ish-table thead th:last-child { text-align: right; }
.ish-table tbody td { padding: .9rem; border-bottom: 1px solid #e8eaf0; color: #333; }
.ish-table tbody td.amt { text-align: right; font-family: ui-monospace,'Share Tech Mono',monospace; color: #0096b9; }
.ish-table th.amt { text-align: right; }
.ish-table .ish-qty { text-align: center; white-space: nowrap; width: 1%; }
.ish-table thead th.ish-qty { text-align: center; }

.ish-totals { margin-left: auto; width: 300px; max-width: 100%; }
.ish-totals .row { display: flex; justify-content: space-between; padding: .42rem 0; font-size: .95rem; color: #5a5e70; }
.ish-totals .muted span:last-child { color: #9498a8; }
.ish-totals .grand { border-top: 2px solid #1A1A2E; margin-top: .45rem; padding-top: .75rem;
  font-size: 1.3rem; font-weight: 700; color: #1A1A2E; }
.ish-totals .grand span:last-child { color: #0096b9; font-family: ui-monospace,'Share Tech Mono',monospace; }

.ish-note { margin-top: 1.7rem; padding-top: 1.05rem; border-top: 1px dashed #d4d7e0;
  font-size: .85rem; color: #6a6e80; line-height: 1.7; }

/* footer panel — proportioned to the letter (≈ 105px tall, contacts spread like the SVG) */
.ish-foot { background: #1A1A2E; color: #fff; padding: 0 2rem; min-height: 105px; border-radius: 16px;
  margin-top: 20px; display: flex; flex-direction: column; justify-content: center; gap: .55rem; }
.ish-contacts { display: flex; align-items: center; justify-content: center; gap: 3rem;
  flex-wrap: wrap; font-size: .82rem; }
.ish-c { display: inline-flex; align-items: center; gap: .5rem; }
.ish-ic { width: 15px; height: 15px; flex-shrink: 0; }
.ish-div { width: 1px; height: 18px; background: #00D4FF; opacity: .35; }
.ish-reg { text-align: center; color: #8892A4; font-size: .62rem; letter-spacing: .1em; margin-top: .65rem; }

@media (max-width: 600px) {
  .invoice-sheet { padding: 12px; }
  /* keep the masthead inline (brand left, meta right) — shrink to fit 1 row */
  .ish-head { gap: .5rem; padding: 1rem .8rem; min-height: 0; align-items: center; }
  .ish-brand { gap: .5rem; min-width: 0; }
  .ish-brand .ish-grid { display: none; }   /* drop the grid icon on mobile to give the wordmark its full size */
  .ish-word { font-size: 10.8vw; letter-spacing: .02em; }
  .ish-meta { flex-shrink: 0; }
  .ish-doc { font-size: .54rem; }
  .ish-no { font-size: .72rem; margin: .1rem 0 .3rem; }
  .ish-badge { font-size: .52rem; padding: .16rem .45rem; }
  .ish-ribbon { letter-spacing: .25em; padding: .35rem .9rem; text-align: center; }
  .ish-body { padding: 1.5rem 1.15rem; }
  .ish-parties { flex-direction: column; }
  .ish-dates { text-align: left; }
  .ish-to { word-break: break-word; }
  .ish-totals { width: 100%; margin-left: 0; }
  .ish-note { word-break: break-word; }
  .ish-foot { padding: 1.1rem 1.1rem .9rem; }
  .ish-contacts { flex-direction: column; gap: .55rem; font-size: .82rem; text-align: center; }
  .ish-div { display: none; }
  .ish-table thead th, .ish-table tbody td { padding: .6rem .55rem; }
}

/* ── Print: reproduce the posted docmail letter EXACTLY ───────────────────────
   letter-background.svg (design space, 561pt-wide panels) is printed by Docmail
   via:  printed = 0.9166 × design,  centred with 14.2mm side / 12mm top-bottom
   margins (barcode gap). So the recipient sees these PRINTED sizes:
     masthead 86pt  (dark 73.3pt + cyan slogan 12.8pt)   footer 69.7pt
     corner radius 9pt · wordmark 52pt · slogan 6.9pt/.4em · logo cell 12.8pt gap 4.6pt
     footer text 8.7pt · "Registered" 5.5pt · panels rounded, NOT full-bleed.
   @page margins give the equal white frame; panels = content-box width.          */
@media print {
  .sidebar, .mobile-bar, .nav-backdrop, .page-head, .flash, .no-print { display: none !important; }
  .bg-grid::before, .orb { display: none !important; }
  .shell { display: block !important; min-height: 0 !important; }
  .main { padding: 0 !important; }
  html, body { background: #fff !important; }

  .invoice-sheet {
    max-width: none !important; width: 100% !important; box-shadow: none !important;
    border-radius: 0 !important; padding: 0 !important; margin: 0 !important;
    min-height: 273mm; display: flex; flex-direction: column;          /* 297 − 2×12 */
  }

  /* masthead = dark header (73.3pt) + fused cyan slogan (12.8pt), rounded 9pt */
  .ish-head {
    border-radius: 9pt 9pt 0 0 !important; min-height: 73.3pt; box-sizing: border-box;
    padding: 0 14pt !important; gap: 10pt; flex-wrap: nowrap; align-items: center;
  }
  .ish-grid { grid-template-columns: repeat(3, 12.8pt); grid-auto-rows: 12.8pt; gap: 4.6pt; }
  .ish-grid span { border-radius: 1.8pt; }
  .ish-word { font-size: 44pt; letter-spacing: .08em; line-height: 1; }   /* full-size, fits beside the meta block */
  .ish-meta { flex-shrink: 0; }
  .ish-doc  { font-size: 6.5pt; }
  .ish-no   { font-size: 10pt; margin: .15rem 0 .3rem; }
  .ish-badge { font-size: 5.5pt; padding: .18rem .5rem; }
  .ish-ribbon {
    border-radius: 0 0 9pt 9pt !important; min-height: 12.8pt; box-sizing: border-box;
    padding: 0 !important; display: flex; align-items: center; justify-content: center;
    font-size: 6.9pt; letter-spacing: .4em;
  }

  /* body grows; parties+table stay at top, totals+note drop to the bottom
     (just above the footer) like the letter's closing block */
  .ish-body { flex: 1 0 auto; display: flex; flex-direction: column;
    padding: 22pt 14pt 16pt !important; }
  .ish-totals { margin-top: auto; }

  /* footer = rounded panel (9pt), 69.7pt tall, pinned to page bottom */
  .ish-foot {
    border-radius: 9pt !important; margin: 0 !important; margin-top: auto !important;
    min-height: 69.7pt; box-sizing: border-box; padding: 0 18pt !important;
    display: flex; flex-direction: column; justify-content: center; gap: 6pt;
  }
  .ish-contacts { justify-content: center; width: 100%; gap: 35pt; font-size: 8.7pt; letter-spacing: .03em; }
  .ish-c   { gap: 5pt; }
  .ish-ic  { width: 12pt; height: 12pt; }
  .ish-div { height: 25pt; width: .5pt; opacity: .35; }
  .ish-reg { font-size: 5.5pt; letter-spacing: .08em; margin-top: 4pt; }

  .ish-head, .ish-ribbon, .ish-foot, .ish-table thead th, .ish-grid span,
  .ish-badge, .ish-div, .ish-mark, .ish-ic {
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
  @page { size: A4; margin: 12mm 14.2mm; }
}

/* ── Modal ──────────────────────────────────────────────────────────────── */
.modal[hidden] { display: none; }
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.modal-overlay { position: absolute; inset: 0; background: rgba(5,5,12,.72); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.modal-card { position: relative; z-index: 1; width: 100%; max-width: 440px; background: var(--charcoal-mid); border: 1px solid var(--card-border); border-radius: var(--radius); box-shadow: 0 40px 120px rgba(0,0,0,.5); overflow: hidden; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 1.1rem 1.4rem; border-bottom: 1px solid var(--line); }
.modal-x { background: none; border: none; color: var(--grey); font-size: 1.5rem; line-height: 1; cursor: pointer; width: auto; padding: 0 .2rem; }
.modal-x:hover { color: var(--white); }
.modal-body { padding: 1.4rem; }
.modal-meta { font-family: 'Share Tech Mono', monospace; font-size: .7rem; color: var(--grey); margin: 1rem 0; padding: .9rem 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); line-height: 1.9; }
.modal-actions { display: flex; gap: .5rem; justify-content: space-between; margin-top: 1rem; }

/* ════════════════ Admin Invoices + Subscriptions — overhaul ════════════════
   Balanced data tables, a per-row overflow (⋯) action menu in place of the old
   button pile-up, richer empty states, and a clearer line-item editor.        */

/* card head: stacked title + sub, optional right-hand toolbar */
.card-head .head-l { display: flex; flex-direction: column; gap: .2rem; min-width: 0; }
.card-sub { font-family: 'Share Tech Mono', monospace; font-size: .62rem; letter-spacing: .03em; color: var(--grey); text-transform: none; line-height: 1.4; }
.card-head.stack { flex-direction: column; align-items: stretch; gap: .95rem; }
.card-head.stack .head-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.list-toolbar { display: flex; align-items: center; justify-content: space-between; gap: .7rem 1rem; flex-wrap: wrap; }
.list-toolbar input[type=search] { width: 240px; max-width: 100%; padding: .45rem .8rem; font-size: .82rem; }

/* data tables — tighter, ledger-like, no wrapping on keys */
.data-table thead th { white-space: nowrap; }
.data-table td.num { white-space: nowrap; }
.data-table .date { white-space: nowrap; }
.data-table .cell-name { color: var(--white); font-weight: 700; }
.data-table .amount { font-family: 'Share Tech Mono', monospace; color: var(--cyan); white-space: nowrap; }
.data-table .amount .per { color: var(--grey); font-size: .72em; margin-left: .15rem; }
.data-table .ref-sub { display: block; font-family: 'Share Tech Mono', monospace; font-size: .64rem; color: var(--grey); margin-top: .18rem; letter-spacing: .02em; }
.data-table .desc-cell { color: var(--grey-light); max-width: 320px; }
.data-table th.col-actions, .data-table td.col-actions { width: 1%; white-space: nowrap; text-align: right; padding-right: 1rem; }

/* ⋯ trigger */
.menu-trigger { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; padding: 0; border-radius: 9px; background: rgba(255,255,255,.04); border: 1px solid var(--line); color: var(--grey-light); cursor: pointer; transition: color .2s, border-color .2s, background .2s; }
.menu-trigger:hover, .menu-trigger.open { color: var(--cyan); border-color: var(--cyan-dim); background: rgba(0,212,255,.07); }
.menu-trigger svg { width: 17px; height: 17px; }

/* floating row menu (appended to <body>, position:fixed → never clipped by table scroll) */
.rowmenu { position: fixed; z-index: 200; min-width: 204px; padding: .4rem; background: var(--charcoal-mid); border: 1px solid var(--card-border); border-radius: 12px; box-shadow: 0 24px 64px rgba(0,0,0,.55); animation: rmIn .14s var(--ease); }
.rowmenu[hidden] { display: none; }
@keyframes rmIn { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: none; } }
.rowmenu .mh { font-family: 'Share Tech Mono', monospace; font-size: .56rem; letter-spacing: .14em; text-transform: uppercase; color: var(--grey); padding: .35rem .55rem .4rem; }
.rowmenu button { display: flex; align-items: center; gap: .65rem; width: 100%; padding: .55rem .6rem; background: none; border: 0; border-radius: 8px; color: var(--grey-light); font-family: 'Rajdhani', sans-serif; font-weight: 700; font-size: .9rem; letter-spacing: .4px; text-align: left; cursor: pointer; transition: background .15s, color .15s; }
.rowmenu button:hover { background: rgba(0,212,255,.08); color: var(--cyan); }
.rowmenu button svg { width: 16px; height: 16px; flex-shrink: 0; opacity: .85; }
.rowmenu .sep { height: 1px; margin: .35rem .3rem; background: var(--line); }
.rowmenu .danger { color: var(--error); }
.rowmenu .danger:hover { background: rgba(248,113,113,.1); color: var(--error); }

/* richer empty / loading / error state inside a table card */
.state-box { display: flex; flex-direction: column; align-items: center; gap: .7rem; padding: 3.2rem 1.5rem; text-align: center; }
.state-box svg { width: 30px; height: 30px; color: var(--grey); opacity: .5; }
.state-box.loading svg { animation: spin 1.1s linear infinite; opacity: .7; }
.state-box .st-t { font-family: 'Share Tech Mono', monospace; font-size: .76rem; letter-spacing: .08em; color: var(--grey-light); }
.state-box .st-s { font-size: .9rem; color: var(--grey); max-width: 300px; line-height: 1.5; }

/* line-item editor: column header labels + framing */
.line-items-head { display: grid; grid-template-columns: minmax(0,1fr) 58px 116px 76px 32px; gap: .4rem; padding: 0 .15rem .35rem; }
.line-items-head span { font-family: 'Share Tech Mono', monospace; font-size: .56rem; letter-spacing: .09em; text-transform: uppercase; color: var(--grey); }
.line-items-head .lih-qty, .line-items-head .lih-tax { text-align: center; }
.line-items-head .lih-unit { text-align: left; }
@media (max-width: 620px) { .line-items-head { display: none; } }

@media (max-width: 600px) {
  .list-toolbar input[type=search] { width: 100%; }
  .card-head.stack .head-row { flex-wrap: wrap; }
}

/* ════════════════ Billing console — list-as-hero ══════════════════════════
   Signature: a mono "billing readout" strip with a truthful collected gauge.
   Create flows live in a right-hand slide-over drawer behind a + New button. */

.head-r { display: flex; align-items: center; gap: 1rem; flex-shrink: 0; }

/* ── Summary readout strip (signature element) ───────────────────────────── */
.summary-strip {
  display: grid; grid-template-columns: minmax(160px,auto) 1fr minmax(160px,auto);
  align-items: center; gap: 0;
  background: linear-gradient(180deg, rgba(255,255,255,.045), rgba(255,255,255,.012));
  border: 1px solid var(--card-border); border-radius: var(--radius);
  padding: 1.25rem 0; margin-bottom: 1.4rem; position: relative; overflow: hidden;
}
.summary-strip::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: linear-gradient(var(--cyan), transparent); }
.summary-strip.trio { grid-template-columns: repeat(3, 1fr); }
.ss-cell { display: flex; flex-direction: column; gap: .4rem; min-width: 0; padding: 0 1.6rem; }
.ss-cell + .ss-cell, .summary-strip > .ss-gauge + .ss-cell, .ss-gauge { border-left: 1px solid var(--line); }
.ss-gauge { padding: 0 1.8rem; }
.ss-label { font-family: 'Share Tech Mono', monospace; font-size: .6rem; letter-spacing: .16em; text-transform: uppercase; color: var(--grey); }
.ss-fig { font-family: 'Share Tech Mono', monospace; font-size: 1.85rem; line-height: 1; font-weight: 400; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.ss-fig.amber { color: var(--warning); } .ss-fig.cyan { color: var(--cyan); } .ss-fig.white { color: var(--white); }
.ss-sub { font-family: 'Share Tech Mono', monospace; font-size: .64rem; color: var(--grey); letter-spacing: .02em; }
.ss-gauge .g-top { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: .55rem; }
.ss-gauge .g-top .gl { font-family: 'Share Tech Mono', monospace; font-size: .6rem; letter-spacing: .16em; text-transform: uppercase; color: var(--grey); }
.ss-gauge .g-top .gp { font-family: 'Share Tech Mono', monospace; font-size: 1.05rem; color: var(--cyan); font-variant-numeric: tabular-nums; }
.ss-track { position: relative; height: 9px; border-radius: 6px; background: rgba(255,255,255,.05); border: 1px solid var(--line); overflow: hidden; }
.ss-fill { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 6px; background: linear-gradient(90deg, var(--cyan-2), var(--cyan)); box-shadow: 0 0 18px rgba(0,212,255,.45); transition: width 1.05s var(--ease); }
.ss-gauge .g-foot { margin-top: .5rem; }
@media (max-width: 760px) {
  .summary-strip, .summary-strip.trio { grid-template-columns: 1fr; padding: .4rem 0; }
  .ss-cell, .ss-gauge { padding: 1rem 1.4rem; border-left: 0 !important; border-top: 1px solid var(--line); }
  .summary-strip > *:first-child { border-top: 0; }
}

/* ── Denser ledger tables — cluster the figures, don't float them ────────── */
.data-table tbody td { padding: .72rem .9rem; }
.data-table td.tight, .data-table th.tight { width: 1%; white-space: nowrap; }
.data-table td.amount.r, .data-table th.amount-h.r { text-align: right; }
.data-table th.amount-h, .data-table td.amount { padding-right: 1.4rem; }

/* ── Slide-over drawer (create flows) ────────────────────────────────────── */
.drawer { position: fixed; inset: 0; z-index: 120; }
.drawer[hidden] { display: none; }
.drawer-overlay { position: absolute; inset: 0; background: rgba(5,5,12,.74); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); opacity: 0; transition: opacity .3s var(--ease); }
.drawer.open .drawer-overlay { opacity: 1; }
.drawer-panel { position: absolute; top: 0; right: 0; height: 100vh; height: 100dvh; width: min(560px, 100%); display: flex; flex-direction: column; background: var(--charcoal-mid); border-left: 1px solid var(--card-border); box-shadow: -34px 0 90px rgba(0,0,0,.55); transform: translateX(100%); transition: transform .34s var(--ease); }
.drawer.open .drawer-panel { transform: none; }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 1.6rem 1.7rem 1.25rem; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.drawer-head h2 { font-size: 1.35rem; letter-spacing: .5px; text-transform: uppercase; }
.drawer-head .eyebrow { display: block; margin-bottom: .3rem; }
.drawer-body { padding: 1.7rem; overflow-y: auto; flex: 1; }
.drawer-body .field { margin-bottom: .95rem; }
@media (prefers-reduced-motion: reduce) { .drawer-panel { transition: none; } }

:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
