/*
  Daybook design tokens
  Direction: Soft Structuralism (taste-skill / high-end-visual-design).
  Silver-grey ground, double-bezel containers, one emerald accent that means "done".
  Shape rule: shells 2rem (concentric cores), list items and cells 14px, text fields 10px,
  every button is a pill.
*/

@font-face {
  font-family: "Cabinet Grotesk";
  src: url("fonts/cabinet-grotesk-500.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Cabinet Grotesk";
  src: url("fonts/cabinet-grotesk-800.woff2") format("woff2");
  font-weight: 800;
  font-display: swap;
}
@font-face {
  font-family: "Satoshi";
  src: url("fonts/satoshi-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Satoshi";
  src: url("fonts/satoshi-500.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Satoshi";
  src: url("fonts/satoshi-700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  --font-display: "Cabinet Grotesk", "Satoshi", system-ui, sans-serif;
  --font-ui: "Satoshi", system-ui, -apple-system, "Segoe UI", sans-serif;

  --bg: #e5e7ea;
  --shell: rgba(22, 27, 36, 0.045);
  --shell-ring: rgba(22, 27, 36, 0.075);
  --core: #f6f7f8;
  --raised: #fdfdfd;
  --ink: #14171c;
  --ink-2: #4e5460;
  --ink-3: #656b76;
  --line: rgba(20, 23, 28, 0.08);
  --line-strong: rgba(20, 23, 28, 0.16);
  --hover: rgba(20, 23, 28, 0.045);
  --accent: #0b7a54;
  --accent-ink: #f3faf7;
  --accent-soft: rgba(11, 122, 84, 0.11);
  --accent-line: rgba(11, 122, 84, 0.38);
  --danger: #b42318;
  --danger-soft: rgba(180, 35, 24, 0.08);
  --orb: rgba(255, 255, 255, 0.14);
  --highlight: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  --shadow: 0 1px 2px rgba(25, 30, 40, 0.04), 0 22px 50px -28px rgba(25, 30, 40, 0.22);
  --shadow-raised: 0 1px 2px rgba(25, 30, 40, 0.06), 0 10px 26px -14px rgba(25, 30, 40, 0.24);
  --island-bg: rgba(246, 247, 248, 0.74);
  --skeleton: rgba(20, 23, 28, 0.06);
  --weekend: rgba(20, 23, 28, 0.03);
  --holiday: #c0392b;
  --vacation: #c98a12;
  --vacation-soft: rgba(214, 150, 30, 0.14);
  --birthday: #b83280;
  --mark-red: #d64541;
  --mark-orange: #e07b2e;
  --mark-yellow: #d9a514;
  --mark-green: #2f9e5a;
  --mark-teal: #189a9a;
  --mark-blue: #3b6fd9;
  --mark-purple: #8457d1;
  --mark-pink: #d4508f;
  --mark-gray: #7d838d;

  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  --r-shell: 2rem;
  --r-pad: 6px;
  --r-core: calc(var(--r-shell) - var(--r-pad));
  --r-item: 14px;
  --r-field: 10px;

  /* Digit box of Cabinet Grotesk 800, in em. Refined at runtime from real font metrics. */
  --numeral-top: 0.115;
  --numeral-h: 0.69;
  --numeral-bottom: 0.195;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0e11;
    --shell: rgba(255, 255, 255, 0.028);
    --shell-ring: rgba(255, 255, 255, 0.07);
    --core: #15181d;
    --raised: #1c2026;
    --ink: #eceef1;
    --ink-2: #aeb4be;
    --ink-3: #8b929d;
    --line: rgba(255, 255, 255, 0.07);
    --line-strong: rgba(255, 255, 255, 0.14);
    --hover: rgba(255, 255, 255, 0.04);
    --accent: #3dcb94;
    --accent-ink: #04281b;
    --accent-soft: rgba(61, 203, 148, 0.13);
    --accent-line: rgba(61, 203, 148, 0.42);
    --danger: #f97066;
    --danger-soft: rgba(249, 112, 102, 0.1);
    --orb: rgba(12, 14, 17, 0.1);
    --highlight: inset 0 1px 0 rgba(255, 255, 255, 0.045);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 26px 60px -30px rgba(0, 0, 0, 0.75);
    --shadow-raised: 0 1px 2px rgba(0, 0, 0, 0.35), 0 12px 28px -14px rgba(0, 0, 0, 0.6);
    --island-bg: rgba(21, 24, 29, 0.72);
    --skeleton: rgba(255, 255, 255, 0.06);
    --weekend: rgba(255, 255, 255, 0.025);
    --holiday: #ff8a80;
    --vacation: #f0b44c;
    --vacation-soft: rgba(240, 180, 76, 0.13);
    --birthday: #f48fb1;
    --mark-red: #f0605c;
    --mark-orange: #f39a55;
    --mark-yellow: #f2c94c;
    --mark-green: #4cc282;
    --mark-teal: #3cc4c4;
    --mark-blue: #6a95f0;
    --mark-purple: #a888ec;
    --mark-pink: #ee7fb4;
    --mark-gray: #a1a7b1;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0c0e11;
  --shell: rgba(255, 255, 255, 0.028);
  --shell-ring: rgba(255, 255, 255, 0.07);
  --core: #15181d;
  --raised: #1c2026;
  --ink: #eceef1;
  --ink-2: #aeb4be;
  --ink-3: #8b929d;
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.14);
  --hover: rgba(255, 255, 255, 0.04);
  --accent: #3dcb94;
  --accent-ink: #04281b;
  --accent-soft: rgba(61, 203, 148, 0.13);
  --accent-line: rgba(61, 203, 148, 0.42);
  --danger: #f97066;
  --danger-soft: rgba(249, 112, 102, 0.1);
  --orb: rgba(12, 14, 17, 0.1);
  --highlight: inset 0 1px 0 rgba(255, 255, 255, 0.045);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 26px 60px -30px rgba(0, 0, 0, 0.75);
  --shadow-raised: 0 1px 2px rgba(0, 0, 0, 0.35), 0 12px 28px -14px rgba(0, 0, 0, 0.6);
  --island-bg: rgba(21, 24, 29, 0.72);
  --skeleton: rgba(255, 255, 255, 0.06);
  --weekend: rgba(255, 255, 255, 0.025);
  --holiday: #ff8a80;
  --vacation: #f0b44c;
  --vacation-soft: rgba(240, 180, 76, 0.13);
  --birthday: #f48fb1;
  --mark-red: #f0605c;
  --mark-orange: #f39a55;
  --mark-yellow: #f2c94c;
  --mark-green: #4cc282;
  --mark-teal: #3cc4c4;
  --mark-blue: #6a95f0;
  --mark-purple: #a888ec;
  --mark-pink: #ee7fb4;
  --mark-gray: #a1a7b1;
  color-scheme: dark;
}

/* ------------------------------------------------------------------ base */

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  padding: max(14px, env(safe-area-inset-top)) 16px max(40px, env(safe-area-inset-bottom));
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

button {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

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

[hidden] {
  display: none !important;
}

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

/* ------------------------------------------------------------------ controls */

.icon-btn {
  display: grid;
  place-items: center;
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  color: var(--ink-2);
  font-size: 19px;
  transition: background-color 0.35s var(--ease), color 0.35s var(--ease), transform 0.35s var(--ease);
}

.icon-btn:hover {
  background: var(--hover);
  color: var(--ink);
}

.icon-btn:active {
  transform: scale(0.94);
}

.icon-btn.small {
  width: 34px;
  height: 34px;
  font-size: 17px;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  flex: none;
  gap: 10px;
  height: 44px;
  padding: 0 6px 0 18px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  transition: transform 0.5s var(--ease), opacity 0.3s var(--ease);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-primary[disabled] {
  opacity: 0.6;
  cursor: default;
}

.btn-orb {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--orb);
  font-size: 14px;
  transition: transform 0.5s var(--ease);
}

.btn-primary:hover .btn-orb {
  transform: translateX(2px) scale(1.06);
}

.ghost-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 14px 0 11px;
  border-radius: 999px;
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: inset 0 0 0 1px var(--line-strong);
  transition: background-color 0.3s var(--ease), color 0.3s var(--ease), transform 0.35s var(--ease);
}

.ghost-btn i {
  font-size: 16px;
}

.ghost-btn:hover {
  background: var(--hover);
  color: var(--ink);
}

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

.ghost-btn.danger {
  color: var(--danger);
}

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

/* ------------------------------------------------------------------ island */

.island {
  position: sticky;
  top: max(12px, env(safe-area-inset-top));
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 2px;
  width: max-content;
  max-width: 100%;
  margin: 0 auto 20px;
  padding: 5px;
  border-radius: 999px;
  background: var(--island-bg);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  backdrop-filter: blur(20px) saturate(160%);
  box-shadow: 0 0 0 1px var(--shell-ring), var(--shadow-raised), var(--highlight);
}

.island-month {
  min-width: 9.6em;
  margin: 0;
  padding: 0 4px;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.01em;
  text-align: center;
  white-space: nowrap;
}

.island-divider {
  width: 1px;
  height: 20px;
  margin: 0 6px;
  background: var(--line-strong);
}

.island-today {
  height: 38px;
  padding: 0 16px;
  margin-right: 2px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-size: 14px;
  font-weight: 500;
  transition: transform 0.4s var(--ease), opacity 0.3s var(--ease);
}

.island-today:active {
  transform: scale(0.97);
}

@media (prefers-reduced-transparency: reduce) {
  .island {
    background: var(--core);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

/* ------------------------------------------------------------------ layout */

.board {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "day" "notes" "cal";
  gap: 18px;
  max-width: 1320px;
  margin: 0 auto;
}

.area-day {
  grid-area: day;
}

.area-cal {
  grid-area: cal;
}

.area-notes {
  grid-area: notes;
  display: flex;
}

@media (min-width: 1000px) {
  body {
    padding: 16px 28px 40px;
  }

  .board {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    grid-template-rows: auto 1fr;
    grid-template-areas: "day cal" "day notes";
    gap: 22px;
    align-items: start;
  }

  .area-notes {
    align-self: stretch;
  }
}

/* Double bezel: a tinted tray (shell) holding a machined plate (core). */
.shell {
  padding: var(--r-pad);
  border-radius: var(--r-shell);
  background: var(--shell);
  box-shadow: 0 0 0 1px var(--shell-ring), var(--shadow);
}

.core {
  border-radius: var(--r-core);
  background: var(--core);
  box-shadow: var(--highlight);
}

/* ------------------------------------------------------------------ day */

.day {
  padding: 26px 26px 18px;
}

.day-line {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
}

.day-weekday {
  margin: 0;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.015em;
}

.day-rel {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--hover);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.day-rel.is-today {
  background: var(--accent-soft);
  color: var(--accent);
}

.day-rel:empty {
  display: none;
}

.day-steps {
  display: flex;
  gap: 2px;
  margin-left: auto;
  margin-right: -8px;
}

.numeral {
  position: relative;
  overflow: hidden;
  font-family: var(--font-display);
  font-size: clamp(168px, 19vw, 280px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.06em;
  font-variant-numeric: tabular-nums;
}

.numeral-face {
  position: relative;
  width: fit-content;
  margin: calc(var(--numeral-top) * -1em + 10px) 0 calc(var(--numeral-bottom) * -1em + 8px) -0.045em;
  padding-right: 0.06em;
}

.numeral-face.is-leaving {
  position: absolute;
  top: 0;
  left: 0;
}

.numeral-base {
  display: block;
}

/* The numeral fills with the accent from the baseline up as tasks get done. */
.numeral-fill {
  position: absolute;
  inset: 0;
  color: var(--accent);
  clip-path: inset(calc((var(--numeral-top) + (1 - var(--fill, 0)) * var(--numeral-h)) * 1em) 0 0 0);
  transition: clip-path 1.1s var(--ease);
}

.day-sub {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
}

.day-month {
  margin: 0;
  color: var(--ink-2);
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.015em;
}

.day-progress {
  margin: 0;
  color: var(--ink-3);
  font-size: 14px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.carry {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin-top: 22px;
  padding: 10px 10px 10px 16px;
  border-radius: var(--r-item);
  background: var(--accent-soft);
  font-size: 14px;
}

.carry p {
  margin: 0;
}

.carry .ghost-btn {
  background: var(--raised);
  color: var(--ink);
  box-shadow: 0 0 0 1px var(--line);
}

.add {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 22px;
  padding: 5px 5px 5px 18px;
  border-radius: 999px;
  background: var(--raised);
  box-shadow: 0 0 0 1px var(--line), var(--shadow-raised);
  transition: box-shadow 0.35s var(--ease);
}

.add:focus-within {
  box-shadow: 0 0 0 1.5px var(--accent-line), 0 0 0 5px var(--accent-soft), var(--shadow-raised);
}

.add-icon {
  flex: none;
  color: var(--ink-3);
  font-size: 18px;
}

.add-input {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 16px;
}

.add-input::placeholder,
.task-note::placeholder,
.notes-input::placeholder {
  color: var(--ink-3);
  opacity: 1;
}

/* ------------------------------------------------------------------ tasks */

.tasks {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 14px -10px 0;
  padding: 0;
  list-style: none;
}

.task {
  position: relative;
  border-radius: var(--r-item);
  transition: background-color 0.3s var(--ease), box-shadow 0.3s var(--ease), opacity 0.3s var(--ease);
}

.task:hover {
  background: var(--hover);
}

.task.is-open {
  background: var(--raised);
  box-shadow: 0 0 0 1px var(--line), var(--shadow-raised);
}

.task.is-entering {
  animation: task-in 0.55s var(--ease);
}

.task-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 8px 6px 8px 12px;
}

.check {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  color: transparent;
  font-size: 13px;
  box-shadow: inset 0 0 0 1.5px var(--line-strong);
  transition: background-color 0.35s var(--ease), box-shadow 0.35s var(--ease), color 0.2s var(--ease);
}

.check::before {
  content: "";
  position: absolute;
  inset: -10px;
}

.check:hover {
  box-shadow: inset 0 0 0 1.5px var(--accent);
}

.check i {
  transform: scale(0.3);
  transition: transform 0.5s var(--spring);
}

.check[aria-checked="true"] {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: inset 0 0 0 1.5px var(--accent);
}

.check[aria-checked="true"] i {
  transform: scale(1);
}

.check.is-popping {
  animation: pop 0.55s var(--spring);
}

.task-title {
  display: flex;
  align-items: center;
  flex: 1;
  gap: 8px;
  min-width: 0;
  padding: 4px 0;
  text-align: left;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.4;
}

.task-label {
  min-width: 0;
  overflow-wrap: anywhere;
}

/* Strike line draws across every wrapped line of the title. */
.task-text {
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat;
  background-position: 0 58%;
  background-size: 0% 1.5px;
  transition: background-size 0.55s var(--ease), color 0.45s var(--ease);
}

.task.is-done .task-text {
  color: var(--ink-3);
  background-size: 100% 1.5px;
}

.task-note-flag {
  flex: none;
  color: var(--ink-3);
  font-size: 16px;
}

.task-grip {
  display: grid;
  place-items: center;
  flex: none;
  width: 26px;
  height: 32px;
  color: var(--ink-3);
  font-size: 18px;
  cursor: grab;
  opacity: 0;
  transition: opacity 0.25s var(--ease);
}

.task:hover .task-grip {
  opacity: 1;
}

@media (hover: none) {
  .task-grip {
    display: none;
  }
}

.task-details {
  display: grid;
  gap: 12px;
  padding: 0 14px 14px 48px;
  animation: reveal 0.45s var(--ease);
}

.field {
  display: grid;
  gap: 5px;
}

.field-label {
  color: var(--ink-3);
  font-size: 12.5px;
  font-weight: 500;
}

.task-edit,
.task-note {
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: var(--r-field);
  outline: 0;
  background: var(--core);
  font-size: 15px;
  line-height: 1.5;
  box-shadow: inset 0 0 0 1px var(--line);
  transition: box-shadow 0.3s var(--ease);
}

.task-note {
  min-height: 4.8em;
  resize: vertical;
  field-sizing: content;
}

.task-edit:focus,
.task-note:focus {
  box-shadow: inset 0 0 0 1.5px var(--accent-line), 0 0 0 4px var(--accent-soft);
}

.task-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}

/* drag and drop */
.task.is-dragging {
  opacity: 0.4;
}

.task.drop-before::before,
.task.drop-after::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}

.task.drop-before::before {
  top: -2px;
}

.task.drop-after::after {
  bottom: -2px;
}

.empty {
  padding: 30px 2px 14px;
}

.empty-title {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.empty-body {
  max-width: 46ch;
  margin: 0;
  color: var(--ink-3);
  font-size: 14.5px;
}

.skeleton {
  display: none;
  gap: 8px;
  margin-top: 18px;
}

.skeleton span {
  height: 44px;
  border-radius: var(--r-item);
  background: var(--skeleton);
  animation: shimmer 1.4s ease-in-out infinite alternate;
}

.skeleton span:nth-child(2) {
  width: 82%;
}

.skeleton span:nth-child(3) {
  width: 64%;
}

body.is-loading .skeleton {
  display: grid;
}

body.is-loading .tasks,
body.is-loading .empty {
  display: none;
}

/* ------------------------------------------------------------------ calendar */

.cal {
  padding: 18px;
}

.cal-weekdays,
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.cal-grid {
  grid-auto-rows: 1fr;
}

.cal-weekdays {
  padding-bottom: 10px;
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 500;
}

.cal-weekdays span {
  padding-left: 9px;
}

.cal-cell {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  min-height: 98px;
  padding: 7px 7px 8px;
  border-radius: var(--r-item);
  text-align: left;
  box-shadow: inset 0 0 0 1px var(--line);
  transition: background-color 0.3s var(--ease), box-shadow 0.35s var(--ease), opacity 0.3s var(--ease);
}

/* Each day fills from the bottom with the accent as its tasks get done. */
.cal-cell::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--accent-soft);
  transform: scaleY(var(--fill, 0));
  transform-origin: bottom;
  transition: transform 1s var(--ease);
}

.cal-cell:hover {
  background: var(--hover);
}

.cal-cell.is-out {
  opacity: 0.5;
}

.cal-cell.is-selected {
  background: var(--raised);
  box-shadow: 0 0 0 1px var(--line-strong), var(--shadow-raised);
}

.cal-cell.is-drop {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.cal-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 4px;
}

.cal-num {
  display: grid;
  place-items: center;
  min-width: 30px;
  height: 30px;
  padding: 0 7px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 500;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.cal-cell.is-complete .cal-num {
  color: var(--accent);
  font-weight: 800;
}

.cal-cell.is-today .cal-num {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 800;
}

.cal-note-flag {
  margin: 5px 3px 0 0;
  color: var(--ink-3);
  font-size: 15px;
}

.cal-items {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  padding-left: 3px;
}

.cal-item {
  overflow: hidden;
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.4;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.cal-item.is-done {
  color: var(--ink-3);
  text-decoration: line-through;
}

.cal-more {
  color: var(--ink-3);
  font-size: 11.5px;
  font-weight: 500;
}

.cal-count {
  display: none;
  padding-left: 3px;
  color: var(--ink-3);
  font-size: 11.5px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 760px) {
  .cal {
    padding: 12px;
  }

  .cal-weekdays,
  .cal-grid {
    gap: 4px;
  }

  .cal-weekdays span {
    padding-left: 0;
    text-align: center;
  }

  .cal-cell {
    align-items: center;
    gap: 2px;
    min-height: 62px;
    padding: 6px 2px;
  }

  .cal-top {
    justify-content: center;
  }

  .cal-num {
    min-width: 28px;
    height: 28px;
    padding: 0 5px;
    font-size: 15px;
  }

  .cal-note-flag,
  .cal-items {
    display: none;
  }

  .cal-count {
    display: block;
    padding-left: 0;
  }
}

/* ------------------------------------------------------------------ notes */

.notes {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 22px 24px 24px;
  transition: box-shadow 0.35s var(--ease);
}

.notes:focus-within {
  box-shadow: var(--highlight), inset 0 0 0 1.5px var(--accent-line);
}

.notes-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 10px;
  margin-bottom: 10px;
}

.notes-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.notes-date {
  margin: 0;
  color: var(--ink-3);
  font-size: 14px;
}

.save-state {
  margin: 0 0 0 auto;
  color: var(--ink-3);
  font-size: 13px;
}

.save-state.is-error {
  color: var(--danger);
}

.notes-input {
  flex: 1 0 auto;
  width: 100%;
  max-width: 75ch;
  min-height: 170px;
  padding: 0;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  font-size: 15.5px;
  line-height: 1.65;
  field-sizing: content;
}

/* ------------------------------------------------------------------ hint & toast */

.hint {
  margin: 26px auto 0;
  color: var(--ink-3);
  font-size: 13px;
  text-align: center;
}

@media (hover: none) {
  .hint {
    display: none;
  }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: calc(100vw - 32px);
  min-height: 44px;
  padding: 6px 6px 6px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-raised);
  transform: translateX(-50%);
}

.toast.is-in {
  animation: toast-in 0.5s var(--ease);
}

.toast.is-error {
  background: var(--danger);
  color: #fff8f7;
}

.toast-text {
  padding: 6px 0;
}

.toast-action {
  height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--orb);
  font-size: 13.5px;
  font-weight: 700;
}

.date-picker {
  position: fixed;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* ------------------------------------------------------------------ lock screen */

body.is-locked {
  display: grid;
  place-items: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
}

body.is-locked .island,
body.is-locked .view,
body.is-locked .hint,
body.is-locked .offer {
  display: none;
}

body:not(.is-locked) .lock {
  display: none;
}

.lock {
  width: min(100%, 440px);
}

.lock .core {
  padding: 28px 28px 30px;
}

.lock-brand {
  margin: 0;
  color: var(--ink-2);
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
}

.lock .numeral {
  font-size: clamp(130px, 34vw, 190px);
}

.lock-date {
  margin: 0 0 24px;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.015em;
}

.lock-bio {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}

.bio-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 54px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 16px;
  font-weight: 500;
  transition: transform 0.4s var(--ease), opacity 0.3s var(--ease);
}

.bio-btn i {
  font-size: 24px;
}

.bio-btn:active {
  transform: scale(0.98);
}

.bio-btn[disabled] {
  opacity: 0.6;
  cursor: default;
}

.lock-or {
  margin: 0;
  color: var(--ink-3);
  font-size: 13.5px;
  text-align: center;
}

.lock-form {
  display: grid;
  gap: 14px;
}

.lock-label {
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 500;
}

.lock-input {
  width: 100%;
  height: 50px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  outline: 0;
  background: var(--raised);
  font-size: 16px;
  box-shadow: 0 0 0 1px var(--line), var(--shadow-raised);
  transition: box-shadow 0.35s var(--ease);
}

.lock-input:focus {
  box-shadow: 0 0 0 1.5px var(--accent-line), 0 0 0 5px var(--accent-soft), var(--shadow-raised);
}

.lock-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 5px 5px 18px;
  border-radius: 999px;
  background: var(--raised);
  box-shadow: 0 0 0 1px var(--line), var(--shadow-raised);
  transition: box-shadow 0.35s var(--ease);
}

.lock-row:focus-within {
  box-shadow: 0 0 0 1.5px var(--accent-line), 0 0 0 5px var(--accent-soft), var(--shadow-raised);
}

.lock-row.is-invalid {
  box-shadow: 0 0 0 1.5px var(--danger), 0 0 0 5px var(--danger-soft);
}

.lock-row.is-shaking {
  animation: shake 0.45s var(--ease);
}

.lock-input.in-row,
.lock-input.in-row:focus {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.lock-error {
  min-height: 1.5em;
  margin: -4px 0 0;
  color: var(--danger);
  font-size: 14px;
}

.lock-error.is-info {
  color: var(--ink-2);
}

/* ------------------------------------------------------------------ fingerprint offer */

.offer {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 10px;
  width: max-content;
  max-width: calc(100vw - 24px);
  padding: 6px 6px 6px 16px;
  border-radius: 999px;
  background: var(--raised);
  box-shadow: 0 0 0 1px var(--line-strong), var(--shadow-raised);
  transform: translateX(-50%);
  animation: toast-in 0.5s var(--ease);
}

.offer-icon {
  color: var(--accent);
  font-size: 22px;
}

.offer-text {
  margin: 0;
  font-size: 14.5px;
  font-weight: 500;
}

.offer-later,
.offer-yes {
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color 0.3s var(--ease), transform 0.35s var(--ease);
}

.offer-later {
  color: var(--ink-2);
}

.offer-later:hover {
  background: var(--hover);
}

.offer-yes {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
}

.offer-yes:active,
.offer-later:active {
  transform: scale(0.97);
}

body.has-offer .toast {
  bottom: calc(max(20px, env(safe-area-inset-bottom)) + 64px);
}

/* ------------------------------------------------------------------ settings */

.sheet {
  width: min(520px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  margin: auto;
  padding: 0;
  border: 0;
  overflow: visible;
  background: transparent;
  color: var(--ink);
}

.sheet::backdrop {
  background: rgba(12, 14, 17, 0.34);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.sheet[open] {
  animation: sheet-in 0.45s var(--ease);
}

.sheet .shell {
  background: var(--bg);
}

.sheet-core {
  max-height: calc(100dvh - 40px);
  padding: 22px 24px 24px;
  overflow-y: auto;
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-right: -8px;
}

.sheet-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.015em;
}

.settings-who {
  margin: 2px 0 0;
  color: var(--ink-3);
  font-size: 14px;
}

.settings-block {
  display: grid;
  justify-items: start;
  gap: 10px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.settings-label {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.settings-help {
  max-width: 52ch;
  margin: 0;
  color: var(--ink-3);
  font-size: 14px;
}

.segmented {
  display: inline-flex;
  gap: 2px;
  padding: 4px;
  border-radius: 999px;
  background: var(--hover);
  box-shadow: inset 0 0 0 1px var(--line);
}

.segmented button {
  height: 34px;
  padding: 0 16px;
  border-radius: 999px;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 500;
  transition: background-color 0.3s var(--ease), color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.segmented button[aria-checked="true"] {
  background: var(--raised);
  color: var(--ink);
  box-shadow: 0 0 0 1px var(--line), var(--shadow-raised);
}

.devices {
  display: grid;
  gap: 6px;
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

.device {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px 10px 14px;
  border-radius: var(--r-item);
  background: var(--raised);
  box-shadow: 0 0 0 1px var(--line);
}

.device-icon {
  flex: none;
  color: var(--ink-2);
  font-size: 22px;
}

.device-text {
  display: grid;
  flex: 1;
  min-width: 0;
}

.device-name {
  font-size: 15px;
  font-weight: 500;
}

.device-meta {
  color: var(--ink-3);
  font-size: 13px;
}

.device-here {
  color: var(--accent);
  font-weight: 700;
}

/* ------------------------------------------------------------------ motion */

@keyframes enter {
  from {
    opacity: 0;
    transform: translateY(18px);
    filter: blur(6px);
  }
}

@keyframes task-in {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.985);
  }
}

@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
}

@keyframes pop {
  40% {
    transform: scale(1.22);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 16px) scale(0.96);
  }
}

@keyframes sheet-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
}

@keyframes shimmer {
  to {
    opacity: 0.45;
  }
}

@keyframes shake {
  20%,
  60% {
    transform: translateX(-6px);
  }
  40%,
  80% {
    transform: translateX(6px);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .island,
  .shell {
    animation: enter 0.9s var(--ease) both;
  }

  .area-day {
    animation-delay: 0.06s;
  }

  .area-cal {
    animation-delay: 0.12s;
  }

  .area-notes {
    animation-delay: 0.18s;
  }
}

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

/* ------------------------------------------------------------------ small screens */

@media (max-width: 640px) {
  :root {
    --r-shell: 1.6rem;
    --r-pad: 5px;
  }

  body {
    padding: max(10px, env(safe-area-inset-top)) 10px max(32px, env(safe-area-inset-bottom));
  }

  .offer {
    flex-wrap: wrap;
    width: calc(100vw - 20px);
    padding: 12px 12px 12px 16px;
    border-radius: 22px;
  }

  .offer-text {
    flex: 1;
  }

  .island {
    width: 100%;
    margin-bottom: 14px;
  }

  .island-month {
    flex: 1;
    min-width: 0;
    font-size: 16px;
  }

  .island-divider {
    display: none;
  }

  .island-today {
    padding: 0 13px;
  }

  .day {
    padding: 20px 18px 14px;
  }

  .tasks {
    margin-left: -8px;
    margin-right: -8px;
  }

  .task-details {
    padding-left: 14px;
  }

  .notes {
    padding: 18px 18px 20px;
  }

  .add {
    padding-left: 14px;
  }

  .add .btn-primary {
    padding-left: 14px;
  }
}

/* ================================================================== planner additions */

/* ---- view switcher in the island */

.views {
  display: flex;
  gap: 2px;
}

.view-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 14px 0 12px;
  border-radius: 999px;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color 0.3s var(--ease), color 0.3s var(--ease);
}

.view-btn i {
  font-size: 18px;
}

.view-btn:hover {
  background: var(--hover);
  color: var(--ink);
}

.view-btn[aria-current="page"] {
  background: var(--ink);
  color: var(--bg);
}

.view-badge {
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

@media (max-width: 640px) {
  .view-btn {
    padding: 0 11px;
  }

  .view-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .views {
    flex: 1;
    justify-content: space-between;
  }

  .view-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 16px;
    height: 16px;
    font-size: 10px;
  }
}

/* ---- calendar header */

.cal-head {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: -4px 0 12px -6px;
}

.cal-month {
  min-width: 9.5em;
  margin: 0;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.01em;
  text-align: center;
}

.cal-today {
  height: 34px;
  margin-left: auto;
  padding: 0 14px;
  border-radius: 999px;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 500;
  box-shadow: inset 0 0 0 1px var(--line-strong);
  transition: background-color 0.3s var(--ease), color 0.3s var(--ease);
}

.cal-today:hover {
  background: var(--hover);
  color: var(--ink);
}

/* ---- calendar days: weekends, holidays, vacations, birthdays and marks */

.cal-cell.is-weekend {
  background: var(--weekend);
}

.cal-cell.is-holiday .cal-num {
  color: var(--holiday);
  font-weight: 800;
}

.cal-cell.is-vacation {
  background: var(--vacation-soft);
}

.cal-cell.is-vacation::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--vacation);
}

.cal-cell.has-mark {
  background: color-mix(in srgb, var(--mark) 15%, transparent);
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--mark) 55%, transparent);
}

.cal-cell.has-mark.is-selected {
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--mark) 70%, transparent), var(--shadow-raised);
}

.cal-flags {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin: 5px 3px 0 0;
}

.cal-flags i {
  color: var(--ink-3);
  font-size: 15px;
}

.cal-flags .cal-cake {
  color: var(--birthday);
}

.cal-flags .cal-mark-icon {
  color: var(--mark, var(--ink));
  font-size: 17px;
}

.cal-line {
  display: flex;
  align-items: center;
  gap: 3px;
  overflow: hidden;
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.cal-line i {
  flex: none;
  font-size: 12px;
}

.cal-holiday {
  display: block;
  color: var(--holiday);
}

.cal-birthday {
  display: block;
  color: var(--birthday);
}

.cal-vacation {
  color: var(--ink-2);
}

.cal-vacation i {
  color: var(--vacation);
}

.cal-label {
  display: block;
  color: var(--mark, var(--ink-2));
  font-weight: 700;
}

.cal-cell:not(.has-mark) .cal-label {
  color: var(--ink-2);
}

@media (max-width: 760px) {
  .cal-head {
    margin: -2px 0 10px;
  }

  .cal-month {
    min-width: 0;
    flex: 1;
    font-size: 17px;
  }

  .cal-flags {
    position: absolute;
    top: 3px;
    right: 3px;
    margin: 0;
  }

  .cal-flags i {
    font-size: 11px;
  }

  .cal-flags .cal-note-flag {
    display: none;
  }

  .cal-flags .cal-mark-icon {
    font-size: 12px;
  }
}

/* ---- day panel: what's on this day, and adding to it */

.day-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 4px 12px 4px 9px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
}

.badge i {
  flex: none;
  font-size: 16px;
}

button.badge {
  transition: filter 0.3s var(--ease), transform 0.35s var(--ease);
}

button.badge:hover {
  filter: brightness(0.97);
}

button.badge:active {
  transform: scale(0.97);
}

.badge-holiday {
  background: color-mix(in srgb, var(--holiday) 11%, transparent);
  color: var(--holiday);
}

.badge-birthday {
  background: color-mix(in srgb, var(--birthday) 11%, transparent);
  color: var(--birthday);
}

.badge-vacation {
  background: var(--vacation-soft);
  color: var(--ink);
}

.badge-vacation i {
  color: var(--vacation);
}

.badge-mark {
  background: color-mix(in srgb, var(--mark, var(--ink-3)) 14%, transparent);
  color: var(--ink);
}

.badge-mark i {
  color: var(--mark, var(--ink-2));
}

.day-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

/* ---- repeating tasks */

.task-repeat-flag {
  flex: none;
  color: var(--accent);
  font-size: 16px;
}

.task-repeat,
.text-input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--r-field);
  outline: 0;
  background: var(--core);
  font-size: 15px;
  box-shadow: inset 0 0 0 1px var(--line);
  transition: box-shadow 0.3s var(--ease);
}

.task-repeat {
  appearance: none;
  padding-right: 34px;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}

.task-repeat:focus,
.text-input:focus {
  box-shadow: inset 0 0 0 1.5px var(--accent-line), 0 0 0 4px var(--accent-soft);
}

.text-input:disabled {
  opacity: 0.7;
}

/* ---- Claude in the notes card, and suggestions anywhere */

.note-ai {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.note-ai-state {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--ink-3);
  font-size: 13.5px;
}

.note-ai-state::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent);
  opacity: 0.55;
}

.note-ai-state.is-busy::before {
  animation: breathe 1.2s ease-in-out infinite alternate;
}

.note-ai-state.is-error {
  color: var(--danger);
}

.note-ai-state.is-error::before {
  background: var(--danger);
}

.suggestion-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.suggestion {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 8px 10px 14px;
  border-radius: var(--r-item);
  background: var(--raised);
  box-shadow: 0 0 0 1px var(--line);
  animation: reveal 0.45s var(--ease);
}

.suggestion-icon {
  flex: none;
  color: var(--accent);
  font-size: 22px;
}

.suggestion-text {
  display: grid;
  flex: 1;
  min-width: 0;
}

.suggestion-title {
  font-size: 15px;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.suggestion-meta {
  color: var(--ink-3);
  font-size: 13px;
}

.suggestion-actions {
  display: flex;
  flex: none;
  gap: 4px;
}

.link-btn {
  color: var(--ink-2);
  font-size: inherit;
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
  transition: color 0.3s var(--ease), text-decoration-color 0.3s var(--ease);
}

.link-btn:hover {
  color: var(--ink);
  text-decoration-color: currentColor;
}

@media (max-width: 640px) {
  .suggestion {
    flex-wrap: wrap;
  }

  .suggestion-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

/* ---- dialogs: shared form parts */

.plan-body {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.plan-only {
  display: grid;
  gap: 12px;
}

.field-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14.5px;
  cursor: pointer;
}

.check-row input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
}

.plan-cost {
  margin: 0;
  color: var(--ink-2);
  font-size: 14px;
}

.plan-cost.is-over {
  color: var(--danger);
}

.sheet-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 22px;
}

.sheet-actions .danger {
  margin-right: auto;
}

.number-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.number-input {
  width: 96px;
}

.swatches,
.icon-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.swatch-pick {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: var(--mark, transparent);
  color: #fff;
  font-size: 15px;
  box-shadow: inset 0 0 0 1px var(--line-strong);
  transition: transform 0.35s var(--spring);
}

.swatch-pick[data-color=""] {
  background:
    linear-gradient(135deg, transparent calc(50% - 1px), var(--ink-3) calc(50% - 1px), var(--ink-3) calc(50% + 1px), transparent calc(50% + 1px)),
    var(--raised);
  color: var(--ink);
}

.swatch-pick i {
  opacity: 0;
  transition: opacity 0.2s var(--ease);
}

.swatch-pick[aria-checked="true"] {
  transform: scale(1.12);
  box-shadow: 0 0 0 2px var(--core), 0 0 0 4px var(--ink);
}

.swatch-pick[aria-checked="true"] i {
  opacity: 1;
}

.icon-picks {
  max-height: 168px;
  overflow-y: auto;
  padding: 2px;
}

.icon-pick {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  color: var(--ink-2);
  font-size: 20px;
  box-shadow: inset 0 0 0 1px var(--line);
  transition: background-color 0.3s var(--ease), color 0.3s var(--ease);
}

.icon-pick:hover {
  background: var(--hover);
  color: var(--ink);
}

.icon-pick[aria-checked="true"] {
  background: var(--ink);
  color: var(--bg);
  box-shadow: none;
}

/* ================================================================== other views */

.year-view,
.journal-view,
.ask-view {
  display: grid;
  gap: 18px;
  max-width: 1320px;
  margin: 0 auto;
}

.side-core {
  display: grid;
  gap: 12px;
  padding: 22px 22px 24px;
}

.side-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.side-help {
  max-width: 60ch;
  margin: 0;
  color: var(--ink-3);
  font-size: 14px;
}

/* ---- year */

@media (min-width: 1000px) {
  .year-view {
    grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr);
    align-items: start;
    gap: 22px;
  }
}

.year-side {
  display: grid;
  gap: 18px;
}

.year-core {
  padding: 20px 22px 22px;
}

.year-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  margin: -4px 0 18px -6px;
}

.year-title {
  min-width: 2.8em;
  margin: 0;
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.03em;
  text-align: center;
}

.leave-summary {
  margin: 0 auto 0 12px;
  color: var(--ink-2);
  font-size: 14.5px;
  font-weight: 500;
}

.leave-summary.is-over {
  color: var(--danger);
}

.year-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 22px 20px;
}

@media (max-width: 1240px) {
  .year-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .year-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 12px;
  }

  .leave-summary {
    width: 100%;
    margin: 6px 0 0 6px;
  }
}

.mini-title {
  display: block;
  margin: 0 0 6px;
  padding: 2px 4px;
  border-radius: 6px;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 500;
}

.mini-title:hover {
  background: var(--hover);
}

.mini-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 2px;
}

.mini-head {
  color: var(--ink-3);
  font-size: 10.5px;
  font-weight: 500;
  text-align: center;
}

.mini-day {
  position: relative;
  aspect-ratio: 1;
  min-width: 0;
  border-radius: 6px;
  color: var(--ink);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  transition: background-color 0.2s var(--ease);
}

.mini-day:hover {
  background: var(--hover);
}

.mini-day.is-weekend {
  background: var(--weekend);
  color: var(--ink-2);
}

.mini-day.is-vacation {
  background: var(--vacation-soft);
  box-shadow: inset 0 -2px 0 var(--vacation);
}

.mini-day.has-mark {
  background: color-mix(in srgb, var(--mark) 22%, transparent);
}

.mini-day.is-holiday {
  color: var(--holiday);
  font-weight: 800;
}

.mini-day.is-birthday::after {
  content: "";
  position: absolute;
  bottom: 3px;
  left: 50%;
  width: 4px;
  height: 4px;
  margin-left: -2px;
  border-radius: 999px;
  background: var(--birthday);
}

.mini-day.is-today {
  box-shadow: inset 0 0 0 1.5px var(--accent);
  font-weight: 800;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 20px 0 0;
  padding: 16px 0 0;
  border-top: 1px solid var(--line);
  color: var(--ink-3);
  font-size: 13px;
  list-style: none;
}

.legend li {
  display: flex;
  align-items: center;
  gap: 7px;
}

.swatch {
  width: 12px;
  height: 12px;
  border-radius: 4px;
}

.swatch-weekend {
  background: var(--weekend);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

.swatch-holiday {
  background: var(--holiday);
}

.swatch-vacation {
  background: var(--vacation);
}

.swatch-birthday {
  width: 8px;
  height: 8px;
  margin: 2px;
  border-radius: 999px;
  background: var(--birthday);
}

.budget {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.budget-label {
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 500;
}

.budget .segmented button {
  min-width: 38px;
  padding: 0 12px;
}

.dayoffs,
.holiday-list {
  display: grid;
  gap: 6px;
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
}

.dayoff {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 10px 10px 12px;
  border-radius: var(--r-item);
  background: var(--raised);
  box-shadow: 0 0 0 1px var(--line);
}

.dayoff.is-over {
  opacity: 0.6;
}

.dayoff-gain {
  display: grid;
  flex: none;
  justify-items: center;
  width: 54px;
  line-height: 1;
}

.dayoff-num {
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.dayoff-unit {
  margin-top: 3px;
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 500;
}

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

.dayoff-dates {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
}

.dayoff-meta {
  margin: 1px 0 0;
  color: var(--ink-3);
  font-size: 13px;
}

.holiday {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 10px;
  align-items: baseline;
  padding: 5px 2px;
  font-size: 14px;
}

.holiday.is-past {
  opacity: 0.5;
}

.holiday-date {
  justify-self: start;
  color: var(--holiday);
  font-weight: 500;
  text-decoration-color: color-mix(in srgb, var(--holiday) 35%, transparent);
}

.holiday-name {
  color: var(--ink-2);
}

/* ---- journal */

.journal-view,
.ask-view {
  max-width: 880px;
}

.journal-core {
  padding: 22px 24px 26px;
}

.journal-head,
.ask-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.journal-title,
.ask-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.journal-tabs {
  display: flex;
  gap: 6px;
  margin: 18px -24px 0;
  padding: 0 24px 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.journal-tab {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 14px 0 12px;
  border-radius: 999px;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 500;
  box-shadow: inset 0 0 0 1px var(--line-strong);
  transition: background-color 0.3s var(--ease), color 0.3s var(--ease);
}

.journal-tab i {
  font-size: 18px;
}

.journal-tab:hover {
  background: var(--hover);
}

.journal-tab[aria-selected="true"] {
  background: var(--ink);
  color: var(--bg);
  box-shadow: none;
}

.journal-count {
  color: inherit;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  opacity: 0.7;
}

.journal-count:empty {
  display: none;
}

.journal-list {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.journal-empty {
  margin: 8px 0;
  color: var(--ink-3);
  font-size: 15px;
}

.entry {
  display: grid;
  gap: 6px;
  padding: 14px 14px 10px 16px;
  border-radius: var(--r-item);
  background: var(--raised);
  box-shadow: 0 0 0 1px var(--line);
}

.entry[data-tone] {
  box-shadow: 0 0 0 1px var(--line), inset 3px 0 0 var(--tone);
}

.entry[data-tone="positive"],
.mood-tile.tone-positive {
  --tone: var(--accent);
}

.entry[data-tone="neutral"],
.mood-tile.tone-neutral {
  --tone: var(--ink-3);
}

.entry[data-tone="negative"],
.mood-tile.tone-negative {
  --tone: var(--holiday);
}

.entry-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
}

.entry-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.entry-tag {
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 500;
}

.entry-text {
  max-width: 68ch;
  margin: 0;
  color: var(--ink-2);
  font-size: 15px;
  line-height: 1.55;
}

.entry-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--ink-3);
  font-size: 13px;
}

.entry-foot .icon-btn {
  margin-right: -6px;
}

.entry-days,
.qa-days {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-bottom: 4px;
}

.day-chip {
  height: 28px;
  padding: 0 11px;
  border-radius: 999px;
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 500;
  box-shadow: inset 0 0 0 1px var(--line-strong);
  transition: background-color 0.3s var(--ease), color 0.3s var(--ease);
}

.day-chip:hover {
  background: var(--hover);
  color: var(--ink);
}

.mood-strip {
  display: grid;
  grid-template-columns: repeat(30, minmax(0, 1fr));
  gap: 3px;
  margin-bottom: 8px;
}

.mood-tile {
  aspect-ratio: 1;
  border-radius: 4px;
  background: var(--tone, var(--hover));
}

.mood-tile.tone-none {
  box-shadow: inset 0 0 0 1px var(--line);
}

/* ---- ask */

.ask-core {
  display: grid;
  gap: 18px;
  padding: 22px 24px 20px;
}

.ask-intro {
  display: grid;
  gap: 14px;
}

.ask-examples {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ask-examples .ghost-btn {
  height: auto;
  min-height: 36px;
  padding: 6px 14px;
  white-space: normal;
  text-align: left;
}

.ask-thread {
  display: grid;
  gap: 14px;
}

.ask-thread:empty {
  display: none;
}

.qa {
  display: grid;
  gap: 10px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  animation: reveal 0.45s var(--ease);
  scroll-margin-top: 90px;
}

.qa-q {
  justify-self: end;
  max-width: 85%;
  margin: 0;
  padding: 9px 14px;
  border-radius: 16px 16px 4px 16px;
  background: var(--ink);
  color: var(--bg);
  font-size: 15px;
  overflow-wrap: anywhere;
}

.qa-a {
  max-width: 68ch;
  font-size: 15.5px;
  line-height: 1.6;
}

.qa-a p {
  margin: 0 0 8px;
}

.qa-a p:last-child {
  margin-bottom: 0;
}

.qa-a a {
  color: var(--accent);
  text-underline-offset: 3px;
  overflow-wrap: anywhere;
}

.qa-a.is-error {
  display: grid;
  justify-items: start;
  gap: 8px;
  color: var(--danger);
}

.qa-a.is-thinking {
  display: grid;
  gap: 8px;
}

.thinking-text {
  color: var(--ink-3);
  font-size: 14px;
}

.thinking-bar {
  display: block;
  width: 70%;
  height: 12px;
  border-radius: 999px;
  background: var(--skeleton);
  animation: shimmer 1s ease-in-out infinite alternate;
}

.thinking-bar + .thinking-bar {
  width: 45%;
}

.qa-changes {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--r-item);
  background: var(--accent-soft);
  font-size: 14px;
  list-style: none;
}

.qa-changes li {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.qa-changes i {
  color: var(--accent);
  font-size: 12px;
}

.qa-changes.is-undone {
  background: var(--hover);
  color: var(--ink-3);
  text-decoration: line-through;
}

.qa-changes.is-undone i {
  color: var(--ink-3);
}

.qa-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.qa-foot:has(.qa-days:empty):not(:has(button.ghost-btn, .qa-undone)) {
  display: none;
}

.qa-undone {
  color: var(--ink-3);
  font-size: 13px;
}

.ask-form {
  position: sticky;
  bottom: max(12px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 5px 5px 18px;
  border-radius: 999px;
  background: var(--raised);
  box-shadow: 0 0 0 1px var(--line), var(--shadow-raised);
  transition: box-shadow 0.35s var(--ease);
}

.ask-form:focus-within {
  box-shadow: 0 0 0 1.5px var(--accent-line), 0 0 0 5px var(--accent-soft), var(--shadow-raised);
}

.ask-form .add-icon {
  color: var(--accent);
}

@keyframes breathe {
  to {
    opacity: 1;
    transform: scale(1.35);
  }
}

@media (max-width: 640px) {
  .side-core,
  .journal-core,
  .ask-core,
  .year-core {
    padding: 18px 16px 20px;
  }

  .journal-tabs {
    margin: 16px -16px 0;
    padding: 0 16px 4px;
  }

  .journal-title,
  .ask-title {
    font-size: 26px;
  }

  .field-pair {
    grid-template-columns: 1fr;
  }
}

body:not([data-page="planner"]) .hint {
  display: none;
}

.ask-thread:not(:empty) {
  padding-bottom: 8px;
}

/* ================================================================== Claude on request */

.note-ai-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
}

.note-ai-bar .ghost-btn {
  color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent-line);
}

.note-ai-bar .ghost-btn:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.note-ai-bar .ghost-btn[disabled] {
  opacity: 0.45;
  cursor: default;
}

.note-ai-bar .note-ai-state {
  flex: 1;
  min-width: 12em;
}

.tell {
  display: grid;
  gap: 8px;
}

.tell-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 4px 4px 16px;
  border-radius: 999px;
  background: var(--raised);
  box-shadow: 0 0 0 1px var(--line);
  transition: box-shadow 0.35s var(--ease);
}

.tell-row:focus-within {
  box-shadow: 0 0 0 1.5px var(--accent-line), 0 0 0 5px var(--accent-soft);
}

.tell-row .add-icon {
  color: var(--accent);
}

.tell-row .add-input {
  height: 40px;
  font-size: 15px;
}

.tell-row .btn-primary {
  height: 40px;
}

.tell-row .btn-primary[disabled] {
  opacity: 0.5;
}

.tell-quote {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 4px 4px 12px;
  border-radius: var(--r-item);
  background: var(--accent-soft);
  color: var(--ink-2);
  font-size: 13.5px;
}

.tell-quote > i {
  flex: none;
  color: var(--accent);
  font-size: 16px;
}

.tell-quote-text {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.tell-result:empty {
  display: none;
}

.qa.is-compact {
  gap: 8px;
  padding: 12px 14px;
  border: 0;
  border-radius: var(--r-item);
  background: var(--raised);
  box-shadow: 0 0 0 1px var(--line);
}

.qa.is-compact .qa-a {
  font-size: 15px;
}

/* the toolbar over selected note text */
.selection-pop {
  position: fixed;
  z-index: 35;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  box-shadow: var(--shadow-raised);
  animation: pop-in 0.25s var(--ease);
}

.selection-pop button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 13px 0 11px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color 0.25s var(--ease);
}

.selection-pop button:hover {
  background: var(--orb);
}

.selection-pop i {
  font-size: 16px;
}

.selection-pop-divider {
  width: 1px;
  height: 18px;
  background: color-mix(in srgb, var(--bg) 25%, transparent);
}

.selection-pop.is-docked {
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  animation: none;
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: translateY(4px) scale(0.96);
  }
}

.password-form {
  display: grid;
  justify-items: start;
  gap: 10px;
  width: 100%;
}

.password-form .field {
  width: min(100%, 320px);
}

.lock-error.is-info {
  color: var(--accent);
}

.journal-help {
  margin-top: 4px;
}

/* The notes card is a flex item; let it shrink below its content on narrow screens. */
.area-notes > .notes {
  min-width: 0;
}

/* ================================================================== richer day marks */

.mark-icon {
  color: var(--icon, var(--ink));
}

.cal-mark-icons {
  display: inline-flex;
  align-items: center;
  gap: 1px;
}

.cal-flags .mark-icon {
  font-size: 16px;
  color: var(--icon, var(--ink));
}

.cal-text {
  display: block;
  overflow: hidden;
  padding-left: 3px;
  color: var(--text, var(--ink-2));
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.35;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.badge-icons {
  display: inline-flex;
  gap: 2px;
}

.badge-icons .mark-icon {
  font-size: 16px;
}

.badge-text.has-color {
  color: var(--text);
  font-weight: 700;
}

@media (max-width: 760px) {
  .cal-top {
    flex-direction: column;
    align-items: center;
    gap: 1px;
  }

  .cal-flags {
    position: static;
    gap: 1px;
    margin: 0;
  }

  .cal-flags i,
  .cal-flags .mark-icon {
    font-size: 10px;
  }

  .cal-text {
    width: 100%;
    padding: 0 1px;
    font-size: 9px;
    text-align: center;
  }
}

/* ---- mark dialog */

.field-hint {
  margin-left: 4px;
  color: var(--ink-3);
  font-weight: 400;
}

.picked {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-height: 44px;
}

.picked-icon {
  position: relative;
  display: inline-flex;
}

.picked-pick {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--raised);
  font-size: 24px;
  box-shadow: inset 0 0 0 1px var(--line-strong);
  transition: box-shadow 0.25s var(--ease);
}

.picked-pick[aria-pressed="true"] {
  box-shadow: inset 0 0 0 2px var(--ink);
}

.picked-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-size: 10px;
}

.picked-empty {
  color: var(--ink-3);
  font-size: 13.5px;
}

.swatches.is-small .swatch-pick {
  width: 28px;
  height: 28px;
  font-size: 13px;
}

.swatches.is-disabled {
  opacity: 0.4;
}

.icon-library {
  display: grid;
  gap: 4px;
  max-height: 260px;
  margin-top: 4px;
  padding: 2px 4px 2px 2px;
  overflow-y: auto;
  border-top: 1px solid var(--line);
}

.icon-library .icon-picks {
  max-height: none;
  overflow: visible;
}

.icon-group {
  margin: 8px 0 2px;
  color: var(--ink-3);
  font-size: 12.5px;
  font-weight: 500;
}

.icon-pick[aria-pressed="true"] {
  background: var(--ink);
  color: var(--bg);
  box-shadow: none;
}

.icon-pick:disabled {
  opacity: 0.35;
  cursor: default;
}
