/* VCAPP — hệ quản trị công việc cá nhân, tông xanh ESG. Không phụ thuộc CDN (chạy offline/LAN). */
:root {
  --green-900: #053d2b; --green-800: #075e42; --green-700: #0b7a55; --green-600: #11946a; --green-500: #22a97c;
  --green-100: #dff3ea; --green-50: #f0f9f4; --lime: #8cc63f;
  --bg: #f3f6f4; --surface: #ffffff; --surface-2: #f8faf9; --border: #e1e8e4; --border-strong: #cdd8d2;
  --text: #17271f; --text-2: #4d5f56; --muted: #7b8c84;
  --danger: #c0392b; --danger-bg: #fdecea; --warn: #b26b00; --warn-bg: #fff4dc; --info: #1f6fb2; --info-bg: #e8f2fb; --ok: #0b7a55; --ok-bg: #e2f5ec;
  --radius: 10px; --radius-sm: 7px; --shadow: 0 1px 2px rgba(16,40,30,.05), 0 4px 16px rgba(16,40,30,.06);
  --sidebar: 256px;
  --font: Roboto, "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14px/1.5 var(--font); color: var(--text); background: var(--bg); }
a { color: var(--green-700); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.25; font-weight: 600; }
h1 { font-size: 22px; } h2 { font-size: 18px; } h3 { font-size: 15.5px; }
code { font-family: var(--mono); font-size: .92em; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; border: 1px solid var(--border); }
.ico { flex: none; vertical-align: -3px; }
.muted { color: var(--muted); } .small { font-size: 12.5px; } .nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.neg { color: var(--danger); }
.mono { font-family: var(--mono); }
[hidden] { display: none !important; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
/* Khung điều hướng 2 tầng: rail phân hệ (trái) + panel menu của phân hệ đang dùng */
body { --rail: 72px; --panel: 236px; --sidebar: calc(var(--rail) + var(--panel)); --accent: var(--green-700); }
body.nav-collapsed { --sidebar: var(--rail); }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); display: flex; z-index: 40; transition: transform .2s ease, width .2s ease; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; color: #fff; text-decoration: none !important; }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(145deg, var(--green-600), var(--green-800)); display: grid; place-items: center; color: #fff; box-shadow: 0 4px 12px rgba(0,0,0,.2); }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 16px; letter-spacing: .2px; }
.brand-text small { font-size: 11.5px; opacity: .75; }

.rail { width: var(--rail); flex: none; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 0 12px; background: #062e21; overflow-y: auto; scrollbar-width: none; }
.rail-brand { width: 42px; height: 42px; border-radius: 12px; background: linear-gradient(145deg, var(--green-600), var(--green-800)); display: grid; place-items: center; color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,.16), 0 6px 16px rgba(0,0,0,.3); margin-bottom: 12px; flex: none; text-decoration: none !important; transition: transform .15s; }
.rail-brand:hover { transform: translateY(-1px); }
.rail-item { --mod: var(--green-600); width: 62px; flex: none; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px 5px; border-radius: 10px; color: #a9cbbb; text-decoration: none !important; font-size: 10.5px; line-height: 1.15; text-align: center; position: relative; }
.rail-ico { width: 36px; height: 32px; border-radius: 9px; display: grid; place-items: center; transition: background .15s, color .15s; }
.rail-label { max-width: 60px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-item:hover { color: #fff; }
.rail-item:hover .rail-ico { background: rgba(255,255,255,.08); }
.rail-item.active { color: #fff; font-weight: 600; }
.rail-item.active .rail-ico { background: var(--mod); color: #fff; box-shadow: 0 4px 12px rgba(0,0,0,.25), inset 0 0 0 1px rgba(255,255,255,.18); }
.rail-item.active::before { content: ""; position: absolute; left: -5px; top: 10px; width: 3px; height: 24px; border-radius: 0 3px 3px 0; background: #fff; }
.rail-sep { width: 32px; height: 1px; background: rgba(255,255,255,.1); margin: 6px 0; flex: none; }
.rail-fill { flex: 1; min-height: 12px; }

.panel { width: var(--panel); flex: none; display: flex; flex-direction: column; background: linear-gradient(180deg, var(--green-900), #06402e 55%, #073a2a); color: #d6ebe1; border-left: 1px solid rgba(255,255,255,.05); min-width: 0; }
body.nav-collapsed .panel { display: none; }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 16px 14px 14px; border-bottom: 1px solid rgba(255,255,255,.07); min-height: 68px; }
.panel-mark { --mod: var(--green-600); width: 34px; height: 34px; border-radius: 9px; background: var(--mod); color: #fff; display: grid; place-items: center; flex: none; box-shadow: 0 3px 10px rgba(0,0,0,.25); }
.panel-title { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.panel-title small { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: #8fbfa8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel-title strong { font-size: 15px; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav { flex: 1; overflow-y: auto; padding: 4px 10px 16px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; }
.nav-group { font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: #7fb39a; padding: 16px 10px 5px; font-weight: 600; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: #d6ebe1; text-decoration: none !important; margin-bottom: 1px; font-size: 13.5px; }
.nav-link .ico { opacity: .8; }
.nav-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-link.active { background: rgba(140,198,63,.18); color: #fff; box-shadow: inset 3px 0 0 var(--lime); font-weight: 500; }
.nav-link.active .ico { opacity: 1; }
.nav-dot { --mod: var(--green-600); width: 22px; height: 22px; border-radius: 6px; background: var(--mod); color: #fff; display: grid; place-items: center; flex: none; }
.nav-mod span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-foot { padding: 10px 16px 12px; font-size: 11px; color: #7fb39a; border-top: 1px solid rgba(255,255,255,.06); display: flex; flex-direction: column; gap: 1px; }
.sidebar-foot span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.main { flex: 1; margin-left: var(--sidebar); min-width: 0; display: flex; flex-direction: column; transition: margin-left .2s ease; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; height: 60px; padding: 0 24px 0 14px; background: rgba(255,255,255,.92); backdrop-filter: blur(6px); border-bottom: 1px solid var(--border); }
.topbar::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--accent); }
.context { display: flex; align-items: center; gap: 8px; font-size: 13px; white-space: nowrap; min-width: 0; }
.context a { color: var(--text-2); text-decoration: none; }
.context a:hover { color: var(--text); }
.context-sep { color: var(--muted); }
.context-mod { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; color: var(--text) !important; padding: 4px 10px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 9%, #fff); }
.context-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.launcher { width: 340px; }
.launcher-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; }
.launcher-item { --mod: var(--green-600); display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 12px 6px 10px; border-radius: 10px; color: var(--text); font-size: 12px; text-align: center; line-height: 1.25; text-decoration: none !important; }
.launcher-item:hover { background: var(--surface-2); }
.launcher-item.active { background: color-mix(in srgb, var(--mod) 9%, #fff); font-weight: 600; }
.launcher-ico { width: 42px; height: 42px; border-radius: 12px; background: var(--mod); color: #fff; display: grid; place-items: center; box-shadow: 0 4px 12px color-mix(in srgb, var(--mod) 35%, transparent); }
.search { flex: 1; max-width: 520px; display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 0 14px; color: var(--muted); }
.search input[type=search] { flex: 1; border: 0; background: transparent; height: 36px; min-height: 0; padding: 0; font: inherit; color: var(--text); outline: none; min-width: 0; box-shadow: none; }
.search:focus-within { border-color: var(--green-500); box-shadow: 0 0 0 3px rgba(34,169,124,.15); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn { position: relative; width: 38px; height: 38px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--text-2); display: grid; place-items: center; cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); border-color: var(--border); }
.dot { position: absolute; top: 3px; right: 2px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 10.5px; display: grid; place-items: center; font-weight: 600; }
.user-btn { display: flex; align-items: center; gap: 10px; border: 0; background: transparent; cursor: pointer; padding: 4px 6px; border-radius: 10px; font: inherit; color: inherit; text-align: left; }
.user-btn:hover { background: var(--surface-2); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, var(--green-700), var(--green-500)); color: #fff; display: grid; place-items: center; font-weight: 600; }
.user-meta { display: flex; flex-direction: column; line-height: 1.2; max-width: 220px; }
.user-meta strong { font-size: 13px; } .user-meta small { color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dropdown { position: relative; }
.dropdown-menu { display: none; position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(16,40,30,.16); padding: 6px; z-index: 50; }
.dropdown.open .dropdown-menu { display: block; }
.dropdown-wide { min-width: 320px; }
.dropdown-title { font-size: 12px; font-weight: 600; color: var(--muted); padding: 6px 10px; text-transform: uppercase; letter-spacing: .05em; }
.dropdown-empty { padding: 10px; color: var(--muted); }
.dropdown-item { display: flex; gap: 10px; align-items: center; width: 100%; padding: 8px 10px; border-radius: 7px; color: var(--text); border: 0; background: none; font: inherit; cursor: pointer; text-align: left; text-decoration: none !important; }
.dropdown-item:hover { background: var(--green-50); }
.note-warn .ico { color: var(--warn); } .note-danger .ico { color: var(--danger); }
.content { padding: 20px 24px 40px; max-width: 1480px; width: 100%; }
.breadcrumbs { font-size: 12.5px; color: var(--muted); margin-bottom: 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.breadcrumbs a { color: var(--text-2); }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.page-head h1 { margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--text-2); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.only-mobile { display: none; }
.sidebar-backdrop { display: none; }

/* ---------- Components ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card-head h2, .card-head h3 { margin: 0; }
.card-body { padding: 16px 18px; }
.card-body.flush { padding: 0; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.stat { display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); color: inherit; text-decoration: none !important; }
.stat:hover { border-color: var(--green-500); }
.stat-icon { width: 40px; height: 40px; border-radius: 10px; background: var(--green-50); color: var(--green-700); display: grid; place-items: center; flex: none; }
.stat-value { font-size: 22px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--text-2); font-size: 12.5px; }
.stat-hint { color: var(--muted); font-size: 12px; margin-top: 2px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.tile { display: flex; flex-direction: column; gap: 8px; padding: 18px; border-radius: var(--radius); background: linear-gradient(160deg, #fff, var(--green-50)); border: 1px solid var(--border); color: inherit; text-decoration: none !important; box-shadow: var(--shadow); transition: transform .15s; }
.tile:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 55%, #fff); }
.tile .stat-icon { width: 44px; height: 44px; background: var(--accent); color: #fff; }
.tile h3 { margin: 4px 0 0; } .tile p { margin: 0; color: var(--text-2); font-size: 13px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-weight: 500; cursor: pointer; text-decoration: none !important; white-space: nowrap; }
.btn:hover { background: var(--surface-2); border-color: var(--muted); }
.btn:disabled, .btn.disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn-primary { background: var(--green-700); border-color: var(--green-700); color: #fff; }
.btn-primary:hover { background: var(--green-800); border-color: var(--green-800); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #a93226; }
.btn-warn { background: #fff7e6; border-color: #f0c36d; color: #7a4a00; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn-xs { height: 26px; padding: 0 8px; font-size: 12px; }
.btn-group { display: inline-flex; flex-wrap: wrap; gap: 4px; }
form.inline { display: inline; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; line-height: 1.6; white-space: nowrap; }
.badge-ok { background: var(--ok-bg); color: var(--ok); } .badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-warn { background: var(--warn-bg); color: var(--warn); } .badge-info { background: var(--info-bg); color: var(--info); }
.badge-muted { background: #eef1ef; color: var(--text-2); } .badge-dark { background: #263b31; color: #fff; }

.alert { position: relative; padding: 11px 40px 11px 14px; border-radius: var(--radius-sm); margin-bottom: 12px; border: 1px solid; }
.alert-success { background: var(--ok-bg); border-color: #b5e2cc; color: #0a5a3f; }
.alert-error { background: var(--danger-bg); border-color: #f2c1bb; color: #8f2318; }
.alert-warning { background: var(--warn-bg); border-color: #f1d49a; color: #7a4a00; }
.alert-info { background: var(--info-bg); border-color: #bcd6ee; color: #174f80; }
.alert-secret { background: #fffbea; border-color: #f0d77a; color: #5b4500; padding-right: 14px; }
.alert-secret .secret { font-size: 15px; padding: 3px 8px; background: #fff; letter-spacing: .5px; user-select: all; }
.alert-close { position: absolute; right: 8px; top: 6px; border: 0; background: none; font-size: 20px; line-height: 1; color: inherit; opacity: .6; cursor: pointer; }

.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { padding: 9px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.table thead th { background: var(--surface-2); color: var(--text-2); font-weight: 600; font-size: 12px; text-transform: none; position: sticky; top: 0; z-index: 1; white-space: nowrap; }
.table tbody tr:hover { background: #fafcfb; }
.table tfoot td { font-weight: 700; background: var(--green-50); border-top: 2px solid var(--green-100); }
.table .group-row td { background: #eef6f1; font-weight: 600; color: var(--green-800); }
.table td.actions-cell { white-space: nowrap; text-align: right; }
.table-sm th, .table-sm td { padding: 6px 10px; }
.table tr.row-error td { background: #fff6f5; } .table tr.row-warn td { background: #fffaf0; }
.table tr.is-muted td { color: var(--muted); }
.empty { padding: 28px; text-align: center; color: var(--muted); }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; padding: 14px 18px; border-bottom: 1px solid var(--border); background: var(--surface-2); border-radius: var(--radius) var(--radius) 0 0; }
.filters .field { margin: 0; min-width: 150px; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field > span, .field-label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field small { color: var(--muted); font-size: 12px; }
input[type=text], input[type=search], input[type=email], input[type=password], input[type=number], input[type=tel], input[type=date], input[type=file], select, textarea {
  font: inherit; color: var(--text); background: #fff; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 7px 10px; min-height: 36px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--green-500); box-shadow: 0 0 0 3px rgba(34,169,124,.15); }
input[type=file] { padding: 6px; }
textarea { min-height: 80px; resize: vertical; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13.5px; }
.check input { width: 16px; height: 16px; accent-color: var(--green-700); }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 6px 14px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); max-height: 280px; overflow: auto; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; padding-top: 6px; }
.help { background: var(--info-bg); color: #174f80; border-radius: var(--radius-sm); padding: 10px 12px; font-size: 13px; }

dl.kv { display: grid; grid-template-columns: 180px 1fr; gap: 8px 14px; margin: 0; }
dl.kv dt { color: var(--muted); } dl.kv dd { margin: 0; }

.pagination { display: flex; gap: 4px; align-items: center; justify-content: space-between; padding: 12px 18px; flex-wrap: wrap; }
.pagination .pages { display: flex; gap: 4px; flex-wrap: wrap; }
.pagination a, .pagination span.cur { min-width: 32px; height: 32px; padding: 0 8px; border: 1px solid var(--border); border-radius: 7px; display: grid; place-items: center; color: var(--text); text-decoration: none; }
.pagination span.cur { background: var(--green-700); color: #fff; border-color: var(--green-700); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--text-2); border-bottom: 2px solid transparent; white-space: nowrap; text-decoration: none; }
.tabs a.active { color: var(--green-700); border-bottom-color: var(--green-700); font-weight: 600; }

.matrix th.mod { background: var(--green-50); color: var(--green-800); text-align: left; font-size: 13px; }
.matrix td.perm-code { font-family: var(--mono); font-size: 12px; color: var(--muted); }

.modal { border: 0; border-radius: 14px; padding: 0; width: min(460px, calc(100vw - 32px)); box-shadow: 0 24px 64px rgba(0,0,0,.25); }
.modal::backdrop { background: rgba(10,30,20,.45); }
.modal-body { padding: 20px 22px; }
.modal-title { margin: 0 0 8px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 8px 0 8px 18px; border-left: 2px solid var(--green-100); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 14px; width: 10px; height: 10px; border-radius: 50%; background: var(--green-600); }
.steps { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.step { padding: 6px 12px; border-radius: 999px; background: #eef1ef; color: var(--text-2); font-size: 12.5px; }
.step.done { background: var(--ok-bg); color: var(--ok); } .step.cur { background: var(--green-700); color: #fff; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.kpi { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; }
.kpi b { display: block; font-size: 17px; font-variant-numeric: tabular-nums; }
.kpi span { font-size: 12px; color: var(--muted); }
pre.json { background: #0f241b; color: #d2f1e2; padding: 12px; border-radius: 8px; overflow: auto; font-size: 12px; max-height: 360px; }

/* ---------- Cổng hệ thống (trang tổng quan) ---------- */
.portal-hero { position: relative; overflow: hidden; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding: 22px 26px; margin-bottom: 18px; border-radius: 14px; color: #e3f3eb;
  background: radial-gradient(600px 240px at 100% 0%, rgba(140,198,63,.35), transparent 60%), linear-gradient(120deg, var(--green-900), var(--green-700)); box-shadow: var(--shadow); }
.portal-hero h1 { color: #fff; font-size: 23px; margin: 0 0 4px; }
.portal-hero p { margin: 0; opacity: .85; max-width: 640px; }
.portal-hero .hero-meta { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-chip { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.18); border-radius: 10px; padding: 8px 14px; min-width: 110px; }
.hero-chip b { display: block; font-size: 19px; color: #fff; font-variant-numeric: tabular-nums; line-height: 1.2; }
.hero-chip span { font-size: 11.5px; opacity: .8; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 6px 0 10px; }
.section-title h2 { margin: 0; font-size: 16px; }
.mod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin-bottom: 20px; }
.mod-card { --mod: var(--green-700); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; position: relative; transition: border-color .15s, transform .15s; }
.mod-card::before { content: ""; height: 4px; background: var(--mod); }
.mod-card:hover { border-color: color-mix(in srgb, var(--mod) 45%, var(--border)); transform: translateY(-2px); }
.mod-card-head { display: flex; gap: 12px; align-items: flex-start; padding: 16px 18px 10px; color: inherit; text-decoration: none !important; }
.mod-card-ico { width: 44px; height: 44px; border-radius: 12px; background: var(--mod); color: #fff; display: grid; place-items: center; flex: none; box-shadow: 0 6px 14px color-mix(in srgb, var(--mod) 30%, transparent); }
.mod-card-head h3 { margin: 0 0 3px; font-size: 15.5px; }
.mod-card-head p { margin: 0; color: var(--text-2); font-size: 12.5px; line-height: 1.45; }
.mod-card-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; padding: 4px 18px 12px; }
.mod-stat { display: block; padding: 9px 11px; border-radius: 9px; background: color-mix(in srgb, var(--mod) 6%, #fff); border: 1px solid color-mix(in srgb, var(--mod) 14%, #fff); color: inherit; text-decoration: none !important; }
.mod-stat:hover { border-color: color-mix(in srgb, var(--mod) 40%, #fff); }
.mod-stat b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; line-height: 1.2; }
.mod-stat span { font-size: 11.5px; color: var(--text-2); }
.mod-stat small { display: block; font-size: 11px; color: var(--muted); margin-top: 1px; }
.mod-card-links { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 18px 14px; }
.mod-card-links a { font-size: 12px; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); text-decoration: none; }
.mod-card-links a:hover { border-color: var(--mod); color: var(--text); }
.mod-card-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 18px; border-top: 1px solid var(--border); background: var(--surface-2); font-size: 12px; color: var(--muted); }
.mod-card-foot a { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; color: var(--mod); }
.mod-card.is-core { --mod: #475569; }

/* ---------- Phân hệ Tài chính / Văn bản ---------- */
.bars { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px; height: 190px; align-items: end; }
.bars-col { display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; min-width: 0; }
.bars-pair { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 2px; border-bottom: 1px solid var(--border); }
.bar { width: 40%; max-width: 14px; min-height: 1px; border-radius: 3px 3px 0 0; }
.bar.is-in, .legend-dot.is-in { background: #0b7a55; } .bar.is-out, .legend-dot.is-out { background: #c2410c; }
.bars-label { font-size: 11px; color: var(--muted); }
.legend-dot { display: inline-block; width: 9px; height: 9px; border-radius: 2px; vertical-align: 0; }
.meter-row { margin-bottom: 12px; }
.meter-top { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; margin-bottom: 4px; }
.meter { height: 7px; border-radius: 99px; background: #eef1ef; overflow: hidden; }
.meter span { display: block; height: 100%; border-radius: 99px; background: var(--accent); }
.meter span.is-over { background: var(--danger); } .meter span.is-none { background: #d5dcd8; }
.setup-layout { grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr); align-items: start; }
.voucher-layout { grid-template-columns: minmax(0, 1fr) 300px; align-items: start; }
.doc-layout { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
.voucher-print .card-body { padding: 28px 32px; }
.voucher-top { display: flex; justify-content: space-between; gap: 16px; font-size: 13px; }
.voucher-no { text-align: right; }
.voucher-title { text-align: center; font-size: 22px; letter-spacing: .06em; margin: 18px 0 2px; }
.voucher-date { text-align: center; font-style: italic; color: var(--text-2); margin: 0 0 18px; }
.voucher-lines { display: grid; grid-template-columns: 170px 1fr; gap: 8px 12px; margin: 0 0 24px; }
.voucher-lines dt { color: var(--text-2); } .voucher-lines dd { margin: 0; border-bottom: 1px dotted var(--border-strong); padding-bottom: 2px; }
.voucher-signs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; text-align: center; font-size: 12.5px; }
.voucher-signs div { display: flex; flex-direction: column; gap: 2px; min-height: 110px; }
.voucher-signs small { color: var(--muted); font-style: italic; }
.voucher-signs span { margin-top: auto; font-weight: 600; }
.task-callout { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); background: color-mix(in srgb, var(--accent) 5%, #fff); }
.seg { display: flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.seg-item { flex: 1; position: relative; cursor: pointer; }
.seg-item input { position: absolute; opacity: 0; pointer-events: none; }
.seg-item span { display: block; text-align: center; padding: 7px 4px; font-size: 12.5px; border-left: 1px solid var(--border); }
.seg-item:first-child span { border-left: 0; }
.seg-item input:checked + span { background: var(--accent); color: #fff; font-weight: 600; }
.seg-item input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -2px; }
.page-head h1 + .actions { margin-top: 6px; }
@media (max-width: 1100px) { .setup-layout, .voucher-layout, .doc-layout { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 900px) { .voucher-lines { grid-template-columns: 1fr; gap: 0; } .voucher-lines dd { margin-bottom: 8px; } .voucher-signs { grid-template-columns: repeat(2, 1fr); } .voucher-print .card-body { padding: 18px; } .bars { gap: 2px; } }
@media print { .no-print, .alert, .page-head .actions, .tabs { display: none !important; } .voucher-layout, .doc-layout { display: block; } .voucher-print { border: 0; } .content { padding: 0; } .topbar::before { display: none; } }

/* ---------- Hướng dẫn ---------- */
.help-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 16px; align-items: start; }
.help-toc { position: sticky; top: 76px; }
.help-toc ol { margin: 8px 0 0; padding-left: 20px; line-height: 1.9; }
.help-section { scroll-margin-top: 76px; }
.help-section h3 { margin-top: 18px; color: var(--green-800); }
.help-section h3:first-child { margin-top: 0; }
.help-section li { margin-bottom: 4px; }
.help-section dl.kv { grid-template-columns: 240px 1fr; }

/* ---------- Guest (đăng nhập VCAPP) ---------- */
.guest { min-height: 100vh; background:
  radial-gradient(900px 520px at 8% 0%, rgba(34,169,124,.55) 0%, transparent 62%),
  radial-gradient(700px 480px at 100% 100%, rgba(140,198,63,.18) 0%, transparent 60%),
  linear-gradient(140deg, #04291d 0%, var(--green-900) 45%, #0a5c41 100%); }
.guest-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr .9fr; max-width: 1120px; margin: 0 auto; align-items: center; gap: 56px; padding: 32px 24px; }
.guest-hero { color: #d8efe4; }
.vc-brand { display: flex; align-items: center; gap: 12px; }
.vc-mark { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 13px; background: linear-gradient(145deg, var(--green-600), var(--green-800)); box-shadow: inset 0 0 0 1px rgba(255,255,255,.18), 0 8px 24px rgba(0,0,0,.25); flex: none; }
.vc-mark.sm { width: 36px; height: 36px; border-radius: 10px; box-shadow: none; }
.vc-brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.vc-brand-text strong { font-size: 22px; color: #fff; letter-spacing: .06em; }
.vc-brand-text small { font-size: 13px; opacity: .8; }
.guest-hero h1 { font-size: 36px; line-height: 1.2; margin: 34px 0 12px; color: #fff; font-weight: 700; letter-spacing: -.01em; }
.guest-hero > p { font-size: 15.5px; opacity: .85; max-width: 470px; margin: 0; }
.vc-preview { margin: 28px 0 0; max-width: 420px; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.14); border-radius: 14px; padding: 16px 16px 10px; backdrop-filter: blur(6px); }
.vc-preview-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.vc-preview-head small { display: block; font-size: 12px; opacity: .7; }
.vc-preview-head strong { font-size: 16px; color: #fff; }
.vc-ring { --p: 0; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--lime) calc(var(--p) * 1%), rgba(255,255,255,.15) 0); }
.vc-ring b { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: #0a4a35; color: #fff; font-size: 11.5px; }
.vc-tasks { list-style: none; margin: 0; padding: 0; }
.vc-tasks li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid rgba(255,255,255,.08); font-size: 13.5px; color: #eef8f3; }
.vc-tasks li > span:nth-child(2) { flex: 1; min-width: 0; }
.vc-tasks li.done > span:nth-child(2) { text-decoration: line-through; opacity: .55; }
.vc-check { width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid rgba(255,255,255,.45); display: grid; place-items: center; flex: none; color: #04291d; }
.vc-tasks li.done .vc-check { background: var(--lime); border-color: var(--lime); }
.vc-tasks .tag { font-style: normal; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 99px; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.tag.t-green { background: rgba(140,198,63,.2); color: #c9eb9c; }
.tag.t-blue { background: rgba(96,165,250,.2); color: #bcdcff; }
.tag.t-amber { background: rgba(251,191,36,.2); color: #fde3a0; }
.hero-points { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 10px; }
.hero-points li { display: flex; gap: 10px; align-items: center; opacity: .9; }
.hero-points .ico { color: var(--lime); }
.guest-card { background: #fff; border-radius: 18px; padding: 30px 32px 20px; box-shadow: 0 30px 80px rgba(0,0,0,.35); max-width: 440px; width: 100%; justify-self: end; }
.vc-card-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.vc-card-brand > span:last-child { display: flex; flex-direction: column; line-height: 1.25; }
.vc-card-brand strong { letter-spacing: .06em; font-size: 15px; }
.vc-card-brand small { color: var(--muted); font-size: 12.5px; }
.guest-card h2 { font-size: 23px; margin-bottom: 4px; }
.guest-card .sub { color: var(--muted); margin: 0 0 22px; }
.guest-card input[type=text], .guest-card input[type=password] { height: 42px; }
.guest-card .btn-primary { width: 100%; height: 44px; font-size: 15px; margin-top: 4px; border-radius: 10px; transition: background .15s, transform .1s; }
.guest-card .btn-primary:active { transform: translateY(1px); }
.input-ico { position: relative; display: block; }
.input-ico > .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-ico > input { width: 100%; padding-left: 38px; }
.input-ico:focus-within > .ico { color: var(--green-700); }
.input-ico:has(.pw-toggle) > input { padding-right: 42px; }
.pw-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border: 0; background: none; border-radius: 8px; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.pw-toggle:hover { background: var(--surface-2); color: var(--text); }
.pw-toggle[aria-pressed=true] { color: var(--green-700); }
.caps-warn { color: var(--warn) !important; display: inline-flex; align-items: center; gap: 4px; }
.guest-links { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 14px; font-size: 13px; }
.guest-links .muted { display: inline-flex; align-items: center; gap: 5px; }
.vc-foot { margin: 22px 0 0; padding-top: 14px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); text-align: center; }

/* ---------- Thương hiệu VCAPP trong khung ứng dụng ---------- */
.brand-svg { display: block; flex: none; }
.panel-brand { background: linear-gradient(145deg, var(--green-600), var(--green-800)) !important; box-shadow: inset 0 0 0 1px rgba(255,255,255,.16), 0 3px 10px rgba(0,0,0,.25); }
.panel-title .brand-name { letter-spacing: .06em; }
.panel-brand + .panel-title small { text-transform: none; letter-spacing: 0; font-size: 11.5px; }
.portal-hero { background: radial-gradient(700px 300px at 0% 0%, rgba(34,169,124,.45), transparent 62%), radial-gradient(520px 260px at 100% 100%, rgba(140,198,63,.22), transparent 60%), linear-gradient(140deg, #04291d 0%, var(--green-900) 45%, #0a5c41 100%); }

/* ---------- Vai trò theo phân hệ ---------- */
.role-mod-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--mod, var(--green-700)); margin-right: 6px; vertical-align: 1px; }
.role-groups { display: grid; gap: 10px; max-height: 420px; overflow: auto; }
.role-group { margin: 0; padding: 8px 12px 10px; border: 1px solid var(--border); border-left: 3px solid var(--mod, var(--green-700)); border-radius: var(--radius-sm); background: var(--surface-2); display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px 14px; }
.role-group legend { padding: 0 6px; font-weight: 600; font-size: 12.5px; color: var(--text); }
.role-line { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0 0 8px; }
.role-line-mod { font-size: 12px; font-weight: 600; color: var(--text-2); min-width: 86px; }

/* ---------- Ứng dụng cài đặt (PWA) ---------- */
.pwa-install { margin-top: 16px; }
.pwa-install .btn { width: 100%; height: 40px; border-style: dashed; color: var(--green-700); }
.pwa-ios-hint { margin: 16px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--green-50); color: var(--text-2); font-size: 12.5px; display: flex; gap: 8px; align-items: flex-start; }
.pwa-ios-hint .ico { margin-top: 2px; color: var(--green-700); }
.offline-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.offline-card { max-width: 400px; text-align: center; justify-self: center; }
.offline-card img { border-radius: 18px; margin-bottom: 12px; }
.offline-card .btn { width: 100%; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); } .grid-3 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 900px) {
  body, body.nav-collapsed { --sidebar: min(308px, 88vw); --panel: calc(var(--sidebar) - var(--rail)); }
  body.nav-collapsed .panel { display: flex; }
  .sidebar { transform: translateX(-100%); box-shadow: 0 0 40px rgba(0,0,0,.3); }
  .portal-hero { padding: 18px; } .portal-hero h1 { font-size: 20px; }
  .launcher { width: min(320px, calc(100vw - 24px)); right: -90px; }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 35; }
  .main { margin-left: 0; }
  .only-mobile { display: grid; }
  .hide-mobile { display: none; }
  .topbar { padding: 0 12px; }
  .content { padding: 14px 12px 32px; }
  .grid-2, .grid-3, .grid-4, .form-grid, .help-layout { grid-template-columns: minmax(0, 1fr); }
  .help-toc { position: static; }
  dl.kv { grid-template-columns: 1fr; gap: 2px; } dl.kv dd { margin-bottom: 8px; }
  .guest-wrap { grid-template-columns: minmax(0, 1fr); gap: 20px; padding: 24px 16px; align-content: start; }
  .guest-hero h1 { font-size: 24px; margin-top: 18px; } .guest-hero h1 br { display: none; }
  .hero-points, .vc-preview, .guest-hero > p { display: none; }
  .guest-card { justify-self: stretch; max-width: none; padding: 24px 20px 16px; }
}
@media print { .sidebar, .topbar, .actions, .filters, .pagination, .help-toc, .breadcrumbs { display: none !important; } .main { margin: 0; } .help-layout { display: block; } .card { box-shadow: none; } }

/* Ô đánh dấu dùng chung class field: giữ trên một hàng */
.field.check { flex-direction: row; align-items: flex-start; gap: 8px; font-size: 13.5px; }
.field.check input { margin-top: 2px; flex: none; }

/* Cột người có thuế TNCN > 0 */
.table th.tp, .table td.tp { background: #fff8e6; }
