/* KGi interface. Layout and colours follow "Kiluwa GI · UI/UX Design Prototypes"
   v1.0: dark forest side menu, white top header, page title band, cards on a
   light green canvas. System fonts only, so the POS still renders offline.
   Animations are short, never block a sale, and stop with "reduce motion". */
:root {
  /* Brand (from the design document) */
  --green: #168B38; --forest: #0f4a1c; --forest-dark: #14251B; --forest-deep: #0a3313;
  --lime: #7cc51c; --orange: #F58220; --amber: #F5C542; --info: #2457A7; --danger: #C83E3E;
  --bg: #F4F7F4; --surface: #ffffff; --ink: #14251B; --muted: #68756C; --line: #DCE4DD;
  --green-soft: #E5F3E9; --lime-soft: #EEF8DF; --orange-soft: #FEEEDF; --amber-soft: #FEF6DC;
  --info-soft: #E4ECF8; --danger-soft: #FBE7E7;
  --radius: 16px; --radius-sm: 11px;
  --shadow: 0 1px 2px rgba(20, 37, 27, .05), 0 6px 18px rgba(20, 37, 27, .06);
  --shadow-lift: 0 4px 10px rgba(20, 37, 27, .07), 0 16px 34px rgba(20, 37, 27, .11);
  --grad-brand: linear-gradient(120deg, var(--forest-deep) 0%, var(--forest) 45%, var(--green) 100%);
  --grad-sun: linear-gradient(135deg, var(--amber) 0%, var(--orange) 100%);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --side-w: 252px;
  /* Section colours: the title band and menu accent change per part of the system */
  --sec-a: #0f4a1c; --sec-b: #168B38; --sec-accent: #F5C542;
}
.sec-ripoti { --sec-a: #14251B; --sec-b: #0f4a1c; --sec-accent: #F5C542; }
.sec-uza { --sec-a: #6d3004; --sec-b: #c0590b; --sec-accent: #F5C542; }
.sec-mzigo { --sec-a: #0a3d1b; --sec-b: #168B38; --sec-accent: #a6e05a; }
.sec-uhamisho { --sec-a: #12295a; --sec-b: #2457A7; --sec-accent: #8fb6f2; }
.sec-upotevu { --sec-a: #5c1717; --sec-b: #b13636; --sec-accent: #f7a3a3; }
.sec-stock { --sec-a: #4a3700; --sec-b: #8f6b00; --sec-accent: #F5C542; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; color: var(--ink); background: var(--bg); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif; }
a { color: var(--green); }
h1 { font-size: 1.6rem; margin: 0 0 4px; line-height: 1.2; letter-spacing: -.015em; }
h2 { font-size: 1.05rem; margin: 0 0 14px; display: flex; align-items: center; gap: 9px; }
h2 > .i { width: 30px; height: 30px; padding: 6px; border-radius: 9px; color: var(--sec-b); background: var(--green-soft); background: color-mix(in srgb, var(--sec-b) 12%, #fff); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.text-danger { color: var(--danger); font-weight: 600; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
.i { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.2em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Motion */
@keyframes fade-up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes pop-in { 0% { opacity: 0; transform: scale(.88); } 100% { opacity: 1; transform: none; } }
@keyframes grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes grow-x { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes shake { 0%, 100% { transform: none; } 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
@keyframes twinkle { 0%, 100% { opacity: .35; transform: scale(.7) rotate(0); } 50% { opacity: 1; transform: scale(1.1) rotate(20deg); } }
@keyframes drift { 0%, 100% { transform: translate(0, 0) rotate(var(--r, 0deg)); } 50% { transform: translate(18px, -14px) rotate(calc(var(--r, 0deg) + 6deg)); } }
@keyframes shimmer { from { background-position: 0% 50%; } to { background-position: 100% 50%; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(.94); } 100% { transform: scale(1); } }
@keyframes badge-pop { 0% { transform: scale(1); } 50% { transform: scale(1.25); } 100% { transform: scale(1); } }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 16px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
main > * { animation: fade-up .35s var(--ease) backwards; }
.stagger > * { animation: fade-up .45s var(--ease) backwards; }
.stagger > :nth-child(2) { animation-delay: .05s; } .stagger > :nth-child(3) { animation-delay: .1s; }
.stagger > :nth-child(4) { animation-delay: .15s; } .stagger > :nth-child(5) { animation-delay: .2s; }
.stagger > :nth-child(n+6) { animation-delay: .25s; }

/* ---------- App frame: side menu + header + content ---------- */
body.app {
  display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh;
  background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 600 300' fill='none'%3E%3Cellipse cx='300' cy='150' rx='290' ry='110' transform='rotate(-14 300 150)' stroke='%23168B38' stroke-opacity='.07' stroke-width='10'/%3E%3Cellipse cx='300' cy='150' rx='250' ry='86' transform='rotate(-14 300 150)' stroke='%23F58220' stroke-opacity='.08' stroke-width='6'/%3E%3C/svg%3E") right -160px bottom -60px / 760px auto no-repeat fixed;
}
.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 6px;
  background: var(--forest-dark); color: #cbd6ce; padding: 16px 12px; scrollbar-width: thin;
  background-image: radial-gradient(400px 220px at 0% 100%, rgba(22, 139, 56, .28), transparent 70%);
}
.side-brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 14px; text-decoration: none; color: #fff; border-bottom: 1px solid rgba(255,255,255,.08); margin-bottom: 6px; }
.brand-badge { display: grid; place-items: center; background: #fff; border-radius: 12px; padding: 4px 8px; box-shadow: 0 2px 10px rgba(0,0,0,.2); transition: transform .2s var(--spring); }
.brand-badge img { height: 32px; width: auto; display: block; }
.side-brand:hover .brand-badge, .top-brand:hover .brand-badge { transform: rotate(-3deg) scale(1.05); }
.side-brand-text { line-height: 1.15; }
.side-brand-text strong { display: block; font-size: 1rem; }
.side-brand-text small { color: #8fa197; font-size: .78rem; }
.side-group { margin: 12px 10px 4px; font-size: .7rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: #6f8277; }
.side ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.side a { position: relative; display: flex; align-items: center; gap: 11px; padding: 10px 12px; min-height: 44px; border-radius: 11px; color: #cbd6ce; text-decoration: none; font-weight: 600; transition: background .2s, color .2s; }
.side a .i { width: 20px; height: 20px; color: #8fa197; transition: color .2s, transform .25s var(--spring); }
.side a:hover { background: rgba(255,255,255,.06); color: #fff; }
.side a:hover .i { color: var(--sec-accent); transform: scale(1.12); }
.side a.on { background: var(--green); color: #fff; box-shadow: 0 6px 16px rgba(22, 139, 56, .35); }
.side a.on .i { color: #fff; }
.side a.on::before { content: ""; position: absolute; left: -12px; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0; background: var(--sec-accent); }
.side-user { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 8px 4px; border-top: 1px solid rgba(255,255,255,.08); }
.side-user-text { flex: 1; min-width: 0; color: #fff; font-weight: 600; font-size: .9rem; line-height: 1.2; }
.side-user-text small { display: block; color: #8fa197; font-weight: 500; font-size: .78rem; }
.side-logout { width: 40px; height: 40px; border-radius: 10px; border: 1px solid rgba(255,255,255,.14); background: transparent; color: #cbd6ce; cursor: pointer; display: grid; place-items: center; }
.side-logout:hover { background: rgba(200, 62, 62, .25); color: #fff; }
.side-install { margin-top: auto; padding: 8px 0 4px; }
.side-install:not([hidden]) + .side-user { margin-top: 0; }
.install-btn, .install-ios { display: flex; align-items: center; gap: 11px; width: 100%; margin: 0; padding: 10px 12px; min-height: 52px; border-radius: 12px; text-align: left; font: inherit; font-size: .9rem; font-weight: 700; color: #fff; background: rgba(245, 197, 66, .12); border: 1px dashed rgba(245, 197, 66, .5); }
.install-btn { cursor: pointer; transition: background .2s, transform .2s var(--spring); animation: pop-in .4s var(--spring) backwards; }
.install-btn:hover { background: rgba(245, 197, 66, .22); transform: translateY(-1px); }
.install-btn .i, .install-ios .i { width: 20px; height: 20px; color: var(--amber); }
.install-btn small { display: block; font-weight: 500; font-size: .76rem; color: #b9c7be; }
.install-ios { font-weight: 500; font-size: .84rem; line-height: 1.4; color: #dbe5de; }
a.side-logout { text-decoration: none; }
a.side-logout:hover { background: rgba(255, 255, 255, .1); color: var(--amber); }
.side-user form { display: contents; }
a.avatar { text-decoration: none; transition: transform .2s var(--spring); }
a.avatar:hover, a.avatar:focus-visible { transform: scale(1.08); }

/* ---------- Products and prices ---------- */
.unit-prices { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.unit-prices li { display: inline-flex; gap: 6px; align-items: baseline; padding: 3px 10px; border-radius: 999px; background: var(--green-soft); font-size: .86rem; }
.unit-prices li strong { font-variant-numeric: tabular-nums; }
.unit-prices li.off, tr.off td { opacity: .55; }
.unit-prices li.off span { text-decoration: line-through; }
label.check { display: inline-flex; align-items: center; gap: 8px; margin: 0; min-height: 44px; font-weight: 600; cursor: pointer; }
label.check input { width: 20px; min-height: 0; height: 20px; accent-color: var(--green); }
.row.checks { gap: 6px 22px; }
.unit-table td { vertical-align: middle; }
.unit-table td input { min-width: 90px; }
.unit-table td.num input { text-align: right; }
.import-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-bottom: 16px; }
.import-steps > .card { margin: 0; }
.import-ok { border-top: 4px solid var(--green); }
.import-bad { border-top: 4px solid var(--danger); }
.import-bad h2 > .i { color: var(--danger); background: var(--danger-soft); }
.import-errors { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; max-height: 60vh; overflow-y: auto; }
.import-errors li { padding: 8px 12px; border-radius: 10px; background: var(--danger-soft); color: #7d1f1f; font-weight: 600; font-size: .92rem; }
.pagestats.light > * { color: var(--ink); background: var(--green-soft); border-color: #c7e5cf; }

/* ---------- Password page ---------- */
.pw-wrap { display: grid; grid-template-columns: minmax(0, 460px) minmax(0, 1fr); gap: 16px; align-items: start; }
.pw-wrap .field ul.errorlist { list-style: none; margin: 6px 0 0; padding: 0; color: #a32b2b; font-size: .86rem; font-weight: 600; }
.pw-rules { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.pw-rules li { display: flex; gap: 10px; align-items: flex-start; }
.pw-rules .i { color: var(--green); margin-top: 3px; }
.pw-note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 13px; margin-bottom: 16px; background: var(--amber-soft); border: 1px solid #f3dc94; color: #6b4b00; font-weight: 600; }
.pw-note .i { color: #b08900; margin-top: 2px; }
@media (max-width: 860px) { .pw-wrap { grid-template-columns: minmax(0, 1fr); } }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; flex: none; font-weight: 800; font-size: .85rem; color: var(--forest-dark); background: var(--grad-sun); box-shadow: 0 0 0 3px rgba(245, 197, 66, .25); }
.side-scrim { display: none; }
.shell { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; padding: 10px 24px;
  padding-top: max(10px, env(safe-area-inset-top)); background: rgba(255,255,255,.9);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line);
}
.top-brand { display: none; text-decoration: none; }
.top-brand .brand-badge { padding: 3px 7px; box-shadow: 0 1px 4px rgba(0,0,0,.12); border: 1px solid var(--line); }
.top-date { line-height: 1.15; }
.top-date small { display: block; color: var(--muted); font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.top-date strong { font-size: .98rem; }
.topbar .spacer { flex: 1; }
.shop-switch, .shop-chip { display: flex; align-items: center; gap: 6px; border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 0 6px 0 12px; font-size: .9rem; font-weight: 600; color: var(--ink); }
.shop-switch .i, .shop-chip .i { color: var(--green); }
.shop-chip { padding: 8px 14px; }
.shop-switch select { font: inherit; border: 0; background: transparent; min-height: 40px; padding: 6px 8px; width: auto; cursor: pointer; }
.shop-switch select:focus { box-shadow: none; }
.top-avatar { display: none; }
main { width: 100%; max-width: 1280px; margin: 0 auto; padding: 22px 24px 60px; }
.tabbar { display: none; }

/* ---------- Page title band (colour follows the section) ---------- */
.pagehead {
  position: relative; overflow: hidden; display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px 18px;
  margin-bottom: 18px; padding: 22px 24px; border-radius: 20px; color: #fff;
  background: linear-gradient(125deg, var(--sec-a) 0%, var(--sec-b) 100%); box-shadow: 0 10px 28px rgba(20, 37, 27, .22);
}
.pagehead::before { content: ""; position: absolute; width: 520px; height: 170px; right: -230px; top: -110px; border-radius: 50%; border: 3px solid var(--sec-accent); opacity: .45; transform: rotate(-12deg); pointer-events: none; }
.pagehead::after { content: ""; position: absolute; width: 420px; height: 120px; right: -60px; bottom: -88px; border-radius: 50%; border: 2px solid #fff; opacity: .16; transform: rotate(-8deg); pointer-events: none; }
.pagehead > * { position: relative; z-index: 1; }
.pagehead h1 { color: #fff; }
.pagehead .muted, .pagehead .sub { color: rgba(255,255,255,.82) !important; margin: 0; }
.pagehead .eyebrow { margin: 0 0 4px; font-size: .78rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--sec-accent); }
.pagehead label { color: rgba(255,255,255,.9); }
.pagehead .btn { background: #fff; color: var(--sec-a); box-shadow: 0 4px 14px rgba(0,0,0,.15); }
.pagehead .btn:hover { filter: none; background: #f3f7f3; }
.pagehead .btn.alt, .pagehead .btn.glass { background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.35); box-shadow: none; }
.pagehead .btn.alt:hover, .pagehead .btn.glass:hover { background: rgba(255,255,255,.22); }
.pagehead select, .pagehead input { border-color: transparent; }
.head-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.seg { display: inline-flex; gap: 2px; padding: 4px; border-radius: 13px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.22); }
.seg a { color: #fff; text-decoration: none; font-weight: 700; font-size: .92rem; padding: 8px 14px; min-height: 40px; display: grid; place-items: center; border-radius: 10px; transition: background .2s, color .2s; }
.seg a:hover { background: rgba(255,255,255,.14); }
.seg a.on { background: #fff; color: var(--sec-a); box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.pagestats { flex-basis: 100%; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 4px; }
.pagestats > * { display: block; padding: 11px 14px; border-radius: 13px; color: #fff; text-decoration: none; background: rgba(255,255,255,.11); border: 1px solid rgba(255,255,255,.2); transition: background .2s, transform .2s var(--spring); }
.pagestats > a:hover { background: rgba(255,255,255,.2); transform: translateY(-2px); }
.pagestats strong { display: block; font-size: 1.3rem; line-height: 1.2; }
.pagestats span { font-size: .8rem; opacity: .85; }
.pagestats .danger { background: rgba(200, 62, 62, .35); }

/* ---------- Surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; transition: box-shadow .25s; }
.card:hover { box-shadow: var(--shadow-lift); }
.grid > .card, .dash-grid > .card { margin-bottom: 0; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: 10px; }
.card-head h2 { margin: 0; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid.kpis { grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); }
.kpi { position: relative; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--green); border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow); transition: transform .25s var(--spring), box-shadow .25s; }
.kpi:nth-child(2) { border-left-color: var(--orange); } .kpi:nth-child(3) { border-left-color: var(--info); }
.kpi:nth-child(4) { border-left-color: var(--amber); } .kpi:nth-child(5) { border-left-color: var(--danger); }
.kpi:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.kpi .label { color: var(--muted); font-size: .85rem; font-weight: 600; }
.kpi .value { font-size: 1.5rem; font-weight: 800; letter-spacing: -.01em; }
.kpi.accent { background: linear-gradient(160deg, #fff 55%, var(--orange-soft)); }
.empty { text-align: center; padding: 18px 10px; color: var(--muted); }
.empty .i { width: 46px; height: 46px; padding: 11px; border-radius: 50%; background: #eef2ee; color: var(--muted); animation: pop-in .4s var(--spring) both; }
.empty.good .i { background: var(--green-soft); color: var(--green); }
.empty p { margin: 8px 0 0; }

/* ---------- Dashboard: stat tiles ---------- */
.stats-grid { display: grid; grid-template-columns: 1.5fr repeat(3, 1fr); gap: 14px; margin-bottom: 16px; }
.stats-grid:has(> :nth-child(3):last-child) { grid-template-columns: 1.5fr 1fr 1fr; }
.stat { position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 6px; padding: 16px 16px 12px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--k, var(--green)); box-shadow: var(--shadow); transition: transform .25s var(--spring), box-shadow .25s; }
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.stat.k-profit { --k: var(--orange); } .stat.k-count { --k: var(--info); } .stat.k-avg { --k: var(--amber); }
.stat-top { display: flex; align-items: center; gap: 10px; }
.stat-icon { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; color: var(--k, var(--green)); background: var(--green-soft); background: color-mix(in srgb, var(--k, var(--green)) 13%, #fff); }
.stat-icon .i { width: 20px; height: 20px; }
.stat-label { font-weight: 700; color: var(--muted); font-size: .9rem; }
.stat-value { font-size: 1.75rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.stat-value small { font-size: .8rem; font-weight: 700; color: var(--muted); margin-right: 5px; letter-spacing: 0; }
.stat-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: .82rem; }
.delta { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px 2px 6px; border-radius: 999px; font-weight: 800; font-size: .8rem; }
.delta .i { width: 14px; height: 14px; stroke-width: 2.6; }
.delta.up { color: #0d6e2b; background: var(--green-soft); }
.delta.down { color: #a32b2b; background: var(--danger-soft); }
.delta.flat { color: var(--muted); background: #eef1ee; font-weight: 600; }
.pill { padding: 2px 8px; border-radius: 999px; background: var(--orange-soft); color: #8a4200; font-weight: 700; }
.spark { display: block; width: 100%; height: 36px; margin-top: 2px; overflow: visible; }
.spark-line { fill: none; stroke: #9AA59D; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.spark-dot { fill: var(--k, var(--green)); stroke: #fff; stroke-width: 2; }
.stat.hero { --k: var(--amber); color: #fff; border: 0; background: linear-gradient(135deg, var(--forest-deep), var(--forest) 55%, var(--green)); box-shadow: 0 12px 30px rgba(15, 74, 28, .3); }
.stat.hero::after { content: ""; position: absolute; width: 300px; height: 110px; right: -90px; top: -40px; border-radius: 50%; border: 3px solid var(--amber); opacity: .4; transform: rotate(-14deg); pointer-events: none; }
.stat.hero .stat-icon { color: var(--amber); background: rgba(255,255,255,.12); }
.stat.hero .stat-label, .stat.hero .muted, .stat.hero .stat-value small { color: rgba(255,255,255,.8); }
.stat.hero .stat-value { font-size: 2.6rem; }
.stat.hero .delta.up { background: rgba(255,255,255,.16); color: #c9f3d3; }
.stat.hero .delta.down { background: rgba(255,255,255,.16); color: #ffd0d0; }
.stat.hero .delta.flat { background: rgba(255,255,255,.14); color: rgba(255,255,255,.85); }
.stat.hero .spark-line { stroke: rgba(255,255,255,.55); }
.stat.hero .spark-dot { stroke: var(--forest); }

/* ---------- Dashboard: chart cards ---------- */
.dash-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.dash-grid .span-2 { grid-column: span 2; }
.dash-grid .span-3 { grid-column: 1 / -1; }
.chart { position: relative; min-height: 60px; }
.chart svg { display: block; max-width: 100%; overflow: visible; }
.chart .grid { stroke: #E8EEE9; stroke-width: 1; }
.chart .axis { stroke: #CBD5CD; stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .cross { stroke: #9AA59D; stroke-width: 1; }
.chart .end-label { fill: var(--ink); font-size: 11.5px; font-weight: 700; }
.chart .seg { cursor: pointer; transition: opacity .2s; }
.chart .seg:hover { opacity: .82; }
.chart .spin-in { animation: pop-in .6s var(--spring) both; }
.chart .grow path { transform-box: fill-box; transform-origin: bottom; animation: grow .6s var(--ease) both; }
.donut-total { fill: var(--ink); font-size: 22px; font-weight: 800; }
.donut-sub { fill: var(--muted); font-size: 11px; }
.donut-wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 18px; }
.chart-tip { position: absolute; z-index: 60; min-width: 150px; padding: 9px 11px; border-radius: 11px; background: var(--forest-dark); color: #fff; font-size: .82rem; box-shadow: 0 10px 26px rgba(0,0,0,.25); pointer-events: none; }
.chart-tip strong { display: block; margin-bottom: 4px; }
.tip-row { display: flex; align-items: center; gap: 7px; line-height: 1.6; }
.tip-row b { margin-left: auto; padding-left: 14px; font-variant-numeric: tabular-nums; }
.key { display: inline-block; flex: none; width: 10px; height: 10px; border-radius: 3px; }
.key.line { width: 16px; height: 3px; border-radius: 2px; }
.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .86rem; }
.legend li { display: flex; align-items: center; gap: 7px; }
.legend.col { flex-direction: column; gap: 10px; min-width: 150px; }
.legend.col li { display: grid; grid-template-columns: 10px 1fr auto; align-items: center; column-gap: 8px; }
.legend.col li .muted { grid-column: 2 / 4; margin-top: -3px; }
.chart-table { margin-top: 10px; font-size: .9rem; }
.chart-table summary { cursor: pointer; color: var(--green); font-weight: 700; min-height: 32px; display: inline-flex; align-items: center; }
.chart-table table { margin-top: 6px; }
.shop-row + .shop-row { margin-top: 16px; }
.shop-row-top { display: flex; align-items: center; gap: 8px; }
.shop-row-top .num { margin-left: auto; font-weight: 800; }
.shop-row p { margin: 0; }
.meter { height: 9px; margin: 8px 0 6px; border-radius: 999px; background: #EDF1ED; overflow: hidden; }
.meter span { display: block; height: 100%; border-radius: 999px; transform-origin: left; animation: grow-x .8s var(--ease) both .2s; }
.toplist { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.toplist-row { display: flex; align-items: center; gap: 9px; }
.toplist-name { flex: 1; min-width: 0; font-weight: 600; }
.rank { width: 24px; height: 24px; flex: none; border-radius: 8px; display: grid; place-items: center; font-size: .78rem; font-weight: 800; color: var(--forest); background: var(--green-soft); }
.toplist li:first-child .rank { background: var(--grad-sun); color: var(--forest-dark); }
.hbar { height: 8px; margin: 6px 0 3px 33px; border-radius: 999px; background: #EDF1ED; overflow: hidden; }
.hbar span { display: block; height: 100%; border-radius: 999px; background: var(--green); transform-origin: left; animation: grow-x .8s var(--ease) both .2s; }
.toplist .muted { margin-left: 33px; }
.alerts { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 8px; }
.alert { --a: var(--green); --a-soft: var(--green-soft); display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 13px; background: var(--a-soft); border: 1px solid var(--line); border: 1px solid color-mix(in srgb, var(--a) 22%, #fff); }
.alert strong { display: block; font-size: .93rem; }
.alert .muted { display: block; font-size: .8rem; }
.alert-icon { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; color: #fff; background: var(--a); }
.alert.warn { --a: var(--orange); --a-soft: var(--orange-soft); }
.alert.info { --a: var(--info); --a-soft: var(--info-soft); }
.alert.amber { --a: #b08900; --a-soft: var(--amber-soft); }
.alert.danger { --a: var(--danger); --a-soft: var(--danger-soft); }
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* ---------- Tables ---------- */
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { padding: 10px 11px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: #F6F9F6; }
thead th:first-child { border-top-left-radius: 10px; } thead th:last-child { border-top-right-radius: 10px; }
tbody tr { transition: background .15s; }
tbody tr:hover td { background: #F4FAF5; }
tr.total td, tr.total:hover td { font-weight: 700; background: var(--green-soft); }
tr.low td, tr.low:hover td { background: var(--orange-soft); }
td[colspan].muted { text-align: center; padding: 30px 10px; }
td[colspan].muted::before {
  content: ""; display: block; width: 46px; height: 46px; margin: 0 auto 8px; border-radius: 50%;
  background: #eef2ee url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2368756C' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 8l-9-5-9 5 9 5 9-5z'/%3E%3Cpath d='M3 8v8l9 5 9-5V8'/%3E%3Cpath d='M12 13v8'/%3E%3C/svg%3E") center / 24px no-repeat;
}

/* ---------- Forms and buttons ---------- */
label { display: block; font-weight: 650; font-size: .9rem; margin-bottom: 5px; }
input, select, textarea { font: inherit; width: 100%; padding: 9px 12px; border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: #fff; color: var(--ink); min-height: 44px; transition: border-color .2s, box-shadow .2s; }
input:hover, select:hover, textarea:hover { border-color: #c3cfc6; }
input:focus, select:focus, textarea:focus { border-color: var(--green); outline: none; box-shadow: 0 0 0 4px rgba(22, 139, 56, .18); }
.field { margin-bottom: 13px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > .field { flex: 1 1 180px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; font: inherit; font-weight: 700; border: 0; border-radius: 12px;
  padding: 10px 18px; min-height: 44px; cursor: pointer; text-decoration: none; color: #fff; background: var(--green);
  box-shadow: 0 3px 10px rgba(22, 139, 56, .25); transition: transform .15s var(--ease), box-shadow .2s, filter .2s, background .2s;
}
.btn:hover { filter: brightness(1.07); box-shadow: 0 6px 16px rgba(22, 139, 56, .3); transform: translateY(-1px); }
.btn:active { transform: translateY(1px) scale(.98); box-shadow: 0 2px 6px rgba(22, 139, 56, .2); }
.btn.alt { background: var(--surface); color: var(--ink); border: 1.5px solid var(--line); box-shadow: none; }
.btn.alt:hover { border-color: var(--green); color: var(--forest); background: var(--green-soft); filter: none; }
.btn.warn { background: var(--grad-sun); color: #3d1d00; box-shadow: 0 3px 12px rgba(245, 130, 32, .3); }
.btn.danger { background: var(--danger); box-shadow: 0 3px 10px rgba(200, 62, 62, .25); }
.btn.glass { background: rgba(10, 51, 19, .55); color: #fff; border: 1px solid rgba(255,255,255,.35); box-shadow: none; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: .88rem; border-radius: 10px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; filter: grayscale(.3); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1.5px solid var(--line); background: var(--surface); border-radius: 999px; padding: 7px 14px; min-height: 40px; font-weight: 650; text-decoration: none; color: var(--ink); font-size: .9rem; cursor: pointer; transition: all .2s var(--ease); }
.chip:hover { border-color: var(--green); background: var(--green-soft); }
.chip.on { background: var(--green); border-color: var(--green); color: #fff; box-shadow: 0 3px 10px rgba(22, 139, 56, .25); }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .76rem; font-weight: 700; background: var(--green-soft); color: #0d6e2b; }
.badge.warn { background: var(--orange-soft); color: #8a4200; }
.badge.danger { background: var(--danger-soft); color: #a32b2b; }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.grey { background: #ECEFEC; color: var(--muted); }

/* ---------- Messages ---------- */
.messages { list-style: none; padding: 0; margin: 0 0 14px; }
.messages li { display: flex; align-items: center; gap: 10px; padding: 11px 10px 11px 14px; border-radius: 12px; margin-bottom: 8px; background: var(--green-soft); border: 1px solid #c7e5cf; color: #0d5a24; font-weight: 600; animation: fade-up .35s var(--ease) both; transition: opacity .35s, transform .35s; }
.messages li > .i { color: var(--green); }
.messages li > span { flex: 1; }
.messages li.error { background: var(--danger-soft); border-color: #f1c6c6; color: #7d1f1f; }
.messages li.error > .i { color: var(--danger); }
.messages li.warning { background: var(--orange-soft); border-color: #f6d3b0; color: #7a3d00; }
.messages li.out { opacity: 0; transform: translateX(20px); }
.msg-x { background: none; border: 0; color: inherit; opacity: .6; cursor: pointer; min-width: 36px; min-height: 36px; border-radius: 8px; display: grid; place-items: center; }
.msg-x:hover { opacity: 1; background: rgba(0,0,0,.05); }

/* ---------- Line editor ---------- */
.lines td { padding: 6px; }
.lines input { min-height: 40px; }
.lines .rm { background: none; border: 0; color: var(--danger); font-size: 1.3rem; cursor: pointer; min-width: 40px; min-height: 40px; border-radius: 10px; }
.lines .rm:hover { background: var(--danger-soft); }

/* ---------- Login ---------- */
.login-body { background: var(--forest-deep); overflow-x: hidden; }
.login-bg { position: fixed; inset: 0; overflow: hidden; pointer-events: none; background: linear-gradient(135deg, var(--forest-dark), var(--forest) 45%, var(--green) 100%); background-size: 200% 200%; animation: shimmer 18s ease-in-out infinite alternate; }
.login-bg .ring { position: absolute; border-radius: 50%; animation: drift 16s ease-in-out infinite; }
.login-bg .r1 { --r: -14deg; width: 900px; height: 340px; left: -220px; top: 8%; border: 5px solid rgba(245, 197, 66, .55); box-shadow: 0 0 40px rgba(245, 130, 32, .25); }
.login-bg .r2 { --r: -10deg; width: 1100px; height: 420px; right: -380px; bottom: -120px; border: 4px solid rgba(124, 197, 28, .45); animation-duration: 20s; animation-delay: -6s; }
.login-bg .r3 { --r: 8deg; width: 600px; height: 220px; right: -120px; top: -60px; border: 3px solid rgba(245, 130, 32, .4); animation-duration: 13s; animation-delay: -3s; }
.login-bg .blob { position: absolute; border-radius: 50%; filter: blur(60px); animation: drift 22s ease-in-out infinite; }
.login-bg .b1 { width: 380px; height: 380px; background: var(--lime); left: -120px; bottom: -120px; opacity: .35; }
.login-bg .b2 { width: 320px; height: 320px; background: var(--orange); right: 10%; top: -140px; opacity: .3; animation-delay: -9s; }
.login-bg .spark { position: absolute; color: var(--amber); filter: drop-shadow(0 0 10px rgba(245, 197, 66, .9)); animation: twinkle 3.2s ease-in-out infinite; }
.login-bg .s1 { width: 44px; height: 44px; left: 12%; top: 14%; }
.login-bg .s2 { width: 26px; height: 26px; right: 18%; top: 22%; animation-delay: -1.2s; }
.login-bg .s3 { width: 32px; height: 32px; left: 44%; bottom: 10%; animation-delay: -2.1s; }
.login { position: relative; z-index: 1; min-height: 100vh; display: grid; grid-template-columns: 1.1fr minmax(320px, 420px); align-items: center; gap: 56px; max-width: 1080px; margin: 0 auto; padding: 32px 24px; }
.login-hero { color: #fff; animation: fade-up .6s var(--ease) both; }
@keyframes glow { 0%, 100% { box-shadow: 0 10px 30px rgba(0,0,0,.25), 0 0 0 0 rgba(245, 197, 66, 0); } 50% { box-shadow: 0 10px 30px rgba(0,0,0,.25), 0 0 0 10px rgba(245, 197, 66, .22); } }
@keyframes word-in { from { opacity: 0; transform: translateY(.45em) rotate(3deg); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes sweep { from { background-position: 100% 0; } to { background-position: 0% 0; } }
@keyframes icon-bounce { 0% { transform: scale(.4); } 60% { transform: scale(1.15); } 100% { transform: none; } }
@keyframes err-pulse { 0% { box-shadow: 0 0 0 0 rgba(200, 62, 62, .45); } 100% { box-shadow: 0 0 0 12px rgba(200, 62, 62, 0); } }
.hero-logo { display: inline-block; background: #fff; border-radius: 22px; padding: 10px 18px; box-shadow: 0 10px 30px rgba(0,0,0,.25); animation: pop-in .6s var(--spring) both .1s, glow 3.6s ease-in-out 1s infinite; }
.hero-logo img { display: block; width: 150px; height: auto; }
.login-hero h1 { font-size: clamp(2rem, 4.5vw, 3.1rem); margin: 22px 0 8px; letter-spacing: -.02em; color: #fff; }
.login-hero h1 .w { display: inline-block; animation: word-in .6s var(--ease) both .2s; }
.login-hero h1 .brand {
  background: linear-gradient(100deg, var(--amber) 0%, var(--orange) 35%, #fff3c4 50%, var(--orange) 65%, var(--amber) 100%) 0 0 / 250% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: word-in .6s var(--ease) both .38s, sweep 5s ease-in-out 1.2s infinite alternate;
}
.hero-sub { font-size: 1.08rem; opacity: .9; max-width: 30em; margin: 0 0 22px; animation: fade-up .5s var(--ease) both .5s; }
.hero-points { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.hero-points li { display: flex; align-items: center; gap: 12px; font-weight: 600; animation: slide-in .5s var(--ease) both; }
.hero-points li:nth-child(1) { --d: .65s; } .hero-points li:nth-child(2) { --d: .8s; } .hero-points li:nth-child(3) { --d: .95s; }
.hero-points li, .hero-points span { animation-delay: var(--d); }
.hero-points span { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.25); color: var(--amber); animation: icon-bounce .6s var(--spring) both; }
.login-card { background: rgba(255, 255, 255, .97); border-radius: 24px; padding: 30px 28px 24px; box-shadow: 0 24px 60px rgba(0, 0, 0, .3); animation: pop-in .55s var(--spring) backwards .15s; transition: transform .4s var(--ease), box-shadow .4s; }
.login-card.shake { animation: pop-in .4s var(--spring) backwards, shake .45s ease .4s; }
.login-card.sending { transform: translateY(-6px); box-shadow: 0 32px 70px rgba(0, 0, 0, .35), 0 0 0 4px rgba(124, 197, 28, .35); }
.login-error { animation: err-pulse .8s ease-out .85s 2; }
.login-card-logo { display: none; }
.login-card .hello { display: inline-flex; align-items: center; gap: 7px; margin: 0 0 6px; padding: 5px 12px; border-radius: 999px; background: var(--amber-soft); color: #7a5600; font-weight: 700; font-size: .88rem; }
.login-card .hello .i { color: var(--orange); animation: spin 12s linear infinite; }
.login-card h2 { font-size: 1.35rem; margin: 4px 0 18px; }
.login-error { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: var(--danger-soft); color: #7d1f1f; font-weight: 600; font-size: .92rem; margin-bottom: 14px; }
.login-error .i { color: var(--danger); margin-top: 2px; }
.input-icon { position: relative; }
.input-icon > .i { position: absolute; z-index: 1; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; transition: color .2s; }
.input-icon input { padding-left: 42px; min-height: 50px; border-radius: 13px; background: #F7FAF7; }
.input-icon input { transition: border-color .2s, box-shadow .25s, transform .25s var(--ease), background .2s; }
.input-icon input:focus { background: #fff; transform: translateY(-1px); box-shadow: 0 0 0 4px rgba(22, 139, 56, .18), 0 8px 18px rgba(22, 139, 56, .12); }
.input-icon:focus-within > .i { color: var(--green); transform: translateY(-50%) scale(1.1); transition: color .2s, transform .25s var(--spring); }
.peek { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border: 0; background: none; border-radius: 10px; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.peek:hover { color: var(--forest); background: var(--green-soft); }
.input-icon:has(.peek) input { padding-right: 50px; }
.caps { display: flex; align-items: center; gap: 6px; color: #8a4200; font-size: .84rem; font-weight: 600; margin: 6px 0 0; }
.login-btn { width: 100%; min-height: 52px; font-size: 1.05rem; margin-top: 6px; border-radius: 14px; background: var(--green); }
.login-btn .spinner { display: none; width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid rgba(255,255,255,.35); border-top-color: #fff; animation: spin .7s linear infinite; }
.login-btn.loading .spinner { display: inline-block; }
.login-foot { text-align: center; color: var(--muted); font-size: .84rem; margin: 16px 0 0; }

/* ---------- POS ---------- */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; align-items: start; }
.pos-search { display: flex; gap: 8px; margin-bottom: 10px; }
.pos-search input { min-height: 50px; border-radius: 14px; padding-left: 44px; box-shadow: var(--shadow); background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23168B38' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E") 14px center / 20px no-repeat; }
.pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tile { position: relative; overflow: hidden; text-align: left; background: var(--surface); border: 1.5px solid var(--line); border-left: 4px solid var(--orange); border-radius: 14px; padding: 12px; cursor: pointer; font: inherit; color: var(--ink); min-height: 98px; display: flex; flex-direction: column; gap: 2px; box-shadow: 0 1px 2px rgba(20,37,27,.05); transition: border-color .15s, box-shadow .2s, transform .15s var(--ease); }
.tile:hover, .tile:focus-visible { border-color: var(--green); box-shadow: var(--shadow-lift); transform: translateY(-2px); }
.tile.bump { animation: bump .22s var(--ease); }
.tile .n { font-weight: 700; line-height: 1.2; }
.tile .u { color: var(--muted); font-size: .85rem; }
.tile .p { margin-top: auto; font-weight: 800; color: var(--forest); }
.tile .s { font-size: .75rem; color: var(--muted); }
.tile .s.out { color: var(--danger); font-weight: 700; }
.cart { position: sticky; top: 76px; border-top: 4px solid var(--orange); }
.cart-lines { max-height: 42vh; overflow-y: auto; margin: 0 -4px; }
.cline { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; padding: 9px 4px; border-bottom: 1px dashed var(--line); animation: fade-up .25s var(--ease) both; }
.cline .qty { display: flex; align-items: center; gap: 4px; }
.cline .qty button { width: 40px; height: 40px; border-radius: 11px; border: 1.5px solid var(--line); background: #fff; font-size: 1.15rem; cursor: pointer; transition: background .15s, transform .1s; }
.cline .qty button:hover { background: var(--green-soft); border-color: var(--green); }
.cline .qty button:active { transform: scale(.92); }
.cline .qty input { width: 76px; min-height: 40px; text-align: center; padding: 4px; }
.cline .price input { width: 110px; min-height: 36px; padding: 4px 8px; text-align: right; }
.cline .x { background: none; border: 0; color: var(--danger); cursor: pointer; font-weight: 700; }
#count.pop, .cartbar.pop { animation: badge-pop .3s var(--spring); }
.cart-total { display: flex; justify-content: space-between; align-items: baseline; font-size: 1.55rem; font-weight: 800; margin: 14px 0; padding: 12px 14px; border-radius: 14px; background: var(--green-soft); color: var(--forest); font-variant-numeric: tabular-nums; }
.paybtns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 10px; }
.paybtns button { min-height: 48px; border-radius: 12px; border: 1.5px solid var(--line); background: #fff; color: var(--ink); font: inherit; font-weight: 700; cursor: pointer; transition: all .18s var(--ease); }
.paybtns button:hover { border-color: var(--green); }
.tierbtns { grid-template-columns: 1fr 1fr; margin: 6px 0 4px; }
.paybtns button[aria-pressed="true"] { background: var(--green); color: #fff; border-color: var(--green); box-shadow: 0 3px 10px rgba(22, 139, 56, .25); }
.syncbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 14px; border-radius: 12px; margin-bottom: 12px; font-size: .9rem; font-weight: 600; background: var(--green-soft); color: #0d5a24; border: 1px solid #c7e5cf; }
.syncbar #syncmsg::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; background: var(--green); box-shadow: 0 0 0 4px rgba(22, 139, 56, .18); vertical-align: 1px; }
.syncbar.off { background: var(--orange-soft); color: #7a3c05; border-color: #f7d4b4; }
.syncbar.off #syncmsg::before { background: var(--orange); box-shadow: 0 0 0 4px rgba(245, 130, 32, .2); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--forest-dark); color: #fff; padding: 13px 20px; border-radius: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.25); font-weight: 650; z-index: 70; max-width: 92vw; animation: toast-in .3s var(--spring) both; }
.toast.err { background: var(--danger); }
.sale-done { position: fixed; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 65; }
.sale-done span { width: 112px; height: 112px; border-radius: 50%; display: grid; place-items: center; background: var(--green); box-shadow: 0 0 0 10px rgba(22, 139, 56, .2), 0 20px 40px rgba(15, 74, 28, .35); animation: pop-in .35s var(--spring) both; transition: opacity .3s; }
.sale-done.out span { opacity: 0; }
.sale-done .i { width: 58px; height: 58px; color: #fff; stroke-width: 3; stroke-dasharray: 30; stroke-dashoffset: 30; animation: draw .35s ease .15s forwards; }
.cartbar { display: none; }

/* ---------- Loading: skeletons, top progress bar, busy buttons ---------- */
@keyframes skel { from { background-position: 150% 0; } to { background-position: -50% 0; } }
@keyframes progress { 0% { transform: scaleX(0); } 30% { transform: scaleX(.45); } 70% { transform: scaleX(.78); } 100% { transform: scaleX(.92); } }
.skel, .skel-line {
  background: #E4EBE5 linear-gradient(100deg, transparent 30%, rgba(255,255,255,.7) 50%, transparent 70%) 0 0 / 200% 100% no-repeat;
  animation: skel 1.3s ease-in-out infinite; border-radius: 12px;
}
.skel-line { display: block; height: 12px; border-radius: 6px; }
.skel-line.w40 { width: 40%; } .skel-line.w60 { width: 60%; } .skel-line.w80 { width: 80%; }
/* Charts hold their size while they are drawn, so the page does not jump. */
.chart.skel { min-height: 250px; }
#hours.skel { min-height: 180px; }
.chart.donut.skel { width: 172px; height: 172px; min-height: 0; border-radius: 50%; }
/* POS placeholders until the product list is ready */
.tile.skel-tile { cursor: default; pointer-events: none; border-left-color: var(--line); gap: 9px; }
.tile.skel-tile .skel-line:last-child { margin-top: auto; height: 16px; }
.chip.skel { width: 74px; border-color: transparent; pointer-events: none; }
/* Moving between pages: a bar runs along the top, and a slow page shows a skeleton */
.page-progress { position: fixed; z-index: 90; top: 0; left: 0; right: 0; height: 3px; pointer-events: none; transform-origin: left; transform: scaleX(0); background: var(--grad-sun); box-shadow: 0 0 10px rgba(245, 130, 32, .6); opacity: 0; }
body.navigating .page-progress { opacity: 1; animation: progress 8s cubic-bezier(.1, .7, .3, 1) forwards; }
.page-skel { display: none; }
body.navigating.slow .page-skel {
  display: block; position: fixed; z-index: 25; top: 61px; left: var(--side-w); right: 0; bottom: 0; overflow: hidden;
  padding: 22px max(24px, calc((100vw - var(--side-w) - 1280px) / 2 + 24px)); background: var(--bg); animation: fade-up .2s var(--ease) both;
}
.page-skel .ps-head { height: 118px; border-radius: 20px; margin-bottom: 18px; background-color: color-mix(in srgb, var(--sec-b) 22%, #E4EBE5); }
.page-skel .ps-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.page-skel .ps-stats span { height: 84px; border-radius: var(--radius); }
.page-skel .ps-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: grid; gap: 16px; }
.btn.busy { pointer-events: none; }
.btn.busy::before { content: ""; width: 16px; height: 16px; flex: none; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; opacity: .8; animation: spin .7s linear infinite; }
.btn.busy > .i { display: none; }

/* ---------- Page arrival ---------- */
@keyframes head-in { from { opacity: 0; transform: translateY(-14px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes arrive { from { opacity: 0; transform: scale(.975); } to { opacity: 1; transform: none; } }
@keyframes slide-in { from { opacity: 0; transform: translateX(-16px); } to { opacity: 1; transform: none; } }
main > .pagehead { animation: head-in .5s var(--ease) backwards; }
.pagestats > * { animation: rise .45s var(--ease) backwards; }
.pagestats > :nth-child(1) { animation-delay: .18s; } .pagestats > :nth-child(2) { animation-delay: .26s; }
.pagestats > :nth-child(3) { animation-delay: .34s; } .pagestats > :nth-child(n+4) { animation-delay: .42s; }
tr.row-in { animation: rise .35s var(--ease) backwards; animation-delay: calc(var(--i, 0) * 35ms + 120ms); }
.badge { animation: pop-in .35s var(--spring) backwards .2s; }
body.arrive .shell { animation: arrive .5s var(--ease) backwards; }
@media (min-width: 861px) { body.arrive .side { animation: slide-in .5s var(--ease) backwards; } }
.card { transition: box-shadow .25s, transform .25s var(--spring); }
@media (hover: hover) { .dash-grid > .card:hover { transform: translateY(-2px); } }
.stat:active, .pagestats > a:active { transform: scale(.985); }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .stats-grid, .stats-grid:has(> :nth-child(3):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat.hero { grid-column: 1 / -1; }
  .stats-grid > .stat:not(.hero):last-child:nth-child(even) { grid-column: 1 / -1; }
  .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  body.app { display: block; }
  .side { position: fixed; z-index: 80; left: 0; top: 0; bottom: 0; width: min(300px, 86vw); transform: translateX(-104%); transition: transform .28s var(--ease), box-shadow .28s; }
  body.menu-open .side { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.35); }
  .side-scrim { display: block; position: fixed; inset: 0; z-index: 75; background: rgba(10, 20, 14, .45); animation: fade-up .2s both; }
  .topbar { padding: 8px 14px; padding-top: max(8px, env(safe-area-inset-top)); gap: 10px; }
  .top-brand, .top-avatar { display: grid; }
  .top-date { display: none; }
  .shop-switch { max-width: 52vw; }
  .shop-switch select { min-width: 0; max-width: 100%; text-overflow: ellipsis; }
  .shop-chip { max-width: 52vw; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; display: block; font-size: .85rem; padding: 7px 12px; }
  .shop-chip .i { margin-right: 5px; }
  main { padding: 14px 14px calc(96px + env(safe-area-inset-bottom)); }
  .tabbar {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; z-index: 50; left: 0; right: 0; bottom: 0;
    padding: 6px 6px max(6px, env(safe-area-inset-bottom)); background: rgba(255,255,255,.96); border-top: 1px solid var(--line);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 -6px 20px rgba(20, 37, 27, .06);
  }
  .tab-pill { position: absolute; z-index: 0; top: 6px; left: 0; height: 54px; border-radius: 14px; background: var(--green-soft); pointer-events: none; transition: transform .38s var(--spring), width .3s var(--ease); }
  .tabbar a, .tabbar button { z-index: 1; }
  .tabbar a.on .i { animation: icon-bounce .45s var(--spring) .1s backwards; }
  body.menu-open .side li { animation: slide-in .32s var(--ease) backwards; animation-delay: calc(var(--i, 0) * 28ms + 90ms); }
  body.navigating.slow .page-skel { left: 0; padding: 14px; bottom: calc(66px + env(safe-area-inset-bottom)); }
  .page-skel .ps-head { height: 96px; border-radius: 18px; }
  .page-skel .ps-stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tabbar a, .tabbar button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 54px; border: 0; background: none; color: var(--muted); font: inherit; font-size: .72rem; font-weight: 700; text-decoration: none; border-radius: 12px; cursor: pointer; }
  .tabbar .i { width: 22px; height: 22px; transition: transform .25s var(--spring); }
  .tabbar a.on { color: var(--green); }
  .tabbar a.on .i { transform: translateY(-1px) scale(1.08); }
  .tabbar a:active, .tabbar button:active { background: var(--green-soft); }
  .pagehead { padding: 18px 16px; border-radius: 18px; }
  .pagehead h1 { font-size: 1.35rem; }
  .head-tools { width: 100%; flex-wrap: nowrap; }
  .hide-sm { display: none; }
  .seg { flex: 1; }
  .seg a { flex: 1; padding: 8px 6px; }
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
  .dash-grid .span-2 { grid-column: auto; }
  .pos { grid-template-columns: minmax(0, 1fr); }
  .cart { position: static; }
  .cartbar { display: flex; position: fixed; left: 10px; right: 10px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 45; justify-content: space-between; align-items: center; gap: 10px; background: var(--grad-sun); color: #3d1d00; border: 0; border-radius: 16px; padding: 15px 18px; font: inherit; font-weight: 800; font-size: 1.05rem; box-shadow: 0 8px 24px rgba(245, 130, 32, .4); cursor: pointer; }
  body.has-cartbar main { padding-bottom: calc(160px + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .login { grid-template-columns: 1fr; gap: 20px; padding: 24px 16px; align-content: center; }
  .login-hero { text-align: center; }
  .hero-logo, .hero-points { display: none; }
  .login-hero h1 { margin-top: 0; }
  .hero-sub { margin: 0 auto 4px; font-size: .98rem; }
  .login-card { padding: 24px 20px 20px; margin-top: 40px; }
  .login-card-logo { display: block; width: max-content; margin: -64px auto 10px; background: #fff; border-radius: 18px; padding: 8px 14px; box-shadow: 0 8px 22px rgba(0,0,0,.2); }
  .login-card-logo img { display: block; width: 110px; height: auto; }
}
/* Table cards: on phones every row becomes a small card, labelled by its column. */
@media (max-width: 640px) {
  .stack-host { background: none; border: 0; box-shadow: none; padding: 0; }
  .stack-host:hover { box-shadow: none; }
  .stackable thead { display: none; }
  .stackable, .stackable tbody, .stackable tfoot, .stackable tr, .stackable td { display: block; width: 100%; }
  .stackable tr { margin-bottom: 10px; padding: 6px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--sec-b); box-shadow: var(--shadow); }
  .stackable tr.low { border-left-color: var(--orange); background: var(--orange-soft); }
  .stackable tr.total { border-left-color: var(--green); background: var(--green-soft); }
  .stackable td, .stackable tr:hover td, .stackable tr.low td, .stackable tr.total td { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; padding: 7px 0; border: 0; background: none; text-align: right; white-space: normal; }
  .stackable td + td { border-top: 1px dashed var(--line); }
  .stackable td::before { content: attr(data-label); flex: none; max-width: 48%; text-align: left; font-size: .74rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
  .stackable td:not([data-label])::before { content: none; }
  .stackable td:first-child { justify-content: flex-start; flex-wrap: wrap; gap: 4px 10px; font-weight: 700; font-size: 1.02rem; text-align: left; }
  .stackable td:first-child::before { content: none; }
  .stackable td[colspan] { display: block; text-align: center; }
  .stackable td input { max-width: 55%; }
  .stats-grid { gap: 10px; }
  .stat { padding: 13px 13px 10px; }
  .stat-value { font-size: 1.3rem; }
  .stat.hero .stat-value { font-size: 2.2rem; }
  .stat-label { font-size: .82rem; }
  .pagestats { grid-template-columns: 1fr 1fr; }
  .pagestats strong { font-size: 1.1rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
}
@media print {
  body.app { display: block; background: #fff; }
  .side, .topbar, .tabbar, .no-print, .head-tools, .chart-tip { display: none !important; }
  .pagehead { background: none; color: var(--ink); box-shadow: none; padding: 0; }
  .pagehead h1, .pagehead .muted, .pagehead .sub { color: var(--ink) !important; }
  .pagehead::before, .pagehead::after { display: none; }
  .card, .kpi, .stat { box-shadow: none; }
  main > *, .stagger > * { animation: none !important; }
}

/* ---------- Error pages (404, 500) ---------- */
.err-page { position: relative; z-index: 1; min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.err-card { width: 100%; max-width: 440px; background: var(--surface, #fff); border-radius: 22px; padding: 32px 28px; text-align: center; box-shadow: 0 24px 60px rgba(0,0,0,.3); animation: fade-up .5s var(--ease) both; }
.err-logo { width: 120px; height: auto; }
.err-card .err-code { margin: 18px 0 0; font-size: 3.4rem; font-weight: 800; line-height: 1; letter-spacing: -.03em; background: linear-gradient(120deg, var(--green), var(--lime)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.err-card h1 { font-size: 1.3rem; margin: 10px 0 8px; }
.err-card p { color: var(--muted); margin: 0 0 12px; }
.err-card .btn { margin-top: 10px; min-height: 48px; }
.err-card .err-icon { width: 64px; height: 64px; color: var(--orange); stroke-width: 1.8; vertical-align: 0; }
.err-card .err-queue { background: var(--green-soft); color: var(--forest); border-radius: 12px; padding: 10px 12px; font-weight: 600; }
.err-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.err-actions .btn { flex: 1 1 150px; justify-content: center; }

/* ---------- Bulk SMS ---------- */
.sms-groups { display: flex; flex-wrap: wrap; gap: 4px 22px; }
.sms-groups .badge { margin-left: 2px; }
.sms-counter { margin: -4px 0 8px; font-weight: 700; color: var(--forest); }
.sms-counter.many { color: #8a4200; }
.sms-warn { margin: 0 0 10px; padding: 8px 12px; border-radius: 10px; background: var(--orange-soft); color: #8a4200; font-size: .9rem; }
.sms-bubble { max-width: 420px; padding: 12px 14px; border-radius: 16px 16px 16px 4px; background: var(--green-soft); color: var(--ink); white-space: normal; overflow-wrap: anywhere; line-height: 1.45; }
input.pick { width: 22px; height: 22px; min-height: 0; accent-color: var(--green); }

/* ---------- Returns, price hints ---------- */
.unit-margin { display: block; margin-top: 4px; font-size: .78rem; color: var(--muted); font-weight: 600; }
.unit-margin.neg { color: var(--danger); }
@media (max-width: 860px) { .stackable td:has(.unit-margin) { flex-wrap: wrap; } .stackable .unit-margin { flex-basis: 100%; text-align: right; } }
.below-cost { border-top: 4px solid var(--orange); }
.return-table .qty-in { width: 90px; text-align: right; }
.issue.done { opacity: .75; }
.week-cmp { flex-basis: 100%; font-size: .78rem; font-weight: 700; color: var(--muted); }
.week-cmp.up { color: var(--green); }
.week-cmp.down { color: var(--danger); }
.stat.hero .week-cmp { color: rgba(255, 255, 255, .88); }

/* Devices logged in (Vifaa) */
.devices { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.device { display: flex; align-items: flex-start; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 13px; }
.device.new { border-color: #f3c58f; background: #fffaf3; }
.device-icon .i { width: 40px; height: 40px; padding: 9px; border-radius: 12px; background: var(--green-soft); color: var(--green); }
.device-body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.device-body p { margin: 4px 0 0; }
.device-name { font-weight: 600; }
.device .btn { min-height: 44px; }
.pw-devices { grid-column: 1 / -1; }
.pw-devices form { margin-top: 12px; }
@media (max-width: 560px) {
  .device { flex-wrap: wrap; }
  .device form { width: 100%; }
  .device .btn { width: 100%; }
}

/* KGi Intelligence (Akili ya biashara) */
.insight-list { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); margin: 0; }
.insight-list .alert { align-items: start; }
.insight-items { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 3px; font-size: .84rem; }
.insight-items b { font-weight: 700; }
@media (max-width: 560px) {
  .insight-list .alert { grid-template-columns: 38px minmax(0, 1fr); }
  .insight-list .alert > .btn { grid-column: 2; justify-self: start; min-height: 44px; }
}

/* Return reason (only expired or faulty goods come back) */
.reason-pick { border: 0; padding: 0; margin: 0 0 8px; display: flex; flex-wrap: wrap; gap: 0 24px; }
.reason-pick legend { font-weight: 700; margin-bottom: 4px; padding: 0; }
