/* ============================================================
   Mint design system — token-driven.
   The :root block is the "Classic" theme (deep-navy financial look).
   Other themes only override tokens — see themes.css. Layout and
   responsive rules live in responsive.css.
   ============================================================ */
:root {
  --navy-950: #0a1428;
  --navy-900: #0d1b34;
  --navy-800: #12264a;
  --navy-700: #1a3562;
  --accent: #1f5fbf;
  --accent-600: #1a4fa0;
  --accent-100: #e3edfb;
  --gold: #c9a227;
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #f4f6fa;        /* hover fills, quiet inputs */
  --surface-3: #fafbfd;        /* table heads */
  --border: #e2e8f0;
  --border-soft: #f1f5f9;
  --text: #1e293b;
  --text-soft: #64748b;
  --heading: var(--navy-900);
  --heading-2: var(--navy-800);
  --ok: #16a34a;
  --warn: #f59e0b;
  --err: #dc2626;
  --code-bg: #eef2f7;
  --input-bg: #ffffff;
  --radius: 10px;
  --radius-sm: 8px;
  --radius-xs: 4px;
  --radius-pill: 999px;
  --shadow: 0 1px 3px rgba(13, 27, 52, 0.08), 0 4px 16px rgba(13, 27, 52, 0.05);
  --shadow-pop: 0 20px 60px rgba(10, 20, 40, 0.35);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --heading-font: var(--font);
  --heading-weight: 700;
  --font-size: 14.5px;
  --sidebar-w: 248px;
  --sidebar-bg: linear-gradient(180deg, var(--navy-900) 0%, var(--navy-950) 100%);
  --sidebar-text: #cbd5e1;
  --sidebar-item: #c3d0e0;
  --sidebar-muted: #5b7194;
  --sidebar-sub: #7d90ad;
  --sidebar-hover: rgba(255, 255, 255, 0.06);
  --sidebar-active-bg: var(--accent);
  --sidebar-active-text: #ffffff;
  --sidebar-active-border: transparent;
  --sidebar-border: rgba(255, 255, 255, 0.08);
  --brand-mark-bg: linear-gradient(135deg, var(--accent) 0%, #57a0ff 100%);
  --topbar-bg: var(--surface);
  --stage-past-bg: #e8f0e9;
  --stage-past-text: #3f6549;
  --stage-past-border: #cfe3d4;
  --chip-bg: #f1f5f9;
  --overlay: rgba(10, 20, 40, 0.45);
  --modal-bg: #ffffff;
  --toast-bg: var(--navy-900);
  --help-head-bg: var(--navy-900);
  --focus: var(--accent);
  --login-bg: linear-gradient(135deg, var(--navy-950) 0%, var(--navy-800) 60%, var(--navy-700) 100%);
  --pad: 20px;                 /* card padding (density) */
  --pad-x: 22px;
  --row-pad: 10px;             /* table cell vertical padding (density) */
  --section-transform: uppercase;
  --section-spacing: 1px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: var(--font-size); line-height: 1.5; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: var(--code-bg); border-radius: var(--radius-xs); padding: 1px 5px; font-size: 0.9em; }
h1, h2, h3, h4 { font-family: var(--heading-font); font-weight: var(--heading-weight); color: var(--heading); }

/* ---------------- layout shell ---------------- */
#app { display: flex; height: 100vh; height: 100dvh; overflow: hidden; }

.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; display: flex; flex-direction: column;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
}
.sidebar .brand {
  display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px;
  color: #fff; font-size: 17px; font-weight: 700; letter-spacing: 0.3px; font-family: var(--heading-font);
}
.brand-mark {
  width: 30px; height: 30px; border-radius: var(--radius-sm); flex-shrink: 0;
  background: var(--brand-mark-bg);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 15px; font-weight: 800;
}
.brand small { display: block; font-size: 10.5px; font-weight: 500; color: var(--sidebar-sub); letter-spacing: 0.4px; font-family: var(--font); }
.sidebar nav { flex: 1; overflow-y: auto; padding: 6px 10px 20px; }
.nav-section { font-size: 10.5px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--sidebar-muted); margin: 18px 10px 6px; display: flex; align-items: center; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 11px; margin: 1px 0;
  border-radius: var(--radius-sm); color: var(--sidebar-item); cursor: pointer; font-size: 13.5px; user-select: none;
  border-left: 3px solid transparent;
}
.nav-item:hover { background: var(--sidebar-hover); text-decoration: none; color: #fff; }
.nav-item.active { background: var(--sidebar-active-bg); color: var(--sidebar-active-text); font-weight: 600; border-left-color: var(--sidebar-active-border); }
.nav-item .dot { width: 8px; height: 8px; border-radius: 3px; flex-shrink: 0; background: var(--dot, #64748b); }
.nav-item .badge { margin-left: auto; background: var(--err); color: #fff; border-radius: 9px; font-size: 10.5px; padding: 0 6px; font-weight: 700; }
.nav-item .tag { margin-left: auto; font-size: 10px; letter-spacing: .6px; text-transform: uppercase; opacity: .75; }
.nav-item .chev { margin-left: auto; opacity: .6; transition: transform .15s; }
.nav-item[aria-expanded="true"] .chev { transform: rotate(90deg); }
.nav-row { display: flex; align-items: center; gap: 2px; }
.nav-row > .nav-item { flex: 1; min-width: 0; }
.nav-row .chev { color: var(--sidebar-muted); border-radius: 6px; }
.nav-row .chev:hover { background: var(--sidebar-hover); color: #fff; }
.nav-row.open .chev .ic { transform: rotate(90deg); }
.nav-group-btn { background: none; border: none; cursor: pointer; font-family: inherit; text-align: left; width: 100%; display: flex; align-items: center; gap: 6px; }
.nav-group-btn:hover { color: #fff; }
.nav-tree { margin: 0 0 4px 12px; padding-left: 8px; border-left: 1px solid var(--sidebar-border); }
.nav-tree .nav-item { padding: 6px 9px; font-size: 13px; }
.nav-tree .nav-tree { margin-left: 8px; }
.nav-tree .nav-tree .nav-item { font-size: 12.5px; padding: 5px 8px; }
.nav-group-label { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: var(--sidebar-muted); margin: 8px 8px 2px; }
.sidebar .foot { padding: 12px 16px; border-top: 1px solid var(--sidebar-border); font-size: 11.5px; color: var(--sidebar-muted); }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 56px; flex-shrink: 0; background: var(--topbar-bg); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px; padding: 0 22px;
}
.topbar .search-wrap { position: relative; width: 380px; max-width: 40vw; }
.topbar input[type=search] {
  width: 100%; padding: 8px 12px 8px 34px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); font-size: 13.5px; font-family: inherit;
}
.search-icon { position: absolute; left: 10px; top: 8px; color: var(--text-soft); }
.search-results {
  position: absolute; top: 42px; left: 0; right: 0; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); z-index: 60; max-height: 380px; overflow-y: auto;
}
.search-hit { padding: 9px 14px; cursor: pointer; border-bottom: 1px solid var(--border-soft); }
.search-hit:hover { background: var(--accent-100); }
.search-hit .muted { font-size: 12px; }
.topbar .spacer { flex: 1; }
.topbar .icon-btn { position: relative; }
.notif-dot { position: absolute; top: 2px; right: 2px; width: 9px; height: 9px; background: var(--err); border-radius: 50%; border: 2px solid var(--surface); }
.user-chip {
  display: flex; align-items: center; gap: 9px; cursor: pointer; padding: 5px 10px; border-radius: var(--radius-sm);
}
.user-chip:hover { background: var(--surface-2); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--navy-800); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 12.5px; font-weight: 700;
}
.env-badge {
  font-size: 10.5px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; padding: 3px 9px;
  border-radius: var(--radius-xs); color: #fff; background: var(--env-color, #64748b);
}
.menu-btn { display: none; }
.content { flex: 1; overflow-y: auto; padding: 26px 30px 60px; }
.content-narrow { max-width: 1320px; margin: 0; }
.content-wide { max-width: 1600px; margin: 0; }
.row-self td { background: var(--surface-2); }
.breadcrumb { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: 13px; color: var(--text-soft); }
.breadcrumb .sep { opacity: .5; }

/* ---------------- primitives ---------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: var(--pad) var(--pad-x); }
.page-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 21px; font-weight: var(--heading-weight); color: var(--heading); }
.page-head .sub { color: var(--text-soft); font-size: 13.5px; margin-top: 2px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 15px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-size: 13.5px; font-weight: 600; cursor: pointer; font-family: inherit; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-600); }
.btn-danger { background: var(--surface); border-color: #fecaca; color: var(--err); }
.btn-danger:hover { background: #fef2f2; }
.btn-sm { padding: 4px 10px; font-size: 12.5px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.icon-btn {
  border: none; background: none; cursor: pointer; font-size: 16px; color: var(--text-soft);
  padding: 7px; border-radius: var(--radius-sm); line-height: 1; font-family: inherit;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* inline SVG icons */
.ic { flex-shrink: 0; vertical-align: -2px; }
.btn .ic { margin-right: 2px; }
.nav-item .ic { width: 16px; height: 16px; opacity: 0.85; }
.nav-item.active .ic { opacity: 1; }
.nav-add {
  border: none; background: none; color: var(--sidebar-muted); cursor: pointer; padding: 2px 4px;
  border-radius: 6px; margin-left: 6px; display: inline-flex; vertical-align: middle;
}
.nav-add:hover { color: #fff; background: var(--sidebar-hover); }
.search-icon .ic { display: block; }

/* accessibility: consistent keyboard focus ring */
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--radius-xs); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent-100); outline-offset: 0; }

.pill {
  display: inline-flex; align-items: center; padding: 2px 10px; border-radius: var(--radius-pill); font-size: 12px;
  font-weight: 600; background: color-mix(in srgb, var(--pill, #64748b) 14%, var(--surface));
  color: var(--pill, #475569); border: 1px solid color-mix(in srgb, var(--pill, #64748b) 30%, var(--surface));
}

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.grid { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.grid th {
  text-align: left; padding: var(--row-pad) 14px; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.7px;
  color: var(--text-soft); border-bottom: 1px solid var(--border); background: var(--surface-3); font-weight: 700;
}
table.grid td { padding: var(--row-pad) 14px; border-bottom: 1px solid var(--border-soft); vertical-align: top; }
table.grid tr.rowlink { cursor: pointer; }
table.grid tr.rowlink:hover { background: var(--accent-100); }
table.grid td.num, table.grid th.num { text-align: right; font-variant-numeric: tabular-nums; }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { padding: 16px 18px; }
.stat .n { font-size: 26px; font-weight: 800; color: var(--heading); }
.stat .l { font-size: 12.5px; color: var(--text-soft); font-weight: 600; }

.muted { color: var(--text-soft); }
.small { font-size: 12.5px; }
.multiline { white-space: pre-wrap; }
.hidden { display: none !important; }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; }
.flex { display: flex; gap: 10px; align-items: center; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ---------------- forms ---------------- */
label.f-label { display: block; font-size: 12.5px; font-weight: 700; color: var(--heading-2); margin-bottom: 4px; }
label.f-label .req { color: var(--err); }
label.f-label .lock { color: var(--gold); font-size: 11px; margin-left: 4px; }
.f-help { font-size: 12px; color: var(--text-soft); margin-top: 3px; }
.f-row { margin-bottom: 15px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=tel],
input[type=datetime-local], input[type=search], input[type=url], input[type=color], select, textarea {
  width: 100%; padding: 8px 11px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13.5px; font-family: inherit; background: var(--input-bg); color: var(--text);
}
input[type=color] { padding: 2px 4px; height: 36px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-100); border-color: var(--accent); }
textarea { resize: vertical; }
.section-title {
  font-size: 12px; text-transform: var(--section-transform); letter-spacing: var(--section-spacing); color: var(--text-soft);
  font-weight: 800; margin: 22px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--border);
}
.ref-wrap { position: relative; }
.ref-results {
  position: absolute; top: 38px; left: 0; right: 0; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow); z-index: 50; max-height: 240px; overflow-y: auto;
}
.ref-item { padding: 8px 12px; cursor: pointer; font-size: 13px; }
.ref-item:hover { background: var(--accent-100); }
.toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13.5px; }
.toggle input { width: auto; }

/* ---------------- modal ---------------- */
.modal-overlay {
  position: fixed; inset: 0; background: var(--overlay); z-index: 100;
  display: flex; align-items: flex-start; justify-content: center; padding: 60px 20px;
}
.modal {
  background: var(--modal-bg); border-radius: calc(var(--radius) + 4px); width: 560px; max-width: 100%; max-height: 82vh;
  display: flex; flex-direction: column; box-shadow: var(--shadow-pop);
}
.modal-wide { width: min(880px, 96vw); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 12px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 16px; color: var(--heading); }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot { padding: 13px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 9px; flex-wrap: wrap; }

/* ---------------- toasts ---------------- */
#toasts { position: fixed; bottom: 22px; right: 22px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--toast-bg); color: #fff; padding: 11px 18px; border-radius: var(--radius); font-size: 13.5px;
  box-shadow: var(--shadow); max-width: 380px; animation: slide-in 0.25s ease;
}
.toast-err { background: var(--err); }
.toast-warn { background: var(--warn); }
.toast.gone { opacity: 0; transition: opacity 0.4s; }
@keyframes slide-in { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------------- login ---------------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--login-bg);
}
.login-card { width: 400px; max-width: 92vw; background: var(--modal-bg); border-radius: calc(var(--radius) + 6px); padding: 34px 34px 28px; box-shadow: 0 24px 80px rgba(0,0,0,0.4); }
.login-card .brand { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; color: var(--heading); font-size: 21px; font-weight: 800; font-family: var(--heading-font); }
.login-tag { color: var(--text-soft); font-size: 13px; margin-bottom: 24px; }
.login-note { margin-top: 18px; font-size: 12px; color: var(--text-soft); text-align: center; }
.sso-btn { width: 100%; justify-content: center; margin-top: 10px; }

/* ---------------- record detail ---------------- */
.stagebar { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 4px 0 2px; }
.stage-chip {
  display: flex; align-items: center; gap: 6px; padding: 5px 13px; border-radius: var(--radius-pill); font-size: 12.5px;
  font-weight: 600; background: var(--chip-bg); color: var(--text-soft); border: 1px solid var(--border);
}
.stage-chip.current { background: var(--stage, var(--accent)); border-color: transparent; color: #fff; }
.stage-chip.past { background: var(--stage-past-bg); color: var(--stage-past-text); border-color: var(--stage-past-border); }
.stage-arrow { color: #cbd5e1; font-size: 12px; }
.tabs { display: flex; gap: 2px; border-bottom: 2px solid var(--border); margin: 18px 0 18px; overflow-x: auto; }
.tab {
  padding: 9px 17px; cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--text-soft);
  border-bottom: 2px solid transparent; margin-bottom: -2px; user-select: none; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.kv { display: grid; grid-template-columns: 220px 1fr; gap: 6px 18px; font-size: 13.5px; }
.kv dt { color: var(--text-soft); font-weight: 600; padding: 6px 0; }
.kv dd { padding: 6px 0; min-width: 0; overflow-wrap: anywhere; }
.comment { border-bottom: 1px solid var(--border-soft); padding: 12px 2px; }
.comment .who { font-weight: 700; font-size: 13px; color: var(--heading-2); }
.comment .when { color: var(--text-soft); font-size: 12px; margin-left: 8px; }
.timeline-item { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border-soft); font-size: 13px; }
.timeline-item .v { font-weight: 800; color: var(--accent); min-width: 34px; }

/* ---------------- workflow designer ---------------- */
.wf-stage-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 13px 15px; margin-bottom: 10px; background: var(--surface); border-left: 5px solid var(--stage, #64748b); }
.wf-trans { font-size: 13px; padding: 7px 12px; border: 1px dashed var(--border); border-radius: var(--radius-sm); margin-bottom: 7px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.wf-flow { overflow-x: auto; padding: 8px 0 4px; }
.wf-flow svg { display: block; min-width: 100%; }
.wf-node { cursor: pointer; }
.wf-node rect { fill: var(--surface); stroke: var(--stage, #64748b); stroke-width: 2; }
.wf-node.approval rect { stroke-dasharray: 5 3; }
.wf-node text { font-family: var(--font); font-size: 12px; fill: var(--text); }
.wf-node .sub { font-size: 10px; fill: var(--text-soft); }
.wf-edge path { fill: none; stroke: #94a3b8; stroke-width: 1.6; cursor: pointer; }
.wf-edge.rejection path { stroke: var(--err); stroke-dasharray: 4 3; }
.wf-edge text { font-family: var(--font); font-size: 10.5px; fill: var(--text-soft); cursor: pointer; }
.wf-edge:hover path { stroke: var(--accent); }

/* ---------------- help panel ---------------- */
.help-panel {
  position: fixed; top: 0; right: -420px; width: 400px; max-width: 92vw; height: 100vh; z-index: 90;
  background: var(--surface); border-left: 1px solid var(--border); box-shadow: -12px 0 40px rgba(13,27,52,0.12);
  transition: right 0.25s ease; display: flex; flex-direction: column;
}
.help-panel.open { right: 0; }
.help-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; background: var(--help-head-bg); color: #fff; }
.help-head h3 { font-size: 15px; color: #fff; }
.help-body { padding: 18px 22px; overflow-y: auto; flex: 1; }
.help-body .md h3, .help-body .md h4 { margin: 14px 0 6px; color: var(--heading); }
.help-body .md p, .help-body .md ul { margin-bottom: 10px; }
.help-body .md ul { padding-left: 20px; }
.tour-highlight { position: relative; z-index: 96 !important; box-shadow: 0 0 0 4px var(--gold), 0 0 0 9999px rgba(10,20,40,0.55) !important; border-radius: var(--radius-sm); }
.tour-pop {
  position: fixed; z-index: 97; background: var(--surface); border-radius: calc(var(--radius) + 2px); padding: 16px 18px; width: 300px; max-width: 92vw;
  box-shadow: 0 16px 50px rgba(0,0,0,0.35);
}
.tour-pop h4 { color: var(--heading); margin-bottom: 6px; }
.tour-pop .flex { margin-top: 12px; justify-content: space-between; }

/* ---------------- misc ---------------- */
.spinner {
  width: 28px; height: 28px; margin: 40px auto; border: 3px solid var(--border);
  border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state { text-align: center; color: var(--text-soft); padding: 44px 20px; font-size: 13.5px; }
.md p { margin-bottom: 8px; }
.md ul { padding-left: 20px; margin-bottom: 8px; }
.md h3, .md h4, .md h5 { margin: 12px 0 6px; }
.banner { padding: 10px 16px; border-radius: var(--radius-sm); font-size: 13px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.banner-warn { background: #fef3c7; border: 1px solid #f6d365; color: #7c5a05; }
.banner-info { background: var(--accent-100); border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--surface)); color: var(--accent-600); }
.banner-err { background: #fee2e2; border: 1px solid #fca5a5; color: #7f1d1d; }

/* ---------------- reporting & charts ---------------- */
.chart-box { margin: 6px 0 18px; }
.chart-box svg { max-width: 100%; height: auto; }
.chart-tip {
  position: fixed; z-index: 210; background: var(--toast-bg); color: #fff; padding: 8px 12px;
  border-radius: var(--radius-sm); font-size: 12.5px; pointer-events: none; box-shadow: var(--shadow); max-width: 240px;
}
.chart-tip .muted { color: #94a3b8; }
.donut-wrap { display: flex; gap: 26px; align-items: center; flex-wrap: wrap; }
.chart-legend { display: flex; flex-direction: column; gap: 6px; min-width: 190px; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.legend-swatch { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }
.legend-label { color: var(--text); }
.legend-value { margin-left: auto; font-weight: 700; color: var(--heading); }
.col-picker { display: flex; flex-wrap: wrap; gap: 7px; }
.col-chip {
  padding: 5px 12px; border: 1px solid var(--border); border-radius: var(--radius-pill); font-size: 12.5px;
  cursor: pointer; user-select: none; background: var(--surface); color: var(--text-soft);
}
.col-chip.on { background: var(--accent-100); border-color: var(--accent); color: var(--accent-600); font-weight: 600; }
.dash-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; }
.dash-widget { grid-column: span 3; min-width: 0; }
.dash-widget.full { grid-column: 1 / -1; }
.dash-widget.third { grid-column: span 2; }
.dash-title { font-weight: 700; color: var(--heading); font-size: 15px; }
.dash-title:hover { color: var(--accent); text-decoration: none; }

/* ---------------- scorecards & KPI widgets ---------------- */
.scorecard { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.scorecard th { text-align: left; padding: 9px 12px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--text-soft); border-bottom: 1px solid var(--border); background: var(--surface-3); white-space: nowrap; }
.scorecard th.metric, .scorecard td.metric { text-align: center; }
.scorecard td { padding: 8px 12px; border-bottom: 1px solid var(--border-soft); }
.scorecard tr.row-link { cursor: pointer; }
.scorecard tr.row-link:hover td { background: var(--surface-2); }
.scorecard td.row-name { font-weight: 600; color: var(--heading-2); }
.rag { display: inline-flex; align-items: center; justify-content: center; min-width: 46px; padding: 3px 10px; border-radius: var(--radius-pill); font-weight: 700; font-size: 13px; border: 1px solid transparent; font-variant-numeric: tabular-nums; }
.rag[role="button"] { cursor: pointer; }
.rag-green { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.rag-amber { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.rag-red { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.rag-none { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.rag[role="button"]:hover { filter: brightness(.96); }
.kpi-tile .n { font-size: 34px; font-weight: 800; line-height: 1.1; }
.kpi-tile .target { font-size: 12px; color: var(--text-soft); }
.drill-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--border-soft); }
.drill-row:hover { background: var(--accent-100); }
.filter-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: var(--radius-pill); background: var(--accent-100); color: var(--accent-600); font-size: 12.5px; font-weight: 600; }

/* ---------------- builders (three-pane) ---------------- */
.builder { display: grid; grid-template-columns: 260px minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.builder-pane { position: sticky; top: 0; max-height: calc(100vh - 140px); overflow-y: auto; }
.builder-top { position: sticky; top: -26px; z-index: 5; background: var(--bg); padding: 4px 0 10px; margin-bottom: 8px; }
.builder-tabs { display: none; }
.palette-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 6px; background: var(--surface); cursor: grab; font-size: 13px; }
.palette-item:hover { border-color: var(--accent); background: var(--accent-100); }
.canvas-item { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 12px 14px; margin-bottom: 10px; position: relative; }
.canvas-item.selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-100); }
.canvas-item.dragging { opacity: .45; }
.canvas-item .handle { cursor: grab; color: var(--text-soft); padding: 0 6px; user-select: none; }
.canvas-item .ci-head { display: flex; gap: 8px; align-items: center; }
.canvas-item .ci-title { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.canvas-item .ci-actions { display: flex; gap: 2px; }
.canvas-section { border: 1px dashed var(--border); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 14px; background: var(--surface-3); }
.canvas-section > .cs-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-weight: 700; color: var(--heading-2); }
.drop-target { min-height: 40px; }
.drop-target.over { outline: 2px dashed var(--accent); outline-offset: 2px; background: var(--accent-100); }
.preview-pane { background: var(--surface-3); border: 1px dashed var(--border); border-radius: var(--radius); padding: 18px; }
.opt-list .opt-row { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.opt-list .opt-row input[type=text] { flex: 1; }
.opt-list .opt-row input[type=color] { width: 40px; flex: none; }
.crit-row { display: grid; grid-template-columns: 1fr 120px 1fr auto; gap: 6px; margin-bottom: 6px; align-items: center; }
.md-editor { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.md-editor textarea { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; min-height: 160px; }
.md-editor .md-preview { border: 1px dashed var(--border); border-radius: var(--radius-sm); padding: 10px 14px; background: var(--surface-3); overflow-y: auto; max-height: 420px; font-size: 13.5px; }
.chips-help { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.chips-help code { cursor: pointer; }
.unsaved { color: var(--warn); font-weight: 700; font-size: 12px; }

/* ---------------- diff review ---------------- */
.diff-list .diff-item { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 8px; background: var(--surface); }
.diff-item.op-add { border-left: 4px solid var(--ok); }
.diff-item.op-modify { border-left: 4px solid var(--warn); }
.diff-item.op-remove { border-left: 4px solid var(--err); }
.diff-body { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.diff-body pre { font-size: 11.5px; background: var(--surface-3); border: 1px solid var(--border-soft); border-radius: var(--radius-xs); padding: 8px; overflow: auto; max-height: 260px; white-space: pre-wrap; }
.diff-body .before pre { border-color: #fecaca; }
.diff-body .after pre { border-color: #bbf7d0; }

/* ---------------- theme picker ---------------- */
.theme-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.theme-card { border: 2px solid var(--border); border-radius: var(--radius); padding: 10px; cursor: pointer; background: var(--surface); }
.theme-card.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-100); }
.theme-thumb { height: 110px; border-radius: 6px; overflow: hidden; display: flex; border: 1px solid var(--border-soft); }
.theme-thumb .tt-side { width: 32%; padding: 8px 6px; }
.theme-thumb .tt-side i { display: block; height: 6px; border-radius: 3px; margin-bottom: 6px; opacity: .8; }
.theme-thumb .tt-main { flex: 1; padding: 8px; }
.theme-thumb .tt-bar { height: 8px; border-radius: 3px; margin-bottom: 8px; }
.theme-thumb .tt-card { border-radius: 4px; height: 26px; margin-bottom: 6px; border: 1px solid transparent; }

/* ---------------- knowledge base ---------------- */
.kb-row {
  display: flex; justify-content: space-between; gap: 16px; align-items: baseline;
  padding: 10px 14px; border-radius: var(--radius-sm); text-decoration: none; color: inherit;
}
.kb-row:hover { background: var(--accent-100); text-decoration: none; }
.kb-title { font-weight: 600; color: var(--heading-2); }
.kb-body .md h3 { font-size: 19px; color: var(--heading); margin: 20px 0 8px; }
.kb-body .md h4, .kb-body .md h5 { color: var(--heading-2); margin: 16px 0 6px; }
.kb-body .md p { margin-bottom: 10px; line-height: 1.65; }
.kb-body .md ul { padding-left: 22px; margin-bottom: 10px; }
.kb-body .md li { margin-bottom: 4px; }
.kb-body .md code { background: var(--code-bg); }

.bar-track { height: 8px; background: var(--code-bg); border-radius: 4px; overflow: hidden; display: flex; }
.bar-seg { height: 100%; }
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
.danger-text { color: var(--err); }
.ok-text { color: var(--ok); }

/* ---------------- survey / attestation take pages ---------------- */
.q-block { padding: 14px 0; border-bottom: 1px solid var(--border-soft); }
.q-block:last-child { border-bottom: none; }
.q-section { margin: 18px 0 6px; }
.q-section h3 { font-size: 16px; margin-bottom: 4px; }
.rating-scale { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.rating-scale label { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; min-width: 40px; background: var(--surface); }
.rating-scale label.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.rating-scale input { position: absolute; opacity: 0; width: 0; height: 0; }
.rating-ends { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-soft); margin-top: 4px; }
.choice-list label { display: flex; gap: 8px; align-items: center; padding: 5px 0; cursor: pointer; }
.choice-list input { width: auto; }
.ack-item { display: flex; gap: 10px; align-items: flex-start; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 8px; background: var(--surface); }
.ack-item input { width: auto; margin-top: 3px; }
.statement-box { background: var(--accent-100); padding: 16px 18px; border-radius: var(--radius); font-size: 15px; margin-bottom: 14px; }

/* ------------------------------------------------------- accessibility */
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 3000;
  background: var(--navy-900, #0f2a52); color: #fff; padding: 10px 18px;
  border-radius: 0 0 8px 0; font-weight: 600; text-decoration: none;
}
.skip-link:focus { left: 0; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---- v2.2: plan / Gantt, tasks, scoring ---- */
.gantt-wrap { overflow-x: auto; padding: 4px 8px 8px; }
.gantt { font-family: inherit; display: block; }
.gantt .g-month { fill: transparent; }
.gantt .g-month-alt { fill: var(--surface-2, #f6f7f9); }
.gantt .g-row-alt { fill: rgba(0, 0, 0, 0.025); }
.gantt .g-head { font-size: 11px; font-weight: 700; fill: var(--text); }
.gantt .g-sub { font-size: 9px; fill: var(--text-soft); }
.gantt .g-sub.today { fill: #dc2626; font-weight: 700; }
.gantt .g-week { stroke: var(--border); stroke-width: 1; }
.gantt .g-label { font-size: 12px; fill: var(--text); }
.gantt .g-label.done { fill: var(--text-soft); text-decoration: line-through; }
.gantt .g-label.overdue { fill: #dc2626; font-weight: 600; }
.gantt .g-bar { fill: var(--accent); opacity: 0.55; }
.gantt .g-bar.done { fill: #16a34a; }
.gantt .g-bar.overdue { fill: #dc2626; }
.gantt .g-progress { fill: var(--accent); opacity: 0.95; pointer-events: none; }
.gantt .g-bar.done + .g-progress { fill: #16a34a; }
.gantt .g-bartext { font-size: 10px; fill: #fff; font-weight: 700; pointer-events: none; }
.gantt .g-milestone { fill: #7c3aed; }
.gantt .g-milestone.done { fill: #16a34a; }
.gantt .g-milestone.overdue { fill: #dc2626; }
.gantt .g-dep { fill: none; stroke: var(--text-soft); stroke-width: 1.2; stroke-dasharray: 3 2; }
.gantt .g-dep-head { fill: var(--text-soft); }
.gantt .g-dep.conflict, .gantt .g-dep-head.conflict { stroke: #dc2626; fill: #dc2626; }
.gantt .g-dep.conflict { fill: none; }
.gantt .g-today { stroke: #dc2626; stroke-width: 1.5; stroke-dasharray: 4 3; }
.progress-mini { display: inline-block; vertical-align: middle; width: 70px; height: 8px; border-radius: 4px; background: var(--surface-3, #e5e7eb); overflow: hidden; }
.progress-mini > div { height: 100%; background: var(--accent); }
.score-card .section-title { margin-top: 8px; }
.score-editor input[type=number] { text-align: right; }
[data-theme="dark"] .gantt .g-row-alt, :root:not([data-theme="light"]) .gantt .g-row-alt { fill: rgba(255, 255, 255, 0.03); }

/* ====================================================== 3.1 additions */
.heatmap { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.heat-cell { border-radius: var(--radius, 8px); padding: 10px 12px; cursor: pointer; border: 1px solid transparent; transition: filter .15s; }
.heat-cell:hover { filter: brightness(.96); }
.heat-cell.rag-none { background: var(--surface-2); }
.heat-label { font-size: 12px; font-weight: 600; margin-bottom: 4px; line-height: 1.25; }
.heat-n { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.lec .lec-grid { stroke: var(--border, #e2e8f0); stroke-width: 1; }
.lec .lec-tick { font-size: 11px; fill: var(--muted, #64748b); }
.lec .lec-area { fill: rgba(42, 120, 214, .12); }
.lec .lec-line { fill: none; stroke: #2a78d6; stroke-width: 2; }
.lec .lec-p95 { stroke: #7c3aed; stroke-dasharray: 4 3; }
.lec .lec-threshold { stroke: #dc2626; stroke-dasharray: 5 3; }
.lec .lec-threshold-text { fill: #dc2626; }
.spark .spark-green { fill: none; stroke: #16a34a; stroke-width: 2; }
.spark .spark-amber { fill: none; stroke: #f59e0b; stroke-width: 2; }
.spark .spark-red { fill: none; stroke: #dc2626; stroke-width: 2; }
.spark .spark-none { fill: none; stroke: #94a3b8; stroke-width: 2; }
.depgraph { display: block; max-width: 100%; }
.depgraph .dep-edge { stroke: #94a3b8; stroke-width: 1.4; }
.depgraph .dep-depends { stroke: #2a78d6; }
.depgraph .dep-supports { stroke: #16a34a; }
.depgraph .dep-arrowhead { fill: #64748b; }
.depgraph .dep-edge-label { font-size: 9px; fill: var(--muted, #64748b); }
.depgraph .dep-label { font-size: 11px; font-weight: 700; fill: var(--text, #0d1b34); }
.depgraph .dep-sub { font-size: 9.5px; fill: var(--muted, #64748b); }
.depgraph .dep-node circle { stroke: #fff; stroke-width: 2; }
.depgraph .dep-node.root circle { stroke: var(--text, #0d1b34); stroke-width: 3; }
.depgraph .dep-node circle.closed { opacity: .45; }
.row-stale td:first-child { box-shadow: inset 3px 0 0 #dc2626; }

/* ---- 3.2: compound fields, conditions, multi-step forms ---- */
.table-scroll { overflow-x: auto; max-width: 100%; }
.matrix-grid { border-collapse: collapse; font-size: 13px; min-width: 320px; }
.matrix-grid th, .matrix-grid td { border: 1px solid var(--border); padding: 6px 8px; text-align: center; }
.matrix-grid th[scope="row"] { text-align: left; font-weight: 600; background: var(--surface-2, var(--surface)); min-width: 140px; }
.matrix-grid thead th { font-weight: 600; color: var(--text-soft); background: var(--surface-2, var(--surface)); }
.matrix-grid th.mx-scale { box-shadow: inset 0 -3px 0 var(--mx, transparent); }
.matrix-grid td.mx-cell { cursor: pointer; position: relative; }
.matrix-grid td.mx-cell label { display: block; cursor: pointer; margin: 0; }
.matrix-grid td.mx-cell input { position: absolute; opacity: 0; width: 0; height: 0; }
.matrix-grid .mx-dot { display: inline-block; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--border); background: var(--surface); }
.matrix-grid td.mx-cell.on .mx-dot { background: var(--mx, var(--accent)); border-color: var(--mx, var(--accent)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--mx, var(--accent)) 25%, transparent); }
.matrix-grid td.mx-cell.on { background: color-mix(in srgb, var(--mx, var(--accent)) 14%, transparent); }
.matrix-grid.ro td.mx-cell { cursor: default; }
.matrix-grid .mx-val { font-weight: 600; }
.matrix-grid .mx-select { min-width: 90px; }
.mx-legend { display: flex; gap: 12px; flex-wrap: wrap; }
.mx-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: middle; }
.rating-scale label { --rt: var(--accent); }
.rating-scale label.on { background: var(--rt); border-color: var(--rt); color: #fff; }
.table-field { border-collapse: collapse; font-size: 13px; width: 100%; }
.table-field th, .table-field td { border: 1px solid var(--border); padding: 4px 6px; vertical-align: top; text-align: left; }
.table-field thead th { font-weight: 600; color: var(--text-soft); background: var(--surface-2, var(--surface)); white-space: nowrap; }
.table-field td input, .table-field td select, .table-field td textarea { margin: 0; min-width: 90px; }
.table-field .tf-totals td { font-weight: 700; background: var(--surface-2, var(--surface)); }
.table-field.ro td { padding: 6px 8px; }
.upload-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 6px; }
.upload-item { display: flex; gap: 6px; align-items: center; padding: 4px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); font-size: 13px; }
.upload-item a { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.address-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.address-grid input:not(.addr-half) { grid-column: 1 / -1; }
.json-view { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; background: var(--surface-2, var(--surface)); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; max-height: 260px; overflow: auto; white-space: pre-wrap; }
textarea.mono, input.mono, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.derived-field { padding: 6px 0; }
.f-row.readonly { opacity: .75; }
.condition-editor .crit-row { grid-template-columns: minmax(120px, 1fr) minmax(120px, 160px) minmax(120px, 1.4fr) auto; }
.choice-list.inline { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.choice-list.inline label { padding: 2px 0; }
.cfg-box { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px 2px; margin-bottom: 12px; background: var(--surface-2, var(--surface)); }
.cfg-box .section-title { margin-top: 0; }
.tc-head, .tc-row { display: grid; grid-template-columns: 1.4fr 110px 1.4fr 40px 44px 28px; gap: 6px; align-items: center; margin-bottom: 4px; }
.tc-head { font-weight: 600; }
.rule-row { display: grid; grid-template-columns: 24px 1.4fr 1fr 28px; gap: 6px; align-items: center; margin-bottom: 4px; }
.route-rule { border-left: 3px solid var(--accent-100); padding: 4px 0 4px 10px; margin-bottom: 8px; }
.form-steps { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.form-step { padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); font-size: 12.5px; color: var(--text-soft); background: var(--surface); }
.form-step.current { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }
.form-step.done { border-color: var(--accent); color: var(--accent); cursor: pointer; }
.page-hidden { display: none !important; }
.survey-page > h3 { font-size: 16px; margin-bottom: 6px; }
.child-group { margin-top: 12px; }
.child-row { margin-bottom: 8px; }
.ranking-list { list-style: none; padding: 0; margin: 4px 0; max-width: 460px; }
.ranking-list li { display: flex; gap: 8px; align-items: center; padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 4px; background: var(--surface); }
.ranking-list .rank-n { width: 22px; height: 22px; border-radius: 50%; background: var(--accent-100); color: var(--accent); font-weight: 700; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; }
.ranking-list .rank-label { flex: 1; }
.ranking-list .rank-btns { display: flex; gap: 2px; }
.slider-wrap input[type="range"] { flex: 1; max-width: 420px; }
.slider-out { font-weight: 700; min-width: 48px; }
.btn.blocked { opacity: .55; cursor: not-allowed; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 12px; }
.scale-editor input[type="color"] { width: 36px; height: 30px; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); background: none; }
.stagebar + .chip-row .small { align-self: center; }

/* ---------------- document templates ---------------- */
.doc-canvas { min-height: 300px; }
.doc-page-strip { border: 1px dashed var(--border); border-radius: var(--radius-sm); padding: 6px 10px; margin-bottom: 10px; background: var(--surface-3); }
.merge-list { max-height: 260px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px; margin-top: 6px; background: var(--surface); }
.merge-item { display: flex; flex-direction: column; gap: 1px; padding: 4px 6px; border-radius: var(--radius-xs); cursor: pointer; }
.merge-item:hover { background: var(--accent-100); }
.merge-item code { font-size: 12px; }
.doc-preview { margin-top: 8px; }
.doc-paper { background: #fff; color: var(--doc-body, #1F2937); border: 1px solid var(--border); box-shadow: var(--shadow); padding: 28px 32px; font-size: 12.5px; line-height: 1.45; max-width: 100%; }
.doc-paper.landscape { padding: 22px 40px; }
.doc-paper h1 { font-size: 22px; color: var(--doc-heading, #0D1B34); margin: 0 0 4px; }
.doc-paper h2 { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--doc-accent, #1F5FBF); margin: 16px 0 6px; }
.doc-paper h3 { font-size: 13px; color: var(--doc-heading, #0D1B34); margin: 10px 0 4px; }
.doc-paper p { margin: 0 0 6px; }
.doc-paper .doc-meta { color: var(--doc-muted, #64748B); font-size: 11px; }
.doc-paper blockquote { margin: 0 0 8px 12px; color: var(--doc-muted, #64748B); border-left: 2px solid var(--doc-rule, #C9A227); padding-left: 8px; }
.doc-paper pre { font-size: 11px; white-space: pre-wrap; background: #f6f8fa; padding: 6px 8px; border-radius: 4px; }
.doc-paper hr { border: 0; border-top: 1.5px solid var(--doc-rule, #C9A227); margin: 10px 0; }
.doc-paper ul, .doc-paper ol { margin: 0 0 8px 18px; padding: 0; }
.doc-paper table { width: 100%; border-collapse: collapse; margin-bottom: 10px; }
.doc-paper .doc-kv th { text-align: left; width: 28%; color: var(--doc-muted, #64748B); font-weight: 700; padding: 4px 6px 4px 0; vertical-align: top; border-bottom: 1px solid #E2E8F0; }
.doc-paper .doc-kv td { padding: 4px 0; border-bottom: 1px solid #E2E8F0; vertical-align: top; white-space: pre-wrap; }
.doc-paper .doc-table th { text-align: left; font-size: 10.5px; color: var(--doc-muted, #64748B); border-bottom: 1px solid #E2E8F0; padding: 3px 4px; }
.doc-paper .doc-table td { font-size: 11px; border-bottom: 1px solid #E2E8F0; padding: 3px 4px; vertical-align: top; }
.doc-paper .doc-table tbody tr:nth-child(even) td { background: #F6F8FA; }
.doc-paper .doc-hf { color: var(--doc-muted, #64748B); font-size: 10px; border-bottom: 1px solid #E2E8F0; padding-bottom: 4px; margin-bottom: 14px; }
.doc-paper .doc-hf.foot { border-bottom: 0; border-top: 1px solid #E2E8F0; margin: 18px 0 0; padding-top: 6px; display: flex; justify-content: space-between; }
.doc-paper .doc-pagebreak { text-align: center; color: var(--doc-muted, #64748B); font-size: 10px; border-top: 1px dashed #94a3b8; margin: 14px 0; padding-top: 2px; }
.doc-paper .doc-sign { display: grid; gap: 16px; margin: 26px 0 8px; }
.doc-paper .doc-sign .line { border-top: 1px solid var(--doc-body, #1F2937); margin-right: 24px; margin-bottom: 3px; }
.doc-export { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.doc-export-layout { max-width: 220px; font-size: 12.5px; padding: 4px 6px; }
@media (max-width: 900px) { .builder { grid-template-columns: 1fr; } .builder-pane { position: static; max-height: none; } }

.xp-list { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; max-height: 300px; overflow-y: auto; background: var(--surface); }
.xp-individual ul li { margin: 2px 0; }
