/* AI Governance Hub — Professional Design System */
/* Direction: Enterprise editorial — Notion × Linear × Belgian consultancy */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* Core palette — deep navy + warm coral */
  --navy-950: #0b0f1a;
  --navy-900: #111827;
  --navy-800: #1e2738;
  --navy-700: #2a364a;
  --navy-600: #3d4b63;
  --navy-500: #556479;
  --navy-400: #7b8ba2;
  --navy-300: #a3b1c6;
  --navy-200: #cdd5e0;
  --navy-100: #e8ecf1;
  --navy-50:  #f4f6f9;

  --coral: #e05d44;
  --coral-dark: #c7422d;
  --coral-deep: #a3331f;
  --coral-tint: #fef0ed;
  --coral-glow: #fcd7cf;

  /* Semantic surfaces */
  --paper: #f8f9fb;
  --card: #ffffff;
  --raised: #ffffff;
  --border: #e5e9f0;
  --border2: #d0d7e2;
  --ink: var(--navy-900);
  --muted: var(--navy-500);
  --faint: var(--navy-300);

  /* Status ramp */
  --emerald: #10885a;
  --emerald-tint: #ecfaf3;
  --sapphire: #2563a8;
  --sapphire-tint: #edf3fb;
  --amber: #c27014;
  --amber-tint: #fef6eb;
  --rose: #d03e3e;
  --rose-tint: #fef0f0;
  --violet: #6d4aaa;
  --violet-tint: #f3effc;
  --slate: var(--navy-400);
  --slate-tint: var(--navy-50);

  /* Elevation */
  --shadow-xs: 0 1px 2px rgba(11,15,26,.04);
  --shadow-sm: 0 1px 3px rgba(11,15,26,.05), 0 4px 14px rgba(11,15,26,.05);
  --shadow-md: 0 4px 12px rgba(11,15,26,.07), 0 12px 28px rgba(11,15,26,.08);
  --shadow-lg: 0 8px 24px rgba(11,15,26,.12), 0 20px 48px rgba(11,15,26,.1);
  --shadow-inset: inset 0 1px 2px rgba(11,15,26,.06);

  /* Radii */
  --r-xs: 4px; --r-sm: 6px; --r-md: 10px; --r-lg: 14px; --r-xl: 18px; --r-2xl: 24px;

  /* Transitions */
  --ease: cubic-bezier(.22,.68,.4,1);
  --duration: .18s;
}

/* ===== DARK MODE ===== */
[data-theme="dark"] {
  --paper: #0d1117;
  --card: #161b22;
  --raised: #1c2333;
  --border: #21262d;
  --border2: #30363d;
  --ink: #e6edf3;
  --muted: #8b949e;
  --faint: #484f58;
  --emerald: #3fb950; --emerald-tint: #0d2117;
  --sapphire: #58a6ff; --sapphire-tint: #0d1d32;
  --amber: #d29922; --amber-tint: #2a1f0a;
  --rose: #f85149; --rose-tint: #2d0f0f;
  --violet: #a78bfa; --violet-tint: #1a1333;
  --slate: #6e7681; --slate-tint: #161b22;
  --coral: #f47458; --coral-dark: #e05d44; --coral-tint: #2d160f; --coral-glow: #3d1f14;
  --shadow-xs: 0 1px 2px rgba(0,0,0,.3);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.3), 0 4px 14px rgba(0,0,0,.2);
  --shadow-md: 0 4px 12px rgba(0,0,0,.3), 0 12px 28px rgba(0,0,0,.2);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.4), 0 20px 48px rgba(0,0,0,.3);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0d1117; --card: #161b22; --raised: #1c2333;
    --border: #21262d; --border2: #30363d;
    --ink: #e6edf3; --muted: #8b949e; --faint: #484f58;
    --emerald: #3fb950; --emerald-tint: #0d2117;
    --sapphire: #58a6ff; --sapphire-tint: #0d1d32;
    --amber: #d29922; --amber-tint: #2a1f0a;
    --rose: #f85149; --rose-tint: #2d0f0f;
    --violet: #a78bfa; --violet-tint: #1a1333;
    --slate: #6e7681; --slate-tint: #161b22;
    --coral: #f47458; --coral-dark: #e05d44; --coral-tint: #2d160f; --coral-glow: #3d1f14;
    --shadow-xs: 0 1px 2px rgba(0,0,0,.3); --shadow-sm: 0 1px 3px rgba(0,0,0,.3), 0 4px 14px rgba(0,0,0,.2);
    --shadow-md: 0 4px 12px rgba(0,0,0,.3), 0 12px 28px rgba(0,0,0,.2);
    --shadow-lg: 0 8px 24px rgba(0,0,0,.4), 0 20px 48px rgba(0,0,0,.3);
  }
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14.5px;
  line-height: 1.6;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4 {
  font-family: "DM Sans", sans-serif;
  font-weight: 700;
  letter-spacing: -.025em;
  margin: 0;
  line-height: 1.2;
}
a { color: var(--coral); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: var(--coral-glow); color: var(--navy-900); }
:focus-visible { outline: 2px solid var(--coral); outline-offset: 2px; border-radius: var(--r-xs); }

/* ===== LAYOUT ===== */
.wrap { max-width: 1220px; margin: 0 auto; padding: 0 32px; }
@media (max-width: 700px) { .wrap { padding: 0 16px; } }

/* ===== HEADER ===== */
header.app {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 30;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(255,255,255,.85);
}
[data-theme="dark"] header.app { background: rgba(22,27,34,.88); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) header.app { background: rgba(22,27,34,.88); } }

header.app::before {
  content: ""; display: block; height: 3px;
  background: linear-gradient(90deg, var(--coral), #f4801f, var(--coral-dark));
}

.top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 16px 0 12px; flex-wrap: wrap;
}
.brand h1 {
  font-size: 22px; font-weight: 700;
  background: linear-gradient(135deg, var(--coral), var(--coral-dark));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.brand p { margin: 1px 0 0; color: var(--muted); font-size: 12.5px; font-weight: 400; letter-spacing: .01em; }

.top-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.savetag { font-size: 11px; color: var(--faint); }

/* ===== TABS ===== */
nav.tabs {
  display: flex; gap: 0; flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  margin: 0 -32px; padding: 0 32px;
}
.tab {
  appearance: none; border: none; background: none;
  font: inherit; font-size: 13px; font-weight: 500;
  color: var(--muted); padding: 10px 16px 12px;
  cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -1px; transition: color var(--duration) var(--ease);
  white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab.active {
  color: var(--coral); border-bottom-color: var(--coral);
  font-weight: 600;
}
@media (max-width: 700px) {
  nav.tabs { margin: 0 -16px; padding: 0 16px; overflow-x: auto; flex-wrap: nowrap; }
  .tab { padding: 9px 12px 11px; font-size: 12.5px; flex-shrink: 0; }
}

/* ===== VIEWS ===== */
main { padding: 0 0 60px; }
.view { display: none; padding-top: 20px; }
.view.active { display: block; animation: viewIn .28s var(--ease); }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ===== BUTTONS ===== */
button.btn {
  appearance: none; font: inherit; font-size: 13px; font-weight: 500;
  border: 1px solid var(--border2); background: var(--card); color: var(--ink);
  padding: 6px 14px; border-radius: var(--r-md); cursor: pointer;
  transition: all var(--duration) var(--ease); min-height: 34px;
  display: inline-flex; align-items: center; gap: 6px;
}
button.btn:hover { border-color: var(--coral); color: var(--coral); box-shadow: var(--shadow-xs); }
button.btn:active { transform: scale(.98); }
button.btn.primary {
  background: linear-gradient(135deg, var(--coral), var(--coral-dark));
  color: #fff; border-color: transparent; font-weight: 600;
  box-shadow: 0 1px 3px rgba(224,93,68,.25);
}
button.btn.primary:hover { box-shadow: 0 4px 12px rgba(224,93,68,.3); transform: translateY(-1px); border-color: transparent; color: #fff; }
button.btn.primary:active { transform: translateY(0) scale(.98); }
button.btn.sm { padding: 4px 10px; font-size: 12px; min-height: 28px; border-radius: var(--r-sm); }
button.btn.danger:hover { border-color: var(--rose); color: var(--rose); }
button.btn:disabled { opacity: .4; pointer-events: none; }

/* ===== FILTERS ===== */
.filters {
  display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 14px 16px;
  margin-bottom: 20px; box-shadow: var(--shadow-xs);
}
.field { display: flex; flex-direction: column; gap: 3px; }
.field label {
  font-size: 10px; color: var(--muted); font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em;
}
select, input, textarea {
  font: inherit; font-size: 13px; color: var(--ink);
  background: var(--paper); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 6px 10px; outline: none;
  transition: border-color var(--duration), box-shadow var(--duration);
  min-height: 34px;
}
select:focus, input:focus, textarea:focus {
  border-color: var(--coral);
  box-shadow: 0 0 0 3px var(--coral-tint);
}
select:hover, input:hover { border-color: var(--border2); }
.filters .spacer { flex: 1 1 auto; min-width: 12px; }

/* ===== PANELS ===== */
.panel {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.panel .ph {
  padding: 12px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 8px;
}
.panel .ph h3 { font-size: 15px; font-weight: 600; }
.panel .pb { padding: 16px 18px; }

/* ===== GRID LAYOUT ===== */
.grid2 { display: grid; grid-template-columns: 1.5fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }

/* ===== TABLE ===== */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; font-size: 10px; text-transform: uppercase;
  letter-spacing: .07em; color: var(--muted); font-weight: 600;
  padding: 8px 12px; border-bottom: 2px solid var(--border);
  position: sticky; top: 84px; background: var(--card); z-index: 1;
}
td {
  padding: 10px 12px; border-bottom: 1px solid var(--border);
  vertical-align: middle; font-variant-numeric: tabular-nums;
}
tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--duration); }
tbody tr:nth-child(even) td { background: rgba(0,0,0,.015); }
[data-theme="dark"] tbody tr:nth-child(even) td { background: rgba(255,255,255,.015); }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--coral-tint) !important; }
tr.grp-row { cursor: pointer; }
tr.grp-row td { background: var(--paper) !important; border-bottom: 1px solid var(--border2); font-weight: 600; }
tr.grp-row:hover td { background: var(--navy-100) !important; }
[data-theme="dark"] tr.grp-row:hover td { background: var(--navy-800) !important; }
.grp-caret { display: inline-block; width: 14px; color: var(--coral); font-size: 10px; }

/* ===== BADGES ===== */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; padding: 2px 8px; border-radius: 50px;
  font-weight: 600; white-space: nowrap; line-height: 1.5;
  letter-spacing: .01em;
}
.b-teal   { background: var(--emerald-tint); color: var(--emerald); }
.b-red    { background: var(--rose-tint);    color: var(--rose); }
.b-blue   { background: var(--sapphire-tint); color: var(--sapphire); }
.b-amber  { background: var(--amber-tint);  color: var(--amber); }
.b-gray   { background: var(--slate-tint);  color: var(--slate); }
.b-purple { background: var(--violet-tint); color: var(--violet); }

/* ===== KPI CARDS ===== */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
@media (max-width: 820px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }
.kpi-box {
  position: relative; background: var(--card);
  border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 16px 16px 14px; box-shadow: var(--shadow-xs);
  overflow: hidden; transition: transform var(--duration) var(--ease), box-shadow var(--duration);
}
.kpi-box:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.kpi-box::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--kc); border-radius: 0 2px 2px 0;
}
.kpi-box .khead { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.kpi-box .kicon {
  width: 32px; height: 32px; border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; background: var(--kc-tint); color: var(--kc); flex-shrink: 0;
}
.kpi-box .kval {
  font-family: "JetBrains Mono", monospace; font-weight: 600;
  font-size: 28px; line-height: 1; color: var(--ink);
}
.kpi-box .klabel { font-size: 12px; color: var(--muted); line-height: 1.3; }

/* ===== FOUR-LEAF CHART ===== */
svg.fl { width: 100%; height: auto; display: block; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; font-size: 12px; color: var(--muted); padding: 12px 18px 0; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; vertical-align: 0; margin-right: 4px; }
.fl-tip {
  position: fixed; z-index: 60; pointer-events: none;
  opacity: 0; transition: opacity .15s;
  background: var(--card); border: 1px solid var(--border2);
  border-radius: var(--r-lg); padding: 10px 14px;
  font-size: 12.5px; line-height: 1.5;
  box-shadow: var(--shadow-lg); max-width: 240px;
}
.fl-tip.show { opacity: 1; }
.fl-tip .tt-title { font-weight: 700; font-size: 13px; margin-bottom: 4px; color: var(--coral); }
.fl-tip .tt-row { display: flex; justify-content: space-between; gap: 14px; color: var(--muted); font-size: 12px; }
.fl-tip .tt-row b { color: var(--ink); font-weight: 600; font-family: "JetBrains Mono", monospace; font-size: 12px; }
.fl-tip .tt-chip { display: inline-block; background: var(--paper); border: 1px solid var(--border); color: var(--muted); border-radius: var(--r-xs); padding: 1px 6px; font-size: 10px; margin: 2px 2px 0 0; }

.fl-toolbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.fl-ctl {
  display: flex; align-items: center; gap: 5px;
  background: var(--paper); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 3px 8px 3px 10px;
}
.fl-ctl .cl { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; white-space: nowrap; }
.fl-toggle {
  display: flex; align-items: center; gap: 6px;
  background: var(--paper); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 4px 10px;
  cursor: pointer; user-select: none; font-size: 12px; color: var(--ink);
  transition: border-color var(--duration);
}
.fl-toggle:hover { border-color: var(--border2); }
.fl-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.fl-toggle .sw {
  position: relative; width: 30px; height: 16px;
  border-radius: 10px; background: var(--border2);
  transition: background var(--duration); flex-shrink: 0;
}
.fl-toggle .sw::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 12px; height: 12px; border-radius: 50%;
  background: #fff; transition: transform var(--duration);
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.fl-toggle input:checked + .sw { background: var(--coral); }
.fl-toggle input:checked + .sw::after { transform: translateX(14px); }
.fl-countpill {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px; color: var(--muted);
  background: var(--paper); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 4px 8px;
}

/* Detail */
.detail-empty { color: var(--faint); font-size: 13px; padding: 8px 0; font-style: italic; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 4px 12px; font-size: 13px; margin: 12px 0; }
.kv dt { color: var(--muted); font-weight: 500; }
.kv dd { margin: 0; word-break: break-word; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.stat {
  background: var(--paper); border-radius: var(--r-sm); padding: 10px 12px;
  border: 1px solid var(--border); text-align: center;
}
.stat .l { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 2px; }
.stat .v { font-size: 20px; font-family: "JetBrains Mono", monospace; font-weight: 600; }

/* ===== RUNNING / CARDS ===== */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.uc-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 14px 16px;
  box-shadow: var(--shadow-xs);
  transition: border-color var(--duration), box-shadow var(--duration);
}
.uc-card:hover { border-color: var(--border2); box-shadow: var(--shadow-sm); }
.uc-card h3 { font-size: 15px; margin-bottom: 3px; }
.uc-card .meta { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.mt-bar { height: 4px; border-radius: 3px; background: var(--border); overflow: hidden; margin: 8px 0 4px; }
.mt-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--emerald), #2dd4a0); border-radius: 3px; }

input[type=range] {
  -webkit-appearance: none; appearance: none;
  height: 4px; border-radius: 3px;
  background: var(--border2); outline: none; cursor: pointer;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px;
  border-radius: 50%; background: var(--coral);
  box-shadow: 0 1px 4px rgba(224,93,68,.3); transition: transform .1s;
}
input[type=range]::-webkit-slider-thumb:hover { transform: scale(1.15); }

/* Gantt */
.gantt-scroll { overflow-x: auto; border-radius: 0 0 var(--r-lg) var(--r-lg); padding: 4px; }

/* ===== MEETINGS ===== */
.meeting {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-lg); margin-bottom: 12px;
  box-shadow: var(--shadow-xs); overflow: hidden;
  transition: box-shadow var(--duration);
}
.meeting:hover { box-shadow: var(--shadow-sm); }
.meeting .mhd {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  background: var(--paper);
}
.meeting .mbd { padding: 12px 16px; }
.decision {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 8px 0; border-top: 1px solid var(--border);
}
.decision:first-child { border-top: none; }

/* ===== REGISTER HELPERS ===== */
.memlist { display: flex; flex-direction: column; gap: 4px; }
.memrow {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px; width: 100%; text-align: left;
  background: var(--paper); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 7px 12px;
  cursor: pointer; font: inherit; transition: border-color var(--duration);
}
.memrow:hover { border-color: var(--coral); }
.memrow .mn { font-weight: 600; font-size: 13px; }
.memrow .ms { display: flex; align-items: center; white-space: nowrap; }

/* ===== KEBAB MENU ===== */
.kebab { position: relative; display: inline-block; }
.kebab-btn {
  appearance: none; border: 1px solid var(--border);
  background: var(--card); border-radius: var(--r-sm);
  width: 28px; height: 26px; cursor: pointer; color: var(--muted);
  font-size: 14px; line-height: 1; padding: 0;
  transition: all var(--duration);
}
.kebab-btn:hover { border-color: var(--coral); color: var(--coral); }
.kebab-menu {
  position: absolute; right: 0; top: 30px;
  background: var(--card); border: 1px solid var(--border2);
  border-radius: var(--r-md); box-shadow: var(--shadow-md);
  z-index: 20; min-width: 170px; padding: 4px;
  display: none; animation: menuIn .12s var(--ease);
}
@keyframes menuIn { from { opacity: 0; transform: scale(.96) translateY(-4px); } to { opacity: 1; transform: none; } }
.kebab-menu.show { display: block; }
.kebab-menu .mlabel {
  font-size: 10px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--faint); padding: 4px 8px; font-weight: 600;
}
.kebab-menu button {
  display: block; width: 100%; text-align: left;
  border: none; background: none; font: inherit; font-size: 13px;
  padding: 5px 8px; border-radius: var(--r-sm); cursor: pointer; color: var(--ink);
  transition: background .08s;
}
.kebab-menu button:hover { background: var(--paper); }
.kebab-menu button.cur { font-weight: 600; color: var(--coral); }

/* ===== MODALS ===== */
.overlay {
  position: fixed; inset: 0;
  background: rgba(11, 15, 26, .5);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: none; align-items: center; justify-content: center;
  z-index: 50; padding: 20px;
}
.overlay.show { display: flex; animation: overlayIn .2s var(--ease); }
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--card); border-radius: var(--r-xl);
  width: 100%; max-width: 620px; max-height: 90vh; overflow: auto;
  box-shadow: var(--shadow-lg); border: 1px solid var(--border);
  animation: modalIn .25s var(--ease);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(.97); } to { opacity: 1; transform: none; } }
.modal .mh {
  position: sticky; top: 0; z-index: 2;
  background: var(--card); padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
}
.modal .mh h3 { font-size: 17px; }
.modal .mb { padding: 20px; }
.close-x {
  appearance: none; border: 1px solid var(--border);
  background: var(--paper); font-size: 16px; color: var(--muted);
  cursor: pointer; line-height: 1; width: 32px; height: 32px;
  border-radius: var(--r-sm); display: flex; align-items: center; justify-content: center;
  transition: all var(--duration);
}
.close-x:hover { border-color: var(--coral); color: var(--coral); background: var(--coral-tint); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 4px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.form-grid input, .form-grid select, .form-grid textarea { width: 100%; }
.rng { display: flex; align-items: center; gap: 10px; }
.rng output { font-family: "JetBrains Mono", monospace; font-size: 16px; min-width: 30px; text-align: right; }
.mf { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } .form-grid .full { grid-column: 1; } }

/* ===== TOAST ===== */
#toast-container {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 100; pointer-events: none;
}
.toast {
  background: var(--navy-800); color: #fff;
  padding: 10px 16px; border-radius: var(--r-md);
  font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-md);
  pointer-events: auto;
  display: flex; align-items: center; gap: 8px;
  max-width: 300px;
  animation: toastIn .22s var(--ease);
}
.toast.success { background: var(--emerald); }
.toast.error   { background: var(--rose); }
.toast.warning { background: var(--amber); color: var(--navy-900); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.toast.out { animation: toastOut .18s var(--ease) forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px); } }

/* ===== LOADING ===== */
.loading-bar {
  position: fixed; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--coral), #f4801f, var(--coral));
  z-index: 200; transform-origin: left;
  animation: loadingPulse 1.2s ease infinite;
}
@keyframes loadingPulse { 0%{transform:scaleX(0)} 50%{transform:scaleX(.7)} 100%{transform:scaleX(1)} }

/* ===== EMPTY STATES ===== */
.empty {
  text-align: center; color: var(--faint);
  padding: 44px 20px; font-size: 13.5px; line-height: 1.7;
}
.empty-icon { font-size: 32px; display: block; margin-bottom: 8px; opacity: .6; }
.pill-link { color: var(--coral); text-decoration: none; border-bottom: 1px solid var(--coral-glow); transition: border-color var(--duration); }
.pill-link:hover { border-color: var(--coral); }
.note { font-size: 12px; color: var(--faint); margin-top: 3px; }

/* ===== DARK TOGGLE ===== */
.dark-toggle {
  appearance: none; border: 1px solid var(--border);
  background: var(--card); border-radius: var(--r-sm);
  width: 32px; height: 32px; cursor: pointer; color: var(--muted);
  font-size: 14px; display: flex; align-items: center; justify-content: center;
  transition: all var(--duration);
}
.dark-toggle:hover { border-color: var(--border2); background: var(--paper); }

/* ===== FOOTER ===== */
footer.app-footer {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: 32px; background: var(--card);
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: var(--faint); gap: 6px;
  z-index: 25;
}
footer.app-footer a { color: var(--faint); }
footer.app-footer a:hover { color: var(--coral); }

/* ===== PRINT ===== */
@media print {
  header.app { position: static; }
  footer.app-footer, .overlay, #toast-container { display: none !important; }
  .panel { box-shadow: none; border: 1px solid #ccc; }
}
