/* ============================================================
   PrimePace - Design System
   ============================================================ */

/* ------------------------------------------------------------
   1. CSS CUSTOM PROPERTIES (DESIGN TOKENS)
   ------------------------------------------------------------ */

:root {
  --auth-screen-balance: 0px;
  --visible-top: 0px;
  /* Sidebar / Layout */
  --sidebar-w: 248px;
  --header-h: 68px;

  /* Border Radius */
  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-full: 9999px;

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

  /* Typography */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --text-xs:   0.70rem;
  --text-sm:   0.8125rem;
  --text-base: 0.9375rem;
  --text-md:   1.0625rem;
  --text-lg:   1.25rem;
  --text-xl:   1.5rem;
  --text-2xl:  1.875rem;
  --text-3xl:  2.25rem;

  /* Transitions */
  --ease: 220ms cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── Light Theme (default) ── */
:root,
[data-theme="light"] {
  color-scheme: light;

  --bg:           #F3EFFB;
  --surface:      #FFFFFF;
  /* The header sits on its own token so dark can put the frame — header and
     sidebar — on a darker ground than the cards. Light keeps them the same. */
  --header-bg:    #FFFFFF;
  --surface-2:    #F7F4FD;
  --surface-3:    #EFE9FA;
  --surface-hover:#EAE3F8;
  --overlay:      rgba(30, 10, 60, 0.42);

  --primary:      #7C3AED;
  --primary-h:    #6D28D9;
  --primary-s:    #EDE9FE;
  --primary-text: #FFFFFF;

  --accent:       #A855F7;
  --accent-s:     rgba(168, 85, 247, 0.12);
  --accent-text:  #6B21A8;

  --teal:         #0EA5A0;
  --teal-s:       rgba(14, 165, 160, 0.10);
  --teal-text:    #115E59;

  --success:      #10B981;
  --success-s:    rgba(16, 185, 129, 0.10);
  --success-text: #065F46;

  --warning:      #F59E0B;
  --warning-s:    rgba(245, 158, 11, 0.10);
  --warning-text: #78350F;

  --danger:       #DC2626;
  --danger-s:     rgba(239, 68, 68, 0.10);
  --danger-text:  #7F1D1D;

  --purple:       #8B5CF6;
  --purple-s:     rgba(139, 92, 246, 0.12);
  --purple-text:  #5B21B6;

  --orange:       #F97316;
  --orange-s:     rgba(249, 115, 22, 0.10);
  --orange-text:  #9A3412;

  /* Category colours. These six have one job the semantic colours don't: they
     have to be told apart at a glance, in a list where they sit inches from
     each other. Borrowing the semantic palette put Work and Personal on two
     shades of the same purple and Finances and Home on two shades of the same
     orange, so a glance carried no information. They own their own tokens now:
     indigo, green, violet, yellow, rose, grey — six hues, evenly spread. */
  --cat-work-s:      rgba(59, 130, 246, 0.18);
  --cat-work-text:   #1E40AF;
  --cat-health-s:    rgba(16, 185, 129, 0.13);
  --cat-health-text: #065F46;
  --cat-pers-s:      rgba(147, 51, 234, 0.12);
  --cat-pers-text:   #6B21A8;
  --cat-fin-s:       rgba(234, 179, 8, 0.18);
  --cat-fin-text:    #854D0E;
  --cat-home-s:      rgba(244, 63, 94, 0.11);
  --cat-home-text:   #9F1239;

  /* Deadline pill. The ink used to be one hard-coded value for every theme,
     which meant a brown that only ever suited the light one: on the two dark
     themes the amber chip sat at 2.9:1, under the 4.5:1 a small label needs. */
  --due-late-s:      rgba(220, 38, 38, 0.12);
  --due-late-text:   #B91C1C;
  --due-soon-s:      rgba(234, 179, 8, 0.14);
  --due-soon-text:   #92400E;

  --text-1:       #1A0A30;
  --text-2:       #4C3873;
  --text-3:       #6E5C90;
  --text-4:       #7C6AA0;

  --border:       #DDD5F0;
  --border-s:     #EEE9FA;

  /* Linie i akcenty, nazwane po roli. W motywie jasnym trzymaja
     dokladnie te wartosci, ktore mialy zawsze — zmienia sie tylko to,
     ze reguly nizej siegaja po nazwe roli zamiast po surowy kolor. */
  --line-soft:    var(--border-s);
  --line:         var(--border);
  --line-field:   var(--border);
  --line-strong:  var(--primary);
  --primary-ink:  var(--primary);

  --shadow-sm:    0 1px 3px rgba(80,30,150,0.07), 0 1px 2px rgba(80,30,150,0.05);
  --shadow-md:    0 4px 12px rgba(80,30,150,0.09), 0 2px 4px rgba(80,30,150,0.06);
  --shadow-lg:    0 12px 28px rgba(80,30,150,0.11), 0 4px 8px rgba(80,30,150,0.07);
  --shadow-xl:    0 24px 48px rgba(80,30,150,0.14), 0 8px 16px rgba(80,30,150,0.09);

  /* Calendar colors */
  --cal-work:     #7C3AED;
  --cal-health:   #10B981;
  --cal-personal: #A855F7;
  --cal-finance:  #F59E0B;
  --cal-home:     #F97316;
  --cal-other:    #64748B;

  /* Sidebar */
  --sidebar-bg:   #150A2E;
  --sidebar-text: rgba(255,255,255,0.60);
  --sidebar-text-active: #FFFFFF;
  --sidebar-item-hover: rgba(139,92,246,0.12);
  --sidebar-item-active: rgba(139,92,246,0.28);
  --sidebar-label: rgba(255,255,255,0.55);
  --sidebar-border: rgba(139,92,246,0.10);

  /* Day closed panel. Like the sidebar, it is the same in both themes: the
     panel is its own dark surface, not a card that follows the page, so
     switching theme must not move it.

     Her call, 15 October 2026: the bar wears the colour of the open page in
     the menu. That colour is not a token — it is --sidebar-item-active laid
     over --sidebar-bg, which is how the menu row is built. Written as a flat
     value because the button's letters have to BE that colour, and no element
     can take its colour from two layers of another one.

     #362165 is what the browser actually paints that row: CSS alpha is kept
     as a 255th, so 0.28 is really 71/255, and the arithmetic lands a shade
     under the value plain decimals give (#362166). She compared two crops
     and found the one step. If either of those two tokens ever changes, this
     changes with them. */
  --daylock-bg:        #362165;
  --daylock-ink:       #FFFFFF;
  --daylock-btn:       #FFFFFF;
  --daylock-btn-press: #E8E2F7;
}

/* ── Dark Theme ──────────────────────────────────────────────────────────
   One dark theme, built out of neutral greys. The old one was navy and the
   one people actually got was "purple": every card tinted, every shadow
   glowing, the whole page a gradient. Colour now means something — violet is
   what is active, red is late, green is finished — and everything else is
   grey, so the eye lands on the work instead of the decoration.

   The greys are set by how they READ, not by how dark they look: the page is
   the same #121212 Spotify uses, and what carries a dark interface is the ink
   on it. The label grey is the most-used colour in the app — 144 places — so
   it is the one that decides whether the whole thing looks legible or murky.

   "purple" is kept as a name here because it is the value already saved on
   people's devices. It is the same theme; Storage answers with "dark" now,
   and this selector is what makes a device that has not been read yet still
   open dark rather than white. */
[data-theme="dark"],
[data-theme="purple"] {
  color-scheme: dark;

  /* Granat, nie neutralna czern: jasnosc kazdej powierzchni odpowiada
     tej, ktora byla wczesniej, wiec czytelnosc tekstu sie nie zmienia
     — rozni sie sama barwa, ta z logo i z paska bocznego. */
  --bg:           #150E23;   /* the page */
  --header-bg:    #120C1E;   /* header: the frame around the work */
  --surface:      #23193C;   /* cards and modals */
  --surface-2:    #2F2150;   /* fields and the sections inside a card */
  --surface-3:    #35255A;   /* a section inside one of those */
  --surface-hover:#3A2963;   /* hover, and the row that is selected */
  --overlay:      rgba(0, 0, 0, 0.66);

  /* Violet is for what is active: the primary button, the selected thing,
     a progress bar. Nothing wears it for decoration. */
  --primary:      #8B5CF6;
  --primary-h:    #9F73FA;
  --primary-s:    rgba(139, 92, 246, 0.16);
  --primary-text: #FFFFFF;

  --accent:       #A78BFA;
  --accent-s:     rgba(167, 139, 250, 0.14);
  --accent-text:  #DDD6FE;

  --teal:         #2DD4BF;
  --teal-s:       rgba(45, 212, 191, 0.12);
  --teal-text:    #99F6E4;

  --success:      #34D399;
  --success-s:    rgba(52, 211, 153, 0.12);
  --success-text: #A7F3D0;

  --warning:      #FBBF24;
  --warning-s:    rgba(251, 191, 36, 0.12);
  --warning-text: #FDE68A;

  --danger:       #F87171;
  --danger-s:     rgba(248, 113, 113, 0.12);
  --danger-text:  #FECACA;

  --purple:       #A78BFA;
  --purple-s:     rgba(167, 139, 250, 0.12);
  --purple-text:  #DDD6FE;

  --orange:       #FB923C;
  --orange-s:     rgba(251, 146, 60, 0.12);
  --orange-text:  #FED7AA;

  /* Six hues that have to be told apart at a glance — unchanged. */
  --cat-work-s:      rgba(96, 165, 250, 0.18);
  --cat-work-text:   #BFDBFE;
  --cat-health-s:    rgba(52, 211, 153, 0.14);
  --cat-health-text: #A7F3D0;
  --cat-pers-s:      rgba(192, 132, 252, 0.16);
  --cat-pers-text:   #E9D5FF;
  --cat-fin-s:       rgba(250, 204, 21, 0.14);
  --cat-fin-text:    #FDE68A;
  --cat-home-s:      rgba(251, 113, 133, 0.15);
  --cat-home-text:   #FECDD3;

  --due-late-s:      rgba(248, 113, 113, 0.14);
  --due-late-text:   #FECACA;
  --due-soon-s:      rgba(250, 204, 21, 0.14);
  --due-soon-text:   #FDE68A;

  --text-1:       #FFFFFF;   /* what is being read */
  --text-2:       #D6D2DE;   /* what stands beside it */
  --text-3:       #B3AEBE;   /* dates, counts, labels */
  /* Placeholders and the days outside a month. It used to be a near-black
     navy — invisible on a dark field, which is the one place it is used. */
  --text-4:       #8B8595;

  /* Kazda linia w motywie ciemnym jest biala z kryciem. Biel polozona
     na granacie przepuszcza go, wiec linia zostaje ciepla, ale przestaje
     byc "fioletem na fiolecie". Jedno krycie trzyma ten sam kontrast na
     kazdej powierzchni — sztywny kolor tego nie potrafi. */
  --line-soft:    rgba(255, 255, 255, 0.20);   /* 1,92 — ciche podzialy */
  --line:         rgba(255, 255, 255, 0.32);   /* 2,91 — karty i listy */
  --line-field:   rgba(255, 255, 255, 0.40);   /* 3,78 — pola do wpisywania */
  --line-strong:  rgba(255, 255, 255, 0.62);   /* 7,08 — zaznaczenie, skupienie */
  --primary-ink:  #FFFFFF;                     /* 16,4 — napis akcentowy */

  --border:       var(--line);
  --border-s:     var(--line-soft);

  /* Black, and only black. The glow is gone. */
  --shadow-sm:    0 1px 3px rgba(0,0,0,0.40);
  --shadow-md:    0 4px 12px rgba(0,0,0,0.45);
  --shadow-lg:    0 12px 28px rgba(0,0,0,0.55);
  --shadow-xl:    0 24px 48px rgba(0,0,0,0.65);

  --cal-work:     #60A5FA;
  --cal-health:   #34D399;
  --cal-personal: #C084FC;
  --cal-finance:  #FBBF24;
  --cal-home:     #FB7185;
  --cal-other:    #94A3B8;

  /* Pasek boczny jest ten sam w obu motywach: przelaczenie zmienia
     wylacznie czesc glowna. Wartosci przepisane z motywu jasnego. */
  --sidebar-bg:   #150A2E;
  --sidebar-text: rgba(255,255,255,0.60);
  --sidebar-text-active: #FFFFFF;
  --sidebar-item-hover: rgba(139,92,246,0.12);
  --sidebar-item-active: rgba(139,92,246,0.28);
  --sidebar-label: rgba(255,255,255,0.55);
  --sidebar-border: rgba(139,92,246,0.10);

  /* Przepisane z motywu jasnego, z tego samego powodu co pasek boczny. */
  --daylock-bg:        #362165;
  --daylock-ink:       #FFFFFF;
  --daylock-btn:       #FFFFFF;
  --daylock-btn-press: #E8E2F7;
}

/* ── Changing theme ──────────────────────────────────────────────────────
   The switch is a whole page changing colour at once, which without this
   simply blinks. The class is put on for the length of the fade and taken
   off again, so nothing else in the app pays for it: hover stays instant,
   and a page opening in dark opens dark rather than fading into it. */
html.theme-switch,
html.theme-switch *,
html.theme-switch *::before,
html.theme-switch *::after {
  transition: background-color 260ms ease,
              border-color     260ms ease,
              color            260ms ease,
              fill             260ms ease,
              box-shadow       260ms ease !important;
}
@media (prefers-reduced-motion: reduce) {
  html.theme-switch,
  html.theme-switch *,
  html.theme-switch *::before,
  html.theme-switch *::after { transition: none !important; }
}

/* ------------------------------------------------------------
   2. RESET & BASE
   ------------------------------------------------------------ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font);
  font-size: var(--text-base);
  color: var(--text-1);
  background: var(--bg);
  line-height: 1.6;
  overflow-x: hidden;
  transition: background var(--ease), color var(--ease);
}

a { text-decoration: none; color: inherit; }
img { display: block; max-width: 100%; }
button { cursor: pointer; font-family: var(--font); border: none; background: none; }
input, textarea, select { font-family: var(--font); }
ul, ol { list-style: none; }
svg { display: block; flex-shrink: 0; }

:focus-visible {
  outline: 2px solid var(--line-strong);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

/* ------------------------------------------------------------
   3. SCROLLBAR
   ------------------------------------------------------------ */

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: var(--r-full); }
::-webkit-scrollbar-thumb:hover { background: var(--text-4); }

/* ------------------------------------------------------------
   4. LAYOUT - SHELL
   ------------------------------------------------------------ */

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 200;
  overflow: hidden;
  transition: transform var(--ease);
}

/* ── `vh` means the TALLEST the screen ever gets (MOB-04) ────────────────
   On a phone the visible height changes as the browser's own bars slide in and
   out, and `100vh` is the height with all of them hidden. A panel sized in it
   is taller than the screen for as long as a bar is showing, and the bottom of
   it sits behind that bar: present in the layout, unreachable by a thumb.
   `dvh` is the same measure, taken from what is visible NOW.

   Always as a PAIR, in this order. A browser that has never heard of `dvh`
   throws the second line away and keeps the first, so the old behaviour is the
   fallback and nothing is ever left with no height at all. Every place in this
   stylesheet that sizes by the viewport height is written this way — eight of
   them, found by the audit and converted together.

   Not the keyboard, though: no CSS unit shrinks for that, because the keyboard
   is not part of the browser. The windows get that from `--visible-h` in
   js/utils.js — see the .modal-wrapper rule. ── */
.main-wrapper {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  transition: margin var(--ease);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 190;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

/* ------------------------------------------------------------
   5. SIDEBAR
   ------------------------------------------------------------ */

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 22px var(--sp-5);
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  background: transparent;
}

.brand-logo-img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: var(--r-sm);
  display: block;
}

.brand-name {
  font-size: var(--text-md);
  font-weight: 700;
  color: white;
  letter-spacing: -0.3px;
}

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

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: var(--sp-3);
}

.nav-group-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--sidebar-label);
  text-transform: uppercase;
  padding: 0 var(--sp-3);
  margin-bottom: var(--sp-1);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 9px var(--sp-3);
  border-radius: var(--r-sm);
  color: var(--sidebar-text);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: background var(--ease), color var(--ease);
  position: relative;
}

.nav-item:hover {
  background: var(--sidebar-item-hover);
  color: var(--sidebar-text-active);
}

.nav-item.active {
  background: var(--sidebar-item-active);
  color: var(--sidebar-text-active);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--primary);
  border-radius: 0 var(--r-full) var(--r-full) 0;
}

[data-theme="dark"]   .nav-item.active::before { background: var(--accent); }
[data-theme="light"]  .nav-item.active::before { background: #C084FC; }

.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.9;
}

.menu-toggle {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  transition: background var(--ease);
  flex-shrink: 0;
}

.menu-toggle:hover { background: var(--surface-2); }
.menu-toggle svg { width: 20px; height: 20px; }

/* ------------------------------------------------------------
   6. TOP HEADER
   ------------------------------------------------------------ */

.top-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--sp-8);
  gap: var(--sp-4);
  flex-shrink: 0;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}


.header-left {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  min-width: 0;
}

.header-title-group { min-width: 0; }

.page-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: -0.3px;
  line-height: 1.2;
}

.page-subtitle {
  font-size: var(--text-sm);
  color: var(--text-3);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  flex-shrink: 0;
}

.header-date-chip {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: var(--r-full);
  white-space: nowrap;
}

.header-user {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  cursor: pointer;
  padding: 4px 4px 4px var(--sp-2);
  border-radius: var(--r-full);
  transition: background var(--ease);
}

.header-user:hover { background: var(--surface-2); }

.header-avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--r-full);
  background: var(--primary);
  color: white;
  font-size: var(--text-sm);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid var(--primary-s);
}

.header-avatar img { width: 100%; height: 100%; object-fit: cover; }

.header-username {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-1);
}

/* ------------------------------------------------------------
   7. PAGE CONTAINER & PAGES
   ------------------------------------------------------------ */

.page-container {
  flex: 1;
  padding: var(--sp-8);
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  /* A column so the open page fills the area between header and footer instead
     of stopping at its own content. A page whose content is shorter than the
     screen can then center something against the whole space — an empty-state
     message reads as adrift when it sits against the top of a short box. */
  display: flex;
  flex-direction: column;
}

.page { display: none; }
.page.active { display: block; flex: 1; animation: pageFadeIn 0.25s ease forwards; }

@keyframes pageFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ------------------------------------------------------------
   8. CARD COMPONENT
   ------------------------------------------------------------ */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--ease), border-color var(--ease);
}

.card:hover { box-shadow: var(--shadow-md); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--border-s);
}

.card-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-1);
  letter-spacing: -0.2px;
}

.card-subtitle {
  font-size: var(--text-sm);
  color: var(--text-3);
  margin-top: 2px;
}

.card-body {
  padding: var(--sp-6);
}

.card-body.p0 { padding: 0; }

/* ------------------------------------------------------------
   9. BUTTONS
   ------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 9px var(--sp-5);
  border-radius: var(--r-sm);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1;
  transition: all var(--ease);
  white-space: nowrap;
  flex-shrink: 0;
}

.btn svg { width: 16px; height: 16px; }

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 8px rgba(29, 61, 143, 0.25);
}

.btn-primary:hover {
  background: var(--primary-h);
  box-shadow: 0 4px 14px rgba(29, 61, 143, 0.35);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text-1);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--surface-hover);
  border-color: var(--text-4);
}

/* Disabled buttons (e.g. Save while a required field is empty) read as inert. */
.btn:disabled,
.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none;
}

/* A form field flagged invalid (replaces validation toasts). */
.field-invalid {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 3px var(--danger-s) !important;
}

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  padding: 7px var(--sp-3);
}

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

.btn-danger {
  background: var(--danger);
  color: #fff;
  border: 1px solid var(--danger);
}

.btn-danger:hover { background: var(--danger); color: #fff; filter: brightness(.92); }

.btn-sm {
  padding: 6px 10px;
  font-size: var(--text-xs);
}

.btn-sm svg { width: 14px; height: 14px; }

.btn-icon {
  padding: 7px;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-2);
  border: 1px solid transparent;
  transition: background var(--ease), color var(--ease), border-color var(--ease);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

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

.btn-icon:active {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text-1);
  transform: none;
}

.btn-icon svg { width: 16px; height: 16px; }

.btn-icon-danger:hover {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}

.btn-icon-danger:active {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}

[data-theme="light"] .btn-icon:active {
  background: #e2d9f3;
  border-color: #c4b5e8;
  color: #1a1035;
}

[data-theme="light"] .btn-icon-danger:hover,
[data-theme="light"] .btn-icon-danger:active {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #dc2626;
}

/* ------------------------------------------------------------
   10. FORM ELEMENTS
   ------------------------------------------------------------ */

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.form-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-2);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px var(--sp-4);
  border: 1px solid var(--line-field);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text-1);
  font-size: var(--text-sm);
  transition: border-color var(--ease), box-shadow var(--ease);
  appearance: none;
  -webkit-appearance: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--line-strong);
  box-shadow: 0 0 0 3px var(--primary-s);
}

.form-input::placeholder { color: var(--text-4); }
.form-textarea {
  resize: none;
  min-height: 96px;
  line-height: 1.5;
}

/* Native date inputs: render the value/sub-fields in the accent (purple)
   consistently in every window. Without this, engines show a mix - some
   sub-fields in the accent, some in the default text color. Base and WebKit
   pseudo-element rules are kept separate so engines that don't know the
   pseudo-elements still apply the base color. Times are not here: they are
   drawn by .timefield below, which owns its own segments. */
input[type="date"].form-input {
  color: var(--primary-ink);
  -webkit-text-fill-color: var(--primary-ink);
}
input[type="date"]::-webkit-datetime-edit,
input[type="date"]::-webkit-datetime-edit-fields-wrapper,
input[type="date"]::-webkit-datetime-edit-text,
input[type="date"]::-webkit-datetime-edit-month-field,
input[type="date"]::-webkit-datetime-edit-day-field,
input[type="date"]::-webkit-datetime-edit-year-field {
  color: var(--primary-ink) !important;
  -webkit-text-fill-color: var(--primary-ink) !important;
  opacity: 1;
}
/* The segment you are editing highlights in the OS accent colour — a blue that
   belongs to no palette here. Grey it, and keep the digits readable rather than
   reversing them out. Only the field can be reached: the drop-down calendar is
   drawn by the browser outside the page and takes no styling from us. */
input[type="date"]::-webkit-datetime-edit-month-field:focus,
input[type="date"]::-webkit-datetime-edit-day-field:focus,
input[type="date"]::-webkit-datetime-edit-year-field:focus {
  background: var(--surface-hover);
  color: var(--text-1) !important;
  -webkit-text-fill-color: var(--text-1) !important;
  border-radius: 3px;
  outline: none;
}

/* A time is one field made of segments — hour, minutes, and AM/PM when the
   setting asks for twelve hours — in both settings, so they look and type the
   same. The box carries the border; the segments inside carry none. */
.timefield {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  width: 100%;
  min-height: 48px;
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  font-family: var(--font);
  font-size: var(--text-sm);
  transition: border-color var(--ease), box-shadow var(--ease);
}

.timefield:focus-within {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 3px var(--primary-s);
}

.timefield.field-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-soft, rgba(225, 29, 72, .12));
}

.timefield-seg {
  border: 0;
  background: transparent;
  padding: 2px 3px;
  font: inherit;
  color: var(--primary-ink);
  -webkit-text-fill-color: var(--primary-ink);
  text-align: center;
  border-radius: 4px;
  outline: none;
  min-width: 0;
}

/* The focused segment is blocked out, the way a native time field marks the
   part you are typing into. Grey, not blue — it is a place marker, not a state. */
.timefield-seg:focus {
  background: var(--surface-hover);
  color: var(--text-1);
  -webkit-text-fill-color: var(--text-1);
}

.timefield-hour, .timefield-min { width: 2.6ch; padding: 2px 1px; }
.timefield-period { width: 3.4ch; margin-left: 7px; cursor: pointer; caret-color: transparent; }
.timefield-colon { color: var(--primary-ink); opacity: .75; margin: 0 -1px; }

/* A date is the same field with more segments and a button to the browser's
   calendar for anyone who would rather point than type. */
.datefield {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  position: relative;
  width: 100%;
  min-height: 48px;
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  font-family: var(--font);
  font-size: var(--text-sm);
  transition: border-color var(--ease), box-shadow var(--ease);
}
.datefield:focus-within { border-color: var(--line-strong); box-shadow: 0 0 0 3px var(--primary-s); }
.datefield.field-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-soft, rgba(225, 29, 72, .12));
}

.datefield-seg {
  border: 0;
  background: transparent;
  padding: 2px 1px;
  font: inherit;
  color: var(--primary-ink);
  -webkit-text-fill-color: var(--primary-ink);
  text-align: center;
  border-radius: 4px;
  outline: none;
  min-width: 0;
}
.datefield-seg:focus {
  background: var(--surface-hover);
  color: var(--text-1);
  -webkit-text-fill-color: var(--text-1);
}
/* Sized to their digits and butted up against the separators, so the date reads
   as one string — 28.08.2026 — not as three boxes with gaps between them. */
.datefield-day, .datefield-month { width: 2.2ch; }
.datefield-year { width: 4.3ch; }
.datefield-sep { color: var(--primary-ink); opacity: .75; margin: 0; }

.datefield-pick {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  border: 0;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  padding: 2px;
  border-radius: 4px;
  transition: color var(--ease), background var(--ease);
}
.datefield-pick svg { width: 16px; height: 16px; }
.datefield-pick:hover { color: var(--primary-ink); background: var(--surface-hover); }

/* The month grid. Placed by script — below the field, or above it when below
   would run off the screen — so it never covers a dialog's own buttons the way
   the browser's own calendar did. Above every dialog, since it opens over one. */
.datepop {
  display: none;
  position: fixed;
  z-index: 960;
  width: 268px;
  padding: var(--sp-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-xl);
  font-family: var(--font);
  user-select: none;
}

.datepop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-2);
}
.datepop-title {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-1);
  text-transform: capitalize;
}
.datepop-nav {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  border-radius: var(--r-sm);
  color: var(--text-3);
  cursor: pointer;
  transition: background var(--ease), color var(--ease);
}
.datepop-nav svg { width: 15px; height: 15px; }
.datepop-nav:hover { background: var(--surface-2); color: var(--text-1); }

.datepop-dows, .datepop-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.datepop-dow {
  text-align: center;
  font-size: .68rem;
  font-weight: 600;
  color: var(--text-3);
  padding-bottom: 2px;
  text-transform: uppercase;
}

.datepop-day {
  height: 32px;
  border: 0;
  background: transparent;
  border-radius: var(--r-sm);
  font: inherit;
  font-size: .82rem;
  color: var(--text-1);
  cursor: pointer;
  transition: background var(--ease), color var(--ease);
}
.datepop-day:hover:not(:disabled) { background: var(--surface-2); }
.datepop-day.out { color: var(--text-4); }
.datepop-day:disabled { color: var(--text-4); opacity: .45; cursor: default; }
/* Today is outlined, the chosen day is filled — one is a fact, the other a choice. */
.datepop-day.today { box-shadow: inset 0 0 0 1px var(--border); }
.datepop-day.cursor { box-shadow: inset 0 0 0 2px var(--primary-s); }
.datepop-day.sel {
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  box-shadow: none;
}

/* The date popup has no footer: the "Today" button that sat there is gone
   (see openDatePicker) — today is already marked in the grid. */

/* An optional date: the button on its own line, the field appearing under it. */
.optdate { display: flex; flex-direction: column; align-items: flex-start; gap: var(--sp-2); }
.optdate-field { width: 100%; display: flex; align-items: center; gap: var(--sp-3); }
.optdate-field[hidden] { display: none; }
/* Taking a date off is rare and cannot be undone, so it is a word next to the
   field rather than a second press on the pill — which is how the date got
   there and would be the easiest thing to hit by accident. */
.optdate-clear {
  background: none; border: 0; padding: 0; cursor: pointer;
  font-size: .78rem; color: var(--text-3);
}
.optdate-clear:hover { color: var(--danger); }

.datefield-sm {
  width: auto;
  max-width: 100%;
  flex: 0 1 auto;
  min-height: 38px;
  padding: var(--sp-1) var(--sp-2);
  font-size: .82rem;
}

.timefield-sm {
  width: auto;
  max-width: 100%;
  flex: 0 1 auto;
  min-height: 38px;
  padding: var(--sp-1) var(--sp-2);
  font-size: .82rem;
}

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 36px;
  cursor: pointer;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4);
}

/* ------------------------------------------------------------
   11. BADGES / TAGS
   ------------------------------------------------------------ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--r-full);
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

/* Badge text uses the darker (light theme) / lighter (dark themes) "ink"
   tokens so small labels clear WCAG AA contrast on the soft tint backgrounds. */
.badge-primary  { background: var(--primary-s); color: var(--primary-h); }
.badge-success  { background: var(--success-s); color: var(--success-text); }
.badge-warning  { background: var(--warning-s); color: var(--warning-text); }
.badge-danger   { background: var(--danger-s);  color: var(--danger-text);  }
.badge-purple   { background: var(--purple-s);  color: var(--purple-text);  }
.badge-teal     { background: var(--teal-s);    color: var(--teal-text);    }
.badge-orange   { background: var(--orange-s);  color: var(--orange-text);  }
.badge-neutral  { background: var(--surface-2); color: var(--text-2);  border: 1px solid var(--border); }

/* Category colors */
.cat-work     { background: var(--cat-work-s);   color: var(--cat-work-text); }
.cat-health   { background: var(--cat-health-s); color: var(--cat-health-text); }
.cat-personal { background: var(--cat-pers-s);   color: var(--cat-pers-text); }
.cat-finances { background: var(--cat-fin-s);    color: var(--cat-fin-text); }
.cat-home     { background: var(--cat-home-s);   color: var(--cat-home-text); }
.cat-other    { background: var(--surface-2);    color: var(--text-2); border: 1px solid var(--border); }

/* ------------------------------------------------------------
   12. PROGRESS BARS
   ------------------------------------------------------------ */

.progress-bar-wrap {
  width: 100%;
  height: 8px;
  background: var(--surface-2);
  border-radius: var(--r-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: var(--r-full);
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 2px;
}

.progress-bar-fill.success { background: linear-gradient(90deg, var(--success), var(--teal)); }
.progress-bar-fill.warning { background: linear-gradient(90deg, var(--warning), var(--orange)); }

.progress-thin .progress-bar-wrap { height: 5px; }
.progress-thick .progress-bar-wrap { height: 12px; }

.progress-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--sp-2);
}

.progress-label-value {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-1);
}

/* ------------------------------------------------------------
   13. MODAL
   ------------------------------------------------------------ */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 900;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.modal-overlay.active { display: block; animation: fadeIn 0.2s ease; }

/* ── The one container every window in the app sits in (MOB-03) ─────────
   It used to be a full-screen area that scrolled as a whole, with a window
   inside it that had no height limit at all. On a big phone the windows fit
   by accident, because their content happens to be shorter than the screen.
   Measured on 1 Oct 2026 at 375x380 — what an iPhone has left when the
   keyboard is up — New Task stood 629px tall, New Habit 661 and New Event
   674, and scrolling to the middle of the form sent the title to -248px:
   off the top of the screen, with no way to see what you were filling in.

   So the window is capped to the height that is actually VISIBLE, the title
   and the buttons are held still, and the only thing that scrolls is the
   middle. Three units in that order on purpose: `vh` for a browser that
   knows nothing newer, `dvh` for one that follows Safari's bars as they
   come and go, and the variable last — set from `visualViewport` in
   js/utils.js, because the KEYBOARD is not browser chrome and no CSS unit
   shrinks for it. Each line is ignored by a browser that cannot read it. */
.modal-wrapper {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 910;
  height: 100vh;
  height: 100dvh;
  height: var(--visible-h, 100dvh);
  overflow-y: auto;
  padding: 20px;
  align-items: flex-start;
  justify-content: center;
}

.modal-wrapper.active {
  display: flex;
  animation: fadeIn 0.2s ease;
}

/* Follow iOS keyboard panning, not just its reduced height. Every window on a
   phone, the Vision Board's included since 8 October 2026: iOS moves the whole
   visible area DOWN when the keyboard opens, and a window left at the top of
   the layout has its title above the screen. Notes is the one exception, and
   not a window at all — its editor keeps up with the keyboard its own way. */
@media (max-width: 760px) {
  .modal-wrapper:not(.viewport-deferred) { top: var(--visible-top, 0px); }
  .modal-wrapper.keyboard-open { padding: 0; }
  .modal-wrapper.keyboard-open .modal { height: 100%; margin: 0 auto; }
  .goals-inspector.open {
    top: max(var(--header-h), var(--visible-top, 0px));
    height: calc(var(--visible-h, 100dvh) + var(--visible-top, 0px) - max(var(--header-h), var(--visible-top, 0px)));
  }
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 520px;
  padding: 0;
  margin: auto;
  /* A column of three: a title that stays, a middle that scrolls, buttons
     that stay. `max-height: 100%` is the wrapper's visible height less its
     padding, which is what border-box makes it mean. */
  display: flex;
  flex-direction: column;
  max-height: 100%;
  animation: slideUp 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-lg { max-width: 680px; }

@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--border-s);
  /* Never squeezed and never scrolled away: it is the only thing that says
     what this window is. */
  flex: none;
}

.modal-title {
  font-size: var(--text-md);
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: -0.2px;
}

.modal-close {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  color: var(--text-3);
  transition: all var(--ease);
  flex-shrink: 0;
}

.modal-close:hover { background: var(--surface-2); color: var(--text-1); }
.modal-close svg { width: 18px; height: 18px; }

.modal-body {
  padding: 32px;
  font-size: 1rem;
  line-height: 1.7;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
  /* The one part that scrolls. `min-height: 0` is what allows it to: a flex
     child refuses to shrink below its content without it, and the column
     would grow past the cap above instead of scrolling inside it.
     `overscroll-behavior` keeps a flick at the end of the form from carrying
     on into the page behind the window. */
  overflow-y: auto;
  min-height: 0;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--border-s);
  /* Held still for the same reason as the title. The phone rules used to do
     this with `position: sticky`, which only worked because the whole window
     was what scrolled; now that the middle scrolls, being a column child
     that cannot shrink is what keeps Save in sight. */
  flex: none;
}

/* ── Resume Day option buttons ── */
.resume-day-option {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-4);
  width: 100%;
  padding: var(--sp-4) var(--sp-5);
  border-radius: var(--r-lg);
  border: 1px solid transparent;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: all var(--ease);
}
.resume-day-option-body { display: flex; flex-direction: column; gap: 4px; }
.resume-day-option-title {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-1);
  line-height: 1.3;
}
.resume-day-option-desc {
  font-size: var(--text-xs);
  color: var(--text-3);
  line-height: 1.5;
}
.btn-primary-soft {
  background: var(--primary-s, rgba(79,99,232,.08));
  border-color: var(--primary-s, rgba(79,99,232,.15));
}
.btn-primary-soft:hover { background: var(--primary-s); border-color: var(--line-strong); }
.btn-primary-soft .resume-day-option-title { color: var(--primary-ink); }
.btn-ghost-soft {
  background: var(--surface-2);
  border-color: var(--border);
}
.btn-ghost-soft:hover { background: var(--surface-3); border-color: var(--border-s); }

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-5) var(--sp-6);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: box-shadow var(--ease), transform var(--ease);
}

.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
}

.stat-card.c-primary::before   { background: linear-gradient(90deg, var(--primary), var(--accent)); }
.stat-card.c-success::before   { background: linear-gradient(90deg, var(--success), var(--teal)); }
.stat-card.c-warning::before   { background: linear-gradient(90deg, var(--warning), var(--orange)); }
.stat-card.c-purple::before    { background: linear-gradient(90deg, var(--purple), var(--accent)); }

.stat-value {
  font-size: var(--text-2xl);
  font-weight: 800;
  color: var(--text-1);
  letter-spacing: -0.5px;
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: var(--text-sm);
  color: var(--text-3);
  font-weight: 500;
}

.quick-task-check.done {
  background: var(--success);
  border-color: var(--success);
  color: white;
}

.quick-task-check.done svg { display: block; }

.quick-task-text.done {
  /* No strike-through — that reads as "skipped"; muted color + check signals done. */
  color: var(--text-3);
}

.week-bar-col.today .week-bar-fill {
  background: linear-gradient(180deg, var(--accent) 0%, var(--primary) 100%);
}

.section-title {
  font-size: var(--text-md);
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: -0.2px;
}

/* ------------------------------------------------------------
   17. CALENDAR PAGE
   ------------------------------------------------------------ */

.calendar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
  flex-wrap: wrap;
}

.cal-add-mobile, .habits-add-mobile { display: none; }

.cal-nav {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
}

.cal-nav-arrow {
  flex: 0 0 auto;
}

/* Sits with the arrows, not with the view switcher: it moves the calendar in
   time, which is what the arrows do. A little air after the arrows so it does
   not read as a third one. */
.cal-today-btn {
  flex: 0 0 auto;
  margin-left: var(--sp-2);
}

.cal-current-label {
  font-size: var(--text-md);
  font-weight: 700;
  color: var(--text-1);
  text-align: center;
  letter-spacing: -0.2px;
  white-space: nowrap;
}

.view-toggle {
  display: flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 3px;
  gap: 2px;
}

.view-btn {
  padding: 6px 14px;
  border-radius: 5px;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-2);
  transition: all var(--ease);
}

.view-btn.active {
  background: var(--surface);
  color: var(--text-1);
  box-shadow: var(--shadow-sm);
}

/* Month grid */
.cal-month-grid {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.cal-day-names {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: color-mix(in srgb, var(--primary) 8%, transparent);
  border-bottom: 1px solid var(--border);
}

.cal-day-name {
  padding: var(--sp-3) var(--sp-2);
  text-align: center;
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.cal-cells {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.cal-cell {
  min-height: 100px;
  padding: var(--sp-2);
  border-right: 1px solid var(--border-s);
  border-bottom: 1px solid var(--border-s);
  cursor: pointer;
  transition: background var(--ease);
  overflow: hidden;
}

.cal-cell:hover { background: var(--surface-hover); }
.cal-cell:nth-child(7n) { border-right: none; }

.cal-cell.other-month { background: var(--surface-3); }
.cal-cell.other-month .cal-cell-date { color: var(--text-4); }

.cal-cell.today { background: var(--primary-s); }
.cal-cell.today .cal-cell-date {
  background: var(--primary);
  color: white;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.cal-cell-date {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 4px;
  line-height: 1;
}

.cal-event-pill {
  display: block;
  padding: 2px 6px;
  border-radius: var(--r-sm);
  font-size: 10px;
  font-weight: 600;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: opacity var(--ease);
}

.cal-event-pill:hover { opacity: 0.8; }

.cal-more-pill {
  font-size: 10px;
  color: var(--text-3);
  font-weight: 600;
  padding: 1px 4px;
}

/* Week / Day view */
.cal-time-view {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.cal-time-header {
  display: grid;
  background: color-mix(in srgb, var(--primary) 8%, transparent);
  border-bottom: 1px solid var(--border);
}

.cal-time-header-cell {
  padding: var(--sp-3) var(--sp-2);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-right: 1px solid var(--border-s);
}

.cal-time-header-cell:first-child { border-right: 1px solid var(--border); }
.cal-time-header-day  { font-size: var(--text-xs); font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em; }
.cal-time-header-date { font-size: var(--text-sm); font-weight: 700; color: var(--text-3); }

.cal-time-header-date.today {
  background: var(--primary);
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.cal-time-body {
  display: flex;
  overflow-y: auto;
  max-height: 580px;
  position: relative;
}

.cal-time-labels {
  width: 56px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
}

.cal-hour-label {
  height: 64px;
  position: relative;
  flex-shrink: 0;
}
/* Label sits centered ON the hour gridline (Mac Calendar style), not below it. */
.cal-hour-label span {
  position: absolute;
  top: 0;
  right: var(--sp-2);
  transform: translateY(-50%);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-3);
  white-space: nowrap;
}

.cal-time-cols {
  flex: 1;
  display: grid;
  position: relative;
}

.cal-day-col {
  position: relative;
  border-right: 1px solid var(--border-s);
}

.cal-day-col:last-child { border-right: none; }

.cal-hour-row {
  height: 64px;
  border-bottom: 1px solid var(--border-s);
  position: relative;
  cursor: pointer;
  transition: background var(--ease);
}

.cal-hour-row:hover { background: rgba(79,99,232,.05); }

.cal-hour-row:last-child { border-bottom: none; }

.cal-hour-row.half-hour::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  top: 50%;
  border-top: 1px dashed var(--border-s);
}

/* Current time across the week grid: faint on the other days, solid with a
   dot on today — the eye finds "now" without hunting for the right column. */
.cal-now-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 0;
  border-top: 1px solid var(--danger);
  opacity: .28;
  pointer-events: none;
  z-index: 11;
}
.cal-now-line-today { opacity: 1; }
.cal-now-line-today i {
  position: absolute;
  left: -4px;
  top: -4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
}

.cal-time-event {
  position: absolute;
  left: 3px;
  right: 3px;
  border-radius: var(--r-sm);
  padding: 3px 6px;
  font-size: 11px;
  font-weight: 600;
  overflow: hidden;
  cursor: pointer;
  z-index: 10;
  display: flex;
  flex-direction: column;
  transition: opacity var(--ease), transform var(--ease);
}

.cal-time-event:hover { opacity: 0.88; transform: scale(1.01); }

.cal-time-event-title {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Time range anchored to the bottom of the tile, in a lighter weight. */
.cal-time-event-time {
  margin-top: auto;
  font-size: 10px;
  font-weight: 400;
  opacity: 0.85;
  white-space: nowrap;
}

/* Calendar right panel - event details */
.cal-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: var(--sp-6);
  align-items: start;
}

.cal-events-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.cal-event-item {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border-bottom: 1px solid var(--border-s);
  align-items: flex-start;
  transition: background var(--ease);
  cursor: pointer;
}

.cal-event-item:last-child { border-bottom: none; }
.cal-event-item:hover { background: var(--surface-2); }

.cal-event-color-bar {
  width: 4px;
  border-radius: var(--r-full);
  flex-shrink: 0;
  align-self: stretch;
  min-height: 40px;
}

.cal-event-info { flex: 1; min-width: 0; }
.cal-event-info-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 3px;
}

.cal-event-info-meta {
  font-size: var(--text-xs);
  color: var(--text-3);
}

.cal-event-actions {
  display: flex;
  gap: var(--sp-1);
  opacity: 0;
  transition: opacity var(--ease);
}

.cal-event-item:hover .cal-event-actions { opacity: 1; }

.filter-chip.active { background: var(--primary); color: white; border-color: var(--line-strong); }

.task-checkbox {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--ease);
  margin-top: 1px;
}

.task-checkbox:hover { border-color: var(--success); }
.task-checkbox.checked { background: var(--success); border-color: var(--success); color: white; }
.task-checkbox svg { display: none; width: 11px; height: 11px; }
.task-checkbox.checked svg { display: block; }

.task-title.done {
  /* No strike-through — that reads as "skipped"; muted color + check signals done. */
  color: var(--text-3);
}

.task-actions {
  display: flex;
  gap: var(--sp-1);
  opacity: 0;
  transition: opacity var(--ease);
  flex-shrink: 0;
  /* Wide enough for the largest button set (calendar + edit + delete) so the
     reserved area is identical across every row - buttons reveal on hover with
     zero layout shift, and badges line up in a steady column. */
  min-width: 108px;
  justify-content: flex-end;
}

.task-item:hover .task-actions { opacity: 1; }

.priority-dot.high   { background: var(--danger); }
.priority-dot.medium { background: var(--warning); }
.priority-dot.low    { background: var(--success); }

/* Tasks stats sidebar */
@media (min-width: 641px) {
  .task-empty-desktop-hidden { display: none; }
}

.tasks-stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-s);
  font-size: var(--text-sm);
}

.tasks-stat-row:last-child { border-bottom: none; }
.tasks-stat-key { color: var(--text-2); font-weight: 500; }
.tasks-stat-val { font-weight: 700; color: var(--text-1); }

.milestone-check.done  { background: var(--success); border-color: var(--success); color: white; }
.milestone-check.done svg { display: block; }

.milestone-title.done { color: var(--text-3); }

.goal-toggle-btn.open svg { transform: rotate(180deg); }

/* ════════════════════════════════════════════════════════
   Goals redesign — rail (goal list) + workspace (selected goal)
   ════════════════════════════════════════════════════════ */
.goals-redesign {
  display: flex;
  gap: var(--sp-5);
  align-items: flex-start;
}

/* ── Rail ── */
.goals-rail {
  width: 300px;
  flex: none;
  background: var(--surface);
  border: 1px solid var(--border-s);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: var(--sp-4);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - var(--sp-8));
  max-height: calc(100dvh - var(--sp-8));
  overflow: hidden;
}
.grail-head { padding: var(--sp-4) var(--sp-4) var(--sp-3); border-bottom: 1px solid var(--border-s); }
/* The review sits under the goals, not above them: it is what you reach for
   after reading the list, not a second heading. On an empty tab the list <div>
   isn't rendered at all, and then the head's own divider already separates the
   two — a second line there would fence off an empty strip. */
.grail-foot { padding: var(--sp-3) var(--sp-4) var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-2); }
.grail-list + .grail-foot { border-top: 1px solid var(--border-s); }
.grail-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); }
.grail-title { font-size: 1.05rem; font-weight: 800; color: var(--text-1); margin: 0; letter-spacing: -.02em; }
.grail-seg {
  display: inline-flex;
  background: var(--surface-2);
  border-radius: var(--r-sm);
  padding: 3px;
  margin-top: var(--sp-3);
}
.grail-seg button {
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-3);
  padding: 5px 16px;
  border: none;
  background: none;
  border-radius: calc(var(--r-sm) - 2px);
  cursor: pointer;
  transition: background var(--ease), color var(--ease);
}
.grail-seg button.on { background: var(--primary); color: #fff; box-shadow: 0 2px 8px -2px rgba(124,92,252,.5); }
/* An empty Paused or Completed carries the SAME strip as Active with its two
   buttons made invisible, and its line laid over the space they are holding.
   The two cards are then the same height at every window width and every zoom,
   because it is the same markup - no number to measure and get wrong.

   visibility, not display: an invisible button still takes up its space, which
   is the whole point, and the browser keeps it out of the tab order and out of
   the reach of a click, so there is nothing there to press. */
.grail-foot-ghost { visibility: hidden; position: relative; }
.grail-foot-ghost .inbox-empty-msg {
  visibility: visible;
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--sp-3);
}
.grail-list { overflow-y: auto; padding: var(--sp-2); display: flex; flex-direction: column; gap: 4px; }

.grail-card {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  text-align: left;
  padding: var(--sp-3);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: none;
  cursor: pointer;
  transition: background var(--ease), border-color var(--ease);
}
.grail-card:hover { background: var(--surface-2); }
.grail-card.sel { background: var(--primary-soft, rgba(124,92,252,.08)); border-color: var(--line-strong); }
.grail-ring { position: relative; flex: none; }
/* A finished goal's ring: the same ring, closed, in the colour the app gives
   to finished things. The number inside it stays. */
.grail-ring-done .grail-ring-pct { color: var(--success-text); }
.grail-ring-pct {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: .62rem; font-weight: 700; color: var(--text-1);
}
.grail-card-body { min-width: 0; flex: 1; }
.grail-card-title {
  font-size: .9rem; font-weight: 700; color: var(--text-1);
  line-height: 1.25; letter-spacing: -.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.grail-card-meta { display: flex; align-items: center; gap: var(--sp-2); margin-top: 4px; }
.grail-card-steps { font-size: .72rem; color: var(--text-3); }
.grail-card:hover .grail-card-actions,
.grail-card.sel .grail-card-actions { opacity: 1; }

/* ── Workspace ── */
.goals-workspace { flex: 1; min-width: 0; }
.goals-mobile-nav { display: none; }
.gws-mobile-more { display: none; }
.task-mobile-more { display: none; }
.gws-empty { display: grid; place-items: center; min-height: 360px; }
/* Empty tab (no goal selectable): center the placeholder across the WHOLE main
   area — rail + workspace — like Notes/Wishlist, not only the column beside the
   rail. The rail stays in flow top-left; the placeholder overlays, centered. */
.goals-redesign-empty { position: relative; min-height: 60vh; min-height: 60dvh; flex: 1; }
/* The goals page itself has to stretch, or the wrapper below has nothing to
   fill — the placeholder would centre against its own short box again. */
#page-goals.active { display: flex; flex-direction: column; }
/* The placeholder overlays the whole area (incl. the rail); it has no clickable
   content, so let clicks fall through to the rail buttons beneath it. */
.goals-redesign-empty .gws-empty { position: absolute; inset: 0; min-height: 0; pointer-events: none; }
.gws-head {
  background: var(--surface);
  border: 1px solid var(--border-s);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--sp-5);
  margin-bottom: var(--sp-4);
}
/* The header is a row until the name no longer fits in it, and then it is two
   rows. Nothing here asks how wide the window is: the name claims 220px before
   anything else may stay on its line, so the controls step down by themselves —
   at every width, including the ones nobody thought to test. */
.gws-head-top { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap; }
.gws-head-info { flex: 1 1 220px; min-width: 0; }
.gws-title {
  font-size: 1.4rem; font-weight: 800; color: var(--text-1); margin: 0;
  letter-spacing: -.02em; display: flex; align-items: flex-start; gap: var(--sp-2);
}
/* break-word, never `anywhere`: both break a word too long for the line, but
   `anywhere` also tells the browser this box is happy one letter wide, and a
   flex row that is short of space takes it at its word — the goal's name came
   out as a vertical column of letters. */
.gws-title-text { min-width: 0; overflow-wrap: break-word; }
.gws-title > .badge { flex: none; margin-top: 4px; }
/* Two zones: steps/percent on the left, deadline (if any) on the right. With
   space-between the left zone keeps its position whether or not a deadline is
   shown, so the card height/layout is identical for every goal. */
.gws-sub { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-top: var(--sp-2); font-size: .8rem; color: var(--text-3); }
.gws-sub-main { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; }
.gws-sub-deadline { font-weight: 600; white-space: nowrap; margin-left: var(--sp-3); }
/* What stands where the deadline stood. A goal that is finished cannot be late
   for anything, so the red count of days overdue has nothing left to say —
   the day it was finished has. */
.gws-sub-done { color: var(--success-text); }
.gws-dot { width: 3px; height: 3px; border-radius: var(--r-full); background: var(--border); flex-shrink: 0; }
.gws-head-actions { display: flex; align-items: center; gap: var(--sp-2); flex: none; }
.gws-mode {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border-s);
  border-radius: var(--r-md);
  padding: 3px;
}
.gws-mode button {
  font-size: .78rem; font-weight: 600; color: var(--text-3);
  padding: 5px 12px; border: none; background: none; border-radius: var(--r-sm); cursor: pointer;
  transition: background var(--ease), color var(--ease);
}
.gws-mode button.on { background: var(--surface); color: var(--text-1); box-shadow: var(--shadow-sm); }
/* Once the goal holds work the mode stops being a choice and becomes a label.
   It keeps the segment's footprint but drops the raised, white fill that marks
   a selected option — nothing here is selected, because nothing is on offer.
   What shows through is the track behind it, like an unpicked tab. */
.gws-mode-fixed,
.gws-year,
.gws-year-label {
  font-family: var(--font);
  font-size: .78rem;
  font-weight: 600;
  font-style: normal;
  line-height: 1.2;
  letter-spacing: normal;
  color: var(--text-2);
}
.gws-mode-fixed {
  padding: 5px 12px;
  cursor: default;
}
/* The plan's year, on the same track as the planning mode: the two together
   say what kind of plan this is and when it runs. A select, not arrows — it
   offers the years rather than making you step to them one at a time. */
/* No chevron. It still opens a list on click — the hover panel is what says
   so, the way the year itself does by being the only thing there that changes.
   An arrow drawn beside four plain icon buttons read as a fifth control. */
.gws-year {
  padding: 5px 10px;
  border: none; background: none; border-radius: var(--r-sm);
  cursor: pointer; appearance: none;
  transition: background-color var(--ease);
}
.gws-year-label { display: none; }
.gws-year:hover { background-color: var(--surface); }
.gws-progress { margin-top: var(--sp-4); }
.gws-progress-row { display: flex; align-items: center; justify-content: space-between; font-size: .78rem; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.gws-bar { height: 8px; border-radius: var(--r-full); background: var(--surface-2); overflow: hidden; }
.gws-bar > i { display: block; height: 100%; border-radius: var(--r-full); background: var(--primary); transition: width .4s cubic-bezier(.4,0,.2,1); }
/* Violet is the colour of work in progress. A full bar is not progress any
   more, it is a result, so it takes the colour the app gives to finished
   things — softly, because it is a statement and not an alarm. */
.gws-bar-done { background: var(--success-s); }
.gws-bar-done > i { background: var(--success); }


/* ── Detailed view: quarter tabs (one quarter shown at a time) ── */
/* Four across while four fit, then three, then two, then one. 130px is what a
   quarter needs for its name, its months and its count on one line each. A grid
   rather than a wrapping row, so the last quarter on a line cannot stretch
   itself across the rest of it. */
.gq-tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
}
.gq-tab {
  min-width: 0;
  text-align: left;
  padding: 11px 13px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--border-s);
  cursor: pointer;
  transition: border-color var(--ease), background var(--ease);
}
.gq-tab:hover { border-color: var(--border); }
.gq-tab.on { background: var(--text-1); border-color: var(--text-1); }
/* ── A quarter that has run out ──
   It keeps its shape and loses its colour: still readable, no longer a place
   to plan into. A past quarter nobody ever planned into loses the card too —
   there is nothing behind it to open. */
.gq-tab.past { background: var(--surface); border-color: var(--border-s); }
.gq-tab.past .gq-tab-l { color: var(--text-3); font-weight: 700; }
.gq-tab.past .gq-tab-r,
.gq-tab.past .gq-tab-c { color: var(--text-3); opacity: .8; }
.gq-tab.past.on { background: var(--text-3); border-color: var(--text-3); }
.gq-tab.past.on .gq-tab-l { color: var(--bg); }
.gq-tab.past.on .gq-tab-r,
.gq-tab.past.on .gq-tab-c { color: color-mix(in srgb, var(--bg) 72%, transparent); }
.gq-tab.unused {
  background: color-mix(in srgb, var(--text-3) 26%, transparent);
  border-color: transparent;
  cursor: default;
  filter: grayscale(1);
}
.gq-tab.unused:hover { border-color: transparent; }

.gq-tab-l { display: block; font-size: .82rem; font-weight: 800; color: var(--text-1); }
.gq-tab-r { display: block; font-size: .68rem; color: var(--text-3); margin-top: 2px; }
.gq-tab-c { display: block; font-size: .68rem; color: var(--text-3); margin-top: 7px; font-weight: 600; }
/* The ink on the chosen tab is the page's own ground, not white: the tab is
   filled with --text-1, which is near-black in the light theme and near-WHITE
   in the two dark ones — so white lettering left the quarter you were looking
   at invisible in dark mode. */
.gq-tab.on .gq-tab-l { color: var(--bg); }
.gq-tab.on .gq-tab-r { color: color-mix(in srgb, var(--bg) 72%, transparent); }
.gq-tab.on .gq-tab-c { color: color-mix(in srgb, var(--bg) 50%, transparent); }

/* Closed records use neutral lavender; green is reserved for completion. */
.gq-tab.past.closed {
  background: color-mix(in srgb, var(--surface) 88%, var(--text-3));
  border-color: var(--border);
}
.gq-tab.past.closed.on,
.gq-tab.past.closed:hover { border-color: var(--text-3); }
.gq-tab.past.closed .gq-tab-l { color: var(--text-1); }
.gq-tab.past.closed .gq-tab-r,
.gq-tab.past.closed .gq-tab-c { color: var(--text-3); opacity: 1; }

.gq-panel-title { font-size: .85rem; font-weight: 700; color: var(--text-1); }
.gq-panel-range { font-weight: 500; color: var(--text-3); font-size: .72rem; margin-left: var(--sp-1); }

/* Reused step bodies inside the workspace */
.gws-body .year-goal-simple {
  background: var(--surface);
  border: 1px solid var(--border-s);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--sp-2) var(--sp-4);
}
.gws-body .year-goal-breakdown {
  background: transparent;
  border-top: none;
  padding: 0;
}

/* ── Step inspector (right-hand slide-over) ── */
.gins-overlay {
  position: fixed; inset: 0;
  background: rgba(24,18,56,.28);
  opacity: 0; pointer-events: none;
  transition: opacity .28s;
  z-index: 105;
}
.gins-overlay.open { opacity: 1; pointer-events: auto; }
.goals-inspector {
  position: fixed; top: var(--header-h); right: 0; height: calc(100% - var(--header-h));
  width: 404px; max-width: 92vw;
  background: var(--surface);
  border-left: 1px solid var(--border-s);
  box-shadow: -20px 0 48px -28px rgba(24,18,56,.32);
  transform: translateX(101%);
  visibility: hidden;
  transition: transform .32s cubic-bezier(.22,1,.36,1), visibility .32s;
  z-index: 110;
  display: flex; flex-direction: column;
}
.goals-inspector.open { transform: none; visibility: visible; }
.gins-head { padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--border-s); }
/* Close sits on the breadcrumb line, in the corner of the panel, so the title
   row below is free to carry the step's status instead. */
.gins-crumb-row { display: flex; align-items: flex-start; gap: var(--sp-2); }
.gins-crumb { flex: 1; display: flex; align-items: center; gap: 6px; font-size: .72rem; font-weight: 600; color: var(--text-3); flex-wrap: wrap; min-height: 22px; }
.gins-title-row .gr-status { flex-shrink: 0; margin-top: 4px; }
.gins-sep { color: var(--border); }
.gins-title-row { display: flex; align-items: flex-start; gap: var(--sp-2); margin-top: var(--sp-3); }
/* An input dressed as the heading it replaces: the step is renamed in place,
   so it should read as a title until you put the caret in it. */
.gins-title {
  font-size: 1.15rem; font-weight: 800; color: var(--text-1); line-height: 1.3;
  flex: 1; min-width: 0; letter-spacing: -.01em;
  font-family: inherit; background: none; border: 1px solid transparent;
  border-radius: var(--r-sm); padding: 2px 6px; margin-left: -6px; width: 100%;
  transition: background var(--ease), border-color var(--ease);
}
.gins-title:hover { background: var(--surface-2); }
.gins-title:focus { outline: none; background: var(--surface); border-color: var(--line-strong); }
.gins-title.done { color: var(--text-3); }
.gins-body { overflow-y: auto; min-height: 0; overscroll-behavior-y: contain; padding: var(--sp-4) var(--sp-5) var(--sp-6); flex: 1; }

.gins-field { margin-top: var(--sp-5); }
/* The panel opens straight into its first section — nothing sits above it now
   that completion is shown in the header rather than toggled here. */
.gins-body > .gins-field:first-child { margin-top: 0; }
/* Both dates are asked for with the same pill the Quick Add bar uses: nothing
   here is filled in until you say you want it. Date sits first — it is the one
   that puts the step on a day — with Deadline under it. */
.gins-dates { display: flex; flex-direction: column; align-items: flex-start; gap: var(--sp-2); }
.gins-dates .form-input { width: 100%; }
.gins-dates .qa-pill + .qa-pill { margin-top: var(--sp-2); }
.gins-label { font-size: .68rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); margin-bottom: var(--sp-2); }
.gins-notes {
  width: 100%; min-height: 76px; resize: vertical;
  border: 1px solid var(--border-s); border-radius: var(--r-md);
  padding: 10px 12px; font-family: inherit; font-size: .82rem; color: var(--text-2);
  background: var(--surface-2);
}
.gins-notes:focus { outline: none; border-color: var(--line-strong); background: var(--surface); }
.gins-sub { display: flex; align-items: center; gap: 10px; padding: 7px 2px; }
/* Built like the task checkbox on the dashboard — same round shape, same size,
   same green when ticked — and a finished sub-step fades the way a finished
   task row does, rather than only greying its words. */
.gins-sub-cb {
  width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border);
  flex: none; display: grid; place-items: center; cursor: pointer; background: var(--surface);
  transition: all var(--ease);
}
.gins-sub-cb svg { width: 11px; height: 11px; color: #fff; }
.gins-sub-cb.done { background: var(--success); border-color: var(--success); }
.gins-sub-title { font-size: .85rem; color: var(--text-1); flex: 1; min-width: 0; overflow-wrap: break-word; }
.gins-sub-actions { display: flex; align-items: center; gap: 10px; flex: none; }
@media (max-width: 760px) {
  .gins-sub-actions > button:not(.task-mobile-more) { display: none; }
  .gins-sub-actions .task-mobile-more {
    display: grid; place-items: center; width: 44px; height: 44px;
    padding: 0; color: var(--text-2); border-radius: var(--r-sm);
  }
  .gins-sub-actions .task-mobile-more svg { width: 24px; height: 24px; }
}
.gins-sub.done { opacity: .5; }
.gins-sub .btn-icon { opacity: 0; transition: opacity var(--ease); }
.gins-sub:hover .btn-icon { opacity: 1; }
/* The day a sub-step was put on. It stays visible without hover, because it is
   the thing that tells the two kinds of sub-step apart at a glance. */
.gins-sub-day {
  font-size: .72rem; font-weight: 600; color: var(--primary-ink);
  background: var(--primary-s); border-radius: var(--r-full);
  padding: 2px 8px; flex-shrink: 0; white-space: nowrap;
}
.gins-sub .btn-icon.on { opacity: 1; color: var(--primary-ink); background: var(--primary-s); }
/* A touch screen has no hover, so hover-only controls are simply unreachable
   there. Putting a sub-step on a day is the main thing this row does — it
   cannot be the one action a phone cannot perform. */
@media (hover: none) {
  .gins-sub .btn-icon { opacity: .7; }
}
.gins-sub-date { padding: 0 2px 8px 30px; }
.gins-foot { border-top: 1px solid var(--border-s); padding: var(--sp-3) var(--sp-5); display: flex; gap: var(--sp-2); }
.gins-foot-btn {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 7px;
  font-size: .82rem; font-weight: 700; padding: 9px; border-radius: var(--r-md);
  color: var(--text-2); background: var(--surface-2); border: none; cursor: pointer;
  transition: background var(--ease), color var(--ease);
}
.gins-foot-btn:hover { background: var(--border-s); }
.gins-foot-btn svg { width: 15px; height: 15px; }
.gins-foot-btn.danger { color: var(--danger); }
.gins-foot-btn.danger:hover { background: var(--danger-soft, rgba(225,29,72,.1)); }

@media (max-width: 760px) {
  .goals-redesign { flex-direction: column; }
  .goals-rail { width: 100%; position: static; max-height: none; }
  /* Stacked layout is already full-width, so the placeholder centers correctly
     in normal flow — undo the desktop absolute-overlay centering. */
  .goals-redesign-empty { min-height: 0; }
  .goals-redesign-empty .gws-empty { position: static; min-height: 360px; }
}

@media (max-width: 900px) {
    .goals-month-grid  { grid-template-columns: repeat(2, 1fr); }
}

.goal-row-done .goal-row-title { text-decoration: line-through; }
.goal-row-check.checked {
  background: var(--accent);
  border-color: var(--accent);
}
.goal-row-check.checked svg { display: block; }
.goal-row-title {
  font-size: .9rem;
  font-weight: 600;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Milestones modal internals */
.ms-goal-header {
  margin-bottom: var(--sp-4);
  padding-bottom: var(--sp-3);
  border-bottom: 1px solid var(--border);
}
.ms-goal-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 4px;
}
.ms-goal-meta {
  font-size: .78rem;
  color: var(--text-3);
}
.ms-progress-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}
.ms-progress-pct {
  font-size: .85rem;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
  min-width: 40px;
}
.ms-progress-label {
  font-size: .78rem;
  color: var(--text-3);
  flex: 1;
}

.ms-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: var(--sp-4);
  max-height: 340px;
  overflow-y: auto;
}
.ms-empty {
  font-size: .85rem;
  color: var(--text-4);
  font-style: italic;
  padding: var(--sp-3) 0;
}
.ms-add-row {
  padding-top: var(--sp-2);
}

.ms-row {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-md);
  transition: background var(--ease);
}
.ms-row:hover { background: var(--surface-2); }
/* A finished step fades whole, the way a finished task does on the dashboard
   and a finished sub-step does in the step panel. Dimming only the title left
   the tick at full strength, so what was done drew more of the eye than what
   was still to do. */
.ms-row-done { opacity: .5; }

/* The same tick as everywhere else something is finished: round, twenty
   pixels, green. */
.ms-check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--ease);
}
.ms-check:hover { border-color: var(--success); }
.ms-check.checked {
  background: var(--success);
  border-color: var(--success);
}
.ms-check.checked svg { display: block; }
.ms-check svg { display: none; width: 11px; height: 11px; color: #fff; }

.ms-row-body { flex: 1; min-width: 0; }
.ms-row-title {
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-1);
}
.ms-row-date {
  font-size: .72rem;
  color: var(--text-3);
  margin-top: 2px;
}
.ms-row-actions {
  display: flex;
  gap: var(--sp-1);
  flex-shrink: 0;
  opacity: 0;
  transition: opacity var(--ease);
}
.ms-row:hover .ms-row-actions { opacity: 1; }

.ms-action-task {
  font-size: .7rem;
  padding: 2px 7px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  color: var(--text-2);
  transition: border-color var(--ease), color var(--ease), background var(--ease);
}
.ms-action-task:hover { border-color: var(--green,#22c55e); color: var(--green,#22c55e); }

/* ── Milestone labels (tasks,
habits {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-top: 3px;
  flex-wrap: wrap;
}
/* ── "Add to Task List" modal header: one compact line, neutral tag ── */
.sg-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
}
.sg-item { font-size: var(--text-sm); color: var(--text-1); }
.sg-item strong { font-weight: 700; }
.sg-sep, .sg-goal { color: var(--text-3); }

/* ── ms-action-habit button ── */
.ms-action-habit {
  font-size: .8rem;
  padding: 2px 7px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  color: var(--text-2);
  transition: border-color var(--ease), color var(--ease);
}
.ms-action-habit:hover { border-color: var(--accent); color: var(--accent); }

.year-goal-breakdown {
  background: var(--surface-2);
  border-top: 1px solid var(--border-s);
  padding: var(--sp-4) var(--sp-4) var(--sp-2);
}
/* ── Quarterly goal block (inside year breakdown Q panel) ── */
.quarter-goal-block {
  border: 1px solid var(--border-s);
  border-radius: var(--r-md);
  margin-bottom: var(--sp-5);
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.quarter-goal-block:last-child { margin-bottom: 0; }
.quarter-goal-hdr {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-3);
  cursor: pointer;
  transition: background var(--ease);
}
.quarter-goal-hdr:hover { background: var(--surface-2); }
.quarter-goal-info { flex: 1; min-width: 0; }

/* The arrow says the goal opens; the whole bar is what you press. It used to be
   the arrow alone, back when the view switch sat on this bar too and a press a
   few pixels wide of it would have shut the goal. The switch has its own line
   now, so the only things left to miss are Edit and Delete, and those two keep
   their own press. */
.qcaret-btn {
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; width: 26px; height: 26px;
  background: none; border: none; border-radius: var(--r-sm);
  cursor: pointer; padding: 0;
  transition: background var(--ease);
}
.qcaret-btn:hover { background: var(--surface-2); }
.qcaret { color: var(--text-3); font-size: .8rem; text-align: center; }
.qg-substatus { font-size: .72rem; color: var(--text-3); margin-top: 1px; }
/* Full width of its row, like the goal's own Overall progress bar above it —
   capped at 320px, a finished sub-goal read as barely half done. */
.qg-bar { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; margin-top: 6px; }
.qg-bar-fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width .3s ease; }
.qg-actions { display: flex; align-items: center; gap: var(--sp-1); flex-shrink: 0; }
/* Edit and Delete keep their space whether or not they are showing, so the
   view switch beside them never moves — a row that shuffles under the cursor
   is a row you misclick. Fading, not appearing. */
.qg-hover-actions {
  display: flex; gap: var(--sp-1);
  opacity: 0; pointer-events: none;
  transition: opacity var(--ease);
}
.quarter-goal-hdr:hover .qg-hover-actions,
.qg-hover-actions:focus-within { opacity: 1; pointer-events: auto; }
/* No hover to give: on a touch screen these two are the only way to rename or
   delete a quarterly goal, so they are simply always there. */
@media (hover: none) {
  .qg-hover-actions { opacity: 1; pointer-events: auto; }
}

/* Each month is its own card ("window") with space between them. */
.qmonth {
  background: var(--surface);
  border: 1px solid var(--border-s);
  border-radius: var(--r-md);
  margin-bottom: var(--sp-3);
  overflow: hidden;
}
.qmonth:last-child { margin-bottom: 0; }
/* Separated by rule, not by fill: a tinted month header sat on a tinted panel
   and the two dissolved into each other. Hairlines cost no colour and hold at
   any background — the same trick .grv-qgoal uses to part a goal from its
   steps. The row never changes colour, not even on hover; the pointer cursor
   and the disclosure arrow already say it is clickable. */
.qmonth-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3);
  cursor: pointer;
}
/* One line between months, one under an open month's title. Both come from the
   element that follows, so nothing needs to know whether it is last or open. */
.qmonth + .qmonth { border-top: 1px solid var(--border-s); }
.qmonth-body { border-top: 1px solid var(--border-s); }
.qmonth-name { font-size: var(--text-sm); font-weight: 600; color: var(--text-1); flex: 1; }
.qmonth-status { font-size: .72rem; color: var(--text-3); }
.qmonth-empty .qmonth-name { font-weight: 500; color: var(--text-2); }
.qmonth-body { padding: var(--sp-3) var(--sp-3) var(--sp-3); }

/* The same two-button segment as the goal's Simple/Detailed switch above it —
   both answer "which view", so they should not look like different controls. */
.qview-seg {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border-s);
  border-radius: var(--r-md);
  padding: 3px;
}
.qview-seg button {
  font-size: .78rem; font-weight: 600; color: var(--text-3);
  padding: 5px 14px; border: none; background: none; border-radius: var(--r-sm); cursor: pointer;
  transition: background var(--ease), color var(--ease);
}
.qview-seg button.on { background: var(--surface); color: var(--text-1); box-shadow: var(--shadow-sm); }
/* Its own line under the goal's bar: it belongs to the plan below it, not to
   the goal's controls, so the progress line gets its full width back. Left, not
   centred — every other control on this page starts at the same left edge as
   the months and weeks it acts on, and a centred one made the eye jump out to
   the middle and back. */
.qview-bar {
  display: flex; justify-content: flex-start;
  /* The months and weeks below sit at --sp-4; the switch that changes them
     starts on the same line, which is what "the same left edge" above meant
     and what a four-pixel miss quietly undid. */
  padding: var(--sp-3) var(--sp-3) var(--sp-3) var(--sp-4);
  background: var(--surface-2);
  border-top: 1px solid var(--border-s);
}

.qstep-add { margin-top: 2px; }

/* ── The one decision a finished quarter asks for. It sits under the quarterly
   goal's own header, visible whether or not the goal is opened: a decision
   that hides behind a caret is a decision nobody takes. ── */
.qdecide {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: var(--sp-3);
  /* The sentence is about the goal named directly above it, so it starts where
     that name starts — past the caret's column. Sharing the header's padding
     without sharing its caret put this line alone at the card's edge, further
     left than anything it was talking about. */
  padding: var(--sp-3) var(--sp-3) var(--sp-3) calc(var(--sp-3) + 26px + var(--sp-2));
  border-top: 1px solid var(--border-s);
  background: var(--surface-2);
}
.qdecide-fact { font-size: .78rem; font-weight: 600; color: var(--text-2); }
.qdecide-acts { display: flex; gap: var(--sp-2); flex-wrap: wrap; }

/* ── Work carried over from the quarter this one continues. Each step is
   placed by hand; nothing lands in a month on its own. ── */
.qcarried {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-3);
  margin-bottom: var(--sp-3);
  background: var(--surface);
}
.qcarried-hdr {
  font-size: .875rem; font-weight: 600; color: var(--text-3);
  padding-bottom: var(--sp-3);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--sp-2);
}
.qcarried-row { display: flex; align-items: center; gap: var(--sp-2); }
.qcarried-row .ms-row { flex: 1; min-width: 0; }
.qcarried-row .btn { flex-shrink: 0; }
.qcarried-schedule { color: var(--primary); min-height: 44px; }
.qcarried-row .ms-row-title { overflow-wrap: break-word; }


/* ── Weekly view: one card per week of the quarter ── */
.qweeks { display: flex; flex-direction: column; gap: var(--sp-3); }
.qweek-card {
  background: var(--surface);
  border: 1px solid var(--border-s);
  border-radius: var(--r-md);
  overflow: hidden;
}

/* ── Where a period stands ──
   Three states, three colours, one meaning each: red is a debt to answer,
   green is work behind you, plain is work still to come. The line between the
   last two is the same device the task list uses for finished tasks. */
.qweek-card-done, .qmonth-done {
  background: rgba(34,197,94,.06);
  border-color: rgba(34,197,94,.26);
}
.qweek-card-done .qweek-count, .qmonth-done .qmonth-status {
  color: #16a34a; font-weight: 600;
}
/* ── A period that was never used ──
   The fourth state. Red is a debt, green is work behind you, plain is work
   ahead — and grey is a stretch of time the plan had not reached yet. It is
   not finished, so it must not be green; there is nothing inside it, so it
   does not open. The dashed edge says the same thing without a word. */
.qweek-card-unused, .qmonth-unused {
  background: color-mix(in srgb, var(--text-3) 26%, transparent);
  border-color: transparent;
  /* Grey whichever theme is on. The palette is drained rather than swapped for
     a second set of colours, so light, dark and purple all land on their own
     right grey without three more rules to keep in step. */
  filter: grayscale(1);
}
.qweek-card-unused .qweek-hdr, .qmonth-unused .qmonth-row { cursor: default; }
.qweek-card-unused .qweek-range, .qmonth-unused .qmonth-name {
  color: var(--text-3); font-weight: 500;
}
.qweek-card-unused .qweek-count, .qmonth-unused .qmonth-status {
  color: var(--text-3); font-weight: 500;
}

.qweek-card-late, .qmonth-late {
  background: rgba(220,38,38,.05);
  border-color: rgba(220,38,38,.32);
}
.qweek-card-late .qweek-range, .qmonth-late .qmonth-name { color: var(--text-1); }
.qweek-hdr .grv-late-chip, .qmonth-row .grv-late-chip { margin-left: var(--sp-2); }

.qdone-div {
  display: flex; align-items: center; gap: 9px;
  margin: var(--sp-4) 0 var(--sp-2);
  padding: 6px 4px;
  cursor: pointer;
  border-top: 1px solid var(--border-s);
}
.qdone-div .qcaret { color: var(--text-3); font-size: .7rem; }
.qdone-div-label {
  font-size: .7rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-3);
}
.qdone-div:hover .qdone-div-label { color: var(--text-2); }

/* ── A quarter that is over ──
   It replaces the week and month lists: there is nothing left to plan in it,
   and an empty quarter would read as lost work rather than finished work. */
.qdone {
  border: 1px solid rgba(34,197,94,.3);
  border-radius: var(--r-md);
  background: rgba(34,197,94,.07);
  padding: 12px 14px;
}
.qdone-hdr { display: flex; align-items: center; gap: var(--sp-3); }
.qdone-line { font-size: .86rem; font-weight: 700; color: var(--text-1); flex: 1; }
.qdone-btn {
  font-size: .75rem; font-weight: 700; color: var(--primary-ink);
  background: none; border: none; cursor: pointer;
  padding: 4px 8px; border-radius: var(--r-sm);
}
.qdone-btn:hover { background: var(--surface); }
.qdone-list {
  margin-top: var(--sp-3);
  border-top: 1px solid rgba(34,197,94,.24);
  padding-top: var(--sp-2);
  display: flex; flex-direction: column; gap: 2px;
}
.qdone-step { display: flex; align-items: center; gap: 10px; padding: 5px 2px; font-size: .84rem; }
.qdone-tick {
  width: 15px; height: 15px; flex: none; color: #16a34a;
  display: flex; align-items: center; justify-content: center;
}
.qdone-tick svg { width: 15px; height: 15px; }
.qdone-title { flex: 1; color: var(--text-2); }
.qdone-date { color: var(--text-3); font-size: .76rem; font-variant-numeric: tabular-nums; }
.qdone-sub {
  margin: var(--sp-3) 0 4px; padding-top: var(--sp-2);
  border-top: 1px solid rgba(34,197,94,.24);
  font-size: .7rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-3);
}
.qdone-step-moved .qdone-tick { color: var(--primary-ink); font-weight: 800; }
.qdone-step-moved .qdone-title { color: var(--text-3); }
/* Closed unfinished: present and readable, but plainly not work that happened.
   Nothing red — the quarter was closed on purpose, and this is a record, not a
   reproach. */
.qdone-step-left .qdone-tick  { color: var(--text-4); font-size: .8rem; }
.qdone-step-left .qdone-title { color: var(--text-3); }
/* The strip across the top says which month (or months) the week's days
   belong to. It is the only place that says it, which is why it is a band and
   not a footnote. */
/* The week we are in. The dashboard frames today's card the same way, so the
   two places that show a calendar agree about what "now" looks like. */
.qweek-card-now { border: 2px solid var(--line-strong); }

/* The same row a month gets: a caret, a name, and what is inside — because a
   week and a month are the same question asked at two sizes, and a quarter of
   thirteen opened weeks is a page nobody reads to the end. */
.qweek-hdr {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-3);
  cursor: pointer;
}
.qweek-range { font-size: var(--text-sm); font-weight: 600; color: var(--text-1); flex: 1; }
.qweek-count { font-size: .72rem; color: var(--text-3); }
/* A week nothing was planned into is still a week you can plan into — it is
   quieter, not absent. */
.qweek-card-empty .qweek-range { font-weight: 500; color: var(--text-2); }
.qweek-body { border-top: 1px solid var(--border-s); padding: var(--sp-3); }
/* A week that sits on the border between two quarters says so in words. It
   used to say it with a coloured bar as well — one stripe per month, in the
   month colours — and that bar was the only colour in a column of grey rows,
   so it read as a status: work done, work late, something wrong. It was
   neither; it was a calendar fact the dates already carry. */
.qweek-cross {
  display: flex; align-items: center;
  font-size: .72rem; font-weight: 600; color: var(--text-3);
}

.qweek-noweek .qsteps-list,
.qweek-noweek .qstep-add { padding: 0 var(--sp-3); }

/* Steps whose month is settled but whose week is not. They are not lost and
   not late — they simply have not been placed yet, so they gather at the end
   of the quarter with the one control that places them. */
.qweek-noweek { border-style: dashed; }
.qnoweek-row {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: 0 var(--sp-3);
}
.qnoweek-row .ms-row { flex: 1; min-width: 0; }
/* One width for every row, so the buttons line up down the right edge. */
/* Every button says the same three words, so letting it fit its own text
   still leaves the column even — and the arrow sits beside the words instead
   of being pushed to a far edge by a width the button did not need. */
.qweek-pick {
  flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 6px;
  font-family: inherit; font-size: .72rem;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border-s);
  border-radius: var(--r-sm);
  padding: 5px 8px;
  cursor: pointer;
}
.qweek-pick:hover { border-color: var(--line-strong); color: var(--primary-ink); }
.qweek-pick-txt { min-width: 0; text-align: left; }
/* No calendar icon on this button — her call, 15 October 2026. The words say
   what it does; the arrow says it opens. A third mark said neither. */
.qweek-pick-caret { display: inline-flex; flex-shrink: 0; }
.qweek-pick-caret svg { width: 11px; height: 11px; display: block; }

/* The weeks it offers. Hung off the button in fixed coordinates, so a long
   quarter scrolls inside the menu instead of stretching the card. */
.qwpop {
  position: fixed; z-index: 1000; min-width: 148px;
  max-height: 280px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg, 12px);
  box-shadow: var(--shadow-lg, 0 12px 34px -8px rgba(0,0,0,.35));
  padding: 6px; display: flex; flex-direction: column;
}
.qwpop-row {
  text-align: left; background: transparent; border: none;
  padding: 7px 10px; border-radius: var(--r-sm, 7px);
  font-family: inherit; font-size: .8rem; color: var(--text-1);
  white-space: nowrap; cursor: pointer;
}
.qwpop-row:hover { background: var(--surface-2); color: var(--primary-ink); }
.qwpop-row:focus-visible { outline: none; background: var(--surface-2); color: var(--primary-ink); }

/* The step's own deadline, read down the right edge of a list. It wears the
   app's deadline pill, so a step's deadline and a task's deadline are the same
   thing to look at; only the place it sits is this list's business. */
.ms-row > .ms-row-date,
.ms-row > .task-deadline-badge {
  margin-left: auto; margin-top: 0; align-self: center; flex-shrink: 0;
}
.ms-row-subs { font-size: .72rem; color: var(--text-3); margin-top: 2px; }

.quarter-breakdown-detailed {
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface-2);
  border-top: 1px solid var(--border-s);
}

/* ── Plan mode chooser (5-Year Goal creation) ── */
.plan-mode-choice {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  margin-top: var(--sp-2);
}
.plan-mode-option {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border: 2px solid var(--border);
  /* --r-sm, because these two sit directly under the text fields in the same
     window and a card rounded differently from the field above it reads as a
     different kind of thing. It asked for --radius, which this palette has
     never had, so the cards were drawn with square corners. */
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.plan-mode-option:hover { border-color: var(--line-strong); background: var(--surface-2); }
/* The chosen one is marked with the palette's own selection violet. It used to
   ask for --primary-light, which is not a colour this app defines, so it always
   fell through to a fixed pale lavender - a light-theme colour drawn in the
   dark theme too, which put white text on a near-white slab. */
.plan-mode-option.selected { border-color: var(--primary); background: var(--primary-s); }
.plan-mode-option input[type="radio"] { flex-shrink: 0; margin-top: 3px; accent-color: var(--primary); }
.plan-mode-body strong { display: block; font-size: var(--text-sm); font-weight: 700; color: var(--text-1); }
.plan-mode-desc { font-size: .72rem; color: var(--text-3); margin-top: 2px; }

/* ── Simple year-goal: inline steps ── */
.year-goal-simple {
  padding: var(--sp-2) var(--sp-4);
}
.year-goal-add-step {
  margin-top: var(--sp-1);
}
/* The button inside now carries the box, so the wrapper stops drawing a second
   one around it. */
.gq-add-subgoal { margin-top: var(--sp-3); }
/* "+ New step" trigger — built to read as the Quick Add bar on the dashboard
   and the task pages: same box, same tinted "+" tile, same muted prompt. Only
   the look is shared; a goal step asks for nothing but a name, so no pills for
   priority or category follow it.

   The tile keeps one colour throughout. On the dashboard the "+" is its own
   small button and fills in when the pointer is on it; here the whole bar is
   the button, so the same rule lit the tile up whenever the pointer crossed
   the strip — a change with nothing behind it. The border answers the hover. */
.goal-add-step-link {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-2);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--ease), box-shadow var(--ease);
}
.goal-add-step-link:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }

.goal-add-step-ico {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: var(--r-sm);
  background: var(--primary-s);
  color: var(--primary-ink);
}
.goal-add-step-ico svg { width: 18px; height: 18px; }
.goal-add-step-text {
  flex: 1;
  min-width: 0;
  color: var(--text-2);
  font-size: var(--text-base);
  font-weight: 500;
}

/* Typing state: the box picks up the accent border the Quick Add bar shows
   when it opens, and nothing else moves — the field stands exactly where the
   prompt stood, in the same type. */
.goal-add-step-open {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
  cursor: default;
}
.goal-add-step-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--text-1);
  font-size: var(--text-base);
  font-weight: 500;
  font-family: inherit;
  padding: 0;
  outline: none;
}
.goal-add-step-input::placeholder { color: var(--text-2); font-weight: 500; }

/* ── Habit per-day times ── */
.habit-day-times-section {
  margin-top: var(--sp-4);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border-s);
}
.habit-day-time-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) 0;
  border-bottom: 1px solid var(--border-s);
}
.habit-day-time-row:last-child { border-bottom: none; }
.habit-day-time-label {
  min-width: 90px;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-2);
}
.habit-day-time-sep {
  color: var(--text-4);
  font-size: .9rem;
}
.form-input-sm {
  max-width: 110px;
  font-size: .82rem;
  padding: var(--sp-1) var(--sp-2);
}

@media (max-width: 640px) {
  .habit-day-time-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: end;
  }
  .habit-day-time-label {
    grid-column: 1 / -1;
    min-width: 0;
  }
  .habit-day-time-row > .form-input-sm {
    width: 100%;
    max-width: none;
  }
}

@media (max-width: 360px) {
  /* The day name takes its own line so the two compact time boxes and the
     dash between them still fit side by side. */
  .habit-day-time-row:has(.timefield-sm) {
    grid-template-columns: auto auto auto;
    align-items: center;
  }
  .habit-day-time-row:has(.timefield-sm) .habit-day-time-label {
    grid-column: 1 / -1;
  }
}

.wl-list-tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 600;
}

.wl-list-tab.active .wl-list-count { background: rgba(255,255,255,.25); }

/* ── Wishlist body: filter col | separator | content ── */
.wl-body {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-5);
}

/* Nothing open - no lists yet, or the last one has just been deleted. Her
   call, 9 October 2026: the page is then the panel's "Achieved" and "New
   List" and nothing else, so the card beside it is not drawn. An empty one
   standing there was a white rectangle the height of the window next to a
   panel with two rows in it. */
#page-wishlist .wl-no-list .wl-content { display: none; }

/* ── Left sidebar card (My Wishlist / Acquired / My Lists / New List) ── */
.wl-sidebar {
  width: 230px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--border-s);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--sp-3);
}
/* An empty wishlist, holding its shape without saying anything. Her call: the
   white card stays, the sentence goes. Collapsed onto its heading it read as a
   broken strip; this gives it room instead of words. */
.wl-empty-space { min-height: 220px; }

.wl-nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  width: 100%;
  text-align: left;
  padding: 9px var(--sp-3);
  background: transparent;
  border: none;
  border-radius: var(--r-md);
  font-size: .9rem;
  font-weight: 500;
  color: var(--text-1);
  cursor: pointer;
  transition: background var(--ease);
}
.wl-nav-item:hover { background: var(--surface-2); }
/* Selected: the same as a chosen tab in Goals - her call, 2026-09-27. Both are
   "this is the one you are looking at", and they were saying it two different
   ways: a filled purple pill there, a faint grey wash here. Kept as one set of
   values with the Goals rule (.grail-seg button.on), so changing one and not
   the other puts them back out of step. */
.wl-nav-item.active {
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 2px 8px -2px rgba(124,92,252,.5);
}
.wl-nav-name {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wl-nav-section {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-4);
  padding: var(--sp-4) var(--sp-3) var(--sp-1);
}
/* Between her own lists and Achieved. Without it, Achieved sits directly under
   the "My Lists" heading's group and reads as one more list of hers - which it
   is not: it is everything already ticked off, from every list at once.

   Drawn only when there are lists above it. With none - a new account, or the
   moment after the last one went - it would be a line across the top of the
   panel with nothing on the other side of it. */
.wl-nav-rule {
  height: 1px;
  background: var(--border-s);
  margin: var(--sp-2) var(--sp-1);
}
/* The same button as Monthly Review in the Goals rail - her call, 2026-09-27.
   Three ways of saying "make a new one" in three panels that sit beside each
   other in the same menu, and the plus went with them: the word already says
   it. Kept as one set of values with .grail-review; change one and the others
   drift. */
.wl-new-list-btn {
  width: 100%;
  padding: 7px var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text-2);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--ease), color var(--ease);
}
.wl-new-list-btn:hover { background: var(--surface-hover); color: var(--text-1); }
.wl-new-list-btn svg { width: 14px; height: 14px; }
.wl-share-ico { display: inline-flex; align-items: center; color: var(--primary-ink); cursor: pointer; }
.wl-share-ico svg { width: 13px; height: 13px; }

/* ── Add-item link preview ── */
.wl-preview-area { margin-top: 8px; }
.wl-preview-msg {
  font-size: .78rem;
  color: var(--text-3);
  padding: 4px 2px;
}
.wl-preview-loading::after {
  content: '';
  display: inline-block;
  width: 11px; height: 11px;
  margin-left: 6px;
  vertical-align: -1px;
  border: 2px solid var(--border);
  border-top-color: var(--line-strong);
  border-radius: 50%;
  animation: wl-spin .6s linear infinite;
}
@keyframes wl-spin { to { transform: rotate(360deg); } }
.wl-preview-thumb {
  margin-top: 4px;
  width: 96px; height: 96px;
  border-radius: var(--radius-sm, 8px);
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.wl-preview-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Said out loud only when the automatic attempt came back empty-handed. */
.wl-preview-msg--miss { color: var(--text-2); line-height: 1.5; }
.wl-preview-msg--miss em { font-style: normal; font-weight: 600; color: var(--text-1); }

/* Sits under the thumbnail: the only handle on a picture the form otherwise
   keeps out of sight. */
.wl-img-action {
  display: block;
  background: none;
  border: none;
  padding: 0;
  margin-top: 6px;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--primary-ink);
  cursor: pointer;
}
.wl-img-action:hover { text-decoration: underline; }

.wl-filter-btn.active {
  background: var(--primary-light, #e0e7ff);
  color: var(--primary-ink);
  font-weight: 600;
}

.wl-content {
  flex: 1;
  min-width: 0;
  max-width: 940px;   /* keep the card from stretching full-width when few items */
  background: var(--surface);
  border: 1px solid var(--border-s);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--sp-5);
}

.wl-content-hdr {
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
}
.wl-content-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-1);
}
.wl-hdr-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
/* Not a row of its own here: its children become items of the header's row,
   so the list's own buttons sit exactly where they always have and "< Lists"
   stays hidden. It is a row only on a phone, where it is the bar that carries
   "< Lists" and the "..." together - her call, 9 October 2026, naming Notes
   and Goals, which read that way already. */
.wl-mobile-nav { display: contents; }
.wl-content-hdr:hover .wl-content-mgmt { opacity: 1; }

@media (max-width: 640px) {
  .wl-body { flex-direction: column; }
  .wl-sidebar { width: 100%; }
}

.wl-mobile-heading, .wl-mobile-back, .wl-mobile-count,
.wl-mobile-add, .wl-mobile-item-open { display: none; }

/* ── List tag on card (shown in "All" view) ── */
.wish-card-list-tag {
  display: inline-block;
  font-size: .68rem;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--text-3);
  padding: 1px 6px;
  border-radius: 8px;
  margin-bottom: var(--sp-2);
  border: 1px solid var(--border);
}

.wishlist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--sp-5);
  align-items: stretch;  /* one row, one height — an opened description lifts the whole row together */
}

.wish-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow var(--ease), transform var(--ease);
  display: flex;
  flex-direction: column;
}

.wish-card:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); }

.wish-card-img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-4);
  overflow: hidden;
  position: relative;
}

.wish-card-img img {
  position: relative;   /* laid over the tile underneath */
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

/* Stands in for a picture the shop would not give us. The hue comes from the
   item's own title, so a card keeps the same face every time it is drawn.
   Written in OKLCH, not HSL: the same lightness reads as the same lightness at
   every hue, which is what keeps the letter legible on a cyan tile as well as
   on a red one. Every combination clears 4.5:1 in all three themes. */
.wish-card-tile {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  --tile-bg-l: 0.95;
  --tile-bg-c: 0.055;
  --tile-ink-l: 0.46;
  --tile-host-l: 0.48;
  background: var(--surface-2);   /* for anything that cannot read oklch() */
  background: linear-gradient(145deg,
    oklch(var(--tile-bg-l) var(--tile-bg-c) var(--tile-h)),
    oklch(calc(var(--tile-bg-l) - 0.04) calc(var(--tile-bg-c) + 0.005) calc(var(--tile-h) + 26)));
}
.wish-tile-letter {
  font-size: 2.6rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text-2);
  color: oklch(var(--tile-ink-l) 0.13 var(--tile-h));
}
.wish-tile-host {
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--text-3);
  color: oklch(var(--tile-host-l) 0.07 var(--tile-h));
}
[data-theme="dark"] .wish-card-tile {
  --tile-bg-l: 0.30; --tile-bg-c: 0.045; --tile-ink-l: 0.86; --tile-host-l: 0.78;
}
[data-theme="dark"] .wish-tile-letter { color: oklch(var(--tile-ink-l) 0.09 var(--tile-h)); }
[data-theme="dark"] .wish-tile-host   { color: oklch(var(--tile-host-l) 0.05 var(--tile-h)); }

.wish-card:hover .wish-card-img img { transform: scale(1.04); }

.wish-card-body {
  padding: var(--sp-4);
  flex: 1;
  display: flex;
  flex-direction: column;
}

.wish-card-title {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: -0.2px;
  margin-bottom: var(--sp-2);
  line-height: 1.3;
}

.wish-card-desc {
  font-size: var(--text-sm);
  color: var(--text-3);
  line-height: 1.5;
  margin-bottom: var(--sp-3);
  overflow-wrap: anywhere;   /* wrap long unbroken strings so text never touches the edge */
  word-break: break-word;
}

/* The note as it was typed: line breaks and blank lines survive onto the card,
   the way they stand in the edit field. Only the text carries this — the block
   around it also holds the toggle button, which must not inherit it. */
.wish-desc-text { white-space: pre-wrap; }

/* Its own line, always. Left inline it lands wherever the last line of text
   happens to end — under the preview when the text fills the width, tacked
   onto the end of a short closing line when opened — so the one control on the
   block moves about as the block is opened and closed. */
.wish-desc-toggle {
  display: block;
  background: none;
  border: none;
  padding: 0;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--primary-ink);
  cursor: pointer;
  white-space: nowrap;
  text-align: left;
}
.wish-desc-toggle:hover { text-decoration: underline; }

.wish-card-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-2);
  padding-top: var(--sp-3);
  margin-top: auto; /* a card taller than its content still keeps the row at the foot */
  border-top: 1px solid var(--border-s);
}

/* On the card, not behind it: what you can do with an item should not depend on
   having found it with the pointer first. */
.wish-card-actions {
  display: flex;
  gap: var(--sp-1);
}

/* THAT it is taken, and nothing more. A present list that named the giver
   would spend the surprise months early; a list that said nothing at all would
   let you buy the thing yourself. */
.wish-reserved {
  margin-right: auto;
  font-size: .72rem; font-weight: 700;
  color: var(--success-text, var(--success));
  background: var(--success-s, var(--surface-2));
  padding: 4px 10px; border-radius: 999px;
}
.wish-act-done { color: var(--success); }
.wish-act-undo { color: var(--text-3); }
.wish-card-actions .btn-icon-danger { color: var(--danger); }

.wish-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--primary-ink);
  transition: opacity var(--ease);
}

.wish-link:hover { opacity: 0.75; }
.wish-link svg { width: 12px; height: 12px; }

.wishlist-toolbar .spacer { flex: 1; }

/* ------------------------------------------------------------
   21. VISION BOARD PAGE
   ------------------------------------------------------------ */

/* One mode only: a free canvas. Two panels side by side — the board list and
   the sheet — both sized so the header, the list, the whole sheet and the
   zoom controls fit on screen without scrolling the page. The height itself
   is measured at runtime (_fitShell), because the space left under the app
   header depends on the window. */
.vb-shell {
  display: flex;
  gap: var(--sp-4);
  align-items: stretch;
  min-height: 420px;
  position: relative;
}

.vbc-work-toolbar { display: contents; }
.vbc-mobile-nav, .vbc-mobile-back, .vbc-mobile-tools, .vbc-mobile-preview,
.vbc-mobile-arrow { display: none; }

/* ── Board list ── */
.vbc-boards {
  width: 232px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border-s);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--sp-4) var(--sp-3);
}
.vbc-boards-label {
  font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-4); padding: 0 var(--sp-2) var(--sp-3);
}
.vbc-boards-list {
  display: flex; flex-direction: column; gap: 2px;
  overflow-y: auto; min-height: 0; flex: 1;
}
.vbc-board {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: 10px var(--sp-3); border-radius: var(--r-md);
  background: transparent; color: var(--text-1);
  font-size: .92rem; font-weight: 500; cursor: pointer; user-select: none;
  transition: background var(--ease);
}
.vbc-board:hover { background: var(--surface-2); }
.vbc-board.active { background: var(--primary); color: #fff; font-weight: 700; }
.vbc-board-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vbc-board.editing { padding: 0; }
.vbc-board-input {
  width: 100%; box-sizing: border-box;
  font: inherit; font-weight: 600;
  padding: 10px var(--sp-3);
  border: 1px solid var(--line-strong); border-radius: var(--r-md);
  background: var(--surface); color: var(--text-1); outline: none;
}
.vbc-board-add {
  flex-shrink: 0;
  margin-top: var(--sp-2);
  width: 100%;
  padding: 7px var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text-2);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--ease), color var(--ease);
}
.vbc-board-add:hover { background: var(--surface-hover); color: var(--text-1); }
.vbc-board-add svg { width: 15px; height: 15px; }

/* ── Work panel: header, sheet, floating controls ── */
.vbc-work {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border-s);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.vbc-head {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border-s);
  flex-shrink: 0;
}
.vbc-title {
  font-size: 1.05rem; font-weight: 700; color: var(--text-1);
  letter-spacing: -.2px; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  cursor: text;
}
.vbc-title-input {
  font: inherit; font-size: 1.05rem; font-weight: 700;
  padding: 3px 8px; min-width: 200px;
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text-1); outline: none;
}
.vbc-saved {
  font-size: var(--text-xs); color: var(--text-4);
  opacity: 0; transition: opacity var(--ease); flex-shrink: 0;
}
.vbc-saved.on { opacity: 1; }
.vbc-tools { margin-left: auto; display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.vbc-tool {
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  border: none; background: transparent; border-radius: var(--r-md);
  color: var(--text-2); cursor: pointer; padding: 0;
  transition: background var(--ease), color var(--ease);
}
.vbc-tool:hover:not(:disabled) { background: var(--surface-2); color: var(--text-1); }
.vbc-tool:disabled { opacity: .35; cursor: default; }
.vbc-tool svg { width: 19px; height: 19px; }

/* Boards toggle — only on narrow screens */
.vbc-boards-toggle {
  display: none;
  width: 34px; height: 34px; align-items: center; justify-content: center;
  border: none; background: transparent; border-radius: var(--r-md);
  color: var(--text-2); cursor: pointer; padding: 0; flex-shrink: 0;
}
.vbc-boards-toggle svg { width: 18px; height: 18px; }
.vbc-backdrop { display: none; }

/* ── The sheet ── */
.vbc-stage {
  flex: 1; min-height: 0;
  overflow: auto;
  position: relative;
  margin: var(--sp-4);
  border: 1px solid var(--border-s);
  border-radius: var(--r-lg);
  background: var(--surface-2);
}
.vbc-stage.drop { border-color: var(--line-strong); box-shadow: inset 0 0 0 2px var(--primary-s, rgba(99,102,241,.35)); }
.vbc-pan { position: relative; }
.vbc-canvas {
  position: relative;
  transform-origin: 0 0;
  background-image: radial-gradient(var(--border, rgba(0,0,0,.12)) 1.1px, transparent 1.1px);
  background-size: 26px 26px;
}


/* ── Items ── */
.vbc-item {
  position: absolute;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  min-width: 60px; min-height: 48px;
  cursor: grab;
  user-select: none;
  transition: box-shadow .15s ease, border-color .15s ease;
}
.vbc-item-body {
  position: absolute; inset: 0;
  overflow: hidden;
  border-radius: var(--r-md);
  pointer-events: none;          /* clicks reach the item, so it can be dragged */
}
.vbc-item-text {
  background: var(--surface);
  border-color: var(--border-s);
  box-shadow: var(--shadow-sm);
}
.vbc-item-image { background: transparent; }
/* Words with no card behind them — straight onto the sheet. */
.vbc-item-text.vbc-nofill { border-color: transparent; box-shadow: none; }
.vbc-item-text.vbc-nofill:hover { border-color: var(--primary-s, rgba(99,102,241,.35)); }
.vbc-text-content {
  width: 100%; height: 100%;
  padding: 12px 14px;
  box-sizing: border-box;
  word-break: break-word;
  overflow: hidden;
  line-height: 1.45;
  white-space: pre-wrap;
}
/* While typing, the text has to take the pointer back off the item */
.vbc-item.vbc-editing { cursor: text; }
.vbc-item.vbc-editing .vbc-item-body { pointer-events: auto; }
.vbc-item.vbc-editing .vbc-text-content { user-select: text; outline: none; cursor: text; }

.vbc-item:hover { border-color: var(--primary-s, rgba(99,102,241,.35)); }
.vbc-item-selected {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 1px var(--primary, #6366f1);
  z-index: 5;
}

/* Four corner handles, shown when the item is selected — not on hover alone,
   because a touch screen has no hover and the handles would be unreachable. */
.vbc-handle {
  position: absolute;
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--surface, #fff);
  border: 2px solid var(--line-strong);
  opacity: 0;
  transition: opacity var(--ease);
  z-index: 15;
}
.vbc-item-selected .vbc-handle { opacity: 1; }
.vbc-h-nw { left: -6px;  top: -6px;    cursor: nwse-resize; }
.vbc-h-ne { right: -6px; top: -6px;    cursor: nesw-resize; }
.vbc-h-sw { left: -6px;  bottom: -6px; cursor: nesw-resize; }
.vbc-h-se { right: -6px; bottom: -6px; cursor: nwse-resize; }

/* Framing a picture */
.vbc-item.vbc-cropping { cursor: move; box-shadow: 0 0 0 2px var(--primary, #6366f1); }
.vbc-item.vbc-cropping .vbc-item-body { opacity: .96; }
.vbc-croptip {
  display: none;
  position: absolute; left: 50%; bottom: 62px; transform: translateX(-50%);
  z-index: 40;
  background: var(--text-1); color: var(--surface);
  font-size: var(--text-xs); font-weight: 500;
  padding: 7px 14px; border-radius: var(--r-full);
  box-shadow: var(--shadow-lg);
  white-space: nowrap;
}
.vbc-croptip.on { display: block; }

/* ── The little bar above whatever is selected ── */
.vbc-bar {
  display: none;
  position: absolute;
  transform: translate(-50%, -100%);
  z-index: 45;
  align-items: center; gap: 2px;
  background: var(--surface);
  border: 1px solid var(--border-s);
  border-radius: var(--r-full);
  box-shadow: var(--shadow-lg, 0 10px 30px -8px rgba(0,0,0,.28));
  padding: 5px 7px;
}
.vbc-bar-btn {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border: none; background: transparent; border-radius: var(--r-md);
  color: var(--text-2); cursor: pointer; padding: 0;
  transition: background var(--ease), color var(--ease);
}
.vbc-bar-btn:hover { background: var(--surface-2); color: var(--text-1); }
.vbc-bar-btn.on { background: var(--primary-s, rgba(99,102,241,.18)); color: var(--primary-ink); }
.vbc-bar-btn.danger:hover { background: var(--danger-bg, #fee2e2); color: var(--danger, #dc2626); }
.vbc-bar-btn svg { width: 17px; height: 17px; }
.vbc-bar-sep { width: 1px; height: 18px; background: var(--border); margin: 0 3px; }

/* ── Popovers (font, colour, layers, the “…” menu) ── */
.vbc-pop {
  position: fixed; z-index: 1200; min-width: 178px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg, 12px);
  box-shadow: var(--shadow-lg, 0 12px 34px -8px rgba(0,0,0,.35));
  padding: 6px; display: flex; flex-direction: column; gap: 1px;
}
.vbc-pop-row {
  text-align: left; background: transparent; border: none;
  padding: 9px 12px; border-radius: var(--r-sm, 7px);
  font-size: .9rem; color: var(--text-1); cursor: pointer; font-family: inherit;
}
.vbc-pop-row:hover { background: var(--surface-2); }
.vbc-pop-row.on { background: var(--primary-s, rgba(99,102,241,.16)); font-weight: 600; }
.vbc-pop-row.danger { color: var(--danger, #dc2626); }
.vbc-pop-row.danger:hover { background: var(--danger-bg, #fee2e2); }
.vbc-pop-sep { height: 1px; background: var(--border-s); margin: 5px 4px; }
.vbc-pop-sizes { display: flex; gap: 3px; padding: 2px; }
.vbc-pop-size {
  flex: 1; padding: 7px 0; border: 1px solid var(--border-s); border-radius: var(--r-sm);
  background: transparent; font-size: .78rem; color: var(--text-2);
  cursor: pointer; font-family: inherit;
}
.vbc-pop-size:hover { background: var(--surface-2); }
.vbc-pop-size.on { background: var(--primary); border-color: var(--line-strong); color: #fff; font-weight: 700; }
.vbc-sw-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 4px; }
.vbc-sw {
  width: 100%; aspect-ratio: 1; border-radius: 50%;
  border: 1px solid var(--border); cursor: pointer; padding: 0;
}
.vbc-sw.on { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--primary); }
.vbc-sw-none {
  background: var(--surface);
  background-image: linear-gradient(45deg, transparent 44%, var(--danger, #dc2626) 44%,
                    var(--danger, #dc2626) 56%, transparent 56%);
}
.vbc-pop-cap {
  font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-4); padding: 6px 8px 2px;
}
.vbc-pop-any {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  padding: 8px 12px; font-size: .85rem; color: var(--text-2); cursor: pointer;
}
.vbc-pop-any input { width: 34px; height: 26px; padding: 0; border: 1px solid var(--border); border-radius: var(--r-sm); background: none; cursor: pointer; }

/* ── Zoom controls, bottom right of the sheet ── */
.vbc-zoom {
  position: absolute; right: calc(var(--sp-4) + 12px); bottom: calc(var(--sp-4) + 12px);
  z-index: 30;
  display: flex; align-items: center; gap: 2px;
  background: var(--surface);
  border: 1px solid var(--border-s);
  border-radius: var(--r-full);
  box-shadow: var(--shadow-md, 0 6px 20px -6px rgba(0,0,0,.22));
  padding: 4px 6px;
}
.vbc-zoom-btn {
  width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
  border: none; background: transparent; border-radius: 50%;
  color: var(--text-2); cursor: pointer; padding: 0;
}
.vbc-zoom-btn:hover { background: var(--surface-2); color: var(--text-1); }
.vbc-zoom-btn svg { width: 15px; height: 15px; }
.vbc-zoom-val {
  font-size: .8rem; font-weight: 600; color: var(--text-2);
  min-width: 42px; text-align: center; font-variant-numeric: tabular-nums;
}

/* ── “There is more below” arrow ── */
.vbc-scrolldown {
  display: none;
  position: absolute; left: 50%; bottom: 6px; transform: translateX(-50%);
  z-index: 30;
  width: 34px; height: 34px; align-items: center; justify-content: center;
  border: 1px solid var(--border-s); background: var(--surface);
  border-radius: 50%; color: var(--text-2); cursor: pointer; padding: 0;
  box-shadow: var(--shadow-md, 0 6px 20px -6px rgba(0,0,0,.22));
}
.vbc-scrolldown.on { display: flex; }
.vbc-scrolldown:hover { color: var(--text-1); }
.vbc-scrolldown svg { width: 16px; height: 16px; }

/* ── Narrow screens: the board list slides in over the sheet ── */
@media (max-width: 860px) {
  .vbc-boards-toggle { display: flex; }
  .vbc-boards {
    position: absolute; z-index: 60; left: 0; top: 0; bottom: 0;
    width: 250px;
    transform: translateX(-108%);
    transition: transform .22s var(--ease-out, ease);
    box-shadow: var(--shadow-lg, 0 12px 34px -8px rgba(0,0,0,.35));
  }
  .vbc-boards.open { transform: translateX(0); }
  .vbc-backdrop {
    display: block; position: absolute; inset: 0; z-index: 55;
    background: rgba(0,0,0,.28);
    opacity: 0; pointer-events: none; transition: opacity .2s ease;
  }
  .vbc-backdrop.on { opacity: 1; pointer-events: auto; }
  .vbc-zoom { right: var(--sp-4); bottom: var(--sp-4); }
}

/* ------------------------------------------------------------
   22. PROFILE PAGE
   ------------------------------------------------------------ */

/* ── Progress Report + Activity ─────────────────────────────────
   The five kinds of work need five colours that stay apart from one
   another on a light and a dark background alike. Three of them are the
   app's own tokens, which already swap by theme; the other two are named
   here and swapped the same way. */
:root { --pr-step: #3B82F6; --pr-inbox: #94A3B8; }
[data-theme="dark"], [data-theme="purple"] {
  --pr-step: #60A5FA; --pr-inbox: #8FA4C4;
}
/* Solid category colours. The soft --cat-*-s tokens already carry these
   hues at low opacity; a ring and a dot need them at full strength, and
   named by the category key so the markup can reach them directly. */
:root {
  --cat-work: #3B82F6; --cat-health: #10B981; --cat-personal: #9333EA;
  --cat-finances: #EAB308; --cat-home: #F43F5E; --cat-other: #64748B;
}
[data-theme="dark"], [data-theme="purple"] {
  --cat-work: #60A5FA; --cat-health: #34D399; --cat-personal: #C084FC;
  --cat-finances: #FACC15; --cat-home: #FB7185; --cat-other: #94A3B8;
}

.pr-k-task  { background: var(--primary);   }
.pr-k-habit { background: var(--success);   }
.pr-k-step  { background: var(--pr-step);   }
.pr-k-inbox { background: var(--pr-inbox);  }

.pr-card { margin-bottom: var(--sp-3); padding: 0; }
.pr-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--sp-3); flex-wrap: wrap;
  padding: var(--sp-4) var(--sp-5) var(--sp-3);
}
.pr-sub { font-size: var(--text-xs); color: var(--text-3); margin-top: 2px; }

.pr-tabs {
  display: flex; gap: 2px; flex-shrink: 0;
  background: var(--surface-2); border: 1px solid var(--border-s);
  border-radius: var(--r-md); padding: 3px;
}
.pr-tabs button {
  padding: 5px var(--sp-3); border: none; border-radius: var(--r-sm);
  background: transparent; font-family: inherit;
  font-size: var(--text-xs); font-weight: 600; color: var(--text-3);
  cursor: pointer; transition: background var(--ease), color var(--ease);
}
.pr-tabs button:hover  { color: var(--text-1); }
.pr-tabs button.active { background: var(--surface); color: var(--text-1); box-shadow: var(--shadow-sm); }

/* The four numbers. Each column is its own question, so they are divided
   rather than merely spaced. */
.pr-stats {
  display: grid; grid-template-columns: repeat(5, 1fr);
  border-top: 1px solid var(--border-s);
}
.pr-stat { padding: var(--sp-3) var(--sp-5); border-left: 1px solid var(--border-s); min-width: 0; }
.pr-stat:first-child { border-left: none; }
.pr-stat-k { font-size: var(--text-xs); color: var(--text-3); margin-bottom: 2px; }
.pr-stat-v {
  font-size: var(--text-lg); font-weight: 700; color: var(--text-1); letter-spacing: -.3px;
  line-height: 1.2;
}
.pr-change { display: inline-flex; align-items: center; gap: 4px; }
.pr-change.up   { color: var(--success-text); }
.pr-change.down { color: var(--danger-text); }
.pr-up, .pr-down { font-size: .8em; }
.pr-none { font-size: var(--text-sm); font-weight: 600; color: var(--text-3); letter-spacing: 0; }

/* ── The chart ── */
.pr-legend { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; }
.pr-leg {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: var(--text-xs); font-weight: 600; color: var(--text-2); white-space: nowrap;
}
.pr-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

.pr-chart { padding: 0 var(--sp-5) var(--sp-4); }

/* The plot: an axis down the left, faint lines across, bars on top of both.
   The bars keep their own box so a long period can scroll sideways without
   taking the scale with it. */
.pr-plot { position: relative; padding-left: 34px; padding-top: var(--sp-4); border-top: 1px solid var(--border-s); }
.pr-axis {
  position: absolute; left: 0; top: var(--sp-4); bottom: 26px; width: 30px;
  display: flex; flex-direction: column; justify-content: space-between;
  font-size: var(--text-xs); color: var(--text-4); text-align: right;
  font-variant-numeric: tabular-nums; pointer-events: none;
}
.pr-axis span { transform: translateY(-50%); }
.pr-axis span:first-child { transform: none; }
.pr-axis span:last-child  { transform: translateY(-100%); }
.pr-grid {
  position: absolute; left: 34px; right: 0; top: var(--sp-4); bottom: 26px;
  display: flex; flex-direction: column; justify-content: space-between;
  pointer-events: none;
}
.pr-grid i { display: block; height: 1px; background: var(--border-s); }

.pr-bars {
  position: relative;
  display: flex; align-items: flex-end; gap: var(--sp-3);
  height: 190px;
  overflow-x: auto;
}
.pr-col {
  flex: 1; min-width: 34px;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  height: 100%;
}
/* The stack is the bar: each kind takes a share of it in proportion to how
   many of that kind the stretch holds. */
.pr-stack {
  width: 100%; max-width: 54px; min-height: 3px;
  display: flex; flex-direction: column-reverse;
  border-radius: var(--r-sm); overflow: hidden;
  transition: opacity var(--ease);
}
.pr-col:hover .pr-stack { opacity: .82; }
.pr-seg { display: block; width: 100%; min-height: 2px; }
.pr-col-l {
  margin-top: var(--sp-2); flex-shrink: 0;
  font-size: var(--text-xs); color: var(--text-3); white-space: nowrap;
}

/* The hover panel. It is a sibling of the bar strip rather than a child,
   because the strip scrolls sideways and would clip anything inside it. */
.pr-tip {
  position: absolute; z-index: 5; pointer-events: none;
  min-width: 138px; padding: var(--sp-3);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); box-shadow: var(--shadow-md);
  opacity: 0; visibility: hidden; transition: opacity var(--ease);
}
.pr-tip.on { opacity: 1; visibility: visible; }
.pr-tip-h {
  font-size: var(--text-xs); font-weight: 600; color: var(--text-1);
  margin-bottom: var(--sp-2); white-space: nowrap;
}
.pr-tip-r, .pr-tip-t {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: var(--text-xs); color: var(--text-2); line-height: 1.85;
}
.pr-tip-r span, .pr-tip-t span { flex: 1; white-space: nowrap; }
.pr-tip-r b, .pr-tip-t b { color: var(--text-1); font-variant-numeric: tabular-nums; }
.pr-tip-t {
  margin-top: var(--sp-2); padding-top: var(--sp-2);
  border-top: 1px solid var(--border-s); font-weight: 600;
}
.pr-tip-none { font-size: var(--text-xs); color: var(--text-3); white-space: nowrap; }
.pr-empty {
  padding: var(--sp-6) var(--sp-5) var(--sp-8);
  text-align: center; color: var(--text-3); font-size: var(--text-sm);
  border-top: 1px solid var(--border-s);
}

@media (max-width: 820px) {
  /* Two per row, so the pair that reads as a ratio — Completed and Planned —
     stays side by side on a narrow screen. An odd count leaves the last one
     alone on its row, so it takes the whole width instead of half of it: it is
     also the one whose value is a sentence rather than a number. */
  .pr-stats { grid-template-columns: repeat(2, 1fr); }
  .pr-stat:nth-child(odd) { border-left: none; }
  .pr-stat:not(:last-child) { border-bottom: 1px solid var(--border-s); }
  .pr-stat:nth-child(odd):last-child { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .pr-head { padding-left: var(--sp-4); padding-right: var(--sp-4); }
  .pr-stat { padding-left: var(--sp-4); padding-right: var(--sp-4); }
  .pr-chart { padding-left: var(--sp-4); padding-right: var(--sp-4); }
  .pr-bars { height: 190px; }
  .pr-plot { padding-left: 28px; }
  .pr-grid { left: 28px; }
}

/* ── Completion Rhythm ──────────────────────────────────────────
   Twenty-four thin bars of one colour, standing on a line.

   No axis and no grid: the question is which stretch of the day the work
   falls in, and the numbers behind the heights would answer a question
   nobody is asking. The one rule under the bars is there so they stand on
   something and the hours below it read as a scale rather than a caption. */
.rh-bars {
  display: flex; align-items: flex-end; gap: 3px;
  height: 130px;
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border-s);
  border-bottom: 1px solid var(--border-s);
}
.rh-col { flex: 1; height: 100%; display: flex; align-items: flex-end; min-width: 0; }
/* One colour for every bar. Two of them used to be picked out as the peak,
   which put the same claim in two places — the sentence under the chart says
   which stretch it is, in words — and left the rest of the day in the paler
   shade, so the hours that were not the peak read as the faint ones. The
   hover shade stays: that is an answer to the reader, not a claim. */
.rh-col i {
  display: block; width: 100%;
  background: var(--primary); border-radius: var(--r-sm) var(--r-sm) 0 0;
  transition: background var(--ease);
}
.rh-col:hover i { background: var(--primary-h); }
/* Placed, not spread: every third hour sits under the middle of the bar it
   names, so the hour the sentence below points at can actually be found.
   Spreading them evenly would slide each label a little off its own bar. */
.rh-scale {
  position: relative; height: 16px;
  margin-top: var(--sp-2);
  font-size: var(--text-xs); color: var(--text-4);
}
.rh-scale span { position: absolute; white-space: nowrap; }
.rh-foot { margin-top: var(--sp-2); font-size: var(--text-xs); color: var(--text-3); line-height: 1.7; }

/* ── Activity by Category ───────────────────────────────────────
   A ring drawn as one circle with a dashed outline: no path arithmetic,
   no wedge that rounds into a sliver, and still a circle at any size. */
.cat-body {
  display: flex; align-items: center; justify-content: center; gap: var(--sp-8);
  padding: var(--sp-4) var(--sp-5) var(--sp-5);
  border-top: 1px solid var(--border-s);
  flex-wrap: wrap;
}
/* The ring is the point of this card, so it is the larger of the two. The
   table is capped rather than stretched: given the whole width it pushed its
   numbers to the far edge, which read as a legend running away from its own
   chart. The pair is centred instead, balanced on both sides. */
.cat-ring { position: relative; width: 200px; height: 200px; flex-shrink: 0; }
.cat-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.pr-arc {
  fill: none; stroke-width: 19;
  transition: stroke-dasharray var(--ease);
}
.pr-arc-bg { stroke: var(--surface-3, var(--surface-2)); }
.cat-ring-mid {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  pointer-events: none;
}
.cat-ring-n { font-size: var(--text-lg); font-weight: 700; color: var(--text-1); letter-spacing: -.3px; }
.cat-ring-l {
  font-size: .6rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em;
  color: var(--text-4); margin-top: 1px;
}

.cat-table { flex: 0 1 380px; min-width: 240px; }
.cat-row {
  display: grid; grid-template-columns: 1fr auto auto;
  align-items: center; gap: var(--sp-3);
  padding: 6px 0;
  border-bottom: 1px solid var(--border-s);
}
.cat-row:last-child { border-bottom: none; }
.cat-head {
  border-bottom: 1px solid var(--border);
  font-size: var(--text-xs); font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-4); padding-top: 0;
}
.cat-name {
  display: flex; align-items: center; gap: 8px; min-width: 0;
  font-size: var(--text-xs); font-weight: 600; color: var(--text-1);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cat-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.cat-num {
  /* A fixed width, not a minimum: each row is its own grid, so the only thing
     holding the columns in line is that every cell in them measures the same.
     With a minimum, the header sized itself to the word "Planned" and the rows
     to their digits, and the two drifted apart. */
  width: 62px; text-align: right;
  font-size: var(--text-xs); font-variant-numeric: tabular-nums;
}
.cat-plan { color: var(--text-3); }
.cat-done { color: var(--text-1); font-weight: 700; }

@media (max-width: 700px) {
  .cat-body { gap: var(--sp-5); padding-left: var(--sp-4); padding-right: var(--sp-4); justify-content: center; }
  .cat-table { min-width: 100%; }
}

/* ── Account card ──────────────────────────────────────────────
   Read straight down: who you are, what you are paying for, and the
   one thing you might want to do about it. The action is a row, not a
   button, so it has room to say where it leads. */
.acct-card { margin-bottom: var(--sp-3); padding: 0; overflow: hidden; }

/* The same card as before, one step quieter throughout: every size drops a
   rung on the scale and the padding comes in with it. Nothing moved — a name
   set at 30px was simply louder than anything else on a page of reports. */
.acct-id { padding: var(--sp-4) var(--sp-5); }
.acct-label {
  font-size: .6rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-4); margin-bottom: var(--sp-2);
}
.acct-name-row { display: flex; align-items: baseline; gap: var(--sp-3); min-width: 0; }
.acct-name {
  font-size: var(--text-md); font-weight: 700; color: var(--text-1);
  letter-spacing: -.2px; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* The name IS the field, the way a step's title is in the Goals inspector.
   It carries no border until you reach for it, so the card reads as a card
   and not as a form. */
.acct-name {
  width: 100%; font-family: inherit;
  border: 1px solid transparent; border-radius: var(--r-sm);
  background: transparent; padding: 2px 6px; margin-left: -6px;
  transition: border-color var(--ease), background var(--ease);
}
.acct-name:hover { border-color: var(--border-s); }
.acct-name:focus {
  outline: none; border-color: var(--line-strong); background: var(--surface);
}
.acct-name::placeholder { color: var(--text-4); font-weight: 400; }
.acct-email {
  display: flex; align-items: baseline; gap: var(--sp-2);
  margin-top: var(--sp-2); min-width: 0;
}
.acct-email-k { font-size: var(--text-xs); color: var(--text-3); flex-shrink: 0; }
.acct-email-v {
  font-size: var(--text-sm); font-weight: 600; color: var(--text-1);
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* The plan facts sit under the identity, edge-to-edge divider above them. */
.acct-facts {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-5);
  border-top: 1px solid var(--border-s);
}
.acct-fact { min-width: 0; }
.acct-fact-k { font-size: var(--text-xs); color: var(--text-3); margin-bottom: 2px; white-space: nowrap; }
.acct-fact-v {
  font-size: var(--text-sm); font-weight: 700; color: var(--text-1);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.acct-fact-v.acct-ok    { color: var(--success-text); }
.acct-fact-v.acct-muted { color: var(--text-3); }

/* The action. Its divider is inset, because it separates two things inside
   the same card rather than two halves of it. */
.acct-action { padding: 0 var(--sp-5) var(--sp-3); }
/* The row sits inside a padded box, so it carries no side padding of its own —
   two lots of it left the action indented past every other line in the card. */
.acct-action .acct-row {
  border-top: 1px solid var(--border-s);
  padding: var(--sp-3) 0 0;
}

.acct-row {
  display: flex; align-items: center; gap: var(--sp-3);
  width: 100%; text-align: left;
  padding: var(--sp-3) var(--sp-5);
  background: transparent; border: none; font-family: inherit;
  cursor: pointer; color: inherit;
}
.acct-row-static { cursor: default; }
.acct-row-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.acct-row-t {
  font-size: var(--text-sm); font-weight: 600; color: var(--primary-ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.acct-row-static .acct-row-t { color: var(--text-1); }
.acct-row:not(.acct-row-static):hover .acct-row-t { color: var(--primary-h); text-decoration: underline; }
.acct-row[disabled] { opacity: .6; cursor: default; }

/* The line under the section name. The row used to be one word — the action,
   in purple, doubling as its own button. Now the name and the explanation sit
   on the left as plain text and the press is a button of its own on the right,
   the same shape Settings uses for Change Password and Contact support. */
.acct-row-d {
  font-size: var(--text-xs);
  color: var(--text-3);
  line-height: 1.5;
  white-space: normal;
}

/* Secondary, in the app's own violet rather than grey: this is the one action
   on the page that is worth money. */
.acct-sub-btn {
  background: var(--primary-s);
  color: var(--primary-ink);
  border: 1px solid transparent;
}
.acct-sub-btn:hover { border-color: var(--primary); }

/* A way back to a subscription for somebody the app does NOT think is Pro.
   Quiet on purpose: most people reading it have never paid, and the one who
   has is the one who needs it most. */
.acct-sub-more { margin-top: var(--sp-3); }
.acct-link {
  background: none; border: 0; padding: 0; font: inherit; cursor: pointer;
  color: var(--text-muted); font-size: var(--text-xs); text-decoration: underline;
  text-underline-offset: 2px;
}
.acct-link:hover { color: var(--primary); }

/* A phone has no room for a sentence and a button side by side. */
@media (max-width: 480px) {
  .acct-action .acct-row { flex-direction: column; align-items: stretch; gap: var(--sp-3); }
  .acct-sub-btn { width: 100%; padding: 9px var(--sp-5); }
}

.acct-row-link {
  flex-shrink: 0;
  font-size: var(--text-xs); font-weight: 600; color: var(--primary-ink);
  text-decoration: none;
}
.acct-row-link:hover { color: var(--primary-h); text-decoration: underline; }

@media (max-width: 640px) {
  .acct-facts { grid-template-columns: 1fr 1fr; }
  .acct-row { gap: var(--sp-3); padding-left: var(--sp-4); padding-right: var(--sp-4); }
  .acct-action { padding-left: var(--sp-4); padding-right: var(--sp-4); }
  .acct-row-link span { display: none; }
}

.profile-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-4);
}

.profile-stat {
  background: var(--surface-2);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  text-align: center;
}

.profile-stat-value {
  font-size: var(--text-2xl);
  font-weight: 800;
  color: var(--text-1);
  letter-spacing: -0.5px;
  line-height: 1;
  margin-bottom: 4px;
}

.profile-stat-label {
  font-size: var(--text-xs);
  color: var(--text-3);
  font-weight: 500;
}

/* Achievement badges */
.badges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--sp-4);
}

.achievement-badge {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  text-align: center;
  transition: all var(--ease);
  position: relative;
  overflow: hidden;
}

.achievement-badge:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.achievement-badge.locked {
  opacity: 0.45;
  filter: grayscale(0.6);
}

.achievement-badge.unlocked {
  border-color: var(--warning);
  background: linear-gradient(135deg, var(--warning-s) 0%, transparent 100%);
}

.badge-emoji {
  font-size: 28px;
  line-height: 1;
  margin-bottom: var(--sp-2);
  display: block;
}

.badge-desc {
  font-size: 10px;
  color: var(--text-3);
  line-height: 1.4;
}

.badge-unlocked-mark {
  position: absolute;
  top: var(--sp-2);
  right: var(--sp-2);
  width: 16px;
  height: 16px;
  background: var(--warning);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
}

.profile-day-progress {
  padding: var(--sp-5) var(--sp-6);
}

.profile-day-value {
  font-size: var(--text-3xl);
  font-weight: 800;
  color: var(--text-1);
  letter-spacing: -1px;
  line-height: 1;
  margin-bottom: 4px;
}

.profile-day-label {
  font-size: var(--text-sm);
  color: var(--text-3);
  margin-bottom: var(--sp-4);
}

/* ------------------------------------------------------------
   23. EMPTY STATES
   ------------------------------------------------------------ */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 50vh;
  min-height: 50dvh;
  padding: var(--sp-12) var(--sp-6);
  color: var(--text-3);
}

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

.empty-state h3 {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-2);
  margin-bottom: var(--sp-2);
}

.empty-state p {
  font-size: var(--text-sm);
  color: var(--text-3);
  max-width: 300px;
  line-height: 1.6;
  margin-bottom: var(--sp-5);
}

/* ------------------------------------------------------------
   24. UTILITY / HELPERS
   ------------------------------------------------------------ */

.flex       { display: flex; }
.mb-5       { margin-bottom: var(--sp-5); }
.mt-4       { margin-top: var(--sp-4); }
.hidden     { display: none; }

/* Divider */
.divider {
  border: none;
  border-top: 1px solid var(--border-s);
  margin: var(--sp-4) 0;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Separator dot */
.sep { color: var(--text-4); }

/* ------------------------------------------------------------
   25. RESPONSIVE
   ------------------------------------------------------------ */

@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .cal-layout { grid-template-columns: 1fr; }
  }

@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }
  .sidebar {
    transform: translateX(-248px);
    width: 248px;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-xl);
  }
  .sidebar-overlay.active { display: block; }
  .main-wrapper { margin-left: 0; }
  .menu-toggle { display: flex; }
  .top-header { padding: 0 var(--sp-5); }
  .page-container { padding: var(--sp-5); }
  .header-username { display: none; }
}

@media (max-width: 680px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .wishlist-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
  .form-row { grid-template-columns: 1fr; }
  .profile-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .badges-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .header-date-chip { display: none; }
  .cal-layout { gap: var(--sp-4); }
  .wishlist-grid { grid-template-columns: 1fr; }
  .modal { border-radius: 0; }
  .modal-wrapper { align-items: flex-end; padding: 0; }
  /* Her call, 8 October 2026: the two reports are a page of their own, not a
     card stuck to the bottom of the one behind it. A short report left half
     the screen showing the page it came from. Only on a phone — on a desktop
     a report is a window in the middle, as it always was.

     Her call, 14 October 2026: the reviews join them — End of Day, Monthly,
     Quarterly and the deadline windows. She remembered the phone windows being
     put right and took that to mean full screen; what 2 October actually did
     (7bca65e) was CAP every window to the screen and let the middle scroll,
     which leaves a short one short. These four are a sitting she works through,
     not a card, so they now fill the screen the reports do.

     Morning Review is deliberately NOT on the list. She has said twice she
     does not want it touched, and that is hers to change, not mine. */
  .modal.modal-full-phone { height: 100%; }
  /* Filling the screen is only worth it if the report fills it too: the middle
     of a window does not stretch by itself, so a short report left the lower
     half blank. And a window with no buttons still kept the strip they would
     have stood in. */
  .modal.modal-full-phone .modal-body { flex: 1; }
  .modal.modal-full-phone .modal-footer:empty { display: none; }
}

/* ============================================================
   TASKS REDESIGN - Inbox + Day Groups
   ============================================================ */

/* ── Top control bar ── */
.tasks-control-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
  flex-wrap: wrap;
}

.tasks-view-tabs {
  display: flex;
  gap: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 4px;
}

.tasks-view-tab {
  padding: var(--sp-2) var(--sp-4);
  border: none;
  border-radius: calc(var(--r-lg) - 2px);
  background: transparent;
  color: var(--text-3);
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--ease);
  white-space: nowrap;
}

.tasks-view-tab:hover {
  color: var(--text-1);
  background: var(--surface-3);
}

.tasks-view-tab.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.15);
}

/* ── Empty state ── */
.tasks-empty-state {
  text-align: center;
  padding: var(--sp-10) var(--sp-6);
  color: var(--text-3);
  font-size: var(--text-sm);
}

/* Two-level empty text, matching Notes / Wishlist / Vision Board. */
.tasks-empty-state h3 {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-2);
  margin-bottom: var(--sp-2);
}
.tasks-empty-state p {
  font-size: var(--text-sm);
  color: var(--text-3);
  max-width: 300px;
  margin: 0 auto;
  line-height: 1.6;
}
/* By Day empty state: center the whole block (header + hint + button) vertically
   in the available area, matching Notes / Wishlist / Vision Board / Goals. */
.tasks-empty-state-centered {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 50vh;
  min-height: 50dvh;
}

/* Two-column page grid (main + sidebar) */
.tasks-page-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-6);
  align-items: start;
}
/* A grid child will not shrink below its own contents unless it is told it
   may: `min-width` on a grid item defaults to `auto`, which means "as wide as
   what is inside me". A column then computes WIDER than the grid holding it,
   and the page runs off the side — hidden by `overflow-x: hidden` on the body,
   so it reads as a cut-off page rather than one that scrolls.
   Measured 4 Oct 2026: at a 320px screen this grid was 275 wide and its one
   column 318.5. Gone at 359, so only the narrowest phones ever saw it. */
.tasks-page-grid > * { min-width: 0; }

.inbox-task .task-actions {
  display: flex;
  gap: var(--sp-1);
  opacity: 0;
  transition: opacity var(--ease);
  flex-shrink: 0;
  min-width: 108px;
  justify-content: flex-end;
}

.inbox-task:hover .task-actions { opacity: 1; }

/* The line that says a list is empty, for Today, Inbox, By Day, Habits and
   History. Upright, not italic: her call, 2026-09-27. It is a plain statement
   of fact, not an aside, and the slant read as a whisper on a sentence that is
   simply true. One class, so the five cannot drift apart again. */
.inbox-empty-msg {
  padding: var(--sp-6) var(--sp-5);
  font-size: var(--text-sm);
  color: var(--text-3);
  text-align: center;
  /* Split evenly rather than filling the first line and leaving one word
     stranded on the second. The Goals rail is narrow enough for that to happen
     to almost any sentence, and it read as a mistake. */
  text-wrap: balance;
  line-height: 1.6;
}

.tasks-stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 0;
  border-bottom: 1px solid var(--border-s);
  font-size: var(--text-sm);
}

.tasks-stat-row:last-child { border-bottom: none; }
.tasks-stat-key { color: var(--text-2); font-weight: 500; }
.tasks-stat-val { font-weight: 700; color: var(--text-1); }

/* Custom category badge - neutral teal */
.cat-custom {
  background: rgba(6,182,212,.13);
  color: #06B6D4;
  border: 1px solid rgba(6,182,212,.3);
}

.donut-legend-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-xs);
}

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

.donut-legend-cat {
  flex: 1;
  color: var(--text-2);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.donut-legend-pct {
  font-weight: 700;
  color: var(--text-1);
  flex-shrink: 0;
}

.donut-empty {
  text-align: center;
  padding: var(--sp-4) 0 var(--sp-2);
  color: var(--text-3);
  font-size: var(--text-sm);
  line-height: 1.5;
}

.past-toggle-btn.expanded .past-toggle-chevron {
  transform: rotate(180deg);
}

/* ============================================================
   DASHBOARD REDESIGN - New classes
   ============================================================ */

/* ── Stats row ── */
.dash-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}
@media (max-width: 860px) {
  .dash-stats-row { grid-template-columns: repeat(2, 1fr); }
}

/* Stat card: label on top, big number below */
.dash-stat {
  background: var(--surface);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-s);
  border-left-width: 3px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  transition: box-shadow var(--ease);
}
.dash-stat:hover { box-shadow: var(--shadow-md); }

.dash-stat.c-success { border-left-color: var(--success); }
.dash-stat.c-primary  { border-left-color: var(--line-strong); }
.dash-stat.c-warning  { border-left-color: var(--warning); }
.dash-stat.c-purple   { border-left-color: var(--purple);  }

.dash-stat-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: .03em;
}
.dash-stat-value {
  font-size: var(--text-2xl);
  font-weight: 800;
  color: var(--text-1);
  line-height: 1.1;
  margin-top: 1px;
}
.dash-stat-sub {
  font-size: var(--text-xs);
  color: var(--text-3);
  margin-top: 2px;
}

/* ── Two-column layout ── */
.dash-two-col {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: var(--sp-4);
  align-items: start;
  margin-bottom: var(--sp-4);
}
@media (max-width: 1100px) {
  .dash-two-col { grid-template-columns: 1fr; }
  /* A grid child will not shrink past its own content unless it is told it
     may: without this the cards keep their desktop width on a phone and the
     whole page scrolls sideways, which also drags every centred dialog half
     off the screen. */
  .dash-two-col > * { min-width: 0; }
}

/* ── Task list card (left) ── */
.dash-tasks-card {
  display: flex;
  flex-direction: column;
}
.dash-tasks-hdr {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5) var(--sp-3);
  border-bottom: 1px solid var(--border-s);
  flex-wrap: wrap;
}
.dash-hdr-right {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

/* ── Sort toggle ── */
.sort-toggle {
  display: flex;
  background: var(--surface-2);
  border-radius: var(--r-sm);
  padding: 2px;
  gap: 2px;
}
.sort-toggle button {
  padding: 4px 10px;
  font-size: var(--text-xs);
  font-weight: 600;
  border-radius: calc(var(--r-sm) - 2px);
  color: var(--text-3);
  border: none;
  background: transparent;
  cursor: pointer;
  transition: all var(--ease);
  white-space: nowrap;
}
.sort-toggle button:hover { color: var(--text-1); }
.sort-toggle button.active {
  background: var(--surface);
  color: var(--primary-ink);
  box-shadow: var(--shadow-sm);
}

/* ── Quick Add bar (Tasks: Dashboard / Inbox / By Day) ── */
.quick-add {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  /* One consistent filled colour in both states (collapsed & expanded); the
     pills are white so they keep contrast against it. */
  background: var(--surface-2);
  margin-bottom: var(--sp-4);
  transition: border-color var(--ease), box-shadow var(--ease);
}
.quick-add.expanded {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
}
.quick-add-form {
  margin: 0;
}
/* Inside a card (Dashboard Today, Inbox) inset the bar from the card edges so
   it lines up with the header text instead of touching the border. The By Day
   bar sits at page level (not a card child) and stays full-width with the day
   cards below it. */
.card > .quick-add {
  margin-top: var(--sp-4);
  margin-left: var(--sp-5);
  margin-right: var(--sp-5);
}
.quick-add-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
}
/* Filled purple "+" tile */
.quick-add-ico {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: var(--r-sm);
  /* Tinted rather than filled: at full strength this was the loudest thing on
     a page of quiet task rows, for an action that is always available and
     never urgent. The shape stays, so it still reads as a button. */
  background: var(--primary-s);
  color: var(--primary-ink);
}
/* The tile keeps one colour throughout. It marks where a new task begins and
   opens the field when pressed — it does not submit, so there is no state for
   it to announce, and lighting it up on the way past said something happened
   when nothing had. The bar's own border answers the hover. */
.quick-add-open { cursor: pointer; }
.quick-add-ico svg { width: 18px; height: 18px; }
.quick-add-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--text-1);
  font-size: var(--text-base);
  font-weight: 500;
  font-family: inherit;
  padding: 0;
  outline: none;
}
.quick-add-input::placeholder { color: var(--text-2); font-weight: 500; }

.quick-add-panel {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4) var(--sp-4);
  border-top: 1px solid var(--border-s);
}
/* An explicit display above would otherwise beat the [hidden] UA rule. */
.quick-add-panel[hidden] { display: none; }
.qa-field {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.qa-field-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-3);
}
.qa-pills {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}
.qa-pill {
  padding: 7px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  /* White so the pills stand out against the lavender bar background. */
  background: var(--surface);
  color: var(--text-2);
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--ease);
  white-space: nowrap;
}
.qa-pill:hover {
  border-color: var(--line-strong);
  color: var(--text-1);
}
.qa-pill.selected {
  background: var(--primary);
  border-color: var(--line-strong);
  color: var(--primary-text);
}
.qa-date-input { max-width: 200px; }
.qa-deadline-toggle {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
}
.qa-deadline-toggle svg { width: 16px; height: 16px; }
/* Same width as the Date field above it — they are the same kind of input and
   sat a few pixels apart at different sizes. */
.qa-deadline-field .optdate-field { width: min(200px, 100%); }

/* ── Habit type toggle (General vs Specific time) ── */
.habit-type-toggle {
  display: flex;
  background: var(--surface-2);
  border-radius: var(--r-sm);
  padding: 3px;
  gap: 3px;
}
.habit-type-btn {
  flex: 1;
  padding: 8px 12px;
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: calc(var(--r-sm) - 2px);
  color: var(--text-3);
  border: none;
  background: transparent;
  cursor: pointer;
  transition: all var(--ease);
  white-space: nowrap;
}
.habit-type-btn:hover { color: var(--text-1); }
.habit-type-btn.active {
  background: var(--surface);
  color: var(--primary-ink);
  box-shadow: var(--shadow-sm);
}

/* ── Task list ── */
/* Today's list is shown whole. It used to sit in a 500px box with a scrollbar
   of its own, which hid the end of a long day, hid the completed items under
   it, and hid the button below — and a panel that scrolls inside a page that
   also scrolls is worst of all on a phone, where the wrong one moves under
   your thumb. The card simply grows, and the page scrolls as a page. */
.dash-task-list {
  flex: 1;
  /* The list is the last thing in the card now that the footer button is gone,
     so its bottom corners have to follow the card's own. Without this a hovered
     last row paints a square corner over the rounded one. */
  border-bottom-left-radius:  var(--r-lg);
  border-bottom-right-radius: var(--r-lg);
  overflow: hidden;
}
/* This Week is the exception, and keeps its own panel: seven day cards is a
   great deal of page, and the view scrolls itself to today when it opens
   (scrollWeekTo) — which needs something that scrolls. */
.dash-task-list-week {
  background: var(--surface-2);
  padding: var(--sp-4);
  overflow-y: auto;
  max-height: 500px;
}
.dash-weekcard { margin-bottom: var(--sp-4); border-color: transparent; overflow: hidden; }
.dash-weekcard:last-child { margin-bottom: 0; }
.dash-weekcard .dash-tasks-hdr { border-bottom: 1px solid var(--border-s); }
.dash-weekcard-hdr { cursor: pointer; }
.dash-weekcard-hdr:hover .card-title { color: var(--primary-ink); }
/* The primary border marks the ONE selected day (drives the right calendar).
   Today is identified by its TODAY tag + coloured title and a neutral edge —
   it only gets the primary border when it is itself the selected day, so the
   selection never "competes" with today. */
.dash-weekcard-sel   { border: 2px solid var(--line-strong); }
.dash-weekcard-today:not(.dash-weekcard-sel) { border-color: var(--border-s); }
.dash-weekcard-today .card-title { color: var(--primary-ink); }
.dash-weekcard-today-tag {
  color: var(--primary-ink);
  font-weight: 800;
  letter-spacing: .03em;
  margin-right: 7px;
}

.dash-task-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-5);
  border-bottom: 1px solid var(--border-s);
  transition: background var(--ease);
  min-height: 40px;
}
.dash-task-row:last-child { border-bottom: none; }
.dash-task-row:hover { background: var(--surface-2); }
.dash-task-row.done { opacity: .5; }

/* Actions area on the right of every unified task row */
.tasks-row-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-shrink: 0;
  min-width: 108px;
  justify-content: flex-end;
}
/* All action buttons hidden until hover - instant (no fade) so nothing appears to move */
.tasks-row-actions .task-sched-btn { opacity: 0; transition: none; }
.tasks-row-actions .task-actions   { opacity: 0; transition: none; }
.dash-task-row:hover .tasks-row-actions .task-sched-btn { opacity: 1; }
.dash-task-row:hover .tasks-row-actions .task-actions   { opacity: 1; }

/* Habit frequency label - always visible, sits before the edit/delete buttons */
.habit-rec-label {
  font-size: var(--text-xs);
  color: var(--text-3);
  white-space: nowrap;
  flex-shrink: 0;
}
.habits-list-row { align-items: flex-start; }
.habits-list-row .dash-task-content { flex-direction: column; align-items: flex-start; gap: 6px; }
.habits-list-row .dash-task-title { white-space: normal; overflow-wrap: anywhere; overflow: visible; }
.habits-list-row .habit-rec-label { white-space: normal; overflow-wrap: anywhere; max-width: 100%; }

.dash-task-content {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.dash-task-title {
  flex: 1;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-task-title.done {
  /* No strike-through — that reads as "skipped". The green check + muted color
     is the completed signal. */
  color: var(--text-3);
}

/* ── Extra-small badge ── */
.badge.badge-xs, .badge-xs {
  font-size: 10px !important;
  padding: 1px 6px !important;
  line-height: 1.5;
}

/* ── Right column ── */
.dash-right-col { display: flex; flex-direction: column; }

/* ── Agenda card ── */
.agenda-card { display: flex; flex-direction: column; }

.agenda-slots {
  height: 430px; /* ~12 visible slots at 36px each = 6 am - 6 pm */
  overflow-y: auto;
  scroll-behavior: smooth;
  position: relative; /* so child slot.offsetTop is measured against this scroll box */
}

/* The same agenda inside the Calendar's Day view, where the page gives it the
   whole column: the grid's own height, not the dashboard card's. */
.agenda-card-cal .agenda-slots { height: 580px; }

.agenda-slot {
  display: flex;
  align-items: stretch;
  gap: 0;
  min-height: 48px; /* uniform hour height so a 1-hour event fits its slot (Mac Calendar look) */
  border-bottom: 1px solid var(--border-s);
  transition: background var(--ease);
  position: relative;
}
.agenda-slot:last-child { border-bottom: none; }
/* One tone per line: the tile is the only colour. A band behind it — a tint for
   "there is something here", another for the current hour — made every filled
   row read as two shades of the same thing. The hour still marks itself: its
   label turns, and the red line crosses the row. */
.agenda-slot.agenda-slot-drop-target { background: var(--accent-s); outline: 2px dashed var(--accent); outline-offset: -2px; }

.agenda-time {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-4);
  width: 60px;
  flex-shrink: 0;
  padding: 0 var(--sp-2) 0 var(--sp-3);
  line-height: 1;
  /* Keep "4 pm" / "12 pm" on a single line (the space must not wrap). */
  white-space: nowrap;
  /* Centered ON the hour gridline (Mac Calendar style), not below it. */
  align-self: flex-start;
  transform: translateY(-50%);
}
.agenda-slot.is-now .agenda-time { color: var(--primary-ink); font-weight: 800; }

.agenda-content {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  padding: 4px var(--sp-3) 4px var(--sp-2);
  min-height: 48px;
  border-radius: var(--r-xs);
  transition: background var(--ease);
}
.agenda-content:hover { background: rgba(79,99,232,.05); }

/* Current-time indicator (Mac Calendar style): a red pill label sitting in
   the left time gutter + a thin line crossing the whole row at the exact
   minute (inline `top`), overlaid ON any event it passes through. No dot. */
.agenda-now-line {
  position: absolute;
  left: var(--sp-3); /* line the red pill up with the hour labels' column (their padding-left) */
  right: var(--sp-3);
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
  pointer-events: none;
  z-index: 5;
}
.agenda-now-line::after {
  content: '';
  flex: 1;
  height: 2px;
  background: #ef4444;
  border-radius: 1px;
}
.agenda-now-label {
  flex: 0 0 auto;
  text-align: center;
  font-size: 9px;
  font-weight: 700;
  line-height: 1.2;
  color: #fff;
  background: #ef4444;
  padding: 1px 5px;
  border-radius: 999px;
  /* Compact enough to stay within the time gutter and never cross the event's
     coloured left bar (24h shows no meridiem; 12h appends a small am/pm). */
  white-space: nowrap;
}
.agenda-now-mer {
  font-size: 7px;
  font-weight: 700;
  margin-left: 1px;
  text-transform: lowercase;
}

/* Events inside agenda */
/* Washed in its own colour, the same 15% the month chips and week blocks use,
   so one thing keeps one colour wherever it is drawn: an event or task purple,
   a habit blue, a goal step deep blue. The colour is the whole tile — no left
   bar, because neither the month nor the week draws one. --evt-color per row. */
.agenda-event {
  padding: 3px 8px;
  border-radius: var(--r-sm);
  background: color-mix(in srgb, var(--evt-color, var(--accent)) 15%, transparent);
  cursor: grab;
  user-select: none;
  transition: opacity var(--ease), transform var(--ease);
}
.agenda-event:active { cursor: grabbing; }
.agenda-event:hover { transform: translateX(2px); opacity: .9; }
.agenda-event.agenda-event-dragging { opacity: .35; transform: scale(.98); }

/* Habits in the agenda - same shape as a task, in the habit colour,
   just checkable on click */
.agenda-event-habit {
  cursor: pointer;
  draggable: false;
}
.agenda-event-habit:hover { opacity: .85; transform: translateX(2px); }
.agenda-event-habit-done .agenda-event-title {
  text-decoration: line-through;
  opacity: .55;
}
.agenda-event-habit-done { opacity: .7; }

.agenda-event-title {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.agenda-event-time {
  font-size: 10px;
  color: var(--text-3);
  font-weight: 500;
}

/* One shape for every chip that sits in the badge slot at the end of a row.
   The window decides the colour and the word; the size is not the window's to
   choose, or the same slot reads as a different kind of thing in each of the
   three reviews — which is exactly what it did: 9px here, 11px in the goal
   review, and 11px again at a heavier weight for an overdue mark. */
.sort-badge,
.grv-late-chip,
.grv-planned {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: .04em;
  padding: 1px 6px;
  border-radius: var(--r-full);
  white-space: nowrap;
}
/* Theme-aware ink tokens so these small labels clear WCAG AA on the soft tint. */
.sort-badge--high   { background: var(--danger-s);  color: var(--danger-text);  }
.sort-badge--medium { background: var(--warning-s); color: var(--warning-text); }
.sort-badge--low    { background: var(--surface-2); color: var(--text-2);        }
/* Category sort-badge — each category in its own colour on the task list
   (the Quick Add pills stay neutral). Mirrors the .cat-* palette. */
.sort-badge--cat-work     { background: var(--cat-work-s);   color: var(--cat-work-text);   }
.sort-badge--cat-health   { background: var(--cat-health-s); color: var(--cat-health-text); }
.sort-badge--cat-personal { background: var(--cat-pers-s);   color: var(--cat-pers-text);   }
.sort-badge--cat-finances { background: var(--cat-fin-s);    color: var(--cat-fin-text);    }
.sort-badge--cat-home     { background: var(--cat-home-s);   color: var(--cat-home-text);   }
.sort-badge--cat-other    { background: var(--surface-2); color: var(--text-2);        }
.sort-badge--habit  { background: var(--teal-s);    color: var(--teal-text);    }
.sort-badge--goal   { background: var(--primary-s); color: var(--primary-h);    }
/* For a chip that names what KIND of row this is rather than how urgent it is:
   the deadline window tags a plain task, and a plain task has no colour of its
   own to borrow. */
.sort-badge--plain  { background: var(--surface-2); color: var(--text-2);       }

/* "Carried since <date>" — cut to the same pattern as the deadline pill beside
   it: same type, same padding, same radius. Two chips on one row in two
   different sizes read as two different kinds of thing, and these are the same
   kind of thing — a date the task is measured against. The tint separates
   them: the deadline is the task's own date, this one is the app's note that
   the task keeps sliding. */
/* The two dates travel together. On a wide screen the wrapper is not a box at
   all — `contents` hands its two children straight to the row, which is where
   they stood before it existed, so the desktop row is unchanged. On a phone it
   becomes the box that holds them side by side. */
.task-dates { display: contents; }

.task-carried {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .70rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: var(--r-full);
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: 2px;
  color: var(--text-3);
  background: var(--primary-s);
}

.dash-task-row.habit-skipped { opacity: .45; }
.dash-task-row.habit-skipped .dash-task-title { text-decoration: line-through; }

/* ── Past view: read-only historical rows + inline state tags ── */
.past-row { cursor: default; }
.past-row .task-checkbox { cursor: default; }
.past-tag {
  display: inline-block;
  margin-left: var(--sp-2);
  font-size: .62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 1px 6px;
  border-radius: 999px;
  vertical-align: middle;
}
.past-tag--skip  { background: var(--surface-2); color: var(--text-2);       }
/* A day that handed its work on. Borrows the "Carried since" pill rather than
   the uppercase tags beside it: both say the same quiet thing — this one slid —
   and neither is an alarm, so neither should shout. */
.past-tag--moved {
  font-size: .70rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: normal;
  padding: 2px 10px;
  color: var(--text-3);
  background: var(--primary-s);
}

.dash-task-section-divider {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-5);
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .06em;
  background: var(--surface-3);
  border-top: 1px solid var(--border-s);
  border-bottom: 1px solid var(--border-s);
}

/* ── Bottom row: Goals (compact) + Donut (large, equal halves) ── */
.dash-bottom-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4);
  align-items: stretch; /* equal heights */
}
/* The same rule as the Tasks grid above, and it was already here — but only
   inside the narrow query below, where this grid is ONE column. Two columns
   is the case that needs it more: measured 4 Oct 2026, at 1024px the row was
   707 wide and its two columns 422.6 + 381.7 = 804, so the chart ran 81px off
   the right of the page. Worst between 901 and 1100, which is a laptop and an
   iPad held sideways. */
.dash-bottom-row > * { min-width: 0; }
@media (max-width: 860px) {
  .dash-bottom-row { grid-template-columns: 1fr; }
  /* The min-width line that used to be here said the same as the rule above
     and only below 860, which is why the two-column case kept the fault. */
}

.dash-goals-card { display: flex; flex-direction: column; }
.dash-donut-card  { display: flex; flex-direction: column; }

/* Goals body - compact spacing */
.dash-goals-body {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  flex: 1;
  min-height: 0;        /* allow the body to shrink within the card… */
  overflow-y: auto;     /* …and scroll instead of clipping extra goals */
}
.dash-goal-row { display: flex; flex-direction: column; gap: 3px; cursor: pointer; border-radius: var(--r-sm); transition: background var(--ease); padding: 2px 0; }
.dash-goal-row:hover { background: var(--surface-2); }

/* Compact one-line row: name · steps · bar · % */
/* Name on the left, steps/bar/percent on the right — until the name is down to
   300px, when the three of them move to a line of their own.

   300px is a measured number, not a guess. Her call, 14 October 2026: the
   three were still fitting beside the name while the name itself was being
   folded into three short lines to let them, and she wants the row to give up
   earlier than that — "nawet jak progress line sie misci to i tak ma juz
   trafiac na nastepna linijke". Measured in the real app, card by card: the
   group needs 176px with its gap, so the row breaks once the name is left
   less than 300. Below that a name of any ordinary length starts folding; at
   1440 the row is 506 wide and the name keeps 330, so a full screen is
   untouched, and both goals in the card always break at the same width
   instead of one of them looking different from the other. */
.dash-goal-line { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.dash-goal-heading { display: flex; flex: 1 1 300px; align-items: flex-start; justify-content: space-between; gap: var(--sp-2); min-width: 0; }
.dash-goal-title {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-1);
  flex: 0 1 auto;
  min-width: 0;
  overflow-wrap: break-word;   /* see .gws-title-text: never `anywhere` in a flex row */
  white-space: normal;
}
.dash-goal-cat { flex: none; }
/* The three of them travel together. On a line of their own they begin where
   the name begins — her call, 14 October 2026, after seeing them stranded
   against the right edge with a hand's width of nothing to their left. No
   margin pushes them there: .dash-goal-heading above grows into whatever the
   row has spare, so while the three still fit beside the name they are held
   at the end of the row, and the moment they drop to their own line they
   start at its beginning. */
.dash-goal-meta { display: flex; align-items: center; gap: var(--sp-2); flex: none; }
.dash-goal-steps { font-size: .68rem; color: var(--text-3); flex: none; min-width: 56px; text-align: left; white-space: nowrap; }
.dash-goal-bar { flex: none; width: 64px; height: 4px; background: var(--surface-2); border-radius: var(--r-full); overflow: hidden; }
.dash-goal-bar-fill { height: 100%; background: var(--primary); border-radius: var(--r-full); transition: width .5s cubic-bezier(.4,0,.2,1); }
.dash-goal-pct { font-size: .72rem; font-weight: 700; color: var(--text-1); flex: none; min-width: 32px; text-align: right; }

.dash-goal-next {
  font-size: .72rem;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Donut body - centred vertically */
.dash-donut-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-3) var(--sp-5) var(--sp-5);
}

/* ── Today's Focus: the ring beside its legend ──
   Stacked, the two shared one column of height: a day spent in ONE category
   left a short legend and a tall empty gap under a small ring, and a day
   across five pushed the last rows out through the bottom of the card. The
   card cannot grow — it is the height of the goals card beside it.

   Side by side, the two stop competing. The ring is one fixed size whatever
   the day held, and more categories only make the list on the right longer. */
.donut-wrap-lg {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: var(--sp-5);
  width: 100%;
}
.donut-svg-lg {
  width: 220px;
  height: 220px;
  flex-shrink: 0;
  filter: drop-shadow(0 3px 10px rgba(0,0,0,.10));
}
/* Only as wide as its longest row needs. At full width the name stretched to
   the card's edge and left a 246px run of nothing between it and the number. */
.donut-legend-lg {
  flex: 0 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Below roughly 380px of card the two no longer fit abreast and the category
   names start being cut, so they go back to being stacked. The card is full
   width by then, so there is height to spend. */
@media (max-width: 560px) {
  .donut-wrap-lg { flex-direction: column; gap: var(--sp-4); }
  .donut-svg-lg  { width: 180px; height: 180px; }
  .donut-legend-lg { width: 100%; }
}

/* ============================================================
   PROFILE - Activity Chart
   ============================================================ */

/* Period tab row */
/* Bars container */
/* ── Toggle switch ── */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
  cursor: pointer;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: var(--r-full);
  transition: background var(--ease);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--ease);
  box-shadow: 0 1px 3px rgba(0,0,0,.18);
}
.toggle-switch input:checked + .toggle-slider {
  background: var(--primary);
}
.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(18px);
}

/* ============================================================
   SETTINGS PAGE

   One column of sections, each a card with a heading and a list of
   rows under it. The label reads on the left, the control sits at
   the right edge — so a wide screen is filled by the row rather
   than by empty space beside a narrow column.
   ============================================================ */

.settings-page {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  max-width: 1080px;
}

.set-card { border-radius: var(--r-sm); padding: 0; overflow: hidden; }

.set-head {
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border-s);
}
.set-head-title {
  font-size: var(--text-base); font-weight: 700; color: var(--text-1);
}
.set-head-sub {
  font-size: var(--text-xs); color: var(--text-3); margin-top: 2px;
  max-width: 78ch;
}

.set-rows { display: flex; flex-direction: column; }

.set-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-5);
  padding: var(--sp-3) var(--sp-5);
  border-bottom: 1px solid var(--border-s);
}
.set-row:last-child { border-bottom: none; }

.set-text { flex: 1; min-width: 0; }
.set-label {
  font-size: var(--text-sm); font-weight: 600; color: var(--text-1);
}
.set-desc {
  font-size: var(--text-xs); color: var(--text-3); margin-top: 2px;
  max-width: 78ch;
}
.set-warn { color: var(--warning, var(--danger)); }

.set-control {
  flex-shrink: 0; display: flex; align-items: center;
  gap: var(--sp-3); flex-wrap: wrap; justify-content: flex-end;
}
.set-toggle { flex-shrink: 0; }

/* A section that cannot be used right now stays on the page and says why,
   rather than disappearing and taking the reader's place with it. */
.set-card-off .set-head-title,
.set-card-off .set-label { color: var(--text-3); }
.set-card-off .set-check { color: var(--text-4); cursor: default; }
.set-card-off .set-check input { cursor: default; }

.set-stages { gap: var(--sp-4); }
.set-check {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: var(--text-xs); color: var(--text-2); cursor: pointer;
  white-space: nowrap;
}
.set-check input { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }

/* Light / Dark and 12h / 24h: one row, the chosen half lifted out of it. */
.set-seg {
  display: flex; background: var(--surface-2);
  border-radius: var(--r-sm); padding: 2px; gap: 2px; flex-shrink: 0;
}
.set-seg-btn {
  padding: 6px 16px;
  font-size: var(--text-xs); font-weight: 600;
  border-radius: calc(var(--r-sm) - 2px);
  color: var(--text-3); border: none; background: transparent;
  cursor: pointer; transition: all var(--ease); white-space: nowrap;
}
/* Both halves share a width, so Theme and Time Format come out the same size
   however long their words are. 8.5rem holds "On the deadline day"'s neighbours
   comfortably at every supported text size. */
.set-seg-2 { width: 17rem; }
.set-seg-2 .set-seg-btn { flex: 1 1 0; padding: 6px 8px; }
.set-seg-btn:hover { color: var(--text-1); }
/* Every chosen half wears the same treatment — Theme and Time Format are the
   same control asked twice, so the answer has to look the same in both. */
.set-seg-btn.active {
  background: linear-gradient(135deg, #7C3AED, #A855F7);
  color: #fff;
  box-shadow: 0 0 12px rgba(139,92,246,0.45);
}
/* The gradient and the glow are older than the themes, so they burn in both.
   Light keeps them; in dark the chosen half is simply violet. */
[data-theme="dark"] .set-seg-btn.active {
  background: var(--primary);
  box-shadow: none;
}

.set-note {
  font-size: var(--text-xs); color: var(--text-3);
  padding: 0 var(--sp-5) var(--sp-3);
}
.set-status {
  font-size: var(--text-xs); font-weight: 600; color: var(--text-3);
  padding: 4px 10px; border: 1px solid var(--border-s); border-radius: var(--r-sm);
}
.set-error {
  font-size: var(--text-xs); color: var(--danger);
  margin-top: 4px; text-align: right; max-width: 34ch;
}
.set-error:empty { display: none; }

.set-row-danger { background: var(--danger-s); }
.set-row-danger .set-label { color: var(--danger); }
.set-btn-warn { color: var(--danger); border-color: var(--danger); }

/* On a narrow screen the control drops under its label rather than being
   squeezed against it — the stage checkboxes especially. */
@media (max-width: 640px) {
  .set-seg-2 { width: 100%; max-width: none; }
  .set-seg-2 .set-seg-btn { min-width: 0; text-align: center; }
  .set-row {
    flex-direction: column; align-items: stretch; gap: var(--sp-2);
    padding: var(--sp-3) var(--sp-4);
  }
  .set-control { justify-content: flex-start; }
  .set-control > .btn { width: 100%; justify-content: center; text-align: center; }
  .set-stages { gap: var(--sp-3) var(--sp-4); }
  .set-error { text-align: left; max-width: none; }
  .set-head { padding: var(--sp-4); }
  .set-note { padding: 0 var(--sp-4) var(--sp-3); }
}

/* ============================================================
   NOTES
   ============================================================ */

/* The height is set at runtime (js/notes.js _fitApp), against the window and
   from this element's own top edge, so the page ends where every other page
   ends. It used to be calc(100vh - 180px) here, and 180 is right only when
   nothing sits above the frame - with the trial banner up it ran on past the
   bottom. The min-height stays as the floor for a very short window. */
.notes-app {
  display: flex;
  min-height: 460px;
  border: 1px solid var(--border);
  border-radius: var(--r-xl, 16px);
  overflow: hidden;
  background: var(--surface);
}

/* ── left rail ── */
.notes-sidebar {
  width: 300px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--surface-2);
}
.notes-sidebar-head {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3);
  border-bottom: 1px solid var(--border-s, var(--border));
}
.notes-search-wrap { position: relative; flex: 1; }
.notes-search-input {
  width: 100%;
  padding: 8px 12px 8px 34px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  font-size: var(--text-sm);
  color: var(--text-1);
  font-family: inherit;
  transition: all var(--ease);
  box-sizing: border-box;
}
.notes-search-input:focus {
  outline: none;
  border-color: var(--line-strong);
  box-shadow: 0 0 0 3px rgba(124,92,252,.12);
}
.notes-compose {
  flex-shrink: 0;
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--primary-ink);
  cursor: pointer;
  transition: all var(--ease);
}
.notes-compose:hover { background: var(--primary); color: #fff; border-color: var(--line-strong); }
.notes-compose svg { width: 16px; height: 16px; }

.notes-list { flex: 1; overflow-y: auto; padding: var(--sp-2); }
.notes-list-empty { padding: var(--sp-6) var(--sp-4); text-align: center; color: var(--text-3); font-size: var(--text-sm); }
.notes-group-label {
  font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-4); padding: var(--sp-4) var(--sp-2) var(--sp-1);
}
.notes-group-label:first-child { padding-top: var(--sp-1); }
.notes-row {
  display: flex; align-items: center; gap: 2px; width: 100%;
  margin-bottom: 2px; border-radius: var(--r-md);
  transition: background var(--ease);
}
.notes-row:hover { background: var(--surface-3, rgba(0,0,0,.04)); }
.notes-row.active { background: rgba(124,92,252,.22); }
.notes-row-main {
  flex: 1; min-width: 0; display: block; text-align: left;
  padding: 9px 10px; background: transparent; border: none;
  cursor: pointer; font-family: inherit;
}
.notes-row-actions {
  display: flex; gap: 2px; padding-right: 6px;
  opacity: 0; transition: opacity var(--ease);
}
.notes-row:hover .notes-row-actions,
.notes-row.active .notes-row-actions { opacity: 1; }
.notes-row-act {
  width: 26px; height: 26px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: none; border-radius: 6px;
  color: var(--text-3); cursor: pointer; transition: all var(--ease);
}
.notes-row-act:hover { background: rgba(0,0,0,.07); color: var(--text-1); }
.notes-row-act.is-pinned { color: var(--warning); }
.notes-row-act-danger:hover { background: var(--danger-s, rgba(239,68,68,.1)); color: var(--danger); }
.notes-row-act svg { width: 14px; height: 14px; }
.notes-row-title {
  display: flex; align-items: center; gap: 6px;
  font-size: .9rem; font-weight: 700; color: var(--text-1);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.notes-row-pin { color: var(--warning); font-size: .7rem; }
.notes-row-sub {
  display: block; margin-top: 2px;
  font-size: .78rem; color: var(--text-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.notes-row-empty { color: var(--text-4); font-style: italic; }

/* ── right pane (editor) ── */
.notes-detail { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--surface); }
.note-toolbar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px;
  padding: 6px var(--sp-4);
  border-top: 1px solid var(--border-s, var(--border));
  border-bottom: 1px solid var(--border-s, var(--border));
}
.nt-btn {
  min-width: 30px; height: 30px; padding: 0 7px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid transparent; border-radius: var(--r-sm, 7px);
  font-size: .9rem; color: var(--text-2); cursor: pointer;
  transition: all var(--ease);
}
.nt-btn:hover { background: var(--surface-2); color: var(--text-1); }
.nt-btn.nt-on { background: rgba(124,92,252,.16); color: var(--primary-ink); }
.nt-btn.nt-on:hover { background: rgba(124,92,252,.24); color: var(--primary-ink); }
.nt-ico svg { width: 17px; height: 17px; display: block; }

/* small floating "⋯" handle that appears by a table */
/* ── the two table grips ──────────────────────────────────────────────────
   One sits on the table's top edge over the current column and is as wide as
   that column; the other on the left edge beside the current row and as tall
   as that row. notes.js sets each size, because only it knows the table. */
.note-tgrip {
  position: fixed; z-index: 999; display: none;
  align-items: center; justify-content: center;
  padding: 0; overflow: visible;
  background: var(--surface); color: var(--text-3);
  border: 1px solid var(--border);
  box-shadow: 0 1px 4px -2px rgba(0,0,0,.2);
  cursor: pointer;
  transition: background var(--ease), color var(--ease), border-color var(--ease);
}
/* A button of its own, clear of the table, rather than one merged into its
   border — the merged look read as a button sitting on top of a cell. */
.note-tgrip-col, .note-tgrip-row { border-radius: 5px; }
.note-tgrip svg { width: 13px; height: 13px; display: block; }
.note-tgrip:hover { color: var(--primary-ink); border-color: var(--line-strong); }
/* The reach, taken OUTWARD only: up above the table for the column grip, left
   of it for the row grip. That strip is empty, and until now a tap landing
   there threw the caret out of the table altogether. Nothing is laid over the
   cells — her call, 28 October 2026 — so tapping a cell near the edge still
   puts the caret in that cell. */
/* The column and the row the grips act on, outlined so that what the menu
   will change can be seen before it changes. Drawn over the note and deaf to
   every tap, so typing in a marked cell is exactly as it was. */
.note-tsel {
  position: fixed; z-index: 998; display: none;
  pointer-events: none;
  border: 1px solid var(--primary); border-radius: 3px;
}

.note-tgrip::before { content: ''; position: absolute; }
.note-tgrip-col::before { left: 0; right: 0; top: -14px; bottom: -2px; }
.note-tgrip-row::before { top: 0; bottom: 0; left: -14px; right: -2px; }

/* The caret we draw ourselves when the browser's own would not fit inside the
   note — see _clipCaret in js/notes.js. Sits under the grips: it is something
   to look at, never something to touch. */
.note-tcaret {
  position: fixed; z-index: 997; display: none; pointer-events: none;
  background: var(--primary);
  animation: note-tcaret-blink 1.06s steps(1, end) infinite;
}
@keyframes note-tcaret-blink { 0%, 50% { opacity: 1 } 50.01%, 100% { opacity: 0 } }
@media (prefers-reduced-motion: reduce) { .note-tcaret { animation: none } }

/* table add/delete context menu */
.note-tmenu {
  position: fixed; z-index: 1000; min-width: 190px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg, 12px);
  box-shadow: var(--shadow-lg, 0 12px 34px -8px rgba(0,0,0,.35));
  padding: 6px; display: flex; flex-direction: column;
}
.note-tmenu-item {
  text-align: left; background: transparent; border: none;
  padding: 8px 12px; border-radius: var(--r-sm, 7px);
  font-size: .88rem; color: var(--text-1); cursor: pointer; font-family: inherit;
}
.note-tmenu-item:hover { background: var(--surface-2); }
.note-tmenu-item.danger { color: var(--danger); }
.note-tmenu-item.danger:hover { background: var(--danger-s, rgba(239,68,68,.1)); }
.note-tmenu-sep { height: 1px; background: var(--border); margin: 5px 6px; }
.nt-sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }
.nt-colors { display: inline-flex; gap: 4px; align-items: center; }
.nt-color {
  width: 18px; height: 18px; border-radius: 50%;
  border: 1.5px solid var(--surface); box-shadow: 0 0 0 1px var(--border);
  cursor: pointer; padding: 0; transition: transform var(--ease);
}
.nt-color:hover { transform: scale(1.15); }

.note-title-input {
  border: none; outline: none; background: transparent;
  padding: var(--sp-4) var(--sp-6) 0;
  font-size: 1.5rem; font-weight: 800; color: var(--text-1);
  font-family: inherit; letter-spacing: -.02em;
  /* Wraps to as many lines as the title needs; the height is set from the
     content, so there is nothing to scroll and nothing to drag. */
  width: 100%;
  display: block;
  flex: none;          /* never squeezed by the body below it */
  resize: none;
  overflow: hidden;
  line-height: 1.25;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.note-title-input::placeholder { color: var(--text-4); }
/* Title and text scroll as one sheet of paper, the way a document does in a
   word processor. They used to be two: the body scrolled inside its own frame
   while the title stayed nailed to the top, so text ran up underneath it and
   was gone — with no way to scroll back to it. Only the date and the toolbar
   stay put now; everything that is the note itself moves together. */
.note-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  /* Whatever moves this — our own nudge or the browser reaching for the caret
     — arrives as a slide rather than a jump. */
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  .note-scroll { scroll-behavior: auto; }
}
.note-sync-conflict {
  padding: var(--sp-3) var(--sp-6);
  color: var(--text-1);
  background: var(--primary-s);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3);
  flex-shrink: 0;
}
.note-body {
  /* Fills the pane even when the note is short, so clicking the empty space
     below the last line still puts the caret in the note. */
  flex: 1 0 auto;
  outline: none;
  padding: var(--sp-3) var(--sp-6) var(--sp-8);
  font-size: .98rem; line-height: 1.7; color: var(--text-1);
}
.note-body:empty:before { content: attr(data-placeholder); color: var(--text-4); }
/* While a table menu is open. iOS paints the caret of the text being edited
   above every other layer on the page, so it was drawn on top of the menu's
   own words — her pictures of 29 October 2026. Nothing is blurred and the
   selection is untouched; only the blinking line stands aside. */
.note-body.caret-hidden { caret-color: transparent; }
.note-body h1, .note-body h2, .note-body h3 { font-weight: 800; margin: .6em 0 .3em; line-height: 1.3; }
.note-body h2 { font-size: 1.3rem; }
/* the global reset kills list markers — restore them inside the editor */
.note-body ul { list-style: disc outside; padding-left: 1.5em; margin: .4em 0; }
.note-body ol { list-style: decimal outside; padding-left: 1.6em; margin: .4em 0; }
.note-body li { margin: .25em 0; }

/* checklist (Mac-Notes-style tickable items) */
.note-body ul[data-checklist] { list-style: none; padding-left: 0; margin: .4em 0; }
.note-body ul[data-checklist] li {
  position: relative; list-style: none; padding-left: 28px; margin: .3em 0;
}
.note-body ul[data-checklist] li::before {
  content: ''; position: absolute; left: 0; top: .12em;
  width: 18px; height: 18px; box-sizing: border-box;
  border: 2px solid var(--border); border-radius: 50%; cursor: pointer;
  transition: background var(--ease), border-color var(--ease);
}
.note-body ul[data-checklist] li[data-checked="1"]::before {
  background: var(--primary); border-color: var(--line-strong);
}
.note-body ul[data-checklist] li[data-checked="1"]::after {
  content: ''; position: absolute; left: 6px; top: .28em;
  width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0;
  transform: rotate(45deg); pointer-events: none;
}
.note-body ul[data-checklist] li[data-checked="1"] { color: var(--text-3); }
.note-body a { color: var(--primary-ink); }
/* The gap above a table is where the column grip sits, so it has to be
   taller than the grip (16px) or the grip lands on the line above. */
.note-body table { border-collapse: collapse; margin: 1.3em 0 .5em; width: auto; }
.note-body td, .note-body th {
  border: 1px solid var(--border); padding: 6px 10px; min-width: 60px; vertical-align: top;
}

/* Mobile-only navigation is absent from the desktop layout. */
.note-mobile-nav { display: none; }

/* ── mobile: stack rail above editor ── */
@media (max-width: 720px) {
  .notes-app { flex-direction: column; height: calc(100vh - 150px); height: calc(100dvh - 150px); }
  .notes-sidebar { width: 100%; max-height: 42%; border-right: none; border-bottom: 1px solid var(--border); }
}

/* ============================================================
   HABITS & DAY PICKER
   ============================================================ */

.day-picker {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
  margin-top: var(--sp-2);
}

.day-pill {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: var(--text-xs);
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--ease);
  display: flex;
  align-items: center;
  justify-content: center;
}
.day-pill:hover {
  border-color: var(--line-strong);
  color: var(--primary-ink);
  background: var(--primary-s, rgba(79,99,232,.08));
}
.day-pill.active {
  background: var(--primary);
  border-color: var(--line-strong);
  color: #fff;
  box-shadow: 0 2px 8px rgba(79,99,232,.35);
}

@keyframes obFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes obFadeOut { to { opacity: 0; transform: scale(.96); } }

@keyframes obSlideUp { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: translateY(0); } }

/* ============================================================
   AVATAR HOVER & TOOLTIP
   ============================================================ */
.header-user {
  position: relative;
}
.header-user:hover .header-avatar {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 3px var(--primary-s);
}
.header-user::after {
  content: attr(title);
  position: absolute;
  bottom: -32px;
  right: 0;
  background: var(--text-1);
  color: var(--surface);
  font-size: var(--text-xs);
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--r-sm);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--ease);
}
.header-user:hover::after { opacity: 1; }

/* ============================================================
   DASHBOARD - DAY CLOSED PANEL
   ============================================================
   Stands above the task list, not under the page. Every colour is a token:
   the old strip hard-coded #fff over a background it also changed, which is
   how white text ended up on pale lilac the moment the day was closed.

   Her call, 15 October 2026: a filled deep-purple bar, white writing, white
   button. The panel is therefore its OWN surface, the one thing on the page
   that does not follow the theme — which is why its four colours are tokens
   of their own, written twice, exactly as the sidebar's are. */
.dash-daylock {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-5);
  margin-bottom: var(--sp-5);
  background: var(--daylock-bg);
  border-radius: var(--r-lg);
}
.dash-daylock-text { flex: 1; min-width: 0; }
.dash-daylock-title { font-size: 1rem; font-weight: 700; color: var(--daylock-ink); }
/* One appearance, and it is this one. The button carries its own background at
   rest instead of borrowing one on hover, which is what gave the old Resume
   two looks on a phone: a tap leaves :hover standing until something else is
   touched. Hover is behind a query no touch screen matches. */
.dash-daylock-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: var(--sp-2) var(--sp-5);
  background: var(--daylock-btn);
  border: 1px solid transparent;
  color: var(--daylock-bg);
  font-weight: 600;
}
.dash-daylock-btn:active { background: var(--daylock-btn-press); }
@media (hover: hover) {
  .dash-daylock-btn:hover { background: var(--daylock-btn-press); }
}
/* On a phone the button takes its own line at full width, the way every other
   action in a card does, with the 44px touch target the rest of the app uses. */
@media (max-width: 640px) {
  .dash-daylock { flex-wrap: wrap; }
  .dash-daylock-text { flex: 1 1 60%; }
  .dash-daylock-btn { width: 100%; justify-content: center; min-height: 44px; }
}

/* A closed day's list: read, not worked.
   The rows keep their shape — a tick that was earned today still reads as
   done — but the box stops being a control and the row's buttons are not
   drawn, so there is nothing to press and nothing to reach with a keyboard
   either. The refusal itself is in the handlers; this is what makes the
   refusal visible instead of a press that silently does nothing. */
.dash-list-locked .task-checkbox {
  pointer-events: none;
  cursor: default;
}
.dash-list-locked .tasks-row-actions,
.dash-list-locked .task-actions { display: none; }
/* In This Week the same lock is worn by one card out of seven, so that card
   has to say why it is quiet — the panel announcing it stands in the other
   tab. A chip beside the day's name, in the words the panel uses. */
.dash-weekcard-closed {
  margin-left: var(--sp-2);
  padding: 2px var(--sp-2);
  border-radius: var(--r-sm);
  background: var(--primary-s);
  color: var(--primary-ink);
  font-size: var(--text-xs);
  font-weight: 600;
  white-space: nowrap;
}

/* ============================================================
   DASHBOARD - END MY DAY STRIP
   ============================================================ */
.dash-eod-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-5);
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
  border-radius: var(--r-lg);
  margin-bottom: 0;
  color: #fff;
}
.eod-strip-done {
  background: linear-gradient(135deg, rgba(124,58,237,0.25) 0%, rgba(109,40,217,0.35) 100%);
  border: 1px solid rgba(124,58,237,0.3);
}
.dash-eod-strip-left {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
}
.dash-eod-strip-title {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 2px;
}
.dash-eod-strip-sub {
  font-size: var(--text-xs);
  color: rgba(255,255,255,.75);
  line-height: 1.4;
}
.dash-eod-strip-btn {
  flex-shrink: 0;
  background: rgba(255,255,255,.15);
  border: 1.5px solid rgba(255,255,255,.35);
  color: #fff;
  padding: var(--sp-2) var(--sp-5);
  font-weight: 600;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.dash-eod-strip-btn:hover {
  background: rgba(255,255,255,.25);
  border-color: rgba(255,255,255,.6);
}

/* ============================================================
   DASHBOARD - TODAY / THIS WEEK TABS
   ============================================================ */
/* The same shape as the Settings segmented control (.set-seg): one pattern,
   one answer, wherever it is asked. */
.dash-task-view-tabs {
  display: flex;
  gap: 2px;
  background: var(--surface-2);
  border-radius: var(--r-sm);
  padding: 3px;
}
.dash-task-tab {
  padding: 5px 16px;
  border-radius: calc(var(--r-sm) - 2px);
  border: none;
  background: transparent;
  color: var(--text-3);
  font-size: var(--text-sm);
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--ease);
}
.dash-task-tab.active {
  background: var(--surface);
  color: var(--text-1);
  font-weight: 600;
  box-shadow: var(--shadow-xs, 0 1px 3px rgba(0,0,0,.1));
}

.dash-empty-state {
  text-align: center;
  padding: var(--sp-8) var(--sp-5);
}
.dash-empty-msg {
  font-size: var(--text-sm);
  color: var(--text-3);
  margin-bottom: var(--sp-4);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  border: 1px solid var(--danger);
}
.btn-danger:hover { background: var(--danger); color: #fff; filter: brightness(.92); }

/* Task row in week view (with edit/delete actions) */
.dash-task-row-week {
  padding-right: var(--sp-3);
}

/* ── Auth Gate ── */
/* The sign-in screen covers everything, so it is sized by the same ladder as
   a window — and for the same reason, which her own phone measured. `inset: 0`
   on a fixed element is the box the browser lays out in, and on an iPhone that
   box runs PAST the bottom of what she can see, by the height of the bar you
   swipe home with. The card centres itself in that box with `margin-block:
   auto`, so it sat about eighteen points low: on the screenshot from the
   installed app the gap above was 192 and below 144. Centred in the box that
   ends below the clock but ignores the bottom bar predicts 191 — which is what
   it was doing. Centred in what she can actually see predicts 174.

   So: a height, not an inset, read from what is visible. `vh`, then `dvh` for
   the browser's own bars, then the variable js/utils.js fills from
   visualViewport — which is also the only one that knows about the keyboard. */
.auth-gate {
  position: fixed; inset: 0; z-index: 9000;
  height: 100vh;
  height: 100dvh;
  height: var(--visible-h, 100dvh);
  display: flex;
  background: var(--bg);
  animation: authFadeIn 0.35s ease;
}
@keyframes authFadeIn { from { opacity:0; } to { opacity:1; } }
.auth-gate-out { animation: authFadeOut 0.35s ease forwards; }
@keyframes authFadeOut { to { opacity:0; transform: scale(0.98); } }

.auth-left {
  width: 42%;
  background: var(--sidebar-bg);
  display: flex; flex-direction: column; justify-content: center;
  padding: 60px 52px;
  gap: var(--sp-8);
}
@media (max-width: 720px) { .auth-left { display: none; } }

.auth-brand { display: flex; align-items: center; gap: var(--sp-3); }
.auth-brand-logo { width: 40px; height: 40px; border-radius: var(--r-sm); object-fit: contain; }
.auth-brand-name { font-size: var(--text-lg); font-weight: 700; color: #fff; }
.auth-headline { font-size: 2.2rem; font-weight: 800; color: #fff; line-height: 1.2; margin-bottom: 40px; }
.auth-features { display: flex; flex-direction: column; margin-top: 0; }
.auth-feature {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 1rem;
  font-weight: 500;
  color: rgba(255,255,255,0.85);
  padding: 12px 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.auth-feature:last-child { border-bottom: none; }
.auth-feature svg { flex-shrink: 0; opacity: 0.9; }

.auth-right {
  flex: 1;
  display: flex; align-items: flex-start; justify-content: center;
  padding: var(--sp-8) var(--sp-6);
  overflow-y: auto;
  min-height: 0;
  overscroll-behavior-y: contain;
  scroll-padding-block: 12px;
}

.auth-card {
  margin-block: auto;
  flex-shrink: 0;
  width: 100%; max-width: 420px;
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border);
  overflow: hidden;
}

.auth-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.auth-tab {
  flex: 1; padding: var(--sp-4) var(--sp-5);
  font-size: var(--text-sm); font-weight: 600;
  border: none; background: transparent; cursor: pointer;
  color: var(--text-3); transition: all var(--ease);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.auth-tab.active { color: var(--primary-ink); border-bottom-color: var(--line-strong); background: var(--surface); }
.auth-tab:hover:not(.active) { color: var(--text-1); }

.auth-card-body { padding: 40px; }
.auth-card-title { font-size: 2rem; font-weight: 800; color: var(--text-1); margin-bottom: 8px; }
.auth-card-sub { font-size: 1rem; color: var(--text-3); margin-bottom: 28px; }

.auth-form { display: flex; flex-direction: column; gap: 0; }
.auth-form .form-group { margin-bottom: 20px; }
.auth-submit-btn { width: 100%; margin-top: var(--sp-2); padding-top: 16px; padding-bottom: 16px; }

.auth-password-wrap { position: relative; }
.auth-password-wrap .form-input { padding-right: 44px; }
.auth-toggle-pass {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  color: var(--text-3); padding: 4px; line-height: 1;
}
/* The button used to hold an emoji, which brought its own size. An inline SVG
   does not, so the size is set here. */
.auth-toggle-pass svg { width: 18px; height: 18px; }
.auth-toggle-pass:hover { color: var(--text-1); }

.auth-error {
  background: var(--danger-s); border: 1px solid var(--danger);
  color: var(--danger); border-radius: var(--r-sm);
  padding: var(--sp-3) var(--sp-4); font-size: var(--text-sm);
}
/* Neutral instruction (not an error) - grey, e.g. "check your email to confirm" */
.auth-error.auth-error--notice {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text-2);
}

/* The reset stripped every margin in the page, so these lines sat against the
   button and against each other. The card has room to spare; the crowding was
   never a decision. */
.auth-switch { text-align: center; font-size: var(--text-sm); color: var(--text-3); margin-top: var(--sp-5); }
/* Sign In carries two of them — the forgotten password, then the way to make
   an account. Set apart from each other by less than either is from the
   button, so they read as two offers and not as one paragraph. */
.auth-switch + .auth-switch { margin-top: var(--sp-3); }
.auth-switch a { color: var(--primary-ink); text-decoration: none; font-weight: 600; }
.auth-switch a:hover { text-decoration: underline; }


/* The three documents, under the account form. Quieter than the note above
   them — they are there to be findable, not to be read before signing up. */
.auth-legal { text-align: center; font-size: var(--text-xs); color: var(--text-4); margin-top: var(--sp-3); }
.auth-legal a { color: var(--text-3); text-decoration: none; }
.auth-legal a:hover { color: var(--primary-ink); text-decoration: underline; }
.auth-legal-sep { margin: 0 var(--sp-2); opacity: .6; }


/* Header logout button */
.header-logout-btn {
  width: 34px; height: 34px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-3); cursor: pointer; display: flex;
  align-items: center; justify-content: center;
  transition: all var(--ease);
}
.header-logout-btn:hover { color: var(--danger); border-color: var(--danger); background: var(--danger-s); }
.header-logout-btn svg { width: 16px; height: 16px; }

/* ── Onboarding Tour ── */
.tour-overlay {
  position: fixed; inset: 0; z-index: 8500;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  animation: tourFadeIn 0.3s ease;
}
@keyframes tourFadeIn { from { opacity:0; } to { opacity:1; } }

.tour-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-xl);
  padding: var(--sp-10) var(--sp-8);
  max-width: 480px; width: 90%;
  text-align: center;
  animation: tourSlideIn 0.35s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes tourSlideIn { from { opacity:0; transform: translateY(24px) scale(0.96); } to { opacity:1; transform: none; } }

.tour-step-tag {
  display: inline-block; background: var(--primary-s); color: var(--primary-ink);
  font-size: var(--text-xs); font-weight: 700; letter-spacing: 0.5px;
  padding: 3px 12px; border-radius: var(--r-full); margin-bottom: var(--sp-5);
}
.tour-icon { font-size: 3rem; margin-bottom: var(--sp-4); line-height: 1; }
.tour-title { font-size: var(--text-xl); font-weight: 700; color: var(--text-1); margin-bottom: var(--sp-3); }
.tour-desc { font-size: var(--text-sm); color: var(--text-2); line-height: 1.7; margin-bottom: var(--sp-6); }

.tour-dots { display: flex; justify-content: center; gap: 6px; margin-bottom: var(--sp-7); }
.tour-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--border); transition: all var(--ease);
}
.tour-dot.active { background: var(--primary); transform: scale(1.3); }

.tour-actions { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }

.nav-item.tour-highlight {
  background: var(--sidebar-item-active) !important;
  box-shadow: 0 0 0 2px var(--primary), 0 0 16px rgba(139,92,246,0.25);
  border-radius: var(--r-sm);
}
/* A ring is enough to say "here"; the halo round it was the old theme's idea. */
[data-theme="dark"] .nav-item.tour-highlight { box-shadow: 0 0 0 2px var(--primary); }
.nav-item.tour-highlight .nav-icon,
.nav-item.tour-highlight span { color: var(--sidebar-text-active) !important; }

.btn-danger:hover { background: var(--danger); color: #fff; filter: brightness(.92); }

/* ── Task deadline badge - always-visible on far right ── */
.task-deadline-badge {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: .70rem;
  font-weight: 600;
  border-radius: var(--r-full);
  padding: 2px 10px;
  white-space: nowrap;
}
.task-deadline--overdue  { background: var(--due-late-s);  color: var(--due-late-text); }
.task-deadline--today,
.task-deadline--soon { background: var(--due-soon-s);  color: var(--due-soon-text); }
.task-deadline--normal   { background: var(--surface-2);    color: var(--text-3);       }

/* ── Reminder modal ── */
/* ── One scroller, not two ───────────────────────────────────────────────
   Her report, 29 October 2026, with a picture: a white strip above Save that
   does nothing except make the part she can read smaller.

   Measured at 375x812: the window is the full height of the phone and its
   middle is 662 tall, but this list capped itself at 60dvh — 487 — and did
   its own scrolling inside that. So 143 points of the window were blank by
   arithmetic, the list was shorter than it needed to be, and a flick near the
   bottom scrolled the wrong box.

   The cap was from the days when a window had no height limit of its own and
   a long list would have pushed Save off the screen. The window has had that
   limit since MOB-03: .modal is capped to what is visible and .modal-body is
   the one part that scrolls. So the cap had nothing left to protect. */
.reminders-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
  /* Kept exactly as it was. It was the gutter for this list's own scrollbar
     and has nothing to do with the blank strip, and she asked for the strip
     and nothing else — so the rows keep the width they had. */
  padding-right: 2px;
}

.reminder-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.reminder-group-title {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-1);
}
.reminder-group-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}
/* A deadline row is a review row (.rvw-row) that happens to be its own card:
   these rows stand apart with a gap between them, where a review's sit inside
   one bordered list. So the card keeps its border, its padding and the tint
   that says how close the deadline is, and the skeleton inside it — the title,
   the tag in the corner, the answers, the day under them — is the review's,
   unchanged. Written after .rvw-row so these four win where they overlap. */
.reminder-item {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-4) var(--sp-5);
  background: var(--surface);
}
.reminder-item + .reminder-item { border-top: 1px solid var(--border); }
.reminder-item--overdue { border-color: rgba(220,38,38,.35);  background: rgba(220,38,38,.04);  }
.reminder-item--soon    { border-color: rgba(234,179,8,.35);  background: rgba(234,179,8,.05);  }
.reminder-item--upcoming{ border-color: var(--border);        background: var(--surface);       }
/* How overdue it is, in the line under the title. */
.reminder-item--overdue .rvw-row-c { color: var(--danger); font-weight: 600; }
/* The card IS the surface, so the day sits straight on it rather than in a
   panel of its own with borders running down a card that already has some. */
.reminder-item .rvw-inline {
  padding: var(--sp-3) 0 0;
  background: none;
  border: none;
}
/* Answered rows do not fade here: the tint is what this window uses its
   colour for, and dimming it would blur how close a deadline is. */
.reminder-item.rvw-row-answered { opacity: 1; }
/* Save points at a row it cannot save, and the mark stays until it is
   answered. */
.rvw-row-flag { border-color: var(--line-strong); box-shadow: 0 0 0 2px var(--primary-s); }
/* What the row is waiting for, said rather than hinted at. The ring above is
   invisible on a card that already has a coloured border - measured on her
   phone, 28 October 2026 - so the words carry it. */
.rvw-need {
  margin-top: 8px;
  color: var(--danger);
  font-size: var(--text-sm);
  line-height: 1.5;
}

/* ── Legal Footer (static, at end of page, theme-aware, delicate) ── */
#legal-footer {
  /* display toggled to flex in app.js after login; hidden by default */
  display: none;
  width: 100%;
  align-items: center;
  justify-content: center;   /* centered on the line */
  text-align: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 24px;
  background: var(--bg);                       /* matches dashboard bg: light-light, dark-dark */
  border-top: 1px solid var(--border-s, var(--border));
}
.legal-footer-link {
  color: var(--text-4, var(--text-3));        /* faint, delicate */
  font-size: 0.68rem;
  font-weight: 400;
  opacity: 0.6;
  text-decoration: none;
  transition: opacity var(--ease), color var(--ease);
}
.legal-footer-link:hover {
  opacity: 1;
  color: var(--text-2);
}
.legal-footer-sep {
  color: var(--text-4, var(--text-3));
  opacity: 0.4;
  font-size: 0.68rem;
  user-select: none;
}

/* ── Custom Cookie Consent Banner (dark purple, brand-matched) ── */
.cookie-banner {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 100000;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 14px 28px;
  padding: 16px 24px;
  background: linear-gradient(160deg, #130b2e 0%, #0c0618 100%);
  border-top: 1px solid rgba(139, 92, 246, 0.25);
  box-shadow: 0 -6px 28px rgba(0, 0, 0, 0.35);
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.85rem;
  line-height: 1.55;
  animation: cookieBannerIn 0.35s ease;
}
@keyframes cookieBannerIn { from { transform: translateY(100%); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.cookie-banner-out { animation: cookieBannerOut 0.25s ease forwards; }
@keyframes cookieBannerOut { to { transform: translateY(100%); opacity: 0; } }

.cookie-banner-text {
  max-width: 620px;
  text-align: center;
}
.cookie-banner-text a {
  color: #a78bfa;
  text-decoration: underline;
  font-weight: 600;
}
.cookie-banner-text a:hover { color: #c4b5fd; }

.cookie-banner-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.cookie-btn {
  padding: 9px 24px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.cookie-btn-accept { background: #7c3aed; color: #fff; }
.cookie-btn-accept:hover { background: #6d28d9; }
.cookie-btn-reject {
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  border-color: rgba(255, 255, 255, 0.28);
}
.cookie-btn-reject:hover { background: rgba(255, 255, 255, 0.10); color: #fff; }

/* ── Accessibility: respect the user's reduced-motion preference ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ════════════════════════════════════════════════════════
   HABIT REPORT MODAL
════════════════════════════════════════════════════════ */
.habit-report { display: flex; flex-direction: column; gap: var(--sp-5); }

.hr-head-center { text-align: center; }
.hr-head-title { font-size: var(--text-lg); font-weight: 800; color: var(--text-1); }
.hr-head-sub   { margin-top: 4px; font-size: var(--text-sm); color: var(--text-3); }

/* Stat cards — three stacked rows: [Consistency] / [Completed · Skipped] / [Current · Longest · Best] */
.hr-stats-stack { display: flex; flex-direction: column; gap: var(--sp-3); }
.hr-stats { display: grid; gap: var(--sp-3); }
.hr-stats-1 { grid-template-columns: 1fr; }
.hr-stats-2 { grid-template-columns: repeat(2, 1fr); }
.hr-stat {
  background: var(--surface-2);
  border: 1px solid var(--border-s);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
  text-align: center;
}
.hr-stat-value { font-size: var(--text-xl); font-weight: 800; color: var(--primary-ink); line-height: 1.1; }
.hr-stat-label { margin-top: 4px; font-size: var(--text-xs); font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; }

/* Sections */
.hr-section { display: flex; flex-direction: column; gap: var(--sp-3); }
.hr-section-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.hr-section-title { font-size: var(--text-sm); font-weight: 700; color: var(--text-2); }
.hr-section-sub { font-weight: 400; color: var(--text-3); }

/* Weekly history rows */
.hr-weeks { display: flex; flex-direction: column; gap: 2px; }
.hr-week-row {
  display: flex; justify-content: space-between;
  padding: 8px var(--sp-3); border-radius: var(--r-sm);
  background: var(--surface-2); font-size: var(--text-sm); color: var(--text-2);
}
.hr-week-val { font-weight: 700; color: var(--text-1); }

.hr-history-link {
  align-self: flex-start;
  background: none; border: none; cursor: pointer;
  color: var(--primary-ink); font-size: var(--text-xs); font-weight: 700; font-family: inherit; padding: 0;
}
.hr-history-link:hover { text-decoration: underline; }

@media (max-width: 560px) {
  .hr-stats-3 { grid-template-columns: repeat(3, 1fr); }
}

/* ════════════════════════════════════════════════════════
   GOAL REPORT MODAL
════════════════════════════════════════════════════════ */
.goal-report { display: flex; flex-direction: column; gap: var(--sp-5); }

.gr-head-center { text-align: center; }
.gr-head-title {
  font-size: var(--text-xl); font-weight: 800; color: var(--text-1);
}
.gr-head-line { margin-top: 8px; font-size: var(--text-sm); font-weight: 600; color: var(--text-2); }
.gr-head-sub  { margin-top: 4px; font-size: var(--text-sm); color: var(--text-3); }
.gr-status {
  display: inline-block; font-size: var(--text-xs); font-weight: 700;
  padding: 3px 10px; border-radius: 999px; text-transform: uppercase; letter-spacing: .04em;
}
.gr-status-active    { color: var(--primary-ink);      background: var(--primary-s); }
.gr-status-paused    { color: var(--text-3);        background: var(--surface-3); }
.gr-status-completed { color: var(--success-text);  background: var(--success-s); }

/* Big progress bar */
.gr-progress { display: flex; flex-direction: column; gap: 6px; }
.gr-progress-row { display: flex; justify-content: space-between; font-size: var(--text-sm); font-weight: 700; color: var(--text-2); }
.gr-bar { height: 14px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.gr-bar > i { display: block; height: 100%; background: var(--primary); border-radius: 999px; transition: width .5s; }

/* Stat cards — stacked rows */
.gr-stats-stack { display: flex; flex-direction: column; gap: var(--sp-3); }
.gr-stats { display: grid; gap: var(--sp-3); }
.gr-stats-1 { grid-template-columns: 1fr; }
.gr-stats-2 { grid-template-columns: repeat(2, 1fr); }
.gr-stat {
  background: var(--surface-2); border: 1px solid var(--border-s);
  border-radius: var(--r-md); padding: var(--sp-3) var(--sp-4); text-align: center;
}
.gr-stat-value { font-size: var(--text-lg); font-weight: 800; color: var(--primary-ink); line-height: 1.2; }
.gr-stat-value small { font-size: var(--text-xs); font-weight: 600; color: var(--text-2); }
.gr-stat-label { margin-top: 4px; font-size: var(--text-xs); font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; }
/* Flipped card: label on top, value below (used for the date cards). */
.gr-stat-flip .gr-stat-label { margin-top: 0; }
.gr-stat-flip .gr-stat-value { margin-top: 4px; }

/* Sections */
.gr-section { display: flex; flex-direction: column; gap: var(--sp-3); }
.gr-section-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.gr-section-title { font-size: var(--text-sm); font-weight: 700; color: var(--text-2); }
.gr-section-sub { font-weight: 400; color: var(--text-3); }

.gr-steps { display: flex; flex-direction: column; gap: 2px; }
.gr-step {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 8px var(--sp-3); border-radius: var(--r-sm); background: var(--surface-2);
}
.gr-step-dot {
  width: 18px; height: 18px; flex: none; border-radius: 50%;
  border: 2px solid var(--border); display: flex; align-items: center; justify-content: center;
  color: #fff;
}
.gr-step-dot svg { width: 11px; height: 11px; }
.gr-step-dot.done { background: var(--success); border-color: var(--success); }
.gr-step-title { flex: 1; min-width: 0; font-size: var(--text-sm); color: var(--text-1); }
.gr-step.done .gr-step-title { color: var(--text-3); }
.gr-step-date { font-size: var(--text-xs); color: var(--text-3); white-space: nowrap; }
.gr-empty { font-size: var(--text-sm); color: var(--text-3); font-style: italic; padding: var(--sp-2) 0; }

.gr-history-link {
  align-self: flex-start;
  background: none; border: none; cursor: pointer;
  color: var(--primary-ink); font-size: var(--text-xs); font-weight: 700; font-family: inherit; padding: 0;
}
.gr-history-link:hover { text-decoration: underline; }
/* Plain text link — no focus pill (the global :focus-visible outline); keep an
   accessible underline instead so all "Full history" links look identical. */
.gr-history-link:focus-visible { outline: none; text-decoration: underline; }

@media (max-width: 560px) {
  .gr-stats-2 { grid-template-columns: repeat(2, 1fr); }
}

/* ═══════════════════════════════════════════════════════════════════════
   MONTHLY GOAL REVIEW
   Built from the Goals view's own parts — gws-head for the goal header,
   gq-panel-title for the quarter line, quarter-goal-info for the quarterly goal,
   ms-row for the steps. What lives here is layout glue and nothing else, so
   the panel cannot drift into a second visual language.
═══════════════════════════════════════════════════════════════════════ */

/* Manual entry point in the Goals rail */
.grail-review {
  width: 100%;
  padding: 7px var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text-2);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--ease), color var(--ease);
}
.grail-review:hover { background: var(--surface-hover); color: var(--text-1); }

/* The line under the name of a review window — the month, the day, the quarter
   that ended. It sits UNDER the title rather than beside it: her call,
   2026-09-18. Beside it, a long one ("Q2 2026 has ended") read as part of the
   heading and pushed the whole line towards the close button. The title span is
   a flex item, so it is already a block and a block child starts a new line. */
.grv-month {
  display: block;
  margin-top: 2px;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-3);
}

/* The panel body takes the opening focus (see goalreview.js). It is a plain
   container, so it gets no ring — the buttons inside keep theirs for Tab. */
#grvBody:focus, #grvBody:focus-visible { outline: none; }

/* ══ Quarter Review ══════════════════════════════════════════════════════
   One card per quarterly goal that owes a decision, and three answers on each.
   The answers are equal in weight on purpose: continuing is the commonest one
   but not the right one, and a card that leans on a button is a card that
   answers for you. */
/* ════════════════════════════════════════════════════════════════════
   REVIEW WINDOWS — one skeleton for all three
   A review is a list of things that each need one decision, answered in a
   sitting and written only on Save. The three of them ask about different
   things, so they say different words — but the shape is the same, because
   learning it once should be enough.

   Header: what and how many.  One grouping band.  Rows of one line each.
   Answers as named buttons, never an icon.  A footer that counts what is
   still unanswered and keeps Save out of reach until nothing is.
   ════════════════════════════════════════════════════════════════════ */
.rvw-list { display: flex; flex-direction: column; gap: var(--sp-4); }
/* The same line, in the Morning and Quarter reviews — see .grv-month. */
.rvw-when {
  display: block;
  margin-top: 2px;
  font-size: .78rem; font-weight: 600; color: var(--text-3);
}

/* Exactly one level of grouping. Nesting a second one turned a review into a
   document to be navigated instead of a list to be answered. */
.rvw-band {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: 11px var(--sp-3);
  background: var(--surface);
  border: 1px solid var(--border-s);
  border-radius: var(--r-md) var(--r-md) 0 0;
}
.rvw-band-t {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: .92rem; font-weight: 700; color: var(--text-1);
}
.rvw-band-s { font-size: .74rem; color: var(--text-3); margin-top: 2px; }
/* The foot of a goal's card: the answer that belongs to the goal itself, kept
   with the answers rather than in the title row, where it read as part of the
   heading. Right-aligned, like the footer of a dialog. */
.rvw-foot {
  display: flex; justify-content: flex-end;
  padding: var(--sp-3);
  background: var(--surface);
  border: 1px solid var(--border-s);
  /* A line closing the steps off. Her call, 2026-09-18: without it the answer
     about the card floated in the same space as the answers about the steps,
     with nothing saying where one list ended. */
  border-top: 1px solid var(--border-s);
  border-radius: 0 0 var(--r-md) var(--r-md);
}
/* …so the rows above it stop being the last thing in the card. */
.rvw-group:has(.rvw-foot) .rvw-rows { border-radius: 0; border-bottom: none; }

/* Same shape as the answers on the rows above, in the app's own purple: it is a
   control of the same weight, but it answers about the goal rather than about a
   step, and reading as one of the three would invite it to be pressed as one. */
.rvw-opt-dl { color: var(--primary-ink); border-color: var(--line-strong); background: var(--surface); }
.rvw-opt-dl:hover { background: var(--primary-s); border-color: var(--line-strong); color: var(--primary-ink); }

/* A goal past its deadline, in the red the rest of the app uses for late work
   — the same values the overdue months, weeks and deadline rows carry. */
.rvw-group-late .rvw-band,
.rvw-group-late .rvw-rows,
.rvw-group-late .rvw-foot,
.rvw-group-late .rvw-inline {
  background: rgba(220,38,38,.05);
  border-color: rgba(220,38,38,.32);
}
.rvw-group-late .rvw-bandbar {
  border-left-color: rgba(220,38,38,.32);
  border-right-color: rgba(220,38,38,.32);
}
/* One bar per group and none in the rows: three progress bars stacked on one
   screen were three numbers of the same kind competing to be read. */
.rvw-bandbar {
  height: 3px; background: var(--border);
  border-left: 1px solid var(--border-s); border-right: 1px solid var(--border-s);
}
.rvw-bandbar > i { display: block; height: 100%; background: var(--primary); }
/* The same line inside a row rather than across a card, so it has no card edge
   to meet: no side borders, and a little air above the answers. */
.rvw-rowbar {
  height: 3px; background: var(--border);
  border-radius: var(--r-full);
  margin-top: 8px;
}
.rvw-rowbar > i { display: block; height: 100%; border-radius: var(--r-full); background: var(--primary); }
/* Where an answer needs one more thing — a day — it opens under its own row
   rather than in a second dialog. */
.rvw-inline {
  padding: var(--sp-3);
  background: var(--surface);
  border-left: 1px solid var(--border-s); border-right: 1px solid var(--border-s);
}
.rvw-inline .form-group { max-width: 280px; margin: 0; }
.rvw-rows {
  background: var(--surface);
  border: 1px solid var(--border-s); border-top: none;
  border-radius: 0 0 var(--r-md) var(--r-md);
  overflow: hidden;
}
.rvw-row { padding: 13px var(--sp-3); }
.rvw-row + .rvw-row { border-top: 1px solid var(--border-s); }
/* Answered rows step back so the eye finds what is still unanswered. */
.rvw-row-answered { opacity: .72; }
.rvw-row-top { display: flex; align-items: flex-start; gap: var(--sp-3); }
.rvw-row-t { font-size: var(--text-sm); font-weight: 600; color: var(--text-1); }
.rvw-row-c { font-size: .72rem; color: var(--text-3); margin-top: 2px; }
/* The corner of a review row. It used to hold exactly one mark, so it could be
   a bare span; now it holds up to three — carried, deadline, kind — and they
   need to sit apart and be allowed to wrap on a narrow phone rather than push
   the title out of the row. */
.rvw-row-badge {
  margin-left: auto;
  flex-shrink: 0;
  font-size: .72rem;
  color: var(--text-3);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}

/* The answers. Colour carries the meaning and is the same in all three
   windows: moving work on is the app's own purple, finishing is green, taking
   something away is red, and anything else stays neutral. Colour only ever
   shows on the answer that was picked — three coloured buttons per row, unpicked,
   would shout a choice that has not been made. */
.rvw-opts { display: flex; gap: var(--sp-2); margin-top: 10px; flex-wrap: wrap; }
.rvw-opt {
  font-size: .78rem; font-weight: 600; color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--border-s);
  border-radius: var(--r-sm);
  padding: 7px 14px; cursor: pointer;
  transition: background var(--ease), color var(--ease), border-color var(--ease);
}
.rvw-opt:hover { border-color: var(--text-3); color: var(--text-1); }
.rvw-opt.on { color: #fff; font-weight: 700; }
.rvw-opt-move.on { background: var(--primary); border-color: var(--line-strong); }
.rvw-opt-done.on { background: var(--success); border-color: var(--success); }
.rvw-opt-del.on  { background: var(--danger);  border-color: var(--danger); }
.rvw-opt-plain.on { background: var(--text-3); border-color: var(--text-3); }
/* "Keep in Inbox" is the one answer that changes nothing about the task, so it
   fills in the quiet grey the habit "Skip" already uses rather than in a colour
   that reads as an action taken. */
.rvw-opt-keep.on { background: var(--text-3); border-color: var(--text-3); }
/* A deadline chosen in this sitting fills the same way an answer does, and in
   the app's own purple — the colour the side panel in Goals already uses for a
   deadline that is set. The button never becomes "Cancel": it keeps its word
   and a second press folds the field away, the same as Schedule. */
.rvw-opt-dl.on { background: var(--primary); border-color: var(--line-strong); }

/* What is left to answer, beside the button that is waiting for it — in the
   modal's own footer, so it stays put while the list scrolls. */
.rvw-left { margin-right: auto; font-size: .78rem; color: var(--text-3); }

/* The quarter question, asked in the row that raised it. Set apart by a rule
   above rather than a box: it belongs to the answer directly over it, and a
   card inside a card would read as a second, competing decision. */
/* The one question in the sitting that is not a plain yes-or-no about the row
   it sits in: answering it makes a copy of a goal in another quarter. It is
   lifted onto the page's own ground so the eye stops at it instead of reading
   past a line of grey text — a rule under the row was too easy to miss. */
.rvw-qmove {
  display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap;
  margin-top: var(--sp-3);
  padding: 11px 13px;
  background: var(--bg);
  border-radius: var(--r-md);
}
/* Two lines, the way the window on the goal page puts them: the fact that made
   the question necessary, then the question itself. Both carry weight — the
   whole of it is the thing being decided. */
.rvw-qmove-text {
  flex: 1; min-width: 14rem;
  font-size: .8rem; line-height: 1.55;
  font-weight: 600; color: var(--text-1);
}
.rvw-qmove-text b { display: block; margin-top: 3px; font-weight: 600; }
/* The answer keeps the card's own ground, or it sinks into the block it sits on. */
.rvw-qmove .rvw-opt { background: var(--surface); }
/* The deadline window keeps an empty slot in every row and hides it with the
   attribute. `display: flex` above outranks the browser's own rule for [hidden],
   so without this the divider is drawn under rows that have nothing to ask. */
.rvw-qmove[hidden] { display: none; }

/* The line a row shows when the day just chosen lands after the day the work is
   due by. It states the fact and stops — the answer to it is the row's own
   Change deadline button, not something buried in here. Wears the app's
   past-the-deadline colours, so it reads as the same fact the badge above it
   is already carrying. */
.rvw-late {
  display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap;
  margin-top: var(--sp-3); padding: 11px 13px;
  background: var(--due-late-s); border-radius: var(--r-md);
}
.rvw-late-text {
  flex: 1; min-width: 14rem;
  font-size: .8rem; line-height: 1.55; font-weight: 600;
  color: var(--due-late-text);
}
.rvw-late-text b { display: block; margin-top: 3px; font-weight: 600; opacity: .8; }

/* The last look before anything is destroyed. It replaces the list rather than
   opening over it, because the app has a single modal slot — and because the
   whole point is to see everything that goes in one place. */
.rvw-confirm { padding: var(--sp-2) 0; }
.rvw-confirm-t { font-size: 1.05rem; font-weight: 700; color: var(--text-1); }

/* ── The one confirmation body ──
   Worn by every irreversible press: the delete dialogs and the second stage of
   all four reviews. They used to be four hand-written copies of nearly the same
   markup, which is how one of them came to list what was going without ever
   saying it could not be undone. */
.cfm-lead { font-size: var(--text-sm); color: var(--text-2); line-height: 1.6; margin: 0; }
.cfm-list {
  margin: var(--sp-3) 0 0; padding-left: 20px;
  font-size: var(--text-sm); color: var(--text-1); line-height: 1.7;
  /* The app strips list markers everywhere (ul, ol { list-style: none }), which
     left these reading as an indented run of sentences rather than as a list of
     separate things. Here the marker is the point: each line is one item that
     is about to go. */
  list-style: disc outside;
  /* Its own scroll, so a goal with forty steps cannot push the buttons off the
     screen — the question has to stay answerable without scrolling past it. */
  max-height: 34vh; max-height: 34dvh; overflow-y: auto;
}
.cfm-list li { margin: 0; }
.cfm-note { font-size: var(--text-sm); color: var(--text-2); margin: var(--sp-3) 0 0; }
.cfm-rest { font-size: .78rem; color: var(--text-3); margin: var(--sp-3) 0 0; }
/* A recurring event has two answers rather than one, so the choice IS the
   footer and sits in the body — laid out like a footer, on one line at the
   right, because that is where the answer to a dialog is looked for. They were
   stacked and full-width while they read "Delete only this event" / "Delete all
   events in this series"; short labels do not need the room. */
.cfm-choices {
  display: flex; flex-wrap: wrap; justify-content: flex-end;
  gap: var(--sp-3); margin-top: var(--sp-5);
}

@media (max-width: 640px) {
  .rvw-opts { flex-direction: column; }
  .rvw-opt { text-align: center; }
}

/* The two ways a quarterly goal can end, told apart at a glance. Without this
   a quarter called finished and a quarter given up on look identical the
   moment the decision is taken. */
.qend-chip {
  margin-left: var(--sp-2);
  font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-3);
  background: var(--surface-2);
  border-radius: var(--r-full);
  padding: 2px 8px;
  vertical-align: middle;
}
.qend-chip.qend-done { color: var(--success); }

.grv-list { display: flex; flex-direction: column; gap: var(--sp-4); }
.grv-none { padding: var(--sp-6) var(--sp-2); color: var(--text-3); font-size: var(--text-base); }

/* One card per goal — the only box in the panel. */
.grv-goal {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  overflow: hidden;
}
/* In Goals the header is a card in its own right, floating above the plan. Here
   it is the top of one card, so it drops its border, corners and shadow — two
   nested outlines read as a seam across the goal, not as structure. */
.grv-goal .gws-head {
  padding: var(--sp-4) var(--sp-5);
  border: none;
  border-radius: 0;
  box-shadow: none;
  margin-bottom: 0;
}
.grv-mode { margin-top: 0; }
/* Two controls, not two halves of one: the plan opens, the deadline moves.
   They sit on a line together but keep their own shapes so neither reads as
   the unselected half of the other. */
.grv-actions { display: flex; align-items: center; gap: var(--sp-3); margin-top: var(--sp-3); }
.grv-dl-btn {
  background: none; border: none; cursor: pointer;
  font-size: .78rem; font-weight: 600; color: var(--text-3);
  padding: 5px 0;
  transition: color var(--ease);
}
.grv-dl-btn:hover { color: var(--primary-ink); }
/* A date chosen in this sitting and not yet written down. */
/* One toggle, two labels — Show plan and Hide plan are the same control and
   look the same. The raised `on` state is for picking between siblings. */
.grv-mode button.on { background: none; box-shadow: none; color: var(--text-3); }

/* Plan area, three levels deep. A year's plan can run to several quarters with
   several goals each, so each level gets its own weight: the quarter is a
   filled band, the quarterly goal a bordered block, the steps a plain list. */
.grv-body { padding: 0 var(--sp-5) var(--sp-4); }
.grv-q + .grv-q { margin-top: var(--sp-5); }

.grv-q-hdr {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-2);
  padding: 6px var(--sp-3);
  margin-bottom: var(--sp-3);
  background: var(--surface-2);
  border-radius: var(--r-sm);
}
.grv-q-hdr .gq-panel-title { text-transform: uppercase; letter-spacing: .04em; }

.grv-sub {
  border: 1px solid var(--border-s);
  border-radius: var(--r-md);
  padding: var(--sp-3);
}
.grv-sub + .grv-sub { margin-top: var(--sp-3); }

/* The goal's own summary sits above a hairline; everything below it is steps. */
.grv-qgoal {
  padding: 0 var(--sp-1) var(--sp-3);
  border-bottom: 1px solid var(--border-s);
  margin-bottom: var(--sp-2);
}
.grv-qgoal-top { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-2); }
.grv-qgoal-top .qg-substatus { margin-top: 0; white-space: nowrap; }

/* The schedule button is the point of the row, so it does not wait for hover
   the way the Goals row actions do — on touch that hover never arrives. */
.grv-body .ms-row-actions,
.grv-step .ms-row-actions { opacity: 1; }

/* A lapsed period is worth the colour but not the weight — bold on every late
   row turns a list into a wall of shouting. The month in progress stays in the
   ordinary grey the rest of the dates use. */
.grv-step .ms-row-date.late { color: var(--danger); }

/* The quarter is past and says so; this says the question was already
   answered. Neutral on purpose — "overdue" is a nudge, this is a receipt, and
   two red chips on one row would read as two problems. */
.grv-cont-chip {
  font-size: .68rem; font-weight: 600; color: var(--text-3);
  background: var(--surface-2); border: 1px solid var(--border-s);
  border-radius: 999px; padding: 2px 9px; white-space: nowrap;
}
.grv-late-chip { background: var(--danger-s); color: var(--danger-text); }

/* Confirmation that the step is now in the task list. Sits where the schedule
   button was, so the row visibly changes state the moment the day is picked. */
.grv-planned {
  gap: 4px;
  background: var(--success-s);
  color: var(--success-text);
}
.grv-planned svg { width: 9px; height: 9px; }

/* Schedule panel — a day, nothing more. Inline because the app has a single
   modal slot and a dialog cannot open over this one. The field inside is the
   app's ordinary form-group/form-label/form-input Date field; only the tinted
   tray around it belongs to this panel.

   Row and tray share one tint and one outline, with no seam between them: the
   panel belongs to the step above it, and floating it off on its own read as a
   second, unrelated field. */
.grv-step-open .ms-row,
.grv-pform { background: var(--surface-2); }
.grv-step-open .ms-row {
  border-radius: var(--r-md) var(--r-md) 0 0;
}
.grv-pform {
  margin: 0;
  padding: 0 var(--sp-3) var(--sp-3);
  border-radius: 0 0 var(--r-md) var(--r-md);
}
/* A step row is narrow; left alone the field would stretch the whole modal. */
.grv-pform .form-group { max-width: 280px; }

/* ═══════════════════════════════════════════════════════════════════
   PHONES — everything below is inside a width or hover query, so a
   desktop browser never reads a line of it.

   The app was built for a wide screen and then squeezed. Two habits of
   that build break a phone, and almost everything here undoes one of
   them:

     · a grid or flex child keeps its own content width unless it is
       told it may shrink (min-width: 0). Without it a card holds its
       desktop width inside a 335px column, the page grows wider than
       the screen, and every centred dialog lands half off it;

     · rows that pack five things onto one line — title, badge, count,
       bar, percentage — have nothing left for the title. On a phone
       the name comes first and the rest wraps underneath.

   A touch screen has no hover, so anything the app only reveals on
   hover has to be visible here or it cannot be reached at all.
   ═══════════════════════════════════════════════════════════════════ */

/* ── Controls that only appear on hover ── */
@media (hover: none) {
  /* The three buttons on a task row are the only way to schedule, edit
     or delete it — there is no other tap target for them. */
  .tasks-row-actions .task-sched-btn,
  .tasks-row-actions .task-actions { opacity: 1; }
}

/* ── Today ── */
@media (max-width: 640px) {
  /* Title first, on its own line, then the buttons right-aligned under
     it — instead of a name cut to "Review Q2 …" beside three icons. */
  .dash-task-row { flex-wrap: wrap; align-items: center; row-gap: 6px; }
  .dash-task-content { flex: 1 1 auto; }
  .dash-task-title { white-space: normal; overflow: visible; text-overflow: clip; }
  .dash-task-row .tasks-row-actions { order: 9; min-width: 0; margin-left: auto; }
  .dash-task-row .sort-badge { order: 8; }

  /* Keep the category beside the title; progress has its own row. */
  .dash-goal-line {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 64px auto;
  }
  .dash-goal-heading { grid-column: 1 / -1; }
  .dash-goal-steps { grid-column: 1; margin-left: 0; text-align: left; }
  .dash-goal-bar { grid-column: 2; }
  .dash-goal-pct { grid-column: 3; }
}

/* ── Review windows ── */
@media (max-width: 640px) {
  /* The same habit as the task row above, in the three windows that ask
     questions. A row now carries up to three marks — how long it has been
     slipping, when it is due by, what kind of work it is — and together they
     want 250px of a 310px line. The title was left with one word per line and
     the last mark still hung off the card.

     So the marks drop under the name, where they read left to right like a
     sentence, and the name gets the whole line. */
  .rvw-row-top { flex-wrap: wrap; row-gap: 6px; }
  .rvw-row-top > div:first-child { flex: 1 1 100%; min-width: 0; }
  .rvw-row-badge { margin-left: 0; width: 100%; justify-content: flex-start; }

  /* And the same for the band at the top of a card, for the same reason and
     with a twist: the rule above already made every mark a full line, but the
     band was not allowed to wrap, so a 100%-wide mark squeezed the title into a
     column two words wide. Measured at 375px on a quarter card, whose line is
     the longest in the window: "Launch first offer" came out one word per
     line. */
  .rvw-band { flex-wrap: wrap; row-gap: 6px; }
  .rvw-band > div:first-child { flex: 1 1 100%; min-width: 0; }
}

/* ── Goals ── */
@media (max-width: 640px) {
  /* Four quarter cards side by side need 456px between them. Two rows of
     two fit a phone and keep every quarter the same size. */
  .gq-tabs { display: grid; grid-template-columns: 1fr 1fr; }

  /* The goal's own name was squeezed into 104px beside a 294px row of
     controls, and came out stacked one word per line. The controls move
     under it instead. */
  .gws-head-top { flex-wrap: wrap; }
  .gws-head-actions { flex: 1 1 100%; flex-wrap: wrap; }
  .gws-sub { flex-wrap: wrap; }
  .gws-sub-deadline { margin-left: 0; }
}

/* ── Calendar, month view ── */
@media (max-width: 560px) {
  /* Seven columns on a phone leave each day 44px wide, and a name in that
     space reads "M…". The day list under the grid already spells out
     whatever day is selected, so up here each event becomes a dot: how
     busy the day is, at a glance, which is what a month view is for.
     The whole cell is one tap target — the dot does not take the tap,
     and an event is opened from the list below, where it has a name. */
  .cal-cell { min-height: 62px; padding: 5px 4px; }
  .cal-cell .cal-event-pill {
    display: inline-block;
    width: 7px; height: 7px; padding: 0; margin: 0 3px 3px 0;
    border-radius: var(--r-full);
    /* The pill's own background is a 15% tint set on the element, which at
       dot size is invisible; --ev carries the event's real colour. */
    background: var(--ev, var(--primary)) !important;
    text-indent: -999px; overflow: hidden; white-space: nowrap;
    pointer-events: none;
  }
  .cal-more-pill { display: inline-block; font-size: 9px; padding: 0; }
}

/* ── Calendar, week view ── */
@media (max-width: 700px) {
  /* Seven days of hours cannot fit a phone, and stretched to fit they would
     be unreadable. The card scrolls sideways on its own instead, so the
     page underneath stays exactly as wide as the screen — a page wider
     than the phone is what drags every centred dialog half off it. */
  .cal-layout > * { min-width: 0; }
  .cal-time-view { overflow-x: auto; }
  .cal-time-header, .cal-time-body { min-width: 520px; }
}

/* ── Fingers, not a pointer ──
   A finger needs about 44px to hit something reliably; a mouse needs the
   size of an arrow tip. Everything the app draws was sized for the arrow.
   Where the shape matters — a small round tick, a colour swatch — the
   drawing stays exactly as it is and an invisible pad around it carries
   the touch. Everything else simply grows. */
@media (max-width: 640px) {
  /* The tick on a task row: the most-pressed control in the app, and 20px
     across. The circle is left alone; the target around it is not. */
  .task-checkbox { position: relative; }
  .task-checkbox::after { content: ''; position: absolute; inset: -12px; }

  /* Icon buttons — schedule, edit, delete, month arrows, board tools. */
  .btn-icon.btn-sm,
  .btn.btn-icon,
  .notes-row-act,
  .notes-compose,
  .nt-btn,
  .quick-add-ico,
  .vbc-tool,
  .vbc-zoom-btn,
  .vbc-boards-toggle { min-width: 44px; min-height: 44px; }

  /* A note's colour: the swatch keeps its size so the row still reads as a
     row of colours, and the pad does the catching. */
  .nt-color { position: relative; }
  .nt-color::after { content: ''; position: absolute; inset: -13px; }

  /* Tabs and segmented switches: wide enough already, far too short. */
  .dash-task-tab,
  .tasks-view-tab,
  .view-btn,
  .set-seg-btn,
  .sort-toggle button,
  .gws-year,
  .gws-mode button { min-height: 44px; }

  /* Every ordinary button, whatever it says — including the short ones
     whose label is a single word ("All"). */
  .btn { min-height: 44px; min-width: 44px; }

  /* Anything typed into or chosen from. A 27px-tall name field is a target
     for a cursor, not a thumb. */
  input[type="text"], input[type="email"], input[type="password"],
  input[type="number"], input[type="search"], input[type="url"],
  input[type="date"], input[type="time"], select, textarea { min-height: 44px; }
  /* Except the three little boxes of a date or a time, which are one field
     between them: the field already answers a tap, and 44px each would make
     a date three fingers wide. */
  .datefield-seg, .timefield-seg { min-height: 0; }

  /* Rows that are one wide target from edge to edge. */
  .wl-nav-item,
  .wl-new-list-btn,
  .grail-review,
  .acct-row,
  .vbc-board,
  .vbc-board-add,
  .agenda-event { min-height: 44px; }

  /* Typing fields. The bar's own padding made the row tall enough to see,
     but the field itself — the part that answers a tap — was 18px. */
  .quick-add-input,
  .notes-search-input { min-height: 44px; }

  /* The remaining segmented switches, under their own names. */
  .grail-seg button,
  .pr-tabs button { min-height: 44px; }

  /* Four equal tabs fill the mobile row without wrapping their labels. */
  #page-profile .pr-tabs,
  #page-tasks .tasks-view-tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: 100%;
    min-width: 0;
  }
  #page-profile .pr-tabs button,
  #page-tasks .tasks-view-tab {
    min-width: 0;
    padding-inline: 4px;
    text-align: center;
    white-space: nowrap;
  }

  #page-tasks #inboxList > .inbox-empty-msg,
  #page-tasks .habits-add-desktop,
  #page-tasks .habits-empty-msg { display: none; }
  #page-tasks .habits-add-mobile { display: block; padding: 16px 20px; }
  #page-tasks .habits-add-mobile button {
    min-height: 48px;
    border-radius: 12px;
    font-size: 16px;
    text-align: center;
  }
  #page-tasks .dash-hdr-right:has(.sort-toggle) { width: 100%; }
  #page-tasks .dash-tasks-hdr .sort-toggle {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    min-width: 0;
  }
  #page-tasks .dash-tasks-hdr .sort-toggle button {
    min-width: 0;
    text-align: center;
    white-space: nowrap;
  }

  #page-calendar .cal-add-desktop { display: none; }
  #page-calendar .cal-add-mobile {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 48px;
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 16px;
  }
  #page-calendar .calendar-toolbar .view-toggle {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }
  #page-calendar .view-btn { min-width: 0; text-align: center; }

  #page-dashboard .dash-tasks-hdr { gap: 8px; }
  #page-dashboard .dash-hdr-right { width: 100%; }
  #page-dashboard .dash-hdr-right:not(:has(.sort-toggle)) { display: none; }
  #page-dashboard .dash-task-view-tabs,
  #page-dashboard .dash-tasks-hdr .sort-toggle {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    min-width: 0;
  }
  #page-dashboard .dash-task-tab,
  #page-dashboard .dash-tasks-hdr .sort-toggle button {
    min-width: 0;
    text-align: center;
    white-space: nowrap;
  }
  #page-dashboard .dash-tasks-hdr .sort-toggle button.active {
    background: var(--surface-3);
    box-shadow: none;
  }

  /* A switch keeps its shape — 42 by 24 is what a switch looks like — and
     the pad around it carries the touch. Same for the plain tick boxes
     under the reminder stages. */
  .toggle-switch { position: relative; }
  .toggle-switch::after { content: ''; position: absolute; inset: -10px; }
  .set-check input[type="checkbox"] { width: 22px; height: 22px; position: relative; }
  .set-check { position: relative; }
  .set-check::after { content: ''; position: absolute; inset: -11px; }

  /* A shop link in a wishlist row, and the links on the account page: text,
     so they cannot simply grow — the line they sit on does instead. */
  .wish-link,
  .acct-row-link { display: inline-flex; align-items: center; min-height: 44px; }

  /* Save is always in sight, so a long form does not have to be scrolled
     back down before it can be kept. */
  .modal-footer {
    position: sticky;
    bottom: 0;
    background: var(--surface);
    border-radius: 0;
  }
}

/* Mobile Goals uses the existing rail and workspace as two screens. All
   planning controls and step renderers remain shared with desktop. */
@media (max-width: 760px) {
  #page-goals .goals-redesign { gap: 0; width: 100%; }
  #page-goals .goals-workspace { display: none; width: 100%; }
  #page-goals .goals-mobile-detail .goals-rail { display: none; }
  #page-goals .goals-mobile-detail .goals-workspace { display: block; }
  #page-goals .goals-mobile-nav {
    display: flex; align-items: center; justify-content: space-between;
    margin: calc(-1 * var(--sp-4)) calc(-1 * var(--sp-4)) var(--sp-4);
    padding: 6px 12px; border-bottom: 1px solid var(--border);
  }
  #page-goals .goals-mobile-nav button {
    min-height: 44px; padding: 0 var(--sp-2); border: none;
    background: transparent; color: var(--primary-ink); font: inherit;
    font-weight: 400;
  }
  #page-goals .goals-mobile-nav .gws-mobile-more { color: var(--text-2); padding: 0; }
  #page-goals .grail-row { display: none; }
  #page-goals .grail-seg { display: flex; width: 100%; margin-top: 0; }
  #page-goals .grail-seg button { flex: 1; min-width: 0; min-height: 44px; padding: 5px 8px; }
  #page-goals .grail-list { overflow: visible; }
  #page-goals .grail-card.sel { background: none; border-color: transparent; }
  #page-goals .grail-card-title { white-space: normal; overflow-wrap: anywhere; }
  #page-goals .grail-card-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px var(--sp-2);
    align-items: start;
  }
  #page-goals .grail-card-meta { display: contents; }
  #page-goals .grail-card-meta > .badge { grid-column: 2; }
  #page-goals .grail-card-steps { grid-column: 1 / -1; }
  #page-goals .grail-review { min-height: 48px; }
  #page-goals .gws-head { padding: var(--sp-4); }
  #page-goals .gws-head-top { flex-wrap: wrap; gap: var(--sp-2); }
  #page-goals .gws-head-info { width: 100%; display: flex; align-items: flex-start; gap: var(--sp-2); }
  #page-goals .gws-head-info .gws-title { flex: 1; min-width: 0; }
  #page-goals .gws-mobile-more {
    display: grid; place-items: center; flex: none; width: 44px; height: 44px;
    padding: 0; border: none; border-radius: var(--r-sm);
    background: transparent; color: var(--text-2);
  }
  #page-goals .gws-mobile-more svg { display: block; width: 24px; height: 24px; }
  #page-goals .gws-head-actions > button { display: none; }
  #page-goals .qg-hover-actions { display: none; }
  #page-goals .gws-title { font-size: 1.25rem; overflow-wrap: anywhere; }
  #page-goals .gws-head-actions { flex-wrap: wrap; gap: var(--sp-1); }
  /* The year has a 44px touch target; centre the static mode label beside it. */
  #page-goals .gws-mode { align-items: center; }
  #page-goals .gws-mode-fixed {
    display: inline-flex; align-items: center; min-height: 44px;
    line-height: 1.2; white-space: nowrap;
  }
  #page-goals .gws-year { min-height: 44px; line-height: 1.2; }
  #page-goals .gws-sub { flex-wrap: wrap; }
  #page-goals .gws-sub-deadline { margin-left: 0; }
  #page-goals .gws-progress { margin-top: var(--sp-3); }
  #page-goals .gq-tabs { gap: 4px; }
  #page-goals .gq-tab { min-width: 0; padding: 10px 6px; }
  #page-goals .gq-tab-r, #page-goals .gq-tab-c { overflow-wrap: anywhere; }
  .modal-wrapper:is(.goals-actions-sheet, .row-actions-sheet) { align-items: flex-end; padding: 0; }
  .modal, .modal-header, .modal-footer { border-radius: 0; }
  :is(.goals-actions-sheet, .row-actions-sheet) .modal {
    width: 100%; max-width: 100%; margin: 0;
    border-radius: 0;
  }
  :is(.goals-actions-sheet, .row-actions-sheet) .modal-body { padding-bottom: max(var(--sp-5), env(safe-area-inset-bottom)); }
  :is(.gws-mobile-action-list, .row-action-list) { display: flex; flex-direction: column; }
  :is(.gws-mobile-action, .row-menu-action) {
    display: flex; align-items: center; gap: var(--sp-4); width: 100%;
    min-height: 56px; padding: var(--sp-3) var(--sp-2); border: none;
    background: transparent; color: var(--text-1); text-align: left; font-size: 1rem;
  }
  :is(.gws-mobile-action, .row-menu-action) svg { width: 21px; height: 21px; flex: none; color: var(--text-2); }
  :is(.gws-mobile-action, .row-menu-action):hover { background: var(--surface-2); }
  :is(.gws-mobile-action, .row-menu-action).danger {
    margin-top: var(--sp-2); border-top: 1px solid var(--border-s); color: var(--danger);
  }
  :is(.gws-mobile-action, .row-menu-action).danger svg { color: var(--danger); }
}

@media (max-width: 760px) {
  :is(#page-dashboard, #page-tasks) .task-action-menu { opacity: 1; }
  :is(#page-dashboard, #page-tasks) .task-action-menu > button:not(.task-mobile-more) { display: none; }
  :is(#page-dashboard, #page-tasks) .task-mobile-more {
    display: grid; place-items: center; flex: none; width: 44px; height: 44px;
    padding: 0; border: none; border-radius: var(--r-sm);
    background: transparent; color: var(--text-2);
  }
  :is(#page-dashboard, #page-tasks) .task-mobile-more svg { display: block; width: 24px; height: 24px; }
  /* Completed dashboard rows have no extra actions: no empty menu. */
  :is(#page-dashboard, #page-tasks) .task-action-menu:not(:has(> button:not(.task-mobile-more))) { display: none; }
  :is(#page-dashboard, #page-tasks) .tasks-row-actions { min-width: 0; }
}

/* Keep the mobile label and menu together; only the title consumes flexible
   space. Secondary dates live below it and cannot push the menu to a new row. */
@media (max-width: 760px) {
  :is(#page-dashboard, #page-tasks) .dash-task-row {
    display: grid; grid-template-columns: 20px minmax(0, 1fr) max-content 44px;
    column-gap: 6px; row-gap: 4px; align-items: start;
    padding-left: var(--sp-4); padding-right: var(--sp-3);
  }
  :is(#page-dashboard, #page-tasks) .dash-task-row > .task-checkbox {
    grid-column: 1; grid-row: 1; margin-top: 12px;
  }
  :is(#page-dashboard, #page-tasks) .dash-task-content {
    grid-column: 2; grid-row: 1; min-width: 0; min-height: 44px;
  }
  :is(#page-dashboard, #page-tasks) .dash-task-row:not(:has(> .task-checkbox)) .dash-task-content {
    grid-column: 1 / 3;
  }
  :is(#page-dashboard, #page-tasks) .dash-task-title {
    white-space: normal; overflow-wrap: anywhere; overflow: visible; text-overflow: clip;
  }
  :is(#page-dashboard, #page-tasks) .dash-task-row > .sort-badge {
    grid-column: 3; grid-row: 1; justify-self: end; align-self: start;
    margin: 12px 0 0; order: initial;
  }
  :is(#page-dashboard, #page-tasks) .dash-task-row > .tasks-row-actions { display: contents; }
  :is(#page-dashboard, #page-tasks) .dash-task-row .task-action-menu {
    /* Override the desktop three-button minimum too, otherwise the menu
       overflows its 44px grid column and is clipped outside the card. */
    grid-column: 4; grid-row: 1; width: 44px; min-width: 0; margin: 0; gap: 0;
    justify-content: center;
  }
  /* Her call, 15 October 2026: the two dates share ONE line and sit at the
     right edge, under HIGH and the three dots — not stacked under the title,
     one above the other. They are one box here, so the space between them is
     the gap below and nothing else; placing them as two grid items of their
     own left a hole as wide as the columns they happened to land in.
     A row with neither date has an empty box, and an empty box is not drawn:
     otherwise every task on the page would carry a second, blank line. */
  :is(#page-dashboard, #page-tasks) .dash-task-row > .task-dates {
    display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center;
    gap: var(--sp-2);
    grid-column: 2 / 5; grid-row: 2; justify-self: end;
    max-width: 100%; min-width: 0;
  }
  :is(#page-dashboard, #page-tasks) .dash-task-row > .task-dates:empty { display: none; }
  :is(#page-dashboard, #page-tasks) .dash-task-row .task-dates > * {
    max-width: 100%; white-space: normal; overflow-wrap: anywhere;
  }
  /* The schedule follows the full title; only the menu reserves a column. */
  #page-tasks .dash-task-row.habits-list-row {
    grid-template-columns: minmax(0, 1fr) 44px;
  }
  #page-tasks .dash-task-row.habits-list-row .dash-task-content {
    grid-column: 1; padding-top: 10px; padding-bottom: 10px;
  }
  #page-tasks .habits-list-row .task-action-menu {
    grid-column: 2;
  }
  /* History has no action menu, so it needs no reserved fourth column. */
  #page-tasks .dash-task-row.past-row {
    grid-template-columns: 20px minmax(0, 1fr) max-content;
    padding-right: var(--sp-4);
  }
}

/* Notes on a phone: a list or a document, each using the full pane. */
@media (max-width: 760px) {
  /* Keep iOS caret scrolling inside the document, not the whole app. The
     visual viewport can move independently of the layout viewport. */
  body.notes-editor-active { position: fixed; inset: 0; overflow: hidden; }
  body.notes-editor-active #page-notes { animation: none; transform: none; }
  body.notes-editor-active .top-header {
    position: fixed; top: var(--visible-top, 0px); left: 0; right: 0;
  }
  /* The legal links sit at the end of the page, so a pinned editor — which is
     taken out of the flow and sized to the visible strip — used to come down
     on top of them: her screenshot of 28 October 2026 has them beside the
     B / I / list / Aa row. Her call: they belong at the very bottom, on their
     own. So the card stops short of them.

     Which of the two heights applies decides itself, with no class to keep in
     step. Keyboard down, the strip is the whole screen and the second term
     wins, leaving the links their line underneath. Keyboard up, the strip is
     a fraction of it and the first term wins — the links are below the
     keyboard and out of sight anyway, and a note being written into must not
     give up a line of room for something nobody can see.
     --legal-h is the links' own line: 12px of padding each side, a 0.68rem
     line, and the hairline above it. */
  body.notes-editor-active #page-notes .notes-app {
    --legal-h: 44px;
    position: fixed; left: 20px; right: 20px;
    top: calc(var(--visible-top, 0px) + var(--header-h) + 12px);
    height: min(calc(var(--visible-h, 100dvh) - var(--header-h) - 24px),
                calc(100dvh - var(--header-h) - 24px - var(--legal-h)));
    min-height: 0;
  }
  #page-notes .notes-app { min-height: 180px; flex-direction: column; }
  #page-notes .notes-sidebar { width: 100%; max-height: none; flex: 1; min-height: 0; border: 0; }
  #page-notes .notes-detail { display: none; min-height: 0; }
  #page-notes .notes-show-detail .notes-sidebar { display: none; }
  #page-notes .notes-show-detail .notes-detail { display: flex; }
  #page-notes .notes-search-wrap { min-width: 0; }
  #page-notes .notes-search-input { font-size: 16px; height: 48px; }
  #page-notes .notes-compose { width: 48px; height: 48px; background: var(--primary); color: #fff; }
  #page-notes .notes-list { padding: 12px; }
  #page-notes .notes-group-label { padding: 16px 8px 8px; font-size: 12px; color: var(--text-3); }
  #page-notes .notes-row { background: var(--surface); border-bottom: 1px solid var(--border); border-radius: 0; margin: 0; }
  #page-notes .notes-row-main { padding: 16px 12px; }
  #page-notes .notes-row-title { display: block; font-size: 16px; }
  #page-notes .notes-row-pin { margin-left: 6px; }
  #page-notes .notes-row-sub { margin-top: 6px; font-size: 13px; }
  #page-notes .notes-row-actions { display: none; }
  #page-notes .note-mobile-nav { display: flex; justify-content: space-between; align-items: center; padding: 6px 12px; border-bottom: 1px solid var(--border); }
  #page-notes .note-mobile-back { min-height: 44px; padding: 0 8px; background: transparent; border: 0; font: inherit; color: var(--primary-ink); cursor: pointer; }
  /* A row, said out loud. Every button in here is display:flex, which on a
     block parent means one PER LINE: the moment the diagnostics button
     joined the "...", the two stacked and the navigation grew from 57px to
     101px - measured - taking 44px off an editing pane that is 129px tall
     with the keyboard up. */
  #page-notes .note-mobile-actions { display: flex; align-items: center; }
  #page-notes .note-mobile-actions > button { display: none; }
  #page-notes .note-mobile-actions .task-mobile-more { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; border: 0; background: transparent; color: var(--text-2); }
  #page-notes .note-mobile-actions svg { width: 24px; height: 24px; }
  #page-notes .note-title-input { padding: 12px 20px 0; font-size: 26px; }
  #page-notes .note-body { padding: 12px 20px 24px; font-size: 16px; overflow-wrap: anywhere; }
  /* ── but not inside a table ───────────────────────────────────────────
     Her report, 29 October 2026, with a picture of a column reading
     "Пгмг / мг / Гргр / ршр": she could not write more than four characters
     on a line. Measured at 375 wide: a cell is 60 across, 38 of it is text,
     and a capital is 11.56 — three characters, then the word is cut in half
     and carried on underneath.

     `overflow-wrap: anywhere` is a phone-only rule, added so that a long web
     address in a note wraps instead of widening the page. A paragraph has
     nowhere to grow sideways; a table CELL has. Left normal, a word too long
     for its column widens the column and the table scrolls sideways — which
     is what the same table does on a computer, where this rule has never
     applied. Measured after: "Пгмгмгргргршр" goes from three chopped lines
     to one whole one, and "Spotkanie" from "Spo/tkan/ie" to itself. */
  #page-notes .note-body td, #page-notes .note-body th { overflow-wrap: normal; }
  #page-notes .note-scroll { min-width: 0; scroll-behavior: auto; }
  #page-notes .note-mobile-nav { flex: none; }
  /* ── One bar, everything on it ────────────────────────────────────────
     Her call, 29 October 2026: "мне не нравится, что все скрыто за буквочка
     А. Как-то очень неинтуитивно." The phone showed four buttons and kept
     the other eight behind "Aa" — the one place where the phone did not
     match the computer, against the rule that a phone changes only what can
     be seen and reached, never the functions themselves.

     Measured at 375 points: the bar is 333 wide and the whole row needs 594,
     so it has to move sideways; seven of the twelve are in view at once.
     Arrows were drawn and measured too — they cost two of those seven, a
     third of what can be seen — so the edge fades instead, and only the edge
     that still has something behind it. ── */
  #page-notes .note-toolbar {
    order: 5; flex: none; height: 58px;
    padding: 6px 12px max(6px, env(safe-area-inset-bottom));
    justify-content: flex-start; gap: 2px; flex-wrap: nowrap;
    overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain;
  }
  #page-notes .note-toolbar::-webkit-scrollbar { display: none; }
  #page-notes .note-toolbar .nt-btn,
  #page-notes .note-toolbar .nt-colors,
  #page-notes .note-toolbar .nt-color { flex: none; }
  #page-notes .note-toolbar .nt-btn { min-width: 44px; height: 44px; font-size: 18px; }
  #page-notes .note-toolbar .nt-colors { display: inline-flex; align-items: center; gap: 6px; padding-left: 4px; }
  #page-notes .nt-color { width: 44px; height: 44px; border-width: 9px; }
  /* The fade is painted by a mask, so it dims whatever is under it rather
     than laying a colour over it — the bar sits on the card, and a solid
     patch the colour of the card would show as a smudge the moment the card
     is not quite that colour. */
  #page-notes .note-toolbar.nt-more-right {
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent);
            mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent);
  }
  #page-notes .note-toolbar.nt-more-left {
    -webkit-mask-image: linear-gradient(to right, transparent, #000 24px);
            mask-image: linear-gradient(to right, transparent, #000 24px);
  }
  #page-notes .note-toolbar.nt-more-left.nt-more-right {
    -webkit-mask-image: linear-gradient(to right, transparent, #000 24px, #000 calc(100% - 24px), transparent);
            mask-image: linear-gradient(to right, transparent, #000 24px, #000 calc(100% - 24px), transparent);
  }
}

/* Wishlist: choose a list, then browse compact items on a phone. */
@media (max-width: 760px) {
  #page-wishlist .wl-body { display: block; }
  #page-wishlist .wl-sidebar { width: 100%; }
  #page-wishlist .wl-content { display: none; width: 100%; max-width: none; padding: 16px; }
  #page-wishlist .wl-show-items .wl-sidebar { display: none; }
  #page-wishlist .wl-show-items .wl-content { display: block; }
  #page-wishlist .wl-mobile-heading { display: block; margin: 8px 12px 16px; font-size: 22px; }
  /* The same heading twice. "My Lists" labelled the group under it because
     "My Wishlist" sat above it and was not part of it; with that view gone it
     labels the whole sidebar, which on a phone the line above already does, in
     the same words. The desktop keeps it - there it is the only one. */
  #page-wishlist .wl-nav-section { display: none; }
  #page-wishlist .wl-nav-item { min-height: 64px; padding: 14px 12px; font-size: 16px; }
  #page-wishlist .wl-nav-name { white-space: normal; overflow-wrap: anywhere; }
  #page-wishlist .wl-nav-item.active { background: transparent; color: var(--text-1); box-shadow: none; font-weight: 500; }
  #page-wishlist .wl-new-list-btn { min-height: 48px; padding: 12px 16px; margin-top: 16px; border-radius: 12px; font-size: 16px; }
  #page-wishlist .wl-mobile-add { display: block; }
  /* The bar across the top of an open list: "< Lists" at one end, the list's
     own "..." at the other, the way a note's reads. The header below it is a
     column so the bar can be lifted above the name without the name having to
     share its line with anything. */
  #page-wishlist .wl-content-hdr { display: flex; flex-direction: column; align-items: stretch; gap: 0; margin-bottom: 4px; }
  #page-wishlist .wl-hdr-right { order: -1; display: block; margin-left: 0; }
  #page-wishlist .wl-mobile-nav { display: flex; justify-content: space-between; align-items: center; width: calc(100% + 32px); min-height: 56px; margin: -16px -16px 16px; padding: 6px 12px; border-bottom: 1px solid var(--border); }
  #page-wishlist .wl-mobile-back { display: flex; align-items: center; min-height: 44px; padding: 0 8px; border: 0; background: transparent; color: var(--primary-ink); font: inherit; cursor: pointer; }
  #page-wishlist .wl-content-title { font-size: 23px; overflow-wrap: break-word; min-width: 0; }
  #page-wishlist .wl-mobile-count { display: block; font-size: 13px; color: var(--text-3); margin-bottom: 20px; }
  #page-wishlist .wl-desktop-add, #page-wishlist .wl-list-actions > button { display: none; }
  #page-wishlist .wl-list-actions .task-mobile-more { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; background: transparent; border: 0; color: var(--text-2); }
  #page-wishlist .task-mobile-more svg { width: 24px; height: 24px; }
  #page-wishlist .wishlist-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  #page-wishlist .wishlist-grid:has(.wl-empty-space),
  #page-wishlist .wl-content:has(.wl-empty-space) .wl-mobile-count { display: none; }
  #page-wishlist .wish-card { position: relative; flex-direction: row; align-items: center; gap: 12px; padding: 12px 32px 12px 12px; box-shadow: none; min-height: 98px; }
  #page-wishlist .wish-card:hover { transform: none; }
  #page-wishlist .wish-card-img { width: 64px; height: 72px; flex: 0 0 64px; border-radius: 10px; }
  #page-wishlist .wish-tile-letter { font-size: 28px; }
  #page-wishlist .wish-tile-host { display: none; }
  #page-wishlist .wish-card-body { padding: 0; min-width: 0; }
  #page-wishlist .wish-card-title { font-size: 15px; margin: 0; overflow-wrap: anywhere; }
  #page-wishlist .wish-card-desc, #page-wishlist .wish-link, #page-wishlist .wish-card-actions { display: none; }
  #page-wishlist .wish-card-footer { border: 0; padding: 0; margin: 6px 0 0; }
  #page-wishlist .wish-card-footer:not(:has(.wish-reserved)) { display: none; }
  #page-wishlist .wl-mobile-item-open { display: flex; align-items: center; justify-content: flex-end; position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; padding: 10px; border: 0; background: transparent; color: var(--text-3); font-size: 24px; cursor: pointer; border-radius: inherit; }
  #page-wishlist .wl-mobile-item-open:focus-visible { outline: 2px solid var(--primary); outline-offset: -3px; }
  .wish-detail-card { border: 0; box-shadow: none; }
  .wish-detail-card:hover { transform: none; box-shadow: none; }
  .wish-detail-card .wish-card-img { height: 160px; aspect-ratio: auto; border-radius: 12px; }
  .wish-detail-card .wish-card-img img { object-fit: contain; }
  .wish-detail-card .wish-card-body { padding: 16px 0 0; }
  .wish-detail-card .wish-card-title { overflow-wrap: anywhere; }
}

/* Mobile Vision Board: explicit board list and a touch workspace. */
@media (max-width: 760px) {
  #page-visionboard .vb-shell { display: block; min-height: 300px; }
  #page-visionboard .vbc-boards { position: static; width: 100%; height: auto; max-width: none; transform: none; visibility: visible; opacity: 1; }
  #page-visionboard .vbc-boards-list { overflow: visible; gap: 10px; }
  #page-visionboard .vbc-boards-label { font-size: 22px; text-transform: none; letter-spacing: -.3px; color: var(--text-1); }
  #page-visionboard .vbc-board { min-height: 96px; border: 1px solid var(--border); padding: 12px; gap: 12px; }
  #page-visionboard .vbc-board.active { color: var(--text-1); background: var(--surface); }
  #page-visionboard .vbc-board-name { white-space: normal; overflow-wrap: anywhere; font-size: 16px; }
  #page-visionboard .vbc-mobile-preview { display: flex; align-items: center; justify-content: center; overflow: hidden; width: 72px; height: 72px; flex: 0 0 72px; border-radius: 10px; background: var(--surface-2); color: var(--text-2); font-size: 12px; text-align: center; }
  #page-visionboard .vbc-mobile-preview img { width: 100%; height: 100%; object-fit: cover; }
  #page-visionboard .vbc-mobile-arrow { display: block; color: var(--text-3); font-size: 22px; }
  #page-visionboard .vbc-board-add { min-height: 48px; margin-top: 16px; border-radius: 12px; font-size: 16px; }
  #page-visionboard .vbc-work { display: none; height: 100%; }
  #page-visionboard .vb-show-board .vbc-work { display: flex; }
  #page-visionboard .vb-show-board .vbc-boards { display: none; }
  #page-visionboard .vbc-backdrop, #page-visionboard .vbc-boards-toggle,
  #page-visionboard .vbc-head .vbc-tools, #page-visionboard .vbc-saved,
  #page-visionboard .vbc-scrolldown { display: none; }
  /* Her call, 8 October 2026, after seeing it both ways: the board's name keeps
     its own line UNDER the way back, rather than sharing that row. It cost 55px
     of sheet; she preferred reading the whole name. Do not merge them again. */
  #page-visionboard .vbc-head { padding: 8px 12px; gap: 4px; flex-wrap: wrap; }
  #page-visionboard .vbc-mobile-nav { display: flex; align-items: center; justify-content: space-between; width: calc(100% + 24px); margin: -8px -12px 8px; padding: 6px 12px; border-bottom: 1px solid var(--border); }
  #page-visionboard .vbc-work-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 4px; padding: 8px; border-bottom: 1px solid var(--border-s); flex-shrink: 0; }
  #page-visionboard .vbc-mobile-back { display: flex; align-items: center; min-height: 44px; border: 0; background: transparent; padding: 0 4px; color: var(--primary-ink); font: inherit; cursor: pointer; }
  #page-visionboard .vbc-title { width: 100%; white-space: normal; overflow-wrap: anywhere; font-size: 21px; }
  #page-visionboard .vbc-stage { margin: 8px; border-radius: 12px; overscroll-behavior: contain; }
  #page-visionboard .vbc-canvas { --vb-handle-size: 28px; touch-action: none; }
  #page-visionboard .vbc-mobile-tools { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
  #page-visionboard .vbc-mobile-nav .vbc-tool, #page-visionboard .vbc-mobile-tools .vbc-tool { min-width: 44px; min-height: 44px; }
  #page-visionboard .vbc-mobile-tools [data-vb="endCrop"] { display: none; }
  #page-visionboard .vbc-work:has(.vbc-cropping) [data-vb="endCrop"] { display: flex; }
  #page-visionboard .vbc-zoom { position: static; align-self: center; transform: none; border: 0; border-left: 1px solid var(--border); border-radius: 0; box-shadow: none; background: transparent; margin: 0; padding: 0; gap: 0; }
  #page-visionboard .vbc-zoom [data-vb="zoomFit"] { display: none; }
  #page-visionboard .vbc-zoom-btn { min-width: 44px; min-height: 44px; border-radius: 8px; }
  #page-visionboard .vbc-zoom-val { min-width: 36px; }
  /* While a picture is being cropped there is nothing to add; the tick that
     finishes the crop takes their place. */
  #page-visionboard .vbc-work:has(.vbc-cropping) .vbc-mobile-tools :is([data-vb="addText"], [data-vb="pickImage"]) { display: none; }
  #page-visionboard .vbc-bar { transform: none; max-width: calc(100% - 16px); overflow-x: auto; padding: 4px; }
  #page-visionboard .vbc-bar-btn { min-width: 44px; min-height: 44px; flex-shrink: 0; }
  #page-visionboard .vbc-croptip { display: none; }
  /* The fallback was missing here from the day this rule was written: on a
     browser that does not know `dvh` the popup had no ceiling at all. */
  .vbc-pop { max-width: calc(100vw - 16px); max-height: 50vh; max-height: 50dvh; overflow-y: auto; top: auto !important; bottom: 12px; }
  .vb-mobile-sheet .row-menu-action { min-height: 48px; }
}

@media (max-width: 760px) {
  #page-visionboard .vbc-handle { width: var(--vb-handle-size, 28px); height: var(--vb-handle-size, 28px); pointer-events: none; }
  #page-visionboard .vbc-item-selected .vbc-h-se { pointer-events: auto; right: calc(var(--vb-handle-size, 28px) / -2); bottom: calc(var(--vb-handle-size, 28px) / -2); }
  #page-visionboard .vbc-h-nw, #page-visionboard .vbc-h-ne, #page-visionboard .vbc-h-sw { display: none; }
  #page-calendar .cal-event-actions { opacity: 1; flex-shrink: 0; }
  #page-calendar .cal-event-actions > button:not(.task-mobile-more) { display: none; }
  #page-calendar .cal-event-actions .task-mobile-more {
    display: flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; padding: 0;
    border: 0; background: transparent; color: var(--text-2);
  }
  #page-calendar .cal-event-actions .task-mobile-more svg { width: 24px; height: 24px; }
  #page-calendar .cal-event-info-title { overflow-wrap: anywhere; }
}

/* iOS zooms focused form controls whose text is smaller than 16px.
   Keep manual pinch zoom available; fix the controls rather than the viewport. */
@media (max-width: 760px), (pointer: coarse) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="hidden"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="file"]),
  select,
  textarea:not(.note-title-input) {
    font-size: max(16px, 1em) !important;
  }
}

/* Keep the full week together on phones, retaining the desktop circles. */
@media (max-width: 760px) {
  .modal .day-picker {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 4px;
    justify-items: center;
  }
  .modal .day-pill {
    width: 100%;
    max-width: 44px;
    height: auto;
    aspect-ratio: 1;
    min-width: 0;
    padding: 0;
    border-radius: 50%;
  }
}
@media (max-width: 480px) {
  .modal .day-picker { margin-inline: -16px; }
}

/* Centre both auth forms in the usable phone viewport. Auto margins collapse
   when a form is taller than the space, keeping its top reachable by scrolling. */
@media (max-width: 760px) {
  .auth-right {
    padding: 16px;
    padding-bottom: calc(16px + var(--auth-screen-balance, 0px));
  }
  .auth-card { margin-block: auto; }
  .auth-card-body { padding: 24px; }
  .auth-card-title { font-size: 1.75rem; line-height: 1.2; }
}

/* The native picker keeps 16px text to avoid iOS focus zoom; its visible
   label matches the static planning mode, with the full touch target intact. */
@media (max-width: 760px), (pointer: coarse) {
  .gws-year-picker { position: relative; display: inline-flex; align-items: center; }
  .gws-year-label {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 44px; min-width: 44px; padding: 5px 10px;
  }
  .gws-year-picker .gws-year {
    position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0;
  }
  .gws-year-picker:focus-within { outline: 2px solid var(--primary); border-radius: var(--r-sm); }
}
