/* Painter Rewards — one stylesheet for all roles.
   Idea: a paint shade card. The reward total sits on a yellow paint chip; each brand carries its own colour strip. */

:root {
  --ink: #1b2a3a;
  --muted: #566676;
  --wall: #f4f6f7;
  --surface: #ffffff;
  --line: #dbe2e7;
  --teal: #0f5c6e;
  --teal-strong: #0a4553;
  --teal-soft: #e3eff1;
  --chip: #f2b705;
  --chip-ink: #1b2a3a;
  --valid: #1e7b4f;
  --used: #5f6b76;
  --expired: #a35a06;
  --wrong: #b42318;
  --focus: #1d6fd6;
  --radius-s: 6px;
  --radius-m: 10px;
  --shadow: 0 1px 2px rgba(27, 42, 58, .08);
  --font: "Hind Siliguri", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Bengali", sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e8edf1; --muted: #a3b1bd; --wall: #11181f; --surface: #1a232c; --line: #2c3945;
    --teal: #4fb3c7; --teal-strong: #7fcddc; --teal-soft: #17323a; --chip: #f2b705; --chip-ink: #1b2a3a;
    --valid: #4cc38a; --used: #a3b1bd; --expired: #f0a54a; --wrong: #ff7b6e; --focus: #7ab4ff;
    --shadow: none; color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--wall); color: var(--ink); font: 16px/1.5 var(--font); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--teal); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.hidden { display: none !important; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- top bar */
.bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; padding: 10px 16px;
  background: var(--surface); border-bottom: 1px solid var(--line); }
.bar .mark { width: 28px; height: 28px; flex: none; }
.bar h1 { font-size: 1.05rem; font-weight: 600; margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.iconbtn { border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-s); min-width: 44px; min-height: 44px; padding: 0 12px; cursor: pointer; }
.menu { position: absolute; right: 12px; top: 56px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m);
  box-shadow: 0 8px 24px rgba(0,0,0,.14); min-width: 220px; padding: 6px; z-index: 10; }
.menu button { display: block; width: 100%; text-align: left; padding: 12px; border: 0; background: none; border-radius: var(--radius-s); cursor: pointer; }
.menu button:hover { background: var(--teal-soft); }

main { max-width: 640px; margin: 0 auto; padding: 16px 16px 48px; }
main.wide { max-width: 1180px; }

/* ---------- forms */
.field { display: block; margin: 0 0 16px; }
.field > span { display: block; font-weight: 600; margin-bottom: 6px; }
.field small { display: block; color: var(--muted); margin-top: 4px; }
input[type=text], input[type=password], input[type=date], input[type=search], input[type=number], select, textarea {
  width: 100%; min-height: 48px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface); }
textarea { min-height: 120px; }
.pw { position: relative; }
.pw button { position: absolute; right: 4px; top: 4px; height: 40px; border: 0; background: none; color: var(--teal); padding: 0 10px; cursor: pointer; font-weight: 600; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border-radius: var(--radius-s);
  border: 1px solid var(--teal); background: var(--teal); color: #fff; font-weight: 600; cursor: pointer; }
.btn:hover { background: var(--teal-strong); }
.btn.secondary { background: transparent; color: var(--teal); }
.btn.danger { background: var(--wrong); border-color: var(--wrong); }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: .9rem; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; }
.row > * { flex: 1 1 160px; }
.msg { padding: 12px 14px; border-radius: var(--radius-s); margin: 0 0 16px; border-left: 4px solid; background: var(--surface); }
.msg.error { border-color: var(--wrong); }
.msg.warn { border-color: var(--expired); }
.msg.ok { border-color: var(--valid); }
.msg.info { border-color: var(--teal); }

/* ---------- sign-in */
.signin { max-width: 420px; margin: 0 auto; padding: 32px 16px 48px; }
.signin .brandline { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.signin .brandline svg { width: 44px; height: 44px; }
.signin h1 { font-size: 1.6rem; line-height: 1.2; margin: 0; }
.signin .lang { margin-left: auto; }
.signin .help { margin-top: 20px; color: var(--muted); font-size: .9rem; }

/* ---------- period picker */
.periods { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; margin: 0 -2px 8px; scrollbar-width: none; }
.periods button { flex: none; min-height: 40px; padding: 0 14px; border-radius: 20px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; white-space: nowrap; }
.periods button[aria-pressed=true] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.custom { display: flex; gap: 8px; align-items: end; margin-bottom: 12px; flex-wrap: wrap; }
.custom label { flex: 1 1 130px; }
.custom label span { display: block; font-size: .85rem; color: var(--muted); }
.period-line { font-size: .95rem; color: var(--muted); margin: 0 0 12px; }

/* ---------- the paint chip (hero) */
.chipcard { display: grid; grid-template-rows: 1fr auto; background: var(--chip); color: var(--chip-ink); border-radius: var(--radius-m);
  min-height: 190px; overflow: hidden; box-shadow: var(--shadow); }
.chipcard .top { padding: 18px 18px 8px; }
.chipcard .label { font-weight: 600; font-size: .95rem; }
.chipcard .amount { font-size: clamp(2.4rem, 11vw, 3.6rem); font-weight: 700; line-height: 1.05; letter-spacing: -.01em; margin-top: 6px; }
.chipcard .foot { background: rgba(255,255,255,.55); padding: 10px 18px; display: flex; justify-content: space-between; gap: 12px; font-size: .95rem; }
.chipcard .foot b { font-weight: 700; }
.chipcard.empty .amount { font-size: 2rem; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0 20px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 10px 12px; }
.stat b { display: block; font-size: 1.35rem; line-height: 1.2; }
.stat span { font-size: .82rem; color: var(--muted); }

/* ---------- tabs */
.tabs { display: flex; border-bottom: 1px solid var(--line); margin: 8px 0 12px; overflow-x: auto; }
.tabs button { flex: none; min-height: 46px; padding: 0 16px; border: 0; border-bottom: 3px solid transparent; background: none; cursor: pointer; font-weight: 600; color: var(--muted); }
.tabs button[aria-selected=true] { color: var(--ink); border-bottom-color: var(--teal); }

/* ---------- brand shade strips */
.brands { list-style: none; margin: 0; padding: 0; }
.brand { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s); margin-bottom: 8px; overflow: hidden; }
.brand > button { display: grid; grid-template-columns: 12px 1fr auto; gap: 12px; align-items: center; width: 100%; padding: 0 14px 0 0; min-height: 64px;
  border: 0; background: none; text-align: left; cursor: pointer; }
.brand .strip { align-self: stretch; background: var(--sw); }
.brand .name { font-weight: 600; line-height: 1.3; padding: 10px 0; }
.brand .name small { display: block; font-weight: 400; color: var(--muted); }
.brand .val { text-align: right; font-weight: 700; }
.brand .val small { display: block; font-weight: 400; color: var(--muted); }
.packs { border-top: 1px solid var(--line); padding: 4px 14px 8px 26px; }
.pack { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.pack:last-child { border-bottom: 0; }
.pack .p { font-weight: 600; }

/* ---------- transactions */
.txns { list-style: none; margin: 0; padding: 0; }
.txn { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s);
  padding: 10px 12px; margin-bottom: 6px; }
.txn .what { font-weight: 600; line-height: 1.3; }
.txn .when { font-size: .85rem; color: var(--muted); }
.txn .amt { text-align: right; font-weight: 700; }
.txn .amt small { display: block; font-weight: 400; font-size: .8rem; color: var(--muted); }
.status { display: inline-block; font-size: .78rem; font-weight: 600; padding: 1px 8px; border-radius: 10px; border: 1px solid currentColor; }
.status.valid { color: var(--valid); } .status.used { color: var(--used); } .status.expired { color: var(--expired); } .status.wrong { color: var(--wrong); } .status.other { color: var(--muted); }
.txn.dim .amt { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1px; }

.footnote { margin-top: 24px; font-size: .85rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: 12px; }
.footnote p { margin: 2px 0; }
.empty { text-align: center; padding: 32px 16px; color: var(--muted); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius-m); }
.loading { padding: 28px; text-align: center; color: var(--muted); }
.loading::before { content: ""; display: inline-block; width: 18px; height: 18px; margin-right: 10px; vertical-align: -3px; border: 3px solid var(--line);
  border-top-color: var(--teal); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- staff layouts */
.staff { display: grid; grid-template-columns: 220px 1fr; gap: 24px; }
.side { position: sticky; top: 72px; align-self: start; }
.side button { display: block; width: 100%; text-align: left; padding: 10px 12px; min-height: 44px; border: 0; border-radius: var(--radius-s); background: none; cursor: pointer; font-weight: 600; color: var(--muted); }
.side button[aria-current=page] { background: var(--surface); color: var(--ink); box-shadow: inset 3px 0 0 var(--teal); }
.side select { display: none; }
@media (max-width: 820px) {
  .staff { grid-template-columns: 1fr; gap: 8px; }
  .side { position: static; }
  .side button { display: none; }
  .side select { display: block; }
}
h2 { font-size: 1.35rem; margin: 4px 0 16px; }
h3 { font-size: 1.05rem; margin: 24px 0 10px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 16px; margin-bottom: 16px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 12px; }
.kpi b { display: block; font-size: 1.4rem; line-height: 1.2; }
.kpi span { font-size: .85rem; color: var(--muted); }
.kpi.accent { background: var(--chip); color: var(--chip-ink); border-color: var(--chip); }
.kpi.accent span { color: var(--chip-ink); }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: .93rem; }
th, td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-weight: 600; background: var(--wall); position: sticky; top: 0; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--teal-soft); }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.progress { height: 10px; background: var(--line); border-radius: 5px; overflow: hidden; margin: 8px 0; }
.progress > i { display: block; height: 100%; background: var(--teal); width: 0; transition: width .2s; }
.list-plain { margin: 0; padding-left: 20px; }
.checks { max-height: 280px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-s); padding: 6px 10px; background: var(--surface); }
.checks label { display: flex; gap: 10px; align-items: center; padding: 6px 0; }
dialog { border: 0; border-radius: var(--radius-m); padding: 20px; max-width: 440px; width: calc(100% - 32px); background: var(--surface); color: var(--ink); }
dialog::backdrop { background: rgba(10, 20, 30, .5); }
.secret { font: 600 1.6rem/1.2 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .08em; padding: 12px; background: var(--wall); border-radius: var(--radius-s); text-align: center; user-select: all; }
.offline { position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 20; }
