/* ==========================================================================
   GNFR — TorrentDay design system theme
   Source: torrentday-DESIGN.md (night-sky nav bar with sunrise logo, teal-grey
   canvas, white 14px cards with one soft shadow, burnt-orange primary action,
   Barlow Semi Condensed labels + Open Sans body at weight 500).
   Linked AFTER each page's inline <style>, so it overrides it.
   ========================================================================== */

:root {
    --td-brand:     #C2500A;
    --td-cta-a:     #C4530D;
    --td-cta-b:     #AD4309;
    --td-sun:       #FF8A3D;
    --td-amber:     #FFC46B;
    --td-rose:      #FF5E7A;
    --td-canvas:    #EEF3F3;
    --td-surface:   #FFFFFF;
    --td-alt:       #F6F9F9;
    --td-chip:      #EBF2F2;
    --td-chip-h:    #DBE7E8;
    --td-selected:  #0C2C38;
    --td-text:      #13262C;
    --td-muted:     #4D6367;
    --td-dim:       #5F757A;
    --td-border:    #D3DFE0;
    --td-soft:      #E7EEEF;
    --td-ok:        #0C7A4B;
    --td-ok-bg:     #E2F3EA;
    --td-err:       #C0263B;
    --td-err-bg:    #FFE6E9;
    --td-info-bg:   #FFF3E4;
    --td-info-bd:   #FFC48D;

    --td-sky: linear-gradient(90deg, #2C2138 0%, #1B2B3D 34%, #0C2C38 68%, #071D26 100%);
    --td-cta: linear-gradient(#C4530D, #AD4309);
    --td-cta-h: linear-gradient(#B44A0B, #983B08);
    --td-card-shadow: 0 1px 2px rgba(7,29,38,.05), 0 6px 18px -10px rgba(7,29,38,.18);
    --td-pop-shadow: 0 16px 36px -12px rgba(7,29,38,.34), 0 4px 10px -4px rgba(7,29,38,.12);
    --td-btn-shadow: inset 0 1px 0 rgba(255,255,255,.16), 0 1px 2px rgba(110,40,0,.22);
    --td-ring: inset 0 0 0 1px #D3DFE0;
    --td-sky-ring: inset 0 0 0 1px rgba(190,226,230,.22);

    --font-display: 'Barlow Semi Condensed', 'Arial Narrow', sans-serif;
    --font-body:    'Open Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;

    /* legacy variables used by every page's inline CSS, remapped */
    --primary:   #C2500A;
    --primary-h: #983B08;
    --accent:    #FF8A3D;
    --neutral:   #5F757A;
    --bg:        #EEF3F3;
    --surface:   #F6F9F9;
    --surface-r: #EBF2F2;
    --text:      #13262C;
    --text-2:    #4D6367;
    --border:    #D3DFE0;
    --error:     #C0263B;
    --red:       #C0263B;
    --success:   #0C7A4B;
    --green:     #0C7A4B;
    --yellow-header: #F6F9F9;
    --row-alt:   #FFFFFF;
}

/* ── Base ─────────────────────────────────────────────────────────────── */
body {
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 14px;
    line-height: 1.4;
    background: var(--td-canvas);
    color: var(--td-text);
    -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font-family: inherit; }
input, select, textarea { font-weight: 500; }

/* ── Header = the night-sky nav bar (the only place the sky gradient is used) ── */
header, .shell .header {
    position: relative;
    background: var(--td-sky);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    border: 0;
    box-shadow: none;
    color: #E6F0F1;
    min-height: 56px;
    padding-top: 8px;
    padding-bottom: 8px;
}
/* order + list pages keep their sticky behaviour */
header[style], header { z-index: 900; }

/* hub header with the sunrise logo overlapping the bar's lower edge */
header:has(.logo) { padding: 8px clamp(10px,1.6vw,20px) 8px 92px; min-height: 56px; }
.logo { gap: 12px; position: static; }
.logo-mark {
    position: absolute;
    left: clamp(10px,1.6vw,20px);
    top: 8px;
    width: 62px; height: 62px;
    border-radius: 50%;
    background: linear-gradient(165deg, #FFC46B 0%, #FF8A3D 55%, #FF5E7A 100%);
    box-shadow: 0 0 0 3px #0C2C38, 0 0 22px 2px rgba(255,138,61,.55);
    font-size: 1.7rem;
    z-index: 2;
}
.logo-text {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.55rem;
    letter-spacing: 2.4px;
    color: #fff;
    line-height: 1;
}
.logo-text span { color: var(--td-amber); }
.logo-sub {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: .7rem;
    letter-spacing: 1.4px;
    color: rgba(230,240,241,.72);
    margin-top: 2px;
}

.page-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: .96px;
    text-transform: uppercase;
    color: #fff;
}
.page-title span { color: var(--td-amber); }

/* stats strip under the nav (hub) */
.td-stats {
    position: relative;
    height: 41px;
    display: flex;
    align-items: center;
    gap: 28px;
    padding: 0 clamp(10px,1.6vw,20px) 0 104px;
    background:
        radial-gradient(140px 46px at 52px -6px, rgba(255,138,61,.20), rgba(255,138,61,0) 70%),
        #fff;
    border-bottom: 1px solid var(--td-border);
    flex-shrink: 0;
}
.td-stat { display: flex; align-items: baseline; gap: 8px; }
.td-stat-l {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 11.5px;
    letter-spacing: 1.15px;
    text-transform: uppercase;
    color: var(--td-dim);
}
.td-stat-v {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 15.5px;
    font-variant-numeric: tabular-nums;
    color: var(--td-text);
}
.td-stat-v.warn { color: var(--td-err); }

/* ── Buttons ──────────────────────────────────────────────────────────── */
/* Primary: CTA gradient, uppercase condensed label, 9px radius */
.cart-btn, .send-btn, .login-btn, .btn-primary, .email-btn, .upload-btn, .modal-send {
    background: var(--td-cta);
    border: 0;
    border-radius: 9px;
    color: #fff;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 14.5px;
    letter-spacing: .87px;
    text-transform: uppercase;
    box-shadow: var(--td-btn-shadow);
    min-height: 36px;
    padding: 0 16px;
    transition: background .12s;
}
.cart-btn:hover, .send-btn:hover, .login-btn:hover, .btn-primary:hover, .email-btn:hover,
.upload-btn:hover, .modal-send:hover {
    background: var(--td-cta-h);
    transform: none;
    box-shadow: var(--td-btn-shadow);
}
.cart-btn:active, .send-btn:active, .login-btn:active, .btn-primary:active, .email-btn:active,
.upload-btn:active, .modal-send:active { background: #8F3807; }
.cart-count {
    background: #E11D48;
    color: #fff;
    border-radius: 99px;
    box-shadow: 0 0 0 2px #0C2C38;
    font-family: var(--font-display);
    font-weight: 700;
    min-width: 19px;
    padding: 0 6px;
    font-size: .75rem;
}

/* Outline: transparent, inset ring instead of a border */
.back-btn, .admin-login-btn, .signout-btn, .sort-btn, .print-btn, .add-row-btn, .restore-btn,
.btn-ghost, .modal-cancel, .card-edit-btn {
    background: transparent;
    border: 0;
    border-radius: 8px;
    color: var(--td-text);
    box-shadow: var(--td-ring);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 12.5px;
}
.back-btn:hover, .admin-login-btn:hover, .signout-btn:hover, .sort-btn:hover, .print-btn:hover,
.add-row-btn:hover, .restore-btn:hover, .btn-ghost:hover, .modal-cancel:hover, .card-edit-btn:hover {
    background: var(--td-chip);
    color: var(--td-text);
    box-shadow: var(--td-ring);
}
.restore-btn { color: var(--td-muted); }
/* …the same controls on the dark nav bar */
header .back-btn, header .admin-login-btn, header .signout-btn, header .sort-btn, header .print-btn {
    color: #E6F0F1;
    box-shadow: var(--td-sky-ring);
    border-radius: 10px;
}
header .back-btn:hover, header .admin-login-btn:hover, header .signout-btn:hover,
header .sort-btn:hover, header .print-btn:hover {
    background: rgba(190,226,230,.13);
    color: #fff;
    box-shadow: var(--td-sky-ring);
}
header .sort-btn.active {
    background: linear-gradient(rgba(255,196,107,.04), rgba(255,138,61,.22));
    box-shadow: inset 0 0 0 1px rgba(255,196,107,.24);
    color: #fff;
}
.sort-btn.active { background: var(--td-selected); color: #fff; box-shadow: none; }

/* Card button (Add): white, bordered, condensed uppercase */
.add-btn {
    background: #fff;
    border: 1px solid var(--td-border);
    border-radius: 10px;
    color: var(--td-brand);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 14px;
    letter-spacing: .87px;
    text-transform: uppercase;
    box-shadow: var(--td-card-shadow);
    padding: 0 14px;
    min-height: 34px;
}
.add-btn:hover { background: var(--td-cta); color: #fff; border-color: transparent; }
.add-btn:active { transform: scale(.97); }

/* Destructive */
.btn-danger, .delete-btn {
    background: transparent;
    border: 0;
    border-radius: 8px;
    color: var(--td-err);
    box-shadow: inset 0 0 0 1px #F58A98;
}
.btn-danger:hover, .delete-btn:hover { background: var(--td-err-bg); color: var(--td-err); box-shadow: inset 0 0 0 1px #F58A98; }

/* ── Fields ───────────────────────────────────────────────────────────── */
.search-input, .qty-select, .qty-input, .cart-location, .cart-name-input, .login-input,
.modal-input, .form-group input[type="text"], .form-group input[type="password"],
.col-count input, .custom-input, .custom-name-input {
    background: var(--td-alt);
    border: 1px solid var(--td-border);
    border-radius: 9px;
    color: var(--td-text);
    font-weight: 500;
}
.search-input { border-radius: 11px; min-height: 36px; }
.search-input::placeholder, .cart-name-input::placeholder, .login-input::placeholder { color: var(--td-dim); }
.search-input:focus, .qty-select:focus, .qty-input:focus, .cart-location:focus, .cart-name-input:focus,
.login-input:focus, .modal-input:focus, .form-group input:focus, .col-count input:focus,
.custom-input:focus, .custom-name-input:focus {
    border-color: var(--td-brand);
    box-shadow: 0 0 0 3px rgba(194,80,10,.14);
    background: #fff;
}
.col-count input { border-radius: 8px; }
.col-count input.has-value { background: var(--td-info-bg); border-color: var(--td-info-bd); font-weight: 700; }
.form-group label, .modal-label {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 11.5px;
    letter-spacing: 1.15px;
    color: var(--td-dim);
}
.qty-select option, .cart-location option { background: #fff; color: var(--td-text); }

/* ── Admin banner = info banner ───────────────────────────────────────── */
.admin-banner {
    background: var(--td-info-bg);
    color: #8A4B05;
    border-bottom: 1px solid var(--td-info-bd);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 1.2px;
    min-height: 40px;
}
.admin-banner button {
    background: transparent;
    border: 0;
    box-shadow: inset 0 0 0 1px var(--td-info-bd);
    color: #8A4B05;
    border-radius: 8px;
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: .87px;
    text-transform: uppercase;
}
.admin-banner button:hover { background: #FFE9CC; }

/* ── Hub ──────────────────────────────────────────────────────────────── */
.hub-wrap {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 12px clamp(10px,1.6vw,20px) 36px;
    gap: 12px;
    align-items: stretch;
}
.hub-section {
    max-width: none;
    align-items: stretch;
    gap: 14px;
    background: #fff;
    border: 1px solid var(--td-border);
    border-radius: 14px;
    box-shadow: var(--td-card-shadow);
    padding: 14px 16px 22px;
}
.section-title {
    justify-content: flex-start;
    text-align: left;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 1.4px;
    color: var(--td-text);
    gap: 10px;
}
.section-title::before {
    flex: none;
    width: 9px; height: 9px;
    border-radius: 3px;
    background: var(--td-sun);
}
.section-title::after { background: var(--td-soft); }

.hub-cards { justify-content: flex-start; gap: 12px; }
.hub-card {
    background: var(--td-alt);
    border: 1px solid var(--td-border);
    border-radius: 14px;
    box-shadow: none;
    color: var(--td-text);
    font-weight: 700;
    letter-spacing: 0;
    gap: 14px;
    transition: border-color .12s, background .12s, box-shadow .12s;
}
.hub-card:hover {
    background: #fff;
    border-color: var(--td-sun);
    transform: none;
    box-shadow: var(--td-card-shadow);
}
.hub-card-label {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.02rem;
    letter-spacing: .96px;
    text-transform: uppercase;
    line-height: 1.15;
    padding: 0 12px;
}
.hub-card-add { background: transparent; border: 1.5px dashed var(--td-border); color: var(--td-dim); }
.hub-card-add:hover { background: var(--td-info-bg); border-color: var(--td-sun); color: var(--td-brand); transform: none; }
.hub-card.locked-card.admin-view { background: var(--td-err-bg); border-color: #F58A98; }
.locked-overlay { border-radius: 14px; background: rgba(246,249,249,.97); backdrop-filter: none; }
.locked-overlay-text {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: .8rem;
    letter-spacing: 1.15px;
    color: var(--td-dim);
}

/* admin card controls */
.cat-edit-btn, .cat-delete-btn {
    border-radius: 8px;
    background: #fff;
    border: 0;
    box-shadow: var(--td-ring);
    color: var(--td-muted);
}
.cat-edit-btn:hover { background: var(--td-brand); color: #fff; box-shadow: none; }
.cat-delete-btn { color: var(--td-err); box-shadow: inset 0 0 0 1px #F58A98; }
.cat-delete-btn:hover { background: var(--td-err); color: #fff; }
.cat-move-btn, .cat-lock-btn {
    border-radius: 8px;
    background: #fff;
    border: 0;
    box-shadow: var(--td-ring);
    color: var(--td-text);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: .74rem;
    letter-spacing: .6px;
    text-transform: uppercase;
}
.cat-move-btn:hover { background: var(--td-chip); color: var(--td-text); }
.cat-lock-btn { color: var(--td-err); box-shadow: inset 0 0 0 1px #F58A98; }
.cat-lock-btn:hover { background: var(--td-err-bg); }
.cat-lock-btn.unlocked { color: var(--td-ok); box-shadow: inset 0 0 0 1px #86CDA8; }
.cat-lock-btn.unlocked:hover { background: var(--td-ok-bg); }

/* ── Login ────────────────────────────────────────────────────────────── */
.login-screen { background: var(--td-canvas); }
.login-card {
    background: #fff;
    border: 1px solid var(--td-border);
    border-radius: 14px;
    box-shadow: var(--td-card-shadow);
}
.login-logo-mark { border-radius: 10px; }
.login-welcome {
    font-family: var(--font-body);
    font-weight: 800;
    font-size: 2.3rem;
    letter-spacing: -.4px;
    color: var(--td-text);
}
.login-welcome span { color: var(--td-brand); }
.login-sub {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: 2.4px;
    color: var(--td-dim);
}
.login-input { min-height: 46px; border-radius: 11px; }
.login-btn { min-height: 46px; font-size: 15.5px; border-radius: 11px; }
.login-btn:hover { transform: none; }
.login-error { background: var(--td-err-bg); border: 1px solid #F58A98; color: var(--td-err); border-radius: 10px; }

/* ── Modals ───────────────────────────────────────────────────────────── */
.modal-overlay { background: rgba(7,29,38,.5); backdrop-filter: none; -webkit-backdrop-filter: none; }
.modal, .modal-box {
    background: #fff;
    border: 1px solid var(--td-border);
    border-top: 1px solid var(--td-border);
    border-radius: 14px;
    box-shadow: var(--td-pop-shadow);
}
.modal-header {
    background: #fff;
    color: var(--td-text);
    border-bottom: 1px solid var(--td-soft);
    border-radius: 14px 14px 0 0;
    padding: 16px 20px;
}
.modal-header h3, .modal-box h2 {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: var(--td-text);
}
.modal-box h2 { margin-bottom: 16px; }
.modal-close { color: var(--td-dim); }
.modal-close:hover { color: var(--td-text); }
.modal-summary { background: var(--td-alt); border: 1px solid var(--td-border); border-radius: 10px; color: var(--td-muted); }
.modal-summary strong, .import-bar strong { color: var(--td-brand); }
.pass-display { background: var(--td-alt); border: 1px solid var(--td-border); border-radius: 11px; }
.pass-display:focus-within, .pass-display.active { border-color: var(--td-brand); box-shadow: 0 0 0 3px rgba(194,80,10,.14); background: #fff; }
.pass-char.filled { color: var(--td-brand); }
.pass-char.empty { color: var(--td-border); }
.btn {
    border-radius: 9px;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 14.5px;
    letter-spacing: .87px;
    text-transform: uppercase;
}
.btn-primary:disabled { opacity: .5; }
.form-error { color: var(--td-err); }

/* ── Toast ────────────────────────────────────────────────────────────── */
.toast {
    background: var(--td-selected);
    border: 0;
    border-radius: 10px;
    box-shadow: var(--td-pop-shadow);
    font-weight: 600;
}
.toast.success { background: var(--td-selected); }
.toast.error { background: var(--td-err); }

/* ── Order page: product cards ────────────────────────────────────────── */
.grid-area { padding: 12px clamp(10px,1.6vw,20px) 40px; }
.product-grid { gap: 12px; max-width: 1400px; margin: 0 auto; }
.product-card {
    background: #fff;
    border: 1px solid var(--td-border);
    border-radius: 14px;
    box-shadow: var(--td-card-shadow);
    transition: border-color .12s;
}
.product-card:hover { transform: none; box-shadow: var(--td-card-shadow); border-color: var(--td-info-bd); }
.card-img { background: var(--td-alt); }
.card-img-empty { color: var(--td-border); }
.card-body { border-top: 1px solid var(--td-soft); padding: 10px 12px 6px; }
.card-name {
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 14px;
    line-height: 18px;
    color: var(--td-text);
}
.card-sku {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 13px;
    letter-spacing: .5px;
    font-variant-numeric: tabular-nums;
    color: var(--td-dim);
}
.card-actions, .card-edit-bar { padding: 6px 10px 12px; }
.card-edit-btn { width: 100%; min-height: 32px; }
.slot-empty {
    background: transparent;
    border: 1.5px dashed var(--td-border);
    border-radius: 14px;
    color: var(--td-dim);
}
.slot-empty:hover { border-color: var(--td-sun); background: var(--td-info-bg); color: var(--td-brand); }
.no-results { color: var(--td-dim); font-family: var(--font-display); font-weight: 600; letter-spacing: 1.15px; text-transform: uppercase; }

/* ── Order page: cart sidebar ─────────────────────────────────────────── */
/* the sticky header (z 900) used to sit on top of the cart panel's title, Clear and close buttons */
.sidebar-overlay { background: rgba(7,29,38,.5); z-index: 940; }
.cart-sidebar { background: #fff; border-left: 1px solid var(--td-border); box-shadow: var(--td-pop-shadow); z-index: 950; }
.cart-head { background: #fff; border-bottom: 1px solid var(--td-soft); }
.cart-head h2 {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: var(--td-text);
}
.cart-clear-btn {
    background: transparent;
    border: 0;
    box-shadow: var(--td-ring);
    border-radius: 8px;
    color: var(--td-text);
    font-weight: 600;
}
.cart-clear-btn:hover { background: var(--td-chip); }
.cart-close-btn { color: var(--td-dim); }
.cart-close-btn:hover { color: var(--td-text); }
.cart-items { background: var(--td-canvas); }
.cart-item {
    background: #fff;
    border: 1px solid var(--td-border);
    border-radius: 10px;
    box-shadow: none;
}
.cart-item-img { border-radius: 6px; background: var(--td-alt); }
.cart-item-img img { border-radius: 6px; }
.cart-item-name { color: var(--td-text); font-weight: 700; }
.cart-item-qty { color: var(--td-brand); font-family: var(--font-display); font-weight: 700; font-size: .85rem; font-variant-numeric: tabular-nums; }
.cart-item-remove { color: #B5C5C8; }
.cart-item-remove:hover { color: var(--td-err); }
.cart-footer { border-top: 1px solid var(--td-border); }
.cart-empty-msg { color: var(--td-dim); }
.send-btn { min-height: 46px; font-size: 15.5px; border-radius: 11px; }

/* ── Footer ───────────────────────────────────────────────────────────── */
footer {
    background: #fff;
    border-top: 1px solid var(--td-border);
    color: var(--td-dim);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: .8rem;
    letter-spacing: 1.15px;
    text-transform: uppercase;
}
footer span { color: var(--td-brand); }

/* ── Stocktake / CSV list tables ──────────────────────────────────────── */
.table-wrap { padding: 12px clamp(10px,1.6vw,20px) 24px; }
.table-container {
    background: #fff;
    border: 1px solid var(--td-border);
    border-radius: 14px;
    box-shadow: var(--td-card-shadow);
}
thead tr th {
    background: var(--td-alt);
    color: var(--td-dim);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 12.5px;
    letter-spacing: 1.25px;
    padding: 8px 10px;
    height: 38px;
    border: 0;
    border-bottom: 1px solid var(--td-border);
}
thead tr th.sortable:hover { background: var(--td-chip); color: var(--td-text); }
thead tr th.sort-asc, thead tr th.sort-desc { color: var(--td-text); }
thead tr th.sort-asc::after, thead tr th.sort-desc::after { color: var(--td-brand); }
thead tr th.col-action-h { border: 0; border-bottom: 1px solid var(--td-border); }
tbody tr { border-bottom: 0; }
tbody tr:nth-child(even) { background: #fff; }
tbody tr:hover { background: #F4F8F8; }
tbody td {
    padding: 8px 10px;
    border: 0;
    border-bottom: 1px solid var(--td-soft);
    color: var(--td-text);
    font-weight: 500;
}
.col-no { color: var(--td-dim); font-family: var(--font-display); font-weight: 600; font-variant-numeric: tabular-nums; }
.col-supp { color: var(--td-text); font-family: var(--font-display); font-weight: 600; font-size: 15px; letter-spacing: .4px; font-variant-numeric: tabular-nums; }
.col-name { font-weight: 700; color: var(--td-text); }
.col-case { color: var(--td-muted); }
#importTable td.col-num, #importTable td.col-diff {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 15px;
    font-variant-numeric: tabular-nums;
}
tbody tr.custom-row { background: var(--td-info-bg) !important; }
tbody tr.custom-row:hover { background: #FFEBD2 !important; }
.import-bar { background: var(--td-info-bg); border: 1px solid var(--td-info-bd); border-radius: 10px; color: #8A4B05; }
.import-empty { color: var(--td-dim); }
.import-empty p:first-child { color: var(--td-text) !important; font-family: var(--font-display); font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; font-size: 1.05rem !important; }
#importTable td.col-diff.neg { color: var(--td-err); }
#importTable td.col-diff.pos { color: var(--td-ok); }
.empty-state h2 { font-family: var(--font-display); font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; font-size: 1rem; color: var(--td-text); }
.row-count { font-family: var(--font-display); font-weight: 600; letter-spacing: .6px; color: var(--td-dim); }
.remove-row-btn { color: #B5C5C8; }
.remove-row-btn:hover { color: var(--td-err); }

/* ── Stock count pages (chemical_count.html / nonpro_count.html) ──────── */
/* Dark = TorrentDay dark theme (deep teal) */
body:has(> .shell) {
    --bg:#071419; --surface:#0C1F26; --surface2:#12292F; --surface3:#19363E;
    --border:#1D3840; --border-hi:#2A4D57;
    --text:#DCE9EA; --text-2:#8BA4A8; --text-3:#7D979B;
    --accent:#FF8A3D; --accent-muted:#5A2E10; --accent-dim:rgba(255,138,61,.14);
    --green:#4ADE9A; --green-dim:rgba(74,222,154,.13);
    --red:#FF7B8E;   --red-dim:rgba(255,123,142,.13);
    --yellow:#FFC46B; --yellow-dim:rgba(255,196,107,.13);
    --radius:9px; --radius-sm:8px; --radius-lg:14px;
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
}
/* Light = TorrentDay light theme */
body.light:has(> .shell) {
    --bg:#EEF3F3; --surface:#FFFFFF; --surface2:#F6F9F9; --surface3:#EBF2F2;
    --border:#D3DFE0; --border-hi:#B5C5C8;
    --text:#13262C; --text-2:#4D6367; --text-3:#5F757A;
    --accent:#C2500A; --accent-muted:#FFC48D; --accent-dim:rgba(196,83,13,.08);
    --green:#0C7A4B; --green-dim:#E2F3EA;
    --red:#C0263B;   --red-dim:#FFE6E9;
    --yellow:#96590A; --yellow-dim:#FFF6CF;
}
.shell .header { height: 56px; padding: 0 clamp(10px,1.6vw,20px); }
.shell .brand-icon {
    width: 34px; height: 34px;
    border-radius: 50%;
    border: 0;
    background: linear-gradient(165deg, #FFC46B 0%, #FF8A3D 55%, #FF5E7A 100%);
    color: #0C2C38;
    box-shadow: 0 0 14px 1px rgba(255,138,61,.5);
}
.shell .brand-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: .96px;
    text-transform: uppercase;
    color: #fff;
}
.shell .brand-title span { color: var(--td-amber); }
.shell .btn {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 12.5px;
    letter-spacing: 0;
    text-transform: none;
    background: transparent;
    border: 0;
    border-radius: 10px;
    color: #E6F0F1;
    box-shadow: var(--td-sky-ring);
}
.shell .btn:hover { background: rgba(190,226,230,.13); border: 0; color: #fff; }
.shell .btn-primary {
    background: var(--td-cta);
    color: #fff;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 14.5px;
    letter-spacing: .87px;
    text-transform: uppercase;
    box-shadow: var(--td-btn-shadow);
    border-radius: 9px;
}
.shell .btn-primary:hover { background: var(--td-cta-h); }
.shell .btn-ghost { box-shadow: none; }
.shell .btn-danger { color: #FF9AA8; box-shadow: inset 0 0 0 1px rgba(255,123,142,.5); background: transparent; }
.shell .btn-danger:hover { background: rgba(255,123,142,.16); color: #fff; border: 0; }
/* buttons that are not in the nav bar (empty-state import) sit on the page, not the sky */
.shell .empty-state .btn-primary, .shell .tab-panel .btn-primary { box-shadow: var(--td-btn-shadow); }
.shell .stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--td-card-shadow); }
.shell .stat-icon { border-radius: 8px; }
.shell .stat-label { font-family: var(--font-display); font-weight: 600; letter-spacing: 1.15px; font-size: 11.5px; }
.shell .stat-value { font-family: var(--font-display); font-weight: 700; font-size: 18px; font-variant-numeric: tabular-nums; }
.shell .tab-nav { background: var(--surface); border-bottom-color: var(--border); }
.shell .tab-btn {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 1.4px;
    text-transform: uppercase;
}
.shell .tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.shell thead th {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 12.5px;
    letter-spacing: 1.25px;
    background: var(--surface2);
    color: var(--text-3);
    border-bottom: 1px solid var(--border);
    height: 38px;
}
.shell thead th:nth-child(6) { color: var(--text-3); }
.shell thead th:nth-child(7) { color: var(--text); }
.shell tbody td { color: var(--text); border: 0; border-bottom: 1px solid var(--border); }
.shell td.mono, .shell .row-num { font-family: var(--font-display); font-weight: 600; font-variant-numeric: tabular-nums; }
.shell tbody tr { border-bottom: 0; }
.shell tbody tr:hover { background: var(--surface2); }
.shell tbody tr.counted { background: var(--accent-dim); }
.shell tbody tr.counted:hover { background: var(--accent-dim); }
.shell td input[type="number"], .shell td select.outlet-sel { border-radius: 8px; }
.shell .diff-badge { border-radius: 99px; font-family: var(--font-display); font-weight: 700; }
.shell .empty-state h2 { color: var(--text); }
.shell .empty-icon { border-radius: 14px; }
.shell .progress-fill { background: var(--accent); }

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 580px) {
    header:has(.logo) { padding-left: 84px; }
    .logo-sub { display: none; }
    .td-stats { padding-left: 92px; gap: 16px; }
    .td-stat-l { display: none; }
    .login-welcome { font-size: 1.9rem; }
}
@media (max-width: 600px) {
    .page-title { font-size: 1rem; }
    .grid-area, .table-wrap { padding-left: 10px; padding-right: 10px; }
}

/* ── Print: keep the working documents plain ──────────────────────────── */
@media print {
    body { background: #fff !important; }
    .table-container { box-shadow: none; border: none; border-radius: 0; }
    thead tr th { background: #E7EEEF !important; color: #13262C !important; border-bottom: 2px solid #13262C; }
}
