/* Minibay Inventory theme: logo pink (#d3266f) on a dark plum sidebar, same palette as the Minibay desk. Mobile-first overrides at the bottom. */
: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;
    --shadow: 0 1px 2px rgba(92, 15, 49, .05), 0 8px 24px rgba(92, 15, 49, .06);
    --r: 16px;
}
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif; background: var(--paper); color: var(--ink); -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%); 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.05rem; letter-spacing: -.2px; }
body .sidebar-brand h3 i { width: 38px; height: 38px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; margin: 0 !important;
    background: linear-gradient(135deg, var(--b), #f0558f); color: #fff; font-size: 1.1rem; box-shadow: 0 6px 16px rgba(211, 38, 111, .45); flex-shrink: 0; }
body .sidebar-brand small { display: block; margin: 6px 0 0 50px; color: #b79aab; letter-spacing: .3px; }
body .sidebar-nav { padding: 18px 14px; }
body .sidebar-nav a { color: #cdb7c6; padding: 11px 14px; border-radius: 12px; font-size: .9rem; margin-bottom: 4px; position: relative; }
body .sidebar-nav a i { font-size: 1.05rem; width: 20px; text-align: center; }
body .sidebar-nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
body .sidebar-nav a.active { background: linear-gradient(135deg, var(--b), #e03d84); color: #fff; 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 48px; max-width: 1500px; }
body .page-header { margin-bottom: 26px; }
body .page-header h2 { font-size: 1.65rem; font-weight: 800; letter-spacing: -.5px; color: var(--ink); }
body .page-header .sub { color: var(--muted); font-size: .9rem; margin-top: 2px; font-weight: 500; }
body .btn-primary-brand, body .btn-brand { background: linear-gradient(135deg, var(--b), #e03d84); border: 0; color: #fff; border-radius: 12px; padding: 10px 18px; font-weight: 700; font-size: .9rem; box-shadow: 0 6px 16px rgba(211, 38, 111, .28); transition: transform .15s, box-shadow .15s, filter .15s; }
body .btn-primary-brand:hover, body .btn-brand:hover { background: linear-gradient(135deg, var(--b-dark), var(--b)); color: #fff; transform: translateY(-1px); box-shadow: 0 10px 22px rgba(211, 38, 111, .35); }
body .btn-primary-brand:active { transform: none; }
body .btn-ghost { background: #fff; border: 1.5px solid var(--line); color: var(--ink); border-radius: 12px; padding: 9px 16px; font-weight: 600; font-size: .88rem; }
body .btn-ghost:hover { border-color: var(--b-light); color: var(--b-dark); background: var(--b-soft2); }

body .filter-bar { gap: 10px; align-items: center; }
body .filter-bar input[type=text], body .filter-bar input:not([type]), body .filter-bar select, body .form-control, body .form-select { border-radius: 12px; border: 1.5px solid #eadde4; background: #fff; color: var(--ink); }
body .filter-bar input:focus, body .filter-bar select:focus, 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); }

/* chips (used by the products filters) */
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 9px 15px; border-radius: 999px; border: 1.5px solid #eadde4; background: #fff; color: var(--ink); font-weight: 600; font-size: .85rem; cursor: pointer; user-select: none; transition: all .15s; white-space: nowrap; }
.chip:hover { border-color: var(--b-light); background: var(--b-soft2); }
.chip.on { background: var(--b); border-color: var(--b); color: #fff; box-shadow: 0 6px 14px rgba(211, 38, 111, .3); }
.chip .n { background: rgba(0, 0, 0, .08); border-radius: 999px; padding: 0 8px; font-size: .75rem; }
.chip.on .n { background: rgba(255, 255, 255, .25); }
.chip.danger:not(.on) { color: var(--bad); border-color: #f6c5cd; background: var(--bad-soft); }

/* cards + tables */
body .card-table, body .card { background: #fff; border: 0; border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
body th { background: var(--b-soft2); color: #8a6a7d; border-bottom: 1px solid var(--line); font-weight: 700; letter-spacing: .6px; }
body td { border-bottom: 1px solid var(--line); }
body tr:hover td { background: var(--b-soft2); }
body .table th { background: var(--b-soft2); color: #8a6a7d; }
body .action-link { color: var(--b); font-weight: 600; }
body .row-clickable { cursor: pointer; }
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); padding: 18px 22px; }
body .modal-title { font-weight: 800; letter-spacing: -.3px; }
body .modal-body { padding: 22px; }

/* status badges: keep meaning, tint toward the brand */
body .badge-stock, body .badge-role { font-weight: 700; letter-spacing: .2px; }
body .badge-ok, body .badge-received, body .badge-completed { background: var(--ok-soft); color: var(--ok); }
body .badge-low, body .badge-partial { background: var(--warn-soft); color: var(--warn); }
body .badge-neg { background: var(--bad-soft); color: var(--bad); }
body .badge-ordered, body .src-print_app { background: var(--b-soft); color: var(--b-dark); }
body .user-avatar { background: linear-gradient(135deg, var(--b), #f0558f); }

/* ---------- dashboard ---------- */
body .stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 22px; }
body .stat-card { border-radius: var(--r); padding: 20px 22px; box-shadow: var(--shadow); position: relative; overflow: hidden; border: 1px solid var(--line); }
body .stat-card::after { content: ""; position: absolute; right: -28px; top: -28px; width: 96px; height: 96px; border-radius: 50%; background: var(--b-soft); opacity: .8; }
body .stat-card .label { color: var(--muted); position: relative; z-index: 1; }
body .stat-card .value { font-size: 2.1rem; font-weight: 800; letter-spacing: -1px; color: var(--ink); position: relative; z-index: 1; }
body .stat-card.warn .value { color: var(--warn); } body .stat-card.warn::after { background: var(--warn-soft); }
body .stat-card.danger .value { color: var(--bad); } body .stat-card.danger::after { background: var(--bad-soft); }
body .stat-card.good .value { color: var(--ok); } body .stat-card.good::after { background: var(--ok-soft); }
body .quick-card { border-radius: var(--r); box-shadow: var(--shadow); border: 1px solid var(--line); }
body .quick-card:hover { border-color: var(--b-light); box-shadow: 0 14px 32px rgba(211, 38, 111, .14); }
body .quick-card i { color: var(--b); width: 46px; height: 46px; border-radius: 14px; background: var(--b-soft); display: inline-flex !important; align-items: center; justify-content: center; font-size: 1.3rem !important; }

/* ---------- product photos ---------- */
.ph { width: 52px; height: 52px; border-radius: 14px; object-fit: cover; background: var(--b-soft); border: 1px solid var(--line); display: block; flex-shrink: 0; }
.ph-empty { display: inline-flex; align-items: center; justify-content: center; color: var(--b-light); font-size: 1.3rem; }
.pname { font-weight: 700; color: var(--ink); text-decoration: none; line-height: 1.25; display: block; }
.pname:hover { color: var(--b); }
.psku { font-size: .74rem; color: var(--muted); font-family: ui-monospace, Menlo, Consolas, monospace; margin-top: 2px; }
.stock-num { font-weight: 800; font-size: 1.05rem; letter-spacing: -.3px; }
.stock-num.zero, .stock-num.neg { color: var(--bad); }

/* ---------- analytics ---------- */
.panel { background: #fff; border-radius: var(--r); box-shadow: var(--shadow); border: 1px solid var(--line); padding: 20px 22px; }
.panel h3 { font-size: 1rem; font-weight: 800; letter-spacing: -.2px; margin: 0 0 4px; }
.panel .hint { color: var(--muted); font-size: .8rem; margin-bottom: 14px; }
.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; align-items: start; }
.grid-eq { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.chart-box { position: relative; height: 300px; }
.rank-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.rank-row:last-child { border-bottom: 0; }
.rank-n { width: 26px; height: 26px; border-radius: 50%; background: var(--b-soft); color: var(--b-dark); font-weight: 800; font-size: .78rem; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.rank-main { flex: 1; min-width: 0; }
.rank-main .t { font-weight: 700; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar { height: 6px; border-radius: 6px; background: var(--b-soft); margin-top: 6px; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--b), #f0558f); }
.rank-val { font-weight: 800; font-size: .95rem; text-align: right; }
.rank-val small { display: block; font-weight: 500; color: var(--muted); font-size: .72rem; }
.empty-state { text-align: center; padding: 38px 16px; color: var(--muted); }
.empty-state i { font-size: 2.2rem; color: var(--b-light); display: block; margin-bottom: 8px; }
.range-tabs { display: inline-flex; background: #fff; border: 1.5px solid #eadde4; border-radius: 12px; padding: 3px; gap: 2px; }
.range-tabs button { border: 0; background: transparent; padding: 7px 14px; border-radius: 9px; font-weight: 700; font-size: .82rem; color: var(--muted); }
.range-tabs button.on { background: var(--b); color: #fff; box-shadow: 0 4px 10px rgba(211, 38, 111, .3); }

/* ---------- product page ---------- */
.hero { display: flex; gap: 22px; align-items: flex-start; }
.hero-img { width: 132px; height: 132px; border-radius: 22px; object-fit: cover; background: var(--b-soft); border: 1px solid var(--line); flex-shrink: 0; box-shadow: var(--shadow); }
.hero h2 { margin: 0 0 4px; }
.kv { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 12px; }
.kv div { font-size: .84rem; color: var(--muted); } .kv b { color: var(--ink); }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: .85rem; margin-bottom: 14px; }
.back-link:hover { color: var(--b); }

/* ---------- login ---------- */
body.login-page { background: radial-gradient(900px 500px at 15% 10%, rgba(240, 85, 143, .35), transparent 60%), radial-gradient(700px 500px at 90% 90%, rgba(211, 38, 111, .30), transparent 60%), linear-gradient(160deg, var(--side1), var(--side2)); min-height: 100vh; height: auto; padding: 20px; }
body.login-page .login-card { border-radius: 24px; padding: 38px 34px; box-shadow: 0 40px 90px rgba(0, 0, 0, .45); }
body.login-page .brand-logo { display: flex; flex-direction: column; align-items: center; gap: 12px; font-weight: 800; letter-spacing: -.4px; color: var(--ink); }
body.login-page .brand-logo i { width: 58px; height: 58px; border-radius: 18px; display: inline-flex; align-items: center; justify-content: center; margin: 0 !important; background: linear-gradient(135deg, var(--b), #f0558f); color: #fff; font-size: 1.7rem; box-shadow: 0 12px 26px rgba(211, 38, 111, .45); }

/* ---------- mobile chrome (injected by theme.js) ---------- */
.m-topbar, .m-bottomnav, .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); transform: translateX(-102%); transition: transform .2s linear; will-change: transform; }
    body.nav-open .sidebar { transform: none; }
    .m-overlay { display: block; position: fixed; inset: 0; background: rgba(23, 8, 18, .55); 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: #fbf7f9; 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; flex-shrink: 0; }
    .m-topbar .m-title { font-weight: 800; font-size: 1.1rem; letter-spacing: -.3px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .m-topbar .m-ready { display: inline-flex; align-items: center; gap: 6px; padding: 9px 12px; border-radius: 12px; background: var(--b); color: #fff; font-weight: 800; font-size: .82rem; text-decoration: none; flex-shrink: 0; white-space: nowrap; }
    .m-topbar .m-mark { width: 34px; height: 34px; border-radius: 11px; background: linear-gradient(135deg, var(--b), #f0558f); color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 14px rgba(211, 38, 111, .35); }
    .m-bottomnav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000; background: #fff; border-top: 1px solid var(--line); padding: 6px 6px calc(env(safe-area-inset-bottom) + 6px); box-shadow: 0 -8px 24px rgba(92, 15, 49, .07); }
    .m-bottomnav a, .m-bottomnav button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 2px; border: 0; background: none; color: #9b8a96; font-size: .68rem; font-weight: 700; text-decoration: none; border-radius: 12px; min-height: 52px; }
    .m-bottomnav { gap: 2px; padding-left: 4px; padding-right: 4px; }
    .m-bottomnav a, .m-bottomnav button { min-width: 0; min-height: 56px; justify-content: center; border-radius: 14px; font-size: .62rem; letter-spacing: -.1px; -webkit-tap-highlight-color: transparent; transition: background .12s, transform .08s; }
    .m-bottomnav a:active, .m-bottomnav button:active { transform: scale(.94); background: #f6e9ef; }
    .m-bottomnav a span, .m-bottomnav button span { text-align: center; line-height: 1.1; max-width: 100%; overflow-wrap: anywhere; }
    .m-bottomnav a i, .m-bottomnav button i { font-size: 1.4rem; }
    .m-bottomnav a.on, .m-bottomnav button.on { background: #fbe8f0; }
    .m-bottomnav a.on::before, .m-bottomnav button.on::before { display: none; }
    .m-bottomnav a.go { color: #fff; background: #16a34a; box-shadow: 0 4px 10px rgba(22,163,74,.35); }
    .m-bottomnav a.go.on { background: #15803d; }
    .m-bottomnav i { font-size: 1.28rem; line-height: 1; }
    .m-bottomnav .on { color: var(--b); } .m-bottomnav .on i { transform: translateY(-1px); }
    .m-bottomnav .on::before { content: ""; width: 22px; height: 3px; border-radius: 3px; background: var(--b); margin-bottom: 1px; }
    body { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }

    body .main-content { padding: 18px 16px 28px; }
    body .page-header { margin-bottom: 18px; }
    body .page-header h2 { font-size: 1.35rem; }
    body .page-header > .btn, body .page-header > button { width: 100%; justify-content: center; }
    .page-header .d-flex, .page-header .range-tabs { width: 100%; }
    .range-tabs button { flex: 1; }
    body .filter-bar { display: flex; flex-wrap: wrap; }
    body .filter-bar input[type=text], body .filter-bar input:not([type]), body .filter-bar select { width: 100%; flex: 1 1 100%; min-height: 46px; }
    body .filter-bar .form-check { margin-left: 0 !important; }
    .chips-row { display: flex; gap: 8px; overflow-x: auto; width: 100%; padding-bottom: 4px; scrollbar-width: none; margin: 0 -2px; }
    .chips-row::-webkit-scrollbar { display: none; }
    .form-control, .form-select, input, select, textarea { font-size: 16px !important; }          /* stops iOS zooming into fields */
    .btn, .action-link, .chip { min-height: 44px; }
    body .stat-grid { grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 18px; }
    body .stat-card { padding: 15px 16px; } body .stat-card .value { font-size: 1.65rem; }
    body .quick-links { grid-template-columns: 1fr 1fr; gap: 12px; }
    body .quick-card { padding: 15px; } body .quick-card .desc { display: none; }
    .grid-2, .grid-eq { grid-template-columns: 1fr; gap: 14px; }
    .chart-box { height: 240px; }
    .panel { padding: 16px; }
    .hero { gap: 14px; } .hero-img { width: 92px; height: 92px; border-radius: 18px; }
    .hero h2 { font-size: 1.15rem !important; }

    /* tables become cards */
    body .card-table { background: transparent; box-shadow: none; overflow: visible; }
    body .card-table table, body .card-table tbody { display: block; width: 100%; }
    body .card-table thead { display: none; }
    body .card-table tr { display: block; background: #fff; border-radius: 16px; box-shadow: var(--shadow); border: 1px solid var(--line); margin-bottom: 12px; padding: 12px 14px; }
    body .card-table td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: .88rem; text-align: right; background: transparent !important; }
    body .card-table td:last-child { border-bottom: 0; }
    body .card-table td { overflow-wrap: anywhere; min-width: 0; }      /* long batch names (no spaces) wrap instead of widening the page */
    body .card-table td[data-label]::before { content: attr(data-label); color: var(--muted); font-weight: 700; font-size: .7rem; text-transform: uppercase; letter-spacing: .5px; text-align: left; flex-shrink: 0; }
    body .card-table td[colspan] { display: block; text-align: center; border: 0; }
    body .card-table td:empty { display: none; }
    body .card-table .row-actions, body .card-table td:last-child:not([data-label]) { justify-content: flex-start; flex-wrap: wrap; gap: 6px 18px; }

    /* product cards */
    body .product-table tr { display: grid; grid-template-columns: 64px 1fr auto; grid-template-areas: "photo prod stock" "photo meta status" "act act act"; gap: 2px 12px; align-items: center; }
    body .product-table td { display: block; border: 0; padding: 0; text-align: left; }
    body .product-table td::before { display: none !important; }
    body .product-table .c-photo { grid-area: photo; align-self: start; }
    body .product-table .c-photo .ph { width: 64px; height: 64px; }
    body .product-table .c-prod { grid-area: prod; }
    body .product-table .c-stock { grid-area: stock; text-align: right; }
    body .product-table .c-meta { grid-area: meta; color: var(--muted); font-size: .76rem; }
    body .product-table .c-status { grid-area: status; text-align: right; }
    body .product-table .c-act { grid-area: act; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); display: flex; gap: 8px; }
    body .product-table .c-act .action-link { flex: 1; text-align: center; margin: 0; background: var(--b-soft2); border-radius: 10px; padding: 11px 6px; }
    body .product-table td[colspan] { grid-column: 1 / -1; }

    .modal-dialog { margin: 0; max-width: none; min-height: 100%; display: flex; align-items: flex-end; }
    body .modal-content { border-radius: 24px 24px 0 0; width: 100%; max-height: 92vh; overflow-y: auto; }
    .modal.fade .modal-dialog { transform: translateY(40px); } .modal.show .modal-dialog { transform: none; }
    .item-row { grid-template-columns: 1fr 1fr auto !important; } .item-row > :first-child { grid-column: 1 / -1; }
}
@media (min-width: 992px) { .chips-row { display: contents; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

@media (max-width: 991.98px) {
    body .product-table .c-unit, body .product-table .c-reorder, body .product-table .c-cost { display: none; }
}
.mobile-only { display: none; } @media (max-width: 991.98px) { .mobile-only { display: block; } }

body .stat-grid.six { grid-template-columns: repeat(6, 1fr); }
body .action-link { white-space: nowrap; }
@media (max-width: 1299.98px) { body .stat-grid.six { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 991.98px) { body .stat-grid.six { grid-template-columns: 1fr 1fr; } }
