:root {
  color-scheme: dark;
  --bg: #101113;
  --surface: #17191d;
  --surface-strong: #20242a;
  --line: #31363d;
  --line-soft: #252a30;
  --text: #f3f6f8;
  --muted: #98a2ad;
  --muted-strong: #c1c8d0;
  --accent: #e0523f;
  --accent-soft: rgba(224, 82, 63, 0.16);
  --good: #3fbf7f;
  --warn: #d8a23a;
  --bad: #e0523f;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

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

button {
  cursor: pointer;
}

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

.login-shell {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    linear-gradient(135deg, rgba(224, 82, 63, 0.18), transparent 34%),
    linear-gradient(225deg, rgba(70, 132, 116, 0.14), transparent 40%),
    var(--bg);
}

.login-panel {
  width: min(420px, 100%);
  display: grid;
  gap: 28px;
  padding: 34px;
  background: rgba(13, 24, 41, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.login-panel h1,
.brand-block h1,
.topbar h2 {
  margin: 0;
}

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

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

.login-form {
  display: grid;
  gap: 16px;
}

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

input,
textarea,
select {
  width: 100%;
  min-height: 40px;
  color: var(--text);
  background: #121418;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  outline: none;
}

textarea {
  padding: 10px 12px;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
}

.primary-button,
.secondary-button,
.text-button,
.nav-item {
  border: 0;
  border-radius: 6px;
  min-height: 38px;
  padding: 0 14px;
  color: var(--text);
}

.primary-button {
  background: var(--accent);
  font-weight: 900;
}

.secondary-button {
  background: var(--surface-strong);
  border: 1px solid var(--line);
  font-weight: 800;
}

.text-button {
  background: transparent;
  color: var(--muted-strong);
  padding: 0;
}

.form-error,
.message-bar {
  margin: 0;
  color: #ffd5ce;
  background: rgba(224, 82, 63, 0.16);
  border: 1px solid rgba(224, 82, 63, 0.38);
  border-radius: 6px;
  padding: 10px 12px;
}

.app-shell {
  min-height: 100svh;
  display: grid;
  grid-template-columns: 238px minmax(0, 1fr);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  min-height: 100svh;
  padding: 22px;
  background: #0c0d0f;
  border-right: 1px solid var(--line-soft);
}

.brand-block {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-soft);
}

.brand-block h1 {
  font-size: 24px;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-item {
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--muted-strong);
  font-weight: 800;
}

.nav-item.active,
.nav-item:hover {
  background: var(--accent-soft);
  color: var(--text);
}

.admin-footer {
  margin-top: auto;
  display: grid;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.admin-footer p {
  margin: 0;
}

.workspace {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line-soft);
}

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

.range-controls,
.filter-row,
.tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.range-controls input {
  width: 150px;
}

.content-root {
  display: grid;
  gap: 18px;
  padding-top: 18px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--line-soft);
}

.metric-cell {
  min-height: 104px;
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 16px;
  background: var(--surface);
}

.metric-cell span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.metric-cell strong {
  font-size: 25px;
}

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

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.section-header h3 {
  margin: 0;
  font-size: 17px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
  background: var(--surface);
}

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

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  background: #13161a;
  white-space: nowrap;
}

td {
  color: var(--muted-strong);
  font-size: 13px;
}

tr:last-child td {
  border-bottom: 0;
}

.row-button {
  color: var(--text);
  background: transparent;
  border: 0;
  padding: 0;
  font-weight: 900;
  text-align: left;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  background: var(--surface-strong);
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.badge.good {
  color: #bff6da;
  background: rgba(63, 191, 127, 0.14);
}

.badge.bad {
  color: #ffd5ce;
  background: rgba(224, 82, 63, 0.16);
}

.chart {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--surface);
}

.bar-row {
  display: grid;
  grid-template-columns: 94px minmax(120px, 1fr) 58px;
  align-items: center;
  gap: 10px;
  color: var(--muted-strong);
  font-size: 12px;
}

.bar-track {
  height: 8px;
  overflow: hidden;
  background: #101216;
  border-radius: 999px;
}

.bar-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 220ms ease;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.35fr) minmax(0, 0.65fr);
  gap: 18px;
}

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

.action-panel {
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
}

.action-panel h4 {
  margin: 0;
  font-size: 14px;
}

.summary-panel {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
}

.summary-panel h3 {
  margin: 0;
}

.key-value {
  display: grid;
  gap: 5px;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
}

.key-value span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.key-value strong {
  color: var(--text);
  font-size: 14px;
}

.empty {
  color: var(--muted);
  padding: 24px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--surface);
}

@media (max-width: 1060px) {
  .metric-grid {
    grid-template-columns: repeat(3, minmax(130px, 1fr));
  }

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

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

@media (max-width: 760px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

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

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

  .nav-item {
    text-align: center;
    padding: 0 8px;
  }

  .topbar {
    display: grid;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
  }
}
