:root {
  --background: #0b0f1a;
  --surface: #11182a;
  --surface-alt: #162036;
  --text: #f5f7ff;
  --muted: #aab4d5;
  --border: rgba(255, 255, 255, 0.08);
  --accent: #6be3ff;
  --accent-2: #ff7ad1;
  --accent-3: #58f1b8;
  --shadow: 0 12px 50px rgba(0, 0, 0, 0.45);
  --radius-lg: 18px;
  --radius: 14px;
  --radius-sm: 10px;
  --space: 14px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

[data-theme="light"] {
  --background: #f6f8ff;
  --surface: #ffffff;
  --surface-alt: #eef1ff;
  --text: #0e1324;
  --muted: #59648a;
  --border: rgba(14, 19, 36, 0.08);
  --shadow: 0 14px 40px rgba(14, 19, 36, 0.14);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: linear-gradient(180deg, var(--background), #0c1222 20%, var(--background));
  color: var(--text);
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

a { color: inherit; text-decoration: none; }
button, input, textarea, select { font-family: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius);
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 10px 14px;
  border-radius: var(--radius);
  z-index: 100;
}
.skip-link:focus { left: 8px; }

.app { min-height: 100%; display: flex; flex-direction: column; }

.appbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(11, 15, 26, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
}
[data-theme="light"] .appbar { background: rgba(246, 248, 255, 0.85); }

.appbar-title { font-weight: 700; letter-spacing: 0.2px; }
.appbar-actions { display: flex; gap: 8px; align-items: center; }

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.06);
  color: inherit;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform .12s ease, background .12s ease;
}
.icon-btn:hover { transform: translateY(-1px); background: rgba(255,255,255,0.1); }
[data-theme="light"] .icon-btn { background: rgba(14,19,36,0.05); }

.layout { display: grid; grid-template-columns: 1fr; min-height: calc(100vh - 60px); }

.content {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card header { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.card header h2 { margin: 0; font-size: 17px; }
.card header p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

.placeholder { opacity: 0.8; }
.loading-row { display: flex; gap: 12px; align-items: center; }
.loader { width: 32px; height: 32px; border-radius: 50%; border: 4px solid rgba(255,255,255,0.15); border-top-color: var(--accent); animation: spin 1s linear infinite; }
.skeleton-line { height: 10px; border-radius: 8px; background: var(--surface-alt); opacity: 0.7; }

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.grid { display: grid; gap: 12px; }
.grid.two { grid-template-columns: 1fr; }
@media (min-width: 740px) { .grid.two { grid-template-columns: repeat(2, 1fr); } }

.btn {
  min-height: 48px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(107,227,255,0.18), rgba(255,122,209,0.12));
  color: inherit;
  padding: 10px 14px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: transform .12s ease, filter .12s ease;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.04); }
.btn:active { transform: translateY(0); }
.btn.ghost { background: transparent; }
.btn.secondary { background: var(--surface-alt); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; background: var(--surface-alt); border: 1px solid var(--border); font-size: 12px; }

.input, select, textarea {
  width: 100%;
  min-height: 46px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-alt);
  padding: 10px 12px;
  outline: none;
}
textarea { resize: vertical; min-height: 100px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; color: var(--muted); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--border);
  background: var(--surface-alt);
  padding: 8px 10px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  transition: transform .12s ease, background .12s ease;
}
.chip:hover { transform: translateY(-1px); }
.chip[aria-pressed="true"], .chip.active { background: linear-gradient(135deg, rgba(107,227,255,0.2), rgba(255,122,209,0.16)); }

.progress-line { width: 100%; height: 10px; background: var(--surface-alt); border-radius: 999px; border: 1px solid var(--border); overflow: hidden; }
.progress-line.thin { height: 8px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .2s ease; }

.choice-card { display: flex; gap: 10px; align-items: center; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-alt); cursor: pointer; transition: transform .12s ease, border-color .12s ease; }
.choice-card:hover { transform: translateY(-1px); border-color: rgba(255,255,255,0.14); }
.choice-card input { width: 18px; height: 18px; }
.choice-meta small { color: var(--muted); }

.wizard-actions { position: sticky; bottom: 8px; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); }

.drawer {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: min(320px, 90vw);
  background: var(--surface);
  border-right: 1px solid var(--border);
  box-shadow: var(--shadow);
  transform: translateX(-110%);
  transition: transform .25s ease;
  z-index: 60;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.drawer.open { transform: translateX(0); }
.drawer-header { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.drawer-title { font-weight: 800; letter-spacing: 0.3px; }
.drawer-sub { color: var(--muted); font-size: 13px; }
.drawer-search { padding-top: 6px; }
.drawer-nav { display: flex; flex-direction: column; gap: 6px; }
.drawer-nav button { width: 100%; justify-content: flex-start; gap: 10px; }
.drawer-focus { border-top: 1px solid var(--border); padding-top: 10px; }
.section-label { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.drawer-actions { display: flex; flex-direction: column; gap: 8px; margin-top: auto; }
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(2px);
  z-index: 50;
  opacity: 0;
  transition: opacity .2s ease;
}
.drawer-backdrop.show { opacity: 1; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 70;
  padding: 12px;
}
.modal-backdrop.show { display: flex; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
  padding: 14px;
}
.modal-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.modal-h h3 { margin: 0; }
.modal-h p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.modal-x { border: 1px solid var(--border); background: var(--surface-alt); border-radius: var(--radius); cursor: pointer; min-width: 42px; min-height: 42px; }
.modal-body, .modal-b { padding-top: 10px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.modal-footer { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.modal-kicker { font-size: 12px; color: var(--muted); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 90px;
  transform: translateX(-50%);
  background: rgba(12, 16, 30, 0.9);
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  display: none;
  gap: 8px;
  align-items: center;
  z-index: 80;
  box-shadow: var(--shadow);
}
.toast.show { display: flex; animation: pop .2s ease both; }
.toast .msg { font-size: 13px; }
[data-theme="light"] .toast { background: rgba(246,248,255,0.92); }

.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 75; }

.onboarding {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 14px;
  z-index: 90;
}
.onboarding.show { display: flex; }
.onboarding-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 16px;
  max-width: 520px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.onboarding-steps { display: flex; gap: 8px; }
.step { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--border); display: grid; place-items: center; color: var(--muted); }
.step.current { background: linear-gradient(135deg, rgba(107,227,255,0.25), rgba(255,122,209,0.2)); color: var(--text); }

.mini-pill { padding: 6px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-alt); font-size: 12px; }
.bar { height: 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-alt); overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent-3)); transition: width .4s ease; }

.loader-inline { width: 16px; height: 16px; border-radius: 50%; border: 3px solid rgba(255,255,255,0.2); border-top-color: var(--accent); animation: spin 1s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

.visually-hidden { position: absolute; left: -9999px; }
