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

/* The UI was designed on a 2K (2560px) monitor. On smaller viewports,
   scale everything down to 90% — equivalent to the browser's own 90% zoom —
   so 1080p displays match the intended proportions automatically. */
@media (max-width: 2100px) {
    html {
        zoom: 0.9;
    }
}

:root {
    --bg: #1a1a1a;
    --bg-card: #222222;
    --bg-hover: #2a2a2a;
    --border: #333333;
    --border-focus: #555555;
    --text: #e8e8e8;
    --text-muted: #888888;
    --accent: #c8a96e;
    --accent-dim: #a08050;
    --series-sales: #199e70;
    --series-listings: #d95926;
    --price-green: #22c55e;
    --price-red: #ef4444;
    --error: #c86e6e;
    --success: #3ba55d;
    --warning: #d9a441;
    --radius: 12px;
    --radius-sm: 8px;

    --font-sans: 'Sora', sans-serif;
    --font-mono: 'DM Mono', monospace;

    /* Elevation — dropdown/menu popovers, floating panels, the side drawer. */
    --shadow-menu: 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-panel: 0 4px 16px rgba(0, 0, 0, 0.25);
    --shadow-drawer: -8px 0 24px rgba(0, 0, 0, 0.4);
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    display: flex;
    flex-direction: column;
}

/* ── Top bar ── */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 32px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

.topbar-brand {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--accent);
    text-decoration: none;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    transition: opacity 0.2s;
}

.topbar-brand:hover {
    opacity: 0.75;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-user-menu {
    position: relative;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 2px;
    transition: color 0.2s;
}

.topbar-user:hover,
.topbar-user.open {
    color: var(--text);
}

.topbar-user .dropdown-arrow {
    font-size: 0.9rem;
}

.topbar-user-dropdown {
    right: 0;
    min-width: 150px;
    display: flex;
    flex-direction: column;
    padding: 4px;
}

.topbar-user-item {
    display: block;
    width: 100%;
    text-align: left;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    text-decoration: none;
    background: none;
    border: none;
    border-radius: calc(var(--radius) - 2px);
    padding: 8px 10px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.topbar-user-item:hover {
    background: var(--bg-hover);
    color: var(--text);
}

/* .btn-login is the shared .btn .btn--ghost (components.css) — its size and
   accent hover are defined there, after the base, so the hover wins. */

/* ── Navbar ── */
.navbar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 32px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

/* ── Mobile nav plumbing ──
   On desktop the hamburger button is hidden and .navbar-menu dissolves
   (display: contents) so its children — the page links and .navbar-right —
   lay out as direct flex items of .navbar exactly as before. mobile.css
   flips both under its breakpoint to build the slide-down panel. */
.nav-toggle {
    display: none;
}

.navbar-menu {
    display: contents;
}

.navbar a {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 400;
    color: var(--text-muted);
    text-decoration: none;
    padding: 14px 16px;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.navbar a:hover,
.navbar a.active {
    color: var(--text);
    border-bottom-color: var(--accent);
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

/* ── Content area ── */
.content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

/* ── Page wrapper ──
   The root element of every routed page fragment (Cards, Prices, Inventory,
   Decks GA, Admin). position:relative because each page's side drawer
   (#card-drawer / #inv-card-drawer) is `position: absolute; top: 0;
   height: 100%` and needs a positioned ancestor to size against — without one
   it falls back to the viewport and covers the topbar/navbar. Feature files
   add page-specific extras (e.g. .admin-page's list-width var) on top. */
.page {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
    position: relative;
}

/* ── Fade-swap transition ──
   The class pair driven by fadeSwap() (animation.js) and a few direct
   classList toggles (admin.js). Any element fadeSwap is handed picks these up;
   callers needing a different pace pass their own class names (see admin.css's
   curio-fade-*). .tile-img-spinner overrides `transform` back to none — it's an
   opacity-only fade (cards.css). */
.fade-out {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.fade-in {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

/* ── Page header ── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 32px;
    border-bottom: 1px solid var(--border);
}

/* List-view header — the title/label row above a grid, with an action button
   to the right (Inventory bins, Decks GA deck list). */
.list-header {
    padding: 24px 32px 20px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
}

/* Detail-view header — stacked back-link + title block above a detail body
   (Inventory bin detail, Decks GA deck detail). */
.detail-header {
    padding: 16px 32px;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}

/* ── Label ──
   The monospace uppercase kicker/caption used above sections, fields, stats,
   and page headers throughout. Base is the accent "section kicker"; --muted is
   the dimmer field/group caption; --sm / --lg adjust size. Consumers keep only
   structural deltas (margin, display, white-space) on their prefixed class. */
.label {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--accent);
}

.label--muted {
    color: var(--text-muted);
    letter-spacing: 0.1em;
}

.label--sm { font-size: 0.65rem; }
.label--lg { font-size: 0.78rem; }

/* .page-label is the shared .label .label--lg (see templates). */

/* ── Utility ── */
.hidden {
    display: none !important;
}

/* ── Scrollbars ──
   .scroll-thin: the standard thin custom bar for scroll containers (grids,
   lists, tables, panels). .scroll-none: hide the bar entirely (textareas that
   scroll internally). Wide/inset variants (.card-grid-wrap, .card-drawer) and
   popover-menu bars keep their own rules. */
.scroll-thin {
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
.scroll-thin::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
.scroll-thin::-webkit-scrollbar-track {
    background: var(--bg);
}
.scroll-thin::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 8px;
}
.scroll-thin::-webkit-scrollbar-thumb:hover {
    background: var(--border-focus);
}

.scroll-none {
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.scroll-none::-webkit-scrollbar {
    display: none;
}

/* ── Footer ── */
.footer {
    padding: 20px 32px;
    border-top: 1px solid var(--border);
    text-align: center;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    max-height: 80px;
    transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
    overflow: hidden;
}

.footer.footer-hidden {
    max-height: 0;
    opacity: 0;
    padding: 0 32px;
    border-top-width: 0;
}

/* ── Global confirm modal ── */

#app-confirm-modal .inv-modal-actions {
    display: block;
}

#app-confirm-btn {
    width: 100%;
    transition: opacity 0.2s ease, filter 0.2s ease, border-color 0.2s, background 0.2s;
}

/* Darkened/inert until "confirm" is typed */
#app-confirm-btn:disabled {
    opacity: 0.35;
    filter: grayscale(0.6) brightness(0.7);
    cursor: not-allowed;
    pointer-events: none;
}

/* ── Account-setup gate ──
   Full-screen, non-dismissible: shown when an admin has cleared this user's
   Omnidex ID and/or password. */
.setup-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(2px);
}

.setup-card {
    width: 100%;
    max-width: 380px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
}

.setup-header {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.setup-title {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin: 0;
}

.setup-desc {
    margin: 0;
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-muted);
}

.setup-step {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.setup-step + .setup-step {
    margin-top: 4px;
}

.setup-error {
    display: none;
}

.setup-error.visible {
    display: block;
}

.setup-submit {
    width: 100%;
    padding: 11px 20px;
    font-size: 0.9rem;
}