/* ============================================================================
   ThirdPerspective — warm VS Code theme
   ----------------------------------------------------------------------------
   Structure and type follow the attached VS Code screenshot: Segoe UI for the
   chrome, Consolas for anything data-ish, flat dark surfaces, square corners,
   hairline borders — but every neutral is warmed up (the editor is #1f1d1b
   rather than #1f1f1f) and the accents are the pink/blue/orange from the
   screenshot. No glass blur, no glow blobs: this is an IDE now.
   ========================================================================== */

:root {
  /* surfaces — warm neutrals -------------------------------------------- */
  --bg:        #1f1d1b;   /* editor area          (VS Code #1f1f1f, warmed) */
  --bg-dark:   #181614;   /* title / activity / sidebar                     */
  --bg-tab:    #1a1816;   /* tab strip + breadcrumb bar                     */
  --panel:     #24211e;   /* cards                                         */
  --panel-2:   #2a2724;   /* inputs, chips, popups                          */
  --hover:     #2f2b27;
  --sel:       #37332e;   /* selected explorer row                         */
  --line:      #33302b;   /* hairline borders                              */
  --line-soft: #2b2825;

  /* text ----------------------------------------------------------------- */
  --text:      #d9d3ca;   /* VS Code #cccccc, warmed                       */
  --text-dim:  #9a938a;   /* VS Code #858585, warmed                       */
  --text-mute: #756f68;

  /* syntax-style accents (straight from the screenshot) ------------------- */
  --pink:   #d16fa4;   /* folder names / primary accent                   */
  --blue:   #79b8e8;   /* links, file icons, breadcrumbs                  */
  --orange: #ce9178;   /* strings                                         */
  --yellow: #dcdcaa;   /* functions / headings                            */
  --green:  #98c379;   /* comments / success                              */
  --red:    #f14c4c;   /* errors                                          */
  --teal:   #4ec9b0;
  --kw:     #569cd6;   /* keywords                                        */
  --status: #8f4a12;   /* warm status bar                                 */

  /* type ----------------------------------------------------------------- */
  --font-ui:   "Segoe UI", "Segoe UI Variable", system-ui, -apple-system, sans-serif;
  --font-mono: Consolas, "JetBrains Mono", ui-monospace, monospace;
  --logo-font: var(--font-ui);

  /* legacy colour vars (used by rings / steppers below) ------------------- */
  --color-cyan:  var(--blue);
  --color-purple: var(--pink);
  --color-green: var(--green);
  --color-amber: #e3a04a;
  --color-red:   var(--red);

  /* body map tones */
  --bm-fresh:   #98c379;
  --bm-recent:  #b8d99a;
  --bm-due:     #e3a04a;
  --bm-overdue: #f14c4c;
  --bm-cold:    #756f68;
  --bm-none:    #534d45;
}

/* ============================================================================
   Base
   ========================================================================== */
html, body { height: 100%; }

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 13px;
  overflow: hidden;                 /* the shell manages its own scrolling */
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(209, 111, 164, 0.35); }

/* Every card is a flat IDE panel now — beat Tailwind's rounded-3xl. */
body .glass-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
}
body .glass-card:hover { border-color: #454039; }

/* ============================================================================
   VS Code chrome
   ========================================================================== */
.vs-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* ---- app header ---------------------------------------------------------- */
.vs-appbar {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 36px;
  flex: none;
  padding: 0 14px;
  background: var(--bg-dark);
  border-bottom: 1px solid var(--line);
  color: var(--text-dim);
  font-size: 12px;
  user-select: none;
}
.vs-appbar-conn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.vs-appbar-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.02em;
}
.vs-appbar-spacer { flex: 1; }
.vs-appbar #current-date { color: var(--text-dim); }
#sound-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
}
#sound-toggle:hover { background: var(--hover); color: var(--text); }
#sound-toggle svg { width: 14px; height: 14px; }

/* ---- workbench: activity | editor ------------------------------ */
.vs-workbench {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
}

/* activity bar (left icon strip) — also carries id="tabs" for app.js */
.vs-activity {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 48px;
  flex: none;
  background: var(--bg-dark);
  border-right: 1px solid var(--line-soft);
  padding-top: 4px;
}
.vs-activity .tab-btn {
  position: relative;
  width: 48px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  border-radius: 0;
  color: var(--text-mute);
  cursor: pointer;
  transition: color 0.12s ease;
}
.vs-activity .tab-btn svg { width: 22px; height: 22px; }
.vs-activity .tab-btn:hover { color: var(--text); }
.vs-activity .tab-btn.active { color: #f0ebe3; }
.vs-activity .tab-btn.active::before {
  content: '';
  position: absolute;
  left: 0; top: 9px; bottom: 9px;
  width: 2px;
  background: var(--pink);
  border-radius: 0 2px 2px 0;
}
.vs-activity-bottom {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-bottom: 6px;
  gap: 2px;
}
.vs-activity-bottom button {
  width: 44px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-mute);
  cursor: pointer;
  border-radius: 4px;
}
.vs-activity-bottom button:hover { color: var(--text); background: var(--hover); }
.vs-activity-bottom button svg { width: 19px; height: 19px; }
#refresh-icon.spin { animation: spin 0.9s linear infinite; }

/* editor area */
.vs-editor {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  background: var(--bg);
}

/* scrolling content */
.vs-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px 22px 40px;
}
.vs-scroll > .tab-panel {
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
}

/* :where() keeps specificity at zero so setConn()'s bg-emerald-400 /
   bg-red-500 status classes still win over the default dot color. */
:where(#live-dot) {
  width: 7px; height: 7px;
  border-radius: 9999px;
  background: #cfc8bd;
  display: inline-block;
}
#live-indicator {
  font-size: 10.5px;
  letter-spacing: 0.06em;
  font-weight: 700;
  text-transform: uppercase;
}
#current-date { color: #ffeadb; }

/* ============================================================================
   Progress rings
   ========================================================================== */
.ring-circle {
  transition: stroke-dashoffset 1.4s cubic-bezier(0.4, 0, 0.2, 1);
  filter: drop-shadow(0 0 6px currentColor);
}
#ring-calorie { color: rgba(224, 138, 78, 0.65); }
#ring-protein { color: rgba(121, 184, 232, 0.65); }
#ring-budget  { color: rgba(209, 111, 164, 0.65); }

/* ============================================================================
   Stepper / currency
   ========================================================================== */
.stepper {
  display: inline-flex;
  align-items: center;
  gap: 0;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid #454039;
  background: var(--panel-2);
}
.stepper-btn {
  width: 2.2rem;
  height: 2.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.12s ease;
}
.stepper-btn:hover { color: var(--text); background: var(--hover); }
.stepper-btn:active { background: var(--sel); }
.stepper-input {
  width: 3.5rem;
  text-align: center;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font-mono);
  outline: none;
}
.stepper-input::-webkit-outer-spin-button,
.stepper-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper-input[type=number] { -moz-appearance: textfield; }

.currency-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: rgba(209, 111, 164, 0.15);
  color: var(--pink);
  border: 1px solid rgba(209, 111, 164, 0.35);
}

/* ============================================================================
   Panels / animation (tab-panel keeps its contract)
   ========================================================================== */
.tab-btn.muted-active {
  color: var(--text);
  background: var(--sel);
}

.tab-panel { animation: fade-up 0.25s ease both; }
@keyframes fade-up {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================================
   Forms
   ========================================================================== */
.field {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid #454039;
  border-radius: 3px;
  padding: 0.6rem 0.75rem;
  font-size: 0.85rem;
  font-family: var(--font-ui);
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field::placeholder { color: var(--text-mute); }
.field:focus {
  outline: none;
  border-color: var(--pink);
  box-shadow: 0 0 0 2px rgba(209, 111, 164, 0.22);
}
select.field { appearance: none; background-image: none; }
select.field option { background: var(--panel); color: var(--text); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border-radius: 3px;
  padding: 0.6rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  font-family: var(--font-ui);
  transition: background 0.12s ease, filter 0.15s ease, opacity 0.15s ease;
  cursor: pointer;
  border: 1px solid transparent;
}
.btn:active { filter: brightness(0.9); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-sm { padding: 0.25rem 0.6rem; font-size: 0.7rem; }
/* Segmented view switchers (Month / Week / Day) toggle .active on .btn. */
.btn.active { background: var(--sel); border-color: #6a635a; color: #fff; }

.btn-primary { background: #a3520c; color: #fff; }
.btn-primary:hover { background: #bd6113; }
.btn-food     { background: #a3520c; color: #fff; }
.btn-food:hover { background: #bd6113; }
.btn-workout  { background: #2d6a3f; color: #eafff0; }
.btn-workout:hover { background: #37804d; }
.btn-money    { background: #8a3b6b; color: #ffeef7; }
.btn-money:hover { background: #a1477e; }
.btn-study    { background: #2f5f8a; color: #eaf4ff; }
.btn-study:hover { background: #39709f; }
.btn-ghost    { background: var(--panel-2); color: var(--text); border-color: #454039; }
.btn-ghost:hover { background: var(--hover); }
.btn-danger   { background: rgba(241, 76, 76, 0.14); color: #ff8f8f; border-color: rgba(241, 76, 76, 0.35); }
.btn-danger:hover { background: rgba(241, 76, 76, 0.22); }

.label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin-bottom: 0.35rem;
}

/* ============================================================================
   Food autocomplete
   ========================================================================== */
.ac-wrap { position: relative; }
.ac-list {
  position: absolute;
  z-index: 40;
  left: 0; right: 0; top: calc(100% + 4px);
  background: var(--panel-2);
  border: 1px solid #454039;
  border-radius: 4px;
  max-height: 18rem;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
}
.ac-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  padding: 0.55rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--line-soft);
  transition: background 0.12s ease;
}
.ac-item:last-child { border-bottom: none; }
.ac-item:hover, .ac-item.sel { background: var(--sel); }
.ac-item .nm { font-size: 0.86rem; font-weight: 600; color: var(--text); }
.ac-item .mt { font-size: 0.72rem; color: var(--text-mute); font-family: var(--font-mono); white-space: nowrap; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.1rem 0.45rem;
  border-radius: 3px;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.badge-cache   { background: rgba(152, 195, 121, 0.16); color: var(--green); border: 1px solid rgba(152, 195, 121, 0.35); }
.badge-ai      { background: rgba(209, 111, 164, 0.16); color: var(--pink); border: 1px solid rgba(209, 111, 164, 0.35); }
.badge-manual  { background: rgba(169, 161, 150, 0.14); color: var(--text-dim); border: 1px solid rgba(169, 161, 150, 0.3); }

/* ============================================================================
   Muscle body map — anatomical chart on the app background
   ----------------------------------------------------------------------------
   Same three tiers as the printed chart (pink / orange / yellow), but drawn on
   the panel the tab already uses instead of on a white card. The silhouette is
   a mid grey and the muscle seams are a translucent white, so neighbouring
   regions still read as separate muscles on a dark surface.
   ========================================================================== */
.bm-stage {
  margin-top: 0.5rem;
  padding: 0.5rem 0 0;
  background: transparent;
  border: 0;
}
.bm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 0.75rem;
  align-items: start;
}
.bm-figure { position: relative; }
.bm-svg { width: 100%; height: auto; display: block; }

/* Plain silhouette: the untracked body reads as warm grey, the joints
   (hands, feet) sit a shade darker, exactly as in the chart. */
.bm-flesh { fill: #6e6963; }
.bm-joint { fill: #5c5751; }
.bm-shadow { fill: rgba(255, 255, 255, 0.045); }
.bm-contour {
  fill: none;
  stroke: rgba(255, 255, 255, 0.24);
  stroke-width: 1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Printed-style callouts: muscle names, leader lines and landing dots. */
.bm-labels { pointer-events: none; }
.bm-labels text {
  fill: #b3ada5;
  font-family: var(--font-ui);
  font-size: 8.6px;
  font-weight: 700;
  letter-spacing: 0.25px;
}
.bm-lead { fill: none; stroke: rgba(255, 255, 255, 0.26); stroke-width: 0.9; }
.bm-lead-dot { fill: rgba(255, 255, 255, 0.55); }

/* Regions inherit their colour from the effort class; the translucent seam is
   what separates neighbouring muscles. Level 0 stays plain silhouette grey. */
.bm-region {
  cursor: pointer;
  fill: #6e6963;
  stroke: rgba(255, 255, 255, 0.32);
  stroke-width: 0.9;
  stroke-linejoin: round;
  stroke-linecap: round;
  transition: fill 0.3s ease, opacity 0.3s ease, filter 0.2s ease;
}
.bm-region .bm-line {
  fill: none;
  stroke: rgba(255, 255, 255, 0.45);
  stroke-width: 0.9;
  stroke-linecap: round;
}
.bm-region.bm-effort-1,
.bm-region.bm-effort-2 { fill: #f5dd1e; }
.bm-region.bm-effort-3 { fill: #e8862c; }
.bm-region.bm-effort-4 { fill: #c0446e; }
.bm-region:hover { filter: brightness(1.06) saturate(1.08); }
.bm-region:focus { outline: none; filter: brightness(1.12); }
.bm-region:focus-visible { filter: brightness(1.12) drop-shadow(0 0 3px rgba(192, 68, 110, 0.9)); }
.bm-region.bm-out { opacity: 0.22; }

/* Legend: three tiers, swatches as squares like the chart. */
.bm-effort-legend { margin-top: 0.85rem; }
.bm-effort-levels {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 0.35rem 0.9rem;
}
.bm-effort-level {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.02em;
  text-transform: uppercase; color: var(--text-dim);
}
.bm-effort-label { color: inherit; }
.bm-legend-title {
  margin-top: 0.5rem; font-size: 0.6rem; font-weight: 600;
  letter-spacing: 0.05em; color: var(--text-mute);
}
.bm-effort-dot {
  width: 13px; height: 13px; border-radius: 2px; flex: none;
  background: #6e6963;
}
.bm-effort-dot.bm-effort-1,
.bm-effort-dot.bm-effort-2 { background: #f5dd1e; }
.bm-effort-dot.bm-effort-3 { background: #e8862c; }
.bm-effort-dot.bm-effort-4 { background: #c0446e; }
/* "never trained" — the workout-photo chips pass the bare class 'none'. */
.bm-effort-dot.none,
.bm-effort-dot.bm-none { background: #6e6963; }

/* Legend chips under the map (app.js buildLegend): same three tiers. */
.bm-legend { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.bm-key {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.3rem 0.55rem; border-radius: 3px;
  background: var(--panel-2); border: 1px solid #454039;
  font-size: 0.68rem; font-weight: 600; color: var(--text-dim);
}
.bm-key .dot { width: 10px; height: 10px; border-radius: 2px; flex: none; background: #6e6963; }
.bm-key .dot.bm-effort-1,
.bm-key .dot.bm-effort-2 { background: #f5dd1e; }
.bm-key .dot.bm-effort-3 { background: #e8862c; }
.bm-key .dot.bm-effort-4 { background: #c0446e; }
.bm-key .ago { color: var(--text-mute); font-family: var(--font-mono); font-size: 0.62rem; }

.bm-window-note { text-align: center; font-size: 0.68rem; color: var(--text-mute); margin-top: 0.3rem; }

.bm-tip {
  position: absolute;
  z-index: 50;
  pointer-events: none;
  background: var(--panel-2);
  border: 1px solid #454039;
  color: var(--text);
  font-size: 0.66rem;
  font-weight: 600;
  padding: 0.28rem 0.55rem;
  border-radius: 3px;
  max-width: min(260px, calc(100vw - 3rem));
  transform: translate(-50%, -130%);
  opacity: 0;
  transition: opacity 0.15s ease;
}
.bm-tip.on { opacity: 1; }
/* ============================================================================
   Muscle chips
   ========================================================================== */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.4rem 0.7rem;
  border-radius: 3px;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--panel-2);
  border: 1px solid #454039;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}
.chip:hover { border-color: #6a635a; color: var(--text); }
.chip.on {
  background: rgba(152, 195, 121, 0.16);
  border-color: rgba(152, 195, 121, 0.6);
  color: var(--green);
}

/* ============================================================================
   List rows
   ========================================================================== */
.list-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0.7rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--line-soft);
  transition: background 0.15s ease;
}
.list-row:hover { background: var(--hover); }

.tick {
  width: 1.35rem; height: 1.35rem;
  border-radius: 3px;
  border: 1.5px solid #6a635a;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s ease;
  cursor: pointer;
}
.tick.on { background: var(--green); border-color: var(--green); }
.tick.on svg { width: 0.8rem; height: 0.8rem; color: #14260c; }

/* An expense row: the type is editable in place, and a row that logged itself
   says so, so a machine-read transaction is never mistaken for a typed one. */
.ex-cat {
  flex-shrink: 0;
  max-width: 9.5rem;
  padding: 0.25rem 0.35rem;
  border-radius: 3px;
  font-size: 0.68rem;
  font-family: inherit;
  color: var(--text-mute);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line-soft);
  cursor: pointer;
}
.ex-cat:hover { background: var(--hover); }
.ex-cat:focus { outline: 1px solid var(--green); outline-offset: 1px; }
.ex-cat option { background: #17171a; color: #f0ece5; }

.src-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.05rem 0.4rem;
  border-radius: 3px;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-mute);
  border: 1px solid var(--line-soft);
}
.src-tag-sms {
  background: rgba(96, 200, 190, 0.15);
  color: #7fd6cc;
  border-color: rgba(96, 200, 190, 0.35);
}

.icon-btn {
  padding: 0.3rem;
  border-radius: 3px;
  color: var(--text-mute);
  transition: all 0.15s ease;
  flex-shrink: 0;
}
.icon-btn:hover { color: #ff8f8f; background: rgba(241, 76, 76, 0.12); }

/* ============================================================================
   Toasts / Modal / Animations
   ========================================================================== */
.toast {
  position: fixed;
  right: 1rem;
  bottom: 3rem;
  transform: translateY(20px);
  z-index: 90;
  padding: 0.7rem 1.1rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--panel-2);
  border: 1px solid #454039;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  max-width: min(420px, 88vw);
  text-align: left;
  color: var(--text);
}
.toast.on { opacity: 1; transform: translateY(0); }
.toast.ok  { border-left: 3px solid var(--green); }
.toast.err { border-left: 3px solid var(--red); }
.toast.warn{ border-left: 3px solid var(--color-amber); }

.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 1rem;
}
@media (min-width: 640px) {
  .modal { align-items: center; }
}

.spin { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.ai-pulse {
  background: linear-gradient(90deg, rgba(209,111,164,0.14), rgba(121,184,232,0.14), rgba(209,111,164,0.14));
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

@keyframes slide-up {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
.animate-slide-up { animation: slide-up 0.3s cubic-bezier(0.4, 0, 0.2, 1); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(217, 211, 202, 0.18); border-radius: 6px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(217, 211, 202, 0.34); background-clip: content-box; }

/* ============================================================================
   Calendar notify marks — bell toggle + marked-block hints
   ========================================================================== */
.cal-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  flex: none;
  border-radius: 9999px;
  border: 1px solid #454039;
  background: var(--panel-2);
  color: var(--text-dim);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.cal-mark:hover { color: var(--text); border-color: var(--pink); }
.cal-mark.on {
  color: var(--pink);
  background: rgba(209, 111, 164, 0.16);
  border-color: rgba(209, 111, 164, 0.55);
  box-shadow: 0 0 8px rgba(209, 111, 164, 0.3);
}

[data-cal-mark] { cursor: pointer; }
.calendar-event:hover { filter: brightness(1.15); }

.cal-mark-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 4px;
  border-radius: 9999px;
  background: var(--pink);
  box-shadow: 0 0 6px rgba(209, 111, 164, 0.8);
  vertical-align: middle;
}
.cal-block-marked { outline: 1px solid rgba(209, 111, 164, 0.45); }

.cal-mark-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.45rem;
  border-radius: 3px;
  background: rgba(209, 111, 164, 0.07);
  border: 1px solid rgba(209, 111, 164, 0.16);
  color: var(--text);
}
.cal-mark-item .dot {
  width: 7px;
  height: 7px;
  border-radius: 9999px;
  background: var(--pink);
  box-shadow: 0 0 6px rgba(209, 111, 164, 0.7);
  flex: none;
}

/* ============================================================================
   Responsive — the IDE chrome adapts, the app stays usable
   ========================================================================== */
@media (max-width: 767px) {
  .vs-appbar-title { display: none; }
  .vs-scroll { padding: 12px 12px 32px; }
  .toast { right: 0.6rem; left: 0.6rem; max-width: none; }
}

/* Reference anatomical chart */
.bm-stage { background: transparent; border-radius: 0; padding: 28px 12px 16px; overflow: hidden; }
.bm-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; }
.bm-flesh, .bm-joint { fill: #999a97; }
.bm-shadow { fill: rgba(255, 255, 255, .035); }
.bm-contour { stroke: #e6e6e4; stroke-width: 1.4; }
.bm-labels text { fill: var(--text); font-family: Arial, sans-serif; font-size: 9px; letter-spacing: -.2px; }
.bm-lead { stroke: var(--text-dim); stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
.bm-region { fill: #999a97; stroke: #f4f4ef; stroke-width: 1.4; }
.bm-region .bm-line { stroke: #f4f4ef; stroke-width: 1.4; }
.bm-region.bm-effort-1, .bm-region.bm-effort-2 { fill: #ffdf00; }
.bm-region.bm-effort-3 { fill: #f18925; }
.bm-region.bm-effort-4 { fill: #d34270; }
.bm-effort-levels { flex-direction: column; align-items: flex-start; gap: 5px; }
.bm-effort-level { color: var(--text); font-family: Arial, sans-serif; font-size: 11px; max-width: 135px; }
.bm-effort-dot { width: 24px; height: 24px; border-radius: 0; }
.bm-effort-dot.bm-effort-1, .bm-effort-dot.bm-effort-2, .bm-key .dot.bm-effort-1, .bm-key .dot.bm-effort-2 { background: #ffdf00; }
.bm-effort-dot.bm-effort-3, .bm-key .dot.bm-effort-3 { background: #f18925; }
.bm-effort-dot.bm-effort-4, .bm-key .dot.bm-effort-4 { background: #d34270; }
.bm-legend-title { color: var(--text-dim); text-align: center; }
.bm-effort-legend { margin-top: -48px; position: relative; pointer-events: none; }
@media (max-width: 480px) {
  .bm-stage { padding: 18px 6px 12px; }
  .bm-effort-legend { margin-top: 8px; }
  .bm-effort-levels { flex-direction: row; gap: 8px; }
  .bm-effort-level { font-size: 9px; flex: 1; }
  .bm-effort-dot { width: 16px; height: 16px; }
}

.bm-labels text { font-size: 10px; }

.chat-messages { max-height: 55vh; overflow-y: auto; display: grid; gap: 14px; }
.chat-message { padding: 16px; border: 1px solid #484139; border-radius: 10px; background: #27231f; }
.chat-user { margin-left: 8%; border-color: #9e5d29; }
.chat-assistant { margin-right: 8%; }
.chat-message p { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 8px; }
.chat-controls { display: flex; flex-wrap: wrap; gap: 10px; }
#chat-input { resize: vertical; min-height: 110px; }
#chat-photo { max-height: 180px; max-width: 100%; border-radius: 8px; }
.change-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid #484139; overflow-wrap: anywhere; }
.change-row small { display: block; color: #a9a196; margin-top: 4px; }
.change-row button { flex-shrink: 0; }
button:disabled { opacity: .55; cursor: default; }

.ai-inline-status, [data-state][role="status"] { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12px; color: #a9a196; }
[role="status"][data-state="error"] { color: #e99b88; }
[role="status"][data-state="ready"] { color: #98c379; }
.ai-spinner { flex-shrink: 0; width: 12px; height: 12px; border: 2px solid #534d45; border-top-color: #e08a4e; border-radius: 50%; animation: ai-spin .8s linear infinite; }
.ai-state-dot { flex-shrink: 0; width: 6px; height: 6px; background: currentColor; border-radius: 50%; }
@keyframes ai-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ai-spinner { animation: none; } }

.food-value-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(140px,1fr)); gap: 10px; }
.food-value-label { display: block; font-size: 11px; color: #cac3b8; margin-bottom: 5px; }
.calorie-burn-offset { position: absolute; top: 0; height: 100%; background: #79b8e8; transition: width .7s, left .7s; }
.workout-energy { display: block; color: #79b8e8; margin-top: 5px; }

/* Weekly schedule: half-hour rows, muted blocks and sticky day headers. */
.schedule-scroll{max-height:70vh;overflow:auto;border:1px solid #403b35;border-radius:14px}
.schedule-grid{display:grid;grid-template-columns:64px repeat(7,minmax(100px,1fr));grid-template-rows:64px 1440px;min-width:850px;background:#211f1b}
.schedule-heading,.schedule-corner{position:sticky;top:0;z-index:3;background:#28251f;border-right:1px solid #403b35;border-bottom:1px solid #403b35;padding:12px 5px;text-align:center;font-size:12px}
.schedule-heading span{display:block;color:#a9a294;font-size:11px;margin-top:4px}.schedule-heading.is-today{color:#e2c983;background:#363024}
.schedule-hours{display:grid;grid-template-rows:repeat(36,40px)}.schedule-hours span{font:11px monospace;text-align:center;color:#a9a294;padding-top:10px;border-bottom:1px solid #39352e}
.schedule-column{position:relative;display:grid;grid-template-rows:repeat(36,40px);border-right:1px solid #403b35}.schedule-column.is-today{background:#e2c98308}
.schedule-slot{border:0;border-bottom:1px solid #39352e;background:transparent;cursor:pointer}.schedule-slot:hover,.schedule-slot:focus-visible{background:#e2c98316}
.schedule-event{position:absolute;z-index:1;background:color-mix(in srgb,var(--event-color) 22%,#25231e);border:1px solid color-mix(in srgb,var(--event-color) 60%,#25231e);border-left:3px solid var(--event-color);border-radius:7px;padding:5px 7px;text-align:left;overflow:hidden;color:#f0ece3;cursor:pointer;min-height:20px}
.schedule-event strong,.schedule-event span,.schedule-event small{display:block;overflow:hidden;text-overflow:ellipsis}.schedule-event strong{font-size:12px}.schedule-event span{font-size:10px;opacity:.85}.schedule-event small{font-size:10px;color:#aaa294}.schedule-event:hover{filter:brightness(1.2)}.schedule-hint{font-size:12px;color:#aaa294;margin-top:12px}
.record-editor{background:#25221e;color:#eee9df;border:1px solid #514a40;border-radius:18px;padding:24px;width:min(560px,calc(100vw - 32px));max-height:85vh;overflow:auto}.record-editor::backdrop{background:#0009}.record-editor h2{font-size:20px;font-weight:700;margin-bottom:18px}.record-edit-fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}.record-edit-fields label{font-size:12px;color:#bcb4a7}.record-edit-fields .field{display:block;width:100%;margin-top:6px}.record-edit-actions{display:flex;justify-content:flex-end;gap:12px;margin-top:20px}.record-edit-error{color:#f4a5a5;font-size:13px;margin-top:12px}@media(max-width:480px){.record-edit-fields{grid-template-columns:1fr}}
