:root {
  --bg: #070707;
  --bg-panel: #0d0d0d;
  --bg-panel-2: #121212;
  --line: #2f513d;
  --line-strong: #4f8a68;
  --text: #d8e7d5;
  --muted: #8ca08f;
  --green: #8df0a9;
  --amber: #f4cd62;
  --red: #ef7f7f;
  --cyan: #8fd1ff;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "IBM Plex Mono", "SFMono-Regular", Menlo, Consolas, monospace;
}

body::before,
body::after {
  content: "";
  position: fixed;
  left: 0;
  right: 0;
  pointer-events: none;
}

body::before {
  top: 0;
  height: 1px;
  background: rgba(141, 240, 169, 0.18);
}

body::after {
  bottom: 0;
  height: 1px;
  background: rgba(141, 240, 169, 0.08);
}

.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.14;
  background:
    repeating-linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.03) 0,
      rgba(255, 255, 255, 0.03) 1px,
      transparent 1px,
      transparent 4px
    );
}

.shell {
  position: relative;
  max-width: 1580px;
  margin: 0 auto;
  padding: 20px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.8fr);
  gap: 18px;
  margin-bottom: 16px;
  padding: 18px;
  border: 1px solid var(--line-strong);
  background: linear-gradient(180deg, rgba(17, 17, 17, 0.98), rgba(10, 10, 10, 0.98));
}

.kicker {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.18em;
}

.topbar h1 {
  margin: 0 0 10px;
  font-size: clamp(28px, 5vw, 42px);
  line-height: 1;
  font-weight: 600;
}

.headline {
  margin: 0;
  color: var(--text);
  line-height: 1.7;
  max-width: 78ch;
}

.topbar-meta {
  display: grid;
  gap: 14px;
  align-content: start;
}

.status-pill {
  justify-self: start;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  color: var(--green);
  background: rgba(141, 240, 169, 0.08);
  font-size: 12px;
  letter-spacing: 0.12em;
}

.status-pill.warn {
  color: var(--amber);
  border-color: rgba(244, 205, 98, 0.6);
  background: rgba(244, 205, 98, 0.08);
}

.status-pill.bad {
  color: var(--red);
  border-color: rgba(239, 127, 127, 0.65);
  background: rgba(239, 127, 127, 0.08);
}

.meta-list {
  display: grid;
  gap: 8px;
}

.meta-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px dashed rgba(79, 138, 104, 0.45);
}

.meta-list span {
  color: var(--muted);
}

.snapshot {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric {
  border: 1px solid var(--line);
  background: var(--bg-panel);
  min-height: 104px;
  padding: 14px;
}

.metric-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.metric-value {
  margin-top: 14px;
  font-size: clamp(24px, 2.2vw, 34px);
  line-height: 1;
}

.metric-sub {
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.hint {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border: 1px solid var(--line-strong);
  color: var(--green);
  font-size: 10px;
  cursor: help;
}

.hint::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%);
  min-width: 220px;
  max-width: 300px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  background: #0a0a0a;
  color: var(--text);
  font-size: 12px;
  line-height: 1.5;
  white-space: normal;
  opacity: 0;
  visibility: hidden;
  transition: opacity 120ms ease;
  z-index: 20;
}

.hint:hover::after,
.hint:focus-visible::after {
  opacity: 1;
  visibility: visible;
}

.notice {
  margin-bottom: 16px;
  padding: 14px 16px;
  border: 1px solid rgba(244, 205, 98, 0.5);
  background: rgba(70, 56, 19, 0.24);
}

.notice.hidden {
  display: none;
}

.notice-list {
  display: grid;
  gap: 8px;
  color: var(--amber);
}

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

.panel {
  border: 1px solid var(--line);
  background: var(--bg-panel-2);
  padding: 16px;
  min-width: 0;
}

.panel-wide {
  grid-column: span 2;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 14px;
}

.section-head h2 {
  margin: 0;
  font-size: 15px;
  color: var(--text);
}

.section-head span {
  color: var(--muted);
  font-size: 12px;
}

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

.phase-card {
  border: 1px solid var(--line);
  background: #101010;
  padding: 14px;
}

.phase-label {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 10px;
}

.phase-value {
  color: var(--text);
  font-size: 19px;
  line-height: 1.35;
}

.phase-sub {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

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

.kv {
  border: 1px solid rgba(79, 138, 104, 0.45);
  background: rgba(255, 255, 255, 0.01);
  padding: 12px;
}

.kv .k {
  color: var(--muted);
  font-size: 12px;
}

.kv .v {
  margin-top: 8px;
  word-break: break-word;
  line-height: 1.45;
}

.bucket-chart {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 8px;
  align-items: end;
  min-height: 176px;
  padding-top: 12px;
}

.bucket {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.bucket-count {
  color: var(--text);
  font-size: 11px;
}

.bucket-bar-wrap {
  width: 100%;
  min-height: 112px;
  display: flex;
  align-items: flex-end;
}

.bucket-bar {
  width: 100%;
  min-height: 2px;
  border: 1px solid rgba(143, 209, 255, 0.5);
  background: linear-gradient(180deg, rgba(143, 209, 255, 0.78), rgba(141, 240, 169, 0.14));
}

.bucket-label {
  color: var(--muted);
  font-size: 10px;
}

.table-shell {
  overflow: auto;
  border: 1px solid rgba(79, 138, 104, 0.45);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead {
  background: rgba(143, 209, 255, 0.05);
}

th,
td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid rgba(79, 138, 104, 0.28);
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

td.wrap {
  white-space: normal;
}

td.positive {
  color: var(--green);
}

td.negative {
  color: var(--red);
}

td.warning {
  color: var(--amber);
}

.empty {
  color: var(--muted);
}

.audit-list {
  display: grid;
  gap: 8px;
}

.audit-row {
  display: grid;
  grid-template-columns: 140px 160px minmax(0, 1fr);
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(79, 138, 104, 0.35);
  background: rgba(255, 255, 255, 0.01);
}

.audit-type {
  color: var(--cyan);
}

.audit-time {
  color: var(--muted);
}

.audit-message {
  white-space: normal;
  line-height: 1.5;
}

@media (max-width: 1280px) {
  .snapshot {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

@media (max-width: 980px) {
  .topbar,
  .grid {
    grid-template-columns: 1fr;
  }

  .panel-wide {
    grid-column: span 1;
  }
}

@media (max-width: 820px) {
  .shell {
    padding: 12px;
  }

  .snapshot,
  .kv-grid,
  .phase-grid {
    grid-template-columns: 1fr;
  }

  .audit-row {
    grid-template-columns: 1fr;
  }
}
