:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --panel: #ffffff;
  --panel-soft: #f0f3f7;
  --line: #d8dee8;
  --text: #172033;
  --muted: #637086;
  --accent: #0b67c2;
  --accent-dark: #074f97;
  --danger: #b4232f;
  --warn: #966300;
  --ok: #167348;
}

* {
  box-sizing: border-box;
}

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

button,
input {
  font: inherit;
}

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

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 28px;
  min-height: 100vh;
  padding: 24px;
  border-right: 1px solid var(--line);
  background: var(--panel);
}

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

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

h1 {
  font-size: 28px;
  line-height: 1.05;
}

h2 {
  font-size: 30px;
  line-height: 1.1;
}

h3 {
  margin-bottom: 12px;
  font-size: 18px;
}

nav {
  display: grid;
  gap: 8px;
}

.nav-button,
.sync-state button,
.access-form button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
}

.nav-button {
  padding: 9px 12px;
  text-align: left;
}

.nav-button.active,
.nav-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.access-form {
  display: grid;
  gap: 8px;
  margin-top: auto;
}

.access-form label {
  color: var(--muted);
  font-size: 13px;
}

.access-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
}

.access-form button,
.sync-state button {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
  padding: 8px 12px;
}

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

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}

.sync-state {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.metric {
  min-height: 84px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
  line-height: 1;
}

.metric.danger strong {
  color: var(--danger);
}

.metric.warn strong {
  color: var(--warn);
}

.metric.ok strong {
  color: var(--ok);
}

.content-panel {
  display: grid;
  gap: 20px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
}

.panel-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

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

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-weight: 700;
  background: #f8fafc;
}

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

a {
  color: var(--accent);
}

small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  max-width: 560px;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 750;
}

.badge.red {
  background: #fbeaec;
  color: var(--danger);
}

.badge.yellow {
  background: #fff3d7;
  color: var(--warn);
}

.badge.green,
.badge.fresh {
  background: #e7f6ee;
  color: var(--ok);
}

.badge.neutral {
  background: #edf1f5;
  color: var(--muted);
}

.score {
  position: relative;
  min-width: 96px;
  height: 22px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8edf3;
}

.score i {
  position: absolute;
  inset: 0 auto 0 0;
  background: linear-gradient(90deg, #4f9de8, #b4232f);
}

.score span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #101827;
  font-size: 12px;
  font-weight: 750;
}

.filters {
  display: flex;
  gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.filters input {
  min-width: 260px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
}

.filters button {
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #ffffff;
  padding: 10px 14px;
  cursor: pointer;
}

.alert {
  margin-bottom: 20px;
  border: 1px solid #f1c48b;
  border-radius: 8px;
  background: #fff8ec;
  color: #6f4400;
  padding: 12px 14px;
}

.hidden {
  display: none;
}

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

  .sidebar {
    position: static;
    min-height: auto;
  }

  nav {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  }
}

@media (max-width: 640px) {
  .workspace,
  .sidebar {
    padding: 16px;
  }

  .topbar,
  .filters {
    display: grid;
  }

  h2 {
    font-size: 24px;
  }

  .filters input {
    min-width: 0;
    width: 100%;
  }
}
