/* =========================================================
   Jc · Personal Index — workbench
   ========================================================= */

/* ---------- tokens ---------- */
:root {
  --bg: #f3f0e8;
  --surface: #fffdf8;
  --surface-2: #f0ece2;
  --surface-hover: #faf7f0;
  --ink: #191713;
  --ink-2: #4a4438;
  --muted: #8b8374;
  --line: rgba(25, 23, 19, 0.10);
  --line-strong: rgba(25, 23, 19, 0.20);
  --accent: #e4502a;
  --accent-text: #b8461f;
  --accent-soft: rgba(228, 80, 42, 0.11);
  --accent-soft-2: rgba(228, 80, 42, 0.18);
  --positive: #3f6b52;
  --danger: #b4362a;
  --danger-soft: rgba(180, 54, 42, 0.10);

  --sidebar: #16140f;
  --sidebar-ink: #f3eee2;
  --sidebar-muted: #8d8676;
  --sidebar-line: rgba(255, 255, 255, 0.07);
  --sidebar-active: rgba(255, 255, 255, 0.075);

  --serif: "Songti SC", "Noto Serif SC", "STSong", "Times New Roman", serif;
  --sans: "PingFang SC", "HarmonyOS Sans SC", "Helvetica Neue", Arial, sans-serif;

  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(24, 22, 16, 0.03), 0 18px 40px -32px rgba(24, 22, 16, 0.42);
  --shadow-lift: 0 2px 4px rgba(24, 22, 16, 0.04), 0 24px 48px -30px rgba(24, 22, 16, 0.46);
  --shadow-pop: 0 28px 70px -34px rgba(0, 0, 0, 0.55);

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-press: cubic-bezier(0.2, 0, 0, 1);

  --dur-press: 90ms;
  --dur-fast: 150ms;
  --dur-base: 240ms;
  --dur-slow: 340ms;
  --dur-sheet: 400ms;

  --sb-w: 228px;
  --content-max: 1180px;

  --heat-0: #ebe6dc;
  --heat-1: #f8ded3;
  --heat-2: #efb39e;
  --heat-3: #e47c59;
  --heat-4: #c9421f;

  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #11100c;
  --surface: #1b1914;
  --surface-2: #242119;
  --surface-hover: #211e17;
  --ink: #f2ecdf;
  --ink-2: #d0c8b7;
  --muted: #9a9282;
  --line: rgba(242, 236, 223, 0.10);
  --line-strong: rgba(242, 236, 223, 0.22);
  --accent: #ff6a3d;
  --accent-text: #ff8a63;
  --accent-soft: rgba(255, 106, 61, 0.14);
  --accent-soft-2: rgba(255, 106, 61, 0.22);
  --positive: #7fbf9b;
  --danger: #ff7f6e;
  --danger-soft: rgba(255, 127, 110, 0.12);

  --sidebar: #0a0906;
  --sidebar-ink: #f3eee2;
  --sidebar-muted: #8b8474;
  --sidebar-line: rgba(255, 255, 255, 0.07);
  --sidebar-active: rgba(255, 255, 255, 0.075);

  --shadow: 0 1px 0 rgba(255, 255, 255, 0.025), 0 22px 50px -34px rgba(0, 0, 0, 0.8);
  --shadow-lift: 0 2px 6px rgba(0, 0, 0, 0.2), 0 28px 56px -30px rgba(0, 0, 0, 0.85);
  --shadow-pop: 0 32px 80px -32px rgba(0, 0, 0, 0.9);

  --heat-0: #242119;
  --heat-1: #4a2619;
  --heat-2: #773621;
  --heat-3: #b74928;
  --heat-4: #ff6a3d;

  color-scheme: dark;
}

/* ---------- base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  height: 100%;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body.modal-open { overflow: hidden; }

::selection { background: var(--accent); color: #fff8f4; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button,
input,
textarea,
select { font: inherit; color: inherit; }

button { cursor: pointer; }

a { color: inherit; }

img { max-width: 100%; display: block; }

.icon {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--muted) 32%, transparent);
  border: 3px solid transparent;
  border-radius: 99px;
  background-clip: padding-box;
}

/* ---------- app / sidebar ---------- */
.app { min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  width: var(--sb-w);
  padding: 26px 16px 18px;
  background: var(--sidebar);
  color: var(--sidebar-ink);
  border-right: 1px solid var(--sidebar-line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 8px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 12px;
  background: var(--accent);
  color: #fff6ef;
  font-family: var(--serif);
  font-size: 22px;
  line-height: 1;
  padding-bottom: 2px;
  box-shadow: 0 8px 18px -9px rgba(228, 80, 42, 0.9);
}

.brand-text { min-width: 0; }
.brand-text strong {
  display: block;
  overflow: hidden;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.brand-text em {
  display: block;
  overflow: hidden;
  margin-top: 2px;
  color: var(--sidebar-muted);
  font-size: 9.5px;
  font-style: normal;
  letter-spacing: 0.06em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-caption {
  margin: 24px 0 8px;
  padding: 0 10px;
  color: var(--sidebar-muted);
  font-size: 8.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.nav {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-indicator {
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 18px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
  transform: translate3d(0, var(--ind-y, 0px), 0);
  transition: transform var(--dur-slow) var(--ease-out), width var(--dur-slow) var(--ease-out), height var(--dur-slow) var(--ease-out);
  pointer-events: none;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 11px;
  border-radius: 10px;
  color: var(--sidebar-muted);
  font-size: 12.5px;
  text-decoration: none;
  letter-spacing: 0.02em;
  transition: color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}

.nav-item .icon { width: 17px; height: 17px; opacity: 0.92; }

.nav-item:hover {
  color: var(--sidebar-ink);
  background: rgba(255, 255, 255, 0.045);
}

.nav-item.is-active {
  color: #fff;
  background: var(--sidebar-active);
}

.nav-item.is-active .icon { color: var(--accent); }

.sidebar-bottom {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: auto;
}

.sidebar-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px;
}

.local-note {
  color: var(--sidebar-muted);
  font-size: 8.5px;
  letter-spacing: 0.04em;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  transition: color var(--dur-fast), border-color var(--dur-fast), background-color var(--dur-fast), transform var(--dur-press);
}

.icon-button:hover { color: var(--ink); border-color: var(--line-strong); background: var(--surface); }
.icon-button:active { transform: scale(0.94); }

.sidebar .icon-button {
  border-color: var(--sidebar-line);
  color: var(--sidebar-muted);
}
.sidebar .icon-button:hover {
  border-color: rgba(255, 255, 255, 0.22);
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.theme-toggle .icon { width: 15px; height: 15px; transition: transform var(--dur-slow) var(--ease-out), opacity var(--dur-fast); }
.theme-icon-sun { display: none; }
[data-theme="dark"] .theme-icon-sun { display: block; }
[data-theme="dark"] .theme-icon-moon { display: none; }

.profile-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-width: 0;
  padding: 9px 8px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: inherit;
  text-align: left;
  transition: background-color var(--dur-fast) var(--ease-out);
}

.profile-row:hover { background: rgba(255, 255, 255, 0.045); }

.profile-row .profile-text {
  min-width: 0;
  flex: 1;
}

.profile-row .profile-text b {
  display: block;
  overflow: hidden;
  font-size: 11px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-row .profile-text em {
  display: block;
  overflow: hidden;
  margin-top: 1px;
  color: var(--sidebar-muted);
  font-size: 8.5px;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-row .chev { width: 13px; height: 13px; color: var(--sidebar-muted); }

.avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  overflow: hidden;
  border-radius: 50%;
  background: linear-gradient(135deg, #e4502a, #f0a06b);
  background-position: center;
  background-size: cover;
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
}

.avatar.has-image { color: transparent; }

/* ---------- main / views ---------- */
.main {
  min-height: 100vh;
  margin-left: var(--sb-w);
  padding: 30px 38px 42px;
}

.content {
  max-width: var(--content-max);
  margin: 0 auto;
}

.view { display: none; }
.view.is-active { display: block; }

.view-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 20px;
  min-height: 82px;
}

.view-heading { min-width: 0; }

.kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.view-heading h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 36px;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: 0.01em;
}

.view-heading .lede {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.015em;
}

.view-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  padding-bottom: 2px;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.03em;
  white-space: nowrap;
  transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast), border-color var(--dur-fast), transform var(--dur-press), box-shadow var(--dur-fast);
}

.btn .icon { width: 14px; height: 14px; }
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff8f4;
  box-shadow: 0 10px 20px -14px rgba(228, 80, 42, 0.85);
}
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); border-color: transparent; }

.btn-ghost {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink-2);
}
.btn-ghost:hover { border-color: var(--line-strong); color: var(--ink); background: var(--surface-hover); }

.btn-quiet {
  border-color: transparent;
  color: var(--muted);
  padding: 0 10px;
}
.btn-quiet:hover { color: var(--ink); background: var(--surface-2); }

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

.btn:disabled { opacity: 0.38; cursor: not-allowed; transform: none; }

.icon-action {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  opacity: 0;
  transition: opacity var(--dur-fast), color var(--dur-fast), background-color var(--dur-fast), transform var(--dur-press);
}
.icon-action .icon { width: 14px; height: 14px; }
.icon-action:hover { color: var(--ink); background: var(--surface-2); }
.icon-action:active { transform: scale(0.9); }
.row:hover .icon-action,
.row:focus-within .icon-action,
.icon-action:focus-visible { opacity: 1; }
.icon-action.danger:hover { color: var(--danger); background: var(--danger-soft); }

/* ---------- cards ---------- */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 17px 19px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: border-color var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out);
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
}

.card-head h2 {
  margin: 0;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 650;
  line-height: 1.35;
  letter-spacing: 0.015em;
}

.card-meta {
  flex: none;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 9px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.03em;
}

.link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent-text);
  font-size: 9.5px;
  letter-spacing: 0.03em;
  text-decoration: none;
  transition: color var(--dur-fast);
}
.link .icon { width: 11px; height: 11px; transition: transform var(--dur-fast) var(--ease-out); }
.link:hover { color: var(--accent); }
.link:hover .icon { transform: translateX(2px); }

/* ---------- overview ---------- */
.ov-grid { display: flex; flex-direction: column; gap: 14px; }

.ov-row { display: grid; gap: 14px; }
.ov-row.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ov-row.cols-75 { grid-template-columns: 1.36fr 1fr; }

.ov-row.cols-3 .card { min-height: 252px; }
.ov-row.cols-75 .card { min-height: 268px; }
.ov-row.body-row .card { min-height: 226px; }

/* quote */
.quote-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 368px;
  max-width: 100%;
  flex: none;
  padding: 11px 15px 9px 42px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}
.quote-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 13px;
  bottom: 13px;
  width: 2px;
  border-radius: 0 2px 2px 0;
  background: var(--accent);
}
.quote-mark {
  position: absolute;
  left: 13px;
  top: 5px;
  color: var(--accent);
  font-family: var(--serif);
  font-size: 29px;
  line-height: 1;
  opacity: 0.9;
}
.quote-text {
  margin: 0;
  min-height: 20px;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 12.5px;
  line-height: 1.55;
  letter-spacing: 0.02em;
}
.quote-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 5px;
}
.quote-author {
  overflow: hidden;
  color: var(--muted);
  font-size: 8.5px;
  letter-spacing: 0.05em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.quote-actions { display: flex; align-items: center; gap: 10px; flex: none; }
.quote-actions button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 8.5px;
  letter-spacing: 0.04em;
  transition: color var(--dur-fast);
}
.quote-actions button:hover { color: var(--ink); }
.quote-pinned {
  color: var(--accent-text);
  font-size: 8px;
  letter-spacing: 0.04em;
}

/* mini lists */
.mini-list { margin: 0; padding: 0; list-style: none; }

.mini-todo {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 36px;
  padding: 7px 0;
  border-top: 1px solid var(--line);
}
.mini-todo:first-child { border-top: 0; padding-top: 1px; }

.mini-check {
  display: grid;
  place-items: center;
  width: 14px;
  height: 14px;
  flex: none;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: transparent;
  font-size: 7px;
  line-height: 1;
}
.mini-todo.done .mini-check {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff8f4;
}
.mini-todo span.txt {
  overflow: hidden;
  color: var(--ink-2);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mini-todo.done span.txt { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 0.5px; }

.mini-note {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
.mini-note:first-child { border-top: 0; padding-top: 1px; }
.mini-note-main { min-width: 0; }
.mini-note-title {
  display: block;
  overflow: hidden;
  font-family: var(--serif);
  font-size: 11.5px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mini-note-excerpt {
  display: block;
  overflow: hidden;
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mini-note-date { flex: none; padding-top: 2px; color: var(--muted); font-size: 8px; white-space: nowrap; }

.mini-session {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
.mini-session:first-child { border-top: 0; padding-top: 1px; }
.mini-session-date { color: var(--muted); font-size: 8.5px; }
.mini-session-title { overflow: hidden; font-size: 10.5px; text-overflow: ellipsis; white-space: nowrap; }
.mini-session-min { color: var(--muted); font-size: 8.5px; white-space: nowrap; }

/* empty states inside cards */
.empty {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  padding: 30px 0 32px;
}
.empty.compact { padding: 20px 0 22px; }
.empty-title {
  margin: 0;
  color: var(--ink-2);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.45;
  letter-spacing: 0.03em;
}
.empty-sub {
  margin: 0;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.7;
}
.empty .link { margin-top: 6px; }

/* plan */
.plan-body { display: flex; align-items: center; gap: 18px; flex: 1; min-height: 0; }
.ring-wrap { width: 96px; flex: none; text-align: center; }
.ring { position: relative; width: 80px; height: 80px; margin: 0 auto; }
.ring svg { display: block; width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 5.5; stroke-linecap: round; }
.ring .track { stroke: var(--surface-2); }
.ring .fill { stroke: var(--accent); transition: stroke-dashoffset 720ms var(--ease-out); }
.ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: baseline;
  justify-content: center;
  font-family: var(--serif);
  font-size: 18px;
  line-height: 80px;
}
.ring-label em { margin-left: 1px; color: var(--muted); font-family: var(--sans); font-size: 8.5px; font-style: normal; }
.ring-cap { margin-top: 5px; color: var(--muted); font-size: 8px; letter-spacing: 0.04em; }

.week-list { flex: 1; min-width: 0; margin: 0; padding: 0; list-style: none; }
.week-row {
  display: grid;
  grid-template-columns: 25px minmax(0, 1fr) auto 12px;
  align-items: center;
  gap: 7px;
  min-height: 25px;
  padding: 3px 5px;
  border-radius: 6px;
}
.week-row .wk { color: var(--muted); font-size: 8.5px; }
.week-row .wt { overflow: hidden; color: var(--ink-2); font-size: 9.5px; text-overflow: ellipsis; white-space: nowrap; }
.week-row .tag {
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 7.5px;
  line-height: 1.45;
  white-space: nowrap;
}
.week-row .ok { color: var(--accent); font-size: 8.5px; text-align: right; }
.week-row.done .wt { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 0.5px; }
.week-row.today { background: var(--accent-soft); }
.week-row.today .wk { color: var(--accent-text); }
.week-row.today .wt { color: var(--accent-text); font-weight: 600; }
.week-row.today .tag { border-color: transparent; background: var(--accent); color: #fff8f4; }
.week-row.rest .wt { color: var(--muted); }

.week-empty {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 9px;
}

/* heatmap */
.heat-body { display: flex; align-items: center; gap: 16px; flex: 1; min-height: 0; }
.heat-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; flex: none; }
.heat-grid {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 14px;
  grid-template-rows: repeat(7, 14px);
  gap: 4px;
}
.heat-cell {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: var(--heat-0);
  transition: transform var(--dur-fast) var(--ease-out), background-color var(--dur-base);
}
.heat-cell.lv1 { background: var(--heat-1); }
.heat-cell.lv2 { background: var(--heat-2); }
.heat-cell.lv3 { background: var(--heat-3); }
.heat-cell.lv4 { background: var(--heat-4); }
.heat-cell.today { outline: 1.5px solid var(--accent); outline-offset: 1.5px; }
.heat-cell:hover { transform: scale(1.2); }
.heat-legend { display: flex; align-items: center; gap: 3px; color: var(--muted); font-size: 7.5px; }
.heat-legend i { width: 8px; height: 8px; border-radius: 2px; background: var(--heat-0); }
.heat-legend i.lv1 { background: var(--heat-1); }
.heat-legend i.lv2 { background: var(--heat-2); }
.heat-legend i.lv3 { background: var(--heat-3); }
.heat-legend i.lv4 { background: var(--heat-4); }

.heat-stats {
  display: flex;
  flex-direction: column;
  gap: 11px;
  flex: 1;
  min-width: 0;
  padding-left: 16px;
  border-left: 1px solid var(--line);
}
.heat-stat b { display: block; font-family: var(--serif); font-size: 15px; font-weight: 600; line-height: 1.2; }
.heat-stat span { display: block; margin-top: 1px; color: var(--muted); font-size: 7.5px; letter-spacing: 0.03em; }

/* body metrics */
.metric-list { display: flex; flex-direction: column; justify-content: center; flex: 1; min-height: 0; }
.metric-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
}
.metric-row:first-child { border-top: 0; padding-top: 0; }
.metric-info { min-width: 0; }
.metric-label { display: block; color: var(--muted); font-size: 8px; letter-spacing: 0.1em; }
.metric-value { margin-top: 2px; font-family: var(--serif); font-size: 21px; font-weight: 600; line-height: 1.2; }
.metric-value em { margin-left: 2px; color: var(--muted); font-family: var(--sans); font-size: 8px; font-style: normal; font-weight: 400; }
.metric-delta { display: block; margin-top: 2px; color: var(--positive); font-size: 8px; }
.spark { width: 260px; height: 46px; flex: none; overflow: visible; }
.spark .area { fill: var(--accent-soft); }
.spark .line { fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.spark .dot { fill: var(--surface); stroke: var(--accent); stroke-width: 1.3; }
.spark .dot.hit { fill: transparent; stroke: none; }

/* today card */
.today-card .today-date { margin: 0; color: var(--muted); font-size: 8.5px; letter-spacing: 0.05em; }
.diary-input {
  width: 100%;
  min-height: 46px;
  margin: 7px 0 2px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink-2);
  font-family: var(--serif);
  font-size: 12px;
  line-height: 1.75;
  resize: none;
  outline: none;
}
.diary-input::placeholder { color: var(--muted); opacity: 0.75; }
.today-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.today-chip {
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 8px;
  letter-spacing: 0.02em;
}
.today-chip b { color: var(--ink-2); font-weight: 600; }
.today-save {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--positive);
  font-size: 8px;
  opacity: 0;
  transition: opacity var(--dur-base);
}
.today-save.show { opacity: 1; }

/* ---------- notes view ---------- */
.panel-card { padding: 20px 22px 14px; }
.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.list-head .count { color: var(--muted); font-size: 9.5px; letter-spacing: 0.04em; }

.note-list { display: flex; flex-direction: column; }
.note-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 17px 0;
  border: 0;
  border-top: 1px solid var(--line);
  background: none;
  color: inherit;
  text-align: left;
  transition: background-color var(--dur-fast), padding var(--dur-fast);
}
.note-row:last-child { border-bottom: 1px solid var(--line); }
.note-row-main { min-width: 0; }
.note-row-title {
  display: block;
  overflow: hidden;
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color var(--dur-fast);
}
.note-row-excerpt {
  display: -webkit-box;
  overflow: hidden;
  margin-top: 4px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.65;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
}
.note-row-date { color: var(--muted); font-size: 9px; white-space: nowrap; }
.note-row-arrow { color: var(--line-strong); transition: transform var(--dur-base) var(--ease-out), color var(--dur-fast); }
.note-row:hover .note-row-title { color: var(--accent-text); }
.note-row:hover .note-row-arrow { color: var(--accent); transform: translateX(3px); }

/* ---------- todos view ---------- */
.todo-input-row {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 8px 0 15px;
  border-bottom: 1px solid var(--line-strong);
}
.todo-plus { color: var(--muted); font-family: var(--serif); font-size: 20px; line-height: 1; }
.todo-input {
  flex: 1;
  min-width: 0;
  padding: 6px 0;
  border: 0;
  background: none;
  color: var(--ink);
  font-size: 15px;
  letter-spacing: 0.01em;
  outline: none;
}
.todo-input::placeholder { color: var(--muted); }

.todo-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0 6px;
}
.filters { display: flex; gap: 4px; }
.filter {
  padding: 5px 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font-size: 9.5px;
  letter-spacing: 0.02em;
  transition: color var(--dur-fast), background-color var(--dur-fast), border-color var(--dur-fast);
}
.filter:hover { color: var(--ink); background: var(--surface-2); }
.filter.is-active { border-color: var(--line); background: var(--surface); color: var(--ink); }
.filter-count { margin-left: 3px; color: var(--muted); font-size: 8px; }

.todo-list { display: flex; flex-direction: column; }
.todo-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 4px 2px;
  border-bottom: 1px solid var(--line);
  transition: background-color var(--dur-fast);
}
.todo-row:hover { background: color-mix(in srgb, var(--ink) 2.5%, transparent); }
.todo-check {
  position: relative;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  padding: 0;
  border: 0;
  background: none;
  color: #fff8f4;
}
.todo-check::before {
  content: "";
  width: 18px;
  height: 18px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: transparent;
  transition: background-color var(--dur-fast), border-color var(--dur-fast), transform var(--dur-press);
}
.todo-check::after {
  content: "";
  position: absolute;
  left: 13px;
  top: 16px;
  width: 9px;
  height: 5px;
  border-left: 1.5px solid #fff8f4;
  border-bottom: 1.5px solid #fff8f4;
  opacity: 0;
  transform: rotate(-45deg) scale(0.6);
  transition: opacity var(--dur-fast), transform var(--dur-fast) var(--ease-out);
}
.todo-check:hover::before { border-color: var(--accent); }
.todo-row.done .todo-check::before { background: var(--accent); border-color: var(--accent); }
.todo-row.done .todo-check::after { opacity: 1; transform: rotate(-45deg) scale(1); }
.todo-check:active::before { transform: scale(0.9); }

.todo-text {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--ink-2);
  font-size: 12.5px;
  line-height: 1.55;
  transition: color var(--dur-fast);
}
.todo-row.done .todo-text { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 0.5px; }

.todo-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  color: var(--muted);
  font-size: 9.5px;
  letter-spacing: 0.03em;
}

/* ---------- fitness view ---------- */
.fit-grid { display: grid; gap: 14px; }
.fit-top { display: grid; grid-template-columns: 1.36fr 1fr; gap: 14px; }

.session-list { display: flex; flex-direction: column; }
.session-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto 30px;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.session-row:first-child { border-top: 0; padding-top: 2px; }
.session-date { color: var(--muted); font-size: 9px; letter-spacing: 0.03em; }
.session-main { min-width: 0; }
.session-title { margin: 0; font-family: var(--serif); font-size: 16px; line-height: 1.4; }
.session-note { margin: 3px 0 0; color: var(--muted); font-size: 9.5px; line-height: 1.5; }
.session-min { color: var(--muted); font-size: 9px; white-space: nowrap; }

.plan-card .card-head .card-meta { color: var(--accent-text); }
.plan-edit-hint { color: var(--muted); font-size: 9px; }

.body-wide { padding-bottom: 16px; }
.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; margin-top: 2px; }
.metric-block {
  min-width: 0;
  padding: 12px 0 2px;
}
.metric-block + .metric-block { border-left: 1px solid var(--line); padding-left: 24px; }
.metric-block .metric-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.metric-block .metric-label { font-size: 8.5px; }
.metric-block .metric-value { font-size: 24px; }
.metric-block .spark { width: 100%; height: 64px; margin-top: 8px; }
.metric-block .metric-delta { font-size: 8.5px; }

/* ---------- review ---------- */
.review-grid { display: grid; grid-template-columns: 1.42fr 1fr; gap: 14px; align-items: start; }

.calendar-card { padding-bottom: 16px; }
.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.cal-month { font-family: var(--serif); font-size: 17px; letter-spacing: 0.02em; }
.cal-month em { margin-left: 3px; color: var(--muted); font-family: var(--sans); font-size: 9px; font-style: normal; }
.cal-nav { display: flex; align-items: center; gap: 2px; }
.cal-nav .icon-button { width: 30px; height: 30px; border-color: transparent; }
.cal-nav .icon-button:hover { background: var(--surface-2); border-color: transparent; }
.cal-today-btn {
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 8.5px;
  transition: color var(--dur-fast), border-color var(--dur-fast), background-color var(--dur-fast);
}
.cal-today-btn:hover { color: var(--ink); border-color: var(--line-strong); background: var(--surface-2); }

.cal-dows {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 5px;
}
.cal-dow { padding: 4px 0; color: var(--muted); font-size: 8px; letter-spacing: 0.12em; text-align: center; }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.cal-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 52px;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-2);
  font-size: 11px;
  line-height: 1;
  transition: background-color var(--dur-fast), color var(--dur-fast), transform var(--dur-press);
}
.cal-cell:hover { background: var(--surface-2); }
.cal-cell:active { transform: scale(0.96); }
.cal-cell.outside { color: var(--muted); opacity: 0.38; }
.cal-num {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  transition: background-color var(--dur-fast), color var(--dur-fast), box-shadow var(--dur-fast);
}
.cal-cell.today .cal-num {
  color: var(--accent-text);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px var(--accent);
}
.cal-cell.selected .cal-num {
  background: var(--ink);
  color: var(--bg);
  font-weight: 600;
  box-shadow: none;
}
.cal-cell.selected.today .cal-num {
  background: var(--accent);
  color: #fff8f4;
  box-shadow: none;
}
.cal-cell.selected:hover { background: var(--surface-2); }

.cal-dots { display: flex; align-items: center; gap: 2px; height: 4px; }
.cal-dot { width: 4px; height: 4px; border-radius: 50%; background: var(--accent); }
.cal-dot.other { background: var(--ink-2); opacity: 0.55; }

.cal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 11px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 8.5px;
}
.cal-legend { display: flex; align-items: center; gap: 10px; }
.cal-legend span { display: inline-flex; align-items: center; gap: 4px; }
.cal-legend i { width: 4px; height: 4px; border-radius: 50%; background: var(--accent); }
.cal-legend i.other { background: var(--ink-2); opacity: 0.55; }

.detail-card { padding-bottom: 16px; }
.detail-date { margin: 0; font-family: var(--serif); font-size: 19px; line-height: 1.4; }
.detail-weekday { margin: 3px 0 0; color: var(--muted); font-size: 9px; letter-spacing: 0.05em; }
.detail-diary-wrap { margin-top: 12px; padding-top: 11px; border-top: 1px solid var(--line); }
.detail-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 8px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.detail-diary {
  width: 100%;
  min-height: 58px;
  margin-top: 6px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink-2);
  font-family: var(--serif);
  font-size: 11.5px;
  line-height: 1.75;
  resize: none;
  outline: none;
}
.detail-diary::placeholder { color: var(--muted); opacity: 0.75; }

.activity-block { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.activity-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 4px 0;
  color: var(--ink-2);
  font-size: 10.5px;
  line-height: 1.5;
}
.activity-item .dot { width: 3px; height: 3px; margin-top: 6px; flex: none; border-radius: 50%; background: var(--accent); }
.activity-item .num { margin-left: auto; flex: none; color: var(--muted); font-size: 8.5px; }
.activity-empty { padding: 7px 0 2px; color: var(--muted); font-size: 9.5px; }
.detail-empty { padding: 26px 0 30px; }

/* ---------- modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  visibility: hidden;
  opacity: 0;
  transition: opacity var(--dur-base) var(--ease-in-out), visibility 0s linear var(--dur-base);
}
.modal.is-open {
  visibility: visible;
  opacity: 1;
  transition: opacity var(--dur-base) var(--ease-out), visibility 0s;
}
.modal-scrim {
  position: absolute;
  inset: 0;
  background: rgba(13, 12, 9, 0.48);
  -webkit-backdrop-filter: blur(7px);
  backdrop-filter: blur(7px);
}
[data-theme="dark"] .modal-scrim { background: rgba(0, 0, 0, 0.62); }

.sheet {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(720px, 100%);
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow-pop);
  opacity: 0;
  transform: translateY(12px) scale(0.985);
  transition: opacity var(--dur-base) var(--ease-out), transform var(--dur-sheet) var(--ease-out);
}
.modal.is-open .sheet { opacity: 1; transform: none; }
.sheet[data-size="sm"] { width: min(430px, 100%); }
.sheet[data-size="md"] { width: min(680px, 100%); }
.sheet[data-size="lg"] { width: min(780px, 100%); }

.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 26px 0;
}
.sheet-heading { min-width: 0; }
.sheet-kicker {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 8px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.sheet-kicker:empty { display: none; }
.sheet-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0.015em;
}
.sheet-close { margin: -4px -6px 0 0; }
.sheet-close .icon { width: 16px; height: 16px; }

.sheet-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 26px 8px;
  overscroll-behavior: contain;
}
.sheet-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 26px 20px;
  border-top: 1px solid var(--line);
}
.sheet-foot .spacer { flex: 1; }

/* forms */
.form { display: flex; flex-direction: column; gap: 15px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.1em;
}
.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 9px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
  outline: none;
  transition: border-color var(--dur-fast);
  color-scheme: light;
}
[data-theme="dark"] .field input,
[data-theme="dark"] .field textarea,
[data-theme="dark"] .field select { color-scheme: dark; }
.field input:focus,
.field textarea:focus,
.field select:focus { border-bottom-color: var(--accent); }
.field input::placeholder,
.field textarea::placeholder { color: var(--muted); opacity: 0.7; }
.field textarea { min-height: 74px; resize: vertical; }
.field small { color: var(--muted); font-size: 8.5px; line-height: 1.6; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

.note-editor-title {
  width: 100%;
  padding: 4px 0 10px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 27px;
  line-height: 1.35;
  outline: none;
}
.note-editor-title::placeholder { color: var(--muted); opacity: 0.55; }
.note-editor-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; color: var(--muted); font-size: 9px; }
.note-editor-body {
  width: 100%;
  min-height: 260px;
  margin-top: 14px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink-2);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.9;
  resize: none;
  outline: none;
}
.note-editor-body::placeholder { color: var(--muted); opacity: 0.7; }

.plan-editor { display: flex; flex-direction: column; gap: 3px; }
.plan-editor-row {
  display: grid;
  grid-template-columns: 42px 88px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
.plan-editor-row:first-child { border-top: 0; }
.plan-editor-day { color: var(--muted); font-size: 9.5px; }
.plan-editor-type {
  width: 100%;
  padding: 6px 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 9.5px;
  outline: none;
}
.plan-editor-input {
  width: 100%;
  padding: 7px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  color: var(--ink);
  font-size: 11.5px;
  outline: none;
}
.plan-editor-input:disabled { color: var(--muted); opacity: 0.55; }
.plan-editor-rest { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 8.5px; white-space: nowrap; }
.plan-editor-rest input { width: 13px; height: 13px; accent-color: var(--accent); }

.avatar-editor { display: flex; align-items: center; gap: 14px; }
.avatar-editor .avatar { width: 58px; height: 58px; font-size: 16px; }
.avatar-editor-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.avatar-editor-actions .btn { min-height: 30px; padding: 0 11px; font-size: 9.5px; }
.file-input { display: none; }

.profile-form { display: flex; flex-direction: column; gap: 20px; }
.theme-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.theme-row p { margin: 0; color: var(--muted); font-size: 9.5px; }
.theme-row b { display: block; margin-bottom: 2px; color: var(--ink-2); font-size: 10.5px; font-weight: 500; }

.quote-form textarea { min-height: 64px; }
.pinned-hint { color: var(--muted); font-size: 9px; line-height: 1.7; }

.form-error {
  margin: 0;
  padding: 7px 9px;
  border-radius: 7px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 9.5px;
  line-height: 1.5;
}

.dirty-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--ink-2);
  font-size: 9.5px;
}
.dirty-bar .dirty-actions { display: flex; gap: 6px; flex: none; }

/* ---------- toast / tooltip ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: calc(100vw - 36px);
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--bg);
  box-shadow: 0 18px 40px -20px rgba(0, 0, 0, 0.6);
  font-size: 10.5px;
  letter-spacing: 0.02em;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: opacity var(--dur-fast) var(--ease-out), transform var(--dur-base) var(--ease-out);
  overflow: hidden;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast-action {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent-text);
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
}
[data-theme="dark"] .toast-action { color: #ffb49c; }
.toast-progress {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 1.5px;
  background: var(--accent);
  transform-origin: left center;
  transform: scaleX(0);
}
.toast.is-visible .toast-progress { animation: toastProgress var(--toast-duration, 3000ms) linear forwards; }

.tooltip {
  position: fixed;
  z-index: 300;
  padding: 5px 8px;
  border-radius: 6px;
  background: var(--ink);
  color: var(--bg);
  font-size: 8.5px;
  line-height: 1.4;
  letter-spacing: 0.02em;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 4px);
  transition: opacity 120ms var(--ease-out), transform 120ms var(--ease-out);
  white-space: nowrap;
}
.tooltip.is-visible { opacity: 1; transform: translate(-50%, 0); }

.noscript-note {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 400;
  margin: 0;
  padding: 9px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--bg);
  font-size: 11px;
  transform: translateX(-50%);
}

/* ---------- mobile bar ---------- */
.mobile-bar { display: none; }

/* ---------- motion helpers ---------- */
@keyframes toastProgress {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

@keyframes spinOnce {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.spin-once { animation: spinOnce 420ms var(--ease-out); }

@keyframes softPulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}

/* ---------- responsive ---------- */
@media (hover: hover) {
  .card:hover {
    border-color: var(--line-strong);
    box-shadow: var(--shadow-lift);
  }
  .ov-row.cols-3 .card:hover,
  .ov-row.cols-75 .card:hover { transform: translateY(-1px); }
}

@media (max-width: 1280px) {
  .main { padding: 28px 30px 38px; }
  .quote-card { width: 342px; }
}

@media (max-width: 1180px) {
  :root { --sb-w: 84px; }
  .sidebar { align-items: flex-start; padding: 24px 13px 18px; }
  .brand { width: 100%; justify-content: center; padding: 0; }
  .brand-text,
  .nav-caption,
  .nav-item span,
  .local-note,
  .profile-row .profile-text,
  .profile-row .chev { display: none; }
  .brand-mark { width: 38px; height: 38px; }
  .nav { width: 100%; }
  .nav-item { justify-content: center; padding: 11px 0; }
  .sidebar-bottom { width: 100%; align-items: center; }
  .sidebar-tools { padding: 0; justify-content: center; }
  .profile-row { justify-content: center; padding: 4px 0; }
  .profile-row .avatar { margin: 0; }
  .main { margin-left: var(--sb-w); }
  .view-heading h1 { font-size: 33px; }
}

@media (max-width: 980px) {
  .ov-row.cols-3,
  .ov-row.cols-75,
  .fit-top { grid-template-columns: 1fr; }
  .ov-row.cols-3 .card,
  .ov-row.cols-75 .card { min-height: 0; }
  .review-grid { grid-template-columns: 1fr; }
  .detail-card { position: static; }
  .metric-grid { gap: 18px; }
}

@media (max-width: 900px) {
  :root { --sb-w: 0px; }

  .sidebar {
    inset: auto 0 0 0;
    flex-direction: row;
    align-items: center;
    width: 100%;
    height: calc(62px + env(safe-area-inset-bottom));
    padding: 0 8px env(safe-area-inset-bottom);
    border-top: 1px solid var(--sidebar-line);
    border-right: 0;
    background: color-mix(in srgb, var(--sidebar) 97%, transparent);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
  }

  .brand,
  .nav-caption,
  .sidebar-bottom { display: none; }

  .nav {
    flex-direction: row;
    width: 100%;
    gap: 0;
    margin: 0 auto;
  }

  .nav-indicator {
    top: 0;
    left: 0;
    width: 18px;
    height: 3px;
    border-radius: 0 0 3px 3px;
    transform: translate3d(var(--ind-x, 0px), 0, 0);
  }

  .nav-item {
    flex: 1;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    min-height: 54px;
    padding: 6px 0;
    border-radius: 10px;
    font-size: 9px;
    letter-spacing: 0.04em;
  }

  .nav-item span { display: block; }
  .nav-item .icon { width: 18px; height: 18px; }
  .nav-item.is-active { background: transparent; color: #fff; }
  .nav-item.is-active .icon { color: var(--accent); }

  .mobile-bar {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: calc(56px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 20px 0;
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid var(--line);
  }

  .mobile-brand {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--ink);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-decoration: none;
  }

  .mobile-brand .brand-mark { width: 26px; height: 26px; border-radius: 8px; font-size: 16px; }
  .mobile-profile { width: 34px; height: 34px; border: 0; padding: 0; border-radius: 50%; }
  .mobile-profile .avatar { width: 32px; height: 32px; }
  .mobile-profile:hover { background: transparent; border: 0; }

  .main {
    margin-left: 0;
    padding: calc(70px + env(safe-area-inset-top)) 18px calc(90px + env(safe-area-inset-bottom));
  }

  .view-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    min-height: 0;
    margin-bottom: 18px;
  }

  .view-heading h1 { font-size: 30px; }
  .view-actions { width: 100%; flex-wrap: wrap; }
  .quote-card { width: 100%; }
  .view-actions .btn { flex: 1; }

  .card { padding: 16px 16px 12px; border-radius: 16px; }
  .ov-row.cols-3 .card,
  .ov-row.cols-75 .card { min-height: 0; }
  .ov-grid { gap: 12px; }
  .ov-row { gap: 12px; }

  .panel-card { padding: 16px 16px 12px; }
  .note-row { grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
  .note-row-arrow { display: none; }
  .note-row-date { font-size: 8.5px; }

  .todo-input-row { gap: 10px; }
  .todo-input { font-size: 16px; }
  .todo-row { min-height: 52px; }
  .todo-check { width: 40px; height: 40px; }
  .todo-check::before { width: 19px; height: 19px; }
  .todo-check::after { left: 15px; top: 18px; }
  .icon-action { opacity: 1; }
  .icon-action:hover { background: transparent; }

  .fit-top { gap: 12px; }
  .session-row { grid-template-columns: 40px minmax(0, 1fr) auto 28px; gap: 10px; }
  .metric-grid { grid-template-columns: 1fr; }
  .metric-block + .metric-block { border-left: 0; border-top: 1px solid var(--line); padding-left: 0; padding-top: 14px; }
  .metric-block .spark { height: 58px; }

  .review-grid { gap: 12px; }
  .cal-cell { height: 46px; font-size: 12px; border-radius: 10px; }
  .cal-num { width: 27px; height: 27px; }
  .cal-dow { font-size: 8px; }
  .detail-diary { font-size: 12px; }

  .sheet {
    width: 100%;
    max-height: 92dvh;
    border-radius: 20px 20px 0 0;
  }
  .modal { align-items: flex-end; padding: 0; }
  .sheet[data-size="sm"],
  .sheet[data-size="md"],
  .sheet[data-size="lg"] { width: 100%; }
  .sheet-head { padding: 20px 20px 0; }
  .sheet-body { padding: 16px 20px 6px; }
  .sheet-foot { padding: 12px 20px 18px; }
  .note-editor-title { font-size: 24px; }
  .note-editor-body { min-height: 180px; font-size: 16px; }
  .field input,
  .field textarea,
  .field select,
  .todo-input { font-size: 16px; }
  .field-row { grid-template-columns: 1fr; gap: 15px; }

  .toast { bottom: calc(78px + env(safe-area-inset-bottom)); }
  .tooltip { display: none; }
}

@media (max-width: 620px) {
  .main { padding-left: 14px; padding-right: 14px; }
  .view-heading h1 { font-size: 27px; }
  .view-heading .lede { font-size: 10.5px; }
  .quote-card { padding: 10px 13px 8px 38px; }
  .quote-text { font-size: 12px; }
  .quote-mark { left: 11px; font-size: 26px; }
  .quote-foot { align-items: flex-end; }
  .quote-actions { gap: 8px; }
  .card-head h2 { font-size: 14.5px; }
  .card-meta { font-size: 8.5px; }
  .card-meta { max-width: 46%; overflow: hidden; text-overflow: ellipsis; }
  .card-foot { font-size: 8.5px; }

  .mini-note-excerpt { max-width: 210px; }
  .heat-body { flex-direction: column; align-items: stretch; gap: 11px; }
  .heat-wrap { align-items: center; }
  .heat-stats { flex-direction: row; justify-content: space-between; padding-left: 0; padding-top: 10px; border-left: 0; border-top: 1px solid var(--line); }
  .heat-stat { min-width: 0; }
  .heat-stat b { font-size: 14px; }
  .heat-stat span { font-size: 7px; }

  .plan-body { gap: 10px; }
  .ring-wrap { width: 76px; }
  .ring { width: 68px; height: 68px; }
  .ring-label { font-size: 16px; line-height: 68px; }
  .ring-cap { font-size: 7px; }
  .week-row { grid-template-columns: 22px minmax(0, 1fr) auto 10px; gap: 5px; }
  .week-row .wt { font-size: 9px; }
  .week-row .tag { font-size: 7px; padding: 1px 5px; }

  .metric-row { gap: 10px; }
  .metric-row .chart-empty { width: 160px; min-height: 42px; }
  .metric-value { font-size: 19px; }
  .spark { width: 160px; height: 42px; }
  .metric-block .spark { width: 100%; height: 56px; }

  .today-chips { gap: 4px; }
  .today-chip { font-size: 7.5px; padding: 2px 6px; }

  .cal-cell { height: 42px; font-size: 11px; }
  .cal-num { width: 25px; height: 25px; }
  .cal-dots { height: 3px; }
  .cal-dot { width: 3px; height: 3px; }
  .cal-month { font-size: 15px; }
  .cal-foot { font-size: 7.5px; }

  .session-title { font-size: 15px; }
  .session-note { font-size: 9px; }

  .profile-form { gap: 16px; }
  .theme-row { padding-top: 12px; }
}

@media (max-width: 400px) {
  .main { padding-left: 12px; padding-right: 12px; }
  .nav-item { font-size: 8.5px; }
  .view-heading h1 { font-size: 25px; }
  .heat-grid { grid-auto-columns: 12px; grid-template-rows: repeat(7, 12px); gap: 3px; }
  .heat-cell { width: 12px; height: 12px; }
  .cal-cell { height: 40px; }
  .spark { width: 130px; }
  .session-row { grid-template-columns: 34px minmax(0, 1fr) auto 24px; gap: 8px; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- app-specific motion / state polish ---------- */
body.modal-open {
  position: fixed;
  left: 0;
  right: 0;
  width: 100%;
  overflow: hidden;
}

.nav-indicator { transition: none; }
.nav.is-ready .nav-indicator {
  transition: transform var(--dur-slow) var(--ease-out), width var(--dur-slow) var(--ease-out), height var(--dur-slow) var(--ease-out);
}

.quote-text {
  display: -webkit-box;
  min-height: 39px;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.heat-cell.future { opacity: 0.35; }

.spark .dot.hit {
  fill: transparent;
  stroke: none;
  pointer-events: all;
}

.spark .line {
  transition: stroke-dashoffset 760ms var(--ease-out);
}

@keyframes flashRow {
  from { background-color: var(--accent-soft); }
  to { background-color: transparent; }
}

.is-flashed { animation: flashRow 760ms var(--ease-out); }

.mini-note {
  width: 100%;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.mini-note:hover { background: var(--surface-2); }
.mini-note { padding-left: 4px; padding-right: 4px; margin-left: -4px; margin-right: -4px; }
.mini-note-main { min-width: 0; }

.session-main {
  display: block;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  text-align: left;
}
.session-main:hover .session-title { color: var(--accent-text); }

.todo-row:hover .icon-action,
.todo-row:focus-within .icon-action,
.session-row:hover .icon-action,
.session-row:focus-within .icon-action {
  opacity: 1;
}

.view-heading h1:focus { outline: none; }

.metric-delta { color: var(--muted); }
.metric-grid.single { grid-template-columns: 1fr; }
.metric-block .spark { height: auto; width: 100%; aspect-ratio: 260 / 46; }

html.theme-changing body,
html.theme-changing .sidebar,
html.theme-changing .mobile-bar,
html.theme-changing .card,
html.theme-changing .quote-card,
html.theme-changing .sheet,
html.theme-changing .cal-cell,
html.theme-changing .today-chip,
html.theme-changing .field input,
html.theme-changing .field textarea,
html.theme-changing .field select,
html.theme-changing .todo-row,
html.theme-changing .note-row,
html.theme-changing .session-row {
  transition: background-color 240ms var(--ease-out), color 240ms var(--ease-out), border-color 240ms var(--ease-out), box-shadow 240ms var(--ease-out) !important;
}
.icon-action { transition-property: opacity, color, background-color, transform; }
.todo-check::before { transition-property: background-color, border-color, transform; }
.plan-editor-input:disabled { opacity: 0.55; }


.chart-empty {
  display: grid;
  place-items: center;
  width: 260px;
  min-height: 46px;
  flex: none;
  border-top: 1px dashed var(--line);
  border-bottom: 1px dashed var(--line);
  color: var(--muted);
  font-size: 8px;
  letter-spacing: 0.02em;
  text-align: center;
}

.metric-block .chart-empty {
  width: 100%;
  min-height: 64px;
  margin-top: 8px;
}

.week-row.today .wt { text-decoration: none; }


.avatar-editor-info {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}
.avatar-editor-info small { color: var(--muted); font-size: 8.5px; line-height: 1.5; }


@media (max-width: 900px) {
  .sheet[data-size="lg"] { min-height: 88dvh; }
}


@media (max-width: 900px) {
  .plan-editor-input,
  .plan-editor-type,
  .diary-input,
  .detail-diary { font-size: 16px; }
  .plan-editor-row { grid-template-columns: 34px 74px minmax(0, 1fr) auto; gap: 8px; }
  .plan-editor-rest { font-size: 8px; }
}


button.activity-item {
  width: 100%;
  padding: 4px 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
button.activity-item:hover { color: var(--accent-text); }


.quote-actions button { min-height: 22px; padding: 2px 1px; }

@media (max-width: 900px) {
  .filter { padding: 7px 12px; font-size: 10px; }
  .quote-actions { gap: 12px; }
  .quote-actions button { min-height: 28px; font-size: 9.5px; }
  .icon-action { width: 36px; height: 36px; }
  .session-row { grid-template-columns: 40px minmax(0, 1fr) auto 36px; }
}


@media (max-width: 400px) {
  .metric-row .chart-empty { width: 130px; }
}


.btn[hidden] { display: none; }


/* ---------- todo workspace ---------- */
.todo-workspace {
  display: grid;
  grid-template-columns: 202px minmax(0, 1fr);
  min-height: 570px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.todo-nav {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 22px 12px 18px;
  background: color-mix(in srgb, var(--surface-2) 48%, var(--surface));
  border-right: 1px solid var(--line);
}

.todo-nav-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 8px 7px;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.todo-nav-main,
.todo-nav-lists { display: flex; flex-direction: column; gap: 2px; }

.todo-nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 34px;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-2);
  font-size: 11.5px;
  text-align: left;
  transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}

.todo-nav-item:hover { background: var(--surface-hover); color: var(--ink); }
.todo-nav-item.is-active {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
  box-shadow: 0 1px 0 rgba(24, 22, 16, 0.02);
}
.todo-nav-icon { display: inline-flex; width: 16px; height: 16px; align-items: center; justify-content: center; color: var(--muted); }
.todo-nav-icon .icon { width: 15px; height: 15px; }
.todo-nav-item.is-active .todo-nav-icon { color: var(--accent-text); }
.todo-dot { display: block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.todo-nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.todo-nav-count { color: var(--muted); font-size: 9px; font-variant-numeric: tabular-nums; }
.todo-nav-item.is-active .todo-nav-count { color: var(--accent-text); }

.todo-nav-list { position: relative; display: flex; align-items: center; }
.todo-nav-list .todo-nav-item { padding-right: 28px; }
.todo-list-edit {
  position: absolute;
  right: 5px;
  top: 50%;
  width: 24px;
  height: 24px;
  transform: translateY(-50%);
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}
.todo-list-edit .icon { width: 12px; height: 12px; }
.todo-nav-list:hover .todo-list-edit,
.todo-list-edit:focus-visible { opacity: 1; }
.todo-list-edit:hover { background: var(--surface); color: var(--ink); }

.todo-add-list {
  display: inline-flex;
  width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
}
.todo-add-list .icon { width: 12px; height: 12px; }
.todo-add-list:hover { background: var(--surface); color: var(--ink); }
.todo-nav-empty { margin: 3px 9px; color: var(--muted); font-size: 9.5px; }
.todo-nav-new {
  display: none;
  align-items: center;
  gap: 7px;
  margin-top: auto;
  padding: 8px 9px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  text-align: left;
}
.todo-nav-new .icon { width: 13px; height: 13px; }
.todo-nav-new:hover { color: var(--ink); border-color: var(--muted); }

.todo-panel { display: flex; min-width: 0; flex-direction: column; padding: 24px 26px 18px; }
.todo-panel-head { display: flex; flex-direction: column; gap: 14px; padding-bottom: 4px; }
.todo-title-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.todo-title-row .kicker { margin: 0 0 3px; }
.todo-title-row h2 { margin: 0; font-family: var(--serif); font-size: 25px; font-weight: 600; letter-spacing: -0.02em; }
.todo-panel-count { color: var(--muted); font-size: 9.5px; }
.todo-search {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-hover);
  color: var(--muted);
  transition: border-color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}
.todo-search:focus-within { border-color: var(--line-strong); background: var(--surface); }
.todo-search .icon { width: 14px; height: 14px; }
.todo-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 11px;
}
.todo-search input::placeholder { color: var(--muted); }
.todo-search-clear {
  display: inline-flex;
  width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
}
.todo-search-clear:hover { background: var(--surface-2); color: var(--ink); }
.todo-search-clear .icon { width: 12px; height: 12px; }

.todo-add {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  margin-top: 12px;
  padding: 0 2px;
  border-bottom: 1px solid var(--line);
}
.todo-plus { color: var(--accent-text); font-size: 17px; line-height: 1; }
.todo-add .todo-input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; padding: 10px 0; font-size: 12px; }
.todo-add .todo-input::placeholder { color: var(--muted); }
.btn-small { min-height: 28px; padding: 5px 10px; font-size: 9.5px; }
.todo-detail-add { color: var(--muted); }
.todo-detail-add .icon { width: 12px; height: 12px; }

.todo-plan-strip {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 14px;
  margin-top: 14px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-hover);
}
.plan-days { display: grid; flex: 1; min-width: 0; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.plan-day {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 5px 2px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.2;
  transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.plan-day b { color: var(--ink-2); font-family: var(--serif); font-size: 15px; font-weight: 500; line-height: 1.1; }
.plan-day em { color: var(--muted); font-size: 7.5px; font-style: normal; }
.plan-day:hover { background: var(--surface); }
.plan-day.is-active { background: var(--accent); border-color: var(--accent); color: #fff8f4; }
.plan-day.is-active b,
.plan-day.is-active em { color: #fff8f4; }
.plan-jump { display: flex; min-width: 84px; flex-direction: column; align-items: flex-end; justify-content: center; gap: 3px; color: var(--muted); font-size: 8px; }
.plan-jump .link { font-size: 8.5px; }
.plan-date-field { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.plan-date-field .icon { width: 12px; height: 12px; }
.plan-date-field input {
  width: 92px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 8.5px;
  outline: 0;
}

.task-groups { display: flex; flex-direction: column; gap: 18px; padding-top: 14px; }
.task-group-head { display: flex; align-items: center; justify-content: space-between; padding: 0 2px 5px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 8.5px; letter-spacing: 0.04em; }
.task-group-head span:last-child { font-variant-numeric: tabular-nums; }
.task-group-head .is-overdue { color: var(--accent-text); }
.task-list { display: flex; flex-direction: column; }
.task-row {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) 28px 28px;
  align-items: start;
  gap: 9px;
  min-height: 48px;
  padding: 11px 2px;
  border-bottom: 1px solid var(--line);
  transition: background-color var(--dur-fast) var(--ease-out);
}
.task-row:last-child { border-bottom: 0; }
.task-row:hover { background: var(--surface-hover); }
.task-main {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
}
.task-title { color: var(--ink); font-size: 12.5px; line-height: 1.4; word-break: break-word; }
.task-row.done .task-title { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1px; }
.task-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; color: var(--muted); font-size: 8.5px; line-height: 1.5; }
.task-meta .is-overdue { color: var(--accent-text); }
.meta-sep { color: var(--line-strong); }
.task-list-tag { display: inline-flex; align-items: center; gap: 4px; }
.task-list-tag i { display: block; width: 5px; height: 5px; border-radius: 50%; }
.task-note-tag { display: inline-flex; align-items: center; gap: 3px; }
.task-note-tag .icon { width: 10px; height: 10px; }
.task-star {
  display: inline-flex;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  margin-top: -3px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--line-strong);
  transition: color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out), transform var(--dur-press) var(--ease-press);
}
.task-star .icon { width: 14px; height: 14px; }
.task-star:hover { background: var(--surface-2); color: var(--ink-2); }
.task-star.is-on { color: var(--accent); }
.task-star.is-on .icon { fill: currentColor; }
.task-star:active { transform: scale(0.9); }
.task-row .icon-action { opacity: 0; margin-top: -2px; }
.task-row:hover .icon-action,
.task-row .icon-action:focus-visible { opacity: 1; }
.task-row.is-flashed { animation: row-flash 760ms var(--ease-out); }
.task-row.done .todo-check { background: var(--accent); border-color: var(--accent); }
.task-row.done .todo-check::after { opacity: 1; transform: scale(1); }

.todo-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: auto; padding-top: 14px; color: var(--muted); font-size: 9px; }
.todo-foot .btn { font-size: 9px; }
.todo-empty { padding: 20px 0; }

/* task / list forms */
.task-form .field-row { grid-template-columns: 1.1fr 0.9fr; }
.date-quick { display: flex; flex-wrap: wrap; gap: 5px; margin-top: -2px; }
.date-quick .chip { min-height: 25px; padding: 4px 9px; font-size: 9px; }
.task-toggles { display: flex; flex-wrap: wrap; gap: 12px 18px; padding-top: 2px; }
.check-row { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: 10px; cursor: pointer; }
.check-row input { width: 14px; height: 14px; accent-color: var(--accent); }
.check-row .icon { width: 13px; height: 13px; color: var(--muted); }
.color-row { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 3px; }
.color-swatch { width: 25px; height: 25px; border: 2px solid transparent; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25); transition: transform var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out); }
.color-swatch:hover { transform: scale(1.08); }
.color-swatch.is-active { border-color: var(--ink); box-shadow: inset 0 0 0 2px var(--surface); }

@media (max-width: 900px) {
  .todo-workspace { display: block; min-height: 0; }
  .todo-nav {
    flex-direction: row;
    align-items: center;
    gap: 6px;
    padding: 9px 10px;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    scrollbar-width: none;
  }
  .todo-nav::-webkit-scrollbar { display: none; }
  .todo-nav-main,
  .todo-nav-lists { flex-direction: row; flex: 0 0 auto; align-items: center; gap: 4px; }
  .todo-nav-caption,
  .todo-nav-empty { display: none; }
  .todo-nav-new {
    display: inline-flex;
    flex: 0 0 auto;
    margin: 0;
    padding: 6px 9px;
    border: 1px dashed var(--line-strong);
    border-radius: 8px;
    font-size: 9.5px;
    white-space: nowrap;
  }
  .todo-nav-item { min-height: 32px; width: auto; padding: 6px 9px; white-space: nowrap; font-size: 10.5px; }
  .todo-nav-icon { width: 14px; height: 14px; }
  .todo-nav-count { font-size: 8.5px; }
  .todo-nav-list .todo-nav-item { padding-right: 24px; }
  .todo-list-edit { right: 2px; opacity: 1; }
  .todo-panel { padding: 18px 16px 16px; }
  .todo-title-row h2 { font-size: 23px; }
  .todo-add { gap: 5px; }
  .todo-detail-add { padding: 5px 7px; }
  .todo-detail-add .icon { width: 11px; height: 11px; }
  .todo-plan-strip { flex-direction: column; gap: 7px; }
  .plan-jump { flex-direction: row; align-items: center; justify-content: space-between; }
  .plan-date-field input { width: 112px; font-size: 16px; }
  .task-row { grid-template-columns: 24px minmax(0, 1fr) 28px 34px; gap: 7px; }
  .task-row .icon-action { opacity: 1; }
  .task-star { width: 26px; height: 26px; }
  .task-title { font-size: 13px; }
  .task-meta { font-size: 9px; }
  .task-form .field-row { grid-template-columns: 1fr; }
  .todo-search input { font-size: 16px; }
  .todo-add .todo-input { font-size: 16px; }
  .todo-search { min-height: 38px; }
  .todo-add { min-height: 48px; }
}

@media (max-width: 420px) {
  .task-row { grid-template-columns: 22px minmax(0, 1fr) 26px 30px; }
  .plan-day b { font-size: 13px; }
  .plan-day { font-size: 7.5px; }
  .todo-detail-add { font-size: 0; gap: 0; }
  .todo-detail-add .icon { width: 14px; height: 14px; }
}


.plan-date-btn {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 25px;
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  font-size: 8.5px;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.plan-date-btn:hover { border-color: var(--line-strong); color: var(--ink); }
.plan-date-btn .icon { width: 11px; height: 11px; }
.plan-date-btn input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

/* ---------- notes: heatmap, filter, time, location ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 9px;
  white-space: nowrap;
  transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.chip:hover { border-color: var(--line-strong); color: var(--ink); }
.chip.is-active { background: var(--ink); border-color: var(--ink); color: var(--bg); }

.note-heat-card { margin-bottom: 16px; }
.note-heat-body { display: flex; align-items: center; justify-content: center; gap: 52px; }
.note-heat-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; flex: none; }
.note-heat-grid .heat-cell { cursor: pointer; border: 0; padding: 0; }
.note-heat-cell.is-selected { outline: 2px solid var(--ink); outline-offset: 2px; }
.note-heat-stats { display: flex; flex: 0 1 auto; min-width: 0; align-items: center; justify-content: flex-start; gap: 34px; padding-left: 34px; border-left: 1px solid var(--line); }
.note-heat-stats div { text-align: center; }
.note-heat-stats b { display: block; font-family: var(--serif); font-size: 18px; font-weight: 600; line-height: 1.2; }
.note-heat-stats span { display: block; margin-top: 2px; color: var(--muted); font-size: 8px; }

.note-filter-bar { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.note-filter-chips { display: inline-flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.note-date-btn {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 26px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 9px;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}
.note-date-btn:hover,
.note-date-btn.is-active { border-color: var(--line-strong); color: var(--ink); }
.note-date-btn .icon { width: 11px; height: 11px; }
.note-date-btn input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.note-filter-label { color: var(--muted); font-size: 8.5px; white-space: nowrap; }
.list-head .note-filter-bar { margin-left: auto; }

.note-row-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; min-width: 0; }
.note-row-time { color: var(--muted); font-size: 8.5px; white-space: nowrap; }
.note-row-loc { display: inline-flex; max-width: 150px; align-items: center; gap: 3px; overflow: hidden; color: var(--muted); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.note-row-loc .icon { width: 10px; height: 10px; }

.note-editor-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 8.5px; }
.note-loc-add {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 8px 0 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 8.5px;
}
.note-loc-add .icon { width: 12px; height: 12px; }
.note-loc-add:hover { color: var(--accent-text); }
.note-loc-row { display: flex; align-items: center; gap: 7px; min-height: 30px; margin: 7px 0 0; padding: 5px 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-hover); }
.note-loc-pin { display: inline-flex; color: var(--accent-text); }
.note-loc-pin .icon { width: 13px; height: 13px; }
.note-loc-main { display: flex; min-width: 0; flex: 1; flex-direction: column; }
.note-loc-main b { overflow: hidden; color: var(--ink-2); font-size: 9px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.note-loc-main small { overflow: hidden; color: var(--muted); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.note-loc-map { color: var(--accent-text); font-size: 8.5px; }
.note-loc-row .icon-action { opacity: 1; width: 22px; height: 22px; }
.note-loc-row .icon-action .icon { width: 11px; height: 11px; }
.note-loc-row + .note-editor-body { margin-top: 2px; }

@media (max-width: 900px) {
  .note-heat-body { flex-direction: column; gap: 12px; }
  .note-heat-stats { width: 100%; padding: 12px 0 0; border-top: 1px solid var(--line); border-left: 0; }
  .note-heat-stats b { font-size: 17px; }
  .list-head { flex-wrap: wrap; align-items: flex-start; }
  .list-head .note-filter-bar { width: 100%; justify-content: flex-start; margin-left: 0; }
  .note-filter-label { margin-left: auto; }
  .note-row { grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
  .note-row-arrow { display: none; }
  .note-row-meta { align-items: flex-end; }
  .note-row-time { font-size: 8px; }
  .note-date-btn input { pointer-events: auto; }
  .note-date-btn { position: relative; overflow: hidden; }
  .note-date-btn input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; pointer-events: auto; }
  .note-filter-bar .chip { min-height: 30px; padding: 6px 11px; font-size: 10px; }
  .note-date-btn { min-height: 30px; font-size: 10px; }
}

/* ---------- fitness: session details & energy ---------- */
.session-sub { margin: 3px 0 0; color: var(--muted); font-size: 9px; line-height: 1.5; }
.session-sub .kcal { color: var(--ink-2); }

.energy-card { padding-bottom: 16px; }
.energy-body { display: grid; grid-template-columns: 1.04fr 0.96fr; gap: 24px; align-items: stretch; }
.energy-meals { display: flex; flex-direction: column; gap: 9px; min-width: 0; }
.energy-meals-head { display: flex; align-items: center; justify-content: space-between; padding-bottom: 3px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 8px; letter-spacing: 0.08em; }
.meal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 12px; }
.meal-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 26px;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-hover);
  transition: border-color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}
.meal-row:focus-within { border-color: var(--line-strong); background: var(--surface); }
.meal-row > span { color: var(--ink-2); font-size: 9px; }
.meal-row input {
  width: 100%;
  min-width: 0;
  padding: 2px 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.2;
}
.meal-row input::placeholder { color: var(--line-strong); font-family: var(--sans); font-size: 10px; }
.meal-row em { color: var(--muted); font-size: 7.5px; font-style: normal; }
.energy-note { display: flex; align-items: center; gap: 8px; margin-top: 1px; color: var(--muted); font-size: 8px; }
.energy-note input { flex: 1; min-width: 0; padding: 4px 0; border: 0; border-bottom: 1px solid var(--line); outline: 0; background: transparent; font-size: 9.5px; }
.energy-note input::placeholder { color: var(--muted); }

.energy-side { display: flex; min-width: 0; flex-direction: column; gap: 12px; padding-left: 22px; border-left: 1px solid var(--line); }
.energy-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 16px; align-items: end; }
.energy-number { display: flex; align-items: baseline; gap: 4px; min-width: 0; }
.energy-number span { color: var(--muted); font-size: 8px; }
.energy-number b { color: var(--ink); font-family: var(--serif); font-size: 24px; font-weight: 600; line-height: 1.1; }
.energy-number em { color: var(--muted); font-size: 7.5px; font-style: normal; }
.energy-net { grid-column: 1 / -1; display: inline-flex; align-items: center; gap: 4px; align-self: start; padding-top: 4px; border-top: 1px solid var(--line); color: var(--muted); font-size: 8.5px; }
.energy-net b { color: var(--ink-2); font-family: var(--serif); font-size: 13px; font-weight: 600; }
.energy-net.is-negative b { color: var(--accent-text); }
.energy-chart { display: flex; min-height: 80px; flex-direction: column; justify-content: flex-end; gap: 6px; }
.energy-chart-head { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 8px; }
.energy-legend { display: inline-flex; align-items: center; gap: 4px; }
.energy-legend i { width: 5px; height: 5px; border-radius: 2px; }
.energy-legend i.in { background: var(--accent); }
.energy-legend i.out { margin-left: 7px; background: var(--ink-2); opacity: 0.55; }
.energy-bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; align-items: end; height: 56px; padding-top: 2px; }
.energy-day { display: flex; min-width: 0; height: 100%; flex-direction: column; align-items: center; justify-content: flex-end; gap: 3px; padding: 2px 1px 0; border-radius: 4px; }
.energy-day.is-active { background: transparent; }
.energy-columns { display: flex; align-items: flex-end; justify-content: center; gap: 2px; width: 100%; height: 42px; }
.energy-bars .bar { display: block; width: 5px; min-height: 2px; border-radius: 2px 2px 0 0; transition: height var(--dur-base) var(--ease-out); }
.energy-bars .bar.in { background: var(--accent); }
.energy-bars .bar.out { background: var(--ink-2); opacity: 0.55; }
.energy-day-label { color: var(--muted); font-size: 7px; white-space: nowrap; }
.energy-day.is-active .energy-day-label { color: var(--accent-text); }

.energy-date-btn {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 8px;
  cursor: pointer;
}
.energy-date-btn:hover { border-color: var(--line-strong); color: var(--ink); }
.energy-date-btn .icon { width: 11px; height: 11px; }
.energy-date-btn input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.category-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.category-chips .chip { min-height: 28px; padding: 5px 12px; font-size: 10px; }

@media (max-width: 980px) {
  .energy-body { grid-template-columns: 1fr; gap: 16px; }
  .energy-side { padding: 0; border-left: 0; border-top: 1px solid var(--line); padding-top: 12px; }
  .energy-summary { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .meal-grid { grid-template-columns: 1fr; }
  .energy-number b { font-size: 22px; }
  .energy-day-label { font-size: 6.5px; }
  .energy-date-btn { position: relative; overflow: hidden; }
  .energy-date-btn input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; pointer-events: auto; }
  .energy-note input { font-size: 16px; }
  .meal-row input { font-size: 16px; }
}

/* ---------- review: word heat & date picker ---------- */
.cal-month-btn {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 17px;
  letter-spacing: 0.02em;
  text-align: left;
}
.cal-month-btn em { color: var(--muted); font-family: var(--sans); font-size: 9px; font-style: normal; }
.cal-pick-icon { display: inline-flex; margin-left: 2px; color: var(--muted); opacity: 0.6; transition: color var(--dur-fast), opacity var(--dur-fast); }
.cal-pick-icon .icon { width: 13px; height: 13px; }
.cal-month-btn:hover .cal-pick-icon { color: var(--accent-text); opacity: 1; }
.cal-date-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }

.cal-cell.heat-1 { background: var(--heat-1); }
.cal-cell.heat-2 { background: var(--heat-2); }
.cal-cell.heat-3 { background: var(--heat-3); }
.cal-cell.heat-4 { background: var(--heat-4); }
.cal-cell.heat-3:not(.selected) .cal-num,
.cal-cell.heat-4:not(.selected) .cal-num { color: #fff8f4; }
.cal-cell.heat-3:not(.selected) .cal-dot,
.cal-cell.heat-4:not(.selected) .cal-dot { background: #fff8f4; }
.cal-cell.heat-1:hover,
.cal-cell.heat-2:hover,
.cal-cell.heat-3:hover,
.cal-cell.heat-4:hover { filter: brightness(0.985); }
.cal-cell.selected { background: transparent; }
.cal-cell.selected.heat-1,
.cal-cell.selected.heat-2,
.cal-cell.selected.heat-3,
.cal-cell.selected.heat-4 { background: var(--heat-1); }
.cal-cell.selected .cal-num { box-shadow: none; }
.cal-cell.selected.today .cal-num { box-shadow: none; }

.cal-heat-legend { display: inline-flex; align-items: center; gap: 3px; }
.cal-heat { display: inline-block; width: 7px; height: 7px; border-radius: 2px; }
.cal-heat.lv1 { background: var(--heat-1); }
.cal-heat.lv2 { background: var(--heat-2); }
.cal-heat.lv3 { background: var(--heat-3); }
.cal-heat.lv4 { background: var(--heat-4); }
.cal-foot { flex-wrap: wrap; row-gap: 5px; }
.cal-legend { flex-wrap: wrap; row-gap: 4px; }

.detail-date-btn {
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.4;
  text-align: left;
}
.detail-relative { margin-left: 6px; color: var(--muted); font-family: var(--sans); font-size: 10px; }
.detail-date-btn:hover { color: var(--accent-text); }
.activity-sub { display: inline-flex; align-items: center; gap: 3px; color: var(--muted); font-size: 9px; }
.activity-sub .icon { width: 10px; height: 10px; }
.activity-title .num { color: var(--muted); font-family: var(--sans); font-size: 8.5px; }

@media (max-width: 900px) {
  .cal-cell { height: 46px; }
  .cal-cell.heat-3:not(.selected) .cal-num,
  .cal-cell.heat-4:not(.selected) .cal-num { color: #fff8f4; }
  .cal-foot { font-size: 8px; }
  .cal-legend { gap: 7px; }
  .detail-date-btn { font-size: 18px; }
}
@media (max-width: 420px) {
  .cal-month-btn { font-size: 15px; }
  .cal-cell { height: 42px; }
  .cal-cell .cal-num { width: 25px; height: 25px; }
  .cal-foot { font-size: 7.5px; }
}

/* Long lists: defer off-screen rows without changing the document flow. */
.note-row { content-visibility: auto; contain-intrinsic-size: auto 68px; }
.task-row { content-visibility: auto; contain-intrinsic-size: auto 48px; }

/* ---------- location picker ---------- */
.sheet { position: relative; overflow: hidden; }
.location-picker {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: inherit;
  animation: loc-in var(--dur-base) var(--ease-out) both;
}
@keyframes loc-in {
  from { opacity: 0; transform: translate3d(0, 8px, 0); }
  to { opacity: 1; transform: none; }
}
.loc-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 24px 12px;
  border-bottom: 1px solid var(--line);
}
.loc-heading { flex: 1; min-width: 0; }
.loc-heading .kicker { margin: 0 0 4px; }
.loc-heading h3 { margin: 0; font-family: var(--serif); font-size: 22px; font-weight: 600; letter-spacing: 0.01em; }
.loc-head .icon-button { width: 30px; height: 30px; }
.loc-head .icon-button .icon { width: 14px; height: 14px; }
.loc-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 14px 24px 18px; overscroll-behavior: contain; }

.loc-setup {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--accent-soft);
}
.loc-setup b { color: var(--accent-text); font-size: 11px; font-weight: 600; }
.loc-setup p { margin: 4px 0 0; color: var(--ink-2); font-size: 9.5px; line-height: 1.6; }
.loc-setup .loc-hint { color: var(--muted); font-size: 8.5px; }

.loc-map-wrap { position: relative; }
.loc-map {
  width: 100%;
  height: 210px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-2);
}
.loc-map-status { margin: 5px 0 0; color: var(--muted); font-size: 8px; }

.loc-search-row { display: flex; align-items: center; gap: 7px; margin-top: 12px; }
.loc-search {
  display: flex;
  flex: 1;
  min-width: 0;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--muted);
  background: var(--surface-hover);
}
.loc-search:focus-within { border-color: var(--line-strong); background: var(--surface); }
.loc-search .icon { width: 13px; height: 13px; }
.loc-search input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 11px; }
.loc-search input::placeholder { color: var(--muted); }

.loc-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.loc-city { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 8.5px; }
.loc-city input {
  width: 108px;
  min-height: 28px;
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: 0;
  background: var(--surface);
  color: var(--ink);
  font-size: 10px;
}
.loc-city input:focus { border-color: var(--line-strong); }
.loc-radius { display: inline-flex; align-items: center; gap: 3px; }
.loc-radius .chip { min-height: 25px; padding: 4px 8px; font-size: 8.5px; }
.loc-controls #locCurrent { margin-left: auto; font-size: 8.5px; }
.loc-status { min-height: 14px; margin: 5px 0 0; color: var(--muted); font-size: 8.5px; }

.loc-results { margin-top: 8px; max-height: 190px; overflow-y: auto; border-top: 1px solid var(--line); }
.loc-hint { margin: 8px 0; color: var(--muted); font-size: 9px; line-height: 1.6; }
.loc-result-list { display: flex; flex-direction: column; }
.loc-result {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 2px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
}
.loc-result:last-child { border-bottom: 0; }
.loc-result:hover { background: var(--surface-hover); }
.loc-result-main { display: flex; min-width: 0; flex: 1; flex-direction: column; gap: 2px; }
.loc-result-main b { overflow: hidden; color: var(--ink); font-size: 11px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.loc-result-main small { overflow: hidden; color: var(--muted); font-size: 8.5px; text-overflow: ellipsis; white-space: nowrap; }
.loc-result-go { color: var(--line-strong); }
.loc-result-go .icon { width: 13px; height: 13px; }

.loc-manual { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.loc-manual-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.loc-manual-head b { color: var(--ink-2); font-size: 10px; font-weight: 500; }
.loc-manual-head span { color: var(--muted); font-size: 8px; }
.loc-manual-grid { display: grid; grid-template-columns: 1fr 1.15fr; gap: 10px; }
.loc-manual .field { gap: 3px; }
.loc-manual .field span { font-size: 8px; }
.loc-manual .field input { padding: 6px 0; font-size: 11px; }
.loc-error { min-height: 13px; margin: 5px 0 0; color: var(--accent-text); font-size: 8.5px; }

.loc-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.loc-foot .btn { font-size: 10px; }
.loc-foot .btn-primary { margin-left: auto; }

.note-loc-change {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 8px;
}
.note-loc-change:hover { color: var(--accent-text); }

@media (max-width: 900px) {
  .location-picker { animation-duration: 180ms; }
  .loc-head { padding: 16px 18px 10px; }
  .loc-heading h3 { font-size: 21px; }
  .loc-body { padding: 12px 18px 16px; }
  .loc-map { height: 170px; }
  .loc-search input { font-size: 16px; }
  .loc-city input { width: 120px; font-size: 16px; }
  .loc-result-main b { font-size: 12px; }
  .loc-result-main small { font-size: 9px; }
  .loc-manual-grid { grid-template-columns: 1fr; gap: 8px; }
  .loc-manual .field input { font-size: 16px; }
  .loc-foot { padding: 10px 18px calc(12px + env(safe-area-inset-bottom)); }
  .loc-foot .btn { min-height: 36px; font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  .location-picker { animation: none; }
}

@media (max-width: 900px) {
  .loc-controls #locCurrent { min-height: 34px; font-size: 10px; }
  .loc-city input { min-height: 32px; }
}

.loc-mode { display: flex; align-items: center; gap: 4px; margin-top: 9px; }
.loc-mode .chip { min-height: 24px; padding: 4px 10px; font-size: 8.5px; }
.location-picker.city-mode .loc-radius { opacity: 0.35; pointer-events: none; }

/* ---------- training filters, BMR, macros ---------- */
.session-filter-bar { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; padding-bottom: 9px; border-bottom: 1px solid var(--line); }
.session-filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.session-filter-row .chip { min-height: 23px; padding: 3px 8px; font-size: 8.5px; }
.session-category-row .chip { color: var(--muted); }
.session-category-row .chip.is-active { color: var(--bg); }
.session-custom-range { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.session-date-field { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 8px; }
.session-date-field input { width: 112px; padding: 3px 5px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--ink-2); font-size: 8.5px; outline: 0; }
.session-date-field input:focus { border-color: var(--line-strong); }
.session-range-dash { color: var(--line-strong); font-size: 9px; }
.session-custom-hint { color: var(--accent-text); font-size: 8px; }
.session-row.is-rest .session-title { color: var(--muted); }
.session-row.is-rest .session-sub { color: var(--muted); }
.session-rest-hint { margin: 4px 0 0; padding: 7px 9px; border-radius: 7px; background: var(--accent-soft); color: var(--accent-text); font-size: 9px; line-height: 1.6; }

.energy-summary { grid-template-columns: 1fr 1fr; }
.energy-number b { font-size: 22px; }
.energy-number span { white-space: nowrap; }
.energy-profile-hint { margin: 0; color: var(--muted); font-size: 8.5px; line-height: 1.7; }
.energy-profile-hint .link { font-size: 8.5px; }
.energy-net { font-size: 8.5px; }
.energy-net b { font-size: 14px; }
.macro-toggle { font-size: 8.5px; }
.meal-row.is-estimated em { color: var(--accent-text); }
.macro-panel { margin-top: 7px; padding: 8px 0 0; border-top: 1px solid var(--line); }
.macro-panel[hidden] { display: none; }
.macro-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; color: var(--muted); font-size: 8px; }
.macro-grid { display: flex; flex-direction: column; gap: 5px; }
.macro-row { display: grid; grid-template-columns: 30px repeat(4, minmax(0, 1fr)); gap: 5px; align-items: center; }
.macro-meal { color: var(--ink-2); font-size: 8.5px; }
.macro-input { display: flex; min-width: 0; flex-direction: column; gap: 1px; }
.macro-input span { color: var(--muted); font-size: 7px; white-space: nowrap; }
.macro-input input { width: 100%; min-width: 0; padding: 3px 4px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface-hover); color: var(--ink); font-size: 9px; outline: 0; }
.macro-input input:focus { border-color: var(--line-strong); background: var(--surface); }
.macro-totals { display: flex; flex-wrap: wrap; align-items: baseline; gap: 5px 10px; margin-top: 7px; padding-top: 6px; border-top: 1px dashed var(--line); color: var(--muted); font-size: 8px; }
.macro-total-label { color: var(--ink-2); }
.macro-totals b { color: var(--ink-2); font-weight: 500; }

.body-profile-formula { margin: 7px 0 0; color: var(--muted); font-size: 8px; line-height: 1.6; }
.activity-sub-line { margin-top: 3px; color: var(--muted); font-size: 8.5px; line-height: 1.7; }

@media (max-width: 980px) {
  .session-filter-row .chip { min-height: 27px; padding: 5px 10px; font-size: 9.5px; }
  .session-date-field input { font-size: 16px; width: 125px; }
  .macro-row { grid-template-columns: 30px repeat(4, minmax(0, 1fr)); gap: 4px; }
  .macro-input input { font-size: 16px; padding: 4px 3px; }
  .macro-input span { font-size: 7.5px; }
  .energy-summary { grid-template-columns: 1fr 1fr; gap: 8px 12px; }
  .energy-number b { font-size: 20px; }
  .body-profile-formula { font-size: 9px; }
}
@media (max-width: 560px) {
  .macro-row { grid-template-columns: 28px repeat(4, minmax(0, 1fr)); }
  .macro-input span { font-size: 6.5px; }
  .energy-number b { font-size: 19px; }
  .energy-number span { font-size: 7.5px; }
}

.sheet.location-mode { height: min(86vh, 780px); max-height: 92dvh; }

/* ---------- cloud sync ---------- */
.cloud-button { position: relative; }
.cloud-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--line-strong);
  box-shadow: 0 0 0 2px var(--sidebar, var(--surface));
  transition: background-color var(--dur-fast), box-shadow var(--dur-fast);
}
.cloud-button.is-on .cloud-dot { background: #5f9e6b; }
.cloud-button.is-syncing .cloud-dot { background: var(--accent); animation: cloud-pulse 1.2s ease-in-out infinite; }
.cloud-button.is-error .cloud-dot { background: var(--danger); }
.cloud-button.is-on { color: var(--ink-2); }
.sidebar .cloud-button.is-on { color: #fff; }
.sidebar .cloud-dot { box-shadow: 0 0 0 2px #1e1d1b; }
@keyframes cloud-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.82); }
}
.mobile-cloud { margin-left: auto; margin-right: 10px; }
.cloud-panel { display: grid; gap: 14px; }
.cloud-lede { margin: 0; color: var(--ink-2); font-size: 12px; line-height: 1.75; }
.cloud-field { margin: 0; }
.cloud-hint { margin: 0; color: var(--muted); font-size: 9.5px; line-height: 1.75; }
.cloud-sent { display: grid; justify-items: center; gap: 8px; padding: 18px 8px 8px; text-align: center; }
.cloud-sent-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin-bottom: 2px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
}
.cloud-sent-icon .icon { width: 22px; height: 22px; }
.cloud-sent h3 { margin: 0; color: var(--ink); font-size: 15px; font-weight: 500; }
.cloud-sent p { max-width: 280px; margin: 0; color: var(--muted); font-size: 10px; line-height: 1.75; }
.cloud-sent b { color: var(--ink-2); font-weight: 500; }
.cloud-account { display: flex; align-items: center; gap: 10px; }
.cloud-account-avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 500;
}
.cloud-account span:last-child { display: grid; gap: 2px; min-width: 0; }
.cloud-account b { overflow: hidden; color: var(--ink); font-size: 11px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.cloud-account em { color: var(--muted); font-size: 9px; font-style: normal; }
.cloud-facts { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 10px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--muted); font-size: 9px; }
.cloud-facts b { color: var(--ink-2); font-weight: 500; }
@media (prefers-reduced-motion: reduce) {
  .cloud-button.is-syncing .cloud-dot { animation: none; }
}
.mobile-cloud .cloud-dot { box-shadow: 0 0 0 2px var(--bg); }
.cloud-button.is-warn .cloud-dot { background: #d39a3b; }
.sidebar .cloud-button.is-warn { color: #fff; }
.cloud-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.cloud-compare > div {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}
.cloud-compare b { color: var(--ink-2); font-size: 10px; font-weight: 500; }
.cloud-compare span { color: var(--muted); font-size: 9px; line-height: 1.6; }
