:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-2: #eef3f7;
  --ink: #18202b;
  --muted: #617084;
  --line: #d8e0ea;
  --brand: #1b7f79;
  --brand-dark: #0f5f5b;
  --accent: #c24d2c;
  --blue: #2f6fb4;
  --ok: #1f8f5a;
  --warn: #b17800;
  --danger: #b13b3b;
  --shadow: 0 12px 35px rgba(26, 39, 56, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

.hidden {
  display: none !important;
}

.loginView {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.loginCard {
  width: min(520px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow);
  display: grid;
  gap: 14px;
}

.loginCard label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.loginCard input {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
}

.loginCard input:focus {
  outline: 2px solid rgba(27, 127, 121, 0.16);
  border-color: var(--brand);
}

.loginButton {
  height: 44px;
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.loginButton:hover {
  background: var(--brand-dark);
}

.loginFeedback {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.shell {
  width: min(1440px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.05;
}

h2 {
  font-size: 18px;
  line-height: 1.2;
}

.subtitle {
  margin: 10px 0 0;
  max-width: 620px;
  color: var(--muted);
  font-size: 16px;
}

.statusBox {
  min-width: 255px;
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.statusBox strong,
.statusBox span {
  display: block;
}

.statusBox span:last-child {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.statusMeta {
  margin-top: 2px;
  color: var(--brand-dark);
  font-size: 11px;
  font-weight: 800;
  text-transform: lowercase;
}

.statusDot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--warn);
  box-shadow: 0 0 0 4px rgba(177, 120, 0, 0.14);
}

.statusDot.running {
  background: var(--blue);
  box-shadow: 0 0 0 4px rgba(47, 111, 180, 0.14);
}

.statusDot.done {
  background: var(--ok);
  box-shadow: 0 0 0 4px rgba(31, 143, 90, 0.14);
}

.notice {
  border: 1px solid #cfdad9;
  background: #edf6f4;
  color: #27413f;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 18px;
}

.metricGrid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric {
  min-height: 124px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin-top: 10px;
  font-size: 28px;
  line-height: 1.05;
}

.metric small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.sectionGrid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr);
  gap: 18px;
  margin-bottom: 18px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 18px;
}

.wide {
  min-width: 0;
}

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

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

.chipButton {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.chipButton.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.liveActions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.statusBox .chipButton {
  margin-left: auto;
}

.livePanel {
  margin-bottom: 18px;
}

.liveFilterBar {
  grid-template-columns: 180px minmax(220px, 1fr);
}

.statusBadge {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.statusBadge.neutral,
.statusBadge.waiting {
  background: #eef3f7;
  color: var(--muted);
}

.statusBadge.approved {
  background: #dff4e9;
  color: var(--ok);
}

.statusBadge.denied {
  background: #fde9e9;
  color: var(--danger);
}

.statusBadge.error {
  background: #fff0db;
  color: var(--warn);
}

.chart {
  display: grid;
  grid-template-columns: repeat(var(--bar-count), minmax(24px, 1fr));
  align-items: end;
  gap: 8px;
  min-height: 330px;
  padding: 8px 0 0;
  overflow-x: auto;
}

.barWrap {
  min-width: 44px;
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 8px;
  height: 300px;
}

.barStack {
  display: flex;
  align-items: end;
  gap: 3px;
  min-height: 240px;
  border-bottom: 1px solid var(--line);
}

.bar {
  width: 100%;
  min-height: 2px;
  border-radius: 5px 5px 0 0;
}

.bar.ops {
  background: var(--brand);
}

.bar.value {
  background: var(--accent);
}

.barLabel {
  color: var(--muted);
  font-size: 11px;
  text-align: center;
  white-space: nowrap;
}

.workloadList,
.hierarchy,
.detailList {
  display: grid;
  gap: 10px;
}

.workItem,
.hierarchyItem {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.workItem:last-child,
.hierarchyItem:last-child {
  border-bottom: 0;
}

.workItem span,
.hierarchyItem span,
.detailList dt {
  color: var(--muted);
  font-size: 13px;
}

.workItem strong,
.hierarchyItem strong,
.detailList dd {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  text-align: right;
}

.progressArea {
  margin: 10px 0 14px;
}

.progressTrack {
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #dde5ee;
}

.progressFill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
  transition: width 180ms ease;
}

.progressNumbers {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.detailList {
  grid-template-columns: 1fr auto;
}

.guardrails {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.guardrails li {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  padding: 12px;
  color: #324253;
  font-size: 13px;
}

.scopePanel {
  margin-bottom: 18px;
}

.scopeGrid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

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

.scopeMetric span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.scopeMetric strong {
  display: block;
  margin-top: 8px;
  color: var(--ink);
  font-size: 21px;
}

.filterBar {
  display: grid;
  grid-template-columns: 220px 220px minmax(220px, 1fr);
  gap: 10px;
  margin: 6px 0 12px;
}

.filterBar label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.filterBar select,
.filterBar input {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  padding: 0 10px;
}

.tableWrap {
  max-height: 390px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.scopeTable {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
}

.scopeTable th,
.scopeTable td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 13px;
}

.scopeTable th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f7fafc;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.scopeTable td:nth-child(4),
.scopeTable td:nth-child(5),
.scopeTable th:nth-child(4),
.scopeTable th:nth-child(5) {
  text-align: right;
}

.liveTable td:nth-child(1),
.liveTable th:nth-child(1),
.liveTable td:nth-child(2),
.liveTable th:nth-child(2),
.liveTable td:nth-child(3),
.liveTable th:nth-child(3),
.liveTable td:nth-child(4),
.liveTable th:nth-child(4),
.liveTable td:nth-child(5),
.liveTable th:nth-child(5),
.liveTable td:nth-child(6),
.liveTable th:nth-child(6),
.liveTable td:nth-child(7),
.liveTable th:nth-child(7),
.liveTable td:nth-child(10),
.liveTable th:nth-child(10) {
  white-space: nowrap;
}

.liveTable td:nth-child(8),
.liveTable td:nth-child(9),
.liveTable th:nth-child(8),
.liveTable th:nth-child(9) {
  text-align: right;
}

.liveTable .mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}

.scopeTable tbody tr:hover {
  background: #f8fbfc;
}

@media (max-width: 1050px) {
  .metricGrid,
  .guardrails,
  .scopeGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sectionGrid {
    grid-template-columns: 1fr;
  }

  .filterBar {
    grid-template-columns: 1fr;
  }

  .liveFilterBar {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .shell {
    width: min(100vw - 20px, 1440px);
    padding-top: 18px;
  }

  .topbar {
    display: grid;
  }

  .statusBox {
    min-width: 0;
  }

  .metricGrid,
  .guardrails,
  .scopeGrid {
    grid-template-columns: 1fr;
  }

  .metric strong {
    font-size: 24px;
  }
}
