/* =====================================================
   ORBIT — Personal Dashboard
   Original dashboard styles (preserved from index.html)
   + app views, forms, auth
   ===================================================== */

:root {
  --bg: #f4f1ea;
  --ink: #0a0a0a;
  --dim: #6b6b6b;
  --line: #e5e0d5;
  --accent: #ff4a1c;
  --card: #ffffff;
}

/* ── Dark theme ─────────────────────────── */
html[data-theme="dark"] {
  --bg: #131110;
  --ink: #efe9df;
  --dim: #9b9388;
  --line: rgba(255,255,255,0.12);
  --accent: #ff6b3d;
  --card: #1e1b17;
  color-scheme: dark;
}
html[data-theme="dark"] .card:hover { transform: translateY(-2px); }
html[data-theme="dark"] .nav-item:hover { background: rgba(255,255,255,0.06); }
html[data-theme="dark"] .book { background: rgba(255,255,255,0.04); }
html[data-theme="dark"] .book:hover { background: rgba(255,255,255,0.07); }
html[data-theme="dark"] .settings-stat { background: rgba(255,255,255,0.04); }
html[data-theme="dark"] .journal-item.active { background: rgba(255,255,255,0.05); }
html[data-theme="dark"] .mood-pill { background: rgba(255,255,255,0.08); color: var(--dim); }
html[data-theme="dark"] .seg { background: rgba(255,255,255,0.08); }
html[data-theme="dark"] .search-item:hover { background: rgba(255,255,255,0.06); }
html[data-theme="dark"] .weather-card { color: #402d1c; }
html[data-theme="dark"] .weather-card .weather-location { color: #402d1c; }
html[data-theme="dark"] .weather-hours .h { background: rgba(255,255,255,0.55); }
html[data-theme="dark"] .money-meta .up, html[data-theme="dark"] .tx-amount.income { color: #4ade80; }
html[data-theme="dark"] .icon-btn { background: var(--card); }
html[data-theme="dark"] .field input, html[data-theme="dark"] .field select, html[data-theme="dark"] .field textarea { background: var(--card); }
html[data-theme="dark"] .modal-box { background: var(--bg); }
html[data-theme="dark"] .cal-cell { background: var(--card); }
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { background: var(--bg); color: var(--ink); font-family: 'Inter', sans-serif; -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; padding: 24px; overflow-x: hidden; }

.serif { font-family: 'Instrument Serif', serif; font-weight: 400; }
.italic { font-style: italic; }

/* Grid layout */
.app {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
  max-width: 1600px;
  margin: 0 auto;
}

/* ── SIDEBAR ─────────────────────────── */
.sidebar {
  position: sticky; top: 24px; height: fit-content;
  padding: 4px;
  z-index: 50;
}
.brand {
  font-family: 'Instrument Serif', serif;
  font-size: 32px; letter-spacing: -1px;
  margin-bottom: 6px;
  display: flex; align-items: baseline; gap: 6px;
}
.brand .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent); display: inline-block;
  box-shadow: 0 0 0 3px rgba(255, 74, 28, 0.15);
}
.brand-sub {
  font-size: 11px; color: var(--dim); letter-spacing: 1px;
  text-transform: uppercase; margin-bottom: 40px;
}

.nav { display: flex; flex-direction: column; gap: 2px; }
  .nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px; border-radius: 12px;
    font-size: 14px; font-weight: 500; color: var(--ink);
    cursor: pointer; transition: all 0.25s ease;
    position: relative;
  }
  .nav-item:hover { background: rgba(0,0,0,0.04); }
  .nav-item.active {
    background: var(--ink); color: var(--bg);
  }
  .nav-item.active .num { color: var(--accent); }
  .nav-item .num {
    font-family: 'Instrument Serif', serif; font-style: italic;
    font-size: 13px; color: var(--dim); width: 20px;
  }
  .nav-item .icon { display: none; }
  .nav-item .label { flex: 1; }
  .nav-item .badge {
    font-size: 10px; padding: 2px 6px;
    background: var(--accent); color: white;
    border-radius: 4px; font-weight: 600;
    margin-left: 8px;
  }
  .nav-more { position: relative; display: none; }
  .nav-dropdown {
    position: absolute; bottom: 100%; left: 0; right: 0; margin-bottom: 8px;
    background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
    box-shadow: 0 16px 40px rgba(0,0,0,0.15); overflow: hidden; z-index: 60;
  }
  .nav-dropdown-item {
    padding: 12px 16px; cursor: pointer; font-family: 'Inter', sans-serif; font-size: 14px;
    color: var(--ink); transition: background 0.1s;
  }
  .nav-dropdown-item:hover { background: rgba(255,74,28,0.1); color: var(--accent); }
  .nav-dropdown-item.active { background: var(--accent); color: #fff; }

  .sidebar-foot {
  margin-top: 48px; padding: 16px;
  background: var(--ink); color: var(--bg);
  border-radius: 20px; position: relative; overflow: hidden;
}
.sidebar-foot::before {
  content: ''; position: absolute; top: -30px; right: -30px;
  width: 80px; height: 80px; border-radius: 50%;
  background: var(--accent);
  filter: blur(20px); opacity: 0.6;
}
.sidebar-foot .label { font-size: 10px; opacity: 0.6; letter-spacing: 1px; text-transform: uppercase; }
.sidebar-foot .val { font-family: 'Instrument Serif', serif; font-size: 28px; margin-top: 4px; position: relative; }
.sidebar-foot .delta { font-size: 11px; color: var(--accent); margin-top: 4px; position: relative; }

/* ── MAIN ────────────────────────────── */
.main { display: flex; flex-direction: column; gap: 24px; z-index: 10; }

.top-bar {
  display: flex; justify-content: space-between; align-items: flex-end;
  padding-bottom: 20px; border-bottom: 1px solid var(--line);
}
.greeting {
  font-family: 'Instrument Serif', serif; font-size: 56px;
  line-height: 1; letter-spacing: -2px;
}
.greeting .italic { color: var(--accent); }
.greeting-sub { color: var(--dim); font-size: 14px; margin-top: 8px; }
.top-actions { display: flex; gap: 8px; align-items: center; }
.top-right { display: flex; align-items: center; gap: 20px; }
.top-clock { display: flex; align-items: center; justify-content: center; }
.clock-digital {
  font-family: 'Instrument Serif', serif; font-size: 42px; letter-spacing: -2px; line-height: 1;
  display: flex; align-items: baseline; gap: 5px; white-space: nowrap;
}
.clock-digital .ampm { font-size: 14px; color: var(--dim); letter-spacing: 0.5px; }
.clock-digital .secs { font-size: 18px; color: var(--dim); font-variant-numeric: tabular-nums; }
.clock-analog { width: 62px; height: 62px; }
.clock-analog .tick { stroke: var(--dim); stroke-width: 1.5; }
.clock-analog .hand-h { stroke: var(--ink); stroke-width: 5; stroke-linecap: round; }
.clock-analog .hand-m { stroke: var(--ink); stroke-width: 3; stroke-linecap: round; }
.clock-analog .hand-s { stroke: var(--accent); stroke-width: 1.5; stroke-linecap: round; }
.clock-analog .face { stroke: var(--ink); stroke-width: 3; fill: none; }
.clock-analog .pin { fill: var(--ink); }

.seg { display: inline-flex; gap: 6px; background: rgba(0,0,0,0.04); border-radius: 30px; padding: 4px; }
.seg .chip { border: none; background: transparent; }
.seg .chip.active { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.icon-btn {
  width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--card);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.2s;
  font-size: 16px; color: var(--ink);
}
.icon-btn:hover { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: linear-gradient(135deg, #ff4a1c, #ff9558);
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 600; font-size: 14px;
}

/* Floating music toggle — fixed bottom-right, visible on every page */
.music-fab {
  position: fixed; bottom: 24px; right: 24px; top: auto; z-index: 56;
  width: auto; height: auto; border-radius: 999px;
  padding: 12px 20px; gap: 10px;
  font-size: 14px; font-weight: 600;
  box-shadow: 0 8px 24px rgba(10,10,10,0.15);
}
.music-fab .icon { font-size: 16px; line-height: 1; }
.music-fab .label { white-space: nowrap; }
.music-fab.playing {
  background: var(--ink); color: var(--bg); border-color: var(--ink);
}
.music-fab.playing:hover { background: var(--accent); border-color: var(--accent); }
.music-fab.disabled { opacity: 0.4; pointer-events: none; }

/* Hero row: 2 big cards */
.hero {
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px;
}

/* Focus card (BIG) */
.focus-card {
  background: var(--ink); color: var(--bg);
  border-radius: 32px; padding: 36px;
  position: relative; overflow: hidden;
  min-height: 340px;
  display: flex; flex-direction: column; justify-content: space-between;
}
.focus-card::before {
  content: ''; position: absolute; top: -100px; right: -100px;
  width: 300px; height: 300px; border-radius: 50%;
  background: radial-gradient(circle, var(--accent), transparent 70%);
  filter: blur(40px); opacity: 0.7;
}
.focus-tag {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11px; letter-spacing: 2px; text-transform: uppercase;
  opacity: 0.6; position: relative;
}
.focus-tag::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.5); }
}
.focus-title {
  font-family: 'Instrument Serif', serif;
  font-size: 64px; line-height: 0.95; letter-spacing: -2px;
  margin: 20px 0; position: relative; max-width: 90%;
}
.focus-title .italic { color: var(--accent); }
.focus-meta {
  display: flex; gap: 32px; position: relative;
  padding-top: 20px; border-top: 1px solid rgba(255,255,255,0.15);
}
.focus-meta .item .label { font-size: 10px; opacity: 0.5; letter-spacing: 1.5px; text-transform: uppercase; }
.focus-meta .item .val { font-family: 'Instrument Serif', serif; font-size: 22px; margin-top: 4px; }

.focus-edit {
  position: absolute; top: 24px; right: 24px;
  background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2);
  color: var(--bg); border-radius: 30px; padding: 8px 14px;
  font-size: 11px; letter-spacing: 1px; text-transform: uppercase;
  cursor: pointer; transition: all 0.2s; z-index: 2;
}
.focus-edit:hover { background: var(--accent); border-color: var(--accent); }
.focus-session {
  margin-left: auto; align-self: flex-end;
  background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2);
  color: var(--bg); border-radius: 30px; padding: 8px 14px;
  font-size: 11px; letter-spacing: 1px; text-transform: uppercase;
  cursor: pointer; transition: all 0.2s;
}
.focus-session:hover { background: var(--accent); border-color: var(--accent); }

/* Weather card */
.weather-card {
  background: linear-gradient(135deg, #ffe8dd 0%, #ffd4b8 100%);
  border-radius: 32px; padding: 32px;
  position: relative; overflow: hidden;
  min-height: 340px;
  display: flex; flex-direction: column;
}
.weather-card::before {
  content: ''; position: absolute; top: 30px; right: 30px;
  width: 90px; height: 90px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #ffd76b, #ff6b1c);
  box-shadow: 0 0 60px rgba(255, 107, 28, 0.5);
}
.weather-location { font-size: 12px; letter-spacing: 2px; text-transform: uppercase; color: var(--ink); opacity: 0.6; }
.weather-temp {
  font-family: 'Instrument Serif', serif;
  font-size: 128px; line-height: 1; letter-spacing: -4px;
  margin-top: 40px;
}
.weather-temp sup { font-size: 40px; vertical-align: super; margin-left: -8px; }
.weather-desc { font-family: 'Instrument Serif', serif; font-style: italic; font-size: 24px; margin-top: 8px; }
.weather-hours { display: flex; gap: 8px; margin-top: auto; }
.weather-hours .h {
  flex: 1; text-align: center; padding: 10px 4px;
  background: rgba(255,255,255,0.4); border-radius: 12px;
  backdrop-filter: blur(8px);
}
.weather-hours .h .t { font-size: 10px; opacity: 0.7; }
.weather-hours .h .v { font-family: 'Instrument Serif', serif; font-size: 18px; margin-top: 2px; }

/* Second row */
.row-2 {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 24px;
}
.card {
  background: var(--card); border-radius: 24px; padding: 24px;
  border: 1px solid var(--line);
  min-height: 220px;
  display: flex; flex-direction: column;
  transition: transform 0.3s ease;
}
.card:hover { transform: translateY(-2px); }
.card-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px;
}
.card-title {
  font-family: 'Instrument Serif', serif; font-size: 22px;
  letter-spacing: -0.5px;
}
.card-title .italic { color: var(--accent); }
.card-more {
  font-size: 11px; color: var(--dim); text-transform: uppercase;
  letter-spacing: 1px; cursor: pointer;
}
.card-more:hover { color: var(--ink); }

/* Habits ring */
.habits { display: flex; align-items: center; gap: 24px; flex: 1; }
.ring { position: relative; width: 120px; height: 120px; flex-shrink: 0; }
.ring svg { transform: rotate(-90deg); }
.ring-c { stroke: var(--line); }
.ring-p { stroke: var(--accent); stroke-linecap: round;
  stroke-dasharray: 314; stroke-dashoffset: 78;
  transition: stroke-dashoffset 1s ease;
}
.ring-val {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Instrument Serif', serif; font-size: 32px;
}
.habits-list { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.habit { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.habit .check {
  width: 18px; height: 18px; border-radius: 6px;
  border: 1.5px solid var(--line); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.2s;
}
.habit.done .check {
  background: var(--ink); border-color: var(--ink); color: var(--bg);
  font-size: 10px;
}
.habit.done .label { text-decoration: line-through; color: var(--dim); }

/* Finance sparkline */
.money { font-family: 'Instrument Serif', serif; font-size: 44px; letter-spacing: -1px; margin-top: 8px; }
.money .cents { font-size: 22px; color: var(--dim); }
.spark { margin-top: 16px; height: 60px; }
.money-meta { display: flex; justify-content: space-between; margin-top: 12px; font-size: 12px; color: var(--dim); }
.money-meta .up { color: #2f7a3d; }
.money-meta .down { color: var(--accent); }

/* Calendar */
.cal-day {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.cal-day:last-child { border: none; }
.cal-time { font-family: 'Instrument Serif', serif; font-style: italic; font-size: 14px; color: var(--dim); width: 60px; }
.cal-bar { width: 3px; height: 24px; border-radius: 2px; background: var(--accent); }
.cal-bar.blue { background: #4a7fff; }
.cal-bar.green { background: #2fbf6c; }
.cal-text { font-size: 13px; font-weight: 500; }
.cal-sub { font-size: 11px; color: var(--dim); margin-top: 2px; }

/* Bottom row */
.row-3 { display: grid; grid-template-columns: 1fr 1.4fr; gap: 24px; }

/* Now playing */
.music-card {
  background: linear-gradient(135deg, #1a1a2e 0%, #2d1b3d 100%);
  color: white;
  border-radius: 24px; padding: 24px;
  position: relative; overflow: hidden;
  display: flex; flex-direction: column;
  min-height: 240px;
}
.music-card::before {
  content: ''; position: absolute; top: -50px; left: -50px;
  width: 200px; height: 200px; border-radius: 50%;
  background: radial-gradient(circle, #ff4a1c, transparent 70%);
  opacity: 0.4; filter: blur(30px);
  animation: float 6s ease-in-out infinite;
}
@keyframes float {
  0%, 100% { transform: translate(0,0); }
  50% { transform: translate(30px, 20px); }
}
.music-label { font-size: 10px; letter-spacing: 3px; text-transform: uppercase; opacity: 0.5; position: relative; }
.music-track { font-family: 'Instrument Serif', serif; font-size: 28px; margin-top: 12px; position: relative; letter-spacing: -0.5px; }
.music-artist { font-size: 13px; opacity: 0.6; margin-top: 4px; position: relative; }
.eq { display: flex; gap: 3px; align-items: end; height: 40px; margin-top: auto; position: relative; }
.eq span {
  flex: 1; background: linear-gradient(to top, #ff4a1c, #ff9558);
  border-radius: 2px;
  animation: eqbar 1s ease-in-out infinite;
}
@keyframes eqbar { 0%,100% { height: 15%; } 50% { height: 100%; } }
.eq.paused span { animation-play-state: paused; }
.eq.paused span { height: 15%; }
.music-controls { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 16px; position: relative; }
.mc-btn {
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.06); color: #fff;
  font-size: 14px; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.2s, transform 0.1s;
}
.mc-btn:hover { background: rgba(255,255,255,0.16); }
.mc-btn:active { transform: scale(0.92); }
.mc-btn:disabled { opacity: 0.35; cursor: default; }
.mc-btn.mc-play {
  width: 48px; height: 48px;
  border: none; background: #ff4a1c; font-size: 17px; box-shadow: 0 4px 18px rgba(255,74,28,0.4);
}
.mc-btn.mc-play:hover { background: #ff5c31; }
.mc-btn.mc-play.autoplay-blocked {
  animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 4px 18px rgba(255,74,28,0.4), 0 0 0 0 rgba(255,74,28,0.6); }
  50% { box-shadow: 0 4px 18px rgba(255,74,28,0.4), 0 0 0 12px rgba(255,74,28,0); }
}
.music-progress {
  height: 3px; background: rgba(255,255,255,0.15); border-radius: 2px;
  margin-top: 16px; position: relative; cursor: pointer;
}
.music-progress::after { content: none; }
.music-progress .mp-fill { display: block; height: 100%; width: 0; background: white; border-radius: 2px; }
.music-time { display: flex; justify-content: space-between; font-size: 11px; opacity: 0.6; margin-top: 6px; position: relative; font-family: monospace; }

/* Reading list */
.reading-list { display: flex; flex-direction: column; gap: 12px; }
.book {
  display: flex; align-items: center; gap: 16px;
  padding: 12px; border-radius: 16px;
  background: rgba(0,0,0,0.02);
  cursor: pointer; transition: all 0.2s;
}
.book:hover { background: rgba(0,0,0,0.05); }
.book-cover {
  width: 44px; height: 60px; border-radius: 6px; flex-shrink: 0;
  background: linear-gradient(135deg, #ff4a1c, #7a1f0a);
}
.book:nth-child(2) .book-cover { background: linear-gradient(135deg, #4a7fff, #1a3a8a); }
.book:nth-child(3) .book-cover { background: linear-gradient(135deg, #2fbf6c, #0f5c34); }
.book-info { flex: 1; }
.book-title { font-family: 'Instrument Serif', serif; font-size: 18px; line-height: 1.2; }
.book-author { font-size: 12px; color: var(--dim); margin-top: 2px; }
.book-progress {
  width: 100%; height: 3px; background: var(--line);
  border-radius: 2px; margin-top: 8px; overflow: hidden;
}
.book-progress span { display: block; height: 100%; background: var(--accent); }

@media (max-width: 1100px) {
  .hero, .row-2, .row-3 { grid-template-columns: 1fr; }
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; }
}

/* ══════════════════════════════════════════════════
   ORBIT APP — added views, forms, auth
   ══════════════════════════════════════════════════ */

.hidden { display: none !important; }
.nav-sheet-backdrop { display: none; }

.view { animation: viewIn 0.4s cubic-bezier(0.16, 1, 0.3, 1); }
#view-today { display: flex; flex-direction: column; gap: 24px; }
@keyframes viewIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* Page head */
.page-head {
  display: flex; justify-content: space-between; align-items: flex-end;
  padding-bottom: 20px; border-bottom: 1px solid var(--line);
  margin-bottom: 24px; gap: 16px; flex-wrap: wrap;
}
.page-title { font-family: 'Instrument Serif', serif; font-size: 44px; letter-spacing: -1px; line-height: 1; }
.page-sub { color: var(--dim); font-size: 13px; margin-top: 6px; }

/* Buttons */
.btn {
  border: none; cursor: pointer; font-family: 'Inter', sans-serif;
  font-size: 13px; font-weight: 600; padding: 12px 18px;
  border-radius: 12px; transition: all 0.2s;
}
.btn-primary { background: var(--ink); color: var(--bg); }
.btn-primary:hover { background: #1f1f1f; }
.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-danger { background: transparent; border: 1px solid rgba(255,74,28,0.35); color: var(--accent); }
.btn-danger:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-sm { padding: 8px 12px; font-size: 12px; border-radius: 9px; }

/* Fields */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: var(--dim); }
.field input, .field select, .field textarea {
  font-family: 'Inter', sans-serif; font-size: 14px; padding: 12px 14px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--bg);
  color: var(--ink); outline: none; transition: border-color 0.2s; width: 100%;
}
.field textarea { resize: vertical; min-height: 120px; line-height: 1.6; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* Empty state */
.empty { text-align: center; color: var(--dim); padding: 40px 16px; font-size: 13px; }
.empty .serif { font-size: 24px; display: block; margin-bottom: 6px; color: var(--ink); }

/* Chips / filters */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.chip {
  border: 1px solid var(--line); background: transparent; color: var(--dim);
  padding: 8px 14px; border-radius: 30px; font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all 0.2s; font-family: 'Inter', sans-serif;
}
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip.active { background: var(--ink); border-color: var(--ink); color: var(--bg); }

/* ── Auth screen ── */
.auth-screen {
  min-height: calc(100vh - 48px);
  display: grid; place-items: center;
  position: relative;
}

/* Shown briefly on load/refresh while we check the session, so the
   login screen never flashes for an already-logged-in user. */
.boot-loader {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
}
.boot-loader .dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 6px rgba(255, 74, 28, 0.15);
  animation: bootPulse 1s ease-in-out infinite;
}
@keyframes bootPulse {
  0%, 100% { transform: scale(0.85); opacity: 0.7; }
  50% { transform: scale(1.15); opacity: 1; }
}
.auth-brand {
  font-family: 'Instrument Serif', serif; font-size: 44px; letter-spacing: -1px;
  display: flex; align-items: baseline; gap: 6px; margin-bottom: 8px;
}
.auth-brand .dot {
  width: 10px; height: 10px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 3px rgba(255,74,28,0.15);
}
.auth-sub { font-size: 12px; color: var(--dim); letter-spacing: 1px; text-transform: uppercase; margin-bottom: 32px; }
.auth-card {
  width: min(430px, 100%); background: var(--card); border: 1px solid var(--line);
  border-radius: 32px; padding: 40px; text-align: center;
  box-shadow: 0 24px 60px rgba(10,10,10,0.06);
}
.auth-tabs { display: flex; gap: 8px; margin-bottom: 28px; }
.auth-tab {
  flex: 1; padding: 10px; border-radius: 10px; text-align: center;
  font-size: 13px; font-weight: 600; cursor: pointer; color: var(--dim); transition: all 0.2s;
}
.auth-tab.active { background: var(--ink); color: var(--bg); }
.auth-form { text-align: left; }
.auth-err { color: var(--accent); font-size: 12px; margin-top: 12px; min-height: 16px; text-align: left; }
.auth-form .btn { width: 100%; }
.auth-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 22px 0; color: var(--dim); font-size: 11px;
  text-transform: uppercase; letter-spacing: 1px;
}
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.btn-google {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--card); color: var(--ink); border: 1px solid var(--line);
}
.btn-google:hover { border-color: var(--ink); background: rgba(0,0,0,0.02); }
.btn-google:disabled { opacity: 0.6; cursor: default; }

/* ── Calendar view ── */
.cal-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.cal-month-label { font-family: 'Instrument Serif', serif; font-size: 26px; letter-spacing: -0.5px; }
.cal-nav .icon-btn { width: 36px; height: 36px; font-size: 18px; }
.cal-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-weekday { text-align: center; font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--dim); padding: 4px 0; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 6px; }
.cal-cell {
  min-height: 68px; border: 1px solid var(--line); border-radius: 12px;
  padding: 6px 8px; cursor: pointer; transition: all 0.2s; background: var(--card);
}
.cal-cell:hover { border-color: var(--ink); }
.cal-cell.other { opacity: 0.32; }
.cal-cell.today { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.cal-cell.today .cal-cell-num { color: var(--accent); }
.cal-cell.selected { outline: 2px solid var(--accent); }
.cal-cell-num { font-size: 12px; font-weight: 600; }
.cal-cell-dots { display: flex; gap: 3px; margin-top: 8px; flex-wrap: wrap; }
.cal-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.cal-dot.blue { background: #4a7fff; }
.cal-dot.green { background: #2fbf6c; }
.cal-events-scroll { max-height: 320px; overflow: auto; }

/* ── Tasks view ── */
.task-item { display: flex; align-items: center; gap: 14px; padding: 16px 4px; border-bottom: 1px solid var(--line); }
.task-item:last-child { border-bottom: none; }
.task-check {
  width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--line);
  cursor: pointer; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  font-size: 11px; transition: all 0.2s;
}
.task-check:hover { border-color: var(--ink); }
.task-item.done .task-check { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.task-item.done .task-title { text-decoration: line-through; color: var(--dim); }
.task-title { flex: 1; font-size: 14px; font-weight: 500; }
.task-meta { display: flex; align-items: center; gap: 10px; }
.task-due { font-size: 11px; color: var(--dim); }
.pri {
  font-size: 10px; padding: 3px 8px; border-radius: 6px;
  text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600;
}
.pri.high { background: rgba(255,74,28,0.12); color: var(--accent); }
.pri.medium { background: rgba(74,127,255,0.12); color: #3a66cc; }
.pri.low { background: rgba(0,0,0,0.06); color: var(--dim); }
.icon-del {
  background: none; border: none; color: var(--dim); cursor: pointer;
  font-size: 16px; opacity: 0; transition: all 0.2s; padding: 4px;
}
.task-item:hover .icon-del, .tx-item:hover .icon-del { opacity: 1; }
.icon-del:hover { color: var(--accent); }
.task-edit { background: none; border: none; color: var(--dim); cursor: pointer; font-size: 13px; opacity: 0; transition: all 0.2s; }
.task-item:hover .task-edit, .tx-item:hover .task-edit { opacity: 1; }
.task-edit:hover { color: var(--ink); }

/* ── Habits view ── */
.habit-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 24px;
  padding: 24px; display: flex; align-items: center; gap: 18px; transition: all 0.3s ease;
}
.habit-card:hover { transform: translateY(-2px); }
.check-big {
  width: 46px; height: 46px; border-radius: 50%; border: 2px solid var(--line); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  font-size: 18px; transition: all 0.2s; color: var(--bg);
}
.check-big:hover { border-color: var(--ink); }
.habit-card.done .check-big { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.habit-card.done .habit-name { text-decoration: line-through; color: var(--dim); }
.habit-name { font-family: 'Instrument Serif', serif; font-size: 24px; letter-spacing: -0.5px; }
.habit-streak { font-size: 11px; color: var(--dim); margin-top: 4px; }
.habit-del {
  margin-left: auto; background: none; border: none; color: var(--dim);
  cursor: pointer; font-size: 15px; opacity: 0; transition: all 0.2s;
}
.habit-card:hover .habit-del { opacity: 1; }
.habit-del:hover { color: var(--accent); }
.habit-week { display: flex; gap: 10px; align-items: flex-end; min-height: 140px; }
.hw-day { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.hw-bar-wrap { height: 110px; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.hw-bar { width: 60%; border-radius: 8px 8px 0 0; background: var(--ink); position: relative; transition: height 0.6s cubic-bezier(0.16,1,0.3,1); }
.hw-bar.has { background: var(--accent); }
.hw-label { font-size: 10px; color: var(--dim); text-transform: uppercase; letter-spacing: 1px; }

/* ── Finance view ── */
.stat-box { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.stat-label { font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--dim); }
.stat-val { font-family: 'Instrument Serif', serif; font-size: 40px; letter-spacing: -1px; }
.tx-item { display: flex; align-items: center; gap: 14px; padding: 14px 4px; border-bottom: 1px solid var(--line); }
.tx-item:last-child { border-bottom: none; }
.tx-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.tx-dot.income { background: #2fbf6c; }
.tx-dot.expense { background: var(--accent); }
.tx-main { flex: 1; min-width: 0; }
.tx-title { font-size: 13px; font-weight: 500; }
.tx-sub { font-size: 11px; color: var(--dim); margin-top: 2px; }
.tx-amount { font-weight: 600; font-size: 14px; font-variant-numeric: tabular-nums; }
.tx-amount.income { color: #2f7a3d; }
.tx-amount.expense { color: var(--accent); }
.tx-list-scroll { max-height: 420px; overflow: auto; }
.cat-bar { margin-bottom: 12px; }
.cat-row { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 6px; color: var(--dim); }
.cat-track { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.cat-fill { height: 100%; background: var(--accent); border-radius: 3px; }

/* ── Journal view ── */
.journal-item { padding: 14px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
.journal-item:last-child { border-bottom: none; }
.journal-item:hover { opacity: 0.7; }
.journal-item.active { background: rgba(0,0,0,0.03); border-radius: 12px; padding-left: 12px; }
.journal-date { font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: 1px; }
.journal-title { font-family: 'Instrument Serif', serif; font-size: 20px; margin-top: 4px; }
.journal-preview { font-size: 12px; color: var(--dim); margin-top: 4px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.journal-scroll { max-height: 460px; overflow: auto; }
.mood-pill { font-size: 11px; padding: 3px 10px; border-radius: 30px; background: rgba(0,0,0,0.05); color: var(--dim); }

/* ── Library view ── */
.book-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.book-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 24px;
  padding: 24px; display: flex; gap: 18px; transition: all 0.3s ease;
}
.book-card:hover { transform: translateY(-2px); }
.book-cover-lg {
  width: 64px; height: 88px; border-radius: 8px; flex-shrink: 0;
  background: linear-gradient(135deg, #ff4a1c, #7a1f0a);
}
.book-card:nth-child(3n+2) .book-cover-lg { background: linear-gradient(135deg, #4a7fff, #1a3a8a); }
.book-card:nth-child(3n+3) .book-cover-lg { background: linear-gradient(135deg, #2fbf6c, #0f5c34); }
.book-card-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.book-card-title { font-family: 'Instrument Serif', serif; font-size: 20px; line-height: 1.15; }
.book-card-author { font-size: 12px; color: var(--dim); margin-top: 2px; }
.book-progress { margin-top: auto; padding-top: 12px; }
.book-progress .bp-top { display: flex; justify-content: space-between; font-size: 11px; color: var(--dim); margin-bottom: 6px; }
.book-actions { display: flex; gap: 8px; margin-top: 12px; }
.status-pill { font-size: 10px; padding: 3px 10px; border-radius: 30px; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; width: fit-content; }
.status-pill.reading { background: rgba(74,127,255,0.12); color: #3a66cc; }
.status-pill.finished { background: rgba(47,191,108,0.14); color: #2f7a3d; }
.status-pill.toread { background: rgba(0,0,0,0.06); color: var(--dim); }

/* ── Settings view ── */
.settings-stat { text-align: center; padding: 20px 8px; background: rgba(0,0,0,0.02); border-radius: 16px; }
.settings-stat .v { font-family: 'Instrument Serif', serif; font-size: 40px; letter-spacing: -1px; }
.settings-stat .l { font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: 1px; margin-top: 4px; }

/* ── Modal ── */
.modal {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center;
  background: rgba(10,10,10,0.5); backdrop-filter: blur(4px); padding: 24px;
}
.modal-box {
  background: var(--bg); border: 1px solid var(--line); border-radius: 28px;
  padding: 32px; width: min(520px, 100%); max-height: 86vh; overflow: auto;
  animation: viewIn 0.3s cubic-bezier(0.16,1,0.3,1);
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-title { font-family: 'Instrument Serif', serif; font-size: 26px; letter-spacing: -0.5px; }
.modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--dim); }

/* Search */
.search-input {
  width: 100%; font-family: 'Inter', sans-serif; font-size: 16px;
  padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); outline: none; transition: border-color 0.2s;
  margin-bottom: 12px;
}
.search-input:focus { border-color: var(--accent); }
.search-results { max-height: 320px; overflow: auto; }
.search-item {
  display: flex; flex-direction: column; gap: 2px;
  padding: 12px 14px; border-radius: 12px; cursor: pointer; transition: background 0.15s;
}
.search-item:hover { background: rgba(0,0,0,0.04); }
.search-kind { font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: var(--dim); }
.search-label { font-size: 14px; font-weight: 500; }

/* Toast */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(24px);
  background: var(--ink); color: var(--bg); padding: 12px 22px; border-radius: 12px;
  font-size: 13px; z-index: 99; opacity: 0; pointer-events: none; transition: all 0.3s;
  box-shadow: 0 12px 30px rgba(10,10,10,0.2);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Admin */
.admin-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.admin-stat { padding: 18px; min-height: auto; }
.admin-stat-v { font-family: 'Instrument Serif', serif; font-size: 32px; letter-spacing: -0.5px; }
.admin-stat-l { font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: 1px; margin-top: 4px; }
.admin-users { margin-top: 16px; }
.admin-user {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 14px 6px; border-bottom: 1px solid var(--line);
}
.admin-user:last-child { border-bottom: none; }
.au-main { flex: 1; min-width: 220px; }
.au-name { font-weight: 600; font-size: 14px; }
.au-email { color: var(--dim); font-weight: 400; }
.au-meta { font-size: 12px; color: var(--dim); margin-top: 3px; }
.au-counts { font-size: 12px; color: var(--dim); max-width: 340px; line-height: 1.5; }
.au-actions { display: flex; gap: 8px; }
.admin-detail { max-height: 62vh; overflow: auto; padding-right: 6px; }
.admin-detail h4 {
  font-size: 11px; letter-spacing: 2px; text-transform: uppercase; opacity: 0.5;
  margin: 18px 0 6px;
}
.admin-detail .dim { font-size: 12px; color: var(--dim); }
.admin-detail-sub { font-size: 12px; color: var(--dim); }
.ad-row {
  display: flex; gap: 12px; justify-content: space-between;
  font-size: 13px; padding: 6px 0; border-bottom: 1px dashed var(--line);
}
.ad-row span:nth-child(2) { flex: 1; }
.ad-row span:last-child { text-align: right; color: var(--dim); white-space: nowrap; }
html[data-theme="dark"] .ad-row { border-color: rgba(255,255,255,0.08); }

/* misc */
.row-2.cols-2 { grid-template-columns: 1fr 1fr; }
.row-2.cols-2eq { grid-template-columns: 1fr 1fr; }
.icon-btn { font-family: 'Inter', sans-serif; }

@media (max-width: 1100px) {
  .book-grid { grid-template-columns: repeat(2, 1fr); }
  .row-2.cols-2eq { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .book-grid { grid-template-columns: 1fr; }
  .page-title { font-size: 34px; }
  .focus-title { font-size: 44px; }
  .cal-cell { min-height: 52px; }
  .clock-analog { width: 46px; height: 46px; }
}

/* ══════════════════════════════════════════════════
   ORBIT — PWA install banner + mobile layout
   ══════════════════════════════════════════════════ */

/* Install prompt banner */
.install-banner {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px;
  background: var(--ink); color: var(--bg);
  padding: 12px 16px; border-radius: 18px; z-index: 65;
  box-shadow: 0 16px 40px rgba(0,0,0,0.25);
  max-width: min(92vw, 430px);
  animation: viewIn 0.3s cubic-bezier(0.16,1,0.3,1);
}
.install-banner .ib-icon { width: 46px; height: 46px; border-radius: 12px; flex-shrink: 0; }
.install-banner .ib-text { flex: 1; min-width: 0; }
.install-banner .ib-title { font-weight: 600; font-size: 14px; }
.install-banner .ib-sub { font-size: 12px; opacity: 0.7; margin-top: 2px; line-height: 1.4; }
.install-banner .ib-actions { display: flex; gap: 8px; flex-shrink: 0; }
.install-banner .btn { background: var(--accent); color: #fff; border: none; white-space: nowrap; }
.install-banner .btn-ghost { background: transparent; border: 1px solid rgba(255,255,255,0.3); color: var(--bg); }
.install-banner .btn-ghost:hover { border-color: #fff; }

@media (max-width: 760px) {
  body { padding: 14px 14px 0; }
  .app { gap: 12px; }
  .main { padding-top: 4px; padding-bottom: calc(88px + env(safe-area-inset-bottom)); }

  /* Sidebar becomes a fixed BOTTOM tab bar */
  .sidebar {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto;
    z-index: 55; background: var(--bg); border-top: 1px solid var(--line);
    padding: 4px 4px calc(6px + env(safe-area-inset-bottom));
    box-shadow: 0 -6px 24px rgba(10,10,10,0.06);
  }
  .brand, .brand-sub, .sidebar-foot { display: none; }
  .nav { flex-direction: row; justify-content: space-around; gap: 0; }
  .nav-item {
    flex-direction: column; gap: 3px; padding: 8px 6px 6px; font-size: 9px;
    border-radius: 14px; flex: 1; text-align: center; min-width: 0;
  }
  .nav-item:active { background: rgba(0,0,0,0.06); }
  .nav-item .num { display: none; }
  .nav-item .icon {
    display: block; font-size: 20px; line-height: 1; font-style: normal;
    color: var(--dim);
  }
  .nav-item.active .icon { color: var(--accent); }
  .nav-item .label { font-size: 10px; font-weight: 600; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .nav-item .badge {
    position: absolute; top: 2px; right: calc(50% - 22px);
    margin: 0; font-size: 8px; padding: 1px 5px;
  }
  /* Collapse the extra items into the "More" sheet to fit the bottom bar */
  .nav-item.nav-extra { display: none; }
  .nav-more { position: relative; display: flex; }

  /* Dim backdrop behind the More sheet */
  .nav-sheet-backdrop {
    display: block; position: fixed; inset: 0; z-index: 58;
    background: rgba(10,10,10,0.45); backdrop-filter: blur(2px);
  }

  /* "More" sheet slides up from the bottom, above the tab bar */
  .nav-dropdown {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto;
    margin: 0; padding: 8px 8px calc(14px + env(safe-area-inset-bottom));
    border-radius: 24px 24px 0 0; max-height: 65vh; overflow-y: auto;
    z-index: 59; background: var(--bg); border: 1px solid var(--line); border-bottom: none;
    box-shadow: 0 -20px 50px rgba(10,10,10,0.25);
    animation: viewIn 0.25s cubic-bezier(0.16,1,0.3,1);
  }
  .nav-dropdown::before {
    content: ''; display: block; width: 40px; height: 4px; border-radius: 2px;
    background: var(--line); margin: 4px auto 12px;
  }
  .nav-dropdown-item {
    display: flex; align-items: center; gap: 14px;
    padding: 16px 14px; font-size: 15px; font-weight: 500;
    border-radius: 14px; border-bottom: none;
  }
  .nav-dropdown-item .icon { font-size: 18px; width: 22px; text-align: center; color: var(--dim); flex-shrink: 0; }
  .nav-dropdown-item:hover, .nav-dropdown-item:active { background: rgba(0,0,0,0.05); }
  .nav-dropdown-item.active .icon { color: var(--accent); }

  /* Focus card mobile — stack the +session button below the stats
     instead of squeezing it into the same row */
  .focus-card { padding: 26px; min-height: auto; }
  .focus-title { font-size: 34px; max-width: 100%; }
  .focus-edit { top: 18px; right: 18px; padding: 6px 12px; }
  .focus-meta { flex-wrap: wrap; row-gap: 16px; column-gap: 20px; }
  .focus-meta .item { flex: 1 1 auto; min-width: 70px; }
  .focus-session {
    flex-basis: 100%; margin-left: 0; align-self: stretch;
    text-align: center; white-space: nowrap;
  }

  /* Music card mobile */
  .music-card { padding: 20px; min-height: 200px; }
  .music-track { font-size: 24px; }
  .mc-btn { width: 42px; height: 42px; font-size: 15px; }
  .mc-btn.mc-play { width: 56px; height: 56px; font-size: 20px; }
  .eq { height: 30px; }

  .top-bar { flex-direction: column; align-items: stretch; flex-wrap: nowrap; gap: 12px; padding-bottom: 16px; }
  .greeting { font-size: 34px; }
  .top-right { width: 100%; justify-content: space-between; gap: 12px; }
  .top-clock { flex: 1; justify-content: flex-start; overflow: hidden; }
  .clock-digital { font-size: 32px; }
  .clock-digital .ampm { font-size: 15px; }
  .clock-digital .secs { font-size: 18px; }
  #btnSearch { display: none; }
  .icon-btn, .avatar { width: 36px; height: 36px; }
  .music-fab {
    top: auto; bottom: calc(96px + env(safe-area-inset-bottom)); right: 14px;
    padding: 10px 14px; font-size: 12px; gap: 6px;
  }
  .music-fab .icon { font-size: 14px; }

  .page-title { font-size: 32px; }
  .row-2.cols-2 { grid-template-columns: 1fr; }

  .modal { padding: 12px; }
  .modal-box { padding: 22px 18px; }

  .install-banner {
    left: 12px; right: 12px; bottom: calc(78px + env(safe-area-inset-bottom));
    transform: none; max-width: none; flex-wrap: wrap;
  }
  .install-banner .ib-actions { margin-left: auto; }
}

@media (max-width: 480px) {
  .auth-card { padding: 28px 22px; border-radius: 24px; }
  .weather-card { padding: 24px; min-height: 280px; }
  .music-card { padding: 20px; }
  .clock-digital { font-size: 26px; }
  .clock-digital .secs { display: none; }
  .icon-btn, .avatar { width: 38px; height: 38px; }
  .admin-user { padding: 12px 2px; }
  .admin-stat-v { font-size: 26px; }
  .cal-cell { padding: 4px 4px; border-radius: 8px; }
  .cal-cell-num { font-size: 10px; }
  .cal-cell-dots { gap: 2px; margin-top: 4px; }
  .cal-dot { width: 4px; height: 4px; }
}
