/* style.css — theme design system, plain CSS. */

/* Tokens — dark "HTB-like": deep navy surfaces, neon green accent with DARK
   text on primary buttons (--color-primary-fg). In this dark palette the -600/
   -700 steps run BRIGHTER than -500 where they color text on dark grounds. */
:root {
    /* Brand (neon green). RGB triplet without rgb()/commas → opacity via rgb(var(--x) / 0.5). */
    --color-primary-50: 32 46 31;    /* dark green tint (selected/hover fills) */
    --color-primary-100: 38 55 35;
    --color-primary-200: 48 69 42;
    --color-primary-500: 159 239 0;  /* #9fef00 */
    --color-primary-600: 142 214 0;  /* button hover (slightly deeper) */
    --color-primary-700: 197 244 103;/* readable light-green text on dark fills */
    --color-primary-900: 220 250 160;
    --color-primary-fg: 20 29 43;    /* dark navy text on neon buttons */

    /* Sidebar */
    --color-sidebar: 26 35 50;       /* #1a2332 */
    --color-sidebar-fg: 255 255 255;

    /* Page backgrounds */
    --color-page: 20 29 43;          /* #141d2b */
    --color-page-public: 20 29 43;

    /* Surfaces and UI grays (navy scale) */
    --color-surface: 26 35 50;       /* #1a2332 cards/header */
    --color-surface-muted: 33 44 62; /* soft backgrounds: readout, thead, hover, light code */
    --color-border: 62 75 95;
    --color-border-soft: 42 53 71;
    --color-text: 255 255 255;
    --color-text-soft: 164 177 205;  /* #a4b1cd */
    --color-text-muted: 108 122 148;

    /* Shape */
    --radius: 0.5rem;
    --radius-control: 0.375rem;
    --radius-pill: 9999px;
    --shadow-card: none;
    --shadow-control: none;
    --shadow-menu: 0 8px 24px rgba(0, 0, 0, 0.45);
    /* Typography: tenants override only this var (plus their own @font-face for web fonts). */
    --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Base */
body {
    min-height: 100vh;
    margin: 0;
    display: flex;
    flex-direction: column; /* public by default; .app--auth → row */
    background: rgb(var(--color-page-public));
    color: rgb(var(--color-text));
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
}
/* Form controls don't inherit body font-family by default; force it. */
button, input, select, textarea { font-family: inherit; }
body.app--auth {
    flex-direction: row;
    background: rgb(var(--color-page));
}

/* Auth/public visibility (.hidden is toggled on the ui-*-only elements). */
.hidden { display: none !important; }
[x-cloak] { display: none !important; }

* { box-sizing: border-box; }
img { max-width: 100%; }

/* Layout (app shell) */

/* Mobile sidebar overlay */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 30;
}
@media (min-width: 1024px) { .overlay { display: none; } }

/* Sidebar */
.sidebar {
    position: fixed;
    inset-block: 0;
    left: 0;
    z-index: 40;
    width: 240px;
    min-height: 100vh;
    background: rgb(var(--color-sidebar));
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transform: translateX(-100%);
    transition: transform 0.2s;
}
.sidebar.is-open { transform: translateX(0); }
@media (min-width: 1024px) { .sidebar { transform: translateX(0); } }

.sidebar-logo {
    height: 4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0 1.25rem;
}
.sidebar-logo img { height: 2rem; object-fit: contain; }
.sidebar-brand {
    font-size: 1.125rem;
    font-weight: 700;
    color: rgb(var(--color-sidebar-fg));
    letter-spacing: -0.025em;
}

.nav {
    flex: 1;
    padding: 0.5rem 0.75rem 0;
    overflow-y: auto;
}
.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 7px 0.75rem;
    margin-bottom: 2px;
    border-radius: var(--radius-control);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    color: rgb(var(--color-sidebar-fg) / 0.5);
    transition: all 0.15s;
    cursor: pointer;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
}
.nav-link:hover { color: rgb(var(--color-sidebar-fg)); background: rgb(var(--color-sidebar-fg) / 0.06); }
.nav-link.is-active { color: rgb(var(--color-primary-500)); background: rgb(var(--color-primary-500) / 0.08); }
.nav-link svg, .nav-link i { width: 1rem; height: 1rem; flex-shrink: 0; opacity: 0.7; }

.sidebar-logout { padding: 0 0.75rem 0.75rem; }
@media (min-width: 1024px) { .sidebar-logout { display: none; } }

/* Main wrapper */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
@media (min-width: 1024px) {
    body.app--auth .main-wrapper { margin-left: 240px; }
}

/* Header */
.header {
    background: rgb(var(--color-surface));
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 20;
}
.header--auth {
    height: 2.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
}
.header--public { width: 100%; }
.header-inner {
    max-width: 72rem;
    margin: 0 auto;
    width: 100%;
    height: 3.5rem;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
@media (min-width: 768px) {
    .header--auth { padding: 0 1.5rem; }
    .header-inner { padding: 0 1.5rem; }
}
.header-actions { display: flex; align-items: center; gap: 0.5rem; }
.header-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 15px;
    color: rgb(var(--color-text));
    letter-spacing: -0.025em;
    text-decoration: none;
}
.header-brand img { height: 1.5rem; object-fit: contain; }

/* Header icon button (hamburger, etc.) */
.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: rgb(var(--color-text-soft));
    display: inline-flex;
    align-items: center;
    transition: color 0.15s;
    padding: 0;
}
.icon-btn:hover { color: rgb(var(--color-text)); }
.icon-btn svg { width: 1.25rem; height: 1.25rem; }
@media (min-width: 1024px) { .icon-btn--mobile { display: none; } }

/* Panel name hidden in the navbar by request; re-enable via display + font styles. */
.header-mobile-brand { display: none; }

/* Header action button (balance, language, currency, logout) */
.header-btn {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    background: none;
    border: none;
    cursor: pointer;
    color: rgb(var(--color-text) / 0.7);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-control);
    font-size: 12px;
    transition: all 0.15s;
    text-decoration: none;
}
.header-btn:hover { color: rgb(var(--color-text)); background: rgb(255 255 255 / 0.06); }
.header-btn svg { width: 0.875rem; height: 0.875rem; }
.header-btn--balance { color: rgb(var(--color-text)); font-weight: 500; padding: 0.25rem 0.625rem; }
.header-btn--balance:hover { color: rgb(var(--color-primary-500)); background: rgb(var(--color-primary-50)); }
.header-btn--balance svg { color: rgb(var(--color-text-muted)); }
.header-btn--logout:hover { color: rgb(255 94 94); background: rgb(255 62 62 / 0.12); }
.desktop-only { display: none; }
@media (min-width: 1024px) { .desktop-only { display: flex; } }

/* Public nav links */
.pubnav { display: none; align-items: center; gap: 0.25rem; font-size: 13px; font-weight: 500; }
@media (min-width: 768px) { .pubnav { display: flex; } }
.pubnav-link {
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-control);
    color: rgb(var(--color-text-soft));
    text-decoration: none;
    transition: all 0.15s;
}
.pubnav-link:hover { color: rgb(var(--color-text)); background: rgb(var(--color-surface-muted) / 0.8); }
.menu-btn { display: inline-flex; }
@media (min-width: 768px) { .menu-btn { display: none; } }

.pubmenu-mobile {
    border-top: 1px solid rgb(var(--color-border-soft));
    background: rgb(var(--color-surface));
    padding: 0.5rem;
    position: relative;
    z-index: 50;
}
@media (min-width: 768px) { .pubmenu-mobile { display: none; } }
.pubmenu-mobile a {
    display: block;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-control);
    font-size: 0.875rem;
    font-weight: 500;
    color: rgb(var(--color-text-soft));
    text-decoration: none;
    transition: all 0.15s;
}
.pubmenu-mobile a:hover { color: rgb(var(--color-primary-500)); background: rgb(var(--color-primary-500) / 0.05); }

/* Dropdowns (language / currency) */
.dropdown { position: relative; }
.dropdown-menu {
    position: absolute;
    top: 100%;
    margin-top: 0.25rem;
    background: rgb(var(--color-surface));
    border: 1px solid rgb(var(--color-border-soft));
    border-radius: var(--radius-control);
    box-shadow: var(--shadow-menu);
    padding: 0.25rem 0;
    min-width: 120px;
    z-index: 50;
}
.dropdown-menu--right { right: 0; }
.dropdown-menu--left { left: 0; }
/* Shared header switchers (langSwitcher/currencySwitcher partials) carry no
   alignment modifier: the header context decides. */
.header--auth .dropdown-menu { right: 0; }
.header--public .dropdown-menu { left: 0; }
/* Full-width scrollable menu (new_order category/service select). */
.dropdown-menu--full { left: 0; right: 0; width: 100%; max-height: 16rem; overflow-y: auto; }
.dropdown-item.is-selected { background: rgb(var(--color-primary-50)); color: rgb(var(--color-primary-700)); }
.dropdown-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.375rem 0.75rem;
    font-size: 12px;
    color: rgb(var(--color-text-soft));
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
}
.dropdown-item:hover { color: rgb(var(--color-text)); background: rgb(var(--color-surface-muted)); }

/* Main / footer */
.main {
    flex: 1;
    padding: 0.5rem 1rem 1rem;
    overflow-y: auto;
}
@media (min-width: 768px) { .main { padding: 0.75rem 1.5rem 1.5rem; } }
@media (min-width: 1024px) { .main { padding: 0.75rem 2.5rem 2.5rem; } }
.container { max-width: 72rem; margin: 0 auto; width: 100%; }
/* Instant click feedback: while a navigation request is in flight, htmx marks
   #content (hx-indicator on <body>) and the outgoing page dims immediately. */
#content { transition: opacity 0.12s; }
#content.htmx-request { opacity: 0.55; }
/* The authenticated app is data-dense (10-column order tables): give it more
   room than the public pages. Wide-screen space goes to the tables instead of
   dead side margins. */
body.app--auth .container { max-width: 88rem; }

.footer {
    flex-shrink: 0;
    background: rgb(var(--color-surface) / 0.5);
    padding: 1rem;
    font-size: 11px;
    color: rgb(var(--color-text-soft) / 0.6);
    text-align: center;
}
@media (min-width: 768px) { .footer { padding: 1rem 1.5rem; } }

/* Floating chat buttons (WhatsApp / Telegram) */
.chat-fab-stack {
    position: fixed;
    bottom: 1.5rem;
    z-index: 50;
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    gap: 0.75rem;
}
.chat-fab-stack--left { left: 1.5rem; }
.chat-fab-stack--right { right: 1.5rem; }
.chat-fab {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: var(--radius-pill);
    color: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    transition: all 0.2s ease-out;
}
.chat-fab:hover { filter: brightness(1.08); }

.chat-fab--whatsapp { background: linear-gradient(to bottom, #2EE373, #1FA855); }
.chat-fab--telegram { background: linear-gradient(to bottom, #36B0EE, #1A88BC); }
.chat-fab svg { filter: drop-shadow(0 1px 1px rgba(0,0,0,0.25)); }
.chat-fab--whatsapp svg { width: 1.75rem; height: 1.75rem; }
.chat-fab--telegram svg { width: 2.25rem; height: 2.25rem; }

/* Components */

/* Card */
.card {
    background: rgb(var(--color-surface));
    border-radius: var(--radius);
    border: 1px solid rgb(var(--color-border-soft));
}
.card--pad { padding: 1.25rem; }
@media (min-width: 768px) { .card--pad { padding: 1.5rem; } }

/* Form controls */
.label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: rgb(var(--color-text-soft));
    margin-bottom: 0.375rem;
}
.input, .select, .textarea, .select-trigger {
    width: 100%;
    border: 1px solid rgb(var(--color-border));
    border-radius: var(--radius-control);
    background: rgb(var(--color-surface));
    padding: 9px 0.75rem;
    font-size: 0.875rem;
    line-height: 1.25rem; /* uniform height across inputs, selects and triggers */
    color: rgb(var(--color-text));
    box-shadow: var(--shadow-control);
    transition: all 0.15s;
    font-family: inherit;
}
.input:focus, .select:focus, .textarea:focus, .select-trigger:focus {
    outline: none;
    border-color: rgb(var(--color-primary-500));
    box-shadow: 0 0 0 2px rgb(var(--color-primary-500) / 0.1);
}
/* Button replacing a native <select>: label left, chevron right. */
.select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    text-align: left;
    cursor: pointer;
}
.select-trigger > span:first-child {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 0.5rem;
}
.select-trigger .trigger-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.select-trigger img { width: 1rem; height: 1rem; flex-shrink: 0; }
.select-trigger .chevron { width: 1rem; height: 1rem; flex-shrink: 0; color: rgb(var(--color-text-muted)); transition: transform 0.15s; }
.select-trigger .chevron.is-open { transform: rotate(180deg); }

/* Search with magnifier on the left (new_order autocomplete); cf. .search (button right). */
.search-left { position: relative; }
.search-left > svg {
    position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%);
    width: 1rem; height: 1rem; color: rgb(var(--color-text-muted)); pointer-events: none;
}
.search-left .input { padding-left: 2.25rem; }
.input:disabled, .select:disabled, .textarea:disabled {
    background: rgb(var(--color-surface-muted) / 0.8);
    color: rgb(var(--color-text-soft));
    cursor: not-allowed;
}
.textarea { resize: vertical; }
.select { appearance: none; cursor: pointer; }
.checkbox {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    border-radius: 0.25rem;
    border: 1px solid rgb(var(--color-border));
    accent-color: rgb(var(--color-primary-500));
}
.field { margin-bottom: 0; }
.help { margin-top: 0.25rem; font-size: 12px; color: rgb(var(--color-text-soft)); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
    padding: 9px 1.25rem;
    border-radius: var(--radius-control);
    transition: all 0.15s;
    cursor: pointer;
    border: none;
    text-decoration: none;
    line-height: 1.25rem;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn--block { width: 100%; }
.btn--sm { padding: 0.375rem 0.75rem; font-size: 13px; }
.btn--primary {
    background: rgb(var(--color-primary-500));
    color: rgb(var(--color-primary-fg));
}
.btn--primary:hover:not(:disabled) { filter: brightness(1.1); }
.btn--primary:active { filter: brightness(0.95); }
.btn--outline {
    background: rgb(var(--color-surface));
    color: rgb(var(--color-text));
    border: 1px solid rgb(var(--color-border));
    box-shadow: var(--shadow-control);
}
.btn--outline:hover:not(:disabled) { background: rgb(var(--color-surface-muted)); }
/* Square icon button */
.btn--icon { padding: 0.375rem; gap: 0; }
/* Very small row action buttons (tables). */
.btn--xs { padding: 0.125rem 0.5rem; font-size: 11px; border-radius: var(--radius-control); }
/* Colored semantic actions (refill=success, cancel=danger). */
.btn--success {
    background: rgb(46 231 182 / 0.1); color: #2ee7b6; border: 1px solid rgb(46 231 182 / 0.35);
    box-shadow: var(--shadow-control);
}
.btn--success:hover:not(:disabled) { background: rgb(46 231 182 / 0.18); }
.btn--danger {
    background: rgb(255 62 62 / 0.1); color: #ff6b6b; border: 1px solid rgb(255 62 62 / 0.35);
    box-shadow: var(--shadow-control);
}
.btn--danger:hover:not(:disabled) { background: rgb(255 62 62 / 0.18); }

/* Accent links */
.link {
    font-weight: 500;
    color: rgb(var(--color-primary-500));
    transition: color 0.15s;
    text-decoration: none;
    cursor: pointer;
    background: none;
    border: none;
}
.link:hover { color: rgb(var(--color-primary-500) / 0.8); }

/* Chip (network-logo filter on new_order) */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    height: 2.5rem;
    padding: 0 0.75rem;
    flex-shrink: 0;
    border-radius: var(--radius-control);
    border: 1px solid rgb(var(--color-border-soft));
    background: rgb(var(--color-surface));
    color: rgb(var(--color-text-soft));
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}
.chip:hover { background: rgb(var(--color-surface-muted)); }
.chip img, .chip svg { width: 1rem; height: 1rem; flex-shrink: 0; }
.chip.is-active {
    border-color: rgb(var(--color-primary-500));
    background: rgb(var(--color-primary-50));
    color: rgb(var(--color-primary-700));
    box-shadow: 0 0 0 2px rgb(var(--color-primary-500) / 0.1);
}

/* Readout (read-only box: description, charge, average time) */
.readout {
    width: 100%;
    border: 1px solid rgb(var(--color-border-soft));
    border-radius: var(--radius-control);
    background: rgb(var(--color-surface-muted));
    padding: 9px 0.75rem;
    font-size: 0.875rem;
    color: rgb(var(--color-text-soft));
    white-space: pre-line;
}
.readout--value { color: rgb(var(--color-text)); font-weight: 500; font-variant-numeric: tabular-nums; }

/* Search (input with embedded button/magnifier) */
.search { position: relative; width: 100%; }
@media (min-width: 640px) { .search { width: 18rem; } }
.search .input { padding-right: 3rem; }
.search-btn {
    position: absolute;
    inset-block: 0;
    right: 0;
    display: flex;
    align-items: center;
    padding: 0 0.75rem;
    border: none;
    border-radius: 0 var(--radius-control) var(--radius-control) 0;
    background: rgb(var(--color-primary-500));
    color: rgb(var(--color-primary-fg));
    cursor: pointer;
    transition: filter 0.15s;
}
.search-btn:hover { filter: brightness(1.1); }
.search-btn svg { width: 1rem; height: 1rem; }

/* Data table */
.table-wrap { overflow-x: auto; }
.table { width: 100%; text-align: left; font-size: 0.875rem; border-collapse: collapse; }
.table thead tr { border-bottom: 1px solid rgb(var(--color-border-soft)); }
.table th {
    padding: 0.625rem 0.75rem;
    font-size: 11px;
    font-weight: 600;
    color: rgb(var(--color-text-soft) / 0.6);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}
.table td { padding: 0.625rem 0.75rem; vertical-align: top; }
.table tbody tr { border-top: 1px solid rgb(var(--color-border-soft)); }
.table tbody tr:hover { background: rgb(var(--color-surface-muted) / 0.5); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
/* Long URL in a cell: truncate with ellipsis instead of letting it dictate the
   table width (the full link stays in href/title). */
.table .cell-trunc {
    display: inline-block;
    max-width: 16rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
}
.table-empty { padding: 2rem 1rem; text-align: center; font-size: 0.875rem; color: rgb(var(--color-text-soft)); }

/* Status badges */
.badge {
    display: inline-flex;
    align-items: center;
    border-radius: var(--radius-pill);
    padding: 0.125rem 0.5rem;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}
.badge--pending     { background: rgb(255 175 0 / 0.12);  color: #ffbe33; } /* amber */
.badge--processing  { background: rgb(77 163 255 / 0.12); color: #4da3ff; } /* blue */
.badge--in-progress { background: rgb(56 189 248 / 0.12); color: #38bdf8; } /* sky */
.badge--completed   { background: rgb(159 239 0 / 0.12);  color: #9fef00; } /* neon green */
.badge--partial     { background: rgb(255 159 67 / 0.12); color: #ff9f43; } /* orange */
.badge--canceled    { background: rgb(164 177 205 / 0.12); color: #a4b1cd; } /* slate */
.badge--rejected    { background: rgb(255 62 62 / 0.12);  color: #ff5e5e; } /* red */
.badge--answered    { background: rgb(77 163 255 / 0.12); color: #4da3ff; }
.badge--closed      { background: rgb(164 177 205 / 0.1); color: #8f9cb8; }
.badge--welcome     { background: rgb(167 139 250 / 0.12); color: #a78bfa; }
.badge--neutral     { background: rgb(164 177 205 / 0.12); color: #a4b1cd; }

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.875rem;
    color: rgb(var(--color-text-soft));
}
.pagination-nav { display: flex; align-items: center; gap: 0.5rem; }
.page-btn {
    border: 1px solid rgb(var(--color-border));
    border-radius: var(--radius-control);
    background: rgb(var(--color-surface));
    /* Buttons do NOT inherit text color — without this the ‹ › arrows render
       in the UA default (near-black) and vanish on the dark surface. */
    color: rgb(var(--color-text-soft));
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    line-height: 1;
    box-shadow: var(--shadow-control);
    cursor: pointer;
    transition: all 0.15s;
}
.page-btn:hover:not(:disabled) { background: rgb(var(--color-surface-muted)); color: rgb(var(--color-text)); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Skeleton */
@keyframes pulse { 50% { opacity: 0.5; } }
.skeleton { background: rgb(var(--color-border-soft)); border-radius: var(--radius-control); animation: pulse 2s cubic-bezier(0.4,0,0.6,1) infinite; }
.skeleton-line { height: 2.5rem; }

/* Spinner */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { width: 1rem; height: 1rem; animation: spin 1s linear infinite; }

/* Modal */
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.4);
}
.modal-box {
    position: relative;
    width: 100%;
    max-width: 32rem;
    background: rgb(var(--color-surface));
    border-radius: var(--radius);
    box-shadow: var(--shadow-menu);
    padding: 1.25rem;
    max-height: 80vh;
    overflow-y: auto;
}
@media (min-width: 768px) { .modal-box { padding: 1.5rem; } }
.modal-close {
    background: none; border: none; cursor: pointer;
    color: rgb(var(--color-text-muted));
    font-size: 1.25rem; line-height: 1;
}
.modal-close:hover { color: rgb(var(--color-text-soft)); }

/* Alert */
.alert {
    border-radius: var(--radius-control);
    padding: 0.5rem 0.75rem;
    font-size: 13px;
}
.alert--warning { border: 1px solid rgb(255 175 0 / 0.35); background: rgb(255 175 0 / 0.08); color: #ffd166; }

/* Toast (created dynamically at runtime) */
.toast {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-control);
    box-shadow: var(--shadow-menu);
    font-size: 0.875rem;
    font-weight: 700;
    z-index: 50;
    color: #fff;
    transition: opacity 0.3s;
}
.toast--ok { background: #9fef00; color: #141d2b; }
.toast--error { background: #ff3e3e; }

/* Auth (login / signup / reset) */
.auth-page { display: flex; align-items: flex-start; justify-content: center; padding-top: 3rem; }
.auth-box { width: 100%; max-width: 380px; padding: 0 1rem; }
.auth-card { padding: 2rem; }
.auth-title { font-size: 1.25rem; line-height: 1.75rem; font-weight: 600; color: rgb(var(--color-text)); }
.auth-alt { text-align: center; font-size: 13px; color: rgb(var(--color-text-soft)); padding-top: 0.25rem; }
/* Status/help paragraph on auth pages ("email sent", "invalid token"). */
.auth-hint { text-align: center; font-size: 13px; color: rgb(var(--color-text-soft)); }
@media (min-width: 768px) {
    .auth-page { align-items: center; padding-top: 0; min-height: 75vh; }
    .auth-box { padding: 0; }
}

/* Card section title (h2 inside .card--pad). Keeps the browser's default top
   margin — collapses against the card padding exactly like the old inline style. */
.card-title { font-size: 13px; font-weight: 600; color: rgb(var(--color-text)); margin-bottom: 1rem; }

/* Responsive form grid (account page et al). --wide = the profile variant. */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.form-grid--wide { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
/* Submit row spanning the whole grid. */
.form-actions { grid-column: 1 / -1; padding-top: 0.25rem; }

/* Inline error message under a form control. */
.error-text { font-size: 12px; color: #ff5e5e; }

/* Highlighted amount box (addfunds modals: "amount to pay"). */
.amount-box {
    text-align: center;
    border-radius: var(--radius-control);
    background: rgb(var(--color-primary-50));
    border: 1px solid rgb(var(--color-primary-200));
    padding: 0.625rem 0.75rem;
    margin-bottom: 1rem;
}
.amount-box--copy { cursor: pointer; }
.amount-box-label {
    font-size: 11px;
    font-weight: 500;
    color: rgb(var(--color-primary-700));
    text-transform: uppercase;
    letter-spacing: 0.025em;
    margin-bottom: 0.125rem;
}
.amount-box-value { font-size: 1.125rem; font-weight: 600; color: rgb(var(--color-primary-900)); }

/* Tiny uppercase section label (Endpoint / Request / Response, modal kickers). */
.eyebrow {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: rgb(var(--color-text-soft));
}

/* Inline code chip (API docs). Pair with .mono. */
.code-chip {
    border-radius: var(--radius-control);
    background: rgb(var(--color-surface-muted));
    padding: 0.125rem 0.375rem;
    font-size: 13px;
    color: rgb(var(--color-text));
}

/* Code block (API docs request/response). --dark = the request variant. */
.code-block {
    background: rgb(var(--color-surface-muted));
    color: rgb(var(--color-text-soft));
    padding: 0.75rem 1rem;
    border-radius: var(--radius-control);
    overflow-x: auto;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 13px;
    line-height: 1.625;
    box-shadow: 0 0 0 1px rgb(var(--color-border-soft));
}
.code-block--dark { background: #0f172a; color: #e2e8f0; box-shadow: none; }

/* Utilities */
.stack > * + * { margin-top: 1rem; }      /* column with uniform spacing */
.form-stack > * + * { margin-top: 1rem; } /* semantic alias for forms */
.stack-sm > * + * { margin-top: 0.5rem; }
.stack-lg > * + * { margin-top: 1.5rem; }
/* Label + link row (e.g. "Password" + "forgot my password"). */
.field-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.375rem; }
.row { display: flex; align-items: center; gap: 0.5rem; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.grow { flex: 1; }
.muted { color: rgb(var(--color-text-soft)); }
.strong { font-weight: 600; color: rgb(var(--color-text)); }
.center { text-align: center; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
/* THE id style: every entity/reference id in tables and lists renders the same
   way — small mono, tabular digits, no wrap. Pair with `muted` (plain id) or
   `link` (clickable id); color comes from that pairing. */
.cell-id {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.75rem;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
/* Dimmest text tier (placeholder dashes, de-emphasized hints). */
.dim { color: rgb(var(--color-text-muted)); }
.nowrap { white-space: nowrap; }
/* Type-size helpers (match the sizes the theme already uses everywhere). */
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 12px; }
.text-2xs { font-size: 11px; }
/* Flex row that wraps (button + input pairs, etc.). */
.row-wrap { display: flex; gap: 0.75rem; flex-wrap: wrap; }
