/* Layout: one sticky header with tabs, then a single column of item cards (2-3 columns on wide screens); every edit happens in one bottom sheet. */
:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #eceef2;
  --fg: #1c1b22;
  --muted: #646271;
  --line: #dddde4;
  --accent: #a3165f;
  --accent-fg: #ffffff;
  --low: #c62828;
  --low-soft: #fde7e6;
  --med: #b86e00;
  --med-soft: #fff1d6;
  --high: #1f7a45;
  --high-soft: #def3e6;
  --shadow: 0 1px 2px rgba(30,20,40,.06), 0 4px 14px rgba(30,20,40,.06);
  --display: "Baloo 2", "Trebuchet MS", system-ui, sans-serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --r: 14px;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #141318; --surface: #1e1d24; --surface-2: #2a2932; --fg: #f1f0f5; --muted: #a3a1af; --line: #34333d;
  --accent: #f06bb0; --accent-fg: #1a0b13;
  --low: #ff7a70; --low-soft: #3a1c1b; --med: #ffb84d; --med-soft: #3a2b12; --high: #5fd68f; --high-soft: #163322;
  --shadow: 0 1px 2px rgba(0,0,0,.4); color-scheme: dark } }
:root[data-theme="dark"] {
  --bg: #141318; --surface: #1e1d24; --surface-2: #2a2932; --fg: #f1f0f5; --muted: #a3a1af; --line: #34333d;
  --accent: #f06bb0; --accent-fg: #1a0b13;
  --low: #ff7a70; --low-soft: #3a1c1b; --med: #ffb84d; --med-soft: #3a2b12; --high: #5fd68f; --high-soft: #163322;
  --shadow: 0 1px 2px rgba(0,0,0,.4); color-scheme: dark }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { background: var(--bg); color: var(--fg); font-family: var(--body); font-size: 16px; -webkit-tap-highlight-color: transparent; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--surface); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.wrap { max-width: 1180px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }

header.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 12px 6px; }
.brand h1 { font-family: var(--display); font-weight: 800; font-size: 1.6rem; line-height: 1; margin: 0; letter-spacing: -.01em; }
.brand h1 span { color: var(--accent); }
.who { font-size: .8rem; color: var(--muted); text-align: right; }
.tabs { display: flex; gap: 6px; padding-block: 4px 10px; }
.tab { flex: 1; min-height: 48px; border-radius: 12px; border: 0; background: var(--surface-2); font-weight: 700; font-size: 1rem; display: flex; align-items: center; justify-content: center; gap: 8px; }
.tab[aria-selected="true"] { background: var(--fg); color: var(--bg); }
.tab .n { font-variant-numeric: tabular-nums; background: var(--low); color: #fff; border-radius: 99px; padding: 1px 8px; font-size: .8rem; }
.tab .n:empty { display: none; }

.banner { margin-top: 12px; padding: 10px 14px; border-radius: 12px; background: var(--med-soft); color: var(--fg); font-size: .9rem; }

.tools { display: grid; gap: 10px; padding-block: 14px 6px; }
.search { position: relative; }
.search input { width: 100%; min-height: 52px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); padding: 0 48px 0 46px; font-size: 1.05rem; }
.search svg { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: var(--muted); }
.search .clear { position: absolute; right: 6px; top: 6px; width: 40px; height: 40px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 1.3rem; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 42px; padding: 0 16px; border-radius: 99px; border: 1.5px solid var(--line); background: var(--surface); font-weight: 600; font-size: .95rem; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.chip[aria-pressed="true"] { border-color: var(--fg); background: var(--fg); color: var(--bg); }
.chip .dot { width: 10px; height: 10px; border-radius: 50%; }
.chip .c { font-variant-numeric: tabular-nums; opacity: .7; }

.list { display: grid; gap: 12px; padding-block: 10px 120px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .list { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1080px) { .list { grid-template-columns: 1fr 1fr 1fr; } }
.group-h { grid-column: 1 / -1; font-family: var(--display); font-weight: 700; font-size: 1.15rem; margin: 10px 0 -2px; display: flex; justify-content: space-between; align-items: baseline; }
.group-h small { font-family: var(--body); font-weight: 500; color: var(--muted); font-size: .85rem; }

.card { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); border: 1px solid var(--line); display: grid; overflow: hidden; min-width: 0; }
.card.lvl-low { border-left: 6px solid var(--low); }
.card.lvl-medium { border-left: 6px solid var(--med); }
.card.lvl-high { border-left: 6px solid var(--high); }
.card-main { all: unset; cursor: pointer; display: grid; gap: 4px; padding: 14px 16px 10px; min-width: 0; }
.card-main:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.row1 { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.name { font-weight: 700; font-size: 1.12rem; overflow-wrap: anywhere; }
.qty { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--muted); white-space: nowrap; font-size: .95rem; }
.qty b { color: var(--fg); }
.meta { color: var(--muted); font-size: .88rem; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.tag { font-size: .78rem; font-weight: 700; padding: 2px 8px; border-radius: 6px; }
.tag.exp { background: var(--med-soft); color: var(--med); }
.tag.expd { background: var(--low-soft); color: var(--low); }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 0 12px 12px; }
.seg button { min-height: 50px; border-radius: 11px; border: 2px solid var(--line); background: var(--surface); font-weight: 800; font-size: .95rem; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); }
.seg button[data-l="low"][aria-pressed="true"] { background: var(--low); border-color: var(--low); color: #fff; }
.seg button[data-l="medium"][aria-pressed="true"] { background: var(--med); border-color: var(--med); color: #fff; }
.seg button[data-l="high"][aria-pressed="true"] { background: var(--high); border-color: var(--high); color: #fff; }
:root[data-theme="dark"] .seg button[aria-pressed="true"] { color: #111; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .seg button[aria-pressed="true"] { color: #111; } }
.foot { font-size: .75rem; color: var(--muted); padding: 0 16px 12px; margin-top: -4px; }

.empty { grid-column: 1 / -1; text-align: center; padding: 48px 16px; color: var(--muted); }
.empty h2 { font-family: var(--display); color: var(--fg); font-size: 1.4rem; margin: 0 0 6px; text-wrap: balance; }

.fab { position: fixed; right: max(18px, calc(env(safe-area-inset-right, 0px) + 12px)); bottom: calc(env(safe-area-inset-bottom, 0px) + 18px); z-index: 6; min-height: 60px; padding: 0 26px 0 20px; border-radius: 99px; border: 0; background: var(--accent); color: var(--accent-fg); font-weight: 800; font-size: 1.1rem; box-shadow: 0 6px 20px rgba(163,22,95,.35); display: flex; align-items: center; gap: 8px; }
.fab svg { width: 24px; height: 24px; }

/* Sheet */
.scrim { position: fixed; inset: 0; z-index: 20; background: rgba(10,8,14,.45); display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 720px) { .scrim { align-items: center; } }
.sheet { background: var(--bg); width: 100%; max-width: 640px; max-height: 94%; overflow-y: auto; border-radius: 20px 20px 0 0; padding: 0 0 calc(env(safe-area-inset-bottom, 0px) + 16px); }
@media (min-width: 720px) { .sheet { border-radius: 20px; max-height: 90%; } }
.sheet-h { position: sticky; top: 0; z-index: 2; background: var(--bg); display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px)); border-bottom: 1px solid var(--line); }
.sheet-h h2 { font-family: var(--display); font-size: 1.35rem; margin: 0; }
.x { width: 48px; height: 48px; border-radius: 12px; border: 0; background: var(--surface-2); font-size: 1.4rem; }
.form { display: grid; gap: 18px; padding: 16px max(16px, env(safe-area-inset-right, 0px)) 8px max(16px, env(safe-area-inset-left, 0px)); }
.f { display: grid; gap: 8px; min-width: 0; }
.f > label, .f > .lab { font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.f .opt { text-transform: none; letter-spacing: 0; font-weight: 500; }
.in { width: 100%; min-height: 52px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); padding: 0 14px; font-size: 1.05rem; }
textarea.in { padding: 12px 14px; min-height: 80px; resize: vertical; }
.pick { display: flex; flex-wrap: wrap; gap: 8px; }
.pick .chip { min-height: 46px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 420px) { .two { grid-template-columns: 1fr; } }
.stepper { display: grid; grid-template-columns: 56px 1fr 56px; gap: 6px; }
.stepper button { min-height: 52px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); font-size: 1.5rem; font-weight: 700; }
.stepper input { text-align: center; font-variant-numeric: tabular-nums; font-weight: 700; padding: 0 4px; }
.seg.big { padding: 0; }
.seg.big button { min-height: 58px; font-size: 1.05rem; }
.hint { font-size: .85rem; color: var(--muted); }
.actions { display: grid; gap: 10px; padding: 8px max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px)); }
.btn { min-height: 56px; border-radius: 14px; border: 0; font-weight: 800; font-size: 1.1rem; }
.btn.primary { background: var(--accent); color: var(--accent-fg); }
.btn.ghost { background: transparent; color: var(--low); border: 2px solid var(--low-soft); }
.btn.danger { background: var(--low); color: #fff; }
.confirm { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.confirm p { grid-column: 1 / -1; margin: 4px 0 0; text-align: center; font-weight: 600; }
.err { color: var(--low); font-weight: 600; font-size: .9rem; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom, 0px) + 92px); z-index: 30; background: var(--fg); color: var(--bg); padding: 12px 18px; border-radius: 12px; font-weight: 600; max-width: calc(100% - 32px); display: flex; gap: 14px; align-items: center; }
.toast button { background: transparent; border: 0; color: var(--accent); font-weight: 800; min-height: 36px; }
:root[data-theme="dark"] .toast button { color: var(--accent); }
@media (prefers-reduced-motion: no-preference) { .card { transition: border-color .15s; } .seg button { transition: background .12s, color .12s; } }

/* ---------- self-hosted additions: sign-in, menu, staff, activity ---------- */
html, body { margin: 0; min-height: 100%; }
:root { padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
.login { max-width: 560px; margin: 0 auto; padding-block: 32px 48px; display: grid; gap: 20px; }
.login h1 { font-family: var(--display); font-weight: 800; font-size: 2.2rem; margin: 0; line-height: 1; }
.login h1 span { color: var(--accent); }
.login p { margin: 0; color: var(--muted); }
.names { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.name-tile { min-height: 72px; border-radius: 16px; border: 1.5px solid var(--line); background: var(--surface); font-weight: 700; font-size: 1.15rem; box-shadow: var(--shadow); overflow-wrap: anywhere; padding: 8px; }
.pinpad { display: grid; gap: 16px; justify-items: center; }
.pinpad .who-big { font-family: var(--display); font-size: 1.6rem; font-weight: 700; }
.dots { display: flex; gap: 14px; min-height: 22px; }
.dots i { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--muted); }
.dots i.on { background: var(--fg); border-color: var(--fg); }
.keys { display: grid; grid-template-columns: repeat(3, 84px); gap: 12px; }
.keys button { height: 72px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); font-size: 1.7rem; font-weight: 700; box-shadow: var(--shadow); font-variant-numeric: tabular-nums; }
.keys button.go { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); font-size: 1.1rem; }
.keys button.soft { background: var(--surface-2); box-shadow: none; font-size: 1.1rem; }
.linkbtn { background: none; border: 0; color: var(--accent); font-weight: 700; min-height: 44px; padding: 0 8px; }
.menu-btn { min-height: 44px; min-width: 44px; border-radius: 12px; border: 0; background: var(--surface-2); font-weight: 700; padding: 0 12px; display: inline-flex; align-items: center; gap: 8px; }
.menu { position: absolute; right: max(16px, env(safe-area-inset-right, 0px)); top: 56px; z-index: 8; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); display: grid; min-width: 220px; overflow: hidden; }
.menu button { min-height: 52px; border: 0; background: none; text-align: left; padding: 0 18px; font-weight: 600; font-size: 1rem; }
.menu button + button { border-top: 1px solid var(--line); }
.staff-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px 10px 16px; }
.staff-row .nm { font-weight: 700; font-size: 1.05rem; }
.staff-row .rl { font-size: .8rem; color: var(--muted); }
.staff-row.off { opacity: .55; }
.staff-row .btns { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.small-btn { min-height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); font-weight: 600; font-size: .9rem; }
.act { display: grid; gap: 2px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.act b { font-weight: 700; }
.act span { color: var(--muted); font-size: .85rem; }
.offline { position: fixed; left: 0; right: 0; top: 0; z-index: 40; background: var(--low); color: #fff; text-align: center; font-weight: 700; padding: calc(env(safe-area-inset-top, 0px) + 6px) 16px 6px; }
.brand { position: relative; }
.menu .menu-link { display: flex; align-items: center; min-height: 52px; padding: 0 18px; font-weight: 700; font-size: 1rem; color: var(--accent); text-decoration: none; border-bottom: 1px solid var(--line); }

/* Store picker (Gully Chaat, Karkhana…) */
.brand h1 b { font-weight: inherit; }
.store-pick { margin-left: auto; min-height: 44px; border-radius: 12px; border: 0; background: var(--surface-2); color: inherit; font: inherit; font-weight: 700; padding: 0 10px; max-width: 40vw; }

/* Clock in / clock out card (only for people on the team list) */
.clock { margin-top: 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--r); background: var(--surface); border: 1.5px solid var(--line); box-shadow: var(--shadow); }
.clock.on { border-color: var(--high); background: var(--high-soft); }
.clock-t { display: grid; flex: 1 1 200px; gap: 2px; }
.clock-t b { font-size: 1.1rem; }
.clock-t span { color: var(--muted); font-size: .92rem; }
.clock-b { flex: 0 0 auto; min-width: 150px; padding: 0 22px; }
.clock .pick { flex: 1 1 100%; }
.clock-tips { flex: 1 1 100%; display: grid; gap: 6px; font-weight: 700; }
.clock-tips .opt { font-weight: 500; color: var(--muted); }
.clock-btns { flex: 1 1 100%; display: flex; gap: 10px; }
.clock-btns .btn { flex: 1; background: var(--surface-2); }
.clock-btns .btn.primary { background: var(--accent); flex: 2; }
@media (max-width: 480px) { .clock-b { flex: 1 1 100%; } }
