/* ============================================================
   Carebeary - Tibetan Vajrayana theme
   Palette: oxblood/maroon, saffron/gold, lapis, parchment.
   Goal: warm and reverent, but uncluttered so the UI stays clear.
   ============================================================ */

:root {
  /* Marigold Festival (theme #14) - LIGHT by default. The dark variation lives in
     the prefers-color-scheme media query below, so the app follows the OS/browser
     theme. Palette names: --maroon = marigold orange (primary), --gold = saffron
     (accent), --lapis = magenta (secondary). Surface/effect colors are semantic
     vars so both themes can re-map them in one place. */
  --parchment: #fff8e8; /* page background */
  --parchment-2: #f6e8c6; /* secondary surface (e.g. segmented track) */
  --card: #ffffff; /* elevated surface: cards, fields, dialogs */
  --ink: #3a2410; /* primary text */
  --muted: #9c8463; /* secondary text */
  --maroon: #e8651e; /* marigold orange: links + accents */
  --maroon-deep: #c2410c; /* headings / emphasis */
  --gold: #f4b400;
  --gold-soft: #e0992a;
  --lapis: #c2186a;
  --green: #4f9d3a;
  --line: #e6cf9c; /* borders / dividers (a touch bolder for crisp edges) */
  --danger: #c0392b;

  /* Semantic surface + effect colors (re-mapped for dark below). */
  --body-grad-top: rgba(255, 248, 232, 0.84);
  --body-grad-bottom: rgba(255, 248, 232, 0.9);
  --surface: rgba(255, 253, 246, 0.97); /* tiles (near-solid flat block, not glassy) */
  --surface-item: rgba(255, 253, 246, 0.98); /* list items */
  --surface-border: rgba(199, 154, 58, 0.62); /* bolder, defined edges */
  --surface-border-soft: rgba(199, 154, 58, 0.5);
  --inset-hi: rgba(255, 255, 255, 0.8);
  --shadow-soft: rgba(94, 20, 20, 0.08);
  --shadow-1: rgba(94, 20, 20, 0.12);
  --shadow-2: rgba(94, 20, 20, 0.18);
  --chip-bg: #faf3df;
  --tile-new-1: #fff6df;
  --tile-new-2: #ffedc2;
  --auth-bg: rgba(255, 253, 246, 0.97);
  --auth-shadow: rgba(94, 20, 20, 0.15);
  --dialog-bg: rgba(255, 253, 246, 0.99);
  --overlay-veil: rgba(43, 33, 23, 0.5);
  --loading-veil: rgba(255, 248, 232, 0.85);
  --toast-bg: #c2410c;
  --toast-fg: #fff7e3;
  --sidebar-1: #fff6e6;
  --sidebar-2: #f4e6c4;
  --hover-bg: rgba(94, 20, 20, 0.06);

  /* Geometric "Bauhaus" type to match the bear's flat, circular geometry:
     Poppins (rounded geometric) for display/headings, Jost (a Futura-like
     geometric sans) for body and UI text. */
  --display: "Poppins", "Jost", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --sans: "Jost", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --radius: 14px;
  --tap: 48px;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

/* DARK theme - applied automatically when the OS/browser is in dark mode.
   "Midnight Teal": a deep teal-green ground (a hue pulled from the bear's belly)
   that sits complementary to the marigold-orange brand, so the bear, the icons
   and the gold/magenta accents pop instead of blending into a warm background. */
@media (prefers-color-scheme: dark) {
  :root {
    --parchment: #0c1c1b;
    --parchment-2: #102826;
    --card: #14302e;
    --ink: #eaf3ef;
    --muted: #8eb4ad;
    --maroon: #ff7d3a;
    --maroon-deep: #ffa05a;
    --gold: #ffc233;
    --gold-soft: #d6a043;
    --lapis: #ff5ea0;
    --green: #5fcf9e;
    --line: #2c4f4a;
    --danger: #ff6b5e;

    --body-grad-top: rgba(8, 26, 25, 0.9);
    --body-grad-bottom: rgba(4, 15, 14, 0.96);
    --surface: rgba(18, 44, 42, 0.92);
    --surface-item: rgba(18, 44, 42, 0.94);
    --surface-border: rgba(95, 199, 184, 0.5);
    --surface-border-soft: rgba(95, 199, 184, 0.38);
    --inset-hi: rgba(255, 255, 255, 0.05);
    --shadow-soft: rgba(0, 0, 0, 0.4);
    --shadow-1: rgba(0, 0, 0, 0.46);
    --shadow-2: rgba(0, 0, 0, 0.54);
    --chip-bg: rgba(255, 125, 58, 0.17);
    --tile-new-1: #123c38;
    --tile-new-2: #0e2c29;
    --auth-bg: rgba(18, 44, 42, 0.96);
    --auth-shadow: rgba(0, 0, 0, 0.6);
    --dialog-bg: rgba(18, 44, 42, 0.99);
    --overlay-veil: rgba(0, 0, 0, 0.66);
    --loading-veil: rgba(6, 18, 17, 0.84);
    --toast-bg: #14302e;
    --toast-fg: #eaf3ef;
    --sidebar-1: #0e2422;
    --sidebar-2: #081715;
    --hover-bg: rgba(255, 255, 255, 0.05);
  }
}

* {
  box-sizing: border-box;
}

/* The HTML `hidden` attribute must always win, even over rules like
   `.overlay { display: flex }`. Without this, overlays never hide. */
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  /* Theme-colored backstop so no device chrome / viewport gap ever shows black. */
  background-color: var(--parchment);
}

body {
  font-family: var(--sans);
  color: var(--ink);
  background-color: var(--parchment);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

/* Dynamic vajra watermark (js/watermark.js): a fixed layer of scattered,
   slightly-decomposed five-prong vajras behind all app content. */
#wm-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
#app {
  position: relative;
  z-index: 1;
}

/* ---- View routing ---- */
.view {
  min-height: 100vh; /* fallback for browsers without dvh */
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}
.view[hidden] {
  display: none;
}

/* Centered container on larger screens. */
.topbar,
.home-grid,
.item-list,
.empty-note,
.create-scroll,
.create-footer-inner {
  width: 100%;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}

/* ---- Top bar ---- */
.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(var(--safe-top) + 14px) 16px 14px;
  background:
    linear-gradient(180deg, rgba(232, 101, 30, 0.97), rgba(194, 65, 12, 0.98)),
    url("../assets/images/background.jpg") center / cover;
  color: #fff6e6;
  border-bottom: 3px solid var(--gold);
  position: sticky;
  top: 0;
  z-index: 5;
  box-shadow: 0 4px 20px rgba(94, 20, 20, 0.28);
}
.topbar-home {
  justify-content: center;
}
.topbar-title {
  flex: 1;
  margin: 0;
  font-family: var(--display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: center;
}
.topbar-home .topbar-title {
  letter-spacing: 0.02em;
  font-size: 20px;
}
.topbar-mark {
  /* App-style "badge": a rounded square shows the WHOLE bear (a circle would
     clip the paws), so the full mascot reads even at this small size. */
  width: 46px;
  height: 46px;
  border-radius: 27%;
  object-fit: cover;
  box-shadow: 0 0 0 2px rgba(199, 154, 58, 0.6), 0 2px 8px rgba(0, 0, 0, 0.28);
}

.icon-btn {
  width: var(--tap);
  height: var(--tap);
  min-width: var(--tap);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: #f7ecca;
  border-radius: 12px;
  cursor: pointer;
}
.icon-btn:active {
  background: rgba(255, 255, 255, 0.18);
}
.icon-btn svg {
  width: 24px;
  height: 24px;
}
.icon-btn-spacer {
  width: var(--tap);
  height: var(--tap);
}

/* Logo/home button shown next to the Back button on sub-screens. */
.home-btn {
  background: transparent;
}
.home-btn:active {
  background: rgba(255, 255, 255, 0.14);
}
.home-btn img {
  width: 38px;
  height: 38px;
  border-radius: 27%;
  object-fit: cover;
  display: block;
  box-shadow: 0 0 0 2px rgba(199, 154, 58, 0.6);
}

/* ---- Home tiles (the big buttons) ---- */
.home-grid {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px 18px 12px;
  justify-content: center;
  /* Medallion size + how far it straddles above each tile's top border. */
  --tile-icon: 84px;
  --tile-poke: 9px;
}

/* A quiet, secondary entry to the Review flow (sits below the three big tiles;
   the main desktop entry is the sidebar). */
.home-secondary {
  display: flex;
  justify-content: center;
  padding: 0 18px calc(var(--safe-bottom) + 24px);
}
.home-review {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 11px 20px;
  border: 1.5px solid var(--surface-border-soft);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-family: var(--display);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.home-review svg {
  width: 20px;
  height: 20px;
  color: var(--gold-soft);
}
.home-review:hover {
  background: var(--hover-bg);
  color: var(--ink);
  border-color: var(--gold-soft);
}
.home-review:active {
  transform: scale(0.98);
}

/* Small (i) at the bottom-right of the home screen -> the "What is GTD?" page.
   On desktop the sidebar carries that link, so this is hidden there. */
#view-home {
  position: relative;
}
.home-info {
  position: absolute;
  right: calc(var(--safe-right) + 14px);
  bottom: calc(var(--safe-bottom) + 12px);
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--surface-border-soft);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.08s ease;
}
.home-info svg {
  width: 22px;
  height: 22px;
  color: var(--gold-soft);
}
.home-info:hover {
  background: var(--hover-bg);
  border-color: var(--gold-soft);
}
.home-info:active {
  transform: scale(0.95);
}
@media (min-width: 960px) {
  body.is-authed .home-info {
    display: none;
  }
}
.tile {
  flex: 1 1 0;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* Top padding clears the medallion that straddles the top border; the roomier
     bottom padding keeps the example text comfortably off the bottom edge. */
  padding: calc(var(--tile-icon) - var(--tile-poke) + 12px) 16px 20px;
  /* Flat, bold geometric block to echo the bear: solid-ish fill, a defined
     2px edge, no glassy blur or ornamental flourishes. */
  border: 2px solid var(--surface-border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--display);
  cursor: pointer;
  box-shadow: 0 4px 12px var(--shadow-soft);
  transition: transform 0.08s ease, box-shadow 0.12s ease;
  position: relative;
  /* visible so the medallion can poke above the top border */
  overflow: visible;
}
.tile:active {
  transform: scale(0.985);
  box-shadow: 0 1px 3px var(--shadow-soft);
}
.tile-icon {
  /* Straddles the top border like a badge (poking up by --tile-poke). */
  position: absolute;
  top: calc(-1 * var(--tile-poke));
  left: 50%;
  transform: translateX(-50%);
  width: var(--tile-icon);
  height: var(--tile-icon);
  object-fit: cover;
  border-radius: 50%;
  /* Cream medallion so the (light-background) emblem reads as an intentional
     seal on the dark tile, matching the brand mark. */
  background: #fcf3df;
  box-shadow:
    0 0 0 3px rgba(216, 162, 60, 0.5),
    0 5px 14px var(--shadow-2);
  z-index: 2;
}
.tile-text {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.tile-label {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.1;
}
.tile-sub {
  font-size: 14.5px;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.25;
}
.tile-eg {
  font-size: 12.5px;
  font-style: italic;
  color: var(--muted);
  opacity: 0.9;
  line-height: 1.2;
  /* sit closer to the description above it */
  margin-top: -3px;
}
.tile-actions {
  color: var(--maroon);
}
.tile-projects {
  color: var(--lapis);
}
.tile-new {
  background: linear-gradient(165deg, var(--tile-new-1), var(--tile-new-2));
  color: var(--maroon-deep);
  border-color: var(--gold);
}
.tile-new .tile-label {
  color: var(--maroon-deep);
}

/* Mobile home: size everything to fit the screen exactly (no scrolling). The
   medallion + text scale down on shorter viewports via clamp(...vh...). */
@media (max-width: 759px) {
  #view-home {
    height: 100vh; /* fallback for browsers without dvh */
    height: 100dvh;
    overflow: hidden;
  }
  /* Installed (Add to Home Screen) launch: iOS reports a slightly short *dynamic*
     height on the first frame (a strip at the bottom until you scroll). In
     standalone there's no browser chrome, so the large/static viewport height
     equals the full screen and fills from the first frame without snapping. */
  html.standalone #view-home {
    height: 100vh;
    height: 100lvh;
  }
  .home-grid {
    --tile-icon: clamp(54px, 9.5vh, 82px);
    --tile-poke: clamp(6px, 1vh, 9px);
    gap: clamp(10px, 1.8vh, 16px);
    /* Extra top padding so the first tile's medallion clears the header rule. */
    padding: clamp(22px, 3.4vh, 34px) 18px clamp(8px, 1.4vh, 12px);
  }
  .tile {
    min-height: 0;
    padding-bottom: clamp(12px, 2vh, 20px);
  }
  /* The New tile keeps its medallion inline (not offset): icon + label centered.
     Its icon is a touch smaller + spacing tighter so the whole group fits the
     tile (with breathing room under the label) even on short phones. */
  .tile-new {
    padding-top: clamp(8px, 1.5vh, 16px);
    padding-bottom: clamp(8px, 1.5vh, 16px);
    gap: clamp(4px, 1vh, 12px);
  }
  .tile-new .tile-icon {
    position: static;
    transform: none;
    width: clamp(44px, 7.6vh, 64px);
    height: clamp(44px, 7.6vh, 64px);
  }
  .tile-label {
    font-size: clamp(20px, 3.4vh, 26px);
  }
  .tile-sub {
    font-size: clamp(12.5px, 1.95vh, 14.5px);
  }
  .tile-eg {
    font-size: clamp(11px, 1.6vh, 12.5px);
  }
  .home-secondary {
    padding: clamp(2px, 1vh, 8px) 18px calc(var(--safe-bottom) + clamp(2px, 0.8vh, 8px));
  }
  .home-review {
    padding: clamp(8px, 1.4vh, 11px) 20px;
  }
}

/* ---- Lists ---- */
.item-list {
  list-style: none;
  /* `margin: 0 auto` keeps the auto left/right margins from the centered-container
     rule above so the list stays centered (matching the title) on wide screens. */
  margin: 0 auto;
  padding: 14px 14px calc(var(--safe-bottom) + 28px);
}
.item {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-item);
  border: 1.5px solid var(--surface-border-soft);
  border-radius: 12px;
  padding: 6px 8px 6px 4px;
  margin-bottom: 10px;
  box-shadow: 0 2px 6px var(--shadow-soft);
}
.item.sortable-ghost {
  opacity: 0.35;
}
.item.sortable-chosen {
  box-shadow: 0 4px 14px rgba(94, 20, 20, 0.18);
}
.nib {
  width: 40px;
  min-width: 40px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--gold);
  cursor: grab;
  touch-action: none;
}
.nib svg {
  width: 22px;
  height: 22px;
}
.item-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 4px 8px 2px;
  background: transparent;
  border: none;
  text-align: left;
  cursor: pointer;
  border-radius: 8px;
  font: inherit;
  color: inherit;
}
.item-main:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
.item-main:active {
  background: rgba(184, 134, 11, 0.08);
}
.item-body {
  flex: 1;
  min-width: 0;
}
/* chevron affordance signalling the row opens a detail view */
.item-main::after {
  content: "";
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--gold-soft);
  border-top: 2px solid var(--gold-soft);
  transform: rotate(45deg);
  opacity: 0.7;
}
.item-title {
  font-size: 17px;
  line-height: 1.3;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.item-tags {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 5px;
}
.item-tags:empty {
  display: none;
}
.item-cat {
  display: inline-block;
  padding: 2px 10px;
  font-size: 12px;
  color: var(--maroon);
  background: var(--chip-bg);
  border: 1px solid var(--gold-soft);
  border-radius: 11px;
}
.item-note {
  width: 16px;
  height: 16px;
  color: var(--gold);
  opacity: 0.85;
}
.item-del {
  width: var(--tap);
  height: var(--tap);
  min-width: var(--tap);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--danger);
  border-radius: 10px;
  cursor: pointer;
}
.item-del:active {
  background: rgba(160, 32, 32, 0.1);
}
.item-del svg {
  width: 22px;
  height: 22px;
}

.empty-note {
  padding: 30px 26px;
  text-align: center;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.5;
}

/* ---- Someday / maybe section (projects parked for later) ---- */
#list-someday {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 14px calc(var(--safe-bottom) + 28px);
}
.someday-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 6px 4px 14px;
  font-family: var(--display);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.someday-heading::before,
.someday-heading::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
/* ID beats the generic .item-list box rules so the section owns the padding. */
#list-someday-items {
  margin: 0;
  padding: 0;
  max-width: none;
}
/* The parked items read as quieter than the active list. */
#list-someday-items .item {
  opacity: 0.82;
}

/* ---- Checkbox row (someday toggle in the create form + review screen) ---- */
.check-row {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: 14px;
  margin-bottom: 14px;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}
.check-row input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 26px;
  height: 26px;
  min-width: 26px;
  margin: 1px 0 0;
  border: 2px solid var(--gold-soft);
  border-radius: 8px;
  background: var(--parchment);
  cursor: pointer;
  position: relative;
  flex: 0 0 auto;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.check-row input[type="checkbox"]:checked {
  background: var(--maroon);
  border-color: var(--maroon-deep);
}
.check-row input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 8px;
  top: 3px;
  width: 6px;
  height: 12px;
  border: solid #fff7ea;
  border-width: 0 3px 3px 0;
  transform: rotate(45deg);
}
.check-row input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
.check-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.check-title {
  font-family: var(--display);
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}
.check-sub {
  font-size: 13px;
  line-height: 1.4;
  color: var(--muted);
}
/* Weekly-review-day picker: sits just under the weekly toggle; greys out when off. */
.pref-day-select {
  margin-top: -2px;
}
.pref-day-select:disabled {
  opacity: 0.2;
  cursor: not-allowed;
}

/* ---- Create form ---- */
.create-form {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.create-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 18px 18px 120px;
}
.segmented {
  display: flex;
  background: var(--parchment-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 18px;
}
.segment {
  flex: 1;
  min-height: 44px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: var(--display);
  font-size: 17px;
  font-weight: 600;
  border-radius: 9px;
  cursor: pointer;
  /* The unselected option is dimmed so the active choice is obvious at a glance. */
  opacity: 0.2;
  transition: opacity 0.12s ease, color 0.12s ease, background 0.12s ease;
}
.segment.is-active {
  background: var(--card);
  color: var(--maroon);
  opacity: 1;
  box-shadow: 0 1px 4px rgba(94, 20, 20, 0.14);
}

/* Compact type toggle that lives in the Create screen's header (orange bar),
   freeing vertical room in the form (helpful with the keyboard open). */
.topbar-segmented {
  flex: 1;
  max-width: 340px;
  margin: 0;
  padding: 3px;
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.28);
}
.topbar-segmented .segment {
  min-height: 38px;
  font-size: 15px;
  color: #ffe9d4;
  opacity: 0.72;
}
.topbar-segmented .segment.is-active {
  background: #fff6e6;
  color: var(--maroon-deep);
  opacity: 1;
}

.field {
  width: 100%;
  font-family: var(--sans);
  font-size: 17px;
  color: var(--ink);
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 14px 14px;
  margin-bottom: 14px;
  -webkit-appearance: none;
  appearance: none;
}
.field:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(244, 180, 0, 0.22);
}
.field-big {
  font-size: 26px;
  line-height: 1.35;
  font-family: var(--display);
  min-height: 132px;
  resize: none;
}
/* Single-line Name field (no newlines; Enter submits). */
.field-title {
  font-size: 22px;
  font-weight: 600;
  font-family: var(--display);
}
.field-title::placeholder {
  color: var(--muted);
  opacity: 0.5;
}
.field-desc {
  font-size: 17px;
  line-height: 1.45;
  min-height: 96px;
  resize: vertical;
}
select.field {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24'><path fill='none' stroke='%23e8651e' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round' d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 42px;
}
.field-label {
  display: block;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 4px 2px 8px;
}

/* Keyboard-aware sticky submit: pinned to the bottom and lifted above the
   on-screen keyboard via the VisualViewport API (see app.js). */
.create-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 12px 18px calc(var(--safe-bottom) + 12px);
  background: linear-gradient(180deg, rgba(239, 228, 207, 0), var(--parchment) 38%);
  z-index: 6;
  transition: transform 0.12s ease-out;
}
.create-footer .btn {
  max-width: 720px;
  margin: 0 auto;
}

/* ---- Detail view ---- */
.detail-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 22px 20px calc(var(--safe-bottom) + 28px);
}
.detail-title {
  font-family: var(--display);
  font-size: 40px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--maroon-deep);
  margin: 0 0 12px;
  overflow-wrap: anywhere;
}
.detail-cat {
  margin-bottom: 18px;
}
.detail-block {
  margin: 18px 0 8px;
}
.detail-description {
  overflow-wrap: anywhere;
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--surface-border-soft);
  border-left: 4px solid var(--gold-soft);
  border-radius: 12px;
  padding: 16px 16px;
  box-shadow: 0 2px 8px var(--shadow-soft);
}
.detail-description.is-empty {
  color: var(--muted);
  font-style: italic;
  border-left-color: var(--line);
}

/* Markdown-rendered content inside a description */
.detail-description > :first-child {
  margin-top: 0;
}
.detail-description > :last-child {
  margin-bottom: 0;
}
.detail-description p {
  margin: 0 0 10px;
}
.detail-description ul,
.detail-description ol {
  margin: 8px 0;
  padding-left: 1.5em;
}
.detail-description li {
  margin: 3px 0;
}
.detail-description h1,
.detail-description h2,
.detail-description h3,
.detail-description h4,
.detail-description h5,
.detail-description h6 {
  font-family: var(--display);
  color: var(--maroon-deep);
  margin: 14px 0 8px;
  line-height: 1.25;
}
.detail-description h1 {
  font-size: 1.4em;
}
.detail-description h2 {
  font-size: 1.25em;
}
.detail-description h3 {
  font-size: 1.1em;
}
.detail-description h4,
.detail-description h5,
.detail-description h6 {
  font-size: 1em;
}
.detail-description a {
  color: var(--maroon);
  text-decoration: underline;
}
.detail-description strong {
  color: var(--maroon-deep);
}
.detail-description code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: rgba(199, 154, 58, 0.16);
  padding: 1px 5px;
  border-radius: 5px;
}
.detail-description pre {
  background: rgba(58, 36, 16, 0.92);
  color: #fdf2dc;
  padding: 12px 14px;
  border-radius: 10px;
  overflow-x: auto;
  margin: 10px 0;
}
.detail-description pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: 0.88em;
}
.detail-description blockquote {
  margin: 10px 0;
  padding: 2px 14px;
  border-left: 3px solid var(--gold-soft);
  color: var(--muted);
  font-style: italic;
}
.detail-description hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 14px 0;
}
.detail-dates {
  margin: 22px 0;
  padding: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 16px;
  font-size: 14px;
}
.detail-dates dt {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 12px;
  align-self: center;
}
.detail-dates dd {
  margin: 0;
  color: var(--ink);
}
.detail-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 26px;
}

/* ---- Review screen ---- */
.review-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 22px 20px calc(var(--safe-bottom) + 28px);
}
.review-progress {
  margin: 0 0 20px;
}
.review-progress-track {
  height: 8px;
  border-radius: 6px;
  background: var(--parchment-2);
  border: 1px solid var(--surface-border-soft);
  overflow: hidden;
}
.review-progress-track span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--gold), var(--maroon));
  border-radius: 6px;
  transition: width 0.25s ease;
}
.review-progress-text {
  margin-top: 8px;
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-align: center;
}
.review-card {
  background: var(--surface-item);
  border: 1.5px solid var(--surface-border);
  border-top: 4px solid var(--gold);
  border-radius: var(--radius);
  padding: 20px 18px;
  box-shadow: 0 4px 16px var(--shadow-soft);
}
.review-cat {
  margin-bottom: 12px;
}
.review-project-title {
  font-family: var(--display);
  font-size: 30px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--maroon-deep);
  margin: 0 0 8px;
  overflow-wrap: anywhere;
}
.review-meta {
  margin: 18px 0;
}
.review-card .check-row {
  margin: 4px 0 0;
}
.review-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}
.review-actions-row {
  display: flex;
  gap: 10px;
}
.review-actions-row .btn {
  flex: 1;
}
.review-nav {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 16px;
}
.btn-sm {
  min-height: 40px;
  padding: 8px 14px;
  font-size: 15px;
  font-weight: 600;
}
.btn:disabled {
  opacity: 0.4;
  cursor: default;
}
.review-done {
  text-align: center;
  padding: 30px 16px;
  max-width: 460px;
  margin: 0 auto;
}
.review-done-mark {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 3px rgba(216, 162, 60, 0.55), 0 8px 22px var(--shadow-2);
  margin-bottom: 16px;
}
.review-done-title {
  font-family: var(--display);
  font-size: 26px;
  font-weight: 700;
  color: var(--maroon-deep);
  margin: 0 0 8px;
}
.review-done-text {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
  margin: 0 0 22px;
}
.review-done-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 12px 18px;
  font-family: var(--display);
  font-size: 18px;
  font-weight: 700;
  border-radius: 12px;
  border: 1px solid transparent;
  cursor: pointer;
}
.btn-block {
  width: 100%;
  display: flex;
}
.btn-tall {
  min-height: 60px;
  font-size: 21px;
}
.btn-primary {
  /* Flat solid fill (not a gradient) to match the bear's color-blocking. */
  background: var(--maroon);
  color: #fff7ea;
  border-color: var(--maroon-deep);
  box-shadow: 0 3px 9px rgba(232, 101, 30, 0.26);
}
.btn-primary:active {
  filter: brightness(0.94);
}
.btn-primary:disabled {
  opacity: 0.6;
  cursor: default;
}
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--line);
}
.btn-danger {
  background: var(--danger);
  color: #fff;
}

/* ---- Auth: landing / login / signup ---- */
#view-login,
#view-signup,
#view-landing,
#view-about {
  justify-content: center;
  padding: 24px 18px calc(var(--safe-bottom) + 24px);
  overflow-y: auto;
}
.auth-wrap,
.landing-wrap {
  width: 100%;
  max-width: 440px;
  margin: auto;
  padding: 30px 26px calc(var(--safe-bottom) + 30px);
  text-align: center;
  background: var(--auth-bg);
  border: 2px solid var(--surface-border);
  border-radius: 18px;
  box-shadow: 0 10px 30px var(--auth-shadow);
}
.auth-wrap {
  max-width: 380px;
}
/* On phones, the signed-out home and the "What is GTD?" page are full-width,
   scrollable pages (no card border/box) - just first-class pages. The auth
   forms (login / signup / forgot) keep their card. */
@media (max-width: 559px) {
  .landing-wrap {
    max-width: none;
    padding: 8px 0 0;
    background: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
}
.brand-mark {
  width: 104px;
  height: 104px;
  object-fit: cover;
  border-radius: 50%;
  margin: 0 auto 10px;
  display: block;
  box-shadow: 0 0 0 3px rgba(216, 162, 60, 0.55), 0 8px 22px var(--shadow-2);
}
.landing-wrap .brand-mark {
  width: 132px;
  height: 132px;
}
.brand-title {
  font-family: var(--display);
  font-size: 27px;
  font-weight: 700;
  color: var(--maroon-deep);
  margin: 8px 0 4px;
}
.landing-wrap .brand-title {
  font-size: 38px;
  font-weight: 800;
  letter-spacing: 0.01em;
}
.brand-sub {
  color: var(--muted);
  margin: 0 0 22px;
  font-size: 15px;
  line-height: 1.5;
}
.brand-slogan {
  font-family: var(--display);
  font-style: italic;
  font-size: 19px;
  color: var(--maroon);
  margin: 0 0 3px;
}
/* The quiet connector between the slogan and the "mind like water" tagline. */
.brand-experience {
  font-family: var(--display);
  font-style: italic;
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 1px;
}

/* ---- Brand wordmark lockup: Carebeary^GTD + "mind like water" tagline ---- */
.brand-gtd {
  font-size: 0.46em;
  font-weight: 700;
  vertical-align: super;
  letter-spacing: 0.03em;
  /* Match the "Carebeary" wordmark color (whatever surrounds it). */
  color: inherit;
  margin-left: 1px;
}
.brand-tag {
  display: block;
  font-family: var(--display);
  font-style: italic;
  font-weight: 500;
  color: var(--lapis);
  letter-spacing: 0.01em;
}
.brand-tag-lg {
  font-size: 18px;
  margin: 0 0 14px;
}
/* Home topbar: stack wordmark + tagline; lighten accents to read on the orange bar. */
.topbar-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  line-height: 1.05;
}
.topbar-brand .brand-name {
  font-size: 20px;
}
.topbar-brand .brand-tag {
  font-size: 10.5px;
}
.topbar .brand-tag {
  color: #ffd6e2;
}
/* Sidebar: wordmark + tagline stacked beside the badge. */
.sidebar-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.12;
  text-align: left;
}
.sidebar-brand-text .brand-tag {
  font-size: 11px;
  margin-top: 1px;
}
.landing-card {
  text-align: left;
  font-size: 15.5px;
  line-height: 1.65;
  color: var(--ink);
  margin: 0 0 22px;
}
.landing-card p {
  margin: 0 0 12px;
}
.landing-card p:last-child {
  margin-bottom: 0;
}
.about-list {
  margin: 10px 0 12px;
  padding-left: 1.25em;
}
.about-list li {
  margin: 6px 0;
}
.about-list strong {
  color: var(--maroon-deep);
}
.landing-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
/* Desktop + signed in: the sidebar is the way out, so the About page's Back
   button is redundant (still shown on mobile and when signed out). */
@media (min-width: 960px) {
  body.is-authed #about-back {
    display: none;
  }
}
/* The About page's in-view header is only for signed-in mobile: it gives the
   page a real "About" header + top-left Back, like other mobile sub-pages.
   Signed out it stays a landing-style page; on desktop the sidebar handles nav. */
.about-topbar {
  display: none;
}
@media (max-width: 959px) {
  body.is-authed .about-topbar {
    display: flex;
  }
  /* The top-left Back replaces the bottom Back on signed-in mobile. */
  body.is-authed #about-back {
    display: none;
  }
  /* Sit the content directly under the header rather than vertically centered. */
  body.is-authed .about-wrap {
    margin-top: 0;
  }
}
.auth-wrap .field {
  text-align: left;
  font-size: 17px;
  margin-bottom: 12px;
}
.auth-switch {
  margin: 18px 0 0;
  font-size: 14px;
  color: var(--muted);
}
.auth-switch a {
  color: var(--maroon);
  font-weight: 600;
  text-decoration: none;
}
.auth-note {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.auth-note p {
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 10px;
}

.form-error {
  color: var(--danger);
  font-size: 14px;
  margin: -2px 2px 12px;
  text-align: left;
}
.form-success {
  color: var(--green);
  font-size: 14px;
  margin: -2px 2px 12px;
  text-align: left;
}

/* ---- Account screen ---- */
.account-id {
  margin: 4px 0 8px;
}
.account-email {
  font-size: 18px;
  font-weight: 600;
  color: var(--maroon-deep);
  word-break: break-all;
}
#change-password-form .field {
  margin-bottom: 12px;
}

/* "Add to your iPhone" helper (copyable deep link + steps). */
.hint-text {
  font-size: 14px;
  line-height: 1.55;
  color: var(--muted);
  margin: 0 0 12px;
}
.hint-text strong {
  color: var(--ink);
}
.copy-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.copy-field {
  flex: 1;
  min-width: 0;
  margin-bottom: 0;
  font-size: 13.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.copy-btn {
  flex: 0 0 auto;
  min-height: 0;
  padding: 0 18px;
  font-size: 15px;
}
.hint-steps {
  margin: 12px 0 0;
  padding-left: 1.2em;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--muted);
}
.hint-steps li {
  margin: 5px 0;
}
.hint-steps strong {
  color: var(--ink);
}

.form-error {
  color: var(--danger);
  font-size: 14px;
  margin: -4px 2px 14px;
  text-align: left;
}

/* ---- Overlays: confirm + loading ---- */
.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--overlay-veil);
  z-index: 20;
  padding: 24px;
}
.dialog {
  width: 100%;
  max-width: 340px;
  background: var(--dialog-bg);
  border: 2px solid var(--surface-border);
  border-top: 4px solid var(--gold);
  border-radius: var(--radius);
  padding: 22px 20px 16px;
  box-shadow: 0 12px 32px var(--auth-shadow);
}
.dialog-text {
  margin: 0 0 18px;
  font-size: 17px;
  text-align: center;
  color: var(--ink);
}
.dialog-actions {
  display: flex;
  gap: 10px;
}
.dialog-actions .btn {
  flex: 1;
  font-size: 16px;
}

.overlay-loading {
  background: var(--loading-veil);
  flex-direction: column;
}
.spinner {
  width: 72px;
  height: 72px;
  object-fit: contain;
  animation: spin 1.4s linear infinite;
  filter: drop-shadow(0 4px 12px rgba(232, 101, 30, 0.25));
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation-duration: 3s;
  }
}

/* ---- Toast ---- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-bottom) + 22px);
  transform: translateX(-50%);
  background: var(--toast-bg);
  color: var(--toast-fg);
  border: 1px solid var(--surface-border);
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 15px;
  max-width: 90%;
  text-align: center;
  z-index: 30;
  box-shadow: 0 6px 20px var(--shadow-2);
}

/* ---- Desktop niceties ---- */
@media (min-width: 760px) {
  .home-grid {
    flex-direction: row;
    flex-wrap: wrap;
    align-content: center;
    min-height: 60vh;
  }
  .tile {
    min-height: 200px;
  }
  /* The full-width "New" tile is a horizontal row, so its icon sits inline
     (not straddling the top like the stacked Actions/Projects tiles). */
  .tile-new {
    flex-basis: 100%;
    min-height: 96px;
    flex-direction: row;
    gap: 16px;
    padding: 18px 24px;
  }
  .tile-new .tile-icon {
    position: static;
    transform: none;
    width: 64px;
    height: 64px;
  }
  .tile:hover {
    box-shadow: 0 6px 18px var(--shadow-2);
    border-color: var(--gold-soft);
  }
}

/* ============================================================
   Desktop shell: a persistent sidebar + content area, shown only
   when signed in on wide screens. Mobile and the signed-out
   (landing/login/signup) screens are unaffected.
   ============================================================ */
.sidebar {
  display: none;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px 18px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink);
}
.sidebar-brand img {
  width: 50px;
  height: 50px;
  border-radius: 27%;
  object-fit: cover;
  box-shadow: 0 0 0 2px rgba(216, 162, 60, 0.6);
}
.sidebar-brand-name {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--maroon-deep);
}
.sidebar-links {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sidebar-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 12px 14px;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease;
}
.sidebar-link svg {
  width: 22px;
  height: 22px;
  color: var(--gold);
  flex: 0 0 auto;
}
.sidebar-link:hover {
  background: var(--hover-bg);
}
.sidebar-link.is-active {
  background: var(--chip-bg);
  color: var(--maroon-deep);
  font-weight: 600;
}
.sidebar-link.is-active svg {
  color: var(--maroon);
}
.sidebar-link-new,
.sidebar-link-new svg {
  color: var(--maroon);
}

@media (min-width: 960px) {
  body.is-authed #app {
    display: flex;
    align-items: stretch;
    min-height: 100dvh;
  }
  body.is-authed .sidebar {
    display: flex;
    flex-direction: column;
    flex: 0 0 256px;
    padding: 16px 14px calc(var(--safe-bottom) + 14px);
    background: linear-gradient(180deg, var(--sidebar-1), var(--sidebar-2));
    border-right: 1px solid var(--line);
    position: sticky;
    top: 0;
    height: 100dvh;
    overflow-y: auto;
  }
  body.is-authed .view:not([hidden]) {
    flex: 1 1 auto;
    min-width: 0;
  }
  /* The sidebar provides brand + account; hide the redundant in-view chrome. */
  body.is-authed .home-btn {
    display: none;
  }
  body.is-authed .topbar-home {
    display: none;
  }
  /* Use the full content area instead of a narrow centered column: drop the
     720px cap and left-align with comfortable desktop gutters. */
  body.is-authed .topbar,
  body.is-authed .item-list,
  body.is-authed .empty-note,
  body.is-authed .create-scroll,
  body.is-authed .detail-scroll {
    max-width: none;
    margin-left: 0;
    margin-right: 0;
  }
  body.is-authed .topbar {
    padding-left: 32px;
    padding-right: 32px;
  }
  body.is-authed .item-list {
    padding-left: 36px;
    padding-right: 36px;
  }
  body.is-authed #list-someday {
    max-width: none;
    margin-left: 0;
    margin-right: 0;
    padding-left: 36px;
    padding-right: 36px;
  }
  body.is-authed .detail-scroll,
  body.is-authed .create-scroll,
  body.is-authed .review-scroll {
    padding-left: 40px;
    padding-right: 40px;
  }
  body.is-authed .review-scroll {
    margin-left: 0;
    margin-right: 0;
  }
  /* Header title left-aligned (desktop header feel) rather than centered. */
  body.is-authed .topbar-title {
    text-align: left;
    padding-left: 4px;
  }
  /* Keep the fixed Create footer within the content area (right of the sidebar). */
  body.is-authed .create-footer {
    left: 256px;
    padding-left: 40px;
    padding-right: 40px;
  }
  body.is-authed .create-footer .btn {
    max-width: none;
    margin: 0;
  }
  /* Forms & detail read as a comfortable left-aligned column, not full-bleed
     (lists/empty notes keep filling the width). */
  body.is-authed .create-scroll,
  body.is-authed .detail-scroll,
  body.is-authed .review-scroll {
    max-width: 680px;
  }
  body.is-authed .detail-description {
    max-width: none;
  }
  /* The action-type toggle is a compact control, not a full-width bar. */
  body.is-authed .segmented {
    max-width: 320px;
  }
  /* Action buttons size to their content and sit left-aligned, not stretched
     across the whole column the way a phone-width block button would. */
  body.is-authed .btn-block {
    width: fit-content;
    min-width: 200px;
  }
  body.is-authed .detail-actions {
    flex-direction: row;
    flex-wrap: wrap;
  }
}
