:root {
  --bg-surface: #0f172a;
  --bg-elevated: #111827;
  --bg-panel: #1f2937;
  --bg-muted: #0b1224;
  --accent: #38bdf8;
  --accent-strong: #22c55e;
  --accent-warn: #f59e0b;
  --ink: #e5e7eb;
  --ink-dim: #cbd5e1;
  --border: #1f2937;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  --card-surface: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.01));
  --card-border: rgba(255, 255, 255, 0.05);
  --btn-secondary-bg: rgba(255, 255, 255, 0.08);
  --btn-ghost-bg: transparent;
  --ghost-border: rgba(255, 255, 255, 0.1);
}

:root[data-theme="light"] {
  --bg-surface: #f8fafc;
  --bg-elevated: #ffffff;
  --bg-panel: #e2e8f0;
  --bg-muted: #e5e7eb;
  --accent: #2563eb;
  --accent-strong: #16a34a;
  --accent-warn: #d97706;
  --ink: #0f172a;
  --ink-dim: #334155;
  --border: #cbd5e1;
  --shadow: 0 12px 30px rgba(15, 23, 42, 0.18);
  --card-surface: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.94));
  --card-border: rgba(15, 23, 42, 0.08);
  --btn-secondary-bg: rgba(15, 23, 42, 0.08);
  --btn-ghost-bg: rgba(15, 23, 42, 0.03);
  --ghost-border: rgba(15, 23, 42, 0.16);
}

/* Layout */
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }
.hidden { display: none; }
.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.justify-start { justify-content: flex-start; }
.flex-wrap { flex-wrap: wrap; }
.grow { flex-grow: 1; }
.shrink-0 { flex-shrink: 0; }
.w-full { width: 100%; }
.h-full { height: 100%; }
.min-h-screen { min-height: 100vh; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.rounded { border-radius: 8px; }
.rounded-lg { border-radius: 12px; }
.rounded-full { border-radius: 9999px; }
.shadow { box-shadow: var(--shadow); }
.shadow-sm { box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25); }
.border { border: 1px solid var(--border); }
.border-dashed { border-style: dashed; }

/* Spacing */
.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.pb-16 { padding-bottom: 4rem; }
.m-0 { margin: 0; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mx-auto { margin-left: auto; margin-right: auto; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.space-y-2 > * + * { margin-top: 0.5rem; }
.space-y-3 > * + * { margin-top: 0.75rem; }
.space-y-4 > * + * { margin-top: 1rem; }

/* Typography */
.text-xs { font-size: 0.75rem; line-height: 1.1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-base { font-size: 1rem; line-height: 1.5rem; }
.text-lg { font-size: 1.125rem; line-height: 1.6rem; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.text-2xl { font-size: 1.5rem; line-height: 2rem; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-medium { font-weight: 500; }
.uppercase { text-transform: uppercase; }
.tracking-wide { letter-spacing: 0.05em; }

/* Colors */
.bg-surface { background: radial-gradient(circle at 20% 20%, var(--bg-elevated) 0, var(--bg-muted) 40%, var(--bg-surface) 80%); }
.bg-panel { background-color: var(--bg-panel); }
.bg-elevated { background-color: var(--bg-elevated); }
.bg-muted { background-color: var(--bg-muted); }
.bg-accent { background: linear-gradient(120deg, #22c55e, #38bdf8); }
.bg-accent-soft { background-color: rgba(56, 189, 248, 0.12); }
.bg-warn-soft { background-color: rgba(245, 158, 11, 0.12); }
.bg-success-soft { background-color: rgba(34, 197, 94, 0.16); }
.text-ink { color: var(--ink); }
.text-dim { color: var(--ink-dim); }
.text-accent { color: #38bdf8; }
.text-success { color: #22c55e; }
.text-warn { color: #fbbf24; }
.text-error { color: #f87171; }
.border-accent { border-color: rgba(56, 189, 248, 0.5); }

/* Components */
.card {
  background: var(--card-surface);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 1rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: 12px;
  font-weight: 600;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: linear-gradient(120deg, #38bdf8, #22c55e); color: #0f172a; }
.btn-secondary { background: var(--btn-secondary-bg); color: var(--ink); }
.btn-ghost { background: var(--btn-ghost-bg); color: var(--ink); border-color: var(--ghost-border); }
.btn:hover { transform: translateY(-1px); box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3); }
.btn:active { transform: translateY(0); box-shadow: none; }

.input {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--ink);
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  width: 100%;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input:focus {
  border-color: rgba(56, 189, 248, 0.6);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.06);
}

.chip { padding: 0.4rem 0.75rem; border-radius: 9999px; background: rgba(255, 255, 255, 0.06); }
.link { color: #38bdf8; text-decoration: underline; cursor: pointer; }

.progress {
  position: relative;
  height: 10px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.progress .bar {
  height: 100%;
  border-radius: 9999px;
  background: linear-gradient(120deg, #22c55e, #38bdf8);
}

.nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  backdrop-filter: blur(12px);
  background: linear-gradient(180deg, var(--bg-elevated) 0%, var(--bg-surface) 90%);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  padding: 0.5rem;
  gap: 0.5rem;
}

.nav button {
  font-size: 0.8rem;
  border-radius: 12px;
  padding: 0.65rem 0.5rem;
}

.tablet-nav { display: none; }

/* Grid helpers */
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.col-span-2 { grid-column: span 2 / span 2; }

/* Breakpoints */
@media (min-width: 640px) {
  .sm\\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sm\\:flex-row { flex-direction: row; }
  .sm\\:block { display: block; }
  .sm\\:hidden { display: none; }
  .nav { position: static; grid-template-columns: repeat(6, minmax(0, 1fr)); background: transparent; border: none; }
  .tablet-nav { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0.5rem; }
}

@media (min-width: 768px) {
  .md\\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md\\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .md\\:flex-row { flex-direction: row; }
  .md\\:items-start { align-items: flex-start; }
  .md\\:gap-6 { gap: 1.5rem; }
}

@media (min-width: 1024px) {
  .lg\\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lg\\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .lg\\:flex-row { flex-direction: row; }
}
