/* ================================================================
   J.A.R.V.I.S. — Design System v4
   Black + cream neutral base · No brand hue — cream carries the default,
   categories carry the color
   ================================================================ */

/* ---- Tokens ---- */
:root {
  /* Core accent — rose/coral. Unified across the whole app (no more
     per-category hue shifting). App.CAT_ARC is neutralized so every view
     reads this rose accent. */
  --arc:         #fb7185;
  --arc-bright:  #f0899c;
  --arc-dim:     #c4485a;
  --arc-glow:    rgba(251,113,133,.10);
  --arc-glow-md: rgba(251,113,133,.18);
  --arc-glow-hi: rgba(251,113,133,.30);

  /* Backgrounds — near-black #0d0e12 with translucent-white glass panels.
     The layered radial-gradient atmosphere lives on body::before. */
  --bg-app:        #0d0e12;
  --bg-surface:    rgba(255,255,255,.07);
  --bg-surface-bd: rgba(255,255,255,.12);
  --bg-struct:     rgba(255,255,255,.045);
  --bg-struct-bd:  rgba(255,255,255,.10);
  --bg-sidebar:    rgba(255,255,255,.045);
  --bg-sidebar-bd: rgba(255,255,255,.08);
  --bg-solid:      #15171d;  /* opaque fill: donut holes, inner tiles */

  /* Text */
  --text-1: #f4f6fa;
  --text-2: #c2c8d2;
  --text-3: #868e9c;

  /* Dividers */
  --divider: rgba(255,255,255,.10);

  /* Semantic accents — redesign palette (rose alert, blue, green, gold) */
  --red:        rgba(242,96,110,.14);
  --red-fg:     #f2606e;
  --orange:     rgba(246,182,75,.14);
  --orange-fg:  #f6b64b;
  --green:      rgba(127,221,158,.14);
  --green-fg:   #7fdd9e;
  --blue:       rgba(127,176,255,.16);
  --blue-fg:    #7fb0ff;
  --purple:     rgba(200,140,240,.16);
  --purple-fg:  #c88cf0;
  --cyan:       rgba(51,214,208,.16);
  --cyan-fg:    #33d6d0;

  /* Primary CTA — rose gradient, near-black text (set on the button) */
  --cta:        #fb7185;
  --cta-fg:     #1a0709;
  --cta-hover:  #f0899c;

  /* Danger */
  --danger:     #f2606e;
  --danger-bg:  rgba(242,96,110,.12);

  /* Success */
  --success:    #7fdd9e;
  --success-bg: rgba(127,221,158,.12);

  /* Chart categorical palette — validated for dark-surface CVD/contrast (8 hues,
     fixed order, never cycled — see dataviz skill). Used by any SVG chart. */
  --chart-1: #3987e5; /* blue */
  --chart-2: #199e70; /* aqua */
  --chart-3: #c98500; /* yellow */
  --chart-4: #008300; /* green */
  --chart-5: #9085e9; /* violet */
  --chart-6: #e66767; /* red */
  --chart-7: #d55181; /* magenta */
  --chart-8: #d95926; /* orange */

  /* Shadows — deep float + rose glow on primary CTAs */
  --sh-card:  0 1px 3px rgba(0,0,0,.4);
  --sh-raise: 0 30px 70px -30px rgba(0,0,0,.5);
  --sh-modal: 0 40px 90px -30px rgba(0,0,0,.7);
  --sh-glow:  0 8px 22px -8px rgba(251,113,133,.6);

  /* Typography — Sora display, Inter Tight body, IBM Plex Mono numerals */
  --ff-display: "Sora", -apple-system, system-ui, sans-serif;
  --ff-body:    "Inter Tight", -apple-system, system-ui, sans-serif;
  --ff-mono:    "IBM Plex Mono", "SF Mono", "Fira Code", monospace;

  /* Spacing */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px;  --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-7: 32px;  --sp-8: 48px;

  /* Radius — larger, matching the redesign's soft panels */
  --r-xs:   5px;  --r-sm:   9px;  --r-md:   12px;
  --r-lg:   14px; --r-xl:   18px; --r-full: 9999px;

  /* Transitions */
  --t-fast: 120ms ease;
  --t-mid:  200ms ease;
  --t-slow: 350ms cubic-bezier(.4,0,.2,1);
}

/* ---- Light theme — same black+cream system, inverted. Semantic
   (red/green/chart/etc) accents stay fixed across both themes. ---- */
:root[data-theme="light"] {
  --arc:         #e5566c;
  --arc-bright:  #fb7185;
  --arc-dim:     #c4485a;
  --arc-glow:    rgba(229,86,108,.08);
  --arc-glow-md: rgba(229,86,108,.14);
  --arc-glow-hi: rgba(229,86,108,.22);

  --bg-app:        #f4f1ef;
  --bg-surface:    #ffffff;
  --bg-surface-bd: rgba(20,15,17,.10);
  --bg-struct:     #efeae8;
  --bg-struct-bd:  rgba(20,15,17,.07);
  --bg-sidebar:    #efeae8;
  --bg-sidebar-bd: rgba(20,15,17,.09);
  --bg-solid:      #ffffff;

  --text-1: #17141a;
  --text-2: #59545e;
  --text-3: #8b8590;

  --divider: rgba(20,15,17,.09);

  --cta:        #e5566c;
  --cta-fg:     #ffffff;
  --cta-hover:  #fb7185;

  --sh-card:  0 1px 3px rgba(20,15,17,.10);
  --sh-raise: 0 4px 20px rgba(20,15,17,.14);
  --sh-modal: 0 24px 64px rgba(20,15,17,.22);
  --sh-glow:  0 8px 22px -8px rgba(229,86,108,.4);
}
/* Light theme: opaque surfaces + no atmospheric gradient (translucent-white
   panels and the rose/blue glow are dark-only). */
:root[data-theme="light"] body::before { display: none; }

/* ================================================================
   Reset + base
   ================================================================ */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }

body {
  background: var(--bg-app);
  color: var(--text-1);
  font-family: var(--ff-body);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Layered radial-gradient atmosphere (dark theme). Fixed behind everything. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle at 12% 6%,  rgba(251,113,133,.28), transparent 42%),
    radial-gradient(circle at 88% 96%, rgba(127,176,255,.22), transparent 46%),
    radial-gradient(circle at 60% 40%, rgba(251,113,133,.05), transparent 60%),
    var(--bg-app);
}

button, input, select, textarea { font-family: inherit; }

/* ================================================================
   Layout — sidebar + main
   ================================================================ */

.app-shell {
  display: flex;
  height: 100vh;
}

/* ---- Sidebar — collapsible with hover expand ---- */
.sidebar {
  width: 52px;
  min-width: 52px;
  background: var(--bg-sidebar);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--bg-sidebar-bd);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: var(--sp-3) 0;
  position: relative;
  z-index: 200;
  transition: width 0.2s ease, min-width 0.2s ease;
  overflow: hidden;
}
.sidebar:hover {
  width: 176px;
  min-width: 176px;
}

.sidebar-brand {
  padding: var(--sp-2) var(--sp-3);
  margin-bottom: var(--sp-3);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  white-space: nowrap;
}

.sidebar-brand-icon {
  width: 30px;
  height: 30px;
  background: var(--arc-glow);
  border: 1px solid var(--arc-dim);
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--arc-bright);
  font-weight: 800;
  font-size: 14px;
  flex-shrink: 0;
}

.sidebar-brand-name {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-1);
  opacity: 0;
  transition: opacity 0.15s ease;
}
.sidebar:hover .sidebar-brand-name { opacity: 1; }

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 var(--sp-2);
  width: 100%;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 6px var(--sp-2);
  border-radius: var(--r-sm);
  color: var(--text-3);
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--t-fast);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  white-space: nowrap;
  position: relative;
}

.sidebar-link:hover {
  background: var(--bg-struct);
  color: var(--text-1);
}

.sidebar-link.active {
  color: var(--text-1);
}
.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 2px;
  height: 16px;
  border-radius: 1px;
  background: var(--arc);
}

.sidebar-link svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.sidebar-link .nav-label {
  opacity: 0;
  transition: opacity 0.15s ease;
}
.sidebar:hover .sidebar-link .nav-label { opacity: 1; }

/* ---- Nav groups (accordion) ---- */
.nav-group { width: 100%; }

.nav-group-head { display: flex; align-items: stretch; width: 100%; }

.grp-label {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 6px var(--sp-2);
  border-radius: var(--r-sm);
  color: var(--text-3);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: none;
  text-align: left;
  white-space: nowrap;
  min-width: 0;
}
.grp-label:hover { background: var(--bg-struct); color: var(--text-1); }
.grp-label svg { width: 18px; height: 18px; flex-shrink: 0; }
.grp-label .nav-label { opacity: 0; transition: opacity 0.15s ease; }
.sidebar:hover .grp-label .nav-label { opacity: 1; }

.grp-chev {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 0;
  padding: 0;
  border: none;
  background: none;
  color: var(--text-3);
  cursor: pointer;
  opacity: 0;
  overflow: hidden;
  transition: opacity 0.15s ease, width 0.15s ease;
  flex-shrink: 0;
}
.sidebar:hover .grp-chev { opacity: 1; width: 26px; padding: 0 4px; }
.grp-chev:hover { color: var(--text-1); }
.grp-chev svg { width: 14px; height: 14px; transition: transform 0.15s ease; }
.nav-group.open .grp-chev svg { transform: rotate(90deg); }

.grp-hub {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 0;
  padding: 0;
  border: none;
  background: none;
  color: var(--text-3);
  cursor: pointer;
  opacity: 0;
  overflow: hidden;
  transition: opacity 0.15s ease, width 0.15s ease;
  flex-shrink: 0;
}
.sidebar:hover .grp-hub { opacity: 1; width: 22px; padding: 0 2px; }
.grp-hub svg { width: 13px; height: 13px; }

/* Unified rose redesign — group icons stay neutral, warming to the rose
   accent when the group is open or hovered (no per-category hues). */
.nav-group .grp-label svg { color: var(--text-2); transition: color 0.15s ease; }
.nav-group.open .grp-label svg,
.grp-label:hover svg,
.grp-hub:hover { color: var(--arc); }

.nav-group-body { display: none; flex-direction: column; gap: 2px; }
.nav-group.open .nav-group-body { display: flex; }
.nav-group-body .sidebar-link { padding-left: 30px; font-size: 11.5px; }
.nav-group-body .sidebar-link svg { width: 15px; height: 15px; }

/* Sub-category divider inside a group (e.g. Lists, Medical, Activities). */
.nav-subhead {
  display: flex;
  align-items: center;
  padding: 8px 12px 3px 30px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
  opacity: 0;
  transition: opacity 0.15s ease;
}
.sidebar:hover .nav-subhead { opacity: 0.75; }
.nav-subhead span { position: relative; padding-left: 12px; }
.nav-subhead span::before {
  content: "";
  position: absolute;
  left: 0; top: 50%;
  width: 6px; height: 1px;
  background: var(--arc);
  opacity: 0.6;
}
/* Leaves under a sub-category indent a touch further. */
.nav-group-body .sidebar-link.sublink { padding-left: 38px; }

.nav-group-collapse {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 5px var(--sp-2) 7px 30px;
  color: var(--text-3);
  font-size: 10.5px;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  opacity: 0;
  transition: opacity 0.15s ease;
  white-space: nowrap;
}
.sidebar:hover .nav-group-collapse { opacity: 1; }
.nav-group-collapse:hover { color: var(--text-2); }
.nav-group-collapse svg { width: 12px; height: 12px; }

/* Collapsed rail: never show group contents, even if left open */
.sidebar:not(:hover) .nav-group-body,
.sidebar:not(:hover) .nav-group-collapse { display: none; }

/* ---- Tile hub (category landing page) ---- */
.hub-center-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 65vh;
}
.hub-center-wrap .page-title { text-align: center; margin-bottom: var(--sp-5); }

.tile-hub-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--sp-3);
  max-width: 580px;
  margin: 0 auto;
}
.tile-hub-grid .stat-card-lg {
  width: 136px;
  padding: 20px 10px;
  cursor: pointer;
  transition: transform var(--t-fast), border-color var(--t-fast);
}
.tile-hub-grid .stat-card-lg:hover {
  transform: translateY(-2px);
  border-color: var(--divider);
}
.tile-hub-grid .stat-icon { font-size: 25px; margin-bottom: 7px; }
.tile-hub-grid .stat-icon svg { width: 25px; height: 25px; }

/* ---- Back bar — persistent way out of any non-dashboard view ---- */
.back-bar {
  display: flex;
  align-items: center;
  margin-bottom: var(--sp-4);
}
.back-bar button {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--arc);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  padding: 0;
}
.back-bar button:hover { text-decoration: underline; }
.back-bar svg { width: 15px; height: 15px; }

/* ---- Offline banner + app-wide toasts ---- */
.offline-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-2) var(--sp-4);
  background: var(--danger-bg);
  color: var(--danger);
  border-bottom: 1px solid var(--danger);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}

.app-toast-slot {
  position: fixed;
  bottom: var(--sp-5);
  right: var(--sp-5);
  z-index: 600;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  max-width: 320px;
}

.app-toast {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-surface);
  border: 1px solid var(--bg-surface-bd);
  border-left: 3px solid var(--arc);
  border-radius: var(--r-md);
  box-shadow: var(--sh-raise);
  color: var(--text-1);
  font-size: 13px;
  font-weight: 500;
  animation: app-toast-in var(--t-mid);
}
.app-toast.app-toast-error   { border-left-color: var(--danger); }
.app-toast.app-toast-success { border-left-color: var(--success); }

@keyframes app-toast-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.sidebar-footer {
  padding: var(--sp-2) var(--sp-3);
  border-top: 1px solid var(--divider);
  margin-top: auto;
  white-space: nowrap;
}

/* ---- Focus / DND toggle (Phase 10) ---- */
#focus-toggle.focus-active { color: var(--orange-fg); }
body.focus-mode::before {
  content: '🔕 Focus mode'; position: fixed; top: 8px; left: 50%; transform: translateX(-50%);
  font-size: 10px; color: var(--orange-fg); background: var(--bg-surface); border: 1px solid var(--orange-fg);
  padding: 2px 10px; border-radius: var(--r-full); z-index: 2000; pointer-events: none; opacity: 0.9;
}

/* ---- Notification bell + panel (Phase 0) ---- */
.notif-wrap { display: inline-block; position: relative; }
.notif-badge {
  position: absolute; top: -2px; right: -2px; min-width: 14px; height: 14px;
  padding: 0 3px; border-radius: var(--r-full); background: var(--red-fg);
  color: #fff; font-size: 9px; font-weight: 700; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.notif-panel {
  display: none; position: absolute; bottom: calc(100% + 8px); left: 0;
  width: 320px; max-height: 400px; overflow-y: auto;
  background: var(--bg-surface); border: 1px solid var(--bg-surface-bd);
  border-radius: var(--r-md); box-shadow: var(--sh-modal); z-index: 500;
}
.notif-panel.open { display: block; }
.notif-panel-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px; border-bottom: 1px solid var(--divider);
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-2);
}
.notif-empty { padding: 20px 12px; text-align: center; color: var(--text-3); font-size: 12px; }
.notif-list { display: flex; flex-direction: column; }
.notif-item { padding: 10px 12px; border-bottom: 1px solid var(--divider); cursor: pointer; }
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--bg-struct); }
.notif-item.unread { background: var(--arc-glow); }
.notif-item.unread .notif-item-title::before {
  content: ''; display: inline-block; width: 6px; height: 6px;
  border-radius: 50%; background: var(--arc); margin-right: 6px;
}
.notif-item-title { font-size: 12px; font-weight: 600; color: var(--text-1); }
.notif-item.notif-warn .notif-item-title { color: var(--orange-fg); }
.notif-item.notif-crit .notif-item-title { color: var(--red-fg); }
.notif-item-body { font-size: 11px; color: var(--text-2); margin-top: 2px; }
.notif-item-time { font-size: 10px; color: var(--text-3); margin-top: 4px; }
.btn-link {
  background: none; border: none; padding: 0; color: var(--arc-bright);
  font-size: 11px; font-weight: 600; cursor: pointer;
}
.btn-link:hover { text-decoration: underline; }

/* ---- Main content ---- */
.main-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-4) var(--sp-5);
  position: relative;
}

.page-header {
  margin-bottom: var(--sp-7);
}

.page-title {
  font-family: var(--ff-display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: 0 0 var(--sp-1) 0;
  color: var(--text-1);
  text-shadow: 0 0 30px rgba(245,240,230,.12);
}

.page-subtitle {
  color: var(--text-2);
  font-size: 13px;
  font-family: var(--ff-mono);
  letter-spacing: 0.04em;
  margin: 0;
}

/* ================================================================
   Cards — glass-panel HUD style
   ================================================================ */

.card {
  background: var(--bg-surface);
  border: 1px solid var(--bg-surface-bd);
  border-radius: var(--r-md);
  box-shadow: var(--sh-card);
  padding: var(--sp-5);
  position: relative;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--arc-dim), transparent);
  opacity: 0.5;
  border-radius: var(--r-md) var(--r-md) 0 0;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-4);
}

.card-title {
  font-family: var(--ff-display);
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--arc-bright);
  margin: 0;
  text-shadow: 0 0 12px rgba(245,240,230,.2);
}

/* ================================================================
   Dashboard
   ================================================================ */

/* ---- Skeleton loading ---- */
.skel {
  background: linear-gradient(90deg, var(--bg-struct) 25%, var(--bg-surface) 50%, var(--bg-struct) 75%);
  background-size: 200% 100%;
  animation: skelPulse 1.5s ease-in-out infinite;
  border-radius: var(--r-sm);
}
.skel-text { height: 12px; display: block; }
.skel-card { height: 68px; border-radius: var(--r-md); }
@keyframes skelPulse {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---- New dashboard layout ---- */
.dash-header { margin-bottom: 8px; }
.dash-greeting { font-size: 15px; font-weight: 700; color: var(--text-1); }
.dash-date { font-size: 11px; color: var(--text-2); margin-top: 0; }

.dash-section-label {
  font-size: 9px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1.5px; color: var(--text-2); margin-bottom: 5px; margin-top: 8px;
  display: flex; align-items: center; gap: 8px;
}
.dash-section-label::after {
  content: ''; flex: 1; height: 1px; background: var(--divider);
}

/* Cards size to their own content instead of being stretched to fill equal grid
   columns — pack left, leave unused row space unused rather than forcing width. */
.dash-bento-4, .dash-bento-3, .dash-bento-2 {
  display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; align-items: flex-start;
}
@media (max-width: 800px) {
  .dash-bento-4 .dash-card, .dash-bento-3 .dash-card, .dash-bento-2 .dash-card {
    flex: 1 1 100%; max-width: 100%;
  }
}

/* Dense bento grid for the dashboard — variable tile spans, no section labels. */
.dash-bento {
  display: grid; grid-template-columns: repeat(8, 1fr);
  grid-auto-rows: minmax(46px, auto); grid-auto-flow: dense; gap: 10px;
}
.dash-bento .dash-card { flex: unset; min-width: 0; max-width: none; align-self: start; }
.dash-bento.customizing [data-card-key] {
  cursor: grab; outline: 1px dashed var(--arc-dim); outline-offset: -1px;
}
.dash-bento.customizing [data-card-key]:active { cursor: grabbing; }
.dash-bento.customizing [data-card-key].dragging { opacity: 0.35; }
.dgc-5x4 { grid-column: span 5; grid-row: span 4; }
.dgc-3x4 { grid-column: span 3; grid-row: span 4; }
.dgc-3x6 { grid-column: span 3; grid-row: span 6; }
.dgc-3x3 { grid-column: span 3; grid-row: span 3; }
.dgc-5x3 { grid-column: span 5; grid-row: span 3; }
.dgc-2x6 { grid-column: span 2; grid-row: span 4; }
.dgc-2x2 { grid-column: span 2; grid-row: span 2; }
@media (max-width: 900px) {
  .dash-bento { grid-template-columns: repeat(2, 1fr); grid-auto-rows: auto; }
  .dgc-5x4, .dgc-3x4, .dgc-3x6, .dgc-3x3, .dgc-5x3, .dgc-2x6 { grid-column: span 2; grid-row: auto; }
  .dgc-2x2 { grid-column: span 1; grid-row: auto; }
  .dash-donut-nw { flex-direction: column; align-items: stretch; }
  .dash-nw-mini { text-align: left; white-space: normal; margin-top: 8px; }
}

.muted { color: var(--text-3); font-size: 11px; }
.gauge-wrap { display: flex; align-items: center; justify-content: center; margin-top: 4px; }

/* Gauge tile: full-width header row above, full-size gauges split below */
.dash-gauge-combo { display: flex; flex-direction: column; }
.dash-gauge-header-row { display: flex; justify-content: space-between; margin-bottom: 4px; }
.dash-gauge-body { display: flex; align-items: center; flex: 1; }
.dash-gauge-half { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; }
.dash-gauge-divider { width: 1px; align-self: stretch; background: rgba(245,240,230,.14); margin: 0 10px; }

/* Paired stat-stack tile: two 3-row stacks split by a vertical divider */
.dash-stat-combo { display: flex; }
.dash-stat-combo-half { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.dash-stat-combo-divider { width: 1px; align-self: stretch; background: rgba(245,240,230,.14); margin: 0 12px; }

.dash-stat-row { display: flex; justify-content: space-between; align-items: center; padding: 5px 0; cursor: pointer; }
.dash-stat-row + .dash-stat-row { border-top: 1px solid rgba(245,240,230,.08); }
.dash-stat-row-label {
  font-size: 9px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; color: var(--text-2);
}
.dash-stat-row-value { font-size: 12.5px; font-weight: 700; color: var(--text-1); }

/* Timeline calendar (dashboard "Today" tile) */
.cal-allday {
  display: flex; align-items: center; gap: 6px; font-size: 10.5px; color: var(--text-2);
  padding: 4px 8px; margin-bottom: 10px; border-radius: 6px; background: rgba(245,240,230,.04);
}
.cal-allday-dot { width: 6px; height: 6px; border-radius: 2px; flex-shrink: 0; }
.cal-timeline { position: relative; flex: 1; margin-left: 34px; max-height: 150px; overflow-y: auto; overflow-x: hidden; }
.cal-hour-line { position: absolute; left: -34px; right: 0; border-top: 1px solid var(--divider); }
.cal-hour-label {
  position: absolute; left: -34px; width: 28px; text-align: right; font-size: 8.5px;
  color: var(--text-3); font-family: var(--ff-mono); transform: translateY(-5px);
}
.cal-event {
  position: absolute; border-radius: 5px; padding: 2px 5px; font-size: 9px;
  overflow: hidden; border: 1px solid; line-height: 1.2; cursor: default;
}
.cal-event-time { font-size: 7.5px; opacity: .75; font-family: var(--ff-mono); }
.cal-legend { display: flex; flex-wrap: wrap; gap: 10px 14px; margin-top: 10px; font-size: 10px; color: var(--text-2); }
.cal-legend span { display: flex; align-items: center; gap: 5px; }
.cal-legend-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

.dash-card {
  background: var(--bg-surface); border: 1px solid var(--bg-surface-bd);
  border-radius: var(--r-md); padding: 8px 10px;
  cursor: pointer; transition: border-color 0.15s; position: relative;
  flex: 0 0 auto; min-width: 140px; max-width: 420px;
}
.dash-card:hover { border-color: var(--arc-dim); }

.dash-card-label {
  font-size: 9px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; color: var(--text-2); margin-bottom: 3px;
}
.dash-card-value { font-size: 13px; font-weight: 700; color: var(--text-1); }
.dash-card-unit { font-size: 11px; font-weight: 400; color: var(--text-3); }
.dash-card-sub { font-size: 10px; color: var(--text-1); opacity: 0.6; margin-top: 1px; }

/* Spend-by-category tile: net worth folded into its unused right-hand strip */
.dash-donut-nw { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.dash-donut-nw-main { flex: 0 0 auto; min-width: 0; }
.dash-nw-mini { flex: 0 0 auto; text-align: right; padding-top: 1px; cursor: pointer; white-space: nowrap; }
.dash-nw-mini .dash-card-sub { line-height: 1.4; }

.dash-card-row-header {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px;
}
.dash-link {
  font-size: 10px; color: var(--arc-bright); cursor: pointer;
  transition: color var(--t-fast);
}
.dash-link:hover { color: var(--text-1); }

/* Hover expand */
.dash-hover-card .dash-expand {
  display: none; position: absolute; top: 100%; left: 0; right: 0;
  z-index: 100; margin-top: -1px;
  background: var(--bg-surface); border: 1px solid var(--arc);
  border-top: none; border-radius: 0 0 var(--r-md) var(--r-md);
  padding: 6px 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  animation: dashSlide 0.12s ease;
}
.dash-hover-card.expanded .dash-expand { display: block; }
.dash-hover-card.expanded {
  border-color: var(--arc); border-radius: var(--r-md) var(--r-md) 0 0; z-index: 101;
}
@keyframes dashSlide { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: translateY(0); } }

.dash-expand-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 3px 0; font-size: 11px; color: var(--text-2);
}
.dash-expand-row + .dash-expand-row { border-top: 1px solid var(--divider); }

.dash-pri-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }

/* Task rows in dashboard */
.dash-task-row {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 0; border-bottom: 1px solid rgba(255,255,255,.03);
}
.dash-task-row:last-child { border-bottom: none; }
.dash-task-check {
  width: 16px; height: 16px; border-radius: var(--r-full);
  border: 2px solid var(--text-3); flex-shrink: 0;
  cursor: pointer; background: none; transition: all var(--t-fast);
}
.dash-task-check:hover { border-color: var(--arc); background: var(--arc-glow); }
.dash-task-check.done { background: var(--success); border-color: var(--success); }
.dash-task-title { flex: 1; font-size: 12px; color: var(--text-1); }
.dash-task-title.done { color: var(--text-3); text-decoration: line-through; }
.dash-task-date { font-size: 10px; color: var(--text-3); flex-shrink: 0; }


/* Legacy compat — keep for stats page */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--sp-3); margin-bottom: var(--sp-5);
}
.stat-card {
  background: var(--bg-surface); border: 1px solid var(--bg-surface-bd);
  border-radius: var(--r-md); padding: var(--sp-4);
}
.stat-label {
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-2); margin-bottom: var(--sp-1);
}
.stat-value { font-size: 20px; font-weight: 700; color: var(--text-1); }
.stat-value.overdue { color: var(--red-fg); }
.stat-value.active { color: var(--arc-bright); }
.stat-value.done { color: var(--green-fg); }

/* ================================================================
   Task list
   ================================================================ */

.task-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: var(--sp-3);
  align-items: start;
}

.task-item {
  display: flex;
  flex-direction: column;
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  border: 1px solid var(--bg-surface-bd);
  background: var(--bg-surface);
  transition: all var(--t-fast);
}

.task-item:hover {
  border-color: var(--arc-dim);
  box-shadow: 0 0 16px var(--arc-glow);
}

.task-item-top {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
}

.task-desc {
  font-size: 11.5px;
  color: var(--text-2);
  margin-top: 4px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.task-cat-tag {
  font-size: 10px;
  color: var(--text-2);
  padding: 2px 7px;
  border: 1px solid var(--divider);
  border-radius: var(--r-full);
}

.task-date {
  margin-left: auto;
  font-size: 10.5px;
  color: var(--text-3);
}

.task-check {
  width: 20px;
  height: 20px;
  border-radius: var(--r-full);
  border: 2px solid var(--text-3);
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 1px;
  transition: all var(--t-fast);
  background: none;
  padding: 0;
}

.task-check:hover {
  border-color: var(--arc);
  background: var(--arc-glow);
  box-shadow: 0 0 8px rgba(245,240,230,.2);
}

.task-check.done {
  border-color: var(--success);
  background: var(--success);
  box-shadow: 0 0 8px rgba(34,197,94,.3);
}

.task-body { flex: 1; min-width: 0; }

.task-title {
  font-weight: 500;
  font-size: 14px;
}

.task-title.done {
  text-decoration: line-through;
  color: var(--text-3);
}

.task-meta {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--bg-surface-bd);
  font-size: 11px;
  color: var(--text-2);
  font-family: var(--ff-mono);
}

/* Priority badges — HUD style */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--r-xs);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: var(--ff-mono);
  border: 1px solid;
}

.badge-urgent {
  background: rgba(239,35,60,.15);
  color: var(--red-fg);
  border-color: rgba(239,35,60,.3);
  box-shadow: 0 0 8px rgba(239,35,60,.15);
}

.badge-high {
  background: var(--orange);
  color: var(--orange-fg);
  border-color: rgba(245,158,11,.2);
}

.badge-medium {
  background: var(--blue);
  color: var(--blue-fg);
  border-color: rgba(245,240,230,.2);
}

.badge-low {
  background: var(--green);
  color: var(--green-fg);
  border-color: rgba(34,197,94,.2);
}

/* ================================================================
   Notes
   ================================================================ */

.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--sp-4);
}

.note-card {
  background: var(--bg-surface);
  border: 1px solid var(--bg-surface-bd);
  border-radius: var(--r-md);
  box-shadow: var(--sh-card);
  padding: var(--sp-5);
  cursor: pointer;
  transition: all var(--t-fast);
  position: relative;
}

.note-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--arc-dim), transparent);
  opacity: 0.4;
  border-radius: var(--r-md) var(--r-md) 0 0;
}

.note-card:hover {
  border-color: rgba(245,240,230,.2);
  box-shadow: var(--sh-raise);
  transform: translateY(-1px);
}

.note-card.pinned {
  border-color: rgba(245,240,230,.3);
  box-shadow: 0 0 16px rgba(245,240,230,.08);
}

.note-title {
  font-family: var(--ff-display);
  font-size: 15px;
  font-weight: 600;
  margin-bottom: var(--sp-2);
}

.note-preview {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.note-footer {
  display: flex;
  justify-content: space-between;
  margin-top: var(--sp-3);
  font-size: 10px;
  color: var(--text-3);
  font-family: var(--ff-mono);
}

.note-tags {
  display: flex;
  gap: var(--sp-1);
  flex-wrap: wrap;
}

.note-tag {
  background: var(--purple);
  color: var(--purple-fg);
  padding: 1px 6px;
  border-radius: var(--r-xs);
  font-size: 10px;
  font-weight: 600;
  font-family: var(--ff-mono);
  border: 1px solid rgba(168,100,255,.2);
}

/* ================================================================
   Buttons — HUD controls
   ================================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-sm);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--t-fast);
  font-family: var(--ff-body);
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--arc-glow-md);
  color: var(--arc-bright);
  border-color: var(--arc-dim);
  box-shadow: 0 0 16px var(--arc-glow);
}

.btn-primary:hover {
  background: var(--arc-glow-hi);
  border-color: var(--arc);
  box-shadow: 0 0 24px var(--arc-glow-md);
  color: #fff;
}

.btn-ghost {
  background: none;
  color: var(--text-2);
}

.btn-ghost:hover {
  background: var(--arc-glow);
  color: var(--text-1);
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: rgba(255,45,45,.2);
}

.btn-danger:hover {
  background: rgba(255,45,45,.25);
  box-shadow: 0 0 16px rgba(255,45,45,.15);
}

/* ================================================================
   Forms / Inputs — tech panel style
   ================================================================ */

.form-group {
  margin-bottom: var(--sp-4);
}

.form-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: var(--sp-1);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: var(--ff-mono);
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid rgba(245,240,230,.1);
  border-radius: var(--r-sm);
  background: rgba(255,255,255,.03);
  color: var(--text-1);
  font-size: 14px;
  transition: all var(--t-fast);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: rgba(245,240,230,.4);
  box-shadow: 0 0 12px rgba(245,240,230,.1);
  background: rgba(245,240,230,.04);
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%237A7580' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

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

/* ================================================================
   Custom select — replaces native <select> chrome. The real <select>
   stays in the DOM (visually hidden) purely as the value/state holder,
   so every existing save()-time `.value` read and onchange handler
   keeps working untouched. See App.enhanceSelect() in app.js.
   ================================================================ */
.jsel-native { display: none !important; }

/* variant: chip row — small fixed option sets (≤6) */
.jsel-chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.jsel-chip {
  padding: 6px 14px; border: 1px solid rgba(245,240,230,.1); border-radius: var(--r-full);
  background: rgba(255,255,255,.03); color: var(--text-2); font-size: 13px;
  font-family: var(--ff-body); cursor: pointer; transition: var(--t-fast);
}
.jsel-chip:hover { border-color: var(--arc-dim); color: var(--text-1); }
.jsel-chip.active { border-color: var(--arc); color: var(--arc-bright); background: var(--arc-glow); }
.jsel-chip:focus-visible { outline: 2px solid var(--arc); outline-offset: 1px; }

/* variant: trigger button shared by listbox + combobox */
.jsel-trigger {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3); border: 1px solid rgba(245,240,230,.1); border-radius: var(--r-sm);
  background: rgba(255,255,255,.03); color: var(--text-1); font-size: 14px; font-family: var(--ff-body);
  cursor: pointer; transition: var(--t-fast); text-align: left;
}
.jsel-trigger:hover { border-color: var(--arc-dim); }
.jsel-trigger.open, .jsel-trigger:focus-visible { outline: none; border-color: rgba(245,240,230,.4); box-shadow: 0 0 12px rgba(245,240,230,.1); }
.jsel-trigger-label.placeholder { color: var(--text-3); }
.jsel-trigger-caret { flex-shrink: 0; width: 10px; height: 10px; opacity: .6; transition: transform var(--t-fast); }
.jsel-trigger.open .jsel-trigger-caret { transform: rotate(180deg); }

.jsel-wrap { position: relative; }

.jsel-panel {
  position: absolute; z-index: 400; top: calc(100% + 4px); left: 0; right: 0;
  max-height: 260px; overflow-y: auto; background: var(--bg-surface); border: 1px solid var(--bg-surface-bd);
  border-radius: var(--r-md); box-shadow: 0 12px 32px rgba(0,0,0,.4); padding: var(--sp-1);
}
.jsel-panel-search {
  width: 100%; padding: var(--sp-2) var(--sp-3); margin-bottom: var(--sp-1); border: 1px solid var(--divider);
  border-radius: var(--r-sm); background: rgba(255,255,255,.03); color: var(--text-1); font-size: 13px;
  font-family: var(--ff-body);
}
.jsel-panel-search:focus { outline: none; border-color: rgba(245,240,230,.3); }
.jsel-option {
  padding: 8px 10px; border-radius: var(--r-xs); font-size: 13px; color: var(--text-2);
  cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2);
}
.jsel-option:hover, .jsel-option.highlighted { background: var(--arc-glow); color: var(--text-1); }
.jsel-option.selected { color: var(--arc-bright); font-weight: 600; }
.jsel-option-empty { padding: 10px; font-size: 12px; color: var(--text-3); text-align: center; }

/* ================================================================
   Modal — holographic panel
   ================================================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-mid);
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--bg-surface);
  border: 1px solid rgba(245,240,230,.2);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-modal), 0 0 60px rgba(245,240,230,.06);
  width: 90%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  padding: var(--sp-6);
  position: relative;
}

.modal::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--arc), transparent);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
}

.modal-title {
  font-family: var(--ff-display);
  font-size: 18px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 var(--sp-5) 0;
  color: var(--arc-bright);
  text-shadow: 0 0 16px rgba(245,240,230,.2);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-3);
  margin-top: var(--sp-5);
}

/* ================================================================
   Theme toggle — repurposed as system indicator
   ================================================================ */

.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--arc-dim);
  padding: var(--sp-2);
  border-radius: var(--r-sm);
  transition: color var(--t-fast);
}

.theme-toggle:hover {
  color: var(--arc-bright);
  filter: drop-shadow(0 0 6px rgba(245,240,230,.4));
}

.theme-toggle svg { width: 18px; height: 18px; }

/* ================================================================
   Courses — Sakai/D2L assignment log
   Two readouts of the same synced data: Timeline (log feed, newest
   first, grouped by month) and By class (syllabus order, grouped by
   course). Each course keeps a fixed color tag across both — the
   HUD equivalent of color-coding a binder per class.
   ================================================================ */

.courses-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin: var(--sp-5) 0 var(--sp-3);
  flex-wrap: wrap;
}

.courses-count {
  font-family: var(--ff-mono);
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: 0.02em;
}

.seg-toggle {
  display: inline-flex;
  border: 1px solid var(--bg-surface-bd);
  border-radius: var(--r-sm);
  background: var(--bg-struct);
  padding: 2px;
  gap: 2px;
}

.seg-toggle button {
  font-family: var(--ff-mono);
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  background: none;
  border: none;
  border-radius: calc(var(--r-sm) - 2px);
  padding: 5px 12px;
  cursor: pointer;
  transition: all var(--t-fast);
}

.seg-toggle button:hover { color: var(--text-2); }

.seg-toggle button.active {
  background: var(--arc-glow-md);
  color: var(--arc-bright);
  box-shadow: inset 0 0 0 1px var(--arc-dim);
}

.courses-group-header {
  display: flex;
  align-items: baseline;
  gap: var(--sp-3);
  margin: var(--sp-6) 0 var(--sp-2);
  font-family: var(--ff-mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
}

.courses-group-header:first-child { margin-top: 0; }
.courses-group-header.is-current-month { color: var(--arc-bright); }

.courses-group-header::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--divider);
}

.courses-group-count {
  font-weight: 400;
  color: var(--text-3);
  text-transform: none;
  letter-spacing: 0;
}

/* Timeline mode: a rail with a course-colored dot per row */
.courses-timeline { position: relative; padding-left: 14px; }
.courses-timeline::before {
  content: '';
  position: absolute;
  left: 3px; top: 4px; bottom: 4px;
  width: 1px;
  background: var(--divider);
}

.courses-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,.03);
  position: relative;
}
.courses-row:last-child { border-bottom: none; }

.courses-dot {
  width: 7px; height: 7px; border-radius: 50%;
  flex-shrink: 0; margin-left: -14px;
  box-shadow: 0 0 0 3px var(--bg-app);
}

.courses-row-title { flex: 1; font-size: 13px; color: var(--text-1); min-width: 0; }
.courses-row-course {
  font-size: 11px; color: var(--text-3); flex-shrink: 0;
  font-family: var(--ff-mono);
}
.courses-row-date {
  font-size: 11px; font-family: var(--ff-mono); flex-shrink: 0; min-width: 62px; text-align: right;
}
.courses-row-date.is-overdue { color: var(--red-fg); }
.courses-row-date.is-soon { color: var(--orange-fg); }
.courses-row-date.is-normal { color: var(--text-3); }

/* ================================================================
   Empty states
   ================================================================ */

.empty-state {
  text-align: center;
  padding: var(--sp-8) var(--sp-5);
  color: var(--text-3);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  margin-bottom: var(--sp-4);
  opacity: 0.3;
}

.empty-state p {
  font-size: 13px;
  font-family: var(--ff-mono);
  letter-spacing: 0.03em;
  margin: 0 0 var(--sp-4) 0;
}

/* ================================================================
   Scrollbar — subtle red
   ================================================================ */

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(245,240,230,.2);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(245,240,230,.35); }

/* ================================================================
   Utility
   ================================================================ */

.hidden { display: none !important; }
.text-muted { color: var(--text-2); }
.text-sm { font-size: 12px; }
.mt-2 { margin-top: var(--sp-2); }
.mt-4 { margin-top: var(--sp-4); }
.mb-4 { margin-bottom: var(--sp-4); }
.gap-2 { gap: var(--sp-2); }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* ================================================================
   Loading
   ================================================================ */

.loading {
  text-align: center; padding: var(--sp-8);
  color: var(--text-2); font-family: var(--ff-mono);
  font-size: 13px; letter-spacing: 0.05em;
}

/* ================================================================
   Journal
   ================================================================ */

.jrn-stat {
  display: flex; align-items: center; gap: var(--sp-4);
  background: var(--bg-surface); border: 1px solid var(--bg-surface-bd);
  border-radius: var(--r-md); padding: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-3);
}
.jrn-stat-cap { font-size: 11px; color: var(--text-3); margin-bottom: 2px; }
.jrn-stat-val { font-size: 16px; color: var(--text-1); font-weight: 500; }
.jrn-spark { flex: 1; height: 32px; max-width: 320px; }

.journal-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--sp-3); align-items: start;
}

.journal-entry-card {
  position: relative;
  padding: var(--sp-3) var(--sp-4);
  padding-right: 34px;
  background: var(--bg-surface); border: 1px solid var(--bg-surface-bd);
  border-left: 3px solid var(--mood, var(--divider));
  border-radius: var(--r-md); cursor: pointer; transition: var(--t-mid);
}

.journal-entry-card:hover {
  border-color: var(--arc-dim);
  border-left-color: var(--mood, var(--arc-dim));
  box-shadow: 0 0 12px var(--arc-glow);
}

.journal-entry-header {
  display: flex; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-2);
}

.journal-date-inline {
  font-family: var(--ff-mono); font-size: 10.5px; color: var(--text-3);
  letter-spacing: 0.04em;
}

.journal-mood { font-size: 15px; }

.journal-energy { display: flex; gap: 3px; margin-left: auto; }
.journal-energy span {
  width: 5px; height: 5px; border-radius: 50%; background: var(--divider);
}
.journal-energy span.on { background: var(--mood, var(--orange-fg)); }

.journal-preview {
  font-size: 12.5px; color: var(--text-2); line-height: 1.5;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.journal-entry-card .btn-delete {
  position: absolute; top: 10px; right: 10px;
}

/* Mood & Energy pickers */
.mood-picker, .energy-picker {
  display: flex; gap: var(--sp-2);
}

.mood-btn, .energy-btn {
  width: 36px; height: 36px; border: 1px solid var(--divider);
  border-radius: var(--r-sm); background: var(--bg-app);
  cursor: pointer; font-size: 18px; transition: var(--t-fast);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-1);
}

.energy-btn {
  font-family: var(--ff-display); font-size: 13px; font-weight: 600;
}

.mood-btn:hover, .energy-btn:hover { border-color: var(--arc-dim); }

.mood-btn.active, .energy-btn.active {
  border-color: var(--arc); background: var(--arc-glow-md);
  box-shadow: 0 0 8px var(--arc-glow);
}

/* ================================================================
   Bookmarks
   ================================================================ */

.bookmarks-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--sp-3); align-items: start;
}

.bookmark-card {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-surface); border: 1px solid var(--bg-surface-bd);
  border-radius: var(--r-md); transition: var(--t-fast);
}

.bookmark-card:hover { border-color: var(--arc-dim); }

.bookmark-card.pinned { border-color: var(--arc); }

.bookmark-icon {
  width: 32px; height: 32px; display: flex; align-items: center;
  justify-content: center; font-size: 18px; flex-shrink: 0;
  background: var(--bg-app); border-radius: var(--r-sm);
}

.bookmark-icon img { border-radius: 2px; }

.bookmark-info { flex: 1; min-width: 0; }

.bookmark-title {
  font-family: var(--ff-display); font-size: 14px; font-weight: 600;
  color: var(--arc-bright); text-decoration: none; letter-spacing: 0.02em;
}

.bookmark-title:hover { text-decoration: underline; }

.bookmark-url {
  font-family: var(--ff-mono); font-size: 11px; color: var(--text-3);
  margin-top: 1px;
}

.bookmark-desc {
  font-size: 13px; color: var(--text-2); margin-top: 4px;
}

.bookmark-actions {
  display: flex; gap: var(--sp-1); flex-shrink: 0;
}

/* ================================================================
   Snippets
   ================================================================ */

.snippets-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--sp-3); align-items: start;
}

.snippet-card {
  background: var(--bg-surface); border: 1px solid var(--bg-surface-bd);
  border-radius: var(--r-lg); padding: var(--sp-4);
}

.snippet-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: var(--sp-3);
}

.snippet-title {
  font-family: var(--ff-display); font-size: 15px; font-weight: 600;
  color: var(--text-1); letter-spacing: 0.03em;
}

.snippet-meta {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: 12px;
}

.snippet-preview {
  background: var(--bg-app); border: 1px solid var(--divider);
  border-radius: var(--r-sm); padding: var(--sp-3);
  font-family: var(--ff-mono); font-size: 12px; line-height: 1.6;
  color: var(--text-2); overflow: hidden; max-height: 120px;
  margin-bottom: var(--sp-3); white-space: pre-wrap; word-break: break-all;
}

.snippet-preview code { color: inherit; }

.snippet-actions {
  display: flex; gap: var(--sp-2);
}

/* ================================================================
   Weekly Stats
   ================================================================ */

.stats-week-header {
  display: flex; align-items: center; gap: var(--sp-2);
  justify-content: center; margin-bottom: var(--sp-6);
  font-family: var(--ff-display); font-size: 14px; font-weight: 600;
  color: var(--text-2); letter-spacing: 0.05em; text-transform: uppercase;
}

.stats-grid-large {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--sp-4);
}

.stat-card-lg {
  background: var(--bg-surface); border: 1px solid var(--bg-surface-bd);
  border-radius: var(--r-lg); padding: var(--sp-6);
  text-align: center;
}

.stat-icon { font-size: 28px; margin-bottom: var(--sp-2); }

.stat-value-lg {
  font-family: var(--ff-display); font-size: 32px; font-weight: 700;
  color: var(--arc-bright); line-height: 1.1;
}

.stat-label-lg {
  font-family: var(--ff-mono); font-size: 11px; color: var(--text-2);
  text-transform: uppercase; letter-spacing: 0.05em; margin-top: var(--sp-2);
}

/* ================================================================
   Search Overlay
   ================================================================ */

.search-overlay {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(0,0,0,.6); backdrop-filter: blur(4px);
  display: none; align-items: flex-start; justify-content: center;
  padding-top: 15vh;
}

.search-overlay.open { display: flex; }

.search-box {
  width: 100%; max-width: 520px;
  background: var(--bg-surface); border: 1px solid var(--arc-dim);
  border-radius: var(--r-lg); box-shadow: var(--sh-modal);
  overflow: hidden;
}

.search-box input {
  width: 100%; padding: 16px 20px; border: none;
  background: transparent; color: var(--text-1);
  font-family: var(--ff-body); font-size: 16px;
  outline: none;
}

.search-box input::placeholder { color: var(--text-3); }

#search-results {
  max-height: 320px; overflow-y: auto;
  border-top: 1px solid var(--divider);
}

#search-results:empty { border-top: none; }

.search-result {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 10px 20px; cursor: pointer; transition: var(--t-fast);
}

.search-result:hover { background: var(--arc-glow); }

.search-type { font-size: 16px; flex-shrink: 0; }

.search-title {
  flex: 1; font-size: 14px; color: var(--text-1);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.search-badge {
  font-family: var(--ff-mono); font-size: 10px; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.05em;
  padding: 2px 6px; background: var(--bg-app); border-radius: var(--r-xs);
}

.search-empty {
  padding: 20px; text-align: center; color: var(--text-3);
  font-family: var(--ff-mono); font-size: 13px;
}

/* Command palette section labels + keyboard highlight */
.palette-section {
  padding: 10px 20px 4px;
  font-family: var(--ff-mono); font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-3);
}
.palette-item.palette-active { background: var(--arc-glow-md); }

/* ================================================================
   Quick Capture FAB
   ================================================================ */

.fab {
  position: fixed; bottom: 24px; right: 24px; z-index: 100;
  width: 56px; height: 56px; border: none;
  border-radius: 50%; background: var(--arc);
  color: #fff; font-size: 28px; font-weight: 300;
  cursor: pointer; box-shadow: var(--sh-raise);
  transition: var(--t-mid); display: flex;
  align-items: center; justify-content: center;
  line-height: 1;
}

.fab:hover {
  background: var(--arc-bright);
  transform: scale(1.05);
  box-shadow: 0 6px 24px rgba(245,240,230,.3);
}

/* Secondary FAB (contact quick-log) — stacked above the primary FAB, same
   treatment but smaller and neutral so it doesn't compete visually. */
.fab-secondary {
  bottom: 92px; width: 44px; height: 44px; font-size: 18px;
  background: var(--bg-surface); border: 1px solid var(--bg-surface-bd); color: var(--text-1);
}
.fab-secondary:hover { background: var(--bg-struct); transform: scale(1.05); box-shadow: var(--sh-raise); }

.contact-quick-panel {
  display: none; position: fixed; bottom: 144px; right: 24px; z-index: 100;
  width: 300px; max-height: 420px; overflow-y: auto;
  background: var(--bg-surface); border: 1px solid var(--bg-surface-bd);
  border-radius: var(--r-md); box-shadow: var(--sh-modal); padding: var(--sp-2);
}
.contact-quick-panel.open { display: block; }
.cq-search {
  width: 100%; margin-bottom: var(--sp-2); padding: 6px 10px;
  background: var(--bg-struct); border: 1px solid var(--divider);
  border-radius: var(--r-sm); color: var(--text-1); font-size: 12px;
}
.cq-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 6px; border-bottom: 1px solid var(--divider); gap: 8px;
}
.cq-row:last-child { border-bottom: none; }
.cq-name { font-size: 12px; font-weight: 600; color: var(--text-1); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cq-last { font-size: 10px; color: var(--text-3); }
.cq-actions { display: flex; gap: 4px; flex-shrink: 0; }
.cq-btn {
  background: var(--bg-struct); border: 1px solid var(--divider); border-radius: var(--r-sm);
  color: var(--text-2); font-size: 10px; font-weight: 600; padding: 4px 7px; cursor: pointer;
}
.cq-btn:hover { background: var(--arc-glow); color: var(--text-1); border-color: var(--arc-dim); }

.quick-capture-tabs {
  display: flex; gap: var(--sp-2); margin-bottom: var(--sp-4);
}

.qc-tab {
  flex: 1; padding: 8px; border: 1px solid var(--divider);
  border-radius: var(--r-sm); background: var(--bg-app);
  color: var(--text-2); font-family: var(--ff-display);
  font-size: 12px; font-weight: 600; cursor: pointer;
  transition: var(--t-fast); letter-spacing: 0.05em;
  text-transform: uppercase;
}

.qc-tab:hover { border-color: var(--arc-dim); }

.qc-tab.active {
  border-color: var(--arc); color: var(--arc-bright);
  background: var(--arc-glow);
}

/* ================================================================
   Small buttons
   ================================================================ */

.btn-sm {
  padding: 4px 10px; font-size: 12px; border-radius: var(--r-sm);
}

.btn-danger-text { color: var(--danger) !important; }
.btn-danger-text:hover { background: var(--danger-bg) !important; }

.btn-icon {
  width: 28px; height: 28px; border: none; background: none;
  color: var(--text-3); cursor: pointer; font-size: 16px;
  border-radius: var(--r-xs); transition: var(--t-fast);
  display: flex; align-items: center; justify-content: center;
}

.btn-icon:hover { background: var(--bg-app); color: var(--text-1); }

.btn-delete:hover { color: var(--danger); background: var(--danger-bg); }

/* ================================================================
   Second Brain
   ================================================================ */

.brain-controls {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: var(--sp-3); flex-wrap: wrap; gap: var(--sp-2);
}

.brain-legend {
  display: flex; flex-wrap: wrap; gap: var(--sp-3);
}

.brain-legend-item {
  display: flex; align-items: center; gap: 4px;
  font-family: var(--ff-mono); font-size: 10px; color: var(--text-2);
  text-transform: uppercase; letter-spacing: 0.04em;
}

.brain-legend-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}

.brain-canvas-wrap {
  background: var(--bg-surface); border: 1px solid var(--bg-surface-bd);
  border-radius: var(--r-lg); overflow: hidden;
  min-height: 500px; position: relative;
}

#brain-svg {
  width: 100%; height: 500px; display: block;
}

.brain-detail-panel {
  position: absolute; bottom: 16px; left: 50%;
  transform: translateX(-50%); z-index: 50;
  background: var(--bg-surface); border: 1px solid var(--arc-dim);
  border-radius: var(--r-lg); box-shadow: var(--sh-raise);
  padding: var(--sp-4) var(--sp-5); min-width: 280px; max-width: 420px;
}

.brain-detail-header {
  display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-3);
}

.brain-detail-icon { font-size: 28px; }

.brain-detail-title {
  font-family: var(--ff-display); font-size: 16px; font-weight: 600;
  color: var(--text-1); letter-spacing: 0.03em;
}

.brain-detail-meta {
  font-family: var(--ff-mono); font-size: 11px; color: var(--text-2);
  text-transform: uppercase; letter-spacing: 0.04em; margin-top: 2px;
}

.brain-detail-desc {
  font-size: 13px; color: var(--text-2); line-height: 1.5;
  margin-bottom: var(--sp-3);
}

.brain-detail-url {
  display: block; font-family: var(--ff-mono); font-size: 12px;
  color: var(--arc-bright); text-decoration: none;
  margin-bottom: var(--sp-3); word-break: break-all;
}

.brain-detail-url:hover { text-decoration: underline; }

.brain-detail-actions {
  display: flex; gap: var(--sp-2); border-top: 1px solid var(--divider);
  padding-top: var(--sp-3);
}

/* ================================================================
   CHAT
   ================================================================ */

.main-content.chat-view {
  padding: 0;
  overflow: hidden;
  display: flex;
}

.chat-layout {
  display: flex; flex: 1; min-height: 0; gap: 0;
}

.chat-mobile-bar { display: none; }

.chat-drawer-backdrop { display: none; }

.chat-sidebar {
  width: 220px; border-right: 1px solid var(--divider);
  display: flex; flex-direction: column; flex-shrink: 0;
}

.chat-sidebar-header {
  padding: var(--sp-3) var(--sp-4); display: flex;
  align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--divider);
}

.btn-icon {
  width: 28px; height: 28px; border-radius: var(--r-sm);
  border: 1px solid var(--divider); background: transparent;
  color: var(--text-1); font-size: 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

.btn-icon:hover { background: var(--arc-glow); border-color: var(--arc-dim); }

.chat-conv-list {
  flex: 1; overflow-y: auto; padding: var(--sp-2);
}

.chat-conv-item {
  display: flex; align-items: center; padding: 8px 10px;
  border-radius: var(--r-sm); cursor: pointer; margin-bottom: 2px;
  transition: var(--t-fast);
}

.chat-conv-item:hover { background: var(--arc-glow); }
.chat-conv-item.active { background: var(--arc-glow-md); border: 1px solid var(--arc-dim); }

.chat-conv-title {
  flex: 1; font-size: 12px; color: var(--text-1);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.chat-conv-delete {
  background: none; border: none; color: var(--text-3); font-size: 16px;
  cursor: pointer; padding: 0 4px; opacity: 0; transition: var(--t-fast);
}

.chat-conv-item:hover .chat-conv-delete { opacity: 1; }
.chat-conv-delete:hover { color: var(--danger); }

.chat-main {
  flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0;
}

.chat-messages {
  flex: 1; overflow-y: auto; padding: var(--sp-4) var(--sp-6);
  display: flex; flex-direction: column; gap: var(--sp-4);
}

.chat-welcome {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
}

.chat-suggestions {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; justify-content: center;
}

.chat-suggest-btn {
  padding: 8px 14px; border-radius: var(--r-full); border: 1px solid var(--divider);
  background: transparent; color: var(--text-2); font-size: 12px;
  font-family: var(--ff-body); cursor: pointer; transition: var(--t-fast);
}

.chat-suggest-btn:hover { border-color: var(--arc-dim); color: var(--arc-bright); background: var(--arc-glow); }

.chat-msg {
  display: flex; gap: 10px; align-items: flex-start;
}

.chat-msg-user { flex-direction: row-reverse; }

.chat-msg-avatar {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 14px;
  background: var(--bg-struct); border: 1px solid var(--divider);
}

.chat-msg-assistant .chat-msg-avatar { background: var(--arc-glow); border-color: var(--arc-dim); }

.chat-msg-content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chat-msg-user .chat-msg-content { align-items: flex-end; }

.chat-msg-text {
  font-size: 14px; line-height: 1.6; color: var(--text-1);
  word-wrap: break-word;
  display: inline-block; max-width: 88%;
  padding: 8px 12px; border-radius: var(--r-md);
  background: var(--bg-struct);
}

.chat-msg-assistant .chat-msg-text {
  border-radius: 4px var(--r-md) var(--r-md) var(--r-md);
}

.chat-msg-user .chat-msg-text {
  background: var(--arc); color: #fff;
  border-radius: var(--r-md) 4px var(--r-md) var(--r-md);
  text-align: left;
}

.chat-msg-text code {
  background: rgba(0,0,0,.25); padding: 1px 5px; border-radius: 3px;
  font-family: var(--ff-mono); font-size: 12px;
}

.chat-msg-list {
  margin: 4px 0; padding-left: 18px;
}
.chat-msg-list li { margin-bottom: 2px; }

.chat-msg-meta {
  font-size: 11px; color: var(--text-3); margin-top: 4px;
}

.chat-action-badge {
  display: inline-block; padding: 4px 10px; background: var(--green);
  color: var(--green-fg); font-size: 11px; border-radius: var(--r-full);
  margin: 4px 0 4px 38px;
}

.chat-input-bar {
  padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--divider);
}

.chat-form {
  display: flex; gap: 8px; align-items: flex-end;
}

.chat-form textarea {
  flex: 1; resize: none; border: 1px solid var(--divider);
  border-radius: var(--r-md); background: var(--bg-struct);
  color: var(--text-1); font-family: var(--ff-body); font-size: 14px;
  padding: 10px 14px; min-height: 40px; max-height: 120px;
  line-height: 1.4;
}

.chat-form textarea:focus { outline: none; border-color: var(--arc); box-shadow: 0 0 0 2px var(--arc-glow); }

.chat-send-btn {
  width: 40px; height: 40px; border-radius: var(--r-md);
  border: none; background: var(--arc); color: #fff;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: var(--t-fast); flex-shrink: 0;
}

.chat-send-btn:hover { background: var(--arc-bright); }
.chat-send-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ================================================================
   TELEGRAM
   ================================================================ */

.tg-messages {
  display: flex; flex-direction: column; gap: 8px;
}

.tg-msg-card {
  background: var(--bg-surface); border: 1px solid var(--bg-surface-bd);
  border-radius: var(--r-md); padding: 12px 16px;
}

.tg-msg-header {
  display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
}

.tg-msg-type {
  font-size: 12px; color: var(--text-2); font-weight: 600;
  text-transform: capitalize;
}

.tg-msg-time {
  font-size: 11px; color: var(--text-3); margin-left: auto;
}

.tg-action-badge {
  font-size: 10px; padding: 2px 8px; border-radius: var(--r-full);
  background: var(--green); color: var(--green-fg); font-weight: 600;
  text-transform: capitalize;
}

.tg-msg-transcribed {
  font-size: 13px; color: var(--text-2); line-height: 1.5;
  padding: 6px 0; border-bottom: 1px solid var(--divider);
}

.tg-msg-text {
  font-size: 13px; color: var(--text-1); line-height: 1.5; margin-top: 4px;
}

.tg-msg-summary {
  font-size: 12px; color: var(--arc-bright); margin-top: 4px;
  font-style: italic;
}

/* ================================================================
   POMODORO
   ================================================================ */

.pomodoro-container {
  max-width: 480px;
}

.pomodoro-timer-card {
  background: var(--bg-surface); border: 1px solid var(--bg-surface-bd);
  border-radius: var(--r-lg); padding: var(--sp-7);
  text-align: center; margin-bottom: var(--sp-5);
}

.pomodoro-display {
  font-family: var(--ff-display); font-size: 72px; font-weight: 700;
  color: var(--arc-bright); letter-spacing: 4px;
  text-shadow: 0 0 20px var(--arc-glow-hi);
  margin-bottom: var(--sp-5);
}

.pomodoro-controls {
  display: flex; align-items: center; justify-content: center; gap: var(--sp-3);
}

.pomodoro-start-btn {
  min-width: 120px; padding: 12px 24px !important; font-size: 16px !important;
}

.pomodoro-settings {
  margin-top: var(--sp-4);
}

/* ================================================================
   HEALTH / WORKOUT
   ================================================================ */

.workout-template-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--sp-4);
}

.workout-template-card {
  background: var(--bg-surface); border: 1px solid var(--bg-surface-bd);
  border-radius: var(--r-md); padding: var(--sp-4);
  transition: var(--t-fast);
}
.workout-template-card:hover {
  border-color: var(--arc-dim); box-shadow: var(--sh-card);
}

.workout-template-header {
  display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-3);
}

.workout-template-icon {
  font-size: 28px; width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  background: var(--arc-glow); border-radius: var(--r-sm);
}

.workout-template-name {
  font-family: var(--ff-display); font-size: 14px; font-weight: 600;
  color: var(--text-1); letter-spacing: 0.03em;
}

.workout-template-meta {
  font-size: 12px; color: var(--text-3); margin-top: 2px;
}

.workout-template-actions {
  display: flex; gap: var(--sp-2); margin-top: var(--sp-3);
  border-top: 1px solid var(--divider); padding-top: var(--sp-3);
}

/* Active workout header */
.workout-active-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: var(--sp-4) 0; margin-bottom: var(--sp-4);
  border-bottom: 1px solid var(--divider);
}

.workout-active-title {
  font-family: var(--ff-display); font-size: 20px; font-weight: 700;
  color: var(--text-1); letter-spacing: 1px; margin: 0;
}

.workout-active-timer {
  font-family: var(--ff-mono); font-size: 28px; color: var(--arc-bright);
  text-shadow: 0 0 12px var(--arc-glow-hi); letter-spacing: 2px;
}

/* Exercise cards in active workout */
.workout-exercise-card {
  background: var(--bg-surface); border: 1px solid var(--bg-surface-bd);
  border-radius: var(--r-md); margin-bottom: var(--sp-4); overflow: hidden;
}

.workout-exercise-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--divider);
}

.workout-exercise-info { display: flex; align-items: center; gap: var(--sp-3); }

.workout-exercise-name {
  font-family: var(--ff-display); font-size: 14px; font-weight: 600;
  color: var(--text-1); letter-spacing: 0.03em;
}

.workout-exercise-body {
  display: flex; gap: var(--sp-4); padding: var(--sp-4);
}

/* Animation container */
.exercise-animation {
  width: 160px; min-width: 160px; height: 160px;
  border: 1px solid var(--arc-glow-md); border-radius: var(--r-sm);
  background: var(--bg-struct); display: flex; align-items: center; justify-content: center;
  position: relative;
}
.exercise-animation::before {
  content: ''; position: absolute; inset: 0; border-radius: var(--r-sm);
  box-shadow: inset 0 0 20px rgba(245,240,230,0.06);
  pointer-events: none;
}

/* Sets area */
.workout-sets-area { flex: 1; min-width: 0; }

.workout-sets-header {
  display: flex; gap: var(--sp-2); align-items: center;
  font-size: 10px; font-weight: 700; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 1px;
  padding-bottom: var(--sp-2); margin-bottom: var(--sp-2);
  border-bottom: 1px solid var(--divider);
}
.workout-sets-header span { flex: 1; text-align: center; }
.workout-sets-header span:first-child { flex: 0 0 32px; }
.workout-sets-header span:last-child { flex: 0 0 36px; }

/* Set rows */
.set-row {
  display: flex; gap: var(--sp-2); align-items: center;
  padding: var(--sp-1) 0; transition: var(--t-fast);
}
.set-row.completed { opacity: 0.6; }

.set-number {
  flex: 0 0 32px; text-align: center;
  font-family: var(--ff-mono); font-size: 12px; color: var(--text-3);
}

.set-input {
  flex: 1; min-width: 0;
  background: var(--bg-app); border: 1px solid var(--divider);
  border-radius: var(--r-xs); color: var(--text-1);
  font-family: var(--ff-mono); font-size: 14px;
  text-align: center; padding: 6px 4px;
  -moz-appearance: textfield;
}
.set-input::-webkit-inner-spin-button,
.set-input::-webkit-outer-spin-button { -webkit-appearance: none; }
.set-input:focus { outline: none; border-color: var(--arc); box-shadow: 0 0 0 2px var(--arc-glow); }

.set-reps-control {
  flex: 1; display: flex; align-items: center; gap: 2px;
}

.set-reps-btn {
  width: 28px; height: 28px; border: 1px solid var(--divider);
  border-radius: var(--r-xs); background: var(--bg-struct);
  color: var(--text-2); font-size: 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--t-fast);
}
.set-reps-btn:hover { border-color: var(--arc-dim); color: var(--arc-bright); }

.set-reps-input { flex: 1; min-width: 36px; }

.set-complete-btn {
  flex: 0 0 36px; height: 32px;
  border: 1px solid var(--divider); border-radius: var(--r-xs);
  background: transparent; color: var(--text-3);
  font-size: 14px; cursor: pointer; transition: var(--t-fast);
}
.set-complete-btn:hover { border-color: var(--green-fg); color: var(--green-fg); }
.set-complete-btn.done {
  background: var(--green); border-color: var(--green-fg); color: var(--green-fg);
}

/* Rest timer overlay */
.rest-timer-overlay {
  position: fixed; bottom: 20px; right: 20px; z-index: 100;
  display: flex; align-items: center; justify-content: center;
}

.rest-timer-content {
  background: var(--bg-surface); border: 1px solid var(--arc-dim);
  border-radius: var(--r-lg); padding: var(--sp-5);
  box-shadow: var(--sh-raise); text-align: center; min-width: 200px;
}

.rest-timer-label {
  font-family: var(--ff-display); font-size: 12px; font-weight: 700;
  color: var(--text-3); letter-spacing: 3px; margin-bottom: var(--sp-2);
}

.rest-timer-display {
  font-family: var(--ff-display); font-size: 40px; font-weight: 700;
  color: var(--arc-bright); text-shadow: 0 0 16px var(--arc-glow-hi);
}

.rest-timer-bar-bg {
  width: 100%; height: 4px; background: var(--bg-struct);
  border-radius: var(--r-full); margin-top: var(--sp-3); overflow: hidden;
}

.rest-timer-bar {
  height: 100%; background: var(--arc); border-radius: var(--r-full);
  transition: width 1s linear;
}

/* Exercise picker modal */
.exercise-picker-filters {
  display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-bottom: var(--sp-3);
}

.exercise-filter-chip {
  padding: 4px 12px; border: 1px solid var(--divider); border-radius: var(--r-full);
  background: transparent; color: var(--text-2); font-size: 12px;
  font-family: var(--ff-body); cursor: pointer; transition: var(--t-fast);
}
.exercise-filter-chip:hover,
.exercise-filter-chip.active {
  border-color: var(--arc); color: var(--arc-bright); background: var(--arc-glow);
}

.exercise-picker-list {
  max-height: 400px; overflow-y: auto;
}

.exercise-picker-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: var(--sp-3) var(--sp-2); border-bottom: 1px solid var(--divider);
  cursor: pointer; transition: var(--t-fast);
}
.exercise-picker-item:hover { background: var(--arc-glow); }

.exercise-picker-name {
  font-family: var(--ff-display); font-size: 13px; font-weight: 600;
  color: var(--text-1); letter-spacing: 0.02em;
}

.exercise-picker-meta { display: flex; gap: var(--sp-2); }

/* History cards */
.workout-history-list { display: flex; flex-direction: column; gap: var(--sp-2); }

.workout-history-card {
  background: var(--bg-surface); border: 1px solid var(--bg-surface-bd);
  border-radius: var(--r-sm); padding: var(--sp-3) var(--sp-4);
  cursor: pointer; transition: var(--t-fast);
}
.workout-history-card:hover { border-color: var(--arc-dim); }

.workout-history-name {
  font-family: var(--ff-display); font-size: 13px; font-weight: 600;
  color: var(--text-1); margin-bottom: 4px; letter-spacing: 0.02em;
}

.workout-history-meta {
  display: flex; gap: var(--sp-3); font-size: 12px; color: var(--text-3);
}

/* Workout summary */
.workout-summary { max-width: 600px; }

/* Template exercise list in modal */
.template-exercise-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 8px; border-bottom: 1px solid var(--divider);
  font-size: 13px; color: var(--text-1);
}

/* ================================================================
   Workout redesign — rich stat cards, live session, rest banner
   ================================================================ */

/* Mono eyebrow used across the redesign */
.wk-eyebrow {
  font: 500 10px var(--ff-mono); letter-spacing: .16em;
  text-transform: uppercase; color: var(--text-2);
}

.wk-stat-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-3); margin-bottom: var(--sp-5);
}
.wk-stat {
  background: var(--bg-surface); border: 1px solid var(--bg-surface-bd);
  border-radius: var(--r-xl); padding: 18px;
  display: flex; flex-direction: column; gap: 8px;
  transition: var(--t-fast);
}
.wk-stat:hover { border-color: var(--arc-glow-hi); }
.wk-stat-value {
  font-family: var(--ff-display); font-size: 32px; font-weight: 700;
  color: #fff; line-height: 1; letter-spacing: -.01em;
}
.wk-stat-value.sm { font-size: 18px; }
.wk-stat-sub { font-size: 12px; color: var(--text-3); }
.wk-stat-row { display: flex; align-items: baseline; gap: 8px; }

/* 5-segment weekly-goal progress */
.wk-seg-row { display: flex; gap: 4px; margin-top: 2px; }
.wk-seg {
  flex: 1; height: 6px; border-radius: var(--r-full);
  background: rgba(255,255,255,.12);
}
.wk-seg.on { background: var(--arc); }

/* Trend chip (▲/▼ %) */
.wk-trend { font-family: var(--ff-mono); font-size: 12px; font-weight: 500; }
.wk-trend.up { color: var(--green-fg); }
.wk-trend.down { color: var(--red-fg); }
.wk-trend.flat { color: var(--text-3); }

/* Live session — elevated header card with pulsing dot */
.workout-active-header {
  background: var(--bg-surface); border: 1px solid var(--arc-glow-hi);
  border-radius: var(--r-xl); padding: 18px 22px; margin-bottom: var(--sp-4);
  box-shadow: 0 10px 34px -16px rgba(251,113,133,.5);
}
.wk-live {
  display: inline-flex; align-items: center; gap: 7px;
  font: 500 10px var(--ff-mono); letter-spacing: .16em;
  text-transform: uppercase; color: var(--green-fg); margin-bottom: 4px;
}
.wk-live-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--green-fg);
  box-shadow: 0 0 0 0 rgba(127,221,158,.6); animation: nowpulse 2.4s ease-out infinite;
}
.wk-active-sub { font-size: 13px; color: var(--text-2); margin-top: 4px; }
@keyframes nowpulse {
  0%   { box-shadow: 0 0 0 0 rgba(127,221,158,.55); }
  70%  { box-shadow: 0 0 0 7px rgba(127,221,158,0); }
  100% { box-shadow: 0 0 0 0 rgba(127,221,158,0); }
}

/* Set-check pop */
@keyframes popset {
  0% { transform: scale(1); } 45% { transform: scale(1.22); } 100% { transform: scale(1); }
}
.set-complete-btn.done { animation: popset .3s ease; }
.set-row.completed { background: var(--green); border-radius: var(--r-sm); opacity: 1; }
.set-row.completed .set-number,
.set-row.completed .set-input { color: var(--green-fg); }

/* Rest timer → blue-tinted banner */
.rest-timer-content {
  background: rgba(127,176,255,.12); border: 1px solid rgba(127,176,255,.4);
  border-radius: var(--r-lg); padding: var(--sp-5);
  box-shadow: var(--sh-raise); text-align: center; min-width: 210px;
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}
.rest-timer-label { color: var(--blue-fg); }
.rest-timer-display { color: var(--blue-fg); text-shadow: 0 0 16px rgba(127,176,255,.4); }
.rest-timer-bar { background: var(--blue-fg); }

/* --- Workout control bar: units toggle + accent swatches --- */
.wk-controls {
  display: flex; gap: 22px; justify-content: flex-end; flex-wrap: wrap;
  align-items: center; margin-bottom: 16px;
}
.wk-ctl { display: flex; align-items: center; gap: 8px; }
.wk-seg2 {
  display: inline-flex; border: 1px solid var(--bg-surface-bd);
  border-radius: var(--r-full); overflow: hidden;
}
.wk-seg2 button {
  padding: 5px 14px; background: transparent; border: none;
  color: var(--text-2); font: 600 12px var(--ff-body); cursor: pointer;
  transition: var(--t-fast);
}
.wk-seg2 button.active { background: var(--arc); color: var(--cta-fg); }
.wk-accent-row { display: flex; gap: 7px; }
.dash-accent { display: flex; align-items: center; gap: 8px; }
.wk-swatch {
  width: 20px; height: 20px; border-radius: 50%; background: var(--sw);
  border: 2px solid transparent; cursor: pointer; padding: 0;
  transition: var(--t-fast);
}
.wk-swatch:hover { transform: scale(1.12); }
.wk-swatch.active { border-color: var(--text-1); box-shadow: 0 0 0 2px var(--bg-app), 0 0 10px var(--sw); }

/* --- Muscle map card: period selector, figure + ranked list, heat legend --- */
.wk-mm-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 14px;
}
.wk-period-seg {
  display: inline-flex; gap: 3px; background: var(--bg-struct);
  border-radius: var(--r-full); padding: 3px;
}
.wk-period {
  padding: 4px 11px; border: none; background: transparent; cursor: pointer;
  border-radius: var(--r-full); color: var(--text-3);
  font: 500 11px var(--ff-mono); letter-spacing: .04em; transition: var(--t-fast);
}
.wk-period:hover { color: var(--text-2); }
.wk-period.active { background: var(--arc); color: var(--cta-fg); }

.wk-mm-body { display: flex; gap: 20px; align-items: flex-start; }
.wk-mm-figure { flex: 0 0 300px; max-width: 300px; }
.wk-mm-side { flex: 1; min-width: 0; }
.wk-mm-list {
  column-count: 2; column-gap: 26px;
}
.wk-ml-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 6px; border-bottom: 1px solid var(--divider);
}
.wk-ml-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.wk-ml-name { flex: 1; font-size: 13px; color: var(--text-1); }
.wk-ml-val { font-family: var(--ff-mono); font-size: 13px; color: var(--text-2); }
.wk-ml-val span { font-size: 10px; color: var(--text-3); }
.wk-ml-empty { color: var(--text-3); font-size: 13px; padding: 16px 6px; }

/* Grouped / indented detailed list with square heat swatches — flows into
   columns (no scroll), tight row rhythm. */
.wk-ml-group { break-inside: avoid; margin-bottom: 12px; }
.wk-ml-sq { width: 11px; height: 11px; border-radius: 3px; flex-shrink: 0; }
.wk-ml-sq.lg { width: 13px; height: 13px; border-radius: 4px; }
.wk-ml-cat {
  display: flex; align-items: center; gap: 9px;
  padding: 3px 4px 5px; border-bottom: 1px solid var(--divider);
}
.wk-ml-catname {
  flex: 1; font: 600 11px var(--ff-mono); letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-1);
}
.wk-ml-sub {
  display: flex; align-items: center; gap: 9px;
  padding: 2px 4px 2px 20px;
}
.wk-ml-sub .wk-ml-name { font-size: 12.5px; color: var(--text-2); }
.wk-ml-sub.off { opacity: .45; }

.wk-heat-legend { display: flex; align-items: center; gap: 10px; margin-top: 16px; max-width: 300px; }
.wk-heat-bar { flex: 1; height: 8px; border-radius: var(--r-full); }
.wk-heat-cap { font: 500 10px var(--ff-mono); letter-spacing: .08em; color: var(--text-3); white-space: nowrap; }

/* --- Per-exercise mini muscle map (replaces the stick figure) --- */
.wk-ex-map {
  width: 120px; min-width: 120px;
  display: flex; align-items: center; justify-content: center;
}
.wk-ex-map .mm-stage { max-width: 110px; }
.wk-ex-map .mm-svg { max-height: 190px; }

@media (max-width: 720px) {
  .wk-stat-grid { grid-template-columns: repeat(2, 1fr); }
  .wk-mm-body { flex-direction: column; }
  .wk-mm-figure { flex: none; max-width: 240px; margin: 0 auto; }
  .wk-mm-list { column-count: 1; }
  .wk-controls { justify-content: space-between; }
}

/* ================================================================
   GOALS
   ================================================================ */

.goals-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--sp-4);
}

.goal-card {
  background: var(--bg-surface); border: 1px solid var(--bg-surface-bd);
  border-radius: var(--r-md); padding: var(--sp-4);
  transition: var(--t-fast);
}
.goal-card:hover { border-color: var(--arc-dim); }

.goal-card-header { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-3); }

.goal-icon {
  font-size: 24px; width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm); flex-shrink: 0;
}

.goal-info { flex: 1; min-width: 0; }

.goal-title {
  font-family: var(--ff-display); font-size: 14px; font-weight: 600;
  color: var(--text-1); letter-spacing: 0.03em;
}

.goal-meta {
  display: flex; gap: var(--sp-2); flex-wrap: wrap; margin-top: 2px;
  font-size: 12px; color: var(--text-3);
}

.goal-desc {
  font-size: 13px; color: var(--text-2); margin-bottom: var(--sp-3);
  line-height: 1.4;
}

.goal-progress-row {
  display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-3);
}

.goal-progress-bar-bg {
  flex: 1; height: 8px; background: var(--bg-struct);
  border-radius: var(--r-full); overflow: hidden;
}

.goal-progress-bar-fill {
  height: 100%; border-radius: var(--r-full);
  transition: width 0.3s ease;
}

.goal-progress-pct {
  font-family: var(--ff-mono); font-size: 13px; color: var(--text-2);
  min-width: 36px; text-align: right;
}

.goal-milestones {
  display: flex; flex-direction: column; gap: 2px;
  margin-bottom: var(--sp-3); padding: var(--sp-2) 0;
  border-top: 1px solid var(--divider); border-bottom: 1px solid var(--divider);
}

.goal-milestone {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: 4px var(--sp-2); border-radius: var(--r-xs);
  cursor: pointer; font-size: 13px; color: var(--text-1);
  transition: var(--t-fast);
}
.goal-milestone:hover { background: var(--arc-glow); }
.goal-milestone.done { color: var(--text-3); text-decoration: line-through; }

.goal-ms-check {
  width: 18px; height: 18px; border: 1.5px solid var(--divider);
  border-radius: var(--r-xs); display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: var(--green-fg); flex-shrink: 0;
}
.goal-milestone.done .goal-ms-check {
  background: var(--green); border-color: var(--green-fg);
}

.goal-card-actions {
  display: flex; gap: var(--sp-2); flex-wrap: wrap;
  border-top: 1px solid var(--divider); padding-top: var(--sp-3);
}

/* ================================================================
   KANBAN
   ================================================================ */

.kanban-board {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-4); min-height: 400px;
}

.kanban-column {
  background: var(--bg-struct); border: 1px solid var(--bg-struct-bd);
  border-radius: var(--r-md); display: flex; flex-direction: column;
}

.kanban-column-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--divider);
}

.kanban-column-title {
  font-family: var(--ff-display); font-size: 12px; font-weight: 700;
  color: var(--text-2); text-transform: uppercase; letter-spacing: 1px;
}

.kanban-column-count {
  font-family: var(--ff-mono); font-size: 12px; color: var(--text-3);
  background: var(--bg-app); border-radius: var(--r-full);
  padding: 2px 8px;
}

.kanban-column-body {
  flex: 1; padding: var(--sp-3); display: flex; flex-direction: column;
  gap: var(--sp-2); overflow-y: auto;
}

.kanban-empty {
  text-align: center; color: var(--text-3); font-size: 13px;
  padding: var(--sp-6) 0;
}

.kanban-card {
  background: var(--bg-surface); border: 1px solid var(--bg-surface-bd);
  border-radius: var(--r-sm); padding: var(--sp-3);
  transition: var(--t-fast);
}
.kanban-card:hover { border-color: var(--arc-dim); box-shadow: var(--sh-card); }

.kanban-card-title {
  font-size: 13px; font-weight: 600; color: var(--text-1);
  margin-bottom: var(--sp-2); cursor: pointer;
}
.kanban-card-title:hover { color: var(--arc-bright); }

.kanban-card-meta {
  display: flex; gap: var(--sp-2); align-items: center; margin-bottom: var(--sp-2);
}

.kanban-card-due { font-size: 11px; color: var(--text-3); font-family: var(--ff-mono); }

.kanban-card-actions { display: flex; gap: var(--sp-1); }

.view-toggle {
  display: flex; border: 1px solid var(--divider); border-radius: var(--r-sm);
  overflow: hidden;
}

.view-toggle-btn {
  padding: 6px 10px; background: transparent; border: none;
  color: var(--text-3); font-size: 14px; cursor: pointer;
  transition: var(--t-fast);
}
.view-toggle-btn:hover { color: var(--text-1); }
.view-toggle-btn.active {
  background: var(--arc-glow); color: var(--arc-bright);
}

/* ================================================================
   INSIGHTS / CHARTS
   ================================================================ */

.insights-charts-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--sp-4); align-items: start;
}

.insight-chart-card {
  background: var(--bg-surface); border: 1px solid var(--bg-surface-bd);
  border-radius: var(--r-md); overflow: hidden;
}

.insight-chart-title {
  font-family: var(--ff-display); font-size: 13px; font-weight: 600;
  color: var(--text-1); letter-spacing: 0.05em;
  padding: var(--sp-3) var(--sp-4); margin: 0;
  border-bottom: 1px solid var(--divider);
}

.insight-chart-body {
  padding: var(--sp-4); overflow-x: auto;
}

/* ================================================================
   HABIT TRACKER GRID + DAY PICKER
   ================================================================ */

.day-picker {
  display: flex; gap: 4px;
}

.day-picker-btn {
  width: 32px; height: 32px; border-radius: var(--r-sm);
  border: 1px solid var(--divider); background: var(--bg-struct);
  color: var(--text-3); font-size: 11px; font-weight: 600;
  cursor: pointer; transition: all var(--t-fast);
  display: flex; align-items: center; justify-content: center;
  font-family: inherit;
}
.day-picker-btn:hover { border-color: var(--arc-dim); color: var(--text-2); }
.day-picker-btn.selected {
  background: var(--arc-glow-md); border-color: var(--arc);
  color: var(--arc-bright);
}

.habit-priority-note { font-size: 11.5px; color: var(--text-3); margin: 4px 0 16px; }
.habit-priority-note b { color: var(--text-2); }

.tracker-card {
  background: var(--bg-surface); border: 1px solid var(--bg-surface-bd);
  border-radius: var(--r-md); padding: 18px 20px; overflow-x: auto;
}
.tracker-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.month-nav { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--text-1); }
.month-nav button {
  background: none; border: none; color: var(--text-2); cursor: pointer;
  font-size: 15px; padding: 2px 6px; font-family: inherit;
}
.month-nav button:hover { color: var(--text-1); }
.legend-key { display: flex; gap: 14px; font-size: 10.5px; color: var(--text-3); }
.legend-key span { display: flex; align-items: center; gap: 5px; }
.key-sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.tmatrix { display: grid; gap: 5px; min-width: 620px; }
.tm-col-head {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 4px 2px 10px; cursor: pointer; border-radius: var(--r-sm);
}
.tm-col-head:hover { background: rgba(245,240,230,.04); }
.tm-col-icon {
  width: 28px; height: 28px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; font-size: 14px;
}
.tm-col-name { font-size: 10.5px; color: var(--text-1); text-align: center; font-weight: 600; }
.tm-col-meta { display: flex; align-items: center; gap: 5px; font-size: 9.5px; color: var(--text-3); }
.tm-star { background: none; border: none; cursor: pointer; font-size: 12px; color: var(--text-3); padding: 0; line-height: 1; font-family: inherit; }
.tm-star.active { color: var(--chart-3); }
.tm-add-col {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 6px;
  padding-top: 4px; cursor: pointer; border-radius: var(--r-sm); border: 1px dashed var(--bg-surface-bd);
}
.tm-add-col:hover { border-color: var(--text-3); }
.tm-add-icon {
  width: 28px; height: 28px; border-radius: 8px; display: flex; align-items: center;
  justify-content: center; font-size: 16px; color: var(--text-3); background: rgba(245,240,230,.05);
}
.tm-add-label { font-size: 10px; color: var(--text-3); }

.tm-row-label {
  display: flex; align-items: center; gap: 6px; font-size: 11px;
  color: var(--text-2); font-family: var(--ff-mono);
}
.tm-row-label .dow { color: var(--text-3); font-size: 9.5px; width: 26px; }
.tm-row-label.today { color: var(--text-1); font-weight: 700; }
.tm-cell {
  height: 24px; border-radius: 6px; cursor: pointer; background: rgba(245,240,230,.07);
  transition: background .12s, transform .08s; user-select: none;
}
.tm-cell:active { transform: scale(0.92); }
.tm-cell.green { background: var(--chart-4); }
.tm-cell.red { background: var(--danger); }
.tm-cell.future { background: rgba(245,240,230,.03); cursor: default; }

/* compact priority-habit widget on the dashboard */
.habit-grid { display: grid; gap: 6px; align-items: center; }
.hg-col-label {
  font-size: 9px; color: var(--text-2); text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hg-row-label { font-size: 9.5px; color: var(--text-2); white-space: nowrap; }
.hg-cell {
  aspect-ratio: 1; max-height: 46px; border-radius: 5px; cursor: pointer; background: rgba(245,240,230,.08);
  transition: background .12s;
}
.hg-cell.green { background: var(--chart-4); }
.hg-cell.red { background: var(--danger); }
.hg-cell.disabled { cursor: default; opacity: .4; }

/* ================================================================
   RESPONSIVE — Goals / Kanban
   ================================================================ */
@media (max-width: 768px) {
  .kanban-board { grid-template-columns: 1fr; }
  .goals-grid { grid-template-columns: 1fr; }
}

/* ================================================================
   RESPONSIVE — Health
   ================================================================ */
@media (max-width: 768px) {
  .workout-exercise-body { flex-direction: column; }
  .exercise-animation { width: 100%; min-width: unset; height: 140px; }
  .workout-active-header { flex-direction: column; gap: var(--sp-3); text-align: center; }
}


/* ================================================================
   RESPONSIVE — narrow-window layout (fine pointer, <= 700px)
   Phone layout does NOT live here — see static/css/mobile.css, which
   owns everything behind the (pointer: coarse) breakpoint. The nav
   rules that used to build a bottom scroll strip were deleted (D1);
   a narrow desktop window now keeps the normal vertical sidebar.
   ================================================================ */
@media (max-width: 700px) {
  .page-header.flex,
  .page-header .flex {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 10px;
  }

  .fab {
    right: 16px;
    width: 48px;
    height: 48px;
    font-size: 24px;
  }

  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-bento-4 { grid-template-columns: repeat(2, 1fr); }

  /* ---- Chat ---- */
  .chat-layout { flex-direction: column; }

  .chat-mobile-bar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 12px; border-bottom: 1px solid var(--divider);
    flex-shrink: 0;
  }

  .chat-mobile-title {
    font-size: 13px; font-weight: 600; color: var(--text-1);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    flex: 1; text-align: center; padding: 0 8px;
  }

  .chat-drawer-backdrop {
    position: fixed; inset: 0; bottom: 60px; background: rgba(0,0,0,.5);
    z-index: 499; opacity: 0; pointer-events: none; transition: opacity .2s ease;
  }
  .chat-drawer-backdrop.open { display: block; opacity: 1; pointer-events: auto; }

  .chat-sidebar {
    position: fixed; top: 0; left: 0; bottom: 60px;
    width: 260px; max-width: 80vw;
    background: var(--bg-app);
    z-index: 500;
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: var(--sh-raise);
  }
  .chat-sidebar.open { transform: translateX(0); }

  .chat-messages { padding: var(--sp-3); gap: var(--sp-3); }
  .chat-input-bar { padding: var(--sp-2) var(--sp-3); }
  .chat-msg-text { max-width: 82%; font-size: 13px; }
  .chat-msg-avatar { width: 24px; height: 24px; font-size: 12px; }
}

/* ================================================================
   Wishlist
   ================================================================ */

.wl-filters {
  display: flex;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
  flex-wrap: wrap;
}

.wl-approval {
  background: var(--bg-surface);
  border: 1px solid rgba(245,240,230,.25);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-raise);
  padding: var(--sp-4) var(--sp-5);
  margin-bottom: var(--sp-4);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--sp-4);
  flex-wrap: wrap;
}

.wl-approval-label {
  font-size: 9px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; color: var(--text-2); font-family: var(--ff-mono);
}

.wl-approval-path { font-size: 14px; font-weight: 600; color: var(--text-1); margin-top: 2px; }
.wl-chevron { color: var(--text-3); }
.wl-approval-meta { font-size: 11px; color: var(--text-3); font-family: var(--ff-mono); margin-top: 4px; }
.wl-approval-actions { display: flex; gap: var(--sp-2); flex-shrink: 0; }

.wl-layout {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: var(--sp-4);
  align-items: start;
}

@media (max-width: 800px) {
  .wl-layout { grid-template-columns: 1fr; }
}

.wl-sidebar {
  background: var(--bg-sidebar);
  border: 1px solid var(--bg-struct-bd);
  border-radius: var(--r-lg);
  padding: var(--sp-2);
  position: sticky;
  top: 16px;
  align-self: start;
}
@media (max-width: 800px) { .wl-sidebar { position: static; } }

.wl-divider { border-top: 1px solid var(--divider); margin: var(--sp-2) var(--sp-1); }

.wl-cat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--sp-2) var(--sp-2);
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
  cursor: pointer;
  transition: background var(--t-fast);
}
.wl-cat:hover { background: var(--arc-glow); }
.wl-cat-active { background: var(--arc-glow-md); color: var(--arc-bright); }

.wl-subcats { margin-bottom: 2px; }

.wl-subcat {
  display: flex;
  justify-content: space-between;
  padding: 5px var(--sp-2) 5px 26px;
  border-radius: var(--r-sm);
  font-size: 12px;
  color: var(--text-2);
  cursor: pointer;
  transition: background var(--t-fast);
}
.wl-subcat:hover { background: var(--arc-glow); color: var(--text-1); }
.wl-subcat.wl-cat-active { background: var(--arc-glow-md); color: var(--arc-bright); }

.wl-count { font-size: 10px; color: var(--text-3); font-family: var(--ff-mono); }

.wl-drop-hover { background: var(--arc-glow-hi) !important; outline: 1px dashed var(--arc-dim); }

.wl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: var(--sp-3);
}

.wl-card {
  background: var(--bg-surface);
  border: 1px solid var(--bg-surface-bd);
  border-radius: var(--r-md);
  overflow: hidden;
  cursor: grab;
  display: flex;
  flex-direction: column;
  box-shadow: 0 1px 2px rgba(0,0,0,.12), 0 6px 20px rgba(0,0,0,.10);
  transition: transform var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast);
}
.wl-card:hover { transform: translateY(-3px); border-color: var(--arc); box-shadow: 0 12px 34px var(--arc-glow-md); }
.wl-card-review { outline: 1px dashed var(--arc-dim); outline-offset: -3px; }

.wl-card-img {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--bg-struct);
  display: flex;
  align-items: center;
  justify-content: center;
}
.wl-card-img img { width: 100%; height: 100%; object-fit: cover; }
.wl-card-noimg { font-family: var(--ff-display); font-size: 34px; font-weight: 700; color: var(--text-3); opacity: 0.5; user-select: none; }

.wl-card-body { padding: 11px 12px 12px; display: flex; flex-direction: column; gap: 5px; flex: 1; }

.wl-badge {
  position: absolute;
  top: 8px; left: 8px;
  font-family: var(--ff-mono);
  font-size: 10px;
  letter-spacing: 0.03em;
  padding: 3px 8px;
  border-radius: var(--r-full);
  background: rgba(0,0,0,.46);
  color: #fff;
  backdrop-filter: blur(6px);
  max-width: calc(100% - 16px);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.wl-badge-review { position: static; background: var(--orange); color: var(--orange-fg); backdrop-filter: none; }

.wl-card-path { font-family: var(--ff-mono); font-size: 10px; color: var(--text-3); letter-spacing: 0.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wl-card-title {
  font-family: var(--ff-display);
  font-size: 13.5px; font-weight: 600; color: var(--text-1); line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.wl-card-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 4px; }
.wl-card-price { font-family: var(--ff-mono); font-size: 12.5px; font-weight: 600; color: var(--text-1); font-variant-numeric: tabular-nums; }
.wl-card-meta { font-size: 11px; color: var(--text-3); font-family: var(--ff-mono); }
.wl-pill-want { background: var(--arc-glow); color: var(--arc-bright); }

/* view toggle: tiles vs rows */
.wl-viewtoggle { display: inline-flex; gap: 2px; background: var(--bg-struct); border: 1px solid var(--bg-struct-bd); border-radius: var(--r-sm); padding: 3px; }
.wl-viewtoggle button { border: 0; background: transparent; cursor: pointer; color: var(--text-3); padding: 6px 9px; border-radius: 6px; display: grid; place-items: center; transition: background var(--t-fast), color var(--t-fast); }
.wl-viewtoggle button svg { width: 16px; height: 16px; display: block; }
.wl-viewtoggle button:hover { color: var(--text-1); }
.wl-viewtoggle button.active { background: var(--arc-glow-md); color: var(--arc-bright); }

/* rows view */
.wl-tablewrap { overflow-x: auto; border: 1px solid var(--bg-surface-bd); border-radius: var(--r-md); background: var(--bg-surface); }
.wl-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.wl-table thead th { font-family: var(--ff-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-3); text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--bg-struct-bd); white-space: nowrap; user-select: none; }
.wl-table thead th.wl-th-sort { cursor: pointer; }
.wl-table thead th.wl-th-sort:hover { color: var(--text-1); }
.wl-table thead th.num { text-align: right; }
.wl-th-ar { color: var(--arc-bright); font-size: 9px; margin-left: 3px; }
.wl-table tbody tr { cursor: pointer; transition: background var(--t-fast); }
.wl-table tbody tr:hover { background: var(--bg-struct); }
.wl-table tbody tr.wl-row-selected { background: var(--arc-glow-md); }
.wl-table tbody td { padding: 9px 14px; border-bottom: 1px solid var(--bg-struct-bd); color: var(--text-2); vertical-align: middle; white-space: nowrap; }
.wl-table tbody tr:last-child td { border-bottom: 0; }
.wl-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.wl-row-item { display: flex; align-items: center; gap: 11px; }
.wl-row-thumb { width: 34px; height: 34px; border-radius: var(--r-xs); background: var(--bg-struct); overflow: hidden; flex-shrink: 0; }
.wl-row-thumb img { width: 100%; height: 100%; object-fit: cover; }
.wl-row-title { font-weight: 600; color: var(--text-1); }
.wl-row-review .wl-row-title { color: var(--text-1); }
.wl-row-path { font-family: var(--ff-mono); font-size: 12px; color: var(--text-3); }
.wl-row-price { font-family: var(--ff-mono); font-weight: 600; color: var(--text-1); }
.wl-pill { font-size: 10px; font-family: var(--ff-mono); padding: 2px 8px; border-radius: var(--r-full); background: var(--bg-struct); color: var(--text-3); white-space: nowrap; }
.wl-pill-owned { background: var(--arc-glow-md); color: var(--arc-bright); }
.wl-pill-due { background: var(--orange); color: var(--orange-fg); }
.wl-pill-over { background: var(--danger-bg, rgba(242,96,110,.12)); color: var(--danger); }

/* ---------------------------------------------------------- inventory --- */
.inv-toolbar { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; margin-bottom: var(--sp-4); }
.inv-toolbar .filter-chips { margin-bottom: 0; }

.inv-rail { background: var(--orange); border: 1px solid color-mix(in srgb, var(--orange-fg) 30%, transparent); border-radius: var(--r-lg); padding: 12px 14px; margin-bottom: var(--sp-4); }
.inv-rail-title { font-family: var(--ff-mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--orange-fg); margin-bottom: 8px; }
.inv-rail-row { display: flex; gap: 18px; flex-wrap: wrap; }
.inv-rail-item { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-2); }
.inv-rail-item b { color: var(--text-1); font-weight: 600; }
.inv-rail-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--orange-fg); flex-shrink: 0; }
.inv-rail-dot.over { background: var(--danger); }

.inv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: var(--sp-3); }
.inv-card { background: var(--bg-surface); border: 1px solid var(--bg-surface-bd); border-radius: var(--r-md); padding: var(--sp-3); cursor: pointer; transition: border-color var(--t-fast), transform var(--t-fast); }
.inv-card:hover { border-color: var(--arc-dim); transform: translateY(-1px); }
.inv-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.inv-card-cat { font-family: var(--ff-mono); font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); }
.inv-card-name { font-family: var(--ff-display); font-weight: 600; font-size: 14px; color: var(--text-1); margin-top: 4px; line-height: 1.3; }
.inv-card-meta { font-size: 12px; color: var(--text-2); margin-top: 10px; }
.inv-card-sub { font-size: 11px; color: var(--text-3); margin-top: 3px; font-family: var(--ff-mono); }
.inv-actions { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }

.inv-ring { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; }
.inv-ring-lg { width: 54px; height: 54px; }
.inv-ring-inner { width: 30px; height: 30px; border-radius: 50%; background: var(--bg-solid); display: grid; place-items: center; font-family: var(--ff-mono); font-size: 9px; font-weight: 600; }
.inv-ring-lg .inv-ring-inner { width: 40px; height: 40px; font-size: 11px; }

.inv-toast { position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 120%); z-index: 1200; background: var(--bg-solid); border: 1px solid var(--bg-surface-bd); border-radius: var(--r-full); padding: 10px 18px; font-size: 13px; color: var(--text-1); box-shadow: 0 12px 40px rgba(0,0,0,.34); transition: transform 0.32s cubic-bezier(.34,1.4,.5,1); }
.inv-toast.show { transform: translate(-50%, 0); }
.inv-toast-error { border-color: var(--danger); color: var(--danger); }

/* --------------------------------------- belongings (wishlist+inventory) --- */
.wl-seg { display: inline-flex; background: var(--bg-struct); border: 1px solid var(--bg-struct-bd); border-radius: var(--r-full); padding: 3px; margin-bottom: 14px; }
.wl-seg button { border: 0; background: transparent; cursor: pointer; font-family: var(--ff-body); font-weight: 600; font-size: 13px; color: var(--text-3); padding: 8px 22px; border-radius: var(--r-full); transition: color var(--t-fast), background var(--t-fast); }
.wl-seg button:hover { color: var(--text-1); }
.wl-seg button.active { background: linear-gradient(180deg, var(--arc-bright), var(--arc)); color: #fff; box-shadow: 0 4px 14px var(--arc-glow-hi); }
.wl-card { position: relative; }
.wl-card-ring { position: absolute; top: 8px; right: 8px; z-index: 2; filter: drop-shadow(0 2px 6px rgba(0,0,0,.4)); }
.wl-card-actions { margin-top: 10px; }
.wl-card-btn { width: 100%; }

.wl-item-modal-grid { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 24px; }
@media (max-width: 680px) {
  .wl-item-modal-grid { grid-template-columns: 1fr; }
}

.wl-cat-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; flex-shrink: 0; color: var(--text-3);
  cursor: pointer; border-radius: var(--r-xs);
  transition: transform var(--t-fast), color var(--t-fast), background var(--t-fast);
}
.wl-cat-toggle svg { width: 14px; height: 14px; }
.wl-cat-toggle:hover { color: var(--text-1); background: var(--arc-glow); }
.wl-cat-toggle-collapsed { transform: rotate(-90deg); }
.wl-cat-label { cursor: pointer; }

/* Resources folder tree — hover-revealed folder actions (+ rename delete) */
.rz-cat-actions {
  display: inline-flex; gap: 2px; opacity: 0;
  transition: opacity var(--t-fast);
}
.wl-cat:hover .rz-cat-actions, .wl-cat-active .rz-cat-actions { opacity: 1; }
.rz-cat-actions button {
  background: none; border: none; cursor: pointer; padding: 0 3px;
  font-size: 11px; line-height: 1; color: var(--text-3); border-radius: var(--r-xs);
}
.rz-cat-actions button:hover { color: var(--text-1); background: var(--arc-glow); }
.rz-card[draggable="true"] { cursor: grab; }
.rz-card[draggable="true"]:active { cursor: grabbing; }

/* Utilities — collapsible tool sections + search */
.tool-section { margin-bottom: 18px; }
.tool-section-head {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 4px 0; margin-bottom: 10px; user-select: none;
  border-bottom: 1px solid var(--divider);
}
.tool-section-head .wl-cat-toggle { width: 16px; height: 16px; }
.tool-section-title {
  font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-2);
}
.tool-section-count { font-size: 10px; color: var(--text-3); font-family: var(--ff-mono); }
.tool-section.collapsed .stats-grid-large { display: none; }
.tool-search-wrap { margin-bottom: 16px; max-width: 340px; }

.wl-item-modal-compact .form-group { margin-bottom: 12px; }

.wl-chip {
  display: inline-flex; align-items: center;
  padding: 6px 12px; border-radius: var(--r-full);
  border: 1px solid var(--bg-surface-bd); background: var(--bg-surface);
  color: var(--text-2); font-size: 12px; font-weight: 600;
  font-family: var(--ff-body); cursor: pointer;
  transition: all var(--t-fast); white-space: nowrap;
}
.wl-chip:hover { border-color: var(--arc-dim); color: var(--text-1); }
.wl-chip.active { background: var(--arc-glow-md); border-color: var(--arc); color: var(--arc-bright); }

.wl-tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 600; color: var(--text-2);
  background: var(--bg-struct); border: 1px solid var(--bg-surface-bd);
  border-radius: var(--r-full); padding: 2px 8px; font-family: var(--ff-mono);
}
.wl-card-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.wl-tag-removable { cursor: pointer; }
.wl-tag-removable:hover { border-color: var(--arc-dim); color: var(--text-1); }
.wl-tag-x { color: var(--text-3); font-weight: 700; }

#wl-filters .btn-ghost.active { background: var(--arc-glow-md); border-color: var(--arc); color: var(--arc-bright); }

.wl-card-selectable { cursor: pointer; position: relative; }
.wl-card-selected { outline: 2px solid var(--arc); outline-offset: -2px; }
.wl-card-check {
  position: absolute; top: 8px; left: 8px; z-index: 1;
  width: 18px; height: 18px; cursor: pointer;
}

.wl-bulk-bar {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap;
  background: var(--bg-surface); border: 1px solid var(--bg-surface-bd);
  border-radius: var(--r-md); padding: var(--sp-2) var(--sp-3); margin-bottom: var(--sp-3);
}
.wl-bulk-count { font-size: 12px; font-weight: 600; color: var(--text-2); font-family: var(--ff-mono); }

/* ================================================================
   Activities module
   ================================================================ */

.activity-thumb {
  width: 40px; height: 40px; flex-shrink: 0; border-radius: var(--r-sm);
  background: var(--bg-struct); border: 1px solid var(--bg-surface-bd);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3); overflow: hidden;
}
.activity-thumb img { width: 100%; height: 100%; object-fit: cover; }
.activity-thumb svg { width: 18px; height: 18px; }

.tag-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: var(--r-full);
  border: 1px solid var(--bg-surface-bd); background: var(--bg-surface);
  color: var(--text-2); font-size: 11px; font-family: var(--ff-body);
  white-space: nowrap;
}
.tag-chip button {
  border: none; background: none; color: var(--text-3); cursor: pointer;
  font-size: 12px; line-height: 1; padding: 0;
}
.tag-chip button:hover { color: var(--arc-bright); }

.activity-section-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-3); font-family: var(--ff-mono); margin: 20px 0 8px;
}
.activity-section-label:first-child { margin-top: 0; }

.activity-group-label {
  font-size: 11px; color: var(--text-3); font-family: var(--ff-mono);
  margin: 12px 0 6px; padding-left: 2px;
}

.activity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.activity-grid-wide { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

.activity-tile {
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border: 1px solid var(--bg-surface-bd);
  border-radius: var(--r-md);
  overflow: hidden;
}

.activity-tile-img {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--bg-struct);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  cursor: pointer;
  overflow: hidden;
  flex-shrink: 0;
}
.activity-tile-img img { width: 100%; height: 100%; object-fit: cover; }
.activity-tile-img svg { width: 26px; height: 26px; }
.activity-tile-photo-btn {
  position: absolute; bottom: 6px; right: 6px;
  width: 22px; height: 22px; border-radius: var(--r-full);
  background: rgba(0,0,0,.55); border: 1px solid rgba(255,255,255,.15);
  display: flex; align-items: center; justify-content: center;
  color: #fff; pointer-events: none;
}
.activity-tile-photo-btn svg { width: 12px; height: 12px; }

.activity-tile-body { padding: 10px 12px; flex: 1; }
.activity-tile-title {
  font-size: 13px; font-weight: 600; line-height: 1.3; margin: 0 0 2px;
  overflow-wrap: break-word;
}
.activity-tile-sub {
  font-size: 11px; color: var(--text-2); font-family: var(--ff-mono);
  margin: 0; line-height: 1.4;
}
.activity-tile-chips { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }

.activity-tile-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; border-top: 1px solid var(--bg-surface-bd);
  gap: 6px;
}
.activity-tile-footer .btn {
  font-size: 11px; padding: 4px 8px; white-space: nowrap;
}

.toggle-switch { position: relative; display: inline-block; width: 34px; height: 20px; flex-shrink: 0; cursor: pointer; }
.toggle-switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.toggle-slider {
  position: absolute; inset: 0; background: var(--bg-struct);
  border: 1px solid var(--bg-surface-bd); border-radius: var(--r-full);
  transition: var(--t-fast); pointer-events: none;
}
.toggle-slider::before {
  content: ''; position: absolute; width: 14px; height: 14px; left: 2px; top: 2px;
  background: var(--text-3); border-radius: var(--r-full); transition: var(--t-fast);
}
.toggle-switch input:checked + .toggle-slider { background: var(--arc-glow); border-color: var(--tg-on, var(--arc)); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(14px); background: var(--tg-on, var(--arc-bright)); }

/* ============================================================ Muscle heat-map */
.mm-card {
  background: var(--surface-1, rgba(255,255,255,0.02));
  border: 1px solid var(--divider, rgba(255,255,255,0.08));
  border-radius: var(--r-lg, 16px);
  padding: 16px;
}
.mm-heatmap { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.mm-controls { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.mm-segset {
  display: inline-flex; background: var(--surface-2, rgba(0,0,0,0.18));
  border: 1px solid var(--divider, rgba(255,255,255,0.08));
  border-radius: var(--r-full, 999px); padding: 2px;
}
.mm-seg {
  border: 0; background: transparent; cursor: pointer;
  color: var(--text-3, #9aa); font-size: 12px; font-weight: 600;
  letter-spacing: 0.02em; padding: 5px 14px; border-radius: var(--r-full, 999px);
  transition: var(--t-fast, 0.15s ease);
}
.mm-seg:hover { color: var(--text-2, #ccd); }
.mm-seg.active {
  background: var(--arc-glow, rgba(255,120,90,0.16));
  color: var(--tg-on, var(--arc-bright, #ff8a6a));
}
.mm-stage { width: 100%; max-width: 340px; }
.mm-svg { display: block; width: 100%; height: auto; max-height: 60vh; }
/* the delight moment: muscles crossfade between idle / focus / hot */
.mm-muscle {
  transition: fill 320ms ease, fill-opacity 320ms ease;
  stroke: rgba(0,0,0,0.14); stroke-width: 1.1;
}
.mm-muscle[data-muscle="head"], .mm-muscle[data-muscle="hair"] { stroke: none; }
.mm-caption {
  font-size: 12.5px; color: var(--text-3, #9aa); text-align: center;
  max-width: 300px; line-height: 1.4;
}
/* idle body has a soft breathing glow; focus mode holds steady */
.mm-heatmap:not(.mm-focus) .mm-stage {
  animation: mmBreathe 5.5s ease-in-out infinite;
}
@keyframes mmBreathe {
  0%, 100% { opacity: 0.9; }
  50%      { opacity: 1; }
}

/* Docs markdown viewer (Workspace > Docs) */
.doc-md { font-size: 13.5px; line-height: 1.6; color: var(--text-2); }
.doc-md .doc-h { color: var(--text-1); font-weight: 600; margin: 16px 0 8px; line-height: 1.25; }
.doc-md h1.doc-h { font-size: 20px; }
.doc-md h2.doc-h { font-size: 17px; }
.doc-md h3.doc-h { font-size: 15px; }
.doc-md h4.doc-h, .doc-md h5.doc-h, .doc-md h6.doc-h { font-size: 13.5px; color: var(--text-2); }
.doc-md .doc-p { margin: 8px 0; }
.doc-md .doc-ul { margin: 8px 0; padding-left: 20px; }
.doc-md .doc-ul li { margin: 3px 0; }
.doc-md .doc-code { background: var(--bg-struct); border: 1px solid var(--bg-struct-bd); border-radius: 4px; padding: 1px 5px; font-family: var(--font-mono, ui-monospace, monospace); font-size: 12px; color: var(--arc-bright); }
.doc-md .doc-pre { background: var(--bg-struct); border: 1px solid var(--bg-struct-bd); border-radius: 8px; padding: 12px 14px; overflow-x: auto; margin: 10px 0; }
.doc-md .doc-pre code { font-family: var(--font-mono, ui-monospace, monospace); font-size: 12px; color: var(--text-2); white-space: pre; }
.doc-md a { color: var(--arc); }

/* Trips — browser-tab planner */
.browserbar { display: flex; align-items: flex-end; gap: 4px; border-bottom: 1px solid var(--divider); padding: 0 4px; overflow-x: auto; }
.browserbar .btab { display: flex; align-items: center; gap: 8px; padding: 8px 12px; font-size: 12.5px; color: var(--text-2); background: var(--bg-struct); border: 1px solid var(--divider); border-bottom: none; border-radius: 9px 9px 0 0; white-space: nowrap; cursor: pointer; position: relative; top: 1px; }
.browserbar .btab .btab-fav { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); flex-shrink: 0; }
.browserbar .btab.active { color: var(--text-1); background: var(--bg-surface); }
.browserbar .btab.active .btab-fav { background: var(--arc); box-shadow: 0 0 8px var(--arc); }
.browserbar .btab.active::after { content: ""; position: absolute; left: 10px; right: 10px; top: -1px; height: 2px; background: var(--arc); border-radius: 2px; }
.browserbar .btab-x { color: var(--text-3); font-size: 14px; line-height: 1; }
.browserbar .btab-x:hover { color: var(--red-fg); }
.browserbar .btab-add { background: transparent; border: none; color: var(--arc); font-size: 18px; padding: 4px 12px; cursor: pointer; }
.tripbody { background: var(--bg-surface); border: 1px solid var(--divider); border-top: none; border-radius: 0 0 14px 14px; padding: 20px 22px; }
.triphead { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; border-bottom: 1px solid var(--divider); padding-bottom: 14px; margin-bottom: 14px; }
.triphead h2 { font-size: 22px; margin: 0; font-weight: 600; color: var(--text-1); }
.trip-pill { font-size: 11px; color: var(--text-2); border: 1px solid var(--divider); border-radius: 999px; padding: 2px 10px; }
.trip-day { font-size: 11px; color: var(--arc); min-width: 48px; padding-top: 3px; font-weight: 600; }
.tcard.budget { background: var(--bg-struct); border: 1px solid var(--divider); border-radius: 10px; padding: 12px 14px; }
.tcard.budget .kv { display: flex; justify-content: space-between; font-size: 13px; padding: 5px 0; border-bottom: 1px dashed var(--divider); }
.tcard.budget .kv:last-child { border-bottom: none; }
.tcard.budget .kv .lbl { color: var(--text-2); }
.tcard.budget .kv .val { color: var(--text-1); font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 4px; }

/* ================= Business Hub (business.js / marquee.js / sidejobs.js) ===== */
.biz-page { padding: 4px 0 40px; }
.biz-loading, .biz-empty { color: var(--text-3); padding: 32px 4px; font-size: 14px; }
.biz-subnav { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 22px; }
.biz-chip { background: var(--bg-struct); border: 1px solid var(--bg-struct-bd); color: var(--text-2);
  padding: 7px 15px; border-radius: 999px; font-size: 13px; font-weight: 600; cursor: pointer; transition: all .14s; }
.biz-chip:hover { color: var(--text-1); border-color: var(--bg-surface-bd); }
.biz-chip.on { background: var(--cta); border-color: var(--cta); color: var(--cta-fg); }
.biz-statrow { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 22px; }
.biz-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.biz-card { background: var(--bg-surface); border: 1px solid var(--bg-surface-bd); border-radius: 14px;
  padding: 15px 16px; display: flex; flex-direction: column; gap: 5px; }
.biz-stat { background: var(--bg-surface); border: 1px solid var(--bg-surface-bd); border-radius: 14px;
  padding: 14px 18px; display: flex; flex-direction: column; gap: 3px; min-width: 150px; flex: 1 1 auto; }
.biz-card-label, .biz-stat span { font-size: 11.5px; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); }
.biz-card-value, .biz-stat b { font-size: 1.35rem; font-weight: 700; color: var(--text-1); font-variant-numeric: tabular-nums; }
.biz-card-sub { font-size: 12px; color: var(--text-3); }
.biz-h3 { font-size: 13px; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); margin: 26px 0 12px; }
.biz-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 18px; }
.biz-form input[type=text], .biz-form input[type=number], .biz-form input[type=date] {
  background: var(--bg-struct); border: 1px solid var(--bg-struct-bd); color: var(--text-1);
  padding: 8px 11px; border-radius: 9px; font-size: 13px; }
.biz-form input:focus, .biz-select:focus { outline: 2px solid var(--arc); outline-offset: 1px; }
.biz-check { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 13px; }
.biz-btn { background: var(--cta); color: var(--cta-fg); border: none; padding: 8px 16px; border-radius: 9px;
  font-size: 13px; font-weight: 600; cursor: pointer; }
.biz-btn:hover { background: var(--cta-hover); }
.biz-note { color: var(--text-3); font-size: 12.5px; margin: 10px 2px 0; }
.biz-link { color: var(--arc); font-weight: 600; text-decoration: none; }
.biz-link:hover { text-decoration: underline; }
.biz-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.biz-table th { text-align: left; color: var(--text-3); font-weight: 600; font-size: 11px; letter-spacing: .04em;
  text-transform: uppercase; padding: 8px 10px; border-bottom: 1px solid var(--bg-surface-bd); }
.biz-table td { padding: 9px 10px; border-bottom: 1px solid var(--bg-struct-bd); color: var(--text-1);
  font-variant-numeric: tabular-nums; }
.biz-table .biz-empty { text-align: center; color: var(--text-3); }
.biz-select { background: var(--bg-struct); border: 1px solid var(--bg-struct-bd); color: var(--text-1);
  padding: 4px 8px; border-radius: 7px; font-size: 12px; }
.biz-x { background: none; border: none; color: var(--text-3); cursor: pointer; font-size: 14px; padding: 2px 6px; }
.biz-x:hover { color: var(--danger); }
.biz-mini { background: var(--bg-struct); border: 1px solid var(--bg-struct-bd); color: var(--text-2);
  padding: 3px 8px; border-radius: 7px; font-size: 11px; cursor: pointer; white-space: nowrap; }
.biz-mini:hover { color: var(--orange-fg); border-color: var(--orange-fg); }
