:root {
  color-scheme: light;

  /* fonts — from Tea's design system (Onest + Geist Mono) */
  --type-sans: 'Onest', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --type-mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Tea's Figma "system" variables */
  --c-page: #F4F3F1;   /* Background 1 */
  --c-bg2:  #E6E5E3;   /* Background 2 */
  --c-ink:  #242425;   /* Text 1 */
  --c-ink2: #BBB8B3;   /* Text 2 */

  /* app tokens, mapped onto the system palette */
  --bg: var(--c-page);
  --panel: #ffffff;            /* clean white card on the warm page */
  --panel-2: #edece9;          /* subtle fill: buttons, inputs, steppers */
  --line: #e2e1de;             /* borders */
  --line-hover: #d0cfca;
  --text: var(--c-ink);
  --muted: #8a8a86;            /* readable secondary text */
  --faint: var(--c-ink2);     /* Text 2 — de-emphasised labels */
  /* selection/focus idiom in this system is neutral ink, not a hue */
  --accent: var(--c-ink);
  --accent-ink: var(--c-ink);
  --accent-2: #b23b3b;        /* restrained warm red — danger + brand dot only */
  --today: var(--c-ink);      /* today marker = ink dot, page-colour number */
  --grid: #e8e6e2;            /* calendar grid lines (softer than --line) */
  --othermonth: #edece9;      /* days outside the current month */
  --topbar: rgba(244, 243, 241, .82);
  --radius: 12px;
  --shadow: 0 6px 24px rgba(20, 16, 40, .10);

  /* category colours (mirror backend config.CATEGORIES) — kept vivid for scannability */
  --cat-screening: #d98c00;
  --cat-concert: #e5484d;
  --cat-theatre: #9b51e0;
  --cat-talk: #1f9d57;
  --cat-travel: #3b6fd4;
  --cat-other: #6c6678;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; }
body {
  margin: 0;
  font: 400 15px/1.5 var(--type-sans);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}

/* ---------- top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 20px;
  background: var(--topbar);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; letter-spacing: .14em; font-size: 18px; white-space: nowrap; }
.brand .dot { color: var(--accent-2); }

.nav { display: flex; align-items: center; gap: 12px; }
.period { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: .01em; min-width: 220px; }
.stepper { display: flex; gap: 2px; }
.step {
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line); width: 32px; height: 32px;
  font-size: 18px; line-height: 1; cursor: pointer; border-radius: 8px;
  transition: border-color .12s, background .12s;
}
.step:first-child { border-radius: 8px 0 0 8px; }
.step:last-child { border-radius: 0 8px 8px 0; }
.step:hover { border-color: var(--accent); }

/* ---------- buttons ---------- */
.btn {
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 14px; font-size: 13px; cursor: pointer;
  transition: border-color .15s, background .15s, transform .05s;
}
.btn:hover { border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn.small { padding: 7px 12px; }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); }
.btn.primary { background: var(--c-ink); border-color: var(--c-ink); color: var(--c-page); font-weight: 600; }
.btn.primary:hover { background: #3a3a3b; border-color: #3a3a3b; }
.btn.danger { color: var(--accent-2); }
.btn.danger:hover { border-color: var(--accent-2); color: var(--accent-2); }
.newBtn, #newBtn { margin-left: auto; }

/* ---------- view tabs ---------- */
.viewtabs {
  display: flex; gap: 4px; background: var(--c-bg2);
  border: 1px solid var(--line); border-radius: 999px; padding: 3px;
}
.tab {
  background: transparent; border: none; color: var(--faint);
  padding: 5px 16px; border-radius: 999px; font-size: 13px; cursor: pointer;
  transition: all .12s; font-family: inherit;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--panel); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(20, 16, 40, .07); }

/* ---------- category filter bar ---------- */
.catbar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px; border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.filter-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted);
}
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--panel); border: 1px solid var(--line); color: var(--muted);
  border-radius: 999px; padding: 4px 12px; font-size: 13px; cursor: pointer;
  user-select: none; transition: all .12s;
}
.chip .swatch { width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--muted)); flex: none; }
.chip:hover { border-color: var(--line-hover); color: var(--text); }
.chip.off { opacity: .4; }
.chip.off .swatch { background: var(--muted); }
.cal-edit-btn {
  margin-left: auto; background: transparent; border: 1px solid var(--line);
  color: var(--muted); border-radius: 8px; padding: 5px 12px; font-size: 12px; cursor: pointer;
}
.cal-edit-btn:hover { border-color: var(--accent); color: var(--text); }

/* calendars editor rows */
.cal-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }
.cal-row { display: flex; align-items: center; gap: 10px; }
.cal-row .cal-color {
  width: 34px; height: 34px; padding: 0; border: 1px solid var(--line);
  border-radius: 8px; background: var(--panel-2); cursor: pointer; flex: none;
}
.cal-row .cal-color::-webkit-color-swatch-wrapper { padding: 3px; }
.cal-row .cal-color::-webkit-color-swatch { border: none; border-radius: 5px; }
.cal-row .cal-name {
  flex: 1; background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 9px 11px; font-size: 14px; font-family: inherit;
}
.cal-row .cal-name:focus { outline: none; border-color: var(--accent); }
.feed-chip {
  border-style: dashed; color: var(--accent-ink); font-weight: 600;
  margin-left: 4px;
}
.feed-chip.off { color: var(--muted); }

/* ---------- stage / calendar shell ---------- */
.stage { flex: 1; min-height: 0; padding: 16px 20px 20px; }
.calendar {
  height: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ===================== MONTH VIEW ===================== */
.month-grid { display: flex; flex-direction: column; height: 100%; }
.weekday-row {
  display: grid; grid-template-columns: repeat(7, 1fr);
  border-bottom: 1px solid var(--line);
}
.weekday {
  padding: 8px 10px; font-size: 11px; text-transform: uppercase; letter-spacing: .1em;
  color: var(--muted); text-align: right;
}
.weeks { flex: 1; display: grid; grid-auto-rows: 1fr; min-height: 0; }
.week {
  display: grid; grid-template-columns: repeat(7, 1fr);
  border-bottom: 1px solid var(--grid);
}
.week:last-child { border-bottom: none; }
.daycell {
  border-right: 1px solid var(--grid);
  padding: 4px 6px 6px;
  min-height: 0; overflow: hidden;
  display: flex; flex-direction: column; gap: 3px;
  cursor: pointer;
}
.daycell:last-child { border-right: none; }
.daycell.other { background: var(--othermonth); }
.daycell.other .daynum { color: var(--muted); opacity: .6; }
.daycell:hover { background: var(--panel-2); }
.daynum {
  align-self: flex-end;
  font-size: 13px; font-weight: 600; color: var(--text);
  width: 24px; height: 24px; display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
}
.daycell.today .daynum { background: var(--today); color: #fff; }
.pill {
  display: flex; align-items: center; gap: 5px;
  font-size: 12px; padding: 2px 7px; border-radius: 6px;
  background: color-mix(in srgb, var(--c) 20%, transparent);
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: pointer; border: 1px solid transparent;
}
.pill:hover { box-shadow: inset 0 0 0 200px rgba(0, 0, 0, .06); }
.pill .dot-s { width: 7px; height: 7px; border-radius: 50%; background: var(--c); flex: none; }
.pill .ptime { color: var(--muted); font-variant-numeric: tabular-nums; }
.pill.allday { background: var(--c); color: #12100a; font-weight: 600; }
.pill.allday .dot-s { display: none; }
/* CINEMA · interested — solid fill, no edges. Prominence via fill strength. */
.pill.feed.interested { background: color-mix(in srgb, var(--c) 20%, transparent); }
.pill.feed.interested .ptitle { color: var(--text); }
/* repeated all month → recede (fainter fill) */
.pill.feed.interested.repeated { background: color-mix(in srgb, var(--c) 12%, transparent); opacity: .8; }
.pill.feed.interested.repeated .ptitle { color: var(--muted); }
/* rare / one-off → stronger fill so it stands out */
.pill.feed.interested.singular { background: color-mix(in srgb, var(--c) 42%, transparent); }
.pill.feed.interested.singular .ptitle { color: var(--text); font-weight: 600; }
/* CINEMA · attending — full solid fill ("going") */
.pill.attending {
  background: var(--c);
  color: #12100a;
}
.pill.attending .dot-s { display: none; }
.pill.attending .ptime { color: rgba(0, 0, 0, .55); }
.pill.attending .ptitle { color: #12100a; font-weight: 600; }
.pill.attending.allday { background: var(--c); color: #12100a; font-weight: 600; }
.more-link { font-size: 11px; color: var(--muted); padding: 1px 6px; cursor: pointer; }
.more-link:hover { color: var(--accent-ink); }

/* ===================== TIME GRID (week / day) ===================== */
.timegrid { display: flex; flex-direction: column; height: 100%; min-height: 0; }
/* one thick top band: day headings + all-day area, no text selection so
   dragging a multi-day event never selects the date text */
.tg-band {
  display: grid; border-bottom: 1px solid var(--line);
  user-select: none; -webkit-user-select: none;
  /* grid-template-columns set inline (gutter + N day cols) */
}
.tg-bandcorner {
  border-right: 1px solid var(--grid); position: relative;
}
.tg-bandcorner span {
  position: absolute; bottom: 5px; right: 6px;
  font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em;
}
.tg-daycol { border-right: 1px solid var(--grid); display: flex; flex-direction: column; }
.tg-daycol:last-child { border-right: none; }
.tg-dayhead {
  text-align: center; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  box-sizing: border-box;
}
.tg-dayhead .dh-name { text-transform: uppercase; letter-spacing: .08em; font-size: 11px; }
.tg-dayhead .dh-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 50%;
  font-size: 17px; font-weight: 600; color: var(--text);
}
.tg-daycol.today .dh-num { background: var(--today); color: var(--c-page); }
.tg-daycol.today .dh-name { color: var(--text); }
.tg-daycol.today { background: color-mix(in srgb, var(--today) 5%, transparent); }

.tg-scroll { flex: 1; overflow-y: auto; min-height: 0; }
.tg-body {
  display: grid;
  position: relative;   /* positioning context for the drag ghost */
  /* grid-template-columns + height set inline */
}
.hour-gutter { border-right: 1px solid var(--grid); }
.hour-label {
  border-bottom: 1px solid var(--grid);
  font-size: 11px; color: var(--muted); text-align: right;
  padding: 0 6px 0 0; position: relative;
}
.hour-label span { position: absolute; top: -7px; right: 6px; }
.day-col {
  border-right: 1px solid var(--grid); position: relative;
  background-image: repeating-linear-gradient(
    to bottom, transparent 0, transparent 51px, var(--grid) 51px, var(--grid) 52px);
}
.day-col:last-child { border-right: none; }
.day-col.today {
  background-color: color-mix(in srgb, var(--today) 6%, transparent);
}

.tg-event {
  position: absolute;
  left: 3px; right: 3px;
  border-radius: 7px;
  padding: 3px 7px;
  overflow: hidden;
  cursor: pointer;
  background: color-mix(in srgb, var(--c) 45%, var(--panel));
  font-size: 12px; line-height: 1.25;
  z-index: 2;
}
/* Hover: a uniform, edge-free lighten (white overlay clipped to the rounded box). */
.tg-event:hover { box-shadow: inset 0 0 0 200px rgba(0, 0, 0, .06); }
.tg-event .te-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tg-event .te-meta { color: var(--muted); font-size: 11px; }
/* interested — solid fill, no edges. Prominence via fill strength. */
.tg-event.feed.interested { background: color-mix(in srgb, var(--c) 22%, var(--panel)); }
.tg-event.feed.interested .te-title { color: var(--text); }
/* repeated all month → recede (fainter fill) */
.tg-event.feed.interested.repeated { background: color-mix(in srgb, var(--c) 15%, var(--panel)); opacity: .85; }
/* rare / one-off → stronger fill so it reads as a real, catchable screening */
.tg-event.feed.interested.singular { background: color-mix(in srgb, var(--c) 40%, var(--panel)); }
.tg-event.feed.interested.singular .te-title { color: var(--text); }
/* attending — full solid fill */
.tg-event.attending { background: var(--c); }
.tg-event.attending .te-title { color: #12100a; }
.tg-event.attending .te-meta { color: rgba(0, 0, 0, .6); }
/* your own cinema attendances: full Film colour, distinct from the interested tints */
.tg-event.attended { background: var(--c); }
.tg-event.attended .te-title { color: #12100a; }
.tg-event.attended .te-meta { color: rgba(0, 0, 0, .6); }
.pill.attended { background: var(--c); }
.pill.attended .dot-s { display: none; }
.pill.attended .ptime { color: rgba(0, 0, 0, .55); }
.pill.attended .ptitle { color: #12100a; font-weight: 600; }
/* --- drag & drop --- */
.tg-event[data-id]:not([data-id^="cinema:"]) { cursor: grab; }
.month-grid .pill[data-id]:not([data-id^="cinema:"]) { cursor: grab; }
body.cal-dragging { cursor: grabbing; user-select: none; }
body.cal-dragging * { cursor: grabbing !important; }
body.cal-resizing, body.cal-resizing * { cursor: ns-resize !important; user-select: none; }
/* top/bottom resize grips on your own timed events */
.te-resize { position: absolute; left: 0; right: 0; height: 7px; cursor: ns-resize; z-index: 3; }
.te-resize.top { top: 0; }
.te-resize.bottom { bottom: 0; }
.drag-ghost {
  position: absolute; z-index: 30; left: 0; width: 100%;
  border-radius: 7px; padding: 3px 7px; overflow: hidden;
  background: color-mix(in srgb, var(--cat-screening) 34%, var(--panel));
  border: 1px solid var(--accent);
  box-shadow: var(--shadow); pointer-events: none;
  font-size: 12px; line-height: 1.25;
}
.drag-ghost .dg-title { font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drag-ghost .dg-time { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.daycell.drop-target { background: color-mix(in srgb, var(--accent) 16%, var(--panel-2)); box-shadow: inset 0 0 0 2px var(--accent); }
/* multi-day drag-to-create range band (month cells + week/day all-day cells) */
.cal-range { background: color-mix(in srgb, var(--accent) 15%, var(--panel)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent); }
.allday-cell.cal-range { border-radius: 6px; }
.pill.dragging-pill { opacity: .35; }
.now-line { position: absolute; left: 0; right: 0; height: 2px; background: var(--today); z-index: 5; }
.now-line::before {
  content: ""; position: absolute; left: -4px; top: -3px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--today);
}

/* all-day area inside each band day column (below the day heading) */
.allday-cell { padding: 3px 4px 5px; display: flex; flex-direction: column; gap: 2px; flex: 1; min-height: 22px; }

/* ===================== MODAL ===================== */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0, 0, 0, .5);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 8vh 16px; overflow-y: auto;
}
.modal {
  width: 100%; max-width: 520px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  position: relative;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid var(--line);
}
.modal-head h2 { margin: 0; font-size: 17px; }
.detail-close {
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  font-size: 13px; cursor: pointer;
}
.detail-close:hover { border-color: var(--accent); }
.modal-body { padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.field input, .field select, .field textarea {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 9px 11px; font-size: 14px; font-family: inherit;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); }
.field textarea { resize: vertical; }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }
.field.narrow { max-width: 120px; }
.field.checkbox { flex-direction: row; align-items: center; gap: 8px; }
.field.checkbox span { text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--text); }
.field.checkbox input { width: 16px; height: 16px; accent-color: var(--accent); }

.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--muted);
  border-radius: 999px; padding: 5px 12px; font-size: 13px; cursor: pointer;
}
.seg-btn .swatch { width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.seg-btn.active { border-color: var(--c); color: var(--text); background: color-mix(in srgb, var(--c) 16%, var(--panel-2)); }

.film-fields {
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px 14px;
  display: flex; flex-direction: column; gap: 12px; margin: 0;
}
.film-fields legend { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--accent-ink); padding: 0 6px; }

.modal-actions { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.modal-actions .spacer { flex: 1; }

/* CINEMA feed detail (read-only) */
.feed-modal { max-width: 440px; }
.fm-badge {
  display: inline-block; font-size: 11px; letter-spacing: .04em;
  border-radius: 999px; padding: 2px 10px; margin-bottom: 4px;
}
.fm-badge.fm-interested { color: var(--accent-ink); border: 1px dashed var(--accent-ink); }
.fm-badge.fm-attending { color: #12100a; background: var(--cat-screening); border: 1px solid var(--cat-screening); }
.fm-when { font-size: 15px; font-weight: 600; }
.fm-loc { color: var(--muted); }
.fm-sub { color: var(--muted); font-size: 13px; }
.fm-orig { font-style: italic; }
.fm-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 2px; }
.fm-tags .tag {
  font-size: 11px; padding: 1px 7px; border-radius: 6px;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--muted);
}
.d-links { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.d-link {
  font-size: 12px; padding: 5px 12px; border-radius: 8px;
  border: 1px solid var(--line); color: var(--text); text-decoration: none;
}
.d-link:hover { border-color: var(--accent); color: var(--accent-ink); }
.muted { color: var(--muted); }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .topbar { flex-wrap: wrap; gap: 10px; }
  .period { min-width: 0; font-size: 17px; }
  #newBtn { margin-left: 0; }
}

/* ===================== new UI (v2 features) ===================== */
/* topbar controls */
.period-btn {
  display: flex; align-items: center; gap: 5px; background: transparent; border: none;
  color: var(--text); cursor: pointer; padding: 2px 6px; border-radius: 8px;
}
.period-btn:hover { background: var(--panel-2); }
.period-btn .caret { color: var(--muted); font-size: 11px; }
.quick-add {
  flex: 1; min-width: 120px; max-width: 300px; margin: 0 6px;
  background: var(--panel); border: 1px solid var(--line); color: var(--text);
  border-radius: 999px; padding: 7px 14px; font-size: 13px;
}
.quick-add:focus { outline: none; border-color: var(--accent); }
.icon-btn {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px;
  width: 34px; height: 34px; font-size: 15px; cursor: pointer; color: var(--text);
}
.icon-btn:hover { border-color: var(--accent); }

/* recurring glyph on events */
.rep { opacity: .6; font-size: .85em; }
/* subscription events read-only */
.pill.sub, .tg-event.sub { cursor: default; }

/* ---- month: week numbers + spanning bars ---- */
.weekday.wn { text-align: center; }
.weeknum {
  display: flex; align-items: flex-start; justify-content: center; padding-top: 4px;
  font-size: 11px; color: var(--muted); border-right: 1px solid var(--grid);
}
.lane-spacer { flex: none; }
.span-bar {
  position: absolute; height: 17px; line-height: 17px;
  border-radius: 5px; padding: 0 7px; font-size: 11px; font-weight: 600;
  background: color-mix(in srgb, var(--c) 82%, var(--panel));
  color: #12100a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: pointer; z-index: 4;
}
.span-bar:hover { box-shadow: inset 0 0 0 200px rgba(0,0,0,.08); }

/* flexible event — a soft-edged blob placed loosely in the day (no time bounds).
   The radial fill dissolves to transparent at the rim so the edge reads as soft. */
.tg-flex {
  position: absolute; left: 5px; right: 5px; z-index: 1;
  display: flex; align-items: center; justify-content: center;
  padding: 2px 12px; cursor: grab;
  background: transparent; overflow: visible; color: var(--text);
}
/* the fill lives in a blurred layer, so the edges feather into the grid */
.tg-flex::before {
  content: ""; position: absolute; inset: 4px;
  border-radius: 18px;
  background: color-mix(in srgb, var(--c) 40%, var(--panel));
  filter: blur(6px);
  z-index: -1;
}
.tg-flex .tf-title { position: relative; font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tg-flex:hover::before { background: color-mix(in srgb, var(--c) 52%, var(--panel)); }
.tg-flex.dragging { z-index: 30; pointer-events: none; opacity: .92; }
/* month / agenda: flexible shows as a soft rounded pill, no time */
.pill.flex {
  border-radius: 999px; color: var(--text); font-weight: 600;
  background: radial-gradient(120% 150% at 50% 50%,
    color-mix(in srgb, var(--c) 34%, var(--panel)) 45%,
    color-mix(in srgb, var(--c) 7%, transparent) 100%);
}

/* multi-day drag-to-create: a stretched bar previewing the final all-day event */
.range-ghost {
  position: fixed; z-index: 40; pointer-events: none;
  border-radius: 5px; padding: 0 7px;
  display: flex; align-items: center;
  font-size: 11px; font-weight: 600; line-height: 1;
  white-space: nowrap; overflow: hidden;
  background: color-mix(in srgb, var(--c) 82%, var(--panel));
  color: #12100a;
  box-shadow: 0 1px 3px rgba(20,16,40,.18);
}

/* ---- agenda view ---- */
.agenda { height: 100%; overflow-y: auto; padding: 8px 0; }
.ag-day { display: grid; grid-template-columns: 84px 1fr; gap: 12px; padding: 10px 20px; border-bottom: 1px solid var(--grid); }
.ag-day.today { background: color-mix(in srgb, var(--today) 6%, transparent); }
.ag-date { display: flex; flex-direction: column; align-items: center; padding-top: 2px; }
.ag-date .ag-dow { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.ag-date .ag-num { font-size: 22px; font-weight: 700; }
.ag-day.today .ag-num { color: var(--today); }
.ag-date .ag-mon { font-size: 11px; color: var(--muted); }
.ag-events { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ag-row { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; cursor: pointer; }
.ag-row:hover { background: var(--panel-2); }
.ag-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.ag-time { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; min-width: 96px; }
.ag-title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-loc { color: var(--muted); font-weight: 400; }

/* ---- mini-month popover ---- */
.mini-month {
  position: fixed; z-index: 60; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow); padding: 10px; width: 240px;
}
.mm-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.mm-title { font-weight: 600; font-size: 14px; }
.mm-nav { background: transparent; border: none; color: var(--text); font-size: 16px; cursor: pointer; width: 26px; height: 26px; border-radius: 6px; }
.mm-nav:hover { background: var(--panel-2); }
.mm-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; }
.mm-wd { text-align: center; font-size: 10px; color: var(--muted); padding-bottom: 2px; }
.mm-day {
  aspect-ratio: 1; border: none; background: transparent; color: var(--text);
  font-size: 12px; cursor: pointer; border-radius: 50%;
}
.mm-day:hover { background: var(--panel-2); }
.mm-day.mm-other { color: var(--muted); opacity: .5; }
.mm-day.mm-today { color: var(--today); font-weight: 700; }
.mm-day.mm-sel { background: var(--c-ink); color: var(--c-page); font-weight: 700; }

/* ---- search ---- */
.search-input {
  flex: 1; background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 9px 12px; font-size: 15px;
}
.search-input:focus { outline: none; border-color: var(--accent); }
.search-results { max-height: 60vh; overflow-y: auto; }
.sr-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.sr-row:hover { background: var(--panel-2); }
.sr-when { color: var(--muted); font-size: 13px; min-width: 108px; font-variant-numeric: tabular-nums; }
.sr-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- settings + subscriptions ---- */
.reminder-opts { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.reminder-opts label { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--text); }
.reminder-opts input { accent-color: var(--accent); }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.subs-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.sub-row { display: flex; align-items: center; gap: 8px; }
.sub-row .swatch { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.sub-name { flex: 1; font-size: 14px; }
.sub-add { display: grid; grid-template-columns: 1fr 2fr auto auto; gap: 6px; align-items: center; }
.sub-add input[type=text], .sub-add input[type=url] {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 8px 10px; font-size: 13px; min-width: 0;
}
.sub-add input[type=color] { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 8px; padding: 0; background: var(--panel-2); }

/* choice dialog */
.choice-btns { display: flex; flex-direction: column; gap: 8px; }
.choice-btns .btn { width: 100%; }

/* colour input in editor */
#fColor { width: 34px; height: 26px; border: 1px solid var(--line); border-radius: 6px; padding: 0; background: var(--panel-2); vertical-align: middle; margin-left: 6px; }

/* ---- tasks (to-dos pinned to a day) ---- */
.pill.task { background: transparent; padding-left: 2px; gap: 5px; }
.pill.task .task-check {
  width: 13px; height: 13px; border-radius: 50%; border: 1.5px solid var(--c);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 8px; line-height: 1; color: #fff; background: transparent; flex: none; cursor: pointer;
}
.pill.task.done .task-check { background: var(--c); }
.pill.task .ptitle { color: var(--text); }
.pill.task.done .ptitle { text-decoration: line-through; color: var(--muted); }

.ag-row.task .task-check {
  width: 18px; height: 18px; border-radius: 50%; border: 1.6px solid var(--muted);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; cursor: pointer; flex: none;
}
.ag-row.task.done .ag-title { text-decoration: line-through; color: var(--muted); }
.ag-row .ag-time { }

/* ===================== design-system typography ===================== */
/* Micro-tier labels (uppercase chrome) render in Geist Mono. */
.filter-label, .weekday, .tg-dayhead .dh-name, .allday-gutter,
.field > span, .ag-dow, .ag-mon, .mm-wd, .weeknum, .fm-badge,
.film-fields legend, .sec-label {
  font-family: var(--type-mono);
}
/* Fine numbers / times — Geist Mono, tabular. */
.pill .ptime, .tg-event .te-meta, .ag-time, .sr-when, .hour-label,
.mono, .dg-time {
  font-family: var(--type-mono);
  font-variant-numeric: tabular-nums;
}
/* Larger numbers stay in Onest but lock to tabular figures. */
.daynum, .tg-dayhead .dh-num, .ag-num, .fm-when, .period {
  font-variant-numeric: tabular-nums;
}
