/* HexaEcom Inventory Portal: 2026 refresh. Loaded after portal.css and only overrides it.
   App shell with sidebar, softer depth, motion, richer cards and charts. Day and night themes.
   Every animation is switched off when the device asks for reduced motion. */

:root {
    --bg: #f3f5fb; --surface: #ffffff; --surface-2: #f6f8fc; --text: #0d1830; --muted: #5b6883;
    --line: #e6eaf3; --line-strong: #d3dae8;
    --accent: #3d6bff; --accent-2: #7b5cff; --accent-soft: rgba(61,107,255,.10);
    --glass: rgba(255,255,255,.74);
    --shadow: 0 1px 2px rgba(13,24,48,.04), 0 10px 28px -10px rgba(13,24,48,.10);
    --shadow-lift: 0 2px 6px rgba(13,24,48,.05), 0 22px 44px -14px rgba(30,50,120,.26);
    --c1: #2a78d6; --c2: #1baf7a; --c3: #6250d6; --c4: #eb6834; --c5: #a8458f; --c6: #7b8797;
    --cdone: #0ca30c; --cpart: #e8a20c; --cact: #d03b3b;
    --good: #0b8f3a; --warn: #b77400; --bad: #c92f2f;
    --side-from: #0b1630; --side-to: #17305f;
    --radius: 18px;
    --ease: cubic-bezier(.2,.8,.2,1);
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #070c18; --surface: #0f1729; --surface-2: #152038; --text: #e8eefb; --muted: #95a3c0;
        --line: #1e2a45; --line-strong: #2a3a5c;
        --accent: #7090ff; --accent-2: #a083ff; --accent-soft: rgba(112,144,255,.14);
        --glass: rgba(12,19,36,.72);
        --shadow: 0 0 0 1px rgba(255,255,255,.02), 0 12px 30px -12px rgba(0,0,0,.6);
        --shadow-lift: 0 0 0 1px rgba(112,144,255,.18), 0 24px 48px -16px rgba(0,0,0,.75);
        --c1: #3987e5; --c2: #199e70; --c3: #9085e9; --c4: #d95926; --c5: #c75bb0; --c6: #8a97a8;
        --cdone: #2fbf55; --cpart: #f0b429; --cact: #e5534b;
        --good: #57d38c; --warn: #f3c25a; --bad: #ff7d76;
        --side-from: #060b17; --side-to: #0e1a36;
    }
}
:root[data-theme="dark"] {
    --bg: #070c18; --surface: #0f1729; --surface-2: #152038; --text: #e8eefb; --muted: #95a3c0;
    --line: #1e2a45; --line-strong: #2a3a5c;
    --accent: #7090ff; --accent-2: #a083ff; --accent-soft: rgba(112,144,255,.14);
    --glass: rgba(12,19,36,.72);
    --shadow: 0 0 0 1px rgba(255,255,255,.02), 0 12px 30px -12px rgba(0,0,0,.6);
    --shadow-lift: 0 0 0 1px rgba(112,144,255,.18), 0 24px 48px -16px rgba(0,0,0,.75);
    --c1: #3987e5; --c2: #199e70; --c3: #9085e9; --c4: #d95926; --c5: #c75bb0; --c6: #8a97a8;
    --cdone: #2fbf55; --cpart: #f0b429; --cact: #e5534b;
    --good: #57d38c; --warn: #f3c25a; --bad: #ff7d76;
    --side-from: #060b17; --side-to: #0e1a36;
}

body { background: var(--bg); font-feature-settings: "cv11", "ss01"; }
::selection { background: color-mix(in srgb, var(--accent) 28%, transparent); }

/* ---------- Ambient background ---------- */
.ambient { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.ambient span { position: absolute; width: 46vw; height: 46vw; border-radius: 50%; filter: blur(90px); opacity: .5; animation: drift 26s ease-in-out infinite alternate; }
.ambient span:nth-child(1) { background: color-mix(in srgb, var(--accent) 22%, transparent); top: -18vw; right: -8vw; }
.ambient span:nth-child(2) { background: color-mix(in srgb, var(--accent-2) 16%, transparent); bottom: -22vw; left: 10vw; animation-delay: -9s; }
.ambient span:nth-child(3) { background: color-mix(in srgb, var(--c2) 12%, transparent); top: 30vh; right: 30vw; width: 30vw; height: 30vw; animation-delay: -16s; }
@keyframes drift { from { transform: translate3d(0,0,0) scale(1); } to { transform: translate3d(-4vw,3vw,0) scale(1.12); } }
.shell-main, .sidebar { position: relative; z-index: 1; }

/* ---------- App shell: sidebar ---------- */
.has-shell .shell-main { margin-left: 252px; min-height: 100vh; display: flex; flex-direction: column; }
.has-shell .shell-main > main { flex: 1; width: 100%; }
.sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: 252px; z-index: 40; display: flex; flex-direction: column; gap: 18px;
    padding: 22px 14px 18px; color: #fff;
    background: radial-gradient(420px 300px at 0% 0%, rgba(112,144,255,.22), transparent 70%), linear-gradient(180deg, var(--side-from), var(--side-to));
    border-right: 1px solid rgba(255,255,255,.06);
}
.side-brand { display: flex; align-items: center; gap: 12px; padding: 4px 10px 14px; color: #fff; text-decoration: none; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-mark { width: 36px; height: 40px; flex: none; background: url('../img/hexaecom-icon-white.png') no-repeat center / contain; filter: drop-shadow(0 4px 14px rgba(112,144,255,.5)); }
.side-brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.side-brand-text strong { font-family: var(--font-head); font-size: 1.08rem; letter-spacing: -.01em; }
.side-brand-text small { color: rgba(255,255,255,.6); font-size: .74rem; letter-spacing: .04em; }
.sidebar .nav { display: flex; flex-direction: column; gap: 4px; margin: 0; }
.sidebar .nav a {
    position: relative; display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 12px;
    color: rgba(255,255,255,.72); font-weight: 500; font-size: .94rem; text-decoration: none; transition: background .2s, color .2s, transform .2s var(--ease);
}
.sidebar .nav a:hover { background: rgba(255,255,255,.07); color: #fff; transform: translateX(2px); }
.sidebar .nav a.is-active { color: #fff; background: linear-gradient(90deg, rgba(112,144,255,.28), rgba(160,131,255,.10)); font-weight: 600; box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }
.sidebar .nav a.is-active::before { content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 4px; border-radius: 0 4px 4px 0; background: linear-gradient(180deg, #8aa6ff, #b39bff); }
.nav-icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sidebar .nav a.is-active .nav-icon { stroke: #a9bcff; }
.sidebar .count-pill { margin-left: auto; background: #ff5d5d; box-shadow: 0 0 0 3px rgba(255,93,93,.18); animation: pop .5s var(--ease) both; }
.side-client { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: 14px; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.08); }
.side-client .for { font-size: .66rem; letter-spacing: .14em; text-transform: uppercase; color: rgba(255,255,255,.55); font-weight: 700; }
.side-client .client-logo { height: 38px; width: auto; align-self: flex-start; }
.side-client .client-logo-light { display: none !important; }
.side-client .client-logo-dark { display: block !important; }

/* Top bar inside the main column */
.topbar { height: 64px; padding: 0 28px; background: var(--glass); backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px); border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.has-shell .topbar .brand { display: none; }
.live-dot { display: inline-flex; align-items: center; gap: 8px; font-size: .78rem; font-weight: 600; color: var(--muted); padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }
.live-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--cdone); box-shadow: 0 0 0 0 color-mix(in srgb, var(--cdone) 60%, transparent); animation: ping 2.2s infinite; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--cdone) 55%, transparent); } 70% { box-shadow: 0 0 0 9px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.user-menu summary { width: auto; height: 40px; padding: 0 14px 0 4px; gap: 10px; border-radius: 999px; background: var(--surface); color: var(--text); border: 1px solid var(--line); font-family: inherit; font-weight: 600; font-size: .88rem; transition: box-shadow .2s, border-color .2s; }
.user-menu summary:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.avatar-dot { width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-family: var(--font-head); background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.user-name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-panel { animation: rise .22s var(--ease) both; border-radius: 16px; }
.icon-btn { width: 40px; height: 40px; transition: transform .35s var(--ease), border-color .2s, color .2s; }
.icon-btn:hover { transform: rotate(-18deg); }
.has-shell .container { max-width: 1400px; padding: 30px 32px 60px; }
.has-shell .footer { border-top: 0; background: transparent; }

/* ---------- Motion primitives ---------- */
@keyframes rise { from { opacity: 0; transform: translate3d(0,14px,0); } to { opacity: 1; transform: none; } }
@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.rise { animation: rise .6s var(--ease) both; animation-delay: calc(var(--i, 0) * 60ms); }
.container > .page-head, .container > .card, .container > .notice, .container > .tabs, .people-list > .person, .report { animation: rise .55s var(--ease) both; }

/* ---------- Generic surfaces ---------- */
.card, .kpi, .table-wrap { border-color: color-mix(in srgb, var(--line) 85%, transparent); border-radius: var(--radius); box-shadow: var(--shadow); }
.btn { border-radius: 12px; transition: transform .18s var(--ease), box-shadow .2s, background .2s, border-color .2s; }
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0) scale(.98); }
.btn-primary, .add-person .plus { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; color: #fff; box-shadow: 0 8px 20px -8px color-mix(in srgb, var(--accent) 70%, transparent); }
.btn-primary:hover { background: linear-gradient(135deg, var(--accent), var(--accent-2)); filter: brightness(1.08); border-color: transparent; }
.choice-btn.is-on, .chip input:checked + span { background: var(--text); border-color: var(--text); color: var(--surface); }
.role-owner { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; color: #fff; }
.page-head h1 { font-size: 1.9rem; letter-spacing: -.025em; }
.tabs a.is-active { color: var(--accent); border-bottom-color: var(--accent); }
.avatar { background: linear-gradient(135deg, var(--accent-soft), color-mix(in srgb, var(--accent-2) 14%, transparent)); color: var(--accent); border-color: transparent; }

/* ---------- Dashboard hero ---------- */
.hero {
    position: relative; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px 28px; align-items: center;
    padding: 26px 30px; margin-bottom: 18px; border-radius: 22px; color: #fff;
    background: radial-gradient(600px 260px at 85% -20%, rgba(160,131,255,.45), transparent 70%), radial-gradient(500px 300px at 0% 120%, rgba(27,175,122,.28), transparent 70%), linear-gradient(135deg, #0f1d3d, #1d3a7a 60%, #2a4fb0);
    box-shadow: 0 24px 50px -24px rgba(29,58,122,.65); animation: rise .6s var(--ease) both;
}
.hero::after { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px); background-size: 36px 36px; mask-image: linear-gradient(90deg, transparent, #000 60%); -webkit-mask-image: linear-gradient(90deg, transparent, #000 60%); pointer-events: none; }
.hero > * { position: relative; z-index: 1; }
.hero .eyebrow { color: rgba(255,255,255,.72); }
.hero h1 { color: #fff; font-size: clamp(1.6rem, 2.6vw, 2.25rem); margin: 6px 0 6px; letter-spacing: -.03em; }
.hero p { margin: 0; color: rgba(255,255,255,.8); }
.hero .pill { background: rgba(255,255,255,.14); color: #fff; backdrop-filter: blur(6px); margin-top: 14px; }
.hero .pill::before { background: #5df2a0; animation: ping 2.2s infinite; }
.hero .pill-warn { background: rgba(255,200,80,.22); }
.hero .pill-warn::before { background: #ffc850; }
.weeks { display: flex; gap: 8px; align-items: flex-end; }
.week { display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: .74rem; color: rgba(255,255,255,.7); font-weight: 600; }
.week i { display: block; width: 46px; height: 8px; border-radius: 99px; background: rgba(255,255,255,.16); overflow: hidden; position: relative; }
.week.is-past i { background: rgba(255,255,255,.55); }
.week.is-now { color: #fff; }
.week.is-now i { background: rgba(255,255,255,.16); }
.week.is-now i::after { content: ""; position: absolute; inset: 0; width: var(--p, 50%); border-radius: inherit; background: linear-gradient(90deg, #8aa6ff, #5df2a0); animation: grow-x 1.2s var(--ease) both .3s; transform-origin: left; }
@keyframes grow-x { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.weeks-wrap { display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }
.weeks-wrap .fine { color: rgba(255,255,255,.65); }

/* ---------- KPI tiles ---------- */
.kpis { gap: 16px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.kpi { position: relative; overflow: hidden; padding: 18px 20px 16px; display: flex; flex-direction: column; animation: rise .6s var(--ease) both; animation-delay: calc(var(--i, 0) * 70ms); transition: transform .28s var(--ease), box-shadow .28s, border-color .28s; }
.kpi::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); opacity: .85; }
.kpi.is-good::before { background: linear-gradient(90deg, var(--cdone), #5df2a0); }
.kpi.is-warn::before { background: linear-gradient(90deg, var(--cpart), #ffd36b); }
.kpi.is-danger::before { background: linear-gradient(90deg, var(--cact), #ff8a7a); }
a.kpi.is-link:hover, a.card.stat.is-link:hover { transform: translateY(-4px); box-shadow: var(--shadow-lift); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
a.kpi.is-link .label::after, a.card.stat.is-link h3::after { content: none; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.kpi .label { font-size: .72rem; }
.kpi-icon { width: 38px; height: 38px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent); flex: none; transition: transform .35s var(--ease); }
.kpi:hover .kpi-icon { transform: rotate(-8deg) scale(1.08); }
.kpi-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.kpi.is-good .kpi-icon { background: color-mix(in srgb, var(--cdone) 14%, transparent); color: var(--good); }
.kpi.is-warn .kpi-icon { background: color-mix(in srgb, var(--cpart) 18%, transparent); color: var(--warn); }
.kpi.is-danger .kpi-icon { background: color-mix(in srgb, var(--cact) 14%, transparent); color: var(--bad); }
.kpi .value { font-size: 2.15rem; margin: 10px 0 2px; font-variant-numeric: tabular-nums; }
.kpi.is-good .value { color: var(--good); } .kpi.is-warn .value { color: var(--warn); } .kpi.is-danger .value { color: var(--bad); }
.kpi-foot { display: flex; flex-direction: column; margin-top: auto; }
.kpi-foot .sub { flex: 1; }
.spark { display: block; width: 100%; height: auto; margin-top: 10px; overflow: visible; }
.spark path.sl { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 0; animation: draw 1.3s var(--ease) both .4s; }
.spark path.sa { fill: currentColor; opacity: .12; animation: fade-soft 1s ease both .8s; }
@keyframes fade-soft { from { opacity: 0; } to { opacity: .12; } }
.spark circle { fill: currentColor; stroke: var(--surface); stroke-width: 2; animation: pop .4s var(--ease) both 1.5s; }
.spark { color: var(--accent); }
.kpi.is-good .spark { color: var(--cdone); } .kpi.is-warn .spark { color: var(--cpart); } .kpi.is-danger .spark { color: var(--cact); }
.spark-note { font-size: .7rem; color: var(--muted); text-align: right; }
@keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
.kpi progress { height: 6px; }
progress::-webkit-progress-value { background: linear-gradient(90deg, var(--cdone), #5df2a0); transition: width 1s var(--ease); }
progress::-moz-progress-bar { background: linear-gradient(90deg, var(--cdone), #5df2a0); }

/* ---------- Channel cards ---------- */
.section-title { display: flex; align-items: center; gap: 10px; font-size: 1.05rem; margin: 30px 0 12px; }
.section-title::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--line-strong), transparent); }
.cards { gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.stat { position: relative; overflow: hidden; animation: rise .6s var(--ease) both; animation-delay: calc(var(--i, 0) * 70ms + 200ms); transition: transform .28s var(--ease), box-shadow .28s, border-color .28s; }
.stat-head { display: flex; align-items: center; gap: 16px; }
.stat-head .ring { flex: none; }
.stat-head h3 { display: flex; align-items: center; gap: 8px; }
.chan-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--c6); box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 0%, transparent); }
.chan-dot.c1 { background: var(--c1); } .chan-dot.c2 { background: var(--c2); } .chan-dot.c3 { background: var(--c3); } .chan-dot.c4 { background: var(--c4); } .chan-dot.c5 { background: var(--c5); }
.chan-dot.all { background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.stat .big { font-size: 1.55rem; }
.stat .big small { font-size: .8rem; font-weight: 600; color: var(--muted); margin-left: 4px; letter-spacing: 0; }
.ring { width: 64px; height: 64px; }
.ring circle { fill: none; stroke-width: 7; }
.ring .track { stroke: var(--line); }
.ring .val { stroke: var(--cdone); stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: var(--off, 1); transform: rotate(-90deg); transform-origin: center; animation: ring-in 1.4s var(--ease) both .35s; }
.ring text { font-family: var(--font-head); font-weight: 700; font-size: 15px; fill: var(--text); }
@keyframes ring-in { from { stroke-dashoffset: 1; } }
.seg { display: flex; gap: 2px; height: 10px; margin: 16px 0 6px; border-radius: 99px; overflow: hidden; background: var(--line); }
.seg span { display: block; height: 100%; transform-origin: left; animation: grow-x 1s var(--ease) both .5s; }
.seg .s-done { background: var(--cdone); } .seg .s-part { background: var(--cpart); } .seg .s-act { background: color-mix(in srgb, var(--cact) 85%, transparent); }
.seg-legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: .76rem; color: var(--muted); }
.seg-legend b { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; vertical-align: 0; }
.seg-legend .s-done { background: var(--cdone); } .seg-legend .s-part { background: var(--cpart); } .seg-legend .s-act { background: var(--cact); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 10px; margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); }
.stat-grid div { display: flex; flex-direction: column; }
.stat-grid dt { font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.stat-grid dd { margin: 2px 0 0; font-family: var(--font-head); font-weight: 600; font-variant-numeric: tabular-nums; }
.stat-grid dd.is-bad { color: var(--bad); }

/* ---------- Charts ---------- */
.charts-block > summary { display: flex; align-items: center; gap: 10px; list-style: none; margin: 30px 0 4px; }
.charts-block > summary::-webkit-details-marker { display: none; }
.charts-block > summary::before { content: ""; width: 9px; height: 9px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform .25s var(--ease); }
.charts-block[open] > summary::before { transform: rotate(45deg); }
.charts-block > summary::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--line-strong), transparent); }
.charts { gap: 16px; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); }
.chart-card { animation: rise .6s var(--ease) both; animation-delay: calc(var(--i, 0) * 60ms + 250ms); transition: box-shadow .28s, transform .28s var(--ease); }
.chart-card:hover { box-shadow: var(--shadow-lift); }
.chart-card h3 { font-size: 1rem; }
.chart text { font-size: 11px; }
.chart text.val { font-size: 11px; font-weight: 700; animation: fade .6s ease both .7s; }
.chart .grid { stroke: var(--line); }
.chart .grid.base { stroke: var(--line-strong); }
.chart rect.bar, .chart path.bar { stroke: none; }
.chart .bar { transform-box: fill-box; transform-origin: 50% 100%; animation: grow-y .8s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms + 150ms); transition: opacity .2s, filter .2s; }
.chart .bar.h { transform-origin: 0 50%; animation-name: grow-x; }
@keyframes grow-y { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.chart:hover .bar { opacity: .55; }
.chart .bar:hover, .chart .bar-link:hover .bar { opacity: 1 !important; filter: brightness(1.08) saturate(1.1); }
.chart path.line { stroke-width: 2.5; stroke-dasharray: 1; stroke-dashoffset: 0; animation: draw 1.4s var(--ease) both .3s; }
.chart path.area { stroke: none; opacity: .12; animation: fade-soft 1s ease both .9s; }
.chart circle.dot { stroke: var(--surface); stroke-width: 2; animation: pop .35s var(--ease) both; animation-delay: calc(var(--i, 0) * 50ms + 900ms); transition: r .15s; }
.chart circle.dot:hover { r: 6; }
.chart .hit { fill: transparent; }
.legend { gap: 6px 16px; }
.swatch { width: 10px; height: 10px; border-radius: 3px; }
svg .area.c1 { fill: var(--c1); } svg .area.c2 { fill: var(--c2); } svg .area.c3 { fill: var(--c3); } svg .area.c4 { fill: var(--c4); } svg .area.c5 { fill: var(--c5); } svg .area.c6 { fill: var(--c6); } svg .area.cdone { fill: var(--cdone); }
.chart-tip {
    position: fixed; z-index: 100; pointer-events: none; padding: 8px 12px; border-radius: 10px; font-size: .8rem; font-weight: 600; line-height: 1.35; max-width: 280px;
    background: var(--text); color: var(--surface); box-shadow: 0 12px 28px -8px rgba(0,0,0,.4); opacity: 0; transform: translate3d(-50%, calc(-100% - 6px), 0) scale(.96); transition: opacity .12s, transform .12s;
}
.chart-tip.is-on { opacity: 1; transform: translate3d(-50%, calc(-100% - 12px), 0) scale(1); }
.chart-tip::after { content: ""; position: absolute; left: 50%; bottom: -5px; width: 10px; height: 10px; background: inherit; transform: translateX(-50%) rotate(45deg); border-radius: 2px; }

/* ---------- Inventory: toolbar and table ---------- */
.toolbar { position: relative; padding: 18px 20px; }
.choice { gap: 6px; padding: 4px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.choice-btn { min-height: 38px; padding: 6px 14px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-weight: 600; transition: background .2s, color .2s, box-shadow .2s, transform .15s var(--ease); display: inline-flex; align-items: center; gap: 7px; }
.choice-btn:hover { background: var(--surface); color: var(--text); }
.choice-btn.is-on { background: var(--surface); color: var(--text); border: 0; box-shadow: 0 1px 2px rgba(13,24,48,.08), 0 4px 12px -4px rgba(13,24,48,.18); }
.choice-btn .n { font-size: .72rem; font-weight: 700; padding: 1px 7px; border-radius: 99px; background: var(--line); color: var(--muted); font-variant-numeric: tabular-nums; }
.choice-btn.is-on .n { background: var(--accent-soft); color: var(--accent); }
.search-box { position: relative; display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 240px; }
.search-box .field-label { display: block; }
.search-box input[type=search] { width: 100%; height: 46px; padding-left: 42px; padding-right: 44px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); transition: border-color .2s, box-shadow .2s, background .2s; }
.search-box input[type=search]:focus { outline: none; background: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.search-box svg { position: absolute; left: 14px; bottom: 13px; width: 20px; height: 20px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; pointer-events: none; }
.search-box kbd { position: absolute; right: 12px; bottom: 12px; font: 600 .72rem/1 ui-monospace, Menlo, monospace; padding: 4px 7px; border-radius: 6px; border: 1px solid var(--line-strong); color: var(--muted); background: var(--surface); }
.count { font-weight: 600; padding: 6px 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); }
.table-wrap { max-height: calc(100vh - 150px); overflow: auto; }
.table { font-size: .88rem; }
.table th { background: color-mix(in srgb, var(--surface-2) 92%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); z-index: 2; padding: 12px 14px; }
.table td { padding: 10px 14px; border-bottom-color: color-mix(in srgb, var(--line) 80%, transparent); }
.table tbody tr { animation: rise .4s var(--ease) both; animation-delay: calc(min(var(--i, 0), 20) * 18ms); transition: background .15s; }
.table tbody tr:hover { background: color-mix(in srgb, var(--accent) 5%, var(--surface)); }
.table th button { transition: color .15s; }
.table th button:hover { color: var(--text); }
.table td.name { min-width: 280px; max-width: 380px; }
.pname { display: flex; flex-direction: column; gap: 1px; }
.pname small { font-size: .66rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.pname span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-weight: 600; line-height: 1.35; }
.table img { width: 44px; height: 44px; border-radius: 12px; transition: transform .25s var(--ease), box-shadow .25s; position: relative; }
.table img:hover { transform: scale(2.6); box-shadow: 0 14px 30px -8px rgba(0,0,0,.35); z-index: 5; }
.badge { display: inline-flex; align-items: center; gap: 6px; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.stock-pill { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; padding: 3px 10px; border-radius: 999px; font-size: .76rem; font-weight: 700; background: var(--surface-2); color: var(--muted); }
.stock-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.stock-pill.st-out { background: var(--act-bg); color: var(--act-fg); }
.stock-pill.st-low { background: color-mix(in srgb, var(--c4) 16%, transparent); color: color-mix(in srgb, var(--c4) 75%, var(--text)); }
.stock-pill.st-4w { background: var(--part-bg); color: var(--part-fg); }
.stock-pill.st-8w { background: color-mix(in srgb, var(--c1) 14%, transparent); color: color-mix(in srgb, var(--c1) 75%, var(--text)); }
.stock-pill.st-ok { background: var(--done-bg); color: var(--done-fg); }
.mini { display: block; height: 4px; margin-top: 6px; border-radius: 99px; background: var(--line); overflow: hidden; min-width: 70px; }
.mini i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--cdone), #5df2a0); transform-origin: left; animation: grow-x .8s var(--ease) both .2s; }
.mini.is-zero i { background: transparent; }
.more .btn { min-width: 180px; }

/* ---------- Sign-in ---------- */
.is-guest .topbar { position: absolute; left: 0; right: 0; background: transparent; border: 0; backdrop-filter: none; -webkit-backdrop-filter: none; }
.auth { min-height: 100vh; }
.auth-hero { position: relative; overflow: hidden; padding-top: 110px; background: radial-gradient(700px 420px at 90% 10%, rgba(160,131,255,.45), transparent 70%), radial-gradient(600px 400px at 0% 100%, rgba(27,175,122,.32), transparent 70%), linear-gradient(145deg, #0b1630, #1d3a7a 70%, #2a4fb0); }
.auth-hero::after { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px); background-size: 40px 40px; mask-image: radial-gradient(circle at 70% 40%, #000, transparent 75%); -webkit-mask-image: radial-gradient(circle at 70% 40%, #000, transparent 75%); pointer-events: none; }
.auth-hero > * { position: relative; z-index: 1; animation: rise .7s var(--ease) both; }
.auth-hero > *:nth-child(2) { animation-delay: .08s; } .auth-hero > *:nth-child(3) { animation-delay: .16s; } .auth-hero > *:nth-child(4) { animation-delay: .24s; } .auth-hero > *:nth-child(5) { animation-delay: .32s; }
.auth-hero h1 { background: linear-gradient(90deg, #fff, #c9d6ff 60%, #b6f5d4); -webkit-background-clip: text; background-clip: text; color: transparent; }
.preview { position: relative; height: 150px; max-width: 460px; margin-top: 8px; }
.pv { position: absolute; border-radius: 16px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.16); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 20px 40px -20px rgba(0,0,0,.5); animation: float 7s ease-in-out infinite; }
.pv-a { left: 0; top: 10px; width: 210px; height: 120px; padding: 16px; display: flex; align-items: flex-end; gap: 10px; }
.pv-a i { flex: 1; border-radius: 6px 6px 2px 2px; background: linear-gradient(180deg, #a9bcff, #6d8dff); transform-origin: bottom; animation: grow-y 1.2s var(--ease) both; }
.pv-a i:nth-child(1) { height: 40%; animation-delay: .5s; } .pv-a i:nth-child(2) { height: 70%; animation-delay: .6s; } .pv-a i:nth-child(3) { height: 55%; animation-delay: .7s; } .pv-a i:nth-child(4) { height: 90%; animation-delay: .8s; background: linear-gradient(180deg, #b6f5d4, #2fbf55); } .pv-a i:nth-child(5) { height: 65%; animation-delay: .9s; }
.pv-b { left: 230px; top: 0; width: 120px; height: 120px; display: flex; align-items: center; justify-content: center; animation-delay: -2s; }
.pv-b svg { width: 78px; height: 78px; }
.pv-b circle { fill: none; stroke-width: 9; }
.pv-b .t { stroke: rgba(255,255,255,.16); }
.pv-b .v { stroke: #5df2a0; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: .28; transform: rotate(-90deg); transform-origin: center; animation: ring-to 1.6s var(--ease) both .8s; }
@keyframes ring-to { from { stroke-dashoffset: 1; } }
.pv-c { left: 150px; top: 96px; width: 190px; height: 48px; display: flex; align-items: center; gap: 10px; padding: 0 14px; font-size: .8rem; font-weight: 600; color: #fff; animation-delay: -4s; }
.pv-c::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: #5df2a0; animation: ping 2.2s infinite; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.auth-side { position: relative; }
.auth-card { padding: 36px; border-radius: 24px; box-shadow: var(--shadow-lift); animation: rise .7s var(--ease) both .15s; }
.auth-card h2 { font-size: 1.6rem; letter-spacing: -.02em; }
.btn-google { border-radius: 14px; transition: transform .18s var(--ease), box-shadow .2s; }
.btn-google:hover { box-shadow: 0 10px 24px -10px rgba(0,0,0,.25); }
.is-guest .footer { position: relative; z-index: 1; }

/* ---------- Tablet and phone ---------- */
.client-brand.phone-only { display: none; }
@media (max-width: 1100px) {
    .has-shell .shell-main { margin-left: 84px; }
    .sidebar { width: 84px; padding: 20px 12px; align-items: center; }
    .side-brand { padding: 4px 0 14px; justify-content: center; }
    .side-brand-text, .nav-label, .side-client { display: none; }
    .sidebar .nav a { justify-content: center; padding: 12px; }
    .sidebar .nav a.is-active::before { left: -12px; }
    .sidebar .count-pill { position: absolute; top: 4px; right: 2px; margin: 0; min-width: 18px; height: 18px; font-size: .64rem; }
    .has-shell .container { padding: 24px 22px 56px; }
}
@media (max-width: 720px) {
    .has-shell .shell-main { margin-left: 0; padding-bottom: 76px; }
    .sidebar { top: auto; bottom: 0; right: 0; width: auto; height: 70px; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); flex-direction: row; border-right: 0; border-top: 1px solid rgba(255,255,255,.08); background: linear-gradient(180deg, var(--side-from), var(--side-to)); }
    .side-brand { display: none; }
    .sidebar .nav { flex-direction: row; flex: 1; justify-content: space-around; gap: 2px; overflow-x: auto; scrollbar-width: none; order: 0; margin: 0; padding: 0; }
    .sidebar .nav::-webkit-scrollbar { display: none; }
    .sidebar .nav a { flex: 1 1 0; min-width: 0; flex-direction: column; gap: 3px; padding: 7px 2px; font-size: .64rem; border-radius: 12px; }
    .nav-label { overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
    .table.responsive .mini { display: none; }
    .sidebar .nav a:hover { transform: none; }
    .nav-label { display: block; white-space: nowrap; }
    .sidebar .nav a.is-active::before { left: 30%; right: 30%; top: -6px; bottom: auto; width: auto; height: 3px; border-radius: 0 0 4px 4px; }
    .sidebar .count-pill { top: 2px; right: 10px; }
    .topbar { height: 58px; padding: 0 14px; flex-wrap: nowrap; }
    .has-shell .topbar .brand { display: flex; }
    .live-dot, .user-name { display: none; }
    .client-brand.phone-only { display: flex; padding-right: 10px; }
    .client-brand.phone-only .client-logo { height: 30px; }
    .user-menu summary { padding: 0 4px; }
    .has-shell .container { padding: 16px 14px 40px; }
    .hero { grid-template-columns: 1fr; padding: 22px 20px; border-radius: 20px; }
    .weeks-wrap { align-items: flex-start; }
    .week i { width: 40px; }
    .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .kpi { padding: 14px 14px 12px; }
    .kpi .value { font-size: 1.45rem; }
    .kpi .sub { font-size: .76rem; }
    .kpi-icon { width: 32px; height: 32px; border-radius: 10px; }
    .spark { display: none; }
    .kpi:last-child:nth-child(odd) { grid-column: 1 / -1; }
    .cards { grid-auto-flow: column; grid-auto-columns: 84%; grid-template-columns: none; overflow-x: auto; scroll-snap-type: x mandatory; padding: 4px 2px 12px; margin: 0 -14px; padding-left: 14px; padding-right: 14px; scrollbar-width: none; }
    .cards::-webkit-scrollbar { display: none; }
    .cards > * { scroll-snap-align: start; }
    .charts { grid-template-columns: 1fr; }
    .choice { width: 100%; }
    .choice-btn { flex: 1 1 auto; justify-content: center; }
    .search-box { min-width: 0; flex: 1 1 100%; }
    .search-box kbd { display: none; }
    .table-wrap { max-height: none; overflow: visible; border: 0; background: transparent; box-shadow: none; }
    .table.responsive tr { border: 1px solid var(--line); border-radius: 16px; background: var(--surface); margin-bottom: 10px; box-shadow: var(--shadow); padding: 8px 0; }
    .table.responsive td.name { padding-top: 6px; }
    .table img:hover { transform: none; }
    .table.responsive td[data-label="Image"] { justify-content: flex-start; }
    .table.responsive td[data-label="Image"]::before { display: none; }
    .table.responsive td[data-label="Image"] img { width: 64px; height: 64px; }
    .auth-hero { padding-top: 84px; }
    .preview { display: none; }
}

/* ---------- Reduced motion: everything still, nothing hidden ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
    .ambient span { animation: none; }
}
.is-redraw .chart *, .is-redraw .chart { animation: none !important; }
