:root {
  color-scheme: light;
  --bg: #f2f0ec;
  --bg-2: #fbfaf7;
  --surface: #ffffff;
  --surface-glass: rgba(255, 255, 255, .78);
  --surface-strong: rgba(255, 255, 255, .95);
  --surface-muted: #f5f6f7;
  --ink: #171922;
  --text: #2a2d34;
  --muted: #68717a;
  --line: #e3e7ea;
  --line-strong: #b8c1c7;
  --accent: #b82625;
  --accent-hot: #eb3223;
  --accent-deep: #7f1615;
  --accent-soft: #fff3f0;
  --gold: #d9a441;
  --good: #147c45;
  --good-bg: #eef9f2;
  --bad: #b82625;
  --bad-bg: #fff7f5;
  --warn: #9d7008;
  --warn-bg: #fff6da;
  --blue: #176ea7;
  --blue-bg: #eaf6ff;
  --turquoise: #087e87;
  --turquoise-bg: #e5fbfc;
  --charcoal: #272b31;
  --shadow-xl: 0 28px 70px rgba(23, 25, 34, .13);
  --shadow-lg: 0 18px 44px rgba(23, 25, 34, .10);
  --shadow-sm: 0 8px 22px rgba(23, 25, 34, .07);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 15px;
  --radius-sm: 11px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #14161d;
  --bg-2: #1b1e26;
  --surface: #222631;
  --surface-glass: rgba(31, 35, 45, .82);
  --surface-strong: rgba(37, 42, 53, .96);
  --surface-muted: #2b303b;
  --ink: #f4f6fb;
  --text: #e4e8ef;
  --muted: #aeb7c2;
  --line: #363d49;
  --line-strong: #586170;
  --accent: #c7352f;
  --accent-hot: #ff4a3d;
  --accent-deep: #ff8a80;
  --accent-soft: rgba(255, 74, 61, .13);
  --good: #5ee092;
  --good-bg: rgba(29, 138, 82, .18);
  --bad: #ff7368;
  --bad-bg: rgba(255, 74, 61, .16);
  --warn: #ffd166;
  --warn-bg: rgba(255, 209, 102, .16);
  --blue: #78c6ff;
  --blue-bg: rgba(86, 171, 232, .16);
  --turquoise: #5ee7ed;
  --turquoise-bg: rgba(94, 231, 237, .14);
  --charcoal: #11131a;
  --shadow-xl: 0 28px 70px rgba(0, 0, 0, .34);
  --shadow-lg: 0 18px 44px rgba(0, 0, 0, .28);
  --shadow-sm: 0 8px 22px rgba(0, 0, 0, .22);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .76), rgba(255, 255, 255, .24)),
    radial-gradient(circle at 8% -12%, rgba(235, 50, 35, .18), transparent 34rem),
    radial-gradient(circle at 92% 8%, rgba(23, 25, 34, .14), transparent 30rem),
    radial-gradient(circle at 54% 104%, rgba(217, 164, 65, .10), transparent 28rem),
    linear-gradient(145deg, #fff 0%, var(--bg-2) 36%, var(--bg) 100%);
  font: 14px/1.52 "Aptos", "Segoe UI Variable Text", "Segoe UI", sans-serif;
}

a { color: inherit; text-decoration: none; }
.app-shell {
  isolation: isolate;
  min-height: 100vh;
  position: relative;
}
.ambient {
  pointer-events: none;
  position: fixed;
  z-index: -1;
  border-radius: 999px;
  filter: blur(10px);
  opacity: .72;
}
.ambient-red {
  width: 420px;
  height: 420px;
  left: -170px;
  top: 88px;
  background: radial-gradient(circle, rgba(235, 50, 35, .20), transparent 67%);
}
.ambient-slate {
  width: 520px;
  height: 520px;
  right: -210px;
  top: 180px;
  background: radial-gradient(circle, rgba(75, 79, 82, .14), transparent 67%);
}

.topbar {
  align-items: center;
  background: rgba(255, 255, 255, .74);
  border-bottom: 1px solid rgba(227, 231, 234, .78);
  box-shadow: 0 20px 50px rgba(23, 25, 34, .08);
  backdrop-filter: blur(22px);
  display: flex;
  gap: 20px;
  padding: 14px 26px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  align-items: center;
  border-radius: 999px;
  display: flex;
  gap: 13px;
  min-width: 270px;
  padding: 5px 10px 5px 4px;
}
.brand img {
  width: 58px;
  height: 58px;
  object-fit: contain;
  filter: drop-shadow(0 10px 18px rgba(23, 25, 34, .12));
}
.brand-title {
  color: var(--ink);
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -.035em;
}
.release {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.nav {
  align-items: center;
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  gap: 9px;
}
.nav a,
.status-pill {
  border: 1px solid rgba(184, 193, 199, .62);
  background: rgba(255, 255, 255, .80);
  border-radius: 999px;
  box-shadow: 0 10px 24px rgba(23, 25, 34, .06);
  color: var(--ink);
  font-weight: 820;
  padding: 11px 16px;
  transition: transform .16s ease, border-color .16s ease, background .16s ease, color .16s ease, box-shadow .16s ease;
}
.nav a:hover {
  background: #fff8f6;
  border-color: rgba(235, 50, 35, .30);
  box-shadow: 0 15px 30px rgba(184, 38, 37, .11);
  transform: translateY(-1px);
}
.nav a.active {
  background: linear-gradient(135deg, var(--accent-hot), var(--accent));
  border-color: transparent;
  box-shadow: 0 18px 36px rgba(184, 38, 37, .23);
  color: #fff;
}
.status-pill {
  align-items: center;
  color: var(--muted);
  display: inline-flex;
  gap: 8px;
  white-space: nowrap;
}
.theme-toggle {
  align-items: center;
  background: rgba(255, 255, 255, .80);
  border: 1px solid rgba(184, 193, 199, .62);
  border-radius: 999px;
  box-shadow: 0 10px 24px rgba(23, 25, 34, .06);
  color: var(--ink);
  display: inline-flex;
  gap: 8px;
  font-weight: 850;
  padding: 11px 16px;
}
.theme-toggle:hover {
  background: #fff8f6;
  border-color: rgba(235, 50, 35, .30);
  box-shadow: 0 15px 30px rgba(184, 38, 37, .11);
}
.theme-toggle-icon {
  font-size: 15px;
  line-height: 1;
}
.dot {
  border-radius: 50%;
  display: inline-block;
  height: 10px;
  width: 10px;
}
.dot.connected { background: #2fbf71; box-shadow: 0 0 16px rgba(47, 191, 113, .78); }
.dot.syncing { background: #f0bd3f; box-shadow: 0 0 16px rgba(240, 189, 63, .78); }
.dot.disconnected { background: #e64949; box-shadow: 0 0 16px rgba(230, 73, 73, .78); }

.content {
  padding: 28px 32px 50px;
}
.page-stack {
  display: grid;
  gap: 20px;
}
.grid {
  display: grid;
  gap: 20px;
}
.grid.two {
  grid-template-columns: minmax(360px, .9fr) minmax(560px, 1.25fr);
}
.grid.sidebar {
  grid-template-columns: minmax(700px, 1.48fr) minmax(410px, .72fr);
}

.flash-wrap {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}
.flash {
  background: rgba(255, 255, 255, .94);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
  padding: 12px 14px;
}
.flash.success { border-color: rgba(20, 124, 69, .28); background: var(--good-bg); color: var(--good); }
.flash.error { border-color: rgba(184, 38, 37, .28); background: var(--bad-bg); color: var(--bad); }

.card,
.hero-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .95), rgba(255, 255, 255, .86)),
    var(--surface);
  border: 1px solid rgba(255, 255, 255, .88);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  padding: 23px;
  position: relative;
}
.card::before,
.hero-card::before {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .95), transparent);
  content: "";
  height: 1px;
  inset: 0 0 auto;
  position: absolute;
}
.hero-card {
  align-items: center;
  display: flex;
  justify-content: space-between;
  min-height: 190px;
  padding: 28px 30px;
}
.hero-card::after {
  background:
    linear-gradient(115deg, transparent 0 44%, rgba(235, 50, 35, .08) 44% 45%, transparent 45% 100%),
    radial-gradient(circle at 88% 18%, rgba(235, 50, 35, .11), transparent 16rem);
  content: "";
  inset: 0;
  pointer-events: none;
  position: absolute;
}
.hero-copy {
  max-width: 720px;
  position: relative;
  z-index: 1;
}
.hero-mark {
  align-items: center;
  display: flex;
  justify-content: flex-end;
  min-width: 280px;
  position: relative;
  z-index: 1;
}
.hero-mark img {
  max-width: 360px;
  opacity: .82;
  filter: drop-shadow(0 22px 32px rgba(23, 25, 34, .12));
}
.setup-hero {
  display: block;
  min-height: 0;
}

.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 920;
  letter-spacing: .14em;
  margin: 0 0 8px;
  text-transform: uppercase;
}
h1, h2, h3 {
  color: var(--ink);
  line-height: 1.12;
  margin: 0 0 8px;
}
h1 {
  font-size: 30px;
  font-weight: 920;
  letter-spacing: -.045em;
}
h2 {
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -.025em;
}
h3 {
  color: var(--muted);
  font-size: 14px;
  font-weight: 850;
}
.muted {
  color: var(--muted);
}
.sync-copy {
  color: var(--muted);
  font-weight: 720;
}

.metric-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}
.metric,
.panel-count {
  align-items: center;
  background: rgba(255, 255, 255, .82);
  border: 1px solid rgba(184, 193, 199, .62);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  color: var(--muted);
  display: inline-flex;
  gap: 7px;
  padding: 8px 12px;
  white-space: nowrap;
}
.metric strong,
.panel-count {
  color: var(--ink);
  font-weight: 920;
}
.panel-title {
  align-items: flex-start;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 16px;
}
.panel-card,
.detail-card {
  padding: 24px;
}
.detail-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .98), rgba(250, 248, 246, .92)),
    var(--surface);
}
.danger-zone {
  border-color: rgba(184, 38, 37, .16);
  background: linear-gradient(180deg, #fff, #fff7f5);
}

.toolbar {
  align-items: end;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 18px 0;
}
.compact-toolbar {
  margin: 0;
}
.control-card {
  padding: 18px 20px;
}
.control-grid {
  align-items: center;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(420px, 1fr) minmax(380px, 1.1fr);
}
.auto-sync-sentinel {
  display: none;
}
.auto-sync-note {
  align-self: end;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .01em;
  margin: 0;
}
.action-strip,
.filter-strip {
  background: rgba(245, 246, 247, .78);
  border: 1px solid rgba(227, 231, 234, .88);
  border-radius: var(--radius-lg);
  margin: 16px 0;
  padding: 14px;
}
.action-strip .toolbar {
  margin: 0;
}

label {
  color: var(--ink);
  display: block;
  font-weight: 780;
  margin-bottom: 6px;
}
input, select, textarea {
  background: rgba(255, 255, 255, .92);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .96);
  color: var(--ink);
  outline: none;
  padding: 11px 12px;
  transition: border-color .14s ease, box-shadow .14s ease, background .14s ease;
  width: 100%;
}
select[multiple] {
  min-height: 118px;
}
textarea {
  min-height: 124px;
  resize: vertical;
}
input:focus, select:focus, textarea:focus {
  background: #fff;
  border-color: var(--accent-hot);
  box-shadow: 0 0 0 4px rgba(235, 50, 35, .12);
}
input[type="file"] {
  background: #fff;
  border-style: dashed;
}
input[type="date"] {
  color-scheme: light;
}
.field-sm { width: 112px; }
.field-date { width: 156px; }
.field-md { width: 245px; }
.field-lg { min-width: 340px; }

.checks {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
}
.checks label {
  align-items: center;
  background: rgba(255, 255, 255, .78);
  border: 1px solid rgba(227, 231, 234, .9);
  border-radius: 999px;
  box-shadow: 0 7px 18px rgba(23, 25, 34, .04);
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  font-weight: 760;
  gap: 8px;
  margin: 0;
  padding: 8px 11px;
  transition: background .14s ease, border-color .14s ease, box-shadow .14s ease, transform .14s ease;
}
.checks label:hover {
  background: #fff8f6;
  border-color: rgba(235, 50, 35, .24);
  box-shadow: 0 10px 22px rgba(184, 38, 37, .08);
  transform: translateY(-1px);
}
input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  background: linear-gradient(180deg, #fff, #f6f8f9);
  border: 1.5px solid #aeb8c0;
  border-radius: 6px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .95);
  cursor: pointer;
  display: inline-grid;
  height: 18px;
  margin: 0;
  min-width: 18px;
  place-content: center;
  transition: background .14s ease, border-color .14s ease, box-shadow .14s ease, transform .14s ease;
  vertical-align: middle;
  width: 18px;
}
input[type="checkbox"]::before {
  border-bottom: 2px solid #fff;
  border-left: 2px solid #fff;
  content: "";
  height: 5px;
  margin-top: -2px;
  transform: rotate(-45deg) scale(0);
  transition: transform .12s ease;
  width: 9px;
}
input[type="checkbox"]:checked {
  background: linear-gradient(135deg, var(--accent-hot), var(--accent));
  border-color: transparent;
  box-shadow: 0 0 0 4px rgba(235, 50, 35, .12);
}
input[type="checkbox"]:checked::before {
  transform: rotate(-45deg) scale(1);
}
input[type="checkbox"]:hover {
  border-color: var(--accent-hot);
}
input[type="checkbox"]:focus-visible {
  outline: 3px solid rgba(235, 50, 35, .22);
  outline-offset: 2px;
}
input[type="radio"] {
  accent-color: var(--accent-hot);
  width: auto;
}

.button, button {
  background: linear-gradient(135deg, var(--accent-hot), var(--accent));
  border: 0;
  border-radius: 16px;
  box-shadow: 0 16px 34px rgba(184, 38, 37, .22);
  color: #fff;
  cursor: pointer;
  font-weight: 880;
  padding: 11px 18px;
  transition: transform .14s ease, box-shadow .14s ease, background .14s ease;
}
.button:hover, button:hover {
  background: linear-gradient(135deg, #ff3b2c, var(--accent));
  box-shadow: 0 20px 42px rgba(184, 38, 37, .26);
  transform: translateY(-1px);
}
.button.secondary, button.secondary {
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  color: var(--ink);
}
.button.secondary:hover, button.secondary:hover {
  background: #fff8f6;
}
.button.danger, button.danger {
  background: linear-gradient(135deg, #9f1e1e, #6f1212);
}
.loading-button {
  align-items: center;
  display: inline-flex;
  gap: 9px;
  justify-content: center;
  min-width: 176px;
}
.button-spinner {
  animation: spin .8s linear infinite;
  border: 2px solid rgba(255, 255, 255, .45);
  border-radius: 50%;
  border-top-color: #fff;
  display: none;
  height: 16px;
  width: 16px;
}
.loading-form.is-loading .button-spinner {
  display: inline-block;
}
.loading-form.is-loading .loading-button {
  cursor: wait;
  opacity: .92;
}
.loading-note {
  align-items: center;
  background: #fff5f2;
  border: 1px solid rgba(235, 50, 35, .20);
  border-radius: 999px;
  color: var(--accent-deep);
  display: none;
  font-weight: 850;
  gap: 9px;
  padding: 9px 13px;
}
.loading-form.is-loading .loading-note {
  display: inline-flex;
}
.loading-dots {
  display: inline-flex;
  gap: 4px;
}
.loading-dots span {
  animation: pulse-dot 1s ease-in-out infinite;
  background: var(--accent-hot);
  border-radius: 50%;
  height: 6px;
  width: 6px;
}
.loading-dots span:nth-child(2) { animation-delay: .15s; }
.loading-dots span:nth-child(3) { animation-delay: .30s; }
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes pulse-dot {
  0%, 80%, 100% { opacity: .35; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

.table-wrap {
  background: rgba(255, 255, 255, .72);
  border: 1px solid rgba(227, 231, 234, .92);
  border-radius: 24px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .98);
  max-height: 620px;
  overflow: auto;
}
table {
  border-collapse: separate;
  border-spacing: 0 7px;
  min-width: 760px;
  padding: 8px;
  width: 100%;
}
.picker-table-wrap {
  max-height: 500px;
  overflow-x: hidden;
}
.picker-table {
  min-width: 0;
  table-layout: fixed;
}
.picker-table th,
.picker-table td {
  padding: 10px 12px;
  text-align: center;
}
.picker-table th:first-child,
.picker-table td:first-child {
  text-align: center;
  width: auto;
}
th, td {
  border: 0;
  padding: 12px 13px;
  vertical-align: middle;
}
th {
  background: linear-gradient(180deg, #565b60, #464b50);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .18);
  color: #fff;
  font-weight: 880;
  position: sticky;
  top: 0;
  white-space: nowrap;
  z-index: 2;
}
th:first-child { border-radius: 15px 0 0 15px; }
th:last-child { border-radius: 0 15px 15px 0; }
th a {
  color: #fff;
  text-decoration: none;
}
tbody td {
  background: rgba(255, 255, 255, .95);
  border-bottom: 1px solid rgba(227, 231, 234, .78);
  border-top: 1px solid rgba(227, 231, 234, .78);
}
tbody td:first-child {
  border-left: 1px solid rgba(227, 231, 234, .78);
  border-radius: 16px 0 0 16px;
}
tbody td:last-child {
  border-radius: 0 16px 16px 0;
  border-right: 1px solid rgba(227, 231, 234, .78);
}
tbody tr:nth-child(even) td {
  background: rgba(249, 251, 252, .95);
}
tbody tr:hover td {
  background: #fff9f6;
}
.clickable-row {
  cursor: pointer;
}
.clickable-row td {
  transition: background .14s ease, border-color .14s ease, box-shadow .14s ease, transform .14s ease;
}
.clickable-row:hover td {
  background: #fff7f4 !important;
  border-color: rgba(235, 50, 35, .18);
}
tr.selected td {
  box-shadow: 0 10px 24px rgba(184, 38, 37, .05);
}
tr.selected td:first-child {
  box-shadow: inset 7px 0 0 var(--accent-hot), 0 10px 24px rgba(184, 38, 37, .05);
}

.prefs-saved td {
  background: linear-gradient(90deg, #e5f8ec 0%, #f1fbf5 42%, #ffffff 100%) !important;
  border-bottom-color: rgba(20, 124, 69, .24);
  border-top-color: rgba(20, 124, 69, .24);
  color: var(--text);
}
.prefs-saved td:first-child {
  border-left-color: rgba(20, 124, 69, .32);
  box-shadow: inset 7px 0 0 #18a058;
}
.prefs-saved td:last-child {
  border-right-color: rgba(20, 124, 69, .24);
}
.prefs-saved td:last-child,
.prefs-saved {
  color: var(--good);
  font-weight: 850;
}
.prefs-needed td {
  background: linear-gradient(90deg, #ffe2dd 0%, #fff0ed 42%, #ffffff 100%) !important;
  border-bottom-color: rgba(184, 38, 37, .28);
  border-top-color: rgba(184, 38, 37, .28);
  color: var(--text);
}
.prefs-needed td:first-child {
  border-left-color: rgba(184, 38, 37, .34);
  box-shadow: inset 7px 0 0 var(--accent-hot);
}
.prefs-needed td:last-child {
  border-right-color: rgba(184, 38, 37, .28);
}
.prefs-needed td:last-child,
.prefs-needed {
  color: var(--bad);
  font-weight: 850;
}
.prefs-saved.selected td {
  background: linear-gradient(90deg, #d8f4e3 0%, #eefaf3 42%, #ffffff 100%) !important;
  box-shadow: 0 12px 28px rgba(20, 124, 69, .08);
}
.prefs-saved.selected td:first-child {
  box-shadow: inset 7px 0 0 #18a058, 0 12px 28px rgba(20, 124, 69, .08);
}
.prefs-needed.selected td {
  background: linear-gradient(90deg, #ffd8d1 0%, #ffecea 42%, #ffffff 100%) !important;
  box-shadow: 0 12px 28px rgba(184, 38, 37, .08);
}
.prefs-needed.selected td:first-child {
  box-shadow: inset 7px 0 0 var(--accent-hot), 0 12px 28px rgba(184, 38, 37, .08);
}
.status-chip,
.source-chip,
.license-chip {
  align-items: center;
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 850;
  justify-content: center;
  min-height: 25px;
  padding: 4px 9px;
  white-space: nowrap;
}
.status-chip {
  background: var(--good-bg);
  color: var(--good);
}
.status-chip.is-muted {
  background: #f1f3f4;
  color: #626a70;
}
.status-chip.is-active {
  background: var(--good-bg);
  color: var(--good);
}
.source-chip {
  background: #f1f3f4;
  color: #50575d;
}
.license-chip {
  background: #fff4de;
  color: #7c5200;
}
.license-ppl {
  background: #e6f2ff;
  color: #155f9c;
}
.license-ifr {
  background: #e9f8ef;
  color: #167246;
}
.license-cpl {
  background: #fff0c8;
  color: #8b5a00;
}
.license-cfi {
  background: #ffe7cf;
  color: #9b4d00;
}
.license-cfii {
  background: #f2e6ff;
  color: #6a35a5;
}
.license-mei {
  background: #e2fbfb;
  color: #08757e;
}
.license-multi,
.license-mlte {
  background: #ffe3ef;
  color: #a51e58;
}
.license-atp,
.license-atp_single,
.license-atp_multi {
  background: #ece9ff;
  color: #4033a0;
}
.license-none {
  background: #f1f3f4;
  color: #68717a;
}
.prefs-saved td:last-child::before,
.prefs-needed td:last-child::before {
  border-radius: 999px;
  content: "";
  display: inline-block;
  height: 8px;
  margin-right: 8px;
  vertical-align: 1px;
  width: 8px;
}
.prefs-saved td:last-child::before {
  background: #18a058;
  box-shadow: 0 0 0 3px rgba(24, 160, 88, .12);
}
.prefs-needed td:last-child::before {
  background: var(--accent-hot);
  box-shadow: 0 0 0 3px rgba(235, 50, 35, .12);
}
.quiet-value {
  color: #9aa2a9;
  font-weight: 750;
}

.match-checkride td { color: #185c2d; background: #e8f7ed !important; }
.match-accelerated td { color: #6d5200; background: #fff4c7 !important; }
.match-consistent td { color: #155d91; background: #e7f4ff !important; }
.match-timebuilding td { color: #087e87; background: #e4fbfb !important; }

.match-card-list {
  display: grid;
  gap: 14px;
  max-height: 620px;
  overflow: auto;
  padding: 2px 4px 4px;
}
.match-card {
  align-items: flex-start;
  background: #fff;
  border: 1px solid rgba(227, 231, 234, .96);
  border-radius: 24px;
  box-shadow: 0 12px 28px rgba(23, 25, 34, .07);
  color: var(--text);
  display: grid;
  gap: 14px;
  grid-template-columns: 76px minmax(0, 1fr);
  padding: 16px;
}
.match-card.match-checkride {
  background: linear-gradient(135deg, #e8f7ed 0%, #f8fffb 58%, #fff 100%);
  border-color: rgba(20, 124, 69, .25);
}
.match-card.match-accelerated {
  background: linear-gradient(135deg, #fff0a9 0%, #fff8d7 56%, #fff 100%);
  border-color: rgba(157, 112, 8, .25);
}
.match-card.match-consistent {
  background: linear-gradient(135deg, #e2f3ff 0%, #f5fbff 58%, #fff 100%);
  border-color: rgba(23, 110, 167, .23);
}
.match-card.match-timebuilding {
  background: linear-gradient(135deg, #d9fbfc 0%, #f4ffff 58%, #fff 100%);
  border-color: rgba(8, 126, 135, .24);
}
.match-select {
  align-items: center;
  background: rgba(255, 255, 255, .72);
  border: 1px solid rgba(227, 231, 234, .9);
  border-radius: 18px;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  flex-direction: column;
  font-size: 12px;
  font-weight: 880;
  gap: 8px;
  justify-content: center;
  margin: 0;
  min-height: 72px;
  padding: 10px;
}
.match-select input {
  transform: none;
}

:root[data-theme="dark"] body {
  background:
    linear-gradient(135deg, rgba(20, 22, 29, .92), rgba(20, 22, 29, .68)),
    radial-gradient(circle at 8% -12%, rgba(255, 74, 61, .18), transparent 34rem),
    radial-gradient(circle at 92% 8%, rgba(150, 160, 180, .12), transparent 30rem),
    radial-gradient(circle at 54% 104%, rgba(217, 164, 65, .08), transparent 28rem),
    linear-gradient(145deg, #11131a 0%, var(--bg-2) 36%, var(--bg) 100%);
}
:root[data-theme="dark"] .ambient-red {
  background: radial-gradient(circle, rgba(255, 74, 61, .18), transparent 67%);
}
:root[data-theme="dark"] .ambient-slate {
  background: radial-gradient(circle, rgba(120, 198, 255, .10), transparent 67%);
}
:root[data-theme="dark"] .topbar {
  background: rgba(20, 22, 29, .82);
  border-bottom-color: rgba(70, 78, 92, .76);
}
:root[data-theme="dark"] .brand img,
:root[data-theme="dark"] .hero-mark img {
  filter: drop-shadow(0 18px 30px rgba(0, 0, 0, .36));
}
:root[data-theme="dark"] .nav a,
:root[data-theme="dark"] .status-pill,
:root[data-theme="dark"] .theme-toggle,
:root[data-theme="dark"] .metric,
:root[data-theme="dark"] .panel-count {
  background: rgba(35, 40, 51, .86);
  border-color: rgba(88, 97, 112, .72);
  color: var(--ink);
}
:root[data-theme="dark"] .nav a:hover,
:root[data-theme="dark"] .theme-toggle:hover {
  background: rgba(255, 74, 61, .12);
  border-color: rgba(255, 74, 61, .38);
}
:root[data-theme="dark"] .card,
:root[data-theme="dark"] .hero-card {
  background:
    linear-gradient(180deg, rgba(38, 43, 54, .96), rgba(29, 33, 43, .92)),
    var(--surface);
  border-color: rgba(90, 98, 112, .52);
}
:root[data-theme="dark"] .hero-card::after {
  background:
    linear-gradient(115deg, transparent 0 44%, rgba(255, 74, 61, .10) 44% 45%, transparent 45% 100%),
    radial-gradient(circle at 88% 18%, rgba(255, 74, 61, .12), transparent 16rem);
}
:root[data-theme="dark"] .action-strip,
:root[data-theme="dark"] .filter-strip {
  background: rgba(28, 32, 42, .76);
  border-color: rgba(86, 96, 112, .64);
}
:root[data-theme="dark"] input,
:root[data-theme="dark"] select,
:root[data-theme="dark"] textarea {
  background: rgba(26, 30, 39, .92);
  border-color: rgba(91, 101, 116, .88);
  color: var(--ink);
}
:root[data-theme="dark"] input[type="date"] {
  color-scheme: dark;
}
:root[data-theme="dark"] input:focus,
:root[data-theme="dark"] select:focus,
:root[data-theme="dark"] textarea:focus {
  background: rgba(19, 22, 30, .98);
  border-color: var(--accent-hot);
}
:root[data-theme="dark"] .button.secondary,
:root[data-theme="dark"] button.secondary {
  background: rgba(35, 40, 51, .92);
  border-color: rgba(88, 97, 112, .76);
  color: var(--ink);
}
:root[data-theme="dark"] .table-wrap,
:root[data-theme="dark"] .match-card-list {
  background: rgba(23, 26, 35, .58);
  border-color: rgba(75, 84, 100, .74);
}
:root[data-theme="dark"] th {
  background: linear-gradient(180deg, #3a404b, #2b303b);
}
:root[data-theme="dark"] tbody td {
  background: rgba(35, 40, 51, .94);
  border-color: rgba(74, 83, 98, .72);
}
:root[data-theme="dark"] tbody tr:nth-child(even) td {
  background: rgba(30, 35, 45, .94);
}
:root[data-theme="dark"] tbody tr:hover td,
:root[data-theme="dark"] .clickable-row:hover td {
  background: rgba(255, 74, 61, .10) !important;
}
:root[data-theme="dark"] .time-opening_6_9:hover td,
:root[data-theme="dark"] .time-opening_9_12:hover td,
:root[data-theme="dark"] .time-opening_12_14:hover td,
:root[data-theme="dark"] .time-opening_14_16:hover td,
:root[data-theme="dark"] .time-opening_16_19:hover td,
:root[data-theme="dark"] .time-opening_19_6:hover td {
  background: #f7fbff !important;
  border-bottom-color: rgba(255, 74, 61, .38);
  border-top-color: rgba(255, 74, 61, .38);
  color: #14202a !important;
}
:root[data-theme="dark"] .time-opening_6_9.selected td,
:root[data-theme="dark"] .time-opening_9_12.selected td,
:root[data-theme="dark"] .time-opening_12_14.selected td,
:root[data-theme="dark"] .time-opening_14_16.selected td,
:root[data-theme="dark"] .time-opening_16_19.selected td,
:root[data-theme="dark"] .time-opening_19_6.selected td {
  background: #ffffff !important;
  color: #14202a !important;
}
:root[data-theme="dark"] .prefs-saved td {
  background: linear-gradient(90deg, rgba(29, 138, 82, .24) 0%, rgba(31, 45, 41, .96) 42%, rgba(35, 40, 51, .94) 100%) !important;
}
:root[data-theme="dark"] .prefs-needed td {
  background: linear-gradient(90deg, rgba(255, 74, 61, .22) 0%, rgba(52, 37, 39, .96) 42%, rgba(35, 40, 51, .94) 100%) !important;
}
:root[data-theme="dark"] .status-chip,
:root[data-theme="dark"] .source-chip,
:root[data-theme="dark"] .license-chip,
:root[data-theme="dark"] .match-facts span,
:root[data-theme="dark"] .match-select,
:root[data-theme="dark"] .match-notes,
:root[data-theme="dark"] .empty-state,
:root[data-theme="dark"] .checks label {
  background: rgba(28, 32, 42, .78);
  border-color: rgba(84, 94, 110, .70);
}
:root[data-theme="dark"] .source-chip {
  color: #c4cbd4;
}
:root[data-theme="dark"] .license-ppl { background: rgba(21, 95, 156, .26); color: #9bd1ff; }
:root[data-theme="dark"] .license-ifr { background: rgba(22, 114, 70, .28); color: #94e9b8; }
:root[data-theme="dark"] .license-cpl { background: rgba(139, 90, 0, .30); color: #ffd785; }
:root[data-theme="dark"] .license-cfi { background: rgba(155, 77, 0, .30); color: #ffc184; }
:root[data-theme="dark"] .license-cfii { background: rgba(106, 53, 165, .32); color: #d7bdff; }
:root[data-theme="dark"] .license-mei { background: rgba(8, 117, 126, .32); color: #9af5f8; }
:root[data-theme="dark"] .license-multi,
:root[data-theme="dark"] .license-mlte { background: rgba(165, 30, 88, .32); color: #ffacd0; }
:root[data-theme="dark"] .license-atp,
:root[data-theme="dark"] .license-atp_single,
:root[data-theme="dark"] .license-atp_multi { background: rgba(64, 51, 160, .34); color: #c5c0ff; }
:root[data-theme="dark"] .match-card {
  background: rgba(33, 38, 49, .94);
  border-color: rgba(76, 86, 102, .72);
  color: var(--text);
}
:root[data-theme="dark"] .match-card.match-checkride {
  background: linear-gradient(135deg, rgba(29, 138, 82, .22), rgba(33, 38, 49, .96) 58%, rgba(26, 30, 39, .98));
}
:root[data-theme="dark"] .match-card.match-accelerated {
  background: linear-gradient(135deg, rgba(157, 112, 8, .24), rgba(33, 38, 49, .96) 58%, rgba(26, 30, 39, .98));
}
:root[data-theme="dark"] .match-card.match-consistent {
  background: linear-gradient(135deg, rgba(23, 110, 167, .24), rgba(33, 38, 49, .96) 58%, rgba(26, 30, 39, .98));
}
:root[data-theme="dark"] .match-card.match-timebuilding {
  background: linear-gradient(135deg, rgba(8, 126, 135, .24), rgba(33, 38, 49, .96) 58%, rgba(26, 30, 39, .98));
}
:root[data-theme="dark"] .match-name,
:root[data-theme="dark"] .match-notes p {
  color: var(--ink);
}
:root[data-theme="dark"] .flash {
  background: rgba(35, 40, 51, .94);
  border-color: rgba(84, 94, 110, .72);
}
.match-main {
  display: grid;
  gap: 12px;
  min-width: 0;
}
.match-card-head {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}
.match-name {
  color: var(--ink);
  font-size: 17px;
  font-weight: 920;
  letter-spacing: -.02em;
}
.match-contact {
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 4px;
}
.match-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}
.match-type-pill {
  align-items: center;
  background: var(--charcoal);
  border-radius: 999px;
  color: #fff;
  display: inline-flex;
  font-size: 12px;
  font-weight: 880;
  min-height: 25px;
  padding: 4px 10px;
}
.match-checkride .match-type-pill { background: #15824a; }
.match-accelerated .match-type-pill { background: #a87805; }
.match-consistent .match-type-pill { background: #176ea7; }
.match-timebuilding .match-type-pill { background: #087e87; }
.match-facts {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.match-facts span {
  background: rgba(255, 255, 255, .70);
  border: 1px solid rgba(227, 231, 234, .76);
  border-radius: 16px;
  color: var(--text);
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 9px 10px;
}
.match-facts strong,
.match-notes strong {
  color: var(--muted);
  font-size: 11px;
  font-weight: 920;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.match-notes {
  background: rgba(255, 255, 255, .78);
  border: 1px solid rgba(235, 50, 35, .18);
  border-left: 6px solid var(--accent-hot);
  border-radius: 18px;
  padding: 12px 14px;
}
.match-notes p {
  color: var(--ink);
  font-size: 15px;
  font-weight: 760;
  line-height: 1.45;
  margin: 5px 0 0;
  white-space: pre-wrap;
}
.match-notes.is-empty {
  border-left-color: #c9d0d5;
}
.match-notes.is-empty p {
  color: #8b949c;
  font-style: italic;
  font-weight: 650;
}
.empty-state {
  background: rgba(255, 255, 255, .82);
  border: 1px dashed var(--line-strong);
  border-radius: 22px;
  color: var(--muted);
  font-weight: 780;
  padding: 26px;
  text-align: center;
}

.picker-radio {
  opacity: 0;
  pointer-events: none;
  position: absolute;
}
.student-pick-name {
  border-radius: 12px;
  display: block;
  font-weight: 760;
  padding: 2px 8px;
  width: 100%;
}
.radio-row.is-picked td,
.radio-row:hover td {
  background: #fff4f1 !important;
  border-color: rgba(235, 50, 35, .28);
}
.radio-row.is-picked td:first-child {
  box-shadow: inset 5px 0 0 var(--accent-hot);
}
.radio-row.is-picked .student-pick-name {
  color: var(--accent);
  font-weight: 900;
}

.time-opening_6_9 td { background: #e1f8ff !important; color: #13212a; }
.time-opening_9_12 td { background: #c9ebff !important; color: #13212a; }
.time-opening_12_14 td,
.time-opening_14_16 td { background: #d7dcff !important; color: #14182a; }
.time-opening_16_19 td { background: #9a9bd3 !important; color: #11131f; }
.time-opening_19_6 td { background: #7770cf !important; color: #fff; }
.time-opening_19_6.selected td { color: #fff; }

.split-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}
.setup-title-row {
  align-items: flex-start;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  position: relative;
  z-index: 1;
}
.setup-top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  min-width: 420px;
}
.form-grid {
  align-items: center;
  display: grid;
  gap: 12px 14px;
  grid-template-columns: 155px minmax(0, 1fr);
}
.form-grid label { margin: 0; }
.form-grid .full { grid-column: 1 / -1; }

.pill {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--accent);
  display: inline-flex;
  font-size: 12px;
  font-weight: 850;
  padding: 5px 10px;
}
.logo-corner {
  display: flex;
  justify-content: flex-end;
}
.logo-corner img {
  max-width: 320px;
  opacity: .78;
}

.session-pill {
  font-weight: 800;
}

.auth-body {
  align-items: center;
  display: flex;
  min-height: 100vh;
  justify-content: center;
  padding: 28px;
}

.auth-shell {
  width: min(100%, 520px);
}

.auth-card {
  background:
    linear-gradient(140deg, rgba(255, 255, 255, .96), rgba(255, 255, 255, .78)),
    radial-gradient(circle at 14% 0%, rgba(235, 50, 35, .16), transparent 18rem),
    var(--surface-strong);
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: 34px;
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  padding: 36px;
  position: relative;
}

.auth-card::before {
  background: linear-gradient(180deg, var(--accent-hot), var(--accent));
  border-radius: 999px;
  content: "";
  height: 86px;
  left: 0;
  position: absolute;
  top: 38px;
  width: 7px;
}

.auth-logo {
  display: block;
  max-width: 245px;
  opacity: .82;
  margin-bottom: 28px;
}

.auth-card h1 {
  font-size: clamp(30px, 5vw, 46px);
  margin-bottom: 10px;
}

.auth-copy {
  color: var(--muted);
  font-size: 15px;
  margin: 0 0 24px;
}

.auth-flashes {
  margin-bottom: 18px;
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-form label {
  color: var(--ink);
  font-weight: 900;
}

.auth-form input {
  font-size: 18px;
  padding: 15px 16px;
  width: 100%;
}

.auth-form button {
  margin-top: 8px;
  width: 100%;
}

:root[data-theme="dark"] .auth-card {
  background:
    linear-gradient(140deg, rgba(35, 40, 51, .96), rgba(29, 33, 43, .86)),
    radial-gradient(circle at 14% 0%, rgba(255, 74, 61, .20), transparent 18rem),
    var(--surface-strong);
  border-color: rgba(88, 97, 112, .76);
}

@media (max-width: 1220px) {
  .control-grid {
    grid-template-columns: 1fr;
  }
  .match-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .hero-card {
    align-items: flex-start;
    flex-direction: column;
  }
  .hero-mark {
    justify-content: flex-start;
    min-width: 0;
  }
}
@media (max-width: 1100px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }
  .brand { min-width: 0; }
  .nav { flex-wrap: wrap; }
  .grid.two,
  .grid.sidebar {
    grid-template-columns: 1fr;
  }
  .form-grid { grid-template-columns: 1fr; }
  .setup-title-row { flex-direction: column; }
  .setup-top-actions {
    justify-content: flex-start;
    min-width: 0;
  }
}
@media (max-width: 720px) {
  .content {
    padding: 18px 14px 36px;
  }
  .card,
  .hero-card {
    border-radius: 22px;
    padding: 18px;
  }
  h1 {
    font-size: 25px;
  }
  .field-md,
  .field-lg,
  .field-sm {
    width: 100%;
    min-width: 0;
  }
  .field-date {
    width: 100%;
    min-width: 0;
  }
  .match-card {
    grid-template-columns: 1fr;
  }
  .match-select {
    flex-direction: row;
    justify-content: flex-start;
    min-height: 0;
  }
  .match-card-head {
    flex-direction: column;
  }
  .match-badges {
    justify-content: flex-start;
  }
  .match-facts {
    grid-template-columns: 1fr;
  }
}
