:root {
  --forest-950: #061d16;
  --forest-900: #0b2c22;
  --forest-850: #0b3327;
  --forest-800: #124734;
  --forest-700: #176044;
  --forest-600: #1d7552;
  --forest-100: #dcece4;
  --forest-50: #eef6f1;
  --amber-600: #d66f12;
  --amber-500: #f08a24;
  --amber-400: #f6a64a;
  --amber-100: #ffead2;
  --amber-50: #fff6e9;
  --red-700: #a73832;
  --red-600: #c64a42;
  --red-100: #f8deda;
  --red-50: #fff2f0;
  --blue-600: #276782;
  --blue-100: #dcebf1;
  --ink-950: #10201b;
  --ink-800: #273a33;
  --ink-700: #3f514b;
  --ink-600: #5d6c67;
  --ink-500: #75817d;
  --ink-400: #99a39f;
  --line-strong: #cfd8d3;
  --line: #dfe6e2;
  --line-soft: #edf1ef;
  --surface: #ffffff;
  --surface-2: #f7f9f8;
  --surface-3: #f1f5f3;
  --canvas: #f4f7f5;
  --shadow-xs: 0 1px 2px rgb(6 29 22 / 4%);
  --shadow-sm: 0 3px 10px rgb(6 29 22 / 6%);
  --shadow-md: 0 12px 32px rgb(6 29 22 / 10%);
  --shadow-lg: 0 28px 70px rgb(6 29 22 / 18%);
  --radius-sm: 7px;
  --radius: 11px;
  --radius-lg: 16px;
  --font-sans: "Raleway", "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  --sidebar-width: 266px;
  --topbar-height: 68px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--ink-950);
  background: var(--canvas);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

button, input, textarea, select { font: inherit; }
button { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
svg { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 8px;
  left: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  color: white;
  background: var(--forest-950);
  font-weight: 700;
  transform: translateY(-150%);
  transition: transform .18s ease;
}

.skip-link:focus { transform: translateY(0); }

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--amber-500) 78%, white);
  outline-offset: 3px;
}

/* Demo status */
.demo-banner {
  position: relative;
  z-index: 300;
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 7px 18px;
  color: #f5fbf8;
  background: var(--forest-950);
  border-bottom: 1px solid rgb(255 255 255 / 8%);
  font-size: .72rem;
  letter-spacing: .025em;
  text-align: center;
}

.demo-banner strong { color: #ffd39e; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.demo-pulse { width: 6px; height: 6px; flex: 0 0 auto; border-radius: 50%; background: var(--amber-400); box-shadow: 0 0 0 4px rgb(246 166 74 / 13%); animation: pulse 2.2s ease-in-out infinite; }

/* Shell */
.app-shell { min-height: calc(100vh - 34px); }

.sidebar {
  position: fixed;
  z-index: 200;
  top: 34px;
  bottom: 0;
  left: 0;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  padding: 22px 15px 16px;
  overflow-y: auto;
  color: #f5fbf8;
  background:
    radial-gradient(circle at 40px 20px, rgb(246 166 74 / 8%), transparent 150px),
    linear-gradient(180deg, var(--forest-850), var(--forest-950));
  border-right: 1px solid rgb(255 255 255 / 6%);
  scrollbar-width: thin;
  scrollbar-color: rgb(255 255 255 / 16%) transparent;
}

.sidebar::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .13;
  background-image: linear-gradient(135deg, transparent 47%, rgb(255 255 255 / 9%) 48%, transparent 49%);
  background-size: 30px 30px;
  mask-image: linear-gradient(to bottom, black, transparent 48%);
}

.sidebar > * { position: relative; z-index: 1; }

.brand-block {
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 20px;
  border-bottom: 1px solid rgb(255 255 255 / 9%);
}

.brand-mark {
  position: relative;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgb(246 166 74 / 45%);
  border-radius: 10px 3px 10px 3px;
  background: rgb(255 255 255 / 5%);
  box-shadow: inset 0 0 0 4px rgb(255 255 255 / 2%);
  font-family: var(--font-mono);
  font-size: .82rem;
  font-weight: 600;
  color: #ffd09a;
}

.brand-mark i { position: absolute; right: -7px; bottom: -7px; width: 18px; height: 18px; background: var(--amber-500); transform: rotate(45deg); }
.brand-copy { min-width: 0; display: flex; flex-direction: column; }
.brand-copy strong { font-size: .95rem; letter-spacing: .115em; }
.brand-copy span { margin-top: 1px; color: rgb(239 248 244 / 58%); font-size: .69rem; }
.sidebar-close { display: none !important; margin-left: auto; color: white !important; }

.workspace-label {
  margin: 26px 11px 9px;
  color: rgb(239 248 244 / 42%);
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.main-nav { display: grid; gap: 4px; }

.nav-item {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: rgb(239 248 244 / 69%);
  background: transparent;
  font-size: .81rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: color .16s ease, background .16s ease, border-color .16s ease, transform .16s ease;
}

.nav-item svg { width: 18px; height: 18px; flex: 0 0 auto; }
.nav-item:hover { color: white; background: rgb(255 255 255 / 5%); transform: translateX(2px); }
.nav-item.active { color: #fff; border-color: rgb(246 166 74 / 18%); background: linear-gradient(90deg, rgb(246 166 74 / 16%), rgb(246 166 74 / 4%)); }
.nav-item.active svg { color: var(--amber-400); }
.nav-count { min-width: 22px; margin-left: auto; padding: 2px 6px; border-radius: 8px; color: rgb(255 255 255 / 66%); background: rgb(255 255 255 / 8%); font-family: var(--font-mono); font-size: .62rem; text-align: center; }
.nav-count-alert { color: #ffd7d2; background: rgb(198 74 66 / 22%); }

.assistant-entry {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  margin: 26px 3px 0;
  padding: 14px 11px;
  overflow: hidden;
  border: 1px solid rgb(246 166 74 / 20%);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgb(255 255 255 / 7%), rgb(246 166 74 / 5%));
}

.assistant-entry::after { content: ""; position: absolute; width: 90px; height: 90px; right: -42px; top: -45px; border: 1px solid rgb(246 166 74 / 14%); border-radius: 50%; }
.assistant-orbit { width: 34px; height: 34px; display: grid; place-items: center; flex: 0 0 auto; color: #ffd09a; border: 1px solid rgb(246 166 74 / 24%); border-radius: 50%; background: rgb(246 166 74 / 10%); }
.assistant-orbit svg { width: 17px; height: 17px; }
.assistant-entry > div:not(.assistant-orbit) { min-width: 0; display: flex; flex-direction: column; }
.assistant-entry span { color: rgb(239 248 244 / 49%); font-size: .62rem; }
.assistant-entry strong { margin-top: 2px; overflow: hidden; color: white; font-size: .72rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.assistant-open { position: relative; z-index: 2; width: 28px; height: 28px; display: grid; place-items: center; border: 0; border-radius: 50%; color: var(--forest-950); background: var(--amber-400); cursor: pointer; }
.assistant-open svg { width: 14px; height: 14px; }

.sidebar-footer { margin-top: auto; padding-top: 24px; }
.security-row { display: flex; align-items: center; gap: 10px; margin: 0 7px 13px; padding: 11px 10px; color: rgb(239 248 244 / 55%); border-top: 1px solid rgb(255 255 255 / 7%); border-bottom: 1px solid rgb(255 255 255 / 7%); }
.security-row svg { width: 17px; height: 17px; color: var(--amber-400); }
.security-row div, .user-row > div:not(.avatar) { min-width: 0; display: flex; flex-direction: column; }
.security-row strong { color: rgb(255 255 255 / 78%); font-size: .67rem; }
.security-row span { font-size: .61rem; }
.user-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 10px 7px 0; }
.avatar { width: 33px; height: 33px; display: grid; place-items: center; border: 1px solid rgb(246 166 74 / 25%); border-radius: 50%; color: #ffd4a4; background: rgb(246 166 74 / 10%); font-family: var(--font-mono); font-size: .65rem; }
.user-row strong { overflow: hidden; font-size: .67rem; text-overflow: ellipsis; white-space: nowrap; }
.user-row span { color: rgb(239 248 244 / 45%); font-size: .59rem; }
.user-row .icon-button { color: rgb(255 255 255 / 50%); }

.sidebar-scrim { display: none; }
.content-shell { min-height: calc(100vh - 34px); margin-left: var(--sidebar-width); }

/* Topbar */
.topbar {
  position: sticky;
  z-index: 100;
  top: 0;
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 0 clamp(20px, 3vw, 42px);
  border-bottom: 1px solid var(--line);
  background: rgb(255 255 255 / 88%);
  backdrop-filter: blur(14px) saturate(130%);
}

.menu-button { display: none !important; }

.global-search {
  width: min(420px, 42vw);
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px 8px 13px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--ink-500);
  background: var(--surface-2);
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.global-search:focus-within { border-color: color-mix(in srgb, var(--forest-600) 55%, white); background: white; box-shadow: 0 0 0 3px rgb(29 117 82 / 8%); }
.global-search svg { width: 17px; height: 17px; flex: 0 0 auto; }
.global-search input { min-width: 0; flex: 1; border: 0; outline: 0; color: var(--ink-950); background: transparent; font-size: .78rem; }
.global-search input::placeholder { color: var(--ink-400); }
.global-search kbd { padding: 2px 6px; border: 1px solid var(--line); border-radius: 5px; color: var(--ink-500); background: white; font-family: var(--font-sans); font-size: .62rem; box-shadow: var(--shadow-xs); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.sync-state { display: inline-flex; align-items: center; gap: 7px; padding-right: 11px; color: var(--ink-500); font-size: .7rem; white-space: nowrap; }
.sync-state i, .live-label i, .assistant-identity span i { width: 6px; height: 6px; border-radius: 50%; background: #2b9b68; box-shadow: 0 0 0 3px rgb(43 155 104 / 10%); }

.icon-button {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--ink-600);
  background: transparent;
  cursor: pointer;
  transition: color .16s ease, border-color .16s ease, background .16s ease, transform .16s ease;
}

.icon-button:hover { color: var(--forest-800); border-color: var(--line); background: var(--surface-2); }
.icon-button:active { transform: scale(.96); }
.icon-button svg { width: 18px; height: 18px; }
.notification-button { position: relative; border-color: var(--line); background: white; }
.notification-button > span { position: absolute; top: -5px; right: -5px; min-width: 17px; height: 17px; display: grid; place-items: center; padding: 0 4px; border: 2px solid white; border-radius: 9px; color: white; background: var(--red-600); font-family: var(--font-mono); font-size: .53rem; }

.button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 15px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: .73rem;
  font-weight: 700;
  letter-spacing: .005em;
  cursor: pointer;
  transition: transform .17s ease, color .17s ease, border-color .17s ease, background .17s ease, box-shadow .17s ease;
}

.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button svg { width: 16px; height: 16px; }
.button-primary { color: white; border-color: var(--forest-800); background: var(--forest-800); box-shadow: 0 7px 16px rgb(18 71 52 / 12%); }
.button-primary:hover { border-color: var(--forest-700); background: var(--forest-700); box-shadow: 0 10px 20px rgb(18 71 52 / 16%); }
.button-quiet { color: var(--ink-700); border-color: var(--line-strong); background: white; }
.button-quiet:hover { color: var(--forest-800); border-color: var(--forest-600); background: var(--forest-50); }
.button-inverse { color: white; border-color: rgb(255 255 255 / 30%); background: rgb(255 255 255 / 7%); }
.button-inverse:hover { border-color: rgb(255 255 255 / 55%); background: rgb(255 255 255 / 12%); }
.button-full { width: 100%; }

/* Main and headings */
main { min-height: calc(100vh - var(--topbar-height) - 34px); }
.app-view { width: min(100%, 1480px); margin: 0 auto; padding: clamp(28px, 3vw, 46px) clamp(20px, 3vw, 42px) 64px; }
.app-view[hidden] { display: none; }
.app-view.active { animation: view-in .32s cubic-bezier(.2,.7,.2,1) both; }

.view-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 28px;
}

.view-heading h1 { margin-top: 9px; color: var(--ink-950); font-size: clamp(1.75rem, 1.35rem + 1.2vw, 2.45rem); line-height: 1.12; letter-spacing: -.035em; }
.view-heading > div:first-child > p { max-width: 720px; margin-top: 8px; color: var(--ink-600); font-size: .88rem; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; color: var(--forest-700); font-size: .64rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.eyebrow > span { width: 18px; height: 2px; background: var(--amber-500); }
.eyebrow-risk { color: var(--red-700); }
.eyebrow-risk > span { background: var(--red-600); }
.heading-meta { min-width: 180px; display: flex; flex-direction: column; align-items: flex-end; padding-left: 22px; border-left: 1px solid var(--line); }
.heading-meta span { color: var(--ink-500); font-size: .67rem; }
.heading-meta strong { margin-top: 2px; color: var(--ink-800); font-family: var(--font-mono); font-size: .68rem; }

.reveal { animation: reveal-up .52s cubic-bezier(.2,.7,.2,1) both; }
.reveal-1 { animation-delay: .02s; }
.reveal-2 { animation-delay: .08s; }
.reveal-3 { animation-delay: .14s; }
.reveal-4 { animation-delay: .2s; }
.reveal-5 { animation-delay: .26s; }

/* Overview */
.insight-strip {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 15px;
  margin-bottom: 18px;
  padding: 15px 17px;
  overflow: hidden;
  border: 1px solid #d4e5dc;
  border-left: 3px solid var(--amber-500);
  border-radius: var(--radius);
  background: linear-gradient(90deg, #f1f8f4, #f9fbfa 72%);
}

.insight-strip::after { content: ""; position: absolute; width: 170px; height: 170px; top: -120px; right: 22%; border: 1px solid rgb(18 71 52 / 6%); border-radius: 50%; }
.insight-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; color: var(--amber-600); background: var(--amber-100); }
.insight-icon svg { width: 16px; height: 16px; }
.insight-copy { min-width: 0; display: flex; flex-direction: column; }
.insight-copy span { color: var(--forest-700); font-size: .63rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.insight-copy strong { margin-top: 2px; color: var(--ink-800); font-size: .78rem; font-weight: 650; }
.text-button { display: inline-flex; align-items: center; gap: 7px; padding: 5px 0; border: 0; color: var(--forest-700); background: transparent; font-size: .7rem; font-weight: 800; cursor: pointer; white-space: nowrap; }
.text-button:hover { color: var(--amber-600); }
.text-button svg { width: 14px; height: 14px; transition: transform .16s ease; }
.text-button:hover svg { transform: translateX(3px); }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.metric-card { position: relative; min-height: 142px; padding: 18px 18px 15px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-xs); transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease; }
.metric-card::before { content: ""; position: absolute; left: 0; top: 0; width: 100%; height: 2px; background: linear-gradient(90deg, var(--forest-600), transparent 70%); opacity: .7; }
.metric-card:hover { transform: translateY(-2px); border-color: #c4d3cc; box-shadow: var(--shadow-sm); }
.metric-card-risk::before { background: linear-gradient(90deg, var(--red-600), transparent 70%); }
.metric-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--ink-600); font-size: .69rem; font-weight: 650; }
.metric-symbol { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 7px; color: var(--forest-700); background: var(--forest-50); }
.metric-symbol svg { width: 14px; height: 14px; }
.metric-card-risk .metric-symbol { color: var(--red-700); background: var(--red-50); }
.metric-value { display: flex; align-items: baseline; gap: 9px; margin-top: 13px; }
.metric-value strong { color: var(--ink-950); font-family: var(--font-mono); font-size: 1.78rem; line-height: 1; letter-spacing: -.05em; }
.trend { padding: 3px 7px; border-radius: 5px; color: var(--ink-600); background: var(--surface-3); font-family: var(--font-mono); font-size: .56rem; font-weight: 600; }
.trend-good { color: var(--forest-700); background: var(--forest-50); }
.trend-risk { color: var(--red-700); background: var(--red-50); }
.metric-card > p { margin-top: 10px; color: var(--ink-500); font-size: .65rem; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(300px, .75fr); gap: 18px; margin-bottom: 18px; }
.dashboard-grid-secondary { grid-template-columns: minmax(0, 1.35fr) minmax(330px, .85fr); }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-xs); }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 19px 20px 16px; }
.panel-head h2 { margin-top: 3px; color: var(--ink-950); font-size: .96rem; letter-spacing: -.015em; }
.panel-kicker { color: var(--forest-600); font-size: .59rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.panel-kicker-risk { color: var(--red-700); }
.panel-count { padding: 4px 8px; border-radius: 5px; color: var(--red-700); background: var(--red-50); font-family: var(--font-mono); font-size: .57rem; font-weight: 600; }

.portfolio-table-wrap { overflow-x: auto; }
.portfolio-table { width: 100%; border-collapse: collapse; }
.portfolio-table th { padding: 9px 14px; color: var(--ink-500); background: var(--surface-2); border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line); font-size: .57rem; font-weight: 800; letter-spacing: .08em; text-align: left; text-transform: uppercase; }
.portfolio-table th:first-child, .portfolio-table td:first-child { padding-left: 20px; }
.portfolio-table th:last-child, .portfolio-table td:last-child { padding-right: 16px; text-align: right; }
.portfolio-table td { padding: 13px 14px; border-bottom: 1px solid var(--line-soft); color: var(--ink-700); font-size: .67rem; vertical-align: middle; }
.portfolio-table tbody tr { cursor: pointer; transition: background .15s ease; }
.portfolio-table tbody tr:hover { background: #fbfcfb; }
.portfolio-table tbody tr:last-child td { border-bottom: 0; }
.project-cell { display: flex; align-items: center; gap: 10px; min-width: 190px; }
.project-code { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 7px; color: var(--forest-700); background: var(--forest-50); font-family: var(--font-mono); font-size: .57rem; font-weight: 600; }
.project-cell div { display: flex; flex-direction: column; }
.project-cell strong { color: var(--ink-950); font-size: .69rem; }
.project-cell span { margin-top: 1px; color: var(--ink-500); font-size: .58rem; }
.progress-cell { min-width: 126px; }
.progress-line { height: 4px; overflow: hidden; border-radius: 2px; background: var(--surface-3); }
.progress-line span { display: block; height: 100%; border-radius: inherit; background: var(--forest-600); }
.progress-cell small { display: block; margin-top: 4px; color: var(--ink-500); font-family: var(--font-mono); font-size: .55rem; }
.health-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 7px; border-radius: 5px; font-size: .58rem; font-weight: 700; white-space: nowrap; }
.health-badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; }
.health-badge.attention { color: var(--amber-600); background: var(--amber-50); }
.health-badge.attention::before { background: var(--amber-500); }
.health-badge.on-track { color: var(--forest-700); background: var(--forest-50); }
.health-badge.on-track::before { background: #2b9b68; }
.health-badge.closing { color: var(--blue-600); background: #edf6f9; }
.health-badge.closing::before { background: var(--blue-600); }
.row-arrow { width: 28px; height: 28px; display: inline-grid; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 6px; color: var(--ink-500); background: white; cursor: pointer; }
.row-arrow svg { width: 13px; height: 13px; }

.attention-panel { overflow: hidden; }
.attention-list { padding: 0 20px; }
.attention-item { position: relative; display: grid; grid-template-columns: auto 1fr; gap: 10px; padding: 13px 0; border-top: 1px solid var(--line-soft); }
.attention-marker { width: 7px; height: 7px; margin-top: 6px; border-radius: 50%; background: var(--red-600); box-shadow: 0 0 0 4px var(--red-50); }
.attention-item.medium .attention-marker { background: var(--amber-500); box-shadow: 0 0 0 4px var(--amber-50); }
.attention-item strong { display: block; color: var(--ink-800); font-size: .69rem; line-height: 1.4; }
.attention-item p { margin-top: 3px; color: var(--ink-500); font-size: .6rem; }
.attention-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.attention-meta span { color: var(--red-700); font-family: var(--font-mono); font-size: .54rem; }
.attention-meta button { padding: 0; border: 0; color: var(--forest-700); background: transparent; font-size: .57rem; font-weight: 800; cursor: pointer; }
.attention-panel > .button { width: calc(100% - 40px); margin: 5px 20px 18px; }

.live-label { display: inline-flex; align-items: center; gap: 7px; color: var(--ink-500); font-size: .59rem; white-space: nowrap; }
.timeline { padding: 0 20px 13px; }
.timeline-item { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 11px; padding: 11px 0; border-top: 1px solid var(--line-soft); }
.timeline-icon, .source-glyph { width: 30px; height: 30px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 7px; }
.timeline-icon svg, .source-glyph svg { width: 14px; height: 14px; }
.mail { color: var(--blue-600); background: #edf6f9; }
.file { color: var(--amber-600); background: var(--amber-50); }
.chat { color: var(--forest-700); background: var(--forest-50); }
.plan { color: #6f558f; background: #f2edf7; }
.timeline-item strong { display: block; color: var(--ink-800); font-size: .67rem; }
.timeline-item p { margin-top: 2px; color: var(--ink-500); font-size: .57rem; }
.timeline-item time { color: var(--ink-400); font-family: var(--font-mono); font-size: .53rem; white-space: nowrap; }

.source-status-grid { display: grid; grid-template-columns: repeat(2, 1fr); padding: 0 20px 18px; gap: 8px; }
.source-status { min-width: 0; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 9px; padding: 10px; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); background: var(--surface-2); }
.source-status div { min-width: 0; display: flex; flex-direction: column; }
.source-status strong { font-size: .64rem; }
.source-status span:not(.source-glyph) { overflow: hidden; color: var(--ink-500); font-size: .53rem; text-overflow: ellipsis; white-space: nowrap; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; }
.status-dot.good { background: #2b9b68; box-shadow: 0 0 0 3px rgb(43 155 104 / 10%); }
.status-dot.warning { background: var(--amber-500); box-shadow: 0 0 0 3px rgb(240 138 36 / 10%); }

/* Filters */
.filter-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: white; }
.search-field { min-width: 210px; flex: 1; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.search-field svg { width: 16px; height: 16px; color: var(--ink-500); }
.search-field input { min-width: 0; flex: 1; border: 0; outline: 0; color: var(--ink-900); background: transparent; font-size: .7rem; }
.filter-pills { display: flex; align-items: center; gap: 5px; overflow-x: auto; scrollbar-width: none; }
.filter-pills::-webkit-scrollbar { display: none; }
.filter-pill { min-height: 32px; display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid transparent; border-radius: 6px; color: var(--ink-600); background: transparent; font-size: .64rem; font-weight: 700; white-space: nowrap; cursor: pointer; }
.filter-pill:hover { color: var(--forest-700); background: var(--forest-50); }
.filter-pill.active { color: var(--forest-800); border-color: #cfe0d7; background: var(--forest-50); }
.filter-pill span { padding: 1px 5px; border-radius: 4px; background: rgb(18 71 52 / 7%); font-family: var(--font-mono); font-size: .52rem; }

/* Projects */
.projects-layout { display: grid; grid-template-columns: minmax(265px, .68fr) minmax(0, 1.55fr); gap: 18px; align-items: start; }
.project-list { display: grid; gap: 8px; }
.project-list-card { width: 100%; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 11px; padding: 13px; border: 1px solid var(--line); border-radius: var(--radius-sm); color: inherit; background: white; text-align: left; cursor: pointer; transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease, background .16s ease; }
.project-list-card:hover { transform: translateX(2px); border-color: #bccdc4; box-shadow: var(--shadow-sm); }
.project-list-card.active { border-color: var(--forest-600); background: linear-gradient(90deg, var(--forest-50), white); box-shadow: inset 3px 0 var(--forest-600); }
.project-list-card .project-code { width: 36px; height: 36px; }
.project-list-card > div { min-width: 0; }
.project-list-card strong { display: block; overflow: hidden; color: var(--ink-950); font-size: .68rem; text-overflow: ellipsis; white-space: nowrap; }
.project-list-card p { margin-top: 3px; color: var(--ink-500); font-size: .56rem; }
.project-list-card > span { color: var(--ink-400); }
.project-list-card > span svg { width: 14px; height: 14px; }
.empty-filter { padding: 30px 20px; border: 1px dashed var(--line-strong); border-radius: var(--radius); color: var(--ink-500); background: white; font-size: .72rem; text-align: center; }

.project-detail { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: var(--shadow-xs); }
.project-detail-hero { position: relative; display: grid; grid-template-columns: 1fr auto; gap: 20px; padding: 22px; overflow: hidden; border-bottom: 1px solid var(--line); background: linear-gradient(135deg, #f6faf8, white); }
.project-detail-hero::after { content: ""; position: absolute; right: -60px; top: -82px; width: 180px; height: 180px; border: 22px solid rgb(18 71 52 / 3%); border-radius: 50%; }
.project-detail-hero > * { position: relative; z-index: 1; }
.project-detail-hero .project-ref { color: var(--forest-600); font-family: var(--font-mono); font-size: .58rem; letter-spacing: .08em; }
.project-detail-hero h2 { margin-top: 5px; color: var(--ink-950); font-size: 1.2rem; letter-spacing: -.025em; }
.project-detail-hero p { max-width: 650px; margin-top: 7px; color: var(--ink-600); font-size: .7rem; }
.detail-progress { min-width: 100px; display: grid; place-items: center; }
.progress-ring { --value: 62; width: 80px; height: 80px; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(var(--forest-600) calc(var(--value) * 1%), var(--surface-3) 0); position: relative; }
.progress-ring::before { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: white; }
.progress-ring span { position: relative; font-family: var(--font-mono); font-size: .9rem; font-weight: 600; }
.progress-ring small { font-size: .55rem; }
.detail-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.detail-fact { padding: 15px 18px; border-right: 1px solid var(--line-soft); }
.detail-fact:last-child { border-right: 0; }
.detail-fact span { display: block; color: var(--ink-500); font-size: .56rem; }
.detail-fact strong { display: block; margin-top: 3px; color: var(--ink-800); font-size: .66rem; }
.detail-body { padding: 20px; }
.detail-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.detail-section-head h3 { font-size: .82rem; }
.detail-section-head span { color: var(--ink-500); font-family: var(--font-mono); font-size: .56rem; }
.task-board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.task-column { padding: 10px; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); background: var(--surface-2); }
.task-column-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; color: var(--ink-600); font-size: .58rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.task-column-head span { width: 19px; height: 19px; display: grid; place-items: center; border-radius: 4px; color: var(--ink-600); background: white; font-family: var(--font-mono); font-size: .51rem; }
.task-card { padding: 10px; margin-top: 7px; border: 1px solid var(--line); border-left: 2px solid var(--forest-600); border-radius: 6px; background: white; box-shadow: var(--shadow-xs); }
.task-card.risk { border-left-color: var(--red-600); }
.task-card strong { display: block; color: var(--ink-800); font-size: .6rem; line-height: 1.35; }
.task-card-meta { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 8px; color: var(--ink-500); font-size: .51rem; }
.task-card-meta span:first-child { max-width: 65%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.detail-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line-soft); }
.detail-footer p { color: var(--ink-500); font-size: .58rem; }

/* Alerts */
.alert-summary { display: grid; grid-template-columns: repeat(3, 130px) minmax(300px, 1fr); align-items: stretch; margin-bottom: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: white; overflow: hidden; }
.alert-summary > div:not(.alert-summary-note) { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; align-content: center; gap: 0 8px; padding: 14px 18px; border-right: 1px solid var(--line); }
.severity-dot { grid-row: 1 / 3; width: 8px; height: 8px; align-self: center; border-radius: 50%; }
.severity-dot.critical { background: var(--red-600); box-shadow: 0 0 0 4px var(--red-50); }
.severity-dot.medium { background: var(--amber-500); box-shadow: 0 0 0 4px var(--amber-50); }
.severity-dot.low { background: var(--blue-600); box-shadow: 0 0 0 4px #edf6f9; }
.alert-summary strong { font-family: var(--font-mono); font-size: .85rem; }
.alert-summary p { color: var(--ink-500); font-size: .57rem; }
.alert-summary-note { display: flex; align-items: center; gap: 10px; padding: 14px 18px; background: var(--forest-50); }
.alert-summary-note svg { flex: 0 0 auto; color: var(--forest-700); }
.alert-summary-note p { color: var(--ink-600); font-size: .6rem; }
.alert-summary-note strong { color: var(--forest-800); font-family: var(--font-sans); font-size: inherit; }
.alert-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 10px; }
.result-count { color: var(--ink-500); font-family: var(--font-mono); font-size: .57rem; }
.alert-list { display: grid; gap: 9px; }
.alert-card { display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; gap: 15px; padding: 17px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: white; transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease; }
.alert-card:hover { transform: translateY(-1px); border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.alert-card.reviewed { opacity: .58; }
.alert-severity-bar { width: 4px; min-height: 100%; border-radius: 3px; background: var(--red-600); }
.alert-card[data-severity="medium"] .alert-severity-bar { background: var(--amber-500); }
.alert-card[data-severity="low"] .alert-severity-bar { background: var(--blue-600); }
.alert-card-main { min-width: 0; }
.alert-card-top { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.severity-badge { padding: 3px 7px; border-radius: 4px; color: var(--red-700); background: var(--red-50); font-size: .52rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.alert-card[data-severity="medium"] .severity-badge { color: var(--amber-600); background: var(--amber-50); }
.alert-card[data-severity="low"] .severity-badge { color: var(--blue-600); background: #edf6f9; }
.alert-card-code { color: var(--ink-400); font-family: var(--font-mono); font-size: .52rem; }
.alert-card h3 { margin-top: 7px; font-size: .77rem; }
.alert-card p { max-width: 850px; margin-top: 4px; color: var(--ink-600); font-size: .64rem; }
.alert-evidence { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 10px; }
.alert-evidence span { display: inline-flex; align-items: center; gap: 5px; color: var(--ink-500); font-size: .54rem; }
.alert-evidence svg { width: 12px; height: 12px; }
.alert-card-actions { min-width: 144px; display: flex; flex-direction: column; align-items: stretch; justify-content: center; gap: 7px; }

/* Sources */
.governance-banner { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 13px; margin-bottom: 18px; padding: 16px 18px; border: 1px solid #cee0d6; border-radius: var(--radius); background: linear-gradient(90deg, var(--forest-50), white); }
.governance-banner > svg { width: 25px; height: 25px; color: var(--forest-700); }
.governance-banner strong { font-size: .72rem; }
.governance-banner p { margin-top: 2px; color: var(--ink-600); font-size: .62rem; }
.governance-banner > span { padding: 5px 9px; border: 1px solid #cee0d6; border-radius: 5px; color: var(--forest-700); font-family: var(--font-mono); font-size: .55rem; white-space: nowrap; }
.source-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 11px; margin-bottom: 18px; }
.source-card { position: relative; padding: 17px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: var(--shadow-xs); }
.source-card::after { content: ""; position: absolute; right: -24px; bottom: -30px; width: 70px; height: 70px; border: 10px solid var(--surface-3); border-radius: 50%; }
.source-card-head { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; }
.source-card .source-glyph { width: 36px; height: 36px; }
.source-state { display: inline-flex; align-items: center; gap: 5px; color: var(--forest-700); font-size: .53rem; font-weight: 700; }
.source-state::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: #2b9b68; }
.source-card h3 { position: relative; z-index: 1; margin-top: 14px; font-size: .74rem; }
.source-card p { position: relative; z-index: 1; min-height: 36px; margin-top: 4px; color: var(--ink-500); font-size: .58rem; }
.source-card-stats { position: relative; z-index: 1; display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; margin-top: 14px; padding-top: 11px; border-top: 1px solid var(--line-soft); }
.source-card-stats div { display: flex; flex-direction: column; }
.source-card-stats strong { font-family: var(--font-mono); font-size: .74rem; }
.source-card-stats span { color: var(--ink-500); font-size: .51rem; }
.source-card-stats time { color: var(--ink-400); font-family: var(--font-mono); font-size: .49rem; }
.sources-lower-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(250px, .55fr); gap: 18px; }
.incoming-list { padding: 0 20px 14px; }
.incoming-item { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 11px 0; border-top: 1px solid var(--line-soft); }
.incoming-item strong { display: block; font-size: .66rem; }
.incoming-item p { margin-top: 2px; color: var(--ink-500); font-size: .55rem; }
.confidence { padding: 3px 6px; border-radius: 4px; color: var(--forest-700); background: var(--forest-50); font-family: var(--font-mono); font-size: .48rem; white-space: nowrap; }
.comparison-panel { padding-bottom: 18px; text-align: center; }
.comparison-panel .panel-head { text-align: left; }
.comparison-ring { width: 104px; height: 104px; display: grid; place-items: center; margin: 2px auto 12px; border-radius: 50%; background: conic-gradient(var(--forest-600) 82%, var(--surface-3) 0); position: relative; }
.comparison-ring::before { content: ""; position: absolute; inset: 9px; border-radius: 50%; background: white; }
.comparison-ring span { position: relative; font-family: var(--font-mono); font-size: 1.25rem; font-weight: 600; }
.comparison-ring small { font-size: .62rem; }
.comparison-panel > p { max-width: 290px; margin: 0 auto 14px; padding: 0 18px; color: var(--ink-600); font-size: .6rem; }
.comparison-panel > .button { width: calc(100% - 36px); margin: 0 18px; }

/* Reports */
.report-hero { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(250px, .55fr); gap: 44px; align-items: center; margin-bottom: 30px; padding: clamp(26px, 4vw, 48px); overflow: hidden; border-radius: var(--radius-lg); color: white; background: linear-gradient(130deg, var(--forest-950), var(--forest-800)); box-shadow: var(--shadow-md); }
.report-hero::before { content: ""; position: absolute; inset: 0; opacity: .16; background-image: radial-gradient(rgb(255 255 255 / 40%) 1px, transparent 1px); background-size: 25px 25px; mask-image: linear-gradient(90deg, black, transparent 64%); }
.report-hero::after { content: ""; position: absolute; width: 360px; height: 360px; right: -170px; top: -170px; border: 1px solid rgb(246 166 74 / 22%); border-radius: 50%; box-shadow: 0 0 0 44px rgb(246 166 74 / 4%), 0 0 0 90px rgb(246 166 74 / 3%); }
.report-hero > * { position: relative; z-index: 1; }
.report-label { color: #ffd09a; font-size: .62rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.report-hero h2 { max-width: 520px; margin-top: 10px; color: white; font-size: clamp(1.6rem, 1.25rem + 1.2vw, 2.25rem); line-height: 1.12; letter-spacing: -.035em; }
.report-hero-copy > p { max-width: 620px; margin-top: 12px; color: rgb(241 248 245 / 70%); font-size: .76rem; }
.report-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 19px; }
.report-chips span { padding: 5px 8px; border: 1px solid rgb(255 255 255 / 13%); border-radius: 5px; color: rgb(255 255 255 / 72%); background: rgb(255 255 255 / 5%); font-family: var(--font-mono); font-size: .5rem; }
.report-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.report-actions .button-primary { color: var(--forest-950); border-color: var(--amber-400); background: var(--amber-400); }
.report-actions .button-primary:hover { background: #fbb665; }
.report-paper { width: min(100%, 285px); aspect-ratio: .78; justify-self: end; padding: 20px; border-radius: 4px; color: var(--ink-950); background: white; box-shadow: 0 24px 60px rgb(0 0 0 / 27%); transform: rotate(2deg); }
.paper-head { display: flex; align-items: center; justify-content: space-between; }
.paper-head span { width: 28px; height: 28px; border: 1px solid var(--forest-600); border-radius: 7px 2px 7px 2px; }
.paper-head i { color: var(--ink-400); font-family: var(--font-mono); font-size: .38rem; font-style: normal; }
.paper-title { width: 78%; height: 7px; margin-top: 25px; border-radius: 2px; background: var(--forest-800); }
.paper-title.short { width: 55%; margin-top: 6px; opacity: .72; }
.paper-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin-top: 20px; }
.paper-metrics i { height: 30px; border-radius: 3px; background: var(--forest-50); border-top: 2px solid var(--forest-600); }
.paper-line { height: 3px; margin-top: 14px; border-radius: 2px; background: var(--line); }
.paper-line + .paper-line { margin-top: 5px; }
.paper-line.medium { width: 62%; }
.paper-chart { height: 86px; display: flex; align-items: flex-end; gap: 5px; margin-top: 18px; padding: 12px 8px 0; border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.paper-chart span { flex: 1; border-radius: 2px 2px 0 0; background: linear-gradient(var(--amber-400), var(--amber-500)); }
.section-title-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 13px; }
.section-title-row h2 { margin-top: 3px; font-size: 1.03rem; }
.report-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; }
.report-card { padding: 17px; border: 1px solid var(--line); border-radius: var(--radius); background: white; transition: transform .17s ease, border-color .17s ease, box-shadow .17s ease; }
.report-card:hover { transform: translateY(-2px); border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.report-card-head { display: flex; justify-content: space-between; gap: 12px; }
.report-type { padding: 4px 7px; border-radius: 4px; color: var(--forest-700); background: var(--forest-50); font-size: .51rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.report-date { color: var(--ink-400); font-family: var(--font-mono); font-size: .5rem; }
.report-card h3 { margin-top: 13px; font-size: .74rem; }
.report-card p { min-height: 37px; margin-top: 5px; color: var(--ink-500); font-size: .58rem; }
.report-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 13px; padding-top: 11px; border-top: 1px solid var(--line-soft); }
.report-status { display: inline-flex; align-items: center; gap: 5px; color: var(--amber-600); font-size: .53rem; font-weight: 700; }
.report-status.approved { color: var(--forest-700); }
.report-status::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.report-card-footer button { padding: 0; border: 0; color: var(--forest-700); background: transparent; font-size: .56rem; font-weight: 800; cursor: pointer; }
.approval-note { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; margin-top: 18px; padding: 16px 18px; border: 1px solid #d4e3db; border-radius: var(--radius); background: var(--forest-50); }
.approval-note > svg { color: var(--forest-700); }
.approval-note strong { font-size: .7rem; }
.approval-note p { margin-top: 2px; color: var(--ink-600); font-size: .58rem; }

/* Assistant */
.assistant-heading { align-items: center; }
.human-control { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid #cee0d6; border-radius: var(--radius-sm); background: var(--forest-50); }
.human-control svg { color: var(--forest-700); }
.human-control div { display: flex; flex-direction: column; }
.human-control strong { color: var(--forest-800); font-size: .63rem; }
.human-control span { color: var(--ink-600); font-size: .53rem; }
.assistant-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(275px, .55fr); gap: 18px; align-items: stretch; min-height: 610px; }
.chat-card { min-height: 610px; display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: var(--shadow-sm); }
.chat-card-head { display: flex; align-items: center; justify-content: space-between; padding: 15px 17px; border-bottom: 1px solid var(--line); }
.assistant-identity { display: flex; align-items: center; gap: 10px; }
.assistant-identity .assistant-orbit { width: 34px; height: 34px; color: var(--forest-700); border-color: #cee0d6; background: var(--forest-50); }
.assistant-identity > div { display: flex; flex-direction: column; }
.assistant-identity strong { font-size: .69rem; }
.assistant-identity span:not(.assistant-orbit) { display: inline-flex; align-items: center; gap: 6px; margin-top: 2px; color: var(--ink-500); font-size: .53rem; }
.chat-messages { flex: 1; min-height: 360px; max-height: 480px; display: flex; flex-direction: column; gap: 12px; padding: 20px; overflow-y: auto; background: linear-gradient(180deg, #fbfcfb, white); scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.message { max-width: min(78%, 620px); display: flex; gap: 8px; animation: message-in .24s ease both; }
.message.assistant { align-self: flex-start; }
.message.user { align-self: flex-end; justify-content: flex-end; }
.message-avatar { width: 27px; height: 27px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; color: var(--forest-700); background: var(--forest-50); border: 1px solid #d5e4dc; }
.message-avatar svg { width: 13px; height: 13px; }
.message-bubble { padding: 10px 12px; border: 1px solid var(--line); border-radius: 4px 11px 11px 11px; color: var(--ink-700); background: white; font-size: .68rem; line-height: 1.55; box-shadow: var(--shadow-xs); }
.message-bubble strong { color: var(--ink-950); }
.message.user .message-bubble { color: white; border-color: var(--forest-800); border-radius: 11px 4px 11px 11px; background: var(--forest-800); }
.message-time { display: block; margin-top: 5px; color: var(--ink-400); font-family: var(--font-mono); font-size: .47rem; }
.message.user .message-time { color: rgb(255 255 255 / 55%); }
.message-action { margin-top: 8px; padding: 6px 9px; border: 1px solid #cddfd6; border-radius: 5px; color: var(--forest-700); background: var(--forest-50); font-size: .56rem; font-weight: 800; cursor: pointer; }
.typing-bubble { display: inline-flex; gap: 4px; padding: 11px 13px; }
.typing-bubble i { width: 5px; height: 5px; border-radius: 50%; background: var(--ink-400); animation: typing 1s ease-in-out infinite; }
.typing-bubble i:nth-child(2) { animation-delay: .15s; }
.typing-bubble i:nth-child(3) { animation-delay: .3s; }
.suggestion-row { display: flex; gap: 6px; padding: 10px 17px 0; overflow-x: auto; border-top: 1px solid var(--line-soft); scrollbar-width: none; }
.suggestion-row::-webkit-scrollbar { display: none; }
.suggestion-row button { padding: 6px 9px; border: 1px solid #d4e3db; border-radius: 5px; color: var(--forest-700); background: var(--forest-50); font-size: .54rem; font-weight: 700; white-space: nowrap; cursor: pointer; }
.suggestion-row button:hover { border-color: var(--forest-600); background: white; }
.chat-composer { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; margin: 10px 17px 0; padding: 9px 9px 9px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: white; box-shadow: 0 0 0 3px rgb(18 71 52 / 3%); }
.chat-composer:focus-within { border-color: var(--forest-600); box-shadow: 0 0 0 3px rgb(18 71 52 / 8%); }
.chat-composer textarea { width: 100%; max-height: 100px; resize: none; border: 0; outline: 0; color: var(--ink-950); background: transparent; font-size: .67rem; line-height: 1.5; }
.chat-composer textarea::placeholder { color: var(--ink-400); }
.chat-composer button { width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 6px; color: white; background: var(--forest-800); cursor: pointer; }
.chat-composer button:hover { background: var(--forest-700); }
.chat-composer button svg { width: 15px; height: 15px; }
.chat-disclaimer { padding: 8px 17px 13px; color: var(--ink-400); font-size: .5rem; text-align: center; }
.assistant-context { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: white; }
.context-head { padding: 17px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.context-head span { display: block; color: var(--ink-500); font-size: .56rem; text-transform: uppercase; letter-spacing: .08em; }
.context-head strong { display: block; margin-top: 4px; font-size: .77rem; }
.context-source { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 9px; margin: 0 17px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.context-source div { display: flex; flex-direction: column; }
.context-source strong { font-size: .63rem; }
.context-source span:not(.source-glyph) { margin-top: 2px; color: var(--ink-500); font-size: .52rem; }
.context-rule { display: flex; align-items: flex-start; gap: 9px; margin: 17px; padding: 13px; border: 1px solid #d4e3db; border-radius: var(--radius-sm); background: var(--forest-50); }
.context-rule svg { width: 18px; height: 18px; flex: 0 0 auto; color: var(--forest-700); }
.context-rule p { color: var(--ink-600); font-size: .57rem; }

/* Modal */
.modal-backdrop { position: fixed; z-index: 500; inset: 0; display: grid; place-items: center; padding: 20px; background: rgb(6 29 22 / 62%); backdrop-filter: blur(5px); animation: fade-in .18s ease both; }
.modal-backdrop[hidden] { display: none; }
.modal { width: min(680px, 100%); max-height: calc(100vh - 40px); padding: 22px; overflow-y: auto; border: 1px solid rgb(255 255 255 / 20%); border-radius: var(--radius-lg); background: white; box-shadow: var(--shadow-lg); animation: modal-in .22s cubic-bezier(.2,.7,.2,1) both; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding-bottom: 15px; border-bottom: 1px solid var(--line); }
.modal-kicker { color: var(--forest-600); font-size: .57rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.modal h2 { margin-top: 4px; font-size: 1.25rem; letter-spacing: -.025em; }
.modal-description { margin: 14px 0 17px; padding: 11px 12px; border-left: 2px solid var(--amber-500); color: var(--ink-600); background: var(--amber-50); font-size: .64rem; }
.modal form { display: grid; gap: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.modal label { display: grid; gap: 5px; color: var(--ink-700); font-size: .59rem; font-weight: 700; }
.modal input, .modal textarea, .modal select { width: 100%; padding: 9px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); outline: 0; color: var(--ink-950); background: white; font-size: .67rem; font-weight: 500; line-height: 1.5; }
.modal textarea { resize: vertical; }
.modal input:focus, .modal textarea:focus, .modal select:focus { border-color: var(--forest-600); box-shadow: 0 0 0 3px rgb(18 71 52 / 8%); }
.approval-check { display: flex; align-items: flex-start; gap: 9px; padding: 10px 11px; border: 1px solid #d4e3db; border-radius: var(--radius-sm); background: var(--forest-50); }
.approval-check svg { width: 17px; height: 17px; flex: 0 0 auto; color: var(--forest-700); }
.approval-check p { color: var(--ink-600); font-size: .56rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 5px; }

/* Toast */
.toast { position: fixed; z-index: 600; right: 22px; bottom: 22px; width: min(390px, calc(100vw - 32px)); display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 13px; border: 1px solid #cbded4; border-radius: var(--radius); background: white; box-shadow: var(--shadow-lg); transform: translateY(24px); opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; }
.toast.show { transform: translateY(0); opacity: 1; pointer-events: auto; }
.toast-icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; color: var(--forest-700); background: var(--forest-50); }
.toast-icon svg { width: 15px; height: 15px; }
.toast strong { display: block; font-size: .66rem; }
.toast p { margin-top: 2px; color: var(--ink-600); font-size: .56rem; }

/* Animations */
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
@keyframes view-in { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }
@keyframes reveal-up { from { opacity: 0; transform: translateY(11px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes message-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
@keyframes typing { 0%, 60%, 100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-3px); opacity: 1; } }

/* Responsive */
@media (max-width: 1180px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid, .dashboard-grid-secondary { grid-template-columns: 1fr; }
  .source-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .alert-summary { grid-template-columns: repeat(3, 1fr); }
  .alert-summary-note { grid-column: 1 / -1; border-top: 1px solid var(--line); }
}

@media (max-width: 980px) {
  :root { --sidebar-width: 250px; }
  .sidebar { transform: translateX(-103%); transition: transform .22s cubic-bezier(.2,.7,.2,1); box-shadow: var(--shadow-lg); }
  body.sidebar-open { overflow: hidden; }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .sidebar-close { display: inline-grid !important; }
  .sidebar-scrim { position: fixed; z-index: 190; inset: 34px 0 0; width: 100%; height: calc(100% - 34px); border: 0; background: rgb(6 29 22 / 48%); backdrop-filter: blur(2px); }
  body.sidebar-open .sidebar-scrim { display: block; }
  .content-shell { margin-left: 0; }
  .menu-button { display: inline-grid !important; }
  .projects-layout { grid-template-columns: 1fr; }
  .project-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .assistant-layout { grid-template-columns: 1fr; }
  .assistant-context { display: grid; grid-template-columns: repeat(2, 1fr); }
  .context-head, .context-rule { grid-column: 1 / -1; }
  .context-source { margin: 0; padding: 12px 17px; border-right: 1px solid var(--line-soft); }
}

@media (max-width: 760px) {
  .demo-banner { min-height: 40px; padding-inline: 12px; font-size: .65rem; }
  .demo-banner span[aria-hidden="true"] { display: none; }
  .sidebar { top: 40px; }
  .sidebar-scrim { top: 40px; }
  .topbar { padding: 0 16px; gap: 9px; }
  .global-search { flex: 1; width: auto; }
  .global-search kbd, .sync-state { display: none; }
  .topbar-actions { margin-left: 0; }
  .topbar-actions .button span { display: none; }
  .topbar-actions .button { width: 38px; padding: 0; }
  .view-heading { align-items: flex-start; flex-direction: column; gap: 15px; }
  .overview-heading { flex-direction: row; align-items: flex-end; }
  .heading-meta { display: none; }
  .insight-strip { grid-template-columns: auto 1fr; }
  .insight-strip .text-button { grid-column: 2; justify-self: start; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .metric-card { min-height: 130px; }
  .filter-bar { align-items: stretch; flex-direction: column; }
  .filter-pills { width: 100%; }
  .projects-layout { grid-template-columns: 1fr; }
  .project-list { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; }
  .project-list-card { min-width: 250px; scroll-snap-align: start; }
  .detail-facts { grid-template-columns: repeat(2, 1fr); }
  .detail-fact:nth-child(2) { border-right: 0; }
  .detail-fact:nth-child(-n+2) { border-bottom: 1px solid var(--line-soft); }
  .task-board { grid-template-columns: 1fr; }
  .alert-card { grid-template-columns: 6px 1fr; }
  .alert-card-actions { grid-column: 2; flex-direction: row; min-width: 0; }
  .alert-card-actions .button { flex: 1; }
  .source-cards { grid-template-columns: 1fr 1fr; }
  .sources-lower-grid { grid-template-columns: 1fr; }
  .report-hero { grid-template-columns: 1fr; }
  .report-paper { display: none; }
  .approval-note { grid-template-columns: auto 1fr; }
  .approval-note .text-button { grid-column: 2; justify-self: start; }
  .human-control { width: 100%; }
}

@media (max-width: 560px) {
  .app-view { padding: 24px 14px 50px; }
  .view-heading h1 { font-size: 1.65rem; }
  .overview-heading { display: block; }
  .metric-grid { grid-template-columns: 1fr; }
  .metric-card { min-height: 0; }
  .portfolio-table th:nth-child(3), .portfolio-table td:nth-child(3), .portfolio-table th:nth-child(4), .portfolio-table td:nth-child(4) { display: none; }
  .source-status-grid { grid-template-columns: 1fr; }
  .timeline-item { grid-template-columns: auto 1fr; }
  .timeline-item time { grid-column: 2; }
  .project-detail-hero { grid-template-columns: 1fr; }
  .detail-progress { justify-self: start; }
  .alert-summary { grid-template-columns: repeat(3, 1fr); }
  .alert-summary > div:not(.alert-summary-note) { grid-template-columns: 1fr; justify-items: center; padding: 12px 6px; text-align: center; }
  .severity-dot { grid-row: auto; margin-bottom: 5px; }
  .alert-summary-note { align-items: flex-start; }
  .alert-toolbar { align-items: flex-start; flex-direction: column; }
  .source-cards, .report-grid { grid-template-columns: 1fr; }
  .incoming-item { grid-template-columns: auto 1fr; }
  .confidence { grid-column: 2; justify-self: start; }
  .report-hero { padding: 24px 18px; }
  .section-title-row { align-items: flex-start; flex-direction: column; }
  .assistant-context { display: block; }
  .context-source { border-right: 0; }
  .message { max-width: 92%; }
  .form-grid { grid-template-columns: 1fr; }
  .modal { padding: 17px; }
  .modal-actions { flex-wrap: wrap; }
  .modal-actions .button { flex: 1 1 130px; }
  .toast { right: 16px; bottom: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

@media print {
  .demo-banner, .sidebar, .topbar, .toast, .modal-backdrop { display: none !important; }
  .content-shell { margin: 0; }
  .app-view { width: 100%; padding: 20px; }
  .app-view:not(.active) { display: none !important; }
  body { background: white; }
}
