/* ========================================
   HANK_ARSE — customer web chrome
   Canonical Hank cyan-dark theme (control-plane cell B1)

   The :root design tokens below are copied VERBATIM from claim-cleaner's app.css
   (the canonical Hank cyan palette) so every Hank customer surface shares one set
   of colors, type, and spacing. The chrome that follows (.app-header / .brand /
   .release-badge / .meta / .app-footer + the anonymous-landing, credit-bar, and
   rate-banner foundations the later cells use) is built on those tokens.
   ======================================== */

:root {
    /* Core palette */
    --bg-primary: #0a0e14;
    --bg-secondary: #0f1419;
    --bg-elevated: #151b23;
    --bg-card: #1a222d;

    /* Text colors */
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #484f58;

    /* Accent colors */
    --accent-cyan: #00d9ff;
    --accent-cyan-dim: rgba(0, 217, 255, 0.15);
    --accent-cyan-glow: rgba(0, 217, 255, 0.4);
    --accent-success: #00f5a0;
    --accent-success-dim: rgba(0, 245, 160, 0.15);
    --accent-error: #ff6b6b;
    --accent-error-dim: rgba(255, 107, 107, 0.15);
    --accent-warning: #ffd93d;
    --accent-warning-dim: rgba(255, 217, 61, 0.15);

    /* Borders */
    --border-subtle: #21262d;
    --border-default: #30363d;
    --border-emphasis: #484f58;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.6);
    --shadow-glow-cyan: 0 0 20px rgba(0, 217, 255, 0.3);
    --shadow-glow-success: 0 0 20px rgba(0, 245, 160, 0.3);
    --shadow-glow-error: 0 0 20px rgba(255, 107, 107, 0.3);

    /* Typography */
    --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', monospace;
    --font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
}

/* ========================================
   BASE RESET + BODY
   Full-bleed: body carries NO padding so the header + footer span edge-to-edge
   (the cell-B1 "header AND footer full-bleed, no app-wide max-width" rule). Only
   the content area (.web-content) is inset.
   ======================================== */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

/* Subtle film-grain overlay — part of claim-cleaner's canonical look. */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    opacity: 0.03;
    pointer-events: none;
    z-index: 9999;
}

h1, h2, h3, h4 {
    font-family: var(--font-mono);
    font-weight: 600;
    letter-spacing: -0.02em;
}

a {
    color: var(--accent-cyan);
    text-decoration: none;
    transition: color 0.2s ease;
}
a:hover {
    color: var(--text-primary);
    text-shadow: 0 0 10px var(--accent-cyan-glow);
}

/* ========================================
   APP HEADER (canonical Hank chrome)
   ======================================== */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-default);
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.brand {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 18px;
    letter-spacing: 0.04em;
}
.brand .logo-1 { color: var(--text-primary); }
.brand .logo-mark {
    color: var(--accent-cyan);
    text-shadow: 0 0 30px var(--accent-cyan-glow);
}
.brand .logo-2 { color: var(--text-primary); }
.brand .brand-sub {
    margin-left: 12px;
    padding: 2px 8px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    background: var(--accent-cyan-dim);
    color: var(--accent-cyan);
    border: 1px solid var(--accent-cyan);
    border-radius: 2px;
}

/* Release/beta tag — canonical Hank treatment (shared across every service + the
   console): a small italic lowercase "beta" in the brand cyan, floating just above
   the top-right of the wordmark, hugging the name. NOT a rectangle. font-size is
   relative to .brand so it scales with the wordmark; position + top is a visual lift
   only (stays in flow → never overlaps the meta cluster). */
.brand .release-badge {
    font-family: var(--font-mono);
    font-style: italic;
    font-weight: 600;
    font-size: .5em;
    letter-spacing: .02em;
    text-transform: lowercase;
    text-decoration: none;
    color: var(--accent-cyan);
    text-shadow: 0 0 9px var(--accent-cyan-glow);
    position: relative;
    top: -.9em;
    margin-left: .16em;
}
.brand .release-badge:hover { text-shadow: 0 0 14px var(--accent-cyan-glow); }

.meta {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
    flex-wrap: wrap;
}
.pill {
    font-family: var(--font-mono);
    font-size: 11px;
    padding: 4px 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.pill.backend { color: var(--accent-success); border-color: var(--accent-success); }
.pill.link { color: var(--accent-cyan); border-color: var(--accent-cyan); }
.pill.logout {
    color: var(--accent-error);
    border-color: var(--accent-error);
    background: transparent;
    cursor: pointer;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.pill.logout:hover { background: var(--accent-error-dim); }
.pill.login {
    color: var(--accent-success);
    border-color: var(--accent-success);
    background: transparent;
    cursor: pointer;
}
.pill.login:hover { background: var(--accent-success-dim); }

/* ========================================
   CONTENT AREA
   The only inset region (header + footer are full-bleed). flex:1 pins the footer
   to the bottom on short pages.
   ======================================== */
.web-content {
    flex: 1 0 auto;
    padding: var(--space-xl) clamp(16px, 4vw, 32px);
}

/* ========================================
   AUTH-STATE / FOUC (control-plane cell B3)
   The shell ships <body class="auth-pending …">. ``auth-pending`` hides BOTH the app and
   the anonymous landing (header only) until app.js confirms the server-baked state and
   removes the class LAST — so the page never flashes the wrong content. ``body.anon`` then
   hides the app (the landing's own visibility is the server-baked ``hidden`` attribute,
   maintained idempotently by app.js). See base.html's <noscript> for the JS-disabled path.
   ======================================== */
body.auth-pending #customer-app,
body.auth-pending #anon-landing { display: none !important; }

/* ========================================
   ANONYMOUS LANDING (control-plane cell B4)
   body.anon hides the app; the sign-in card is the only thing shown.

   NOTE: ``.anon-landing`` deliberately sets NO ``display`` so the section's gating keeps
   working — the UA ``[hidden]`` rule (signed-in), ``body.auth-pending`` (boot veil), and the
   ``body.anon`` reveal all rely on the default block flow here, not an author override. The
   visual treatment lives on the inner ``.anon-card``, which is what gets elevated.
   ======================================== */
body.anon #customer-app { display: none !important; }
.anon-landing {
    margin: 9vh auto 0;
    padding: 0 1.5rem;
    text-align: center;
}
.anon-card {
    max-width: 560px;
    margin: 0 auto;
    padding: clamp(28px, 5vw, 44px) clamp(22px, 5vw, 40px);
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: 4px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}
.anon-title { font-size: 1.9rem; color: var(--text-primary); margin: 0 0 14px; }
.anon-sub { color: var(--text-secondary); font-size: 15px; line-height: 1.65; margin: 0 0 22px; }

/* Value-prop pipeline strip — a visual echo of the one-line prop (ingest → structure →
   remit). Decorative chips on the elevated tokens; the arrows are aria-hidden. */
.anon-pipeline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0 0 28px;
}
.anon-step {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-secondary);
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: 3px;
    padding: 5px 10px;
}
.anon-arrow { color: var(--accent-cyan); font-size: 13px; }

.anon-actions { display: flex; gap: 16px; justify-content: center; align-items: center; flex-wrap: wrap; }
.anon-actions .btn-primary {
    padding: 11px 24px;
    font-family: var(--font-mono);
    font-size: 14px;
    cursor: pointer;
    color: var(--bg-primary);
    background: var(--accent-cyan);
    border: 1px solid var(--accent-cyan);
    border-radius: 2px;
}
.anon-actions .btn-primary:hover { box-shadow: 0 0 14px var(--accent-cyan-glow); }
.anon-actions .btn-link { color: var(--accent-cyan); font-size: 13px; text-decoration: none; }
.anon-actions .btn-link:hover { text-decoration: underline; }
/* Keyboard focus is visible on both the real <button> and the <a> links (accessibility). */
.anon-card a:focus-visible,
.anon-actions .btn-primary:focus-visible {
    outline: 2px solid var(--accent-cyan);
    outline-offset: 2px;
}
.anon-note { margin-top: 30px; color: var(--text-secondary); font-size: 12.5px; line-height: 1.7; }
.anon-note a { color: var(--accent-cyan); text-decoration: none; }
.anon-note a:hover { text-decoration: underline; }

/* ========================================
   FOOTER (canonical two-row build + legal strip)
   ======================================== */
.app-footer {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 14px 24px;
    margin-top: var(--space-xl);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-default);  /* mirrors header's border-bottom */
    flex-shrink: 0;
}
.footer-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-sm);
}
.footer-legal {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
}
.footer-copy { color: var(--text-muted); }
.footer-sep { color: var(--text-muted); }
.footer-link { color: var(--accent-cyan); text-decoration: none; }
.footer-link:hover { color: var(--text-primary); text-shadow: 0 0 10px var(--accent-cyan-glow); }

@media (max-width: 900px) {
    .app-header { flex-direction: column; align-items: flex-start; gap: var(--space-sm); }
    .app-footer { padding: 12px 16px; }
    .footer-row { gap: 6px; }
}

/* ========================================
   CREDIT USAGE BAR + RATE-LIMIT AFFORDANCE (foundation — the B6 cell drives these)
   ======================================== */
.pill.credits {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--accent-cyan);
    border-color: var(--accent-cyan);
}
.pill.credits .credit-bar {
    width: 54px;
    height: 6px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: 3px;
    overflow: hidden;
}
.pill.credits .credit-fill {
    display: block;
    height: 100%;
    width: 0%;
    background: var(--accent-cyan);
    box-shadow: 0 0 8px var(--accent-cyan-glow);
    transition: width 0.4s ease;
}
.pill.credits .credit-word { font-size: 11px; letter-spacing: 0.06em; opacity: 0.75; }
.pill.credits .credit-label { font-size: 11px; letter-spacing: 0.06em; }
/* Amber warning tier — 80–99% of the plan's credits used (B6: accent < 80% < amber < red). */
.pill.credits.warn {
    color: var(--accent-warning);
    border-color: var(--accent-warning);
}
.pill.credits.warn .credit-fill {
    background: var(--accent-warning);
    box-shadow: 0 0 8px var(--accent-warning-dim);
}
.pill.credits.over {
    color: var(--accent-error);
    border-color: var(--accent-error);
    cursor: pointer;  /* over-limit → the pill is an upgrade nudge (app.js wires the click) */
}
.pill.credits.over .credit-fill {
    background: var(--accent-error);
    box-shadow: 0 0 8px var(--accent-error-dim);
    width: 100% !important;
}

.rate-banner {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.04em;
    color: var(--accent-warning);
    background: var(--accent-warning-dim);
    border-bottom: 1px solid var(--accent-warning);
    padding: 8px 16px;
    text-align: center;
}
.rate-banner.over-credits {
    color: var(--accent-error);
    background: var(--accent-error-dim);
    border-bottom-color: var(--accent-error);
}

/* ========================================
   CUSTOMER DOCUMENT APP (control-plane cell B5)
   The signed-in central panel: an in-app nav swapping three views (Upload / My
   documents / Job detail), built on the canonical cyan-dark tokens. Shown only when
   signed in (``body`` not ``.anon``, not ``.auth-pending``); the views toggle via the
   ``[hidden]`` attribute managed by app.js (initCustomerApp).
   ======================================== */
.customer-app {
    max-width: 880px;
    margin: 0 auto;
    width: 100%;
}
/* A view the in-app router has swapped out. ``[hidden]`` is the single source of
   truth for which view shows; this just makes the attribute load-bearing against any
   default display. */
.app-view[hidden] { display: none !important; }

/* In-app nav (tab strip). The active tab is marked with aria-current="page". */
.app-nav {
    display: flex;
    gap: var(--space-sm);
    border-bottom: 1px solid var(--border-default);
    margin-bottom: var(--space-lg);
    flex-wrap: wrap;
}
.app-nav-btn {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-secondary);
    background: transparent;
    border: 0;
    border-bottom: 2px solid transparent;
    padding: 10px 6px;
    margin-bottom: -1px;
    cursor: pointer;
}
.app-nav-btn:hover { color: var(--text-primary); }
.app-nav-btn[aria-current="page"] {
    color: var(--accent-cyan);
    border-bottom-color: var(--accent-cyan);
}
.app-nav-btn:focus-visible { outline: 2px solid var(--accent-cyan); outline-offset: 2px; }

.view-title { font-size: 1.4rem; color: var(--text-primary); margin: 0 0 6px; }
.view-sub { color: var(--text-secondary); font-size: 14px; line-height: 1.6; margin: 0 0 var(--space-lg); }
.view-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
    flex-wrap: wrap;
}
.view-head .view-title { margin: 0; }

/* Shared buttons used across the app views. */
.btn-primary {
    font-family: var(--font-mono);
    font-size: 13px;
    padding: 10px 20px;
    cursor: pointer;
    color: var(--bg-primary);
    background: var(--accent-cyan);
    border: 1px solid var(--accent-cyan);
    border-radius: 2px;
}
.btn-primary:hover { box-shadow: 0 0 14px var(--accent-cyan-glow); }
.btn-primary:focus-visible { outline: 2px solid var(--accent-cyan); outline-offset: 2px; }
.btn-ghost {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.04em;
    padding: 6px 14px;
    cursor: pointer;
    color: var(--accent-cyan);
    background: transparent;
    border: 1px solid var(--border-default);
    border-radius: 2px;
}
.btn-ghost:hover { border-color: var(--accent-cyan); }
.btn-ghost:focus-visible { outline: 2px solid var(--accent-cyan); outline-offset: 2px; }
.btn-back { margin-bottom: var(--space-md); }

/* ---- Upload view ---- */
.dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 200px;
    padding: var(--space-xl);
    text-align: center;
    border: 2px dashed var(--border-emphasis);
    border-radius: 6px;
    background: var(--bg-secondary);
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}
.dropzone:hover { border-color: var(--accent-cyan); }
.dropzone:focus-visible { outline: 2px solid var(--accent-cyan); outline-offset: 2px; }
.dropzone.dragover {
    border-color: var(--accent-cyan);
    background: var(--accent-cyan-dim);
    box-shadow: var(--shadow-glow-cyan);
}
.dropzone.busy { opacity: 0.6; pointer-events: none; }
.dropzone-icon {
    font-family: var(--font-mono);
    font-size: 28px;
    color: var(--accent-cyan);
    text-shadow: 0 0 18px var(--accent-cyan-glow);
}
.dropzone-primary { font-size: 15px; color: var(--text-primary); }
.dropzone-browse { color: var(--accent-cyan); text-decoration: underline; }
.dropzone-hint {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}
/* The native input is driven by the label/dropzone; keep it out of the layout but
   still focusable/operable (not display:none, which would drop it from the a11y tree). */
.dropzone-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}
.upload-status {
    margin-top: var(--space-md);
    padding: 12px 16px;
    border-radius: 4px;
    font-size: 14px;
    border: 1px solid var(--border-default);
    background: var(--bg-card);
    color: var(--text-secondary);
}
.upload-status.ok { border-color: var(--accent-success); color: var(--accent-success); }
.upload-status.error { border-color: var(--accent-error); color: var(--accent-error); }

/* ---- My documents view ---- */
.docs-status {
    padding: 10px 14px;
    border-radius: 4px;
    font-size: 13px;
    color: var(--text-secondary);
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    margin-bottom: var(--space-md);
}
.docs-status.error { border-color: var(--accent-error); color: var(--accent-error); }
.docs-empty {
    text-align: center;
    color: var(--text-secondary);
    padding: var(--space-xl) var(--space-md);
}
.docs-empty p { margin: 0 0 var(--space-md); font-size: 15px; }
.docs-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.doc-row {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    width: 100%;
    text-align: left;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: 4px;
    cursor: pointer;
    color: var(--text-primary);
    font-family: inherit;
}
.doc-row:hover { border-color: var(--accent-cyan); box-shadow: var(--shadow-sm); }
.doc-row:focus-visible { outline: 2px solid var(--accent-cyan); outline-offset: 2px; }
.doc-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.doc-id { font-family: var(--font-mono); font-size: 13px; color: var(--text-primary); }
.doc-sub {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}
.doc-review {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--accent-warning);
}

/* Status badges — one per file processing status. */
.badge {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 3px 9px;
    border-radius: 999px;
    border: 1px solid currentColor;
    white-space: nowrap;
    flex-shrink: 0;
}
.badge-queued { color: var(--text-secondary); }
.badge-processing { color: var(--accent-cyan); }
.badge-done { color: var(--accent-success); }
.badge-partial { color: var(--accent-warning); }
.badge-error { color: var(--accent-error); }

/* ---- Job detail view ---- */
.job-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    flex-wrap: wrap;
    margin-bottom: var(--space-lg);
}
.job-file-id { font-family: var(--font-mono); font-size: 15px; color: var(--text-primary); }
.job-meta { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); letter-spacing: 0.04em; }
.job-section { margin-bottom: var(--space-xl); }
.job-section-title {
    font-size: 0.78rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin: 0 0 var(--space-md);
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-subtle);
}

/* Pipeline progress — fixed stages light up as envelope events arrive over the WS. */
.job-progress { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.stage {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid var(--border-default);
    color: var(--text-muted);
    background: var(--bg-secondary);
}
.stage::before { content: '○'; font-size: 12px; }
.stage[data-state="active"] {
    color: var(--accent-cyan);
    border-color: var(--accent-cyan);
    box-shadow: var(--shadow-glow-cyan);
}
.stage[data-state="active"]::before { content: '◔'; }
.stage[data-state="done"] { color: var(--accent-success); border-color: var(--accent-success); }
.stage[data-state="done"]::before { content: '●'; }
.stage[data-state="error"] { color: var(--accent-error); border-color: var(--accent-error); }
.stage[data-state="error"]::before { content: '×'; }

/* Extracted tree — patients / documents / claims. Every value is textContent. */
.job-result { display: flex; flex-direction: column; gap: var(--space-md); }
.tree-empty, .job-note { color: var(--text-secondary); font-size: 14px; }
.job-note.error { color: var(--accent-error); }
.tree-group { }
.tree-group-title {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--accent-cyan);
    margin: 0 0 8px;
}
.tree-card {
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: 4px;
    padding: 12px 16px;
    margin-bottom: 8px;
}
.tree-card-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}
.tree-card-title { font-family: var(--font-mono); font-size: 13px; color: var(--text-primary); }
.tree-card-tag {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.kv { display: grid; grid-template-columns: minmax(120px, max-content) 1fr; gap: 4px 14px; font-size: 13px; }
.kv-key {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.kv-val { color: var(--text-primary); word-break: break-word; }

/* Remittances + download. */
.job-remittances { display: flex; flex-direction: column; gap: var(--space-md); }
.remit {
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: 4px;
    padding: 12px 16px;
}
.remit-head {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    flex-wrap: wrap;
    margin-bottom: 8px;
}
.remit-title { font-family: var(--font-mono); font-size: 13px; color: var(--text-primary); flex: 1; min-width: 0; }
.remit-state {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 3px 9px;
    border-radius: 999px;
    border: 1px solid currentColor;
}
.remit-state.held { color: var(--accent-warning); }
.remit-state.released, .remit-state.auto_released { color: var(--accent-success); }
.remit-state.rejected { color: var(--accent-error); }
.btn-download {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 6px 14px;
    cursor: pointer;
    color: var(--accent-cyan);
    background: transparent;
    border: 1px solid var(--accent-cyan);
    border-radius: 2px;
}
.btn-download:hover { background: var(--accent-cyan-dim); }
.btn-download:focus-visible { outline: 2px solid var(--accent-cyan); outline-offset: 2px; }

/* Raw I/O developer drawer (claim-cleaner pattern). Collapsed by default. */
.raw-io { margin-bottom: 10px; border: 1px solid var(--border-subtle); border-radius: 4px; }
.raw-io > summary {
    cursor: pointer;
    padding: 10px 14px;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    list-style-position: inside;
}
.raw-io > summary:hover { color: var(--text-primary); }
.copy-raw {
    margin-left: 10px;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 2px 8px;
    cursor: pointer;
    color: var(--accent-cyan);
    background: transparent;
    border: 1px solid var(--border-default);
    border-radius: 2px;
}
.copy-raw:hover { border-color: var(--accent-cyan); }
.raw-pre {
    margin: 0;
    padding: 12px 14px;
    border-top: 1px solid var(--border-subtle);
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    max-height: 360px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

@media (max-width: 640px) {
    .kv { grid-template-columns: 1fr; gap: 2px 0; }
    .kv-key { margin-top: 6px; }
}

/* ========================================
   SCROLLBAR + SELECTION (canonical)
   ======================================== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--border-emphasis); border-radius: 0; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-cyan); }

::selection {
    background: var(--accent-cyan);
    color: var(--bg-primary);
}
