:root {
  /* SHADCN / MONOCHROME THEME */
  --bg: #ffffff;
  --bg-card: #ffffff;
  --bg-input: #fafafa;
  --border: #e4e4e7;
  --border-focus: #18181b;
  --text: #09090b;
  --text-muted: #71717a;
  --text-dim: #a1a1aa;
  --accent: #f4f4f5;
  
  --primary: #18181b;
  --primary-fg: #ffffff;
  
  --danger: #ef4444;
  --danger-soft: #fef2f2;
  --success: #10b981;
  --success-soft: #ecfdf5;
  --warning: #f59e0b;
  --warning-soft: #fffbeb;
  
  --radius: 8px;
  --radius-sm: 6px;
  --sidebar-w: 240px;
  --font: 'Space Grotesk', system-ui, sans-serif;
  --mono: 'JetBrains Mono', monospace;
  --transition: 200ms ease;
  
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-card: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
}

html.dark {
  --bg: #09090b;
  --bg-card: #09090b;
  --bg-input: #18181b;
  --border: #27272a;
  --border-focus: #fafafa;
  --text: #fafafa;
  --text-muted: #a1a1aa;
  --text-dim: #52525b;
  --accent: #18181b;
  
  --primary: #fafafa;
  --primary-fg: #09090b;
  
  --shadow-sm: 0 0 transparent;
  --shadow-card: 0 0 0 1px #27272a;
}

/* ── Reset ──────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; }

/* ── Layout ─────────────────────────────────────────────────────────────────── */
.layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
}
.sidebar-header { padding: 20px 16px 12px; border-bottom: 1px solid var(--border); }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; letter-spacing: -0.02em; }
.logo-text {
  color: var(--text);
}
.logo-icon { font-size: 18px; color: var(--text); }
.sidebar-nav { flex: 1; padding: 8px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.sidebar-footer { padding: 8px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 400;
  transition: background var(--transition), color var(--transition);
}
.nav-item:hover { background: var(--bg-input); color: var(--text); }
.nav-item.active { background: var(--bg-input); color: var(--text); font-weight: 500; }
.nav-item--danger:hover { color: var(--danger); }

/* ── Mobile sidebar ─────────────────────────────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}
.menu-btn {
  display: none;
  background: none; border: none; color: var(--text);
  padding: 4px; border-radius: var(--radius-sm);
}

/* ── Main area ───────────────────────────────────────────────────────────────── */
.main-wrap {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.topbar {
  height: 56px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky; top: 0;
  background: rgba(var(--bg), 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 50;
}
.topbar-title { font-weight: 500; font-size: 14px; flex: 1; }
.topbar-user { font-size: 12px; color: var(--text-muted); }
.main-content { 
  padding: 24px 32px; 
  max-width: 1400px; 
  margin: 0 auto; 
  width: 100%;
}

/* ── UI Framework Extras (Core Principles) ────────────────────────────────── */
.domino-goal {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.15) 0%, rgba(56, 189, 248, 0.05) 100%);
  border: 1px solid var(--primary);
  border-left: 4px solid var(--primary);
  padding: 24px;
  border-radius: var(--radius);
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}
.domino-goal::after {
  content: 'THE ONE THING';
  position: absolute;
  top: 10px; right: 10px;
  font-size: 10px; font-weight: 800; opacity: 0.3;
  letter-spacing: 0.1em;
}
.anti-vision-alert {
  background: var(--danger-soft);
  border: 1px solid var(--danger);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--danger);
  margin-bottom: 20px;
  display: flex; gap: 10px; align-items: center;
}
.identity-tag {
  background: var(--bg-input);
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  border: 1px solid var(--border);
}

/* ── Flash ───────────────────────────────────────────────────────────────────── */
.flash-wrap { padding: 0 20px 0; }
.flash {
  padding: 10px 14px; border-radius: var(--radius); margin-bottom: 12px;
  font-size: 13px; border: 1px solid transparent;
}
.flash--success { background: var(--success-soft); border-color: var(--success); color: var(--success); }
.flash--error { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }

/* ── Cards ───────────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-card);
  transition: box-shadow var(--transition), border-color var(--transition);
}
.card-sm { padding: 14px 16px; }
.card-title { font-size: 13px; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 16px; }

/* ── Stats grid ──────────────────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px; }
.stat-card { background: var(--bg-card); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-sm); }
.stat-val { font-size: 28px; font-weight: 700; font-family: var(--mono); line-height: 1; letter-spacing: -0.03em; }
.stat-label { font-size: 11.5px; color: var(--text-muted); margin-top: 6px; }

/* ── Task items ──────────────────────────────────────────────────────────────── */
.task-list { display: flex; flex-direction: column; gap: 2px; }
.task-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.task-item:hover { border-color: var(--border-focus); box-shadow: var(--shadow-card); }
.task-item.done { opacity: 0.45; }
.task-item.done .task-title { text-decoration: line-through; }

.task-check {
  width: 16px; height: 16px; min-width: 16px;
  border: 1.5px solid var(--border-focus);
  border-radius: 4px;
  background: none;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
  cursor: pointer;
}
.task-check:hover { border-color: var(--success); }
.task-check.checked { background: var(--success); border-color: var(--success); }
.task-check.checked::after {
  content: '✓'; font-size: 10px; color: white; font-weight: 700;
}

.task-title { flex: 1; font-size: 13.5px; }
.task-meta { display: flex; align-items: center; gap: 8px; }
.task-actions { display: flex; gap: 4px; opacity: 0; transition: opacity var(--transition); }
.task-item:hover .task-actions { opacity: 1; }

/* ── Priority badges ─────────────────────────────────────────────────────────── */
.badge {
  font-size: 11px; font-weight: 500; font-family: var(--mono);
  padding: 2px 7px; border-radius: 4px; text-transform: uppercase; letter-spacing: 0.04em;
}
.badge-high { background: var(--danger-soft); color: var(--danger); }
.badge-medium { background: var(--warning-soft); color: var(--warning); }
.badge-low { background: var(--success-soft); color: var(--success); }
.badge-health { background: rgba(34,197,94,0.1); color: #4ade80; }
.badge-work { background: rgba(59,130,246,0.1); color: #60a5fa; }
.badge-learning { background: rgba(168,85,247,0.1); color: #c084fc; }
.badge-personal { background: rgba(245,158,11,0.1); color: var(--warning); }
.badge-finance { background: rgba(16,185,129,0.1); color: #34d399; }

/* ── Buttons ──────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 600; border: none; letter-spacing: -0.01em;
  transition: all var(--transition); white-space: nowrap;
}
.btn-primary { 
  background: var(--primary); color: var(--primary-fg); 
  border: 1px solid var(--primary);
}
.btn-primary:hover { 
  opacity: 0.9;
}
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-muted); box-shadow: var(--shadow-sm); }
.btn-outline:hover { border-color: var(--border-focus); color: var(--text); background: var(--bg-input); }
.btn-ghost { background: transparent; border: none; color: var(--text-muted); padding: 5px 8px; }
.btn-ghost:hover { color: var(--text); background: var(--bg-input); }
.btn-danger { background: var(--danger-soft); color: var(--danger); border: 1px solid transparent; }
.btn-danger:hover { border-color: var(--danger); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-icon { padding: 5px; width: 28px; height: 28px; justify-content: center; }

/* ── Forms ───────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12.5px; font-weight: 500; color: var(--text-muted); margin-bottom: 6px; }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 10px 14px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-size: 13.5px; transition: border-color var(--transition), box-shadow var(--transition);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.02);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-select option { background: var(--bg-card); }
.form-hint { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ── Page header ─────────────────────────────────────────────────────────────── */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px;
}
.page-header h1 { 
  font-size: 24px; font-weight: 700; letter-spacing: -0.03em;
  background: linear-gradient(to right, var(--text), var(--text-muted));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.page-header p { font-size: 13.5px; color: var(--text-muted); margin-top: 4px; }

/* ── Section ────────────────────────────────────────────────────────────────── */
.section { margin-bottom: 28px; }
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.section-title { font-size: 12px; font-weight: 500; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--text-muted); }

/* ── Progress bar ─────────────────────────────────────────────────────────────── */
.progress-bar { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--primary); border-radius: 2px; transition: width 0.4s ease; }

/* ── Goal card ───────────────────────────────────────────────────────────────── */
.goal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.goal-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; transition: border-color var(--transition), box-shadow var(--transition); box-shadow: var(--shadow-sm); }
.goal-card:hover { border-color: var(--primary); box-shadow: 0 0 12px rgba(99, 102, 241, 0.15); }
.goal-card-title { font-size: 14px; font-weight: 500; margin-bottom: 4px; }
.goal-card-desc { font-size: 12.5px; color: var(--text-muted); margin-bottom: 12px; }
.goal-card-meta { display: flex; justify-content: space-between; align-items: center; font-size: 11.5px; color: var(--text-muted); margin-top: 12px; }

/* ── Chat ────────────────────────────────────────────────────────────────────── */
.chat-wrap { display: flex; flex-direction: column; height: calc(100vh - 160px); max-height: 680px; }
.chat-messages {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
  border: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0;
  background: var(--bg-card);
}
.chat-msg { max-width: 78%; }
.chat-msg.user { align-self: flex-end; }
.chat-msg.assistant { align-self: flex-start; }
.chat-bubble {
  padding: 10px 14px; border-radius: 12px; font-size: 13.5px; line-height: 1.55;
}
.chat-msg.user .chat-bubble { background: var(--primary); color: var(--primary-fg); border-radius: 12px 12px 2px 12px; }
.chat-msg.assistant .chat-bubble { background: var(--bg-input); border: 1px solid var(--border); border-radius: 12px 12px 12px 2px; }
.chat-input-wrap {
  display: flex; gap: 8px;
  padding: 12px; border: 1px solid var(--border); border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  background: var(--bg-card);
}
.chat-input { flex: 1; background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 12px; color: var(--text); font-size: 13.5px; resize: none; }
.chat-input:focus { outline: none; border-color: var(--border-focus); }

/* ── Log items ───────────────────────────────────────────────────────────────── */
.log-item { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.log-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
.log-dot.completed { background: var(--success); }
.log-dot.skipped { background: var(--danger); }
.log-dot.created { background: var(--warning); }
.log-dot.backlogged { background: var(--text-muted); }
.log-dot.ai_note { background: #818cf8; }
.log-text { flex: 1; font-size: 13px; }
.log-time { font-size: 11.5px; color: var(--text-muted); font-family: var(--mono); flex-shrink: 0; }

/* ── Empty state ─────────────────────────────────────────────────────────────── */
.empty { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty-icon { font-size: 32px; margin-bottom: 10px; }
.empty p { font-size: 13px; }

/* ── Auth pages ──────────────────────────────────────────────────────────────── */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.auth-card {
  width: 100%; max-width: 380px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 32px;
}
.auth-logo { text-align: center; margin-bottom: 28px; }
.auth-logo .logo { justify-content: center; font-size: 18px; }
.auth-title { font-size: 18px; font-weight: 600; margin-bottom: 4px; }
.auth-sub { font-size: 13px; color: var(--text-muted); margin-bottom: 24px; }
.auth-footer { text-align: center; font-size: 13px; color: var(--text-muted); margin-top: 16px; }
.auth-footer a { color: var(--text); text-decoration: underline; }

/* ── Tabs ────────────────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 2px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 3px; width: fit-content; margin-bottom: 20px; }
.tab { padding: 5px 14px; border-radius: 4px; font-size: 13px; color: var(--text-muted); cursor: pointer; transition: all var(--transition); border: none; background: none; }
.tab.active { background: var(--bg-input); color: var(--text); font-weight: 500; }

/* ── Textarea voice ─────────────────────────────────────────────────────────── */
.voice-box { width: 100%; min-height: 100px; background: var(--bg-input); border: 1px dashed var(--border-focus); border-radius: var(--radius); padding: 14px; color: var(--text); font-family: var(--mono); font-size: 13px; resize: vertical; }
.voice-box:focus { outline: none; border-color: var(--text-muted); }

/* ── Utility ────────────────────────────────────────────────────────────────── */
.flex { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mb-4 { margin-bottom: 16px; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12.5px; }
.text-xs { font-size: 11.5px; }
.mono { font-family: var(--mono); }
.divider { height: 1px; background: var(--border); margin: 20px 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }

/* ── Responsive ──────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-overlay.open {
    display: block;
  }
  .main-wrap { margin-left: 0; }
  .menu-btn { display: flex; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .goal-grid { grid-template-columns: 1fr; }
  .task-actions { opacity: 1; }
  .main-content { padding: 16px; }
}

@media (max-width: 400px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .auth-card { padding: 24px 20px; }
}
