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

/* Tokens — light theme: white surfaces on a soft gray page, green accent with
   WHITE text on primary buttons (--color-primary-fg). The -600/-700 steps are
   DARKER than -500 (text on light tints must stay readable). */
:root {
    /* Brand (green). RGB triplet without rgb()/commas → opacity via rgb(var(--x) / 0.5). */
    --color-primary-50: 247 254 231;  /* #f7fee7 selected/hover fills */
    --color-primary-100: 236 252 203;
    --color-primary-200: 217 249 157;
    --color-primary-500: 101 163 13;  /* #65a30d lime: buttons, active nav */
    --color-primary-600: 77 124 15;   /* #4d7c0f button hover */
    --color-primary-700: 77 124 15;   /* readable green text on light fills */
    --color-primary-900: 54 83 20;
    --color-primary-fg: 255 255 255;  /* white text on green buttons */

    /* Sidebar */
    --color-sidebar: 236 238 236;    /* un paso más oscuro que la página: sidebar > página > tarjetas */
    --color-sidebar-fg: 22 26 22;

    /* Page backgrounds */
    --color-page: 244 245 244;       /* #f4f5f4 */
    --color-page-public: 244 245 244;

    /* Surfaces and UI grays */
    --color-surface: 255 255 255;     /* cards/header */
    --color-surface-muted: 238 240 238; /* soft backgrounds: readout, thead, hover, light code */
    --color-border: 205 210 205;
    --color-border-soft: 226 229 226;
    --color-text: 22 26 22;          /* #161a16 */
    --color-text-soft: 92 100 92;
    --color-text-muted: 139 147 139;

    /* Shape */
    --radius: 0.5rem;
    --radius-control: 0.375rem;
    --radius-pill: 9999px;
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-control: none;
    --shadow-menu: 0 8px 24px rgba(0, 0, 0, 0.12);
    /* Typography: tenants override only this var (plus their own @font-face for web fonts). */
    --font-sans: "Manrope", 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));
    border-right: 1px solid rgb(var(--color-border-soft));
    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.72);
    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-700)); background: rgb(var(--color-primary-500) / 0.14); font-weight: 600; }
.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(var(--color-surface-muted)); }
.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(16 185 129 / 0.1); color: #047857; border: 1px solid rgb(16 185 129 / 0.35);
    box-shadow: var(--shadow-control);
}
.btn--success:hover:not(:disabled) { background: rgb(16 185 129 / 0.18); }
.btn--danger {
    background: rgb(220 38 38 / 0.08); color: #b91c1c; border: 1px solid rgb(220 38 38 / 0.3);
    box-shadow: var(--shadow-control);
}
.btn--danger:hover:not(:disabled) { background: rgb(220 38 38 / 0.14); }

/* 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; }

/* Rich readout: instrucciones de pago escritas por el staff en markdown/HTML
   (el backend ya las sanitizo). Contenido en bloque, no pre-line. */
.readout--rich { white-space: normal; line-height: 1.5; }
.readout--rich > :first-child { margin-top: 0; }
.readout--rich > :last-child { margin-bottom: 0; }
.readout--rich p, .readout--rich ul, .readout--rich ol, .readout--rich table { margin: 0 0 0.6em; }
.readout--rich ul, .readout--rich ol { padding-left: 1.25rem; }
.readout--rich ul { list-style: disc; }
.readout--rich ol { list-style: decimal; }
.readout--rich h1, .readout--rich h2, .readout--rich h3, .readout--rich h4 {
    margin: 0.6em 0 0.3em; font-weight: 600; color: rgb(var(--color-text)); font-size: 1em;
}
.readout--rich a { color: rgb(var(--color-primary)); text-decoration: underline; }
.readout--rich strong { color: rgb(var(--color-text)); }
.readout--rich code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em;
    padding: 0.1em 0.35em; border-radius: 4px;
    background: rgb(var(--color-surface)); border: 1px solid rgb(var(--color-border-soft));
    color: rgb(var(--color-text)); user-select: all;
}
.readout--rich img { max-width: 100%; height: auto; border-radius: var(--radius-control); display: block; margin: 0.5em 0; }
.readout--rich video, .readout--rich iframe {
    display: block; max-width: 100%; width: 100%; aspect-ratio: 16 / 9; height: auto;
    border: 0; border-radius: var(--radius-control); margin: 0.5em 0; background: #000;
}
.readout--rich table { border-collapse: collapse; width: 100%; font-size: 0.9em; }
.readout--rich th, .readout--rich td { border: 1px solid rgb(var(--color-border-soft)); padding: 0.35em 0.5em; text-align: left; }
.readout--rich th { background: rgb(var(--color-surface)); color: rgb(var(--color-text)); }

/* 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(245 158 11 / 0.14);  color: #b45309; } /* amber */
.badge--processing  { background: rgb(59 130 246 / 0.12);  color: #1d4ed8; } /* blue */
.badge--in-progress { background: rgb(14 165 233 / 0.12);  color: #0369a1; } /* sky */
.badge--completed   { background: rgb(22 163 74 / 0.12);   color: #15803d; } /* green */
.badge--partial     { background: rgb(249 115 22 / 0.12);  color: #c2410c; } /* orange */
.badge--canceled    { background: rgb(100 116 139 / 0.12); color: #475569; } /* slate */
.badge--rejected    { background: rgb(220 38 38 / 0.1);    color: #b91c1c; } /* red */
.badge--answered    { background: rgb(59 130 246 / 0.12);  color: #1d4ed8; }
.badge--closed      { background: rgb(100 116 139 / 0.1);  color: #64748b; }
.badge--welcome     { background: rgb(124 58 237 / 0.12);  color: #6d28d9; }
.badge--neutral     { background: rgb(100 116 139 / 0.12); color: #475569; }

/* 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(245 158 11 / 0.35); background: rgb(245 158 11 / 0.08); color: #92400e; }

/* 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: rgb(var(--color-primary-500)); color: #fff; }
.toast--error { background: #dc2626; }

/* 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: #dc2626; }

/* 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));
}
/* Request example on the API page: same light surface as the response block, with a border to set it apart. */
.code-block--dark { background: rgb(var(--color-surface)); color: rgb(var(--color-text)); border: 1px solid rgb(var(--color-border-soft)); 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; }

/* Order receipt (new order page, after a successful submit). */
.receipt {
    padding: 0.875rem 1rem;
    border-radius: var(--radius-control);
    background: rgb(var(--color-primary-500) / 0.08);
    border: 1px solid rgb(var(--color-primary-500) / 0.3);
    font-size: 13px;
}
.receipt-title { margin: 0; font-weight: 600; color: rgb(var(--color-text)); }
.receipt-rows { margin-top: 0.5rem; display: flex; flex-direction: column; gap: 0.2rem; color: rgb(var(--color-text)); overflow-wrap: anywhere; }
.receipt-rows span { font-variant-numeric: tabular-nums; }

/* Sidebar count badge (tickets answered by staff, waiting on the user). */
.nav-badge {
    margin-left: auto;
    min-width: 1rem;
    height: 1rem;
    padding: 0 0.3rem;
    border-radius: var(--radius-pill);
    background: #dc2626;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    line-height: 1rem;
    text-align: center;
    font-variant-numeric: tabular-nums;
}
/* Ticket rows that need the user's attention (staff replied). */
.table tbody tr.row--attention { background: rgb(var(--color-primary-500) / 0.07); }
.table tbody tr.row--attention:hover { background: rgb(var(--color-primary-500) / 0.12); }
