@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg: #080c14;
  --bg-elevated: #0d121c;
  --surface: #111722;
  --surface-raised: #171e2b;   /* one step up from surface — inputs, pills, hover backgrounds */
  --surface-hover: #171e2b;
  --surface-active: #1d2533;   /* pressed/selected state */
  --border: #242d3b;
  --border-strong: #354155;
  --text: #f7f9fc;
  --text-muted: #9aa8bd;
  --text-faint: #68778d;

  --accent: #ff4961;           /* Creator OS coral/red — brand primary */
  --accent-hover: #ff5d72;
  --accent-dim: rgba(255, 73, 97, 0.12);

  --danger: #ef4455;           /* distinct from --accent: errors/destructive actions only */
  --danger-dim: rgba(239, 68, 85, 0.12);

  --gold: #f0ad2d;             /* warning / AI-insight accent */
  --gold-dim: rgba(240, 173, 45, 0.12);
  --green: #22c983;            /* success */
  --green-dim: rgba(34, 201, 131, 0.12);
  --blue: #2f80ff;             /* secondary accent — "intelligent electric blue" */
  --blue-hover: #4790ff;
  --blue-dim: rgba(47, 128, 255, 0.14);

  /* Spacing scale — used consistently instead of ad hoc pixel values */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;

  --radius: 16px;        /* card radius, spec range 14-18px */
  --radius-sm: 10px;     /* control radius (buttons/inputs), spec range 9-12px */
  --radius-lg: 20px;

  /* Elevation: subtle at rest, slightly lifted on hover/focus */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.35);
  --shadow-lg: 0 20px 50px rgba(0,0,0,0.5);

  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

/* Light theme — a real, complete override, not a stub. Toggled via the
   account menu; every component already reads these as CSS variables, so
   the whole app re-themes consistently with zero extra per-component work. */
[data-theme="light"] {
  --bg: #F5F6F8;
  --bg-elevated: #ECEEF2;
  --surface: #FFFFFF;
  --surface-raised: #F0F1F4;
  --surface-hover: #E7E9EE;
  --surface-active: #DEE1E7;
  --border: #E2E4EA;
  --border-strong: #C9CDD6;
  --text: #1A1D24;
  --text-muted: #5B6272;
  --text-faint: #8A90A0;
  --accent: #E23A4C;
  --accent-hover: #D62E40;
  --accent-dim: #FCE4E6;
  --danger: #D6303F;
  --danger-dim: #FBE2E4;
  --gold: #B9790E;
  --gold-dim: #FBEFD9;
  --green: #12885F;
  --green-dim: #DFF6EC;
  --blue: #2F6FE0;
  --blue-hover: #2560C7;
  --blue-dim: #E4EDFC;
  --shadow-sm: 0 1px 2px rgba(20,20,30,0.06);
  --shadow-md: 0 8px 24px rgba(20,20,30,0.08);
  --shadow-lg: 0 20px 50px rgba(20,20,30,0.14);
}
body { transition: background 0.2s ease, color 0.2s ease; }

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55; /* comfortable body line-height */
}
/* Typography hierarchy (hero tier intentionally unused — this is an app
   shell, not a marketing page, so there's no hero heading context). */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;         /* high-weight headings */
  line-height: 1.15;        /* tight heading line-height */
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}
h1 { font-size: 34px; }     /* page heading, spec range 32-40px */
h2 { font-size: 28px; }     /* section heading, spec range 28-36px */
h3 { font-size: 17px; }     /* card heading, spec range 16-20px */
h4 { font-size: 15px; }
p { margin: 0 0 12px; color: var(--text-muted); }
a { color: inherit; }
button { font-family: var(--font-body); cursor: pointer; }
input, textarea, select {
  font-family: var(--font-body);
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 14px;
  width: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, textarea:focus, select:focus {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
  border-color: var(--gold);
}
label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 6px; font-weight: 500; }
::selection { background: var(--accent); color: white; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes revealUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Scroll-reveal (landing page) ---------- */
.scroll-reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1); }
.scroll-reveal.revealed { opacity: 1; transform: translateY(0); }
@media (prefers-reduced-motion: reduce) {
  .scroll-reveal { opacity: 1; transform: none; transition: none; }
}

/* ---------- Landing page card lift + button motion ---------- */
.landing .card { transition: transform 0.25s ease, border-color 0.2s ease, box-shadow 0.2s ease; }
.landing .card:hover { transform: translateY(-4px); border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.btn-arrow { display: inline-block; transition: transform 0.2s ease; }
.btn:hover .btn-arrow { transform: translateX(3px); }
.btn:hover:not(:disabled) { filter: brightness(1.06); }

/* ---------- Skeleton shimmer (loading state) ---------- */
.skeleton-card { pointer-events: none; }
.skeleton-line {
  height: 12px; border-radius: 4px;
  background: linear-gradient(90deg, var(--surface-raised) 25%, var(--surface-hover) 50%, var(--surface-raised) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease infinite;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .skeleton-line { animation: none; background: var(--surface-raised); }
}
@keyframes auroraShift {
  0%, 100% { background-position: 0% 50%, 100% 50%; }
  50% { background-position: 30% 60%, 70% 40%; }
}
@keyframes countGlow {
  0% { text-shadow: 0 0 0 rgba(245,184,65,0); }
  40% { text-shadow: 0 0 12px rgba(245,184,65,0.35); }
  100% { text-shadow: 0 0 0 rgba(245,184,65,0); }
}

/* ---------- Tally light signature ---------- */
.tally {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.tally-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-faint);
  flex-shrink: 0;
}
.tally-dot.on { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); animation: pulse 1.6s infinite; }
.tally-dot.gold { background: var(--gold); box-shadow: 0 0 0 3px var(--gold-dim); }
.tally-dot.green { background: var(--green); box-shadow: 0 0 0 3px var(--green-dim); }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
@media (prefers-reduced-motion: reduce) {
  .tally-dot.on { animation: none; }
}

/* ---------- Layout ---------- */
.app-shell { display: flex; min-height: 100vh; }
.content-column { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ---------- Global sticky top bar ---------- */
.app-topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 24px; background: var(--bg-elevated); border-bottom: 1px solid var(--border);
}
.app-topbar-left { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); flex-shrink: 0; }
.app-topbar-center { display: flex; align-items: center; gap: 8px; flex: 1; justify-content: center; position: relative; }
.app-topbar-right { flex-shrink: 0; }

/* ---------- Channel selector ---------- */
.channel-selector-btn {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-raised); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius-sm); padding: 7px 12px; font-size: 13px;
}
.channel-selector-btn:hover { border-color: var(--border-strong); }
.channel-selector-dropdown {
  position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  min-width: 260px; background: var(--surface-raised); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 60;
  animation: fadeInDown 0.15s ease both;
}
.channel-selector-label {
  font-family: var(--font-mono); font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-faint); padding: 8px 10px 4px;
}
.channel-selector-item {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  background: none; border: none; color: var(--text); text-align: left;
  padding: 9px 10px; border-radius: 7px; font-size: 13px;
}
.channel-selector-item:hover { background: var(--surface-hover); }
.channel-selector-item.active { color: var(--green); }
.channel-selector-divider { height: 1px; background: var(--border); margin: 6px 4px; }

.mobile-topbar { display: none; }
.sidebar-overlay { display: none; }

.sidebar {
  width: 256px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
.brand { display: flex; align-items: center; gap: 8px; padding: 0 8px 20px; }
.brand-mark { width: 10px; height: 10px; border-radius: 2px; background: var(--accent); }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }

.nav-section-label {
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-faint);
  padding: 14px 10px 6px; user-select: none;
}
.nav-section-label:first-child { padding-top: 4px; }
.nav-group { margin-bottom: 4px; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--radius-sm);
  color: var(--text-muted); text-decoration: none;
  font-size: 13.5px; font-weight: 500;
  border: none; background: none; width: 100%; text-align: left;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.nav-link:hover { background: var(--surface-raised); color: var(--text); }
.nav-link:hover .nav-icon { transform: scale(1.15); }
.nav-link.active { background: var(--surface-raised); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.nav-icon { width: 16px; text-align: center; opacity: 0.85; font-family: var(--font-mono); font-size: 12px; display: inline-block; transition: transform 0.15s ease; }

.sidebar-footer { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border); position: relative; }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: var(--radius-sm); cursor: pointer; transition: background 0.15s ease; }
.user-chip:hover { background: var(--surface-raised); }
.user-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--gold-dim); color: var(--gold);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 12px; font-weight: 600;
  flex-shrink: 0;
}
.user-meta { min-width: 0; }
.user-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email { font-size: 12px; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Account dropdown menu ---------- */
.user-menu {
  position: absolute; bottom: calc(100% + 6px); left: 0; right: 0;
  background: var(--surface-raised); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: var(--shadow-lg);
  padding: 6px; z-index: 60;
  animation: fadeInUp 0.15s ease both;
}
.user-menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: none; border: none; color: var(--text); text-align: left;
  padding: 9px 10px; border-radius: 7px; font-size: 13px;
}
.user-menu-item:hover { background: var(--surface-hover); }
.user-menu-item.danger:hover { color: var(--accent); }
.user-menu-divider { height: 1px; background: var(--border); margin: 6px 4px; }
.theme-toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 9px 10px; font-size: 13px; }
.switch {
  position: relative; width: 34px; height: 20px; flex-shrink: 0;
  background: var(--border-strong); border-radius: 10px; border: none; cursor: pointer;
  transition: background 0.2s ease;
}
.switch::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  background: white; border-radius: 50%; transition: transform 0.2s ease;
}
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(14px); }

.logout-btn {
  background: none; border: 1px solid var(--border); color: var(--text-muted);
  border-radius: var(--radius-sm); padding: 7px 10px; font-size: 12px; width: 100%; margin-top: 8px;
}
.logout-btn:hover { border-color: var(--accent); color: var(--accent); }

.main {
  flex: 1;
  min-width: 0;
  padding: 32px 32px 60px;
  max-width: 1240px;
}
.page-header { margin-bottom: 28px; }
.page-eyebrow { font-family: var(--font-mono); font-size: 12px; color: var(--gold); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 6px; }
.page-title { font-size: 34px; }
.page-desc { color: var(--text-muted); font-size: 15px; max-width: 640px; }

/* ---------- Cards & grid ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-5);
  box-shadow: var(--shadow-sm);
  animation: fadeInUp 0.35s ease both;
  transition: border-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}
.card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.card + .card { margin-top: var(--sp-4); }
.grid { display: grid; gap: var(--sp-5); }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 1100px) and (min-width: 901px) { .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 900px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.stat-card { padding: 18px 20px; }
.stat-value { font-family: var(--font-mono); font-size: 26px; font-weight: 500; color: var(--text); animation: countGlow 1s ease 0.2s; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ---------- Goal-progress block (borderless, big number + milestone bar) ---------- */
.goal-block { padding: 4px 4px 0; }
.goal-label {
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--text-muted); margin-bottom: 6px;
}
.goal-value { font-family: var(--font-display); font-size: 32px; font-weight: 700; color: var(--text); line-height: 1.1; }
.goal-bar { height: 6px; border-radius: 3px; background: var(--surface-raised); overflow: hidden; margin: 12px 0 6px; }
.goal-bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--gold)); border-radius: 3px; transition: width 0.6s ease; }
.goal-range { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 12px; color: var(--text-faint); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: var(--radius-sm); padding: 10px 16px; font-size: 13.5px; font-weight: 600;
  border: 1px solid transparent;
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); box-shadow: 0 0 0 3px var(--accent-dim); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary { background: var(--surface-raised); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--text-faint); }
.btn-ghost { background: none; color: var(--text-muted); border: none; padding: 6px 8px; transition: color 0.15s ease, transform 0.12s ease; }
.btn-ghost:hover { color: var(--accent); transform: translateX(1px); }
.btn-block { width: 100%; }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }

/* ---------- Auth screens ---------- */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 20%, rgba(255,71,87,0.10), transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(245,184,65,0.08), transparent 40%),
    var(--bg);
  background-size: 140% 140%, 140% 140%, 100% 100%;
  animation: auroraShift 12s ease-in-out infinite;
}
.auth-card { width: 100%; max-width: 380px; }
.auth-brand { text-align: center; margin-bottom: 24px; }
.auth-brand .brand-mark { margin: 0 auto 12px; width: 14px; height: 14px; border-radius: 3px; }
.auth-tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.auth-tab {
  flex: 1; text-align: center; padding: 9px; border-radius: var(--radius-sm);
  background: var(--surface-raised); border: 1px solid var(--border);
  color: var(--text-muted); font-size: 13px; font-weight: 600;
}
.auth-tab.active { color: var(--text); border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }

/* ---------- Loading / empty / error ---------- */
.loading-line { display: flex; align-items: center; gap: 8px; color: var(--text-muted); font-size: 13px; padding: 24px 0; }
.spinner {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--border); border-top-color: var(--gold);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-state h3 { color: var(--text); font-size: 15px; margin-bottom: 6px; }
.error-banner {
  background: var(--danger-dim); border: 1px solid var(--danger); color: var(--danger);
  border-radius: var(--radius-sm); padding: 10px 14px; font-size: 13px; margin-bottom: 16px;
}
.success-banner {
  background: var(--green-dim); border: 1px solid var(--green); color: var(--green);
  border-radius: var(--radius-sm); padding: 10px 14px; font-size: 13px; margin-bottom: 16px;
}

/* ---------- Idea / SEO result cards ---------- */
.idea-card { border-left: 3px solid var(--gold); }
.idea-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.score-badge {
  font-family: var(--font-mono); font-size: 13px; font-weight: 600;
  color: var(--gold); background: var(--gold-dim); border-radius: 6px;
  padding: 3px 8px; flex-shrink: 0;
}
.idea-hook { font-size: 13px; color: var(--text-muted); font-style: italic; margin: 8px 0; }
.idea-outline { font-size: 13px; color: var(--text); white-space: pre-line; margin-top: 8px; }

.tag-pill {
  display: inline-block; font-family: var(--font-mono); font-size: 12px;
  background: var(--surface-raised); border: 1px solid var(--border); color: var(--text-muted);
  border-radius: 5px; padding: 3px 8px; margin: 0 6px 6px 0;
}

/* ---------- Insights banner (real count, secondary/info accent) ---------- */
.insights-banner {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; background: var(--blue-dim); border: 1px solid var(--blue);
  color: var(--text); font-size: 13.5px; font-weight: 500;
  border-radius: var(--radius-sm); padding: 12px; margin-bottom: 16px;
  transition: transform 0.12s ease, box-shadow 0.15s ease;
}
.insights-banner:hover { box-shadow: 0 0 0 3px var(--blue-dim); transform: translateY(-1px); }

/* ---------- Coach floating input bar ---------- */
.coach-input-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px; border-top: 1px solid var(--border);
  background: var(--bg-elevated);
}
.coach-input-bar input { flex: 1; background: var(--surface-raised); }

/* ---------- Segmented control (chip-style tab bar) ---------- */
.segmented {
  display: inline-flex; gap: 2px; padding: 3px;
  background: var(--surface-raised); border: 1px solid var(--border);
  border-radius: 9px; margin-bottom: var(--sp-4);
}
.segmented button {
  background: none; border: none; color: var(--text-muted);
  font-size: 12.5px; font-weight: 500; padding: 6px 14px; border-radius: 6px;
  transition: background 0.15s ease, color 0.15s ease;
}
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.segmented button:not(.active):hover { color: var(--text); }
.checklist-item { display: flex; align-items: flex-start; gap: 8px; font-size: 13.5px; padding: 5px 0; }
.checklist-item::before { content: '☐'; color: var(--gold); flex-shrink: 0; }

/* ---------- Pipeline (kanban) ---------- */
.kanban { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 12px; }
.kanban-col { min-width: 220px; flex-shrink: 0; }
.kanban-col-head {
  font-family: var(--font-mono); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted); padding: 0 4px 10px; display: flex; justify-content: space-between;
}
.kanban-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px; margin-bottom: 10px; font-size: 13px; cursor: grab;
  transition: transform 0.12s ease, border-color 0.15s ease;
}
.kanban-card:hover { border-color: var(--gold); transform: translateY(-1px); }
.kanban-card:active { cursor: grabbing; }
.kanban-card-title { font-weight: 500; margin-bottom: 4px; }
.kanban-card-meta { font-size: 12px; color: var(--text-faint); font-family: var(--font-mono); }
.kanban-col.drag-over { background: var(--surface-raised); border-radius: 10px; }

/* ---------- Calendar ---------- */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-dow { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); text-align: center; padding-bottom: 6px; text-transform: uppercase; }
.cal-cell {
  min-height: 90px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 6px; background: var(--surface);
}
.cal-cell.cal-empty { background: none; border: none; }
.cal-cell.cal-today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cal-daynum { font-family: var(--font-mono); font-size: 12px; color: var(--text-faint); margin-bottom: 4px; }
.cal-item {
  font-size: 12px; background: var(--gold-dim); color: var(--gold);
  border-radius: 4px; padding: 2px 5px; margin-bottom: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
@media (max-width: 700px) {
  .cal-cell { min-height: 50px; }
  .cal-item { font-size: 9px; }
}

/* ---------- Table-ish rows ---------- */
.row-list .row-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.row-list .row-item:last-child { border-bottom: none; }

/* ---------- Utility ---------- */
.muted { color: var(--text-muted); }
.mono { font-family: var(--font-mono); }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.mt-16 { margin-top: 16px; }
.mb-0 { margin-bottom: 0; }
.hidden { display: none !important; }

/* ---------- Toast notifications ---------- */
#toast-host {
  position: fixed; bottom: 20px; right: 20px; z-index: 200;
  display: flex; flex-direction: column-reverse; gap: 8px;
  max-width: 320px;
}
.toast {
  background: var(--surface-raised); border: 1px solid var(--border);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius-sm); padding: 12px 14px; font-size: 13px; color: var(--text);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  opacity: 0; transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-error { border-left-color: var(--accent); }
.toast-success { border-left-color: var(--green); }

/* ---------- Generic modal (New Clip Project, etc.) ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  z-index: 160; display: flex; align-items: flex-start; justify-content: center;
  padding: 6vh 16px; overflow-y: auto;
}
.modal-box {
  width: 100%; max-width: 480px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.5);
  animation: fadeInUp 0.15s ease both; padding: 20px;
}
.modal-box-lg { max-width: 720px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modal-header h3 { font-size: 16px; }
.modal-close-btn { background: none; border: none; color: var(--text-muted); font-size: 18px; cursor: pointer; line-height: 1; padding: 4px; }
.modal-close-btn:hover { color: var(--text); }
.source-mode-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.source-mode-btn {
  border: 1px solid var(--border); background: var(--bg); border-radius: var(--radius-sm);
  padding: 16px 10px; text-align: center; cursor: pointer; color: var(--text); font-size: 13px;
}
.source-mode-btn:hover { border-color: var(--accent); }

/* ---------- Clipping Projects ---------- */
.structural-idea-card { border-left: 3px solid var(--gold); background: var(--gold-dim); }
.clip-candidate-card { border-left: 3px solid var(--green); }

/* ---------- Command palette (global search) ---------- */
.palette-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  z-index: 150; display: flex; align-items: flex-start; justify-content: center;
  padding-top: 12vh;
}
.palette-box {
  width: 100%; max-width: 560px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.5);
  max-height: 60vh; display: flex; flex-direction: column;
  animation: fadeInUp 0.15s ease both;
}
.palette-input-row { padding: 14px; border-bottom: 1px solid var(--border); }
.palette-input-row input { font-size: 15px; }
.palette-results { overflow-y: auto; padding: 8px; }
.palette-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px; border-radius: var(--radius-sm); cursor: pointer; font-size: 13.5px;
}
.palette-item:hover, .palette-item.active { background: var(--surface-raised); }
.palette-item-meta { font-size: 12px; color: var(--text-faint); font-family: var(--font-mono); flex-shrink: 0; margin-left: 10px; }
.palette-hint { padding: 10px 14px; font-size: 12px; color: var(--text-faint); border-top: 1px solid var(--border); }
.search-trigger-btn {
  display: flex; align-items: center; gap: 8px; width: 100%;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px 10px; color: var(--text-muted); font-size: 12.5px; margin-bottom: 12px;
}
.search-trigger-btn kbd {
  margin-left: auto; font-family: var(--font-mono); font-size: 12px;
  background: var(--surface-raised); border: 1px solid var(--border);
  border-radius: 4px; padding: 1px 5px;
}

/* ============================================================
   Mobile responsiveness (<= 860px): sidebar becomes a slide-in
   drawer behind a hamburger button; content reflows to single
   column with tighter spacing.
============================================================ */
@media (max-width: 860px) {
  .app-shell { flex-direction: column; }
  .app-topbar { display: none; }

  .mobile-topbar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; padding: 12px 16px;
    background: var(--surface); border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 30;
  }
  .mobile-topbar .brand { padding: 0; }
  .hamburger-btn {
    background: var(--surface-raised); border: 1px solid var(--border);
    border-radius: var(--radius-sm); width: 38px; height: 38px;
    display: flex; align-items: center; justify-content: center;
    color: var(--text); font-size: 16px; flex-shrink: 0;
  }
  .hamburger-btn:active { transform: scale(0.94); }

  .sidebar {
    position: fixed; top: 0; left: 0; height: 100%; z-index: 50;
    width: 260px;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 8px 0 32px rgba(0,0,0,0.5);
  }
  .sidebar.open { transform: translateX(0); }

  .sidebar-overlay {
    display: block;
    position: fixed; inset: 0; background: rgba(0,0,0,0.55);
    z-index: 45; opacity: 0; pointer-events: none;
    transition: opacity 0.2s ease;
  }
  .sidebar-overlay.open { opacity: 1; pointer-events: auto; }

  .main { padding: 20px 18px 48px; max-width: 100%; }
  .page-title { font-size: 26px; }
  .page-desc { font-size: 14px; }

  /* Forms stack instead of sitting side-by-side */
  .field-row { flex-direction: column; gap: 0; }
  .field-row .field { max-width: 100% !important; }

  /* Prevent iOS Safari's auto-zoom-on-focus for form fields */
  input, textarea, select { font-size: 16px; }

  .kanban-col { min-width: 200px; }

  .row-item { flex-wrap: wrap; gap: 8px; }

  .auth-wrap { padding: 16px; }
  .auth-card { max-width: 100%; }

  .stat-value { font-size: 22px; }

  .landing-hero h1 { font-size: 30px !important; }
  .landing-nav { padding: 16px 18px; }
  .landing-feature-grid { grid-template-columns: 1fr !important; }
  .landing-steps { grid-template-columns: 1fr !important; }
}

/* ---------- Landing page ---------- */
.landing { max-width: 100%; overflow-x: hidden; }
.landing-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 32px; max-width: 1240px; margin: 0 auto;
  position: sticky; top: 0; z-index: 40;
  background: transparent; border-bottom: 1px solid transparent;
  transition: background 0.25s ease, border-color 0.25s ease, padding 0.25s ease, backdrop-filter 0.25s ease;
}
.landing-nav.scrolled {
  background: rgba(8, 12, 20, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom-color: var(--border);
  padding: 14px 32px;
}
[data-theme="light"] .landing-nav.scrolled { background: rgba(245, 246, 248, 0.82); }
.landing-hero { padding: 60px 24px 50px; max-width: 900px; margin: 0 auto; }
.landing-section { padding: 50px 24px; max-width: 1100px; margin: 0 auto; }
.landing-feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
@media (max-width: 1000px) and (min-width: 601px) { .landing-feature-grid { grid-template-columns: repeat(2, 1fr); } }
.landing-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.landing-step { text-align: center; }
.landing-step-num {
  width: 32px; height: 32px; border-radius: 50%; background: var(--accent-dim); color: var(--accent);
  display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-weight: 700;
  margin: 0 auto 12px;
}
.landing-footer {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px;
  padding: 32px; max-width: 1240px; margin: 0 auto; border-top: 1px solid var(--border);
}
.landing-footer a { font-size: 13px; color: var(--text-muted); text-decoration: none; }
.landing-footer a:hover { color: var(--text); }
@media (max-width: 600px) {
  .landing-nav { padding: 16px 18px; flex-wrap: wrap; gap: 10px; }
  .landing-hero { padding: 40px 18px 36px; }
  .landing-hero h1 { font-size: 32px !important; }
  .landing-hero p { font-size: 14px !important; }
  .landing-section { padding: 36px 18px; }
  .landing-section h2 { font-size: 22px !important; }
  .landing-feature-grid { grid-template-columns: 1fr; }
  .landing-steps { grid-template-columns: 1fr; }
  .landing-footer { padding: 24px 18px; justify-content: center; text-align: center; }
}
