/* Màu và kiểu chữ theo CLAUDE.md mục 6: nền kem, chữ đậm, nhấn cam, font Inter. */
:root {
  --bg: #F6F5F2; --surface: #FFFFFF; --surface-2: #EFEDE8; --ink: #1C1F23; --muted: #5F6670;
  --line: #E2DFD8; --accent: #C2410C; --accent-ink: #FFFFFF;
  --ok: #15803D; --ok-soft: #DCF2E3; --warn: #B45309; --warn-soft: #FBEFD5;
  --bad: #B91C1C; --bad-soft: #FBE0E0;
  --radius: 14px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.wrap { max-width: 440px; margin: 0 auto; padding: 24px 16px 96px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.h1 { font-size: 24px; font-weight: 800; margin: 0 0 4px; }
a { color: var(--accent); font-weight: 600; text-decoration: none; }

/* Đăng nhập */
.page-login .wrap { padding-top: 40px; }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 32px; }
.brand-mark {
  width: 48px; height: 48px; border-radius: 12px; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 18px; letter-spacing: .5px;
}
.brand-name { font-weight: 800; font-size: 18px; }
.brand-sub { color: var(--muted); font-size: 14px; }
.form { display: grid; gap: 16px; margin-top: 20px; }
.field { display: grid; gap: 6px; }
.field span { font-weight: 600; font-size: 14px; }
.field input {
  height: 56px; padding: 0 16px; font: inherit; font-size: 18px; color: var(--ink);
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 12px; width: 100%;
}
.field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(194,65,12,.15); }
.field input.pin { letter-spacing: 8px; font-size: 24px; }
.switch { text-align: center; margin: 24px 0 8px; }

/* Nút: cao ít nhất 44 px vì thợ có thể đeo găng */
.btn {
  display: block; width: 100%; min-height: 56px; border: 0; border-radius: 14px;
  font: inherit; font-weight: 800; font-size: 17px; letter-spacing: .3px; cursor: pointer;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:active { filter: brightness(.92); }
.btn-ghost { background: var(--surface-2); color: var(--ink); min-height: 48px; font-weight: 600; margin-top: 16px; }

.alert { padding: 12px 14px; border-radius: 12px; font-weight: 600; font-size: 15px; margin-top: 16px; }
.alert-bad { background: var(--bad-soft); color: var(--bad); }

/* Trang tạm của đợt 1 */
.hello { color: var(--muted); }
.name { font-size: 22px; font-weight: 800; }
.clock { font-size: 56px; font-weight: 800; letter-spacing: -1px; margin-top: 12px; font-variant-numeric: tabular-nums; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-top: 20px; }
.card p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.topbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.gear { width: 44px; height: 44px; display: grid; place-items: center; font-size: 22px;
        background: var(--surface); border: 1px solid var(--line); border-radius: 12px; color: var(--muted); }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: center;
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
}
.tabbar span, .tabbar a {
  flex: 1; max-width: 148px; text-align: center; padding: 12px 4px; min-height: 44px;
  font-size: 13px; font-weight: 600; color: var(--muted);
}
.tabbar .on { color: var(--accent); }

[hidden] { display: none !important; }
.alert-ok { background: var(--ok-soft); color: var(--ok); }
.h2 { font-size: 18px; font-weight: 800; margin: 28px 0 8px; }
.back { display: inline-block; padding: 8px 0; margin-bottom: 8px; }
.linkbtn { display: block; margin: 12px auto 0; background: none; border: 0; padding: 10px;
           font: inherit; font-weight: 600; color: var(--accent); cursor: pointer; }

/* Màn Chấm công (CLAUDE.md mục 6, màn 1–4) */
.shift { margin-bottom: 20px; }
.ps { padding: 14px 16px; border-radius: 12px; font-weight: 600; font-size: 15px; margin-top: 10px; }
.ps-ok { background: var(--ok-soft); color: var(--ok); }
.ps-bad { background: var(--bad-soft); color: var(--bad); }
.ps-wait { background: var(--surface-2); color: var(--muted); }
.btn-punch { min-height: 72px; font-size: 20px; letter-spacing: 1px; margin-top: 24px; }
.btn-dark { background: var(--ink); color: #fff; }
.btn:disabled { background: var(--line); color: var(--muted); cursor: not-allowed; }
.explain-link { margin-top: 20px; }
.thumb { display: block; width: 72px; height: 72px; object-fit: cover; border-radius: 12px; margin: 16px auto 0; }

.cam { position: fixed; inset: 0; background: #111; color: #fff; z-index: 10;
       display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; }
.cam-oval { width: 220px; height: 290px; border: 3px dashed rgba(255,255,255,.7); border-radius: 50%; }
.cam-note { text-align: center; color: #ccc; font-size: 14px; margin: 20px 0; }
.cam-shoot { width: 76px; height: 76px; border-radius: 50%; background: #fff; border: 6px solid #555; cursor: pointer; }
.cam-cancel { color: #ddd; }

/* Màn Lịch sử công (màn 5) */
.monthbar { display: flex; align-items: center; justify-content: space-between; margin: 12px 0 16px; }
.mbtn { width: 44px; height: 44px; display: grid; place-items: center; font-size: 22px;
        background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.mbtn.off { color: var(--line); }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
        padding: 14px 8px; text-align: center; }
.tile b { display: block; font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; }
.tile span { font-size: 12px; color: var(--muted); }
.days { margin-top: 16px; display: grid; gap: 8px; }
.day { display: flex; gap: 12px; background: var(--surface); border: 1px solid var(--line);
       border-radius: 12px; padding: 12px; }
.day-d { width: 44px; flex: none; text-align: center; }
.day-d b { display: block; }
.day-d span { font-size: 13px; color: var(--muted); }
.day-main { flex: 1; min-width: 0; }
.day-t { font-weight: 700; font-variant-numeric: tabular-nums; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.pill { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.p-ok { background: var(--ok-soft); color: var(--ok); }
.p-warn { background: var(--warn-soft); color: var(--warn); }
.p-bad { background: var(--bad-soft); color: var(--bad); }
.p-acc { background: #FCE7DA; color: var(--accent); }
.p-info { background: #DCEAFB; color: #1D4ED8; }
.p-mute { background: var(--surface-2); color: var(--muted); }

/* Màn quản lý (màn 6–7, Nhân viên, Cài đặt) */
.c-warn { color: var(--warn); } .c-bad { color: var(--bad); }
.alert-warn { background: var(--warn-soft); color: var(--warn); }
.flash { margin: 0 0 16px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 16px 0; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 4px; text-align: center; }
.stat b { display: block; font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--muted); }
.qcard { display: flex; justify-content: space-between; align-items: center; min-height: 52px;
         padding: 12px 16px; border-radius: 12px; margin-top: 8px; font-weight: 700; }
.q-o { background: #FCE7DA; color: var(--accent); }
.q-b { background: #DCEAFB; color: #1D4ED8; }
.q-y { background: var(--warn-soft); color: var(--warn); }
.row-link { color: inherit; font-weight: inherit; align-items: center; }
.pills.right { justify-content: flex-end; margin-top: 0; max-width: 55%; }
.qitem p { color: var(--ink); font-size: 15px; }
.qhead { display: flex; justify-content: space-between; gap: 8px; }
.trow { display: flex; gap: 10px; margin-top: 10px; }
.trow > * { flex: 1; min-width: 0; }
.trow input, .trow select, .qitem input { height: 48px; padding: 0 12px; font: inherit; width: 100%;
  border: 1.5px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); }
.btnrow { display: flex; gap: 10px; margin-top: 12px; }
.btnrow .btn { margin-top: 0; }
.btn-sm { min-height: 48px; font-size: 15px; }
.btn-link { display: grid; place-items: center; text-align: center; margin-top: 16px; }
.btncol { display: grid; gap: 0; }
.addbtn { width: auto; padding: 0 16px; display: grid; place-items: center; }
.tbl { width: 100%; border-collapse: collapse; margin-top: 12px; background: var(--surface);
       border: 1px solid var(--line); border-radius: 12px; overflow: hidden; font-size: 15px; }
.tbl th, .tbl td { padding: 12px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.tbl th { font-size: 12px; color: var(--muted); font-weight: 700; }
.tbl td a { display: block; }
.closing { display: flex; justify-content: space-between; align-items: center; gap: 10px;
           padding: 10px 0; border-top: 1px solid var(--line); margin-top: 10px; }
.closing .dl { width: auto; padding: 0 12px; margin: 0; display: grid; place-items: center; flex: none; }
.sheet { background: var(--surface); border-radius: 20px 20px var(--radius) var(--radius); padding: 20px 16px;
         border: 1px solid var(--line); }
.seg { display: flex; background: var(--surface-2); border-radius: 12px; padding: 4px; margin: 16px 0 0; }
.seg a { flex: 1; text-align: center; padding: 10px; border-radius: 9px; color: var(--muted); }
.seg a.on { background: var(--surface); color: var(--ink); }
.pinbox { text-align: center; border-color: var(--accent); }
.pin-big { font-size: 40px; font-weight: 800; letter-spacing: 8px; font-variant-numeric: tabular-nums; }
.sec summary { display: flex; justify-content: space-between; align-items: center; cursor: pointer;
               min-height: 32px; list-style: none; }
.sec summary::-webkit-details-marker { display: none; }
.sec[open] summary { margin-bottom: 12px; }
.sec form + form { margin-top: 12px; }
.checks ul { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0; }
.checks label { display: flex; align-items: center; gap: 4px; padding: 8px 10px; background: var(--surface-2);
                border-radius: 10px; font-weight: 600; min-height: 44px; }
.checkline { display: flex; align-items: center; gap: 10px; font-weight: 600; min-height: 44px; }
.checkline input { width: 22px; height: 22px; }
.field select { height: 56px; padding: 0 12px; font: inherit; border: 1.5px solid var(--line);
                border-radius: 12px; background: var(--surface); color: var(--ink); width: 100%; }
.hrow { display: flex; justify-content: space-between; align-items: center; padding: 6px 0;
        border-bottom: 1px solid var(--line); font-size: 15px; }
.linkbtn.inline { display: inline; margin: 0; padding: 8px; }
.thumb.sm { width: 56px; height: 56px; margin: 0; }

/* Hướng dẫn cài app */
.guide { margin-top: 12px; }
.steps { margin: 0; padding-left: 22px; display: grid; gap: 10px; }
.kbd { display: inline-block; padding: 0 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2); }

/* Form giải trình */
.field textarea { padding: 12px 16px; font: inherit; color: var(--ink); background: var(--surface);
                  border: 1.5px solid var(--line); border-radius: 12px; width: 100%; }
.err { color: var(--bad); font-style: normal; font-size: 14px; }
