/* Packing app theme -- Minibay pink (#d3266f) on a dark plum sidebar, the same palette as the inventory app and the Minibay desk.
   Loaded AFTER each page's own <style>, so these rules restyle the shared layout (sidebar, cards, tables, buttons, forms) on every desk page. */
:root {
    --b: #d3266f; --b-dark: #a81c57; --b-deep: #5c0f31; --b-soft: #fdecf3; --b-soft2: #fff5f9; --b-light: #f9a8c9; --b-ring: rgba(211, 38, 111, .18);
    --side1: #2d0f1e; --side2: #170812; --ink: #231526; --muted: #7b6b78; --line: #f1e6ec; --paper: #fbf7f9;
    --ok: #0f9d6b; --ok-soft: #e6f7f0; --warn: #c77700; --warn-soft: #fff4de; --bad: #d92d4b; --bad-soft: #fdebee;
    --upcase: #0f766e; --upcase-soft: #d9f3ef;
    --shadow: 0 1px 2px rgba(92, 15, 49, .05), 0 8px 24px rgba(92, 15, 49, .06);
    --r: 16px;
    --bs-primary: #d3266f; --bs-primary-rgb: 211, 38, 111; --bs-link-color: #d3266f; --bs-link-hover-color: #a81c57; --bs-link-color-rgb: 211, 38, 111;
}
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif !important; background: var(--paper) !important; color: var(--ink) !important; -webkit-font-smoothing: antialiased; }
body::before { content: ""; position: fixed; inset: 0 0 auto 0; height: 4px; background: linear-gradient(90deg, var(--b) 0%, #f0558f 55%, var(--b-light) 100%); z-index: 1100; }
a { color: var(--b); }

/* ---------- sidebar ---------- */
body .sidebar { background: linear-gradient(180deg, var(--side1) 0%, var(--side2) 100%) !important; border-right: 0; width: 264px; flex-shrink: 0; box-shadow: 6px 0 30px rgba(23, 8, 18, .12); }
body .sidebar-brand { padding: 26px 20px 20px; border-bottom: 1px solid rgba(255, 255, 255, .07); }
body .sidebar-brand h3 { display: flex; align-items: center; gap: 12px; font-size: 1.02rem; letter-spacing: -.2px; line-height: 1.25; }
body .sidebar-brand h3 i { width: 38px; height: 38px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; margin: 0 !important; flex-shrink: 0;
    background: linear-gradient(135deg, var(--b), #f0558f); color: #fff !important; font-size: 1.1rem; box-shadow: 0 6px 16px rgba(211, 38, 111, .45); }
body .sidebar-brand .badge { background: rgba(240, 85, 143, .22) !important; color: #f9a8c9 !important; }
body .sidebar-brand small { color: #b79aab !important; letter-spacing: .3px; }
body .sidebar-nav { padding: 16px 14px; }
body .sidebar-nav .nav-item, body .sidebar-nav a { color: #cdb7c6 !important; padding: 11px 14px !important; border-radius: 12px; font-size: .9rem; margin-bottom: 4px; border-left: 0 !important; position: relative; text-decoration: none; }
body .sidebar-nav .nav-item i { font-size: 1.05rem; width: 20px; text-align: center; }
body .sidebar-nav .nav-item:hover { background: rgba(255, 255, 255, .07) !important; color: #fff !important; }
body .sidebar-nav .nav-item.active { background: linear-gradient(135deg, var(--b), #e03d84) !important; color: #fff !important; box-shadow: 0 8px 20px rgba(211, 38, 111, .38); }
body .user-badge-container { border-top-color: rgba(255, 255, 255, .09) !important; }

/* ---------- page ---------- */
body .main-content { padding: 34px 40px 52px !important; max-width: 1560px; }
body .page-header { margin-bottom: 26px; }
body .page-header h1, body .page-header h2 { font-size: 1.65rem; font-weight: 800; letter-spacing: -.5px; color: var(--ink) !important; }
body .page-header h1 i, body .page-header h2 i { color: var(--b) !important; }
body .page-header p { color: var(--muted) !important; font-weight: 500; }
body .status-indicator { background: var(--ok-soft); color: var(--ok); }
body .status-indicator .dot { background: var(--ok); }

/* buttons */
body .btn-primary, body .btn-primary-custom, body .btn-run, body .btn-download-csv, body .btn-expand.primary, body .tab-btn.active {
    background: linear-gradient(135deg, var(--b), #e03d84) !important; border: 0 !important; color: #fff !important; border-radius: 12px; font-weight: 700; box-shadow: 0 6px 16px rgba(211, 38, 111, .25); }
body .btn-primary:hover, body .btn-primary-custom:hover, body .btn-run:hover { background: linear-gradient(135deg, var(--b-dark), var(--b)) !important; transform: translateY(-1px); box-shadow: 0 10px 22px rgba(211, 38, 111, .35); }
body .btn-outline-primary { color: var(--b) !important; border-color: var(--b) !important; border-radius: 12px; font-weight: 600; }
body .btn-outline-primary:hover { background: var(--b) !important; color: #fff !important; }
body .btn-outline-secondary { border-radius: 12px; border-color: #eadde4; color: var(--ink); font-weight: 600; }
body .btn-outline-secondary:hover { background: var(--b-soft2); border-color: var(--b-light); color: var(--b-dark); }
body .btn-outline-search { border-radius: 12px; color: var(--b) !important; border-color: var(--b-light) !important; }
body .btn-outline-search:hover { background: var(--b-soft) !important; }
body .btn-light, body .btn-ghost { border-radius: 12px; }

/* forms */
body .form-control, body .form-select { border-radius: 12px; border: 1.5px solid #eadde4; background-color: #fff; padding-top: .6rem; padding-bottom: .6rem; }
body .form-control:focus, body .form-select:focus { border-color: var(--b); box-shadow: 0 0 0 4px var(--b-ring); outline: 0; }
body .form-check-input:checked { background-color: var(--b); border-color: var(--b); }
body .form-check-input:focus { box-shadow: 0 0 0 4px var(--b-ring); border-color: var(--b); }
body .form-label { font-weight: 600; color: #5d4a58; }

/* cards + tables */
body .content-card, body .table-container, body .settings-card, body .panel, body .kpi, body .product-card {
    background: #fff !important; border: 1px solid var(--line) !important; border-radius: var(--r) !important; box-shadow: var(--shadow) !important; }
body .table-container { overflow: hidden; }
body .table thead th, body th { background: var(--b-soft2) !important; color: #8a6a7d !important; border-bottom: 1px solid var(--line) !important; font-weight: 700; letter-spacing: .6px; font-size: .72rem; text-transform: uppercase; }
body .table tbody td, body td { border-bottom-color: var(--line) !important; }
body .table tbody tr:hover, body .table-hover tbody tr:hover { background: var(--b-soft2) !important; }
body .table tbody tr:hover td { background: transparent !important; }
body .modal-content { border-radius: 20px; border: 0; box-shadow: 0 30px 80px rgba(23, 8, 18, .35); }
body .modal-header { border-bottom: 1px solid var(--line); }
body .modal-title { font-weight: 800; letter-spacing: -.3px; }
body .toast-custom { border-radius: 14px !important; }

/* tabs */
body .dashboard-tabs { gap: 8px; border-bottom: 0 !important; }
body .tab-btn { border-radius: 12px !important; border: 1.5px solid #eadde4 !important; background: #fff !important; color: var(--muted) !important; font-weight: 700; }
body .tab-btn:hover { border-color: var(--b-light) !important; color: var(--b-dark) !important; }
body .tab-btn.active { color: #fff !important; border-color: transparent !important; }

/* brand + status badges (Minibay = pink, Upcase = teal so the two never look alike) */
body .badge-brand.minibay, body .badge-brand[data-brand="minibay"] { background: var(--b-soft) !important; color: var(--b-dark) !important; }
body .badge-brand.upcase, body .badge-brand[data-brand="upcase"] { background: var(--upcase-soft) !important; color: var(--upcase) !important; }
body .store-bar { border-radius: var(--r); border: 1px solid var(--line); box-shadow: var(--shadow); }
body .store-bar .store-name.minibay i { color: var(--b) !important; } body .store-bar .store-name.upcase i { color: var(--upcase) !important; }
body .badge-batch-status.batched { background: var(--warn-soft); color: var(--warn); }
body .badge-batch-status.printed { background: var(--ok-soft); color: var(--ok); }

/* stat cards (dashboard) */
body .stats-row { gap: 16px; }
body .stat-card { border-radius: var(--r) !important; padding: 20px 22px !important; box-shadow: var(--shadow) !important; border: 1px solid var(--line) !important; position: relative; overflow: hidden; background: #fff !important; }
body .stat-card::after { content: ""; position: absolute; right: -28px; top: -28px; width: 96px; height: 96px; border-radius: 50%; background: var(--b-soft); opacity: .7; pointer-events: none; }
body .stat-card .stat-icon { border-radius: 12px !important; }
body .stat-card .stat-value { font-weight: 800; letter-spacing: -1px; color: var(--ink); }
body .stat-card .stat-label { color: var(--muted); font-weight: 600; }

/* ---------- reusable analytics blocks (dashboard) ---------- */
.sec-title { display: flex; align-items: baseline; gap: 10px; margin: 6px 0 14px; }
.sec-title h2 { font-size: 1.1rem; font-weight: 800; letter-spacing: -.3px; margin: 0; color: var(--ink); }
.sec-title span { color: var(--muted); font-size: .82rem; font-weight: 500; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); gap: 16px; margin-bottom: 18px; }
.kpi-card { background: #fff; border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 18px 20px; position: relative; overflow: hidden; }
.kpi-card::after { content: ""; position: absolute; right: -26px; top: -26px; width: 88px; height: 88px; border-radius: 50%; background: var(--b-soft); opacity: .75; }
.kpi-card .k-label { font-size: .72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; position: relative; z-index: 1; }
.kpi-card .k-value { font-size: 2rem; font-weight: 800; letter-spacing: -1px; line-height: 1.15; margin-top: 4px; position: relative; z-index: 1; color: var(--ink); }
.kpi-card .k-sub { font-size: .78rem; color: var(--muted); margin-top: 2px; position: relative; z-index: 1; font-weight: 500; }
.kpi-card.good::after { background: var(--ok-soft); } .kpi-card.good .k-value { color: var(--ok); }
.kpi-card.warn::after { background: var(--warn-soft); } .kpi-card.warn .k-value { color: var(--warn); }
.kpi-card.bad::after { background: var(--bad-soft); } .kpi-card.bad .k-value { color: var(--bad); }
.d-up { color: var(--ok); font-weight: 700; } .d-down { color: var(--bad); font-weight: 700; } .d-flat { color: var(--muted); font-weight: 600; }
.dash-grid { display: grid; gap: 16px; margin-bottom: 18px; }
.dash-2 { grid-template-columns: 2fr 1fr; } .dash-eq { grid-template-columns: 1fr 1fr; } .dash-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 1100px) { .dash-2, .dash-eq, .dash-3 { grid-template-columns: 1fr; } }
.d-panel { background: #fff; border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 20px 22px; }
.d-panel h3 { font-size: 1rem; font-weight: 800; letter-spacing: -.2px; margin: 0 0 3px; color: var(--ink); }
.d-panel .hint { color: var(--muted); font-size: .8rem; margin-bottom: 14px; }
.d-empty { text-align: center; color: var(--muted); padding: 26px 10px; font-size: .88rem; }
.d-empty i { display: block; font-size: 1.8rem; color: var(--b-light); margin-bottom: 6px; }
.pipe { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; }
.pipe .step { flex: 1; min-width: 118px; background: var(--b-soft2); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; position: relative; }
.pipe .step .s-n { font-size: 1.5rem; font-weight: 800; letter-spacing: -.5px; line-height: 1.1; }
.pipe .step .s-l { font-size: .72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.pipe .step .s-u { font-size: .74rem; color: var(--muted); margin-top: 2px; }
.pipe .step.on { background: linear-gradient(135deg, var(--b), #e03d84); border-color: transparent; color: #fff; box-shadow: 0 8px 20px rgba(211, 38, 111, .3); }
.pipe .step.on .s-l, .pipe .step.on .s-u { color: rgba(255, 255, 255, .85); }
.run-row { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.run-row:last-child { border-bottom: 0; }
.run-row .pulse { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(15, 157, 107, .5); animation: pulse 1.8s infinite; flex-shrink: 0; }
@keyframes pulse { 70% { box-shadow: 0 0 0 9px rgba(15, 157, 107, 0); } 100% { box-shadow: 0 0 0 0 rgba(15, 157, 107, 0); } }
.run-row .r-main { flex: 1; min-width: 0; } .run-row .r-t { font-weight: 700; font-size: .9rem; } .run-row .r-s { font-size: .76rem; color: var(--muted); }
.run-row .r-v { text-align: right; font-weight: 800; } .run-row .r-v small { display: block; font-weight: 500; color: var(--muted); font-size: .72rem; }
.tag-b { font-size: .68rem; font-weight: 800; padding: 2px 9px; border-radius: 999px; }
.tag-b.minibay { background: var(--b-soft); color: var(--b-dark); } .tag-b.upcase { background: var(--upcase-soft); color: var(--upcase); }
.hbar { height: 7px; border-radius: 7px; background: var(--b-soft); margin-top: 6px; overflow: hidden; }
.hbar > i { display: block; height: 100%; border-radius: 7px; background: linear-gradient(90deg, var(--b), #f0558f); }
.rank-line { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.rank-line:last-child { border-bottom: 0; }
.rank-line .rl-main { flex: 1; min-width: 0; } .rank-line .rl-t { font-weight: 700; font-size: .88rem; }
.rank-line .rl-v { font-weight: 800; text-align: right; } .rank-line .rl-v small { display: block; color: var(--muted); font-weight: 500; font-size: .72rem; }
.chart-wrap { position: relative; height: 270px; }

/* ---------- small screens: the sidebar becomes a slide-in menu (see theme.js) ---------- */
.m-topbar, .m-overlay { display: none; }
@media (max-width: 991.98px) {
    body::before { height: 3px; }
    .app-wrapper { display: block !important; }
    body .sidebar { position: fixed !important; z-index: 1200; top: 0; left: 0; height: 100% !important; width: min(300px, 84vw) !important; max-width: none; transform: translateX(-102%); transition: transform .28s ease; }
    body.nav-open .sidebar { transform: none; }
    .m-overlay { display: block; position: fixed; inset: 0; background: rgba(23, 8, 18, .55); backdrop-filter: blur(2px); z-index: 1150; opacity: 0; pointer-events: none; transition: opacity .2s; }
    body.nav-open .m-overlay { opacity: 1; pointer-events: auto; } body.nav-open { overflow: hidden; }
    .m-topbar { display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 1000; padding: calc(env(safe-area-inset-top) + 12px) 16px 12px; background: rgba(251, 247, 249, .94); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
    .m-topbar button { width: 42px; height: 42px; border-radius: 13px; border: 1.5px solid #eadde4; background: #fff; color: var(--b-dark); font-size: 1.35rem; display: flex; align-items: center; justify-content: center; }
    .m-topbar .m-title { font-weight: 800; font-size: 1.08rem; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    body .main-content { padding: 18px 16px 30px !important; max-width: 100vw !important; }
    .dash-2, .dash-eq, .dash-3 { grid-template-columns: 1fr; }
    .kpi-grid { grid-template-columns: 1fr 1fr; gap: 12px; } .kpi-card .k-value { font-size: 1.6rem; }
    .table-container { overflow-x: auto; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
