:root {
  --brand: #0f9d76; --brand-d: #0b7d5e; --brand-l: #e4f5ef;
  --bg: #f4f6f5; --card: #ffffff; --ink: #14201b; --muted: #66756e; --line: #e3e8e5;
  --warn: #c2700a; --warn-l: #fff4e2; --bad: #d13a3a; --bad-l: #fdecec; --ok: #0f9d76;
  --radius: 14px; --shadow: 0 1px 2px rgba(16, 40, 30, .06), 0 4px 16px rgba(16, 40, 30, .05);
  --nav-h: 64px;
  /* Thang cỡ chữ – chỉ dùng các cỡ này (điện thoại: 12 · 13 · 15 · 17 · 20 · 24px; web nhỏ hơn 1 bậc theo cỡ gốc) */
  --fs-xs: .75rem; --fs-sm: .8125rem; --fs-base: .9375rem; --fs-md: 1.0625rem; --fs-lg: 1.25rem; --fs-xl: 1.5rem;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1412; --card: #161f1b; --ink: #e7eeea; --muted: #93a29b; --line: #26322d;
    --brand-l: #12322a; --warn-l: #3a2a10; --bad-l: #3a1717; --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1412; --card: #161f1b; --ink: #e7eeea; --muted: #93a29b; --line: #26322d;
  --brand-l: #12322a; --warn-l: #3a2a10; --bad-l: #3a1717; --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: Inter, Roboto, 'Helvetica Neue', Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.45;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
body.no-scroll { overflow: hidden; }
a { color: var(--brand); text-decoration: none; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.25; }
h1 { font-size: var(--fs-lg); font-weight: 700; letter-spacing: -.01em; }
h3 { font-size: var(--fs-md); font-weight: 700; }
h4 { font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 1.2em 0 .6em; }
small { font-size: var(--fs-sm); }
code { font-family: ui-monospace, Menlo, monospace; font-size: .9em; }
.muted { color: var(--muted); }
.block { display: block; }
.center { text-align: center; }
.grow { flex: 1; min-width: 0; }
.txt-warn { color: var(--warn); font-style: normal; }
.txt-bad { color: var(--bad); }
.danger-txt { color: var(--bad) !important; }

/* ---------- Buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  border: 1px solid transparent; border-radius: 10px; padding: .6em 1.05em; min-height: 42px;
  font: inherit; font-weight: 600; cursor: pointer; background: var(--card); color: var(--ink);
  transition: transform .06s, background .15s, opacity .15s; white-space: nowrap;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-d); }
.btn.danger { background: var(--bad); color: #fff; }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.ghost:hover { background: var(--brand-l); }
.btn.sm { min-height: 34px; padding: .35em .8em; font-size: var(--fs-sm); }
.btn.lg { min-height: 52px; font-size: var(--fs-md); }
.btn.xl { min-height: 72px; font-size: var(--fs-lg); border-radius: 16px; }
.btn.block { width: 100%; margin-top: .6rem; }
.icon-btn { border: 0; background: none; color: var(--muted); font-size: var(--fs-md); cursor: pointer; padding: .3em .5em; border-radius: 8px; }
.icon-btn:hover { background: var(--bg); color: var(--ink); }

input, select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--card);
  border: 1px solid var(--line); border-radius: 10px; padding: .6em .75em; min-height: 42px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: transparent; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset:disabled { opacity: .75; }
.field { display: block; margin-bottom: .85rem; }
.field > span { display: block; font-size: var(--fs-sm); font-weight: 600; color: var(--muted); margin-bottom: .3rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 .9rem; }
.grid2.top { align-items: start; gap: 1rem; }
.span2 { grid-column: 1 / -1; }
.hint { font-size: var(--fs-sm); color: var(--muted); background: var(--brand-l); border-radius: 10px; padding: .6em .8em; margin: .6rem 0; }
details { border-top: 1px solid var(--line); padding: .7rem 0 .2rem; }
summary { font-weight: 700; cursor: pointer; margin-bottom: .7rem; color: var(--ink); }
.switch { display: flex; align-items: center; gap: .7rem; margin: .6rem 0; cursor: pointer; }
.switch input { display: none; }
.switch span { width: 44px; height: 26px; background: var(--line); border-radius: 99px; position: relative; flex: none; transition: .2s; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { left: 21px; }

/* ---------- Layout ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: .8rem;
  padding: .6rem 16px; padding-top: max(.6rem, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--card) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 700; font-size: var(--fs-md); color: var(--ink); }
.logo { display: inline-block; flex: none; width: 30px; height: 30px; border-radius: 8px; font-size: 0; color: transparent; overflow: hidden;
  background: var(--brand) url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20512%20512%22%3E%3Cpath%20d%3D%22M112%20296l78%2078%20140-160%22%20fill%3D%22none%22%20stroke%3D%22%23fff%22%20stroke-width%3D%2262%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3Ccircle%20cx%3D%22394%22%20cy%3D%22146%22%20r%3D%2240%22%20fill%3D%22%23ffd166%22%2F%3E%3C%2Fsvg%3E") center / 100% no-repeat; }
.logo.big { width: 64px; height: 64px; border-radius: 15px; }
.store { flex: 1; text-align: right; color: var(--muted); font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--brand-l); color: var(--brand-d); font-weight: 700; font-size: var(--fs-sm); cursor: pointer; flex: none; }
.avatar.lg { width: 48px; height: 48px; display: grid; place-items: center; font-size: var(--fs-md); }

.page { max-width: 640px; margin: 0 auto; padding: 1rem 16px calc(var(--nav-h) + 1.5rem + env(safe-area-inset-bottom)); }
.page.wide { max-width: 1180px; }
.page-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .9rem; flex-wrap: wrap; }
.page-head h1 { flex: 1 1 auto; margin: 0; white-space: nowrap; }
.page-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; display: flex; justify-content: center;
  background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.bottomnav a { flex: 1; max-width: 140px; height: var(--nav-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); font-size: var(--fs-xs); font-weight: 600; }
.bottomnav a .ico { font-size: var(--fs-lg); filter: grayscale(1); opacity: .7; }
.bottomnav a.active { color: var(--brand); }
.bottomnav a.active .ico { filter: none; opacity: 1; }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem; margin-bottom: 1rem; border: 1px solid var(--line); }
.card.error { color: var(--bad); background: var(--bad-l); }
.card.list { padding: .3rem 1rem; }

.loading { display: flex; align-items: center; justify-content: center; gap: .6rem; padding: 3rem 1rem; color: var(--muted); }
.loading.full { min-height: 100vh; }
.spin { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--brand); animation: spin .8s linear infinite; display: inline-block; }
.spin.sm { width: 12px; height: 12px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.center-msg { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 2rem 16px; gap: .4rem; }
.empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.empty-ico { font-size: 2.2rem; }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem 16px;
  background: radial-gradient(1200px 500px at 50% -10%, var(--brand-l), transparent 70%), var(--bg); }
.auth-card { width: 100%; max-width: 400px; background: var(--card); border-radius: 20px; padding: 1.6rem 1.3rem; box-shadow: var(--shadow); border: 1px solid var(--line); }
.auth-brand { text-align: center; margin-bottom: 1.2rem; }
.auth-brand h1 { margin: .5rem 0 0; font-size: 1.6rem; }
.auth-brand p { margin: 0; color: var(--muted); }
.tabs { display: flex; background: var(--bg); padding: 4px; border-radius: 12px; margin-bottom: 1.1rem; }
.tabs button { flex: 1; border: 0; background: none; font: inherit; font-weight: 600; color: var(--muted); padding: .55em; border-radius: 9px; cursor: pointer; }
.tabs button.active { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.tabs.inline { max-width: 360px; }

/* ---------- Chấm công ---------- */
.clock-card { text-align: center; padding: 1.4rem 1rem; }
.clock { font-size: 3rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.pill { display: inline-flex; align-items: center; gap: .4rem; margin-top: .7rem; padding: .3em .8em; border-radius: 99px; background: var(--bg); font-size: var(--fs-sm); font-weight: 600; color: var(--muted); }
.pill.ok { background: var(--brand-l); color: var(--brand-d); }
.pill.warn { background: var(--warn-l); color: var(--warn); }
.pill.sm { margin: 0 0 0 .3rem; font-size: var(--fs-xs); }
.checkin-card { border: 2px solid var(--brand); }
.checkin-card.is-out { border-color: var(--warn); }
.checkin-card.is-out .btn.primary { background: var(--warn); }
.qr-guide { display: flex; gap: .8rem; align-items: flex-start; }
.qr-guide p { margin: .2rem 0 0; font-size: var(--fs-base); }
.qr-ico { font-size: 2rem; line-height: 1; color: var(--brand); }
.code-form { display: grid; grid-template-columns: 1fr auto; gap: .5rem; margin-top: .9rem; }
.code-form input { font-size: var(--fs-xl); letter-spacing: .35em; text-align: center; font-weight: 700; min-height: 52px; font-variant-numeric: tabular-nums; }
.result { display: flex; gap: .9rem; align-items: center; border: 0; color: #fff; background: var(--brand); animation: pop .35s ease; }
.result.out { background: #1f6f8b; }
.result p { margin: .15rem 0 0; opacity: .95; font-size: var(--fs-base); }
.result .txt-warn { color: #ffe2a8; }
.result-ico { width: 44px; height: 44px; flex: none; display: grid; place-items: center; border-radius: 50%; background: rgba(255,255,255,.2); font-size: var(--fs-xl); font-weight: 700; }
@keyframes pop { from { transform: scale(.95); opacity: 0; } }

.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { display: inline-flex; align-items: center; gap: .3rem; padding: .25em .7em; border-radius: 99px; font-size: var(--fs-sm); font-weight: 600;
  background: color-mix(in srgb, var(--c, var(--brand)) 14%, transparent); color: color-mix(in srgb, var(--c, var(--brand)) 80%, var(--ink)); }
.timeline { list-style: none; padding: 0; margin: .8rem 0 0; }
.timeline li { padding: .45rem 0; border-top: 1px dashed var(--line); font-size: var(--fs-base); }
.timeline .sep { color: var(--muted); margin: 0 .3rem; }
.timeline em { margin-left: .3rem; font-size: var(--fs-sm); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: .45rem; vertical-align: middle; background: var(--brand); }
.dot.out { background: var(--muted); }

.scanner { position: fixed; inset: 0; z-index: 60; background: #000; display: grid; place-items: center; }
.scanner video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scan-frame { position: relative; width: min(70vw, 280px); aspect-ratio: 1; border: 3px solid #fff; border-radius: 20px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.45); }
.scanner .btn { position: absolute; bottom: calc(2rem + env(safe-area-inset-bottom)); color: #fff; border-color: #fff8; }
.scanner p { position: absolute; top: calc(2rem + env(safe-area-inset-top)); color: #fff; margin: 0; }

/* ---------- Danh sách / thống kê ---------- */
.week-nav { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .9rem; }
.day-list .day-row, .list-row { display: flex; align-items: center; gap: .9rem; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.day-list { background: var(--card); border-radius: var(--radius); padding: 0 1rem; border: 1px solid var(--line); }
.day-row:last-child, .list-row:last-child { border-bottom: 0; }
.day-row.today .day-label b { color: var(--brand); }
.day-label { width: 44px; flex: none; text-align: center; }
.day-label b { display: block; }
.day-label small { color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: .7rem; margin-bottom: 1rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; }
.stat small { color: var(--muted); font-weight: 600; }
.stat b { display: block; font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat.ok b { color: var(--ok); } .stat.warn b { color: var(--warn); } .stat.bad b { color: var(--bad); }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .7rem; margin-bottom: 1rem; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; color: var(--ink); display: flex; flex-direction: column; gap: .15rem; transition: transform .1s, border-color .15s; }
.tile:hover { border-color: var(--brand); transform: translateY(-1px); }
.tile-ico { font-size: var(--fs-xl); margin-bottom: .3rem; }
.tile small { color: var(--muted); }

.filters { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .9rem; }
.filters > * { flex: 1 1 160px; width: auto; }
.table-wrap { padding: 0; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-base); }
.table th { text-align: left; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; padding: .7rem .8rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: .65rem .8rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.clickable { cursor: pointer; }
.clickable:hover td { background: var(--brand-l); }
.badge { background: var(--brand-l); color: var(--brand-d); border-radius: 6px; padding: 0 .4em; font-weight: 700; }
.status { font-weight: 700; font-size: var(--fs-sm); }
.status.active { color: var(--ok); } .status.probation { color: #2563eb; } .status.paused { color: var(--warn); } .status.quit { color: var(--muted); }

/* ---------- Ca & lịch ---------- */
.shift-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .8rem; }
.shift-card { text-align: left; font: inherit; color: inherit; cursor: pointer; border-left: 6px solid var(--c); margin: 0; }
.shift-card.inactive { opacity: .55; }
.shift-name { font-weight: 700; }
.shift-time { font-size: var(--fs-xl); font-weight: 700; margin: .2rem 0; font-variant-numeric: tabular-nums; }
.swatches { display: flex; gap: .5rem; flex-wrap: wrap; }
.swatches input { display: none; }
.swatches i { display: block; width: 32px; height: 32px; border-radius: 50%; cursor: pointer; border: 3px solid transparent; }
.swatches input:checked + i { border-color: var(--ink); }
.legend { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .8rem; }
.sched { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 760px; font-size: var(--fs-sm); }
.sched th, .sched td { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); padding: .45rem; }
.sched th { font-size: var(--fs-sm); color: var(--muted); font-weight: 700; text-align: center; background: var(--card); }
.sched th small { display: block; font-weight: 500; }
.sched th.today { color: var(--brand); }
.sched .sticky { position: sticky; left: 0; background: var(--card); z-index: 1; min-width: 140px; text-align: left; }
.sched td.cell { cursor: pointer; vertical-align: top; min-width: 86px; }
.sched td.cell:hover { background: var(--brand-l); }
.sched td.today { background: color-mix(in srgb, var(--brand-l) 50%, transparent); }
.mini { display: block; margin-bottom: 3px; padding: .15em .45em; border-radius: 6px; font-size: var(--fs-xs); font-weight: 600; color: #fff; background: var(--c); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plus { color: var(--line); font-size: var(--fs-md); display: block; text-align: center; }
.check-list { display: grid; gap: .3rem; max-height: 50vh; overflow: auto; }
.check-list.cols { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); max-height: 34vh; }
.check-row { display: flex; align-items: center; gap: .6rem; padding: .45rem .5rem; border-radius: 8px; cursor: pointer; }
.check-row:hover { background: var(--bg); }
.check-row input, .day-picks input { width: 18px; height: 18px; min-height: 0; flex: none; accent-color: var(--brand); }
.day-picks { display: grid; grid-template-columns: repeat(7, 1fr); gap: .3rem; }
.day-picks label { display: flex; flex-direction: column; align-items: center; gap: .15rem; padding: .4rem .2rem; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.day-picks small { color: var(--muted); font-size: var(--fs-xs); }

/* ---------- Thiết lập ---------- */
.ip-list { list-style: none; padding: 0; margin: .4rem 0 .6rem; }
.ip-list li { display: flex; align-items: center; justify-content: space-between; padding: .45rem .1rem; border-bottom: 1px solid var(--line); }
.inline-form { display: flex; gap: .5rem; margin-top: .6rem; }
.inline-form input { flex: 1; }

/* ---------- Modal / sheet / toast ---------- */
.modal-wrap, .sheet-wrap { position: fixed; inset: 0; z-index: 50; background: rgba(10, 20, 15, .45); display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--card); width: 100%; max-width: 520px; max-height: 92vh; display: flex; flex-direction: column; border-radius: 20px 20px 0 0; animation: up .2s ease; }
.modal.wide { max-width: 720px; }
@keyframes up { from { transform: translateY(30px); opacity: .5; } }
.modal header { display: flex; align-items: center; padding: 1rem 1rem .4rem; }
.modal header h3 { flex: 1; margin: 0; font-size: var(--fs-md); }
.modal-body { padding: .4rem 1rem; overflow-y: auto; }
.modal footer { display: flex; gap: .5rem; padding: .8rem 1rem calc(.8rem + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.spacer { flex: 1; }
.sheet { background: var(--card); width: 100%; max-width: 420px; border-radius: 20px 20px 0 0; padding: 1.2rem 1rem calc(1.2rem + env(safe-area-inset-bottom)); animation: up .2s ease; }
.sheet-user { display: flex; gap: .8rem; align-items: center; margin-bottom: .6rem; }
.sheet-user small { display: block; color: var(--muted); }
#toasts { position: fixed; z-index: 80; left: 50%; transform: translateX(-50%); top: calc(12px + env(safe-area-inset-top)); display: flex; flex-direction: column; gap: .5rem; width: min(92vw, 420px); pointer-events: none; }
.toast { background: var(--ink); color: var(--card); padding: .75em 1em; border-radius: 12px; font-weight: 600; font-size: var(--fs-base); box-shadow: 0 8px 24px rgba(0,0,0,.18); transition: opacity .3s, transform .3s; }
.toast.ok { background: var(--brand); color: #fff; }
.toast.err { background: var(--bad); color: #fff; }
.toast.hide { opacity: 0; transform: translateY(-8px); }

/* ---------- Kiosk ---------- */
.kiosk { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.kiosk header { display: flex; align-items: center; gap: 1rem; padding: 1rem 16px; flex-wrap: wrap; }
.k-store { flex: 1; font-size: var(--fs-lg); font-weight: 700; text-align: center; }
.k-actions { display: flex; gap: .5rem; }
.k-main { flex: 1; display: grid; grid-template-columns: 1fr 320px; gap: 1.5rem; padding: 0 16px 1.5rem; align-items: center; }
.k-qr { background: #fff; color: #14201b; border-radius: 24px; padding: 1.5rem; text-align: center; box-shadow: var(--shadow); justify-self: center; width: 100%; max-width: 520px; }
.k-qr canvas { max-width: 100%; height: auto !important; }
.k-code { font-size: 2.6rem; font-weight: 700; letter-spacing: .2em; font-variant-numeric: tabular-nums; margin-top: .4rem; }
.k-bar { height: 6px; background: #e3e8e5; border-radius: 99px; overflow: hidden; margin: .6rem auto; max-width: 300px; }
.k-bar i { display: block; height: 100%; background: var(--brand); transition: width .25s linear; }
.k-qr p { color: #66756e; margin: .4rem 0 0; }
.k-side { background: var(--card); border-radius: 20px; padding: 1.2rem; border: 1px solid var(--line); align-self: stretch; }
.k-clock { font-size: 3.4rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1; }
.k-date { color: var(--muted); margin-bottom: 1.2rem; text-transform: capitalize; }
.k-recent { list-style: none; padding: 0; margin: 0; }
.k-recent li { display: flex; flex-wrap: wrap; gap: .3rem .6rem; padding: .55rem 0; border-top: 1px solid var(--line); }
.k-recent li b { flex: 1; }
.k-recent em { color: var(--warn); font-style: normal; font-size: var(--fs-sm); width: 100%; }

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .hide-sm { display: none; }
  .grid2 { grid-template-columns: 1fr; }
  .k-main { grid-template-columns: 1fr; }
  .k-side { display: none; }
  .clock { font-size: 2.6rem; }
  .page-head h1 { font-size: var(--fs-lg); }
  .page-head:has(.page-actions > *:nth-child(2)) h1 { flex-basis: 100%; }
}
@media (min-width: 641px) {
  .modal-wrap { align-items: center; }
  .modal { border-radius: 20px; }
  .modal footer { padding-bottom: .8rem; }
}
@media (min-width: 900px) {
  .bottomnav { top: 0; bottom: auto; left: auto; right: 72px; background: none; border: 0; z-index: 25; padding: 0; }
  .bottomnav a { height: 57px; flex-direction: row; gap: .35rem; font-size: var(--fs-sm); padding: 0 .8rem; max-width: none; flex: none; }
  .page { padding-bottom: 2rem; }
  .store { flex: 0 1 auto; text-align: left; padding-left: .5rem; max-width: 28vw; }
  .avatar { margin-left: auto; }
}

/* =========================================================
   TRUNG TÂM THIẾT LẬP
   ========================================================= */
.set-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr) 200px; gap: 20px; align-items: start; }
.set-layout:not(:has(.set-toc)) { grid-template-columns: 240px minmax(0, 1fr); }
.set-nav { position: sticky; top: 76px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .5rem; }
.set-group { font-size: var(--fs-sm); color: var(--muted); padding: .7rem .8rem .35rem; }
.set-group:not(:first-child) { border-top: 1px solid var(--line); margin-top: .4rem; padding-top: .9rem; }
.set-nav a { display: flex; align-items: center; gap: .7rem; padding: .65rem .8rem; border-radius: 10px; color: var(--ink); font-weight: 500; }
.set-nav a:hover { background: var(--bg); }
.set-nav a.active { background: var(--brand-l); color: var(--brand-d); font-weight: 700; }
.i { width: 20px; height: 20px; flex: none; }
.set-main { min-width: 0; }
.set-note { background: var(--warn-l); color: var(--warn); border-radius: 10px; padding: .6rem .9rem; margin-bottom: 1rem; font-size: var(--fs-base); font-weight: 600; }
.set-toc { position: sticky; top: 76px; }
.set-toc div { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem 0; }
.set-toc a { display: block; padding: .4rem 1rem; font-size: var(--fs-sm); color: var(--ink); border-left: 3px solid transparent; }
.set-toc a.active { color: var(--brand); border-left-color: var(--brand); font-weight: 600; }

.set-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 1rem; overflow: hidden; scroll-margin-top: 80px; }
.set-card-head { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.3rem; border-bottom: 1px solid var(--line); }
.set-card-head h2 { flex: 1; margin: 0; font-size: var(--fs-md); font-weight: 700; }
.card-desc { padding: .9rem 1.3rem 0; margin: 0; }
.set-card > .table-wrap, .set-card > .weekday-pick, .set-card > p.sm, .set-card > .cat-list, .set-card > .inline-form { margin-left: 1.3rem; margin-right: 1.3rem; }
.set-card > .table-wrap { margin-top: .9rem; margin-bottom: 1rem; border: 1px solid var(--line); border-radius: 10px; }
.set-card > .inline-form { margin-bottom: 1.2rem; }
.set-row { padding: 1rem 1.3rem; border-bottom: 1px solid var(--line); scroll-margin-top: 80px; }
.set-row:last-child { border-bottom: 0; }
.set-head { display: flex; align-items: center; gap: 1.2rem; }
.set-info { flex: 1; min-width: 0; }
.set-info h3 { margin: 0; font-size: var(--fs-base); font-weight: 600; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.set-info p { margin: .2rem 0 0; color: var(--muted); font-size: var(--fs-base); }
.set-ctrl { flex: none; display: flex; align-items: center; gap: .5rem; }
.set-sub { padding: .7rem 0 0 1.2rem; }
.set-line { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin: .55rem 0; }
.indent { padding-left: 1.8rem; }
.lbl { min-width: 0; }
.lbl-s { color: var(--ink); }
.muted.sm, p.sm { font-size: var(--fs-sm); margin: .4rem 0 0; }
.warn-box { background: var(--warn-l); color: var(--warn); padding: .5rem .8rem; border-radius: 8px; font-size: var(--fs-sm); margin: .5rem 0 0; }

.tgl { position: relative; display: inline-block; cursor: pointer; }
.tgl input { position: absolute; opacity: 0; pointer-events: none; }
.tgl span { display: block; width: 44px; height: 24px; border-radius: 99px; background: #c7cfcb; transition: .2s; position: relative; }
.tgl span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.tgl input:checked + span { background: var(--brand); }
.tgl input:checked + span::after { left: 23px; }
.tgl input:disabled + span { opacity: .55; cursor: not-allowed; }
.chk, .radio { display: inline-flex; align-items: center; gap: .55rem; cursor: pointer; }
.radio { display: flex; margin: .55rem 0; }
.chk input, .radio input { width: 18px; height: 18px; min-height: 0; margin: 0; accent-color: var(--brand); flex: none; }
.unit-in { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; background: var(--card); overflow: hidden; }
.unit-in input { width: 90px; border: 0; text-align: right; min-height: 40px; padding: .45em .5em; border-radius: 0; }
.unit-in input:focus { outline: 0; }
.unit-in:focus-within { outline: 2px solid var(--brand); outline-offset: -1px; }
.unit-in em { font-style: normal; color: var(--muted); padding: 0 .75em 0 .2em; white-space: nowrap; font-size: var(--fs-base); }
.unit-in input:disabled, input.ro, input[readonly] { background: var(--bg); color: var(--muted); }
.tip { display: inline-grid; place-items: center; width: 17px; height: 17px; border-radius: 50%; border: 1.5px solid var(--muted); color: var(--muted); font-size: var(--fs-xs); font-weight: 700; font-style: italic; cursor: help; position: relative; flex: none; }
.tip:hover::after, .tip:focus::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); width: max-content; max-width: 260px; background: var(--ink); color: var(--card); font-style: normal; font-weight: 500; font-size: var(--fs-sm); line-height: 1.4; padding: .5rem .7rem; border-radius: 8px; z-index: 30; white-space: normal; }
.soon { font-size: var(--fs-xs); font-weight: 700; color: var(--warn); background: var(--warn-l); padding: .1em .55em; border-radius: 99px; }
.link-more { display: inline-flex; align-items: center; gap: .2rem; color: var(--ink); font-weight: 500; }
.link-more .i { width: 18px; height: 18px; }
.link-more.sm { font-size: var(--fs-sm); color: var(--brand); }
.btn.outline { background: var(--card); border-color: var(--brand); color: var(--brand); }
.btn.outline:hover { background: var(--brand-l); }
.btn .i { width: 16px; height: 16px; }
.w-lg { width: min(340px, 100%); }
.w-sm { width: auto; min-width: 120px; }
select.w-sm, .tier select { width: auto; }
.tier .unit-in input { width: 70px; }
.tier-gap { width: 70px; }
.icon-btn .i { width: 18px; height: 18px; }

.init-head { display: flex; align-items: flex-start; gap: 1.5rem; padding: 1.2rem 1.3rem .4rem; }
.init-head > div:first-child { flex: 1; }
.init-head h2 { font-size: var(--fs-md); margin: 0 0 .2rem; }
.init-head p { margin: 0; }
.progress { display: flex; align-items: center; gap: .6rem; color: var(--muted); font-weight: 600; flex: none; }
.progress .bar { width: 140px; height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.progress .bar i { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.init-list { list-style: none; margin: 0; padding: 0; }
.init-list li { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.3rem; border-top: 1px solid var(--line); }
.init-list li:first-child { border-top: 0; }
.step { width: 30px; height: 30px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: #fff; font-weight: 700; font-size: var(--fs-base); }
.init-list li.done .step { background: transparent; border: 1.5px solid var(--line); color: var(--ink); }
.init-list li.done .step .i { width: 16px; height: 16px; }
.mini-table { margin-top: .4rem; border: 1px solid var(--line); border-radius: 10px; border-collapse: separate; overflow: hidden; }
.table .actions { text-align: right; white-space: nowrap; width: 1%; }
.weekday-pick { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: 1rem; }
.weekday-pick label { cursor: pointer; }
.weekday-pick input { display: none; }
.weekday-pick span { display: grid; place-items: center; width: 52px; height: 44px; border: 1px solid var(--line); border-radius: 10px; font-weight: 700; color: var(--muted); }
.weekday-pick input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.set-card > p.sm { margin-bottom: 1.1rem; }
.cat-list { list-style: none; padding: 0; margin: .8rem 0; }
.cat-list li { display: flex; align-items: center; justify-content: space-between; padding: .5rem .2rem; border-bottom: 1px solid var(--line); }
.cat-list li:last-child { border-bottom: 0; }
.guide { margin: .2rem 0; padding-left: 1.2rem; color: var(--muted); }
.guide li { margin: .35rem 0; }

@media (max-width: 1100px) {
  .set-layout, .set-layout:not(:has(.set-toc)) { grid-template-columns: 220px minmax(0, 1fr); }
  .set-toc { display: none; }
}
@media (max-width: 760px) {
  .set-layout, .set-layout:not(:has(.set-toc)) { grid-template-columns: minmax(0, 1fr); gap: .8rem; }
  .set-nav { position: sticky; top: 57px; z-index: 5; display: flex; overflow-x: auto; padding: .35rem; gap: .25rem; scrollbar-width: none; margin: 0 -16px; border-radius: 0; border-left: 0; border-right: 0; }
  .set-nav::-webkit-scrollbar { display: none; }
  .set-group { display: none; }
  .set-nav a { flex: none; padding: .5rem .75rem; font-size: var(--fs-base); white-space: nowrap; }
  .set-row, .set-card-head, .init-head, .init-list li { padding-left: 1rem; padding-right: 1rem; }
  .set-card > .table-wrap, .set-card > .weekday-pick, .set-card > p.sm, .set-card > .cat-list, .set-card > .inline-form, .card-desc { margin-left: 1rem; margin-right: 1rem; padding-left: 0; padding-right: 0; }
  .set-sub { padding-left: 0; }
  .indent { padding-left: 1rem; }
  .init-head { flex-direction: column; gap: .6rem; }
  .init-list li { flex-wrap: wrap; }
  .init-list li .set-info { flex: 1 1 calc(100% - 50px); }
  .init-list li .btn { margin-left: calc(30px + 1rem); }
  .set-head { flex-wrap: wrap; gap: .7rem; }
  .set-info { flex: 1 1 200px; }
  .tier { gap: .4rem; }
  .tier .unit-in input { width: 56px; }
  .tier-gap { display: none; }
  .tip:hover::after, .tip:focus::after { left: auto; right: -8px; transform: none; max-width: 230px; }
}
.txt-ok { color: var(--ok); }
.badge.warn { background: var(--warn-l); color: var(--warn); display: inline-block; margin-top: .2rem; }

/* ---------- Đăng ký ---------- */
.auth-card.wide { max-width: 520px; }
.auth-title { font-size: var(--fs-md); text-align: center; margin: .2rem 0 1rem; }
.back-link { border: 0; background: none; color: var(--brand); font: inherit; font-weight: 600; cursor: pointer; padding: 0; margin-bottom: .5rem; }
.auth-foot { text-align: center; font-size: var(--fs-base); margin: .9rem 0 0; }
.seg { display: grid; grid-template-columns: repeat(5, 1fr); gap: .4rem; }
.seg input { display: none; }
.seg label { cursor: pointer; }
.seg b { display: grid; place-items: center; min-height: 42px; border: 1px solid var(--line); border-radius: 10px; font-weight: 600; font-size: var(--fs-base); color: var(--ink); text-align: center; padding: 0 .2rem; }
.seg input:checked + b { border-color: var(--brand); background: var(--brand-l); color: var(--brand-d); box-shadow: inset 0 0 0 1px var(--brand); }
.pw { position: relative; }
.pw input { padding-right: 2.8rem; }
.pw-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); border: 0; background: none; cursor: pointer; font-size: var(--fs-md); padding: .4rem .55rem; opacity: .6; }
input.invalid, select.invalid { border-color: var(--bad); outline: 2px solid var(--bad); outline-offset: -1px; }
@media (max-width: 480px) { .seg { grid-template-columns: repeat(3, 1fr); } }

/* ---------- Ô tiền & giờ 24h ---------- */
input.money { text-align: right; font-variant-numeric: tabular-nums; }
input.time24 { font-variant-numeric: tabular-nums; letter-spacing: .03em; }

/* =========================================================
   CHẤM CÔNG QR + PIN
   ========================================================= */
.punch { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: linear-gradient(180deg, var(--brand-l), var(--bg) 40%); }
.punch-head { display: flex; align-items: center; gap: .7rem; padding: calc(.9rem + env(safe-area-inset-top)) 16px .9rem; }
.punch-head b { display: block; font-size: var(--fs-md); line-height: 1.2; }
.punch-head small { color: var(--muted); }
.punch-head > div { flex: 1; min-width: 0; }
.punch-clock { font-size: var(--fs-xl); font-weight: 700; font-variant-numeric: tabular-nums; }
.punch-main { flex: 1; width: 100%; max-width: 420px; margin: 0 auto; padding: .5rem 16px 1rem; display: flex; flex-direction: column; justify-content: center; }
.punch-foot { text-align: center; color: var(--muted); font-size: var(--fs-xs); padding: .6rem 16px calc(.8rem + env(safe-area-inset-bottom)); }
.pin-box { text-align: center; }
.pin-box h2 { font-size: var(--fs-xl); margin-bottom: .2rem; }
.pin-dots { display: flex; justify-content: center; gap: .9rem; margin: 1.4rem 0 1.6rem; height: 18px; }
.pin-dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--muted); transition: .12s; }
.pin-dots i.on { background: var(--brand); border-color: var(--brand); transform: scale(1.1); }
.pin-dots.shake { animation: shake .4s; }
.pin-dots.shake i { border-color: var(--bad); }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: .7rem; max-width: 320px; margin: 0 auto; }
.keypad button { height: 66px; border-radius: 18px; border: 1px solid var(--line); background: var(--card); font: inherit; font-size: 1.6rem; font-weight: 600; color: var(--ink); cursor: pointer; box-shadow: var(--shadow); transition: transform .06s, background .1s; }
.keypad button:active { transform: scale(.95); background: var(--brand-l); }
.keypad .k-fn { font-size: var(--fs-lg); color: var(--muted); }
.keypad .k-ok { background: var(--brand); color: #fff; border-color: var(--brand); }
.keypad.busy { opacity: .5; pointer-events: none; }
.emp-card { background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 1.4rem 1.1rem; text-align: center; box-shadow: var(--shadow); }
.emp-av { width: 76px; height: 76px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 1.7rem; font-weight: 700; display: grid; place-items: center; margin: 0 auto .7rem; }
.emp-card h2 { font-size: var(--fs-xl); margin: 0; }
.emp-card > p { margin: .2rem 0 .8rem; }
.center-chips { justify-content: center; }
.emp-status { margin-top: 1rem; padding: .6rem; border-radius: 12px; background: var(--bg); font-weight: 600; color: var(--muted); }
.emp-status.in-shift { background: var(--brand-l); color: var(--brand-d); }
.emp-card .hint { text-align: left; margin-bottom: 0; }
.punch-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; margin-top: 1rem; }
.pbtn { border: 0; border-radius: 18px; min-height: 92px; font: inherit; font-size: var(--fs-lg); font-weight: 700; color: #fff; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .2rem; transition: transform .06s, opacity .15s; }
.pbtn span { font-size: var(--fs-xl); line-height: 1; }
.pbtn.in { background: var(--brand); }
.pbtn.out { background: #e07a14; }
.pbtn:active { transform: scale(.97); }
.pbtn:disabled { background: var(--line); color: var(--muted); cursor: not-allowed; }
.pbtn.loading-btn { opacity: .6; }
.link-btn { border: 0; background: none; color: var(--brand); font: inherit; font-weight: 600; margin: 1rem auto 0; cursor: pointer; padding: .5rem; }
.punch-state { text-align: center; background: var(--card); border-radius: 22px; padding: 2rem 1.2rem; border: 1px solid var(--line); box-shadow: var(--shadow); margin-bottom: 1rem; animation: pop .3s ease; }
.punch-state h2 { font-size: var(--fs-lg); margin: .3rem 0; }
.punch-state p { margin: .5rem 0 0; }
.ps-ico { width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto .6rem; font-size: 2.4rem; font-weight: 700; color: #fff; background: var(--muted); }
.punch-state.ok .ps-ico { background: var(--brand); }
.punch-state.out .ps-ico { background: #e07a14; }
.punch-state.bad .ps-ico { background: var(--bad); font-size: 2rem; }
.punch-state.warn .ps-ico { background: var(--warn); }
.ps-name { font-weight: 700; color: var(--muted); }
.ps-time { font-size: 3.2rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; line-height: 1.1; margin: .2rem 0; }
.btn small { font-weight: 500; opacity: .8; }
.dev-req { background: var(--warn-l); border-radius: 10px; padding: .6rem .75rem; margin-bottom: .5rem; }
.dev-req b, .dev-req span { display: block; }
.dev-req span { font-size: var(--fs-sm); color: var(--muted); margin: .15rem 0 .45rem; }
.dev-actions { display: flex; gap: .4rem; }
.dev-cur { display: flex; align-items: center; justify-content: space-between; gap: .6rem; font-size: var(--fs-base); }
.inline-form.tight { margin: 0; }
.pin-input { font-size: var(--fs-lg); font-weight: 700; letter-spacing: .3em; font-variant-numeric: tabular-nums; max-width: 150px; }
.alert-card { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; background: var(--warn-l); color: var(--ink); border-radius: var(--radius); padding: .8rem 1rem; margin-bottom: 1rem; }
.alert-card span { margin-left: auto; color: var(--warn); font-weight: 700; }
.set-sep { border-top: 1px dashed var(--line); margin: .7rem 0; }
.k-steps { text-align: left; color: #44524c; margin: .8rem auto 0; padding-left: 1.3rem; max-width: 320px; }
.k-steps li { margin: .2rem 0; }
.k-print-name { display: none; }
.kiosk.static .k-qr { padding-top: 2rem; }
@media print {
  body { background: #fff; }
  .kiosk header, .k-side, .k-bar, .k-code, #toasts { display: none !important; }
  .kiosk, .k-main { display: block; min-height: 0; padding: 0; background: #fff; }
  .k-qr { box-shadow: none; border: 2px solid #14201b; max-width: 520px; margin: 1cm auto; }
  .k-print-name { display: block; font-size: 1.6rem; font-weight: 700; margin-bottom: .6rem; color: #14201b; }
  .k-steps { font-size: var(--fs-md); }
}
.punch-head > .punch-clock { flex: none; }

/* =========================================================
   BẢNG LƯƠNG & PHIẾU LƯƠNG
   ========================================================= */
.period-bar { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .9rem; }
.period-bar select { width: auto; min-width: 230px; font-weight: 600; }
.pstatus { font-size: var(--fs-sm); font-weight: 700; padding: .25em .75em; border-radius: 99px; }
.pstatus.draft { background: var(--warn-l); color: var(--warn); }
.pstatus.locked { background: #e0ecff; color: #2557c7; }
.pstatus.paid { background: var(--brand-l); color: var(--brand-d); }
.stat b.money-lg, b.money-lg { font-size: var(--fs-lg); font-variant-numeric: tabular-nums; }
.payroll-table tfoot td { border-top: 2px solid var(--line); background: var(--bg); font-weight: 600; }
.slip-layout { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 1.2rem; align-items: start; }
.slip-side h4:first-child { margin-top: 0; }
.slip { border: 1px solid var(--line); border-radius: 14px; padding: 1rem 1.1rem; background: var(--card); }
.slip-head { display: flex; justify-content: space-between; gap: 1rem; border-bottom: 2px solid var(--ink); padding-bottom: .7rem; margin-bottom: .8rem; }
.slip-head h3 { margin: .1rem 0; font-size: var(--fs-lg); letter-spacing: .05em; }
.slip-emp { text-align: right; }
.slip-emp b, .slip-emp small { display: block; }
.slip-emp small { color: var(--muted); }
.slip-work { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; margin-bottom: .8rem; }
.slip-work div { background: var(--bg); border-radius: 10px; padding: .5rem .6rem; }
.slip-work small { display: block; color: var(--muted); font-size: var(--fs-xs); }
.slip-work b { font-size: var(--fs-base); font-variant-numeric: tabular-nums; }
.slip-lines { width: 100%; border-collapse: collapse; font-size: var(--fs-base); }
.slip-lines td { padding: .45rem .1rem; border-bottom: 1px dashed var(--line); }
.slip-lines .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.slip-lines tr.sub td { font-weight: 700; border-bottom: 1px solid var(--line); background: var(--bg); padding-left: .4rem; padding-right: .4rem; }
.slip-lines tr.minus td { color: var(--bad); }
.slip-lines tr.total td { font-size: var(--fs-lg); font-weight: 700; border-bottom: 0; border-top: 2px solid var(--ink); padding-top: .7rem; color: var(--brand-d); }
.vqr { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .25rem; border: 1px solid var(--line); border-radius: 12px; padding: .8rem; background: #fff; color: #14201b; }
.vqr canvas { max-width: 100%; height: auto !important; }
.vqr b { font-size: var(--fs-lg); }
.vqr small { font-size: var(--fs-sm); }
.slip-row { width: 100%; border: 0; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
@media (max-width: 700px) {
  .slip-layout { grid-template-columns: 1fr; }
  .slip-work { grid-template-columns: repeat(2, 1fr); }
  .period-bar select { flex: 1; min-width: 0; }
}
.stat b.money-lg { font-size: clamp(1rem, 4.4vw, 1.25rem); overflow-wrap: anywhere; }
@media (max-width: 640px) { .stats:has(.money-lg) { grid-template-columns: repeat(2, 1fr); } }

/* =========================================================
   GIAO DIỆN 2.0 – header + menu, bottom nav, popup hiện đại
   ========================================================= */
:root { --radius: 16px; --shadow: 0 1px 2px rgba(16,40,30,.05), 0 8px 24px rgba(16,40,30,.06); --shadow-lg: 0 12px 40px rgba(16,40,30,.16); }
body { background: var(--bg); }
.i { width: 20px; height: 20px; flex: none; }
.i.sm { width: 16px; height: 16px; }
.i.big { width: 44px; height: 44px; }
.btn .i { width: 17px; height: 17px; }

/* ---- Header ---- */
.topbar { gap: 1rem; height: 60px; padding: 0 20px; padding-top: env(safe-area-inset-top); background: color-mix(in srgb, var(--card) 92%, transparent); }
.brand { flex: none; }
.topnav { display: flex; align-items: center; gap: .25rem; flex: 1; min-width: 0; }
.tnav { display: inline-flex; align-items: center; gap: .45rem; height: 40px; padding: 0 .85rem; border-radius: 10px; border: 0; background: none; font: inherit; font-weight: 600; font-size: var(--fs-base); color: var(--muted); cursor: pointer; white-space: nowrap; }
.tnav:hover { background: var(--bg); color: var(--ink); }
.tnav.active { color: var(--brand-d); background: var(--brand-l); }
.tnav .i { width: 18px; height: 18px; }
.top-right { display: flex; align-items: center; gap: .6rem; margin-left: auto; }
.store-chip { font-size: var(--fs-sm); color: var(--muted); max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.store { display: none; }
.dd { position: relative; }
.dd-menu { position: absolute; top: calc(100% + 8px); left: 0; z-index: 40; width: 320px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); padding: .45rem; display: none; animation: ddIn .14s ease; }
.dd-menu.narrow { width: 240px; }
.dd-menu.open { display: block; }
@keyframes ddIn { from { opacity: 0; transform: translateY(-4px); } }
.menu-item { display: flex; align-items: center; gap: .8rem; width: 100%; border: 0; background: none; font: inherit; color: var(--ink); text-align: left; padding: .7rem .8rem; border-radius: 12px; cursor: pointer; }
.menu-item:hover { background: var(--bg); }
.menu-item.active { background: var(--brand-l); color: var(--brand-d); }
.menu-item .i { width: 22px; height: 22px; color: var(--brand); }
.menu-item b { display: block; font-weight: 600; font-size: var(--fs-base); }
.menu-item small { display: block; color: var(--muted); font-size: var(--fs-sm); margin-top: .05rem; }
.menu-item.danger, .menu-item.danger .i { color: var(--bad); }
.menu-item em.soon { margin-left: .3rem; vertical-align: 1px; }

/* ---- Page ---- */
.page { padding-top: 1.1rem; }
.page.wide { max-width: 1240px; }
.page-head { align-items: center; gap: .75rem; margin-bottom: 1.1rem; }
.ph-title { flex: 1; min-width: 0; }
.ph-title h1 { margin: 0; font-size: var(--fs-lg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumb { display: block; color: var(--muted); font-weight: 600; font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: .05em; }
.back-btn { width: 40px; height: 40px; flex: none; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--ink); display: grid; place-items: center; cursor: pointer; }
.back-btn:hover { background: var(--brand-l); color: var(--brand-d); border-color: transparent; }
.page-head h1 { flex: initial; }
.card, .stat, .tile, .set-card, .set-nav, .set-toc div { box-shadow: var(--shadow); border-color: transparent; }
.card-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .6rem; }
.card-head h3 { flex: 1; margin: 0; }
a.stat { color: var(--ink); transition: transform .1s; }
a.stat:hover { transform: translateY(-2px); }

/* ---- Tổng quan ---- */
.hero { display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; padding: 1.3rem 1.4rem; margin-bottom: 1rem; border-radius: 20px; color: #fff;
  background: radial-gradient(600px 200px at 100% 0%, rgba(255,255,255,.18), transparent 60%), linear-gradient(135deg, var(--brand), var(--brand-d)); box-shadow: var(--shadow); }
.hero > div:first-child { flex: 1; min-width: 220px; }
.hero small { opacity: .85; }
.hero h2 { margin: .2rem 0 0; font-size: var(--fs-xl); }
.quick { display: grid; grid-template-columns: repeat(4, minmax(92px, 1fr)); gap: .6rem; }
.qa { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .35rem; min-height: 78px; padding: .6rem; border-radius: 14px; border: 0; background: rgba(255,255,255,.16); color: #fff; font: inherit; font-size: var(--fs-sm); font-weight: 600; cursor: pointer; text-align: center; transition: background .15s, transform .08s; }
.qa:hover { background: rgba(255,255,255,.26); }
.qa:active { transform: scale(.97); }
.qa .i { width: 22px; height: 22px; }
.alert-card { width: 100%; border: 0; font: inherit; text-align: left; cursor: pointer; gap: .7rem; }
.alert-card .i { color: var(--warn); }
.alert-card em { margin-left: auto; font-style: normal; color: var(--warn); font-weight: 700; display: inline-flex; align-items: center; gap: .2rem; white-space: nowrap; }
.alert-card.info { background: #e8f1ff; }
.alert-card.info .i, .alert-card.info em { color: #2557c7; }
.dash-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1rem; }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; align-items: center; gap: .7rem; padding: .6rem 0; border-top: 1px solid var(--line); }
.feed li:first-child { border-top: 0; }
.av { width: 36px; height: 36px; flex: none; border-radius: 50%; background: var(--brand-l); color: var(--brand-d); display: grid; place-items: center; font-weight: 700; font-size: var(--fs-sm); }
.av.muted-av { background: var(--bg); color: var(--muted); }
.tag { font-style: normal; font-size: var(--fs-xs); font-weight: 700; padding: .2em .6em; border-radius: 99px; background: var(--bg); color: var(--muted); white-space: nowrap; }
.tag.ok { background: var(--brand-l); color: var(--brand-d); }
.tag.warn { background: var(--warn-l); color: var(--warn); }
.empty-sm { padding: 1rem 0; text-align: center; }
.soon-box { text-align: center; padding: 1rem .5rem; }
.soon-box .i { color: var(--brand); }
.dev-row { display: flex; align-items: center; gap: .7rem; padding: .8rem 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.dev-row:first-child { border-top: 0; }

/* ---- Popup quản lý ca ---- */
.shift-list { display: grid; gap: .5rem; }
.shift-item { display: flex; align-items: center; gap: .8rem; width: 100%; border: 1px solid var(--line); background: var(--card); border-radius: 14px; padding: .75rem .9rem; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.shift-item:hover { border-color: var(--c); }
.shift-item .sw { width: 6px; align-self: stretch; border-radius: 6px; background: var(--c); }
.shift-item .shift-time { font-size: var(--fs-md); margin: 0; white-space: nowrap; }
.shift-item.inactive { opacity: .55; }

/* ---- Popup (modal) ---- */
/* Popup ở giữa màn hình (máy tính, máy tính bảng): bo tròn đủ 4 góc; điện thoại (≤640px) là toàn màn hình, không bo */
.modal { border-radius: 22px; box-shadow: var(--shadow-lg); overflow: hidden; }
.modal header { padding: 1rem 1.2rem .5rem; gap: .5rem; }
.modal-body { padding: .5rem 1.2rem 1rem; }
.modal footer { padding: .8rem 1.2rem calc(.8rem + env(safe-area-inset-bottom)); background: var(--card); border-radius: 0 0 22px 22px; }
.m-back { display: none; border: 0; background: none; color: var(--ink); padding: .3rem; margin-left: -.4rem; border-radius: 10px; cursor: pointer; }
.m-back .i { width: 24px; height: 24px; }
.m-x .i { width: 20px; height: 20px; }
.m-tabs { display: flex; gap: .25rem; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); margin: 0 -1.2rem 1rem; padding: 0 1.2rem; position: sticky; top: -.5rem; background: var(--card); z-index: 2; }
.m-tabs::-webkit-scrollbar { display: none; }
.m-tabs button { border: 0; background: none; font: inherit; font-weight: 600; font-size: var(--fs-base); color: var(--muted); padding: .7rem .8rem; border-bottom: 2px solid transparent; white-space: nowrap; cursor: pointer; position: relative; }
.m-tabs button.active { color: var(--brand-d); border-bottom-color: var(--brand); }
.dot-alert { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); vertical-align: 2px; }
.m-pane h4:first-child { margin-top: 0; }

/* ---- Bảng chọn (sheet) ---- */
.sheet { border-radius: 22px 22px 0 0; padding-top: .5rem; box-shadow: var(--shadow-lg); }
.sheet-grip { width: 40px; height: 4px; border-radius: 99px; background: var(--line); margin: 0 auto .8rem; }
.sheet-title { margin: 0 0 .4rem .4rem; font-size: var(--fs-md); }
.menu-list { display: grid; gap: .1rem; }
.sheet-user { padding: 0 .4rem .6rem; border-bottom: 1px solid var(--line); margin-bottom: .4rem; }

/* ---- Bottom nav (mobile) ---- */
.bottomnav { height: auto; padding: .35rem .4rem calc(.35rem + env(safe-area-inset-bottom)); gap: .2rem; box-shadow: 0 -4px 20px rgba(16,40,30,.06); border-top: 1px solid var(--line); }
.bottomnav a, .bottomnav button { flex: 1; max-width: 120px; height: 56px; border: 0; background: none; font: inherit; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: var(--fs-xs); font-weight: 600; border-radius: 14px; cursor: pointer; }
.bottomnav .i { width: 23px; height: 23px; }
.bottomnav .active { color: var(--brand-d); background: var(--brand-l); }

@media (min-width: 900px) {
  .bottomnav { display: none !important; }
  .page { padding-bottom: 2.5rem; }
}
@media (max-width: 899px) {
  .topnav { display: none; }
  .topbar { height: 56px; padding: 0 16px; }
  .page { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
}
@media (max-width: 760px) {
  .dash-grid { grid-template-columns: 1fr; }
  .quick { grid-template-columns: repeat(4, 1fr); width: 100%; }
  .qa { min-height: 72px; font-size: var(--fs-xs); padding: .5rem .2rem; }
  .hero { padding: 1.1rem; }
  .hero h2 { font-size: var(--fs-lg); }
}
@media (max-width: 640px) {
  .ph-title h1 { font-size: var(--fs-lg); }
  .page-head { flex-wrap: wrap; }
  .page-head:has(.page-actions > *:nth-child(2)) h1 { flex-basis: auto; }
  .page-actions { width: 100%; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .page-actions::-webkit-scrollbar { display: none; }
  .page-actions .btn { flex: none; }
  /* Popup toàn màn hình trên điện thoại, có nút quay lại */
  .modal-wrap { align-items: stretch; }
  .modal, .modal.wide { max-width: none; max-height: none; height: 100%; border-radius: 0; animation: slideIn .22s ease; }
  .modal header { padding-top: calc(.7rem + env(safe-area-inset-top)); border-bottom: 1px solid var(--line); }
  .modal header h3 { font-size: var(--fs-md); }
  .m-back { display: grid; place-items: center; }
  .m-x { display: none; }
  .modal-body { flex: 1; padding-top: .9rem; }
  .modal footer { border-radius: 0; box-shadow: 0 -4px 16px rgba(16,40,30,.06); }
  .m-tabs { top: -.9rem; margin-top: -.9rem; }
}
@keyframes slideIn { from { transform: translateX(30px); opacity: .4; } }
.alert-card > span { flex: 1; margin-left: 0; color: inherit; font-weight: 400; text-align: left; }
.alert-card { align-items: center; flex-wrap: nowrap; }
.quick { grid-template-columns: repeat(5, minmax(88px, 1fr)); }
@media (max-width: 760px) {
  .quick { grid-template-columns: repeat(5, 1fr); gap: .4rem; }
  .qa { min-height: 70px; font-size: var(--fs-xs); gap: .25rem; }
  .qa .i { width: 20px; height: 20px; }
}
@media (max-width: 640px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .alert-card em { font-size: var(--fs-sm); }
}

/* =========================================================
   DANH SÁCH DẠNG BẢNG (bộ lọc trái + bảng) & LƯỚI TUẦN
   ========================================================= */
.list-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 16px; align-items: start; }
.filter-panel { position: sticky; top: 76px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.1rem; }
.fp-group { margin-bottom: 1.2rem; }
.fp-group h4 { margin: 0 0 .55rem; text-transform: none; letter-spacing: 0; font-size: var(--fs-base); color: var(--ink); }
.fp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .45rem; }
.fp-head h4 { margin: 0; }
.filter-panel .radio, .filter-panel .chk { margin: .45rem 0; display: flex; }
.link-btn.sm { font-size: var(--fs-sm); margin: 0; padding: .1rem .2rem; }
.list-main { min-width: 0; }
.toolbar { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .8rem; }
.toolbar .grow { flex: 1; }
.search-box { display: flex; align-items: center; gap: .5rem; flex: 0 1 340px; max-width: 340px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 0 .8rem; min-height: 42px; color: var(--muted); }
.search-box:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-l); }
.search-box input, .search-box select { border: 0; min-height: 40px; padding: 0; background: transparent; outline: 0 !important; box-shadow: none; }
.select-box { flex: 0 1 280px; }
.week-pick { display: inline-flex; align-items: center; gap: .2rem; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 0 .2rem; min-height: 42px; }
.week-pick b { padding: 0 .4rem; font-weight: 600; white-space: nowrap; }
.week-pick .icon-btn { padding: .35rem; }
.view-sel { display: inline-flex; align-items: center; gap: .4rem; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 0 .4rem 0 .7rem; min-height: 42px; }
.view-sel select { border: 0; min-height: 40px; font-weight: 600; padding-left: 0; background-color: transparent; width: auto; }
.btn .count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 .35rem; border-radius: 99px; background: var(--warn); color: #fff; font-size: var(--fs-xs); font-weight: 700; }
.btn.icon-only { min-width: 38px; padding: 0; font-size: var(--fs-lg); letter-spacing: .05em; }
.dd-menu.right { left: auto; right: 0; }
.data-table thead th { background: color-mix(in srgb, var(--bg) 70%, var(--card)); color: var(--ink); text-transform: none; letter-spacing: 0; font-size: var(--fs-sm); font-weight: 700; padding: .8rem; }
.data-table td { padding: .7rem .8rem; vertical-align: middle; }
.data-table .cb { width: 40px; text-align: center; }
.data-table .cb input { width: 18px; height: 18px; min-height: 0; accent-color: var(--brand); }
.data-table .av-col { width: 44px; padding-left: 0; padding-right: 0; }
.data-table tr.sel td { background: var(--brand-l); }
.mono { font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.av.sm { width: 32px; height: 32px; font-size: var(--fs-xs); }
.warn-ico { color: var(--warn); cursor: help; }
.bulk { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.show-sm { display: none; }
.grid-empty { text-align: center; color: var(--muted); padding: 2.5rem 1rem; }
.grid-empty .i { color: var(--muted); opacity: .6; }
.grid-empty p { margin: .6rem 0 0; }

/* Lưới tuần (lịch làm việc & chấm công) */
.week-grid { min-width: 980px; }
.week-grid th { padding: .8rem .4rem; font-size: var(--fs-base); font-weight: 500; color: var(--muted); background: var(--card); }
.week-grid th .dnum { font-weight: 700; color: var(--ink); margin-left: .25rem; }
.week-grid th.today { color: var(--brand); }
.week-grid th.today .dnum { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--brand); color: #fff; }
.week-grid .sticky { min-width: 170px; }
.week-grid td.cell { min-width: 120px; height: 64px; padding: .35rem; }
.week-grid td.cell .plus { opacity: 0; transition: opacity .1s; }
.week-grid td.cell:hover .plus { opacity: 1; color: var(--brand); }
.pchip { display: block; margin-bottom: 4px; padding: .25em .55em; border-radius: 8px; font-size: var(--fs-sm); font-weight: 600; background: color-mix(in srgb, var(--c) 14%, var(--card)); color: color-mix(in srgb, var(--c) 75%, var(--ink)); border-left: 3px solid var(--c); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.achip { display: block; width: 100%; text-align: left; margin-bottom: 4px; padding: .3em .5em; border-radius: 8px; border: 0; border-left: 3px solid var(--k); background: color-mix(in srgb, var(--k) 12%, var(--card)); font: inherit; cursor: pointer; }
.achip b { display: block; font-size: var(--fs-sm); font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.achip small { display: block; font-size: var(--fs-xs); color: var(--muted); }
.achip:hover { filter: brightness(.97); }
.achip.ok, .lg.ok { --k: #2f6fe4; }
.achip.late, .lg.late { --k: #8b5cf6; }
.achip.miss, .lg.miss { --k: #e03a3a; }
.achip.none, .lg.none { --k: #f08c0a; }
.achip.off, .lg.off { --k: #9aa5a0; }
.achip.pending { --k: #0891b2; }
.achip.plan { --k: #c7cfcb; }
.legend-pill { position: sticky; bottom: calc(16px + env(safe-area-inset-bottom)); display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem 1.2rem; width: fit-content; max-width: 100%; margin: 1rem auto 0; padding: .6rem 1.1rem; background: var(--card); border-radius: 99px; box-shadow: var(--shadow-lg); font-size: var(--fs-sm); z-index: 5; }
.lg { display: inline-flex; align-items: center; gap: .4rem; }
.lg i { width: 12px; height: 12px; border-radius: 50%; background: var(--k); }

/* Nút nổi Khởi tạo */
.fab-init { position: fixed; right: 20px; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 30; display: inline-flex; align-items: center; gap: .45rem; border: 0; border-radius: 99px; padding: .65rem 1.05rem; background: #2563eb; color: #fff; font: inherit; font-weight: 600; font-size: var(--fs-base); box-shadow: 0 8px 24px rgba(37,99,235,.35); cursor: pointer; }
.fab-init .i { width: 18px; height: 18px; }

@media (max-width: 1100px) { .hide-md { display: none; } }
@media (max-width: 899px) {
  .list-layout { grid-template-columns: 1fr; gap: .7rem; }
  .filter-panel { position: static; display: flex; gap: .6rem; overflow-x: auto; padding: .7rem; scrollbar-width: none; }
  .filter-panel::-webkit-scrollbar { display: none; }
  .filter-panel .fp-group { margin: 0; flex: none; min-width: 170px; }
  .filter-panel .fp-group h4 { font-size: var(--fs-sm); color: var(--muted); margin-bottom: .3rem; }
  .filter-panel .radio, .filter-panel .chk { margin: .2rem 0; font-size: var(--fs-base); }
  .filter-panel > p { display: none; }
  .fab-init { bottom: calc(84px + env(safe-area-inset-bottom)); right: 14px; padding: .55rem .9rem; font-size: var(--fs-sm); }
}
@media (max-width: 640px) {
  .show-sm { display: block; }
  .search-box { flex-basis: 100%; max-width: none; }
  .select-box { flex: 1 1 100%; }
  .legend-pill { border-radius: 16px; gap: .3rem .8rem; font-size: var(--fs-sm); bottom: calc(84px + env(safe-area-inset-bottom)); }
}
[hidden] { display: none !important; }
.page.wide { max-width: 1440px; }
.pstatus { white-space: nowrap; }
@media (max-width: 1280px) { .data-table .hide-lg { display: none; } }

/* =========================================================
   ĐƠN TỪ & PHÊ DUYỆT
   ========================================================= */
.type-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin-bottom: 1rem; }
.type-opt { display: flex; align-items: center; gap: .55rem; padding: .65rem .7rem; border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; font-weight: 600; font-size: var(--fs-base); line-height: 1.25; }
.type-opt input { display: none; }
.type-opt .i { color: var(--c); width: 22px; height: 22px; }
.type-opt:has(input:checked) { border-color: var(--c); background: color-mix(in srgb, var(--c) 9%, var(--card)); box-shadow: inset 0 0 0 1px var(--c); }
.rq-list { display: grid; gap: .6rem; }
.rq-card { display: flex; gap: .8rem; align-items: flex-start; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: .9rem 1rem; border-left: 4px solid var(--c); }
.rq-ico { width: 38px; height: 38px; flex: none; border-radius: 11px; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 12%, var(--card)); color: var(--c); }
.rq-top { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; }
.rq-type { font-weight: 700; }
.rq-top .tag { margin-left: auto; }
.rq-desc { margin: .25rem 0 .15rem; font-weight: 500; }
.rq-card .muted.sm { margin: .15rem 0 0; }
.rq-actions { display: flex; flex-direction: column; gap: .4rem; flex: none; }
.tag.bad { background: var(--bad-l); color: var(--bad); }
.mini-alerts { display: grid; gap: .5rem; margin-bottom: .8rem; }
.mini-alerts .alert-card { margin: 0; }
.mode-tabs { display: inline-flex; background: var(--card); border-radius: 12px; padding: 4px; box-shadow: var(--shadow); margin-bottom: 1rem; }
.mode-tabs button { border: 0; background: none; font: inherit; font-weight: 600; color: var(--muted); padding: .5rem 1rem; border-radius: 9px; cursor: pointer; }
.mode-tabs button.active { background: var(--brand); color: #fff; }
.punch-links { display: flex; justify-content: center; gap: .5rem; flex-wrap: wrap; margin-top: .6rem; }
.punch-links .link-btn { margin: 0; display: inline-flex; align-items: center; gap: .3rem; }
.portal-h { margin: 1.2rem 0 .6rem; }
.emp-card.portal { margin-bottom: 1rem; }
.punch .rq-card { box-shadow: none; border: 1px solid var(--line); border-left: 4px solid var(--c); }
.punch #done { margin-top: 1rem; }
.slip-lines tr.info td { font-size: var(--fs-sm); color: var(--muted); border-bottom-style: none; padding-top: 0; }
.achip.leave, .lg.leave { --k: #0891b2; }
@media (max-width: 640px) {
  .type-grid { grid-template-columns: repeat(2, 1fr); }
  .rq-card { flex-wrap: wrap; }
  .rq-actions { flex-direction: row; width: 100%; padding-left: calc(38px + .8rem); }
}
.tabs button { white-space: nowrap; }

/* ===================== Giai đoạn 7 – Vận hành SaaS ===================== */
.badge.ok { background: var(--brand-l); color: var(--brand-d); }
.badge.err { background: var(--bad-l); color: var(--bad); }
.badge.info { background: #e8f0fe; color: #2f5fb3; }
.badge.ok, .badge.err, .badge.info, .badge.warn { display: inline-block; padding: .1em .55em; font-size: var(--fs-sm); white-space: nowrap; }
.warn-txt { color: var(--warn) !important; }
.nowrap { white-space: nowrap; }
.btn-row { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .6rem; }
.linkbtn { background: none; border: 0; color: var(--brand); font: inherit; font-weight: 600; cursor: pointer; padding: 0; }
.linkbtn:disabled { color: var(--muted); cursor: default; }
.chip { cursor: pointer; border: 1px solid var(--line); background: var(--card); color: var(--ink); }
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.num-input { width: 7.5rem; text-align: right; }
.copy-box { background: var(--bg); border: 1px dashed var(--line); border-radius: 10px; padding: .8rem 1rem; margin: .4rem 0 .7rem; user-select: all; }

/* Banner gói dịch vụ */
.plan-banner { display: flex; align-items: center; gap: .7rem; padding: .75rem 1rem; border-radius: 12px; margin: 0 0 1rem;
  background: #e8f0fe; color: #1f3f7a; border: 1px solid #cddcf8; }
.plan-banner .i { flex: none; width: 20px; height: 20px; }
.plan-banner span { flex: 1; }
.plan-banner.warn { background: var(--warn-l); color: #7a4706; border-color: #f3d9a8; }
.plan-banner.err { background: var(--bad-l); color: #8f1f1f; border-color: #f2c4c4; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .plan-banner { color: var(--ink); background: #172338; border-color: #26364f; }
  :root:not([data-theme="light"]) .plan-banner.warn { color: var(--ink); background: var(--warn-l); border-color: #5a4320; }
  :root:not([data-theme="light"]) .plan-banner.err { color: var(--ink); background: var(--bad-l); border-color: #5a2626; } }
@media (max-width: 640px) { .plan-banner { flex-wrap: wrap; } .plan-banner .btn { width: 100%; } }

/* Tab Gói dịch vụ */
.plan-sec { padding: 1.1rem 1.3rem; }
.plan-sec h3 { font-size: var(--fs-md); }
.plan-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.plan-head h2 { font-size: var(--fs-xl); margin: .1rem 0 0; }
.plan-meters { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; margin-top: 1rem; }
.pm-top { display: flex; justify-content: space-between; gap: .5rem; margin-bottom: .35rem; }
.meter { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; margin-bottom: .35rem; }
.meter i { display: block; height: 100%; background: var(--brand); border-radius: inherit; }
.meter.warn i { background: var(--warn); }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .8rem; }
.plan-opt { border: 1px solid var(--line); border-radius: 12px; padding: 1rem; position: relative; }
.plan-opt.cur { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-l); }
.plan-opt .po-price { font-size: var(--fs-lg); font-weight: 700; margin: .3rem 0 .4rem; }
.plan-opt ul { margin: 0; padding-left: 1.1rem; color: var(--muted); font-size: var(--fs-base); }
.plan-opt .badge { position: absolute; top: .8rem; right: .8rem; }
@media (max-width: 640px) { .plan-meters { grid-template-columns: 1fr; } }

/* Hồ sơ NV: tài khoản app */
.acct-row { display: flex; align-items: center; gap: .7rem; padding: .7rem .9rem; border: 1px solid var(--line); border-radius: 10px; margin-top: .4rem; }
.acct-row span { flex: 1; display: flex; flex-direction: column; }
.acct-row small { color: var(--muted); }

/* OTP */
.otp-input { font-size: 1.6rem; letter-spacing: .5em; text-align: center; font-variant-numeric: tabular-nums; }

/* Quản trị nền tảng */
.kpi-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: .7rem; margin-bottom: 1rem; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: .8rem 1rem; }
.kpi small { color: var(--muted); display: block; }
.kpi b { font-size: var(--fs-xl); font-variant-numeric: tabular-nums; }
.kpi.ok b { color: var(--brand); } .kpi.warn b { color: var(--warn); } .kpi.err b { color: var(--bad); }
@media (max-width: 1100px) { .kpi-row { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 560px) { .kpi-row { grid-template-columns: repeat(2, 1fr); } }
.pf-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: .6rem; margin-bottom: 1rem; }
.pf-summary > div { background: var(--bg); border-radius: 10px; padding: .6rem .8rem; display: flex; flex-direction: column; gap: .1rem; }
.pf-summary small:last-child:not(:first-child) { color: var(--muted); }
@media (max-width: 640px) { .pf-summary { grid-template-columns: 1fr 1fr; } }
.pf-info p { margin: 0 0 .4rem; }
.pf-info h4 { margin: 1rem 0 .4rem; font-size: var(--fs-base); }
.spark { display: flex; align-items: flex-end; gap: 3px; height: 56px; padding: 4px; background: var(--bg); border-radius: 8px; }
.spark i { flex: 1; background: var(--brand); border-radius: 3px 3px 0 0; min-width: 6px; }
.pf-emps { display: flex; flex-direction: column; gap: .3rem; max-height: 220px; overflow: auto; }
.pf-emps > div { display: flex; justify-content: space-between; gap: .5rem; border-bottom: 1px solid var(--line); padding: .25rem 0; }

/* Nhật ký */
.audit-sum { color: var(--muted); max-width: 520px; }

/* ===================== 008 – Google & mã email ===================== */
.or-sep { display: flex; align-items: center; gap: .8rem; color: var(--muted); font-size: var(--fs-sm); margin: 1.1rem 0 .9rem; }
.or-sep::before, .or-sep::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.btn.google { background: var(--card); color: var(--ink); border: 1px solid var(--line); gap: .6rem; }
.btn.google:hover { background: var(--bg); }
.btn.google svg { width: 20px; height: 20px; }
.seg.two { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: .8rem; }
.menu-note { display: flex; align-items: center; gap: .5rem; padding: .55rem .9rem; color: var(--brand-d); font-size: var(--fs-base); }
.menu-note .i { width: 18px; height: 18px; }
.onboard .ob-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; margin: 1rem 0; }
.ob-card { display: flex; flex-direction: column; align-items: flex-start; gap: .4rem; text-align: left; padding: 1.1rem; border: 1px solid var(--line);
  border-radius: 14px; background: var(--card); color: var(--ink); font: inherit; cursor: pointer; }
button.ob-card:hover { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-l); }
.ob-card.static { cursor: default; }
.ob-card .i.big { width: 30px; height: 30px; color: var(--brand); }
.ob-card small { color: var(--muted); }
.ob-card .btn { margin-top: .3rem; }
@media (max-width: 560px) { .onboard .ob-grid { grid-template-columns: 1fr; } }

/* ===================== Tối ưu hiển thị web & điện thoại ===================== */
/* Thanh menu trên màn hình 900–1199px: bỏ tên cửa hàng, nút QR chỉ còn icon */
@media (min-width: 900px) and (max-width: 1199px) {
  .store-chip { display: none; }
  .top-right .btn.sm { font-size: 0; gap: 0; width: 38px; padding: 0; }
  .tnav { padding: 0 .6rem; }
  .topbar { gap: .6rem; }
  /* Thêm mục Thiết lập chung ⇒ bỏ icon trước chữ để menu vừa một hàng */
  .tnav > .i:first-child { display: none; }
}
/* Lưới tuần vừa màn hình máy tính bảng */
@media (max-width: 1100px) {
  .week-grid { min-width: 820px; }
  .week-grid .sticky { min-width: 130px; }
  .week-grid td.cell { min-width: 96px; }
}

/* Lịch tuần dạng danh sách theo ngày (điện thoại) */
.week-agenda { display: none; }
@media (max-width: 640px) {
  .sched-wrap { display: none; }
  .week-agenda { display: block; }
  .day-strip { position: sticky; top: 56px; z-index: 4; display: grid; grid-template-columns: repeat(7, 1fr); gap: .25rem; margin: 0 0 .8rem; padding: .35rem;
    background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
  .day-strip button { border: 0; background: none; font: inherit; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: .05rem;
    padding: .45rem 0; border-radius: 11px; cursor: pointer; }
  .day-strip small { font-size: var(--fs-xs); font-weight: 600; }
  .day-strip b { font-size: var(--fs-md); color: var(--ink); font-variant-numeric: tabular-nums; }
  .day-strip .today b { color: var(--brand); }
  .day-strip .active { background: var(--brand); color: #fff; }
  .day-strip .active b { color: #fff; }
  .ag-day { display: grid; gap: .6rem; }
  .ag-row { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border-left: 4px solid var(--c); padding: .75rem .9rem; }
  .ag-head { display: flex; align-items: baseline; justify-content: space-between; gap: .6rem; margin-bottom: .45rem; }
  .ag-head b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ag-head small { flex: none; color: var(--muted); font-variant-numeric: tabular-nums; }
  .ag-cell { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; min-height: 34px; }
  .ag-cell.cell { cursor: pointer; }
  .ag-cell .pchip, .ag-cell .mini { display: inline-block; margin: 0; max-width: 100%; font-size: var(--fs-sm); padding: .35em .7em; }
  .ag-cell .achip { display: inline-block; width: auto; max-width: 100%; margin: 0; padding: .4em .7em; }
  .ag-add { color: var(--brand); font-weight: 600; font-size: var(--fs-base); }
  .week-agenda + p.sm { margin-top: .8rem; }
  .legend-pill { position: static; margin-top: .8rem; }
}

/* Bộ lọc thu gọn (máy tính bảng & điện thoại) */
.filter-toggle { display: none; }
@media (max-width: 899px) {
  .filter-toggle { display: inline-flex; justify-self: start; }
  .filter-toggle.open { background: var(--brand-l); color: var(--brand-d); border-color: transparent; }
  .filter-toggle.open .i.sm { transform: rotate(180deg); }
  .filter-panel { display: none; }
  .filter-panel.open { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .9rem 1.2rem; overflow: visible; padding: 1rem; }
  .filter-panel.open .fp-group { min-width: 0; }
  /* Nút bấm đủ lớn cho ngón tay */
  .chip { min-height: 34px; padding: .35em .85em; }
  .link-btn.sm, .link-more.sm { padding: .45rem .3rem; }
}

/* Nút thao tác đầu trang xuống dòng thay vì bị khuất */
@media (max-width: 640px) {
  .page-actions { overflow: visible; flex-wrap: wrap; }
  .page-actions > .btn { flex: 1 1 auto; }
}

/* Màn hình QR: máy tính bảng dựng đứng / màn hình hẹp ⇒ mã QR ở trên, giờ + lượt chấm ở dưới */
@media (max-width: 900px), (orientation: portrait) {
  .k-main { grid-template-columns: minmax(0, 1fr); align-content: center; gap: 1rem; }
  .k-qr { max-width: 560px; }
  .k-side { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 0 1.2rem; width: 100%; max-width: 560px; justify-self: center; align-self: auto; }
  .k-clock { font-size: 2.6rem; }
  .k-date { margin: 0; }
  .k-side h3, .k-recent { grid-column: 1 / -1; }
  .k-side h3 { margin: .8rem 0 .3rem; }
}

/* Trạng thái Wifi ở trang Chấm công: chữ và IP chảy liền một dòng, không tách cột */
.clock-card .pill { display: inline-block; max-width: 100%; }

/* Trang cá nhân (chấm công, đơn từ, lịch) rộng hơn một chút trên máy tính */
@media (min-width: 900px) { .page:not(.wide) { max-width: 760px; } }

/* Nút nổi Khởi tạo không che nội dung cuối trang */
.page:has(~ .fab-init) { padding-bottom: calc(5rem + env(safe-area-inset-bottom)); }
@media (max-width: 899px) {
  .page:has(~ .fab-init) { padding-bottom: calc(76px + 4rem + env(safe-area-inset-bottom)); }
}

/* Thao tác nhanh ở Tổng quan: nhãn tối đa 2 dòng trên điện thoại */
@media (max-width: 640px) {
  .quick { gap: .3rem; }
  .qa { padding: .5rem .1rem; font-size: var(--fs-xs); line-height: 1.2; }
}

/* 3 ô thống kê trên điện thoại: xếp 1 hàng thay vì để 1 ô lẻ */
@media (max-width: 640px) {
  .stats:has(> :nth-child(3):last-child) { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; }
  .stats:has(> :nth-child(3):last-child) .stat { padding: .7rem .75rem; }
  .stats:has(> :nth-child(3):last-child) .stat small { display: block; font-size: var(--fs-xs); line-height: 1.3; }
  .stats:has(> :nth-child(3):last-child) .stat b { font-size: var(--fs-lg); }
}

/* ===================== 009 – Màu giao diện ===================== */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .8rem; padding: 1rem 1.3rem 1.3rem; }
.theme-opt { display: flex; flex-direction: column; gap: .5rem; padding: .7rem; border: 1.5px solid var(--line); border-radius: 14px; cursor: pointer; text-align: center; transition: border-color .15s, box-shadow .15s; }
.theme-opt { position: relative; }
.theme-opt input { position: absolute; top: 0; left: 0; width: 1px; height: 1px; min-height: 0; opacity: 0; pointer-events: none; }
.theme-opt:has(input:checked) { border-color: var(--tc); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tc) 22%, transparent); }
.theme-opt:has(input:focus-visible) { outline: 2px solid var(--tc); outline-offset: 2px; }
.theme-prev { display: grid; gap: 6px; padding: 10px; border-radius: 10px; background: var(--bg); }
.theme-prev i { display: block; border-radius: 6px; }
.tp-bar { height: 22px; background: linear-gradient(135deg, var(--tc), var(--td)); }
.tp-btn { height: 14px; width: 70%; background: var(--tc); }
.tp-chip { height: 12px; width: 45%; background: var(--tl); border: 1px solid color-mix(in srgb, var(--tc) 30%, transparent); }
.theme-opt b { font-size: var(--fs-base); }
.theme-opt:has(input:checked) b::after { content: ' ✓'; color: var(--tc); }
@media (max-width: 760px) { .theme-grid { grid-template-columns: repeat(2, 1fr); padding: 1rem; } }

/* ===================== 010 – Nhập nhân viên từ Excel ===================== */
.imp-steps { margin: 0 0 1rem; padding-left: 1.2rem; display: grid; gap: .6rem; }
.imp-steps li { line-height: 1.5; }
.imp-steps .btn { margin-left: .4rem; vertical-align: middle; }
.imp-drop { display: flex; flex-direction: column; align-items: center; gap: .35rem; padding: 1.6rem 1rem; border: 2px dashed var(--line); border-radius: 16px;
  text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.imp-drop:hover, .imp-drop.over { border-color: var(--brand); background: var(--brand-l); }
.imp-drop .i.big { width: 36px; height: 36px; color: var(--brand); }
.imp-drop.compact { flex-direction: row; justify-content: center; padding: .6rem 1rem; }
.imp-drop.compact .i.big { width: 20px; height: 20px; }
.imp-drop.compact small { display: none; }
.imp-drop.compact b::after { content: ' (chọn file khác)'; font-weight: 400; color: var(--muted); }
#impResult:not(:empty) { margin-top: 1rem; }
.imp-sum { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .7rem; }
.imp-opt { background: var(--bg); border-radius: 12px; padding: .6rem .9rem; margin-bottom: .7rem; font-weight: 600; font-size: var(--fs-base); }
.imp-opt .radio { font-weight: 400; margin: .35rem 0; }
.imp-table { border: 1px solid var(--line); border-radius: 12px; max-height: 46vh; overflow: auto; }
.imp-table thead th { position: sticky; top: 0; background: var(--card); z-index: 1; }
.imp-table tr.imp-error td { background: var(--bad-l); }
.imp-table tr.imp-update td { color: var(--muted); }
.imp-go { justify-content: flex-end; margin-top: .9rem; }
.imp-done { display: flex; gap: 1rem; align-items: flex-start; background: var(--brand-l); border-radius: 14px; padding: 1rem 1.1rem; margin-bottom: .8rem; }
.imp-done.warn { background: var(--warn-l); }
.imp-done .i.big { width: 32px; height: 32px; flex: none; color: var(--brand); }
.imp-done.warn .i.big { color: var(--warn); }
.imp-done h3 { margin: 0 0 .2rem; }
.imp-done p { margin: .2rem 0 0; }
@media (max-width: 640px) { .imp-steps .btn { display: flex; margin: .5rem 0 0; width: fit-content; } .imp-go .btn { width: 100%; } }

/* ===================== 010 – Tổng quan thao tác nhanh ===================== */
.hero-sub { margin: .35rem 0 0; font-size: var(--fs-base); opacity: .92; }
.quick.quick8 { grid-template-columns: repeat(4, minmax(96px, 1fr)); }
.qa { position: relative; }
.qa-n { position: absolute; top: 6px; right: 8px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 99px; background: #fff; color: var(--brand-d);
  font-style: normal; font-size: var(--fs-xs); font-weight: 700; display: grid; place-items: center; }
.count-pill { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 .4rem; margin-left: .3rem; border-radius: 99px; background: var(--warn); color: #fff; font-size: var(--fs-xs); vertical-align: 2px; }
.todo-card { border-left: 4px solid var(--warn); }
.todo-list { list-style: none; margin: 0; padding: 0; }
.todo-list li { display: flex; align-items: center; gap: .75rem; padding: .7rem 0; border-top: 1px solid var(--line); transition: opacity .25s, transform .25s; }
.todo-list li:first-child { border-top: 0; }
.todo-list li.done { opacity: 0; transform: translateX(16px); }
.todo-list b { display: block; font-weight: 600; font-size: var(--fs-base); }
.todo-list small { display: block; font-size: var(--fs-sm); margin-top: .1rem; }
.todo-list small:not(.muted) { color: var(--ink); }
.todo-act { display: flex; gap: .4rem; flex: none; }
.feed li .btn.sm { flex: none; }
.quick-set .qs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .2rem 1.5rem; }
.qs-item { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .7rem 0; border-top: 1px solid var(--line); cursor: pointer; }
.qs-item > span:first-child { font-weight: 500; font-size: var(--fs-base); }
.quick-set .warn-box { margin-top: .8rem; }
.home-quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; margin-bottom: 1rem; }
.home-quick a { display: flex; flex-direction: column; align-items: center; gap: .35rem; padding: .8rem .3rem; border-radius: var(--radius); background: var(--card);
  box-shadow: var(--shadow); color: var(--ink); font-size: var(--fs-sm); font-weight: 600; text-align: center; line-height: 1.2; }
.home-quick a .i { width: 22px; height: 22px; color: var(--brand); }
@media (min-width: 761px) { .hero > div:first-child { flex: 1 1 260px; } }
@media (max-width: 760px) {
  .quick.quick8 { grid-template-columns: repeat(4, 1fr); gap: .35rem; }
  .todo-list li { flex-wrap: wrap; }
  .todo-list .grow { flex: 1 1 calc(100% - 50px); }
  .todo-act { width: 100%; padding-left: calc(36px + .75rem); }
  .todo-act .btn { flex: 1; min-height: 40px; }
  .quick-set .qs-grid { grid-template-columns: 1fr; }
}

/* ===================== 009 – Tối ưu điện thoại ===================== */
.brand-txt { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.brand-store { display: none; font-size: var(--fs-xs); font-weight: 600; color: var(--muted); max-width: 48vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 899px) {
  /* Tên cửa hàng dưới chữ Tickly (thanh trên không còn chỗ cho ô tên cửa hàng) */
  .brand-store:not(:empty) { display: block; }
  .brand { min-width: 0; flex: 1 1 auto; }
  /* iPhone tự phóng to khi gõ vào ô chữ nhỏ hơn 16px */
  input:not([type=checkbox]):not([type=radio]), select, textarea { font-size: 16px; }
  .code-form input, .otp-input, .pin-input { font-size: var(--fs-xl); }
}
@media (max-width: 640px) {
  /* Nút cuối popup to, dễ bấm bằng ngón cái */
  .modal footer .btn { flex: 1 1 0; min-height: 46px; }
  .modal footer .spacer { display: none; }
  .modal footer { flex-wrap: wrap; }
}

/* ===================== 009 – Chuyển khoản gia hạn ===================== */
.paybox { display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap; margin: .6rem 0; }
.paybox .vqr { width: 220px; flex: none; }
.paybox .vqr img { width: 100%; height: auto; border-radius: 6px; }
.pay-info { flex: 1 1 220px; margin: 0; display: grid; gap: .55rem; }
.pay-info div { display: grid; grid-template-columns: 110px 1fr; gap: .5rem; align-items: baseline; }
.pay-info dt { color: var(--muted); font-size: var(--fs-sm); }
.pay-info dd { margin: 0; overflow-wrap: anywhere; }
.pay-info .linkbtn { font-size: var(--fs-sm); margin-left: .3rem; }
.pay-pick { display: grid; grid-template-columns: 2fr 1fr; gap: 0 .8rem; max-width: 520px; }
#payPrev .paybox { flex-direction: column; align-items: stretch; }
#payPrev .vqr { width: 100%; max-width: 240px; align-self: center; }
#payPrev .pay-info div { grid-template-columns: 100px 1fr; }
@media (max-width: 640px) {
  .paybox { flex-direction: column; align-items: stretch; }
  .paybox .vqr { align-self: center; }
  .pay-pick { grid-template-columns: 1fr; }
}

/* ===================== 009 – Thông báo ===================== */
.bell { position: relative; width: 38px; height: 38px; flex: none; display: grid; place-items: center; border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer; }
.bell:hover { background: var(--bg); color: var(--ink); }
.bell .i { width: 22px; height: 22px; }
.bell.has { color: var(--ink); }
.bell.has .i { animation: ring 1.2s ease 1; transform-origin: 50% 10%; }
@keyframes ring { 10%, 30% { transform: rotate(14deg); } 20%, 40% { transform: rotate(-14deg); } 50% { transform: none; } }
.bell-n { position: absolute; top: 2px; right: 1px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 99px; background: var(--bad); color: #fff;
  font-size: var(--fs-xs); font-weight: 700; display: grid; place-items: center; border: 2px solid var(--card); line-height: 1; }
.notif-wrap { position: fixed; inset: 0; z-index: 45; }
.notif-panel { position: absolute; top: 64px; right: 16px; width: 380px; max-height: min(560px, calc(100vh - 90px)); display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-lg); animation: ddIn .14s ease; overflow: hidden; }
.notif-panel header { display: flex; align-items: center; padding: .8rem .8rem .5rem 1.1rem; }
.notif-panel header h3 { flex: 1; margin: 0; font-size: var(--fs-md); }
.notif-ask { display: flex; align-items: center; gap: .7rem; margin: 0 .8rem .5rem; padding: .7rem .8rem; border: 0; border-radius: 12px; background: var(--brand-l); color: var(--brand-d); font: inherit; text-align: left; cursor: pointer; }
.notif-ask small { display: block; color: var(--muted); font-size: var(--fs-sm); }
.notif-list { overflow-y: auto; padding: 0 .5rem .5rem; }
.notif-item { display: flex; align-items: flex-start; gap: .7rem; padding: .7rem .6rem; border-radius: 12px; color: var(--ink); position: relative; }
.notif-item:hover { background: var(--bg); }
.notif-item b { display: block; font-weight: 600; font-size: var(--fs-base); line-height: 1.35; }
.notif-item small { display: block; color: var(--muted); font-size: var(--fs-sm); margin-top: .1rem; }
.notif-item.new { background: color-mix(in srgb, var(--brand-l) 60%, transparent); }
.notif-item.new::after { content: ''; position: absolute; top: 1rem; right: .7rem; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.notif-item.new b { padding-right: 1rem; }
.ni-ico { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 11px; color: var(--c); background: color-mix(in srgb, var(--c) 13%, var(--card)); }
.ni-ico .i { width: 19px; height: 19px; }
.notif-empty { text-align: center; color: var(--muted); padding: 2rem 1rem; }
.notif-empty .i { opacity: .5; }
.notif-panel footer { border-top: 1px solid var(--line); padding: .7rem 1rem; text-align: center; }
.notif-panel footer a { display: inline-flex; align-items: center; gap: .2rem; font-weight: 600; font-size: var(--fs-base); }
@media (max-width: 640px) {
  .notif-wrap { background: rgba(10, 20, 15, .45); animation: fade .15s; }
  .notif-panel { inset: auto 0 0 0; top: auto; width: auto; max-height: 85vh; border-radius: 22px 22px 0 0; border: 0; animation: up .2s ease;
    padding-bottom: env(safe-area-inset-bottom); }
  .notif-item { padding: .8rem .6rem; }
}

/* ===================== 011 – Nút tròn Vào ca / Ra ca ===================== */
.punch-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .3rem; padding: 1.4rem 1rem 1.3rem; }
.punch-card .clock { font-size: 2.6rem; }
.round-punch { --rc: var(--brand); --rd: var(--brand-d); position: relative; width: 196px; height: 196px; margin: 1.1rem 0 .9rem; border: 0; border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .15rem; cursor: pointer; font: inherit; color: #fff;
  background: radial-gradient(circle at 30% 25%, color-mix(in srgb, var(--rc) 70%, #fff), var(--rc) 55%, var(--rd));
  box-shadow: 0 14px 34px color-mix(in srgb, var(--rc) 40%, transparent), inset 0 -6px 14px rgba(0,0,0,.12);
  transition: transform .1s, box-shadow .15s, filter .15s; -webkit-tap-highlight-color: transparent; }
.round-punch.out { --rc: #f08a1c; --rd: #c9620a; }
.round-punch:hover { filter: brightness(1.04); }
.round-punch:active { transform: scale(.96); }
.round-punch:disabled { filter: grayscale(.4) brightness(.95); cursor: wait; }
.round-punch:disabled .rp-ring { animation: none; opacity: 0; }
.round-punch .rp-ico { width: 34px; height: 34px; }
.round-punch b { font-size: 1.7rem; font-weight: 700; letter-spacing: .04em; line-height: 1.1; }
.round-punch small { font-size: var(--fs-sm); opacity: .92; max-width: 150px; line-height: 1.25; }
/* Vòng sóng toả ra quanh nút */
.rp-ring { position: absolute; inset: -10px; border-radius: 50%; border: 3px solid color-mix(in srgb, var(--rc) 45%, transparent); animation: rpPulse 2.2s ease-out infinite; pointer-events: none; }
@keyframes rpPulse { 0% { transform: scale(.92); opacity: .9; } 80%, 100% { transform: scale(1.12); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .rp-ring { animation: none; opacity: .5; } }
.punch-card .pill { margin-top: 0; }
.rp-note { margin: .5rem 0 0; font-size: var(--fs-base); }
.punch-card .code-form { width: 100%; max-width: 340px; margin-top: .9rem; grid-template-columns: 1fr auto; }
.punch-card .code-form:not(:has(#scanBtn)) { grid-template-columns: 1fr; }
.punch-card .code-form input { letter-spacing: .25em; }
@media (max-width: 380px) { .round-punch { width: 172px; height: 172px; } .round-punch b { font-size: var(--fs-xl); } }
/* Trang quét QR + PIN tại quầy */
.punch-round { display: flex; justify-content: center; margin: .4rem 0 .2rem; }
.punch-round .round-punch { margin: 1rem 0; }

/* ===================== 011 – Thiết lập chung trên điện thoại: lưới ô ===================== */
.i.flip { transform: rotate(180deg); }
.hub-group { margin: 1.1rem 0 .55rem; }
.hub-group:first-child { margin-top: 0; }
.hub-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; }
.hub-tile { display: flex; flex-direction: column; gap: .2rem; padding: .9rem .85rem; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow);
  color: var(--ink); min-height: 112px; transition: transform .08s; }
.hub-tile:active { transform: scale(.97); }
.hub-ico { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; background: var(--brand-l); color: var(--brand); margin-bottom: .35rem; }
.hub-ico .i { width: 22px; height: 22px; }
.hub-tile b { font-size: var(--fs-base); line-height: 1.25; }
.hub-tile small { color: var(--muted); font-size: var(--fs-sm); line-height: 1.3; }
@media (max-width: 760px) {
  /* Đang ở trong 1 mục: bỏ thanh mục cuộn ngang, dùng nút quay lại */
  .set-layout .set-nav { display: none; }
}

/* ===================== 014 – Hoa hồng, Báo cáo, Ca trống ===================== */
.cm-rule { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.cm-rule > div { flex: 1; display: flex; flex-direction: column; gap: .1rem; }
.cm-table input { min-height: 36px; padding: .35em .6em; }
.cm-table .cm-sales { width: 150px; text-align: right; }
.cm-table .cm-rate { width: 90px; text-align: right; }
.cm-tiers { display: grid; gap: .1rem; margin-top: .4rem; }
/* Báo cáo */
.rp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1rem; }
.rp-card h3 { display: flex; align-items: center; gap: .4rem; font-size: var(--fs-base); }
.rp-card h3 .i { color: var(--brand); width: 18px; height: 18px; }
.vbar { display: flex; align-items: flex-end; gap: 8px; height: 190px; padding-top: 1.4rem; border-bottom: 1px solid var(--line); }
.vb-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; cursor: default; outline: 0; }
.vb-bar { width: min(100%, 44px); background: var(--brand); border-radius: 4px 4px 0 0; transition: filter .12s; }
.vb-col:hover .vb-bar, .vb-col:focus .vb-bar { filter: brightness(1.12); }
.vb-val { font-size: var(--fs-xs); font-weight: 700; color: var(--ink); margin-bottom: .2rem; min-height: 1em; white-space: nowrap; }
.vb-lbl { position: absolute; bottom: -1.5rem; font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; }
.rp-card .vbar { margin-bottom: 1.7rem; }
.rp-table { display: none; }
.rp-card.show-table .vbar { display: none; }
.rp-card.show-table .rp-table { display: table; }
.hbar { display: grid; gap: .55rem; }
.hb-row { display: grid; grid-template-columns: minmax(0, 9rem) 1fr auto; align-items: center; gap: .6rem; outline: 0; }
.hb-lbl { font-size: var(--fs-base); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-track { height: 12px; background: var(--bg); border-radius: 99px; overflow: hidden; }
.hb-bar { display: block; height: 100%; background: var(--brand); border-radius: 0 4px 4px 0; }
.hb-val { font-size: var(--fs-sm); color: var(--muted); white-space: nowrap; }
.rp-tip { position: absolute; z-index: 90; background: var(--ink); color: var(--card); font-size: var(--fs-sm); font-weight: 600; padding: .4rem .65rem; border-radius: 8px;
  pointer-events: none; box-shadow: 0 6px 18px rgba(0,0,0,.18); max-width: 260px; }
/* Báo cáo trên Tổng quan */
.dash-reports { margin: 1.4rem 0 1rem; }
.dash-sec { display: flex; align-items: center; gap: .6rem; margin-bottom: .8rem; }
.dash-sec h2 { flex: 1; margin: 0; font-size: var(--fs-lg); display: flex; align-items: center; gap: .45rem; }
.dash-sec h2 .i { color: var(--brand); }
.dash-reports > div > p.muted.sm:last-child { margin-top: .2rem; }
/* Ca trống */
.os-list { display: grid; gap: .6rem; }
.os-card { display: flex; align-items: center; gap: .7rem; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: .85rem 1rem; border-left: 4px solid var(--c); }
.os-card small { margin-top: .15rem; }
.os-new { background: var(--bg); border-radius: 14px; padding: .2rem 1rem .9rem; margin-bottom: .8rem; }
.os-auto { font-size: var(--fs-base); margin: .4rem 0 .2rem; }
.os-item { border: 1px solid var(--line); border-left: 4px solid var(--c); border-radius: 12px; padding: .65rem .8rem; margin-bottom: .5rem; }
.os-top { display: flex; align-items: center; gap: .5rem; }
.os-top b { flex: 1; }
.os-claims { list-style: none; margin: .4rem 0 0; padding: 0; display: grid; gap: .3rem; }
.os-claims li { display: flex; align-items: center; gap: .4rem; font-size: var(--fs-base); }
@media (max-width: 640px) { .rp-grid { grid-template-columns: 1fr; } .vbar { gap: 5px; } .hb-row { grid-template-columns: minmax(0, 6.5rem) 1fr auto; } }

/* ===================== 013 – Chống gian lận & xác nhận bảng công ===================== */
/* Chụp ảnh khuôn mặt */
.selfie { position: fixed; inset: 0; z-index: 70; background: rgba(8, 14, 12, .92); display: grid; place-items: center; padding: 1rem; animation: fade .15s; }
.selfie-box { display: flex; flex-direction: column; align-items: center; gap: .8rem; color: #fff; text-align: center; }
.selfie-title { margin: 0; font-size: var(--fs-lg); font-weight: 700; }
.selfie-cam { position: relative; width: min(72vw, 280px); aspect-ratio: 1; border-radius: 50%; overflow: hidden; border: 4px solid #fff; box-shadow: 0 0 0 6px color-mix(in srgb, var(--brand) 55%, transparent); }
.selfie-cam video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.selfie-count { position: absolute; inset: 0; display: grid; place-items: center; font-size: 4rem; font-weight: 700; color: #fff; text-shadow: 0 2px 12px rgba(0,0,0,.5); }
.selfie-hint { margin: 0; font-size: var(--fs-sm); opacity: .8; }
.selfie .btn.ghost { color: #fff; border-color: rgba(255,255,255,.5); }
/* Ảnh trong Bảng chấm công */
.att-photos { display: flex; gap: .8rem; flex-wrap: wrap; }
.att-photos figure { margin: 0; text-align: center; }
.att-photos img { width: 110px; height: 110px; object-fit: cover; border-radius: 14px; cursor: zoom-in; border: 1px solid var(--line); }
.att-photos figcaption { font-size: var(--fs-sm); color: var(--muted); margin-top: .2rem; }
.att-photo-big { width: 100%; max-width: 360px; display: block; margin: 0 auto; border-radius: 16px; }
/* Cảnh báo tăng ca */
.ot-card { border-left: 4px solid var(--bad); }
.ot-card h3 { display: flex; align-items: center; gap: .4rem; }
.ot-card h3 .i { color: var(--bad); }
.ot-list { list-style: none; margin: 0 0 .5rem; padding: 0; display: grid; gap: .7rem; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.ot-list li { background: var(--bg); border-radius: 12px; padding: .6rem .8rem; }
.ot-row { display: grid; grid-template-columns: 120px 1fr; align-items: center; gap: .5rem; margin-top: .3rem; }
.ot-row small { color: var(--muted); font-size: var(--fs-sm); }
.ot-bar { height: 7px; background: var(--line); border-radius: 99px; overflow: hidden; }
.ot-bar i { display: block; height: 100%; background: var(--warn); border-radius: inherit; }
.ot-bar.over i { background: var(--bad); }
/* Xác nhận bảng công */
.ts-confirm { border-left: 4px solid var(--warn); }
.ts-confirm.agreed { border-left-color: var(--ok); }
.ts-confirm.disputed { border-left-color: var(--bad); }
.ts-head { display: flex; gap: .9rem; align-items: flex-start; }
.ts-head .i.big { width: 30px; height: 30px; flex: none; color: var(--warn); }
.ts-confirm.agreed .ts-head .i.big { color: var(--ok); }
.ts-confirm.disputed .ts-head .i.big { color: var(--bad); }
.ts-head h3 { margin: 0 0 .2rem; }
.ts-head p { margin: .15rem 0 0; }
.ts-confirm .btn-row { margin-top: .9rem; }
.ts-admin .card-head { flex-wrap: wrap; }
.ts-admin .card-head .tag { margin-left: .2rem; }
.payroll-table td .tag { font-size: var(--fs-xs); vertical-align: 1px; }
@media (max-width: 640px) {
  .ts-confirm .btn-row .btn { flex: 1; }
  .ot-row { grid-template-columns: 105px 1fr; }
}

/* ===================== 012 – Thông tin cửa hàng & Quản lý người dùng ===================== */
.store-form .grid2 { margin-bottom: .2rem; }
.store-form .btn-row { align-items: center; gap: 1rem; }
.store-plan { display: flex; align-items: center; gap: 1rem 2rem; flex-wrap: wrap; padding: 1rem 1.3rem 1.2rem; }
.store-plan > div { display: flex; flex-direction: column; gap: .1rem; }
.store-plan b { font-size: var(--fs-md); }
.store-plan .btn { margin-left: auto; }
.user-list { padding: .2rem 1.3rem 1rem; }
.user-row { display: flex; align-items: center; gap: .8rem; padding: .8rem 0; border-top: 1px solid var(--line); }
.user-row:first-child { border-top: 0; }
.user-row b { display: block; font-weight: 600; }
.user-row small { display: block; font-size: var(--fs-sm); margin-top: .1rem; }
.user-row b small { display: inline; font-weight: 400; }
.role-table { margin: .9rem 1.3rem 1.2rem; border: 1px solid var(--line); border-radius: 10px; }
.perm-list { display: grid; gap: .4rem; }
.perm-item { display: flex; align-items: flex-start; gap: .65rem; padding: .6rem .75rem; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.perm-item:has(input:checked) { border-color: var(--brand); background: var(--brand-l); }
.perm-item input { width: 18px; height: 18px; min-height: 0; margin-top: .15rem; accent-color: var(--brand); flex: none; }
.perm-item b { display: block; font-weight: 600; font-size: var(--fs-base); }
.perm-item small { color: var(--muted); font-size: var(--fs-sm); }
@media (max-width: 760px) {
  .store-plan { padding: 1rem; gap: .8rem 1.4rem; }
  .store-plan .btn { margin-left: 0; width: 100%; }
  .user-list { padding: .2rem 1rem .8rem; }
  .user-row { flex-wrap: wrap; }
  .user-row .grow { flex: 1 1 calc(100% - 60px); }
  .user-row .btn { margin-left: calc(36px + .8rem); }
  .role-table { margin: .8rem 1rem 1rem; }
}

/* ===================== 011 – Bộ lọc ngang (Nhật ký thao tác) ===================== */
.au-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .7rem 1rem; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: .8rem 1rem; margin-bottom: .8rem; }
.au-f { display: flex; flex-direction: column; gap: .25rem; min-width: 0; }
.au-f > span:first-child { font-size: var(--fs-sm); font-weight: 600; color: var(--muted); }
.au-f input.date-vn { width: 130px; }
.au-f select { width: auto; min-width: 170px; }
.au-f .chips { flex-wrap: nowrap; }
.au-f .chip { min-height: 38px; padding: .3em .85em; }
@media (max-width: 760px) {
  .au-filters { display: grid; grid-template-columns: 1fr 1fr; padding: .8rem; }
  .au-f input.date-vn, .au-f select { width: 100%; min-width: 0; }
  .au-f:has(.chips) { grid-column: 1 / -1; }
  .au-f .chips { overflow-x: auto; scrollbar-width: none; }
  .au-f .chip { flex: 1 0 auto; }
}

/* ===================== 011 – Chữ nhỏ hơn trên máy tính (hiện được nhiều thông tin hơn) ===================== */
/* Các cỡ chữ dùng rem đều theo cỡ gốc của html ⇒ giảm cỡ gốc 16 → 15px; chữ thường 15 → 14px. Điện thoại giữ nguyên. */
@media (min-width: 900px) {
  html { font-size: 15px; }
  body { font-size: 14px; }
  .btn { min-height: 38px; }
  .btn.sm { min-height: 32px; }
  input, select, textarea { min-height: 38px; }
  .table td { padding: .55rem .75rem; }
  .data-table td { padding: .6rem .75rem; }
}

/* ===================== 014 – Vùng chạm tối thiểu 44px trên điện thoại / màn cảm ứng ===================== */
@media (max-width: 899px), (pointer: coarse) {
  .btn.sm { min-height: 44px; min-width: 44px; }
  .icon-btn { min-width: 44px; min-height: 44px; display: inline-grid; place-items: center; }
  .chip, .au-f .chip { min-height: 44px; }
  .bell, .avatar { width: 44px; height: 44px; }
  .seg b, .tabs button { min-height: 44px; }
  /* Link chữ: nới vùng chạm mà không đổi bố cục */
  .linkbtn, .link-more { position: relative; }
  .linkbtn::after, .link-more::after { content: ''; position: absolute; inset: -12px -6px; }
  /* Ô tick: to hơn, chạm cả ô bảng cũng được */
  .chk input, .radio input, .data-table .cb input { width: 22px; height: 22px; }
  .data-table .cb { width: 44px; cursor: pointer; }
  .brand { min-height: 44px; }
  .chk, .radio { min-height: 44px; }
}

/* ===================== 014 – Lưu: dấu ✓ cạnh ô, nhắc thay đổi chưa lưu, nút đang lưu ===================== */
.saved-tick { display: inline-flex; align-items: center; margin-left: .5rem; padding: .1em .55em; border-radius: 99px; background: var(--brand-l); color: var(--brand-d);
  font-size: var(--fs-xs); font-weight: 700; white-space: nowrap; vertical-align: middle; transition: opacity .4s; animation: fade .2s; }
.saved-tick.hide { opacity: 0; }
.dirty [data-save] { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent); }
.dirty .btn-row:has([data-save])::after { content: '● Còn thay đổi chưa lưu'; align-self: center; color: var(--warn); font-size: var(--fs-sm); font-weight: 600; }
.btn .spin.sm { margin-right: .45rem; border-color: rgba(255,255,255,.35); border-top-color: currentColor; vertical-align: -1px; }
.btn.ghost .spin.sm, .btn.outline .spin.sm { border-color: var(--line); border-top-color: var(--brand); }
/* Hộp xác nhận: luôn là hộp nhỏ giữa màn hình (không phủ toàn màn hình trên điện thoại) */
.modal-wrap.small { align-items: center; padding: 16px; }
.modal-wrap.small .modal { height: auto; max-width: 420px; border-radius: 18px; animation: fade .15s; }
.modal-wrap.small .modal header { padding-top: .8rem; border-bottom: 0; }
.modal-wrap.small .m-back { display: none; }
.modal-wrap.small .modal-body { flex: none; padding-top: 0; }
.modal-wrap.small .modal footer { border-radius: 0 0 18px 18px; box-shadow: none; }
.modal-wrap.small .modal footer .btn { flex: 1; }

/* ===================== 015 – Danh sách chọn giờ (00:00 … 23:45, cách 15 phút) ===================== */
.tpick { position: fixed; z-index: 70; max-height: 300px; overflow-y: auto; overscroll-behavior: contain; padding: .35rem;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(16, 40, 30, .18); animation: fade .12s; }
.tpick button { display: block; width: 100%; min-height: 40px; padding: 0 .9rem; border: 0; border-radius: 8px; background: none; color: var(--ink);
  font: inherit; font-size: var(--fs-base); text-align: left; font-variant-numeric: tabular-nums; cursor: pointer; }
.tpick button:hover { background: var(--bg); }
.tpick button.on { background: var(--brand-l); color: var(--brand-d); font-weight: 600; }
@media (max-width: 899px), (pointer: coarse) { .tpick button { min-height: 44px; } }
/* Ô giờ có biểu tượng đồng hồ bên phải */
input.time24 { cursor: pointer; padding-right: 2.3rem;
  background: var(--card) url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%2314201b%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Ccircle%20cx%3D%2212%22%20cy%3D%2212%22%20r%3D%229%22%2F%3E%3Cpath%20d%3D%22M12%207v5l3%202%22%2F%3E%3C%2Fsvg%3E") right .7rem center / 18px no-repeat; }
:root[data-theme="dark"] input.time24 { background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%23e7eeea%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Ccircle%20cx%3D%2212%22%20cy%3D%2212%22%20r%3D%229%22%2F%3E%3Cpath%20d%3D%22M12%207v5l3%202%22%2F%3E%3C%2Fsvg%3E"); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) input.time24 { background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%23e7eeea%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Ccircle%20cx%3D%2212%22%20cy%3D%2212%22%20r%3D%229%22%2F%3E%3Cpath%20d%3D%22M12%207v5l3%202%22%2F%3E%3C%2Fsvg%3E"); } }

/* ===================== 016 – Máy chấm công ZKTeco ===================== */
.zk-dev { display: flex; align-items: center; gap: .8rem; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.zk-dev:last-child { border-bottom: 0; }
.zk-ico { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 11px; background: var(--brand-l); color: var(--brand-d); }
.zk-info { flex: 1; min-width: 0; }
.zk-info b, .zk-info small { display: block; overflow: hidden; text-overflow: ellipsis; }
.zk-guide ol { margin: 0; padding-left: 1.2rem; display: grid; gap: .45rem; }
.zk-copy { cursor: pointer; padding: .15em .5em; border-radius: 6px; background: var(--brand-l); color: var(--brand-d); font-weight: 600; word-break: break-all; }
.zk-copy:hover { text-decoration: underline; }
.zk-map select { min-width: 200px; max-width: 100%; }
.zk-map select.unset { border-color: var(--warn); color: var(--warn); }
@media (max-width: 640px) { .zk-map select { min-width: 0; width: 100%; } }

/* ===================== 017 – Trang menu chức năng kiểu thẻ nhóm (điện thoại) ===================== */
.fn-menu { display: grid; gap: .75rem; }
.fn-card { background: var(--card); border-radius: 16px; padding: 1rem 1.1rem .45rem; box-shadow: var(--shadow); }
.fn-card h3 { margin: 0 0 .35rem; font-size: var(--fs-md); font-weight: 600; }
.fn-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: .75rem; }
.fn-item { display: flex; align-items: center; gap: .7rem; min-height: 56px; padding: .35rem 0; color: var(--ink); -webkit-tap-highlight-color: transparent; }
.fn-item:active .fn-lbl { color: var(--brand); }
.fn-ico { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 10px; background: var(--brand-l); color: var(--brand); }
.fn-ico .i { width: 20px; height: 20px; stroke-width: 2.1; }
.fn-lbl { font-size: var(--fs-base); font-weight: 500; line-height: 1.3; min-width: 0; }

/* ===================== 018 – Chọn cột hiển thị cho bảng danh sách ===================== */
.tbl-tools { display: flex; justify-content: flex-end; margin: 0 0 .5rem; }
.tbl-tools .btn { gap: .35rem; }
.tbl-tools .i { width: 17px; height: 17px; }
.colpop { position: fixed; z-index: 70; width: min(440px, calc(100vw - 16px)); max-height: min(70vh, 460px); overflow-y: auto; padding: .9rem 1rem .6rem;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 32px rgba(16, 40, 30, .18); animation: fade .12s; }
.colpop-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .15rem 1rem; }
.colpop .chk { min-height: 38px; }
.colpop .chk input:disabled + span { color: var(--muted); }
.colpop-foot { display: flex; justify-content: flex-end; border-top: 1px solid var(--line); margin-top: .5rem; padding-top: .55rem; font-size: var(--fs-sm); }
/* Điện thoại: bảng đã tự rút gọn cột ⇒ không cần nút chọn cột */
@media (max-width: 640px) { .tbl-tools, [data-cols-slot] { display: none; } }

/* ===================== 019 – Đầu trang danh sách 1 hàng (máy tính): tiêu đề · tìm kiếm · nút thao tác · cột ===================== */
.page-head:has(.in-head) { flex-wrap: nowrap; }
.page-head:has(.in-head) .ph-title { flex: none; max-width: 30%; }
.page-head .in-head { flex: 1 1 auto; min-width: 0; margin: 0 0 0 1rem; flex-wrap: nowrap; }
.page-head .in-head .grow { display: none; }
.page-head .in-head > small { white-space: nowrap; }
.page-head > [data-cols-slot] { flex: none; }
.page-head > [data-cols-slot]:empty { display: none; }
.page-head .page-actions { flex: none; flex-wrap: nowrap; }
/* Lịch / chấm công tuần: ô chọn nhân viên gọn hơn khi lên hàng tiêu đề; nhãn ca nằm trên cùng ô */
.page-head .in-head .select-box { flex: 0 1 230px; }
.page-head .in-head .week-pick, .page-head .in-head .view-sel { flex: none; }
.week-grid td.sticky { vertical-align: top; }
/* Bộ lọc ngày + tab khi lên hàng tiêu đề: 1 dòng, không chừa lề dưới */
.page-head .in-head .filters { flex-wrap: nowrap; margin: 0; flex: none; }
.page-head .in-head .filters > .date-vn { flex: none; width: 128px; }
.page-head .in-head .filters > select { flex: none; width: 190px; }
.page-head .in-head .tabs { margin: 0; flex: none; }
.page-head .in-head .tabs button { padding: .4em .8em; }

/* ===================== 020 – Tối ưu điện thoại: đầu trang 1 hàng, nút chính nổi, thanh lọc gọn ===================== */
@media (max-width: 640px) {
  /* Đầu trang: ‹ · tiêu đề · nút phụ (chỉ biểu tượng) · ⋯ */
  .page-head { flex-wrap: nowrap; gap: .5rem; margin-bottom: .8rem; }
  .ph-title { flex: 1 1 auto; min-width: 0; }
  .ph-title .crumb { display: none; }
  .page-actions { width: auto; flex: none; overflow: visible; flex-wrap: nowrap; gap: .35rem; }
  .page-actions .btn.ghost .lbl { display: none; }
  .page-actions .btn.ghost:has(.lbl) { min-width: 44px; padding: 0 .6rem; gap: .25rem; }
  /* Nút chính: nút nổi góc phải, phía trên thanh menu dưới */
  .page-actions > .fab { position: fixed; right: 16px; bottom: calc(var(--nav-h) + 14px + env(safe-area-inset-bottom)); z-index: 30;
    min-height: 50px; padding: 0 1.15rem; border-radius: 99px; background: var(--brand); border-color: var(--brand); color: #fff;
    font-size: var(--fs-base); box-shadow: 0 8px 24px color-mix(in srgb, var(--brand) 40%, transparent), 0 2px 6px rgba(0, 0, 0, .12); }
  .page-actions > .fab .i { color: #fff; }
  .page:has(.page-actions > .fab) { padding-bottom: calc(var(--nav-h) + 96px); }
  /* Thanh lọc: gom thành ít hàng */
  .toolbar { gap: .5rem; }
  .toolbar > .filter-toggle { flex: none; min-width: 44px; padding: 0 .7rem; }
  .toolbar:has(> .filter-toggle) > .search-box { flex: 1 1 0; flex-basis: 0; min-width: 0; }
  /* Lịch / chấm công tuần: [chọn NV | kiểu xem] trên 1 hàng, [‹ tuần ›] hàng dưới */
  .toolbar > .select-box { flex: 1 1 0; min-width: 0; max-width: none; }
  .toolbar > .view-sel { flex: 0 1 46%; max-width: 46%; min-width: 0; }
  .toolbar > .view-sel select { width: 100%; min-width: 0; text-overflow: ellipsis; }
  .toolbar > .view-sel > .i { display: none; }
  .toolbar > .grow, .period-bar > .grow { display: none; }
  .period-bar > select { flex: 1 1 220px; min-width: 0; }
  .period-bar > small.muted { flex-basis: 100%; }
  /* Chấm công tổng hợp / chi tiết: 2 ô ngày cạnh nhau, nhân viên 1 hàng */
  .toolbar > .filters { flex: 1 1 100%; margin: 0; }
  .toolbar > .filters > .date-vn { flex: 1 1 0; min-width: 0; }
  .toolbar > .filters > select { flex: 1 1 100%; }
  .toolbar > .week-pick { order: 5; flex: 1 1 100%; justify-content: space-between; }
  .toolbar > #thisWeek { order: 6; }
  /* Đơn từ: [tab] [loại đơn] cùng hàng */
  .toolbar > .tabs.inline { flex: 0 1 auto; margin: 0; }
  .toolbar > .tabs.inline + .view-sel { flex: 1 1 0; }
  .toolbar > .tabs.inline + .view-sel select { width: 100%; }
  .toolbar > small.muted { flex-basis: 100%; }
  /* Bảng nhỏ trong Thiết lập (phụ cấp, giảm trừ…): mỗi dòng thành 1 thẻ, không tràn ngang */
  .mini-table, .mini-table tbody { display: block; }
  .mini-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: .5rem; padding: .55rem 0; border-bottom: 1px solid var(--line); }
  .mini-table tr:last-child { border-bottom: 0; }
  .mini-table td { display: block; padding: 0; border: 0; }
  .mini-table td:first-child { font-weight: 600; }
  .mini-table td:not(:first-child):not(.actions) { font-size: var(--fs-sm); color: var(--muted); }
  .mini-table td.actions { grid-column: 2; grid-row: 1 / span 4; align-self: center; }
}
/* Máy chấm công: danh sách dòng máy hỗ trợ */
.zk-models { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .6rem; margin: .6rem 0 .9rem; }
.zk-model { border: 1px solid var(--line); border-radius: 12px; padding: .7rem .8rem; }
.zk-model-head { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; margin-bottom: .45rem; }
.zk-model-head small { text-align: right; }
.zk-chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.zk-chip { padding: .2em .6em; border-radius: 8px; background: var(--brand-l); color: var(--brand-d); font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; }
.zk-check { background: var(--bg); border-radius: 12px; padding: .8rem .9rem; }
.zk-check > b { display: flex; align-items: center; gap: .4rem; }
.zk-check > b .i { width: 18px; height: 18px; color: var(--brand); }
.zk-check ol { margin: .5rem 0 .4rem; padding-left: 1.2rem; display: grid; gap: .35rem; }
/* Logo trang đăng nhập dẫn về trang giới thiệu */
.auth-home { display: inline-flex; flex-direction: column; align-items: center; color: inherit; text-decoration: none; }
.auth-home:hover h1 { color: var(--brand); }
/* Quản trị viên nền tảng */
.adm-list { display: grid; gap: .1rem; margin-bottom: .6rem; }
.adm-row { display: flex; align-items: center; gap: .7rem; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.adm-row:last-child { border-bottom: 0; }
.adm-info { flex: 1; min-width: 0; }
.adm-info b, .adm-info small { display: block; overflow: hidden; text-overflow: ellipsis; }
.adm-perm { width: 120px; text-align: right; }
.adm-role { align-items: flex-start; margin: .35rem 0; }
@media (max-width: 640px) { .adm-perm { display: none; } }

/* ===================== 021 – PWA: cập nhật bản mới, mất mạng, cài lên điện thoại ===================== */
.upd-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); z-index: 80;
  display: flex; align-items: center; gap: .7rem; padding: .55rem .6rem .55rem 1rem; border-radius: 14px; background: #14201b; color: #fff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25); font-weight: 600; white-space: nowrap; animation: fade .2s; }
.upd-bar .i { color: var(--sun, #ffd166); }
@media (min-width: 900px) { .upd-bar { bottom: 24px; } }
.net-bar { position: sticky; top: 0; z-index: 90; display: flex; align-items: center; justify-content: center; gap: .5rem; padding: .5rem 1rem;
  background: var(--warn-l); color: var(--warn); font-size: var(--fs-sm); font-weight: 600; text-align: center; }
.net-bar .i { width: 18px; height: 18px; flex: none; }
.inst { text-align: center; display: grid; gap: .9rem; justify-items: center; }
.inst img { border-radius: 16px; box-shadow: var(--shadow); }
.inst .btn { min-width: 200px; }
.inst-steps { text-align: left; margin: 0; padding-left: 1.2rem; display: grid; gap: .45rem; }
.inst-ico { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; background: var(--bg); font-size: 13px; }

/* ===================== 022 – Lịch chọn ngày (mọi ô dd/mm/yyyy) ===================== */
.dpick { position: fixed; z-index: 70; width: 280px; max-width: calc(100vw - 16px); padding: .45rem .5rem; background: var(--card); color: var(--ink);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 32px rgba(16, 40, 30, .18); animation: fade .12s; }
.dp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .1rem; }
.dp-head b { font-size: var(--fs-base); }
.dpick button { border: 0; background: none; color: inherit; font: inherit; cursor: pointer; border-radius: 10px; }
.dp-nav { width: 36px; height: 34px; font-size: 1.4rem !important; line-height: 1; color: var(--muted) !important; }
.dp-nav:hover, .dp-grid button:hover, .dp-foot button:hover { background: var(--bg); }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dp-dow span { text-align: center; font-size: var(--fs-xs); font-weight: 600; color: var(--muted); padding: .1rem 0; }
.dp-grid button { height: 34px; font-variant-numeric: tabular-nums; font-size: var(--fs-sm); }
.dp-grid button.sun { color: var(--danger, #d64545); }
.dp-grid button.today { box-shadow: inset 0 0 0 1.5px var(--brand); font-weight: 600; }
.dp-grid button.on { background: var(--brand); color: #fff; font-weight: 700; }
.dp-foot { display: flex; justify-content: space-between; margin-top: .25rem; padding-top: .25rem; border-top: 1px solid var(--line); }
.dp-foot button { min-height: 34px; padding: 0 .8rem; color: var(--brand-d); font-weight: 600; }
@media (max-width: 899px), (pointer: coarse) { .dp-grid button { height: 40px; } .dpick { width: 312px; } }
/* Ô ngày có biểu tượng lịch bên phải */
input.date-vn { cursor: pointer; padding-right: 2.3rem;
  background: var(--card) url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%2314201b%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Crect%20x%3D%223%22%20y%3D%225%22%20width%3D%2218%22%20height%3D%2216%22%20rx%3D%222%22%2F%3E%3Cpath%20d%3D%22M16%203v4M8%203v4M3%2011h18%22%2F%3E%3C%2Fsvg%3E") right .7rem center / 18px no-repeat; }
:root[data-theme="dark"] input.date-vn { background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%23e7eeea%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Crect%20x%3D%223%22%20y%3D%225%22%20width%3D%2218%22%20height%3D%2216%22%20rx%3D%222%22%2F%3E%3Cpath%20d%3D%22M16%203v4M8%203v4M3%2011h18%22%2F%3E%3C%2Fsvg%3E"); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) input.date-vn { background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%23e7eeea%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Crect%20x%3D%223%22%20y%3D%225%22%20width%3D%2218%22%20height%3D%2216%22%20rx%3D%222%22%2F%3E%3Cpath%20d%3D%22M16%203v4M8%203v4M3%2011h18%22%2F%3E%3C%2Fsvg%3E"); } }

/* ===================== 023 – Số phiên bản app ===================== */
.app-ver { position: fixed; right: 10px; bottom: 6px; z-index: 5; font-size: 11px; color: var(--muted); pointer-events: none;
  padding: 1px 8px; border-radius: 999px; background: color-mix(in srgb, var(--bg) 85%, transparent);
  font-variant-numeric: tabular-nums; }
@media (max-width: 760px) { .app-ver { display: none; } }
.hub-ver { text-align: center; color: var(--muted); font-size: var(--fs-xs); margin: 1.2rem 0 .4rem; font-variant-numeric: tabular-nums; }

/* ===================== 024 – Trang đăng ký khi trình duyệt đang đăng nhập sẵn ===================== */
.auth-signed { background: var(--warn-l); color: var(--ink); border-radius: 10px; padding: .65rem .8rem; font-size: var(--fs-sm); line-height: 1.5; margin-bottom: .9rem; }
.auth-signed a { display: inline-block; margin-top: .2rem; font-weight: 600; color: var(--brand-d); }

/* ===================== 025 – Danh sách nhân viên: chi tiết xổ xuống dưới dòng ===================== */
.data-table tr.open > td { background: var(--brand-l); }
.data-table tr.emp-detail > td { padding: 0 !important; background: var(--bg); cursor: default; }
.ed-card { margin: .5rem .7rem .8rem; padding: 1rem 1.1rem .9rem; background: var(--card); border: 1px solid var(--line); border-top: 3px solid var(--brand);
  border-radius: 0 0 14px 14px; box-shadow: 0 6px 18px rgba(16, 40, 30, .06); animation: fade .15s; white-space: normal;
  position: sticky; left: .7rem; box-sizing: border-box; }
.ed-head { display: flex; align-items: center; gap: .8rem; margin-bottom: .9rem; }
.ed-head .av-lg { width: 48px; height: 48px; font-size: var(--fs-base); flex: none; }
.data-table tr.open .av { background: var(--card); box-shadow: 0 0 0 1px var(--line); }
.ed-name { font-size: var(--fs-md); }
.ed-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .4rem 1.6rem; }
.ed-col h4 { margin: 0 0 .3rem; font-size: var(--fs-sm); color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.ed-it { display: grid; grid-template-columns: 9.5rem 1fr; gap: .6rem; padding: .38rem 0; border-bottom: 1px dashed var(--line); font-size: var(--fs-sm); }
.ed-it > small { color: var(--muted); font-size: var(--fs-sm); }
.ed-it > span { font-weight: 500; overflow-wrap: anywhere; }
.ed-note { margin: .7rem 0 0; font-size: var(--fs-sm); }
.ed-note small { display: block; color: var(--muted); }
.ed-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: .5rem; margin-top: .9rem; padding-top: .8rem; border-top: 1px solid var(--line); }
@media (max-width: 1100px) { .ed-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .ed-card { margin: .3rem .2rem .6rem; padding: .8rem .8rem .7rem; }
  .ed-grid { grid-template-columns: 1fr; }
  .ed-it { grid-template-columns: 8.5rem 1fr; }
  .ed-actions .btn { flex: 1 1 0; min-height: 44px; }
}

/* ===================== 026 – Lịch làm việc: chuyển tuần mượt ===================== */
.sched-busy .sched-wrap, .sched-busy .week-agenda, .sched-busy .week-pick b { opacity: .55; transition: opacity .12s; pointer-events: none; }

/* ===================== 027 – Biểu tượng tải: logo Tickly tròn đứng yên, vòng sáng trắng chạy quanh viền ===================== */
.loading { flex-direction: column; gap: .75rem; font-size: var(--fs-sm); }
.loading .spin { position: relative; width: 52px; height: 52px; border: 0; border-radius: 50%; animation: none;
  background: url('../img/logo-tron.svg') center / contain no-repeat; box-shadow: 0 6px 18px rgba(15, 157, 118, .28); }
.loading.full .spin { width: 64px; height: 64px; }
.loading .spin::after { content: ''; position: absolute; inset: 5%; border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 45%, rgba(255, 255, 255, .35) 70%, #fff 95%, transparent 96%);
  -webkit-mask: radial-gradient(farthest-side, transparent 83%, #000 85%);
  mask: radial-gradient(farthest-side, transparent 83%, #000 85%);
  filter: drop-shadow(0 0 3px rgba(255, 255, 255, .95)); animation: spin 1s linear infinite; }
@media (prefers-reduced-motion: reduce) { .loading .spin::after { animation: ringPulse 1.4s ease-in-out infinite; background: #fff; } }
@keyframes ringPulse { 50% { opacity: .2; } }
/* Tải cả trang ⇒ logo nằm chính giữa màn hình (không dính sát dưới tiêu đề); tải trong ô / thẻ thì giữ tại chỗ */
#view > .loading:only-child { position: fixed; inset: 0; z-index: 5; padding: 0; pointer-events: none; }

/* ===================== 028 – Sửa lỗi sau đợt quét giao diện ===================== */
/* Ô nhập + nút Thêm: thẻ hẹp thì nút xuống dòng, ô nhập luôn đủ rộng */
.inline-form { flex-wrap: wrap; }
.inline-form input { flex: 1 1 170px; min-width: 0; }
/* Nhãn, huy hiệu không bị gãy dòng */
.badge { white-space: nowrap; display: inline-block; }
/* Bảng hoa hồng: ô % riêng đủ chỗ cho chữ "Theo bậc" */
.cm-table .cm-rate { width: 100px; }
/* Danh sách dạng bảng trên điện thoại: thu gọn cột tick + avatar để tên nằm 1 dòng */
@media (max-width: 760px) {
  .data-table th.cb, .data-table td.cb { width: 32px; padding-left: .55rem !important; padding-right: 0 !important; }
  .data-table th.av-col, .data-table td.av-col { width: 38px; padding-left: .35rem !important; padding-right: .2rem !important; }
  .data-table td .status { font-size: var(--fs-xs); white-space: nowrap; }
  .data-table td small.show-sm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  /* Popup tạo đơn: ô loại đơn gọn 1 dòng */
  .type-opt { font-size: var(--fs-sm); padding: .6rem .55rem; gap: .4rem; }
  .type-opt .i { width: 18px; height: 18px; flex: none; }
}
/* Số phiên bản: nằm cuối trang (không nổi đè lên nội dung khi cuộn) */
.app-ver { position: static; display: block; width: max-content; margin: -.5rem 16px 14px auto; background: none; padding: 0; }

/* ===================== 029 – PIN bảo mật, Vùng nguy hiểm, xoá cửa hàng ===================== */
.set-card.danger-zone { border: 1.5px solid color-mix(in srgb, var(--bad) 45%, var(--line)); }
.set-card.danger-zone .set-card-head h2 { color: var(--bad); }
.del-warn { display: flex; gap: .7rem; padding: .8rem .9rem; margin-bottom: .9rem; border-radius: 12px; background: var(--bad-l); color: var(--ink); font-size: var(--fs-sm); line-height: 1.5; }
.del-warn > .i { color: var(--bad); width: 22px; height: 22px; flex: none; margin-top: 1px; }
.del-warn ul { margin: .35rem 0 0; padding-left: 1.1rem; }
input.pin6 { letter-spacing: .35em; font-variant-numeric: tabular-nums; max-width: 200px; }
.pf-ops { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .3rem; }
/* Đang mở popup ⇒ tạm ẩn thanh "Đã có bản Tickly mới" để không che nút Lưu / Huỷ (đóng popup là hiện lại) */
body.no-scroll .upd-bar { display: none; }

/* ===================== 030 – Mã QR chấm công (chỉ QR in sẵn) ===================== */
.k-main.one { grid-template-columns: 1fr; justify-items: center; align-content: start; padding-top: 1rem; }
.kiosk.static .k-print-name { display: block; font-size: var(--fs-lg); font-weight: 700; margin-bottom: .6rem; color: #14201b; }
.k-hint { max-width: 520px; line-height: 1.6; }
@media print { .k-hint { display: none !important; } }
@media (max-width: 640px) { .kiosk header .k-store { order: -1; flex-basis: 100%; } .k-actions { flex: 1; justify-content: flex-end; } }
/* Số phiên bản: chỉ ở cuối Thiết lập chung (máy tính: cuối nội dung; điện thoại: cuối lưới ô Thiết lập) */
.set-ver { margin-top: 1.6rem; }
@media (max-width: 760px) { .set-ver { display: none; } }

/* ===================== 031 – Ngắt trang danh sách (bảng dài hơn 10 dòng) ===================== */
.pager { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: .4rem .9rem; padding: .6rem .8rem; font-size: var(--fs-sm); color: var(--muted); }
.pager .pg-nav { display: inline-flex; align-items: center; gap: .15rem; }
.pager .pg-nav b { min-width: 3.6rem; text-align: center; color: var(--ink); font-variant-numeric: tabular-nums; }
.pager .icon-btn { width: 34px; height: 34px; font-size: 1.1rem; border-radius: 8px; }
.pager .icon-btn:disabled { opacity: .35; cursor: default; }
.pager .pg-size select { width: auto; min-height: 34px; padding: .2rem 1.8rem .2rem .6rem; font-size: var(--fs-sm); }
.pager .pg-info { font-variant-numeric: tabular-nums; margin-right: auto; }
@media (max-width: 760px) { .pager { justify-content: space-between; padding: .6rem .3rem; } .pager .icon-btn { width: 40px; height: 40px; } }
/* Quản trị Tickly: danh sách tài khoản của cửa hàng, có nút Đặt lại mật khẩu */
.pf-emps { max-height: 320px; overflow-y: auto; }
.pf-emps .pf-emp { display: flex; align-items: center; gap: .5rem; padding: .35rem 0; border-bottom: 1px dashed var(--line); }
.pf-emps .pf-emp:last-child { border-bottom: 0; }
.pf-emps .pf-emp .btn { flex: none; white-space: nowrap; }

/* ===================== 032 – Quản trị Tickly: chi tiết cửa hàng rộng + chia tab ===================== */
.modal.wide.xwide { max-width: 1040px; }
.modal.xwide .modal-body { min-height: 440px; }
.pf-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem 2rem; }
.pf-dl { display: grid; grid-template-columns: 9.5rem 1fr; gap: .5rem 1rem; margin: 0; font-size: var(--fs-sm); }
.pf-dl dt { color: var(--muted); }
.pf-dl dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.spark.tall { height: 140px; }
.pf-emps.grid { max-height: none; overflow: visible; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 2rem; }
.pf-op { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .9rem 0; border-bottom: 1px solid var(--line); }
.pf-op:last-child { border-bottom: 0; }
.pf-op .btn { flex: none; }
@media (max-width: 760px) {
  .pf-cols, .pf-emps.grid { grid-template-columns: 1fr; }
  .pf-dl { grid-template-columns: 8rem 1fr; }
  .pf-op { flex-direction: column; align-items: stretch; }
}

/* ===================== 033 – Thêm ngày lễ theo quy định ===================== */
.btn-row.tight { display: inline-flex; gap: .4rem; flex-wrap: wrap; margin: 0; }
.law-list { display: grid; gap: .1rem; margin: .4rem 0 .6rem; }
.law-hol { display: flex; align-items: center; gap: .7rem; padding: .6rem .2rem; border-bottom: 1px dashed var(--line); cursor: pointer; }
.law-hol:last-child { border-bottom: 0; }
.law-hol.has { opacity: .6; cursor: default; }
.law-hol input { width: 18px; height: 18px; flex: none; }

/* Ô chọn + nút thêm nhanh (Phòng ban / Chức danh trong hồ sơ nhân viên) */
.sel-add { display: flex; gap: .4rem; }
.sel-add select { flex: 1; min-width: 0; }
.sel-add .btn.icon-only { flex: none; width: 44px; padding: 0; justify-content: center; }

/* ===================== 034 – Bảng lương dạng nhập trực tiếp (Cập nhật bảng tính lương) ===================== */
.pay-sheet { margin: 0; }
.pay-sheet table { min-width: 1180px; }
.pay-sheet th, .pay-sheet td { white-space: nowrap; vertical-align: middle; }
.pay-sheet .pay-act { width: 44px; padding-left: .5rem !important; padding-right: 0 !important; }
.pay-sheet tr.pay-total th { background: var(--card); font-weight: 700; color: var(--ink); font-size: var(--fs-base); border-bottom: 2px solid var(--line); text-transform: none; letter-spacing: 0; }
.pay-sheet .pay-in { width: 118px; text-align: right; font-variant-numeric: tabular-nums; min-height: 38px; padding: .35rem .6rem; }
.pay-sheet .pay-name { font-weight: 700; color: var(--brand-d); padding: 0; text-align: left; }
.pay-sheet .pay-name:hover { text-decoration: underline; }
.pay-sheet tr.pay-miss { display: none; }
.pay-sheet td[data-c="net"] b { font-variant-numeric: tabular-nums; }
.pay-search { flex: 0 1 300px; min-width: 200px; }
.pay-sheet.dirty { box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 35%, transparent); }
.pay-sheet .pay-allow { display: inline-flex; align-items: center; gap: .3rem; }
.pay-sheet .pay-allow .tag { font-style: normal; font-size: var(--fs-xs); }
.pay-sheet .pay-in::placeholder { color: var(--muted); opacity: .8; }
/* Bảng lương: thu gọn để cột Thực lĩnh vừa màn 1366–1440px */
.pay-sheet table { min-width: 0; }
.pay-sheet .pay-in { width: 96px; padding: .3rem .5rem; }
.pay-sheet th, .pay-sheet td { padding-left: .55rem; padding-right: .55rem; }
.pay-sheet thead tr:first-child th { white-space: normal; line-height: 1.25; }

/* ===================== 035 – Bảng lương: cột đều, ô nhập thẳng hàng ===================== */
.pay-sheet table { table-layout: fixed; width: 100%; min-width: 1120px; }
.pay-sheet col.c-act { width: 44px; } .pay-sheet col.c-stt { width: 48px; } .pay-sheet col.c-name { width: auto; } .pay-sheet col.c-num { width: 7.6%; }
.pay-sheet th, .pay-sheet td { padding: .55rem .5rem; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; }
.pay-sheet thead tr:first-child th { white-space: normal; vertical-align: bottom; }
.pay-sheet td.num, .pay-sheet th.num { text-align: right; }
.pay-sheet .pay-in { width: 100%; min-width: 0; box-sizing: border-box; text-align: right; padding: .35rem .5rem; min-height: 36px; font: inherit; }
.pay-sheet .pay-allow { display: flex; align-items: center; gap: .25rem; width: 100%; }
.pay-sheet .pay-allow .pay-in { flex: 1; }
.pay-sheet .pay-allow .tag { flex: none; padding: 0 .3em; }
.pay-sheet td:nth-child(3) { white-space: normal; }
.pay-sheet td:nth-child(3) small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pay-sheet tr.pay-total th { padding-top: .7rem; padding-bottom: .7rem; }
.pay-sheet tr.pay-total th:nth-child(3) { text-align: left; }
/* Số thường lùi vào bằng đúng phần đệm của ô nhập ⇒ chữ số cột nhập và cột thường thẳng hàng */
.pay-sheet td.num, .pay-sheet th.num { padding-right: calc(.5rem + .5rem + 1px); }
.pay-sheet td.num:has(.pay-in) { padding-right: .5rem; }

/* ===================== 036 – Ô chọn Phường / Xã / Đặc khu (gõ để tìm, lọc theo tỉnh) ===================== */
.addr-box { position: relative; display: block; }
.addr-dd { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: .25rem; list-style: none;
  max-height: 260px; overflow-y: auto; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 28px rgba(0,0,0,.14); }
.addr-dd li { padding: .5rem .6rem; border-radius: 7px; cursor: pointer; display: flex; justify-content: space-between; gap: .75rem; font-weight: 500; }
.addr-dd li small { color: var(--muted); font-weight: 400; white-space: nowrap; }
.addr-dd li[data-w]:hover, .addr-dd li.on { background: var(--brand-l); }
.addr-dd li.addr-more { cursor: default; color: var(--muted); font-size: .85rem; font-weight: 400; }

/* ===================== 037 – Chọn ca khi chấm vào (app + trang quét QR) ===================== */
.shift-pick { width: 100%; max-width: 420px; margin: 1rem auto 0; text-align: left; }
.sp-title { margin: 0 0 .45rem; font-weight: 700; font-size: .92rem; color: var(--muted); text-align: center; }
.sp-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: .5rem; }
.sp-opt { --c: var(--brand); position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: .1rem; min-height: 56px;
  padding: .55rem .7rem .55rem .95rem; border: 1.5px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); font: inherit; cursor: pointer; text-align: left; }
.sp-opt::before { content: ''; position: absolute; left: .4rem; top: .6rem; bottom: .6rem; width: 3px; border-radius: 3px; background: var(--c); }
.sp-opt b { font-size: .95rem; }
.sp-opt small { color: var(--muted); font-size: .8rem; }
.sp-opt.on { border-color: var(--brand); background: var(--brand-l); box-shadow: 0 0 0 1px var(--brand) inset; }
.sp-opt.on::after { content: '✓'; position: absolute; right: .55rem; top: .45rem; color: var(--brand); font-weight: 800; }
.sp-opt:disabled { opacity: .5; cursor: not-allowed; }
.sp-opt.sp-un { --c: var(--muted); border-style: dashed; }
.punch-card .shift-pick + .round-punch { margin-top: .9rem; }

/* ===================== 038 – Hướng dẫn lần đầu + dữ liệu mẫu (Tổng quan) ===================== */
.onb-card { padding: 0; overflow: hidden; }
.onb-card .init-list li .grow { min-width: 0; }
.onb-demo { display: flex; align-items: center; gap: .75rem; margin: .8rem 1.3rem .4rem; padding: .75rem .9rem; border-radius: 12px; background: var(--brand-l); font-size: .92rem; }
.onb-demo .i { flex: none; color: var(--brand); }
.onb-demo span { flex: 1; }
.onb-demo .btn { flex: none; }
.onb-demo.on { background: var(--warn-l); }
.onb-demo.on .i { color: var(--warn, #b45309); }
.onb-foot { padding: .5rem 1.3rem .9rem; text-align: right; border-top: 1px solid var(--line); }
@media (max-width: 640px) {
  .onb-demo { flex-wrap: wrap; margin: .7rem 1rem .3rem; }
  .onb-demo .btn { width: 100%; }
  .onb-card .progress .bar { width: 80px; }
  .onb-card .init-list li { gap: .7rem; }
}

/* ===================== 039 – Điều khoản sử dụng & Chính sách bảo mật ===================== */
.chk.agree { display: flex; align-items: flex-start; gap: .55rem; margin: .2rem 0 1rem; font-size: .9rem; line-height: 1.45; color: var(--muted); cursor: pointer; }
.chk.agree input { flex: none; width: 18px; height: 18px; min-height: 0; margin: .1rem 0 0; accent-color: var(--brand); }
.chk.agree a, .legal-links a { color: var(--brand-d); font-weight: 600; }
.legal-links { font-size: .85rem; }
.legal-links a { text-decoration: none; }
.legal-links a:hover { text-decoration: underline; }
.hub-ver.legal-links, .set-ver.legal-links { margin-top: .15rem; font-size: var(--fs-xs); }

/* ===================== 040 – Màn hình Chấm công mới: nút lớn hơn, lỗi hiện ngay dưới nút, dấu ✓ khi xong ===================== */
.round-punch { width: 212px; height: 212px; }
.round-punch b { font-size: 1.85rem; }
.round-punch small { font-size: .95rem; max-width: 165px; }
@media (max-width: 340px) { .round-punch { width: 184px; height: 184px; } }
.punch-err { max-width: 380px; margin: .2rem auto .4rem; padding: .65rem .85rem; border-radius: 12px; background: var(--bad-l); color: var(--bad);
  font-weight: 600; font-size: .93rem; line-height: 1.4; text-align: center; }
.punch-err.shake { animation: shake .4s; }
.result-ico, .ps-ico { animation: tickPop .45s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes tickPop { 0% { transform: scale(.3); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.ps-time { animation: pop .4s ease .1s both; }
.shift-pick .sp-opt { min-height: 60px; }
.shift-pick .sp-opt b { font-size: 1rem; }
@media (prefers-reduced-motion: reduce) { .result-ico, .ps-ico, .ps-time, .punch-err.shake { animation: none; } }

/* ===================== 041 – Kính mờ có chọn lọc (đăng nhập, thanh trên/dưới, popup, màn hình chấm công)
   Chỉ bật khi trình duyệt hỗ trợ; máy yếu (html.no-glass) hoặc người dùng giảm trong suốt ⇒ nền đặc như cũ.
   Bảng lương, bảng công, ô nhập số giữ nền đặc để dễ đọc ===================== */
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  html:not(.no-glass) {
    --glass: color-mix(in srgb, var(--card) 70%, transparent);
    --glass-strong: color-mix(in srgb, var(--card) 82%, transparent);
    --glass-line: color-mix(in srgb, #fff 55%, transparent);
    --glass-blur: blur(18px) saturate(160%);
  }
  :root[data-theme="dark"]:not(.no-glass) { --glass-line: color-mix(in srgb, #fff 12%, transparent); }
  @media (prefers-color-scheme: dark) { :root:not([data-theme="light"]):not(.no-glass) { --glass-line: color-mix(in srgb, #fff 12%, transparent); } }

  /* Đăng nhập / đăng ký: thẻ kính trên nền gradient màu thương hiệu */
  html:not(.no-glass) .auth { position: relative; overflow: hidden; isolation: isolate;
    background: radial-gradient(700px 420px at 15% 10%, color-mix(in srgb, var(--brand) 32%, transparent), transparent 70%),
                radial-gradient(600px 420px at 90% 85%, color-mix(in srgb, var(--brand) 22%, #ffd166 18%), transparent 70%),
                radial-gradient(500px 300px at 85% 5%, color-mix(in srgb, var(--brand-l) 90%, transparent), transparent 70%), var(--bg); }
  html:not(.no-glass) .auth-card { background: var(--glass); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-line); box-shadow: 0 20px 50px rgba(16,40,30,.12), inset 0 1px 0 color-mix(in srgb, #fff 60%, transparent); }
  html:not(.no-glass) .auth-card input, html:not(.no-glass) .auth-card select, html:not(.no-glass) .auth-card .seg label { background: var(--card); }

  /* Thanh trên cùng & menu dưới: nội dung cuộn phía sau hiện mờ */
  html:not(.no-glass) .topbar { background: var(--glass-strong); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); }
  html:not(.no-glass) .bottomnav { background: var(--glass-strong); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
    border-top-color: var(--glass-line); }
  html:not(.no-glass) .page { padding-bottom: calc(var(--nav-h) + 2rem + env(safe-area-inset-bottom)); }

  /* Popup: làm mờ trang phía sau, bản thân popup vẫn nền đặc (chứa dữ liệu) */
  html:not(.no-glass) .modal-wrap, html:not(.no-glass) .sheet-wrap { background: rgba(10, 20, 15, .32); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }

  /* Màn hình chấm công: thẻ kính trên các đốm màu */
  html:not(.no-glass) .punch-card { position: relative; overflow: hidden; isolation: isolate; background: var(--glass);
    -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); border: 1px solid var(--glass-line); }
  html:not(.no-glass) .punch-card::before { content: ''; position: absolute; inset: -30%; z-index: -1; pointer-events: none;
    background: radial-gradient(40% 35% at 20% 20%, color-mix(in srgb, var(--brand) 22%, transparent), transparent 70%),
                radial-gradient(35% 30% at 85% 75%, color-mix(in srgb, #ffd166 30%, transparent), transparent 70%); }
  html:not(.no-glass) .punch-card.is-out::before { background: radial-gradient(40% 35% at 20% 20%, color-mix(in srgb, #f08a1c 22%, transparent), transparent 70%),
                radial-gradient(35% 30% at 85% 75%, color-mix(in srgb, var(--brand) 18%, transparent), transparent 70%); }
  html:not(.no-glass) .punch { background: radial-gradient(600px 380px at 10% 0%, color-mix(in srgb, var(--brand) 26%, transparent), transparent 70%),
                radial-gradient(500px 360px at 100% 100%, color-mix(in srgb, #ffd166 24%, transparent), transparent 70%), var(--bg); }
  html:not(.no-glass) .emp-card, html:not(.no-glass) .punch-state { background: var(--glass);
    -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); border-color: var(--glass-line); }
  html:not(.no-glass) .shift-pick .sp-opt:not(.on) { background: color-mix(in srgb, var(--card) 80%, transparent); }
}
@media (prefers-reduced-transparency: reduce) {
  .auth-card, .topbar, .bottomnav, .punch-card, .emp-card, .punch-state { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; background: var(--card) !important; }
}
/* Ô trạng thái Wifi trên màn hình chấm công: xuống dòng gọn thay vì chia 3 cột */
.punch-card .pill { flex-wrap: wrap; justify-content: center; text-align: center; max-width: 360px; border-radius: 14px; padding: .4em .9em; line-height: 1.35; }
.punch-card .pill small.block { flex-basis: 100%; font-weight: 500; }

/* ===================== 042 – Sai Wifi / GPS ⇒ gửi yêu cầu xác nhận giờ chấm công tới Quản lý ===================== */
.punch-ask { width: 100%; max-width: 380px; margin: .3rem auto .5rem; }
.punch-ask.two { display: grid; gap: .6rem; margin-top: 1rem; }
.punch-ask .btn .i { width: 18px; height: 18px; }
.punch-sent { display: flex; align-items: flex-start; gap: .5rem; margin: 0; padding: .65rem .85rem; border-radius: 12px; background: var(--brand-l); color: var(--brand-d); font-weight: 600; font-size: .93rem; line-height: 1.4; text-align: left; }
.punch-sent .i { flex: none; width: 18px; height: 18px; margin-top: .1rem; }
.ask-time { font-size: 1.15rem; margin: 0 0 .3rem; }
.ask-time b { font-size: 1.6rem; font-variant-numeric: tabular-nums; color: var(--brand-d); }
.emp-card .punch-err { margin-top: .8rem; }

/* ===================== 043 – Quên chấm ra + Báo cáo cuối ngày ===================== */
.punch-err.forgot { display: flex; align-items: flex-start; gap: .5rem; text-align: left; }
.punch-err.forgot .i { flex: none; width: 18px; height: 18px; margin-top: .1rem; }
.daily-card .card-head h3 { display: flex; align-items: center; gap: .45rem; }
.daily-card .card-head h3 .i { width: 18px; height: 18px; color: var(--brand); }
.dr-days { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; margin-bottom: .8rem; }
.chip-btn { height: 34px; padding: 0 .85rem; border-radius: 99px; border: 1px solid var(--line); background: var(--card); color: var(--muted); font: inherit; font-size: var(--fs-sm); font-weight: 600; cursor: pointer; }
.chip-btn.on { background: var(--brand-l); border-color: var(--brand); color: var(--brand-d); }
.dr-days .btn .i { width: 16px; height: 16px; }
.dr-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: .6rem; margin-bottom: .8rem; }
.dr-kpis > div { padding: .7rem .8rem; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); min-width: 0; }
.dr-kpis small { display: block; color: var(--muted); font-size: var(--fs-xs); font-weight: 600; }
.dr-kpis b { display: block; font-size: 1.45rem; line-height: 1.2; font-variant-numeric: tabular-nums; }
.dr-kpis em { display: block; font-style: normal; color: var(--muted); font-size: var(--fs-xs); }
.dr-kpis .warn b { color: var(--warn); }
.dr-kpis .bad b { color: var(--bad); }
.dr-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; margin-bottom: .6rem; }
.dr-sec { border: 1px solid var(--line); border-radius: 12px; padding: .6rem .75rem; min-width: 0; }
.dr-h { display: flex; align-items: center; gap: .45rem; }
.dr-h .i { width: 16px; height: 16px; flex: none; }
.dr-h b { flex: 1; font-size: var(--fs-sm); }
.dr-h span { min-width: 26px; height: 22px; padding: 0 .4rem; border-radius: 99px; display: grid; place-items: center; font-size: var(--fs-xs); font-weight: 700; background: var(--bg); }
.dr-sec.ok { opacity: .7; }
.dr-sec.ok .dr-h .i { color: var(--ok); }
.dr-sec.warn .dr-h .i, .dr-sec.warn .dr-h span { color: var(--warn); }
.dr-sec.warn .dr-h span { background: var(--warn-l); }
.dr-sec.bad .dr-h .i, .dr-sec.bad .dr-h span { color: var(--bad); }
.dr-sec.bad .dr-h span { background: var(--bad-l); }
.dr-list { list-style: none; margin: .45rem 0 0; padding: 0; font-size: var(--fs-sm); }
.dr-list li { padding: .3rem 0; border-top: 1px dashed var(--line); color: var(--muted); }
.dr-list li b { color: var(--ink); font-weight: 600; }
@media (max-width: 760px) {
  .dr-kpis, .dr-grid { grid-template-columns: repeat(2, 1fr); }
  .dr-days .grow { flex-basis: 100%; order: 3; }
}
@media (max-width: 420px) { .dr-grid { grid-template-columns: 1fr; } }

/* ===================== 044 – Gia hạn tự động qua VietQR ===================== */
.pay-wait { display: flex; align-items: center; justify-content: center; gap: .5rem; margin: .6rem 0 0; padding: .6rem; border-radius: 12px; background: var(--brand-l); color: var(--brand-d); font-weight: 600; font-size: var(--fs-sm); }
.pay-done { display: flex; align-items: center; gap: .8rem; padding: 1rem; border-radius: 14px; background: var(--brand-l); color: var(--brand-d); animation: pop .35s ease; }
.pay-done > .i { width: 34px; height: 34px; flex: none; padding: 6px; border-radius: 50%; background: var(--brand); color: #fff; }
.pay-done small { display: block; color: var(--muted); }
#paySec .btn-row { margin: .4rem 0 .8rem; }

/* Quản trị Tickly: gia hạn theo năm / tháng */
.ext-ym { display: flex; gap: .6rem; margin: .5rem 0 .3rem; }
.ext-ym label { display: flex; align-items: center; gap: .4rem; }
.ext-ym input { width: 80px; text-align: center; }
.ext-ym span { color: var(--muted); font-weight: 600; }
#extPrev b { color: var(--brand-d); }

/* ===================== 045 – Thông báo đẩy ===================== */
.notif-ask.on { cursor: default; flex-wrap: wrap; }
.notif-ask .na-act { display: flex; gap: .3rem; margin-left: auto; }
.push-hint { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; }
.push-hint > .i { flex: none; width: 22px; height: 22px; }
.push-hint > span:first-of-type { flex: 1; min-width: 200px; }
.push-hint small { display: block; color: var(--muted); }
.push-hint .ph-act { display: flex; gap: .4rem; margin-left: auto; }

/* ===================== 046 – Bảng dạng thẻ trên điện thoại (bảng lương, bảng chấm công) ===================== */
@media (max-width: 760px) {
  .table-wrap:has(> table[data-cards]) { background: none; border: 0; box-shadow: none; overflow: visible; padding: 0; }
  table[data-cards] { display: block; width: 100%; min-width: 0 !important; table-layout: auto; border: 0; }
  table[data-cards] colgroup, table[data-cards] thead tr:first-child { display: none; }
  table[data-cards] thead, table[data-cards] tbody { display: block; }
  table[data-cards] tr { display: grid; grid-template-columns: 1fr 1fr; gap: .1rem .9rem; margin-bottom: .6rem; padding: .7rem .85rem;
    background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
  table[data-cards] tr.pay-miss { display: none; }
  table[data-cards] td, table[data-cards] thead th { display: flex; align-items: center; justify-content: space-between; gap: .5rem; min-width: 0;
    padding: .3rem 0 !important; border: 0 !important; background: none !important; text-align: right; white-space: normal; font-size: var(--fs-sm); }
  table[data-cards] td.hide-sm, table[data-cards] th.hide-sm { display: flex; }
  table[data-cards] td[data-label]::before, table[data-cards] thead th[data-label]::before { content: attr(data-label); flex: none; color: var(--muted); font-size: var(--fs-xs); font-weight: 600; text-align: left; }
  table[data-cards] td[data-label=""]::before, table[data-cards] th[data-label=""]::before { display: none; }
  table[data-cards] td[data-label=""]:empty, table[data-cards] th[data-label=""]:empty { display: none; }
  /* Tên nhân viên: dòng đầu thẻ, rộng hết */
  table[data-cards] .card-title { grid-column: 1 / -1; order: -1; justify-content: flex-start; text-align: left; font-size: var(--fs-base);
    padding-bottom: .45rem !important; margin-bottom: .2rem; border-bottom: 1px dashed var(--line) !important; }
  table[data-cards] .card-title::before { display: none; }
  table[data-cards] .card-title small.block { display: inline; margin-left: .4rem; }
  /* Bảng lương: ô nhập vừa thẻ, Thực lĩnh nổi bật, dòng tổng là thẻ màu */
  .pay-sheet table[data-cards] .pay-in { width: 112px; min-height: 36px; }
  .pay-sheet table[data-cards] .pay-act { grid-column: 2; grid-row: 1; justify-content: flex-end; width: auto; padding: 0 !important; z-index: 1; }
  .pay-sheet table[data-cards] .pay-act::before { display: none; }
  .pay-sheet table[data-cards] td[data-c="net"] { grid-column: 1 / -1; margin-top: .2rem; padding-top: .45rem !important; border-top: 1px dashed var(--line) !important; font-size: var(--fs-md); }
  .pay-sheet table[data-cards] tr.pay-total { background: var(--brand-l); border-color: color-mix(in srgb, var(--brand) 35%, transparent); }
  .pay-sheet table[data-cards] tr.pay-total th:nth-child(-n+2) { display: none; }
  .pay-sheet table[data-cards] tr.pay-total th:nth-child(3) { grid-column: 1 / -1; justify-content: flex-start; font-size: var(--fs-base); }
  .pay-sheet table[data-cards] tr.pay-total th:nth-child(3)::before { display: none; }
  .pay-sheet table[data-cards] tr.pay-total th[data-t="net"] { grid-column: 1 / -1; font-size: var(--fs-md); }
}
@media (max-width: 760px) { .pay-sheet table[data-cards] tbody td:nth-child(2) { display: none; } }
@media (max-width: 760px) {
  /* Nhãn trên – số dưới để số dài không bị cắt; ô nhập rộng hết ô */
  table[data-cards] td, table[data-cards] thead th { flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: .1rem; text-align: left; }
  table[data-cards] td > *, table[data-cards] thead th > * { max-width: 100%; }
  .pay-sheet table[data-cards] .pay-in, .pay-sheet table[data-cards] .pay-allow { width: 100%; }
  .pay-sheet table[data-cards] .pay-allow { display: flex; align-items: center; gap: .3rem; }
  table[data-cards] tr { position: relative; }
  .pay-sheet table[data-cards] .pay-act { position: absolute; top: .55rem; right: .6rem; }
  .pay-sheet table[data-cards] .card-title { padding-right: 2.6rem !important; flex-direction: row; flex-wrap: wrap; align-items: baseline; }
  .pay-sheet table[data-cards] td[data-c="net"], .pay-sheet table[data-cards] tr.pay-total th[data-t="net"] { flex-direction: row; justify-content: space-between; align-items: center; }
  table[data-cards] .card-title { flex-direction: row; flex-wrap: wrap; align-items: baseline; }
}

/* ===================== 047 – Mượt hơn khi chuyển trang ===================== */
/* Biểu tượng tải chỉ hiện nếu chờ quá 0,2 giây (trang mở nhanh thì không nháy logo) */
.loading { animation: ldIn .25s ease .2s both; }
@keyframes ldIn { from { opacity: 0; } to { opacity: 1; } }
/* Trang mới hiện dần (chỉ đổi độ mờ, không dịch chuyển ⇒ không làm lệch nút nổi / thanh dưới) */
#view { animation: viewIn .18s ease-out both; }
@keyframes viewIn { from { opacity: .35; } to { opacity: 1; } }
/* Danh sách dài: phần ngoài màn hình chưa cần vẽ ⇒ cuộn mượt hơn trên máy yếu */
.feed > li, .rq-list > *, .todo-list > li { content-visibility: auto; contain-intrinsic-size: auto 64px; }
/* Bấm trên điện thoại: phản hồi tức thì, bỏ khung xanh mặc định của trình duyệt */
a, button, .btn, .qa, .chip, .sp-opt { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
@media (prefers-reduced-motion: reduce) { .loading, #view { animation: none; } }

/* ===================== 048 – Giao diện gọn & sạch ===================== */
/* Thẻ phẳng: viền mảnh + bóng rất nhẹ (bớt "nổi khối"), khoảng cách đều 14px */
:root { --shadow: 0 1px 2px rgba(16,40,30,.04); }
.card, .stat, .tile, .set-card, .set-nav, .set-toc div { border-color: var(--line); }
.card { margin-bottom: 14px; }
.card-head { margin-bottom: .75rem; }
.card-head h3 { font-size: var(--fs-base); font-weight: 700; }
.hero { box-shadow: none; margin-bottom: 14px; }
.dash-grid { gap: 14px; }
.dash-grid:has(> :only-child) { grid-template-columns: 1fr; }
.dash-reports { margin-top: 1.4rem; }
/* Báo cáo cuối ngày: ô số nền nhạt không viền, chỉ hiện mục có vấn đề */
.dr-kpis > div { border: 0; }
.dr-grid { margin-bottom: 0; }
.dr-ok { display: flex; align-items: center; gap: .5rem; margin: 0; padding: .65rem .8rem; border-radius: 12px; background: var(--brand-l); color: var(--brand-d); font-size: var(--fs-sm); font-weight: 600; }
.dr-ok .i { width: 16px; height: 16px; flex: none; }
.dr-note { margin: .6rem 0 0; }
.daily-card .card-head h3 .i { width: 16px; height: 16px; }
/* Hướng dẫn lần đầu: bước đã xong gom thành 1 dòng */
.onb-done { display: flex; flex-wrap: wrap; gap: .35rem .9rem; padding: .5rem 1.3rem .2rem; font-size: var(--fs-sm); color: var(--muted); }
.onb-done span { display: inline-flex; align-items: center; gap: .3rem; text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 45%, transparent); }
.onb-done .i { width: 14px; height: 14px; color: var(--ok); }
.onb-card .init-list { margin-top: .5rem; }
.onb-card .init-list li { padding: .8rem 1.3rem; }
.onb-card .init-list li:first-child { border-top: 1px solid var(--line); }
.onb-foot { border-top: 0; padding-top: 0; }
.onb-demo { font-size: var(--fs-sm); }
@media (max-width: 640px) {
  .card { padding: .9rem; margin-bottom: 12px; }
  .hero { padding: 1rem; border-radius: 18px; margin-bottom: 12px; }
  .hero h2 { font-size: var(--fs-md); }
  .hero-sub { font-size: var(--fs-sm); }
  .qa { min-height: 64px; border-radius: 12px; }
  .qa .i { width: 20px; height: 20px; }
  .stats { gap: .5rem; }
  .stat { padding: .65rem .8rem; }
  .stat b { font-size: 1.35rem; }
  .dr-kpis { gap: .45rem; }
  .dr-kpis b { font-size: 1.2rem; }
  .init-head, .onb-done, .onb-card .init-list li, .onb-foot { padding-left: 1rem; padding-right: 1rem; }
  .card.onb-card { padding: 0; }
  .init-head { gap: .8rem; padding-top: 1rem; }
  .onb-card .progress .bar { width: 56px; }
  .onb-demo { margin: .6rem 1rem .2rem; padding: .6rem .75rem; }
  .onb-demo span { flex: 1 1 calc(100% - 2.5rem); }
  .onb-demo .btn { width: auto; margin-left: auto; }
}
/* Tổng quan: tiêu đề "Tổng quan" trùng với menu + lời chào ⇒ ẩn */
.page:has(> #view > .hero) > .page-head:not(:has(.page-actions > *)) { display: none; }
/* Đầu bảng nền xám nhạt (bớt màu), không xuống dòng ở kỳ làm việc */
.pl-st { margin-top: .3rem; }
@media (max-width: 640px) {
  /* Tiêu đề trang dài (Danh sách nhân viên…) không bị cắt chữ */
  .ph-title h1 { font-size: var(--fs-md); }
  .data-table thead th { padding: .6rem .7rem; }
}
