:root {
  color-scheme: light;
  --background: #f8f9fd;
  --foreground: #172033;
  --card: #ffffff;
  --card-foreground: #172033;
  --muted: #f1f4f9;
  --muted-foreground: #667287;
  --primary: #5367d8;
  --primary-foreground: #ffffff;
  --accent: #edf0ff;
  --accent-foreground: #4052ba;
  --border: #e5e9f1;
  --input: #d8deea;
  --ring: #6879e5;
  --destructive: #b44754;
  --warning: #94631d;
  --success: #34785b;
  --viz-series-1: #6173dc;
  --viz-series-2: #5e9b7b;
  --viz-series-3: #c08a4d;
  --viz-series-4: #8e72bf;
  --viz-series-5: #c86475;
  --viz-series-6: #52999b;
  --shadow: 0 1px 2px rgb(35 45 75 / 3%), 0 12px 32px rgb(47 61 105 / 6%);
  --radius: 16px;
  --font-size-base: 15px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --background: #10131c;
  --foreground: #eef1fb;
  --card: #181c28;
  --card-foreground: #eef1fb;
  --muted: #232938;
  --muted-foreground: #a3adc0;
  --primary: #7d8df0;
  --primary-foreground: #111522;
  --accent: #272f55;
  --accent-foreground: #d3d8ff;
  --border: #2b3243;
  --input: #374056;
  --ring: #91a0ff;
  --destructive: #ed8995;
  --warning: #e0b36f;
  --success: #7bc5a0;
  --viz-series-1: #8f9bf1;
  --viz-series-2: #7cb999;
  --viz-series-3: #d5a064;
  --viz-series-4: #ad94d7;
  --viz-series-5: #df8593;
  --viz-series-6: #72b5b7;
  --shadow: 0 1px 2px rgb(0 0 0 / 20%), 0 16px 38px rgb(0 0 0 / 18%);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--background);
}

body {
  margin: 0;
  color: var(--foreground);
  background:
    radial-gradient(circle at 78% -12%, rgb(104 121 229 / 9%), transparent 34rem),
    var(--background);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: var(--font-size-base);
  line-height: 1.5;
}

strong {
  font-weight: 600;
}

::selection {
  color: var(--foreground);
  background: color-mix(in srgb, var(--primary) 28%, var(--card));
}

button,
select,
input {
  font: inherit;
}

a {
  color: inherit;
}

a:focus-visible,
button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--ring) 60%, transparent);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  z-index: 20;
  top: 8px;
  left: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--primary-foreground);
  background: var(--primary);
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

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

.topbar {
  position: sticky;
  z-index: 10;
  top: 0;
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 24px;
  min-width: 0;
  padding: 10px 24px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 78%, transparent);
  background: color-mix(in srgb, var(--card) 88%, transparent);
  box-shadow: 0 1px 8px rgb(35 45 75 / 3%);
  backdrop-filter: blur(18px);
}

.topbar > :not(.brand),
.sidebar,
.filterbar,
main {
  transition: opacity 160ms ease;
}

body.booting .topbar > :not(.brand),
body.booting .sidebar,
body.booting .filterbar,
body.booting main {
  visibility: hidden;
  opacity: 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 12px;
  color: var(--primary-foreground);
  background: linear-gradient(145deg, #7182ec, var(--primary));
  box-shadow: 0 6px 16px rgb(83 103 216 / 24%);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .04em;
}

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

.brand strong {
  font-weight: 600;
  letter-spacing: -.01em;
}

.brand small,
.as-of {
  color: var(--muted-foreground);
  font-size: 12px;
}

.as-of {
  white-space: nowrap;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 9px;
  white-space: nowrap;
}

.user-menu[hidden] {
  display: none;
}

.user-menu img {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  box-shadow: 0 0 0 2px var(--card), 0 0 0 3px var(--border);
}

.user-menu span {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13px;
}

.signed-out .app-shell {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 68px minmax(0, 1fr);
}

.signed-out .sidebar,
.signed-out .filterbar,
.signed-out .mobile-nav-toggle,
.signed-out .as-of {
  display: none;
}

.signed-out main {
  grid-column: 1;
  grid-row: 2;
}

.login-card {
  max-width: 520px;
  margin: 72px auto;
  padding: 44px;
  text-align: center;
}

.login-card h1 {
  margin: 4px 0 10px;
  font-size: clamp(26px, 4vw, 38px);
  line-height: 1.15;
}

.login-card p:not(.eyebrow) {
  margin: 0 auto 24px;
  color: var(--muted-foreground);
}

.repository-picker {
  display: grid;
  gap: 2px;
  min-width: min(320px, 34vw);
  margin-left: auto;
  color: var(--muted-foreground);
  font-size: 11px;
  letter-spacing: .02em;
}

.repository-picker[hidden] {
  display: none;
}

.repository-picker[hidden] + .as-of {
  margin-left: auto;
}

.repository-picker select {
  width: 100%;
  min-height: 34px;
}

.repository-onboarding {
  max-width: 600px;
  margin: 64px auto;
}

.repository-onboarding h1 {
  margin: 4px 0 8px;
  color: var(--foreground);
}

.sync-progress {
  height: 8px;
  margin: 28px 0 18px;
}

.sync-progress > span {
  position: relative;
  overflow: hidden;
  transition: width 300ms ease;
}

.sync-progress > span::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgb(255 255 255 / 45%), transparent);
  content: "";
  transform: translateX(-100%);
  animation: sync-shimmer 1.6s ease-in-out infinite;
}

.sync-progress[data-stage="queued"] > span {
  width: 12%;
}

.sync-progress[data-stage="downloading"] > span,
.sync-progress[data-stage="download_retrying"] > span {
  width: 42%;
}

.sync-progress[data-stage="importing"] > span,
.sync-progress[data-stage="import_retrying"] > span {
  width: 78%;
}

.sync-refresh-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 0;
  color: var(--muted-foreground);
  font-size: 11px;
}

.sync-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--viz-series-1);
  animation: sync-pulse 1.8s ease-in-out infinite;
}

@keyframes sync-shimmer {
  to { transform: translateX(100%); }
}

@keyframes sync-pulse {
  50% { opacity: .35; }
}

@media (prefers-reduced-motion: reduce) {
  .sync-progress > span::after,
  .sync-live-dot {
    animation: none;
  }
}

.mobile-nav-toggle {
  display: none;
}

.sidebar {
  position: relative;
  grid-row: 2 / 4;
  align-self: stretch;
  padding: 24px 12px;
  border-right: 1px solid var(--border);
  background: color-mix(in srgb, var(--card) 72%, var(--background));
}

.sidebar nav {
  display: grid;
  gap: 5px;
}

.sidebar nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  padding: 9px 12px;
  border-radius: 11px;
  color: var(--muted-foreground);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.sidebar nav a:hover {
  color: var(--foreground);
  background: color-mix(in srgb, var(--card) 82%, var(--muted));
}

.sidebar nav a[aria-disabled="true"] {
  color: var(--muted-foreground);
  background: transparent;
  cursor: default;
  opacity: 0.45;
}

.sidebar nav a[aria-disabled="true"]:hover {
  color: var(--muted-foreground);
  background: transparent;
}

.sidebar nav a[aria-current="page"] {
  color: var(--accent-foreground);
  background: var(--accent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 8%, transparent);
  font-weight: 600;
}

.nav-count {
  min-width: 24px;
  padding: 1px 7px;
  border-radius: 999px;
  color: var(--muted-foreground);
  background: var(--muted);
  text-align: center;
  font-size: 12px;
}

.sidebar-note {
  position: absolute;
  right: 18px;
  bottom: 22px;
  left: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  color: var(--muted-foreground);
  font-size: 12px;
}

.sidebar-note strong,
.sidebar-note span {
  display: block;
}

.sidebar-note strong {
  margin-bottom: 3px;
  color: var(--foreground);
  font-weight: 500;
}

.filterbar {
  position: sticky;
  z-index: 8;
  top: 68px;
  grid-column: 2;
  grid-row: 2;
  display: flex;
  align-items: end;
  gap: 10px;
  min-width: 0;
  padding: 14px 28px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 75%, transparent);
  background: color-mix(in srgb, var(--background) 88%, transparent);
  backdrop-filter: blur(18px);
}

.filterbar.filterbar-inline {
  position: static;
  margin: -6px 0 24px;
  padding: 0 0 14px;
}

.filterbar label,
.field {
  display: grid;
  gap: 4px;
  min-width: 112px;
  color: var(--muted-foreground);
  font-size: 11px;
  letter-spacing: .02em;
}

select,
input[type="number"],
input[type="text"] {
  min-height: 38px;
  padding: 6px 30px 6px 9px;
  border: 1px solid var(--input);
  border-radius: 10px;
  color: var(--foreground);
  background: var(--card);
  box-shadow: 0 1px 2px rgb(35 45 75 / 3%);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

select:hover,
input[type="number"]:hover,
input[type="text"]:hover {
  border-color: color-mix(in srgb, var(--input) 55%, var(--primary));
}

select:focus,
input[type="number"]:focus,
input[type="text"]:focus {
  border-color: var(--ring);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 12%, transparent);
}

input[type="number"] {
  width: 100%;
  padding-right: 9px;
}

input[type="text"] {
  width: 100%;
  padding-right: 9px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--primary);
}

main {
  grid-column: 2;
  grid-row: 3;
  min-width: 0;
  padding: 34px;
}

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

.page-header h1 {
  margin: 0 0 5px;
  font-size: clamp(24px, 3vw, 34px);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -.025em;
}

.page-header p {
  max-width: 760px;
  margin: 0;
  color: var(--muted-foreground);
}

.page-actions,
.button-group,
.inline-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid var(--input);
  border-radius: 10px;
  color: var(--foreground);
  background: var(--card);
  box-shadow: 0 1px 2px rgb(35 45 75 / 4%);
  cursor: pointer;
  font-weight: 500;
  text-decoration: none;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

#add-repository[hidden] {
  display: none;
}

.button:hover {
  border-color: color-mix(in srgb, var(--input) 60%, var(--primary));
  background: var(--muted);
  transform: translateY(-1px);
}

.button[aria-pressed="true"],
.button-primary {
  border-color: var(--primary);
  color: var(--primary-foreground);
  background: var(--primary);
  box-shadow: 0 7px 18px rgb(83 103 216 / 18%);
}

.button-primary:hover {
  border-color: var(--primary);
  color: var(--primary-foreground);
  background: color-mix(in srgb, var(--primary) 92%, black);
  box-shadow: 0 9px 22px rgb(83 103 216 / 24%);
}

.button-quiet {
  color: var(--muted-foreground);
  background: transparent;
  box-shadow: none;
}

.button:active {
  transform: translateY(0);
}

.repository-dialog {
  width: min(520px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--card-foreground);
  background: var(--card);
  box-shadow: var(--shadow);
}

.repository-dialog::backdrop {
  background: rgb(31 39 65 / 32%);
  backdrop-filter: blur(4px);
}

.repository-dialog form {
  display: grid;
  gap: 18px;
  padding: 24px;
}

.repository-dialog .settings-field input {
  max-width: 100%;
}

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

.dialog-header h2 {
  margin: 2px 0 0;
  font-size: 24px;
  font-weight: 600;
}

.dialog-header p,
.repository-dialog .metric-secondary,
.repository-dialog .form-error {
  margin: 0;
}

.dialog-actions {
  justify-content: flex-end;
}

.form-error {
  min-height: 1.5em;
  color: var(--destructive);
}

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

.card {
  min-width: 0;
  border: 1px solid color-mix(in srgb, var(--border) 88%, transparent);
  border-radius: var(--radius);
  color: var(--card-foreground);
  background: var(--card);
  box-shadow: var(--shadow);
}

.stat-card {
  display: block;
  padding: 20px;
  text-decoration: none;
}

.stat-label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted-foreground);
  font-size: 12px;
}

.stat-value {
  display: block;
  margin-bottom: 5px;
  font-size: clamp(25px, 3vw, 34px);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -.025em;
}

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

.layout-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, .85fr);
  gap: 18px;
  margin-bottom: 24px;
}

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

.section {
  min-width: 0;
  margin-bottom: 28px;
}

.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 11px;
}

.section-header h2,
.panel-header h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -.01em;
}

.section-header p,
.panel-header p {
  margin: 3px 0 0;
  color: var(--muted-foreground);
  font-size: 12px;
}

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

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

.table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

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

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

th {
  color: var(--muted-foreground);
  background: color-mix(in srgb, var(--muted) 52%, var(--card));
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .01em;
  white-space: nowrap;
}

.table-sort {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
}

.numeric .table-sort {
  justify-content: flex-end;
}

.table-sort:hover {
  color: var(--foreground);
}

.sort-indicator {
  display: inline-block;
  width: 1em;
  color: var(--muted-foreground);
  text-align: center;
}

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

tbody tr:hover {
  background: color-mix(in srgb, var(--accent) 58%, transparent);
}

td a {
  text-decoration-color: color-mix(in srgb, currentColor 30%, transparent);
  text-underline-offset: 3px;
}

.numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.metric-primary {
  display: block;
  font-weight: 500;
}

.metric-secondary {
  display: block;
  margin-top: 2px;
  color: var(--muted-foreground);
  font-size: 11px;
}

.balance-value {
  font-weight: 600;
}

.balance-value[data-balance="within"] {
  color: var(--success);
}

.balance-value[data-balance="outside"] {
  color: var(--warning);
}

.balance-value[data-balance="high"] {
  color: var(--destructive);
}

.balance-value[data-balance="none"] {
  color: var(--muted-foreground);
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 3px 9px;
  border-radius: 999px;
  color: var(--muted-foreground);
  background: var(--muted);
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
}

.action-badge {
  font-size: 15px;
}

.settings-form {
  display: grid;
  gap: 18px;
  max-width: 520px;
}

.settings-field {
  display: grid;
  gap: 7px;
}

.settings-field input {
  width: 100%;
  max-width: 180px;
}

.settings-field select {
  width: 100%;
  max-width: 180px;
}

.settings-description {
  color: var(--muted-foreground);
  font-size: 11px;
}

.column-hint {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  margin-left: 6px;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 10px;
  line-height: 1;
  cursor: help;
}

.badge[data-tone="constraint"] {
  color: var(--warning);
  background: color-mix(in srgb, var(--warning) 13%, transparent);
}

.badge[data-tone="complete"] {
  color: var(--success);
  background: color-mix(in srgb, var(--success) 13%, transparent);
}

.badge[data-tone="critical"] {
  color: var(--destructive);
  background: color-mix(in srgb, var(--destructive) 12%, transparent);
}

.fact-list,
.action-list,
.alert-list,
.event-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.fact-row,
.action-item,
.alert-item,
.event-item {
  display: grid;
  gap: 4px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}

.fact-row:last-child,
.action-item:last-child,
.alert-item:last-child,
.event-item:last-child {
  border-bottom: 0;
}

.fact-row {
  grid-template-columns: minmax(130px, .65fr) minmax(0, 1fr);
}

.fact-row dt {
  color: var(--muted-foreground);
}

.fact-row dd {
  margin: 0;
}

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

.action-rank {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 9px;
  color: var(--accent-foreground);
  background: var(--accent);
  font-weight: 500;
}

.action-item h3,
.alert-item h3 {
  margin: 0 0 3px;
  font-size: 14px;
  font-weight: 500;
}

.action-item p,
.alert-item p {
  margin: 0;
  color: var(--muted-foreground);
  font-size: 12px;
}

.alert-item {
  grid-template-columns: 6px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.alert-marker {
  width: 6px;
  height: 100%;
  min-height: 42px;
  border-radius: 99px;
  background: var(--warning);
}

.alert-item[data-severity="high"] .alert-marker {
  background: var(--destructive);
}

.chart {
  min-width: 0;
}

.chart svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.chart .axis,
.chart .gridline {
  stroke: var(--border);
  stroke-width: 1;
}

.chart .gridline {
  opacity: .75;
}

.chart text {
  fill: var(--muted-foreground);
  font-family: inherit;
  font-size: 11px;
}

.chart .series-1 {
  color: var(--viz-series-1);
  fill: none;
  stroke: currentColor;
}

.chart .series-2 {
  color: var(--viz-series-2);
  fill: none;
  stroke: currentColor;
}

.chart .series-3 {
  color: var(--viz-series-3);
  fill: none;
  stroke: currentColor;
}

.chart .series-4 {
  color: var(--viz-series-4);
  fill: none;
  stroke: currentColor;
}

.chart .series-5 {
  color: var(--viz-series-5);
  fill: none;
  stroke: currentColor;
}

.chart .series-6 {
  color: var(--viz-series-6);
  fill: none;
  stroke: currentColor;
}

.chart .line {
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart .dot,
.chart .bar {
  fill: currentColor;
  stroke: none;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
  color: var(--muted-foreground);
  font-size: 11px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-swatch {
  width: 16px;
  height: 3px;
  border-radius: 99px;
  background: currentColor;
}

.progress {
  width: 100%;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--muted);
}

.progress > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--viz-series-1);
}

.matrix-wrap {
  max-width: 100%;
  overflow-x: auto;
}

.matrix {
  display: grid;
  gap: 3px;
  min-width: 420px;
}

.matrix-cell {
  display: grid;
  min-height: 42px;
  place-items: center;
  padding: 5px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--viz-series-1) calc(var(--intensity, 0) * 75%), var(--muted));
  font-size: 11px;
  text-align: center;
}

.matrix-label {
  display: flex;
  align-items: center;
  min-height: 42px;
  color: var(--muted-foreground);
  font-size: 11px;
}

.forecast-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.forecast-value {
  padding: 12px;
  border-left: 3px solid var(--viz-series-1);
  background: color-mix(in srgb, var(--accent) 45%, transparent);
}

.forecast-value strong,
.forecast-value span {
  display: block;
}

.forecast-value strong {
  margin: 2px 0;
  font-size: 22px;
  font-weight: 500;
}

.forecast-value span {
  color: var(--muted-foreground);
  font-size: 11px;
}

.event-item {
  grid-template-columns: 132px minmax(0, 1fr);
}

.event-time {
  color: var(--muted-foreground);
  font-size: 11px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.settings-group {
  display: grid;
  align-content: start;
  gap: 14px;
}

.settings-group h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 500;
}

.range-row {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(120px, 1fr) 42px;
  align-items: center;
  gap: 10px;
}

.range-value {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.empty-state {
  padding: 52px 28px;
  color: var(--muted-foreground);
  text-align: center;
}

.callout {
  margin-bottom: 18px;
  padding: 12px 14px;
  border-left: 3px solid var(--viz-series-1);
  color: var(--muted-foreground);
  background: color-mix(in srgb, var(--accent) 35%, transparent);
  font-size: 13px;
}

.callout strong {
  color: var(--foreground);
  font-weight: 500;
}

.toast {
  position: fixed;
  z-index: 30;
  right: 20px;
  bottom: 20px;
  max-width: min(360px, calc(100vw - 40px));
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--card-foreground);
  background: var(--card);
  box-shadow: var(--shadow);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

  .filterbar {
    flex-wrap: wrap;
  }

  .filterbar label {
    flex: 1 1 140px;
  }
}

@media (max-width: 820px) {
  .app-shell {
    display: block;
  }

  .topbar {
    position: sticky;
    flex-wrap: wrap;
    padding: 10px 16px;
  }

  .mobile-nav-toggle {
    display: inline-flex;
    margin-left: auto;
    padding: 7px 10px;
    border: 1px solid var(--input);
    border-radius: 8px;
    color: var(--foreground);
    background: var(--card);
  }

  .repository-picker {
    order: 3;
    width: 100%;
    min-width: 0;
    margin-left: 0;
  }

  .as-of {
    display: none;
  }

  .user-menu {
    margin-left: auto;
  }

  .sidebar {
    position: static;
    display: none;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .sidebar[data-open="true"] {
    display: block;
  }

  .sidebar-note {
    position: static;
    margin-top: 18px;
  }

  .filterbar {
    position: static;
    padding: 12px 16px;
  }

  main {
    padding: 22px 16px;
  }

  .layout-grid,
  .layout-grid.equal,
  .settings-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .page-header {
    display: block;
  }

  .page-actions {
    margin-top: 14px;
  }
}

@media (max-width: 560px) {
  .summary-grid,
  .forecast-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .filterbar label {
    flex-basis: calc(50% - 10px);
    min-width: 130px;
  }

  .fact-row,
  .event-item,
  .action-item,
  .alert-item {
    grid-template-columns: minmax(0, 1fr);
  }

  .action-rank,
  .alert-marker {
    display: none;
  }

  .range-row {
    grid-template-columns: minmax(0, 1fr) 42px;
  }

  .range-row label {
    grid-column: 1 / -1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
