/* ════════════════════════════════════════════════════════════════════════
   DSS Stockroom Toolbox — styles.css
   Plain CSS only. No Tailwind (it breaks the iframe print mechanism).
   Sections: tokens · base · shell · components · page-specific · dark mode ·
   responsive.  Tool-specific blocks carried over from the previous index.html
   follow the shell block.
════════════════════════════════════════════════════════════════════════ */
:root {
    --royal:    #003594;
    --gold:     #FFB81C;
    --navy:     #00205B;
    --navy-bg:  #00205B;
    --sky:      #DBEEFF;
    --gray:     #C8C9C7;
    --lt-blue:  #66B2E3;
    --haze:     #FFE939;
    --green:    #00AD6E;
    --red:      #FF5B45;
    --dark-red: #770538;

    --bg:       #f4f5f7;
    --surface:  #ffffff;
    --surface-2:#fafbfd;
    --border:   #e2e4e8;
    --text:     #1a1d23;
    --muted:    #5a6072;
    --input-bg: #ffffff;
    --on-royal-hover: #00205B;
    --topbar-bg:#003594; --sidebar-bg:#00205B; --status-bg:#00205B;
    --ring-rgb: 0 53 148;

    --gothic:    'alternate-gothic-no-3-d', 'Arial Narrow', sans-serif;
    --serif:     'Instrument Serif', Georgia, serif;
    --sans:      'Roboto', Arial, sans-serif;
    --body-serif:'Merriweather', Georgia, serif;
    --mono:      'Roboto Mono', 'Courier New', monospace;

    --nav-h:     48px;
    --status-h:  32px;
    --sb-w:      264px;
    --sb-w-min:  64px;
    --ease:      cubic-bezier(.2,.7,.2,1);
}

[data-palette="default"][data-theme="dark"] {
    --topbar-bg:#0b1f3f; --sidebar-bg:#081327; --status-bg:#060f20;
    --ring-rgb: 59 120 216;
    --royal:    #3b78d8;
    --navy:     #9dbcf0;
    --navy-bg:  #0e2c60;
    --sky:      #15305c;
    --gray:     #5d6b84;
    --lt-blue:  #6aa9e0;
    --bg:       #0a1628;
    --surface:  #10213b;
    --surface-2:#132845;
    --border:   #223657;
    --text:     #e6ecf5;
    --muted:    #93a3bd;
    --input-bg: #0c1b33;
    --on-royal-hover: #6aa0f0;
    color-scheme: dark;
}

/* ════ Autumn palette (default). Same gold; rust, amber and umber replace the blues. ════ */
[data-palette="autumn"] {
    --royal:    #9c3a0b;
    --navy:     #3b1d0c;
    --navy-bg:  #3b1d0c;
    --sky:      #fbe4c4;
    --gray:     #bfa88c;
    --lt-blue:  #d98a3d;
    --haze:     #ffd24d;
    --green:    #3f6f12;
    --red:      #c4361d;
    --dark-red: #7a1d0e;
    --bg:       #f5ede0;
    --surface:  #fffaf1;
    --surface-2:#faf1e2;
    --border:   #d8c4a4;
    --text:     #22140b;
    --muted:    #5e4838;
    --input-bg: #fffdf8;
    --on-royal-hover: #3b1d0c;
    --topbar-bg:#7a2a08; --sidebar-bg:#2e1608; --status-bg:#2e1608;
    --ring-rgb: 156 58 11;
}
[data-palette="autumn"][data-theme="dark"] {
    --royal:    #cc5a12;
    --navy:     #ffc27a;
    --navy-bg:  #4a2410;
    --sky:      #3d2210;
    --gray:     #7a6048;
    --lt-blue:  #e0903f;
    --green:    #9fd45a;
    --red:      #ff7a5c;
    --bg:       #150b06;
    --surface:  #241409;
    --surface-2:#2c190c;
    --border:   #50361f;
    --text:     #fbefdc;
    --muted:    #d0b697;
    --input-bg: #1b0f07;
    --on-royal-hover: #ffb15c;
    --topbar-bg:#1d0e06; --sidebar-bg:#100804; --status-bg:#0b0603;
    --ring-rgb: 204 90 18;
    color-scheme: dark;
}
[data-palette="autumn"][data-theme="dark"] main a:not([class]) { color: #ffb15c; }
[data-palette="autumn"] .sub-tab.active, [data-palette="autumn"] .lst-tab.active { background: var(--navy-bg); color: var(--gold); }

/* ── Base ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--sans);
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.5;
    min-height: 100vh;
    transition: background .2s, color .2s, opacity .13s ease;
}
body.page-leaving { opacity: 0; }
h1, h2 { font-family: var(--serif); font-weight: 400; letter-spacing: 0.01em; }
h3, h4 { font-family: var(--gothic); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
code, .mono { font-family: var(--mono); }
a { color: var(--royal); }
kbd { font-family: var(--mono); font-size: 11px; padding: 1px 6px; border-radius: 4px; border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.icon { flex-shrink: 0; }
.print-only { display: none !important; }

/* ── Shell layout ─────────────────────────────────────────────────────── */
.app { min-height: 100vh; }
.main {
    margin-left: var(--sb-w);
    padding-top: var(--nav-h);
    padding-bottom: calc(var(--status-h) + 8px);
    min-height: 100vh;
    transition: margin-left .22s var(--ease);
}
.app.sb-collapsed .main { margin-left: var(--sb-w-min); }
.main-inner { animation: pageIn .26s var(--ease) both; }
@keyframes pageIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

.container { max-width: 1320px; margin: 0 auto; padding: 0 28px; width: 100%; }
.page-content { padding-top: 22px; padding-bottom: 48px; }

/* Slim page title */
.page-head {
    display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap;
    max-width: 1320px; margin: 0 auto; padding: 18px 28px 12px;
}
.page-head h1 { font-size: 30px; line-height: 1.1; color: var(--text); }
.page-head p { font-size: 13.5px; color: var(--muted); }
.page-head + .container .page-content, .page-head + .container.page-content { padding-top: 10px; }

/* ── Top bar ──────────────────────────────────────────────────────────── */
.topbar {
    position: fixed; top: 0; left: 0; right: 0; height: var(--nav-h); z-index: 300;
    display: flex; align-items: center; gap: 6px; padding: 0 12px 0 8px;
    background: var(--topbar-bg); color: #fff; border-bottom: 2px solid var(--gold);
}
.icon-btn {
    width: 36px; height: 36px; display: grid; place-items: center; border-radius: 8px;
    background: transparent; border: none; color: rgba(255,255,255,.85); cursor: pointer;
    transition: background .15s, color .15s, transform .08s;
}
.icon-btn:hover { background: rgba(255,255,255,.12); color: #fff; }
.icon-btn:active { transform: scale(.93); }
.topbar-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; margin-left: 4px; }
.topbar-brand img { height: 32px; width: auto; display: block; }
.topbar-brand span { font-family: var(--gothic); font-size: 15px; letter-spacing: .09em; text-transform: uppercase; font-weight: 700; white-space: nowrap; }
.topbar-spacer { flex: 1; }
.topbar-launch {
    display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px 0 12px;
    background: rgba(255,255,255,.12); color: rgba(255,255,255,.92); border: 1px solid rgba(255,255,255,.2);
    border-radius: 8px; cursor: pointer; font-family: var(--gothic); font-size: 13px; letter-spacing: .08em; text-transform: uppercase;
    transition: background .15s, border-color .15s, transform .08s;
}
.topbar-launch:hover { background: rgba(255,255,255,.2); border-color: rgba(255,184,28,.7); }
.topbar-launch:active { transform: scale(.97); }
.topbar-launch kbd { background: rgba(0,0,0,.2); border-color: rgba(255,255,255,.2); color: rgba(255,255,255,.75); }

/* ── Sidebar ──────────────────────────────────────────────────────────── */
.sidebar {
    position: fixed; top: var(--nav-h); bottom: var(--status-h); left: 0; width: var(--sb-w); z-index: 250;
    background: var(--sidebar-bg); color: #fff; display: flex; flex-direction: column;
    transition: width .22s var(--ease), transform .24s var(--ease);
    overflow: hidden;
}
[data-theme="dark"] .sidebar { border-right: 1px solid var(--border); }
.sb-collapsed .sidebar { width: var(--sb-w-min); }
.sidebar-logo { display: block; padding: 18px 22px 12px; flex-shrink: 0; }
.sidebar-logo img { display: block; width: 100%; height: auto; }
.sidebar-logo .sidebar-logo-mini { display: block; width: 42px; height: auto; margin: 6px auto 0; overflow: visible; }
.sb-collapsed .sidebar-logo { padding: 16px 6px 12px; }
.sidebar-search-link { padding: 0 10px 6px; flex-shrink: 0; }
.nav-item.nav-search { height: 38px; margin: 0; background: rgba(255,184,28,.12); border: 1px solid rgba(255,184,28,.35); color: var(--gold); font-size: 15px; }
.nav-item.nav-search:hover { background: rgba(255,184,28,.24); color: var(--gold); }
.nav-item.nav-search.active { background: var(--gold); color: var(--navy-bg); }
.nav-item.nav-search.active::before { display: none; }
.sb-collapsed .nav-item.nav-search { justify-content: center; }


.sidebar-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 4px 10px 8px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.2) transparent; }
.nav-section { margin-bottom: 10px; }
.nav-section-title {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px 5px;
    font-family: var(--gothic); font-size: 12.5px; letter-spacing: .14em; text-transform: uppercase; color: rgba(255,255,255,.5);
    background: none; border: none; text-align: left;
}
.nav-section-toggle { cursor: pointer; border-radius: 7px; transition: color .15s, background .15s; }
.nav-section-toggle:hover { color: #fff; background: rgba(255,255,255,.06); }
.nav-section-toggle .nav-label { flex: 1; }
.nav-section-icon { display: none; }
.nav-chev { transition: transform .18s var(--ease); }
.nav-chev.open { transform: rotate(180deg); }
.nav-item {
    position: relative; display: flex; align-items: center; gap: 12px; height: 38px; padding: 0 10px; margin-bottom: 1px;
    border-radius: 8px; color: rgba(255,255,255,.82); text-decoration: none;
    font-family: var(--gothic); font-size: 15px; letter-spacing: .08em; text-transform: uppercase;
    transition: background .15s, color .15s, transform .15s var(--ease);
}
.nav-item:hover { background: rgba(255,255,255,.09); color: #fff; transform: translateX(2px); }
.nav-item:active { transform: scale(.98); }
.nav-item.active { background: rgba(255,184,28,.14); color: var(--gold); }
.nav-item.active::before { content: ''; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--gold); }
.nav-label { white-space: nowrap; }
.nav-links-compact { display: flex; flex-direction: column; padding: 2px 0 6px 10px; margin-left: 18px; border-left: 1px solid rgba(255,255,255,.14); animation: pageIn .2s var(--ease) both; }
.nav-links-compact a { padding: 5px 10px; font-size: 12.5px; color: rgba(255,255,255,.7); text-decoration: none; border-radius: 6px; transition: color .15s, background .15s; }
.nav-links-compact a:hover { color: #fff; background: rgba(255,255,255,.08); }

.sidebar-collapse {
    display: flex; align-items: center; gap: 12px; height: 42px; padding: 0 20px; flex-shrink: 0; width: 100%;
    background: rgba(0,0,0,.18); border: none; border-top: 1px solid rgba(255,255,255,.1); color: rgba(255,255,255,.7);
    font-family: var(--gothic); font-size: 13px; letter-spacing: .1em; text-transform: uppercase; cursor: pointer; transition: color .15s, background .15s;
}
.sidebar-collapse:hover { color: #fff; background: rgba(0,0,0,.28); }
.sidebar-close-mobile { display: none; }

/* Collapsed: icons only */
.sb-collapsed .nav-label, .sb-collapsed .nav-section-title:not(.nav-section-toggle), .sb-collapsed .nav-chev { display: none; }
.sb-collapsed .nav-item, .sb-collapsed .nav-section-toggle { justify-content: center; padding: 0; }
.sb-collapsed .nav-section-icon { display: block; }
.sb-collapsed .nav-section-toggle { height: 38px; color: rgba(255,255,255,.7); }
.sb-collapsed .nav-section { padding-bottom: 6px; border-bottom: 1px solid rgba(255,255,255,.1); }
.sb-collapsed .nav-section:last-child { border-bottom: none; }
.sb-collapsed .sidebar-collapse { justify-content: center; padding: 0; }
.sb-collapsed .nav-item.active::before { left: -10px; }
.sidebar-scrim { display: none; }

/* ── Status bar ───────────────────────────────────────────────────────── */
.statusbar {
    position: fixed; bottom: 0; left: 0; right: 0; height: var(--status-h); z-index: 260;
    display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 16px;
    background: var(--status-bg); color: rgba(255,255,255,.78); font-size: 12px; border-top: 2px solid var(--gold);
}
[data-theme="dark"] .statusbar { border-top-width: 1px; }
.statusbar strong { color: #fff; font-family: var(--mono); font-weight: 500; }
.statusbar-left, .statusbar-right { display: flex; align-items: center; gap: 9px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex-shrink: 0; }
.status-dot.loading { background: var(--gold); animation: dotPulse 1.1s ease-in-out infinite; }
.status-dot.error { background: var(--red); }
@keyframes dotPulse { 50% { opacity: .35; } }

/* ── Skeletons ────────────────────────────────────────────────────────── */
.skeleton {
    display: inline-block; border-radius: 4px; vertical-align: middle;
    background: linear-gradient(90deg, rgba(128,140,160,.18) 25%, rgba(128,140,160,.34) 37%, rgba(128,140,160,.18) 63%);
    background-size: 400% 100%; animation: shimmer 1.3s ease infinite;
}
.statusbar .skeleton { background: linear-gradient(90deg, rgba(255,255,255,.1) 25%, rgba(255,255,255,.26) 37%, rgba(255,255,255,.1) 63%); background-size: 400% 100%; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.skeleton-row td { padding: 14px 10px; }

/* ── Pills (on-hand badges) ───────────────────────────────────────────── */
.pill { display: inline-block; border-radius: 10px; padding: 2px 9px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill-out { background: #ffe0dc; color: #b03020; }
.pill-low { background: #fff3cd; color: #7a5c00; }
.pill-in  { background: #d4f5e5; color: #006b30; }
.pill-ss  { background: #e8e8f0; color: #444488; font-style: italic; font-weight: 500; }
[data-theme="dark"] .pill-out { background: #4a1d1a; color: #ff9d90; }
[data-theme="dark"] .pill-low { background: #4a3b0a; color: #ffd76a; }
[data-theme="dark"] .pill-in  { background: #0f3b27; color: #6fe3a8; }
[data-theme="dark"] .pill-ss  { background: #262a4a; color: #b4b8ff; }

/* ── Quick Launch ─────────────────────────────────────────────────────── */
.ql-backdrop {
    position: fixed; inset: 0; z-index: 600; display: flex; align-items: flex-start; justify-content: center;
    padding: 12vh 16px 16px; background: rgba(2,10,28,.62); backdrop-filter: blur(3px); animation: fadeIn .14s ease both;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.ql-modal {
    width: 100%; max-width: 640px; max-height: 72vh; display: flex; flex-direction: column; overflow: hidden;
    background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 28px 90px rgba(0,0,0,.45);
    animation: qlIn .18s var(--ease) both;
}
@keyframes qlIn { from { opacity: 0; transform: translateY(-8px) scale(.985); } to { opacity: 1; transform: none; } }
.ql-input-row { display: flex; align-items: center; gap: 12px; padding: 0 16px; height: 58px; border-bottom: 1px solid var(--border); color: var(--muted); flex-shrink: 0; }
.ql-input-row input { flex: 1; min-width: 0; height: 100%; background: none; border: none; outline: none; font-family: var(--sans); font-size: 17px; color: var(--text); }
.ql-results { overflow-y: auto; padding: 6px 8px 8px; }
.ql-group-title { padding: 10px 10px 4px; font-family: var(--gothic); font-size: 12.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.ql-row { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 9px; cursor: pointer; transition: background .1s; }
.ql-row.active { background: var(--sky); }
.ql-ico { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; background: var(--bg); color: var(--royal); flex-shrink: 0; }
.ql-row.active .ql-ico { background: var(--royal); color: #fff; }
.ql-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ql-title { font-size: 14px; font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ql-title-note { font-weight: 400; color: var(--muted); font-size: 12.5px; }
.ql-sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ql-sub .mono { color: var(--royal); }
.ql-hint { color: var(--muted); flex-shrink: 0; display: flex; align-items: center; }
.ql-copy { border: 1px solid var(--border); background: var(--surface); color: var(--muted); border-radius: 6px; height: 28px; min-width: 28px; padding: 0 7px; font-size: 11px; cursor: pointer; display: grid; place-items: center; }
.ql-copy:hover { color: var(--royal); border-color: var(--royal); }
.ql-empty { padding: 28px 12px; text-align: center; color: var(--muted); font-size: 14px; }
.ql-foot { display: flex; gap: 18px; padding: 8px 16px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--muted); flex-shrink: 0; background: var(--surface-2); }
.ql-foot kbd { margin-right: 4px; }

/* ── Shared components ────────────────────────────────────────────────── */
.section-label {
    font-family: var(--gothic); font-size: 14px; letter-spacing: .14em; text-transform: uppercase; color: var(--navy); font-weight: 700;
    margin-bottom: 12px;
}
.tool-chip, .info-card, .link-pill {
    transition: border-color .15s, box-shadow .15s, transform .15s var(--ease), background .15s;
}
.tool-chip:active, .info-card:active { transform: scale(.985); }

/* Dashboard */
.dash { max-width: 1040px; margin: 0 auto; padding: 8px 28px 56px; }
.dash-hero { padding: 40px 0 30px; text-align: center; }
.dash-hero h1 { font-size: 44px; line-height: 1.05; color: var(--text); margin-bottom: 8px; }
.dash-hero p { color: var(--muted); font-size: 15px; margin-bottom: 22px; }
.dash-search { display: flex; max-width: 760px; margin: 0 auto; height: 64px; background: var(--surface); border: 2px solid var(--royal); border-radius: 14px; overflow: hidden; box-shadow: 0 6px 24px rgb(var(--ring-rgb) / .12); transition: box-shadow .18s, border-color .18s; }
.dash-search:focus-within { border-color: var(--gold); box-shadow: 0 6px 28px rgba(255,184,28,.28); }
.dash-search .icon { margin: auto 0 auto 20px; color: var(--muted); }
.dash-search input { flex: 1; min-width: 0; border: none; outline: none; background: none; padding: 0 16px; font-size: 19px; font-family: var(--sans); color: var(--text); }
.dash-search button { border: none; background: var(--royal); color: #fff; padding: 0 34px; font-family: var(--gothic); font-size: 17px; letter-spacing: .12em; text-transform: uppercase; cursor: pointer; transition: background .15s, transform .08s; }
.dash-search button:hover { background: var(--navy-bg); }
.dash-search button:active { transform: scale(.97); }
.dash-hint { margin-top: 10px; font-size: 12.5px; color: var(--muted); }
.dash-row { margin-top: 26px; }
.dash-row-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.dash-row-head .section-label { margin-bottom: 0; }
.dash-row-head span { font-size: 12px; color: var(--muted); }
.chip-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.tool-chip {
    position: relative; display: flex; align-items: center; gap: 12px; padding: 14px 40px 14px 14px; text-decoration: none; color: var(--text);
    background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
}
.tool-chip:hover { border-color: var(--royal); box-shadow: 0 3px 14px rgb(var(--ring-rgb) / .12); transform: translateY(-2px); }
.tool-chip .chip-ico { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 9px; background: var(--sky); color: var(--royal); }
.tool-chip .chip-name { font-family: var(--gothic); font-size: 16px; letter-spacing: .08em; text-transform: uppercase; color: var(--navy); }
.tool-chip .chip-sub { font-size: 11.5px; color: var(--muted); }
.tool-chip .pin-btn { position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 6px; border: none; background: none; color: var(--gray); cursor: pointer; }
.tool-chip .pin-btn:hover { color: var(--royal); background: var(--sky); }
.tool-chip .pin-btn.on { color: var(--gold); }
.tool-chip .pin-btn.on svg { fill: currentColor; }
.dash-empty { padding: 18px; border: 1px dashed var(--border); border-radius: 10px; color: var(--muted); font-size: 13.5px; text-align: center; }
.status-panel { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.status-cell { padding: 14px 18px; border-right: 1px solid var(--border); min-width: 0; }
.status-cell:last-child { border-right: none; }
.status-cell .k { font-family: var(--gothic); font-size: 12.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.status-cell .v { font-size: 20px; font-family: var(--mono); color: var(--text); margin-top: 2px; }
.status-cell .v.sm { font-size: 14px; font-family: var(--sans); }
.status-cell .v.err { color: var(--red); font-family: var(--sans); font-size: 14px; }
.link-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.link-pill {
    display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
    font-size: 12.5px; color: var(--royal); text-decoration: none; font-weight: 500;
}
.link-pill:hover { background: var(--sky); border-color: var(--royal); transform: translateY(-1px); }
.link-pill .icon { opacity: .6; }

/* Catalog search page */
.search-page { max-width: 1320px; margin: 0 auto; padding: 4px 28px 40px; }
.search-bar { display: flex; gap: 10px; margin-bottom: 14px; }
.search-bar input { flex: 1; height: 46px; padding: 0 16px; font-size: 16px; border: 1.5px solid var(--border); border-radius: 10px; background: var(--input-bg); color: var(--text); font-family: var(--sans); outline: none; transition: border-color .15s, box-shadow .15s; }
.search-bar input:focus { border-color: var(--royal); box-shadow: 0 0 0 3px rgb(var(--ring-rgb) / .14); }
.search-meta { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.tbl-dense th, .tbl-dense td { padding: 7px 10px; }
.tbl-dense td { font-size: 13px; }
.tbl-dense th { cursor: pointer; user-select: none; white-space: nowrap; }
.tbl-dense tbody tr.result-row { cursor: pointer; transition: background .1s; }
.tbl-dense tbody tr.result-row:hover { background: var(--sky); }
.tbl-dense tbody tr.result-row.open { background: var(--sky); }
.tbl-dense .chev { display: inline-block; transition: transform .15s; color: var(--muted); margin-right: 4px; }
.tbl-dense tr.open .chev { transform: rotate(90deg); }
.detail-cell { background: var(--surface-2); padding: 14px 18px 16px !important; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px 24px; animation: pageIn .18s var(--ease) both; }
.detail-grid .k { font-family: var(--gothic); font-size: 12px; letter-spacing: .13em; text-transform: uppercase; color: var(--muted); }
.detail-grid .v { font-size: 14px; color: var(--text); word-break: break-word; }
.detail-grid .v.mono { font-size: 13px; }
.search-empty { padding: 40px 0; text-align: center; color: var(--muted); }

/* Information (wiki) */
.wiki { max-width: 1320px; margin: 0 auto; padding: 4px 28px 48px; }
.info-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin-bottom: 22px; }
.info-card {
    display: flex; flex-direction: column; gap: 6px; text-align: left; padding: 16px; cursor: pointer; font-family: var(--sans);
    background: var(--surface); border: 1px solid var(--border); border-top: 3px solid var(--royal); border-radius: 10px; color: var(--text);
}
.info-card:hover { border-color: var(--royal); box-shadow: 0 3px 14px rgb(var(--ring-rgb) / .12); transform: translateY(-2px); }
.info-card.active { background: var(--sky); border-color: var(--royal); }
.info-card .ic-head { display: flex; align-items: center; gap: 10px; color: var(--royal); }
.info-card .ic-name { font-family: var(--gothic); font-size: 17px; letter-spacing: .09em; text-transform: uppercase; color: var(--navy); }
.info-card .ic-desc { font-size: 12.5px; color: var(--muted); }
.info-card .ic-count { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.article-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 22px; }
.article-link { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 9px; text-decoration: none; color: var(--text); cursor: pointer; text-align: left; font-family: var(--sans); transition: border-color .15s, transform .15s var(--ease); }
.article-link:hover { border-color: var(--royal); transform: translateX(3px); }
.article-link .al-title { font-weight: 500; }
.article-link .al-sum { font-size: 12.5px; color: var(--muted); }
.empty-cat { padding: 22px; border: 1px dashed var(--border); border-radius: 10px; color: var(--muted); text-align: center; font-size: 14px; margin-bottom: 22px; }
.back-link-old { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 14px; background: none; border: none; color: var(--royal); font-size: 13.5px; cursor: pointer; font-family: var(--sans); }
.back-link:hover { text-decoration: underline; }
.article-body p { margin-bottom: 12px; max-width: 70ch; line-height: 1.65; }

/* Decon article (carried over from Dan's Terminal) */
.vendor-panel { max-width: 980px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; margin-bottom: 32px; }
.vendor-panel-header { background: var(--navy-bg); padding: 14px 20px; display: flex; align-items: center; justify-content: space-between; }
.vendor-panel-header h2 { font-family: var(--gothic); font-size: 15px; letter-spacing: 0.08em; text-transform: uppercase; color: #fff; }
.vendor-panel-body { padding: 24px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 24px; }
.data-table th { background: var(--navy-bg); color: #fff; padding: 8px 12px; text-align: left; font-size: 11px; letter-spacing: 0.05em; text-transform: uppercase; }
.data-table td { padding: 8px 12px; border-bottom: 1px solid var(--border); }
.data-table tr:nth-child(even) td { background: var(--bg); }
.data-table tr:hover td { background: var(--sky); }
.sku-cell { font-family: var(--mono); font-size: 12px; color: var(--royal); }
.steps-section { margin-bottom: 24px; }
.steps-section h3 { font-family: var(--gothic); font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--navy); margin-bottom: 12px; border-left: 3px solid var(--gold); padding-left: 10px; }
.steps-list { list-style: none; counter-reset: steps; }
.steps-list li { counter-increment: steps; position: relative; padding-left: 36px; margin-bottom: 12px; font-size: 13.5px; line-height: 1.6; }
.steps-list li::before { content: counter(steps); position: absolute; left: 0; top: 1px; width: 24px; height: 24px; background: var(--royal); color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; }
.steps-list li a { color: var(--royal); }
.field-highlight { font-family: var(--mono); font-size: 0.9em; background: var(--sky); padding: 1px 5px; border-radius: 3px; color: var(--navy); }
.notes-block { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 18px; margin-top: 8px; font-family: var(--mono); font-size: 13px; line-height: 1.8; white-space: pre-wrap; color: var(--text); }
.notes-controls { display: flex; gap: 10px; align-items: flex-end; margin-bottom: 14px; flex-wrap: wrap; }
.notes-controls label { font-size: 12px; font-weight: 600; color: var(--text); display: block; margin-bottom: 4px; }
.notes-input { height: 38px; padding: 0 10px; border: 1.5px solid var(--border); border-radius: 6px; font-family: var(--sans); font-size: 13px; color: var(--text); background: var(--input-bg); outline: none; width: 220px; }
.notes-input:focus { border-color: var(--royal); }
.copied-msg { font-size: 12px; color: var(--green); font-weight: 600; align-self: center; }
.info-box { background: var(--sky); border: 1px solid var(--lt-blue); border-radius: 6px; padding: 12px 16px; margin-bottom: 20px; font-size: 13px; color: var(--navy); }
.info-box strong { font-weight: 700; }
.divider { border: none; border-top: 1px solid var(--border); margin: 24px 0; }

/* ════ Tool blocks carried over from the previous index.html ════════════ */

/* Breadcrumb (Information) */
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; padding: 6px; margin-bottom: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.crumb { display: inline-flex; align-items: center; gap: 8px; padding: 9px 13px; border: none; background: none; border-radius: 7px; font-family: var(--sans); font-size: 15px; font-weight: 500; color: var(--royal); cursor: pointer; transition: background .15s; }
button.crumb:hover { background: var(--sky); }
.crumb.current { color: var(--text); font-weight: 700; cursor: default; }
button.crumb.current:hover { background: none; }
.crumb-sep { color: var(--muted); }

/* Dashboard customization */
.dash-customize-bar { display: flex; justify-content: flex-end; padding-top: 6px; }
.cust-panel { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--gold); border-radius: 10px; padding: 16px 18px; margin: 8px 0 4px; animation: pageIn .2s var(--ease) both; }
.cust-title { font-family: var(--gothic); font-size: 15px; letter-spacing: .12em; text-transform: uppercase; color: var(--navy); }
.cust-toggles { display: flex; flex-wrap: wrap; gap: 10px 26px; margin: 12px 0 8px; }
.cust-toggle { display: inline-flex; align-items: center; gap: 9px; font-size: 14.5px; cursor: pointer; min-height: 28px; }
.cust-toggle input { width: 18px; height: 18px; accent-color: var(--royal); }
.cust-note { font-size: 12.5px; color: var(--muted); }
.dash-row.dim { opacity: .6; }
.hidden-tag { margin-left: 10px; font-style: normal; font-family: var(--sans); font-size: 11px; letter-spacing: .03em; text-transform: none; background: var(--sky); color: var(--navy); padding: 2px 9px; border-radius: 999px; }
.link-pill-wrap { position: relative; display: inline-flex; }
.link-pill-wrap.editing .link-pill { padding-right: 34px; }
.link-remove { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 21px; height: 21px; border-radius: 50%; border: none; background: var(--border); color: var(--text); cursor: pointer; display: grid; place-items: center; }
.link-remove:hover { background: var(--red); color: #fff; }
.link-add { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; align-items: center; }
.link-add .form-input { flex: 1; min-width: 150px; max-width: 280px; width: auto; padding: 9px 12px; }
.link-err { width: 100%; color: var(--red); font-size: 13px; }

/* Catalog search — phone cards */
.m-sort { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.m-sort label { font-size: 13px; color: var(--muted); white-space: nowrap; }
.m-sort select { flex: 1; padding: 10px 12px; }
.m-list { display: flex; flex-direction: column; gap: 8px; }
.m-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.m-card.open { border-color: var(--royal); }
.m-card-head { display: block; width: 100%; text-align: left; background: none; border: none; padding: 12px 14px; cursor: pointer; color: var(--text); font-family: var(--sans); }
.m-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 4px; }
.m-loc { font-family: var(--mono); font-weight: 700; font-size: 15px; }
.m-name { display: block; font-size: 15px; line-height: 1.35; }
.m-sku { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; font-family: var(--mono); font-size: 13px; color: var(--royal); }
.m-chev { color: var(--muted); transition: transform .15s; }
.m-card.open .m-chev { transform: rotate(180deg); }
.m-detail { padding: 2px 14px 14px; border-top: 1px solid var(--border); background: var(--surface-2); }
.m-detail .detail-cell, .m-detail .detail-grid { padding: 0; }
.m-detail .detail-grid { grid-template-columns: 1fr 1fr; gap: 10px 14px; padding-top: 12px; }
.ql-group { color: var(--text); opacity: .8; }

/* Settings */
.settings-backdrop { position: fixed; inset: 0; z-index: 290; }
.settings-panel {
    position: fixed; top: calc(var(--nav-h) + 8px); right: 12px; width: 340px; max-width: calc(100vw - 24px); z-index: 295;
    background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0,0,0,.35); padding: 16px 16px 14px; animation: qlIn .16s var(--ease) both;
}
.sp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.sp-title { font-family: var(--serif); font-size: 24px; }
.sp-close { width: 32px; height: 32px; display: grid; place-items: center; border: none; border-radius: 8px; background: none; color: var(--muted); cursor: pointer; }
.sp-close:hover { background: var(--sky); color: var(--text); }
.sp-section { padding: 12px 0; border-top: 1px solid var(--border); }
.sp-label { font-family: var(--gothic); font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.sp-themes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sp-theme { display: flex; flex-direction: column; justify-content: flex-start; text-align: left; padding: 10px; border-radius: 10px; border: 2px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; font-family: var(--sans); transition: border-color .15s, transform .12s var(--ease); }
.sp-theme:hover { border-color: var(--royal); transform: translateY(-1px); }
.sp-theme.on { border-color: var(--gold); box-shadow: 0 0 0 2px rgb(var(--ring-rgb) / .25); }
.sp-swatches { display: flex; height: 26px; border-radius: 6px; overflow: hidden; border: 1px solid rgba(0,0,0,.12); margin-bottom: 8px; }
.sp-swatches span { flex: 1; }
.sp-theme-name { display: block; font-weight: 700; font-size: 14px; }
.sp-theme-desc { display: block; font-size: 11.5px; color: var(--muted); line-height: 1.35; }
.sp-seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 3px; }
.sp-seg button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; border: none; border-radius: 8px; background: none; color: var(--muted); cursor: pointer; font-family: var(--sans); font-size: 14px; font-weight: 500; transition: background .15s, color .15s; }
.sp-seg button.on { background: var(--navy-bg); color: var(--gold); }
.sp-link { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; color: var(--text); text-decoration: none; font-size: 14px; background: var(--surface-2); transition: border-color .15s, background .15s; }
.sp-link:hover { border-color: var(--royal); background: var(--sky); }
@media (max-width: 600px) {
    .settings-panel { right: 8px; left: 8px; width: auto; max-width: none; }
}
[data-palette="autumn"][data-theme="dark"] .card h2, [data-palette="autumn"][data-theme="dark"] .page-head h1 { color: var(--navy); }

/* Game frames */
.bk-wrap { max-width: none; margin: 0; padding: 4px 12px 10px; }
.bk-frame { display: block; width: 100%; border: 0; background: transparent; min-height: 480px; }
.bk-missing { padding: 28px 20px; text-align: center; color: var(--muted); border: 1px dashed var(--border); border-radius: 10px; margin: 20px 0; }

/* Signed-in profile: avatar chip, sync badge, profile section of Settings */
.avatar { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--gold); color: #1d0e06; font-family: var(--gothic); font-size: 13px; letter-spacing: .02em; font-weight: 700; flex-shrink: 0; }
.avatar.lg { width: 44px; height: 44px; font-size: 19px; }
.sync-badge { display: inline-flex; align-items: center; gap: 6px; }
.sync-badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.sync-badge.syncing::before { background: var(--gold); animation: dotPulse 1s ease-in-out infinite; }
.sync-badge.error { color: #ffb3a5; }
.sync-badge.error::before { background: var(--red); }
.statusbar-right { gap: 14px; }
.settings-panel { max-height: calc(100vh - var(--nav-h) - var(--status-h) - 24px); overflow-y: auto; }
.sp-who { display: flex; align-items: center; gap: 12px; }
.sp-who-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.sp-who-text strong { font-size: 15px; }
.sp-who-text small { font-size: 11.5px; color: var(--muted); }
.sp-switch { border: 1px solid var(--border); background: var(--surface-2); color: var(--text); border-radius: 8px; padding: 7px 11px; font-size: 12.5px; cursor: pointer; font-family: var(--sans); white-space: nowrap; }
.sp-switch:hover { border-color: var(--royal); background: var(--sky); }
.sp-field { display: flex; flex-direction: column; gap: 5px; margin-top: 12px; font-size: 12px; color: var(--muted); }
.sp-field input { height: 38px; padding: 0 12px; border: 1.5px solid var(--border); border-radius: 8px; background: var(--input-bg); color: var(--text); font-size: 14px; font-family: var(--sans); outline: none; }
.sp-field input:focus { border-color: var(--royal); }
.sp-file { cursor: pointer; position: relative; }
.sp-file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.sp-msg { margin-top: 8px; font-size: 12.5px; color: var(--muted); }
@media (max-width: 600px) { .sync-badge:not(.error) { display: none; } }

/* Leaderboard */
.lb-page { max-width: 1100px; margin: 0 auto; padding: 4px 28px 40px; }
.lb-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 18px; }
.lb-card { background: var(--surface); border: 1px solid var(--border); border-top: 3px solid var(--royal); border-radius: 12px; padding: 16px 18px 12px; }
.lb-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.lb-head h2 { flex: 1; font-size: 26px; color: var(--text); }
.lb-ico { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 9px; background: var(--sky); color: var(--royal); }
.lb-list { list-style: none; }
.lb-row { display: grid; grid-template-columns: 34px 1fr auto 56px; align-items: center; gap: 10px; padding: 9px 8px; border-bottom: 1px solid var(--border); font-size: 14px; }
.lb-row:last-child { border-bottom: none; }
.lb-row.mine { background: var(--sky); border-radius: 8px; border-bottom-color: transparent; }
.lb-rank { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; font-family: var(--mono); font-size: 13px; color: var(--muted); }
.lb-rank.r1 { background: var(--gold); color: #1d0e06; font-weight: 700; }
.lb-rank.r2 { background: #c9ccd2; color: #1d1f24; font-weight: 700; }
.lb-rank.r3 { background: #c98a52; color: #1d0e06; font-weight: 700; }
.lb-name { display: flex; flex-direction: column; min-width: 0; font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.lb-name em { font-style: normal; font-weight: 400; color: var(--muted); }
.lb-name small { font-size: 11.5px; font-weight: 400; color: var(--muted); }
.lb-score { font-family: var(--mono); font-size: 15px; font-weight: 700; color: var(--text); }
.lb-date { font-size: 11.5px; color: var(--muted); text-align: right; }
.lb-empty { padding: 26px 8px; text-align: center; color: var(--muted); font-size: 14px; }
.lb-foot { margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); }
.lb-foot strong { color: var(--text); }
.lb-note { margin-top: 14px; font-size: 12.5px; color: var(--muted); }
@media (max-width: 700px) { .lb-page { padding: 0 14px 32px; } .lb-grid { grid-template-columns: 1fr; } .lb-row { grid-template-columns: 30px 1fr auto; } .lb-date { display: none; } }

/* Data Files (upload) */
.df-page { max-width: 1180px; margin: 0 auto; padding: 4px 28px 40px; }
.df-drop-main { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 26px 20px; text-align: center; cursor: pointer; color: var(--muted);
    background: var(--surface); border: 2px dashed var(--border); border-radius: 14px; transition: border-color .15s, background .15s; margin-bottom: 18px; }
.df-drop-main strong { font-size: 18px; color: var(--text); }
.df-drop-main:hover, .df-drop-main.over, .df-card.over { border-color: var(--royal); background: var(--sky); }
.df-drop-main input, .df-drop-slot input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.df-pending { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.df-pending .form-select { width: auto; min-width: 200px; }
.df-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); gap: 18px; }
.df-card { background: var(--surface); border: 1px solid var(--border); border-top: 3px solid var(--royal); border-radius: 12px; padding: 16px 18px; transition: border-color .15s, background .15s; }
.df-card.done { border-top-color: var(--green); }
.df-card header { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.df-card h2 { font-size: 25px; color: var(--text); }
.df-fname { font-size: 11.5px; color: var(--muted); }
.df-note { font-size: 13px; color: var(--muted); margin: 4px 0 12px; }
.df-current { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; font-size: 13.5px; margin-bottom: 12px; }
.df-current .k { font-family: var(--gothic); font-size: 12px; letter-spacing: .13em; text-transform: uppercase; color: var(--muted); }
.df-current small { font-size: 11.5px; color: var(--muted); }
.df-drop-slot { position: relative; display: block; text-align: center; padding: 18px 12px; border: 1.5px dashed var(--border); border-radius: 10px; font-size: 13.5px; color: var(--muted); cursor: pointer; }
.df-drop-slot:hover { border-color: var(--royal); }
.df-staged { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: var(--surface-2); }
.df-staged-head { display: flex; align-items: center; gap: 8px; font-size: 13.5px; margin-bottom: 6px; }
.df-staged-head span { color: var(--muted); font-size: 12px; }
.df-x { margin-left: auto; width: 24px; height: 24px; display: grid; place-items: center; border: none; border-radius: 50%; background: var(--border); color: var(--text); cursor: pointer; }
.df-x:hover { background: var(--red); color: #fff; }
.df-check { display: flex; gap: 8px; font-size: 13px; padding: 3px 0; line-height: 1.4; }
.df-mark { flex-shrink: 0; width: 18px; height: 18px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff; background: var(--muted); }
.df-check.ok .df-mark { background: var(--green); }
.df-check.warn .df-mark { background: #d98a0a; }
.df-check.err .df-mark { background: var(--red); }
.df-check.err { color: var(--red); }
.df-ack { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 13px; cursor: pointer; }
.df-ack input { width: 17px; height: 17px; accent-color: var(--royal); }
.df-run { display: flex; align-items: flex-start; gap: 9px; margin-top: 10px; font-size: 13px; padding: 9px 11px; border-radius: 8px; background: var(--sky); }
.df-run.live { background: rgba(0,173,110,.14); }
.df-run.live .df-mark { background: var(--green); }
.df-run.error { background: rgba(255,91,69,.14); }
.df-run.error .df-mark { background: var(--red); }
.df-spin { flex-shrink: 0; width: 16px; height: 16px; margin-top: 1px; border-radius: 50%; border: 2px solid var(--border); border-top-color: var(--royal); animation: dfspin .8s linear infinite; }
@keyframes dfspin { to { transform: rotate(360deg); } }
.df-bar { position: sticky; bottom: 8px; display: flex; align-items: flex-end; justify-content: flex-end; gap: 14px; flex-wrap: wrap; margin-top: 18px; padding: 12px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 6px 24px rgba(0,0,0,.12); }
.df-pw { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); margin-right: auto; }
.df-pw input { width: 230px; padding: 8px 10px; }
.df-count { font-size: 13px; color: var(--muted); align-self: center; }
.df-foot { margin-top: 12px; font-size: 12.5px; color: var(--muted); }
@media (max-width: 900px) { .df-page { padding: 0 14px 32px; } .df-grid { grid-template-columns: 1fr; } .df-pw input { width: 100%; } }

.df-versions { margin-top: 10px; font-size: 13px; }
.df-versions summary { cursor: pointer; color: var(--muted); padding: 4px 0; }
.df-versions summary:hover { color: var(--royal); }
.df-versions ul { list-style: none; margin: 6px 0; }
.df-versions li { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.df-versions li span { flex: 1; min-width: 0; } .df-versions li em { font-style: normal; color: var(--green); font-weight: 500; }
.df-versions li a { font-size: 12.5px; }
.df-versions small { display: block; margin-top: 6px; color: var(--muted); font-size: 11.5px; }
.df-bundled { margin-top: 4px; }

/* One header button for settings + who is signed in */
.topbar-account {
    display: inline-flex; align-items: center; gap: 9px; height: 34px; padding: 0 14px 0 11px; margin-left: 6px;
    background: rgba(255,255,255,.1); color: #fff; border: 1px solid rgba(255,255,255,.22); border-radius: 999px; cursor: pointer;
    font-family: var(--sans); font-size: 13.5px; font-weight: 500; transition: background .15s, border-color .15s, transform .08s;
}
.topbar-account:hover, .topbar-account[aria-expanded="true"] { background: rgba(255,255,255,.2); border-color: rgba(255,255,255,.4); }
.topbar-account:active { transform: scale(.97); }
.topbar-account .icon { color: var(--gold); }
@media (max-width: 900px) { .topbar-account-name { display: none; } .topbar-account { width: 36px; padding: 0; justify-content: center; margin-left: 0; } }
        /* ── Cards ───────────────────────────────────────────────────────── */
        .card {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 10px;
            padding: 28px;
            margin-bottom: 24px;
            box-shadow: 0 1px 4px rgba(0,0,0,0.06);
        }
        .card h2 {
            color: var(--royal);
            font-size: 26px;
            margin-bottom: 20px;
            padding-bottom: 12px;
            border-bottom: 2px solid var(--sky);
            font-family: var(--serif);
            font-weight: 400;
        }
        .card h3 {
            color: var(--navy);
            font-size: 11px;
            font-weight: 700;
            letter-spacing: 0.12em;
            text-transform: uppercase;
            font-family: var(--gothic);
            margin-bottom: 14px;
        }
        .card-sm { padding: 20px; }

        /* ── Form Elements ───────────────────────────────────────────────── */
        .form-group { margin-bottom: 18px; }
        .form-label {
            display: block;
            font-weight: 700;
            font-size: 10.5px;
            color: var(--navy);
            margin-bottom: 7px;
            letter-spacing: 0.1em;
            text-transform: uppercase;
            font-family: var(--gothic);
        }
        .form-input, .form-textarea, .form-select {
            width: 100%;
            padding: 10px 14px;
            border: 1.5px solid var(--gray);
            border-radius: 6px;
            font-size: 14.5px;
            font-family: var(--sans);
            color: var(--text);
            background: var(--input-bg);
            transition: all 0.15s;
            outline: none;
        }
        .form-input:focus, .form-textarea:focus, .form-select:focus {
            border-color: var(--royal);
            box-shadow: 0 0 0 3px rgb(var(--ring-rgb) / 0.1);
        }
        .form-textarea { font-family: var(--mono); font-size: 13px; resize: vertical; }
        .form-select { cursor: pointer; }

        /* ── Buttons ─────────────────────────────────────────────────────── */
        .btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            padding: 10px 22px;
            font-weight: 700;
            border-radius: 6px;
            cursor: pointer;
            border: 1.5px solid transparent;
            font-size: 12px;
            letter-spacing: 0.1em;
            text-transform: uppercase;
            transition: all 0.15s;
            font-family: var(--gothic);
            white-space: nowrap;
        }
        .btn:disabled { opacity: 0.45; cursor: not-allowed; }
        .btn-primary { background: var(--royal); color: #fff; border-color: var(--royal); }
        .btn-primary:hover:not(:disabled) { background: var(--navy-bg); border-color: var(--navy); }
        .btn-gold { background: var(--gold); color: var(--royal); border-color: var(--gold); }
        .btn-gold:hover:not(:disabled) { background: var(--haze); }
        .btn-outline { background: transparent; color: var(--royal); border-color: var(--royal); }
        .btn-outline:hover:not(:disabled) { background: var(--sky); }
        .btn-ghost { background: transparent; color: var(--muted); border-color: var(--border); }
        .btn-ghost:hover:not(:disabled) { background: var(--bg); color: var(--text); }
        .btn-red { background: var(--red); color: #fff; border-color: var(--red); }
        .btn-red:hover:not(:disabled) { background: #e54a35; }
        .btn-block { width: 100%; }
        .btn-sm { padding: 7px 14px; font-size: 12px; }

        .btn-group { display: flex; gap: 12px; flex-wrap: wrap; }
        .btn-group .btn { flex: 1; min-width: 120px; }

        /* ── Alerts ──────────────────────────────────────────────────────── */
        .alert {
            padding: 14px 18px;
            border-radius: 8px;
            margin-bottom: 18px;
            border-left: 4px solid;
            font-size: 14px;
        }
        .alert-success { background: #e6faf3; border-color: var(--green); color: #03522a; }
        .alert-error   { background: #fff0ed; border-color: var(--red);   color: var(--dark-red); }
        .alert-info    { background: var(--sky); border-color: var(--lt-blue); color: var(--navy); }
        .alert-warn    { background: #fffbe6; border-color: var(--gold);  color: #6b4f00; }

        /* ── Grid Utilities ──────────────────────────────────────────────── */
        .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
        .grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 18px; }
        .grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }

        /* ── Tables ──────────────────────────────────────────────────────── */
        .table-wrap { overflow-x: auto; border-radius: 8px; border: 1.5px solid var(--navy); }
        table { width: 100%; border-collapse: collapse; }
        th, td { padding: 12px 10px; border-bottom: 1px solid var(--border); text-align: left; }
        th {
            background: var(--sky);
            font-weight: 700;
            color: var(--navy);
            font-family: var(--gothic);
            font-size: 11px;
            letter-spacing: 0.1em;
            text-transform: uppercase;
            cursor: pointer;
            white-space: nowrap;
            position: sticky;
            top: 0;
        }
        th:hover { background: #c5dbf5; }
        tbody tr:hover { background: #fafbfd; }
        tbody tr:last-child td { border-bottom: none; }

        .search-results-card { margin-top: 24px; }

        /* ══════════════════════════════════════════════════════════════════
           FORMS PAGE — tabs for Packing Slip / Hazmat / History
        ══════════════════════════════════════════════════════════════════ */
        .sub-tabs {
            display: flex;
            gap: 0;
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 8px;
            padding: 4px;
            margin-bottom: 24px;
            width: fit-content;
        }
        .sub-tab {
            padding: 9px 22px;
            font-weight: 700;
            background: none;
            border: none;
            color: var(--muted);
            cursor: pointer;
            border-radius: 6px;
            transition: all 0.15s;
            font-size: 11px;
            font-family: var(--gothic);
            letter-spacing: 0.1em;
            text-transform: uppercase;
            display: flex;
            align-items: center;
            gap: 6px;
        }
        .sub-tab:hover { color: var(--royal); background: var(--sky); }
        .sub-tab.active { background: var(--royal); color: var(--gold); font-weight: 700; }

        /* ══════════════════════════════════════════════════════════════════
           HAZMAT BOL
        ══════════════════════════════════════════════════════════════════ */
        .bol-section-label {
            font-size: 9.5px;
            letter-spacing: 0.16em;
            text-transform: uppercase;
            font-weight: 700;
            color: var(--gold);
            background: var(--royal);
            padding: 4px 10px;
            border-radius: 4px;
            display: inline-block;
            margin-bottom: 14px;
            font-family: var(--gothic);
        }

        /* ══════════════════════════════════════════════════════════════════
           HISTORY
        ══════════════════════════════════════════════════════════════════ */
        .history-item {
            border: 1px solid var(--border);
            border-radius: 8px;
            padding: 18px 20px;
            margin-bottom: 12px;
            background: var(--input-bg);
            transition: all 0.15s;
            display: flex;
            align-items: flex-start;
            gap: 16px;
        }
        .history-item:hover { border-color: var(--lt-blue); box-shadow: 0 2px 8px rgb(var(--ring-rgb) / 0.06); }
        .history-item-type-badge {
            font-size: 9.5px;
            font-weight: 700;
            letter-spacing: 0.1em;
            text-transform: uppercase;
            padding: 3px 8px;
            border-radius: 4px;
            white-space: nowrap;
            flex-shrink: 0;
            font-family: var(--gothic);
        }
        .badge-packing  { background: var(--sky); color: var(--navy); }
        .badge-hazmat   { background: #fff0ed; color: var(--dark-red); border: 1px solid #ffb3a5; }
        .badge-newproduct { background: #e6f9f0; color: #005c3b; border: 1px solid #6fcca4; }
        .history-item-body { flex: 1; min-width: 0; }
        .history-item-title { font-weight: 600; color: var(--navy); font-size: 15px; margin-bottom: 3px; }
        .history-item-meta  { font-size: 12.5px; color: var(--muted); }
        .history-item-actions { display: flex; gap: 8px; flex-shrink: 0; }
        .preview-scroll { max-height: 380px; overflow-y: auto; }

        /* ══════════════════════════════════════════════════════════════════
           CYCLE COUNT
        ══════════════════════════════════════════════════════════════════ */
        .scan-display {
            background: var(--navy-bg);
            border: 2px solid var(--gold);
            border-radius: 10px;
            padding: 24px;
            margin-bottom: 20px;
            color: #fff;
        }
        .scan-display .item-name { font-size: 20px; font-family: var(--serif); margin-bottom: 6px; }
        .scan-display .item-detail { font-size: 14px; color: rgba(219,238,255,0.8); margin-bottom: 4px; }
        .scan-display .item-qty-label { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold); margin-top: 14px; margin-bottom: 6px; }
        .count-input-lg {
            font-size: 36px;
            font-family: var(--mono);
            text-align: center;
            padding: 18px;
            border: 2px solid var(--green);
            border-radius: 8px;
            width: 100%;
            outline: none;
            background: var(--input-bg);
            transition: border-color 0.15s;
        }
        .count-input-lg.recount { border-color: var(--red); }
        .count-input-lg:focus { box-shadow: 0 0 0 3px rgba(0,173,110,0.15); }
        .session-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
            padding: 16px 20px;
            background: var(--royal);
            border-radius: 8px;
            color: #fff;
        }
        .session-header h3 { font-family: var(--mono); font-size: 18px; color: var(--gold); }
        .session-header p  { font-size: 13px; color: rgba(255,255,255,0.75); margin-top: 2px; }

        /* ══════════════════════════════════════════════════════════════════
           LABEL GENERATOR
        ══════════════════════════════════════════════════════════════════ */
        .label-app {
            display: grid;
            grid-template-columns: 300px 1fr;
            gap: 24px;
            align-items: start;
        }
        .label-sidebar { position: sticky; top: calc(var(--nav-h) + 20px); }
        .label-sidebar .card { margin-bottom: 16px; }
        .label-sidebar .card h3 { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--border); padding-bottom: 8px; margin-bottom: 14px; font-family: var(--sans); font-weight: 700; }

        .drop-zone {
            position: relative;
            border: 2px dashed var(--gray);
            border-radius: 8px;
            padding: 24px 16px;
            text-align: center;
            cursor: pointer;
            transition: all 0.18s;
            background: var(--bg);
        }
        .drop-zone:hover, .drop-zone.over { border-color: var(--royal); background: var(--sky); }
        .drop-zone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
        .drop-zone-icon { font-size: 28px; margin-bottom: 8px; }
        .drop-zone p { font-size: 13px; color: var(--muted); line-height: 1.5; }
        .drop-zone strong { color: var(--text); }

        .file-pill {
            display: none;
            margin-top: 10px;
            background: var(--sky);
            border: 1px solid var(--lt-blue);
            border-radius: 6px;
            padding: 8px 12px;
            align-items: center;
            gap: 8px;
            font-size: 12px;
        }
        .file-pill.show { display: flex; }
        .fp-name { font-family: var(--mono); color: var(--royal); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

        .label-err {
            display: none;
            margin-top: 10px;
            background: #fff0ed;
            border: 1px solid #ffb3a5;
            border-radius: 6px;
            padding: 10px 12px;
            font-size: 12px;
            color: var(--dark-red);
        }
        .label-err.show { display: block; }

        .col-map {
            background: var(--bg);
            border: 1px solid var(--border);
            border-radius: 6px;
            padding: 10px 12px;
            font-size: 11px;
            font-family: var(--mono);
            line-height: 2;
            color: var(--muted);
            margin-top: 12px;
        }
        .col-map span { color: var(--royal); font-weight: 700; }

        /* Label preview sheet */
        .label-preview-area {
            background: #3a3a3a;
            border-radius: 10px;
            padding: 24px;
            min-height: 400px;
            display: flex;
            flex-direction: column;
            align-items: center;
        }
        .label-pg-header {
            width: 100%;
            max-width: 816px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 12px;
            color: rgba(255,255,255,0.6);
            font-size: 12px;
        }
        .label-sheet {
            background: white;
            width: 816px;
            height: 1056px;
            position: relative;
            flex-shrink: 0;
            box-shadow: 0 12px 60px rgba(0,0,0,0.5);
            margin-bottom: 24px;
        }
        .lc { position: absolute; overflow: hidden; background: var(--input-bg); border: 0.5px solid #ddd; font-family: 'Source Sans 3', Arial, sans-serif; color: #111; }
        .lc-inner { padding: 8px 10px 5px; height: 100%; display: flex; flex-direction: column; }
        .lc-bc { flex-shrink: 0; width: 100%; overflow: hidden; }
        .lc-bc svg { display: block; width: 100% !important; height: auto; }
        .lc-num { text-align: center; font-size: 13px; font-weight: 700; color: #000; margin-top: 2px; padding-top: 2px; flex-shrink: 0; letter-spacing: 0.04em; }
        .lc-name { text-align: center; font-size: 8px; color: #222; line-height: 1.3; margin-top: 2px; flex-shrink: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
        .lc-bottom { display: flex; flex: 1; gap: 5px; min-height: 0; align-items: flex-start; margin-top: 3px; }
        .lc-left, .lc-right { display: flex; flex-direction: column; gap: 2px; overflow: hidden; flex: 1; }
        .lc-right { text-align: right; align-items: flex-end; }
        .lc-field { font-size: 9.5px; color: #333; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; line-height: 1.4; }
        .lc-field b { color: #000; }
        .lc-loc { font-size: 9.5px; font-weight: 700; color: #000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; line-height: 1.4; }
        .lc-empty { background: #f8f8f8; }

        .label-empty-state {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            min-height: 300px;
            width: 100%;
            color: rgba(255,255,255,0.4);
            text-align: center;
            gap: 12px;
        }
        .label-empty-state .ei { font-size: 52px; opacity: 0.5; }
        .label-empty-state p { font-size: 14px; max-width: 240px; line-height: 1.6; }

        /* Label queue */
        .queue-item-row {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 8px 10px;
            background: var(--bg);
            border: 1px solid var(--border);
            border-radius: 6px;
            margin-bottom: 6px;
        }
        .qi-num { font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--royal); }
        .qi-name-s { font-size: 11px; color: var(--muted); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
        .qi-copies { font-size: 10.5px; color: var(--lt-blue); font-family: var(--mono); }
        .qi-del { background: none; border: none; color: var(--gray); cursor: pointer; font-size: 16px; line-height: 1; padding: 0 3px; }
        .qi-del:hover { color: var(--red); }

        /* Toggle switch */
        .toggle-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            margin-top: 12px;
            padding: 10px 12px;
            background: var(--bg);
            border: 1px solid var(--border);
            border-radius: 6px;
            cursor: pointer;
        }
        .toggle-label-text { font-size: 12.5px; color: var(--text); }
        .toggle-label-text small { display: block; font-size: 11px; color: var(--muted); margin-top: 1px; }
        .toggle-switch { position: relative; width: 36px; height: 20px; flex-shrink: 0; }
        .toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
        .toggle-track {
            position: absolute; inset: 0; border-radius: 10px;
            background: var(--gray); border: 1px solid var(--border);
            transition: background 0.2s;
        }
        .toggle-switch input:checked + .toggle-track { background: var(--royal); border-color: var(--royal); }

        /* Label spinner */
        .spinner {
            width: 15px; height: 15px;
            border: 2px solid rgb(var(--ring-rgb) / 0.25);
            border-top-color: var(--royal);
            border-radius: 50%;
            animation: spin 0.7s linear infinite;
            display: none;
        }
        @keyframes spin { to { transform: rotate(360deg); } }

        /* Manual label entry tabs */
        .label-source-tabs {
            display: flex;
            gap: 4px;
            background: var(--bg);
            border: 1px solid var(--border);
            border-radius: 6px;
            padding: 3px;
            margin-bottom: 14px;
        }
        .lst-tab {
            flex: 1;
            padding: 7px 10px;
            border: none;
            border-radius: 5px;
            background: none;
            color: var(--muted);
            font-family: var(--gothic);
            font-size: 11px;
            font-weight: 700;
            letter-spacing: 0.1em;
            text-transform: uppercase;
            cursor: pointer;
            transition: all 0.15s;
        }
        .lst-tab:hover { color: var(--royal); }
        .lst-tab.active { background: var(--royal); color: var(--gold); }


        /* ── Modal overlay ─────────────────────────────────────────────── */
        .modal-backdrop {
            position: fixed;
            inset: 0;
            background: rgba(0,11,32,0.65);
            backdrop-filter: blur(3px);
            z-index: 500;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 20px;
        }
        .modal {
            background: var(--surface);
            border-radius: 12px;
            box-shadow: 0 24px 80px rgba(0,0,0,0.4);
            width: 100%;
            max-width: 760px;
            max-height: 88vh;
            display: flex;
            flex-direction: column;
            overflow: hidden;
        }
        .modal-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 20px 24px 16px;
            border-bottom: 2px solid var(--sky);
            flex-shrink: 0;
        }
        .modal-header h2 {
            margin: 0;
            font-size: 22px;
            color: var(--royal);
            border: none;
            padding: 0;
        }
        .modal-header-actions { display: flex; gap: 10px; align-items: center; }
        .modal-close {
            background: none;
            border: none;
            font-size: 22px;
            color: var(--muted);
            cursor: pointer;
            line-height: 1;
            padding: 2px 6px;
            border-radius: 4px;
            transition: all 0.15s;
        }
        .modal-close:hover { background: var(--bg); color: var(--text); }
        .modal-body {
            padding: 24px;
            overflow-y: auto;
            flex: 1;
        }
        @media (max-width: 600px) {
            .modal-backdrop { padding: 0; align-items: flex-end; }
            .modal { max-width: 100%; max-height: 92vh; border-radius: 16px 16px 0 0; }
        }

/* ════ Responsive ═══════════════════════════════════════════════════════ */
.chip-sub { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

@media (max-width: 900px) {
    /* Full-screen menu: big tiles for tools, one tap to the catalog */
    .sidebar { left: 0; right: 0; width: 100% !important; top: var(--nav-h); bottom: var(--status-h); z-index: 400; overflow-y: auto;
               opacity: 0; visibility: hidden; pointer-events: none; transform: translateY(10px);
               transition: opacity .2s ease, transform .24s var(--ease), visibility 0s linear .24s; }
    .sidebar.mobile-open { opacity: 1; visibility: visible; pointer-events: auto; transform: none; transition-delay: 0s; box-shadow: none; }
    .sidebar-scrim, .sidebar-collapse { display: none !important; }
    .sidebar-logo { padding: 26px 24px 10px; }
    .sidebar-logo img { max-width: 230px; margin: 0 auto; }
    .sidebar-search-link { padding: 12px 20px 8px; }
    .nav-item.nav-search { height: 50px; font-size: 18px; justify-content: center; border-radius: 12px; }
    .sidebar-nav { flex: none; overflow: visible; padding: 8px 20px 28px; }
    .nav-section { margin-bottom: 14px; }
    .nav-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
    .nav-tiles .nav-section-title { grid-column: 1 / -1; padding: 6px 2px 0; font-size: 14px; }
    .nav-tiles .nav-item { flex-direction: column; justify-content: center; gap: 9px; height: 92px; margin: 0; padding: 8px; text-align: center; font-size: 17px;
                           background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.13); border-radius: 12px; }
    .nav-tiles .nav-item .icon { width: 26px; height: 26px; }
    .nav-tiles a.nav-item:last-of-type:nth-of-type(odd) { grid-column: 1 / -1; height: 64px; flex-direction: row; gap: 12px; }
    .nav-tiles .nav-item.active { background: rgba(255,184,28,.16); border-color: rgba(255,184,28,.6); }
    .nav-item:hover { transform: none; }
    .nav-item.active::before { display: none; }
    .nav-section-toggle { height: 50px; padding: 0 12px; font-size: 15px; background: rgba(255,255,255,.07); border-radius: 12px; }
    .nav-links-compact { margin-left: 0; padding-left: 4px; border-left: none; }
    .nav-links-compact a { padding: 11px 12px; font-size: 15px; }
    .sidebar-close-mobile { display: grid; place-items: center; position: absolute; top: 10px; right: 12px; width: 42px; height: 42px; border: none; border-radius: 10px; background: rgba(255,255,255,.1); color: #fff; cursor: pointer; }
    .main, .app.sb-collapsed .main { margin-left: 0; }
    .topbar-launch-label, .topbar-launch kbd { display: none; }
    .topbar-launch { width: 36px; padding: 0; justify-content: center; }
    .topbar-brand span { font-size: 13px; }
    .container { padding: 0 20px; }
    .page-head, .dash, .wiki, .search-page { padding-left: 20px; padding-right: 20px; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; gap: 14px; }
    .card { padding: 20px 18px; }
    .card h2 { font-size: 22px; }
    .sub-tabs { flex-wrap: wrap; width: 100%; }
    .sub-tab { flex: 1; min-width: 120px; justify-content: center; }
    .label-app { grid-template-columns: 1fr; }
    .label-sidebar { position: static; overflow: visible; max-height: none; }
    .label-sidebar .card:last-child { margin-bottom: 0; }
    .label-preview-area { padding: 16px 12px; }
    .label-preview-area > div { overflow-x: auto; width: 100%; }
    .session-header { flex-direction: column; align-items: flex-start; gap: 12px; }
    .session-header > div:last-child { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; }
    .session-header > div:last-child .btn { flex: 1; min-width: 80px; }
    .btn-group { flex-direction: column; }
    .btn-group .btn { width: 100%; }
    .history-item { flex-wrap: wrap; gap: 12px; }
    .history-item-actions { width: 100%; justify-content: flex-end; }
    .dash-hero h1 { font-size: 34px; }
    .status-panel { grid-template-columns: 1fr; }
    .status-cell { border-right: none; border-bottom: 1px solid var(--border); }
    .status-cell:last-child { border-bottom: none; }
    .statusbar-right { display: none; }
}
@media (max-width: 600px) {
    .container { padding: 0 16px; }
    .page-head { padding-top: 14px; }
    .page-head h1 { font-size: 26px; }
    .dash-search { height: 56px; }
    .dash-search button { padding: 0 20px; }
    .dash-search input { font-size: 16px; }
    .chip-row { grid-template-columns: 1fr; }
    .form-input, .form-textarea, .form-select { font-size: 16px; }
    .btn { padding: 13px 18px; font-size: 12px; }
    .btn-sm { padding: 10px 14px; }
    .count-input-lg { font-size: 28px; padding: 14px; }
    table { font-size: 13px; }
    th, td { padding: 10px 8px; }
    .tbl-dense th, .tbl-dense td { padding: 7px 8px; }
    .card { padding: 16px 14px; margin-bottom: 16px; }
    .card h2 { font-size: 20px; margin-bottom: 16px; }
    .sub-tab { padding: 9px 12px; font-size: 10px; }
    .history-item { padding: 14px; }
    .history-item-title { font-size: 14px; }
    .ql-backdrop { padding-top: 6vh; }
}

/* ════ Dark mode refinements for the carried-over tool styles ═══════════ */
[data-theme="dark"] tbody tr:hover { background: var(--surface-2); }
[data-theme="dark"] .tbl-dense tbody tr.result-row:hover,
[data-theme="dark"] .tbl-dense tbody tr.result-row.open { background: var(--sky); }
[data-theme="dark"] .card { box-shadow: none; }
[data-theme="dark"] .card h2 { border-bottom-color: var(--border); }
[data-theme="dark"] .alert-success { background: #0f3b27; color: #8ae9b7; }
[data-theme="dark"] .alert-error   { background: #4a1d1a; color: #ffb3a8; }
[data-theme="dark"] .alert-warn    { background: #3f3208; color: #ffd76a; }
[data-theme="dark"] .alert-info    { background: var(--sky); color: var(--text); }
[data-theme="dark"] .btn-gold { color: #0a1628; }
[data-theme="dark"] .btn-ghost:hover:not(:disabled) { background: var(--surface-2); }
[data-theme="dark"] .btn-outline { color: var(--navy); border-color: var(--royal); }
[data-theme="dark"] .btn-outline:hover:not(:disabled) { background: var(--sky); }
[data-theme="dark"] .form-input, [data-theme="dark"] .form-textarea, [data-theme="dark"] .form-select {
    background: var(--input-bg); color: var(--text); border-color: var(--border);
}
[data-theme="dark"] input, [data-theme="dark"] textarea, [data-theme="dark"] select { color-scheme: dark; }
[data-theme="dark"] .modal, [data-theme="dark"] .modal-header { background: var(--surface); color: var(--text); }
[data-theme="dark"] .modal-header { border-bottom-color: var(--border); }
[data-theme="dark"] .history-item { background: var(--surface); }
[data-theme="dark"] .history-item-title { color: var(--text); }
[data-theme="dark"] .badge-packing { background: var(--sky); color: var(--text); }
[data-theme="dark"] .badge-hazmat { background: #4a1d1a; color: #ffb3a8; border-color: #7a2f28; }
[data-theme="dark"] .badge-newproduct { background: #0f3b27; color: #8ae9b7; border-color: #1c6a46; }
[data-theme="dark"] .sub-tab { color: var(--muted); }
[data-theme="dark"] .sub-tab:hover { background: var(--sky); color: var(--text); }
[data-theme="dark"] .sub-tab.active { background: var(--navy-bg); color: var(--gold); }
[data-theme="dark"] .drop-zone { background: var(--surface-2); border-color: var(--border); }
[data-theme="dark"] .file-pill { background: var(--surface-2); }
[data-theme="dark"] .label-preview-area { background: var(--surface-2); }
[data-theme="dark"] .label-empty-state { color: var(--muted); }
/* Label sheets are previews of paper: keep them white */
[data-theme="dark"] .label-sheet, [data-theme="dark"] .lc { background: #fff; color: #000; }
[data-theme="dark"] .lc-empty { background: #f8f8f8; }
[data-theme="dark"] .scan-display { background: var(--navy-bg); }
[data-theme="dark"] .toggle-track { background: var(--border); }
[data-theme="dark"] .lst-tab { color: var(--muted); }
[data-theme="dark"] .lst-tab.active { background: var(--navy-bg); color: var(--gold); }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ════ Phone passover ═══════════════════════════════════════════════════ */
@media (max-width: 700px) {
    .search-bar { gap: 8px; }
    .search-bar input { height: 48px; font-size: 16px; padding: 0 12px; min-width: 0; }
    .search-bar .btn { padding: 0 16px !important; }
    .search-page, .dash, .wiki { padding-left: 14px; padding-right: 14px; }
    .page-head { padding-left: 14px; padding-right: 14px; gap: 4px 12px; }
    .page-head p { font-size: 13px; }
    .container { padding: 0 14px; }
    .dash-hero { padding: 22px 0 18px; }
    .dash-hero h1 { font-size: 32px; }
    .dash-hero p { font-size: 14px; margin-bottom: 16px; }
    .dash-hint { display: none; }
    .dash-customize-bar { padding-top: 2px; }
    .link-add .form-input { max-width: none; flex-basis: 100%; }
    .link-add .btn { flex: 1; }
    .crumb { padding: 10px 10px; font-size: 14.5px; }
    .vendor-panel-body { padding: 16px 14px; }
    .notes-controls > div, .notes-input { width: 100%; }
    .data-table { font-size: 12.5px; }
    .data-table th, .data-table td { padding: 8px 8px; }
    .ql-backdrop { padding: 0; align-items: stretch; }
    .ql-modal { max-width: none; max-height: none; border-radius: 0; }
    .ql-input-row { height: 56px; }
    .ql-foot { display: none; }
    .ql-results { flex: 1; }
    .ql-modal .ql-row { padding: 11px 10px; }
}

@media (max-width: 600px) {
    /* Inline two- and three-column form grids in the carried-over tools stack on phones */
    main [style*="grid-template-columns: 1fr 1fr"] { grid-template-columns: 1fr !important; }
}
