:root {
  color-scheme: dark light;
  --bg: #101113;
  --bg-soft: #17191d;
  --surface: #202329;
  --surface-strong: #292d35;
  --text: #f4efe5;
  --muted: #a9a497;
  --line: rgba(244, 239, 229, 0.12);
  --accent: #d5ae67;
  --accent-strong: #f1cf84;
  --danger: #f07979;
  --success: #82d59b;
  --warning: #e7bd63;
  --radius: 8px;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f1ea;
    --bg-soft: #ebe6dc;
    --surface: #fffaf0;
    --surface-strong: #f5ecd9;
    --text: #201d18;
    --muted: #655f54;
    --line: rgba(32, 29, 24, 0.14);
    --shadow: 0 24px 70px rgba(56, 44, 20, 0.14);
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(213, 174, 103, 0.14), transparent 34rem),
    var(--bg);
  color: var(--text);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--text);
  border-radius: 7px;
  min-height: 38px;
  padding: 0 12px;
  cursor: pointer;
}

button.primary {
  border-color: rgba(213, 174, 103, 0.55);
  background: linear-gradient(180deg, var(--accent-strong), var(--accent));
  color: #16120a;
  font-weight: 700;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: color-mix(in srgb, var(--surface) 86%, black);
  color: var(--text);
  padding: 10px 11px;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

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

.boot-panel,
.login {
  width: min(520px, calc(100vw - 32px));
  margin: 12vh auto 0;
  padding: 28px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}

.login h1,
.boot-panel h1 {
  margin: 0 0 10px;
  font-size: 32px;
  letter-spacing: 0;
}

.eyebrow {
  color: var(--accent);
  margin: 0 0 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

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

.error {
  color: var(--danger);
}

.workspace {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto auto 1fr;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px 12px;
  border-bottom: 1px solid var(--line);
}

.brand h1 {
  margin: 0;
  font-size: 22px;
}

.brand p {
  margin: 4px 0 0;
  color: var(--muted);
}

.stats {
  display: grid;
  grid-template-columns: repeat(8, minmax(92px, 1fr));
  gap: 8px;
  padding: 12px 22px;
  border-bottom: 1px solid var(--line);
}

.stat {
  min-height: 64px;
  padding: 10px;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.stat strong {
  display: block;
  font-size: 22px;
}

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

.main-grid {
  display: grid;
  grid-template-columns: 240px minmax(420px, 1fr) 360px;
  min-height: 0;
}

.rail,
.table-wrap,
.inspector {
  min-height: 0;
  overflow: auto;
}

.rail,
.inspector {
  padding: 16px;
  border-right: 1px solid var(--line);
}

.inspector {
  border-right: 0;
  border-left: 1px solid var(--line);
}

.filters {
  display: grid;
  gap: 10px;
}

.filter-pill {
  text-align: left;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.filter-pill.active {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.table-head {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.table-head input {
  max-width: 420px;
}

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

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

th {
  color: var(--muted);
  font-size: 12px;
  position: sticky;
  top: 0;
  background: var(--bg-soft);
}

tr {
  cursor: pointer;
}

tr.active-row {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
  margin: 0 4px 4px 0;
  color: var(--muted);
  font-size: 12px;
}

.tag.good {
  color: var(--success);
}

.tag.warn {
  color: var(--warning);
}

.tag.danger {
  color: var(--danger);
}

.inspector h2 {
  margin: 0 0 8px;
  font-size: 20px;
}

.field {
  display: grid;
  gap: 6px;
  margin: 12px 0;
}

.field label {
  color: var(--muted);
  font-size: 12px;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

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

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

  .rail,
  .inspector {
    border: 0;
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 520px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .table-head {
    align-items: stretch;
    flex-direction: column;
  }

  th:nth-child(4),
  td:nth-child(4),
  th:nth-child(5),
  td:nth-child(5) {
    display: none;
  }
}
