/* ============================================================
   JOHNY OS LITE — Hand-Drawn Style Redesign v2
   Fixes: sidebar width, font readability, line-height, card fonts
   New:   layered animated background (floating shapes + particles)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Caveat:wght@400;600;700&family=Inter:wght@400;500;600&family=Noto+Sans+Thai:wght@400;500;600&display=swap');

/* ============================================================
   DESIGN TOKENS
   ============================================================ */
:root {
  color-scheme: light;
  --bg:              #f5f0e8;
  --surface:         #fdfaf4;
  --surface-raised:  #fffef9;
  --surface-soft:    #eee8d8;
  --ink:             #1a1814;
  --ink-muted:       #6b6357;
  --ink-faint:       #b0a898;
  --line:            #c8bfae;
  --line-soft:       #ddd6c8;
  --primary:         #2d6a4f;
  --primary-light:   #52b788;
  --primary-soft:    #d8f3dc;
  --accent:          #c1440e;
  --accent-soft:     #fde8df;
  --amber:           #9a6b00;
  --blue:            #2655a0;
  --shadow-sketch:   4px 4px 0 #c8bfae;
  --shadow-sketch-sm: 2px 2px 0 #c8bfae;
  --shadow-hover:    6px 6px 0 #b0a898;
  --radius-sm:  10px;
  --radius-md:  16px;
  --radius-lg:  22px;
  --radius-xl:  30px;
  --font-hand:  'Caveat', cursive;
  --font-body:  Inter, 'Noto Sans Thai', ui-sans-serif, system-ui, sans-serif;
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out:    cubic-bezier(0.22, 1, 0.36, 1);
  --t-fast: 140ms;
  --t-mid:  260ms;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg:              #141210;
  --surface:         #1e1c18;
  --surface-raised:  #252219;
  --surface-soft:    #2a2720;
  --ink:             #f0ebe0;
  --ink-muted:       #a89e8e;
  --ink-faint:       #6a6058;
  --line:            #3c3830;
  --line-soft:       #302d25;
  --primary:         #74c69d;
  --primary-light:   #95d5b2;
  --primary-soft:    #1b3d2a;
  --accent:          #f08060;
  --accent-soft:     #3d1c0f;
  --amber:           #e6c060;
  --blue:            #7ba8ee;
  --shadow-sketch:   4px 4px 0 #0a0907;
  --shadow-sketch-sm: 2px 2px 0 #0a0907;
  --shadow-hover:    6px 6px 0 #050403;
}

/* ============================================================
   RESET
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { text-decoration: none; }
h1, h2, h3, p { margin: 0; }

/* ============================================================
   BACKGROUND — dot grid + animated canvas layer
   ============================================================ */
body {
  min-height: 100vh;
  background-color: var(--bg);
  background-image: radial-gradient(circle, var(--line-soft) 1px, transparent 1px);
  background-size: 24px 24px;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.65;
}

/* Canvas sits behind everything */
#bg-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.55;
}

[data-theme="dark"] #bg-canvas { opacity: 0.35; }

.app-shell {
  position: relative;
  z-index: 1;
}

/* ============================================================
   APP SHELL
   ============================================================ */
.app-shell {
  display: grid;
  /* FIX 1: sidebar narrower — 13.5rem instead of 17rem */
  grid-template-columns: 13.5rem minmax(0, 1fr);
  min-height: 100vh;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  /* FIX 1b: tighter padding to match smaller width */
  padding: 1.25rem 1rem;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(16px);
  border-right: 2px solid var(--line);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1.75rem;
  padding-bottom: 1rem;
  border-bottom: 2px dashed var(--line);
}

.brand-mark {
  width: 2.5rem;
  height: 2.5rem;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: var(--radius-md);
  background: var(--primary);
  color: #fff;
  font-family: var(--font-hand);
  font-size: 1.4rem;
  font-weight: 700;
  border: 2px solid var(--ink);
  box-shadow: var(--shadow-sketch-sm);
  animation: brand-pop 0.6s var(--ease-spring) both;
}

@keyframes brand-pop {
  0%   { transform: scale(0) rotate(-15deg); opacity: 0; }
  100% { transform: scale(1) rotate(0deg);   opacity: 1; }
}

.brand strong {
  display: block;
  font-family: var(--font-hand);
  font-size: 1.05rem;
  font-weight: 700;
}

.brand span {
  display: block;
  /* FIX 2: smaller subtitle, Inter not Caveat */
  font-family: var(--font-body);
  font-size: 0.72rem;
  color: var(--ink-muted);
}

.nav-list {
  display: grid;
  gap: 0.35rem;
  flex: 1;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  /* FIX 1c: compact nav padding */
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-md);
  border: 1.5px solid transparent;
  color: var(--ink-muted);
  /* FIX 3: body font for nav, not Caveat */
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 500;
  transition:
    color var(--t-fast) var(--ease-out),
    background var(--t-fast) var(--ease-out),
    border-color var(--t-fast) var(--ease-out),
    transform var(--t-fast) var(--ease-spring),
    box-shadow var(--t-fast) var(--ease-out);
}

.nav-link[data-view="dashboard"]::before { content: "⊞"; font-size: 0.95rem; }
.nav-link[data-view="tasks"]::before     { content: "✓"; font-size: 0.95rem; }
.nav-link[data-view="notes"]::before     { content: "✎"; font-size: 0.95rem; }
.nav-link[data-view="expenses"]::before  { content: "฿"; font-size: 0.95rem; }
.nav-link[data-view="secretary"]::before { content: "✦"; font-size: 0.85rem; }

.nav-link:hover {
  color: var(--ink);
  background: var(--surface-soft);
  border-color: var(--line);
  transform: translateX(3px);
}

.nav-link.active {
  color: var(--primary);
  background: var(--primary-soft);
  border-color: var(--primary-light);
  box-shadow: var(--shadow-sketch-sm);
  font-weight: 600;
}

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.55rem 0.9rem;
  margin-top: 1rem;
  border-radius: var(--radius-md);
  border: 1.5px dashed var(--line);
  background: var(--surface-soft);
  color: var(--ink-muted);
  font-family: var(--font-body);
  font-size: 0.84rem;
  transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast) var(--ease-spring);
}

.theme-toggle:hover {
  transform: translateY(-2px);
  color: var(--ink);
  background: var(--surface);
}

/* ============================================================
   WORKSPACE
   ============================================================ */
.workspace {
  width: min(100%, 82rem);
  margin: 0 auto;
  padding: 2.5rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 2.25rem;
}

.eyebrow {
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-muted);
  margin-bottom: 0.3rem;
}

h1 {
  font-family: var(--font-hand);
  font-size: 3.6rem;
  font-weight: 700;
  line-height: 0.95;
  animation: slide-down 0.5s var(--ease-out) both;
}

@keyframes slide-down {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* FIX 2: today-card — larger, more readable text */
.today-card {
  min-width: 14rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-lg);
  border: 2px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-sketch);
  animation: slide-down 0.5s 0.1s var(--ease-out) both;
}

.today-card span {
  display: block;
  /* FIX 2a: bigger label text */
  font-family: var(--font-body);
  font-size: 0.82rem;
  color: var(--ink-muted);
  margin-bottom: 0.3rem;
}

.today-card strong {
  display: block;
  font-family: var(--font-hand);
  /* FIX 2b: bigger bold text */
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.2;
}

/* VIEW SWITCHING */
.view { display: none; }
.view.active {
  display: block;
  animation: view-in 0.4s var(--ease-out) both;
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   SHARED CARD BASE
   ============================================================ */
.today-card,
.stat-card,
.panel,
.composer,
.note-editor,
.quick-card,
.dashboard-hero,
.list-item,
.empty-state {
  border-radius: var(--radius-lg);
  border: 2px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-sketch);
  transition:
    box-shadow var(--t-fast) var(--ease-out),
    transform var(--t-fast) var(--ease-spring);
}

.stat-card:hover,
.panel:hover,
.quick-card:hover,
.list-item:hover {
  box-shadow: var(--shadow-hover);
  transform: translate(-1px, -1px);
}

/* ============================================================
   HERO
   ============================================================ */
.dashboard-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(16rem, 0.75fr);
  gap: 1.5rem;
  align-items: stretch;
  margin-bottom: 1.5rem;
  padding: 2rem;
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--primary-soft) 55%, var(--surface)) 0%,
    var(--surface) 100%);
  position: relative;
  overflow: hidden;
}

/* Decorative spinning rings — keep from original */
.dashboard-hero::before,
.dashboard-hero::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  border: 2px dashed var(--primary-light);
  opacity: 0.22;
  pointer-events: none;
}

.dashboard-hero::before {
  width: 260px; height: 260px;
  top: -60px; right: -60px;
  animation: spin-slow 40s linear infinite;
}

.dashboard-hero::after {
  width: 140px; height: 140px;
  bottom: -40px; right: 80px;
  animation: spin-slow 28s linear infinite reverse;
}

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

.hero-kicker,
.section-label {
  display: inline-block;
  /* FIX 3: body font for labels */
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1.5px solid var(--primary-light);
  border-radius: 999px;
  padding: 0.2rem 0.75rem;
  margin-bottom: 0.25rem;
}

.hero-copy {
  display: grid;
  align-content: center;
  gap: 1rem;
  position: relative;
  z-index: 1;
}

.hero-copy h2 {
  font-family: var(--font-hand);
  font-size: 2.3rem;
  line-height: 1.1;
  max-width: 34rem;
}

.hero-copy p {
  /* FIX 5: body font + proper line-height */
  font-family: var(--font-body);
  color: var(--ink-muted);
  font-size: 0.9rem;
  line-height: 1.85;
  max-width: 36rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.25rem;
}

.primary-action,
.secondary-action {
  min-height: 2.75rem;
  padding: 0 1.25rem;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9rem;
  border: 2px solid;
  transition: transform var(--t-fast) var(--ease-spring), box-shadow var(--t-fast) var(--ease-out);
}

.primary-action {
  background: var(--primary);
  border-color: var(--ink);
  color: #fff;
  box-shadow: var(--shadow-sketch-sm);
}

.primary-action:hover {
  transform: translate(-2px, -2px);
  box-shadow: var(--shadow-sketch);
}

.secondary-action {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
  box-shadow: var(--shadow-sketch-sm);
}

.secondary-action:hover {
  transform: translate(-2px, -2px);
  box-shadow: var(--shadow-sketch);
}

.hero-preview {
  display: grid;
  gap: 0.85rem;
  min-height: 14rem;
  position: relative;
  z-index: 1;
}

.preview-card, .preview-stack {
  border: 2px solid var(--line);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  box-shadow: var(--shadow-sketch-sm);
}

.primary-preview {
  display: grid;
  align-content: end;
  padding: 1.15rem;
}

.preview-card span, .preview-stack span {
  /* FIX 3: body font in preview */
  font-family: var(--font-body);
  color: var(--ink-muted);
  font-size: 0.8rem;
}

.preview-card strong {
  display: block;
  font-family: var(--font-hand);
  margin-top: 0.4rem;
  font-size: 1.3rem;
  line-height: 1.2;
}

.preview-stack {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  padding: 0.75rem;
}

.preview-stack span {
  display: grid;
  min-height: 3rem;
  place-items: center;
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  border: 1.5px solid var(--line-soft);
  /* FIX 3: body font, not Caveat */
  font-family: var(--font-body);
  font-size: 0.84rem;
  transition: transform var(--t-fast) var(--ease-spring);
}

.preview-stack span:hover { transform: translateY(-3px); }

/* ============================================================
   QUICK START GRID
   ============================================================ */
.quick-start-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.quick-card {
  display: grid;
  gap: 0.4rem;
  min-height: 8.5rem;
  padding: 1.25rem;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
  animation: card-rise 0.5s var(--ease-spring) both;
}

.quick-card:nth-child(1) { animation-delay: 0.08s; }
.quick-card:nth-child(2) { animation-delay: 0.16s; }
.quick-card:nth-child(3) { animation-delay: 0.24s; }

@keyframes card-rise {
  from { opacity: 0; transform: translateY(20px) rotate(-1deg); }
  to   { opacity: 1; transform: translateY(0) rotate(0); }
}

.quick-card span {
  font-family: var(--font-hand);
  color: var(--primary);
  font-size: 1rem;
  font-weight: 700;
}

/* FIX 4: quick card title bigger */
.quick-card strong {
  font-family: var(--font-hand);
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.15;
}

/* FIX 4b: quick card description — body font, bigger */
.quick-card small {
  font-family: var(--font-body);
  color: var(--ink-muted);
  font-size: 0.86rem;
  line-height: 1.55;
}

/* ============================================================
   STATS GRID
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  padding: 1.3rem;
  animation: card-rise 0.5s var(--ease-spring) both;
}

.stat-card:nth-child(1) { animation-delay: 0.05s; }
.stat-card:nth-child(2) { animation-delay: 0.10s; }
.stat-card:nth-child(3) { animation-delay: 0.15s; }
.stat-card:nth-child(4) { animation-delay: 0.20s; }

/* FIX 3: stat labels — body font */
.stat-card span {
  display: block;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.5rem;
}

/* Numbers stay Caveat — they're meant to be big & hand-drawn */
.stat-card strong {
  display: block;
  font-family: var(--font-hand);
  font-size: 2.6rem;
  font-weight: 700;
  line-height: 1;
  animation: number-pop 0.5s var(--ease-spring) both;
}

@keyframes number-pop {
  from { opacity: 0; transform: scale(0.7); }
  to   { opacity: 1; transform: scale(1); }
}

/* ============================================================
   DASHBOARD GRID
   ============================================================ */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}

.wide { grid-column: 1 / -1; }

/* ============================================================
   PANEL
   ============================================================ */
.panel { padding: 1.4rem; }

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.1rem;
  padding-bottom: 0.85rem;
  border-bottom: 2px dashed var(--line-soft);
}

/* FIX 5: panel h2 — body font, smaller, tighter */
.panel h2,
.panel-head h2 {
  font-family: var(--font-body);
  font-size: 0.97rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
}

/* Section labels (PRIORITY QUEUE etc) */
.section-label {
  margin-bottom: 0.2rem;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.ghost-button,
.chip,
button[type="submit"],
.empty-action {
  min-height: 2.3rem;
  padding: 0 0.85rem;
  border-radius: var(--radius-md);
  border: 2px solid var(--line);
  background: var(--surface-soft);
  color: var(--ink-muted);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.84rem;
  transition:
    transform var(--t-fast) var(--ease-spring),
    box-shadow var(--t-fast) var(--ease-out),
    background var(--t-fast),
    color var(--t-fast);
}

.ghost-button:hover, .chip:hover {
  transform: translate(-1px, -2px);
  box-shadow: var(--shadow-sketch-sm);
  background: var(--surface);
  color: var(--ink);
}

.chip.active,
button[type="submit"],
.empty-action {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-sketch-sm);
}

.chip.active:hover,
button[type="submit"]:hover,
.empty-action:hover {
  transform: translate(-2px, -2px);
  box-shadow: var(--shadow-sketch);
}

button:active {
  transform: translate(1px, 1px) !important;
  box-shadow: 1px 1px 0 var(--line) !important;
}

/* ============================================================
   FORMS
   ============================================================ */
.composer {
  display: grid;
  grid-template-columns: minmax(12rem, 1fr) 9rem 9rem 7rem;
  gap: 0.75rem;
  padding: 1.1rem;
  margin-bottom: 1rem;
}

.note-editor {
  display: grid;
  gap: 0.75rem;
  padding: 1.1rem;
  margin-bottom: 1rem;
}

input, select, textarea {
  width: 100%;
  border: 2px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  color: var(--ink);
  font-family: var(--font-body);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

input, select {
  min-height: 2.6rem;
  padding: 0 0.85rem;
}

textarea {
  resize: vertical;
  padding: 0.75rem 0.9rem;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent);
}

/* ============================================================
   TOOLBAR
   ============================================================ */
.toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.editor-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

/* ============================================================
   ITEM LIST
   ============================================================ */
.item-list {
  display: grid;
  /* FIX 5: more breathing room between items */
  gap: 0.85rem;
  min-height: 3rem;
}

.list-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  padding: 1rem 1.1rem;
  animation: item-in 0.35s var(--ease-spring) both;
}

@keyframes item-in {
  from { opacity: 0; transform: translateX(-10px); }
  to   { opacity: 1; transform: translateX(0); }
}

.list-item.done {
  opacity: 0.52;
  background: var(--surface-soft);
}

/* FIX 3: item title — body font (not Caveat) */
.item-title {
  display: block;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  /* FIX 5: line-height */
  line-height: 1.5;
  margin-bottom: 0.25rem;
}

.item-meta {
  font-family: var(--font-body);
  color: var(--ink-muted);
  font-size: 0.8rem;
  line-height: 1.5;
}

.item-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.4rem;
}

.icon-button {
  min-width: 2.2rem;
  min-height: 2.2rem;
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  color: var(--ink-muted);
  font-size: 1rem;
  transition: transform var(--t-fast) var(--ease-spring), box-shadow var(--t-fast), background var(--t-fast);
}

.icon-button:hover {
  transform: translate(-1px, -2px);
  box-shadow: var(--shadow-sketch-sm);
  background: var(--surface);
  color: var(--ink);
}

/* ============================================================
   PRIORITY COLORS
   ============================================================ */
.priority-Critical { color: var(--accent); font-weight: 700; }
.priority-High     { color: var(--amber);  font-weight: 600; }
.priority-Medium   { color: var(--blue); }
.priority-Low      { color: var(--ink-faint); }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  display: grid;
  gap: 0.85rem;
  padding: 1.5rem;
  border: 2px dashed var(--line);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--surface) 60%, transparent);
  color: var(--ink-muted);
}

.empty-state strong {
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--ink);
  font-weight: 400;
  line-height: 1.7;
}

.empty-action { width: fit-content; }

/* ============================================================
   EXPENSE BARS
   ============================================================ */
.expense-bars {
  display: grid;
  gap: 0.9rem;
  margin-top: 0.75rem;
}

.bar-row { display: grid; gap: 0.4rem; }

.bar-label {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-family: var(--font-body);
  font-size: 0.84rem;
  font-weight: 500;
}

.bar-track {
  height: 0.65rem;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-soft);
  border: 1.5px solid var(--line-soft);
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  transform-origin: left;
  animation: bar-grow 0.8s var(--ease-out) both;
}

@keyframes bar-grow {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

/* ============================================================
   SECRETARY
   ============================================================ */
.secretary-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(18rem, 0.75fr);
  gap: 1.25rem;
}

.command-box { display: grid; gap: 0.75rem; }
.assistant-log { display: grid; gap: 0.65rem; }

.log-line {
  padding: 0.85rem;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--line-soft);
  background: var(--surface-soft);
  font-family: var(--font-body);
  font-size: 0.88rem;
  line-height: 1.6;
  animation: item-in 0.3s var(--ease-out) both;
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-faint); }

/* ============================================================
   PAGE LOADER BAR
   ============================================================ */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--primary-light), var(--accent));
  z-index: 9999;
  animation: loader 0.8s var(--ease-out) forwards;
  transform-origin: left;
}

@keyframes loader {
  from { transform: scaleX(0); opacity: 1; }
  90%  { transform: scaleX(1); opacity: 1; }
  to   { transform: scaleX(1); opacity: 0; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 960px) {
  .app-shell { grid-template-columns: 1fr; }

  .sidebar {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 2px solid var(--line);
  }

  .nav-list { grid-template-columns: repeat(5, minmax(0, 1fr)); }

  .nav-link {
    justify-content: center;
    padding: 0 0.35rem;
    text-align: center;
    font-size: 0.78rem;
  }

  .nav-link::before { display: none; }

  .theme-toggle { max-width: 11rem; }

  .dashboard-hero,
  .stats-grid,
  .dashboard-grid,
  .quick-start-grid,
  .secretary-layout { grid-template-columns: 1fr; }

  .composer { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 620px) {
  .workspace { padding: 1rem; }
  .dashboard-hero { padding: 1.25rem; }
  .hero-copy h2 { font-size: 1.75rem; }
  .hero-actions { display: grid; }
  .preview-stack { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
  .hero-preview { min-height: auto; }
  .topbar, .panel-head, .editor-actions { align-items: stretch; flex-direction: column; }
  h1 { font-size: 2.5rem; }
  .today-card { min-width: 0; }
  .nav-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .composer { grid-template-columns: 1fr; }
  .list-item { grid-template-columns: 1fr; }
  .item-actions { justify-content: flex-start; }
}