:root {
  color-scheme: light;
  --ink: #202124;
  --muted: #667085;
  --line: #d8dee8;
  --panel: #ffffff;
  --page: #f6f7f9;
  --nav: #253041;
  --nav-soft: #344154;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --warning: #b45309;
  --danger: #b42318;
  --success: #067647;
  --focus: #2563eb;
  --shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.25);
  outline-offset: 2px;
}

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

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  min-height: 100vh;
  padding: 22px 18px;
  background: var(--nav);
  color: #ffffff;
}

.brand {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  background: #ffffff;
  color: var(--nav);
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  margin-top: 2px;
  color: #c6d0de;
}

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

.nav-list a {
  padding: 10px 12px;
  border-radius: 6px;
  color: #d7deea;
  text-decoration: none;
}

.nav-list a.is-active,
.nav-list a:hover {
  background: var(--nav-soft);
  color: #ffffff;
}

.sidebar-footer {
  display: grid;
  gap: 4px;
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  color: #d7deea;
  overflow-wrap: anywhere;
}

.sidebar-footer small {
  color: #aab6c6;
}

.main-panel {
  min-width: 0;
  padding: 28px;
}

.page-header,
.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.page-header {
  margin-bottom: 22px;
}

.page-header h1,
.auth-panel h1 {
  margin: 0;
  font-size: 2rem;
  line-height: 1.1;
}

.panel-header h2 {
  margin: 0;
  font-size: 1.05rem;
}

.panel-header p,
.muted {
  margin: 6px 0 0;
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.primary-button,
.secondary-button,
.ghost-button {
  padding: 0 14px;
  font-weight: 700;
}

.primary-button {
  background: var(--accent);
  color: #ffffff;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.secondary-button {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
}

.ghost-button {
  background: transparent;
  color: var(--muted);
}

.auth-panel,
.loading-panel {
  display: grid;
  gap: 24px;
  width: min(520px, 100%);
  margin: 9vh auto 0;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

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

.login-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 700;
}

.login-form input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
}

.form-error,
.inline-error {
  margin: 0;
  color: var(--danger);
  font-weight: 700;
}

.inline-error {
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid rgba(180, 35, 24, 0.22);
  border-radius: 6px;
  background: #fff4f2;
}

.loading-panel {
  place-items: center;
  text-align: center;
}

.loader {
  width: 32px;
  height: 32px;
  border: 3px solid #d4e7e4;
  border-top-color: var(--accent);
  border-radius: 999px;
  animation: spin 0.8s linear infinite;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

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

.metric-card {
  display: grid;
  gap: 8px;
  min-height: 92px;
  padding: 16px;
}

.metric-card span {
  color: var(--muted);
  font-size: 0.86rem;
}

.metric-card strong {
  font-size: 1.6rem;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr);
  gap: 18px;
  align-items: start;
}

.panel {
  min-width: 0;
  padding: 18px;
}

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

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

table {
  width: 100%;
  min-width: 840px;
  border-collapse: collapse;
}

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

th {
  background: #f1f4f8;
  color: #4b5565;
  font-size: 0.8rem;
  text-transform: uppercase;
}

td span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.86rem;
}

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

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #eef2f6;
  color: #364152;
  font-size: 0.8rem;
  font-weight: 800;
}

.status-pill.review {
  background: #fff3d6;
  color: var(--warning);
}

.status-pill.data-check {
  background: #eef4ff;
  color: var(--focus);
}

.status-pill.monitor {
  background: #ecfdf3;
  color: var(--success);
}

.review-list,
.source-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.review-item,
.source-item {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.review-item {
  grid-template-columns: minmax(0, 1fr) auto;
}

.review-item p,
.source-item p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
}

.source-item {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.source-item > span {
  color: var(--accent-strong);
  font-weight: 800;
}

.empty-state {
  margin: 16px 0 0;
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 1100px) {
  .metrics-grid {
    grid-template-columns: repeat(3, minmax(120px, 1fr));
  }

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

  .wide-panel {
    grid-row: auto;
  }
}

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

  .sidebar {
    min-height: auto;
  }

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

  .main-panel {
    padding: 18px;
  }

  .page-header,
  .panel-header,
  .review-item,
  .source-item {
    display: grid;
  }

  .header-actions {
    justify-content: stretch;
  }

  .header-actions button {
    flex: 1 1 140px;
  }

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

@media (max-width: 460px) {
  .metrics-grid,
  .nav-list {
    grid-template-columns: 1fr;
  }

  .auth-panel {
    margin-top: 0;
    border-radius: 0;
  }
}
