:root {
  color-scheme: light;
  --bg: #f3f5f2;
  --panel: #ffffff;
  --panel-soft: #f8faf8;
  --ink: #17211b;
  --muted: #68736c;
  --line: #d9dfd8;
  --green: #22775b;
  --green-soft: #e4f2eb;
  --amber: #9b6a04;
  --amber-soft: #fff4d4;
  --red: #a64038;
  --red-soft: #fae7e2;
  --blue: #315f9c;
  --blue-soft: #e7eef9;
  --shadow: 0 22px 60px rgba(39, 47, 41, 0.11);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
textarea {
  font: inherit;
}

.app-frame {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 18px;
  padding: 20px;
  border-right: 1px solid var(--line);
  background: #fff;
}

.brand h1,
.topbar h2,
h3,
p {
  margin-top: 0;
}

.brand h1 {
  margin-bottom: 3px;
  font-size: 30px;
  line-height: 1.05;
}

.brand-subtitle {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
}

.nav-list {
  display: grid;
  align-content: start;
  gap: 8px;
}

.nav-item {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 12px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font-weight: 800;
  cursor: pointer;
}

.nav-item:hover,
.nav-item:focus {
  border-color: var(--line);
  background: var(--panel-soft);
  outline: none;
}

.nav-item.active {
  border-color: #b9d8ca;
  background: var(--green-soft);
  color: var(--green);
}

.side-note {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--panel-soft);
}

.side-note p:last-child {
  margin-bottom: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.main-shell {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  padding: 22px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
}

.topbar h2 {
  margin-bottom: 0;
  font-size: 30px;
  line-height: 1.1;
}

.status-strip,
.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.status-pill {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  background: #eef1ef;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status-pill.good {
  border-color: #b8dcc9;
  background: var(--green-soft);
  color: var(--green);
}

.status-pill.warn {
  border-color: #ecd58a;
  background: var(--amber-soft);
  color: var(--amber);
}

.status-pill.danger {
  border-color: #e4b8b2;
  background: var(--red-soft);
  color: var(--red);
}

.route-content {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 16px;
  padding: 18px;
}

.hero-band,
.panel,
.info-card,
.project-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.hero-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 300px);
  gap: 18px;
  align-items: center;
  padding: 20px;
}

.hero-band h3 {
  margin-bottom: 8px;
  font-size: 24px;
  line-height: 1.18;
}

.hero-band p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
}

.hero-band.health {
  border-color: #ebd38b;
  background: #fffdf6;
}

.next-box {
  min-height: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--panel-soft);
}

.next-box strong {
  display: block;
  font-size: 17px;
  line-height: 1.35;
}

.card-grid,
.two-column {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.card-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.info-card,
.project-card,
.panel {
  min-width: 0;
  padding: 16px;
}

.info-card h3 {
  margin-bottom: 0;
  font-size: 18px;
  line-height: 1.25;
}

.info-card.good {
  border-color: #b8dcc9;
  background: var(--green-soft);
}

.info-card.warn,
.project-card.warn {
  border-color: #ecd58a;
  background: var(--amber-soft);
}

.info-card.danger,
.project-card.danger {
  border-color: #e4b8b2;
  background: var(--red-soft);
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 14px;
}

.line-list {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.line-list li,
.queue-row,
.kv-grid div {
  border-top: 1px solid var(--line);
  padding-top: 9px;
}

.line-list li {
  color: var(--muted);
  font-weight: 700;
  line-height: 1.45;
}

.queue-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(140px, auto);
  gap: 16px;
  align-items: start;
}

.queue-row + .queue-row {
  margin-top: 10px;
}

.queue-row span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.chat-layout {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 16px;
}

.case-list {
  max-height: calc(100vh - 126px);
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.case-item {
  width: 100%;
  display: grid;
  gap: 4px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.case-item:hover,
.case-item:focus {
  border-color: var(--line);
  background: var(--panel-soft);
  outline: none;
}

.case-item.active {
  border-color: #b9d8ca;
  background: var(--green-soft);
}

.case-item strong,
.case-item span {
  overflow-wrap: anywhere;
}

.case-item span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.chat-main {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.response-copy {
  margin-bottom: 16px;
  font-size: 19px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.kv-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

.kv-grid.single {
  grid-template-columns: 1fr;
}

dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

dd {
  margin: 3px 0 0;
  font-size: 14px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.stack {
  display: grid;
  gap: 12px;
}

.approval-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(170px, auto);
  gap: 16px;
  align-items: start;
}

.approval-row p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
}

.approval-row.warn {
  border-color: #ecd58a;
}

.approval-row.danger {
  border-color: #e4b8b2;
}

.approval-state {
  display: grid;
  justify-items: end;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
}

@media (max-width: 1120px) {
  .app-frame,
  .chat-layout,
  .hero-band,
  .two-column {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .sidebar,
  .topbar,
  .route-content {
    padding: 14px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav-list,
  .card-grid,
  .kv-grid,
  .approval-row,
  .queue-row {
    grid-template-columns: 1fr;
  }

  .topbar h2 {
    font-size: 25px;
  }

  .hero-band h3 {
    font-size: 21px;
  }

  .approval-state {
    justify-items: start;
  }
}
