/* =====================================================================
   Afin design system (Horizon, giao diện kính theo HTOS skin-glass)
   Nền gradient lạnh xanh xám sang bạc hà, khung trong suốt, thẻ kính trắng bo lớn,
   chữ Lexend nét mảnh, màu chính xanh HTIT + navy, vạch vàng cho mục đang chọn, xanh ngọc cho tiền vào.
   Mọi màu gom ở :root, file razor không rải hex mới.
   ===================================================================== */
:root {
  /* Nền và bề mặt */
  --bg: #D6E2F1;
  --bg-glow:
      radial-gradient(900px 520px at 82% -10%, rgba(231, 207, 127, .40), transparent 62%),
      radial-gradient(900px 640px at -6% -6%, rgba(67, 106, 179, .40), transparent 60%),
      radial-gradient(760px 560px at 30% 112%, rgba(43, 179, 163, .22), transparent 60%),
      linear-gradient(165deg, #B5C8EA 0%, #C6D5EE 22%, #D6E2F1 48%, #E1EBF0 72%, #ECF3EF 100%);

  /* Kính (theo HTOS skin-glass) */
  --gl-navy: #1E3A6E; --gl-navy-2: #2F4D86; --gl-blue: #2F5FB3; --gl-gold: #E7CF7F;
  --gl-panel: rgba(255, 255, 255, .40); --gl-panel-2: rgba(255, 255, 255, .64); --gl-edge: rgba(255, 255, 255, .78);
  --gl-card: rgba(255, 255, 255, .74); --gl-line: rgba(31, 51, 70, .08);
  --gl-shadow: 0 12px 32px -16px rgba(30, 58, 110, .28), 0 2px 6px -2px rgba(30, 58, 110, .06);
  --surface: #ffffff;
  --surface-2: #F9FAFB;
  --surface-3: #F2F4F7;
  --surface-glass: rgba(255, 255, 255, .78);
  --line: #E4E7EC;
  --line-2: #D0D5DD;
  --line-3: #B4BCCB;

  /* Chữ */
  --text: #13213A;
  --text-2: #3B4D6B;
  --text-3: #687894;
  --ink-brand: #13213A;

  /* Màu chính navy */
  --primary: #3A6CC2;
  --primary-2: #2F4D86;
  --primary-3: #1E3A6E;
  --primary-soft: #EAF0FA;
  --primary-soft-2: #DCE6F6;
  --primary-line: #C3D3EE;
  --primary-ring: rgba(58, 108, 194, .22);
  --on-primary: #ffffff;

  /* Nhấn */
  --accent: #0F8F8A;
  --accent-2: #0B7570;
  --accent-soft: #E6F5F4;
  --gold: #E8CF7D;
  --gold-soft: #FBF5E1;

  /* Bộ trạng thái (bg / bd / fg / dot) */
  --success-bg: #ECFDF3; --success-bd: #ABEFC6; --success-fg: #067647; --success-dot: #17B26A;
  --warning-bg: #FFFAEB; --warning-bd: #FEDF89; --warning-fg: #B54708; --warning-dot: #F79009;
  --danger-bg:  #FEF3F2; --danger-bd:  #FECDCA; --danger-fg:  #B42318; --danger-dot:  #F04438;
  --info-bg:    #EAF0FA; --info-bd:    #C3D3EE; --info-fg:    #2F4D86; --info-dot:    #3A6CC2;
  --neutral-bg: #F2F4F7; --neutral-bd: #E4E7EC; --neutral-fg: #344054; --neutral-dot: #98A2B3;

  /* Tên cũ, giữ để không vỡ trang */
  --ok: var(--success-fg);  --ok-soft: var(--success-bg);
  --warn: var(--warning-fg); --warn-soft: var(--warning-bg);
  --err: #C2282A; --err-2: #A11F21; --err-soft: var(--danger-bg);
  --info: var(--info-fg); --info-soft: var(--info-bg);
  --in: #0F8F8A; --out: #C2282A;

  /* Màu nhóm menu */
  --t-blue: #3A6CC2; --t-teal: #0F8F8A; --t-violet: #6B57C9; --t-amber: #C9861A;
  --t-rose: #C2416B; --t-sky: #1F7FB8; --t-slate: #5B6B82;

  /* Màu cột Kanban */
  --st-todo: #98A2B3; --st-doing: #3A6CC2; --st-review: #F79009; --st-done: #17B26A; --st-pause: #F04438;

  /* Bảng */
  --th-bg: #DFE8F6; --th-fg: #1F3A68; --th-line: #BFD0EC;
  --row-hover: #F2F6FD; --row-line: #EDF0F5; --tfoot-bg: #F3F6FB;

  /* Hình khối */
  --r: 20px; --r-lg: 22px; --r-sm: 12px; --r-xs: 8px;
  --sh-1: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 1px rgba(16, 24, 40, .03);
  --sh-2: 0 2px 4px -2px rgba(16, 24, 40, .06), 0 4px 12px -2px rgba(16, 24, 40, .08);
  --sh-3: 0 14px 28px -10px rgba(16, 24, 40, .16), 0 4px 10px -4px rgba(16, 24, 40, .07);
  --sh-4: 0 36px 72px -28px rgba(11, 18, 32, .45), 0 10px 28px -10px rgba(16, 24, 40, .14);
  --sh-brand: 0 10px 22px -12px rgba(47, 77, 134, .75);
  --sh-inner: inset 0 1px 0 rgba(255, 255, 255, .85);
  --shadow: var(--sh-1);
  --shadow-md: var(--sh-3);
  --shadow-lg: var(--sh-4);
  --backdrop: rgba(16, 24, 40, .42);

  --font: "Lexend", "Be Vietnam Pro", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  --mono: "JetBrains Mono", Consolas, "Cascadia Mono", monospace;
  --side-w: 224px;
  --top-h: 56px;
  --h-ctl: 36px;
  --content-max: 1880px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; color: var(--text); font-family: var(--font); font-size: 12.5px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
html { background: var(--bg); }
body { background: var(--bg-glow); background-attachment: fixed; min-height: 100vh; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-2); }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.015em; color: var(--text); }
h1 { font-size: 23.5px; font-weight: 400; letter-spacing: -.02em; } h2 { font-size: 16px; } h3 { font-size: 13.5px; } h4 { font-size: 12.5px; }
h1:focus { outline: none; }
small, .muted { color: var(--text-2); }
.ic { flex: none; display: inline-block; vertical-align: middle; }
::selection { background: var(--primary-soft-2); }

/* Khung xương khi tải */
.loading { position: relative; min-height: 220px; color: transparent; border-radius: var(--r); overflow: hidden;
  background: linear-gradient(90deg, var(--surface-3) 0%, var(--surface-2) 40%, var(--surface-3) 80%) 0 0 / 200% 100%; animation: shimmer 1.2s infinite linear; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ===================== Khung ứng dụng (kính, theo HTOS skin-glass) =====================
   Nền gradient lạnh, sidebar và topbar trong suốt, mục cấp 1 là viên kính, phân hệ gập mở,
   thanh tab dạng viên, vùng nội dung là một tấm kính lớn bo 28.
   Không đặt backdrop-filter, transform, filter trên .main, .content (làm lệch hộp thoại position:fixed). */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; transition: grid-template-columns .2s; }
.shell.nav-hidden { grid-template-columns: 0 minmax(0, 1fr); }
.shell.nav-hidden .side { visibility: hidden; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; min-width: 0; overflow: hidden; color: var(--text-2); }
.brand { display: flex; align-items: center; gap: 10px; padding: 10px 14px 4px; min-height: var(--top-h); flex: none; }
.brand img { display: block; object-fit: contain; }
.brand-txt { display: flex; flex-direction: column; min-width: 0; padding-left: 12px; border-left: 1px solid rgba(31, 51, 70, .14); }
.brand-name { font-weight: 600; font-size: 18px; letter-spacing: -.01em; color: var(--ink-brand); line-height: 1.05; }
.brand-sub { font-size: 9.5px; color: var(--text-3); letter-spacing: .08em; text-transform: uppercase; margin-top: 3px; max-width: 160px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.nav-quick { position: relative; flex: none; display: flex; align-items: center; margin: 10px 14px 6px; }
.nav-quick-ic { position: absolute; left: 14px; color: var(--text-3); pointer-events: none; }
.nav-quick-input { width: 100%; height: 34px; padding: 0 34px 0 40px; border-radius: 999px; border: 1px solid var(--gl-edge); background: var(--gl-panel);
  font: inherit; font-weight: 300; font-size: 12px; color: var(--text); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7); outline: none; transition: background .15s, border-color .15s; }
.nav-quick-input::placeholder { color: var(--text-3); }
.nav-quick-input:hover, .nav-quick-input:focus { background: var(--gl-panel-2); border-color: #fff; }
.nav-quick-input:focus { box-shadow: 0 0 0 3px var(--primary-ring); }
.nav-quick-x { position: absolute; right: 8px; width: 24px; height: 24px; border: 0; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .6); color: var(--text-2); cursor: pointer; padding: 0; }
.nav-quick-x:hover { background: #fff; color: var(--text); }

.nav { flex: 1; overflow-y: auto; padding: 4px 10px 20px; scrollbar-width: none;
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 28px), transparent); }
.nav::-webkit-scrollbar { display: none; }
.nav-label { font-size: 10px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); padding: 12px 12px 6px; }

/* Cấp 1: viên kính; đang chọn = viên xanh thương hiệu chữ trắng */
.nav-l1 { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 4px 10px 4px 6px; margin-bottom: 6px; border-radius: 16px; color: var(--text);
  font-size: 12.5px; font-weight: 400; background: var(--gl-panel); border: 1px solid var(--gl-edge); box-shadow: var(--gl-shadow); transition: background .15s; }
.nav-l1:hover { background: var(--gl-panel-2); color: var(--text); }
.nav-l1 .nav-ic { background: rgba(255, 255, 255, .6); color: var(--primary-2); }
.nav-l1.active { background: linear-gradient(135deg, #3A6CC2 0%, #2F4D86 100%); color: #fff; font-weight: 500; border-color: transparent;
  box-shadow: 0 14px 28px -14px rgba(47, 77, 134, .8), inset 0 1px 0 rgba(255, 255, 255, .25); }
.nav-l1.active:hover { color: #fff; }
.nav-l1.active .nav-ic { background: rgba(255, 255, 255, .2); color: #fff; }
.nav-l1.active .nav-badge { background: #fff; color: var(--primary-2); }

/* Phân hệ: hàng mảnh, icon tròn có màu; đang mở = viên kính */
.nav-mod { --tone: var(--t-blue); margin-bottom: 2px; }
.nav-mod.tone-blue { --tone: var(--t-blue); } .nav-mod.tone-teal { --tone: var(--t-teal); } .nav-mod.tone-violet { --tone: var(--t-violet); }
.nav-mod.tone-amber { --tone: var(--t-amber); } .nav-mod.tone-rose { --tone: var(--t-rose); } .nav-mod.tone-sky { --tone: var(--t-sky); } .nav-mod.tone-slate { --tone: var(--t-slate); }
.nav-ic { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none; transition: background .15s; }
.nav-group { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 38px; padding: 4px 8px 4px 6px; border: 0; border-radius: 16px; background: none;
  font: inherit; font-size: 12.5px; font-weight: 400; color: var(--text); cursor: pointer; text-align: left; transition: background .15s; }
.nav-group .nav-ic { background: color-mix(in srgb, var(--tone) 13%, #fff); color: var(--tone); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tone) 20%, transparent); }
.nav-group:hover { background: var(--gl-panel); }
.nav-group .chev { margin-left: auto; color: var(--text-3); transition: transform .2s, color .2s; }
.nav-group .nav-badge, .nav-group .nav-dot { margin-left: auto; }
.nav-group .nav-badge + .chev, .nav-group .nav-dot + .chev { margin-left: 6px; }
.nav-group.open { background: rgba(255, 255, 255, .55); box-shadow: inset 0 0 0 1px #fff, 0 10px 22px -16px rgba(30, 58, 110, .5); }
.nav-group.open .nav-ic { background: linear-gradient(135deg, #3A6CC2, #1E3A6E); color: #fff; box-shadow: none; }
.nav-group.open .chev { transform: rotate(90deg); color: var(--gl-blue); }
.nav-group.has-active:not(.open) .nav-t { font-weight: 500; }
.nav-t { min-width: 0; flex: 0 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Cấp 2: chữ mảnh; đang chọn = nền kính trắng + vạch vàng bên trái */
.nav-children { padding: 2px 0 6px 16px; position: relative; }
.nav-children::before { content: ""; position: absolute; left: 18px; top: 4px; bottom: 10px; width: 1px; background: rgba(31, 51, 70, .1); }
.nav-item { position: relative; display: flex; align-items: center; gap: 8px; min-height: 32px; padding: 3px 8px 3px 14px; margin: 1px 0; border-radius: 12px;
  color: var(--text-2); font-size: 12px; font-weight: 300; transition: background .15s, color .15s; }
.nav-item .nav-i { color: var(--gl-navy-2); opacity: .75; }
.nav-item:hover { background: rgba(255, 255, 255, .42); color: var(--text); }
.nav-item.active { background: rgba(255, 255, 255, .7); color: var(--gl-navy-2); font-weight: 500; box-shadow: 0 6px 16px -10px rgba(30, 58, 110, .35); }
.nav-item.active::before { content: ""; position: absolute; left: 6px; top: 50%; width: 4px; height: 16px; margin-top: -8px; border-radius: 4px; background: linear-gradient(180deg, #F0CF6B, #C98F1F); }
.nav-item.active .nav-i { opacity: 1; color: var(--gl-blue); }
.nav-badge { margin-left: auto; min-width: 20px; text-align: center; background: linear-gradient(135deg, #3A6CC2, #1E3A6E); color: #fff; font-size: 10px; font-weight: 500; border-radius: 10px; padding: 0 6px; line-height: 19px; font-style: normal; }
.nav-badge.warn { background: var(--warning-dot); }
.nav-dot { margin-left: auto; width: 8px; height: 8px; border-radius: 50%; background: var(--warning-dot); flex: none; }

.side-foot { flex: none; margin: 6px 10px 10px; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 16px;
  background: var(--gl-panel); border: 1px solid var(--gl-edge); box-shadow: var(--gl-shadow); }
.side-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success-dot); box-shadow: 0 0 0 3px rgba(23, 178, 106, .18); flex: none; }
.side-foot-t { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.side-foot-t b { font-size: 11px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-foot-t small { font-size: 10px; color: var(--text-3); font-weight: 300; }

.main { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.top { height: var(--top-h); display: flex; align-items: center; gap: 10px; padding: 0 16px 0 10px; position: relative; z-index: 20; }
.top-fill { flex: 1; }
.menu-btn { width: 40px; height: 40px; border-radius: 50%; border-color: transparent; background: transparent; color: var(--text-2); }
.menu-btn:hover { background: var(--gl-panel-2); border-color: #fff; }
.search-btn, .user-btn { border: 1px solid var(--gl-edge); background: var(--gl-panel); color: var(--text-2); font: inherit; cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7), 0 6px 18px -12px rgba(30, 58, 110, .3); transition: background .15s, border-color .15s; }
.search-btn:hover, .user-btn:hover { background: var(--gl-panel-2); border-color: #fff; color: var(--text); }
.search-btn { display: flex; align-items: center; gap: 10px; width: min(300px, 40vw); min-width: 0; height: 40px; padding: 0 16px; border-radius: 999px; font-weight: 300; font-size: 12px; }
.search-btn > span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-wrap { position: relative; }
.user-btn { display: flex; align-items: center; gap: 10px; padding: 3px 12px 3px 3px; border-radius: 999px; text-align: left; height: 44px; }
.user-btn .who { display: flex; flex-direction: column; line-height: 1.2; }
.user-btn .who-name { font-weight: 500; font-size: 11.5px; color: var(--text); }
.user-btn .who-role { font-size: 9.5px; color: var(--text-2); text-transform: uppercase; letter-spacing: .05em; font-weight: 500; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font-size: 11px; font-weight: 600; flex: none; }
.avatar.sm { width: 24px; height: 24px; font-size: 9px; }
.avatar.xs { width: 20px; height: 20px; font-size: 9px; }
.modal-back.clear { background: transparent; backdrop-filter: none; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 8px); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 32px -12px rgba(16, 24, 40, .22); width: 248px; padding: 6px; z-index: 82; }
.menu-pop-head { display: flex; align-items: center; gap: 10px; padding: 8px 8px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.menu-pop-head span:last-child { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.menu-pop-head b { font-weight: 600; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-pop-head small { font-size: 11px; color: var(--text-3); }
.menu-pop a, .menu-pop button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 9px; color: var(--text); font: inherit; font-size: 12px; border: 0; background: none; cursor: pointer; text-align: left; }
.menu-pop a:hover, .menu-pop button:hover { background: var(--primary-soft); }
.menu-pop .ic { color: var(--primary); }
.menu-pop a.danger, .menu-pop a.danger .ic { color: var(--danger-fg); }
.menu-pop a.danger:hover { background: var(--danger-bg); }
.menu-sep { height: 1px; background: var(--line); margin: 4px 6px; }

/* Thanh tab dạng viên kính */
.tabbar { display: flex; align-items: center; gap: 10px; min-height: 54px; padding: 0 16px 4px 6px; }
.tabbar-strip { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; overflow-x: auto; padding: 4px 4px 10px; scrollbar-width: none; }
.tabbar-strip::-webkit-scrollbar { display: none; }
.atab { --tab-tone: var(--t-blue); position: relative; flex: none; display: flex; align-items: center; height: 40px; max-width: 260px; padding: 0 6px 0 0; border-radius: 999px;
  border: 1px solid var(--gl-edge); background: var(--gl-panel); color: var(--text-2); font-size: 12px; font-weight: 300;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), 0 6px 16px -14px rgba(30, 58, 110, .45); transition: background .15s; }
.atab.tone-teal { --tab-tone: var(--t-teal); } .atab.tone-violet { --tab-tone: var(--t-violet); } .atab.tone-amber { --tab-tone: var(--t-amber); }
.atab.tone-rose { --tab-tone: var(--t-rose); } .atab.tone-sky { --tab-tone: var(--t-sky); } .atab.tone-slate { --tab-tone: var(--t-slate); }
.atab:hover { background: var(--gl-panel-2); border-color: #fff; color: var(--text); }
.atab-main { display: flex; align-items: center; gap: 9px; min-width: 0; height: 100%; padding: 0 8px 0 14px; color: inherit; }
.atab-main:hover { color: inherit; }
.atab-ic { color: var(--tab-tone); }
.atab-title { min-width: 0; max-width: 180px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.atab:not(:has(.atab-x)) { padding-right: 4px; }
.atab-x { width: 22px; height: 22px; border: 0; border-radius: 50%; display: grid; place-items: center; background: transparent; color: var(--text-3); cursor: pointer; opacity: .65; padding: 0; }
.atab:hover .atab-x, .atab.active .atab-x { opacity: 1; }
.atab-x:hover { background: var(--danger-bg); color: var(--danger-fg); }
.atab.active { background: rgba(255, 255, 255, .9); border-color: #fff; color: var(--text); font-weight: 500; box-shadow: 0 10px 22px -14px rgba(30, 58, 110, .55), inset 0 1px 0 #fff; }
.atab.active::after { content: ""; position: absolute; left: 50%; bottom: 4px; width: 26px; height: 3px; margin-left: -13px; border-radius: 3px; background: linear-gradient(90deg, #F0CF6B, #C98F1F); }
.atab-closeall { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 6px 0 12px; border-radius: 999px; border: 1px solid var(--gl-edge);
  background: var(--gl-panel); color: var(--text-2); font: inherit; font-size: 11px; cursor: pointer; margin-bottom: 6px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7), 0 6px 18px -12px rgba(30, 58, 110, .3); }
.atab-closeall:hover { background: var(--gl-panel-2); border-color: #fff; color: var(--text); }
.atab-closeall b { min-width: 24px; height: 24px; padding: 0 6px; display: inline-grid; place-items: center; border-radius: 999px; background: linear-gradient(135deg, #3A6CC2, #1E3A6E); color: #fff; font-size: 10.5px; font-weight: 600; }

/* Vùng nội dung: tấm kính lớn */
.content { flex: 1; margin: 0 10px 10px 4px; padding: 20px 22px 40px; border-radius: 28px; border: 1px solid rgba(255, 255, 255, .62); min-width: 0;
  background: radial-gradient(700px 300px at 100% 0%, rgba(231, 207, 127, .14), transparent 70%), linear-gradient(180deg, rgba(255, 255, 255, .42), rgba(236, 242, 252, .28));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7), 0 30px 60px -40px rgba(30, 58, 110, .35); }
.content > * { max-width: var(--content-max); margin-left: auto; margin-right: auto; }
.side-back { display: none; }

@media (max-width: 960px) {
  .shell, .shell.nav-hidden { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; left: calc(-1 * var(--side-w) - 12px); top: 0; z-index: 50; width: var(--side-w); visibility: visible !important; transition: left .2s;
    background: linear-gradient(165deg, #C6D5EE 0%, #DCE6F3 60%, #E8F0EF 100%); box-shadow: var(--sh-4); }
  .menu-open .side { left: 0; }
  .menu-open .side-back { display: block; position: fixed; inset: 0; background: var(--backdrop); z-index: 40; }
  .content { margin: 0 8px 8px; padding: 16px 14px 56px; border-radius: 22px; }
  .top { padding: 0 10px 0 6px; }
  .user-btn .who { display: none; }
  .user-btn { padding: 3px; }
  .search-btn { width: auto; flex: 1; max-width: 300px; }
  .tabbar { display: none; }
}

/* ===================== Đầu trang ===================== */
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .grow { flex: 1; min-width: 240px; }
.page-head p { margin: 6px 0 0; color: var(--text-2); max-width: 900px; font-size: 12px; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--text-2); font-size: 11.5px; font-weight: 500; margin-bottom: 6px; }
.back:hover { color: var(--primary); }
.title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ===================== Thẻ & lưới ===================== */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh-2); }
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-head > .ic { color: var(--primary); }
.card-head h3 { flex: 1; font-size: 13.5px; font-weight: 600; }
.card-body { padding: 18px 20px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; } .span3 { grid-column: span 3; } .span4 { grid-column: 1 / -1; }
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } .span2, .span3 { grid-column: auto; } }
.grid > .card + .card, .grid > div > .card + .card { margin-top: 0; }
.grid > div > .card + .card { margin-top: 16px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sp { flex: 1; }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; }

/* Thanh lọc: một hàng, mọi ô cao bằng nhau */
.filter-bar .card-body { padding: 12px 16px; }
.filter-bar .row { gap: 8px; }
.filter-bar .inp, .filter-bar .btn, .filter-bar .icon-btn { height: var(--h-ctl); }
.filter-bar .icon-btn { width: var(--h-ctl); }
.filter-bar .row + .chips { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.filter-bar .chk { height: var(--h-ctl); padding: 0 4px; }

/* ===================== KPI ===================== */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { --k: var(--primary); --k-glow: rgba(61, 90, 176, .14);
  position: relative; overflow: hidden; isolation: isolate; container-type: inline-size; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px 14px; box-shadow: var(--sh-2); min-width: 0; }
.stat::before { content: ""; position: absolute; z-index: -1; right: -80px; top: -90px; width: 260px; height: 220px; border-radius: 50%; background: radial-gradient(closest-side, var(--k-glow), transparent); pointer-events: none; }
.stat.ok   { --k: var(--accent);      --k-glow: rgba(15, 143, 138, .15); }
.stat.teal { --k: var(--accent);      --k-glow: rgba(15, 143, 138, .15); }
.stat.err  { --k: var(--err);         --k-glow: rgba(194, 40, 42, .12); }
.stat.warn { --k: var(--warning-dot); --k-glow: rgba(232, 207, 125, .30); }
.stat.info { --k: var(--primary);     --k-glow: rgba(61, 90, 176, .15); }
.stat-label { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--text-2); font-weight: 500; line-height: 1.3; }
.stat-label > span:last-child { min-width: 0; }
.stat-ic { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--k); color: #fff; box-shadow: 0 4px 10px -4px var(--k); }
.stat-value { font-size: clamp(18px, 13cqi, 29px); font-weight: 300; letter-spacing: -.025em; margin-top: 10px; font-variant-numeric: tabular-nums; line-height: 1.1; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat.err .stat-value { color: var(--err); }
.stat-sub { font-size: 11px; color: var(--text-3); margin-top: 6px; min-height: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ===================== Biểu mẫu ===================== */
.fld { display: flex; flex-direction: column; gap: 6px; font-size: 11.5px; }
.fld > span { color: var(--text-2); font-weight: 500; }
.req { color: var(--err); font-weight: 600; }
.inp, select.inp, textarea.inp { width: 100%; height: 34px; border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 0 12px; font: inherit; font-size: 12px; color: var(--text); background: var(--surface); transition: border-color .15s, box-shadow .15s; }
select.inp { padding-right: 30px; }
textarea.inp { height: auto; min-height: 72px; padding: 9px 12px; resize: vertical; line-height: 1.5; }
.inp::placeholder { color: var(--text-3); }
.inp:hover { border-color: var(--line-3); }
.inp:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
.inp:disabled { background: var(--surface-2); color: var(--text-2); }
.inp.num { text-align: right; font-variant-numeric: tabular-nums; }
.inp.invalid { border-color: var(--err); background: var(--err-soft); }
/* Ô ngày hết hạn visa/TRC: vàng khi trong ngưỡng cảnh báo, đỏ khi đã quá hạn */
.inp.exp-warn { border-color: var(--warning-dot); background: var(--warning-bg); color: var(--warning-fg); font-weight: 600; }
.inp.exp-err { border-color: var(--danger-dot); background: var(--danger-bg); color: var(--danger-fg); font-weight: 600; }
.inp.sm { height: 32px; }
.chk { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; color: var(--text-2); }
.chk input { width: 16px; height: 16px; accent-color: var(--primary); }
.month-picker { display: inline-flex; gap: 4px; align-items: center; }
.month-picker .inp { width: 160px; }
.hint { font-size: 11px; color: var(--text-3); }
.search-inp { position: relative; }
.search-inp .ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.search-inp .inp { padding-left: 36px; }

/* ===================== Nút ===================== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--surface); color: var(--text); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap; box-shadow: var(--sh-1); transition: background .15s, border-color .15s, box-shadow .15s, color .15s; }
.btn:hover { background: var(--primary-soft); border-color: var(--primary-line); color: var(--primary-2); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--primary-ring); }
.btn:disabled, .btn:disabled:hover { background: var(--surface-3); border-color: var(--line-2); color: var(--text-2); box-shadow: none; cursor: not-allowed; }
.btn .ic { color: inherit; }
.btn.primary { background: linear-gradient(135deg, var(--primary), var(--primary-3)); border-color: var(--primary-2); color: var(--on-primary); box-shadow: var(--sh-brand), inset 0 1px 0 rgba(255, 255, 255, .18); }
.btn.primary:hover { background: var(--primary-2); border-color: var(--primary-2); color: var(--on-primary); }
.btn.ok { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ok:hover { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }
.btn.danger { background: var(--surface); border-color: var(--danger-bd); color: var(--err); }
.btn.danger:hover { background: var(--err-soft); color: var(--err-2); }
.btn.danger-solid { background: var(--err); border-color: var(--err); color: #fff; }
.btn.danger-solid:hover { background: var(--err-2); border-color: var(--err-2); color: #fff; }
.btn.primary:disabled, .btn.ok:disabled, .btn.danger-solid:disabled { background: var(--line-2); border-color: var(--line-2); color: var(--text-2); box-shadow: none; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); box-shadow: none; }
.btn.ghost:hover { background: var(--primary-soft); color: var(--primary-2); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 11.5px; border-radius: 8px; }
.btn.block { width: 100%; }
.icon-btn { width: 34px; height: 34px; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); cursor: pointer; color: var(--text-2); flex: none; }
.icon-btn:hover { background: var(--primary-soft); color: var(--primary); border-color: var(--primary-line); }
.icon-btn.plain { border-color: transparent; background: transparent; }
.icon-btn.sm { width: 28px; height: 28px; border-radius: 7px; }

/* ===================== Bảng ===================== */
.tbl-wrap { overflow: auto; max-height: calc(100vh - 220px); }
/* Bảng ít dòng có ô chọn thả xuống (Picker): cho danh sách tràn ra ngoài khung bảng thay vì bị cắt */
.tbl-wrap.pop { overflow: visible; max-height: none; }
.card > .tbl-wrap:first-child { border-radius: var(--r) var(--r) 0 0; }
.card > .tbl-wrap:only-child { border-radius: var(--r); }
.card > .tbl-wrap:last-child, .card > table:last-child { border-radius: 0 0 var(--r) var(--r); }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12px; }
.tbl th { text-align: left; font-weight: 600; color: var(--th-fg); font-size: 11px; background: var(--th-bg); padding: 9px 10px; border-bottom: 1px solid var(--th-line); white-space: nowrap; position: sticky; top: 0; z-index: 2; letter-spacing: .005em; }
.tbl td { padding: 10px 12px; height: 44px; border-bottom: 1px solid var(--row-line); vertical-align: middle; line-height: 1.4; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: var(--row-hover); }
.tbl tfoot td { font-weight: 700; color: var(--th-fg); background: var(--tfoot-bg); border-top: 1px solid var(--th-line); border-bottom: 0; position: sticky; bottom: 0; }
.tbl td small { display: block; color: var(--text-3); font-size: 11px; margin-top: 1px; }
.tbl .num, .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl th.num { text-align: right; }
.tbl .c, .tbl th.c { text-align: center; }
.tbl.edit td { padding: 6px 8px; height: auto; }
.tbl.edit .inp { height: 34px; }
/* Bảng dòng dịch vụ của hồ sơ: ô số lượng là ô chữ chỉ nhận số (không dùng ô number của trình duyệt, có máy không hiện số),
   số căn giữa, đậm, màu chữ ghi rõ để cả khi khóa vẫn đọc được; ô tiền đủ rộng cho hàng trăm triệu */
.tbl.edit .col-qty { width: 96px; min-width: 96px; text-align: center; }
.tbl.edit .col-price { min-width: 150px; }
.tbl.edit .col-total { min-width: 180px; }
.tbl.edit .inp.qty { width: 100%; min-width: 72px; padding: 0 6px; text-align: center; text-indent: 0; line-height: normal;
  font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text); -webkit-text-fill-color: var(--text); opacity: 1; }
.tbl.edit .inp.qty:disabled { color: var(--text-2); -webkit-text-fill-color: var(--text-2); }
.tbl tr.void td { color: var(--text-3); text-decoration: line-through; }
.tbl tr.clickable { cursor: pointer; }
.tbl td .badge + .badge { margin-left: 4px; }
/* Độ rộng cột dùng chung (đặt ở th). Cột chữ tự giãn, cột cố định không xuống dòng. */
.tbl .w-code { width: 132px; white-space: nowrap; }
.tbl .w-date { width: 96px; white-space: nowrap; }
.tbl .w-name { min-width: 220px; }
.tbl .w-text { min-width: 260px; }
.tbl .w-person { width: 112px; min-width: 96px; }
.tbl .w-tax { width: 124px; white-space: nowrap; }
.tbl .w-status { width: 152px; min-width: 136px; }
.tbl .w-money { width: 120px; min-width: 108px; }
.tbl .w-money-s { width: 104px; min-width: 92px; }
.tbl .w-count { width: 92px; }
.tbl .w-pct { width: 120px; }
.tbl .w-act { width: 1%; white-space: nowrap; }
.tbl td.nowrap, .nowrap { white-space: nowrap; }
/* Bảng báo cáo nhiều cột tiền: ô hẹp hơn để vừa một màn */
.tbl.dense th, .tbl.dense td { padding-left: 8px; padding-right: 8px; }
.tbl.dense td { font-size: 11.5px; }
.tbl.dense .w-name { min-width: 180px; }
/* Bảng rộng hơn khung: giữ cột đầu (mã) đứng yên khi cuộn ngang */
.tbl-wrap .tbl tbody td:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); }
.tbl-wrap .tbl tbody tr:hover td:first-child { background: var(--row-hover); }
.tbl-wrap .tbl thead th:first-child { left: 0; z-index: 3; }
.tbl-wrap .tbl tfoot td:first-child { left: 0; z-index: 3; }
@media (max-width: 1600px) {
  .tbl th, .tbl td { padding-left: 8px; padding-right: 8px; }
  .tbl .w-code { width: 118px; }
  .tbl .w-date { width: 86px; }
  .tbl .w-name { min-width: 170px; }
  .tbl .w-text { min-width: 200px; }
  .tbl .w-status { width: 128px; min-width: 120px; }
  .tbl .w-money { width: 108px; min-width: 100px; }
  .clamp1 { max-width: 320px; }
}
/* Màn hẹp (laptop 14 inch): ẩn cột phụ để bảng chính vừa khung, không phải cuộn ngang */
@media (max-width: 1500px) {
  .tbl .hide-md { display: none; }
}
.clamp1 { display: block; max-width: 440px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 480px; }
.fill { width: 0; min-width: 100%; max-width: none; }
.badges { display: flex; flex-wrap: wrap; gap: 4px; }
.badges .badge + .badge { margin-left: 0; }
.in { color: var(--in); } .out { color: var(--out); } .neg { color: var(--err); }
.strong { font-weight: 600; }
.code { font-family: var(--mono); font-size: 11px; white-space: nowrap; letter-spacing: -.01em; }
.tbl td.code a { font-weight: 600; }
.code .badge { font-family: var(--font); letter-spacing: 0; margin-left: 6px; }
.tbl td.code .badge { display: flex; width: max-content; margin: 3px 0 0; }
.stat-ic .ic { stroke-width: 2.25; }
.empty { padding: 40px 20px 36px; text-align: center; color: var(--text-3); }
.empty::before { content: ""; display: block; width: 48px; height: 48px; margin: 0 auto 10px; border-radius: 50%; background: var(--primary-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%233D5AB0' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 12h-6l-2 3h-4l-2-3H2'/%3E%3Cpath d='M5.5 5h13L22 12v6a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-6z'/%3E%3C/svg%3E") center / 22px no-repeat; }
.empty-state { text-align: center; padding: 64px 20px; }
.empty-state h2 { margin-bottom: 6px; }
.empty-state p { color: var(--text-2); margin: 0 0 16px; }
.empty-ic { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 14px; background: var(--primary-soft); color: var(--primary); }

/* ===================== Nhãn, thông báo ===================== */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; padding: 1px 9px 1px 8px; border-radius: 999px; white-space: nowrap; line-height: 20px; vertical-align: middle; border: 1px solid transparent; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--dot, currentColor); flex: none; }
.badge.nodot::before { display: none; }
.b-ok   { background: var(--success-bg); border-color: var(--success-bd); color: var(--success-fg); --dot: var(--success-dot); }
.b-warn { background: var(--warning-bg); border-color: var(--warning-bd); color: var(--warning-fg); --dot: var(--warning-dot); }
.b-err  { background: var(--danger-bg);  border-color: var(--danger-bd);  color: var(--danger-fg);  --dot: var(--danger-dot); }
.b-info { background: var(--info-bg);    border-color: var(--info-bd);    color: var(--info-fg);    --dot: var(--info-dot); }
.b-mute { background: var(--neutral-bg); border-color: var(--neutral-bd); color: var(--neutral-fg); --dot: var(--neutral-dot); }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: 12px; font-size: 12px; margin: 10px 0; border: 1px solid transparent; }
.alert.err  { background: var(--danger-bg);  color: var(--danger-fg);  border-color: var(--danger-bd); }
.alert.warn { background: var(--warning-bg); color: var(--warning-fg); border-color: var(--warning-bd); }
.alert.info { background: var(--info-bg);    color: var(--info-fg);    border-color: var(--info-bd); }
.alert.ok   { background: var(--success-bg); color: var(--success-fg); border-color: var(--success-bd); }

/* ===================== Tab, chip ===================== */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tab { padding: 10px 14px; border: 0; background: none; font: inherit; font-weight: 500; color: var(--text-2); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; margin-bottom: -1px; }
.tab:hover { color: var(--text); }
.tab.on { color: var(--primary-2); border-bottom-color: var(--primary); font-weight: 600; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; border: 1px solid var(--line-2); background: var(--surface); border-radius: 999px; padding: 0 13px; font: inherit; font-size: 11.5px; font-weight: 500; cursor: pointer; color: var(--text-2); }
.chip:hover { border-color: var(--primary-line); color: var(--primary-2); background: var(--primary-soft); }
.chip.on { background: var(--primary); border-color: var(--primary); color: var(--on-primary); font-weight: 600; box-shadow: var(--sh-brand); }
.seg { display: inline-flex; background: var(--surface-3); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; font: inherit; font-size: 11.5px; font-weight: 500; color: var(--text-2); padding: 6px 12px; border-radius: 8px; cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--primary-2); font-weight: 600; box-shadow: var(--sh-1); }

/* ===================== Ô chọn có tìm kiếm ===================== */
.picker { position: relative; }
.picker .inp { padding-right: 30px; }
.picker-x { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--text-3); cursor: pointer; display: grid; place-items: center; padding: 4px; border-radius: 6px; }
.picker-x:hover { background: var(--surface-3); color: var(--text); }
.picker-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); max-height: 300px; overflow-y: auto; z-index: 60; min-width: 260px; padding: 4px; }
.picker-item { padding: 8px 10px; cursor: pointer; border-radius: 8px; }
.picker-item small { color: var(--text-3); display: block; }
.picker-item:hover, .picker-item.sel { background: var(--primary-soft); }
.picker-item.create { color: var(--primary); font-weight: 600; }
.picker-empty { padding: 10px; color: var(--text-3); }

/* ===================== Hộp thoại, toast ===================== */
.modal-back { position: fixed; inset: 0; background: var(--backdrop); backdrop-filter: blur(2px); z-index: 80; animation: fade .15s; }
.modal { position: fixed; z-index: 81; top: 7vh; left: 50%; transform: translateX(-50%); width: min(580px, calc(100vw - 24px)); max-height: 86vh; display: flex; flex-direction: column; background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg); animation: pop .16s ease-out; }
.modal.wide { width: min(980px, calc(100vw - 24px)); }
.modal.dialog { width: min(460px, calc(100vw - 24px)); top: 18vh; }
.modal-head { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { flex: 1; font-size: 14.5px; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; background: var(--surface-2); border-radius: 0 0 16px 16px; }
.dialog-body { display: flex; gap: 14px; padding: 22px 22px 18px; }
.dialog-ic { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); flex: none; }
.dialog-ic.danger { background: var(--err-soft); color: var(--err); }
.dialog-text { flex: 1; min-width: 0; }
.dialog-text h3 { font-size: 14.5px; margin-top: 2px; }
.dialog-text p { color: var(--text-2); margin: 6px 0 0; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translate(-50%, 8px) scale(.98); } }
.drawer { position: fixed; z-index: 81; top: 0; right: 0; bottom: 0; width: min(760px, 100vw); background: #fff; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: slide .18s ease-out; }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100; max-width: min(420px, calc(100vw - 40px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: #fff; color: var(--text); box-shadow: var(--shadow-lg); border: 1px solid var(--line); cursor: pointer; font-size: 12px; animation: pop2 .18s ease-out; }
.toast.ok .ic { color: var(--ok); } .toast.err .ic { color: var(--err); }
.toast.err { border-color: var(--danger-bd); }
@keyframes pop2 { from { opacity: 0; transform: translateY(8px); } }

/* ===================== Khối tổng hợp ===================== */
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.money-box { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--line); border-radius: var(--r); overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow); }
.money-box > div { background: #fff; padding: 12px 14px; }
.money-box label { display: block; font-size: 11px; color: var(--text-2); font-weight: 500; }
.money-box b { font-size: 15.5px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.bar { height: 8px; background: var(--surface-3); border-radius: 6px; overflow: hidden; min-width: 60px; }
.bar > i { display: block; height: 100%; background: var(--primary); border-radius: 6px; }
.bar.teal > i { background: var(--accent); }
.check { border: 1px solid var(--line); border-radius: var(--r); background: #fff; margin-bottom: 10px; box-shadow: var(--shadow); }
.check-head { display: flex; gap: 12px; align-items: center; padding: 12px 16px; cursor: pointer; flex-wrap: wrap; }
.check-head h4 { flex: 1; min-width: 200px; }
.check-dot { min-width: 26px; height: 26px; padding: 0 6px; border-radius: 13px; display: grid; place-items: center; color: #fff; font-size: 11px; font-weight: 700; flex: none; }
.check-dot.ok { background: var(--ok); } .check-dot.e3 { background: var(--err); } .check-dot.e2 { background: var(--warning-dot); } .check-dot.e1 { background: var(--neutral-dot); }
.check-body { border-top: 1px solid var(--line); padding: 6px 16px 12px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 6px 0 6px 18px; border-left: 2px solid var(--line); position: relative; font-size: 11.5px; color: var(--text-2); }
.timeline li::before { content: ""; position: absolute; left: -5px; top: 12px; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }

/* ===================== Biểu đồ cột ===================== */
.chart { display: flex; align-items: flex-end; gap: 18px; height: 200px; padding: 8px 4px 0; border-bottom: 1px solid var(--line); }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.chart-bars { display: flex; gap: 4px; align-items: flex-end; height: calc(100% - 22px); width: 100%; justify-content: center; }
.chart-bars i { width: 22px; border-radius: 6px 6px 2px 2px; background: var(--primary); min-height: 2px; }
.chart-bars i.b2 { background: var(--accent); }
.chart-col span { font-size: 10.5px; color: var(--text-3); white-space: nowrap; }
.legend { display: flex; gap: 16px; font-size: 11px; color: var(--text-2); margin-top: 10px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; background: var(--primary); }
.legend i.b2 { background: var(--accent); }

/* ===================== Công việc / Kanban ===================== */
.board { display: grid; grid-template-columns: repeat(5, minmax(230px, 1fr)); gap: 14px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.col { background: var(--surface-3); border-radius: var(--r); padding: 10px; min-height: 200px; transition: background .15s, box-shadow .15s; }
.col.drop { background: var(--primary-soft); box-shadow: inset 0 0 0 2px var(--primary-line); }
.col-head { display: flex; align-items: center; gap: 8px; padding: 2px 4px 10px; font-weight: 600; font-size: 11.5px; }
.col-head .cnt { color: var(--text-3); font-weight: 500; }
.col-dot { width: 8px; height: 8px; border-radius: 50%; }
.tcard { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 8px; box-shadow: var(--shadow); cursor: grab; transition: box-shadow .15s, transform .15s; }
.tcard:hover { box-shadow: var(--shadow-md); }
.tcard.dragging { opacity: .45; }
.tcard-title { font-weight: 550; line-height: 1.4; margin: 6px 0 10px; }
.tcard-meta { display: flex; align-items: center; gap: 10px; color: var(--text-3); font-size: 11px; flex-wrap: wrap; }
.tcard-meta span { display: inline-flex; align-items: center; gap: 4px; }
.tcard-meta .late { color: var(--err); font-weight: 600; }
.tcard-meta .avatar { display: inline-grid; flex: none; padding: 0; }
.proj-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 10.5px; color: var(--text-2); font-weight: 500; }
.proj-tag i { width: 8px; height: 8px; border-radius: 3px; }
/* Thẻ phân loại công việc: --c là màu người dùng chọn (WorkTag.Color); nền pha 15%, chữ đậm */
.wtags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.wtags.pick { gap: 6px; }
.wtag { display: inline-flex; align-items: center; gap: 4px; font: inherit; font-size: 11px; font-weight: 600; line-height: 20px; padding: 1px 9px; border-radius: 999px;
  background: color-mix(in srgb, var(--c) 15%, var(--surface)); color: color-mix(in srgb, var(--c) 72%, var(--text)); border: 1px solid color-mix(in srgb, var(--c) 32%, var(--surface)); white-space: nowrap; }
.wtag.sm { font-size: 10px; line-height: 16px; padding: 0 7px; }
button.wtag { cursor: pointer; }
button.wtag:disabled { cursor: default; }
.wtag.off { background: var(--surface); color: var(--text-2); border-color: var(--line-2); }
.wtag.off:not(:disabled):hover { border-color: color-mix(in srgb, var(--c) 50%, var(--surface)); color: color-mix(in srgb, var(--c) 72%, var(--text)); }
.chip-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.color-inp { width: 44px; height: 34px; padding: 2px; border: 1px solid var(--line-2); border-radius: var(--r-xs); background: var(--surface); cursor: pointer; }
.quick-add { display: flex; gap: 6px; margin-top: 4px; }
.quick-add .inp { height: 34px; background: #fff; }
.task-row { display: flex; gap: 12px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.task-row:hover { background: var(--row-hover); }
.task-row:last-child { border-bottom: 0; }
.task-row .t { flex: 1; min-width: 0; }
.task-row .t div { font-weight: 550; }
.task-row.done .t div { color: var(--text-3); text-decoration: line-through; }
.tick { width: 20px; height: 20px; border-radius: 6px; border: 1.75px solid var(--line-2); background: #fff; display: grid; place-items: center; cursor: pointer; color: #fff; flex: none; padding: 0; }
.tick.on { background: var(--accent); border-color: var(--accent); }
.group-h { display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); font-weight: 600; font-size: 11.5px; }
.cl-item { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.cl-item.done span { color: var(--text-3); text-decoration: line-through; }
.cmt { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cmt:last-child { border-bottom: 0; }
.cmt-body { flex: 1; }
.cmt-body b { font-size: 11.5px; }
.cmt-body small { color: var(--text-3); margin-left: 6px; }
.cmt-body p { margin: 2px 0 0; white-space: pre-wrap; }
.people { display: flex; flex-wrap: wrap; gap: 6px; }
.person-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 3px; border-radius: 20px; border: 1px solid var(--line); background: #fff; font-size: 11px; cursor: pointer; }
.person-chip.on { border-color: var(--primary-line); background: var(--primary-soft); color: var(--primary-2); font-weight: 600; }
.progress-line { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--text-3); }
.progress-line .bar { flex: 1; height: 6px; }

/* ===================== DSU ===================== */
.dsu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; align-items: start; }
.dsu-card { background: #fff; border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); display: flex; flex-direction: column; }
.dsu-card.missing { background: var(--surface-2); border-style: dashed; box-shadow: none; }
.dsu-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.dsu-head .n { flex: 1; min-width: 0; }
.dsu-head .n b { display: block; font-size: 12px; }
.dsu-head .n small { color: var(--text-3); }
.dsu-sec { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.dsu-sec:last-child { border-bottom: 0; }
.dsu-sec h5 { margin: 0 0 6px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.dsu-sec p { margin: 0; white-space: pre-wrap; }
.dsu-sec ul { margin: 4px 0 0; padding-left: 18px; }
.dsu-sec.block { background: var(--gold-soft); }
.pick-list { display: flex; flex-direction: column; gap: 4px; max-height: 260px; overflow-y: auto; }
.pick { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; background: #fff; }
.pick:hover { border-color: var(--primary-line); }
.pick.on { border-color: var(--primary); background: var(--primary-soft); }
.pick .t { flex: 1; min-width: 0; }
.pick small { color: var(--text-3); }
.mood { display: inline-flex; gap: 6px; }
.mood button { border: 1px solid var(--line-2); background: #fff; border-radius: 20px; padding: 5px 12px; font: inherit; font-size: 11.5px; cursor: pointer; color: var(--text-2); }
.mood button.on { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-2); font-weight: 600; }

/* ===================== Tìm nhanh ===================== */
.cmdk { position: fixed; z-index: 91; top: 12vh; left: 50%; transform: translateX(-50%); width: min(620px, calc(100vw - 24px)); background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden; animation: pop .16s ease-out; }
.cmdk-in { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.cmdk-in input { flex: 1; height: 54px; border: 0; outline: none; font: inherit; font-size: 13.5px; }
.cmdk-list { max-height: 420px; overflow-y: auto; padding: 6px; }
.cmdk-sec { font-size: 10px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; padding: 10px 10px 4px; }
.cmdk-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; cursor: pointer; color: var(--text); }
.cmdk-item small { color: var(--text-3); margin-left: auto; }
.cmdk-item.sel, .cmdk-item:hover { background: var(--primary-soft); }
.cmdk-back { z-index: 90; }

/* ===================== In ấn ===================== */
.print-only { display: none; }
@media print {
  .side, .top, .no-print, .toasts { display: none !important; }
  .content { padding: 0; }
  .card { box-shadow: none; border: 0; }
  .print-only { display: block; }
  body { background: #fff; }
  .tbl-wrap { max-height: none; overflow: visible; }
}

/* Ô lưới và thẻ không được giãn theo bảng bên trong: bảng tự cuộn trong khung của nó (tránh tràn trang trên điện thoại) */
.grid > *, .main, .content, .card { min-width: 0; }

/* Hình thức thanh toán */
.pay-seg { align-self: flex-start; }
.pay-seg button { padding: 7px 16px; }
.pay-seg button:disabled { cursor: default; opacity: .75; }
.pay-m { display: inline-block; font-size: 11px; font-weight: 500; }
.pay-m.tm { color: #8A6A12; }
.pay-m.ck { color: var(--primary-2); }
.tbl .w-fund { min-width: 150px; }
.tbl .w-cat { min-width: 130px; }
.sec-sub { margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 11.5px; font-weight: 600; color: var(--text); }
/* Ma trận phân quyền */
.tbl.perm-matrix th.c { min-width: 112px; }
.tbl.perm-matrix input[type=checkbox] { width: 17px; height: 17px; cursor: pointer; accent-color: var(--primary); }
.tbl.perm-matrix input[type=checkbox]:disabled { cursor: default; opacity: .55; }
.tbl.perm-matrix th .hint { font-weight: 400; font-size: 10.5px; }

/* =====================================================================
   Lớp kính cho thành phần bên trong (theo HTOS skin-glass)
   Đặt cuối file để thắng các khai báo gốc phía trên; không đổi tên lớp nào.
   ===================================================================== */
h2, h3, h4 { font-weight: 500; }
.page-head { margin-bottom: 22px; }
.page-head h1 { color: var(--text); }
.page-head p { color: var(--text-2); font-weight: 300; }

/* Thẻ = tấm kính trắng bo lớn */
.card { background: var(--gl-card); border: 1px solid rgba(255, 255, 255, .85); border-radius: var(--r-lg); box-shadow: var(--gl-shadow); }
.card-head { border-bottom-color: var(--gl-line); padding: 14px 20px; }
.card-head h3 { font-weight: 500; }
.card-head > .ic { width: 32px; height: 32px; padding: 7px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); box-sizing: border-box; }
.card > .tbl-wrap:first-child { border-radius: var(--r-lg) var(--r-lg) 0 0; }
.card > .tbl-wrap:only-child { border-radius: var(--r-lg); }
.card > .tbl-wrap:last-child, .card > table:last-child { border-radius: 0 0 var(--r-lg) var(--r-lg); }
.filter-bar { background: rgba(255, 255, 255, .55); }

/* Ô số liệu: viên kính có quầng màu góc phải, icon tròn đặc, số nét mảnh cỡ lớn */
.stats { gap: 16px; }
.stat { background: linear-gradient(135deg, rgba(255, 255, 255, .82), rgba(255, 255, 255, .52)); border: 1px solid rgba(255, 255, 255, .9);
  border-radius: var(--r-lg); padding: 18px 20px 16px; box-shadow: var(--gl-shadow); }
.stat::before { right: -70px; top: -90px; width: 280px; height: 240px; }
.stat.warn { --k: #C98F1F; --k-glow: rgba(231, 207, 127, .45); }
.stat-label { color: var(--text-2); font-weight: 400; }
.stat-ic { width: 32px; height: 32px; background: linear-gradient(135deg, color-mix(in srgb, var(--k) 78%, #fff), var(--k)); box-shadow: 0 8px 16px -8px var(--k); }
.stat-value { font-weight: 300; font-size: clamp(20px, 14cqi, 32.5px); margin-top: 12px; }
.stat-sub { color: var(--text-2); }

/* Nút: viên tròn; nút chính xanh thương hiệu */
.btn { border-radius: 999px; padding: 0 18px; font-weight: 500; background: rgba(255, 255, 255, .82); border-color: var(--line-2); }
.btn:hover { background: #fff; border-color: var(--primary-line); color: var(--primary-2); }
.btn.sm { border-radius: 999px; padding: 0 12px; }
.btn.primary { background: linear-gradient(135deg, #3A6CC2, #2F4D86); border-color: transparent; color: #fff; box-shadow: var(--sh-brand), inset 0 1px 0 rgba(255, 255, 255, .22); }
.btn.primary:hover { background: linear-gradient(135deg, #4577CC, #34558F); border-color: transparent; color: #fff; }
.btn.ok { background: linear-gradient(135deg, #14A39D, #0B7570); border-color: transparent; box-shadow: 0 10px 22px -12px rgba(11, 117, 112, .7); }
.btn.ok:hover { background: linear-gradient(135deg, #18B0AA, #0D817B); border-color: transparent; }
.btn.danger { background: rgba(255, 255, 255, .82); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: rgba(255, 255, 255, .6); border-color: transparent; }
.btn:disabled, .btn:disabled:hover, .btn.primary:disabled, .btn.ok:disabled, .btn.danger-solid:disabled { background: var(--surface-3); border-color: var(--line-2); color: var(--text-2); box-shadow: none; }
.icon-btn { border-radius: 50%; background: rgba(255, 255, 255, .8); border-color: var(--line); }
.icon-btn.plain { background: transparent; border-color: transparent; }

/* Ô nhập */
.inp, select.inp, textarea.inp { border-radius: var(--r-sm); background: rgba(255, 255, 255, .9); border-color: var(--line-2); }
.inp:focus { background: #fff; }
.filter-bar .inp, .filter-bar .btn { height: 38px; }
.search-inp .inp { border-radius: 999px; }

/* Bảng */
.tbl { font-size: 12px; }
.tbl th { font-weight: 500; }
.tbl tbody td { background: rgba(255, 255, 255, .55); }
.tbl-wrap .tbl tbody td:first-child { background: #fbfcfe; }
.tbl tbody tr:hover td, .tbl-wrap .tbl tbody tr:hover td:first-child { background: var(--row-hover); }
.tbl td.code a, .tbl td a.strong { font-weight: 500; }
.code { font-family: var(--font); font-variant-numeric: tabular-nums; letter-spacing: 0; }

/* Tab trong trang và nhóm nút chọn */
.tabs { border-bottom-color: var(--gl-line); gap: 6px; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.seg { background: rgba(255, 255, 255, .5); border: 1px solid rgba(255, 255, 255, .8); border-radius: 999px; padding: 3px; }
.seg button { border-radius: 999px; }
.seg button.on { background: #fff; color: var(--primary-2); box-shadow: 0 6px 14px -10px rgba(30, 58, 110, .5); }
.chip { background: rgba(255, 255, 255, .7); border-color: var(--line-2); }
.chip.on { background: linear-gradient(135deg, #3A6CC2, #2F4D86); border-color: transparent; }

/* Khối tiền, Kanban, DSU */
.money-box { border-radius: var(--r-lg); border-color: rgba(255, 255, 255, .85); box-shadow: var(--gl-shadow); }
.money-box > div { background: rgba(255, 255, 255, .8); }
.money-box b { font-weight: 500; }
.col { background: rgba(255, 255, 255, .38); border: 1px solid rgba(255, 255, 255, .7); border-radius: var(--r-lg); }
.tcard, .dsu-card, .check { border-radius: 16px; border-color: rgba(255, 255, 255, .9); box-shadow: var(--gl-shadow); }
.dsu-card.missing { background: rgba(255, 255, 255, .4); border-color: var(--line-2); }
.group-h { background: rgba(255, 255, 255, .5); }

/* Hộp thoại, ngăn kéo, tìm nhanh */
.modal, .cmdk { border-radius: 22px; }
.modal-foot { border-radius: 0 0 22px 22px; }
.modal-back { background: rgba(19, 33, 58, .38); }
.toast { border-radius: 14px; }

/* Trang trống, thông báo */
.alert { border-radius: 14px; }
.empty-state .empty-ic { background: rgba(255, 255, 255, .7); box-shadow: var(--gl-shadow); }

/* Màn hẹp: bảng có ô chọn thả xuống (tbl-wrap pop) tự cuộn ngang trong khung, không đẩy rộng cả trang */
@media (max-width: 960px) {
  .tbl-wrap.pop { overflow-x: auto; }
}


/* =====================================================================
   Chế độ tối (theo HTOS theme-dark.css). Bật khi html[data-theme="dark"]:
   nút ở thanh trên và trong menu tài khoản, nhớ ở localStorage afin.theme,
   script đầu trang App.razor đặt sẵn để không nháy màn sáng.
   Phần 1 đổi token, phần 2 ghi đè chỗ viết cứng màu trắng. Chỉ áp trên màn hình, bản in giữ nền trắng.
   ===================================================================== */
@media screen {
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0B1424;
  --bg-glow:
      radial-gradient(900px 520px at 82% -10%, rgba(231, 207, 127, .10), transparent 62%),
      radial-gradient(900px 640px at -6% -6%, rgba(67, 106, 179, .38), transparent 60%),
      radial-gradient(760px 560px at 30% 112%, rgba(43, 179, 163, .14), transparent 60%),
      linear-gradient(165deg, #0E1A30 0%, #0B1424 50%, #0A1A22 100%);
  --gl-navy: #2F5FB3; --gl-navy-2: #9DBBF2; --gl-blue: #8FB0EE;
  --gl-panel: rgba(255, 255, 255, .06); --gl-panel-2: rgba(255, 255, 255, .11); --gl-edge: rgba(255, 255, 255, .12);
  --gl-card: rgba(21, 33, 58, .78); --gl-line: rgba(255, 255, 255, .08);
  --gl-shadow: 0 12px 32px -16px rgba(0, 0, 0, .65), 0 2px 6px -2px rgba(0, 0, 0, .35);

  --surface: #15213A; --surface-2: #111C31; --surface-3: #1B2945; --surface-glass: rgba(17, 28, 49, .72);
  --line: #263654; --line-2: #33466B; --line-3: #40557E;
  --text: #E6ECF7; --text-2: #B4C0D6; --text-3: #8C99B3; --ink-brand: #E6ECF7;

  --primary: #5B85D6; --primary-2: #9DBBF2; --primary-3: #2F5FB3;
  --primary-soft: rgba(99, 138, 209, .16); --primary-soft-2: rgba(99, 138, 209, .24); --primary-line: rgba(99, 138, 209, .42);
  --primary-ring: rgba(124, 159, 224, .38);
  --accent: #2BB3A3; --accent-2: #23978A; --accent-soft: rgba(43, 179, 163, .15);
  --gold-soft: rgba(231, 207, 127, .12);

  --success-bg: rgba(55, 162, 94, .14);  --success-bd: rgba(55, 162, 94, .38);  --success-fg: #7FD39C; --success-dot: #4CC17A;
  --warning-bg: rgba(214, 154, 45, .15); --warning-bd: rgba(214, 154, 45, .40); --warning-fg: #EBC56E; --warning-dot: #E7B44A;
  --danger-bg: rgba(226, 84, 78, .15);   --danger-bd: rgba(226, 84, 78, .40);   --danger-fg: #FF9C94; --danger-dot: #F06A63;
  --info-bg: rgba(99, 138, 209, .16);    --info-bd: rgba(99, 138, 209, .40);    --info-fg: #A9C3F2;    --info-dot: #7C9FE0;
  --neutral-bg: rgba(255, 255, 255, .06); --neutral-bd: rgba(255, 255, 255, .14); --neutral-fg: #C3CCDC; --neutral-dot: #7D889E;
  --err: #F06A63; --err-2: #FF8A82; --in: #4FD1C5; --out: #FF8A82;
  --t-blue: #7C9FE0; --t-teal: #3CC4B4; --t-violet: #A693F0; --t-amber: #E7B44A; --t-rose: #EE7FA2; --t-sky: #5CB6E8; --t-slate: #9AAAC2;

  --th-bg: #1A2B4A; --th-fg: #C9D7F0; --th-line: #2B3F66;
  --row-hover: #1A2742; --row-line: #1F2D48; --tfoot-bg: #16243F;
  --sh-1: 0 1px 2px rgba(0, 0, 0, .30);
  --sh-2: 0 2px 4px -2px rgba(0, 0, 0, .35), 0 4px 12px -2px rgba(0, 0, 0, .30);
  --sh-3: 0 14px 28px -10px rgba(0, 0, 0, .55), 0 4px 10px -4px rgba(0, 0, 0, .35);
  --sh-4: 0 36px 72px -28px rgba(0, 0, 0, .75), 0 10px 28px -10px rgba(0, 0, 0, .45);
  --sh-brand: 0 10px 22px -12px rgba(47, 95, 179, .8);
  --sh-inner: inset 0 1px 0 rgba(255, 255, 255, .06);
  --backdrop: rgba(2, 6, 14, .64);
}
html[data-theme="dark"] body { color: var(--text); }
html[data-theme="dark"] ::selection { background: rgba(99, 138, 209, .4); }

/* Khung */
html[data-theme="dark"] .brand-txt { border-left-color: rgba(255, 255, 255, .14); }
html[data-theme="dark"] :is(.nav-quick-input, .search-btn, .user-btn, .atab, .atab-closeall, .nav-l1, .side-foot) { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05), 0 8px 20px -14px rgba(0, 0, 0, .7); }
html[data-theme="dark"] :is(.nav-quick-input:hover, .nav-quick-input:focus, .search-btn:hover, .user-btn:hover, .atab:hover, .atab-closeall:hover, .menu-btn:hover) { border-color: rgba(255, 255, 255, .22); }
html[data-theme="dark"] .nav-quick-x { background: rgba(255, 255, 255, .1); }
html[data-theme="dark"] .nav-quick-x:hover { background: rgba(255, 255, 255, .18); }
html[data-theme="dark"] .nav-l1 .nav-ic { background: rgba(255, 255, 255, .08); color: #9DBBF2; }
html[data-theme="dark"] .nav-l1.active { background: linear-gradient(135deg, #3A6CC2 0%, #24447E 100%); box-shadow: 0 14px 28px -14px rgba(0, 0, 0, .8); }
html[data-theme="dark"] .nav-l1.active .nav-ic { background: rgba(255, 255, 255, .2); color: #fff; }
html[data-theme="dark"] .nav-group .nav-ic { background: color-mix(in srgb, var(--tone) 16%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tone) 32%, transparent); }
html[data-theme="dark"] .nav-group:hover { background: rgba(255, 255, 255, .06); }
html[data-theme="dark"] .nav-group.open { background: rgba(255, 255, 255, .07); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1); }
html[data-theme="dark"] .nav-group.open .nav-ic { background: linear-gradient(135deg, #3A6CC2, #24447E); color: #fff; box-shadow: none; }
html[data-theme="dark"] .nav-children::before { background: rgba(255, 255, 255, .1); }
html[data-theme="dark"] .nav-item .nav-i { color: #9DBBF2; }
html[data-theme="dark"] .nav-item:hover { background: rgba(255, 255, 255, .06); }
html[data-theme="dark"] .nav-item.active { background: rgba(255, 255, 255, .1); color: #E6ECF7; box-shadow: none; }
html[data-theme="dark"] .atab.active { background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .2); box-shadow: 0 10px 22px -14px rgba(0, 0, 0, .8); }
html[data-theme="dark"] .content { border-color: rgba(255, 255, 255, .08);
  background: radial-gradient(700px 300px at 100% 0%, rgba(231, 207, 127, .05), transparent 70%), linear-gradient(180deg, rgba(255, 255, 255, .04), rgba(255, 255, 255, .02));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05), 0 30px 60px -40px rgba(0, 0, 0, .8); }
html[data-theme="dark"] .side { color: var(--text-2); }

/* Thẻ, ô số liệu, nút, ô nhập */
html[data-theme="dark"] .card { border-color: rgba(255, 255, 255, .08); }
html[data-theme="dark"] .filter-bar { background: rgba(21, 33, 58, .6); }
html[data-theme="dark"] .stat { background: linear-gradient(135deg, rgba(27, 41, 69, .9), rgba(21, 33, 58, .7)); border-color: rgba(255, 255, 255, .08); }
html[data-theme="dark"] .btn { background: rgba(255, 255, 255, .06); border-color: var(--line-2); color: var(--text); }
html[data-theme="dark"] .btn:hover { background: rgba(255, 255, 255, .12); border-color: var(--primary-line); color: #fff; }
html[data-theme="dark"] .btn.primary { background: linear-gradient(135deg, #3A6CC2, #24447E); border-color: transparent; color: #fff; }
html[data-theme="dark"] .btn.ok { border-color: transparent; color: #fff; }
html[data-theme="dark"] .btn.danger { background: rgba(255, 255, 255, .04); border-color: var(--danger-bd); color: var(--danger-fg); }
html[data-theme="dark"] .btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
html[data-theme="dark"] .btn.ghost:hover { background: rgba(255, 255, 255, .08); }
html[data-theme="dark"] :is(.btn, .btn.primary, .btn.ok, .btn.danger-solid):disabled { background: var(--surface-3); border-color: var(--line-2); color: var(--text-3); }
html[data-theme="dark"] .icon-btn { background: rgba(255, 255, 255, .06); border-color: var(--line); color: var(--text-2); }
html[data-theme="dark"] .icon-btn:hover { background: rgba(255, 255, 255, .12); color: #fff; }
html[data-theme="dark"] .icon-btn.plain, html[data-theme="dark"] .menu-btn { background: transparent; border-color: transparent; }
html[data-theme="dark"] :is(.inp, select.inp, textarea.inp, .quick-add .inp, .color-inp) { background: #101A2E; border-color: var(--line-2); color: var(--text); }
html[data-theme="dark"] .inp:hover { border-color: var(--line-3); }
html[data-theme="dark"] .inp:focus { background: #0E1729; border-color: #7C9FE0; }
html[data-theme="dark"] .inp:disabled { background: var(--surface-3); color: var(--text-3); }
html[data-theme="dark"] select.inp option { background: var(--surface); color: var(--text); }

/* Bảng */
html[data-theme="dark"] .tbl tbody td { background: rgba(21, 33, 58, .55); }
html[data-theme="dark"] .tbl-wrap .tbl tbody td:first-child { background: #16233D; }
html[data-theme="dark"] .tbl tbody tr:hover td, html[data-theme="dark"] .tbl-wrap .tbl tbody tr:hover td:first-child { background: var(--row-hover); }

/* Tab trong trang, nhóm chọn, chip */
html[data-theme="dark"] .seg { background: rgba(255, 255, 255, .05); border-color: rgba(255, 255, 255, .08); }
html[data-theme="dark"] .seg button.on { background: rgba(255, 255, 255, .14); color: #fff; }
html[data-theme="dark"] .chip { background: rgba(255, 255, 255, .05); }
html[data-theme="dark"] .chip.on { color: #fff; }

/* Các khối nền trắng cũ */
html[data-theme="dark"] :is(.picker-list, .modal, .drawer, .toast, .cmdk, .menu-pop, .check, .tcard, .dsu-card, .pick, .person-chip, .mood button, .tick) { background: var(--surface); border-color: var(--line); }
html[data-theme="dark"] .tick.on { background: var(--accent); border-color: var(--accent); }
html[data-theme="dark"] :is(.pick.on, .person-chip.on, .mood button.on) { background: var(--primary-soft); border-color: var(--primary-line); color: #fff; }
html[data-theme="dark"] .modal-foot { background: var(--surface-2); }
html[data-theme="dark"] .cmdk-in input { background: transparent; color: var(--text); }
html[data-theme="dark"] .money-box { background: var(--line); border-color: rgba(255, 255, 255, .08); }
html[data-theme="dark"] .money-box > div { background: var(--surface); }
html[data-theme="dark"] .col { background: rgba(255, 255, 255, .04); border-color: rgba(255, 255, 255, .07); }
html[data-theme="dark"] .col.drop { background: var(--primary-soft); }
html[data-theme="dark"] :is(.tcard, .dsu-card, .check) { border-color: rgba(255, 255, 255, .08); }
html[data-theme="dark"] .dsu-card.missing { background: rgba(255, 255, 255, .03); }
html[data-theme="dark"] .group-h { background: rgba(255, 255, 255, .04); }
html[data-theme="dark"] .empty-state .empty-ic { background: rgba(255, 255, 255, .06); }
html[data-theme="dark"] .bar { background: rgba(255, 255, 255, .08); }
html[data-theme="dark"] .pay-m.tm { color: #EBC56E; }
html[data-theme="dark"] .modal-back { background: rgba(2, 6, 14, .6); }
html[data-theme="dark"] .modal-back.clear { background: transparent; }
}
@media screen and (max-width: 960px) {
  html[data-theme="dark"] .side { background: linear-gradient(165deg, #111C31 0%, #0E1A30 100%); }
}

/* Công tắc sáng tối trong menu tài khoản, theo HTOS */
.menu-pop .menu-theme .sw { margin-left: auto; flex: none; position: relative; width: 40px; height: 24px; border-radius: 999px;
  background: #D0D5DD; box-shadow: inset 0 1px 2px rgba(16, 24, 40, .12); transition: background-color .26s ease-out; }
.menu-pop .menu-theme .sw.on { background: linear-gradient(135deg, #3A6CC2, #24467F); }
.menu-pop .menu-theme .knob { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; display: grid; place-items: center;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(16, 24, 40, .25);
  transition: transform .3s cubic-bezier(.34, 1.4, .64, 1), width .15s; }
.menu-pop .menu-theme .knob .ic { color: #D69A2D; display: block; }
.menu-pop .menu-theme .sw.on .knob { transform: translateX(16px); }
.menu-pop .menu-theme .sw.on .knob .ic { color: #24467F; }
.menu-pop .menu-theme:active .knob { width: 21px; }
html[data-theme="dark"] .menu-pop .menu-theme .sw { background: rgba(255, 255, 255, .16); }
html[data-theme="dark"] .menu-pop .menu-theme .sw.on { background: linear-gradient(135deg, #4A7BD0, #2F5FB3); }
html[data-theme="dark"] .menu-pop .menu-theme .sw.on .knob .ic { color: #2F5FB3; }
/* Màu mới lan ra từ điểm bấm: tắt hiệu ứng mờ mặc định của View Transitions */
html.vt-theme::view-transition-old(root), html.vt-theme::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
html.vt-theme::view-transition-old(root) { z-index: 1; }
html.vt-theme::view-transition-new(root) { z-index: 2; }
@media (prefers-reduced-motion: reduce) { .menu-pop .menu-theme .sw, .menu-pop .menu-theme .knob { transition: none; } }

@media screen { html[data-theme="dark"] .stat::before { opacity: .5; } }
@media screen { html[data-theme="dark"] a:not([class]) { color: #8FB0EE; } html[data-theme="dark"] a:not([class]):hover { color: #B9CEF5; } }

/* Logo: nền trong suốt; giao diện tối thì logo một màu trắng */
html[data-theme="dark"] .brand img { filter: brightness(0) invert(1); }

/* =====================================================================
   Yêu cầu DN lần 3 (23/11/2026): bảng Hồ sơ theo mẫu, trạng thái xử lý tự ghi,
   thẻ hồ sơ trên Kanban, màn tờ khai NA5/NA8
   ===================================================================== */
.seg a { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 500; color: var(--text-2); padding: 6px 12px; border-radius: 999px; text-decoration: none; }
.seg a:hover { color: var(--primary-2); }
.seg a.on { background: #fff; color: var(--primary-2); font-weight: 600; box-shadow: 0 6px 14px -10px rgba(30, 58, 110, .5); }
.tbl .w-stt { width: 48px; }
.tbl .w-progress { min-width: 140px; }
.tbl .w-cust { min-width: 160px; }
.tbl .w-svc { min-width: 130px; }
.progress-cell { cursor: default; }
.progress-cell .inp { height: 32px; min-width: 170px; }
.progress-btn { display: block; width: 100%; text-align: left; border: 1px dashed transparent; background: var(--primary-soft); color: var(--primary-2); font: inherit; font-size: 11.5px;
  font-weight: 600; padding: 5px 9px; border-radius: 8px; cursor: text; line-height: 1.35; white-space: normal; }
.progress-btn:hover:not(:disabled) { border-color: var(--primary-line); }
.progress-btn.blank { background: none; border-color: var(--line-2); color: var(--text-3); font-weight: 400; }
.progress-btn:disabled { cursor: default; opacity: .6; }
.sys-status { display: inline-block; margin-top: 4px; }
.sys-status .badge { font-size: 10px; }
.progress-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.progress-line .lbl { font-size: 11.5px; font-weight: 600; color: var(--text-2); }
.progress-line .inp { width: min(420px, 100%); height: 34px; }
.case-card { border-left: 3px solid var(--primary); cursor: pointer; }
.case-card[draggable="true"] { cursor: grab; }
.case-tag { display: inline-flex; align-items: center; gap: 4px; font-family: var(--mono); font-size: 11px; font-weight: 600; color: var(--primary-2); }
.tcard-sub { font-size: 11px; color: var(--text-2); margin: -6px 0 8px; line-height: 1.4; }
.case-progress { font-size: 11px; font-weight: 600; color: var(--primary-2); background: var(--primary-soft); border-radius: 8px; padding: 4px 8px; margin-bottom: 8px; }
.tcard-meta .neg { color: var(--err); font-weight: 600; }
.na-form .card + .card { margin-top: 16px; }
.na-form .sub-head { font-weight: 600; color: var(--text-2); border-top: 1px dashed var(--line); padding-top: 10px; }
.na-form .inp.upper { text-transform: uppercase; }
.na-form .sticky-side { position: sticky; top: 12px; }
html[data-theme="dark"] .seg a.on { background: rgba(255, 255, 255, .14); color: #fff; }
html[data-theme="dark"] .progress-btn:not(.blank), html[data-theme="dark"] .case-progress { background: rgba(120, 160, 230, .16); color: #B9CEF5; }

/* ---- Lần 4: trạng thái hồ sơ có màu, in tờ khai ---- */
:root { --violet-bg: #F1ECFB; --violet-bd: #D6C8F2; --violet-fg: #5B3E9E; --violet-dot: #7C5CD6; }
.b-violet { background: var(--violet-bg); border-color: var(--violet-bd); color: var(--violet-fg); --dot: var(--violet-dot); }
.st-select { appearance: none; -webkit-appearance: none; height: 24px; padding: 0 22px 0 10px; border-radius: 999px; border: 1px solid transparent; font: inherit; font-size: 11px; font-weight: 600; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 11px) 10px, calc(100% - 7px) 10px; background-size: 4px 4px; background-repeat: no-repeat; }
.st-select.b-ok { background-color: var(--success-bg); } .st-select.b-warn { background-color: var(--warning-bg); } .st-select.b-info { background-color: var(--info-bg); }
.st-select.b-mute { background-color: var(--neutral-bg); } .st-select.b-violet { background-color: var(--violet-bg); }
.st-select:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.st-select option { background: var(--surface); color: var(--text); font-weight: 400; }
.toolbar .st-select { height: 34px; font-size: 12px; padding: 0 26px 0 14px; background-position: calc(100% - 15px) 15px, calc(100% - 11px) 15px; }
.st-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.st-chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 13px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text-2); font: inherit; font-size: 12px; font-weight: 500; cursor: pointer; }
.st-chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--dot); }
.st-chip.on { font-weight: 600; box-shadow: 0 0 0 2px var(--dot); }
.st-chip:not(.on) { background: var(--surface); color: var(--text-2); border-color: var(--line-2); }
.st-chip:disabled { cursor: default; opacity: .7; }
.w-print { width: 64px; }
.print-btn { display: inline-flex; align-items: center; gap: 4px; width: auto; padding: 0 8px; height: 28px; border-radius: 8px; color: var(--primary); }
.print-btn b { font-size: 11px; font-weight: 600; }
.print-btn.none { color: var(--text-3); opacity: .7; }
.print-btn:hover { opacity: 1; background: var(--info-bg); }
.print-list { display: flex; flex-direction: column; gap: 8px; }
.print-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; }
html[data-theme="dark"] { --violet-bg: rgba(150, 120, 230, .16); --violet-bd: rgba(150, 120, 230, .40); --violet-fg: #C9B8F5; --violet-dot: #A78BEA; }
