:root {
  --ink: #14181F; --ink-2: #3D4553; --muted: #5B6472; --line: #E3E7ED; --line-2: #EEF1F5; --field: #CDD3DC;
  --bg: #F4F6F9; --card: #FFFFFF;
  --blue: #1F4FC4; --blue-dark: #163A92; --blue-soft: #EAF0FD;
  --green: #15803D; --green-soft: #E6F4EA;
  --amber: #92400E; --amber-soft: #FEF3C7;
  --orange: #C2410C; --orange-ink: #9A3412; --orange-soft: #FFF4EC; --orange-line: #F6C9A8;
  --red: #B91C1C; --red-soft: #FDECEC;
  --radius: 14px;
  --font: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.5; -webkit-text-size-adjust: 100%; }
a { color: var(--blue); } a:hover { color: var(--blue-dark); }
h1, h2, h3 { margin: 0; line-height: 1.3; }
h1 { font-size: 26px; font-weight: 700; } h2 { font-size: 17px; font-weight: 700; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; font-size: 16px; color: var(--ink); border: 1px solid var(--field); border-radius: 10px; background: #fff; padding: 10px 12px; width: 100%; min-height: 46px; }
textarea { resize: vertical; min-height: 84px; line-height: 1.5; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 3px solid rgba(31, 79, 196, .35); outline-offset: 1px; border-color: var(--blue); }
input[type=checkbox], input[type=radio] { width: 20px; height: 20px; min-height: 0; padding: 0; accent-color: var(--blue); flex: 0 0 20px; }
label { font-size: 14px; font-weight: 600; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); } .small { font-size: 13px; } .center { text-align: center; }
.row { display: flex; gap: 12px; align-items: center; } .wrap { flex-wrap: wrap; } .grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 16px; } .stack-sm { display: flex; flex-direction: column; gap: 8px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.hidden { display: none !important; }

/* nút */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px; border-radius: 10px; border: 1px solid var(--field); background: #fff; color: var(--ink); font-weight: 600; text-decoration: none; white-space: nowrap; }
.btn:hover { background: #F7F8FA; color: var(--ink); }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; } .btn-primary:hover { background: var(--blue-dark); color: #fff; }
.btn-orange { background: var(--orange); border-color: var(--orange); color: #fff; } .btn-orange:hover { background: var(--orange-ink); color: #fff; }
.btn-green { background: var(--green); border-color: var(--green); color: #fff; } .btn-green:hover { background: #166534; color: #fff; }
.btn-danger { color: var(--red); border-color: #F3C4C4; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-dashed { border-style: dashed; border-color: #9AA6B8; color: var(--blue); background: transparent; }
.btn-sm { min-height: 38px; padding: 0 12px; font-size: 14px; border-radius: 8px; }
.btn-outline-orange { border-color: var(--orange); color: var(--orange); }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: default; }
.icon-btn { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; border: 0; background: transparent; color: var(--ink-2); position: relative; }
.icon-btn:hover { background: var(--line-2); }
.dot { position: absolute; top: 8px; right: 9px; width: 9px; height: 9px; border-radius: 99px; background: var(--orange); border: 2px solid #fff; }

/* thẻ, chip */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.card.card-tight { padding: 0; overflow: visible; }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; border-radius: 99px; padding: 3px 10px; white-space: nowrap; }
.chip-ontime, .chip-done, .chip-active { color: var(--green); background: var(--green-soft); }
.chip-late, .chip-invited { color: var(--amber); background: var(--amber-soft); }
.chip-missing { color: var(--orange-ink); background: #FFEDD5; }
.chip-notyet, .chip-draft, .chip-staff { color: var(--ink-2); background: var(--line-2); }
.chip-doing, .chip-manager, .chip-help { color: var(--blue); background: var(--blue-soft); }
.chip-blocked, .chip-locked { color: var(--red); background: var(--red-soft); }
.chip-pending { color: var(--orange-ink); background: #FFEDD5; }
.chip-director { color: #6D28D9; background: #F1EAFE; } .chip-admin { color: var(--ink); background: var(--line); }
.avatar { flex: 0 0 36px; width: 36px; height: 36px; border-radius: 99px; background: var(--line-2); color: var(--ink-2); font-size: 13px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.avatar-blue { background: #DCE6FB; color: var(--blue); }
.banner { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 12px; font-size: 15px; }
.banner-orange { background: var(--orange-soft); border: 1px solid var(--orange-line); color: var(--orange-ink); }
.banner-green { background: var(--green-soft); color: #14532D; }
.banner-blue { background: var(--blue-soft); color: #1E3A8A; }
.banner-gray { background: var(--line-2); color: var(--ink-2); }
.banner-red { background: var(--red-soft); color: #991B1B; }

/* khung ứng dụng */
.shell { display: flex; min-height: 100vh; }
.sidebar { flex: 0 0 248px; background: #fff; border-right: 1px solid var(--line); padding: 22px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 20px; font-weight: 700; font-size: 17px; text-decoration: none; color: var(--ink); }
.brand-logo { width: 36px; height: 36px; border-radius: 10px; background: var(--blue); display: flex; align-items: center; justify-content: center; flex: 0 0 36px; }
.brand small { display: block; font-size: 12px; font-weight: 500; color: var(--muted); }
.nav-link { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px; color: var(--ink-2); text-decoration: none; font-weight: 500; }
.nav-link:hover { background: var(--line-2); color: var(--ink); }
.nav-link.active { background: var(--blue-soft); color: var(--blue); font-weight: 600; }
.nav-badge { margin-left: auto; background: var(--orange); color: #fff; font-size: 12px; font-weight: 700; border-radius: 99px; padding: 1px 8px; }
.nav-sep { font-size: 12px; font-weight: 600; color: var(--muted); padding: 16px 12px 4px; text-transform: uppercase; letter-spacing: .5px; }
.sidebar-user { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px; border-top: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.main { flex: 1; min-width: 0; padding: 30px 40px 48px; display: flex; flex-direction: column; gap: 22px; }
.topbar { display: none; }
.bottomnav { display: none; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; }
.page-head .sub { font-size: 14px; color: var(--muted); }
.cols { display: flex; flex-wrap: wrap; gap: 22px; align-items: flex-start; }
.col-main { flex: 3 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.col-side { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 18px; }

/* báo cáo */
.task-head, .task-row { display: grid; grid-template-columns: 26px minmax(0, 1fr) 150px 40px; gap: 10px; align-items: center; }
.task-head { font-size: 13px; font-weight: 600; color: var(--muted); }
.task-num { font-size: 14px; color: var(--muted); }
.tasks { display: flex; flex-direction: column; gap: 10px; }
.attach-box { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 14px; border: 1px dashed var(--field); border-radius: 10px; color: var(--muted); font-size: 14px; }
.file-pill { display: inline-flex; align-items: center; gap: 6px; background: var(--bg); border-radius: 8px; padding: 4px 6px 4px 10px; color: var(--ink); font-size: 14px; }
.file-pill a { color: var(--ink); text-decoration: none; } .file-pill a:hover { text-decoration: underline; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.week { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.week-day { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); text-decoration: none; }
.week-dot { width: 36px; height: 36px; border-radius: 99px; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; background: var(--bg); color: var(--muted); }
.week-dot.ontime { background: var(--green); color: #fff; } .week-dot.late { background: #D97706; color: #fff; }
.week-dot.missing { background: var(--orange); color: #fff; } .week-dot.today { border: 2px solid var(--blue); color: var(--blue); background: #fff; }
.comment { display: flex; gap: 10px; font-size: 14px; }
.comment-body { white-space: pre-wrap; }
.detail-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.detail-list li span.chip { margin-left: 6px; }
.prewrap { white-space: pre-wrap; margin: 0; }

/* tổng quan */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.kpi .label { font-size: 14px; color: var(--muted); }
.kpi .value { font-size: 30px; font-weight: 700; margin-top: 4px; line-height: 1.2; }
.kpi .value small { font-size: 17px; color: var(--muted); font-weight: 500; }
.kpi-orange { background: var(--orange-soft); border-color: var(--orange-line); }
.kpi-orange .label { color: var(--orange-ink); font-weight: 600; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tab { min-height: 36px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--field); background: #fff; font-size: 14px; color: var(--ink); }
.tab.active { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 600; }
.list-row { display: grid; grid-template-columns: minmax(150px, 2fr) minmax(0, 1fr) 56px 104px 52px 76px; gap: 12px; align-items: center; padding: 12px 20px; border-top: 1px solid var(--line-2); }
.list-row.head { font-size: 13px; font-weight: 600; color: var(--muted); border-top: 0; border-bottom: 1px solid var(--line); }
.list-row.selected { background: #F5F8FF; }
.list-row .who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.list-row .who b { display: block; font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scroll-x { overflow-x: auto; }
.empty { padding: 28px; text-align: center; color: var(--muted); }

/* bảng quản trị */
.utable .list-row { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) 130px 120px 130px 44px; }
.menu { position: relative; }
.menu-pop { position: absolute; right: 0; top: 44px; z-index: 20; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(20, 24, 31, .12); min-width: 220px; padding: 6px; display: flex; flex-direction: column; }
.menu-pop button { text-align: left; border: 0; background: transparent; padding: 10px 12px; border-radius: 8px; font-size: 14px; color: var(--ink); }
.menu-pop button:hover { background: var(--line-2); }
.menu-pop button.danger { color: var(--red); }

/* hộp thoại, toast */
.overlay { position: fixed; inset: 0; background: rgba(20, 24, 31, .45); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.dialog { background: #fff; border-radius: 18px; width: 100%; max-width: 460px; max-height: calc(100vh - 32px); overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; z-index: 60; max-width: calc(100vw - 32px); font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.toast.error { background: #991B1B; }
.linkbox { display: flex; gap: 8px; } .linkbox input { font-size: 14px; }

/* trang đăng nhập */
.auth { min-height: 100vh; display: flex; flex-wrap: wrap; }
.auth-hero { flex: 1 1 420px; background: var(--blue); color: #fff; padding: 56px 64px; display: flex; flex-direction: column; justify-content: center; gap: 28px; }
.auth-hero h1 { font-size: 38px; line-height: 1.2; max-width: 480px; }
.auth-hero ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; color: #E4ECFD; font-size: 16px; }
.auth-hero li { display: flex; gap: 10px; align-items: center; }
.auth-main { flex: 1 1 420px; display: flex; align-items: center; justify-content: center; padding: 40px 20px; }
.auth-card { width: 100%; max-width: 440px; background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 34px; display: flex; flex-direction: column; gap: 18px; }
.auth-card.wide { max-width: 640px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.pw-wrap { position: relative; } .pw-wrap input { padding-right: 50px; } .pw-wrap .icon-btn { position: absolute; right: 2px; top: 1px; }
.steps { display: flex; flex-direction: column; gap: 14px; }
.step { display: flex; gap: 12px; } .step-n { flex: 0 0 30px; height: 30px; border-radius: 99px; background: var(--blue-soft); color: var(--blue); font-weight: 700; font-size: 14px; display: flex; align-items: center; justify-content: center; }
.big-icon { width: 84px; height: 84px; border-radius: 26px; background: var(--blue-soft); display: flex; align-items: center; justify-content: center; align-self: center; }

/* công tắc */
.switch { flex: 0 0 52px; width: 52px; height: 32px; border-radius: 99px; border: 0; padding: 3px; background: #AEB7C4; display: flex; justify-content: flex-start; }
.switch::after { content: ''; width: 26px; height: 26px; border-radius: 99px; background: #fff; }
.switch[aria-checked=true] { background: var(--blue); justify-content: flex-end; }
.setting-row { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-top: 1px solid var(--line-2); }
.section-title { padding: 14px 18px 6px; font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.loading { padding: 40px; text-align: center; color: var(--muted); }

/* ---------- điện thoại ---------- */
@media (max-width: 899px) {
  .sidebar { display: none; }
  .shell { flex-direction: column; }
  .topbar { display: flex; align-items: center; gap: 8px; position: sticky; top: 0; z-index: 10; background: #fff; border-bottom: 1px solid var(--line); padding: 10px 12px 10px 18px; padding-top: calc(10px + env(safe-area-inset-top)); }
  .topbar .title { flex: 1; font-weight: 700; font-size: 17px; }
  .main { padding: 16px 14px calc(96px + env(safe-area-inset-bottom)); gap: 16px; }
  h1 { font-size: 22px; }
  .card { padding: 16px; }
  .bottomnav { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: #fff; border-top: 1px solid var(--line); padding: 4px 0 calc(6px + env(safe-area-inset-bottom)); }
  .bottomnav a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; font-size: 12px; color: var(--muted); text-decoration: none; position: relative; }
  .bottomnav a.active { color: var(--blue); font-weight: 600; }
  .bottomnav .nav-badge { position: absolute; top: 0; left: 55%; margin: 0; font-size: 11px; padding: 0 6px; }
  .task-head { display: none; }
  .task-row { grid-template-columns: minmax(0, 1fr) 40px; grid-template-areas: "name del" "status del"; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px; gap: 8px; }
  .task-row .task-num { display: none; }
  .task-row .t-name { grid-area: name; } .task-row .t-status { grid-area: status; } .task-row .t-del { grid-area: del; align-self: start; }
  .sticky-actions { position: sticky; bottom: calc(70px + env(safe-area-inset-bottom)); background: var(--bg); padding: 8px 0; z-index: 5; }
  .sticky-actions .btn-primary { flex: 1; }
  .auth-hero { display: none; }
  .auth-main { padding: 28px 16px; align-items: flex-start; }
  .auth-card { border: 0; padding: 8px 6px; background: transparent; }
  .auth { background: #fff; }
  .list-row { grid-template-columns: minmax(0, 1fr) auto auto; padding: 12px 16px; }
  .list-row.head { display: none; }
  .list-row .c-dep, .list-row .c-time, .list-row .c-tasks { display: none; }
  .list-row .c-state { justify-self: end; }
  .list-row .who small { display: block; }
  .utable .list-row { grid-template-columns: minmax(0, 1fr) auto 44px; }
  .utable .c-role, .utable .c-last { display: none; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px 14px; } .kpi .value { font-size: 24px; }
  .dialog { align-self: flex-end; border-radius: 18px 18px 0 0; max-width: none; }
  .overlay { padding: 0; }
  .desktop-only { display: none !important; }
}
@media (min-width: 900px) { .mobile-only { display: none !important; } }
