/* =====================================================================
   TAFA AI DEV — hệ thống thiết kế portal
   Font Be Vietnam Pro + Lora từ Google Fonts (CSP cho phép riêng 2 tên miền này); không thư viện JS ngoài.
   ===================================================================== */
/* Hệ thiết kế EDITORIAL (chốt 27/09/2026, đồng bộ với trang chủ sanungdungai.com):
   giấy ngà, chữ mực, tiêu đề Lora có chân, nội dung Be Vietnam Pro, kẻ mảnh, bo góc 2px, gần như không bóng. */
:root {
  --font: "Be Vietnam Pro", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --serif: "Lora", "Noto Serif", Georgia, serif;
  --mono: "JetBrains Mono", "Cascadia Mono", Consolas, ui-monospace, monospace;

  --bg: #FBF9F4;
  --surface: #FFFFFF;
  --surface-2: #F4F0E6;
  --surface-hover: #F7F4EC;
  --border: #E2DCCD;
  --border-strong: #CFC6B2;
  --text: #1C1A17;
  --text-2: #4A453D;
  --text-3: #7A7366;

  --primary: #0F3D6E;
  --primary-hover: #0B2F56;
  --primary-soft: #E8EEF5;
  --primary-text: #0F3D6E;
  --accent: #F2A900;
  --accent-text: #8A5A00;
  --teal: #8A5A00;

  --ok: #2F6B3A;       --ok-soft: #E7F0E4;      --ok-dot: #3E8E4C;
  --warn: #8A5A00;     --warn-soft: #FBF0D6;    --warn-dot: #D99800;
  --danger: #9B2C1D;   --danger-soft: #F8E6E1;  --danger-dot: #C0392B;
  --info: #0F3D6E;     --info-soft: #E8EEF5;    --info-dot: #0F3D6E;

  --ink: #F4F0E6;          /* sidebar: giấy đậm hơn nền một bậc */
  --ink-2: #EBE5D6;
  --ink-text: #4A453D;
  --ink-muted: #8A8272;

  --radius-sm: 2px; --radius: 2px; --radius-lg: 2px;
  --shadow-sm: none;
  --shadow: none;
  --shadow-lg: 0 16px 32px -16px rgba(60, 45, 20, .28);
  --focus: 0 0 0 3px rgba(15, 61, 110, .22);
  --sidebar-w: 248px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161412; --surface: #1D1A17; --surface-2: #24201C; --surface-hover: #221E1A;
    --border: #35302A; --border-strong: #4A433A;
    --text: #EFEAE0; --text-2: #BDB5A6; --text-3: #8F8778;
    --primary: #9DB9DA; --primary-hover: #BCD0E7; --primary-soft: rgba(157, 185, 218, .12); --primary-text: #AFC7E3;
    --accent-text: #F2C14E;
    --ok: #8CC79A; --ok-soft: rgba(140, 199, 154, .12);
    --warn: #F2C14E; --warn-soft: rgba(242, 193, 78, .12);
    --danger: #F09A8A; --danger-soft: rgba(240, 154, 138, .12);
    --info: #AFC7E3; --info-soft: rgba(175, 199, 227, .12);
    --ink: #1A1714; --ink-2: #24201C; --ink-text: #CFC7B8; --ink-muted: #8F8778;
    --shadow-lg: 0 16px 32px -12px rgba(0, 0, 0, .6);
    --focus: 0 0 0 3px rgba(157, 185, 218, .3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #161412; --surface: #1D1A17; --surface-2: #24201C; --surface-hover: #221E1A;
  --border: #35302A; --border-strong: #4A433A;
  --text: #EFEAE0; --text-2: #BDB5A6; --text-3: #8F8778;
  --primary: #9DB9DA; --primary-hover: #BCD0E7; --primary-soft: rgba(157, 185, 218, .12); --primary-text: #AFC7E3;
  --accent-text: #F2C14E;
  --ok: #8CC79A; --ok-soft: rgba(140, 199, 154, .12);
  --warn: #F2C14E; --warn-soft: rgba(242, 193, 78, .12);
  --danger: #F09A8A; --danger-soft: rgba(240, 154, 138, .12);
  --info: #AFC7E3; --info-soft: rgba(175, 199, 227, .12);
  --ink: #1A1714; --ink-2: #24201C; --ink-text: #CFC7B8; --ink-muted: #8F8778;
  --shadow-lg: 0 16px 32px -12px rgba(0, 0, 0, .6);
  --focus: 0 0 0 3px rgba(157, 185, 218, .3);
  color-scheme: dark;
}

/* ---------------------------------------------------------------- nền */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font: 14px/1.55 var(--font); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
p { margin: 0; }
a { color: var(--primary-text); text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }
.muted { color: var(--text-2); }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 12.5px; }
svg { width: 18px; height: 18px; flex: none; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--radius-sm); }

/* ---------------------------------------------------------------- khởi động */
.boot { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); z-index: 100; transition: opacity .25s; }
body:not(.is-loading) .boot { opacity: 0; pointer-events: none; }
.boot-mark { width: 44px; height: 44px; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.9); opacity: .6; } }

/* ---------------------------------------------------------------- thương hiệu */
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 32px; height: 32px; }
.brand span { display: flex; flex-direction: column; line-height: 1.15; }
.brand strong { font-size: 15px; letter-spacing: .01em; }
.brand small { font-size: 11.5px; color: var(--text-3); }
.brand-light strong { color: #fff; }
.brand-light small { color: var(--ink-muted); }

/* ---------------------------------------------------------------- nút */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: 8px; border: 1px solid transparent;
  font: 600 14px/1 var(--font); cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(47, 91, 234, .3); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--surface-hover); }
.btn-danger { background: var(--danger-dot); color: #fff; }
.btn-danger:hover { filter: brightness(.94); }
.btn-danger-ghost { background: var(--surface); color: var(--danger); border-color: var(--border-strong); }
.btn-danger-ghost:hover { background: var(--danger-soft); border-color: transparent; }
.btn-lg { height: 44px; font-size: 15px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .6; cursor: not-allowed; }
.spinner { display: none; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
.btn[aria-busy="true"] .spinner { display: inline-block; }
.btn[aria-busy="true"] { pointer-events: none; opacity: .85; }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { color: var(--text); background: var(--surface-hover); }
.link { white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; font-weight: 600; font-size: 13px; }
.link svg { width: 15px; height: 15px; }

/* ---------------------------------------------------------------- form */
.form { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; }
.field label { font-weight: 600; font-size: 13px; color: var(--text); }
.hint { font-size: 12.5px; color: var(--text-3); }
input[type="email"], input[type="password"], input[type="text"], input[type="search"], .otp, .input-affix input {
  width: 100%; height: 42px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font: 14px var(--font);
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder { color: var(--text-3); }
input:hover { border-color: var(--text-3); }
input:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus); }
input[aria-invalid="true"] { border-color: var(--danger-dot); }
.otp { font: 600 20px/1 var(--mono); letter-spacing: .5em; text-align: center; padding-left: calc(12px + .5em); }
.otp:placeholder-shown { font: 400 14px/1 var(--font); letter-spacing: normal; padding-left: 12px; }
.otp-sm { height: 38px; font-size: 16px; letter-spacing: .35em; max-width: 170px; }
.input-affix { position: relative; }
.input-affix input { padding-right: 44px; }
.affix-btn {
  position: absolute; right: 4px; top: 4px; width: 34px; height: 34px; border: 0; border-radius: 6px;
  background: transparent; color: var(--text-3); cursor: pointer; display: grid; place-items: center;
}
.affix-btn:hover, .affix-btn[aria-pressed="true"] { color: var(--primary); background: var(--primary-soft); }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }

.alert { display: flex; gap: 10px; padding: 12px 14px; border-radius: 8px; font-size: 13.5px; margin-bottom: 16px; }
.alert-danger { background: var(--danger-soft); color: var(--danger); }
.alert-warn { background: var(--warn-soft); color: var(--warn); }

/* ---------------------------------------------------------------- trạng thái */
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex: none; }
[data-tone="ok"] .status-dot, .status-dot[data-tone="ok"] { background: var(--ok-dot); box-shadow: 0 0 0 3px var(--ok-soft); }
[data-tone="warn"] .status-dot, .status-dot[data-tone="warn"] { background: var(--warn-dot); box-shadow: 0 0 0 3px var(--warn-soft); }
[data-tone="danger"] .status-dot, .status-dot[data-tone="danger"] { background: var(--danger-dot); box-shadow: 0 0 0 3px var(--danger-soft); }

.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--text-2); white-space: nowrap;
}
.badge[data-tone="ok"] { background: var(--ok-soft); color: var(--ok); }
.badge[data-tone="warn"] { background: var(--warn-soft); color: var(--warn); }
.badge[data-tone="danger"] { background: var(--danger-soft); color: var(--danger); }
.badge[data-tone="info"] { background: var(--info-soft); color: var(--info); }

/* ================================================================ ĐĂNG NHẬP */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(380px, 46%) 1fr; }
.auth-hero {
  position: relative; overflow: hidden; color: var(--ink-text);
  background:
    radial-gradient(900px 500px at 110% -10%, rgba(31, 181, 168, .28), transparent 60%),
    radial-gradient(700px 500px at -20% 110%, rgba(76, 125, 255, .35), transparent 60%),
    var(--ink);
}
.auth-hero::before {
  content: ""; position: absolute; inset: 0; opacity: .5;
  background-image: linear-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .045) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse at 30% 40%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at 30% 40%, #000 20%, transparent 75%);
}
.auth-hero-inner { position: relative; height: 100%; display: flex; flex-direction: column; justify-content: space-between; padding: 40px 48px; gap: 40px; }
.auth-pitch { max-width: 460px; }
.auth-pitch h2 { color: #fff; font-size: 34px; line-height: 1.18; letter-spacing: -.02em; margin-bottom: 16px; }
.auth-pitch > p { font-size: 15.5px; color: var(--ink-text); margin-bottom: 28px; }
.auth-points { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.auth-points li { display: flex; gap: 12px; align-items: center; font-size: 14px; }
.auth-points svg { width: 34px; height: 34px; padding: 8px; border-radius: 9px; background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .1); color: #9fc0ff; }
.auth-foot { font-size: 12.5px; color: var(--ink-muted); }

.auth-main { display: grid; place-items: center; padding: 40px 24px; background: var(--bg); }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font-size: 26px; margin-bottom: 6px; }
.auth-card .lead { color: var(--text-2); margin-bottom: 28px; }
.auth-brand-mobile { display: none; margin-bottom: 28px; }
.auth-status { display: flex; align-items: center; gap: 10px; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-2); }
.auth-status strong { color: var(--text); font-weight: 600; }

/* ================================================================ KHUNG ỨNG DỤNG */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; background: linear-gradient(90deg, var(--ink) var(--sidebar-w), var(--bg) var(--sidebar-w)); }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: var(--ink); color: var(--ink-text); border-right: 1px solid rgba(255, 255, 255, .04);
}
.sidebar-head { padding: 20px 20px 16px; }
.nav { flex: 1; overflow-y: auto; padding: 4px 12px 16px; display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-muted); padding: 16px 10px 6px; }
.nav a, .nav-soon {
  display: flex; align-items: center; gap: 11px; height: 38px; padding: 0 10px; border-radius: 8px;
  color: var(--ink-text); font-weight: 500; font-size: 14px; text-decoration: none;
}
.nav a svg, .nav-soon svg { width: 18px; height: 18px; opacity: .85; }
.nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }
.nav a[aria-current="page"] { background: rgba(111, 143, 255, .18); color: #fff; box-shadow: inset 2px 0 0 #7d9bff; }
.nav a[aria-current="page"] svg { color: #9db2ff; opacity: 1; }
.nav-soon { color: var(--ink-muted); cursor: default; }
.nav-soon em { margin-left: auto; font-style: normal; font-size: 10.5px; font-weight: 700; padding: 2px 6px; border-radius: 5px; background: rgba(255, 255, 255, .06); color: var(--ink-muted); }
.sidebar-foot { padding: 14px 16px 18px; border-top: 1px solid rgba(255, 255, 255, .06); }
.env-chip { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--ink-muted); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px;
  min-height: 68px; padding: 10px 32px; background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-title { flex: 1; min-width: 0; }
.crumb { font-size: 12px; color: var(--text-3); font-weight: 500; }
.topbar h1 { font-size: 19px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.only-mobile { display: none; }

.mode-pill {
  display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); white-space: nowrap;
}
.mode-pill[data-tone="ok"] { color: var(--ok); }
.mode-pill[data-tone="warn"] { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.mode-pill[data-tone="danger"] { color: #fff; background: var(--danger-dot); border-color: transparent; }
.mode-pill[data-tone="danger"] .status-dot { background: #fff; box-shadow: none; }

.user-menu { position: relative; }
.user-btn {
  display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 10px 0 4px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; font: inherit;
}
.user-btn:hover { background: var(--surface-hover); }
.user-meta { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; max-width: 160px; }
.user-meta strong { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.user-meta small { font-size: 11.5px; color: var(--text-3); }
.avatar {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, #4c7dff, #1fb5a8); color: #fff; font-weight: 700; font-size: 12.5px; letter-spacing: .02em;
}
.avatar-lg { width: 52px; height: 52px; font-size: 18px; }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 240px; padding: 6px; z-index: 40;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.menu-head { display: flex; flex-direction: column; padding: 10px 10px 12px; margin-bottom: 4px; border-bottom: 1px solid var(--border); }
.menu-head small { color: var(--text-3); overflow-wrap: anywhere; }
.menu a, .menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; height: 36px; padding: 0 10px; border-radius: 6px;
  border: 0; background: none; color: var(--text); font: 500 13.5px var(--font); text-decoration: none; cursor: pointer;
}
.menu a:hover, .menu button:hover { background: var(--surface-2); text-decoration: none; }
.menu svg { width: 16px; height: 16px; color: var(--text-3); }

.banner { margin: 16px 32px 0; padding: 12px 16px; border-radius: var(--radius); font-size: 13.5px; font-weight: 500; }
.banner[data-tone="warn"] { background: var(--warn-soft); color: var(--warn); }
.banner[data-tone="danger"] { background: var(--danger-soft); color: var(--danger); }

.content { padding: 28px 32px 48px; max-width: 1320px; width: 100%; }
.view { display: grid; gap: 20px; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } }

/* ---------------------------------------------------------------- khối */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 22px 24px; box-shadow: var(--shadow-sm); min-width: 0; }
.card-flush { padding: 0; overflow: hidden; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.card-head h3 { font-size: 15px; font-weight: 700; }
.card-head .muted { font-size: 13px; margin-top: 2px; }
.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; }
.eyebrow { font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }

.welcome { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.welcome h2 { font-size: 22px; margin-bottom: 4px; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 20px; box-shadow: var(--shadow-sm); min-width: 0; }
.stat-head { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 14px; }
.stat-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--primary-soft); color: var(--primary-text); }
.stat-icon svg { width: 16px; height: 16px; }
.stat-value { font-size: 24px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-sub { margin-top: 4px; font-size: 12.5px; color: var(--text-3); }
.stat-mode[data-tone="ok"] .stat-icon { background: var(--ok-soft); color: var(--ok); }
.stat-mode[data-tone="ok"] .stat-value { color: var(--ok); }
.stat-mode[data-tone="warn"] .stat-icon { background: var(--warn-soft); color: var(--warn); }
.stat-mode[data-tone="warn"] .stat-value { color: var(--warn); }
.stat-mode[data-tone="danger"] { border-color: var(--danger-dot); }
.stat-mode[data-tone="danger"] .stat-icon { background: var(--danger-soft); color: var(--danger); }
.stat-mode[data-tone="danger"] .stat-value { color: var(--danger); }
.stat [data-tone="ok"] { color: var(--ok); }
.stat [data-tone="danger"] { color: var(--danger); }

.kv { display: grid; gap: 0; margin: 18px 0 0; }
.kv > div { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-top: 1px solid var(--border); font-size: 13.5px; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; font-weight: 600; text-align: right; overflow-wrap: anywhere; min-width: 0; }
.kv-inline { display: flex; gap: 32px; margin: 0; }
.kv-inline > div { flex-direction: column; gap: 2px; border: 0; padding: 0; }
.kv-inline dd { text-align: left; font-size: 15px; }

/* hoạt động */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 32px 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--border); }
.timeline li:first-child { border-top: 0; padding-top: 0; }
.tl-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--surface-2); color: var(--text-2); }
.tl-icon svg { width: 15px; height: 15px; }
.tl-icon[data-tone="ok"] { background: var(--ok-soft); color: var(--ok); }
.tl-icon[data-tone="danger"] { background: var(--danger-soft); color: var(--danger); }
.tl-main { min-width: 0; }
.tl-main strong { display: block; font-size: 13.5px; font-weight: 600; }
.tl-main span { display: block; font-size: 12.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-time { font-size: 12px; color: var(--text-3); white-space: nowrap; }
.empty { padding: 28px 16px; text-align: center; color: var(--text-3); font-size: 13.5px; }

/* step-up */
.stepup { padding: 14px 16px; border-radius: var(--radius); background: var(--surface-2); }
.stepup-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 13.5px; font-weight: 600; margin-bottom: 10px; }
.meter { height: 6px; border-radius: 999px; background: var(--border); overflow: hidden; }
.meter span { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, #4c7dff, #1fb5a8); transition: width .6s ease; }

/* lộ trình */
.roadmap { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); position: relative; }
.roadmap li { position: relative; display: flex; flex-direction: column; gap: 2px; padding-top: 22px; padding-right: 12px; }
.roadmap li::before { content: ""; position: absolute; top: 6px; left: 0; right: 0; height: 2px; background: var(--border); }
.roadmap li:first-child::before { left: 6px; }
.rm-dot { position: absolute; top: 0; left: 0; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 2px solid var(--border-strong); z-index: 1; }
.roadmap li strong { font-size: 13.5px; }
.roadmap li span:not(.rm-dot) { font-size: 12.5px; color: var(--text-3); }
.roadmap li.is-current .rm-dot { border-color: var(--primary); background: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.roadmap li.is-current strong { color: var(--primary-text); }

/* an ninh */
.sec-hero { display: grid; grid-template-columns: auto 1fr auto; gap: 20px; align-items: center; }
.sec-hero-icon { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 14px; background: var(--surface-2); color: var(--text-2); }
.sec-hero-icon svg { width: 28px; height: 28px; }
.sec-hero h2 { font-size: 24px; margin: 2px 0 4px; }
.sec-hero[data-tone="ok"] .sec-hero-icon { background: var(--ok-soft); color: var(--ok); }
.sec-hero[data-tone="ok"] h2 { color: var(--ok); }
.sec-hero[data-tone="warn"] .sec-hero-icon { background: var(--warn-soft); color: var(--warn); }
.sec-hero[data-tone="warn"] h2 { color: var(--warn); }
.sec-hero[data-tone="danger"] { border-color: var(--danger-dot); }
.sec-hero[data-tone="danger"] .sec-hero-icon { background: var(--danger-soft); color: var(--danger); }
.sec-hero[data-tone="danger"] h2 { color: var(--danger); }

.ladder { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.ladder li { padding: 14px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); min-width: 0; }
.ladder li .lvl { display: flex; align-items: center; gap: 8px; font-size: 11.5px; font-weight: 700; color: var(--text-3); letter-spacing: .04em; margin-bottom: 6px; }
.ladder li strong { display: block; font-size: 13.5px; margin-bottom: 4px; }
.ladder li p { font-size: 12.5px; color: var(--text-2); }
.ladder li.is-current { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.ladder li.is-current .lvl { color: var(--primary-text); }
.lvl-now { margin-left: auto; font-size: 10.5px; padding: 1px 6px; border-radius: 5px; background: var(--primary-soft); color: var(--primary-text); letter-spacing: 0; }

.checks { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 28px; }
.checks li { display: flex; gap: 12px; }
.checks strong { font-size: 13.5px; }
.checks .muted { font-size: 12.5px; }
.check-ok { flex: none; width: 20px; height: 20px; margin-top: 1px; border-radius: 50%; background: var(--ok-soft); position: relative; }
.check-ok::after { content: ""; position: absolute; left: 7px; top: 4px; width: 5px; height: 9px; border: solid var(--ok); border-width: 0 2px 2px 0; transform: rotate(45deg); }

/* bảng */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.search { position: relative; flex: 1 1 280px; max-width: 420px; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-3); }
.search input { height: 36px; padding-left: 34px; }
.segmented { display: inline-flex; padding: 3px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--border); }
.segmented button { height: 28px; padding: 0 12px; border: 0; border-radius: 6px; background: none; color: var(--text-2); font: 600 12.5px var(--font); cursor: pointer; }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.toolbar-count { margin-left: auto; font-size: 12.5px; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { position: sticky; top: 0; text-align: left; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); background: var(--surface-2); padding: 10px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
.table tbody tr:hover { background: var(--surface-hover); }
.table tbody tr:last-child td { border-bottom: 0; }
.cell-main { font-weight: 600; }
.cell-sub { display: block; font-size: 12px; color: var(--text-3); }

/* phiên */
.profile { display: flex; align-items: center; gap: 14px; }
.profile strong { font-size: 16px; }
.action-row { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 16px 0; border-top: 1px solid var(--border); }
.action-row:first-of-type { border-top: 0; padding-top: 0; }
.action-row strong { font-size: 14px; }
.action-row .muted { font-size: 13px; margin-top: 2px; }

/* hộp thoại + toast */
.dialog { border: 0; padding: 0; border-radius: var(--radius-lg); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); width: min(440px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgba(8, 12, 28, .55); backdrop-filter: blur(2px); }
.dialog form { padding: 24px; }
.dialog h3 { font-size: 17px; margin-bottom: 8px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 60; display: grid; gap: 10px; width: min(380px, calc(100vw - 32px)); }
.toast {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); font-size: 13.5px;
  animation: toast-in .2s ease;
}
.toast .status-dot { margin-top: 6px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
.scrim { display: none; }

/* ================================================================ RESPONSIVE */
@media (max-width: 1180px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ladder { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .shell { background: var(--bg); }
  .auth { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .auth-brand-mobile { display: flex; }
  .grid-2 { grid-template-columns: 1fr; }
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: var(--sidebar-w); z-index: 50; transform: translateX(-100%); transition: transform .22s ease; }
  body.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 45; background: rgba(8, 12, 28, .5); }
  .only-mobile { display: inline-grid; }
  .topbar { padding: 10px 16px; }
  .content { padding: 20px 16px 40px; }
  .banner { margin: 12px 16px 0; }
  .sec-hero { grid-template-columns: auto 1fr; }
  .sec-hero .kv-inline { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .user-meta, #mode-pill-text { display: none; }
  .mode-pill { padding: 0 11px; }
  .user-btn { padding: 0 4px; }
  .stats { gap: 12px; }
  .stat { padding: 14px 16px; }
  .stat-value { font-size: 18px; white-space: normal; }
  .stat-head { font-size: 12.5px; margin-bottom: 10px; }
  .crumb { display: none; }
  .topbar h1 { font-size: 17px; }
  .stat-sub { display: none; }
  .card { padding: 18px 16px; }
  .card-flush { padding: 0; }
  .roadmap { grid-template-columns: 1fr; gap: 14px; }
  .roadmap li { padding: 0 0 0 26px; }
  .roadmap li::before { top: 14px; bottom: -14px; left: 6px; right: auto; width: 2px; height: auto; }
  .roadmap li:last-child::before { display: none; }
  .ladder { grid-template-columns: 1fr 1fr; }
  .checks { grid-template-columns: 1fr; }
  .kv-inline { flex-wrap: wrap; gap: 16px 24px; }
  .action-row { flex-direction: column; align-items: stretch; }
  .toolbar { padding: 12px; }
  .toolbar-count { margin-left: 0; }
  .timeline li { grid-template-columns: 32px 1fr; }
  .tl-time { grid-column: 2; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; }
  .table tr { padding: 12px 14px; border-bottom: 1px solid var(--border); }
  .table td { padding: 2px 0; border: 0; white-space: normal; }
  .table td[data-label]::before { content: attr(data-label) ": "; color: var(--text-3); font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}


/* ================================================================ EDITORIAL — lớp phong cách
   Chỉ đổi màu, chữ, viền; bố cục và hành vi ở trên giữ nguyên. */
h1, h2, h3, .brand strong, .stat-value, .price strong { font-family: var(--serif); }
h1, h2, h3 { font-weight: 600; letter-spacing: -.005em; }
.topbar h1 { font-size: 22px; font-weight: 600; }
.welcome h2 { font-size: 28px; }
.card-head h3 { font-size: 18px; font-weight: 600; }
.stat-value { font-size: 26px; font-weight: 600; letter-spacing: -.01em; }
.eyebrow, .nav-label { font-family: var(--serif); font-style: italic; text-transform: none; letter-spacing: 0; font-size: 14px; font-weight: 500; }
.crumb { font-family: var(--serif); font-style: italic; }

/* thương hiệu */
.brand strong { font-size: 17px; font-weight: 600; letter-spacing: 0; }
.brand-light strong { color: var(--text); }
.brand-light small { color: var(--text-3); }

/* nút */
.btn { border-radius: 2px; }
.btn-primary { background: var(--text); color: var(--bg); box-shadow: none; }
.btn-primary:hover { background: var(--primary); color: #fff; }
.btn-ghost { border-color: var(--text); background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.icon-btn, .user-btn, .mode-pill { border-radius: 2px; background: transparent; }
.user-btn { border-color: var(--border-strong); }
.avatar { background: var(--primary); color: #fff; border-radius: 2px; font-family: var(--serif); }
[data-theme="dark"] .avatar { color: #161412; }

/* đăng nhập: bên trái khối mực ấm, bên phải giấy */
.auth-hero { background: #1C1A17; color: #D8D2C4; }
.auth-hero::before { display: none; }
.auth-hero .brand-light strong { color: #FBF9F4; }
.auth-hero .brand-light small { color: #A69F90; }
.auth-pitch h2 { font-family: var(--serif); font-weight: 600; font-size: 40px; line-height: 1.12; color: #FBF9F4; }
.auth-pitch > p { color: #D8D2C4; font-size: 16px; }
.auth-points li { border-top: 1px solid rgba(255, 255, 255, .12); padding-top: 14px; }
.auth-points svg { background: transparent; border: 0; padding: 0; width: 22px; height: 22px; color: #F2C14E; }
.auth-foot { color: #A69F90; }
.auth-card h1 { font-size: 34px; }
.auth-status { border-color: var(--border-strong); }

/* khung ứng dụng */
.sidebar { border-right: 1px solid var(--border); }
.nav a, .nav-soon { border-radius: 0; font-size: 14.5px; }
.nav a:hover { background: var(--ink-2); color: var(--text); }
.nav a[aria-current="page"] { background: transparent; color: var(--primary-text); font-weight: 600; box-shadow: inset 2px 0 0 var(--accent); }
.nav a[aria-current="page"] svg { color: var(--accent-text); }
.nav-soon em { background: var(--ink-2); color: var(--ink-muted); border-radius: 2px; }
.sidebar-foot { border-color: var(--border); }
.topbar { background: color-mix(in srgb, var(--bg) 90%, transparent); border-bottom: 1px solid var(--text); }
.mode-pill[data-tone="danger"] { background: var(--danger-dot); color: #fff; }

/* khối: kẻ mảnh thay cho hộp nổi */
.card, .stat { border-radius: 2px; box-shadow: none; }
.stat { border: 0; border-top: 2px solid var(--text); background: transparent; padding: 16px 0 0; }
.stats { gap: 24px; }
.stat-icon { background: transparent; color: var(--accent-text); width: auto; height: auto; }
.stat-mode[data-tone] .stat-icon { background: transparent; }
.stat-mode[data-tone="danger"] { border-top-color: var(--danger-dot); }
.card { border-color: var(--border); }
.card-head { border-bottom: 1px solid var(--border); padding-bottom: 14px; }
.meter span { background: var(--primary); }
.stepup { border-radius: 2px; }
.badge { border-radius: 2px; }
.tl-icon { border-radius: 2px; }
.table th { background: transparent; border-bottom: 1px solid var(--text); font-family: var(--font); letter-spacing: .08em; }
.table tbody tr:hover { background: var(--surface-hover); }
.segmented, .segmented button { border-radius: 2px; }
.toolbar { border-bottom: 1px solid var(--border); }
.ladder li { border-radius: 2px; }
.ladder li.is-current { box-shadow: none; border: 1px solid var(--text); outline: 3px double var(--text); outline-offset: 2px; }
.sec-hero-icon { border-radius: 2px; }
.rm-dot { border-radius: 0; }
.roadmap li.is-current .rm-dot { background: var(--accent); border-color: var(--accent); box-shadow: none; }
.roadmap li.is-current strong { color: var(--text); }
.menu, .dialog, .toast { border-radius: 2px; }
input[type="email"], input[type="password"], input[type="text"], input[type="search"], .otp, .input-affix input, select, textarea { border-radius: 2px; }
@media (max-width: 640px) {
  .stat { padding: 12px 0 0; }
  .welcome h2 { font-size: 24px; }
  .auth-card h1 { font-size: 28px; }
}

/* yêu cầu tư vấn */
.nav-count { margin-left: auto; font-style: normal; font-size: 11.5px; font-weight: 700; min-width: 20px; height: 20px; padding: 0 6px; display: inline-grid; place-items: center; background: var(--accent); color: #1C1A17; border-radius: 2px; }
.table-leads td { white-space: normal; vertical-align: top; }
.table-leads td:first-child { white-space: nowrap; }
.lead-msg { max-width: 320px; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.table-leads a { color: var(--primary-text); }
.status-select { height: 32px; padding: 0 28px 0 10px; border: 1px solid var(--border-strong); border-radius: 2px; background: var(--surface); color: var(--text); font: 500 13px var(--font); cursor: pointer; }
.status-select[data-status="new"] { border-color: var(--accent); background: var(--warn-soft); }
.status-select[data-status="closed"] { color: var(--ok); }
.status-select[data-status="spam"] { color: var(--text-3); }
.leads-note { padding: 12px 20px; font-size: 12.5px; border-top: 1px solid var(--border); }
.segmented { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.segmented button { white-space: nowrap; flex: none; }

/* ================================================================ S1 — dự án, yêu cầu, đặc tả (Editorial) */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.link { font-weight: 600; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; padding-bottom: 20px; border-bottom: 1px solid var(--text); }
.page-head h2 { font-size: 34px; margin: 2px 0 6px; }
.page-head .muted { max-width: 620px; }
.back { display: inline-block; font-size: 13.5px; font-weight: 600; color: var(--text-2); margin-bottom: -4px; }
.back:hover { color: var(--primary-text); text-decoration: none; }

/* danh sách dạng mục báo: kẻ ngang, không hộp */
.entries { list-style: none; margin: 0; padding: 0; }
.entry { display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center; padding: 20px 4px; border-bottom: 1px solid var(--border); color: var(--text); text-decoration: none; transition: background-color .15s; }
.entry:hover { background: var(--surface-hover); text-decoration: none; }
.entry:hover h3, .entry:hover .entry-title { color: var(--primary-text); }
.entry-kicker { font-size: 12.5px; color: var(--text-3); margin-bottom: 4px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.entry h3 { font-size: 21px; margin-bottom: 4px; }
.entry-title { font-size: 15px; font-weight: 500; }
.entry-side { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.entry-count { font-family: var(--serif); font-size: 26px; font-weight: 600; line-height: 1; }
.entries-flush .entry { padding: 16px 0; }
.entries-flush li:last-child .entry { border-bottom: 0; }

.doc-head { padding-bottom: 20px; border-bottom: 1px solid var(--text); }
.doc-head h2 { font-size: 32px; margin: 4px 0 8px; }
.meta-row { display: flex; flex-wrap: wrap; gap: 12px 40px; margin: 20px 0 0; }
.meta-row div { display: grid; gap: 2px; }
.meta-row dt { font-size: 12.5px; color: var(--text-3); }
.meta-row dd { margin: 0; font-weight: 600; }
.run-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.run-head h2 { font-size: 28px; max-width: 860px; }
.badge-lg { height: 28px; padding: 0 12px; font-size: 13px; }

/* bước tiến trình */
.stepper { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.stepper li { display: flex; gap: 10px; align-items: flex-start; padding: 14px 12px 14px 0; color: var(--text-3); position: relative; }
.stepper li + li { padding-left: 14px; border-left: 1px solid var(--border); }
.step-n { flex: none; display: grid; place-items: center; width: 24px; height: 24px; border: 1px solid var(--border-strong); font: 600 12px var(--font); border-radius: 2px; }
.stepper strong { display: block; font-size: 14px; color: var(--text-2); }
.stepper small { display: block; font-size: 12px; }
.stepper li.is-done .step-n { background: var(--text); border-color: var(--text); color: var(--bg); }
.stepper li.is-done strong { color: var(--text); }
.stepper li.is-current { box-shadow: inset 0 -3px 0 var(--accent); }
.stepper li.is-current .step-n { background: var(--accent); border-color: var(--accent); color: #1C1A17; }
.stepper li.is-current strong { color: var(--text); }
.stepper li.is-muted { opacity: .5; }

.run-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.run-main, .run-side { display: grid; gap: 20px; min-width: 0; }
.run-side { position: sticky; top: 88px; }
#panel-action h3 { font-size: 20px; margin-bottom: 6px; }
.action-text { max-width: 720px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.cancel-row { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }
.linkish { background: none; border: 0; padding: 0; font: 500 13.5px var(--font); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.danger-text { color: var(--danger); }
.clar-form { display: grid; gap: 10px; margin-top: 16px; }
.clar-form .field { display: grid; gap: 4px; font-weight: 600; font-size: 14.5px; margin-top: 8px; }
.q-num { font-family: var(--serif); font-style: italic; font-weight: 500; color: var(--accent-text); font-size: 13px; }
textarea, select { font: 14.5px/1.55 var(--font); color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 2px; padding: 10px 12px; width: 100%; }
textarea:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus); }
.request-text { white-space: pre-wrap; font-size: 15px; }

/* tài liệu đặc tả */
.select-inline select { width: auto; height: 36px; padding: 0 32px 0 10px; font-size: 13.5px; }
.note-old { margin: -4px 0 16px; padding: 10px 14px; background: var(--warn-soft); color: var(--warn); font-size: 13.5px; }
.doc { font-size: 15.5px; line-height: 1.7; max-width: 820px; }
.doc h2 { font-size: 26px; margin: 0 0 12px; }
.doc h3 { font-size: 19px; margin: 28px 0 10px; padding-top: 16px; border-top: 1px solid var(--border); }
.doc h4 { font-size: 16px; margin: 20px 0 8px; }
.doc p { margin: 0 0 12px; }
.doc ul, .doc ol { margin: 0 0 12px; padding-left: 22px; }
.doc li { margin: 4px 0; }
.doc blockquote { margin: 0 0 16px; padding: 10px 16px; border-left: 3px solid var(--accent); background: var(--surface-2); color: var(--text-2); font-size: 14.5px; }
.doc code, .mono code { font-family: var(--mono); font-size: 13px; background: var(--surface-2); padding: 1px 5px; }
.doc-table { overflow-x: auto; margin: 0 0 16px; }
.doc table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.doc th { text-align: left; border-bottom: 1px solid var(--text); padding: 8px 10px 8px 0; font-weight: 600; }
.doc td { border-bottom: 1px solid var(--border); padding: 8px 10px 8px 0; vertical-align: top; }
.spec-editor { display: grid; gap: 8px; }
.spec-editor textarea { font-family: var(--mono); font-size: 13px; line-height: 1.6; min-height: 420px; }
.field-label { font-weight: 600; font-size: 13.5px; margin-top: 8px; }

.card-head-pad { padding: 20px 24px 14px; margin: 0; }
.table-tasks td { white-space: normal; vertical-align: top; }
.table-tasks td.mono { white-space: nowrap; }
.ac-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 13px; color: var(--text-2); }

/* cổng duyệt + lịch sử */
.gate { border-top: 3px solid var(--accent); }
.gate h3 { font-size: 20px; margin: 2px 0 10px; }
.gate .btn-block { margin-top: 14px; }
.gate-ok { color: var(--ok); }
.side-title { font-size: 17px; margin-bottom: 10px; }
.history { list-style: none; margin: 0; padding: 0; }
.history a { display: grid; gap: 1px; padding: 10px 0 10px 12px; border-left: 2px solid var(--border); color: var(--text); text-decoration: none; }
.history a:hover { border-left-color: var(--text-3); background: var(--surface-hover); }
.history a.is-active { border-left-color: var(--accent); }
.history small { color: var(--text-3); font-size: 12.5px; }
.history-note { font-style: italic; }
.history-notes { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); }
.history-notes p { font-family: var(--serif); font-style: italic; font-size: 14px; color: var(--text-2); margin-top: 4px; }
.qa { margin: 0; }
.qa dt { font-weight: 600; font-size: 13.5px; margin-top: 10px; }
.qa dd { margin: 2px 0 0; color: var(--text-2); font-size: 13.5px; }
.roadmap li.is-done .rm-dot { background: var(--text); border-color: var(--text); }

/* hộp thoại có form */
.dialog-wide { width: min(640px, calc(100vw - 32px)); }
.dialog form { display: grid; gap: 14px; }
.dialog .field { display: grid; gap: 6px; font-weight: 600; font-size: 13.5px; }
.dialog .field input:not([type=radio]):not([type=checkbox]) { height: 40px; }
.dialog fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 6px; }
.dialog legend { font-weight: 600; font-size: 13.5px; margin-bottom: 6px; }
.form-grid { display: grid; gap: 14px; }
.form-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-narrow { max-width: 260px; }
.radio { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--border); cursor: pointer; font-weight: 400; }
.radio:has(input:checked) { border-color: var(--text); background: var(--surface-2); }
.radio input { margin-top: 3px; accent-color: var(--primary); }
.radio strong { display: block; font-size: 14px; }
.radio small { color: var(--text-3); font-size: 12.5px; }
.check-row { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.check-row input { margin-top: 3px; accent-color: var(--primary); }
.form-error { color: var(--danger); font-size: 13.5px; min-height: 1em; }
.form-error:empty { display: none; }
.dialog .dialog-actions { margin-top: 4px; }

@media (max-width: 1100px) {
  .run-grid { grid-template-columns: 1fr; }
  .run-side { position: static; }
}
@media (max-width: 640px) {
  .page-head { flex-direction: column; align-items: stretch; }
  .page-head h2, .doc-head h2 { font-size: 26px; }
  .run-head { flex-direction: column; }
  .run-head h2 { font-size: 22px; }
  .stepper { grid-template-columns: 1fr; }
  .stepper li + li { border-left: 0; border-top: 1px solid var(--border); padding-left: 0; }
  .stepper li.is-current { box-shadow: inset 3px 0 0 var(--accent); padding-left: 10px; }
  .entry { grid-template-columns: 1fr; gap: 10px; }
  .form-row2 { grid-template-columns: 1fr; }
  .doc { font-size: 15px; }
  .table-tasks thead { display: none; }
}
.card-head { flex-wrap: wrap; }
@media (max-width: 1100px) { .run-side { order: -1; } }
