:root {
  color-scheme: light;
  --bg: #eef2ef;
  --surface: #ffffff;
  --surface-2: #f7faf8;
  --ink: #17211c;
  --muted: #66736c;
  --line: #d8e0db;
  --accent: #1f7a5a;
  --accent-2: #2f6fbd;
  --warn: #b97809;
  --danger: #b8382f;
  --shadow: 0 14px 34px rgba(23, 33, 28, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(238, 242, 239, 0.96)),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  min-height: 38px;
  padding: 0 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

button:hover {
  background: #edf7f2;
  border-color: #aac8bb;
}

button:active {
  transform: translateY(1px);
}

input {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: var(--surface);
  color: var(--ink);
  min-width: 0;
}

.app-shell {
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  padding: 22px 0 18px;
}

.eyebrow,
.subtitle {
  margin: 0;
  color: var(--muted);
}

.eyebrow {
  text-transform: uppercase;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

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

h1 {
  font-size: clamp(2rem, 4vw, 4.6rem);
  line-height: 1;
  margin-top: 6px;
}

h2 {
  font-size: 1rem;
}

.subtitle {
  margin-top: 8px;
  font-size: 1.03rem;
}

.status-cluster {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.status-pill,
.mini-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  min-height: 32px;
  padding: 0 12px;
  font-weight: 800;
  border: 1px solid transparent;
  white-space: nowrap;
}

.status-pill.ready {
  background: #e5f5ed;
  color: #166143;
  border-color: #c2e4d1;
}

.status-pill.active {
  background: #e7f0ff;
  color: #235ca7;
  border-color: #c3d7f4;
}

.status-pill.queue {
  background: #fff3d8;
  color: #8d5a08;
  border-color: #efd49c;
}

.status-pill.cooldown {
  background: #ffe8e5;
  color: #9c3028;
  border-color: #efc1bb;
}

.timebox {
  display: grid;
  gap: 2px;
  text-align: right;
  color: var(--muted);
  font-size: 0.84rem;
}

.timebox strong {
  color: var(--ink);
  font-size: 1rem;
}

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

.metric {
  min-width: 0;
  min-height: 96px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.86);
  padding: 14px;
  box-shadow: 0 8px 18px rgba(23, 33, 28, 0.04);
}

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

.metric strong {
  display: block;
  margin-top: 10px;
  font-size: clamp(1.08rem, 2vw, 1.7rem);
  line-height: 1.08;
  overflow-wrap: anywhere;
}

.layout-two {
  display: grid;
  grid-template-columns: minmax(320px, 0.82fr) minmax(460px, 1.18fr);
  gap: 16px;
  margin-bottom: 16px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  min-width: 0;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.danger-button {
  color: var(--danger);
  border-color: #efc0ba;
  background: #fff7f6;
}

.danger-button:hover {
  background: #ffe8e5;
  border-color: #e29a92;
}

.details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 0;
  background: var(--line);
}

.details div {
  min-height: 70px;
  padding: 12px 14px;
  background: var(--surface);
}

.details dt {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.details dd {
  margin: 8px 0 0;
  overflow-wrap: anywhere;
  font-weight: 700;
}

.table-wrap {
  overflow-x: auto;
}

.table-wrap.compact {
  max-height: 314px;
  overflow-y: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

th {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface-2);
}

td {
  font-size: 0.9rem;
}

.empty-cell {
  color: var(--muted);
  text-align: center;
}

.mini-pill {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--muted);
  font-size: 0.82rem;
}

.controls-band {
  display: grid;
  grid-template-columns: repeat(6, max-content);
  gap: 10px;
  align-items: end;
  margin: 16px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
}

.controls-band label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.controls-band input {
  width: 210px;
}

.cooldown-banner {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid #efc1bb;
  border-radius: var(--radius);
  background: #fff1ef;
  color: #8f2e27;
}

.hidden {
  display: none;
}

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

.chart-panel {
  min-height: 330px;
  padding: 14px 16px 18px;
}

.chart-panel h2 {
  margin-bottom: 12px;
}

.chart-panel canvas {
  width: 100%;
  height: 260px;
  max-height: 260px;
}

.events-panel {
  margin-bottom: 24px;
}

.status-text {
  font-weight: 700;
}

@media (max-width: 1240px) {
  .summary-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

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

@media (max-width: 900px) {
  .app-shell {
    width: min(100% - 20px, 1480px);
    padding-top: 12px;
  }

  .topbar,
  .layout-two {
    grid-template-columns: 1fr;
    display: grid;
  }

  .status-cluster {
    justify-content: flex-start;
  }

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

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

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

  .controls-band button,
  .controls-band input {
    width: 100%;
  }
}

@media (max-width: 540px) {
  .summary-grid,
  .details,
  .controls-band {
    grid-template-columns: 1fr;
  }

  th,
  td {
    padding: 9px 10px;
  }
}
