/* =====================================================================
   TNETOffice.WebMVC - Lịch công tác BCHQS Phường Bình Thạnh
   Mobile-first. Không phụ thuộc thư viện ngoài.
   ===================================================================== */
:root {
  --brand: #1d5a3b;
  --brand-600: #174a30;
  --brand-700: #103823;
  --brand-50: #eaf3ed;
  --brand-100: #d3e7da;
  --accent: #b3261e;
  --gold: #e0b43a;

  --bg: #f3f5f2;
  --surface: #ffffff;
  --surface-2: #f7f8f6;
  --line: #e1e5df;
  --line-strong: #cdd3ca;
  --ink: #18211b;
  --ink-2: #3f4a42;
  --muted: #6b766e;

  --st-dukien: #a35f00;     --st-dukien-bg: #fff3dc;
  --st-chinhthuc: #17703f;  --st-chinhthuc-bg: #e2f3e8;
  --st-dathuchien: #4a5560; --st-dathuchien-bg: #eceff1;
  --st-huy: #b3261e;        --st-huy-bg: #fde7e5;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 40, 25, .06), 0 4px 14px rgba(16, 40, 25, .06);
  --shadow-lg: 0 10px 30px rgba(16, 40, 25, .18);
  --tap: 44px;
  --topbar-h: 56px;
  --tabbar-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: "Segoe UI", "Be Vietnam Pro", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar-h) + 60px); }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15.5px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--brand); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
svg.i { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
svg.i.sm { width: 16px; height: 16px; }
svg.i.lg { width: 24px; height: 24px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------------- Top bar ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 12px 0 14px;
  background: linear-gradient(180deg, var(--brand-600), var(--brand));
  color: #fff;
  box-shadow: 0 1px 0 rgba(0,0,0,.08);
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; min-width: 0; }
.brand-mark { width: 36px; height: 36px; flex: none; border-radius: 50%; background: #fff; box-shadow: 0 0 0 2px rgba(255,255,255,.9); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text b { font-size: 16px; font-weight: 700; letter-spacing: .2px; }
.brand-text small { font-size: 11.5px; opacity: .82; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-transform: uppercase; letter-spacing: .4px; }
.topnav { display: none; }
.topbar .spacer { flex: 1; }

.user-menu { position: relative; }
.user-menu > summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  height: var(--tap); padding: 0 4px; border-radius: 999px;
}
.user-menu > summary::-webkit-details-marker { display: none; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--gold); color: var(--brand-700);
  font-weight: 800; font-size: 15px;
  box-shadow: 0 0 0 2px rgba(255,255,255,.35);
}
.user-menu .who { display: none; }
.user-pop {
  position: absolute; right: 0; top: calc(100% + 6px);
  width: min(300px, calc(100vw - 24px));
  background: var(--surface); color: var(--ink);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: 8px; border: 1px solid var(--line);
}
.user-pop .head { padding: 10px 10px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.user-pop .head b { display: block; font-size: 15px; }
.user-pop .head span { font-size: 13px; color: var(--muted); }
.menu-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  min-height: var(--tap); padding: 0 10px; border-radius: 10px;
  background: none; border: 0; color: var(--ink); text-align: left; cursor: pointer;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-2); outline: none; }
.menu-item.danger { color: var(--accent); }

/* ---------------- Bottom tab bar (mobile) ---------------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  height: calc(var(--tabbar-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
  background: rgba(255,255,255,.97);
  backdrop-filter: saturate(1.4) blur(10px);
  border-top: 1px solid var(--line);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  height: 100%; color: var(--muted); font-size: 11.5px; font-weight: 600;
}
.tab.active { color: var(--brand); }
.tab.active svg.i { stroke-width: 2.4; }
.tab-add { position: relative; }
.tab-add .fab {
  width: 52px; height: 52px; border-radius: 18px;
  display: grid; place-items: center;
  background: var(--brand); color: #fff;
  box-shadow: 0 6px 16px rgba(29, 90, 59, .35);
  margin-top: -18px;
}
.tab-add .fab svg.i { width: 26px; height: 26px; stroke-width: 2.6; }
body.has-tabbar main { padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 20px); }

/* ---------------- Main ---------------- */
main { max-width: 1080px; margin: 0 auto; padding: 12px 12px 24px; }
.page-title { display: flex; align-items: center; gap: 10px; margin: 6px 2px 14px; }
.page-title h1 { font-size: 20px; margin: 0; font-weight: 750; letter-spacing: -.2px; }
.page-title .back { margin-left: -6px; }

.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); }
.card-pad { padding: 14px; }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 16px;
  border-radius: 12px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink);
  font-weight: 650; font-size: 15px; cursor: pointer;
  transition: background .15s, border-color .15s, transform .05s;
  white-space: nowrap; text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid var(--brand-100); outline-offset: 1px; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-600); }
.btn-soft { background: var(--brand-50); border-color: var(--brand-100); color: var(--brand-700); }
.btn-danger { background: #fff; border-color: #f0c5c1; color: var(--accent); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-icon { width: var(--tap); padding: 0; }
.btn-block { width: 100%; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn[disabled] { opacity: .55; pointer-events: none; }

/* ---------------- Week header ---------------- */
.weekbar {
  position: sticky; top: var(--topbar-h); z-index: 30;
  margin: -12px -12px 12px; padding: 10px 12px 8px;
  background: var(--bg);
  border-bottom: 1px solid transparent;
}
.weekbar.stuck { border-bottom-color: var(--line); box-shadow: 0 6px 12px -10px rgba(0,0,0,.25); }
.week-nav { display: flex; align-items: center; gap: 6px; }
.week-nav .label { flex: 1; text-align: center; min-width: 0; position: relative; }
.week-nav .label b { display: block; font-size: 18px; font-weight: 800; letter-spacing: .2px; color: var(--brand-700); }
.week-nav .label span { font-size: 13.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.week-nav .label input[type=date] { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }
.week-nav .nav-btn {
  width: var(--tap); height: var(--tap); border-radius: 12px;
  display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line); color: var(--brand-700);
}
.week-nav .today-btn { font-size: 13px; min-height: 36px; padding: 0 10px; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 10px 2px 2px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  min-height: 36px; padding: 0 14px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line);
  color: var(--ink-2); font-size: 14px; font-weight: 600; cursor: pointer; user-select: none;
}
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; }
.chips .sep { flex: none; width: 1px; background: var(--line-strong); margin: 6px 2px; }

.summary {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 0 2px 12px; font-size: 14px; color: var(--ink-2);
}
.summary .pending { color: var(--st-dukien); font-weight: 700; }
.summary .grow { flex: 1; }

/* ---------------- Day + event ---------------- */
.days { display: grid; gap: 14px; }
.day { scroll-margin-top: calc(var(--topbar-h) + 120px); }
.day-head {
  display: flex; align-items: center; gap: 10px;
  padding: 0 4px 8px;
}
.day-badge {
  width: 46px; flex: none; text-align: center; line-height: 1.1;
  border-radius: 12px; padding: 6px 0;
  background: var(--surface); border: 1px solid var(--line);
}
.day-badge small { display: block; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; }
.day-badge b { font-size: 19px; font-weight: 800; font-variant-numeric: tabular-nums; }
.day.today .day-badge { background: var(--brand); border-color: var(--brand); color: #fff; }
.day.today .day-badge small { color: rgba(255,255,255,.85); }
.day-title { flex: 1; min-width: 0; }
.day-title b { font-size: 15.5px; }
.day-title span { display: block; font-size: 12.5px; color: var(--muted); }
.day-title .tag-today { display: inline; color: var(--accent); font-size: 11px; font-weight: 800; color: var(--accent); text-transform: uppercase; letter-spacing: .5px; margin-left: 6px; }
.day.weekend .day-title b { color: var(--accent); }

.day-list { display: grid; gap: 8px; }
.day-empty {
  border: 1.5px dashed var(--line-strong); border-radius: var(--radius);
  padding: 12px 14px; color: var(--muted); font-size: 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}

.ev { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow); overflow: hidden; position: relative; }
.ev::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--st-chinhthuc); }
.ev.st-dukien::before { background: var(--st-dukien); }
.ev.st-dathuchien::before { background: #9aa4ad; }
.ev.st-huy::before { background: var(--st-huy); }
.ev > summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: 62px 1fr; gap: 10px; padding: 12px 12px 12px 14px; }
.ev > summary::-webkit-details-marker { display: none; }
.ev > summary:focus-visible { outline: 3px solid var(--brand-100); outline-offset: -3px; }
.ev-time { font-variant-numeric: tabular-nums; }
.ev-time b { display: block; font-size: 17px; font-weight: 800; color: var(--brand-700); letter-spacing: -.2px; }
.ev-time b.allday { font-size: 13.5px; line-height: 1.25; }
.ev-time small { display: block; font-size: 12px; color: var(--muted); }
.ev-body { min-width: 0; }
.ev-top { display: flex; align-items: flex-start; gap: 8px; }
.ev-title { flex: 1; font-weight: 650; font-size: 15.5px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.ev[open] .ev-title { -webkit-line-clamp: unset; }
.ev.st-huy .ev-title { text-decoration: line-through; color: var(--muted); }
.ev-meta { display: grid; gap: 3px; margin-top: 6px; font-size: 13.5px; color: var(--ink-2); }
.ev-meta div { display: flex; gap: 6px; align-items: flex-start; }
.ev-meta svg.i { width: 15px; height: 15px; margin-top: 3px; color: var(--muted); }
.ev-meta .date { color: var(--brand-700); font-weight: 650; }

.pill { flex: none; display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 750; white-space: nowrap; }
.pill.st-dukien { color: var(--st-dukien); background: var(--st-dukien-bg); }
.pill.st-chinhthuc { color: var(--st-chinhthuc); background: var(--st-chinhthuc-bg); }
.pill.st-dathuchien { color: var(--st-dathuchien); background: var(--st-dathuchien-bg); }
.pill.st-huy { color: var(--st-huy); background: var(--st-huy-bg); }

.ev-more { border-top: 1px solid var(--line); background: var(--surface-2); padding: 12px 14px 14px; }
.ev-more dl { display: grid; grid-template-columns: 112px 1fr; gap: 6px 10px; margin: 0 0 12px; font-size: 14px; }
.ev-more dt { color: var(--muted); }
.ev-more dd { margin: 0; white-space: pre-line; word-break: break-word; }
.ev-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ev-actions form { display: contents; }

/* ---------------- Forms ---------------- */
.form-card { padding: 4px 14px 14px; }
.section-title { font-size: 12.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .6px; color: var(--brand); margin: 16px 2px 8px; }
.field { margin: 0 0 14px; }
.field > label, .label { display: block; font-weight: 650; font-size: 14px; color: var(--ink-2); margin: 0 0 6px; }
.req { color: var(--accent); }
.input, .select, .textarea {
  width: 100%; min-height: 48px; padding: 10px 13px;
  border-radius: 12px; border: 1.5px solid var(--line-strong); background: #fff;
  font-size: 16px; /* chống zoom trên iOS */
  transition: border-color .15s, box-shadow .15s;
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-50); }
.input-validation-error { border-color: var(--accent) !important; }
.field-validation-error, .text-danger { color: var(--accent); font-size: 13px; display: block; margin-top: 4px; }
.validation-summary-errors, .alert {
  border-radius: 12px; padding: 10px 12px; margin: 0 0 12px; font-size: 14px;
}
.validation-summary-errors { background: var(--st-huy-bg); color: var(--st-huy); }
.validation-summary-errors ul { margin: 0; padding-left: 18px; }
.validation-summary-valid { display: none; }
.alert-info { background: var(--brand-50); color: var(--brand-700); }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

.quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.quick .chip { min-height: 34px; font-size: 13.5px; padding: 0 12px; }
.quick .chip.on { background: var(--brand-50); color: var(--brand-700); border-color: var(--brand); }

.switch, .field > label.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: var(--tap); cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { width: 50px; height: 30px; border-radius: 999px; background: var(--line-strong); position: relative; transition: background .2s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { transform: translateX(20px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 4px var(--brand-100); }

.seg { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: flex; align-items: center; justify-content: center; min-height: var(--tap); border-radius: 12px; border: 1.5px solid var(--line-strong); font-weight: 650; font-size: 14px; background: #fff; cursor: pointer; }
.seg input:checked + span { border-color: currentColor; }
.seg .st-dukien input:checked + span { color: var(--st-dukien); background: var(--st-dukien-bg); }
.seg .st-chinhthuc input:checked + span { color: var(--st-chinhthuc); background: var(--st-chinhthuc-bg); }
.seg .st-dathuchien input:checked + span { color: var(--st-dathuchien); background: var(--st-dathuchien-bg); }
.seg .st-huy input:checked + span { color: var(--st-huy); background: var(--st-huy-bg); }

details.more > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; min-height: var(--tap); font-weight: 650; color: var(--brand); }
details.more > summary::-webkit-details-marker { display: none; }
details.more[open] > summary .chev { transform: rotate(90deg); }
details.more .chev { transition: transform .2s; }

.actionbar {
  position: sticky; bottom: 0; z-index: 20;
  display: flex; gap: 8px; align-items: center;
  margin: 14px -12px -24px; padding: 10px 12px calc(10px + var(--safe-b));
  background: rgba(243,245,242,.96); backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
}
.actionbar .grow { flex: 1; }
.actionbar .btn-primary { flex: 1.4; }

.meta-box { font-size: 13px; color: var(--muted); margin: 10px 2px 0; line-height: 1.6; }

/* ---------------- Flash ---------------- */
.flash {
  position: fixed; left: 50%; transform: translateX(-50%);
  top: calc(var(--topbar-h) + 10px); z-index: 60;
  width: min(520px, calc(100vw - 24px));
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: 12px; box-shadow: var(--shadow-lg);
  font-weight: 600; font-size: 14.5px;
  animation: flashIn .25s ease-out;
}
.flash.ok { background: var(--brand-700); color: #fff; }
.flash.err { background: var(--accent); color: #fff; }
.flash button { margin-left: auto; background: none; border: 0; color: inherit; width: 32px; height: 32px; display: grid; place-items: center; cursor: pointer; }
.flash.hide { opacity: 0; transform: translate(-50%, -8px); transition: .3s; }
@keyframes flashIn { from { opacity: 0; transform: translate(-50%, -8px); } }

/* ---------------- Search ---------------- */
.search-box { position: relative; }
.search-box svg.i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-box .input { padding-left: 44px; min-height: 52px; font-size: 16.5px; }
.result-group { margin: 16px 0 8px; font-weight: 750; font-size: 14px; color: var(--brand-700); display: flex; gap: 8px; align-items: baseline; }
.result-group small { font-weight: 500; color: var(--muted); }
.empty-state { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty-state svg.i { width: 44px; height: 44px; stroke-width: 1.5; color: var(--line-strong); margin-bottom: 8px; }

/* ---------------- Copy week ---------------- */
.copy-head { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; text-align: center; }
.copy-head .wk { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 6px; }
.copy-head .wk small { display: block; font-size: 11.5px; color: var(--muted); text-transform: uppercase; font-weight: 700; }
.copy-head .wk b { font-size: 15px; }
.copy-head .wk span { display: block; font-size: 12.5px; color: var(--ink-2); }
.check-row { display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: start; padding: 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.check-row:last-child { border-bottom: 0; }
.check-row input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--brand); }
.check-row .t { font-size: 13px; color: var(--brand-700); font-weight: 700; }

/* ---------------- Table (danh mục) ---------------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list .name { flex: 1; min-width: 0; font-weight: 600; }
.list .name.off { color: var(--muted); text-decoration: line-through; }
.list .ord { width: 34px; text-align: center; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.inline-form { display: grid; grid-template-columns: 1fr 72px; gap: 8px; }

/* ---------------- Login ---------------- */
body.login {
  min-height: 100vh; min-height: 100dvh;
  background:
    radial-gradient(1200px 500px at 50% -10%, rgba(224,180,58,.18), transparent 60%),
    linear-gradient(180deg, var(--brand-700) 0, var(--brand) 42%, var(--bg) 42%);
  display: flex; flex-direction: column;
}
.login-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 36px 16px 24px; }
.login-hero { text-align: center; color: #fff; margin-bottom: 22px; }
.login-hero .emblem { display: block; width: 88px; height: 88px; margin: 0 auto 12px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px rgba(255,255,255,.95), 0 8px 20px rgba(0,0,0,.28); }
.login-hero .kicker { font-size: 12px; letter-spacing: 1.4px; text-transform: uppercase; opacity: .85; font-weight: 700; }
.login-hero h1 { margin: 4px 0 2px; font-size: 24px; font-weight: 800; letter-spacing: .2px; }
.login-hero p { margin: 0; opacity: .9; font-size: 14.5px; }
.login-card { width: 100%; max-width: 400px; padding: 22px 18px 18px; border-radius: 20px; box-shadow: var(--shadow-lg); }
.login-card h2 { margin: 0 0 16px; font-size: 18px; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 52px; }
.pw-wrap button { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: var(--tap); height: var(--tap); border: 0; background: none; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.check { display: flex; align-items: center; gap: 10px; min-height: var(--tap); font-size: 14.5px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--brand); }
.login-foot { text-align: center; font-size: 12.5px; color: var(--muted); padding: 16px; }

/* ---------------- Desktop / tablet ---------------- */
@media (min-width: 900px) {
  body { font-size: 15px; }
  .topbar { padding: 0 20px; height: 62px; --topbar-h: 62px; }
  .topnav { display: flex; gap: 4px; margin-left: 18px; }
  .topnav a { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border-radius: 10px; color: rgba(255,255,255,.86); font-weight: 600; font-size: 14.5px; }
  .topnav a:hover { background: rgba(255,255,255,.1); color: #fff; }
  .topnav a.active { background: rgba(255,255,255,.16); color: #fff; }
  .user-menu .who { display: none; text-align: right; line-height: 1.15; max-width: 260px; }
  .user-menu .who b { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .user-menu .who small { font-size: 12px; opacity: .8; }
  .tabbar { display: none; }
  body.has-tabbar main { padding-bottom: 32px; }
  main { padding: 20px 24px 32px; }
  .weekbar { margin: -20px -24px 16px; padding: 14px 24px 10px; top: 62px; }
  .week-nav .label b { font-size: 21px; }
  .day { display: grid; grid-template-columns: 210px 1fr; gap: 16px; align-items: start; }
  .day-head { position: sticky; top: 190px; padding: 6px 0 0; display: grid; grid-template-columns: 52px 1fr; grid-template-rows: auto auto; column-gap: 12px; row-gap: 8px; align-items: start; }
  .day-head .day-badge { width: 52px; grid-row: span 2; }
  .day-head .btn-icon { grid-column: 2; justify-self: start; width: auto; min-height: 34px; padding: 0 10px; border: 1px dashed var(--line-strong); }
  .ev > summary { grid-template-columns: 80px 1fr; padding: 14px 16px 14px 18px; }
  .ev-time b { font-size: 18px; }
  .ev-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 18px; }
  .form-wrap { max-width: 760px; margin: 0 auto; }
  .row-2-lg { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
  .actionbar { margin: 18px 0 0; border-radius: 14px; border: 1px solid var(--line); position: static; background: var(--surface); }
  .seg { grid-template-columns: repeat(4, 1fr); }
}

@media (min-width: 900px) and (max-width: 1180px) {
  .topnav a, .topnav .nav-drop > summary { padding: 0 10px; font-size: 14px; }
  .topnav a svg.i { display: none; }
}

@media (min-width: 1440px) {
  .user-menu .who { display: block; }
}


/* ---------------- v05: Quản lý / Nhân viên / Phân quyền ---------------- */
.nav-drop { position: relative; }
.nav-drop > summary { list-style: none; cursor: pointer; }
.nav-drop > summary::-webkit-details-marker { display: none; }
.nav-pop {
  position: absolute; left: 0; top: calc(100% + 6px); z-index: 50;
  min-width: 230px; padding: 6px;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.topnav .nav-drop > summary { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px 0 14px; border-radius: 10px; color: rgba(255,255,255,.86); font-weight: 600; font-size: 14.5px; }
.topnav .nav-drop > summary:hover, .topnav .nav-drop[open] > summary { background: rgba(255,255,255,.1); color: #fff; }
.topnav .nav-drop > summary.active { background: rgba(255,255,255,.16); color: #fff; }
.topnav .nav-pop a.menu-item { color: var(--ink); height: auto; min-height: var(--tap); padding: 0 10px; border-radius: 10px; font-size: 15px; }
.topnav .nav-pop a.menu-item:hover { background: var(--surface-2); color: var(--ink); }

.toolbar-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0 2px 12px; }
.toolbar-row .grow { flex: 1; }
.toolbar-row .search-box { flex: 1 1 220px; margin: 0; }
.toolbar-row .search-box .input { min-height: 46px; }

.people { display: grid; gap: 8px; }
.person {
  display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center;
  padding: 12px 12px 12px 14px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  color: var(--ink);
}
.person.off { opacity: .6; }
.person .ava { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-50); color: var(--brand-700); font-weight: 800; font-size: 17px; }
.person .nm { font-weight: 700; font-size: 15.5px; line-height: 1.3; }
.person .sub { font-size: 13px; color: var(--muted); margin-top: 2px; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.person .sub span { display: inline-flex; align-items: center; gap: 4px; }
.person .sub svg.i { width: 14px; height: 14px; }
.person .tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.tag { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.tag.green { background: var(--st-chinhthuc-bg); color: var(--st-chinhthuc); border-color: transparent; }
.tag.amber { background: var(--st-dukien-bg); color: var(--st-dukien); border-color: transparent; }

.seg-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); margin-bottom: 12px; }
.seg-tabs a { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; border-radius: 9px; font-weight: 700; font-size: 14px; color: var(--ink-2); }
.seg-tabs a.on { background: var(--brand); color: #fff; }

.pq-card { padding: 0; overflow: hidden; margin-bottom: 12px; }
.pq-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.pq-head b { flex: 1; font-size: 15.5px; }
.pq-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; padding: 12px 14px 14px; }
.pq-chk { position: relative; }
.pq-chk input { position: absolute; opacity: 0; }
.pq-chk span {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--tap); border-radius: 12px; border: 1.5px solid var(--line-strong);
  font-weight: 650; font-size: 14px; background: #fff; cursor: pointer; user-select: none;
}
.pq-chk span svg.i { width: 16px; height: 16px; opacity: 0; }
.pq-chk input:checked + span { border-color: var(--brand); background: var(--brand-50); color: var(--brand-700); }
.pq-chk input:checked + span svg.i { opacity: 1; }
.pq-chk input:focus-visible + span { box-shadow: 0 0 0 4px var(--brand-100); }
.pq-chk input:disabled + span { cursor: not-allowed; opacity: .55; }
.pq-chk.na { display: none; }
.pq-inherit { padding: 0 14px 12px; font-size: 13px; color: var(--muted); }
.pq-off .pq-grid { opacity: .45; pointer-events: none; }

.obj-list { list-style: none; margin: 0; padding: 0; }
.obj-list li a { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); color: var(--ink); min-height: 60px; }
.obj-list li:last-child a { border-bottom: 0; }
.obj-list .ava { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand-700); flex: none; }
.obj-list .t { flex: 1; min-width: 0; }
.obj-list .t b { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.obj-list .t small { color: var(--muted); font-size: 12.5px; }

@media (min-width: 900px) {
  .people { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pq-grid { grid-template-columns: repeat(7, 1fr); }
  .pq-chk.na { display: block; }
  .pq-chk.na span { visibility: hidden; }
  .topnav a, .topnav .nav-drop > summary { white-space: nowrap; }
  .pq-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
