/* ==========================================================================
   JS ALAAN HARDWARE — interface styles
   Soft mint palette, floating pill navigation, calm motion.
   ========================================================================== */

:root {
  --bg: #edf3ee;
  --bg-2: #e3ece5;
  --surface: #ffffff;
  --surface-2: #f4f8f5;
  --surface-3: #e9f1ec;
  --ink: #12201a;
  --ink-2: #334139;
  --muted: #65756d;
  --line: #dbe6de;
  --line-2: #c9d8cd;
  --primary: #0f7a52;
  --primary-2: #0a5f40;
  --primary-soft: #d6f3e3;
  --primary-ink: #ffffff;
  --mint: #bff0d6;
  --lime: #d9f99d;
  --warn: #d98c1f;
  --warn-soft: #fdebcc;
  --danger: #d6453f;
  --danger-soft: #fde1df;
  --info: #2f6fdb;
  --info-soft: #dce8fb;
  --shadow: 0 1px 2px rgb(20 40 30 / .05), 0 8px 24px -12px rgb(20 40 30 / .18);
  --shadow-lg: 0 24px 60px -24px rgb(20 40 30 / .35);
  --radius: 18px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  --ease: cubic-bezier(.22, .61, .36, 1);
  --ease-spring: cubic-bezier(.34, 1.4, .64, 1);
  --dur: 260ms;
  --nav-h: 64px;
  --rail-w: 72px;
  --font: 'Plus Jakarta Sans', 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0b1410;
  --bg-2: #0e1a14;
  --surface: #13201a;
  --surface-2: #182a21;
  --surface-3: #1f3328;
  --ink: #e9f3ed;
  --ink-2: #c3d2c9;
  --muted: #8da397;
  --line: #203329;
  --line-2: #2b4335;
  --primary: #34d399;
  --primary-2: #6ee7b7;
  --primary-soft: #113a2a;
  --primary-ink: #06281b;
  --mint: #19533c;
  --lime: #3f6212;
  --warn: #f2b14a;
  --warn-soft: #3a2a0f;
  --danger: #f06d67;
  --danger-soft: #3d1816;
  --info: #7aa7f5;
  --info-soft: #152748;
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 10px 30px -14px rgb(0 0 0 / .6);
  --shadow-lg: 0 24px 60px -20px rgb(0 0 0 / .7);
  color-scheme: dark;
}

/* ---- Base ------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.45; color: var(--ink);
  background: var(--bg);
  background-image: radial-gradient(1200px 600px at 10% -10%, color-mix(in oklab, var(--mint) 55%, transparent), transparent 60%),
                    radial-gradient(900px 500px at 110% 10%, color-mix(in oklab, var(--lime) 35%, transparent), transparent 60%);
  background-attachment: fixed;
  min-height: 100dvh; -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: var(--primary); text-decoration: none; }
img { display: block; max-width: 100%; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 32px; font-weight: 800; letter-spacing: -.02em; } h2 { font-size: 19px; } h3 { font-size: 16px; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.num { font-variant-numeric: tabular-nums; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.right { text-align: right; }
.center { text-align: center; }
.hide { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
::selection { background: var(--primary-soft); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }

/* ---- Icons ------------------------------------------------------------ */
.i { width: 22px; height: 22px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.i.sm { width: 18px; height: 18px; } .i.lg { width: 30px; height: 30px; }

/* ---- Login ------------------------------------------------------------ */
.login {
  min-height: 100dvh; display: grid; place-items: center; padding: 20px; position: relative; overflow: hidden;
}
.login__bg { position: absolute; inset: -20px; background: var(--login-bg) center/cover no-repeat; filter: blur(6px) saturate(1.05) brightness(.75); transform: scale(1.04); animation: slowZoom 30s linear infinite alternate; }
@keyframes slowZoom { to { transform: scale(1.1); } }
.login__veil { position: absolute; inset: 0; background: linear-gradient(160deg, rgb(8 40 28 / .55), rgb(8 40 28 / .25) 50%, rgb(0 0 0 / .45)); }
.login__card {
  position: relative; width: min(420px, 100%); background: color-mix(in oklab, var(--surface) 92%, transparent); backdrop-filter: blur(18px);
  border: 1px solid color-mix(in oklab, var(--line) 70%, transparent); border-radius: 28px; padding: 36px 32px 28px; box-shadow: var(--shadow-lg);
  animation: cardIn .6s var(--ease) both; overflow: hidden;
}
.login__card::before { content: ''; position: absolute; inset: 0; background: url('/media/logo') center 56px/220px auto no-repeat; opacity: .06; pointer-events: none; }
@keyframes cardIn { from { opacity: 0; transform: translateY(18px) scale(.98); } }
.login__brand { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 26px; text-align: center; }
.login__brand .logo { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; box-shadow: 0 10px 24px -10px var(--primary); }
.login__brand h1 { font-size: 22px; letter-spacing: .02em; }
.login__brand p { color: var(--muted); font-size: 13px; }
.login__demo { margin-top: 18px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.login__demo button { font-size: 12px; padding: 8px 6px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); transition: all .2s var(--ease); }
.login__demo button:hover { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); transform: translateY(-1px); }

/* ---- Shell ------------------------------------------------------------ */
.shell { min-height: 100dvh; display: grid; grid-template-rows: auto 1fr; }
.shell > *, .layout > *, .grid > *, .pos > *, .row > *, .col > * { min-width: 0; }
html, body { overflow-x: clip; }
.topbar {
  position: sticky; top: 0; z-index: 40; padding: 12px 16px 0;
}
.topbar__inner {
  margin: 0 auto; max-width: 1480px; display: flex; min-width: 0; align-items: center; gap: 12px; padding: 8px 10px 8px 12px; min-height: var(--nav-h);
  background: color-mix(in oklab, var(--surface) 86%, transparent); backdrop-filter: blur(16px) saturate(1.2);
  border: 1px solid color-mix(in oklab, var(--line) 80%, transparent); border-radius: 999px; box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 10px; padding-right: 8px; min-width: 0; }
.brand__mark { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; flex: none; box-shadow: 0 8px 18px -10px var(--primary); }
.brand__text { line-height: 1.1; min-width: 0; }
.brand__text b { display: block; font-size: 14px; letter-spacing: .03em; white-space: nowrap; }
.brand__text span { font-size: 11.5px; color: var(--muted); white-space: nowrap; }

/* Pill tabs with sliding indicator */
.pills { position: relative; display: flex; gap: 2px; padding: 4px; background: var(--surface-3); border-radius: 999px; isolation: isolate; }
.pills__ind { position: absolute; top: 4px; left: 0; height: calc(100% - 8px); border-radius: 999px; background: var(--ink); z-index: -1;
  transition: transform .38s var(--ease), width .38s var(--ease), opacity .2s; box-shadow: 0 6px 16px -8px rgb(0 0 0 / .5); }
:root[data-theme="dark"] .pills__ind { background: var(--primary); }
.pills button { padding: 9px 18px; border-radius: 999px; font-weight: 700; font-size: 14.5px; color: var(--ink-2); white-space: nowrap; transition: color .25s; display: flex; align-items: center; gap: 7px; }
.pills button.active { color: #fff; }
:root[data-theme="dark"] .pills button.active { color: var(--primary-ink); }
.pills button:hover:not(.active) { color: var(--ink); }
.pills .badge { background: var(--danger); color: #fff; }
.pills button.active .badge { background: #fff; color: var(--ink); }

.topbar__spacer { flex: 1; }
.search { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; min-width: 200px; color: var(--muted); transition: all .25s var(--ease); }
.search:focus-within { border-color: var(--primary); background: var(--surface); box-shadow: 0 0 0 4px var(--primary-soft); color: var(--ink); }
.search input { border: 0; background: none; outline: 0; width: 100%; font-size: 13.5px; }
.search kbd { font: 600 10.5px var(--mono); padding: 2px 6px; border-radius: 6px; background: var(--surface-3); border: 1px solid var(--line); color: var(--muted); }

.iconbtn { position: relative; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line); transition: all .22s var(--ease); }
.iconbtn:hover { background: var(--surface-3); color: var(--ink); transform: translateY(-1px); }
.iconbtn:active { transform: scale(.94); }
.iconbtn .dot { position: absolute; top: 7px; right: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--danger); border: 2px solid var(--surface); transform: scale(0); transition: transform .3s var(--ease-spring); }
.iconbtn .dot.on { transform: scale(1); }
.iconbtn.bell.ring .i { animation: ring .8s var(--ease); transform-origin: top center; }
@keyframes ring { 0%,100% { transform: rotate(0); } 20% { transform: rotate(14deg); } 40% { transform: rotate(-12deg); } 60% { transform: rotate(8deg); } 80% { transform: rotate(-4deg); } }

.theme { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--ink); color: var(--bg); overflow: hidden; position: relative; transition: transform .25s var(--ease); }
.theme:hover { transform: rotate(15deg) scale(1.05); }
.theme .i { position: absolute; transition: transform .45s var(--ease-spring), opacity .3s; }
.theme .sun { transform: translateY(0) rotate(0); } .theme .moon { transform: translateY(32px) rotate(-60deg); opacity: 0; }
:root[data-theme="dark"] .theme .sun { transform: translateY(-32px) rotate(60deg); opacity: 0; }
:root[data-theme="dark"] .theme .moon { transform: translateY(0) rotate(0); opacity: 1; }

.userchip { display: flex; align-items: center; gap: 10px; padding: 4px 12px 4px 4px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); transition: all .22s var(--ease); max-width: 220px; }
.userchip:hover { background: var(--surface-3); }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 12.5px; color: var(--primary-ink); background: linear-gradient(135deg, var(--primary), var(--primary-2)); flex: none; overflow: hidden; }
:root[data-theme="dark"] .avatar { color: var(--primary-ink); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 56px; height: 56px; font-size: 18px; } .avatar.xl { width: 84px; height: 84px; font-size: 26px; border-radius: 24px; }
.userchip__text { line-height: 1.15; text-align: left; min-width: 0; }
.userchip__text small { display: block; font-size: 11px; color: var(--muted); }
.userchip__text b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Layout: rail + content */
.layout { display: grid; grid-template-columns: var(--rail-w) 1fr; gap: 8px; max-width: 1512px; width: 100%; margin: 0 auto; padding: 14px 16px 90px; }
.rail { position: sticky; top: calc(var(--nav-h) + 26px); align-self: start; display: flex; flex-direction: column; gap: 8px; }
.rail__group { display: flex; flex-direction: column; gap: 4px; padding: 6px; background: color-mix(in oklab, var(--surface) 86%, transparent); backdrop-filter: blur(12px); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); }
.rail a { position: relative; width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center; color: var(--muted); transition: all .22s var(--ease); }
.rail a:hover { background: var(--surface-3); color: var(--ink); }
.rail a.active { background: var(--primary-soft); color: var(--primary); }
.rail a .badge { position: absolute; top: 4px; right: 4px; }
.rail a .txt { display: none; }
.rail a .i { width: 24px; height: 24px; }
.rail a .tip { position: absolute; left: calc(100% + 12px); top: 50%; transform: translateY(-50%) translateX(-6px); background: var(--ink); color: var(--bg); font-size: 12px; font-weight: 600; padding: 6px 10px; border-radius: 8px; white-space: nowrap; opacity: 0; pointer-events: none; transition: all .2s var(--ease); z-index: 10; }
.rail a:hover .tip { opacity: 1; transform: translateY(-50%) translateX(0); }

main.page { min-width: 0; }
.page__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 6px 4px 18px; }
.page__head .eyebrow { font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.page__actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* View transition for page content */
.view { animation: viewIn .45s cubic-bezier(.2,.8,.2,1) both; transform-origin: 50% 0; }
/* Low-end phones: no backdrop blur on the floating bars (it repaints on every scroll frame). */
@media (max-width: 760px) and (pointer: coarse) { .bottomnav, .topbar { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; background: var(--surface) !important; } }
@keyframes viewIn { from { opacity: .25; transform: translate3d(0, 22px, 0) scale(.985); } }
.view.leaving { animation: viewOut .2s ease-in both; }
main.page { position: relative; }
.view.pending { visibility: hidden; animation: none; }
.view.pending * { animation-play-state: paused !important; }
@keyframes viewOut { to { opacity: 0; transform: translate3d(0, -10px, 0) scale(.99); } }
.stagger > * { animation: rise .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms); }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }

/* ---- Cards & grids ---------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; position: relative; }
.card.flat { box-shadow: none; }
.card.pad-0 { padding: 0; overflow: hidden; }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card__head .sub { font-size: 12.5px; color: var(--muted); }
.grid { display: grid; gap: 14px; }
.grid.kpi { grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); }
.grid.main { grid-template-columns: minmax(0, 1.75fr) minmax(min(300px, 100%), 1fr); }
@media (max-width: 1100px) { .grid.main { grid-template-columns: 1fr; } }

/* KPI tile */
.kpi { padding: 16px 18px; cursor: default; transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s; overflow: hidden; }
.kpi.click { cursor: pointer; }
.kpi:hover { transform: translateY(-2px); box-shadow: 0 14px 30px -16px rgb(20 40 30 / .35); border-color: var(--line-2); }
.kpi.active { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft), var(--shadow); }
.kpi__label { display: flex; align-items: center; gap: 12px; font-size: 15px; color: var(--ink-2); font-weight: 700; }
.kpi__label .ic { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-2); flex: none; }
.kpi__label .ic .i { width: 22px; height: 22px; }
.kpi__value { font-size: 30px; font-weight: 800; letter-spacing: -.02em; margin-top: 10px; font-variant-numeric: tabular-nums; }
.kpi__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; min-height: 26px; }
.kpi__spark { width: 84px; height: 26px; }
.kpi.tone-ok .ic { background: var(--primary-soft); color: var(--primary); }
.kpi.tone-warn .ic { background: var(--warn-soft); color: var(--warn); }
.kpi.tone-danger .ic { background: var(--danger-soft); color: var(--danger); }
.kpi.tone-info .ic { background: var(--info-soft); color: var(--info); }
.kpi.tone-ink .ic { background: var(--surface-3); color: var(--ink); }

.trend { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 999px; }
.trend.up { background: var(--primary-soft); color: var(--primary); }
.trend.down { background: var(--danger-soft); color: var(--danger); }
.trend.flat { background: var(--surface-3); color: var(--muted); }
.trend.good { background: var(--primary-soft); color: var(--primary); }
.trend.bad { background: var(--danger-soft); color: var(--danger); }

/* Greeting hero */
.hero { position: relative; overflow: hidden; padding: 22px 24px; min-height: 150px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px; background: linear-gradient(120deg, var(--surface) 0%, var(--surface) 55%, color-mix(in oklab, var(--primary-soft) 70%, var(--surface)) 100%); }
.hero__photo { position: absolute; inset: 0; background: var(--hero-img) right center/cover no-repeat; opacity: .22; mask-image: linear-gradient(90deg, transparent 20%, #000 70%); -webkit-mask-image: linear-gradient(90deg, transparent 20%, #000 70%); }
.hero__text { position: relative; }
.hero__text .eyebrow { color: var(--muted); font-size: 15px; }
.hero__text h1 { font-size: 36px; margin: 2px 0 6px; }
.hero__logo { position: relative; height: 70px; border-radius: 12px; opacity: .95; }
.hero__time { position: relative; font-variant-numeric: tabular-nums; text-align: right; }
.hero__time b { display: block; font-size: 30px; font-weight: 800; letter-spacing: -.02em; line-height: 1; }
.hero__time span { font-size: 12.5px; color: var(--muted); }

/* ---- Buttons ---------------------------------------------------------- */
.btn { position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px; border-radius: 999px; font-weight: 700; font-size: 14.5px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); transition: all .22s var(--ease); white-space: nowrap; }
.btn:hover { background: var(--surface-2); border-color: var(--line-2); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.98); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); box-shadow: 0 10px 20px -12px var(--primary); }
.btn.primary:hover { background: var(--primary-2); border-color: var(--primary-2); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn.soft { background: var(--primary-soft); border-color: transparent; color: var(--primary); }
.btn.danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.btn.danger.solid { background: var(--danger); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-3); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 12.5px; }
.btn.lg { height: 50px; padding: 0 22px; font-size: 15px; border-radius: 16px; }
.btn.block { width: 100%; }
.btn.icon { width: 40px; padding: 0; }
.btn.icon.sm { width: 32px; }
.ripple-layer { position: absolute; inset: 0; overflow: hidden; border-radius: inherit; pointer-events: none; z-index: 0; }
.ripple { position: absolute; border-radius: 50%; transform: scale(0); background: currentColor; opacity: .25; animation: ripple .55s var(--ease) forwards; pointer-events: none; }
@keyframes ripple { to { transform: scale(2.6); opacity: 0; } }
.btn.loading { color: transparent !important; pointer-events: none; }
.btn.loading::after { content: ''; position: absolute; width: 18px; height: 18px; border: 2px solid currentColor; border-color: var(--line-2) var(--line-2) var(--primary) var(--primary); border-radius: 50%; animation: spin .7s linear infinite; }
.btn.primary.loading::after { border-color: rgb(255 255 255 / .35) rgb(255 255 255 / .35) #fff #fff; }
@keyframes spin { to { transform: rotate(360deg); } }

.seg { display: inline-flex; gap: 2px; padding: 3px; max-width: 100%; overflow-x: auto; scrollbar-width: none; background: var(--surface-3); border-radius: 999px; position: relative; isolation: isolate; }
.seg button { position: relative; padding: 6px 14px; border-radius: 999px; font-size: 12.5px; font-weight: 600; color: var(--muted); transition: color .25s; z-index: 1; }
.seg button.active { color: var(--ink); }
.seg .seg__ind { position: absolute; top: 3px; left: 0; height: calc(100% - 6px); background: var(--surface); border-radius: 999px; box-shadow: var(--shadow); transition: transform .35s var(--ease), width .35s var(--ease); z-index: 0; }
.seg.sm button { padding: 5px 10px; font-size: 12px; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); transition: all .2s var(--ease); white-space: nowrap; }
.chip:hover { border-color: var(--line-2); background: var(--surface-3); }
.chip.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
:root[data-theme="dark"] .chip.active { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }

.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; font-size: 10.5px; font-weight: 700; background: var(--danger); color: #fff; line-height: 1; }
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; letter-spacing: .01em; white-space: nowrap; }
.tag::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag.ok, .tag.high, .tag.Present, .tag.Excused, .tag.Approved, .tag.cash, .tag.paid { background: var(--primary-soft); color: var(--primary); }
.tag.adequate, .tag.info, .tag.credit { background: var(--info-soft); color: var(--info); }
.tag.low, .tag.warn, .tag.pending, .tag.Pending\ Approval { background: var(--warn-soft); color: var(--warn); }
.tag.out, .tag.danger, .tag.Absent, .tag.Declined, .tag.voided { background: var(--danger-soft); color: var(--danger); }
.tag.neutral, .tag.Upcoming, .tag.Rest\ day, .tag.No\ record\ yet { background: var(--surface-3); color: var(--muted); }
.tag.plain::before { display: none; }

/* ---- Forms ------------------------------------------------------------ */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 12px; color: var(--muted); }
.input, .select, .textarea { width: 100%; height: 42px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface-2); outline: 0; transition: all .22s var(--ease); }
.textarea { height: auto; min-height: 90px; padding: 10px 14px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); background: var(--surface); box-shadow: 0 0 0 4px var(--primary-soft); }
.input.err { border-color: var(--danger); box-shadow: 0 0 0 4px var(--danger-soft); animation: shake .4s var(--ease); }
@keyframes shake { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }
.input[type=number]::-webkit-inner-spin-button { opacity: .4; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2365756d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
.input.big { height: 56px; font-size: 22px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.form { display: grid; gap: 14px; }
.form.two { grid-template-columns: 1fr 1fr; }
.form .span { grid-column: 1 / -1; }
.prefix { position: relative; }
.prefix > span { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 600; }
.prefix .input { padding-left: 30px; }
.toggle { position: relative; width: 44px; height: 26px; border-radius: 999px; background: var(--line-2); transition: background .25s; flex: none; }
.toggle::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .3s var(--ease-spring); box-shadow: 0 1px 3px rgb(0 0 0 / .3); }
.toggle.on { background: var(--primary); } .toggle.on::after { transform: translateX(18px); }
.formerr { color: var(--danger); font-size: 12.5px; font-weight: 600; display: flex; gap: 6px; align-items: center; animation: rise .3s var(--ease); }
.photo-pick { display: flex; align-items: center; gap: 14px; }
.photo-pick .preview { width: 76px; height: 76px; border-radius: 16px; background: var(--surface-3); display: grid; place-items: center; color: var(--muted); overflow: hidden; border: 1px dashed var(--line-2); }
.photo-pick .preview img { width: 100%; height: 100%; object-fit: cover; }

/* ---- Tables & lists --------------------------------------------------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
.t th { text-align: left; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); position: sticky; top: 0; }
.t td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t tbody tr { transition: background .15s; }
.t tbody tr:hover { background: var(--surface-2); }
.t tbody tr.click { cursor: pointer; }
.t tr.grouphead td { background: var(--surface-3); padding: 8px 12px; font-size: 13px; }
.t tr.grouphead:hover td { background: var(--surface-3); }
.t .num, .t .right { text-align: right; font-variant-numeric: tabular-nums; }
.t .thumb { width: 38px; height: 38px; border-radius: 10px; background: var(--surface-3); display: grid; place-items: center; color: var(--muted); overflow: hidden; flex: none; }
.t .thumb img { width: 100%; height: 100%; object-fit: cover; }
.list { display: flex; flex-direction: column; }
.list__item { display: flex; align-items: center; gap: 12px; padding: 11px 6px; border-bottom: 1px solid var(--line); transition: background .15s; border-radius: 10px; }
.list__item:last-child { border-bottom: 0; }
.list__item.click { cursor: pointer; } .list__item.click:hover { background: var(--surface-2); }
.list__item .ic { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; flex: none; background: var(--surface-3); color: var(--ink-2); }
.list__item .ic.ok { background: var(--primary-soft); color: var(--primary); } .list__item .ic.warn { background: var(--warn-soft); color: var(--warn); } .list__item .ic.danger { background: var(--danger-soft); color: var(--danger); } .list__item .ic.info { background: var(--info-soft); color: var(--info); }
.list__item .body { flex: 1; min-width: 0; }
.list__item .body b { display: block; font-size: 15px; }
.list__item .body span { display: block; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list__item.unread { background: color-mix(in oklab, var(--primary-soft) 40%, transparent); }
.empty { padding: 36px 20px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty--compact { padding: 12px 8px; gap: 6px; }
.empty--compact .i { width: 24px; height: 24px; }
.empty .i { width: 40px; height: 40px; opacity: .5; }
.bar { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 999px; background: var(--primary); width: 0; transition: width 1s var(--ease); }
.bar > i.warn { background: var(--warn); } .bar > i.danger { background: var(--danger); } .bar > i.info { background: var(--info); }

/* ---- Material / product cards ---------------------------------------- */
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(190px, 100%), 1fr)); gap: 12px; }
.product { padding: 12px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); cursor: pointer; transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .2s; position: relative; display: flex; flex-direction: column; gap: 8px; }
.product:hover { transform: translateY(-3px); box-shadow: 0 16px 32px -18px rgb(20 40 30 / .4); border-color: var(--line-2); }
.product:active { transform: scale(.98); }
.product.disabled { opacity: .55; }
.product__img { aspect-ratio: 4 / 3; border-radius: 12px; background: var(--surface-3); display: grid; place-items: center; color: var(--muted); overflow: hidden; }
.product__img img { width: 100%; height: 100%; object-fit: cover; }
.product__name { font-weight: 700; font-size: 13.5px; line-height: 1.25; }
.product__meta { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); }
.product__price { font-weight: 800; font-size: 15px; }
.product__price s { color: var(--muted); font-weight: 500; font-size: 11.5px; margin-right: 4px; }
.product .tag { position: absolute; top: 18px; left: 18px; }
.product__add { position: absolute; right: 14px; bottom: 54px; width: 34px; height: 34px; border-radius: 50%; background: var(--primary); color: var(--primary-ink); display: grid; place-items: center; transform: scale(0); transition: transform .3s var(--ease-spring); box-shadow: 0 8px 16px -8px var(--primary); }
.product:hover .product__add { transform: scale(1); }
.product.pop { animation: pop .4s var(--ease-spring); }
@keyframes pop { 50% { transform: scale(1.04); } }

/* ---- POS cart --------------------------------------------------------- */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 14px; align-items: start; }
@media (max-width: 1000px) { .pos { grid-template-columns: 1fr; } .cart { position: static !important; } }
.cart { position: sticky; top: calc(var(--nav-h) + 26px); display: flex; flex-direction: column; max-height: calc(100dvh - var(--nav-h) - 50px); }
.cart__items { flex: 1; overflow: auto; min-height: 120px; max-height: 42dvh; margin: 0 -6px; padding: 0 6px; }
.cart.in-sheet { position: static !important; max-height: none; border: 0; box-shadow: none; background: transparent; padding: 0; }
.cart.in-sheet .cart__submit { display: none; }
.cart-sheet { display: grid; gap: 14px; }
.cart-sheet__hero { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid color-mix(in oklab, var(--primary) 20%, var(--line)); border-radius: 18px; background: linear-gradient(120deg, var(--primary-soft), color-mix(in oklab, var(--surface) 72%, var(--primary-soft))); }
.cart-sheet__mark { width: 42px; height: 42px; flex: none; display: grid; place-items: center; border-radius: 14px; color: var(--primary); background: var(--surface); box-shadow: 0 6px 18px -12px var(--primary); }
.cart-sheet__hero > div { display: grid; gap: 3px; min-width: 0; }
.cart-sheet__hero > div b { font-size: 13.5px; }
.cart-sheet__hero > div span { color: var(--muted); font-size: 12px; line-height: 1.35; }
.cart-sheet__count { margin-left: auto; padding: 6px 9px; border-radius: 999px; background: var(--surface); color: var(--primary); font-size: 11px; font-weight: 800; white-space: nowrap; }
.cart-modal { display: flex; flex-direction: column; overflow: hidden; max-height: min(88dvh, 820px); }
.cart-modal .modal__head { flex: none; margin-bottom: 12px; }
.cart-modal .modal__body { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; margin: 0 -24px; padding: 0 24px 16px; }
.cart-modal .modal__foot { flex: none; margin: 0 -24px -24px; padding: 14px 24px 18px; border-top: 1px solid var(--line); background: color-mix(in oklab, var(--surface) 94%, transparent); }
.cart-sheet__action { width: 100%; min-height: 54px; border-radius: 17px; justify-content: center; gap: 10px; }
.cart-sheet__action b { margin-left: auto; font-size: 16px; font-variant-numeric: tabular-nums; }
.cart-sheet__action span { margin-right: auto; }
.cart__item { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 10px 4px; border-bottom: 1px solid var(--line); animation: rise .35s var(--ease); }
.cart__item.removing { animation: viewOut .2s var(--ease) forwards; }
.cart__item b { font-size: 13.5px; }
.cart__item .price { font-size: 12.5px; color: var(--muted); }
.cart__item .total { font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--surface-2); }
.qty button { width: 30px; height: 30px; display: grid; place-items: center; color: var(--ink-2); transition: background .15s; }
.qty button:hover { background: var(--surface-3); }
.qty input { width: 54px; height: 30px; text-align: center; border: 0; background: none; outline: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.cart__sum { display: grid; gap: 6px; padding-top: 12px; }
.cart__sum .line { display: flex; justify-content: space-between; font-size: 13.5px; color: var(--muted); }
.cart__sum .line.total { font-size: 20px; font-weight: 800; color: var(--ink); padding-top: 6px; border-top: 1px dashed var(--line-2); margin-top: 4px; }
.change { padding: 14px 16px; border-radius: 14px; background: var(--primary-soft); color: var(--primary); display: flex; justify-content: space-between; align-items: center; font-weight: 800; font-size: 18px; transition: all .3s var(--ease); }
.change.short { background: var(--danger-soft); color: var(--danger); }
.change small { font-size: 12px; font-weight: 600; opacity: .8; }
.denoms { display: flex; gap: 6px; flex-wrap: wrap; }
.denoms button { padding: 6px 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); font-weight: 700; font-size: 12.5px; transition: all .18s var(--ease); }
.denoms button:hover { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }

/* Receipt */
.receipt { font-family: var(--mono); font-size: 12.5px; background: var(--surface-2); border-radius: 14px; padding: 16px; border: 1px dashed var(--line-2); }
.receipt .r { display: flex; justify-content: space-between; gap: 10px; padding: 2px 0; }
.receipt hr { border: 0; border-top: 1px dashed var(--line-2); margin: 8px 0; }
.success-check { width: 72px; height: 72px; margin: 0 auto 12px; border-radius: 50%; background: var(--primary-soft); display: grid; place-items: center; color: var(--primary); animation: pop .5s var(--ease-spring); }
.success-check svg { width: 36px; height: 36px; stroke: currentColor; fill: none; stroke-width: 3; stroke-dashoffset: 40; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw .5s .15s var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* ---- Charts ----------------------------------------------------------- */
.chart { width: 100%; height: 240px; display: block; overflow: visible; }
.chart text { font-family: var(--font); font-size: 11px; fill: var(--muted); }
.chart .grid line { stroke: var(--line); stroke-dasharray: 3 4; }
.chart .line { fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.chart .line.draw { stroke-dasharray: var(--len); stroke-dashoffset: var(--len); animation: drawLine 1.2s var(--ease) forwards; }
@keyframes drawLine { to { stroke-dashoffset: 0; } }
.chart .area { opacity: 0; animation: fade .8s .5s forwards; }
@keyframes fade { to { opacity: 1; } }
.chart .dot { fill: var(--surface); stroke-width: 2; opacity: 0; transition: opacity .2s; }
.chart .hit:hover ~ .dot, .chart g:hover .dot { opacity: 1; }
.chart .cbar { transform-box: fill-box; transform-origin: bottom; transform: scaleY(0); animation: growBar .7s var(--ease) forwards; animation-delay: calc(min(var(--i), 40) * 25ms); }
.chart .cbar:hover { filter: brightness(1.12); }
.chart .cval { font-size: 11px; font-weight: 700; fill: var(--ink-2); opacity: 0; animation: fadeIn .4s ease forwards; animation-delay: calc(min(var(--i), 40) * 25ms + .55s); }
@keyframes fadeIn { to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .chart .cbar { animation: none; transform: none; } .chart .cval { animation: none; opacity: 1; } }
@keyframes growBar { to { transform: scaleY(1); } }
.chart .bar:hover { filter: brightness(1.1); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.tooltip { position: fixed; z-index: 100; pointer-events: none; background: var(--ink); color: var(--bg); padding: 8px 10px; border-radius: 10px; font-size: 12px; box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(4px); transition: opacity .15s, transform .15s; white-space: nowrap; }
.tooltip.on { opacity: 1; transform: translateY(0); }
.tooltip b { display: block; font-size: 12.5px; }
.donut { width: 130px; height: 130px; }
.donut circle { fill: none; stroke-width: 12; stroke-linecap: round; transform: rotate(-90deg); transform-origin: center; transition: stroke-dashoffset 1.2s var(--ease); }
.spark { width: 100%; height: 100%; overflow: visible; }
.spark path { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---- Modal / sheet ---------------------------------------------------- */
.overlay { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 16px; background: rgb(6 20 14 / .45); backdrop-filter: blur(6px); animation: fade .22s forwards; opacity: 0; }
.overlay.closing { animation: fadeOut .18s forwards; }
@keyframes fadeOut { to { opacity: 0; } }
.modal { width: min(560px, 100%); max-height: calc(100dvh - 32px); overflow: auto; background: var(--surface); border-radius: 24px; border: 1px solid var(--line); box-shadow: var(--shadow-lg); padding: 24px; animation: modalIn .34s var(--ease-spring) both; }
.modal.wide { width: min(860px, 100%); }
.modal.narrow { width: min(420px, 100%); }
.overlay.closing .modal { animation: modalOut .18s var(--ease) forwards; }
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(.97); } }
@keyframes modalOut { to { opacity: 0; transform: translateY(8px) scale(.98); } }
.modal__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.modal__head p { color: var(--muted); font-size: 13px; margin-top: 2px; }
.modal__foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; flex-wrap: wrap; }
@media (max-width: 640px) {
  .overlay { align-items: end; padding: 0; }
  .modal { width: 100%; max-height: 92dvh; border-radius: 24px 24px 0 0; animation: sheetIn .4s var(--ease) both; padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
  .overlay.closing .modal { animation: sheetOut .2s var(--ease) forwards; }
  @keyframes sheetIn { from { transform: translateY(100%); } }
  @keyframes sheetOut { to { transform: translateY(100%); } }
  .modal::before { content: ''; display: block; width: 40px; height: 4px; border-radius: 2px; background: var(--line-2); margin: -8px auto 14px; }
}

/* Drawer (notifications) */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(400px, 100%); z-index: 95; background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: drawerIn .36s var(--ease) both; }
.drawer.closing { animation: drawerOut .2s var(--ease) forwards; }
@keyframes drawerIn { from { transform: translateX(40px); opacity: 0; } }
@keyframes drawerOut { to { transform: translateX(40px); opacity: 0; } }
.drawer__head { padding: 20px 20px 12px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.drawer__body { flex: 1; overflow: auto; padding: 8px 12px 20px; }

/* ---- Toasts ----------------------------------------------------------- */
.toasts { position: fixed; z-index: 120; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; min-width: 260px; max-width: 380px; padding: 12px 14px; border-radius: 14px; background: var(--ink); color: var(--bg); box-shadow: var(--shadow-lg); animation: toastIn .4s var(--ease-spring) both; font-size: 13.5px; }
.toast.out { animation: toastOut .25s var(--ease) forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px) scale(.96); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(20px); } }
.toast .i { flex: none; } .toast.ok .i { color: #6ee7b7; } .toast.err .i { color: #fca5a5; } .toast.warn .i { color: #fcd34d; }
@media (max-width: 640px) { .toasts { left: 12px; right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); } .toast { max-width: none; } }

/* ---- Skeleton --------------------------------------------------------- */
.sk { background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 50%, var(--surface-3) 75%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; border-radius: 10px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.sk.text { height: 14px; width: 60%; } .sk.title { height: 22px; width: 40%; } .sk.block { height: 120px; width: 100%; }

/* ---- Offline / sync bar ----------------------------------------------- */
.syncbar { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 80; display: flex; align-items: center; gap: 10px; padding: 10px 14px 10px 16px; border-radius: 999px; background: var(--ink); color: var(--bg); box-shadow: var(--shadow-lg); font-size: 13px; font-weight: 600; animation: toastIn .4s var(--ease-spring); }
.syncbar .pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 0 0 var(--warn); animation: pulse 1.6s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@media (max-width: 760px) { .syncbar { bottom: calc(76px + env(safe-area-inset-bottom)); } }

/* ---- Calendar --------------------------------------------------------- */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; max-width: 560px; }
.cal .dow { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); text-align: center; font-weight: 700; padding-bottom: 4px; }
.cal .day { height: 54px; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-weight: 700; font-size: 13px; background: var(--surface-2); border: 1px solid transparent; cursor: pointer; transition: all .2s var(--ease); }
.cal .day:hover { border-color: var(--line-2); transform: translateY(-1px); }
.cal .day.today { border-color: var(--primary); }
.cal .day.sel { background: var(--ink); color: var(--bg); }
.cal .day i { width: 6px; height: 6px; border-radius: 50%; display: block; }
.cal .day.Present i { background: var(--primary); } .cal .day.Absent i { background: var(--danger); } .cal .day.Excused i { background: var(--info); } .cal .day.Pending.Approval i { background: var(--warn); } .cal .day.empty { visibility: hidden; }
.cal .day.missing { box-shadow: inset 0 0 0 2px var(--warn-soft); }

/* Big clock button */
.clockbtn { width: 100%; padding: 22px; border-radius: 22px; display: flex; align-items: center; gap: 16px; background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; box-shadow: 0 18px 36px -18px var(--primary); transition: transform .25s var(--ease), box-shadow .25s; text-align: left; }
.clockbtn:hover { transform: translateY(-2px); } .clockbtn:active { transform: scale(.98); }
.clockbtn.out { background: linear-gradient(135deg, #1f2a26, #3a4a42); box-shadow: 0 18px 36px -18px #1f2a26; }
.clockbtn.done { background: var(--surface-3); color: var(--muted); box-shadow: none; cursor: default; }
.clockbtn .ic { width: 52px; height: 52px; border-radius: 16px; background: rgb(255 255 255 / .18); display: grid; place-items: center; flex: none; }
.clockbtn b { display: block; font-size: 17px; } .clockbtn span { font-size: 12.5px; opacity: .85; }

/* ---- Timeline --------------------------------------------------------- */
.timeline { display: flex; flex-direction: column; }
.timeline__item { display: grid; grid-template-columns: 18px 1fr; gap: 12px; padding: 0 0 16px; position: relative; }
.timeline__item::before { content: ''; position: absolute; left: 8px; top: 20px; bottom: 0; width: 2px; background: var(--line); }
.timeline__item:last-child::before { display: none; }
.timeline__item .pt { width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--surface); background: var(--primary); box-shadow: 0 0 0 1px var(--line); margin-top: 2px; }
.timeline__item .pt.warn { background: var(--warn); } .timeline__item .pt.danger { background: var(--danger); } .timeline__item .pt.info { background: var(--info); } .timeline__item .pt.muted { background: var(--line-2); }

/* ---- Bottom nav (phones) --------------------------------------------- */
.bottomnav { display: none; }
@media (max-width: 760px) {
  :root { --nav-h: 56px; }
  .topbar { padding: 10px 10px 0; }
  .topbar__inner { padding: 6px 8px 6px 8px; gap: 8px; }
  .topbar .pills, .topbar .search, .topbar .userchip__text { display: none; }
  .brand__text span { display: none; }
  .layout { grid-template-columns: 1fr; padding: 10px 10px calc(84px + env(safe-area-inset-bottom)); }
  .rail { display: none; }
  .page__head { margin: 4px 2px 12px; } h1 { font-size: 22px; }
  .card { padding: 14px; border-radius: 16px; }
  .hero { padding: 18px; min-height: 120px; gap: 10px; } .hero__text h1 { font-size: 22px; } .hero__logo { display: none; } .hero__time { text-align: left; } .hero__time b { font-size: 20px; }
  .topbar .userchip { padding: 2px; border: 0; background: none; }
  @media (max-width: 380px) { .brand__text { display: none; } }
  .grid.kpi { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kpi__value { font-size: 24px; } .kpi__label { font-size: 13.5px; } .kpi__label .ic { width: 34px; height: 34px; }
  .form.two { grid-template-columns: 1fr; }
  .products { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .product__add { transform: scale(1); }
  .bottomnav { position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 60; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 6px; background: color-mix(in oklab, var(--surface) 90%, transparent); backdrop-filter: blur(16px); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow-lg); }
  .bottomnav a .i { width: 24px; height: 24px; }
  .bottomnav a { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 4px 6px; border-radius: 16px; font-size: 11px; font-weight: 700; color: var(--muted); transition: all .22s var(--ease); }
  .bottomnav a.active { color: var(--primary); background: var(--primary-soft); }
  .bottomnav a.active .i { transform: translateY(-1px) scale(1.08); }
  .bottomnav a .i { transition: transform .3s var(--ease-spring); }
  .bottomnav a .badge { position: absolute; top: 4px; right: calc(50% - 18px); }
  .bottomnav a .tip { display: none; }
  .product__add { right: 10px; bottom: 60px; width: 32px; height: 32px; }
  .cart__items { max-height: none; }
  .table-wrap { margin: 0 -14px; padding: 0 14px; }
  .t th, .t td { padding: 9px 8px; }
}
@media (min-width: 761px) and (max-width: 1100px) {
  .topbar .search { min-width: 150px; }
  .pills button { padding: 8px 12px; font-size: 13px; }
  .pills button span.txt { display: none; }
}

/* ---- Dark-mode circular wipe (View Transitions) ---------------------- */

/* ---- Print receipt ---------------------------------------------------- */
@media print { body { background: #fff; } .topbar, .rail, .bottomnav, .toasts, .page__actions, .syncbar { display: none !important; } .card { box-shadow: none; } }

/* ---- Reduced motion --------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .login__bg { animation: none; }
}

/* ==========================================================================
   Motion layer — micro-interactions everywhere
   ========================================================================== */
/* Staggered page sections */
.view > * { animation: rise .5s var(--ease) both; }
.view > :nth-child(1) { animation-delay: 0ms; } .view > :nth-child(2) { animation-delay: 60ms; } .view > :nth-child(3) { animation-delay: 120ms; }
.view > :nth-child(4) { animation-delay: 180ms; } .view > :nth-child(5) { animation-delay: 240ms; } .view > :nth-child(n+6) { animation-delay: 300ms; }

/* Pop-in for tags, badges, chips */
.tag, .badge, .trend { animation: popIn .35s var(--ease-spring) both; }
@keyframes popIn { from { opacity: 0; transform: scale(.7); } }

/* Lists: hover slide + chevron nudge */
.list__item.click:hover { transform: translateX(3px); }
.list__item { transition: background .15s, transform .25s var(--ease); }
.list__item.click:hover > .i:last-child, .kpi.click:hover .kpi__foot .i { transform: translateX(3px); }
.list__item > .i, .kpi__foot .i { transition: transform .25s var(--ease); }

/* Nav: active icon bounce, rail hover scale */
.rail a .i, .bottomnav a .i, .pills button .i { transition: transform .3s var(--ease-spring); }
.rail a:hover .i { transform: scale(1.12); }
.rail a.active .i, .bottomnav a.active .i { animation: none; }
@keyframes iconBounce { 0% { transform: scale(.7); } 60% { transform: scale(1.18); } 100% { transform: scale(1); } }
.rail a.active { animation: none; }

/* Login: staggered fields and shimmer on the button */
.login__brand { animation: rise .6s var(--ease) .1s both; }
.login form > :nth-child(1) { animation: rise .5s var(--ease) .25s both; }
.login form > :nth-child(2) { animation: rise .5s var(--ease) .33s both; }
.login form > :nth-child(3) { animation: rise .5s var(--ease) .41s both; }
.login__demo { animation: rise .5s var(--ease) .5s both; }
.login__brand .logo { animation: logoIn .7s var(--ease-spring) both; }
@keyframes logoIn { from { transform: scale(.4) rotate(-20deg); opacity: 0; } }
.btn.primary::before { content: ''; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgb(255 255 255 / .22) 50%, transparent 70%); transform: translateX(-120%); transition: transform .7s var(--ease); pointer-events: none; }
.btn.primary:hover::before { transform: translateX(120%); }

/* Hero: slow living gradient */
.hero::after { content: ''; position: absolute; inset: -40%; background: radial-gradient(closest-side, color-mix(in oklab, var(--mint) 70%, transparent), transparent); opacity: .5; animation: drift 12s ease-in-out infinite alternate; pointer-events: none; }
@keyframes drift { from { transform: translate(-10%, -10%) scale(1); } to { transform: translate(15%, 10%) scale(1.15); } }
.hero > * { position: relative; z-index: 1; }

/* Inputs: lift on focus */
.input:focus, .select:focus, .textarea:focus { transform: translateY(-1px); }
.input.big:focus { transform: scale(1.015); }

/* Toggle / segmented press */
.seg button:active, .pills button:active, .chip:active { transform: scale(.94); }
.seg button, .chip { transition: color .25s, transform .15s var(--ease), background .2s, border-color .2s; }

/* Value bumps (totals, change, badges) */
.bump { animation: bump .4s var(--ease-spring); }
@keyframes bump { 30% { transform: scale(1.12); } }
.flash { animation: flash .7s var(--ease); }
@keyframes flash { 0% { background: var(--primary-soft); } 100% { background: transparent; } }

/* POS specifics */
.product { transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .2s; }
.product:active { transform: scale(.95); }
.product__img { transition: transform .4s var(--ease); overflow: hidden; }
.product:hover .product__img { transform: scale(1.03); }
.product__add:active { transform: scale(.85) !important; }
.cart__item { transition: background .3s; border-radius: 10px; }
.cart__item.flash { background: var(--primary-soft); }
.qty button:active { transform: scale(.8); }
.qty button { transition: background .15s, transform .15s var(--ease-spring); }
.cart .btn.primary:not(:disabled) { animation: glow 2.2s ease-in-out infinite; }
@keyframes glow { 0%, 100% { box-shadow: 0 10px 20px -12px var(--primary); } 50% { box-shadow: 0 14px 30px -10px var(--primary), 0 0 0 6px color-mix(in oklab, var(--primary) 18%, transparent); } }
.change { transition: all .3s var(--ease); }
.change.bump b { display: inline-block; animation: bump .4s var(--ease-spring); }
.denoms button:active { transform: scale(.9); }
.denoms button { transition: all .18s var(--ease), transform .12s; }

/* Fly-to-cart ghost */
.fly { position: fixed; z-index: 200; width: 56px; height: 56px; border-radius: 14px; background: var(--primary); display: grid; place-items: center; color: #fff; pointer-events: none; box-shadow: var(--shadow-lg); overflow: hidden; }
.fly img { width: 100%; height: 100%; object-fit: cover; }

/* Confetti */
.confetti { position: fixed; z-index: 300; width: 10px; height: 14px; border-radius: 2px; pointer-events: none; animation: confetti 1.1s var(--ease) forwards; }
@keyframes confetti { 0% { transform: translate(0, 0) rotate(0); opacity: 1; } 100% { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); opacity: 0; } }

/* Attendance: breathing clock button, calendar pop */
.clockbtn:not(.done) { animation: breathe 2.6s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { box-shadow: 0 18px 36px -18px var(--primary); } 50% { box-shadow: 0 18px 36px -14px var(--primary), 0 0 0 8px color-mix(in oklab, var(--primary) 14%, transparent); } }
.clockbtn.out:not(.done) { animation: none; }
.cal .day { animation: popIn .35s var(--ease-spring) both; animation-delay: calc(var(--i, 0) * 14ms); }
.cal .day:active { transform: scale(.92); }
.timeline__item { animation: rise .45s var(--ease) both; animation-delay: calc(var(--i, 0) * 50ms); }
.timeline__item .pt { animation: popIn .4s var(--ease-spring) both; animation-delay: calc(var(--i, 0) * 50ms + 120ms); }

/* Tables: rows slide in */
.t tbody.stagger tr { animation: rowIn .4s var(--ease) both; animation-delay: calc(var(--i, 0) * 30ms); }
@keyframes rowIn { from { opacity: 0; transform: translateX(-6px); } }

/* Toast progress line */
.toast { position: relative; overflow: hidden; }
.toast::after { content: ''; position: absolute; left: 0; bottom: 0; height: 2px; width: 100%; background: currentColor; opacity: .35; transform-origin: left; animation: toastbar var(--toast-ms, 3200ms) linear forwards; }
@keyframes toastbar { to { transform: scaleX(0); } }

/* Drawer / modal content stagger */
.modal__body > .form > *, .drawer__body .list__item { animation: rise .4s var(--ease) both; }
.modal__body > .form > :nth-child(2) { animation-delay: 40ms; } .modal__body > .form > :nth-child(3) { animation-delay: 80ms; } .modal__body > .form > :nth-child(4) { animation-delay: 120ms; } .modal__body > .form > :nth-child(n+5) { animation-delay: 160ms; }

/* Avatar / userchip */
.userchip:active { transform: scale(.96); }
.avatar { transition: transform .3s var(--ease-spring); }
.userchip:hover .avatar { transform: scale(1.08) rotate(-4deg); }

/* Phone: touch feedback on everything tappable */
@media (hover: none) {
  .card.kpi.click:active, .list__item.click:active, .t tbody tr.click:active { transform: scale(.985); background: var(--surface-2); }
  .btn:active { transform: scale(.95); }
}

/* ==========================================================================
   Visual refresh v3 — matches the reference: flat light-mint canvas, borderless
   white cards with soft shadows, rounded top bar, green active rail icon.
   ========================================================================== */
:root {
  --bg: #eef2ee; --bg-2: #e6ece7; --surface: #ffffff; --surface-2: #f5f7f5; --surface-3: #eaf0eb;
  --line: #e6ece7; --line-2: #d7e0d9; --radius: 22px; --radius-sm: 14px;
  --shadow: 0 1px 2px rgb(20 40 30 / .03), 0 12px 32px -20px rgb(20 40 30 / .22);
  --shadow-lg: 0 24px 60px -24px rgb(20 40 30 / .3);
  --lavender: #e9e4fb; --peach: #fde8dc; --sky: #dfeefb; --butter: #fbf1cf;
}
:root[data-theme="dark"] {
  --bg: #0e1411; --bg-2: #121a16; --surface: #161e1a; --surface-2: #1b2520; --surface-3: #212d27; --line: #1f2a24; --line-2: #2b3a32;
  --lavender: #2a2544; --peach: #3a2a22; --sky: #1c2a3a; --butter: #3a331c;
}
body { background: var(--bg); background-image: none; }
.card { border: 0; box-shadow: var(--shadow); border-radius: var(--radius); }
.card.flat { box-shadow: none; }

/* Top bar: rounded rectangle, round logo */
.topbar { padding: 14px 18px 0; }
.topbar__inner { border-radius: 22px; border: 0; box-shadow: var(--shadow); padding: 10px 12px 10px 12px; min-height: 72px; background: color-mix(in oklab, var(--surface) 94%, transparent); gap: 14px; }
.brand__mark { width: 46px; height: 46px; border-radius: 50%; overflow: hidden; background: var(--primary); box-shadow: none; }
.brand__mark { background: #fff; box-shadow: inset 0 0 0 1px var(--line); }
.brand__mark img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.brand__text b { font-size: 16px; letter-spacing: 0; }
.brand__text span { font-size: 12px; }
.pills { background: var(--surface-3); padding: 5px; }
.pills button { padding: 10px 18px; }
.topbar .iconbtn { border: 0; background: var(--surface-2); }
.topbar .theme { display: none; }
@media (max-width: 760px) { .topbar .theme-mobile { display: grid; width: 40px; height: 40px; } }
.btn.new { background: var(--primary); color: var(--primary-ink); border: 0; height: 44px; padding: 0 18px 0 14px; box-shadow: 0 10px 24px -12px var(--primary); }
.userchip { border: 0; background: var(--surface-2); padding: 4px 10px 4px 4px; }
.userchip__text small { font-size: 11.5px; }
.userchip .chev { color: var(--muted); }

/* Rail: separate small groups; active = green circle */
.layout { gap: 14px; padding: 16px 18px 90px; }
.rail { gap: 10px; top: calc(var(--nav-h) + 34px); }
.rail__group { border: 0; border-radius: 26px; padding: 8px; gap: 6px; box-shadow: var(--shadow); background: var(--surface); }
.rail a { width: 48px; height: 48px; border-radius: 50%; }
.rail a.active { background: var(--primary); color: var(--primary-ink); box-shadow: 0 8px 18px -10px var(--primary); }
.rail .theme { display: grid; width: 48px; height: 48px; margin: 0; }
.rail .theme-moon { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); }

/* Page head: eyebrow sentence + lighter big title */
.page__head { margin: 10px 6px 20px; align-items: flex-end; }
.page__head .eyebrow { font-size: 13.5px; }
h1 { font-weight: 600; font-size: 34px; letter-spacing: -.02em; }
.page__actions .btn { border: 0; box-shadow: var(--shadow); background: var(--surface); }
.page__actions .btn.primary { background: var(--primary); }

/* Buttons: borderless pills */
.btn { border: 0; background: var(--surface); box-shadow: var(--shadow); }
.btn:hover { background: var(--surface-2); }
.btn.ghost { box-shadow: none; background: transparent; }
.btn.ghost:hover { background: var(--surface-3); }
.btn.soft, .btn.danger { box-shadow: none; }
.btn.sm { height: 34px; }
.iconbtn { border: 0; }

/* KPI tiles: compact reference layout */
.kpi { padding: 16px 18px 14px; }
.kpi__label { font-size: 13.5px; color: var(--muted); font-weight: 600; gap: 10px; }
.kpi__label .ic { width: 30px; height: 30px; border-radius: 50%; }
.kpi__label .ic .i { width: 16px; height: 16px; }
.kpi__value { font-size: 28px; margin-top: 12px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.kpi__value .chip-note { font-size: 12px; font-weight: 600; color: var(--muted); background: var(--surface-3); padding: 3px 9px; border-radius: 999px; }
.kpi__foot { margin-top: 8px; }
.kpi.tone-ink .ic { background: var(--surface-3); color: var(--ink); }
.kpi.tone-ok .ic { background: var(--primary-soft); color: var(--primary); }
.kpi.tone-info .ic { background: var(--sky); color: var(--info); }
.kpi.tone-warn .ic { background: var(--butter); color: var(--warn); }
.kpi.tone-danger .ic { background: var(--peach); color: var(--danger); }
.kpi.tone-lavender .ic { background: var(--lavender); color: #6d4fd6; }

/* Hero */
.hero { background: var(--surface); }
.hero::after { opacity: .35; }
.hero__logo { height: 72px; width: auto; max-width: 220px; border-radius: 14px; object-fit: contain; background: #fff; padding: 6px; box-shadow: var(--shadow); }

/* Chips row like the reference: dark "All", white chips with colored dot + count */
.chip { border: 0; background: var(--surface); box-shadow: var(--shadow); padding: 8px 14px; font-size: 13px; }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--primary); display: inline-block; }
.chip .n { color: var(--muted); font-weight: 600; margin-left: 2px; }
.chip.active { background: var(--ink); color: var(--bg); }
.chip.active .n { color: inherit; opacity: .7; }
:root[data-theme="dark"] .chip.active { background: var(--primary); color: var(--primary-ink); }

/* Filter bar */
.filterbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 0 0 14px; }
.filterbar .search { border: 0; background: var(--surface); box-shadow: var(--shadow); height: 42px; }
.filterbar .seg { background: var(--surface); box-shadow: var(--shadow); }
.filterbar .seg .seg__ind { background: var(--surface-3); box-shadow: none; }
.filterbar .select { border: 0; background: var(--surface); box-shadow: var(--shadow); height: 42px; }

/* Product cards: square photo, status chip overlay */
.products { gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(210px, 100%), 1fr)); }
.product { border: 0; box-shadow: var(--shadow); border-radius: 22px; padding: 10px 12px 14px; gap: 10px; }
.product__img { aspect-ratio: 1; border-radius: 16px; }
.product__img.ph { background: var(--ph-bg, var(--surface-3)); color: var(--ph-ink, var(--muted)); }
.product__img.ph .i { width: 44px; height: 44px; opacity: .55; }
.product .tag { top: 18px; left: 20px; background: color-mix(in oklab, var(--surface) 92%, transparent); backdrop-filter: blur(6px); box-shadow: var(--shadow); }
.product .tag.out { color: var(--danger); } .product .tag.low { color: var(--warn); } .product .tag.ok { color: var(--primary); }
.product__name { font-size: 14.5px; }
.product__meta { font-size: 12.5px; }
.product__price { font-size: 16px; }
.product__add { bottom: 62px; right: 18px; width: 36px; height: 36px; }

/* Tables inside cards */
.t th { background: transparent; font-size: 11.5px; }
.t td { border-color: var(--line); }
.table-wrap { border-radius: 0; }

/* Inputs */
.input, .select, .textarea { border: 0; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.input:focus, .select:focus, .textarea:focus { box-shadow: inset 0 0 0 1.5px var(--primary), 0 0 0 4px var(--primary-soft); background: var(--surface); }

/* Login: round logo */
.login__brand .logo { width: 84px; height: 84px; border-radius: 50%; overflow: hidden; background: var(--surface-3); box-shadow: var(--shadow-lg); }
.login__brand .logo { background: #fff; }
.login__brand .logo img { width: 100%; height: 100%; object-fit: contain; padding: 8px; }
.login__card { border: 0; }
.login__card::before { display: none; }

/* Modal, drawer */
.modal { border: 0; border-radius: 26px; }
.drawer { border: 0; }
.list__item .ic { border-radius: 50%; }

/* Bottom nav */
@media (max-width: 760px) {
  .topbar { padding: 10px 10px 0; } .topbar__inner { min-height: 60px; border-radius: 20px; padding: 7px 8px; }
  .brand__mark { width: 40px; height: 40px; }
  .btn.new { display: none; } .brand__text { display: none; } .topbar__inner { gap: 6px; } .brand { padding-right: 0; }
  .bottomnav { border: 0; }
  .bottomnav a.active { background: var(--primary); color: var(--primary-ink); }
  .layout { padding: 12px 12px calc(84px + env(safe-area-inset-bottom)); }
  h1 { font-size: 26px; }
  .products { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .filterbar .chips { order: 10; width: 100%; }
}

.only-phone { display: none !important; }
@media (max-width: 760px) { .only-phone { display: block !important; } .only-desktop { display: none !important; } }
:root[data-theme="dark"] .product__img.ph { filter: saturate(.7) brightness(.55); }

/* ---- Loading: top bar, splash, busy cursor ---------------------------- */
.loadbar { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 500; pointer-events: none; opacity: 0; transition: opacity .2s; }
.loadbar i { display: block; height: 100%; width: 30%; background: linear-gradient(90deg, var(--primary), var(--primary-2)); border-radius: 0 3px 3px 0; transform: translateX(-100%); box-shadow: 0 0 12px var(--primary); }
.loadbar.on { opacity: 1; } .loadbar.on i { animation: loadbar 1.1s var(--ease) infinite; }
.loadbar.done i { animation: none; width: 100%; transform: translateX(0); transition: width .25s var(--ease), transform .25s var(--ease); }
@keyframes loadbar { 0% { transform: translateX(-100%); width: 25%; } 60% { width: 45%; } 100% { transform: translateX(400%); width: 25%; } }
html.busy .btn.primary:not(.loading) { cursor: progress; }
.splash { min-height: 100dvh; display: grid; place-content: center; gap: 18px; justify-items: center; background: var(--bg); }
.splash__logo { width: 96px; height: 96px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-lg); display: grid; place-items: center; overflow: hidden; animation: popIn .6s var(--ease-spring) both; }
.splash__logo img { width: 100%; height: 100%; object-fit: contain; padding: 10px; }
.splash__dots { display: flex; gap: 8px; } .splash__dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--primary); animation: dots 1s ease-in-out infinite; }
.splash__dots i:nth-child(2) { animation-delay: .15s; } .splash__dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dots { 0%, 100% { opacity: .3; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-5px); } }
.sk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(210px, 100%), 1fr)); gap: 14px; }
.sk-grid .sk { aspect-ratio: .85; border-radius: 22px; }
.spinner { width: 22px; height: 22px; border: 2.5px solid var(--line-2); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; }

/* ---- Scroll reveal ------------------------------------------------------ */
.reveal { opacity: 0; transform: translateY(18px) scale(.985); animation: none !important; }
.reveal.in { opacity: 1; transform: none; transition: opacity .55s var(--ease), transform .6s var(--ease-spring); }
.reveal.in .kpi__value, .reveal.in .bar > i { animation: none; }

/* ---- User chip with blurred photo behind the name --------------------- */
.userchip { position: relative; overflow: hidden; }
.userchip.has-photo { padding: 6px 12px 6px 14px; min-width: 150px; }
.userchip__bg { position: absolute; inset: -10px; background: var(--chip-img) center/cover; filter: blur(7px) saturate(1.1); opacity: .55; z-index: 0; }
.userchip.has-photo::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, color-mix(in oklab, var(--surface) 55%, transparent), color-mix(in oklab, var(--surface) 85%, transparent)); z-index: 0; }
.userchip__text, .userchip .chev { position: relative; z-index: 1; }
.userchip.has-photo .userchip__text b { font-size: 13.5px; text-shadow: 0 1px 6px var(--surface); }
.userchip.has-photo .userchip__text small { color: var(--ink-2); }
.list__item .ic.photo { overflow: hidden; background: var(--surface-3); border-radius: 12px; }
.list__item .ic.photo img { width: 100%; height: 100%; object-fit: cover; }
.promo-badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 800; background: var(--lime); color: #3f6212; margin-left: 6px; letter-spacing: .01em; animation: popIn .35s var(--ease-spring) both; }
:root[data-theme="dark"] .promo-badge { background: #3f6212; color: #d9f99d; }
.taps { display: grid; gap: 10px; }
.tap { text-align: left; width: 100%; border: 0; font: inherit; display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 18px; background: var(--surface-2); color: var(--muted); }
.tap .n { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--surface-3); flex: none; }
.tap b { display: block; color: var(--ink); } .tap span { font-size: 12.5px; }
.tap.done { color: var(--ink-2); } .tap.done .n { background: var(--primary-soft); color: var(--primary); }
.tap.next { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; cursor: pointer; box-shadow: 0 18px 36px -18px var(--primary); animation: breathe 2.6s ease-in-out infinite; }
.tap.next b, .tap.next span { color: #fff; } .tap.next .n { background: rgb(255 255 255 / .2); color: #fff; }
.tap.next:active { transform: scale(.98); }
.tap.final.next { background: linear-gradient(135deg, #1f2a26, #3a4a42); box-shadow: 0 18px 36px -18px #1f2a26; animation: none; }
.tawad-box { margin-top: 12px; padding: 12px 14px; border-radius: 18px; background: var(--surface-2); transition: background .25s, box-shadow .25s; }
.tawad-box.active { background: var(--warn-soft); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--warn) 45%, transparent); }
.tawad { margin-top: 10px; animation: popIn .3s var(--ease-spring) both; }
.tawad .form.two { gap: 10px; }
.tawad__msg { margin-top: 6px; font-weight: 600; color: var(--ink-2); } .tawad__msg.err { color: var(--danger); }
.tap.alt { background: var(--surface); color: var(--ink-2); cursor: pointer; box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--primary) 55%, transparent); }
.tap.alt b { color: var(--primary); } .tap.alt .n { background: var(--primary-soft); color: var(--primary); }
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-left: 6px; vertical-align: middle; box-shadow: 0 0 0 0 color-mix(in srgb, var(--primary) 60%, transparent); animation: livePulse 1.6s ease-out infinite; }
@keyframes livePulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--primary) 55%, transparent); } 100% { box-shadow: 0 0 0 9px transparent; } }
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }

/* ---- v2.5 navigation fixes ---- */
.rail { z-index: 30; }
.rail .tip, .rail .theme-moon { display: none !important; }
.navtip { position: fixed; z-index: 1000; transform: translate(-6px, -50%); background: var(--ink); color: var(--bg); font-size: 12.5px; font-weight: 700; padding: 7px 11px; border-radius: 9px; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .15s, transform .18s var(--ease); box-shadow: 0 10px 24px -10px rgb(0 0 0 / .45); }
.navtip.on { opacity: 1; transform: translate(0, -50%); }
.rail a:hover:not(.active), .rail .theme:hover { background: var(--surface-3); color: var(--ink); }
.rail a.active:hover { background: var(--primary); color: var(--primary-ink); }
.rail a:focus, .bottomnav a:focus, .pills button:focus, .theme:focus { outline: none; }
.rail a:focus-visible, .bottomnav a:focus-visible, .pills button:focus-visible, .theme:focus-visible, .btn:focus-visible, .btn.new:focus-visible { outline: 3px solid var(--focus, #2563eb); outline-offset: 3px; }
.rail a.active { animation: none; }
/* New sale: fixed high-contrast pair in both themes (≥ 4.5:1) */
.btn.new { background: var(--primary); color: var(--primary-ink); }
.btn.new:hover { background: var(--primary-2); color: var(--primary-ink); }
:root[data-theme="dark"] .btn.new { background: var(--primary); color: var(--primary-ink); }
:root[data-theme="dark"] .btn.new:hover { background: var(--primary-2); color: var(--primary-ink); }
.btn.new::before { display: none; }
.tawad__eq { display: flex; align-items: baseline; justify-content: center; gap: 10px; margin-top: 10px; padding: 10px; border-radius: 14px; background: var(--surface); font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tawad__eq:empty { display: none; } .tawad__eq .op { color: var(--muted); } .tawad__eq b { color: var(--primary); font-size: 20px; }

/* ---- v2.5 live earnings ---- */
.card.live { background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 12%, var(--surface)), var(--surface)); }
.live__amount { font-size: clamp(30px, 7vw, 44px); font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.live__grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
.live__grid > div { background: var(--surface-2); border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.live__grid span { font-size: 12px; color: var(--muted); } .live__grid b { font-size: 14.5px; overflow-wrap: anywhere; }
@media (max-width: 640px) { .live__grid { grid-template-columns: 1fr 1fr; } }
.live__state { font-size: 12.5px; font-weight: 700; padding: 6px 12px; border-radius: 999px; background: var(--surface-3); color: var(--ink-2); white-space: nowrap; }
.live__state.on { background: var(--primary-soft); color: var(--primary); } .live__state.on::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: currentColor; margin-right: 7px; animation: livePulse 1.6s ease-out infinite; }
.live__state.grace { background: var(--warn-soft); color: var(--warn); white-space: normal; text-align: right; }
.live__state.done { background: var(--primary-soft); color: var(--primary); }
.due { display: flex; gap: 10px; align-items: flex-start; margin-top: 8px; padding: 10px 12px; border-radius: 14px; background: var(--warn-soft); color: var(--ink); font-size: 13px; }
.src { display: inline-block; font-size: 10.5px; font-weight: 800; padding: 1px 7px; border-radius: 999px; background: var(--surface-3); color: var(--ink-2); margin-top: 2px; }
.src.auto { background: var(--warn-soft); color: var(--warn); } .src.admin { background: var(--info-soft, var(--surface-3)); }
@media (prefers-reduced-motion: reduce) { .live__state.on::before { animation: none; } }

/* ---- v2.5.1 bars & charts ---- */
.bar > i { position: relative; overflow: hidden; transition: width 1.1s cubic-bezier(.22,.9,.3,1); }
.bar > i.filled::after { content: ''; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 20%, rgb(255 255 255 / .45) 50%, transparent 80%); transform: translateX(-100%); animation: barShine 1.1s .9s ease-out 1; }
@keyframes barShine { to { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .bar > i { transition: none; } .bar > i.filled::after { display: none; } }
.chartsum { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.chartsum > div { display: grid; grid-template-columns: 10px 1fr; column-gap: 8px; align-items: center; background: var(--surface-2); border-radius: 14px; padding: 9px 11px; min-width: 0; }
.chartsum i { width: 10px; height: 10px; border-radius: 3px; grid-row: span 2; }
.chartsum span { font-size: 11.5px; color: var(--muted); } .chartsum b { font-size: 13.5px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }


/* ---- v2.5.1 instant theme + calm navigation ---- */
html.theme-switching *, html.theme-switching *::before, html.theme-switching *::after { transition: none !important; }
.pills__ind { transition: transform .22s cubic-bezier(.2,.8,.2,1), width .22s cubic-bezier(.2,.8,.2,1), opacity .15s; }
/* Rail and bottom-nav items change state crisply: only hover feedback animates, not the old/new active item. */
.rail a, .bottomnav a { transition: transform .18s var(--ease); }
.rail a.active .i, .bottomnav a.active .i { animation: none; }
.rail a:hover .i { transform: none; }
.rail a:active { transform: scale(.94); }
/* ---- Search suggestions ---- */
.search { position: relative; }
.typeahead { position: absolute; left: 0; right: 0; top: calc(100% + 8px); z-index: 60; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 18px 40px -16px rgb(0 0 0 / .35); padding: 6px; max-height: 360px; overflow: auto; animation: popIn .16s var(--ease) both; }
.typeahead[hidden] { display: none; }
.typeahead__item { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; column-gap: 10px; width: 100%; text-align: left; padding: 9px 11px; border-radius: 11px; color: var(--ink); font: inherit; background: none; border: 0; cursor: pointer; }
.typeahead__item.on, .typeahead__item:hover { background: var(--primary-soft); }
.typeahead__name { font-weight: 700; font-size: 14px; } .typeahead__meta { grid-row: 2; font-size: 12px; color: var(--muted); } .typeahead__item > b { grid-row: span 2; align-self: center; font-size: 13.5px; color: var(--primary); }
.typeahead mark { background: color-mix(in srgb, var(--primary) 28%, transparent); color: inherit; border-radius: 4px; padding: 0 1px; }
.typeahead__empty { padding: 10px 12px; font-size: 13px; color: var(--muted); }
.card.has-typeahead, .filterbar.has-typeahead { position: relative; z-index: 5; overflow: visible; }

/* ---- v2.5.1 colour harmony: readable status text in both themes (WCAG AA) ---- */
:root { --warn-text: #8a5300; --danger-text: #b42318; --info-text: #1d4fb8; --ok-text: #0b6b48; }
:root[data-theme="dark"] { --warn-text: #f6c46a; --danger-text: #ff8e88; --info-text: #9dbdf8; --ok-text: #5fe0b0; }
.tag.low, .tag.warn, .tag.pending, .tag.Pending\ Approval { color: var(--warn-text); }
.tag.out, .tag.danger, .tag.Absent, .tag.Declined, .tag.voided { color: var(--danger-text); }
.tag.adequate, .tag.info, .tag.credit { color: var(--info-text); }
.tag.ok, .tag.high, .tag.Present, .tag.Excused, .tag.Approved, .tag.cash, .tag.paid { color: var(--ok-text); }
.btn.danger { color: var(--danger-text); }
.trend.down, .trend.bad, .change.short { color: var(--danger-text); }
.list__item .ic.warn, .kpi.tone-warn .ic { color: var(--warn-text); }
.list__item .ic.danger, .kpi.tone-danger .ic { color: var(--danger-text); }
.badge { background: var(--danger-text); color: #fff; }
:root[data-theme="dark"] .badge { color: #2a0b09; }
.badge[style*="--primary"] { background: var(--primary) !important; color: var(--primary-ink); }
.badge[style*="--warn"] { background: var(--warn-text) !important; color: #fff; }
:root[data-theme="dark"] .badge[style*="--warn"] { color: #2a1a00; }
.badge[style*="--line-2"], :root[data-theme="dark"] .badge[style*="--line-2"] { color: var(--ink-2); }
.src.auto, .live__state.grace { color: var(--warn-text); }
.due { color: var(--ink); }
.chartsum { grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); }
.chartsum b { white-space: nowrap; overflow-wrap: normal; font-size: 13px; }
.filterbar .typeahead { min-width: min(360px, calc(100vw - 32px)); }

/* ---- v2.5.2 chart grow-in on view ---- */
.chart .cbar { animation: none; transform: scaleY(0); }
.chart.play .cbar { animation: growBar .75s cubic-bezier(.2,.9,.25,1.15) forwards; animation-delay: calc(min(var(--i), 40) * 35ms); }
.chart .cval { animation: none; opacity: 0; }
.chart.play .cval { animation: fadeIn .35s ease forwards; animation-delay: calc(min(var(--i), 40) * 35ms + .55s); }
@media (prefers-reduced-motion: reduce) { .chart .cbar, .chart.play .cbar { animation: none; transform: none; } .chart .cval { opacity: 1; } }
.cashier-kpis .kpi__value { font-size: clamp(22px, 5vw, 30px); }

/* ---- v2.6 · portals & motion ------------------------------------------ */
/* Bottom bar: a bar slides in above the active item. */
.bottomnav a::before { content: ''; position: absolute; top: -7px; left: 28%; right: 28%; height: 4px; border-radius: 4px; background: var(--primary); transform: scaleX(0); opacity: 0; transition: transform .4s var(--ease-spring), opacity .2s; }
.bottomnav a.active::before { transform: scaleX(1); opacity: 1; }
.bottomnav a:active { transform: scale(.92); }
/* Cards lift on hover / press. */
.card.click { transition: transform .25s var(--ease-spring), box-shadow .25s var(--ease); }
@media (hover: hover) { .card.click:hover { transform: translateY(-3px); } }
.card.click:active { transform: scale(.98); }
/* Orders */
.orders { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); }
.order { display: block; width: 100%; text-align: left; font: inherit; color: inherit; border: 1px solid var(--line); animation: orderIn .5s var(--ease-spring) both; animation-delay: calc(var(--i, 0) * 50ms); }
@keyframes orderIn { from { opacity: 0; transform: translateY(16px) scale(.96); } }
.order__items { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; align-items: center; }
.order__chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; border-radius: 999px; background: var(--surface-3); font-size: 12.5px; font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.order__chip:not(:has(img)) { padding-left: 10px; }
.order__chip img { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; }
.order__total { font-size: 18px; }
.change.bad { background: var(--danger-soft); color: var(--danger); }
.kpi.tone-warn .kpi__value { color: var(--warn-text, var(--warn)); }
@media (prefers-reduced-motion: reduce) { .order, .view, .view.leaving { animation: none !important; } .bottomnav a::before { transition: none; } .card.click:hover { transform: none; } }

/* ---- v2.6.1 · cashier bottom bar with 6 items, Tawad summary ------------ */
@media (max-width: 760px) {
  .bottomnav.six { padding: 5px; left: 6px; right: 6px; }
  .bottomnav.six a { font-size: 10px; letter-spacing: -.15px; padding: 7px 1px 5px; min-width: 0; }
  .bottomnav.six a .i { width: 22px; height: 22px; }
}
.bottomnav a .txt { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eq { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; align-items: center; gap: 12px; }
.eq__part { display: flex; flex-direction: column; gap: 4px; padding: 14px; border-radius: 16px; background: var(--surface-2, var(--surface-3)); min-width: 0; animation: orderIn .55s var(--ease-spring) both; }
.eq__part.tawad { background: var(--warn-soft); animation-delay: .12s; }
.eq__part.net { background: var(--primary-soft); animation-delay: .24s; }
.eq__label { font-size: 12.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.eq__v { font-size: clamp(20px, 3.2vw, 30px); font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.eq__v.warn { color: var(--warn-text, var(--warn)); }
.eq__v.ok { color: var(--primary); }
.eq__op { font-size: 28px; font-weight: 800; color: var(--muted); }
@media (max-width: 760px) { .eq { grid-template-columns: 1fr; gap: 6px; } .eq__op { text-align: center; line-height: 1; font-size: 22px; } }
.summary__range { flex-wrap: wrap; gap: 8px; }
.summary__range input[type=date] { width: auto; min-width: 0; max-width: 150px; }
.sumlist { display: flex; flex-direction: column; gap: 12px; }
.sumrow { display: flex; gap: 12px; align-items: center; animation: orderIn .5s var(--ease-spring) both; animation-delay: calc(var(--i, 0) * 45ms); }
.sumrow__img { width: 40px; height: 40px; border-radius: 12px; object-fit: cover; flex: none; }
.sumrow__img.ph { display: grid; place-items: center; background: var(--surface-3); color: var(--muted); }
.sumrow__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.sumrow__body b { overflow: hidden; text-overflow: ellipsis; }
.sumrow__body .row.between { gap: 10px; }
.sumrow__body .row.between > :first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sumrow__bar { margin-top: 3px; }
.tawad-amt { color: var(--warn-text, var(--warn)); font-weight: 700; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; vertical-align: 1px; }
.dot.warn { background: var(--warn); } .dot.ok { background: var(--primary); }
@media (prefers-reduced-motion: reduce) { .eq__part, .sumrow { animation: none; } }

/* Big peso values shrink to fit narrow phones instead of being cut off. */
.kpi { container-type: inline-size; }
.kpi__value { white-space: nowrap; line-height: 1.12; }
@container (max-width: 260px) { .kpi__value { font-size: min(30px, 16.5cqi); } }
@media (max-width: 420px) { .grid.kpi .kpi__label { font-size: 12.5px; } }

/* ---- v2.7 · store identity in every portal ------------------------------ */
.storecard { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; background: linear-gradient(120deg, var(--surface) 0%, color-mix(in oklab, var(--primary-soft) 60%, var(--surface)) 100%); }
.storecard__logo { width: 64px; height: 64px; border-radius: 16px; object-fit: contain; background: #fff; padding: 5px; box-shadow: var(--shadow); flex: none; }
.storecard__body { flex: 1; min-width: 180px; } .storecard__body h2 { margin: 2px 0 2px; }
@media (max-width: 760px) {
  .hero { padding-right: 76px; }
  .hero__logo { display: block; position: absolute; top: 14px; right: 14px; height: 48px; max-width: 90px; padding: 4px; border-radius: 12px; }
}

/* Brand colour picker */
.brand__swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(120px, 100%), 1fr)); gap: 8px; }
.brand__sw { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; text-align: left; transition: transform .2s var(--ease-spring), border-color .2s; }
.brand__sw::before { content: ''; width: 20px; height: 20px; border-radius: 50%; background: var(--sw); flex: none; box-shadow: inset 0 0 0 2px rgb(255 255 255 / .35); }
.brand__sw.on { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary); }
.brand__sw:active { transform: scale(.96); }
.brand__customwrap { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.brand__custom { width: 40px; height: 40px; padding: 0; border: 1px solid var(--line); border-radius: 12px; background: none; cursor: pointer; }
.brand__preview { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 14px 0 8px; padding: 14px; border-radius: 14px; background: var(--bg); border: 1px dashed var(--line-2); }
.brand__pill { padding: 7px 14px; border-radius: 999px; background: var(--primary); color: var(--primary-ink); font-weight: 700; font-size: 13px; }
.brand__bar { flex: 1; min-width: 80px; height: 8px; border-radius: 8px; background: var(--surface-3); overflow: hidden; } .brand__bar i { display: block; width: 64%; height: 100%; background: var(--primary); border-radius: inherit; }

/* Notice when the system is opened inside an editor preview instead of a browser */
.framed-note { position: sticky; top: 0; z-index: 9000; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 16px; background: var(--warn-soft); color: var(--ink); border-bottom: 1px solid var(--line-2); font-size: 13.5px; }
.framed-note > span { flex: 1; min-width: 220px; }
.framed-note code { font-family: var(--mono, monospace); font-weight: 700; user-select: all; }

/* ---- v2.8 · charts at real pixel size, animate when scrolled into view ---- */
.chartbox { width: 100%; position: relative; }
.chartbox > .chart { display: block; width: 100%; height: 100%; overflow: visible; }
.chart text { font-size: 12px; font-variant-numeric: tabular-nums; letter-spacing: 0; }
.chart .ytick { font-weight: 600; }
.chart .xtick { font-weight: 600; fill: var(--ink-2); }
.chart .cval { font-size: 11.5px; }
@media (max-width: 520px) { .chart text { font-size: 11px; } }
.chart .line.draw { animation: none; stroke-dashoffset: var(--len); }
.chart.play .line.draw { animation: drawLine 1.3s cubic-bezier(.35,.1,.2,1) forwards; animation-delay: var(--d, 0ms); }
.chart .area { animation: none; opacity: 0; }
.chart.play .area { animation: fade .9s .55s forwards; }
.chart.instant .line.draw, .chart.instant .area, .chart.instant .cbar, .chart.instant .cval { animation: none !important; stroke-dashoffset: 0; opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .chart .area { opacity: 1; } .chart .line.draw { stroke-dashoffset: 0; } }

/* ---- v2.8 · POS on phones/tablets: total + main button always reachable ---- */
.paydock { display: none; }
@media (max-width: 1000px) {
  .cart { max-height: none; }
  .cart__items { max-height: none; overflow: visible; margin: 0; padding: 0; }
  .paydock { position: fixed; z-index: 59; left: 10px; right: 10px; bottom: calc(14px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 14px;
    background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-lg);
    transform: translateY(calc(100% + 40px)); opacity: 0; pointer-events: none; transition: transform .35s var(--ease-spring), opacity .25s; }
  .paydock.on { transform: none; opacity: 1; pointer-events: auto; }
  .paydock.on.typing { transform: none; opacity: 1; pointer-events: auto; }
  .paydock__sum { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; background: none; border: 0; padding: 0; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
  .paydock__sum span { font-size: 12px; color: var(--muted); font-weight: 600; }
  .paydock__sum b { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.15; }
  .paydock .btn { flex: none; min-height: 48px; padding-inline: 18px; font-size: 15px; }
  body.has-dock main.page { padding-bottom: calc(var(--dock-pad, 96px) + env(safe-area-inset-bottom)); }
}
@media (max-width: 760px) {
  .pos-search-card.search-active { position: sticky; top: calc(var(--nav-h) + 10px); z-index: 20; scroll-margin-top: calc(var(--nav-h) + 10px); }
  .pos-search-card .typeahead { max-height: min(44dvh, 340px); overscroll-behavior: contain; }
  .cart-slot[hidden] { display: none; }
  .cart-modal { max-height: 92dvh; }
  .cart-modal .modal__foot { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .cart-sheet__hero { padding: 12px; }
  .cart-sheet__hero > div span { max-width: 190px; }
}
@media (max-width: 760px) {
  /* sits right above the bottom menu */
  .paydock { bottom: calc(86px + env(safe-area-inset-bottom) + var(--keyboard-height, 0px)); }
  body.has-dock main.page { --dock-pad: 186px; }
}

/* View more / ranked tables */
.viewmore { display: flex; margin: 10px auto 0; }
.report-masonry { columns: 2; column-gap: 14px; margin-top: 14px; }
.report-masonry > .card { display: inline-block; width: 100%; margin: 0 0 14px; vertical-align: top; break-inside: avoid; }
@media (max-width: 760px) { .report-masonry { columns: 1; } }
.t--rank td:first-child { display: flex; align-items: center; gap: 10px; }
.rank { flex: none; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 7px; background: var(--surface-3); color: var(--muted); font-size: 11.5px; font-weight: 800; font-variant-numeric: tabular-nums; }
.t--rank tr:nth-child(-n+3) .rank { background: var(--primary-soft); color: var(--primary); }
.t td.num, .t th.right { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Sales: quick ranges, confirmed sales per day, day headers */
.salesfilter { display: grid; gap: 10px; }
.chip.on { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.daterange input[type=date] { width: auto; min-width: 0; max-width: 160px; }
.daylist { display: flex; flex-direction: column; }
.daylist__row { display: grid; grid-template-columns: minmax(150px, 1.2fr) minmax(80px, 2fr) auto; align-items: center; gap: 14px; padding: 11px 6px; border: 0; border-bottom: 1px solid var(--line); background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; border-radius: 10px; animation: orderIn .45s var(--ease-spring) both; animation-delay: calc(var(--i, 0) * 35ms); }
.daylist__row:last-child { border-bottom: 0; }
@media (hover: hover) { .daylist__row:hover { background: var(--surface-2); } }
.daylist__date { display: flex; flex-direction: column; gap: 2px; min-width: 0; } .daylist__date span { font-size: 12.5px; color: var(--muted); }
.daylist__total { font-variant-numeric: tabular-nums; text-align: right; min-width: 96px; }
@media (max-width: 560px) { .daylist__row { grid-template-columns: 1fr auto; } .daylist__bar { grid-column: 1 / -1; grid-row: 2; } }
.t tr.dayhead td { background: var(--surface-2); padding: 9px 14px; font-size: 13px; color: var(--muted); position: sticky; top: 0; }
.t tr.dayhead b { color: var(--ink); }

/* Page change: the old page dims at once (instant feedback), the new one replaces it quickly. */
.view.outgoing { opacity: .55; transform: translate3d(0, -4px, 0); transition: opacity .12s ease, transform .12s ease; }

/* Product cards: + on the photo corner; name up to 2 lines; SKU and category never run together */
.product__img { position: relative; }
.product .product__img .product__add { position: absolute; top: auto; left: auto; right: 8px; bottom: 8px; width: 36px; height: 36px; z-index: 2; }
.product__name { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; min-height: 2.5em; }
.product__meta { flex-wrap: wrap; gap: 2px 8px; min-width: 0; }
.product__sku { font-family: var(--mono, ui-monospace, monospace); font-size: 11.5px; letter-spacing: .02em; }
.product__cat { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.product__price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 6px; font-variant-numeric: tabular-nums; }
@media (max-width: 760px) { .product .product__img .product__add { transform: scale(1); } .product__cat { flex-basis: 100%; } }

/* Cashier overview: payment methods + sales − Tawad */
.methods { display: flex; flex-direction: column; gap: 12px; }
.method { display: grid; grid-template-columns: 12px minmax(92px, 1fr) minmax(60px, 1.4fr) auto; align-items: center; gap: 10px; }
.method__dot { width: 10px; height: 10px; border-radius: 50%; }
.method__name { display: flex; flex-direction: column; font-weight: 700; font-size: 14px; line-height: 1.2; } .method__name small { font-weight: 500; font-size: 12px; color: var(--muted); }
.method__amt { font-variant-numeric: tabular-nums; text-align: right; min-width: 92px; }
@media (max-width: 420px) { .method { grid-template-columns: 12px 1fr auto; } .method__bar { grid-column: 2 / -1; } }
.eqmini { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; align-items: center; gap: 8px; }
.eqmini > div:not(.op) { display: flex; flex-direction: column; gap: 4px; padding: 12px; border-radius: 14px; background: var(--surface-2); min-width: 0; }
.eqmini span { font-size: 12px; color: var(--muted); font-weight: 600; }
.eqmini b { font-size: clamp(15px, 2.2vw, 20px); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.eqmini .tawad { background: var(--warn-soft) !important; } .eqmini .tawad b { color: var(--warn-text, var(--warn)); }
.eqmini .net { background: var(--primary-soft) !important; } .eqmini .net b { color: var(--primary); }
.eqmini .op { font-size: 20px; font-weight: 800; color: var(--muted); text-align: center; }
@media (max-width: 560px) { .eqmini { grid-template-columns: 1fr; } .eqmini .op { line-height: 1; } }

/* (theme switch: see "Light/dark switch restored from v2.7.2" at the end of this file) */
/* progress bars inside inline wrappers must be blocks to show */
.method__bar .bar, .daylist__bar .bar { display: block; }
.method__bar, .daylist__bar { display: block; min-width: 0; }
@media (max-width: 420px) {
  .method { grid-template-columns: 12px 1fr auto; grid-template-rows: auto auto; row-gap: 6px; }
  .method__dot { grid-row: 1; grid-column: 1; } .method__name { grid-row: 1; grid-column: 2; } .method__amt { grid-row: 1; grid-column: 3; min-width: 0; }
  .method__bar { grid-row: 2; grid-column: 2 / -1; }
}

/* Materials list on phones: each material is a tidy row (name up to 2 lines, then stock · status · price);
   the category is not repeated under every item when the list is grouped by category. */
.t--mat.grouped .c-cat { display: none; }
.c-matname b { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .t--mat thead { display: none; }
  .t--mat, .t--mat tbody { display: block; width: 100%; }
  .t--mat tr.grouphead { display: block; } .t--mat tr.grouphead td { display: block; padding: 10px 14px; }
  .t--mat tr.click { display: grid; grid-template-columns: auto auto 1fr auto; grid-template-areas: "mat mat mat go" "qty st st pr"; align-items: center; gap: 8px 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .t--mat tr.click td { display: block; padding: 0; border: 0; }
  .t--mat .c-mat { grid-area: mat; min-width: 0; } .t--mat .c-mat .row { gap: 12px; align-items: center; flex-wrap: nowrap; }
  .t--mat .c-matname { min-width: 0; }
  .t--mat .c-qty { grid-area: qty; text-align: left; padding-left: 52px !important; white-space: nowrap; }
  .t--mat .c-st { grid-area: st; } .t--mat .c-pr { grid-area: pr; text-align: right; } .t--mat .c-go { grid-area: go; color: var(--muted); }
  .t--mat .c-lh { display: none !important; }
}

/* ---- Light/dark switch restored from v2.7.2 (circular reveal + fade fallback + mode label) ---- */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-new(root) { z-index: 9999; animation: themeReveal .95s cubic-bezier(.45,.05,.25,1) both; }
::view-transition-old(root) { z-index: 1; }
:root[data-theme="dark"]::view-transition-old(root), :root[data-theme="dark"]::view-transition-new(root) { z-index: auto; }
:root[data-theme="dark"]::view-transition-new(root) { z-index: 9999; }
@keyframes themeReveal { from { clip-path: circle(0 at var(--tx, 50%) var(--ty, 50%)); } to { clip-path: circle(var(--tr, 150vmax) at var(--tx, 50%) var(--ty, 50%)); } }
.theme-fade { position: fixed; inset: 0; z-index: 9998; pointer-events: none; background: var(--bg); animation: themeFade .8s ease forwards; }
@keyframes themeFade { from { opacity: .55; } to { opacity: 0; } }
.theme-toast { position: fixed; left: 50%; top: 18px; z-index: 10000; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 999px; background: var(--surface); color: var(--ink); font-weight: 800; font-size: 14px; box-shadow: var(--shadow-lg, 0 18px 40px -18px rgba(0,0,0,.45)); border: 1px solid var(--line); pointer-events: none; animation: themeToast 1.6s cubic-bezier(.2,.8,.2,1) both; }
@keyframes themeToast { 0% { opacity: 0; transform: translate(-50%, -16px) scale(.9); } 18% { opacity: 1; transform: translate(-50%, 0) scale(1); } 80% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; transform: translate(-50%, -10px); } }
@media (prefers-reduced-motion: reduce) { .theme-toast { animation: none !important; } }

/* ---- v2.9 · connection bar (slow / no connection / offline mode / pending sync) ---- */
.netbar { top: 76px; bottom: auto !important; width: min(640px, calc(100% - 20px)); border-radius: 18px; padding: 10px 12px 10px 14px; flex-wrap: wrap; row-gap: 8px; line-height: 1.3; animation: netIn .3s var(--ease-spring) both; }
.netbar.out { animation: netOut .22s ease-in both; }
@keyframes netIn { from { opacity: 0; transform: translate(-50%, -10px) scale(.97); } }
@keyframes netOut { to { opacity: 0; transform: translate(-50%, -8px) scale(.97); } }
.netbar > span:nth-child(2) { flex: 1; min-width: 180px; }
.netbar small { display: block; font-size: 12px; font-weight: 500; opacity: .82; margin-top: 2px; }
.netbar__ic { flex: none; display: grid; place-items: center; width: 26px; height: 26px; }
.netbar__actions { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.netbar.slow { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.netbar.down { background: #7a1f1a; color: #fff; }
.netbar.offline { background: #8a5a00; color: #fff; }
:root[data-theme="dark"] .netbar.down { background: #4a1512; } :root[data-theme="dark"] .netbar.offline { background: #4d3500; }
.netbar.down .btn.soft, .netbar.offline .btn.soft { background: rgb(255 255 255 / .16); color: #fff; border-color: transparent; }
.netbar .spin { width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; }
@media (max-width: 760px) { .netbar { font-size: 12.5px; } .netbar__actions { width: 100%; justify-content: flex-end; } }
@media (prefers-reduced-motion: reduce) { .netbar, .netbar.out { animation: none; } .netbar .spin { animation-duration: 2.4s; } }

/* v2.9.1 — Language (English / Filipino) */
.langswitch { display: inline-flex; padding: 3px; gap: 2px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--line); }
.langswitch button { border: 0; background: none; color: var(--muted); font: inherit; font-weight: 700; font-size: 13px; padding: 7px 14px; border-radius: 999px; cursor: pointer; transition: background .2s, color .2s, box-shadow .2s; min-height: 34px; }
.langswitch button:hover { color: var(--ink); }
.langswitch button.on { background: var(--primary); color: var(--primary-ink); box-shadow: 0 4px 12px -6px var(--primary); }
.langswitch button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.login__lang { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 16px; color: var(--muted); }
.langveil { position: fixed; inset: 0; z-index: 20000; display: grid; place-items: center; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); opacity: 0; transition: opacity .25s ease; }
.langveil.in { opacity: 1; }
.langveil__box { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 26px 34px; border-radius: 22px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 24px 60px -24px rgba(0,0,0,.45); color: var(--ink); text-align: center; }
.langveil__box b { font-size: 17px; }
.langveil__box span:last-child { font-size: 13px; color: var(--muted); }
.langveil__spin { width: 38px; height: 38px; border-radius: 50%; border: 4px solid var(--primary-soft); border-top-color: var(--primary); animation: langSpin .8s linear infinite; }
@keyframes langSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .langveil__spin { animation-duration: 2.4s; } .langveil { transition: none; } }
/* Space kept free under the connection bar (set from app.js while the bar shows). */
main.page::before { content: ''; display: block; height: var(--netbar-space, 0px); transition: height .25s ease; }
@media (prefers-reduced-motion: reduce) { main.page::before { transition: none; } }

/* v2.9.2 — Category sections: a coloured header that stays under the top bar while its
   materials scroll by (Materials, Inventory and the POS / New order catalog). */
.catgroups { display: grid; gap: 18px; }
.catgroup { position: relative; display: grid; gap: 10px; }
.catgroup--grid { grid-column: 1 / -1; margin-bottom: 8px; }
.cathead {
  position: sticky; top: calc(var(--stick-top, 72px) + var(--netbar-space, 0px)); z-index: 6;
  display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 9px 14px 9px 12px;
  border-radius: 14px; border: 1px solid color-mix(in srgb, var(--cat) 34%, var(--line));
  border-left: 5px solid var(--cat);
  background: color-mix(in srgb, var(--cat) 13%, var(--surface));
  box-shadow: 0 8px 18px -14px color-mix(in srgb, var(--cat) 70%, transparent);
  color: var(--ink);
}
.cathead__dot { width: 10px; height: 10px; border-radius: 50%; background: var(--cat); flex: none; box-shadow: 0 0 0 4px color-mix(in srgb, var(--cat) 22%, transparent); }
.cathead__name { font-size: 15px; letter-spacing: .01em; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cathead__n { margin-left: auto; flex: none; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: color-mix(in srgb, var(--cat) 20%, var(--surface)); color: color-mix(in srgb, var(--cat) 65%, var(--ink)); }
[data-theme="dark"] .cathead { background: color-mix(in srgb, var(--cat) 22%, var(--surface)); border-color: color-mix(in srgb, var(--cat) 45%, var(--line)); }
[data-theme="dark"] .cathead__n { background: color-mix(in srgb, var(--cat) 30%, var(--surface)); color: color-mix(in srgb, var(--cat) 35%, #ffffff); }
.catgroup .product { border-top: 3px solid color-mix(in srgb, var(--cat) 55%, transparent); }
.catgroup .t--mat tbody tr td:first-child { box-shadow: inset 4px 0 0 color-mix(in srgb, var(--cat) 65%, transparent); }
@media (max-width: 760px) {
  .cathead { min-height: 40px; padding: 8px 12px 8px 10px; border-radius: 12px; }
  .cathead__name { font-size: 14px; }
}
/* Same column widths in every category's table, so the numbers line up from one section to the next. */
@media (min-width: 761px) {
  .catgroup .t--mat { table-layout: fixed; width: 100%; }
  .catgroup .t--mat tr > :nth-child(2) { width: 130px; }
  .catgroup .t--mat tr > :nth-child(3) { width: 110px; }
  .catgroup .t--mat tr > :nth-child(4) { width: 150px; }
  .catgroup .t--mat tr > :nth-child(5):not(:last-child) { width: 170px; }
  .catgroup .t--mat tr > :last-child { width: 48px; }
}

/* v2.9.2 — Laptop side menu scrolls when it is taller than the screen (Admin has many pages). */
@media (min-width: 761px) {
  .rail { max-height: calc(100dvh - var(--nav-h) - 46px); overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain;
    padding: 4px 4px 14px; margin: -4px -4px 0; scrollbar-width: none; }
  .rail::-webkit-scrollbar { display: none; }
  .rail__more { position: sticky; z-index: 2; align-self: center; flex: none; width: 40px; height: 26px; margin: -2px 0; border: 1px solid var(--line); border-radius: 999px;
    background: var(--surface); color: var(--ink); box-shadow: 0 6px 16px -6px rgb(0 0 0 / .35); display: none; place-items: center; cursor: pointer; transition: background .2s, transform .15s; }
  .rail__more:hover { background: var(--primary); color: var(--primary-ink); }
  .rail__more:active { transform: scale(.92); }
  .rail__more.up { top: 0; order: -1; }
  .rail__more.up .i { transform: rotate(180deg); }
  .rail__more.down { bottom: 0; order: 99; }
  .rail.more-above .rail__more.up, .rail.more-below .rail__more.down { display: grid; }
}
@media (max-width: 760px) { .rail__more { display: none; } }
/* The bottom breathing room belongs to the page, not the layout, so the sticky side menu can reach the
   bottom of the screen on short pages instead of sliding up under the top bar. */
@media (min-width: 761px) { .layout { padding-bottom: 16px; } main.page { padding-bottom: 74px; } }
