:root {
  --ink: #23305e; --ink-soft: #3d4f8f; --bg: #f6f3ec; --surface: #fff; --muted: #efebe2; --line: #e3ded3;
  --text: #1c1f26; --text-2: #6b6f7a; --working: #1e9e6a; --break: #d9811a; --out: #c8473a; --done: #3d4f8f;
  --font: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", Meiryo, system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 var(--font); -webkit-user-select: none; user-select: none; }
button { font: inherit; cursor: pointer; }
.hidden { display: none !important; }
.sr { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }

.kiosk { min-height: 100vh; display: flex; flex-direction: column; }
.k-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; padding: 24px 36px 12px; }
.k-store { font-weight: 700; color: var(--text-2); }
.k-date { font-size: 22px; font-weight: 600; }
.k-clock { font-size: 88px; font-weight: 800; color: var(--ink); line-height: 1.05; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.k-sec { font-size: 34px; color: var(--text-2); font-weight: 600; margin-left: 4px; }
.k-side { display: flex; flex-direction: column; align-items: flex-end; gap: 14px; }
.k-admin { color: var(--text-2); text-decoration: none; font-size: 13px; font-weight: 700; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); }
.k-chips { display: flex; gap: 8px; }
.chip { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; font-size: 14px; font-weight: 600; color: var(--text-2); }
.chip b { font-size: 20px; margin-right: 2px; }
.c-working { color: var(--working); } .c-break { color: var(--break); }
.k-offline { margin: 0 36px 12px; padding: 12px 16px; border-radius: 12px; background: #fbeeec; color: #9c3227; font-weight: 700; }

.k-grid { flex: 1; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; padding: 8px 36px 100px; align-content: start; }
.card { position: relative; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 18px 18px 16px; box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 6px 18px rgba(0,0,0,.05); transition: transform .12s, box-shadow .12s; overflow: hidden; color: var(--text); }
.card:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(0,0,0,.05), 0 10px 24px rgba(0,0,0,.08); }
.card:active { transform: scale(.98); }
.card:focus-visible { outline: 3px solid var(--ink-soft); outline-offset: 2px; }
.card::before { content: ""; position: absolute; left: 0; top: 18px; bottom: 18px; width: 5px; border-radius: 0 4px 4px 0; background: transparent; }
.card.working::before { background: var(--working); }
.card.break::before { background: var(--break); }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.av { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 22px; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; background: var(--muted); color: var(--text-2); }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.working { color: var(--working); background: #e3f4ec; }
.badge.break { color: var(--break); background: #fbf0e1; }
.badge.done { color: var(--done); background: #e8ebf6; }
.c-name { font-size: 20px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-detail { color: var(--text-2); font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c0 { background: #3d5a98; } .c1 { background: #c2554a; } .c2 { background: #2f8f6f; } .c3 { background: #b07a2a; }
.c4 { background: #7a4e9e; } .c5 { background: #2b7fa6; } .c6 { background: #a34771; } .c7 { background: #5c6b2e; }
.k-empty { text-align: center; color: var(--text-2); font-size: 18px; padding: 60px; }
.k-hint { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: rgba(255,255,255,.85); backdrop-filter: blur(8px); border: 1px solid var(--line); padding: 10px 20px; border-radius: 999px; color: var(--text-2); font-weight: 600; white-space: nowrap; }

/* Hộp thoại */
.modal { position: fixed; inset: 0; background: rgba(20, 24, 40, .45); display: grid; place-items: center; padding: 20px; z-index: 10; animation: fade .15s; }
.sheet { position: relative; background: var(--bg); border-radius: 24px; width: 100%; max-width: 420px; padding: 28px 28px 24px; box-shadow: 0 20px 60px rgba(0,0,0,.25); animation: pop .18s; }
.m-close { position: absolute; top: 12px; right: 12px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--muted); font-size: 24px; color: var(--text-2); }
.m-person { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.m-avatar { width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 26px; }
.m-name { font-size: 24px; font-weight: 800; }
.m-status { color: var(--text-2); font-size: 14px; }
.m-lead { text-align: center; font-weight: 700; margin: 4px 0 12px; font-size: 18px; }
.dots { display: flex; justify-content: center; gap: 12px; height: 20px; margin-bottom: 18px; }
.dots span { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(35,48,94,.45); }
.dots span.on { background: var(--ink); border-color: var(--ink); }
.dots.shake { animation: shake .4s; }
.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.pad button { height: 64px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); font-size: 28px; font-weight: 700; color: var(--text); }
.pad button:active { background: var(--muted); }
.pad button.sub { font-size: 16px; color: var(--text-2); background: transparent; }
.ok-btn { width: 100%; margin-top: 14px; height: 58px; border: 0; border-radius: 16px; background: var(--ink); color: #fff; font-size: 20px; font-weight: 800; }
.ok-btn[disabled] { opacity: .4; }
.m-error { min-height: 24px; margin: 10px 0 0; text-align: center; color: var(--out); font-weight: 700; }
.acts { display: grid; gap: 12px; }
.acts button { height: 84px; border: 0; border-radius: 20px; color: #fff; font-size: 28px; font-weight: 800; box-shadow: 0 4px 14px rgba(0,0,0,.12); }
.acts .in { background: linear-gradient(135deg, #25b47a, #1a8a5c); }
.acts .out { background: linear-gradient(135deg, #de5a4c, #b33b2f); }
.acts .break_start, .acts .break_end { background: linear-gradient(135deg, #eb9a35, #c7710f); }

/* Màn kết quả */
.result { position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: #fff; text-align: center; animation: fade .2s; cursor: pointer; padding: 24px; }
.result.in { background: var(--working); } .result.out { background: var(--out); } .result.break_start, .result.break_end { background: var(--break); }
.r-check { width: 140px; height: 140px; border-radius: 50%; background: rgba(255,255,255,.18); display: grid; place-items: center; font-size: 72px; font-weight: 800; animation: pop .35s; }
.r-label { font-size: 26px; font-weight: 700; opacity: .92; }
.r-time { font-size: 104px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.r-name { font-size: 34px; font-weight: 800; margin-top: 6px; }
.r-greet { font-size: 22px; }
.r-worked { margin-top: 8px; padding: 8px 18px; border-radius: 999px; background: rgba(255,255,255,.2); font-weight: 700; font-size: 18px; }

.notice { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.notice-card { max-width: 480px; text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 36px; }
.notice-card h1 { font-size: 22px; }
.notice-card p { color: var(--text-2); }
.big-btn { display: inline-block; margin-top: 10px; background: var(--ink); color: #fff; text-decoration: none; padding: 12px 28px; border-radius: 14px; font-weight: 800; }

@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(.85); opacity: 0; } }
@keyframes shake { 20%, 60% { transform: translateX(-10px); } 40%, 80% { transform: translateX(10px); } }

@media (max-width: 700px) {
  .k-head { padding: 16px 16px 8px; }
  .k-clock { font-size: 56px; } .k-sec { font-size: 22px; } .k-date { font-size: 16px; }
  .k-grid { padding: 8px 16px 90px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .k-hint { font-size: 13px; }
  .r-time { font-size: 72px; }
}
