/* ── Reset & Base ───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Monochrome palette */
  --black:       #000000;
  --white:       #ffffff;
  --gray-100:    #f5f5f5;
  --gray-200:    #e8e8e8;
  --gray-300:    #d0d0d0;
  --gray-400:    #a8a8a8;
  --gray-500:    #787878;
  --gray-600:    #555555;
  --gray-700:    #333333;
  --gray-800:    #1a1a1a;
  --gray-900:    #0d0d0d;

  /* Semantic */
  --bg:          var(--white);
  --surface:     var(--gray-100);
  --surface-2:   var(--gray-200);
  --border:      var(--gray-200);
  --border-dark: var(--gray-300);
  --text:        var(--black);
  --text-muted:  var(--gray-500);
  --text-faint:  var(--gray-400);
  --accent:      var(--black);
  --accent-inv:  var(--white);

  /* Typography */
  --font:        'DM Sans', system-ui, -apple-system, sans-serif;
  --fs-xs:       0.75rem;
  --fs-sm:       0.875rem;
  --fs-base:     1rem;
  --fs-md:       1.125rem;
  --fs-lg:       1.25rem;
  --fs-xl:       1.5rem;
  --fs-2xl:      2rem;
  --fs-3xl:      2.5rem;
  --fw-regular:  400;
  --fw-medium:   500;
  --fw-semibold: 600;
  --fw-bold:     700;
  --lh-tight:    1.2;
  --lh-normal:   1.5;
  --lh-relaxed:  1.7;

  /* Spacing */
  --sp-1:  0.25rem;
  --sp-2:  0.5rem;
  --sp-3:  0.75rem;
  --sp-4:  1rem;
  --sp-5:  1.25rem;
  --sp-6:  1.5rem;
  --sp-8:  2rem;
  --sp-10: 2.5rem;
  --sp-12: 3rem;
  --sp-16: 4rem;
  --sp-20: 5rem;

  /* Layout */
  --nav-h:        60px;
  --bottom-nav-h: 64px;
  --max-w:        1200px;
  --max-w-content:780px;

  /* Effects */
  --radius-sm:  4px;
  --radius:     8px;
  --radius-md:  12px;
  --radius-lg:  16px;
  --radius-full:9999px;
  --shadow-sm:  0 1px 3px rgba(0,0,0,.08);
  --shadow:     0 4px 12px rgba(0,0,0,.10);
  --shadow-md:  0 8px 24px rgba(0,0,0,.12);
  --shadow-lg:  0 16px 48px rgba(0,0,0,.16);
  --transition: 180ms ease;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:          var(--gray-900);
    --surface:     var(--gray-800);
    --surface-2:   var(--gray-700);
    --border:      var(--gray-700);
    --border-dark: var(--gray-600);
    --text:        var(--white);
    --text-muted:  var(--gray-400);
    --text-faint:  var(--gray-500);
    --accent:      var(--white);
    --accent-inv:  var(--black);
  }
}

html {
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
}

body {
  min-height: 100dvh;
  padding-top: var(--nav-h);
  padding-bottom: var(--bottom-nav-h);
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font-family: var(--font); cursor: pointer; border: none; background: none; }
svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; width: 20px; height: 20px; }

/* ── Nav ─────────────────────────────────────────────────────────────────────── */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--sp-6);
  z-index: 100;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-weight: var(--fw-bold);
  font-size: var(--fs-lg);
  letter-spacing: -0.02em;
}

.nav-logo {
  font-size: 1.4rem;
  display: inline-block;
  animation: spin-slow 8s linear infinite;
}

@keyframes spin-slow {
  to { transform: rotate(360deg); }
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--sp-6);
}

.nav-link {
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--text-muted);
  transition: color var(--transition);
}

.nav-link:hover,
.nav-link.active { color: var(--text); }

.nav-avatar-wrap { position: relative; }

.nav-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 2px solid var(--border);
  cursor: pointer;
  transition: border-color var(--transition);
}

.nav-avatar:hover { border-color: var(--text); }

.user-menu {
  position: absolute;
  top: calc(100% + var(--sp-3));
  right: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--sp-3);
  min-width: 200px;
  box-shadow: var(--shadow-md);
  display: none;
  z-index: 200;
}

.user-menu.open { display: block; }

.user-menu-name {
  font-weight: var(--fw-semibold);
  font-size: var(--fs-sm);
  padding: var(--sp-1) var(--sp-2);
}

.user-menu-email {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  padding: 0 var(--sp-2) var(--sp-2);
}

.user-menu-sep {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--sp-2) 0;
}

.user-menu-link {
  display: block;
  padding: var(--sp-2) var(--sp-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}

.user-menu-link:hover { background: var(--surface); }
.user-menu-link--danger { color: var(--gray-500); }

.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: var(--sp-2);
  background: none;
}

.nav-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}

/* ── Mobile Nav ──────────────────────────────────────────────────────────────── */
.nav-mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 149;
}

.nav-mobile {
  position: fixed;
  top: 0; right: -280px;
  width: 280px;
  height: 100dvh;
  background: var(--bg);
  border-left: 1px solid var(--border);
  padding: var(--sp-8) var(--sp-6);
  z-index: 150;
  transition: right 0.28s cubic-bezier(.4,0,.2,1);
  overflow-y: auto;
}

.nav-mobile.open { right: 0; }
.nav-mobile-overlay.open { display: block; }

.mobile-user {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding-bottom: var(--sp-6);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--sp-4);
}

.mobile-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 2px solid var(--border);
}

.mobile-user-name {
  font-weight: var(--fw-semibold);
  font-size: var(--fs-sm);
}

.mobile-user-email {
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

.mobile-link {
  display: block;
  padding: var(--sp-3) 0;
  font-size: var(--fs-base);
  font-weight: var(--fw-medium);
  border-bottom: 1px solid var(--border);
}

.mobile-link--danger { color: var(--gray-500); }

/* ── Bottom Nav (PWA) ────────────────────────────────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--bottom-nav-h);
  background: var(--bg);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: var(--sp-2);
  color: var(--text-faint);
  font-size: 10px;
  font-weight: var(--fw-medium);
  transition: color var(--transition);
  min-width: 48px;
}

.bottom-nav-item.active,
.bottom-nav-item:hover { color: var(--text); }

.bottom-nav-create {
  background: var(--black);
  color: var(--white) !important;
  border-radius: var(--radius-full);
  padding: var(--sp-3) var(--sp-4);
  width: 52px;
  height: 52px;
}

@media (prefers-color-scheme: dark) {
  .bottom-nav-create {
    background: var(--white);
    color: var(--black) !important;
  }
}

/* ── Main Content ────────────────────────────────────────────────────────────── */
.main-content {
  min-height: calc(100dvh - var(--nav-h) - var(--bottom-nav-h));
}

.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--sp-6);
}

.container--content {
  max-width: var(--max-w-content);
  margin: 0 auto;
  padding: 0 var(--sp-6);
}

/* ── Buttons ─────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-6);
  font-family: var(--font);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  border-radius: var(--radius);
  transition: all var(--transition);
  cursor: pointer;
  border: 1.5px solid transparent;
  white-space: nowrap;
}

.btn--primary {
  background: var(--black);
  color: var(--white);
  border-color: var(--black);
}

.btn--primary:hover {
  background: var(--gray-800);
  border-color: var(--gray-800);
}

.btn--outline {
  background: transparent;
  color: var(--text);
  border-color: var(--border-dark);
}

.btn--outline:hover {
  background: var(--surface);
}

.btn--ghost {
  background: transparent;
  color: var(--text-muted);
}

.btn--ghost:hover {
  background: var(--surface);
  color: var(--text);
}

.btn--sm {
  padding: var(--sp-2) var(--sp-4);
  font-size: var(--fs-xs);
  border-radius: var(--radius-sm);
}

.btn--lg {
  padding: var(--sp-4) var(--sp-8);
  font-size: var(--fs-base);
  border-radius: var(--radius-md);
}

.btn--full { width: 100%; }

.btn--google {
  background: var(--white);
  color: var(--gray-700);
  border-color: var(--border-dark);
  font-weight: var(--fw-medium);
}

.btn--google:hover { background: var(--gray-100); }

@media (prefers-color-scheme: dark) {
  .btn--primary { background: var(--white); color: var(--black); border-color: var(--white); }
  .btn--primary:hover { background: var(--gray-200); }
  .btn--google { background: var(--gray-800); color: var(--gray-200); border-color: var(--gray-700); }
  .btn--google:hover { background: var(--gray-700); }
}

/* ── Cards ───────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--sp-6);
  transition: box-shadow var(--transition), border-color var(--transition);
}

.card:hover { box-shadow: var(--shadow); }

.card--flat { box-shadow: none !important; }

.card-title {
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  margin-bottom: var(--sp-2);
}

.card-body {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  line-height: var(--lh-relaxed);
}

/* ── Typography ──────────────────────────────────────────────────────────────── */
.h1 { font-size: var(--fs-3xl); font-weight: var(--fw-bold); letter-spacing: -0.03em; line-height: var(--lh-tight); }
.h2 { font-size: var(--fs-2xl); font-weight: var(--fw-bold); letter-spacing: -0.02em; line-height: var(--lh-tight); }
.h3 { font-size: var(--fs-xl); font-weight: var(--fw-semibold); letter-spacing: -0.01em; }
.h4 { font-size: var(--fs-lg); font-weight: var(--fw-semibold); }
.h5 { font-size: var(--fs-base); font-weight: var(--fw-semibold); }

.text-muted  { color: var(--text-muted); }
.text-faint  { color: var(--text-faint); }
.text-sm     { font-size: var(--fs-sm); }
.text-xs     { font-size: var(--fs-xs); }
.text-center { text-align: center; }

/* ── Form Elements ───────────────────────────────────────────────────────────── */
.input {
  display: block;
  width: 100%;
  padding: var(--sp-3) var(--sp-4);
  font-family: var(--font);
  font-size: var(--fs-sm);
  color: var(--text);
  background: var(--bg);
  border: 1.5px solid var(--border-dark);
  border-radius: var(--radius);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.input:focus {
  border-color: var(--text);
  box-shadow: 0 0 0 3px rgba(0,0,0,.07);
}

.textarea {
  resize: vertical;
  min-height: 120px;
}

.label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  margin-bottom: var(--sp-2);
}

.field { margin-bottom: var(--sp-5); }

/* ── Divider ─────────────────────────────────────────────────────────────────── */
.divider {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  color: var(--text-faint);
  font-size: var(--fs-xs);
  margin: var(--sp-6) 0;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Badge ───────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--sp-2);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  border-radius: var(--radius-full);
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.badge--dark {
  background: var(--black);
  color: var(--white);
  border-color: var(--black);
}

/* ── Stat ─────────────────────────────────────────────────────────────────────── */
.stat {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.stat-value {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-bold);
  letter-spacing: -0.03em;
}

.stat-label {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  font-weight: var(--fw-medium);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Grid ─────────────────────────────────────────────────────────────────────── */
.grid { display: grid; gap: var(--sp-6); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ── Flex Utilities ──────────────────────────────────────────────────────────── */
.flex        { display: flex; }
.flex-col    { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--sp-2); }
.gap-4 { gap: var(--sp-4); }
.gap-6 { gap: var(--sp-6); }

/* ── Spacing Utilities ───────────────────────────────────────────────────────── */
.mt-4  { margin-top: var(--sp-4); }
.mt-6  { margin-top: var(--sp-6); }
.mt-8  { margin-top: var(--sp-8); }
.mb-4  { margin-bottom: var(--sp-4); }
.mb-6  { margin-bottom: var(--sp-6); }
.mb-8  { margin-bottom: var(--sp-8); }
.py-6  { padding-top: var(--sp-6); padding-bottom: var(--sp-6); }
.py-8  { padding-top: var(--sp-8); padding-bottom: var(--sp-8); }
.py-12 { padding-top: var(--sp-12); padding-bottom: var(--sp-12); }
.py-16 { padding-top: var(--sp-16); padding-bottom: var(--sp-16); }

/* ── Auth page ───────────────────────────────────────────────────────────────── */
.auth-wrap {
  min-height: calc(100dvh - var(--nav-h) - var(--bottom-nav-h));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-8) var(--sp-6);
}

.auth-box {
  width: 100%;
  max-width: 420px;
}

.auth-logo {
  text-align: center;
  margin-bottom: var(--sp-8);
}

.auth-logo-symbol {
  font-size: 3rem;
  display: block;
  animation: spin-slow 10s linear infinite;
}

.auth-logo-name {
  font-size: var(--fs-xl);
  font-weight: var(--fw-bold);
  letter-spacing: -0.02em;
}

.auth-logo-tagline {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-top: var(--sp-1);
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-8);
}

.auth-title {
  font-size: var(--fs-xl);
  font-weight: var(--fw-bold);
  letter-spacing: -0.02em;
  margin-bottom: var(--sp-1);
}

.auth-sub {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  margin-bottom: var(--sp-8);
}

/* ── Hero ─────────────────────────────────────────────────────────────────────── */
.hero {
  padding: var(--sp-20) var(--sp-6);
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.hero-label {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--sp-6);
  padding: var(--sp-2) var(--sp-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
}

.hero-title {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: var(--fw-bold);
  letter-spacing: -0.04em;
  line-height: 1.05;
  max-width: 780px;
  margin: 0 auto var(--sp-6);
}

.hero-sub {
  font-size: var(--fs-lg);
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 auto var(--sp-10);
  line-height: var(--lh-relaxed);
}

.hero-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-4);
  flex-wrap: wrap;
}

/* ── Section ─────────────────────────────────────────────────────────────────── */
.section {
  padding: var(--sp-16) var(--sp-6);
}

.section-header {
  margin-bottom: var(--sp-10);
}

.section-title {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-bold);
  letter-spacing: -0.02em;
  margin-bottom: var(--sp-3);
}

.section-sub {
  font-size: var(--fs-base);
  color: var(--text-muted);
  max-width: 520px;
}

/* ── Loop item (feed card) ───────────────────────────────────────────────────── */
.loop-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--sp-5);
  transition: border-color var(--transition);
}

.loop-item:hover { border-color: var(--border-dark); }

.loop-item-meta {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-xs);
  color: var(--text-faint);
  margin-bottom: var(--sp-3);
}

.loop-item-title {
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
  margin-bottom: var(--sp-2);
}

.loop-item-body {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  line-height: var(--lh-relaxed);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.loop-item-tags {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
  margin-top: var(--sp-4);
}

/* ── Dashboard layout ────────────────────────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: var(--sp-8);
  padding: var(--sp-8) var(--sp-6);
  max-width: var(--max-w);
  margin: 0 auto;
}

.sidebar {
  position: sticky;
  top: calc(var(--nav-h) + var(--sp-6));
  height: fit-content;
}

.sidebar-section {
  margin-bottom: var(--sp-6);
}

.sidebar-title {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  margin-bottom: var(--sp-3);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--text-muted);
  transition: all var(--transition);
}

.sidebar-link:hover,
.sidebar-link.active {
  background: var(--surface);
  color: var(--text);
}

/* ── Alert ────────────────────────────────────────────────────────────────────── */
.alert {
  padding: var(--sp-4);
  border-radius: var(--radius);
  font-size: var(--fs-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  margin-bottom: var(--sp-4);
}

.alert--error {
  background: #fff0f0;
  border-color: #ffc5c5;
  color: #c00;
}

@media (prefers-color-scheme: dark) {
  .alert--error { background: #2d0000; border-color: #5c0000; color: #ff9f9f; }
}

/* ── Install banner ───────────────────────────────────────────────────────────── */
#install-banner {
  display: none;
  position: fixed;
  bottom: calc(var(--bottom-nav-h) + var(--sp-4));
  left: var(--sp-4);
  right: var(--sp-4);
  background: var(--black);
  color: var(--white);
  border-radius: var(--radius-md);
  padding: var(--sp-4) var(--sp-5);
  box-shadow: var(--shadow-lg);
  z-index: 90;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
}

#install-banner.visible { display: flex; }

.install-banner-text {
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
}

.install-banner-actions {
  display: flex;
  gap: var(--sp-2);
  flex-shrink: 0;
}

/* ── Responsive ───────────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .sidebar { position: static; }
}

@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-hamburger { display: flex; }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .hero { padding: var(--sp-12) var(--sp-4); }
  .section { padding: var(--sp-10) var(--sp-4); }
}

@media (max-width: 480px) {
  .grid-2,
  .grid-3,
  .grid-4 { grid-template-columns: 1fr; }
  .hero-title { font-size: 2rem; }
}

/* ── Loading spinner ─────────────────────────────────────────────────────────── */
.spinner {
  width: 24px;
  height: 24px;
  border: 2.5px solid var(--border);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Skeleton ─────────────────────────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius);
}

@keyframes shimmer { to { background-position: -200% 0; } }

/* ── Eco-credit chip ─────────────────────────────────────────────────────────── */
.eco-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-1) var(--sp-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  color: var(--text);
}

/* ── Network Diagram (Home) ──────────────────────────────────────────────────── */
.network-diagram {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-8);
  background: var(--surface);
}

.network-core {
  display: block;
  width: fit-content;
  margin: 0 auto var(--sp-8);
  padding: var(--sp-2) var(--sp-6);
  border: 1px dashed var(--border-dark);
  border-radius: var(--radius-full);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-sm);
  text-align: center;
}

.network-clusters {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-6);
}

.network-cluster {
  display: block;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--sp-5);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.network-cluster:hover { border-color: var(--border-dark); box-shadow: var(--shadow); }

.network-cluster-name {
  font-weight: var(--fw-semibold);
  font-size: var(--fs-md);
  margin-bottom: var(--sp-2);
}

.network-cluster-blurb {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  line-height: var(--lh-relaxed);
  margin-bottom: var(--sp-4);
}

.network-cluster-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.network-cluster-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  padding: var(--sp-2) 0;
  border-bottom: 1px dashed var(--border);
}

.network-cluster-list li:last-child { border-bottom: none; }

/* ── Module Cards ─────────────────────────────────────────────────────────────── */
.module-card { display: block; }
.module-icon { font-size: 2rem; line-height: 1; margin-bottom: var(--sp-3); }

/* ── Eco-Pass Cards ───────────────────────────────────────────────────────────── */
.pass-card {
  display: flex;
  flex-direction: column;
}

.pass-card--highlight {
  border-color: var(--text);
  box-shadow: var(--shadow-md);
}

.pass-price {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-bold);
  letter-spacing: -0.02em;
  margin: var(--sp-2) 0 var(--sp-5);
}

.pass-period {
  font-size: var(--fs-sm);
  font-weight: var(--fw-regular);
  color: var(--text-muted);
}

.pass-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  font-size: var(--fs-sm);
  color: var(--text-muted);
  flex: 1;
}

.pass-features li {
  position: relative;
  padding-left: var(--sp-6);
  line-height: var(--lh-normal);
}

.pass-features li::before {
  content: '✓';
  position: absolute;
  left: 0;
  top: 0;
  font-weight: var(--fw-bold);
  color: var(--text);
}

/* ── Cluster / Type Tabs ──────────────────────────────────────────────────────── */
.tab-row {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
  margin-bottom: var(--sp-8);
}

.tab-pill {
  padding: var(--sp-2) var(--sp-5);
  border: 1.5px solid var(--border-dark);
  border-radius: var(--radius-full);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--text-muted);
  background: var(--bg);
  transition: all var(--transition);
}

.tab-pill:hover { background: var(--surface); color: var(--text); }

.tab-pill.active {
  background: var(--black);
  color: var(--white);
  border-color: var(--black);
}

@media (prefers-color-scheme: dark) {
  .tab-pill.active { background: var(--white); color: var(--black); border-color: var(--white); }
}

/* ── Destination Cards ────────────────────────────────────────────────────────── */
.dest-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-2);
}

.dest-tagline {
  font-size: var(--fs-xs);
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: var(--fw-medium);
  margin-bottom: var(--sp-3);
}

.dest-trails {
  margin-top: var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.trail-mini {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
  font-size: var(--fs-xs);
  padding: var(--sp-2) var(--sp-3);
  background: var(--surface-2);
  border-radius: var(--radius);
  line-height: var(--lh-normal);
}

.trail-mini-icon { flex-shrink: 0; }

.dest-section {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-8);
  margin-bottom: var(--sp-8);
}

.dest-section-head {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  flex-wrap: wrap;
  margin-bottom: var(--sp-2);
}

/* ── Trail Cards ──────────────────────────────────────────────────────────────── */
.trail-card-head {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-2);
}

.trail-card-icon {
  font-size: 1.25rem;
}

.trail-card-dest {
  font-size: var(--fs-xs);
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: var(--fw-medium);
  margin-top: var(--sp-3);
}

/* ── Stat Grid (Dashboard) ────────────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-4);
  margin-bottom: var(--sp-8);
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--sp-5);
}

@media (max-width: 768px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Modeler ──────────────────────────────────────────────────────────────────── */
.modeler-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-8);
}

@media (max-width: 900px) {
  .modeler-grid { grid-template-columns: 1fr; }
}

.range-field { margin-bottom: var(--sp-5); }

.range-field-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: var(--sp-2);
}

.range-field-value {
  font-weight: var(--fw-bold);
  font-size: var(--fs-md);
}

input[type="range"] {
  width: 100%;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border-dark);
  border-radius: var(--radius-full);
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--black);
  border: 3px solid var(--bg);
  box-shadow: 0 0 0 1px var(--border-dark);
  cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--black);
  border: 3px solid var(--bg);
  box-shadow: 0 0 0 1px var(--border-dark);
  cursor: pointer;
}

@media (prefers-color-scheme: dark) {
  input[type="range"]::-webkit-slider-thumb,
  input[type="range"]::-moz-range-thumb { background: var(--white); }
}

.modeler-output {
  background: var(--black);
  color: var(--white);
  border-radius: var(--radius-lg);
  padding: var(--sp-8);
  text-align: center;
}

@media (prefers-color-scheme: dark) {
  .modeler-output { background: var(--white); color: var(--black); }
}

.modeler-output-value {
  font-size: var(--fs-3xl);
  font-weight: var(--fw-bold);
  letter-spacing: -0.03em;
  margin: var(--sp-2) 0;
}

.modeler-output-label {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.7;
}

.modeler-breakdown {
  margin-top: var(--sp-6);
  text-align: left;
  font-size: var(--fs-sm);
  border-top: 1px solid rgba(255,255,255,.15);
  padding-top: var(--sp-4);
}

@media (prefers-color-scheme: dark) {
  .modeler-breakdown { border-top-color: rgba(0,0,0,.15); }
}

.modeler-breakdown div {
  display: flex;
  justify-content: space-between;
  padding: var(--sp-1) 0;
  opacity: 0.85;
}

/* ── Ledger Table ─────────────────────────────────────────────────────────────── */
.ledger-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}

.ledger-table th {
  text-align: left;
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  font-weight: var(--fw-semibold);
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--border-dark);
}

.ledger-table td {
  padding: var(--sp-3);
  border-bottom: 1px solid var(--border);
}

.ledger-table tr:last-child td { border-bottom: none; }

.delta-pos { color: var(--text); font-weight: var(--fw-semibold); }
.delta-pos::before { content: '+'; }

/* ── H2Oasis ──────────────────────────────────────────────────────────────────── */
.h2o-node {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: var(--sp-2);
  font-size: var(--fs-sm);
}

.h2o-node-stats {
  display: flex;
  gap: var(--sp-4);
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

/* ── Marketplace ──────────────────────────────────────────────────────────────── */
.market-card { display: flex; flex-direction: column; }

.market-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--sp-2);
  margin-bottom: var(--sp-2);
}

.market-price {
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
  margin: var(--sp-2) 0;
}

.market-artisan {
  font-size: var(--fs-xs);
  color: var(--text-faint);
  margin-bottom: var(--sp-3);
}

.village-share {
  margin-top: auto;
}

.village-share-label {
  display: flex;
  justify-content: space-between;
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-bottom: var(--sp-1);
}

.village-share-bar {
  height: 6px;
  background: var(--surface-2);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.village-share-fill {
  height: 100%;
  background: var(--black);
}

@media (prefers-color-scheme: dark) {
  .village-share-fill { background: var(--white); }
}

/* ── New Loop / Type Pills ───────────────────────────────────────────────────── */
.type-pills {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

.type-pill {
  flex: 1;
  text-align: center;
  padding: var(--sp-3) var(--sp-2);
  border: 1.5px solid var(--border-dark);
  border-radius: var(--radius);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  cursor: pointer;
  transition: all var(--transition);
}

.type-pill input { display: none; }

.type-pill.checked {
  background: var(--black);
  color: var(--white);
  border-color: var(--black);
}

@media (prefers-color-scheme: dark) {
  .type-pill.checked { background: var(--white); color: var(--black); border-color: var(--white); }
}

/* ── Loop List (Trails / Dashboard) ──────────────────────────────────────────── */
.loop-list { display: flex; flex-direction: column; gap: var(--sp-3); }

.empty-state {
  text-align: center;
  padding: var(--sp-12) var(--sp-6);
  color: var(--text-muted);
}

.empty-state-icon { font-size: 2.5rem; margin-bottom: var(--sp-3); }

@media (max-width: 768px) {
  .network-clusters { grid-template-columns: 1fr; }
}
