/* ================================================================
   Daylight — the Calendar (Day · Week thread · Week grid · Month) and THE
   THREAD itself, which Today draws too (calendar-view.js exports dayThread and
   home-view.js puts it on Today). Scoped to body.surface-daylight.

   The thread, from FINAL.md: a row is time · spine · card. The spine is one
   hairline down the day with a round icon on it for each thing; the card beside
   it is as tall as the thing is long. The bead calendar-view.js sizes is kept
   as the row's measure — it sits in the spine column, invisible, and the card
   stretches to it — so the proportion stays that file's decision. Past is
   filled softly, the next thing is outlined, the future is a hairline, and now
   is a quiet red line.

   Colour still comes from each thing's own name (--hue, set per row by
   calendar-view.js), drawn as Daylight's pair: a soft fill with ink on it, and
   a strong tone for icons, rings and bars only — never for words. OKLCH, so
   every hue lands at the same softness, in light and in dark.
   ================================================================ */

body.surface-daylight {
  --cal-check-line: #BDB6AD;
  --cal-seg: var(--dl-segment);
  --cal-seg-on: var(--card-bg);
  --cal-primary: var(--text-heading);
  --cal-on-primary: var(--card-bg);
  --cal-ic-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --cal-ic-prev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M15 6l-6 6 6 6' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --cal-ic-next: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 6l6 6-6 6' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --cal-ic-plus: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 5v14M5 12h14' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  --cal-ic-cal: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3.5' y='5' width='17' height='15.5' rx='2.5'/%3E%3Cpath d='M3.5 10h17M8 3v4M16 3v4'/%3E%3C/svg%3E");
}
body.surface-daylight:not(.theme-light) {
  --cal-check-line: #6B665F;
  --cal-seg: color-mix(in srgb, var(--text-heading) 7%, var(--card-bg));
  --cal-seg-on: color-mix(in srgb, var(--text-heading) 17%, var(--card-bg));
}

/* Each thing's pair, from its hue. Fill = its card when done, and its icon's
   circle; strong = the icon, the ring round the next thing, a bar. */
body.surface-daylight :is(#calendar-view, #home-view) :is(.cv-item, .cv-loose, .cv-block, .cv-chip) {
  --cal-fill: oklch(0.945 0.032 var(--hue, 255));
  --cal-strong: oklch(0.54 0.13 var(--hue, 255));
}
body.surface-daylight:not(.theme-light) :is(#calendar-view, #home-view) :is(.cv-item, .cv-loose, .cv-block, .cv-chip) {
  --cal-fill: oklch(0.305 0.04 var(--hue, 255));
  --cal-strong: oklch(0.8 0.1 var(--hue, 255));
}

/* ================================================================
   The thread — Calendar Day, each day of the Week thread, and Today
   ================================================================ */

body.surface-daylight :is(#calendar-view, #home-view) .cv-thread { position: relative; }

body.surface-daylight :is(#calendar-view, #home-view) .cv-thread > .cv-item {
  display: grid;
  grid-template-columns: 68px 40px minmax(0, 1fr) 44px;
  column-gap: 0;
  align-items: stretch;
  opacity: 1;
}

/* Time: the start, right-aligned against the spine. The end time is on the
   card, so the gutter keeps to one number per row. */
body.surface-daylight :is(#calendar-view, #home-view) .cv-thread > .cv-item > .cv-gut {
  grid-column: 1; grid-row: 1;
  display: block; align-self: start;
  padding: 16px 12px 0 0; text-align: right;
}
body.surface-daylight :is(#calendar-view, #home-view) .cv-thread .cv-gut-t {
  display: block;
  font-size: 13px; line-height: 18px; font-weight: 500;
  color: var(--text-muted); white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
body.surface-daylight :is(#calendar-view, #home-view) .cv-thread .cv-gut-t.on { color: var(--text-heading); font-weight: 600; }
body.surface-daylight :is(#calendar-view, #home-view) .cv-thread .cv-gut-e { display: none; }

/* The spine: one hairline down the whole day. */
body.surface-daylight :is(#calendar-view, #home-view) .cv-thread > .cv-item > .cv-rail {
  grid-column: 2; grid-row: 1;
  position: relative; display: block;
}
body.surface-daylight :is(#calendar-view, #home-view) .cv-thread > .cv-item > .cv-rail::before {
  content: ''; position: absolute;
  left: 19px; top: 0; bottom: 0; width: 2px;
  transform: none; border-radius: 1px;
  background: var(--border);
}
/* It begins at the first thing and ends at the last, rather than trailing off
   past either end of the day. */
body.surface-daylight :is(#calendar-view, #home-view) .cv-thread > .cv-item:first-child > .cv-rail::before { top: 26px; }
body.surface-daylight :is(#calendar-view, #home-view) .cv-thread > .cv-item:last-child > .cv-rail::before { bottom: auto; height: 26px; }
body.surface-daylight :is(#calendar-view, #home-view) .cv-thread > .cv-nowrow:first-child > .cv-rail::before { top: 14px; }
body.surface-daylight :is(#calendar-view, #home-view) .cv-thread > .cv-nowrow:last-child > .cv-rail::before { height: 14px; }
body.surface-daylight :is(#calendar-view, #home-view) .cv-thread > .cv-item:first-child:last-child > .cv-rail::before { display: none; }

/* The bead stays the row's measure — its height is the thing's length — but
   it draws nothing itself: only its icon shows, as the round bead on the
   spine, and the card beside it stretches to its height. */
body.surface-daylight :is(#calendar-view, #home-view) .cv-thread .cv-bead {
  position: relative; display: block;
  width: 40px; margin: 4px 0;
  border: 0; border-radius: 0; background: none; box-shadow: none;
  overflow: visible; opacity: 1; z-index: 1;
}
body.surface-daylight :is(#calendar-view, #home-view) .cv-thread .cv-bead-ic {
  position: absolute; left: 4px; top: 6px;
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--card-bg);
  box-shadow: inset 0 0 0 1px var(--border);
  color: var(--cal-strong);
}
body.surface-daylight :is(#calendar-view, #home-view) :is(.cv-bead-ic, .cv-loose-ic) .sched-ic { color: var(--cal-strong); }
body.surface-daylight :is(#calendar-view, #home-view) :is(.cv-bead-ic, .cv-loose-ic) .sched-ic svg { width: 18px; height: 18px; }
body.surface-daylight :is(#calendar-view, #home-view) :is(.cv-bead-ic, .cv-loose-ic) .sched-ic.emoji { font-size: 16px; }

/* The fill was the clock — solid behind you, part-full for the thing you are
   in. On the Daylight thread the past is told by the cards, so the fill only
   draws for the thing happening now: its stretch of spine, filling in its own
   colour as the minutes go. */
body.surface-daylight :is(#calendar-view, #home-view) .cv-thread .cv-bead-fill { display: none; }
body.surface-daylight :is(#calendar-view, #home-view) .cv-thread .cv-item.current:not(.ghost-ahead) .cv-bead-fill {
  display: block;
  left: 19px; right: auto; width: 2px; border-radius: 1px;
  background: var(--cal-strong);
}

/* The card. */
body.surface-daylight :is(#calendar-view, #home-view) .cv-thread > .cv-item:is(.cv-task, .cv-event) > .cv-info {
  grid-column: 3 / 5; grid-row: 1;
  min-width: 0; margin: 4px 0 4px 8px;
  padding: 10px 44px 10px 14px;
  border-radius: 14px;
  background: var(--card-bg);
  box-shadow: inset 0 0 0 1px var(--border);
  display: flex; flex-wrap: wrap; align-content: flex-start;
  column-gap: 6px; row-gap: 1px;
  transition: box-shadow 0.12s ease, background-color 0.12s ease;
}
body.surface-daylight :is(#calendar-view, #home-view) .cv-thread > .cv-item:is(.cv-task, .cv-event) > .cv-info.cv-clickable:hover {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--text-heading) 22%, transparent);
}
body.surface-daylight :is(#calendar-view, #home-view) .cv-thread .cv-item .cv-name {
  order: 0; flex: 0 0 100%;
  margin: 0; min-width: 0;
  font-size: 15px; line-height: 20px; font-weight: 500;
  color: var(--text-heading);
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  overflow: hidden; overflow-wrap: anywhere;
}
body.surface-daylight :is(#calendar-view, #home-view) .cv-thread .cv-item .cv-range {
  order: 1; flex: none;
  font-size: 13px; line-height: 18px; font-weight: 400;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
body.surface-daylight :is(#calendar-view, #home-view) .cv-thread .cv-item .cv-meta {
  order: 2; flex: 1 1 0; min-width: 0;
  display: flex; align-items: center; gap: 4px;
  margin: 0;
  font-size: 13px; line-height: 18px;
  color: var(--text-muted);
  white-space: nowrap; overflow: hidden;
}
body.surface-daylight :is(#calendar-view, #home-view) .cv-thread > .cv-item > .cv-info > .cv-meta::before { content: '·'; }

/* The note a task lives in, and a meeting's place — the secondary line. */
body.surface-daylight :is(#calendar-view, #home-view) :is(.cv-thread, .cv-loose) .cv-notelink {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font: inherit; color: inherit; background: none; border: 0; padding: 0;
}
body.surface-daylight :is(#calendar-view, #home-view) :is(.cv-thread, .cv-loose) .cv-notelink:hover { color: var(--accent); text-decoration: none; }
body.surface-daylight :is(#calendar-view, #home-view) :is(.cv-thread, .cv-loose) .cv-meta-ic {
  flex: none; font-size: 12px; opacity: 0.85; filter: grayscale(1);
}
body.surface-daylight :is(#calendar-view, #home-view) :is(.cv-thread, .cv-loose) .cv-meta > span:not(.cv-meta-ic) {
  min-width: 0; overflow: hidden; text-overflow: ellipsis;
}

/* The ring — the one thing on a row you can finish — sits inside the card,
   at its right, level with the title. */
body.surface-daylight :is(#calendar-view, #home-view) .cv-thread > .cv-item > .cv-ring {
  grid-column: 4; grid-row: 1;
  justify-self: center; align-self: start;
  margin: 15px 4px 0 0;
  position: relative; z-index: 1;
}
body.surface-daylight :is(#calendar-view, #home-view) :is(.cv-thread, .cv-loose) .cv-ring {
  width: 20px; height: 20px; padding: 0;
  border: 0; border-radius: 50%;
  background: transparent;
  box-shadow: inset 0 0 0 1.5px var(--cal-check-line);
  display: grid; place-items: center;
  transition: background-color 0.12s ease, box-shadow 0.12s ease;
}
body.surface-daylight :is(#calendar-view, #home-view) :is(.cv-thread, .cv-loose) button.cv-ring:hover {
  box-shadow: inset 0 0 0 1.5px var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}
body.surface-daylight :is(#calendar-view, #home-view) :is(.cv-thread, .cv-loose) .cv-ring.on {
  background: var(--accent); box-shadow: none;
}
body.surface-daylight :is(#calendar-view, #home-view) :is(.cv-thread, .cv-loose) .cv-ring.on::after {
  content: ''; display: block;
  width: 12px; height: 12px;
  background: #FFFFFF;
  -webkit-mask: var(--cal-ic-check) center / contain no-repeat;
  mask: var(--cal-ic-check) center / contain no-repeat;
}
body.surface-daylight:not(.theme-light) :is(#calendar-view, #home-view) :is(.cv-thread, .cv-loose) .cv-ring.on::after { background: #161514; }
body.surface-daylight :is(#calendar-view, #home-view) :is(.cv-thread, .cv-loose) .cv-ring.ghost {
  box-shadow: none; background: none; pointer-events: none;
}
/* A meeting that has happened: a quiet check in its own colour. */
body.surface-daylight :is(#calendar-view, #home-view) .cv-thread > .cv-item.cv-event.past:not(.ghost-ahead) > .cv-ring.ghost::after {
  content: ''; display: block;
  width: 16px; height: 16px;
  background: var(--cal-strong);
  -webkit-mask: var(--cal-ic-check) center / contain no-repeat;
  mask: var(--cal-ic-check) center / contain no-repeat;
}

/* ---- States ---- */

/* Behind you: filled softly. The ring still says whether a task got done. */
body.surface-daylight :is(#calendar-view, #home-view) .cv-thread > .cv-item:is(.past, .done):not(.ghost-ahead) > .cv-info {
  background: var(--cal-fill); box-shadow: none;
}
body.surface-daylight :is(#calendar-view, #home-view) .cv-thread > .cv-item:is(.past, .done):not(.ghost-ahead) .cv-bead-ic {
  background: var(--cal-fill); box-shadow: none;
}
body.surface-daylight :is(#calendar-view, #home-view) .cv-thread .cv-item.done .cv-name {
  color: var(--text-muted); text-decoration: line-through;
  text-decoration-color: color-mix(in srgb, var(--text-muted) 60%, transparent);
}

/* Next, and happening now: outlined in its own colour and lifted a little. */
body.surface-daylight :is(#calendar-view, #home-view) .cv-thread > .cv-item.current:not(.ghost-ahead):not(.done) > .cv-info,
body.surface-daylight :is(#calendar-view, #home-view) .cv-thread > .cv-nowrow + .cv-item:is(.cv-task, .cv-event):not(.ghost-ahead):not(.done) > .cv-info,
body.surface-daylight :is(#calendar-view, #home-view) .cv-thread > .cv-nowrow + .cv-gaprow + .cv-item:is(.cv-task, .cv-event):not(.ghost-ahead):not(.done) > .cv-info {
  background: var(--card-bg);
  box-shadow: inset 0 0 0 1.5px var(--cal-strong), 0 2px 10px rgba(31, 28, 24, 0.06);
}
body.surface-daylight :is(#calendar-view, #home-view) .cv-thread > .cv-item.current:not(.ghost-ahead):not(.done) .cv-bead-ic,
body.surface-daylight :is(#calendar-view, #home-view) .cv-thread > .cv-nowrow + .cv-item:is(.cv-task, .cv-event):not(.ghost-ahead):not(.done) .cv-bead-ic,
body.surface-daylight :is(#calendar-view, #home-view) .cv-thread > .cv-nowrow + .cv-gaprow + .cv-item:is(.cv-task, .cv-event):not(.ghost-ahead):not(.done) .cv-bead-ic {
  background: var(--card-bg);
  box-shadow: inset 0 0 0 1.5px var(--cal-strong);
}
body.surface-daylight:not(.theme-light) :is(#calendar-view, #home-view) .cv-thread > .cv-item.current:not(.ghost-ahead):not(.done) > .cv-info,
body.surface-daylight:not(.theme-light) :is(#calendar-view, #home-view) .cv-thread > .cv-nowrow + .cv-item:is(.cv-task, .cv-event):not(.ghost-ahead):not(.done) > .cv-info,
body.surface-daylight:not(.theme-light) :is(#calendar-view, #home-view) .cv-thread > .cv-nowrow + .cv-gaprow + .cv-item:is(.cv-task, .cv-event):not(.ghost-ahead):not(.done) > .cv-info {
  box-shadow: inset 0 0 0 1.5px var(--cal-strong), 0 2px 12px rgba(0, 0, 0, 0.35);
}
body.surface-daylight :is(#calendar-view, #home-view) .cv-thread .cv-item.current .cv-range {
  color: var(--text-heading); font-weight: 500;
}

/* Picked (the Calendar can mark one): the accent ring the kit gives a
   selected card. */
body.surface-daylight :is(#calendar-view, #home-view) .cv-thread > .cv-item:is(.selected, .is-selected, [aria-current="true"], [aria-selected="true"]) > .cv-info {
  box-shadow: 0 0 0 2px var(--accent);
}

/* A repeat that has not happened yet: the same shape, outlined in dashes and
   empty, so it never looks like something to tick. */
body.surface-daylight :is(#calendar-view, #home-view) .cv-thread > .cv-item.ghost > .cv-info {
  background: transparent; box-shadow: none;
  outline: 1.5px dashed color-mix(in srgb, var(--text-muted) 42%, transparent);
  outline-offset: -1.5px;
}
body.surface-daylight :is(#calendar-view, #home-view) .cv-thread > .cv-item.ghost .cv-bead-ic {
  background: var(--card-bg); box-shadow: none;
  outline: 1.5px dashed color-mix(in srgb, var(--text-muted) 42%, transparent);
  outline-offset: -1.5px;
  border: 0; opacity: 1;
}
body.surface-daylight :is(#calendar-view, #home-view) .cv-thread .cv-item.ghost .cv-name,
body.surface-daylight :is(#calendar-view, #home-view) .cv-thread .cv-item.ghost .cv-range { opacity: 1; }
body.surface-daylight :is(#calendar-view, #home-view) .cv-thread .cv-item.ghost .cv-name { color: var(--text-muted); }

/* ---- A free stretch: the spine goes dashed, and the gap is a place to add. */
body.surface-daylight :is(#calendar-view, #home-view) .cv-thread > .cv-gaprow { grid-template-rows: minmax(44px, auto); }
body.surface-daylight :is(#calendar-view, #home-view) .cv-thread > .cv-gaprow > .cv-rail::before {
  width: 0; background: none;
  border-left: 2px dashed var(--border);
}
body.surface-daylight :is(#calendar-view, #home-view) .cv-thread .cv-thin { display: none; }
body.surface-daylight :is(#calendar-view, #home-view) .cv-thread > .cv-gaprow > .cv-info.cv-gapinfo {
  grid-column: 3 / 5; grid-row: 1;
  height: auto; margin: 0 0 0 8px; padding: 0 0 0 14px;
  display: flex; align-items: center;
  background: none; box-shadow: none;
}
body.surface-daylight :is(#calendar-view, #home-view) .cv-thread .cv-gap-add {
  display: inline-flex; align-items: center; gap: 10px;
  height: 30px; margin-left: -8px; padding: 0 8px;
  border-radius: 8px;
}
body.surface-daylight :is(#calendar-view, #home-view) .cv-thread .cv-gap-add:hover { background: var(--dl-hover); }
body.surface-daylight :is(#calendar-view, #home-view) .cv-thread .cv-gap-label {
  font-size: 13px; line-height: 18px; font-style: italic;
  color: var(--text-muted); font-variant-numeric: tabular-nums;
}
body.surface-daylight :is(#calendar-view, #home-view) .cv-thread .cv-gap-add:hover .cv-gap-label { color: var(--text-muted); }
body.surface-daylight :is(#calendar-view, #home-view) .cv-thread .cv-gap-put {
  font-size: 13px; line-height: 18px; font-weight: 500;
  color: var(--accent); opacity: 1;
  text-transform: capitalize;
}

/* ---- Now: a quiet red line with the time in the gutter. */
body.surface-daylight :is(#calendar-view, #home-view) .cv-thread > .cv-nowrow { grid-template-rows: 28px; }
body.surface-daylight :is(#calendar-view, #home-view) .cv-thread > .cv-nowrow > .cv-gut {
  align-self: stretch;
  display: flex; align-items: center; justify-content: flex-end;
  padding: 0 12px 0 0;
}
body.surface-daylight :is(#calendar-view, #home-view) .cv-thread .cv-gut-t.now {
  font-size: 12px; line-height: 16px; font-weight: 600;
  color: var(--danger);
}
body.surface-daylight :is(#calendar-view, #home-view) .cv-thread .cv-nowdot {
  position: absolute; left: 15px; top: 9px;
  width: 10px; height: 10px; margin: 0;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 0 3px var(--card-bg);
  z-index: 1;
}
body.surface-daylight :is(#calendar-view, #home-view) .cv-thread > .cv-nowrow > .cv-info {
  grid-column: 3 / 5; grid-row: 1;
  margin: 0 0 0 -20px; padding: 0;
  display: flex; align-items: center;
  background: none; box-shadow: none;
}
body.surface-daylight :is(#calendar-view, #home-view) .cv-thread .cv-nowline {
  flex: 1; height: 1px; margin: 0;
  background: var(--danger); opacity: 1;
}

/* ---- Things with no time: the same card, with the icon inside it. */
body.surface-daylight :is(#calendar-view, #home-view) .cv-loose {
  display: grid; grid-template-columns: 32px minmax(0, 1fr) 22px;
  align-items: center; gap: 12px;
  padding: 10px 12px 10px 10px;
  border-radius: 14px;
  background: var(--card-bg);
  box-shadow: inset 0 0 0 1px var(--border);
  opacity: 1;
}
body.surface-daylight :is(#calendar-view, #home-view) .cv-loose:hover { background: var(--card-bg); }
body.surface-daylight :is(#calendar-view, #home-view) .cv-loose-ic {
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--cal-fill); color: var(--cal-strong);
}
body.surface-daylight :is(#calendar-view, #home-view) .cv-loose .cv-info { padding: 0; min-width: 0; }
body.surface-daylight :is(#calendar-view, #home-view) .cv-loose .cv-name {
  margin: 0;
  font-size: 15px; line-height: 20px; font-weight: 500;
  color: var(--text-heading);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
body.surface-daylight :is(#calendar-view, #home-view) .cv-loose .cv-meta {
  display: flex; align-items: center; gap: 4px; margin: 1px 0 0;
  font-size: 13px; line-height: 18px; color: var(--text-muted);
  white-space: nowrap; overflow: hidden;
}
body.surface-daylight :is(#calendar-view, #home-view) .cv-loose.done { opacity: 1; background: var(--cal-fill); box-shadow: none; }
body.surface-daylight :is(#calendar-view, #home-view) .cv-loose.done .cv-name {
  color: var(--text-muted); text-decoration: line-through;
  text-decoration-color: color-mix(in srgb, var(--text-muted) 60%, transparent);
}
body.surface-daylight :is(#calendar-view, #home-view) .cv-loose.ghost {
  opacity: 1; background: transparent; box-shadow: none;
  border: 0;
  outline: 1.5px dashed color-mix(in srgb, var(--text-muted) 42%, transparent);
  outline-offset: -1.5px;
}
body.surface-daylight :is(#calendar-view, #home-view) .cv-loose.ghost .cv-name { color: var(--text-muted); }

/* ================================================================
   The Calendar page
   ================================================================ */

/* ---- The header: where you are on the left; stepping, Today, the views
   (a segmented control) and Add on the right. ---- */
body.surface-daylight #calendar-view .cv-head {
  gap: 8px; padding: 18px 28px 14px 32px;
  border-bottom: 0;
}
body.surface-daylight #calendar-view .cv-title {
  order: -1; flex: 1 1 auto; min-width: 0;
  margin: 0 16px 0 0;
  font-family: var(--font-ui);
  font-size: 30px; line-height: 1.1; font-weight: 600; letter-spacing: -0.02em;
  color: var(--text-heading);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}
body.surface-daylight #calendar-view .cv-nav { order: 1; gap: 2px; margin-right: 4px; }
body.surface-daylight #calendar-view .cv-shapes { order: 2; }
body.surface-daylight #calendar-view .cv-modes { order: 3; }
body.surface-daylight #calendar-view .cv-addbtn { order: 4; }

body.surface-daylight #calendar-view .cv-step {
  width: 32px; height: 32px; padding: 0;
  border: 0; border-radius: 8px;
  background: transparent; color: var(--text-muted);
  font-size: 0; line-height: 0;
  display: inline-grid; place-items: center;
}
body.surface-daylight #calendar-view .cv-step::before {
  content: ''; width: 18px; height: 18px;
  background: currentColor;
  -webkit-mask: var(--cal-ic-prev) center / contain no-repeat;
  mask: var(--cal-ic-prev) center / contain no-repeat;
}
body.surface-daylight #calendar-view .cv-nav > .cv-step:nth-child(2)::before {
  -webkit-mask-image: var(--cal-ic-next);
  mask-image: var(--cal-ic-next);
}
body.surface-daylight #calendar-view .cv-step:hover { background: var(--dl-hover); color: var(--text-heading); }

/* Today: the kit's secondary button. */
body.surface-daylight #calendar-view .cv-today {
  height: 36px; margin-left: 6px; padding: 0 14px;
  border: 0; border-radius: 10px;
  background: var(--card-bg); color: var(--text-heading);
  box-shadow: inset 0 0 0 1px var(--border);
  font-size: 14px; font-weight: 500; white-space: nowrap;
}
body.surface-daylight #calendar-view .cv-today:hover { background: var(--dl-hover); color: var(--text-heading); }

/* Day | Week | Month, and the week's Thread | Grid: segmented controls. */
body.surface-daylight #calendar-view :is(.cv-modes, .cv-shapes) {
  display: inline-flex; gap: 2px; padding: 3px;
  border-radius: 10px; background: var(--cal-seg);
}
body.surface-daylight #calendar-view :is(.cv-mode, .cv-shape) {
  height: 30px; padding: 0 12px;
  border: 0; border-radius: 8px;
  background: transparent; color: var(--text-muted);
  font-size: 13px; font-weight: 500; white-space: nowrap;
  box-shadow: none;
}
body.surface-daylight #calendar-view :is(.cv-mode, .cv-shape):hover { background: transparent; color: var(--text-heading); }
body.surface-daylight #calendar-view :is(.cv-mode, .cv-shape).on {
  background: var(--cal-seg-on); color: var(--text-heading);
  box-shadow: 0 1px 2px rgba(31, 28, 24, 0.12);
}
body.surface-daylight:not(.theme-light) #calendar-view :is(.cv-mode, .cv-shape).on { box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4); }

/* Add: the kit's primary button — ink, with its word beside the plus. */
body.surface-daylight #calendar-view .cv-addbtn {
  width: auto; height: 36px; margin-left: 4px; padding: 0 14px 0 12px;
  border: 0; border-radius: 10px;
  background: var(--cal-primary); color: var(--cal-on-primary);
  font-size: 0; line-height: 0;
  display: inline-flex; align-items: center; gap: 6px;
}
body.surface-daylight #calendar-view .cv-addbtn::before {
  content: ''; width: 16px; height: 16px;
  background: currentColor;
  -webkit-mask: var(--cal-ic-plus) center / contain no-repeat;
  mask: var(--cal-ic-plus) center / contain no-repeat;
}
body.surface-daylight #calendar-view .cv-addbtn::after {
  content: 'Add';
  font-size: 14px; line-height: 20px; font-weight: 500;
}
body.surface-daylight #calendar-view .cv-addbtn:hover {
  background: color-mix(in srgb, var(--cal-primary) 88%, var(--card-bg));
  color: var(--cal-on-primary);
}

/* ---- Day: the day's thread, with the things that have no time beside it.
   The thread leads, as it does on Today; the pile of untimed things sits on
   the right as a tray. Stacked on a narrow window, the pile comes first. ---- */
body.surface-daylight #calendar-view .cv-day { padding: 6px 32px 120px; container-type: inline-size; }
body.surface-daylight #calendar-view .cv-day-sum {
  gap: 10px; margin: 0 0 16px; padding: 0;
}
body.surface-daylight #calendar-view .cv-sum-n {
  font-size: 15px; line-height: 20px; font-weight: 600; color: var(--text-heading);
}
body.surface-daylight #calendar-view .cv-sum-free {
  font-size: 13px; line-height: 18px; color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
body.surface-daylight #calendar-view .cv-cols {
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 28px; max-width: 1080px;
}
body.surface-daylight #calendar-view .cv-col-thread { grid-column: 1; grid-row: 1; min-width: 0; }
body.surface-daylight #calendar-view .cv-col-loose {
  grid-column: 2; grid-row: 1;
  gap: 8px; padding: 16px;
  border-radius: 20px;
  background: var(--bg-secondary);
  top: 0;
}
@container (max-width: 760px) {
  body.surface-daylight #calendar-view .cv-cols { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  body.surface-daylight #calendar-view .cv-col-loose { grid-column: 1; grid-row: 1; position: static; }
  body.surface-daylight #calendar-view .cv-col-thread { grid-row: 2; }
}
body.surface-daylight #calendar-view .cv-tray-head {
  margin: 0 0 4px; padding: 0 4px;
  font-family: var(--font-ui);
  font-size: 13px; line-height: 18px; font-weight: 500;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
body.surface-daylight #calendar-view .cv-loose-empty {
  padding: 2px 4px 4px;
  font-size: 13px; line-height: 18px; color: var(--text-muted);
}
body.surface-daylight #calendar-view .cv-add {
  display: flex; align-items: center; gap: 8px;
  margin-top: 2px; padding: 0 10px; height: 36px;
  border: 0; border-radius: 10px;
  background: transparent; color: var(--accent);
  font-size: 14px; font-weight: 500; text-align: left;
  white-space: pre;
}
body.surface-daylight #calendar-view .cv-add:hover {
  background: var(--dl-hover); color: var(--accent);
}

/* Nothing on the day: said once, quietly, where the thread would be. */
body.surface-daylight #calendar-view .cv-empty {
  display: flex; align-items: center; gap: 12px;
  margin: 0; padding: 18px 20px;
  border-radius: 14px;
  background: var(--bg-secondary);
  font-size: 14px; line-height: 20px; color: var(--text-muted);
  text-wrap: pretty;
}
body.surface-daylight #calendar-view .cv-empty::before {
  content: ''; flex: none; width: 20px; height: 20px;
  background: var(--text-muted);
  -webkit-mask: var(--cal-ic-cal) center / contain no-repeat;
  mask: var(--cal-ic-cal) center / contain no-repeat;
}

/* ---- Week, as the same thread: seven days of the Day view, one under
   another, each with its own head. ---- */
body.surface-daylight #calendar-view .cv-weekthread {
  padding: 2px 32px 120px;
  max-width: 820px;
}
body.surface-daylight #calendar-view .cv-wtday {
  margin: 0; padding: 0 0 22px;
}
body.surface-daylight #calendar-view .cv-wtday + .cv-wtday {
  padding-top: 4px;
  border-top: 1px solid var(--border);
}
body.surface-daylight #calendar-view .cv-wthead {
  display: flex; align-items: center; gap: 10px;
  width: 100%; margin: 0 0 8px; padding: 14px 4px 6px;
  border: 0; border-radius: 0;
  text-align: left;
}
body.surface-daylight #calendar-view .cv-wthead-w {
  font-size: 17px; line-height: 24px; font-weight: 600;
  color: var(--text-heading);
}
body.surface-daylight #calendar-view .cv-wthead:hover .cv-wthead-w { color: var(--accent); }
body.surface-daylight #calendar-view .cv-wthead-n {
  min-width: 28px; height: 28px; padding: 0 4px;
  display: inline-grid; place-items: center;
  border-radius: 999px;
  font-size: 15px; line-height: 1; font-weight: 500;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
body.surface-daylight #calendar-view .cv-wtday.today .cv-wthead-w { color: var(--text-heading); }
body.surface-daylight #calendar-view .cv-wtday.today .cv-wthead-n {
  background: var(--accent); color: #FFFFFF;
  font-size: 14px; font-weight: 600; padding: 0 4px;
}
body.surface-daylight:not(.theme-light) #calendar-view .cv-wtday.today .cv-wthead-n { color: #161514; }
body.surface-daylight #calendar-view .cv-wthead-c {
  margin-left: auto;
  font-size: 13px; line-height: 18px; color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
body.surface-daylight #calendar-view .cv-wtday > .cv-tray {
  display: flex; flex-direction: column; gap: 8px;
  margin: 0 0 12px 116px;
}
body.surface-daylight #calendar-view .cv-wtempty {
  padding: 0 0 4px 116px;
  font-size: 13px; line-height: 18px; color: var(--text-muted);
}

/* ---- Week, as the hour grid ---- */
body.surface-daylight #calendar-view .cv-week { padding: 0 20px 0 8px; }
body.surface-daylight #calendar-view :is(.cv-week-heads, .cv-allday, .cv-week-grid) { grid-template-columns: 56px repeat(7, minmax(0, 1fr)); }
body.surface-daylight #calendar-view .cv-week-heads { border-bottom: 1px solid var(--border); }
body.surface-daylight #calendar-view .cv-dayhead {
  gap: 4px; padding: 6px 4px 10px;
  border: 0; border-radius: 10px;
}
body.surface-daylight #calendar-view .cv-dayhead:hover { background: var(--dl-hover); }
body.surface-daylight #calendar-view .cv-dayhead-w {
  font-family: var(--font-ui);
  font-size: 12px; line-height: 16px; font-weight: 500;
  color: var(--text-muted);
}
body.surface-daylight #calendar-view .cv-dayhead-n {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 50%;
  font-size: 16px; line-height: 1; font-weight: 500;
  color: var(--text-heading);
  font-variant-numeric: tabular-nums;
}
body.surface-daylight #calendar-view .cv-dayhead.today .cv-dayhead-w { color: var(--text-heading); }
body.surface-daylight #calendar-view .cv-dayhead.today .cv-dayhead-n {
  width: 30px; height: 30px;
  background: var(--accent); color: #FFFFFF;
  font-size: 15px; font-weight: 600;
}
body.surface-daylight:not(.theme-light) #calendar-view .cv-dayhead.today .cv-dayhead-n { color: #161514; }
body.surface-daylight #calendar-view .cv-allday { border-bottom: 1px solid var(--border); min-height: 34px; }
body.surface-daylight #calendar-view .cv-allday-cell {
  gap: 3px; padding: 4px;
  border-left: 1px solid var(--border);
}
body.surface-daylight #calendar-view .cv-gutter-head {
  font-family: var(--font-ui);
  font-size: 12px; line-height: 16px; font-weight: 500;
  color: var(--text-muted);
  padding: 8px 8px 0 0; text-align: right;
}
body.surface-daylight #calendar-view .cv-week-grid { min-height: 1008px; }
body.surface-daylight #calendar-view .cv-hour-label {
  font-family: var(--font-ui);
  font-size: 12px; line-height: 16px; font-weight: 500;
  color: var(--text-muted);
  padding-right: 10px; transform: translateY(-8px);
  font-variant-numeric: tabular-nums;
}
body.surface-daylight #calendar-view .cv-gutter > .cv-hour-label:first-child { visibility: hidden; }
body.surface-daylight #calendar-view .cv-daycol { border-left: 1px solid var(--border); }
body.surface-daylight #calendar-view .cv-daycol.today { background: color-mix(in srgb, var(--accent) 4%, transparent); }
body.surface-daylight #calendar-view .cv-hour { border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent); }

/* A block: the soft fill with ink on it and a bar of its strong colour. */
body.surface-daylight #calendar-view .cv-block {
  display: flex; flex-direction: column; gap: 1px;
  padding: 4px 6px 4px 9px;
  border: 0; border-radius: 8px;
  background: var(--cal-fill);
  box-shadow: inset 3px 0 0 var(--cal-strong), 0 0 0 1px var(--card-bg);
  font-size: 12px; line-height: 16px;
  color: var(--text-heading);
  opacity: 1;
}
body.surface-daylight #calendar-view .cv-block:hover { box-shadow: inset 3px 0 0 var(--cal-strong), 0 0 0 1px var(--card-bg), 0 2px 8px rgba(31, 28, 24, 0.12); }
body.surface-daylight #calendar-view .cv-block-t {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 11px; line-height: 14px; font-weight: 500;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
body.surface-daylight #calendar-view .cv-block-n {
  font-weight: 500; color: var(--text-heading);
  overflow: hidden; overflow-wrap: anywhere;
}
body.surface-daylight #calendar-view .cv-block.done { opacity: 1; text-decoration: none; }
body.surface-daylight #calendar-view .cv-block.done .cv-block-n {
  color: var(--text-muted); text-decoration: line-through;
}
body.surface-daylight #calendar-view .cv-block.ghost {
  background: var(--card-bg);
  box-shadow: none;
  outline: 1.5px dashed color-mix(in srgb, var(--text-muted) 42%, transparent);
  outline-offset: -1.5px;
  border: 0; opacity: 1;
}
body.surface-daylight #calendar-view .cv-block.ghost .cv-block-n { color: var(--text-muted); }
body.surface-daylight #calendar-view .cv-weeknow {
  height: 2px; margin-top: -1px;
  background: var(--danger);
}
body.surface-daylight #calendar-view .cv-weeknow::before {
  content: ''; position: absolute; left: -5px; top: -4px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--danger);
}

/* ---- Month: today ringed, things as soft chips ---- */
body.surface-daylight #calendar-view .cv-month { padding: 0 20px 16px; }
body.surface-daylight #calendar-view .cv-month-heads { border-bottom: 1px solid var(--border); }
body.surface-daylight #calendar-view .cv-month-head {
  font-family: var(--font-ui);
  font-size: 12px; line-height: 16px; font-weight: 500;
  color: var(--text-muted);
  padding: 8px 10px; text-align: left;
}
body.surface-daylight #calendar-view .cv-cell {
  gap: 3px; padding: 6px;
  border-left: 0; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
  min-height: 104px;
}
body.surface-daylight #calendar-view .cv-month-grid > .cv-cell:nth-child(7n) { border-right: 0; }
body.surface-daylight #calendar-view .cv-cell.out { background: transparent; }
body.surface-daylight #calendar-view .cv-cell-n {
  min-width: 26px; height: 26px; margin: 0 0 2px; padding: 0 5px;
  display: inline-grid; place-items: center;
  border-radius: 999px;
  font-size: 13px; line-height: 1; font-weight: 500;
  color: var(--text-heading);
  font-variant-numeric: tabular-nums;
}
body.surface-daylight #calendar-view .cv-cell-n:hover { background: var(--dl-hover); }
body.surface-daylight #calendar-view .cv-cell.out .cv-cell-n { color: var(--text-muted); font-weight: 500; }
body.surface-daylight #calendar-view .cv-cell.today .cv-cell-n {
  background: transparent;
  box-shadow: inset 0 0 0 1.5px var(--accent);
  color: var(--accent); font-weight: 600;
}
body.surface-daylight #calendar-view .cv-cell.today .cv-cell-n:hover { background: var(--dl-select); }

/* A chip: the area-chip recipe — soft fill, ink words, a dot of its colour. */
body.surface-daylight #calendar-view .cv-chip {
  display: flex; align-items: center; gap: 6px;
  width: 100%; min-width: 0; height: 22px; padding: 0 8px;
  border: 0; border-radius: 999px;
  background: var(--cal-fill);
  color: var(--text-heading);
  font-size: 12px; line-height: 16px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-align: left; opacity: 1;
}
body.surface-daylight #calendar-view .cv-chip::before {
  content: ''; flex: none; width: 6px; height: 6px; border-radius: 50%;
  background: var(--cal-strong);
}
body.surface-daylight #calendar-view .cv-chip:hover { background: color-mix(in srgb, var(--cal-fill) 80%, var(--text-heading) 6%); }
body.surface-daylight #calendar-view .cv-chip.done {
  opacity: 1; color: var(--text-muted);
  text-decoration: line-through;
  text-decoration-color: color-mix(in srgb, var(--text-muted) 60%, transparent);
}
body.surface-daylight #calendar-view .cv-chip.ghost {
  background: transparent;
  outline: 1.5px dashed color-mix(in srgb, var(--text-muted) 42%, transparent);
  outline-offset: -1.5px;
  border: 0; opacity: 1;
  color: var(--text-muted);
}
body.surface-daylight #calendar-view .cv-more {
  align-self: flex-start;
  height: 20px; padding: 0 8px;
  border-radius: 999px;
  font-size: 12px; line-height: 20px; font-weight: 500;
  color: var(--text-muted);
}
body.surface-daylight #calendar-view .cv-more:hover { background: var(--dl-hover); color: var(--text-heading); }


/* ---- The notes of a meeting, beside the day (calendar-view.js). Daylight puts
   them on tiles like everything else, and the picked bead gets the accent ring
   the rest of the look uses for "this one". ---- */
body.surface-daylight .cv-notes-k {
  text-transform: none; letter-spacing: 0; font-size: 12px; color: var(--text-muted);
}
body.surface-daylight .cv-notes-for { font-size: 13px; }
/* THE COLUMN'S PLACE. Daylight puts the thread on the left and the loose pile on
   the right by explicit grid position, so a third child needs one too. The notes
   take the top of the right column and the pile drops below them: the page keeps
   its two columns and its thread keeps its width. */
body.surface-daylight #calendar-view .cv-cols.with-notes { grid-template-columns: minmax(0, 1fr) 320px; max-width: 1180px; }
body.surface-daylight #calendar-view .cv-cols.with-notes .cv-col-thread { grid-column: 1; grid-row: 1 / span 2; }
body.surface-daylight #calendar-view .cv-cols.with-notes .cv-col-notes {
  grid-column: 2; grid-row: 1; position: static;
  gap: 8px; padding: 16px; border-radius: 20px; background: var(--bg-secondary);
}
body.surface-daylight #calendar-view .cv-cols.with-notes .cv-col-loose { grid-column: 2; grid-row: 2; position: static; }
@container (max-width: 760px) {
  body.surface-daylight #calendar-view .cv-cols.with-notes { grid-template-columns: minmax(0, 1fr); }
  body.surface-daylight #calendar-view .cv-cols.with-notes .cv-col-thread { grid-column: 1; grid-row: 3; }
  body.surface-daylight #calendar-view .cv-cols.with-notes .cv-col-notes { grid-column: 1; grid-row: 1; }
  body.surface-daylight #calendar-view .cv-cols.with-notes .cv-col-loose { grid-column: 1; grid-row: 2; }
}
body.surface-daylight .cv-notes-head { padding: 2px 4px 6px; }
body.surface-daylight .cv-notes-row {
  background: var(--card-bg); border: 0; box-shadow: inset 0 0 0 1px var(--border);
  border-radius: 14px; padding: 10px 12px;
}
body.surface-daylight .cv-notes-row:hover { box-shadow: inset 0 0 0 1px var(--accent); }
body.surface-daylight .cv-notes-attach {
  border-radius: 12px; border-style: dashed; color: var(--text-muted);
}
body.surface-daylight .cv-notes-attach:hover { background: var(--dl-hover); color: var(--text-heading); }
/* The picked meeting keeps its mark: the card outlined in the accent, its bead
   ringed. (The base look rings the bead itself; here the bead draws nothing, so
   the ring goes on the round icon that stands in for it.) */
body.surface-daylight :is(#calendar-view, #home-view) .cv-thread > .cv-item.picked:is(.cv-task, .cv-event) > .cv-info {
  box-shadow: inset 0 0 0 2px var(--accent);
}
body.surface-daylight :is(#calendar-view, #home-view) .cv-thread .cv-item.picked .cv-bead { box-shadow: none; }
body.surface-daylight :is(#calendar-view, #home-view) .cv-thread .cv-item.picked .cv-bead-ic { box-shadow: inset 0 0 0 2px var(--accent); }
