/* ============================================================
   VBPL Review — Vietnamese legal documents portal
   Refined editorial / professional theme
   ============================================================ */

:root {
  /* IKIGAI / Lazard-style editorial palette: cream surfaces, deep navy, muted gold */
  --bg: #f6f0e2;            /* cream */
  --bg-2: #ede4cf;
  --paper: #fbf7ec;         /* warm ivory paper */
  --paper-2: #f3ead4;

  /* Primary brand: refined burgundy (kept; works well over cream) */
  --red: #7d1d22;
  --red-dark: #5e1418;
  --red-light: #9b2a30;
  --red-soft: #efdadb;

  /* Navy — IKIGAI deep navy */
  --blue: #1a2c4a;
  --blue-dark: #0f1c33;
  --blue-light: #2c4470;
  --blue-soft: #e0e3eb;

  /* Accent: View Dental green — brighter, fresher (var name kept for compat) */
  --orange: #15a884;
  --orange-dark: #0d8267;
  --orange-soft: #d6efe6;
  --green-tint: rgba(21, 168, 132, 0.10);

  /* Link blue — slightly more saturated for contrast */
  --link: #1a4f8a;
  --link-hover: #8b1f24;
  --visited: #6b21a8;

  /* Ink — warmer near-black with cooler mid-tones */
  --ink: #15181d;
  --ink-soft: #3d4451;
  --ink-mute: #6b7280;
  --ink-faint: #9ca3af;

  /* Lines */
  --line: #dee1e7;
  --line-soft: #ecedf1;
  --line-strong: #c4c8cf;

  /* Reference */
  --ref-bg: #fbf6e6;
  --ref-bg-hover: #f5ecca;
  --ref-border: #a8741b;
  --ref-ink: #5b3e02;

  /* Status */
  --ok: #15803d;
  --ok-bg: #dff0e3;
  --warn: #a26514;
  --warn-bg: #fbf2dc;
  --hot: #b81e1e;
  --hot-bg: #f7e2e2;
  --new: #047857;
  --new-bg: #d8efe2;
  --neutral: #475569;
  --neutral-bg: #e3e6eb;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow: 0 2px 6px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 6px 16px -4px rgba(15, 23, 42, 0.08);

  --r-sm: 3px;
  --r: 4px;
  --r-md: 6px;

  --read-size: 10.5px;
  --read-width: 760px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  /* IKIGAI / investment-banking editorial: Georgia serif throughout */
  font-family: Georgia, "Times New Roman", "Source Serif 4", "Source Serif Pro", serif;
  font-feature-settings: "kern", "lnum", "tnum";
  font-size: 13px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, .brand-name, .doc-titlebar h1, .spotlight h1, .lt-header h2,
.luocdo h2 {
  font-family: Georgia, "Source Serif 4", "Times New Roman", serif;
  letter-spacing: -0.005em;
  font-feature-settings: "kern", "lnum";
  font-weight: 700;
}

/* Numeric / monospace details remain sans for legibility */
.lt-num, .num, .ss-num, code, samp {
  font-family: "Inter", "Segoe UI", -apple-system, system-ui, sans-serif;
  font-feature-settings: "tnum", "ss01";
}

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }
button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; }
table { border-collapse: collapse; }

::selection { background: var(--orange-soft); color: var(--ink); }
.hidden { display: none !important; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.container { max-width: 1240px; margin: 0 auto; padding: 0 16px; }

/* ===== Top utility bar ===== */
.utility {
  background: var(--blue-dark);
  color: rgba(255,255,255,0.78);
  font-size: 12px;
}
.utility-inner {
  max-width: 1240px; margin: 0 auto; padding: 6px 16px;
  display: flex; align-items: center; justify-content: space-between;
}
.utility-left { display: flex; gap: 14px; }
.utility .util-refresh {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 6px; border-radius: 3px;
  cursor: pointer;
}
.utility .util-refresh:hover { background: rgba(255,255,255,0.10); color: white; }
.utility .util-refresh:active { background: rgba(255,255,255,0.18); }
.utility .util-refresh svg { color: rgba(255,255,255,0.6); transition: transform 400ms ease; }
.utility .util-refresh:active svg { transform: rotate(180deg); color: white; }
.utility-right { display: flex; gap: 12px; align-items: center; }
.utility a { color: rgba(255,255,255,0.78); text-decoration: none; }
.utility a:hover { color: white; }
.utility .sep { opacity: 0.4; }
.utility .util-status {
  display: inline-flex; align-items: center; gap: 6px;
  color: rgba(255,255,255,0.85);
}
.utility .util-status::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.25);
}

/* ===== Main header ===== */
.site-header {
  background: white;
  border-bottom: 1px solid var(--line);
}
.header-inner {
  max-width: 1240px; margin: 0 auto; padding: 14px 16px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 24px;
  align-items: center;
}

.brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none;
  cursor: pointer;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 46px; height: 46px;
  background: linear-gradient(135deg, var(--red-light) 0%, var(--red-dark) 100%);
  display: grid; place-items: center;
  border-radius: 6px;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(192, 57, 43, 0.4);
}
.brand-mark svg { width: 26px; height: 26px; color: white; }
.brand-text { line-height: 1.15; }
.brand-name {
  font-size: 18px; font-weight: 700;
  color: var(--red); letter-spacing: -0.2px;
  text-transform: uppercase;
}
.brand-tag { font-size: 11.5px; color: var(--ink-mute); margin-top: 2px; }

/* Header search */
.header-search {
  display: flex;
  background: white;
  border: 2px solid var(--blue);
  border-radius: 4px;
  overflow: hidden;
  max-width: 580px;
  width: 100%;
}
.header-search-type {
  background: var(--blue-soft);
  color: var(--blue-dark);
  border: none;
  border-right: 1px solid var(--line);
  padding: 0 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  display: flex; align-items: center; gap: 4px;
}
.header-search-type:hover { background: var(--blue); color: white; }
.search-wrap { position: relative; flex: 1; }
.search-box {
  display: flex; align-items: center;
  background: white;
}
#search-input, #side-search-input {
  flex: 1; border: none; outline: none;
  font-size: 13.5px; padding: 9px 12px;
  background: transparent;
  color: var(--ink); min-width: 0;
}
#search-input::placeholder, #side-search-input::placeholder { color: var(--ink-mute); }
.search-clear {
  border: none; background: transparent;
  color: var(--ink-mute);
  width: 26px; height: 26px;
  font-size: 18px; line-height: 1;
  display: none; align-items: center; justify-content: center;
  margin-right: 4px;
}
.search-clear:hover { color: var(--red); }
.search-clear.visible { display: inline-flex; }
.search-do {
  background: var(--orange);
  color: white;
  border: none;
  padding: 0 18px;
  font-weight: 600;
  font-size: 13px;
  display: inline-flex; align-items: center; gap: 6px;
  font-family: inherit;
}
.search-do:hover { background: var(--orange-dark); }
.search-shortcut {
  font-size: 11px;
  color: var(--ink-mute);
  background: var(--bg-2);
  border: 1px solid var(--line);
  padding: 2px 6px;
  border-radius: 3px;
  font-family: ui-monospace, "Menlo", monospace;
  margin-right: 6px;
}

.header-actions { display: flex; gap: 6px; align-items: center; }
.header-nav { display: inline-flex; align-items: center; gap: 4px; }
.header-home,
.header-overview {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 600;
  color: var(--ink); text-decoration: none;
  padding: 6px 10px; border-radius: 4px;
  letter-spacing: 0.1px;
}
.header-home:hover,
.header-overview:hover { background: rgba(15, 24, 51, 0.06); color: var(--ink); }
.header-home svg,
.header-overview svg { color: var(--ink-mute); }
.btn-action {
  background: white;
  color: var(--ink);
  border: 1px solid var(--line-strong);
  padding: 7px 14px;
  font-size: 13px;
  border-radius: 4px;
  font-weight: 500;
  display: inline-flex; align-items: center; gap: 5px;
}
.btn-action:hover { border-color: var(--blue); color: var(--blue); }
.btn-action.primary {
  background: var(--red);
  color: white;
  border-color: var(--red);
}
.btn-action.primary:hover { background: var(--red-dark); border-color: var(--red-dark); }

/* ===== Navigation strip ===== */
.navbar {
  background: var(--blue);
  color: white;
  position: sticky;
  top: 0;
  z-index: 30;
  box-shadow: var(--shadow-sm);
}
.navbar-inner {
  max-width: 1240px; margin: 0 auto;
  display: flex; align-items: stretch;
}
.navbar a, .navbar button {
  color: white;
  text-decoration: none;
  padding: 11px 16px;
  font-size: 13.5px;
  font-weight: 500;
  border-right: 1px solid rgba(255,255,255,0.1);
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent;
  border-top: none; border-bottom: none; border-left: none;
  font-family: inherit;
  white-space: nowrap;
}
.navbar a:hover, .navbar button:hover {
  background: var(--blue-dark);
  text-decoration: none;
}
.navbar a.active {
  background: var(--red);
}
.navbar .nav-spacer { flex: 1; border: none; pointer-events: none; }
.navbar .nav-meta {
  font-weight: 400;
  font-size: 12px;
  color: rgba(255,255,255,0.75);
  display: inline-flex; align-items: center; gap: 6px;
  border-right: none;
}
.navbar .nav-meta::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.25);
}

/* Suggestions dropdown (under header search) */
.suggestions {
  position: absolute;
  top: calc(100% + 1px); left: 0; right: 0;
  background: white;
  border: 1px solid var(--line-strong);
  border-top: 2px solid var(--blue);
  border-radius: 0 0 4px 4px;
  list-style: none; margin: 0; padding: 0;
  box-shadow: var(--shadow-md);
  z-index: 25;
  max-height: 420px; overflow-y: auto;
  animation: pop 140ms ease;
}
.suggestions:empty { display: none; }
.suggestions-section {
  padding: 7px 12px 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--ink-mute);
  font-weight: 700;
  background: var(--paper-2);
  border-bottom: 1px solid var(--line-soft);
}
.suggestion {
  padding: 8px 12px;
  cursor: pointer;
  display: flex; align-items: flex-start; gap: 10px;
  border-bottom: 1px solid var(--line-soft);
}
.suggestion:last-child { border-bottom: none; }
.suggestion:hover, .suggestion.active { background: var(--blue-soft); }
.suggestion-type {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 2px 7px;
  border-radius: 2px;
  margin-top: 1px; flex-shrink: 0;
  color: white;
  white-space: nowrap;
}
.suggestion-type.luat     { background: var(--red); }
.suggestion-type.nghidinh { background: var(--blue); }
.suggestion-type.thongtu  { background: var(--ok); }
.suggestion-type.bo-luat  { background: #6b21a8; }

.suggestion-body { flex: 1; min-width: 0; }
.suggestion-title { font-size: 13px; font-weight: 600; color: var(--ink); }
.suggestion-meta { font-size: 11.5px; color: var(--ink-mute); margin-top: 2px; }
.suggestion-meta mark { background: var(--ref-bg); color: var(--ref-ink); padding: 0 2px; border-radius: 2px; }
.suggestion-empty {
  padding: 22px 16px; text-align: center;
  color: var(--ink-mute); font-size: 13px;
}
.suggestion-empty strong { color: var(--ink); display: block; margin-bottom: 4px; }

/* ===== Breadcrumb / page-title strip ===== */
/* ===== Top navigation bar ===== */
.topnav {
  background: var(--blue-dark);
  border-bottom: 1px solid #0a1428;
  position: relative;
  z-index: 50;
}
.topnav-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: stretch;
  gap: 0;
}
.topnav-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 14px;
  color: rgba(247,249,252,0.84);
  font-family: "Inter", "Segoe UI", sans-serif;
  font-size: 12px; font-weight: 500;
  letter-spacing: 0.01em;
  text-decoration: none;
  background: transparent; border: none;
  border-right: 1px solid rgba(255,255,255,0.06);
  cursor: pointer; white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.topnav-link:hover { background: rgba(255,255,255,0.06); color: #f7f9fc; }
.topnav-link.active { background: var(--orange); color: white; }
.topnav-item { position: relative; }
.topnav-trigger { font-family: inherit; }
.topnav-menu {
  display: none;
  position: absolute; top: 100%; left: 0;
  background: white;
  border: 1px solid var(--line-strong);
  border-top: 3px solid var(--orange);
  box-shadow: 0 8px 22px rgba(0,0,0,0.16);
  min-width: 320px;
  padding: 6px 0;
  z-index: 60;
}
.topnav-dropdown.open .topnav-menu,
.topnav-dropdown:hover .topnav-menu { display: block; }
.topnav-dropdown.open .topnav-trigger,
.topnav-dropdown:hover .topnav-trigger { background: var(--blue); color: white; }
.topnav-menu-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px;
  text-decoration: none;
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.12s;
}
.topnav-menu-item:hover { background: var(--blue-soft); color: var(--blue-dark); }
.tn-ico {
  width: 28px; height: 28px;
  border-radius: 4px;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.tn-ico.r1 { background: #fde8e7; color: var(--red); }
.tn-ico.r2 { background: #fef0dc; color: var(--orange); }
.tn-ico.r3 { background: #e8eef9; color: var(--blue); }
.tn-ico.r4 { background: #f3eafe; color: #7c3aed; }
.tn-text { display: flex; flex-direction: column; min-width: 0; }
.tn-name { font-weight: 600; color: var(--ink); }
.tn-cnt { font-size: 11px; color: var(--ink-mute); margin-top: 1px; }

/* "Thêm lĩnh vực mới" affordance */
.topnav-add-field {
  border-top: 1px dashed var(--line);
  margin-top: 4px;
}
.tn-ico-add {
  background: var(--orange-soft);
  color: var(--orange-dark);
  width: 28px; height: 28px;
  border-radius: 4px;
  display: inline-flex; align-items: center; justify-content: center;
}
.topnav-user-fields {
  list-style: none; padding: 0; margin: 0;
  border-top: 1px dashed var(--line);
}
.topnav-user-fields:empty { display: none; }

/* Modal: Thêm lĩnh vực mới */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(15, 28, 51, 0.55);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: fadeIn 0.15s ease-out;
}
.modal-backdrop[hidden] { display: none !important; }
.modal {
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-top: 4px solid var(--orange);
  border-radius: 5px;
  width: min(520px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px -10px rgba(15, 23, 42, 0.35);
  padding: 24px 26px;
}
.modal-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 6px;
}
.modal-head h2 {
  font-family: Georgia, serif;
  font-size: 19px; font-weight: 700;
  color: var(--ink); margin: 0;
  border: none; padding: 0;
}
.modal-close {
  background: transparent; border: none;
  color: var(--ink-mute); font-size: 24px; line-height: 1;
  cursor: pointer; padding: 0 4px;
}
.modal-close:hover { color: var(--orange-dark); }
.modal-desc {
  font-family: Georgia, serif;
  font-size: 12.5px; color: var(--ink-soft);
  line-height: 1.55; margin: 0 0 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.modal-desc strong { color: var(--orange-dark); }
.modal-field {
  display: block; margin-bottom: 14px;
}
.modal-field-label {
  display: block;
  font-family: "Inter", "Segoe UI", sans-serif;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink-soft);
  margin-bottom: 4px;
}
.modal-field input {
  width: 100%;
  font-family: "Inter", "Segoe UI", sans-serif;
  font-size: 13px;
  padding: 8px 10px;
  background: white;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  color: var(--ink);
}
.modal-field input:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(21, 168, 132, 0.15);
}
.modal-field-hint {
  display: block;
  font-family: "Inter", "Segoe UI", sans-serif;
  font-size: 11px; color: var(--ink-mute);
  margin-top: 4px;
}
.modal-field-hint code {
  background: var(--paper-2);
  padding: 1px 5px;
  border-radius: 2px;
  font-size: 10.5px;
}
.modal-actions {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.modal-cancel, .modal-submit {
  font-family: "Inter", "Segoe UI", sans-serif;
  font-size: 12.5px; font-weight: 600;
  padding: 8px 16px;
  border-radius: 3px;
  cursor: pointer;
  letter-spacing: 0.01em;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.modal-cancel {
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--line-strong);
}
.modal-cancel:hover {
  border-color: var(--ink-mute);
  color: var(--ink);
}
.modal-submit {
  background: var(--orange);
  color: white;
  border: 1px solid var(--orange);
}
.modal-submit:hover {
  background: var(--orange-dark);
  border-color: var(--orange-dark);
}

/* Liên kết nhanh — main column card grid */
.quicklinks-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 12px 14px;
}
.qlink {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--blue);
  border-radius: var(--r-sm);
  text-decoration: none;
  color: var(--ink);
  transition: background 0.12s, border-color 0.12s;
}
.qlink:hover { background: var(--blue-soft); border-left-color: var(--red); }
.qlink-ico {
  width: 32px; height: 32px;
  border-radius: 4px;
  background: white;
  border: 1px solid var(--line);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--blue-dark);
  flex-shrink: 0;
}
.qlink-text { display: flex; flex-direction: column; min-width: 0; }
.qlink-name { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.qlink-host {
  font-size: 11px; color: var(--ink-mute);
  font-family: ui-monospace, monospace;
  margin-top: 2px;
}

.crumbs-bar {
  background: var(--paper-2);
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
  padding: 8px 0;
  color: var(--ink-soft);
}
.crumbs-bar .container { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.crumbs-bar a { color: var(--link); cursor: pointer; }
.crumbs-bar .sep { color: var(--ink-faint); }
.crumbs-bar .current { color: var(--ink); font-weight: 600; }

/* ===== Landing page ===== */
.landing { padding: 14px 0 24px; }

.land-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  align-items: start;
}
.land-main { min-width: 0; }

/* Home mode (no doc selected): hide the spotlight; only the industries
   grid is visible. preview-mode (a card was clicked) flips the rule:
   spotlight visible, industries hidden. */
body:not(.preview-mode) .spotlight { display: none; }
body.preview-mode .industries { display: none; }

/* ===== Lĩnh vực pháp lý — main-page industries grid ===== */
.industries {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 22px 24px 24px;
  margin-bottom: 18px;
}
.industries-head {
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.industries-head h2 {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}
.industries-sub {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 13.5px;
  color: var(--ink-mute);
  margin: 0;
  line-height: 1.5;
}
/* Sub-sector tree (landing page) */
.subsector-tree { margin-top: 24px; }
.st-tree {
  list-style: none; padding: 0; margin: 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}
.st-branch {
  list-style: none;
  border-bottom: 1px solid var(--line);
}
.st-branch:last-child { border-bottom: none; }
.st-branch-head {
  width: 100%;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  background: var(--paper-2);
  border: none; border-left: 4px solid var(--line);
  font-family: inherit; cursor: pointer;
  text-align: left;
  transition: background 100ms;
}
.st-branch.type-luat .st-branch-head,
.st-branch.type-bo-luat .st-branch-head { border-left-color: #7d1d22; }
.st-branch.type-nghidinh .st-branch-head { border-left-color: #15a884; }
.st-branch-head:hover { background: var(--bg-2); }

.st-chev {
  display: inline-block;
  width: 14px; text-align: center;
  color: var(--ink-mute);
  transition: transform 150ms;
  font-size: 11px;
}
.st-branch[aria-expanded="true"] > .st-branch-head > .st-chev,
.st-group[aria-expanded="true"] > .st-group-head > .st-chev {
  transform: rotate(90deg);
}

.st-branch-pill {
  font-family: "Inter", sans-serif;
  font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.5px; text-transform: uppercase;
  color: var(--red);
  background: var(--red-soft);
  padding: 3px 8px; border-radius: 3px;
}
.st-branch-label {
  font-family: Georgia, serif;
  font-size: 15px; font-weight: 700;
  color: var(--ink);
  flex: 1;
}
.st-branch-count {
  font-family: "Inter", sans-serif;
  font-size: 11px; font-weight: 700;
  color: var(--ink-mute);
  background: white;
  border: 1px solid var(--line);
  padding: 2px 9px; border-radius: 999px;
}

.st-groups, .st-leaves {
  list-style: none; padding: 0; margin: 0;
  display: none;
  background: white;
}
.st-branch[aria-expanded="true"] > .st-groups,
.st-group[aria-expanded="true"] > .st-leaves { display: block; }

.st-group { list-style: none; border-top: 1px solid var(--line); }
.st-group:first-child { border-top: none; }
.st-group-head {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 18px 10px 38px;
  background: white;
  border: none;
  font-family: inherit; cursor: pointer;
  text-align: left;
  transition: background 100ms;
}
.st-group-head:hover { background: var(--paper-2); }
.st-group-label {
  font-family: "Inter", sans-serif;
  font-size: 12.5px; font-weight: 600;
  color: var(--ink);
  flex: 1;
}
.st-group-count {
  font-family: "Inter", sans-serif;
  font-size: 10.5px; font-weight: 700;
  color: var(--ink-mute);
  background: var(--paper-2);
  padding: 1px 7px; border-radius: 999px;
}

.st-leaves { padding-left: 0; }
.st-leaf {
  list-style: none;
  display: flex; align-items: center; gap: 10px;
  padding: 7px 18px 7px 58px;
  background: white;
  border-top: 1px solid var(--line-soft);
  cursor: pointer;
  transition: background 100ms;
}
.st-leaf:hover { background: var(--paper-2); }
.st-leaf-pill {
  font-family: "Inter", sans-serif;
  font-size: 9.5px; font-weight: 700;
  letter-spacing: 0.4px; text-transform: uppercase;
  color: var(--ink-mute);
  background: var(--paper-2);
  padding: 2px 7px; border-radius: 3px;
  white-space: nowrap; flex-shrink: 0;
  border-left: 2px solid var(--line);
}
.st-leaf-pill.type-luat,
.st-leaf-pill.type-bo-luat { border-left-color: #7d1d22; }
.st-leaf-pill.type-nghidinh { border-left-color: #15a884; }
.st-leaf-pill.type-thongtu { border-left-color: #1a2c4a; }
.st-leaf-pill.type-quyetdinh { border-left-color: #7a3aa8; color: #5e2c84; }
.st-leaf-title {
  font-family: Georgia, "Source Serif 4", serif;
  font-size: 12.5px;
  color: var(--ink);
  flex: 1;
}

.industry-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.industry-card {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 12px;
  align-items: center;
  background: white;
  border: 1px solid var(--line);
  border-left: 3px solid var(--line);
  border-radius: var(--r-md);
  padding: 12px 14px;
  text-align: left;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  font-family: inherit;
}
.industry-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(15, 28, 51, 0.08);
}
.industry-card.type-luat,
.industry-card.type-bo-luat {
  border-left-color: var(--red);
}
.industry-card.type-luat:hover,
.industry-card.type-bo-luat:hover {
  border-color: var(--red);
}
.industry-card.type-nghidinh { border-left-color: var(--orange); }
.industry-card.type-nghidinh:hover { border-color: var(--orange); }
.industry-card.type-thongtu { border-left-color: var(--blue); }
.industry-card.type-thongtu:hover { border-color: var(--blue); }

.industry-card .ind-icon {
  width: 38px; height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(21, 168, 132, 0.10);
  color: var(--orange-dark);
}
.industry-card.type-luat .ind-icon,
.industry-card.type-bo-luat .ind-icon {
  background: rgba(125, 29, 34, 0.10);
  color: var(--red);
}
.industry-card.type-thongtu .ind-icon {
  background: rgba(26, 44, 74, 0.10);
  color: var(--blue);
}
.industry-card .ind-icon svg {
  width: 20px; height: 20px;
}

.industry-card .ind-body {
  min-width: 0;
}
.industry-card .ind-name {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
  line-height: 1.3;
  margin-bottom: 2px;
}
.industry-card .ind-anchor {
  font-family: 'Inter', sans-serif;
  font-size: 11.5px;
  color: var(--ink-mute);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.industry-card .ind-count {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  flex-shrink: 0;
}
.industry-card .ind-count-num {
  font-family: 'Inter', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1;
}
.industry-card .ind-count-lbl {
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  color: var(--ink-mute);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ===== Bộ luật grid (home page) ===== */
.boluat-section,
.alllaws-section {
  margin-top: 28px;
}
.boluat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}
.bl-card {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 12px;
  align-items: center;
  background: white;
  border: 1px solid var(--line);
  border-left: 3px solid var(--red);
  border-radius: var(--r-md);
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.bl-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(15, 28, 51, 0.08);
  border-color: var(--red);
}
.bl-card-year {
  font-family: 'Inter', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--red);
  text-align: center;
  line-height: 1;
}
.bl-card-body {
  min-width: 0;
}
.bl-card-title {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}
.bl-card-id {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  color: var(--ink-mute);
  letter-spacing: 0.2px;
}

/* ===== All Luật grouped by sector — Wikipedia-style category grid ===== */
.alllaws-list { margin: 0; }
.law-cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 14px;
}
.law-cat {
  background: white;
  border: 1px solid var(--line);
  border-top: 3px solid var(--red);
  border-radius: var(--r-md);
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.law-cat-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}
.law-cat-label {
  margin: 0;
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
  line-height: 1.25;
}
.law-cat-count {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 700;
  color: var(--red);
  background: rgba(125, 29, 34, 0.10);
  padding: 2px 9px;
  border-radius: 99px;
  flex-shrink: 0;
  letter-spacing: 0.2px;
}
.law-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.law-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(125, 29, 34, 0.04);
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 3px 10px 3px 8px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: 11.5px;
  color: var(--ink);
  line-height: 1.4;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.12s ease;
}
.law-pill:hover {
  background: rgba(125, 29, 34, 0.12);
  border-color: var(--red);
  transform: translateY(-1px);
}
.law-pill .lp-year {
  font-weight: 700;
  color: var(--red);
  font-size: 10.5px;
  letter-spacing: 0.3px;
}
.law-pill .lp-id {
  font-weight: 500;
  color: var(--ink);
  letter-spacing: 0.1px;
}

@media (max-width: 720px) {
  .law-cat-grid { grid-template-columns: 1fr; }
}

/* ===== Section block ===== */
.block {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  margin-bottom: 18px;
  overflow: hidden;
}
.block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 9px;
  border-bottom: 2px solid var(--orange);
  background: white;
  position: relative;
}
.block-head .title {
  font-size: 14.5px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--blue-dark);
  letter-spacing: 0.2px;
  display: flex; align-items: center; gap: 8px;
}
.block-head .title::before {
  content: "";
  width: 4px; height: 16px;
  background: var(--red);
  border-radius: 2px;
  display: inline-block;
}
.block-head .more {
  font-size: 12.5px;
  color: var(--blue);
  font-weight: 500;
}
.block-head .more:hover { color: var(--red); text-decoration: underline; }
.block-body { padding: 12px 16px; }

/* ===== Featured spotlight (main banner) — editorial dark navy ===== */
.spotlight {
  background:
    radial-gradient(circle at 92% 18%, rgba(42, 157, 143, 0.20) 0%, transparent 40%),
    linear-gradient(135deg, #1a2c4a 0%, #0f1c33 100%);
  color: white;
  padding: 24px 28px;
  border-radius: var(--r);
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
  border: 1px solid #0a1428;
}
/* Type-keyed background variants — match the chips: burgundy for Luật / Bộ
   luật, dental teal-green for Nghị định, navy for Thông tư (default). */
.spotlight.type-luat,
.spotlight.type-bo-luat {
  background:
    radial-gradient(circle at 92% 18%, rgba(255, 255, 255, 0.10) 0%, transparent 40%),
    linear-gradient(135deg, var(--red) 0%, var(--red-dark) 100%);
  border-color: #4a0d11;
}
.spotlight.type-nghidinh {
  background:
    radial-gradient(circle at 92% 18%, rgba(255, 255, 255, 0.14) 0%, transparent 40%),
    linear-gradient(135deg, var(--orange) 0%, var(--orange-dark) 100%);
  border-color: #086a52;
}
.spotlight.type-thongtu {
  background:
    radial-gradient(circle at 92% 18%, rgba(42, 157, 143, 0.20) 0%, transparent 40%),
    linear-gradient(135deg, var(--blue) 0%, var(--blue-dark) 100%);
  border-color: #0a1428;
}
/* Eyebrow chip — neutral white tint on any colored background. */
.spotlight.type-luat .spotlight-eyebrow,
.spotlight.type-bo-luat .spotlight-eyebrow,
.spotlight.type-nghidinh .spotlight-eyebrow {
  background: rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.92);
}
/* The default green primary CTA blends into a green Nghị định background;
   swap it for a high-contrast inverse (cream button, dark teal text). */
.spotlight.type-nghidinh .btn-cta {
  background: #fbf7ec;
  color: var(--orange-dark);
}
.spotlight.type-nghidinh .btn-cta:hover {
  background: #ffffff;
  color: var(--orange-dark);
}
.spotlight::before {
  content: "";
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 70% 60% at 80% 50%, black 0%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 80% 50%, black 0%, transparent 70%);
  pointer-events: none;
}
.spotlight-grid {
  display: block;
  position: relative;
}
.spotlight-eyebrow {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: Georgia, serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  background: rgba(42, 157, 143, 0.18);
  color: #7fc7be;
  padding: 3px 10px;
  border-radius: 2px;
  border: 1px solid rgba(42, 157, 143, 0.36);
}
.spotlight h1 {
  font-size: 24px;
  font-weight: 600;
  line-height: 1.2;
  margin: 10px 0 8px;
  letter-spacing: -0.01em;
  color: #f7f9fc;
}
.spotlight p {
  margin: 0 0 16px;
  font-size: 12.5px;
  color: rgba(247, 249, 252, 0.72);
  line-height: 1.6;
  max-width: 56ch;
}
.spotlight-actions {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap;
}
.spotlight .btn-cta {
  background: var(--orange);
  color: white;
  border: 1px solid rgba(255,255,255,0.06);
  padding: 8px 16px;
  font-weight: 600;
  font-size: 12.5px;
  letter-spacing: 0.01em;
  border-radius: 3px;
  display: inline-flex; align-items: center; gap: 6px;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s;
}
.spotlight .btn-cta:hover { background: var(--orange-dark); text-decoration: none; }
.spotlight .btn-cta-secondary {
  background: transparent;
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.32);
  padding: 7px 14px;
  font-weight: 500;
  font-size: 12.5px;
  letter-spacing: 0.01em;
  border-radius: 3px;
  display: inline-flex; align-items: center; gap: 6px;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.spotlight .btn-cta-secondary:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.55);
}
.spotlight-expired-wrap { position: relative; }
.spotlight-expired-wrap .btn-cta-secondary.open { background: rgba(255,255,255,0.12); border-color: white; }
.spotlight-expired-wrap .se-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 18px;
  padding: 0 6px;
  font-size: 11px; font-weight: 700;
  background: rgba(255,255,255,0.18);
  color: white; border-radius: 10px;
}
.spotlight-expired-menu {
  list-style: none; padding: 6px 0; margin: 6px 0 0;
  position: absolute; top: 100%; left: 0; min-width: 360px; max-width: 480px;
  background: white; color: var(--ink);
  border: 1px solid var(--line-strong);
  border-top: 3px solid var(--ink-soft);
  border-radius: 4px;
  box-shadow: 0 8px 22px rgba(0,0,0,0.22);
  z-index: 60;
}
.spotlight-expired-menu[hidden] { display: none; }
.spotlight-expired-menu li {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px; cursor: pointer;
  font-size: 13px; line-height: 1.35;
}
.spotlight-expired-menu li:hover { background: var(--blue-soft); }
.spotlight-expired-menu .se-type {
  flex-shrink: 0;
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  padding: 2px 8px; border-radius: 3px;
  background: var(--ink-soft); color: white;
  letter-spacing: 0.3px;
}
.spotlight-expired-menu .se-type.luat { background: var(--red); }
.spotlight-expired-menu .se-type.bo-luat { background: var(--red-dark); }
.spotlight-expired-menu .se-type.nghidinh { background: var(--orange); }
.spotlight-expired-menu .se-type.thongtu { background: var(--blue); }
.spotlight-expired-menu .se-body { display: flex; flex-direction: column; min-width: 0; }
.spotlight-expired-menu .se-title { font-weight: 600; color: var(--ink); }
.spotlight-expired-menu .se-meta { font-size: 11.5px; color: var(--ink-mute); margin-top: 1px; }
.spotlight-expired-menu .se-empty {
  padding: 14px 16px; cursor: default;
  color: var(--ink-mute); font-style: italic;
  text-align: center;
}
/* Horizontal statbar — replaces the 6 stat cards */
.spotlight-statbar-wrap {
  margin-top: 18px;
  border-top: 1px solid rgba(127, 199, 190, 0.25);
  padding-top: 14px;
}
.spotlight-statbar-title {
  font-family: Georgia, serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: rgba(247,242,228,0.55);
  margin-bottom: 10px;
}
.spotlight-statbar {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0;
}
.ss-item {
  flex: 1 1 0;
  min-width: 110px;
  display: flex; align-items: baseline; gap: 8px;
  padding: 4px 14px;
  border-left: 1px solid rgba(127, 199, 190, 0.18);
}
.ss-item:first-child { border-left: none; padding-left: 0; }
.ss-num {
  font-size: 22px; font-weight: 700;
  color: #7fc7be;
  letter-spacing: -0.01em;
  line-height: 1;
}
.ss-lbl {
  font-family: Georgia, serif;
  font-size: 11.5px; color: rgba(247,242,228,0.72);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.2;
}
.ss-item.type-boluat .ss-num { color: #e9b6b8; }
.ss-item.type-luat .ss-num { color: #7fc7be; }
.ss-item.type-nghidinh .ss-num { color: #efc28a; }
.ss-item.type-thongtu .ss-num { color: #b8c9e0; }
.ss-item.type-expired .ss-num { color: #b8b9bd; }
.ss-item.type-draft .ss-num { color: #c8b4e6; }

/* ===== "Văn bản mới" tabs ===== */
.tab-strip {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--orange);
  padding: 0 14px;
  background: white;
  align-items: stretch;
}
.tab-strip .tab {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  background: transparent;
  border: none;
  cursor: pointer;
  position: relative;
  display: inline-flex; align-items: center; gap: 5px;
  font-family: inherit;
}
.tab-strip .tab:hover { color: var(--blue); }
.tab-strip .tab.active {
  background: var(--orange);
  color: white;
  border-radius: 4px 4px 0 0;
}
.tab-strip .tab .badge {
  background: var(--bg-2);
  color: var(--ink-soft);
  padding: 1px 6px;
  font-size: 10.5px;
  border-radius: 999px;
  font-weight: 700;
}
.tab-strip .tab.active .badge { background: rgba(255,255,255,0.25); color: white; }

/* ===== Document list ===== */
.doc-list { list-style: none; margin: 0; padding: 0; }
.doc-list li {
  display: grid;
  grid-template-columns: 70px 1fr auto;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px dotted var(--line);
  align-items: center;
  cursor: pointer;
  transition: background 100ms;
}
.doc-list li:last-child { border-bottom: none; }
.doc-list li:hover { background: var(--paper-2); }

.dl-type {
  text-align: center;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: white;
  padding: 4px 0;
  border-radius: 3px;
}
.dl-type.luat     { background: var(--red); }
.dl-type.nghidinh { background: var(--blue); }
.dl-type.thongtu  { background: var(--ok); }
.dl-type.bo-luat  { background: #6b21a8; }

.dl-body { min-width: 0; }
.dl-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--link);
  line-height: 1.4;
  margin-bottom: 3px;
}
.doc-list li:hover .dl-title { color: var(--red); text-decoration: underline; }
.dl-meta {
  font-size: 12px;
  color: var(--ink-mute);
  display: flex; gap: 12px;
  flex-wrap: wrap;
}
.dl-meta .dl-num {
  font-family: ui-monospace, "Menlo", monospace;
  color: var(--ink-soft); font-weight: 600;
  font-size: 11.5px;
}
.dl-meta strong { color: var(--ink-soft); }

.dl-side { font-size: 11.5px; color: var(--ink-mute); text-align: right; white-space: nowrap; }
.dl-side .dl-date { display: block; }

/* ===== Status pills ===== */
.status {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.status.ok      { color: var(--ok);     background: var(--ok-bg); }
.status.expired { color: var(--neutral);background: var(--neutral-bg); }
.status.warn    { color: var(--warn);   background: var(--warn-bg); }
.status.hot     { color: var(--hot);    background: var(--hot-bg); }
.status.new     { color: var(--new);    background: var(--new-bg); }

/* ===== Sidebar (right) ===== */
.aside-block { margin-bottom: 18px; }
.aside-stats {
  background: linear-gradient(135deg, #1d4288 0%, #14306b 100%);
  color: white;
  border-radius: var(--r-md);
  padding: 18px;
}
.aside-stats h3 {
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #ffd9a8;
  margin: 0 0 14px;
}
.aside-stats ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.aside-stats li {
  background: rgba(255,255,255,0.08);
  border-radius: 4px;
  padding: 10px 12px;
}
.aside-stats .stat-num {
  font-size: 20px; font-weight: 700; color: white;
  display: block; line-height: 1;
}
.aside-stats .stat-lbl { font-size: 11px; color: rgba(255,255,255,0.65); margin-top: 4px; }

/* Hot list (compact ranked list) */
.hot-list { list-style: none; padding: 0; margin: 0; counter-reset: hot; }
.hot-list li {
  display: flex; gap: 10px;
  padding: 10px 0;
  border-bottom: 1px dotted var(--line);
  cursor: pointer;
  counter-increment: hot;
}
.hot-list li:last-child { border-bottom: none; }
.hot-list li::before {
  content: counter(hot);
  width: 22px; height: 22px;
  background: var(--bg-2);
  color: var(--ink-soft);
  border-radius: 4px;
  font-weight: 700; font-size: 11.5px;
  display: grid; place-items: center;
  flex-shrink: 0;
  font-family: ui-monospace, monospace;
}
.hot-list li:nth-child(1)::before { background: var(--red); color: white; }
.hot-list li:nth-child(2)::before { background: var(--orange); color: white; }
.hot-list li:nth-child(3)::before { background: var(--blue); color: white; }
.hot-list .h-title {
  font-size: 12.5px; font-weight: 600;
  color: var(--link); line-height: 1.4;
}
.hot-list li:hover .h-title { color: var(--red); text-decoration: underline; }
.hot-list .h-num {
  font-family: ui-monospace, monospace;
  font-size: 11px; color: var(--ink-mute);
  display: block; margin-top: 2px;
}

/* Quick links sidebar */
.quick-list { list-style: none; padding: 0; margin: 0; }
.quick-list li {
  border-bottom: 1px solid var(--line-soft);
}
.quick-list li:last-child { border-bottom: none; }
.quick-list a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 0;
  color: var(--ink);
  font-size: 13px;
  text-decoration: none;
}
.quick-list a:hover { color: var(--red); padding-left: 4px; }
.quick-list a::before {
  content: "›";
  color: var(--orange);
  font-weight: 700;
  font-size: 14px;
}

/* Newsletter card */
.newsletter {
  background: linear-gradient(135deg, var(--orange-soft) 0%, #ffd9a8 100%);
  border: 1px solid var(--orange);
  border-radius: var(--r-md);
  padding: 18px;
}
.newsletter h3 {
  font-size: 14px; margin: 0 0 6px;
  color: var(--orange-dark); font-weight: 700;
}
.newsletter p { font-size: 12px; color: var(--ink-soft); margin: 0 0 10px; line-height: 1.5; }
.newsletter form { display: flex; gap: 4px; }
.newsletter input {
  flex: 1; min-width: 0;
  padding: 7px 10px; font-size: 12.5px;
  border: 1px solid var(--orange);
  border-radius: 3px;
  outline: none;
}
.newsletter button {
  background: var(--orange-dark);
  color: white; border: none;
  padding: 7px 14px;
  font-size: 12.5px; font-weight: 600;
  border-radius: 3px;
}
.newsletter button:hover { background: var(--orange); }

/* ===== Field categories grid ===== */
.field-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.field-card {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 14px;
  display: flex; align-items: center; gap: 12px;
  cursor: pointer;
  transition: all 120ms;
  text-decoration: none;
  color: inherit;
}
.field-card:hover {
  border-color: var(--blue);
  background: white;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: inherit;
}
.field-icon {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 50%;
  flex-shrink: 0;
}
.field-icon svg { width: 20px; height: 20px; }
.field-icon.r1 { background: var(--red-soft);   color: var(--red); }
.field-icon.r2 { background: var(--blue-soft);  color: var(--blue); }
.field-icon.r3 { background: var(--ok-bg);      color: var(--ok); }
.field-icon.r4 { background: var(--orange-soft);color: var(--orange-dark); }
.field-name { font-size: 13px; font-weight: 600; color: var(--ink); }
.field-count { font-size: 11.5px; color: var(--ink-mute); margin-top: 1px; }

/* ===== Trending row ===== */
.trending-row {
  background: linear-gradient(90deg, var(--red-soft) 0%, var(--orange-soft) 100%);
  border: 1px solid var(--red-soft);
  padding: 10px 14px;
  border-radius: var(--r-sm);
  margin-bottom: 18px;
  display: flex; align-items: center; gap: 12px;
  font-size: 12.5px;
}
.trending-row .label {
  background: var(--red); color: white;
  padding: 3px 10px;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.4px;
  border-radius: 3px;
  text-transform: uppercase;
  flex-shrink: 0;
}
.trending-row .ticker {
  display: flex; gap: 18px;
  overflow: hidden;
  flex: 1;
}
.trending-row a { color: var(--ink); font-weight: 500; white-space: nowrap; text-decoration: none; }
.trending-row a:hover { color: var(--red); text-decoration: underline; }

/* ===== Footer ===== */
.site-footer {
  background: var(--blue-dark);
  color: rgba(255,255,255,0.78);
  padding: 32px 0 0;
  margin-top: 30px;
  border-top: 4px solid var(--orange);
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 32px;
  padding-bottom: 28px;
}
.footer-brand p {
  margin: 12px 0 0;
  font-size: 12.5px;
  color: rgba(255,255,255,0.6);
  line-height: 1.65;
  max-width: 360px;
}
.footer-brand .brand-name { color: white; font-size: 16px; }
.footer-brand .brand-tag { color: rgba(255,255,255,0.5); }
.footer-col h4 {
  color: var(--orange);
  font-size: 12px; font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin: 0 0 10px;
}
.footer-col a {
  color: rgba(255,255,255,0.78);
  font-size: 12.5px;
  display: block;
  padding: 4px 0;
  text-decoration: none;
}
.footer-col a:hover { color: var(--orange); text-decoration: underline; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding: 14px 0;
  text-align: center;
  font-size: 12px;
  color: rgba(255,255,255,0.5);
}

/* ============================================================
   AGENCIES (Hệ thống cơ quan Việt Nam)
   ============================================================ */
.agencies-page {
  padding: 14px 0 36px;
  animation: fadeIn 200ms ease;
}
/* Stack pillars vertically — each pillar is full-width, children flow as
   balanced columns inside it. This avoids the lopsided three-column
   layout where the Nhà nước pillar was much taller than the other two. */
.agencies-tree {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}
.ag-node {
  background: white;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 5px 9px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: opacity 0.18s ease;
}
/* Top-level pillar — full width; its label sits on top, children flow
   in a multi-column flow below. */
.ag-node.ag-depth-0 {
  border-top: 3px solid var(--red);
  padding: 8px 14px 12px;
  display: block;       /* override flex so .ag-children can be column-fill */
}
.ag-node.ag-depth-0.ag-kind-party { border-top-color: #b3261e; }
.ag-node.ag-depth-0.ag-kind-state { border-top-color: var(--red); }
.ag-node.ag-depth-0.ag-kind-front { border-top-color: var(--blue); }
.ag-node.ag-depth-0 > .ag-card {
  padding-bottom: 7px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
/* Tier-1 children laid out as balanced multi-column flow inside the pillar.
   break-inside ensures each Tier-1 group (e.g. Chính phủ + its children)
   stays in one column. */
.ag-node.ag-depth-0 > .ag-children {
  column-width: 240px;
  column-gap: 18px;
  display: block;
  border-left: 0;
  padding-left: 0;
  margin-left: 0;
}
.ag-node.ag-depth-0 > .ag-children > .ag-node {
  break-inside: avoid;
  margin-bottom: 8px;
}
.ag-card {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: space-between;
  min-height: 0;
}
.ag-label {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--ink);
  line-height: 1.3;
}
.ag-node.ag-depth-0 .ag-label {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 13.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.2;
}
.ag-node.ag-depth-1 .ag-label {
  font-size: 12.5px;
  font-weight: 700;
}
.ag-node.ag-depth-2 .ag-label,
.ag-node.ag-depth-3 .ag-label {
  font-size: 11.5px;
  font-weight: 500;
}
.ag-children {
  display: flex;
  flex-direction: column;
  gap: 3px;
  border-left: 1px solid var(--line);
  padding-left: 8px;
  margin-left: 2px;
  margin-top: 4px;
}
.ag-children .ag-node {
  background: rgba(125, 29, 34, 0.02);
  border: 1px solid var(--line);
  border-left: 2px solid transparent;
  padding: 4px 8px;
  margin-bottom: 0;
  border-radius: 4px;
}
.ag-children .ag-node:hover { border-left-color: var(--red); }
.ag-children .ag-children { border-left-color: rgba(125, 29, 34, 0.16); }
.ag-mark {
  width: 8px; height: 8px;
  border-radius: 99px;
  background: var(--red);
  flex-shrink: 0;
  font-size: 0;
}
.ag-node.ag-highlight {
  background: rgba(125, 29, 34, 0.08);
  border-color: var(--red);
}
.ag-node.ag-highlight .ag-label {
  color: var(--red);
  font-weight: 700;
}
.ag-node.ag-dim { opacity: 0.42; }
.ag-node.ag-dim:hover { opacity: 1; }

/* Make the Nơi nhận header into a hyperlink */
.doc-body .doc-signature a.sig-recipients-head {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--red);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.12s ease;
  cursor: pointer;
}
.doc-body .doc-signature a.sig-recipients-head:hover {
  border-bottom-color: var(--red);
}
.doc-body .doc-signature a.sig-recipients-head svg {
  opacity: 0.7;
}

/* ============================================================
   OVERVIEW — magazine layout
   ============================================================ */

.overview-page {
  padding: 14px 0 32px;
  animation: fadeIn 200ms ease;
}

/* Masthead — bold title + inline stats strip */
.mag-masthead {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 0 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}
.mag-masthead h1 {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0;
  line-height: 1.15;
}
.mag-stats {
  display: flex;
  gap: 18px;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  color: var(--ink-mute);
  letter-spacing: 0.02em;
  flex-wrap: wrap;
}
.mag-stats strong {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--red);
  margin-right: 5px;
}

/* Magazine sections — flat, no card chrome. Section heads are inline
   eyebrow + title, separated by a thin red rule. */
.mag-section {
  margin: 0 0 26px;
}
.mag-section-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 0 0 12px;
  padding: 0 0 6px;
  border-bottom: 1px solid var(--line);
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
  flex-wrap: wrap;
}
.mag-section-tag {
  display: inline-flex;
  align-items: center;
  font-family: 'Inter', sans-serif;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--red);
  background: rgba(125, 29, 34, 0.08);
  padding: 3px 9px;
  border-radius: 99px;
  flex-shrink: 0;
}

/* HP strip — horizontal flow of chips. Active one is filled burgundy. */
.hp-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.hp-chip {
  background: white;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 12px;
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.hp-chip:hover {
  border-color: var(--red);
  transform: translateY(-1px);
}
.hp-chip-active {
  background: linear-gradient(135deg, rgba(125, 29, 34, 0.97), rgba(95, 19, 24, 0.97));
  border-color: transparent;
  color: white;
}
.hp-chip-active:hover {
  box-shadow: 0 4px 12px rgba(125, 29, 34, 0.25);
}
.hp-chip-active .hp-chip-title { color: white; }
.hp-chip-active .hp-chip-meta { color: rgba(255,255,255,0.78); }
.hp-chip-pill {
  font-family: 'Inter', sans-serif;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.78);
  margin-bottom: 1px;
}
.hp-chip-title {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
  color: var(--ink);
}
.hp-chip-meta {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  color: var(--ink-mute);
  letter-spacing: 0.02em;
}
.hp-chip-past {
  background: rgba(125, 29, 34, 0.04);
}

/* Hiến pháp spotlight chip color (when user opens HP doc) */
.spotlight.type-hienphap {
  background: linear-gradient(135deg, rgba(125, 29, 34, 0.98), rgba(85, 16, 21, 0.98));
  color: white;
}
.spotlight.type-hienphap h1,
.spotlight.type-hienphap p { color: white; }

/* Override industry-card to match magazine density (slightly tighter padding,
   match Inter-everywhere look while keeping serif name) */
.overview-page .industry-card {
  padding: 10px 12px;
}
.overview-page .bl-card {
  padding: 8px 11px;
}

@media (max-width: 720px) {
  .mag-stats { gap: 12px; font-size: 11px; }
  .mag-stats strong { font-size: 14px; }
}

/* ============================================================
   VIEWER (document detail)
   ============================================================ */

.viewer-page {
  padding: 14px 0 30px;
  animation: fadeIn 200ms ease;
}

.viewer-grid {
  display: grid;
  grid-template-columns: 260px 1fr 280px;
  gap: 18px;
  align-items: start;
}

/* Viewer sidebars */
.sidecard {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  margin-bottom: 16px;
  overflow: hidden;
}
.sidecard-head {
  background: var(--paper-2);
  padding: 9px 13px;
  font-size: 12px; font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--blue-dark);
  border-bottom: 2px solid var(--orange);
  display: flex; align-items: center; justify-content: space-between;
}
.sidecard-head .count {
  background: var(--red); color: white;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10.5px; font-weight: 700;
}
.sidecard-body { padding: 10px 12px; font-size: 13px; }

.side-search { position: relative; padding: 10px 12px; }
#side-search-input {
  width: 100%;
  background: white;
  border: 1px solid var(--line-strong);
  padding: 7px 10px;
  font-size: 12.5px;
  border-radius: 4px;
}
#side-search-input:focus {
  outline: none; border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-soft);
}
.suggestions.side {
  top: calc(100% + 2px);
  left: 12px; right: 12px;
  font-size: 12.5px;
  max-height: 320px;
}

.toc {
  font-size: 12.5px;
  display: flex; flex-direction: column; gap: 0;
  max-height: 400px;
  overflow-y: auto;
  padding: 4px 0;
}
.toc a {
  color: var(--ink-soft);
  text-decoration: none;
  padding: 5px 12px;
  display: block;
  border-left: 2px solid transparent;
  cursor: pointer; line-height: 1.4;
}
.toc a:hover { background: var(--blue-soft); color: var(--blue-dark); text-decoration: none; }
.toc a.chapter {
  font-weight: 700; color: var(--ink);
  margin-top: 4px; font-size: 11.5px;
  text-transform: uppercase; letter-spacing: 0.3px;
  cursor: default;
  background: var(--paper-2);
  padding: 5px 12px 5px 10px;
}
.toc a.chapter:hover { background: var(--paper-2); color: var(--ink); }
.toc a.article { padding-left: 18px; font-size: 12px; }
.toc a.article.active {
  color: var(--red); background: var(--red-soft);
  border-left-color: var(--red); font-weight: 600;
}

.related-docs { list-style: none; margin: 0; padding: 0; font-size: 12.5px; }
.related-docs li {
  padding: 8px 0;
  border-bottom: 1px dotted var(--line);
  cursor: pointer;
}
.related-docs li:last-child { border-bottom: none; }
.related-docs li:hover .related-num { color: var(--red); }
.related-docs li[data-disabled] { cursor: default; opacity: 0.7; }
.related-docs .related-num {
  font-family: ui-monospace, monospace;
  font-weight: 700; font-size: 11.5px;
  color: var(--link); display: block;
}
.related-docs .related-title { font-size: 12px; color: var(--ink-mute); display: block; margin-top: 2px; line-height: 1.4; }

/* Viewer main */
.viewer-main {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  min-width: 0;
  overflow: hidden;
}

.doc-titlebar {
  padding: 10px 24px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  position: relative;
}
.doc-titlebar .dt-row1 {
  display: flex; align-items: center; gap: 12px;
  flex-wrap: wrap;
}
.doc-titlebar .type-pill {
  display: inline-flex; align-items: center;
  font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.6px; text-transform: uppercase;
  color: var(--red); background: var(--red-soft);
  padding: 3px 8px;
  border-radius: 3px;
  flex-shrink: 0;
  font-family: "Inter", system-ui, sans-serif;
}
.doc-titlebar h1 {
  font-size: 17px; font-weight: 700;
  margin: 0; color: var(--ink);
  line-height: 1.3;
  letter-spacing: -0.1px;
  flex: 1; min-width: 0;
}
.doc-titlebar .dt-row1 .status {
  flex-shrink: 0;
  font-size: 10px;
  letter-spacing: 0.5px;
  padding: 2px 8px;
}
.doc-titlebar .dt-row2 {
  display: flex; align-items: center; gap: 6px;
  flex-wrap: wrap;
  margin-top: 5px;
  font-size: 11.5px;
  color: var(--ink-soft);
  font-family: "Inter", system-ui, sans-serif;
}
.doc-titlebar .dt-row2 strong {
  font-weight: 600;
  color: var(--ink);
  font-feature-settings: "tnum";
}
.doc-titlebar .dt-issuer { color: var(--ink); font-weight: 500; }
.doc-titlebar .dt-sep { color: var(--ink-faint); }
.doc-titlebar .dt-coverage.full { color: var(--ok); font-weight: 600; }
.doc-titlebar .dt-coverage.partial { color: var(--warn); font-weight: 600; }
.doc-titlebar .dt-source {
  display: inline-block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--blue);
  font-weight: 600;
}
.doc-titlebar .dt-source:hover { text-decoration: underline; }

/* Tabs (within doc) */
.tabbar {
  display: flex;
  background: var(--paper-2);
  border-bottom: 2px solid var(--orange);
  padding: 0;
  position: sticky; top: 47px; z-index: 5;
}
.tabbar .tab {
  border: none; background: transparent;
  padding: 9px 16px; font-size: 12.5px;
  font-weight: 600; color: var(--ink-soft);
  cursor: pointer;
  border-right: 1px solid var(--line);
  font-family: inherit;
  display: inline-flex; align-items: center; gap: 5px;
}
.tabbar .tab:hover { color: var(--blue); background: white; }
.tabbar .tab.active {
  background: var(--orange); color: white;
}
.tabbar .tab .badge {
  background: var(--bg-2); color: var(--ink-soft);
  padding: 1px 6px; font-size: 10.5px;
  border-radius: 999px; font-weight: 700;
}
.tabbar .tab.active .badge { background: rgba(255,255,255,0.25); color: white; }
.tabbar .tab-spacer { flex: 1; pointer-events: none; border-right: none; padding: 0; }
.tabbar .tab.action {
  font-weight: 500; color: var(--link);
  font-size: 12px;
}
.tabbar .tab.action:hover { background: white; color: var(--red); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.read-toolbar {
  display: flex; align-items: center; gap: 12px;
  background: white;
  border-bottom: 1px solid var(--line);
  padding: 8px 24px;
  font-size: 12px;
}
.read-toolbar .lbl {
  color: var(--ink-mute);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-size: 11px; font-weight: 600;
}
.tool-group {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}
.tool-btn {
  border: none; background: white;
  color: var(--ink-soft);
  padding: 4px 10px; font-size: 11.5px;
  border-right: 1px solid var(--line);
  font-weight: 500;
  display: inline-flex; align-items: center; gap: 5px;
}
.tool-btn:last-child { border-right: none; }
.tool-btn:hover { background: var(--blue-soft); color: var(--blue-dark); }
.tool-btn.active { background: var(--orange); color: white; }
.read-toolbar .spacer { flex: 1; }

/* Standalone "Tìm" button in the read-toolbar (not in a tool-group) */
.tool-btn.tool-find-toggle {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 4px 10px;
}

/* Find-in-doc bar */
.find-bar {
  display: flex; align-items: center; gap: 8px;
  background: white;
  border-bottom: 1px solid var(--line);
  padding: 7px 24px;
  position: sticky;
  top: 0;
  z-index: 5;
  box-shadow: 0 1px 0 rgba(15, 28, 51, 0.04);
}
.find-bar .find-bar-icon {
  color: var(--ink-mute);
  flex-shrink: 0;
}
.find-bar input {
  flex: 1;
  min-width: 0;
  max-width: 400px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 5px 9px;
  font: inherit;
  font-size: 12.5px;
  color: var(--ink);
  background: white;
  outline: none;
  transition: border-color 0.12s ease;
}
.find-bar input:focus {
  border-color: var(--red);
}
.find-bar input::placeholder {
  color: var(--ink-mute);
  font-style: italic;
}
.find-bar .find-count {
  font-family: 'Inter', sans-serif;
  font-size: 11.5px;
  color: var(--ink-mute);
  min-width: 38px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.find-bar .find-btn {
  border: 1px solid var(--line);
  background: white;
  color: var(--ink-soft);
  border-radius: 4px;
  padding: 4px 7px;
  cursor: pointer;
  display: inline-flex; align-items: center;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.find-bar .find-btn:hover {
  background: rgba(125, 29, 34, 0.08);
  color: var(--red);
  border-color: var(--red);
}
.find-bar .find-close { margin-left: 4px; }

/* Highlight marks */
mark.vbpl-find-hit {
  background: #fef08a;
  color: inherit;
  padding: 0 1px;
  border-radius: 2px;
  box-decoration-break: clone;
}
mark.vbpl-find-hit.current {
  background: #f97316;
  color: white;
  outline: 2px solid #f97316;
  outline-offset: 1px;
}

/* Doc body — Source Serif 4 (loaded at top of <head>) for clean legal-text
   reading; tighter line-height than the previous 1.85 because Vietnamese
   legal text already has many short numbered/lettered paragraphs and the
   extra leading made the page feel sparse. */
.doc-body {
  padding: 28px clamp(20px, 4vw, 48px) 48px;
  font-size: var(--read-size);
  line-height: 1.55;
  color: #1f2733;
  font-family: "Source Serif 4", Georgia, "Iowan Old Style", serif;
  max-width: var(--read-width);
  margin: 0 auto;
}
.doc-body.wide { max-width: 100%; }

/* Appendix sections inline in article body — visual hierarchy mirroring the
   published Vietnamese gov document layout. Triggered for ~35 docs that
   have 'PHỤ LỤC I/II/III…' embedded in their last article's plain-text
   body (e.g. NĐ 57/2025 DPPA, NĐ 80/2024, BLHS 2015, Luật Đất đai 2024). */
.doc-body h3.appendix-heading {
  font-family: Tahoma, Arial, sans-serif;
  text-align: center;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 1.2px;
  margin: 48px 0 4px;
  color: var(--ink);
  text-transform: uppercase;
  scroll-margin-top: 110px;
}
.doc-body .appendix-subtitle {
  font-family: Tahoma, Arial, sans-serif;
  text-align: center;
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: 0.4px;
  margin: 0 auto 8px;
  max-width: 88%;
  color: var(--ink);
  text-transform: uppercase;
  line-height: 1.35;
}
.doc-body .appendix-attr {
  font-style: italic;
  text-align: center;
  color: var(--ink-mute);
  font-size: calc(var(--read-size) - 1px);
  margin: 4px 0 20px;
}
.doc-body h4.appendix-table-head {
  font-family: Tahoma, Arial, sans-serif;
  font-weight: 700;
  font-size: calc(var(--read-size) + 0.5px);
  margin: 22px 0 8px;
  color: var(--ink);
  scroll-margin-top: 110px;
}
.doc-body h4.appendix-form-label {
  font-family: Tahoma, Arial, sans-serif;
  font-weight: 700;
  font-style: italic;
  font-size: calc(var(--read-size) - 0.5px);
  text-align: right;
  color: var(--ink-mute);
  margin: 18px 0 4px;
}
.doc-body h4.appendix-roman-head {
  font-family: Tahoma, Arial, sans-serif;
  font-weight: 700;
  font-size: calc(var(--read-size) + 1px);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  text-align: center;
  margin: 22px 0 10px;
  color: var(--ink);
  scroll-margin-top: 110px;
}

/* Form-template lines inside appendices (templates for application
   letters, declarations, etc. embedded as the appendix content). */
.doc-body .form-quoc-hieu {
  font-family: Tahoma, Arial, sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  text-align: center;
  font-size: calc(var(--read-size) + 0.5px);
  letter-spacing: 0.3px;
  margin: 18px 0 2px;
  color: var(--ink);
}
.doc-body .form-tieu-ngu {
  font-family: Tahoma, Arial, sans-serif;
  font-weight: 700;
  text-align: center;
  font-size: calc(var(--read-size) - 0.5px);
  letter-spacing: 0.2px;
  margin: 0 0 4px;
  color: var(--ink);
}
.doc-body .form-divider {
  text-align: center;
  color: var(--ink-mute);
  letter-spacing: 2px;
  margin: 0 auto 18px;
  user-select: none;
}
.doc-body .form-place-date {
  text-align: right;
  font-style: italic;
  font-size: calc(var(--read-size) - 0.5px);
  color: var(--ink-mute);
  margin: 6px 0 14px;
}
.doc-body p.form-greeting {
  text-align: center;
  font-weight: 600;
  font-style: italic;
  margin: 14px 0 12px;
  color: var(--ink);
}
.doc-body p.form-cancu {
  font-style: italic;
  color: var(--ink);
  margin-left: 0;
}

/* Closing signature block: "Nơi nhận" + signer.
   Styled to resemble the formal Vietnamese government document layout —
   recipients on the left, signer block on the right.  */
.doc-body .doc-signature {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(180px, 1fr);
  gap: 28px;
  margin: 30px 0 8px;
  padding-top: 18px;
  border-top: 1px solid var(--line-strong);
  align-items: start;
  font-family: Tahoma, Arial, sans-serif;
}
.doc-body .doc-signature .sig-recipients-head {
  font-size: calc(var(--read-size) - 1px);
  font-weight: 700;
  font-style: italic;
  margin: 0 0 6px;
  color: var(--ink);
  letter-spacing: 0.02em;
}
.doc-body .doc-signature .sig-recipients ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.doc-body .doc-signature .sig-recipients li {
  position: relative;
  padding: 1px 0 1px 14px;
  font-size: calc(var(--read-size) - 2px);
  line-height: 1.4;
  color: var(--ink);
}
.doc-body .doc-signature .sig-recipients li::before {
  content: "–";
  position: absolute;
  left: 0;
  color: var(--ink-mute);
}
.doc-body .doc-signature .sig-signer {
  text-align: center;
  padding-top: 4px;
}
.doc-body .doc-signature .sig-line {
  font-size: calc(var(--read-size) - 1px);
  line-height: 1.4;
  letter-spacing: 0.04em;
}
.doc-body .doc-signature .sig-onbehalf {
  font-weight: 700;
  text-transform: uppercase;
  color: var(--ink);
}
.doc-body .doc-signature .sig-position {
  font-weight: 700;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: 36px;          /* space reserved for the seal/signature */
}
.doc-body .doc-signature .sig-mark {
  font-style: italic;
  color: var(--ink-mute);
  font-size: calc(var(--read-size) - 2px);
  margin-bottom: 4px;
}
.doc-body .doc-signature .sig-name {
  font-weight: 700;
  font-size: calc(var(--read-size) + 0.5px);
  color: var(--ink);
  font-family: 'Source Serif 4', Georgia, serif;
  letter-spacing: 0;
}

/* Tables in article body (appendix tables, e.g. QĐ 768 PDP8 phụ lục) */
.doc-body .art-table-wrap {
  margin: 14px 0 18px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.doc-body .art-table {
  border-collapse: collapse;
  width: 100%;
  font-size: calc(var(--read-size) - 1px);
  font-family: 'Inter', Arial, sans-serif;
  background: white;
}
.doc-body .art-table th,
.doc-body .art-table td {
  border: 1px solid var(--line-strong);
  padding: 6px 10px;
  vertical-align: top;
  text-align: left;
  line-height: 1.4;
}
.doc-body .art-table th {
  background: rgba(125, 29, 34, 0.06);
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.02em;
}
.doc-body .art-table tbody tr:nth-child(even) td {
  background: rgba(125, 29, 34, 0.025);
}
.doc-body .art-table tbody tr:hover td {
  background: rgba(125, 29, 34, 0.06);
}
/* Cells where the published value is literal "0" / "0,0" / "0.0" are
   rendered as a muted en-dash via the renderer. Style here just dims the
   color so the eye skips them in favour of real numbers. */
.doc-body .art-table .td-zero {
  color: rgba(31, 39, 51, 0.30);
  font-variant-numeric: tabular-nums;
}

/* Banner row — a single-cell row in a multi-column table acts as a
   section divider inside the table (e.g. "Phần I", "THÔNG TIN VỀ ĐỐI
   TƯỢNG BÁO CÁO"). Centre + bold so it reads as a heading, not data. */
.doc-body .art-table tbody tr.art-row-banner td,
.doc-body .art-table tbody tr.art-row-banner th {
  text-align: center;
  font-weight: 700;
  background: rgba(125, 29, 34, 0.05);
  letter-spacing: 0.02em;
  color: var(--ink);
}

/* Form-template tables (Mẫu số ...) — lighter weight than data tables.
   Drop zebra striping, use thinner borders, smaller font. Distinguishes
   "fill-in form" tables from "actual data" tables visually. */
.doc-body .art-table.art-table-form {
  background: var(--paper);
  border: 1px solid var(--line);
}
.doc-body .art-table.art-table-form th,
.doc-body .art-table.art-table-form td {
  border-color: rgba(200, 192, 168, 0.6);
  padding: 5px 9px;
  font-size: calc(var(--read-size) - 1.5px);
  background: white;
}
.doc-body .art-table.art-table-form tbody tr:nth-child(even) td {
  background: white;
}
.doc-body .art-table.art-table-form tbody tr:hover td {
  background: rgba(125, 29, 34, 0.025);
}
.doc-body .art-table.art-table-form tbody tr.art-row-banner td {
  background: rgba(31, 39, 51, 0.04);
  font-weight: 600;
  font-size: calc(var(--read-size) - 1px);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Checkbox cells — leading "☐" gets replaced with a pseudo box so the
   form-template visual reads as an interactive control even though it
   isn't actually fillable. */
.doc-body .art-table .td-checkbox {
  position: relative;
  padding-left: 22px;
}
.doc-body .art-table .td-checkbox::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 50%;
  transform: translateY(-50%);
  width: 11px;
  height: 11px;
  border: 1.5px solid var(--ink-mute);
  border-radius: 2px;
  background: white;
}
/* Heading hierarchy — three clear visual levels, each obviously larger and
   heavier than the next, with generous spacing to break up dense legal text:
     h2.chapter   (CHƯƠNG I)             — biggest, all caps, top spacing
     .chapter-title (NHỮNG QUY ĐỊNH CHUNG) — same size as chapter, semibold
     h3.article   (Điều X. Heading text) — clearly larger than body, bold
*/
.doc-body h2.chapter {
  text-align: center;
  font-size: calc(var(--read-size) + 7px);
  margin: 44px 0 6px;
  text-transform: uppercase; letter-spacing: 0.8px;
  font-weight: 700; color: var(--ink);
  font-family: Tahoma, Arial, sans-serif;
  line-height: 1.2;
}
.doc-body h2.chapter:first-child { margin-top: 4px; }
.doc-body .chapter-title {
  text-align: center;
  font-size: calc(var(--read-size) + 4px);
  font-weight: 700;
  margin-bottom: 28px;
  color: var(--ink);
  font-family: Tahoma, Arial, sans-serif;
  line-height: 1.3;
  letter-spacing: 0.2px;
  text-transform: uppercase;
}
.doc-body h3.article {
  font-size: calc(var(--read-size) + 2.5px);
  font-weight: 700;
  margin: 32px 0 12px;
  color: var(--ink);
  scroll-margin-top: 110px;
  font-family: Tahoma, Arial, sans-serif;
  display: flex; align-items: baseline; gap: 8px;
  line-height: 1.35;
  letter-spacing: -0.1px;
}
.doc-body h3.article:first-of-type { margin-top: 14px; }
.doc-body h3.article .anchor-link {
  opacity: 0; font-size: 12px;
  color: var(--ink-faint); text-decoration: none;
  font-weight: 400; cursor: pointer;
  transition: opacity 100ms;
  flex-shrink: 0;
}
.doc-body h3.article:hover .anchor-link { opacity: 1; }
.doc-body h3.article .anchor-link:hover { color: var(--red); }
.doc-body h3.article.flash { animation: flashHighlight 1.4s ease; }
@keyframes flashHighlight {
  0% { background: var(--ref-bg); }
  100% { background: transparent; }
}

/* Body paragraphs — clearer spacing between clauses, deeper indent for
   points, and a subtle weight bump for the leading clause number. */
.doc-body p { margin: 4px 0; text-align: justify; line-height: 1.55; }
.doc-body p.clause {
  margin: 8px 0 4px;
  text-indent: 0;
}
.doc-body p.point {
  margin: 2px 0 2px 22px;
  text-align: justify;
  color: rgba(31, 39, 51, 0.94);
}
/* Bolder leading number for clauses — purely cosmetic via first-line
   variant; no DOM change needed. */
.doc-body p.clause::first-letter {
  font-weight: 600;
}

/* Lược đồ */
.luocdo { padding: 22px 24px; }
.luocdo h2 {
  font-size: 16px; margin: 0 0 16px;
  color: var(--blue-dark); font-weight: 700;
  border-bottom: 2px solid var(--orange);
  padding-bottom: 8px;
}
.ld-group { margin-bottom: 20px; }
.ld-label {
  font-size: 11.5px; font-weight: 700;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 8px;
}
.ld-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.ld-list li {
  padding: 10px 14px;
  border: 1px solid var(--line);
  background: var(--paper-2);
  font-size: 12.5px;
  cursor: pointer;
  display: flex; align-items: center; gap: 10px;
  border-radius: var(--r-sm);
  border-left: 3px solid var(--red);
}
.ld-list li:hover { background: var(--blue-soft); }
.ld-list li[data-disabled] { cursor: default; opacity: 0.7; border-left-color: var(--ink-faint); }
.ld-num {
  font-family: ui-monospace, monospace;
  font-weight: 700; font-size: 11.5px;
  background: var(--blue-dark); color: white;
  padding: 2px 8px; border-radius: 3px;
}
.ld-title { color: var(--ink); font-weight: 500; }
.ld-empty {
  color: var(--ink-mute); font-style: italic;
  font-size: 12.5px; padding: 12px;
  background: var(--paper-2); border-radius: var(--r-sm);
  border: 1px dashed var(--line);
}

/* Viewer top action row — back button etc. */
.viewer-actions {
  padding: 10px 0 6px;
  display: flex; align-items: center; gap: 8px;
}
.btn-back {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px;
  background: var(--paper);
  color: var(--ink-soft);
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  font-family: "Inter", "Segoe UI", sans-serif;
  font-size: 12px; font-weight: 600; cursor: pointer;
  letter-spacing: 0.01em;
  transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.btn-back:hover {
  background: var(--orange);
  color: white;
  border-color: var(--orange);
  box-shadow: 0 1px 3px rgba(15, 168, 132, 0.30);
}

/* Sơ đồ — concentric-ring network diagram of related docs */
.sodo { padding: 22px 24px; }
.sodo h2 {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 22px;
  color: var(--ink);
  margin: 0 0 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
/* Hệ thống văn bản — hierarchical pyramid (master Luật → NĐ → TT) */
.ht-subsectors {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  overflow: hidden;
}
.ht-subsectors > .ht-tier-label {
  padding: 10px 16px;
  background: var(--paper-2);
  border-bottom: 1px solid var(--line);
  margin: 0;
}
.ht-subsectors .st-groups { display: block; }
.ht-subsectors .st-leaf.current {
  background: #fbf3d4;
  border-left: 3px solid #7d1d22;
  padding-left: 55px;
}

.ht-meta {
  font-family: "Inter", sans-serif;
  font-size: 11.5px; color: var(--ink-mute);
  margin: 6px 0 18px;
  display: flex; gap: 8px; align-items: baseline;
}
.ht-meta strong { color: var(--ink); font-weight: 700; }
.ht-meta-sep { opacity: 0.4; }
.ht-meta-empty { font-style: italic; }

.ht-pyramid { display: flex; flex-direction: column; align-items: stretch; }
.ht-tier {
  position: relative;
  padding: 16px 0;
  border-bottom: 1px dashed var(--line);
}
.ht-tier:last-child { border-bottom: none; }
.ht-tier-label {
  font-family: "Inter", sans-serif;
  font-size: 10px; text-transform: uppercase; letter-spacing: 1.4px;
  color: var(--ink-mute); font-weight: 700;
  margin-bottom: 10px;
}
.ht-tier-1 { text-align: center; }
.ht-master-hint {
  margin-top: 8px; font-size: 11px; color: var(--ink-soft);
  font-style: italic;
}
.ht-tier-2 .ht-tier-label,
.ht-tier-3 .ht-tier-label { color: var(--ink-soft); }

.ht-grid {
  display: grid;
  gap: 8px;
}
.ht-grid-nghidinh { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.ht-grid-thongtu { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }

.ht-card {
  display: flex; flex-direction: column; gap: 3px;
  padding: 8px 12px;
  background: white;
  border: 1px solid var(--line);
  border-left: 3px solid var(--line);
  border-radius: 4px;
  text-align: left; cursor: pointer;
  font-family: inherit;
  transition: border-color 100ms, background 100ms, transform 100ms;
}
.ht-card:hover {
  border-color: var(--ink-mute);
  background: var(--paper-2);
  transform: translateY(-1px);
}
.ht-card.type-luat,
.ht-card.type-bo-luat { border-left-color: #7d1d22; }
.ht-card.type-nghidinh { border-left-color: #15a884; }
.ht-card.type-thongtu { border-left-color: #1a2c4a; }
.ht-card.current {
  background: #fbf3d4;
  border-color: #7d1d22;
  border-left-width: 5px;
}

.ht-card-lg {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 14px 22px;
  border: 1px solid var(--line);
  border-top: 4px solid #7d1d22;
  border-left: 1px solid var(--line);
  background: var(--paper-2);
  max-width: 480px;
  margin: 0 auto;
}
.ht-card-lg .ht-card-pill {
  font-size: 10.5px;
  color: var(--red);
}
.ht-card-lg .ht-card-title {
  font-size: 16px;
  font-family: Georgia, "Source Serif 4", serif;
  font-weight: 700;
}
.ht-card-md .ht-card-title { font-size: 12.5px; }
.ht-card-sm {
  padding: 6px 10px;
}
.ht-card-sm .ht-card-pill { font-size: 9px; }
.ht-card-sm .ht-card-title { font-size: 11.5px; }
.ht-card-sm .ht-card-date { font-size: 10px; }

.ht-card-pill {
  font-family: "Inter", sans-serif;
  font-size: 9.5px; font-weight: 700;
  letter-spacing: 0.4px; text-transform: uppercase;
  color: var(--ink-mute);
}
.ht-card-title {
  font-family: Georgia, "Source Serif 4", serif;
  font-size: 12.5px; font-weight: 600;
  color: var(--ink); line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ht-card-date {
  font-family: "Inter", sans-serif;
  font-size: 10.5px; color: var(--ink-mute);
  font-feature-settings: "tnum";
  margin-top: 2px;
}

/* Sơ đồ — branching tree of evolution (SVG) */
.evt-meta {
  font-family: "Inter", sans-serif;
  font-size: 11px; color: var(--ink-mute);
  margin: 4px 0 8px;
  display: flex; gap: 6px; align-items: baseline;
}
.evt-meta strong { color: var(--ink); font-weight: 700; }
.evt-meta-sep { opacity: 0.4; }
.evt-zoom-controls {
  display: inline-flex; align-items: center; gap: 4px;
  margin-left: auto;
}
.evt-zoom-btn {
  border: 1px solid var(--line); background: white;
  width: 22px; height: 22px;
  font-family: "Inter", sans-serif; font-size: 13px; font-weight: 700;
  color: var(--ink-soft); cursor: pointer;
  border-radius: 3px;
  padding: 0; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.evt-zoom-btn:hover { background: var(--paper-2); color: var(--ink); }
.evt-zoom-pct {
  font-family: "Inter", sans-serif; font-size: 10.5px;
  font-weight: 600; color: var(--ink-mute);
  min-width: 32px; text-align: right;
  margin-left: 2px;
  font-feature-settings: "tnum";
}
.evt-meta { justify-content: flex-start; }

.evt-wrap { padding: 2px 0; overflow: auto; max-height: 78vh; }
.evt-svg { display: block; margin: 0 auto; }
.evt-svg-v { max-width: 900px; width: 100%; height: auto; }
.evt-svg-h { /* keep natural width set via SVG attrs; container scrolls */ }
.evt-axis-label { font-family: "Inter", sans-serif; font-size: 11px; font-weight: 700; fill: var(--ink-mute); user-select: none; }
.evt-year-toggle:hover .evt-axis-label { fill: var(--ink); }
.evt-collapsed-rect {
  fill: var(--paper-2); stroke: var(--ink-mute);
  stroke-width: 1.5; stroke-dasharray: 4 3;
}
.evt-collapsed-group:hover .evt-collapsed-rect { stroke: var(--ink); }
.evt-fo-collapsed { font-style: italic; opacity: 0.9; }
.evt-fo-collapsed .evt-fo-title { color: var(--ink-soft); }
.evt-axis-line { stroke: var(--line); stroke-dasharray: 3 4; }
.evt-edge { fill: none; stroke-width: 2; }
.evt-edge-replace { stroke: #7d1d22; stroke-width: 2.5; }
.evt-edge-amend { stroke: #b78a3e; stroke-dasharray: 5 4; }
.evt-edge-elevate { stroke: #15a884; stroke-width: 2.5; }
.evt-node-rect { fill: white; stroke: var(--line); stroke-width: 1.5; }
.evt-node-rect.luat,
.evt-node-rect.bo-luat { stroke: #7d1d22; }
.evt-node-rect.nghidinh { stroke: #15a884; }
.evt-node-rect.thongtu { stroke: #1a2c4a; }
.evt-node-rect.current {
  fill: #fbf3d4;
  stroke: #7d1d22; stroke-width: 3;
}
.evt-node-num {
  font-family: "Inter", sans-serif; font-size: 9.5px; font-weight: 700;
  letter-spacing: 0.4px; fill: var(--ink-mute);
  text-transform: uppercase;
}
.evt-node-num.current { fill: #7d1d22; }
.evt-node-title {
  font-family: Georgia, "Source Serif 4", serif; font-size: 12.5px; font-weight: 700;
  fill: var(--ink);
}
.evt-node-sub {
  font-family: "Inter", sans-serif; font-size: 9.5px;
  fill: var(--ink-mute); font-style: italic;
}
.evt-node-group:hover .evt-node-rect { stroke-width: 3; }

/* Card content rendered via <foreignObject> so HTML/CSS handles wrapping */
.evt-fo {
  width: 100%; height: 100%;
  padding: 4px 6px; box-sizing: border-box;
  display: flex; flex-direction: column; justify-content: center;
  text-align: center;
  overflow: hidden;
  font-family: "Inter", system-ui, sans-serif;
}
.evt-fo-num {
  font-size: 8.5px; font-weight: 700;
  letter-spacing: 0.3px; color: var(--ink-mute);
  text-transform: uppercase;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.evt-fo-num.current { color: #7d1d22; }
.evt-fo-title {
  font-family: Georgia, "Source Serif 4", serif;
  font-size: 10.5px; font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
  margin: 1px 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.evt-fo-sub {
  font-size: 8.5px;
  color: var(--ink-mute); font-style: italic;
  line-height: 1.15;
  display: flex; align-items: center; gap: 4px;
  flex-wrap: wrap;
}
/* Background/foreground/border are set inline per sector via an HSL hash on
   the sector key, so each sub-sector gets a distinct stable colour. */
.evt-fo-sector {
  font-style: normal;
  font-size: 7.5px;
  font-weight: 700;
  letter-spacing: 0.1px;
  padding: 1px 5px;
  border-radius: 99px;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.2;
}
.evt-edge-label {
  font-family: "Inter", sans-serif; font-size: 8.5px; font-weight: 600;
  fill: var(--ink-soft); letter-spacing: 0.2px;
}
.evt-edge-label-bg { fill: white; stroke: var(--line); stroke-width: 0.5; }
.evt-legend {
  display: flex; gap: 18px; flex-wrap: wrap;
  margin-top: 14px; padding-top: 14px;
  border-top: 1px dashed var(--line);
  font-family: "Inter", sans-serif; font-size: 11px; color: var(--ink-soft);
}
.evt-legend-line {
  display: inline-block; width: 26px; height: 0;
  border-top: 2px solid var(--line);
  vertical-align: middle; margin-right: 4px;
}
.evt-legend-line.replace { border-top-color: #7d1d22; border-top-width: 2.5px; }
.evt-legend-line.amend { border-top-style: dashed; border-top-color: #b78a3e; }
.evt-legend-line.elevate { border-top-color: #15a884; border-top-width: 2.5px; }

/* Sơ đồ — directional flow layout (hub on top, input | output below) */
.sd-flow {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 14px;
  align-items: start;
}
.sd-flow-side {
  min-width: 0;
  display: flex; flex-direction: column; gap: 14px;
}
.sd-flow-side-label {
  font-family: "Inter", sans-serif;
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 1.4px;
  color: var(--ink-mute); font-weight: 700;
  margin-bottom: -4px;
}
.sd-flow-in .sd-flow-side-label { color: #6c4a2b; }
.sd-flow-out .sd-flow-side-label { color: #15a884; text-align: right; }

.sd-flow-hub {
  margin: 14px 0 6px;
  padding: 16px 18px 14px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-top: 4px solid var(--red);
  border-radius: 4px;
  text-align: center;
}
.sd-flow-hub.type-luat,
.sd-flow-hub.type-bo-luat { border-top-color: #7d1d22; }
.sd-flow-hub.type-nghidinh { border-top-color: #15a884; }
.sd-flow-hub.type-thongtu { border-top-color: #1a2c4a; }
.sd-flow-hub-eyebrow {
  font-family: "Inter", sans-serif;
  font-size: 9.5px; text-transform: uppercase; letter-spacing: 1.4px;
  color: var(--ink-mute); font-weight: 700;
  margin-bottom: 6px;
}
.sd-flow-hub-pill {
  display: inline-block;
  font-family: "Inter", sans-serif;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase;
  color: var(--red); background: var(--red-soft);
  padding: 3px 10px; border-radius: 3px;
  margin-bottom: 8px;
}
.sd-flow-hub-title {
  font-family: Georgia, "Source Serif 4", serif;
  font-size: 15px; font-weight: 700; color: var(--ink);
  line-height: 1.3;
  margin-bottom: 10px;
}
.sd-flow-hub-meta {
  font-family: "Inter", sans-serif;
  font-size: 11px; color: var(--ink-mute);
  display: flex; justify-content: center; gap: 8px;
  border-top: 1px solid var(--line); padding-top: 8px;
}
.sd-flow-hub-meta strong { color: var(--ink); font-weight: 700; }
.sd-flow-hub-sep { opacity: 0.4; }

.sd-bucket {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: white;
  overflow: hidden;
}
.sd-bucket-head {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px;
  background: var(--paper-2);
  border-bottom: 1px solid var(--line);
  font-family: "Inter", sans-serif;
}
.sd-bucket-label {
  font-size: 10.5px; font-weight: 700;
  color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.6px;
  flex: 1;
}
.sd-bucket-count {
  font-size: 10px; font-weight: 700;
  color: var(--ink-mute); background: var(--bg-2);
  padding: 1px 7px; border-radius: 999px;
}
.sd-bucket-list {
  max-height: 320px; overflow-y: auto;
  display: flex; flex-direction: column;
}
.sd-bucket-empty {
  padding: 12px; text-align: center;
  font-size: 11px; color: var(--ink-faint); font-style: italic;
}

.sd-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px;
  background: white; border: none; border-bottom: 1px solid var(--line-soft);
  border-left: 3px solid var(--line);
  text-align: left; cursor: pointer;
  font-family: inherit;
  transition: background 100ms, border-color 100ms;
}
.sd-row:last-child { border-bottom: none; }
.sd-row:hover { background: var(--paper-2); }
.sd-row.type-luat,
.sd-row.type-bo-luat { border-left-color: #7d1d22; }
.sd-row.type-nghidinh { border-left-color: #15a884; }
.sd-row.type-thongtu { border-left-color: #1a2c4a; }
.sd-row-pill {
  font-family: "Inter", sans-serif;
  font-size: 9px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase;
  color: var(--ink-mute);
  white-space: nowrap;
  flex-shrink: 0;
}
.sd-row-title {
  font-family: Georgia, "Source Serif 4", serif;
  font-size: 12px; font-weight: 600; color: var(--ink);
  line-height: 1.3;
  flex: 1; min-width: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (max-width: 720px) {
  .sd-flow { grid-template-columns: 1fr; }
  .sd-flow-out .sd-flow-side-label { text-align: left; }
}

.sd-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 18px;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  color: var(--text-soft);
  margin-bottom: 6px;
}
.sd-leg-item { display: inline-flex; align-items: center; gap: 6px; }
.sd-dot {
  width: 11px; height: 11px;
  border-radius: 50%;
  display: inline-block;
}
.sd-dot.sd-luat, .sd-dot.sd-bo-luat { background: #7d1d22; }
.sd-dot.sd-nghidinh { background: #15a884; }
.sd-dot.sd-thongtu { background: #1a2c4a; }
.sd-line {
  display: inline-block;
  width: 22px; height: 0;
  border-top: 1px solid rgba(26, 44, 74, 0.45);
  vertical-align: middle;
  margin-right: 1px;
}
.sd-line.sd-line-struct {
  border-top-style: dashed;
  border-top-color: #7d1d22;
}

.sd-counts {
  display: flex; flex-wrap: wrap; gap: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  margin-bottom: 12px;
}
.sd-count {
  background: rgba(21, 168, 132, 0.12);
  color: #0d6e57;
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 500;
}

.sd-canvas {
  position: relative;
}
.sd-svg {
  width: 100%;
  height: auto;
  max-height: 78vh;
  background: #fbf7ec;
  border: 1px solid rgba(26, 44, 74, 0.12);
  border-radius: 6px;
  display: block;
  cursor: grab;
  touch-action: none;
}
.sd-svg.sd-dragging { cursor: grabbing; }
.sd-zoom-controls {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: rgba(251, 247, 236, 0.94);
  border: 1px solid rgba(26, 44, 74, 0.18);
  border-radius: 6px;
  padding: 3px;
  z-index: 5;
  box-shadow: 0 1px 3px rgba(15, 28, 51, 0.08);
}
.sd-zoom-btn {
  width: 30px;
  height: 30px;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  border-radius: 4px;
  transition: background 0.15s ease;
  line-height: 1;
  padding: 0;
}
.sd-zoom-btn:hover { background: rgba(21, 168, 132, 0.16); }
.sd-zoom-btn:active { background: rgba(21, 168, 132, 0.28); }

.sd-edge {
  stroke: rgba(26, 44, 74, 0.22);
  stroke-width: 1;
  pointer-events: none;
}
.sd-edge.sd-edge-struct {
  stroke: rgba(125, 29, 34, 0.55);
  stroke-width: 1.4;
  stroke-dasharray: 4 3;
}

.sd-node {
  cursor: pointer;
}
.sd-circle {
  stroke: #fbf7ec;
  stroke-width: 2;
  transition: filter 0.15s ease, stroke-width 0.15s ease;
}
.sd-circle.sd-luat,
.sd-circle.sd-bo-luat { fill: #7d1d22; }
.sd-circle.sd-nghidinh { fill: #15a884; }
.sd-circle.sd-thongtu { fill: #1a2c4a; }
.sd-circle:not(.sd-luat):not(.sd-bo-luat):not(.sd-nghidinh):not(.sd-thongtu) {
  fill: #6b7a8f;
}

.sd-current .sd-circle {
  stroke: #15a884;
  stroke-width: 5;
  filter: drop-shadow(0 0 10px rgba(21, 168, 132, 0.45));
}

.sd-label {
  font-family: 'Inter', sans-serif;
  font-size: 9px;
  text-anchor: middle;
  dominant-baseline: central;
  fill: #fbf7ec;
  pointer-events: none;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.sd-label-center {
  font-size: 13px;
  font-weight: 700;
}

.sd-node:hover .sd-circle {
  filter: brightness(1.18) drop-shadow(0 2px 4px rgba(0,0,0,0.18));
  stroke-width: 3;
}

/* "Lược đồ only" viewing mode (entered via spotlight Lược đồ button) — hide
   the doc title bar, properties, tab strip, reading toolbar, side aside
   columns, and the non-Lược-đồ tab panels. The Gantt panel is always shown,
   regardless of which tab is internally "active". */
body.luocdo-only .doc-titlebar,
body.luocdo-only .props-wrap,
body.luocdo-only .tabbar,
body.luocdo-only .read-toolbar,
body.luocdo-only .viewer-grid > aside,
body.luocdo-only .tab-panel[data-panel="toanvan"] {
  display: none !important;
}
body.luocdo-only .tab-panel[data-panel="luocdo"] {
  display: block !important;
}
body.luocdo-only .viewer-grid {
  grid-template-columns: 1fr !important;
}
body.luocdo-only .viewer-main {
  border: none;
  background: transparent;
  padding: 0;
}

/* Sơ đồ + Mạng lưới + Bảng fullwidth — hide viewer asides so canvas-style
   tabs get the entire content area. */
body.sodo-fullwidth .viewer-grid > aside { display: none !important; }
body.sodo-fullwidth .viewer-grid { grid-template-columns: 1fr !important; }

/* ============================================================
   Mạng lưới (network graph)
   ============================================================ */
.mangluoi { padding: 18px 22px 26px; }
.ml-head { margin-bottom: 12px; }
.ml-head h2 {
  font-size: 16px; margin: 0 0 8px;
  color: var(--blue-dark); font-weight: 700;
  border-bottom: 2px solid var(--orange);
  padding-bottom: 8px;
}
.ml-legend {
  display: flex; flex-wrap: wrap; gap: 14px;
  font-family: 'Inter', sans-serif; font-size: 11px; color: var(--ink-soft);
}
.ml-legend-item { display: inline-flex; align-items: center; gap: 5px; }
.ml-dot { width: 10px; height: 10px; border-radius: 99px; display: inline-block; }
.ml-dot.ml-dim { background: #d6d0c2; }
.ml-dash { width: 18px; height: 0; border-top: 1.6px solid var(--red); display: inline-block; }
.ml-edge-amend-legend { border-color: #b78a3e; border-top-style: dashed; }
.ml-edge-impl-legend { border-color: #a8b4c4; border-top-style: dotted; border-top-width: 2px; }
.ml-wrap { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px; overflow: auto; }
.ml-svg { width: 100%; height: auto; display: block; }
.ml-edge-replace { stroke: #7d1d22; stroke-width: 1.5; }
.ml-edge-amend   { stroke: #b78a3e; stroke-width: 1.4; stroke-dasharray: 4,3; }
.ml-edge-impl    { stroke: #a8b4c4; stroke-width: 1.0; stroke-dasharray: 1,3; }
.ml-node { transition: filter 0.15s ease; }
.ml-node:hover { filter: drop-shadow(0 0 4px rgba(125,29,34,0.45)); }
.ml-sector-label { paint-order: stroke; stroke: white; stroke-width: 3px; }

/* ============================================================
   Bảng (spreadsheet)
   ============================================================ */
.bang { padding: 18px 22px 26px; }
.bg-head { margin-bottom: 12px; }
.bg-head h2 {
  font-size: 16px; margin: 0 0 4px;
  color: var(--blue-dark); font-weight: 700;
  border-bottom: 2px solid var(--orange);
  padding-bottom: 8px;
}
.bg-sub {
  font-family: 'Inter', sans-serif; font-size: 12px; color: var(--ink-mute);
  margin: 4px 0 0;
}
.bg-frame {
  border: 1px solid var(--line); border-radius: var(--r-md);
  overflow: auto; max-height: 70vh;
}
.bg-table {
  border-collapse: collapse; width: 100%; min-width: 760px;
  font-family: 'Inter', sans-serif; font-size: 12px;
}
.bg-table thead { position: sticky; top: 0; z-index: 2; background: var(--paper); }
.bg-table thead th {
  text-align: left; padding: 9px 12px; border-bottom: 2px solid var(--line-strong);
  font-size: 10.5px; font-weight: 700; color: var(--ink-mute);
  letter-spacing: 0.5px; text-transform: uppercase;
  white-space: nowrap;
}
.bg-table th.bg-first, .bg-table td.bg-first {
  position: sticky; left: 0; background: var(--paper);
  border-right: 1px solid var(--line); z-index: 1;
  white-space: nowrap; font-weight: 700;
}
.bg-table tbody td {
  padding: 9px 12px; border-bottom: 1px solid var(--line);
  vertical-align: top; background: white;
}
.bg-table tbody td.bg-first {
  background: var(--paper);
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 13px; color: var(--ink);
}
.bg-active-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px; border-radius: 3px;
  background: rgba(21,168,132,0.10); border-left: 2px solid var(--teal);
  font-weight: 600; color: var(--ink);
  font-size: 11px;
  cursor: pointer;
  margin: 2px 4px 2px 0;
  transition: background 0.12s ease;
}
.bg-active-chip:hover { background: rgba(21,168,132,0.20); }
.bg-active-chip::before { content: "●"; color: var(--teal); margin-right: 2px; }
.bg-past {
  color: var(--ink-mute); font-size: 10.5px; line-height: 1.65;
  margin-top: 4px;
}
.bg-past-id {
  color: var(--ink); font-weight: 600;
  cursor: pointer; text-decoration: underline;
  text-decoration-color: rgba(125,29,34,0.25);
}
.bg-past-id:hover { color: var(--red); }
.bg-past-note { color: var(--ink-mute); margin-left: 4px; font-size: 10px; font-style: italic; }
.bg-empty { color: var(--ink-faint); font-style: italic; font-size: 10.5px; }
.bg-status { display: inline-block; padding: 2px 8px; border-radius: 99px; font-weight: 600; font-size: 11px; }
.bg-status-active { background: rgba(21,168,132,0.10); color: var(--teal); }
.bg-status-idle { background: rgba(107,122,144,0.10); color: var(--ink-mute); }

/* Timeline (lược đồ — hiệu lực) */
.lt-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 16px;
  border-bottom: 2px solid var(--orange);
  padding-bottom: 8px;
}
.lt-header h2 {
  font-size: 16px; margin: 0;
  color: var(--blue-dark); font-weight: 700;
  border: none; padding: 0;
}
.lt-download {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px;
  background: var(--blue-dark); color: white;
  border: none; border-radius: var(--r-sm);
  font-size: 12px; font-weight: 600; cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.lt-download:hover { background: var(--blue); }
.lt-download:active { background: var(--blue-dark); transform: translateY(1px); }
.lt-download svg { stroke: white; }

.lt-legend {
  display: flex; flex-wrap: wrap; gap: 18px;
  font-family: "Inter", "Segoe UI", sans-serif;
  font-size: 11px; color: var(--ink-soft);
  letter-spacing: 0.02em;
  margin-bottom: 14px; padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.lt-legend-item { display: inline-flex; align-items: center; gap: 7px; font-weight: 500; }
.lt-swatch {
  display: inline-block; width: 20px; height: 9px; border-radius: 2px;
  background: var(--blue);
  box-shadow: 0 1px 2px rgba(15,23,42,0.08);
}
.lt-swatch.role-current { background: var(--red); }
.lt-swatch.role-cited { background: var(--blue); }
.lt-swatch.role-cites { background: #0e7490; }
.lt-swatch.role-replaced { background: var(--ink-soft); }
.lt-swatch.role-successor { background: var(--orange); }
.lt-swatch.role-other { background: var(--ink-faint); }
.lt-swatch.type-luat { background: var(--red); }
.lt-swatch.type-bo-luat { background: var(--red-dark); }
.lt-swatch.type-nghidinh { background: var(--orange); }
.lt-swatch.type-thongtu { background: var(--blue); }
.lt-swatch.ring {
  box-shadow: 0 0 0 1.5px rgba(255,255,255,0.9) inset, 0 0 0 1px var(--ink-soft);
}
.lt-swatch.expired {
  background: repeating-linear-gradient(45deg, var(--ink-mute) 0 4px, var(--paper-2) 4px 8px);
  border: 1px solid var(--line-strong);
}

.lt-wrap {
  position: relative;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  overflow-x: auto;
  padding: 0;
}
.lt-wrap { --lt-meta-width: 200px; }
.lt-axis-row {
  display: flex; align-items: stretch;
  border-bottom: 1px solid var(--line);
  background: white;
}
.lt-axis-spacer {
  width: var(--lt-meta-width); flex: 0 0 var(--lt-meta-width);
  border-right: 1px solid var(--line);
}
.lt-axis {
  flex: 1; position: relative;
  height: 22px;
  background: white;
}
.lt-tick {
  position: absolute; top: 0; bottom: 0;
  font-size: 10.5px; font-weight: 600; color: var(--ink-soft);
  border-left: 1px solid var(--line);
  padding: 5px 0 0 3px;
  transform: translateX(-1px);
  white-space: nowrap;
}
.lt-tick-minor {
  border-left-style: dotted;
  border-left-color: var(--line-soft);
}
.lt-today {
  position: absolute; top: 0; bottom: 0;
  border-left: 2px dashed var(--red-light);
  z-index: 2;
  pointer-events: none;
}
.lt-today span {
  position: absolute; top: -2px; left: 4px;
  font-size: 10px; color: var(--red);
  background: white; padding: 2px 5px;
  border: 1px solid var(--red-light); border-radius: 2px;
  font-weight: 700;
}

.lt-rows { display: flex; flex-direction: column; }
.lt-row {
  display: flex; align-items: stretch;
  border-top: 1px solid var(--line-soft);
  min-height: 30px;
  cursor: pointer;
}
.lt-row:hover { background: var(--green-tint); }
.lt-row:hover .lt-num { color: var(--orange-dark); text-decoration: underline; }
.lt-row:hover .lt-bar { filter: brightness(1.1); box-shadow: 0 2px 6px rgba(15,23,42,0.18); }
.lt-row:first-child { border-top: none; }

.lt-meta {
  width: var(--lt-meta-width); flex: 0 0 var(--lt-meta-width);
  padding: 4px 8px;
  display: flex; align-items: center; gap: 7px;
  background: white;
  position: sticky; left: 0; z-index: 1;
  overflow: hidden;
}
.lt-splitter {
  flex: 0 0 4px;
  cursor: col-resize;
  background: var(--line);
  position: relative;
  z-index: 2;
  transition: background 0.15s;
}
.lt-splitter:hover, body.lt-resizing .lt-splitter { background: var(--blue); }
body.lt-resizing { cursor: col-resize !important; user-select: none; }
.lt-type {
  font-family: "Inter", "Segoe UI", sans-serif;
  font-size: 9.5px; font-weight: 700; text-transform: uppercase;
  padding: 2.5px 6px; border-radius: 2px;
  background: var(--red); color: white; flex-shrink: 0;
  letter-spacing: 0.5px;
  line-height: 1.2;
  min-width: 26px; text-align: center;
}
.lt-type.luat { background: var(--red); }
.lt-type.bo-luat { background: var(--red-dark); }
.lt-type.nghidinh { background: var(--orange); }
.lt-type.thongtu { background: var(--blue); }

.lt-meta-text { min-width: 0; flex: 1; overflow: hidden; }
.lt-num {
  font-family: ui-monospace, monospace;
  font-size: 10.5px; font-weight: 700;
  color: var(--blue-dark);
  line-height: 1.3;
  cursor: pointer;
}
.lt-title {
  font-size: 8px;
  color: var(--ink-mute);
  line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.lt-rel {
  position: absolute; bottom: 1px;
  font-size: 9px; color: var(--ink-mute);
  font-style: italic;
  white-space: nowrap;
  pointer-events: none;
  max-width: 60%;
  overflow: hidden; text-overflow: ellipsis;
}
.lt-row.role-current .lt-rel { color: var(--red); font-style: normal; font-weight: 600; }
.lt-row.role-cited .lt-rel { color: var(--blue); }
.lt-row.role-cites .lt-rel { color: #0e7490; }
.lt-row.role-replaced .lt-rel { color: var(--ink-soft); }
.lt-row.role-successor .lt-rel { color: var(--orange); }

.lt-track {
  flex: 1; position: relative;
  min-height: 30px;
  padding: 3px 0;
}
.lt-bar {
  position: absolute; top: 4px;
  height: 14px;
  border-radius: 2px;
  background: var(--blue);
  color: white;
  display: flex; align-items: center;
  padding: 0 7px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(15,23,42,0.12);
  min-width: 10px;
  transition: filter 0.15s, box-shadow 0.15s;
}
.lt-row:hover .lt-bar { filter: brightness(1.08); }
/* Type-driven colour matches the type pill on the left */
.lt-bar.type-luat { background: var(--red); }
.lt-bar.type-bo-luat { background: var(--red-dark); }
.lt-bar.type-nghidinh { background: var(--orange); }
.lt-bar.type-thongtu { background: var(--blue); }
/* Role overlay — current doc gets a white inner ring for emphasis */
.lt-bar.role-current { box-shadow: 0 0 0 2px rgba(255,255,255,0.6) inset, 0 1px 2px rgba(0,0,0,0.2); }
.lt-bar.expired {
  background-image: repeating-linear-gradient(45deg,
    rgba(255,255,255,0.22) 0 4px,
    transparent 4px 8px);
  opacity: 0.85;
}
.lt-bar-label {
  font-size: 9.5px; font-weight: 600;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

.lt-summary {
  list-style: none; padding: 0; margin: 0;
  display: flex; gap: 18px; flex-wrap: wrap;
  font-size: 12.5px; color: var(--ink);
}
.lt-summary li {
  padding: 6px 12px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}
.lt-summary li strong { color: var(--blue-dark); margin-right: 4px; }

/* Compact horizontal summary bar (replaces the .lt-summary card list) */
.lt-summary-bar {
  display: flex; align-items: stretch;
  margin-top: 18px;
  border-top: 2px solid var(--orange);
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  padding: 8px 0;
  box-shadow: 0 1px 2px rgba(15,23,42,0.04);
}
.ls-item {
  flex: 1 1 0;
  min-width: 110px;
  padding: 4px 14px;
  border-left: 1px solid var(--line);
  display: flex; align-items: baseline; gap: 10px;
}
.ls-item:first-child { border-left: none; }
.ls-num {
  font-size: 19px; font-weight: 700;
  color: var(--orange-dark);
  letter-spacing: -0.01em;
  line-height: 1;
}
.ls-lbl {
  font-family: "Inter", "Segoe UI", sans-serif;
  font-size: 10.5px; color: var(--ink-mute);
  text-transform: uppercase; letter-spacing: 0.06em;
  font-weight: 600;
}

/* References */
.legal-ref {
  background: transparent;
  padding: 0 1px;
  border-radius: 2px;
  cursor: help;
  color: #b3261e;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
.legal-ref:hover {
  color: var(--link-hover);
  background: var(--ref-bg);
}
.legal-ref.missing {
  background: transparent;
  color: var(--ink-mute);
  font-style: italic;
}

/* Popup */
.ref-popup {
  position: fixed; z-index: 100;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 12px 32px -8px rgba(15, 24, 51, 0.22), 0 2px 6px rgba(15, 24, 51, 0.08);
  padding: 14px 16px 12px;
  max-width: 480px; min-width: 300px;
  font-size: 13px; line-height: 1.55;
  color: var(--ink);
  font-family: "Inter", system-ui, sans-serif;
  animation: pop 140ms ease;
}
.ref-popup.pinned {
  box-shadow: 0 12px 32px -8px rgba(15, 24, 51, 0.28), 0 0 0 2px var(--ink);
}
.pop-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-bottom: 10px;
}
.pop-source {
  font-size: 10.5px;
  text-transform: uppercase; letter-spacing: 1px;
  color: var(--ink); font-weight: 700;
  font-family: "Inter", system-ui, sans-serif;
}
.pop-actions { display: flex; gap: 2px; }
.pop-icon-btn {
  border: 1px solid transparent; background: transparent;
  width: 24px; height: 22px;
  border-radius: 4px;
  cursor: pointer; color: var(--ink-mute);
  display: grid; place-items: center;
  transition: background 120ms, color 120ms;
}
.pop-icon-btn:hover { background: rgba(15, 24, 51, 0.06); color: var(--ink); }
.pop-icon-btn.on { color: var(--ink); background: rgba(15, 24, 51, 0.10); }
.pop-icon-btn svg { width: 13px; height: 13px; }
.pop-title {
  font-weight: 600; font-size: 15px;
  margin: 0 0 8px; color: var(--ink);
  line-height: 1.35;
  font-family: "Source Serif 4", Georgia, serif;
  letter-spacing: -0.005em;
}
.pop-body {
  color: var(--ink-soft);
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.65;
  font-family: "Source Serif 4", Georgia, serif;
  max-height: 360px;
  overflow-y: auto;
  padding: 2px 0;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}
.pop-meta {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  font-family: "Inter", system-ui, sans-serif;
  letter-spacing: 0.1px;
}
.pop-meta > span {
  color: var(--ink-mute);
  font-size: 11px;
}
.pop-meta .pop-open-doc {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--red);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.12s ease, color 0.12s ease;
}
.pop-meta .pop-open-doc:hover {
  border-bottom-color: var(--red);
  color: #5f1316;
}
.ref-popup.missing { border-color: var(--ink-faint); }
.ref-popup.missing .pop-source { color: var(--ink-mute); }
.ref-popup.missing .pop-body { font-style: italic; color: var(--ink-mute); }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 24px;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: white;
  padding: 9px 18px;
  font-size: 12.5px;
  border-radius: 4px;
  z-index: 200;
  box-shadow: var(--shadow-md);
  opacity: 0; transition: all 200ms ease;
  pointer-events: none;
  border-left: 3px solid var(--orange);
}
.toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Back to top */
.back-top {
  position: fixed; bottom: 22px; right: 22px;
  width: 38px; height: 38px;
  background: var(--red); color: white;
  border: none; border-radius: 4px;
  cursor: pointer; display: grid; place-items: center;
  z-index: 6;
  opacity: 0; transform: translateY(8px);
  pointer-events: none;
  transition: all 180ms ease;
  box-shadow: var(--shadow);
}
.back-top.visible { opacity: 1; transform: none; pointer-events: auto; }
.back-top:hover { background: var(--red-dark); }

/* Print */
@media print {
  .utility, .site-header, .navbar, .crumbs-bar, .viewer-grid > aside, .tabbar,
  .read-toolbar, .back-top, .ref-popup, .site-footer { display: none !important; }
  .viewer-page { padding: 0; background: white; }
  .viewer-grid { display: block; }
  .viewer-main { border: none; border-radius: 0; }
  .doc-body { padding: 0; max-width: 100%; font-size: 11pt; }
  body { background: white; }
  .legal-ref { background: transparent; border-bottom: 1px dotted #888; color: inherit; }
}

/* Responsive */
@media (max-width: 1100px) {
  .viewer-grid { grid-template-columns: 240px 1fr; }
  .viewer-grid > aside:last-of-type { display: none; }
}
@media (max-width: 980px) {
  .land-grid { grid-template-columns: 1fr; }
  .field-grid { grid-template-columns: repeat(2, 1fr); }
  .spotlight-grid { grid-template-columns: 1fr; gap: 18px; }
  .viewer-grid { grid-template-columns: 1fr; }
  .viewer-grid > aside { display: none; }
  .header-inner { grid-template-columns: 1fr; gap: 14px; }
  .header-actions { display: none; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .navbar-inner { overflow-x: auto; }
  .navbar a, .navbar button { padding: 10px 12px; font-size: 12.5px; }
  .doc-list li { grid-template-columns: 60px 1fr; gap: 10px; }
  .doc-list .dl-side { grid-column: 2; text-align: left; margin-top: 4px; }
  .field-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; gap: 20px; }
  .utility { display: none; }
  .doc-titlebar, .props-wrap, .luocdo { padding: 14px 16px; }
  .doc-body { padding: 18px 14px 30px; }
  .read-toolbar { padding: 8px 14px; flex-wrap: wrap; }
  .tabbar { padding: 0 4px; overflow-x: auto; }
}
