/* Default + dark */
:root,
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1419;
  --surface: #1a2332;
  --border: #2d3a4d;
  --text: #e7edf4;
  --muted: #8b9cb3;
  --accent: #6eb3f7;
  --accent-dim: #4a8fd4;
  --row-hover: rgba(110, 179, 247, 0.06);
  --error-bg: #3d1f24;
  --error-border: #8b3a44;
  --error-text: #f5c2c7;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f6f9;
  --surface: #ffffff;
  --border: #d1d9e6;
  --text: #1a2332;
  --muted: #5c6b7f;
  --accent: #1565c0;
  --accent-dim: #1976d2;
  --row-hover: rgba(25, 118, 210, 0.08);
  --error-bg: #fde8ea;
  --error-border: #e57373;
  --error-text: #8b1c1c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  font-size: 15px;
}

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  padding: 1.25rem 1.5rem 0.5rem;
  border-bottom: 1px solid var(--border);
}

.site-header__titles {
  flex: 1;
  min-width: 12rem;
}

.site-header h1 {
  margin: 0 0 0.35rem;
  font-size: 1.35rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.theme-toggle {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.75rem;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.theme-toggle:hover {
  border-color: var(--accent-dim);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--accent-dim);
  outline-offset: 2px;
}

.theme-toggle__icon {
  font-size: 1.1rem;
  line-height: 1;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  align-items: flex-end;
  padding: 1rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 10rem;
}

.field span {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

input,
select {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.45rem 0.65rem;
}

input:focus,
select:focus {
  outline: 2px solid var(--accent-dim);
  outline-offset: 1px;
}

.hint {
  margin: 0;
  align-self: center;
  color: var(--muted);
  font-size: 0.875rem;
}

.hint-wide {
  flex-basis: 100%;
  margin-top: -0.25rem;
}

.hint--rows {
  min-height: 1.25rem;
}

.awaiting-category .field--category select {
  border-color: var(--accent);
  animation: category-glow 2s ease-in-out infinite;
}

@keyframes category-glow {
  0%,
  100% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 35%, transparent);
  }
  50% {
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent);
  }
}

.start-hero {
  display: flex;
  justify-content: center;
  padding: 1.5rem 1.25rem 2.5rem;
}

.start-hero--loading {
  min-height: 10rem;
  align-items: center;
}

.start-hero__loading {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
}

.start-hero__inner {
  position: relative;
  max-width: 26rem;
  padding: 1.75rem 1.5rem 1.5rem;
  text-align: center;
  background: var(--surface);
  border: 2px dashed var(--accent-dim);
  border-radius: 20px;
  box-shadow:
    0 4px 0 color-mix(in srgb, var(--border) 80%, transparent),
    0 18px 48px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .start-hero__inner {
  box-shadow:
    0 4px 0 var(--border),
    0 20px 56px rgba(0, 0, 0, 0.4);
}

.start-hero__badge {
  display: inline-block;
  margin: 0 0 0.65rem;
  padding: 0.2rem 0.7rem;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--bg);
  background: var(--accent);
  border-radius: 999px;
  transform: rotate(-2.5deg);
}

.start-hero__title {
  margin: 0 0 0.6rem;
  font-size: clamp(1.28rem, 4.2vw, 1.72rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.18;
}

.start-hero__accent {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 0.15em;
  text-underline-offset: 0.12em;
}

.start-hero__lede {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.55;
}

.start-hero__lede strong {
  color: var(--text);
}

.start-hero__point {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 1.25rem;
  color: var(--accent);
}

.start-hero__bubble {
  display: inline-block;
  padding: 0.4rem 0.95rem;
  margin-top: 0;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--bg);
  background: var(--accent);
  border: 2px solid var(--text);
  border-radius: 10px;
  transform: rotate(-1.5deg);
  box-shadow: 3px 4px 0 color-mix(in srgb, var(--border) 90%, var(--text));
}

.category-pointer {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 6;
  color: var(--accent);
}

.category-pointer__path {
  stroke: currentColor;
}

.category-pointer__head {
  fill: currentColor;
}

.error {
  margin: 1rem 1.5rem;
  padding: 0.75rem 1rem;
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  border-radius: 8px;
  color: var(--error-text);
}

.table-wrap {
  overflow: auto;
  padding: 0 1.5rem 2rem;
  max-width: 100vw;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.5rem;
}

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

th {
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 1;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

th:hover {
  color: var(--accent);
}

th.num {
  text-align: right;
}

td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

tbody tr:hover td {
  background: var(--row-hover);
}
