:root {
  color-scheme: light;
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --text: #111827;
  --muted: #64748b;
  --line: #dce4f0;
  --blue: #155eef;
  --blue-dark: #0f46c7;
  --green: #087443;
  --red: #b42318;
  --shadow: 0 20px 50px rgba(15, 23, 42, .08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(21, 94, 239, .12), transparent 34rem),
    linear-gradient(180deg, #f8fbff 0%, var(--bg) 42%, #eef2f8 100%);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
}

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

.login-view {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 32px;
}

.login-panel {
  width: min(100%, 420px);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, .92);
  box-shadow: var(--shadow);
  padding: 28px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: 12px;
  background: #111827;
  color: white;
  font-weight: 800;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(26px, 4vw, 36px);
  line-height: 1.05;
}

h2 {
  font-size: 18px;
}

.login-copy {
  margin-top: 20px;
  color: var(--muted);
  line-height: 1.55;
}

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

.login-form label,
.range-control {
  display: grid;
  gap: 6px;
  color: #334155;
  font-size: 13px;
  font-weight: 750;
}

.login-form input,
.range-control select {
  height: 44px;
  border: 1px solid #cfd8e6;
  border-radius: 8px;
  background: white;
  color: var(--text);
  padding: 0 12px;
  outline: none;
}

.login-form input:focus,
.range-control select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(21, 94, 239, .16);
}

.login-form button,
.secondary {
  height: 44px;
  background: var(--blue);
  color: white;
  padding: 0 16px;
}

.login-form button:hover,
.secondary:hover {
  background: var(--blue-dark);
}

.ghost {
  height: 44px;
  border: 1px solid var(--line);
  background: white;
  color: #334155;
  padding: 0 16px;
}

.form-error,
.alert {
  color: var(--red);
  font-size: 13px;
}

.dashboard-view {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 30px;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.muted {
  margin-top: 8px;
  color: var(--muted);
}

.actions {
  display: flex;
  align-items: end;
  gap: 10px;
}

.kpi-grid,
.content-grid {
  display: grid;
  gap: 14px;
}

.kpi-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 14px;
}

.content-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 14px;
}

.main-grid {
  grid-template-columns: minmax(0, 1.45fr) minmax(340px, .55fr);
}

.kpi-card,
.panel,
.alert,
.notes {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}

.kpi-card {
  padding: 18px;
}

.kpi-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.kpi-card strong {
  display: block;
  margin-top: 9px;
  font-size: 30px;
  line-height: 1;
}

.kpi-card small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
}

.kpi-card.accent strong {
  color: var(--green);
}

.panel {
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 18px 0;
}

.panel-head p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.table-wrap {
  overflow-x: auto;
  padding: 12px 18px 18px;
}

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

th,
td {
  border-bottom: 1px solid #e7edf5;
  padding: 10px 8px;
  text-align: right;
  white-space: nowrap;
}

th:first-child,
td:first-child {
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

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

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  background: #eef4ff;
  color: var(--blue);
  padding: 0 9px;
  font-weight: 750;
}

.alert {
  margin-bottom: 14px;
  padding: 14px 16px;
  background: #fff7f7;
}

.notes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px;
}

.note {
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  padding: 8px 10px;
  font-size: 12px;
}

[hidden] {
  display: none !important;
}

@media (max-width: 980px) {
  .topbar,
  .actions {
    align-items: stretch;
    flex-direction: column;
  }

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