:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --text: #17202a;
  --muted: #5f6b76;
  --line: #e3e7eb;
  --brand: #0f766e;
  --brand-ink: #ffffff;
  --ok: #15803d;
  --ok-bg: #e9f7ee;
  --warn: #a15c07;
  --warn-bg: #fff4e0;
  --empty: #b42318;
  --empty-bg: #fdecea;
  --off-bg: #eef0f3;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1418;
    --card: #182026;
    --text: #e7ecef;
    --muted: #9aa7b1;
    --line: #2a343c;
    --brand: #2dd4bf;
    --brand-ink: #062a26;
    --ok: #4ade80;
    --ok-bg: #12301f;
    --warn: #fbbf24;
    --warn-bg: #3a2a0c;
    --empty: #f87171;
    --empty-bg: #3a1716;
    --off-bg: #1d262d;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
.wrap { max-width: 640px; margin: 0 auto; padding: 0 16px; }
[hidden] { display: none !important; }

.top { background: var(--brand); color: var(--brand-ink); }
.top .wrap { display: flex; align-items: center; justify-content: space-between; min-height: 56px; }
.brand { font-weight: 700; font-size: 17px; }
.link { background: none; border: 0; color: inherit; font: inherit; text-decoration: underline; padding: 8px; cursor: pointer; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px; }
.login { margin-top: 24px; }
.login h1 { font-size: 22px; margin: 0 0 4px; }
.muted { color: var(--muted); margin: 0 0 16px; }
.hint { color: var(--muted); font-size: 14px; margin: 16px 0 0; }

label { display: block; font-weight: 600; margin-bottom: 6px; }
input#code {
  width: 100%; font-size: 24px; letter-spacing: 3px; text-transform: uppercase; text-align: center;
  padding: 12px; border: 2px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text);
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
}
input#code:focus { outline: none; border-color: var(--brand); }
.remember { display: flex; gap: 8px; align-items: center; font-weight: 400; margin: 12px 0 16px; color: var(--muted); }
.remember input { width: 20px; height: 20px; }
button#submit {
  width: 100%; padding: 14px; font-size: 17px; font-weight: 700; border: 0; border-radius: 10px;
  background: var(--brand); color: var(--brand-ink); cursor: pointer;
}
button#submit:disabled { opacity: .6; }
.error { color: var(--empty); background: var(--empty-bg); padding: 10px 12px; border-radius: 8px; margin: 12px 0 0; }

.who { padding: 18px 0 8px; }
.who-name { font-size: 20px; font-weight: 700; }
.who-sub { color: var(--muted); font-size: 14px; }

.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 4px; position: sticky; top: 0; z-index: 2; }
.tabs button { border: 0; background: none; color: var(--text); padding: 10px 4px; border-radius: 9px; font: inherit; font-weight: 600; cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--brand); color: var(--brand-ink); }

.summary { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; }
.pill { font-size: 14px; padding: 4px 10px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); }
.pill b { font-variant-numeric: tabular-nums; }

.day { background: var(--card); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; overflow: hidden; }
.day-head { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 14px 4px; }
.day-date { font-weight: 700; }
.day-date .wd { color: var(--muted); font-weight: 500; }
.day.today .day-date::after { content: "Hôm nay"; font-size: 12px; font-weight: 600; margin-left: 8px; padding: 1px 8px; border-radius: 999px; background: var(--brand); color: var(--brand-ink); }
.day.sunday { background: var(--off-bg); }
.day-empty { padding: 4px 14px 12px; color: var(--empty); font-size: 15px; }
.day.sunday .day-empty, .day.today .day-empty { color: var(--muted); }

.sess { border-top: 1px dashed var(--line); }
.sess:first-of-type { border-top: 0; }
.sess summary { list-style: none; cursor: pointer; padding: 6px 14px 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.sess summary::-webkit-details-marker { display: none; }
.span { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.span .plus { font-size: 13px; color: var(--warn); font-weight: 600; }
.meta { color: var(--muted); font-size: 14px; }
.chev { margin-left: auto; color: var(--muted); transition: transform .15s; }
.sess[open] .chev { transform: rotate(90deg); }
.tag { font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 999px; }
.tag.warn { color: var(--warn); background: var(--warn-bg); }
.tag.ok { color: var(--ok); background: var(--ok-bg); }

.punches { margin: 0; padding: 0 14px 12px; list-style: none; }
.punches li { display: flex; gap: 12px; padding: 4px 0; border-top: 1px solid var(--line); font-size: 15px; }
.punches .t { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 64px; }
.punches .d { color: var(--muted); }

.note { margin: 16px 0 40px; color: var(--muted); font-size: 14px; }
.note summary { cursor: pointer; font-weight: 600; color: var(--text); padding: 6px 0; }
.note ul { padding-left: 20px; margin: 6px 0; }
.loading { text-align: center; color: var(--muted); padding: 30px 0; }
