:root {
  --ink: #17251f;
  --ink-soft: #526059;
  --forest: #183d30;
  --forest-light: #275845;
  --cream: #f4f1e8;
  --paper: #fffcf5;
  --line: #dedbd1;
  --gold: #c89f4d;
  --gold-soft: #f4e8c9;
  --red: #a34736;
  --red-soft: #f6e6e0;
  --green: #2f7455;
  --green-soft: #e3f0e9;
  --blue-soft: #e8eff4;
  --shadow: 0 18px 46px rgba(27, 42, 34, .08);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--cream);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button, a { font: inherit; }
button { color: inherit; }

.app-shell { min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 10;
  display: flex;
  width: 250px;
  flex-direction: column;
  padding: 30px 20px 24px;
  color: #fff;
  background:
    linear-gradient(180deg, rgba(255,255,255,.03), transparent 36%),
    var(--forest);
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  color: #fff;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid rgba(255,255,255,.22);
  color: var(--gold-soft);
  background: rgba(255,255,255,.08);
  font-family: Georgia, serif;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .05em;
}

.brand strong, .brand small { display: block; }
.brand strong { font-family: Georgia, serif; font-size: 19px; }
.brand small { margin-top: 1px; color: rgba(255,255,255,.65); font-size: 12px; letter-spacing: .05em; }

.main-nav { display: grid; gap: 7px; margin-top: 64px; }

.nav-item {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 0;
  border-radius: 9px;
  color: rgba(255,255,255,.72);
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: background .18s ease, color .18s ease;
}

.nav-item span { color: rgba(255,255,255,.34); font-size: 11px; letter-spacing: .1em; }
.nav-item:hover, .nav-item:focus-visible { color: #fff; background: rgba(255,255,255,.08); outline: none; }
.nav-item.active { color: #fff; background: rgba(255,255,255,.12); }
.nav-item.active span { color: var(--gold-soft); }

.sidebar-status {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px;
  background: rgba(0,0,0,.08);
}

.sidebar-status strong, .sidebar-status small { display: block; }
.sidebar-status strong { font-size: 13px; }
.sidebar-status small { color: rgba(255,255,255,.56); font-size: 11px; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: #e6b85f; box-shadow: 0 0 0 5px rgba(230,184,95,.12); }

main { margin-left: 250px; padding: 34px clamp(24px, 4vw, 62px) 26px; }

.topbar, .section-heading, .panel-header, footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.topbar { margin-bottom: 28px; }
.topbar h1 { margin: 2px 0 0; font-family: Georgia, serif; font-size: clamp(30px, 4vw, 44px); font-weight: 500; letter-spacing: -.03em; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.eyebrow { margin: 0; color: var(--gold); font-size: 11px; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.eyebrow.light { color: #dfc88d; }
.demo-pill, .count-badge, .time-chip, .stage-badge, .approval-badge, .agent-state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  white-space: nowrap;
}

.demo-pill { padding: 7px 11px; color: var(--forest); background: var(--gold-soft); font-size: 11px; font-weight: 800; }

.secondary-button, .primary-button, .danger-button {
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--paper);
  cursor: pointer;
  font-weight: 750;
}

.secondary-button:hover { border-color: #bbb7ab; background: #fff; }
.primary-button { border-color: var(--forest); color: #fff; background: var(--forest); }
.primary-button:hover { background: var(--forest-light); }
.danger-button { border-color: #d7b8af; color: var(--red); background: #fff8f5; }
.danger-button:hover { background: var(--red-soft); }

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, .8fr);
  gap: 34px;
  overflow: hidden;
  padding: clamp(28px, 5vw, 52px);
  border-radius: var(--radius-lg);
  color: #fff;
  background:
    radial-gradient(circle at 88% 0%, rgba(200,159,77,.28), transparent 34%),
    linear-gradient(135deg, #183d30 0%, #214e3d 68%, #173328 100%);
  box-shadow: var(--shadow);
}

.hero::after {
  position: absolute;
  right: -70px;
  bottom: -120px;
  width: 310px;
  height: 310px;
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 50%;
  content: "";
}

.hero-copy { position: relative; z-index: 1; }
.hero h2 { max-width: 720px; margin: 12px 0 14px; font-family: Georgia, serif; font-size: clamp(31px, 4vw, 50px); font-weight: 500; line-height: 1.08; letter-spacing: -.03em; }
.hero-copy > p:last-child { max-width: 720px; margin: 0; color: rgba(255,255,255,.72); }
.hero-copy strong { color: #fff; }

.hero-stats { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(3, 1fr); align-content: center; }
.hero-stats div { padding: 18px; border-left: 1px solid rgba(255,255,255,.14); }
.hero-stats strong, .hero-stats span { display: block; }
.hero-stats strong { font-family: Georgia, serif; font-size: 36px; font-weight: 500; }
.hero-stats span { margin-top: 2px; color: rgba(255,255,255,.58); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }

.briefing-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, .8fr); gap: 18px; margin-top: 18px; }
.panel { border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--paper); box-shadow: 0 12px 30px rgba(27,42,34,.04); }
.panel-header { padding: 22px 24px; border-bottom: 1px solid var(--line); }
.panel h2, .section-heading h2 { margin: 3px 0 0; font-family: Georgia, serif; font-size: 27px; font-weight: 500; }
.count-badge { min-width: 28px; height: 28px; color: var(--forest); background: var(--gold-soft); font-size: 12px; font-weight: 800; }

.priority-list { margin: 0; padding: 0; list-style: none; }
.priority-list li { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: start; padding: 20px 24px; border-bottom: 1px solid var(--line); }
.priority-list li:last-child { border-bottom: 0; }
.priority-number { display: grid; width: 27px; height: 27px; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--gold); font-family: Georgia, serif; font-weight: 700; }
.priority-list strong { font-size: 14px; }
.priority-list p { margin: 4px 0 0; color: var(--ink-soft); font-size: 12px; }
.time-chip { padding: 5px 9px; color: var(--forest); background: var(--green-soft); font-size: 10px; font-weight: 800; }
.time-chip.urgent { color: var(--red); background: var(--red-soft); }

.risk-panel { overflow: hidden; }
.alert-icon { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 50%; color: var(--red); background: var(--red-soft); font-weight: 900; }
.risk-body { padding: 25px; }
.agent-kicker { color: var(--gold); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.risk-body h3 { margin: 10px 0 7px; font-family: Georgia, serif; font-size: 22px; }
.risk-body p { margin: 0; color: var(--ink-soft); font-size: 13px; }
.text-button { margin-top: 20px; padding: 0; border: 0; color: var(--forest); background: transparent; cursor: pointer; font-size: 12px; font-weight: 850; }
.text-button span { margin-left: 5px; color: var(--gold); }

.section-block { margin-top: 56px; scroll-margin-top: 28px; }
.section-heading { margin-bottom: 18px; }
.section-heading > p { max-width: 440px; margin: 0; color: var(--ink-soft); font-size: 12px; text-align: right; }

.decision-list { display: grid; gap: 12px; }
.decision-card {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 20px;
  align-items: center;
  padding: 22px 24px 22px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--paper);
}
.decision-rail { align-self: stretch; border-radius: 0 6px 6px 0; background: var(--gold); }
.decision-rail.level-c { background: var(--red); }
.decision-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 7px; }
.approval-badge { padding: 4px 8px; color: var(--forest); background: var(--gold-soft); font-size: 9px; font-weight: 900; letter-spacing: .06em; }
.approval-badge.level-c { color: var(--red); background: var(--red-soft); }
.audit-id { color: #777f7a; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; }
.decision-card h3 { margin: 0; font-family: Georgia, serif; font-size: 20px; font-weight: 600; }
.decision-card p { margin: 5px 0 0; color: var(--ink-soft); font-size: 12px; }
.decision-actions { display: flex; gap: 8px; }
.decision-card.resolved { opacity: .68; }
.decision-card.resolved .decision-rail { background: var(--green); }
.decision-result { min-width: 150px; color: var(--green); font-size: 12px; font-weight: 850; text-align: right; }
.decision-result.rejected { color: var(--red); }

.agent-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.agent-card { min-height: 180px; padding: 21px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--paper); transition: transform .18s ease, box-shadow .18s ease; }
.agent-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.agent-card-top { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.agent-icon { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 10px; color: var(--forest); background: var(--gold-soft); font-family: Georgia, serif; font-weight: 800; }
.agent-state { padding: 4px 8px; color: var(--green); background: var(--green-soft); font-size: 9px; font-weight: 850; text-transform: uppercase; letter-spacing: .05em; }
.agent-state.setup { color: #6c6351; background: #efebe2; }
.agent-card h3 { margin: 17px 0 5px; font-size: 15px; }
.agent-card p { margin: 0; color: var(--ink-soft); font-size: 12px; }
.agent-footer { display: flex; justify-content: space-between; gap: 10px; margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--line); color: #737d77; font-size: 10px; }
.agent-footer strong { color: var(--ink); }

.pipeline-value { font-family: Georgia, serif; font-size: 23px; }
.pipeline-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.pipeline-stage { padding: 19px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--paper); }
.pipeline-stage span, .pipeline-stage strong, .pipeline-stage small { display: block; }
.pipeline-stage span { color: var(--ink-soft); font-size: 10px; font-weight: 850; text-transform: uppercase; letter-spacing: .08em; }
.pipeline-stage strong { margin: 9px 0 1px; font-family: Georgia, serif; font-size: 31px; font-weight: 500; }
.pipeline-stage small { color: #78817c; font-size: 10px; }
.pipeline-stage.featured { border-color: var(--forest); color: #fff; background: var(--forest); }
.pipeline-stage.featured span, .pipeline-stage.featured small { color: rgba(255,255,255,.62); }

.table-wrap { overflow-x: auto; margin-top: 14px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--paper); }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 16px 18px; border-bottom: 1px solid var(--line); text-align: left; font-size: 12px; }
th { color: #707972; background: #f9f6ef; font-size: 9px; letter-spacing: .08em; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
td strong, td small { display: block; }
td small { margin-top: 2px; color: #7b837f; }
.stage-badge { padding: 4px 9px; color: var(--forest); background: var(--gold-soft); font-size: 9px; font-weight: 850; }
.stage-badge.muted { background: var(--blue-soft); }

.systems-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.system-card { padding: 18px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--paper); }
.system-card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.system-card h3 { margin: 0; font-size: 14px; }
.system-dot { width: 8px; height: 8px; border-radius: 50%; background: #aaa59a; }
.system-card p { min-height: 38px; margin: 12px 0 0; color: var(--ink-soft); font-size: 11px; }
.system-status { display: block; margin-top: 15px; padding-top: 11px; border-top: 1px solid var(--line); color: #7c7669; font-size: 9px; font-weight: 850; text-transform: uppercase; letter-spacing: .07em; }

footer { margin-top: 56px; padding-top: 22px; border-top: 1px solid var(--line); color: #7a817d; font-size: 10px; }

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  max-width: min(380px, calc(100vw - 48px));
  padding: 14px 17px;
  border-radius: 11px;
  color: #fff;
  background: var(--forest);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  font-size: 12px;
}
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 1100px) {
  .hero { grid-template-columns: 1fr; }
  .hero-stats { max-width: 520px; }
  .agent-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .systems-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .sidebar { position: static; width: auto; padding: 18px 20px; }
  .main-nav { display: flex; overflow-x: auto; margin-top: 18px; }
  .nav-item { width: auto; flex: 0 0 auto; }
  .sidebar-status { display: none; }
  main { margin-left: 0; padding: 24px 18px; }
  .briefing-grid { grid-template-columns: 1fr; }
  .decision-card { grid-template-columns: 7px 1fr; }
  .decision-actions, .decision-result { grid-column: 2; justify-self: start; text-align: left; }
  .pipeline-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 580px) {
  .topbar, .section-heading, footer { align-items: flex-start; flex-direction: column; }
  .topbar-actions { width: 100%; justify-content: space-between; }
  .hero { padding: 28px 22px; }
  .hero-stats { grid-template-columns: 1fr; }
  .hero-stats div { display: flex; gap: 10px; align-items: baseline; padding: 10px 0; border-left: 0; border-top: 1px solid rgba(255,255,255,.14); }
  .hero-stats strong { font-size: 25px; }
  .priority-list li { grid-template-columns: auto 1fr; }
  .time-chip { grid-column: 2; justify-self: start; }
  .section-heading > p { text-align: left; }
  .decision-actions { flex-wrap: wrap; }
  .agent-grid, .systems-grid, .pipeline-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
