:root {
  color-scheme: light;
  --ink: #1c2824;
  --muted: #66716d;
  --paper: #f5f1e8;
  --surface: #fffdf8;
  --line: #d9d3c8;
  --accent: #e85d3f;
  --accent-dark: #bd4028;
  --green: #1c6b52;
  --green-soft: #deeee7;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
}

button, input, textarea { font: inherit; }

button, a { -webkit-tap-highlight-color: transparent; }

.app-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding-bottom: 80px;
}

.topbar {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand {
  color: var(--ink);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.06em;
  text-decoration: none;
}

.topbar-hint, .revision-meta {
  color: var(--muted);
  font-size: .86rem;
}

.revision-meta { display: flex; align-items: center; gap: 18px; }
.revision-meta--empty { display: none; }
.revision-meta a { color: var(--green); font-weight: 650; }

.flash {
  margin: 18px 0 0;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: .9rem;
}

.flash--notice { background: var(--green-soft); color: var(--green); }
.telegram-invite { display: inline-flex; align-items: center; min-height: 44px; color: inherit; font-weight: 650; }

.flash--alert { background: #f8ded8; color: #922d1d; }

.editor { padding-top: 12px; }

.plan-heading {
  position: relative;
  margin-bottom: 12px;
  /* Room for the save status and share action (28px) above the title. */
  padding-top: 1.75rem;
}
/* Readers have no save status or share action to make room for. */
.plan-heading:not(:has(.plan-actions)) { padding-top: .75rem; }

.plan-copy {
  min-width: 0;
  flex: 1 1 360px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.plan-title {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.2rem, 5vw, 4.2rem);
  line-height: 1;
  letter-spacing: -.045em;
}

textarea.plan-title { display: block; resize: none; overflow: hidden; overflow-wrap: anywhere; }
textarea.plan-title:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }

.plan-location-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  width: fit-content;
  max-width: 100%;
  color: var(--muted);
}

.plan-location {
  min-width: 0;
  width: auto;
  max-width: 100%;
  field-sizing: content;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--muted);
  font-size: .9rem;
}

.location-marker { flex: none; }
[data-location-display][data-location-color] {
  border-radius: 4px;
  background: color-mix(in srgb, var(--location-accent) 9%, transparent);
  box-shadow: inset 2px 0 var(--location-accent);
  color: var(--muted);
}
[data-location-display][data-location-color="1"] { --location-accent: #c8614e; }
[data-location-display][data-location-color="2"] { --location-accent: #5883b1; }
[data-location-display][data-location-color="3"] { --location-accent: #8066a5; }
[data-location-display][data-location-color="4"] { --location-accent: #a47d30; }
[data-location-display][data-location-color="5"] { --location-accent: #4e8a70; }
[data-location-display][data-location-color="6"] { --location-accent: #9a628a; }
[data-location-display][data-location-color] .location-marker { color: var(--location-accent); }
.plan-location-row[data-location-color] { width: fit-content; padding: 2px 7px; }
.plan-location-row[data-location-color] .plan-location { color: inherit; }

.plan-location-action {
  margin-top: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: .8rem;
}

.plan-location-action:hover { color: var(--green); }

/* Optional agenda settings live only inside the existing topbar Details. */
.plan-format-heading { margin: 0 0 10px; color: var(--ink); font-size: .82rem; }
.plan-format { padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.plan-format-settings { display: grid; gap: 10px; }
.plan-format-field { display: grid; gap: 5px; min-width: 0; color: var(--muted); font-size: .75rem; font-weight: 700; }
.plan-format-field select {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 500;
}
.plan-format-field select:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.plan-format-note { margin: 0; color: var(--muted); font-size: .75rem; }

.share-action, .secondary-action, .text-action, .metadata-button, .icon-button {
  border: 0;
  cursor: pointer;
}

.plan-actions {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.share-action {
  min-height: 28px;
  padding: 3px 2px;
  background: transparent;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 700;
}

.share-action:hover, .share-action:focus-visible { color: var(--green); }

.save-status {
  color: var(--muted);
  font-size: .68rem;
  opacity: .72;
  white-space: nowrap;
}

.save-status[data-state="saving"] { color: var(--green); opacity: 1; }
.save-status[data-state="error"] { color: #922d1d; opacity: 1; }

.agenda-section { padding-bottom: 42px; }

.take-switcher { margin: 0 0 8px; }
.take-strip {
  display: flex;
  gap: 6px;
  padding-bottom: 4px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.take-tab, .take-score-expand, .fork-take-action, .take-preview-title {
  border: 0;
  cursor: pointer;
  white-space: nowrap;
}

.take-pill {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  border-radius: 999px;
  position: relative;
  isolation: isolate;
}
/* Keep 44px controls, with a quieter 32px surface at normal text size. */
.take-pill::before, .take-tab::after, .take-menu-trigger::after {
  content: "";
  position: absolute;
  inset: 6px 0;
  z-index: -1;
  border-radius: inherit;
  pointer-events: none;
}
.take-pill::before {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--line) 82%, transparent);
}
.take-pill:has(.take-tab[aria-selected="true"])::before {
  background-color: var(--surface);
  box-shadow: inset 0 0 0 2px var(--green);
}
.take-pill.is-best::before { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--green) 42%, var(--line)); }
.take-pill.is-best:has(.take-tab[aria-selected="true"])::before { box-shadow: inset 0 0 0 2px var(--green); }
.take-pill:has(.take-menu) { padding-right: 3px; }

.take-tab {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 9px;
  padding: 7px 11px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: .8rem;
  font-weight: 700;
}

.take-tab.is-scored::after {
  --score-wash: color-mix(in srgb, var(--green) 8%, transparent);
  background: linear-gradient(90deg, var(--score-wash) 0 var(--take-progress), transparent var(--take-progress));
}
.take-tab.is-scored.score-mid::after { --score-wash: color-mix(in srgb, var(--accent) 9%, transparent); }
.take-tab.is-scored.score-low::after { --score-wash: color-mix(in srgb, #b54a37 8%, transparent); }
.take-tab:hover { color: var(--ink); }
.take-tab:hover::after { background-color: var(--surface); }
.take-tab[aria-selected="true"]::after { background-color: transparent; }
.take-tab[aria-selected="true"] {
  color: var(--ink);
  background-color: transparent;
  font-weight: 850;
}
.take-tab[aria-selected="true"] .take-tab-name::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  margin: 0 6px 1px 0;
  border-radius: 50%;
  background: var(--green);
}
.take-pill .take-tab { border-radius: 999px; }
.take-tab:focus-visible, .take-menu-trigger:focus-visible, .archived-takes-trigger:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: -3px;
}
.take-menu, .archived-takes-menu { flex: 0 0 auto; }
.take-menu-trigger {
  position: relative;
  isolation: isolate;
  display: grid;
  width: 44px;
  height: 44px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 1rem;
}
.take-menu-trigger:hover::after, .take-menu-trigger[aria-expanded="true"]::after {
  background: color-mix(in srgb, var(--green) 8%, transparent);
}
.take-menu-trigger:hover, .take-menu-trigger[aria-expanded="true"] { color: var(--ink); }
.take-menu-popover, .archived-takes-popover {
  position: fixed;
  inset: auto;
  display: none;
  /* Size to content, not the top-layer viewport (notably in WebKit). */
  width: max-content;
  height: fit-content;
  min-width: 160px;
  max-width: calc(100vw - 16px);
  max-height: calc(100dvh - 16px);
  overflow-y: auto;
  margin: 0;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 4px 12px rgb(38 45 40 / 10%);
}
.take-menu-popover:popover-open, .archived-takes-popover:popover-open { display: flex; flex-direction: column; }
.take-menu-action {
  min-height: 44px;
  padding: 7px 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: .76rem;
  font-weight: 700;
  text-align: left;
  white-space: nowrap;
}
.take-menu-action:hover, .take-menu-action:focus-visible { outline: 0; background: #ebe5da; }
.take-menu-action--danger { color: #9d4334; }
.take-menu-action:disabled { color: var(--muted); cursor: not-allowed; opacity: .55; }
.archived-takes-trigger {
  min-height: 44px;
  padding: 7px 9px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: .72rem;
  font-weight: 700;
  white-space: nowrap;
}
.archived-takes-popover { width: min(300px, calc(100vw - 16px)); }
.archived-take-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.archived-take-row > span { overflow: hidden; padding-left: 7px; font-size: .76rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.take-tab-name { line-height: 1; }
.take-tab-chosen {
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.take-tab-score { display: inline-flex; align-items: center; }
.take-score-detail-track { overflow: hidden; border-radius: 999px; background: color-mix(in srgb, var(--line) 68%, transparent); }
.take-score-detail-track span { display: block; height: 100%; border-radius: inherit; background: var(--green); }
.take-tab-stars { color: var(--muted); font-size: .68rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.take-score-expand {
  min-height: 44px;
  padding: 7px 9px;
  border-radius: 999px;
  background: transparent;
  color: var(--green);
  font-size: .72rem;
  font-weight: 750;
}
.take-score-expand:hover,
.take-score-expand:focus-visible { background: var(--green-soft); color: var(--green); }

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

.take-score-dialog {
  width: min(760px, calc(100vw - 28px));
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 24px 70px rgb(38 45 40 / 24%);
}
.take-score-dialog::backdrop { background: rgb(38 45 40 / 28%); backdrop-filter: blur(2px); }
.take-score-dialog header { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.take-score-dialog h3 { margin: 1px 0 0; font-size: 1.05rem; }
.take-score-comparison-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 10px; margin: 17px 0; }
.take-score-comparison-card { padding: 13px; border: 1px solid var(--line); border-radius: 10px; background: rgb(255 255 255 / 48%); }
.take-score-comparison-card.is-best { border-color: color-mix(in srgb, var(--accent) 72%, var(--line)); }
.take-score-comparison-card header { align-items: flex-start; }
.take-score-comparison-card h4 { margin: 1px 0 0; font-size: .9rem; }
.take-score-dialog-overall { color: var(--green); font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.take-score-details-list { display: grid; gap: 9px; margin: 13px 0 0; padding: 0; list-style: none; }
.take-score-details-list li { display: grid; grid-template-columns: minmax(90px, 1fr) minmax(80px, 1.3fr) 42px; align-items: center; gap: 10px; color: var(--muted); font-size: .76rem; }
.take-score-details-list li.is-low { color: #922d1d; font-weight: 700; }
.take-score-details-list strong { color: inherit; text-align: right; font-variant-numeric: tabular-nums; }
.take-score-detail-track { height: 6px; }
.take-score-details-list li.is-low .take-score-detail-track span { background: #b54a37; }
.take-score-dialog footer { display: flex; justify-content: flex-end; gap: 8px; }

.fork-take-action {
  min-height: 44px;
  padding: 7px 9px;
  background: transparent;
  color: var(--green);
  font-size: .8rem;
  font-weight: 750;
}

.take-stage { min-width: 0; }
.take-previews { display: none; }

.take-choice-note {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin: 0 0 8px;
  color: var(--muted);
  font-size: .8rem;
}
/* One line on every take, so switching takes never moves the agenda. */
.take-choice-note > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.take-choose-action {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 7px 9px;
  border: 0;
  background: transparent;
  color: var(--green);
  cursor: pointer;
  font-size: .8rem;
  font-weight: 750;
}

.take-previews-heading {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.take-preview {
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgb(255 253 248 / 60%);
}

.take-preview header { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 8px; margin-bottom: 8px; }
.take-preview-title { padding: 0; background: transparent; color: var(--green); font-size: .86rem; font-weight: 800; }
.take-preview ol { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.take-preview-row { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 5px; padding: 7px 0; border-top: 1px solid var(--line); }
.take-preview-row > span { color: var(--accent); font: 700 .65rem ui-monospace, monospace; }
.take-preview-row div { display: grid; gap: 2px; min-width: 0; }
.take-preview-row strong { overflow: hidden; font-size: .76rem; text-overflow: ellipsis; white-space: nowrap; }
.take-preview-row small { overflow: hidden; color: var(--muted); font-size: .68rem; text-overflow: ellipsis; white-space: nowrap; }
.take-preview-row--outline { margin-top: 4px; padding: 7px 6px; border: 0; border-radius: 7px; background: var(--green-soft); color: var(--green); }
.take-preview-more { padding: 8px 0 0 31px; color: var(--muted); font-size: .7rem; }

.revision-panel h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.8rem;
  letter-spacing: -.025em;
}

.agenda-title, .agenda-subtitle, .agenda-location, .agenda-temporal, .agenda-duration, .agenda-owner, .agenda-comment {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.agenda-list, .revision-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* C3: quiet sequence, compact rhythm, full-width wrapping copy. */
.agenda-list { container-type: inline-size; --agenda-row-space: 6px; --agenda-dot-offset: 14px; }
.agenda-item {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  align-items: start;
  min-height: 44px;
  margin-left: 5px;
  padding-left: 20px;
}
.agenda-item:not(.agenda-item--outline)::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 1px;
  background: #c3bbad;
}
.agenda-item:not(.agenda-item--outline)::after {
  content: "";
  position: absolute;
  left: -3px;
  top: calc(var(--agenda-dot-offset) - 1px);
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  outline: 4px solid var(--paper);
}
.agenda-item:first-child::before,
.agenda-item--outline + .agenda-item::before { top: var(--agenda-dot-offset); }
.agenda-item:last-child::before,
.agenda-item:has(+ .agenda-item--outline)::before { bottom: calc(100% - var(--agenda-dot-offset)); }
/* A short green stroke opens each section but the first: 40px whatever
   the width, at the header's left edge, with even space around it. */
.agenda-item--outline {
  margin: 8px 0 0;
  padding: 11px 0 0;
}
.agenda-item--outline:not(:first-child)::before {
  content: ""; position: absolute; left: 0; top: 0;
  width: 40px; height: 2px; border-radius: 1px;
  background: color-mix(in srgb, var(--green) 30%, var(--paper));
}
.agenda-item--outline:first-child { padding-top: 0; }
.agenda-item--outline:first-child { margin-top: 0; }
.agenda-copy { min-width: 0; padding-block: var(--agenda-row-space); }
.agenda-item--outline .agenda-copy { padding-block: 8px 4px; }
/* Points sit at an even text-to-text rhythm: one without a time is only as
   tall as its text. */
.agenda-item:is(.agenda-item--outline, :not(.agenda-item--scheduled)) { min-height: 0; }
/* The row's actions stand on the text's baseline: the copy's first line (the
   title, or the time line above it) and the actions share one baseline, as
   if set in one line, whatever their sizes, pills or icons. The controls'
   negative top margin keeps their baseline the shallower one, so they move
   to the text and the text never moves; the bottom one keeps them from
   adding height (the ••• keeps its 44px target by overlapping the row's
   edges). */
.agenda-item > :is(.agenda-copy, .item-controls) { align-self: baseline; }
.agenda-item > .item-controls { margin-block: -24px -44px; }
/* The row in use lies above its neighbours, so the chevrons and targets
   it lends into their space take the tap, not the next row's mark. */
.agenda-item:is(:hover, :focus-within, .agenda-item--nudged, .agenda-item--dragging) { z-index: 3; }
/* A row's open menu stays above the next row, even while that is hovered. */
.agenda-item:has(.item-menu[open]) { z-index: 4; }
.agenda-title { font-size: 1.0625rem; font-weight: 650; line-height: 1.35; letter-spacing: -.012em; }
.outline-title { font-weight: 700; }
.agenda-schedule .agenda-time { display: block; }
.agenda-schedule { width: fit-content; max-width: 100%; margin-bottom: 2px; }
.outline-schedule { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; margin-top: 2px; color: var(--muted); }
.outline-weekday { font-size: .8125rem; }
.outline-schedule .agenda-date { width: auto; max-width: 100%; font-size: .8125rem; }
.agenda-meta { display: flex; flex-direction: column; align-items: stretch; gap: 2px; margin-top: 2px; }
.agenda-subtitle { color: var(--muted); font-size: .875rem; line-height: 1.5; }
.agenda-location-group { display: flex; width: fit-content; min-width: 0; max-width: 100%; align-items: flex-start; gap: 6px; color: var(--muted); }
/* Drawn, not the ⌖ character (fallback fonts set that glyph low). The
   marker is set like the place's field: one line of its font size and line
   height, with the same 2px guard below (resizeAgendaText), aligned as the
   field is. On that line's baseline stands a mark one cap-height square, so
   it spans exactly the capitals of the place's first line, at any font. */
.agenda-location-group .location-marker { font-size: .8125rem; line-height: 1.5; padding-bottom: 2px; }
.agenda-location-group .location-marker::before {
  content: "";
  display: inline-block;
  width: 1cap; height: 1cap;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cg fill='none' stroke='black' stroke-width='1.4' stroke-linecap='round'%3E%3Ccircle cx='6' cy='6' r='3.2'/%3E%3Cpath d='M6 .7v2.1M6 9.2v2.1M.7 6h2.1M9.2 6h2.1'/%3E%3C/g%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cg fill='none' stroke='black' stroke-width='1.4' stroke-linecap='round'%3E%3Ccircle cx='6' cy='6' r='3.2'/%3E%3Cpath d='M6 .7v2.1M6 9.2v2.1M.7 6h2.1M9.2 6h2.1'/%3E%3C/g%3E%3C/svg%3E") center / contain no-repeat;
}
.agenda-location-group[data-location-color] { padding: 1px 6px; }
.agenda-location { width: auto; field-sizing: content; min-width: 0; color: inherit; font-size: .8125rem; line-height: 1.5; }
.agenda-copy textarea { display: block; resize: none; overflow: hidden; padding: 0; border-radius: 2px; overflow-wrap: anywhere; }
.agenda-copy textarea:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; background: var(--surface); }
.agenda-temporal { flex: none; color: var(--muted); font-size: .8125rem; padding: 0; }
.agenda-date { width: 8.8rem; }
.agenda-time { width: 100%; color: var(--ink); font-size: .8125rem; line-height: 1.5; font-weight: 650; font-variant-numeric: tabular-nums; }
input[readonly].agenda-temporal::-webkit-calendar-picker-indicator { display: none; }
.item-controls { display: flex; align-items: baseline; justify-self: end; }
.item-inline-actions { display: none; }
.item-menu { position: relative; justify-self: end; }
.item-menu[open] { z-index: 5; }
.item-menu-trigger {
  display: grid;
  width: 44px;
  height: 44px;
  cursor: pointer;
  list-style: none;
  place-items: center;
  border-radius: 50%;
  color: var(--muted);
  font-size: .78rem;
  letter-spacing: .05em;
}
.item-menu-trigger::-webkit-details-marker { display: none; }
.item-menu-trigger:hover { background: #ebe5da; color: var(--ink); }
.item-menu-popover {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  display: grid;
  width: 12rem;
  max-width: calc(100vw - 48px);
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
}
.item-menu-action, .item-inline-action {
  appearance: none;
  border: 0;
  cursor: pointer;
  min-height: 44px;
  padding: 8px 9px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  font-size: .78rem;
  white-space: normal;
}
.item-menu-action { width: 100%; }
.item-menu-metadata { padding-bottom: 4px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.item-menu-action--danger { border-top: 1px solid var(--line); border-radius: 0 0 5px 5px; }
.item-menu-action:disabled { opacity: .4; cursor: default; }
.item-inline-action { color: var(--green); white-space: nowrap; }
.item-inline-action:hover, .item-inline-action:focus-visible { background: var(--green-soft); }
.item-inline-action:focus-visible, .item-menu-action:focus-visible, .item-menu-trigger:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: -2px;
}
/* The row's additions sit right of the text for as long as there is room:
   the text takes what it needs (up to the row), the additions the rest. Those
   that do not fit wrap onto a second, clipped line, the last first, and
   their twins show in the ••• menu instead (see syncActionOverflow). */
@container (min-width: 26rem) {
  .agenda-item { grid-template-columns: minmax(0, max-content) minmax(44px, 1fr); }
  .agenda-item > .item-controls { justify-self: stretch; min-width: 0; }
  .item-inline-actions {
    display: flex; flex: 1 1 0; min-width: 0; height: 44px; overflow: hidden;
    flex-wrap: wrap; justify-content: flex-end; align-items: baseline;
  }
}
.item-inline-actions > [data-overflow] { visibility: hidden; }
.item-menu-metadata:not(:has(> :not([hidden]))) { display: none; }
@container (min-width: 42rem) {
  .item-menu-action--in-place-twin { display: none; }
  .item-menu-metadata:not(:has(> :not([hidden], .item-menu-action--in-place-twin))) { display: none; }
}
.item-menu-action:not(:disabled):hover { background: #ebe5da; color: var(--ink); }
.item-menu-action--danger { color: #9d4334; }
/* The list's end: quiet pills like the between-rows control, always shown,
   under the titles; they wrap on a narrow screen or with large text. */
.agenda-add-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0 25px; }
.agenda-add-button {
  max-width: 100%; min-height: 30px; padding: 4px 12px;
  border: 1px solid #b9d4c8; border-radius: 999px; background: var(--paper);
  color: var(--green); font-size: .8125rem; line-height: 1.2; text-align: center;
}
.agenda-add-button:hover { background: var(--green-soft); }
.agenda-add-button:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.agenda-editor--touch-capable .agenda-add-button { min-height: 44px; padding: 4px 16px; }

/* Between rows: one pill, "+ Punkt | + Rahmen". Hover controls fade in
   after a short pause and linger before fading out. */
.agenda-list { --hover-fade: opacity .25s ease .3s; }
.insert-controls {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: -11px;
  display: flex;
  height: 22px;
  border: 1px solid #b9d4c8;
  border-radius: 11px;
  overflow: hidden;
  background: var(--paper);
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%);
  /* Clickable exactly while visible: pointer-events flips with the fade. */
  transition: var(--hover-fade), pointer-events 0s .55s allow-discrete;
}
.insert-controls button {
  height: 100%;
  padding: 0 9px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--green);
  font-size: .72rem;
  line-height: 1;
  white-space: nowrap;
  transition: background .12s ease;
}
/* The first row's "insert above" sits on its top edge. */
.insert-controls--before { top: -11px; bottom: auto; }
.insert-controls button + button { border-left: 1px solid #b9d4c8; }
.insert-controls button:hover { background: var(--green-soft); }
.insert-controls button:focus-visible { outline: 2px solid var(--green); outline-offset: -2px; }
.agenda-item:hover > .insert-controls,
.agenda-item:focus-within > .insert-controls,
.insert-controls:focus-within {
  opacity: 1;
  pointer-events: auto;
  transition-delay: .12s, .12s;
}

/* A point's timeline mark (dot or icon disc) is its drag
   handle; it takes no room of its own and nothing shifts on hover. */
.agenda-drag-mark { cursor: grab; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.agenda-item--dragging .agenda-icon-slot { transform: scale(1.2); transition: transform .12s ease; }
/* Its affordance: small up/down chevrons on the runline, just above and below
   the mark, laid over it (no room taken, nothing shifts). Each moves the row
   one place. They show while the mark is pointed at, on keyboard focus, during
   a drag, and on touch (which has no hover) while the row is being edited. */
.agenda-move {
  position: absolute;
  z-index: 2;
  left: 50%;
  /* As wide as the mark it belongs to, so the whole width takes the hover. */
  width: max(20px, 100%);
  height: 12px;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: transparent;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  /* Still clickable a moment after the pointer or focus leaves. */
  transition: opacity .15s ease, visibility 0s .3s;
}
.agenda-move::before {
  content: "";
  position: absolute;
  inset: 3px 5px;
  background: var(--muted);
  -webkit-mask: var(--agenda-move-chevron) center / contain no-repeat;
  mask: var(--agenda-move-chevron) center / contain no-repeat;
}
.agenda-move:hover::before, .agenda-move:focus-visible::before { background: var(--ink); }
.agenda-move:focus-visible { outline: 2px solid var(--green); outline-offset: 0; }
.agenda-move--up {
  bottom: 100%;
  transform: translate(-50%, -1px);
  --agenda-move-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1.5 5 5 1.5 8.5 5' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.agenda-move--down {
  top: 100%;
  transform: translate(-50%, 1px);
  --agenda-move-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1.5 1 5 4.5 8.5 1' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.agenda-icon-slot:is(:hover, :has(> :focus-visible)) > .agenda-move,
.agenda-editor--touch-capable .agenda-item:focus-within .agenda-move,
.agenda-item--dragging .agenda-move { opacity: 1; visibility: visible; transition: opacity .15s ease; }
/* A section header has no mark: it is held by its empty space, and its
   chevrons sit on the runline in its top and bottom padding. */
.agenda-drag-header { cursor: grab; }
.agenda-drag-header :is(textarea, input, button, a, summary) { cursor: auto; }
.agenda-drag-header :is(button, a, summary) { cursor: pointer; }
/* A section's icon (only if one was chosen) leads it, large to mark the
   level, centred on the runline like the points' marks; its title then
   starts where theirs do (5px runline + 20px). Without one the title stays
   flush left. Vertically centred on the title's first line. */
.agenda-list:not(.agenda-list--compact) .agenda-item--outline {
  --agenda-section-icon: 26px;
}
/* Its text sits at the header's foot, close to the points it leads; the
   icon is placed in that block. */
.agenda-item--outline > .agenda-copy { position: relative; }
.agenda-list:not(.agenda-list--compact) .agenda-item--outline .agenda-icon-slot {
  position: absolute; z-index: 1;
  left: calc(5px - var(--agenda-section-icon) / 2);
  top: calc(8px + 1.0625rem * 1.35 / 2 - var(--agenda-section-icon) / 2);
  display: grid; place-items: center;
  width: var(--agenda-section-icon); height: var(--agenda-section-icon);
}
.agenda-list:not(.agenda-list--compact) .agenda-item--outline .agenda-icon-slot :is(.agenda-icon, .agenda-icon-button) {
  display: grid; place-items: center; width: 100%; height: 100%; min-height: 0;
  font-size: 1.4rem; line-height: 1; color: var(--ink); opacity: .8;
}
.agenda-list:not(.agenda-list--compact) .agenda-item--outline .agenda-icon-slot .agenda-icon-graphic { width: 1em; height: 1em; }
.agenda-list:not(.agenda-list--compact) .agenda-item--outline:has(.agenda-icon-slot) .agenda-copy { padding-left: 25px; }
/* The pair spans a band on the runline as wide as a section icon: pointing
   there (not anywhere on the header) shows the chevrons, as a point's mark
   does. It lies under the header's text and controls, so they keep their
   clicks; the chevrons themselves lie above. */
.agenda-move-pair { position: absolute; left: calc(5px - 13px); width: 26px; top: 0; bottom: 0; }
/* ˄ under a section's stroke, ˅ just below the header's text. */
.agenda-item--outline:not(:first-child) > .agenda-move-pair { top: 7px; }
.agenda-item--outline > .agenda-move-pair { bottom: -3px; }
.agenda-move-pair .agenda-move { width: 100%; height: 10px; }
.agenda-move-pair .agenda-move--up { left: 50%; top: 0; bottom: auto; transform: translateX(-50%); }
.agenda-move-pair .agenda-move--down { left: 50%; top: auto; bottom: 0; transform: translateX(-50%); }
.agenda-move-pair .agenda-move::before { inset: auto 1px; height: 6px; }
/* The glyph sits 3px inside its button. */
.agenda-move-pair .agenda-move--up::before { top: 3px; }
.agenda-move-pair .agenda-move--down::before { bottom: 3px; }
.agenda-item--nudged .agenda-move,
.agenda-move-pair:hover > .agenda-move,
.agenda-item--outline:has(> .agenda-move-pair :focus-visible) > .agenda-move-pair > .agenda-move,
.agenda-editor--touch-capable .agenda-item--outline:focus-within > .agenda-move-pair > .agenda-move { opacity: 1; visibility: visible; transition: opacity .15s ease; }
/* On touch the chevrons take a finger: their area grows outward, away from
   the mark. */
.agenda-editor--touch-capable .agenda-move { width: max(32px, 100%); height: 22px; }
.agenda-editor--touch-capable .agenda-move::before { inset: auto 0; height: 6px; }
.agenda-editor--touch-capable .agenda-move--up::before { bottom: 4px; }
.agenda-editor--touch-capable .agenda-move--down::before { top: 4px; }
/* Touch: the areas reach out past the separators; the chevrons stay inside. */
.agenda-editor--touch-capable .agenda-move-pair .agenda-move { width: 100%; height: 22px; }
.agenda-editor--touch-capable .agenda-move-pair .agenda-move--up { top: -12px; }
.agenda-editor--touch-capable .agenda-move-pair .agenda-move--down { bottom: -12px; }
.agenda-editor--touch-capable .agenda-move-pair .agenda-move::before { inset: auto 7px; height: 6px; }
.agenda-editor--touch-capable .agenda-move-pair .agenda-move--up::before { top: auto; bottom: 1px; }
.agenda-editor--touch-capable .agenda-move-pair .agenda-move--down::before { bottom: auto; top: 1px; }
.agenda-item--dragging { opacity: .45; }
/* A row moved by its chevrons that could not stay put on screen flashes once. */
@keyframes agenda-moved { from { background: var(--green-soft); } to { background: transparent; } }
.agenda-item--moved { animation: agenda-moved .7s ease-out; }
@media (prefers-reduced-motion: reduce) { .agenda-item--moved { animation-duration: .01s; } }
body.agenda-dragging { cursor: grabbing; }
body.agenda-dragging, body.agenda-dragging * { -webkit-user-select: none; user-select: none; }
/* While a row is dragged, the rows it passes are not hovered: no insert
   pills, inline actions or mark chevrons light up under the pointer. The
   drag itself follows the window (mouse) or the held finger (touch). */
body.agenda-dragging .agenda-list { pointer-events: none; }
.agenda-drop-indicator { height: 0; margin: -1px 0 -1px 5px; border-top: 2px solid var(--green); list-style: none; pointer-events: none; }

.icon-button {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 1rem;
}

.icon-button:hover { background: #ebe5da; color: var(--ink); }

.metadata-button {
  padding: 6px 7px;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: .72rem;
  white-space: nowrap;
}

.metadata-button:hover { background: #ebe5da; color: var(--ink); }

.secondary-action {
  justify-self: start;
  margin-top: 14px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: transparent;
  color: var(--green);
  font-size: .86rem;
  font-weight: 700;
}

.secondary-action:hover { border-color: #91ae9f; background: var(--green-soft); }

.text-action {
  padding: 8px 0;
  background: transparent;
  color: var(--green);
  font-size: .82rem;
  font-weight: 700;
}

.revision-panel {
  display: grid;
  grid-template-columns: minmax(180px, 280px) minmax(0, 1fr);
  gap: clamp(32px, 8vw, 96px);
  padding: 42px 0;
  border-top: 1px solid var(--line);
}

.revision-list { display: grid; gap: 6px; }
.revision-list a { display: flex; justify-content: space-between; gap: 16px; padding: 11px 13px; border-radius: 8px; color: var(--muted); font-size: .85rem; text-decoration: none; }
.revision-list a:hover, .revision-list a.is-current { background: var(--surface); color: var(--ink); }
.revision-list a span { display: grid; gap: 3px; }
.revision-list strong { color: var(--ink); font-size: .82rem; }
.revision-list small { color: var(--muted); font-size: .75rem; }
.revision-list time { flex: none; font-size: .75rem; }

input[readonly] { cursor: default; }

.ai-assistant {
  margin: 0 0 1.25rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: color-mix(in srgb, var(--paper) 94%, var(--accent));
  box-shadow: 0 14px 40px rgb(34 43 35 / 6%);
}

.ai-assistant-heading,
.ai-chat-input,
.ai-composer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}

.ai-assistant-heading h2 { margin: 0; }
.ai-expand-action { display: none; }
.ai-summary { display: none; }
.ai-conversation { min-height: 0; }

.ai-messages {
  display: grid;
  gap: .65rem;
  max-height: 18rem;
  margin: 1rem 0;
  padding-right: .25rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
}

.ai-message {
  width: fit-content;
  max-width: min(44rem, 92%);
  margin: 0;
  padding: .65rem .8rem;
  border-radius: .85rem;
  background: var(--paper);
  animation: ai-message-in 180ms ease-out;
}

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

.ai-message--user { justify-self: end; background: var(--ink); color: var(--paper); }
.ai-message--status { opacity: .72; font-style: italic; }
.ai-message--error { color: #8a1f11; background: #fff0ec; }
.ai-message p { margin: 0; white-space: pre-wrap; }
.ai-message-content > :first-child { margin-top: 0; }
.ai-message-content > :last-child { margin-bottom: 0; }
.ai-message-content p,
.ai-message-content ul,
.ai-message-content ol,
.ai-message-content pre,
.ai-message-content blockquote { margin: .55rem 0; }
.ai-message-content ul,
.ai-message-content ol { padding-left: 1.25rem; }
.ai-message-content pre { max-width: 100%; padding: .65rem; overflow-x: auto; border-radius: .55rem; background: var(--ink); color: var(--paper); }
.ai-message-content code { padding: .08rem .25rem; border-radius: .3rem; background: var(--surface); font: .82em ui-monospace, monospace; }
.ai-message-content pre code { padding: 0; background: transparent; }
.ai-message-content a { color: var(--green); text-underline-offset: 2px; }

.ai-attachments,
.ai-tool-activity,
.ai-file-chips { display: flex; flex-wrap: wrap; gap: .35rem; margin: .5rem 0 0; padding: 0; list-style: none; }
.ai-attachments li,
.ai-tool-activity li,
.ai-file-chips li { padding: .22rem .48rem; border-radius: 999px; font-size: .72rem; }
.ai-attachments li { background: rgb(255 255 255 / 16%); }
.ai-message--assistant .ai-attachments li { background: var(--green-soft); color: var(--green); }
.ai-tool-activity li { display: inline-flex; align-items: center; gap: .25rem; background: var(--green-soft); color: var(--green); font-weight: 700; }
.ai-tool-activity li[data-kind="unsaved"] { background: #f6e3de; color: #9d4334; }

.ai-criteria {
  display: grid;
  gap: .35rem;
  margin-bottom: .8rem;
  font-size: .78rem;
  font-weight: 700;
}

.ai-criteria small { color: var(--muted); font-size: .7rem; font-weight: 500; }
.ai-criteria input,
.ai-chat-input textarea {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
}
.ai-criteria input { padding: .65rem .75rem; border: 1px solid var(--line); border-radius: .65rem; background: var(--paper); }

.ai-chat-input { align-items: flex-end; }
.ai-composer {
  flex: 1;
  min-width: 0;
  padding: .45rem .5rem .4rem .75rem;
  border: 1px solid var(--line);
  border-radius: .9rem;
  background: var(--paper);
  box-shadow: 0 6px 20px rgb(34 43 35 / 7%);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
.ai-composer:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 15%, transparent); }
.ai-chat-input[data-dragging="true"] .ai-composer { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent); }
.ai-chat-input textarea { display: block; min-height: 2.2rem; max-height: 9rem; padding: .45rem .2rem; resize: none; overflow-y: auto; line-height: 1.45; outline: 0; }
.ai-composer-actions { justify-content: flex-start; gap: .45rem; }
.ai-upload-action { display: inline-grid; width: 2rem; height: 2rem; place-items: center; border-radius: 999px; cursor: pointer; font-weight: 800; }
.ai-upload-action { flex: none; color: var(--green); background: var(--green-soft); font-size: 1.15rem; }
.ai-upload-action:hover { color: var(--ink); }
.ai-upload-action input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.ai-upload-action:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.ai-composer-hint { flex: 1; color: var(--muted); font-size: .68rem; }
.ai-retry-action { padding: .35rem .55rem; color: var(--green); background: transparent; font-size: .72rem; font-weight: 700; }
.ai-send-action { display: inline-flex; flex: none; height: 2rem; align-items: center; gap: .35rem; padding: 0 .7rem; border-radius: 999px; background: var(--ink); color: var(--paper); font-size: .75rem; font-weight: 800; }
.ai-send-action > :last-child { font-size: 1rem; }
.ai-send-action:disabled { cursor: wait; opacity: .45; }
.ai-file-chips { margin: .15rem 0 .25rem; }
.ai-file-chips:empty { display: none; }
.ai-file-chips li { display: inline-flex; align-items: center; gap: .3rem; max-width: 100%; background: var(--surface); color: var(--ink); }
.ai-file-chips span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-file-remove { display: grid; width: 1rem; height: 1rem; padding: 0; place-items: center; border-radius: 50%; background: color-mix(in srgb, var(--ink) 10%, transparent); color: inherit; font-size: .7rem; }

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

@media (hover: none) {
  .agenda-item:focus-within > .insert-controls { opacity: 1; pointer-events: auto; }
}

@media (min-width: 1000px) {
  .editor-form:has(> .ai-assistant:not([hidden])) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(20rem, 22rem);
    column-gap: clamp(1.5rem, 3vw, 2.5rem);
    align-items: start;
  }
  .editor-form:has(> .ai-assistant:not([hidden])) > .plan-heading { grid-column: 1 / -1; }
  .editor-form:has(> .ai-assistant:not([hidden])) > .ai-assistant {
    position: sticky;
    top: 1rem;
    grid-column: 2;
    grid-row: 2;
    margin: 0;
  }
  .editor-form:has(> .ai-assistant:not([hidden])) > [data-editor-content] {
    min-width: 0;
    grid-column: 1;
    grid-row: 2;
  }
  .take-stage:has(.take-previews) { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(360px, 1fr); gap: 30px; align-items: start; }
  .take-previews { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
}

@media (max-width: 720px) {
  .app-shell { width: min(100% - 24px, 1120px); }
  .editor { padding-top: 12px; }
  .plan-heading { margin-bottom: 12px; }
  .plan-title { font-size: 1.875rem; line-height: 1.12; }
  .revision-panel { grid-template-columns: 1fr; gap: 24px; padding: 34px 0; }
  .topbar { flex-wrap: wrap; gap: 10px 18px; padding: 12px 0; }
  .topbar-hint { display: none; }
  .revision-meta { flex-wrap: wrap; justify-content: flex-end; gap: 4px 10px; font-size: .76rem; }
  .revision-list a { flex-wrap: wrap; gap: 4px 16px; }
  .editor:has(.ai-assistant:not([hidden])) { padding-bottom: 9.5rem; }
  .ai-assistant {
    position: fixed;
    z-index: 20;
    right: 12px;
    bottom: max(10px, env(safe-area-inset-bottom));
    left: 12px;
    max-height: min(78dvh, 42rem);
    margin: 0;
    padding: .65rem;
    border-radius: 1rem;
    box-shadow: 0 18px 60px rgb(20 28 22 / 24%);
  }
  .ai-assistant-heading { display: none; }
  .ai-summary {
    display: grid;
    width: 100%;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: .55rem;
    align-items: center;
    padding: .15rem .2rem .6rem;
    border: 0;
    border-bottom: 1px solid color-mix(in srgb, var(--line) 75%, transparent);
    border-radius: 0;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
    text-align: left;
  }
  .ai-summary-label { display: inline-flex; align-items: center; gap: .35rem; color: var(--muted); font-size: .65rem; font-weight: 750; text-transform: uppercase; letter-spacing: .055em; }
  .ai-summary-label::before { width: .42rem; height: .42rem; border-radius: 50%; background: var(--green); content: ""; }
  .ai-summary [data-ai-summary-text] { overflow: hidden; color: var(--ink); font-size: .8rem; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
  .ai-summary-chevron { width: .55rem; height: .55rem; margin: 0 .3rem 0 .2rem; border-top: 2px solid var(--muted); border-right: 2px solid var(--muted); transform: rotate(-45deg); transition: transform 160ms ease; }
  .ai-assistant[data-expanded="true"] .ai-summary-chevron { transform: rotate(135deg); }
  .ai-summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
  .ai-conversation { display: none; }
  .ai-assistant[data-expanded="true"] .ai-conversation { display: block; }
  .ai-assistant[data-expanded="true"] .ai-messages { max-height: min(45dvh, 24rem); margin: .35rem 0 .65rem; }
  .ai-assistant[data-expanded="true"] .ai-criteria { margin-bottom: .6rem; }
  .ai-chat-input { display: block; }
  .ai-composer { padding: .35rem .4rem .3rem .65rem; }
  .ai-chat-input textarea { max-height: 6rem; }
  .ai-composer-hint { display: none; }
  .ai-retry-action { margin-left: auto; }
  .ai-send-action { width: 2rem; padding: 0; justify-content: center; }
  .ai-send-label { display: none; }
}

.collaboration-status {
  color: var(--muted-color, #667085);
  font-size: 0.85rem;
}

[data-collaboration-target][data-collaborator="true"] {
  outline: 2px solid #7c6ee6;
  outline-offset: 3px;
}

.collaboration-conflict {
  position: sticky;
  bottom: 1rem;
  z-index: 20;
  margin: 1rem;
  padding: 1rem;
  border: 1px solid #d92d20;
  border-radius: 0.75rem;
  background: #fff4f2;
  color: #7a271a;
  box-shadow: 0 0.75rem 2rem rgb(16 24 40 / 18%);
}

.collaboration-conflict > div {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

/* Account and tenant library */
.account-nav { display: flex; flex: 0 0 auto; gap: 0.8rem; margin-left: auto; font-size: 0.82rem; white-space: nowrap; }
.account-nav a { display: inline-flex; min-height: 44px; align-items: center; color: inherit; text-decoration: none; }
.topbar {
  position: relative;
  display: grid;
  min-height: 56px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0 16px;
}
.topbar .brand { display: inline-flex; min-height: 44px; align-items: center; }
.topbar .account-nav { justify-content: flex-end; flex-wrap: wrap; gap: 0 12px; margin-left: 0; }
.plan-details { color: var(--muted); font-size: .82rem; }
.plan-details > summary { display: flex; align-items: center; min-height: 44px; cursor: pointer; gap: 6px; list-style: none; }
.plan-details > summary::-webkit-details-marker { display: none; }
.plan-details > summary::after { content: "⌄"; }
.plan-details[open] > summary::after { content: "⌃"; }
.plan-details > summary:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.plan-details-content {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 20;
  width: min(28rem, 100%);
  max-height: calc(100dvh - 88px);
  overflow-y: auto;
  padding: 12px 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  overflow-wrap: anywhere;
}
.plan-details-content .revision-meta { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.plan-details-content .revision-meta--empty { display: none; }
.plan-details-content a:not([hidden]) { min-height: 44px; display: inline-flex; align-items: center; }
.plan-details-content p { margin: 8px 0; line-height: 1.5; }
.telegram-details { margin-top: 8px; border-top: 1px solid var(--line); padding-top: 8px; }
.jassy-setting { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 8px; border-top: 1px solid var(--line); padding-top: 8px; }
.jassy-setting .secondary-action { margin-top: 0; min-height: 44px; }
.connection-warning { grid-column: 1 / -1; padding-bottom: 8px; color: #922d1d; font-size: .82rem; }
.account-shell, .library-shell { width: min(70rem, calc(100% - 2rem)); margin: 0 auto; padding: 1.25rem 0 4rem; }
.account-shell > .brand { display: inline-block; margin-bottom: 3rem; }
.account-card { width: min(30rem, 100%); margin: 0 auto; padding: 2rem; border: 1px solid var(--line, #d8d1c4); background: #fffdf8; box-shadow: 0 1rem 3rem rgb(57 47 31 / 8%); }
.account-card h1, .library-section h1, .library-section h2 { margin: 0.25rem 0 1rem; }
.account-form { display: grid; gap: 0.55rem; margin-top: 1.5rem; }
.account-form input { width: 100%; margin-bottom: 0.65rem; padding: 0.75rem; border: 1px solid var(--line, #d8d1c4); background: white; font: inherit; }
.account-slug-field { display: flex; align-items: center; margin-bottom: 0.65rem; border: 1px solid var(--line, #d8d1c4); background: white; }
.account-slug-field span { padding-left: 0.75rem; color: var(--muted, #70695f); white-space: nowrap; }
.account-form .account-slug-field input { min-width: 0; margin: 0; border: 0; }
.account-footnote { margin-top: 1.25rem; font-size: 0.9rem; }
.dev-logins { display: grid; gap: 0.5rem; margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px dashed var(--line, #d8d1c4); }
.dev-logins .account-footnote { margin-top: 0.25rem; }
.dev-login-button { display: grid; grid-template-columns: auto 1fr; gap: 0.1rem 0.6rem; width: 100%; padding: 0.6rem 0.75rem; border: 1px solid var(--line, #d8d1c4); background: white; font: inherit; text-align: left; cursor: pointer; }
.dev-login-button:hover, .dev-login-button:focus-visible { border-color: currentColor; }
.dev-login-button span { color: #6b6255; }
.dev-login-button small { grid-column: 1 / -1; color: #6b6255; }
.account-list, .jenda-grid, .local-jenda-list, .member-list { list-style: none; margin: 1rem 0; padding: 0; }
.account-list { display: grid; gap: 0.6rem; }
.library-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 3rem; }
.library-header p { margin: 0.25rem 0 0; color: var(--muted, #70695f); }
.library-header nav { display: flex; align-items: center; gap: 0.8rem; }
.library-header form { margin: 0; }
.library-section { margin-top: 1.5rem; padding: 1.5rem; border: 1px solid var(--line, #d8d1c4); background: #fffdf8; }
.jenda-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 0.8rem; }
.jenda-grid li, .local-jenda-list li { padding: 1rem; border: 1px solid var(--line, #d8d1c4); background: white; }
.jenda-grid li > a:first-child, .local-jenda-list a { display: grid; gap: 0.35rem; color: inherit; text-decoration: none; }
.jenda-grid small, .local-jenda-list small { color: var(--muted, #70695f); }
/* Linked jendas (a program and its rundowns) sit together: parents full width, their rundowns in a grid below. */
.jenda-grid li.jenda-group { grid-column: 1 / -1; padding: 0.6rem; background: color-mix(in srgb, var(--line, #d8d1c4) 25%, #fffdf8); }
.jenda-group ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: 0.6rem; }
.jenda-group-entry { padding: 1rem; border: 1px solid var(--line, #d8d1c4); background: white; }
.jenda-group-entry[data-depth="0"] { grid-column: 1 / -1; }
.jenda-group-entry[data-depth="2"] { border-left: 3px solid var(--line, #d8d1c4); }
.jenda-group-entry > a:first-child { display: grid; gap: 0.35rem; color: inherit; text-decoration: none; }
.jenda-group-entry small { color: var(--muted, #70695f); }
.local-jenda-list, .member-list { display: grid; gap: 0.6rem; }
.member-list li { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem; border: 1px solid var(--line, #d8d1c4); background: white; }
.member-list li > div:first-child { display: grid; gap: 0.25rem; }
.member-list small { color: var(--muted, #70695f); }
.member-actions { display: flex; align-items: center; gap: 0.65rem; }
.member-actions form { margin: 0; }
.member-actions select, .invitation-link input { padding: 0.6rem; border: 1px solid var(--line, #d8d1c4); background: white; font: inherit; }
.invitation-link input { width: 100%; }
.text-action--danger { color: #9b2c1f; }
@media (max-width: 700px) {
  .topbar { flex-wrap: wrap; }
  .account-nav { font-size: 0.76rem; }
  .library-header, .library-header nav { align-items: flex-start; flex-direction: column; }
  .account-card { padding: 1.25rem; }
  .member-list li, .member-actions { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 420px) {
  .topbar { column-gap: 10px; padding: 0; }
  .topbar .account-nav { white-space: normal; gap: 0 10px; font-size: .72rem; }
  .plan-details { font-size: .76rem; }
}

/* Telegram is a shell around the existing cue sheet, not a second editor. */
.telegram-mini-app .app-shell {
  padding-top: var(--telegram-safe-top, 0px);
  padding-bottom: calc(80px + var(--telegram-safe-bottom, 0px));
}
.mini-app-launch { padding-top: 32px; }
.mini-app-access { margin-top: 16px; }
.mini-app-access input[type="submit"] {
  max-width: 100%;
  min-height: 44px;
  padding: 10px 16px;
  border: 0;
  border-radius: 8px;
  background: var(--green);
  color: var(--surface);
  cursor: pointer;
}
.mini-app-access input:disabled { opacity: .55; cursor: default; }
.mini-app-access p { color: var(--muted); font-size: .86rem; }

/* Live operations are independent of the editable, planned agenda below. */
.live-panel { margin-top: 20px; border-block: 1px solid var(--line); padding-block: 16px; }
/* Readers see the live panel only while a session runs; it appears when one starts. */
.live-panel[data-live-reader]:not(:has([data-live-clock])) { display: none; }
.live-heading, .live-clock-row { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.live-heading h2 { margin: 0; font-size: 1.1rem; }
.live-heading > span, .live-clock-row > span, .live-note { color: var(--muted); font-size: .85rem; }
.live-heading > form { margin-left: auto; }
.live-clock-row { margin-top: 12px; }
.live-clock-row > time { font-variant-numeric: tabular-nums; font-weight: 650; }
.live-halves { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); margin-top: 16px; }
.live-half { display: flex; flex-direction: column; min-width: 0; padding: 12px; }
.live-half + .live-half { border-left: 1px solid var(--line); }
.live-half h3 { margin: 0 0 10px; color: var(--green); font-size: .8rem; letter-spacing: .1em; }
.live-half[aria-label="UP NEXT"] h3 { color: #2563a6; }
.live-item[data-live-next] { border-inline-start: 2px solid #2563a6; padding-inline-start: 8px; }
.live-item { flex: 1; min-height: 60px; overflow-wrap: anywhere; }
.live-item strong, .live-item > span { display: block; }
.live-item > span { color: var(--muted); font-size: .85rem; margin-top: 6px; }
.live-item p { white-space: pre-line; }
.live-controls { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.live-clock-row .live-controls { margin-top: 0; }
.live-button { min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); background: var(--surface); cursor: pointer; }
.live-button:hover:not(:disabled) { border-color: var(--green); }
.live-button:disabled { opacity: .5; cursor: default; }
.live-button:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.live-announcement { margin: 12px 0; font-weight: 650; }
.live-history { font-size: .85rem; }
.live-history summary { cursor: pointer; min-height: 44px; padding-block: 12px; }
.live-history ol { max-height: 240px; overflow-y: auto; }
.live-note:empty { display: none; }
@media (max-width: 480px) {
  .live-half { padding-inline: 8px; }
  .live-controls { gap: 6px; }
  .live-button { padding-inline: 8px; }
  .live-heading > form { margin-left: 0; }
}
@media (max-width: 720px) {
  /* The planning composer must not cover live controls during a run. */
  .app-shell:has([data-live-clock]) .ai-assistant { position: static; max-height: none; margin-block: 16px; box-shadow: none; }
  .app-shell:has([data-live-clock]) .editor { padding-bottom: 0; }
}

/* Keep live action forms and labels inside the agenda at large text sizes. */
.live-heading > form, .live-controls form { min-width: 0; max-width: 100%; }
.live-button { max-width: 100%; overflow-wrap: anywhere; white-space: normal; }

/* A cue becomes editable without changing its reading type or position.
   Confirmation uses the existing margin, not the cue's wrapping width. */
.inline-text { display: block; min-width: 0; max-width: 100%; }
.inline-text-line { position: relative; display: flex; align-items: flex-start; width: fit-content; min-width: 0; max-width: 100%; }
.inline-text [data-inline-field] {
  flex: 0 1 auto;
  width: auto;
  min-width: 1ch;
  max-width: 100%;
  field-sizing: content;
  border-radius: 2px;
  caret-color: var(--green);
}
/* The subline hugs its text (up to the row width) instead of a full-width field. */
.inline-text--description .inline-text-line { width: fit-content; max-width: 100%; }
.inline-text--description [data-inline-field] { width: auto; field-sizing: content; min-width: 4ch; max-width: 100%; }
.inline-text [data-inline-field]:is(:focus, [data-editing="true"]) {
  outline: none;
  background: color-mix(in srgb, var(--green) 5%, transparent);
  box-shadow: inset 0 -1px color-mix(in srgb, var(--green) 65%, transparent);
}
.inline-text [data-inline-field]:focus-visible { box-shadow: inset 0 -2px var(--green); }
.inline-text:has(.plan-title) { width: 100%; }
.inline-feedback { position: absolute; inset-inline-start: calc(100% + 2px); top: 0; width: 12px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.inline-feedback[data-state="saved"] { color: var(--green); }
.inline-feedback[data-state="error"] { color: #922d1d; font-weight: 700; }
.inline-failure { display: flex; flex-wrap: wrap; gap: 0 8px; color: #922d1d; font-size: .75rem; line-height: 1.5; }
.inline-failure[hidden] { display: none; }
.inline-retry { min-height: 44px; padding: 0; border: 0; background: transparent; color: inherit; text-decoration: underline; cursor: pointer; }
.inline-help { min-height: 1.5em; margin: 6px 0 0; color: var(--muted); font-size: .6875rem; line-height: 1.5; visibility: hidden; }
.inline-help.is-active { visibility: visible; }

.inline-help.is-single-line .inline-multiline-help { visibility: hidden; }

/* Native date/time widgets follow the browser's UI locale, not the plan's lang.
   Keep their canonical values and pickers, but read the plan-local format until
   deliberate editing begins. A blurred, unaccepted draft stays in edit mode. */
.inline-text-line:has(> [data-temporal-display]:not(:empty)) > .agenda-temporal:not(.temporal-display):not(:focus):not([data-editing="true"]) { color: transparent; -webkit-text-fill-color: transparent; }
/* Content-sized native time inputs grow when their picker appears on focus.
   Reserve editing room so the cue and its feedback do not jump. */
.inline-text .agenda-temporal { field-sizing: fixed; width: 9em; }
.inline-text .agenda-date { width: 12em; }
.temporal-display { color: var(--muted); font-size: .8125rem; position: absolute; inset: 0; pointer-events: none; white-space: nowrap; }
.inline-text-line:has(> .agenda-temporal:is(:focus, [data-editing="true"])) > .temporal-display { visibility: hidden; }
.temporal-display--time { color: var(--ink); line-height: 1.5; font-weight: 650; font-variant-numeric: tabular-nums; }
.inline-text-line:has(> [data-temporal-display]:not(:empty)) > .agenda-temporal:not(:focus):not([data-editing="true"])::-webkit-calendar-picker-indicator { opacity: 0; }

/* Schedule: durations, calculated starts, pauses, overlaps; internal owner and comment. */

.agenda-schedule { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }

.agenda-time--calculated { appearance: none; padding: 0; border: 0; background: transparent; color: var(--muted); font-weight: 500; cursor: pointer; }
span.agenda-time--calculated { cursor: default; }
button.agenda-time--calculated:hover { color: var(--ink); text-decoration: underline dotted; text-underline-offset: 3px; }
.agenda-duration-group, .agenda-duration-text { color: var(--muted); font-size: .8125rem; font-variant-numeric: tabular-nums; }
.agenda-duration-group { display: inline-flex; align-items: baseline; gap: 3px; }
.inline-text input.agenda-duration { field-sizing: content; width: auto; min-width: 2ch; max-width: 5ch; color: inherit; font-size: .8125rem; text-align: right; appearance: textfield; -moz-appearance: textfield; }
.agenda-duration::-webkit-inner-spin-button, .agenda-duration::-webkit-outer-spin-button { appearance: none; margin: 0; }
.agenda-overlap { color: #a23b2b; font-size: .75rem; font-weight: 650; }
.agenda-item--overlap:not(.agenda-item--outline)::after { background: #a23b2b; }

.agenda-pause { position: relative; margin-left: 5px; padding: 3px 0 3px 20px; color: var(--muted); font-size: .75rem; font-style: italic; }
/* Centred on the 1px timeline (and its dots), a little bolder so it reads as a gap. */
.agenda-pause::before { content: ""; position: absolute; left: -.5px; top: 0; bottom: 0; border-left: 2px dashed var(--muted); }

.agenda-internal { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; margin-top: 2px; }
.agenda-internal-field { display: flex; align-items: baseline; gap: 6px; min-width: 0; max-width: 100%; }
.owner-icon { flex: none; align-self: center; width: .8125rem; height: .8125rem; background: var(--muted); -webkit-mask: var(--owner-icon) center / contain no-repeat; mask: var(--owner-icon) center / contain no-repeat; --owner-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='5' r='3'/%3E%3Cpath d='M2 15c0-3.3 2.7-5.5 6-5.5s6 2.2 6 5.5z'/%3E%3C/svg%3E"); }
.agenda-owner, .agenda-comment { color: var(--ink); font-size: .8125rem; line-height: 1.5; }
.agenda-comment { color: var(--muted); font-style: italic; }
/* A remark about the row, not part of its content: speech-bubble mark and a note tint. */
.agenda-comment-group { padding: 0 6px; border-radius: 4px; background: color-mix(in srgb, var(--muted) 9%, transparent); }
.comment-icon { flex: none; align-self: center; width: .8125rem; height: .8125rem; background: var(--muted); -webkit-mask: var(--comment-icon) center / contain no-repeat; mask: var(--comment-icon) center / contain no-repeat; --comment-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M2 2.5A1.5 1.5 0 0 1 3.5 1h9A1.5 1.5 0 0 1 14 2.5v7a1.5 1.5 0 0 1-1.5 1.5H7l-3.5 3.5V11h0A1.5 1.5 0 0 1 2 9.5z'/%3E%3C/svg%3E"); }
.agenda-owner { font-weight: 600; }
.item-menu-internal { padding-bottom: 4px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.agenda-schedule .agenda-time { width: 5.5em; text-align: left; }

/* Links between rows of different plans (a program point and its rundown). */
.agenda-link-group { min-width: 0; }
.agenda-link { display: inline-flex; align-items: baseline; gap: 5px; min-width: 0; max-width: 100%; color: var(--green); font-size: .8125rem; line-height: 1.5; text-decoration: none; }
.agenda-link:hover .agenda-link-label, .agenda-link:focus-visible .agenda-link-label { text-decoration: underline; text-underline-offset: 3px; }
.agenda-link:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; border-radius: 2px; }
.agenda-link-label { overflow-wrap: anywhere; }
.link-icon { flex: none; align-self: center; width: .8125rem; height: .8125rem; background: currentColor; -webkit-mask: var(--link-icon) center / contain no-repeat; mask: var(--link-icon) center / contain no-repeat; --link-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M6.5 9.5l3-3M7 4.5l1.2-1.2a2.6 2.6 0 0 1 3.7 3.7L10.7 8.2M9 11.5l-1.2 1.2a2.6 2.6 0 0 1-3.7-3.7l1.2-1.2'/%3E%3C/svg%3E"); }
.inline-text input.agenda-link-input, .agenda-link-input { width: 100%; min-width: 16rem; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: .8125rem; line-height: 1.5; }
.agenda-internal:has(.agenda-link-input) .agenda-link-group { flex: 1 1 16rem; }
.agenda-item.is-linked { animation: linked-item 1.6s ease-out; }
@keyframes linked-item { from { background: var(--green-soft); } }
.details-action { padding: 0; border: 0; background: transparent; color: var(--green); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* Program ⇄ rundowns: the switching strip and a rundown's program link. */
.rundown-nav { display: flex; gap: 6px; margin: 14px 0 6px; padding-bottom: 4px; overflow-x: auto; scrollbar-width: thin; }
.rundown-nav-link { display: inline-flex; flex: none; align-items: baseline; gap: 6px; min-height: 36px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); font-size: .8125rem; font-weight: 600; text-decoration: none; white-space: nowrap; }
.rundown-nav-link:hover { border-color: var(--muted); }
.rundown-nav-link:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.rundown-nav-link.is-program { font-weight: 700; }
.rundown-nav-link.is-current { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.rundown-nav-when { color: inherit; opacity: .7; font-variant-numeric: tabular-nums; font-weight: 500; }
.program-link-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; margin-top: 4px; }
.program-link-caption { color: var(--muted); font-size: .6875rem; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; }
.program-link-edit { padding: 0; border: 0; background: transparent; color: var(--muted); font-size: .75rem; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* Compact row menu with a mouse; touch keeps 44px targets. */
.item-menu-pair { display: grid; grid-template-columns: 1fr 1fr; }
@media (pointer: fine) {
  .item-menu-popover { width: max-content; min-width: 9.5rem; max-width: 14rem; padding: 3px; }
  .item-menu-action { min-height: 30px; padding: 4px 8px; }
  .item-menu-metadata, .item-menu-internal { padding-bottom: 2px; margin-bottom: 2px; }
}
/* Touch-capable includes hybrid devices whose primary pointer is a mouse.
   Their row menu reveals every hover-only action, while drag and menu targets
   stay comfortably tappable. Desktop-only pointers remain compact. */
.agenda-editor--touch-capable .insert-controls { display: none; }
/* On touch the mark answers a finger's width around it, not just the dot. An
   inline mark (a compact row's) sits right before its title: there the
   area grows left and up/down only, never over the title. */
.agenda-editor--touch-capable .agenda-drag-mark { position: relative; }
.agenda-editor--touch-capable .agenda-drag-mark::after { content: ""; position: absolute; right: 0; top: 50%; width: 28px; height: 40px; transform: translateY(-50%); }
.agenda-editor--touch-capable .agenda-list:not(.agenda-list--compact) .agenda-item:not(.agenda-item--outline) .agenda-drag-mark::after { right: auto; left: 50%; width: 40px; transform: translate(-50%, -50%); }
.agenda-editor--touch-capable .agenda-list--compact .item-menu-trigger { width: 44px; height: 44px; }
/* Touch menus: rows that touch each other, text a size up from the inline
   additions; 36px keeps them easy to hit without the list sprawling. */
.agenda-editor--touch-capable .item-menu-action { min-height: 36px; padding: 6px 10px; font-size: .875rem; line-height: 1.3; }
/* Touch: the row being edited offers its missing fields as pills (see
   markGhostFields). Each is the empty field itself, so typing writes there;
   focused, it is a plain field again. */
.agenda-editor--touch-capable .agenda-item [data-ghost]:placeholder-shown:not(:focus) {
  width: auto; field-sizing: content; padding: 2px 9px; border-radius: 999px;
  background: var(--green-soft); cursor: text;
}
.agenda-editor--touch-capable .agenda-item [data-ghost]:placeholder-shown:not(:focus)::placeholder { color: var(--green); opacity: 1; font-style: normal; }
.agenda-editor--touch-capable .agenda-item [data-ghost].agenda-duration:placeholder-shown { min-width: 5.5em; }
.agenda-editor--touch-capable :is(.agenda-location-group, .agenda-internal-field, .agenda-duration-group):has([data-ghost]:placeholder-shown:not(:focus)) > :is(.location-marker, .owner-icon, .comment-icon, .agenda-duration-unit) { display: none; }
.agenda-editor--touch-capable :is(.agenda-location-group, .agenda-internal-field):has([data-ghost]:placeholder-shown:not(:focus)) { padding: 0; background: none; }
/* Where rows can be hovered, "+ Subline / Ort / Uhrzeit / Dauer" appear on the
   row being pointed at or edited, instead of on every row all the time. */
/* In-place additions: small, in the schedule line, never adding height. */
.item-inline-action--in-place { display: none; }
@container (min-width: 42rem) {
  .item-inline-action.item-inline-action--in-place { display: inline-flex; min-height: 0; padding: 0 4px; border-radius: 4px; font-size: .75rem; line-height: 1.5; }
}
@media (hover: hover) and (pointer: fine) {
  .item-inline-actions, .item-inline-action--in-place { opacity: 0; transition: var(--hover-fade); }
  .agenda-item:is(:hover, :focus-within) :is(.item-inline-actions, .item-inline-action--in-place),
  .agenda-item:has(.item-menu[open]) :is(.item-inline-actions, .item-inline-action--in-place) { opacity: 1; transition-delay: .12s; }
}

/* Line 2: the name, then its subline right after it (wrapping when long). */
.agenda-title-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 10px; min-width: 0; }
/* The subline sits beside the name only while it fits on that line; a
   longer one starts on its own line below instead of wrapping beside it. */
.agenda-title-line > .agenda-subtitle, .agenda-title-line > .inline-text--description { flex: 0 0 auto; min-width: 0; max-width: 100%; }
.agenda-title-line > .inline-text { min-width: 0; }
.agenda-title-line--stacked > :is(.agenda-subtitle, .inline-text--description) { flex-basis: 100%; }
/* Read-only fields hug their text too: subline after the name, duration after the time. */
.agenda-title-line > textarea.agenda-subtitle { width: auto; field-sizing: content; max-width: 100%; }
[data-read-only="true"] .agenda-schedule .agenda-time { width: auto; field-sizing: content; }

/* Visual hierarchy: the name leads; timing is quieter; details are small pills. */
.outline-schedule { align-items: flex-start; }
.outline-weekday, .outline-schedule .agenda-date { line-height: 1.5; }
.agenda-time { font-weight: 600; }
.agenda-time--calculated { font-weight: 500; }
.agenda-schedule { gap: 2px 6px; }
/* Just wide enough for the time while editing: 24h vs 12h. */
/* Typed times size to their text ("13:00", "1:30 PM"); calculated ones too. */
.agenda-schedule .inline-text input.agenda-time { width: auto; field-sizing: content; min-width: 2.8em; }
.agenda-schedule .agenda-time--calculated { width: auto; min-width: 2.8em; }
/* Times are typed; the desktop clock button only widened the field (touch keeps its picker). */
.agenda-schedule input.agenda-time::-webkit-calendar-picker-indicator { display: none; }
/* Overlaid dates and times share the line height of the text beside them. */
.temporal-display { line-height: 1.5; }
.agenda-duration-group { gap: 2px; }
.inline-text input.agenda-duration { padding: 0; }

.agenda-internal { align-items: center; gap: 4px 6px; margin-top: 4px; }
.agenda-internal-field { align-items: center; gap: 4px; min-height: 22px; padding: 0 7px; border-radius: 4px; font-size: .75rem; }
.agenda-internal :is(.agenda-location, .agenda-owner, .agenda-comment, .agenda-link) { font-size: .75rem; line-height: 1.5; }
.agenda-internal .agenda-location-group { gap: 4px; min-height: 22px; align-items: center; }
.agenda-internal .agenda-location-group .location-marker { font-size: .75rem; line-height: 1.4; }
.agenda-internal .agenda-location-group[data-location-color] { padding: 0 7px; }
.agenda-owner { font-weight: 500; }
.agenda-owner-group { background: color-mix(in srgb, var(--muted) 9%, transparent); }
.agenda-link-group { padding: 0 2px; }
.owner-icon, .comment-icon, .link-icon { width: .75rem; height: .75rem; align-self: center; }

/* Overlaid dates and times sit where the input draws its own (vertically
   centred) text, so baseline alignment with the weekday or duration holds
   for any font. */
.temporal-display { display: flex; align-items: center; }
.outline-schedule { align-items: baseline; }
.agenda-duration-group, .agenda-duration-text { line-height: 1.5; }

/* Tighter rows: timing, name and details read as one block. */
.agenda-schedule { margin-bottom: 0; }
.agenda-title-line .agenda-title, .agenda-copy > .inline-text .agenda-title { line-height: 1.25; }
.agenda-meta { margin-top: 1px; }
.agenda-internal { margin-top: 2px; }
/* Detail pills sit right under the name. */
.agenda-meta { margin-top: 0; }
.agenda-internal { margin-top: 0; }
.agenda-internal-field, .agenda-internal .agenda-location-group { min-height: 20px; }
.agenda-internal :is(.agenda-location, .agenda-owner, .agenda-comment, .agenda-link) { line-height: 1.4; }
.item-icon-action { display: inline-flex; align-items: center; gap: 2px; }
.item-icon-action .owner-icon, .item-icon-action .comment-icon { background: currentColor; }
.agenda-internal .item-inline-action--in-place { min-height: 20px; }
/* Calmer hierarchy: times are regular weight (fixed ones in ink, calculated
   ones muted); names a step smaller. */
.agenda-time, .temporal-display--time { font-weight: 500; }
.agenda-title:not(.outline-title) { font-size: 1rem; font-weight: 620; }
.agenda-title-line > textarea.agenda-title { width: auto; field-sizing: content; max-width: 100%; }
.rundown-nav-link { align-items: center; padding-block: 0; line-height: 1.2; }
/* Compact strip: small pills, weekday + time, long titles cut off. */
.rundown-nav { gap: 4px; }
.rundown-nav-link { min-height: 30px; padding: 0 10px; gap: 5px; font-size: .75rem; }
.rundown-nav-title { max-width: 11rem; overflow: hidden; text-overflow: ellipsis; }
.rundown-nav-when { font-weight: 500; }

/* Agenda icon and picker before the name. */
/* The timeline disc an icon sits in; the icon itself is 1rem. */
.agenda-list { --agenda-icon-disc: 26px; }
.agenda-icon-slot { position: relative; display: inline-flex; flex: none; }
.agenda-icon { flex: none; width: 1.4em; font-size: .95rem; line-height: 1.25; text-align: center; }
.agenda-icon-button { padding: 0; border: 0; border-radius: 4px; background: transparent; cursor: pointer; }
.agenda-icon-button:hover { background: #ebe5da; }
.agenda-icon-button.is-empty { display: grid; place-items: center; min-height: 22px; color: var(--muted); }
.agenda-icon-graphic {
  display: block; width: 1.1em; height: 1.1em; margin: auto; background: currentColor;
  -webkit-mask: var(--agenda-icon) center / contain no-repeat; mask: var(--agenda-icon) center / contain no-repeat;
}
.icon-picker-choice .agenda-icon-graphic { width: 22px; height: 22px; }
.agenda-icon-button:focus-visible { outline: 2px solid var(--green); outline-offset: 1px; }
.agenda-title-line:has(> .agenda-icon-slot, > .agenda-icon) { gap: 0 6px; }
.icon-picker {
  position: fixed; inset: auto; box-sizing: border-box; margin: 0; padding: 8px;
  width: min(300px, calc(100vw - 8px)); height: fit-content; overflow: hidden;
  border: 1px solid var(--line); border-radius: 9px; background: var(--surface);
  box-shadow: 0 8px 24px rgb(34 43 35 / 10%);
}
.icon-picker:popover-open { display: flex; flex-direction: column; gap: 6px; }
.icon-picker-results { overflow-y: auto; min-height: 0; max-height: 240px; }
.icon-picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(32px, 1fr)); gap: 2px; }
.icon-picker-choice { min-height: 32px; padding: 0; border: 0; border-radius: 6px; background: transparent; font-size: 1.05rem; cursor: pointer; filter: grayscale(1); }
.icon-picker-choice:hover, .icon-picker-choice.is-current { background: var(--green-soft); }
.icon-picker-input { min-height: 32px; min-width: 0; padding: 3px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); font-size: .875rem; }
.icon-picker-status { margin: 4px; color: var(--muted); font-size: .8125rem; }
.icon-picker-status:empty { display: none; }
.icon-picker-more, .icon-picker-remove { min-height: 30px; padding: 0 6px; border: 0; background: transparent; font-size: .8125rem; cursor: pointer; }
.icon-picker-more { width: 100%; }
.icon-picker-remove { color: #9d4334; flex: none; }
.icon-picker-row { display: flex; align-items: center; gap: 6px; }
.icon-picker-emoji { width: 6rem; }
.icon-picker-heading { margin: 4px 2px 2px; color: var(--muted); font-size: .75rem; font-weight: 650; }
.icon-picker-heading[hidden], .icon-picker-grid[hidden] { display: none; }
.icon-picker-choice--emoji { filter: none; font-size: 1.25rem; line-height: 1; }

/* Compact layout: one table-like line per point (time column, icon + name +
   subline, details); narrow screens wrap each row into two lines. */
.agenda-list--compact .agenda-item:not(.agenda-item--outline) { min-height: 0; margin-left: 0; padding-left: 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.agenda-list--compact .agenda-item:not(.agenda-item--outline)::before, .agenda-list--compact .agenda-item::after { display: none; }
.agenda-list--compact .agenda-item:not(.agenda-item--outline) .agenda-copy { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 12px; padding-block: 5px; }
.agenda-list--compact .agenda-item:not(.agenda-item--outline) .agenda-copy > .agenda-schedule { flex: 0 0 7.25rem; flex-wrap: nowrap; margin: 0; }
/* The name never shrinks below a readable width; details that do not fit
   beside it move to their own line instead of squeezing it. */
.agenda-list--compact .agenda-item:not(.agenda-item--outline) .agenda-copy > :is(.agenda-title-line, .inline-text, .agenda-title) { flex: 1 0 14rem; min-width: min(14rem, 100%); }
.agenda-list--compact .agenda-item:not(.agenda-item--outline) .agenda-copy > .agenda-meta { flex: 0 1 auto; min-width: 0; max-width: 100%; margin: 0; }
.agenda-list--compact .agenda-title:not(.outline-title) { font-size: .9375rem; }
.agenda-list--compact .item-menu-trigger { width: 32px; height: 32px; }
.agenda-list--compact .agenda-pause { margin-left: 0; padding-left: calc(7.25rem + 12px); border-bottom: 1px dashed var(--line); }
.agenda-list--compact .agenda-pause::before { display: none; }
@container (max-width: 34rem) {
  .agenda-list--compact .agenda-item:not(.agenda-item--outline) .agenda-copy > .agenda-schedule { flex-basis: auto; }
  .agenda-list--compact .agenda-item:not(.agenda-item--outline) .agenda-copy > .agenda-meta { flex-basis: 100%; }
  .agenda-list--compact .agenda-pause { padding-left: 0; }
}
.agenda-name { display: flex; align-items: baseline; gap: 6px; min-width: 0; max-width: 100%; }
.agenda-name > .inline-text, .agenda-name > .agenda-title { min-width: 0; }
.agenda-name > textarea.agenda-title { width: auto; field-sizing: content; max-width: 100%; }
/* The strip wraps instead of scrolling: no scrollbar under the pills. */
.rundown-nav { flex-wrap: wrap; overflow: visible; padding-bottom: 0; row-gap: 6px; }
.program-link-inherited { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 2px; color: var(--muted); font-size: .8125rem; }
.program-link-location { background: color-mix(in srgb, var(--muted) 9%, transparent); }
/* "+ Subline" takes no room until the row is pointed at, so a long name
   never gains an invisible extra line. */
@media (hover: hover) and (pointer: fine) {
  .agenda-title-line > .item-inline-action--in-place { display: none; }
  .agenda-item:is(:hover, :focus-within) .agenda-title-line > .item-inline-action--in-place,
  .agenda-item:has(.item-menu[open]) .agenda-title-line > .item-inline-action--in-place { display: inline-flex; }
}
@container (max-width: 42rem) { .agenda-title-line > .item-inline-action--in-place { display: none !important; } }
/* Icons take the dot's place on the timeline (names stay left-aligned), as
   small tinted discs: the tint says the kind, the greyscale icon the type.
   In compact rows they get a narrow column of their own. */
[data-icon-tone="food"] { --icon-tone: #a47d30; }
[data-icon-tone="welcome"] { --icon-tone: #c8614e; }
[data-icon-tone="content"] { --icon-tone: #5883b1; }
[data-icon-tone="spirit"] { --icon-tone: #8066a5; }
[data-icon-tone="activity"] { --icon-tone: #4e8a70; }
[data-icon-tone="logistics"], [data-icon-tone=""] { --icon-tone: #66716d; }
/* Colours chosen in the plan's colour map (Details → Farben). */
[data-icon-color="red"], [data-location-display][data-location-color="red"] { --icon-tone: #c8614e; --location-accent: #c8614e; }
[data-icon-color="blue"], [data-location-display][data-location-color="blue"] { --icon-tone: #5883b1; --location-accent: #5883b1; }
[data-icon-color="violet"], [data-location-display][data-location-color="violet"] { --icon-tone: #8066a5; --location-accent: #8066a5; }
[data-icon-color="amber"], [data-location-display][data-location-color="amber"] { --icon-tone: #a47d30; --location-accent: #a47d30; }
[data-icon-color="green"], [data-location-display][data-location-color="green"] { --icon-tone: #4e8a70; --location-accent: #4e8a70; }
[data-icon-color="plum"], [data-location-display][data-location-color="plum"] { --icon-tone: #9a628a; --location-accent: #9a628a; }
[data-icon-color="grey"], [data-location-display][data-location-color="grey"] { --icon-tone: #66716d; --location-accent: #66716d; }
.agenda-list:not(.agenda-list--compact) .agenda-item:not(.agenda-item--outline) .agenda-icon-slot {
  position: absolute; z-index: 1; left: calc(var(--agenda-icon-disc) / -2); top: calc(var(--agenda-mark-center) - var(--agenda-icon-disc) / 2);
  display: grid; place-items: center; width: var(--agenda-icon-disc); height: var(--agenda-icon-disc); border-radius: 50%;
  background: color-mix(in srgb, var(--icon-tone, var(--muted)) 38%, var(--paper));
  outline: 2px solid var(--paper);
}
.agenda-list:not(.agenda-list--compact) .agenda-item:not(.agenda-item--outline) .agenda-icon-slot .agenda-icon {
  width: var(--agenda-icon-disc); font-size: 1rem; line-height: var(--agenda-icon-disc); filter: grayscale(1) brightness(.45) contrast(1.3); opacity: .8;
}

/* The disc is the button: hover rings the whole disc, not a box inside it. */
.agenda-list:not(.agenda-list--compact) .agenda-item:not(.agenda-item--outline) .agenda-icon-slot > .agenda-icon-button:not(.is-empty) {
  height: 100%; border-radius: 50%;
}
.agenda-list:not(.agenda-list--compact) .agenda-item:not(.agenda-item--outline) .agenda-icon-slot > .agenda-icon-button:not(.is-empty):hover { background: transparent; }
.agenda-list:not(.agenda-list--compact) .agenda-item:not(.agenda-item--outline) .agenda-icon-slot:has(> .agenda-icon-button:not(.is-empty):hover) {
  outline-color: var(--muted);
}

/* An icon that appears once: a plain disc, no colour. */
.agenda-list:not(.agenda-list--compact) .agenda-item:not(.agenda-item--outline) .agenda-icon-slot[data-icon-tone="none"] {
  background: var(--paper); box-shadow: inset 0 0 0 1px var(--line);
}
.plan-color-map { display: grid; gap: 2px; margin-top: 12px; }
.plan-color-map .plan-format-field { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 8.5rem); align-items: center; gap: 8px; }
.plan-color-map .plan-format-field > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plan-color-map select { width: 100%; min-width: 0; min-height: 28px; padding: 2px 6px; font-size: .75rem; }
.plan-format-subheading { margin: 0; color: var(--muted); font-size: .75rem; font-weight: 650; }
.agenda-list:not(.agenda-list--compact) .agenda-item--icon::after { display: none; }
.agenda-list:not(.agenda-list--compact) .agenda-name { gap: 0; }
.agenda-list--compact .agenda-name { display: grid; grid-template-columns: 1.4rem minmax(0, 1fr); gap: 0 4px; }
.agenda-list--compact .agenda-name:not(:has(.agenda-icon-slot))::before { content: ""; }
.agenda-list--compact .agenda-icon { filter: grayscale(1); opacity: .75; }
/* A row's timeline mark (dot, icon disc, the dot's hover box) centres on
   the name, or on time and name together when a row has both. */
.agenda-list:not(.agenda-list--compact) .agenda-item:not(.agenda-item--outline) {
  --agenda-mark-center: calc(var(--agenda-row-space) + .625rem);
}
.agenda-list:not(.agenda-list--compact) .agenda-item--scheduled:not(.agenda-item--outline) {
  --agenda-mark-center: calc(var(--agenda-row-space) + (.8125rem * 1.5 + 1.25rem) / 2);
}
/* The plain dot follows it outside the presenter, which places its own marks. */
:where(.app-shell:not(.app-shell--presenter)) .agenda-list:not(.agenda-list--compact) .agenda-item:not(.agenda-item--outline)::after {
  top: calc(var(--agenda-mark-center) - 3.5px);
}
/* So does the runline where a run begins or ends (first row, after or
   before a section): it starts and stops at the mark's centre, under the
   dot or disc, so the gap each mark leaves around it is the same above and
   below, with or without a time or an icon. */
:where(.app-shell:not(.app-shell--presenter)) .agenda-list:not(.agenda-list--compact) :is(.agenda-item:first-child, .agenda-item--outline + .agenda-item):not(.agenda-item--outline)::before {
  top: var(--agenda-mark-center);
}
:where(.app-shell:not(.app-shell--presenter)) .agenda-list:not(.agenda-list--compact) .agenda-item:not(.agenda-item--outline):has(+ .agenda-item--outline)::before {
  bottom: calc(100% - var(--agenda-mark-center));
}

/* Give the existing timeline dot a hit area without drawing over it, centred
   on the dot (7px at left -3px: centre .5px; vertically the row's mark centre). */
.agenda-list:not(.agenda-list--compact) .agenda-item:not(.agenda-item--outline) .agenda-icon-slot:has(> .is-empty) {
  --agenda-dot-hit: 22px;
  left: calc(.5px - var(--agenda-dot-hit) / 2); top: calc(var(--agenda-mark-center) - var(--agenda-dot-hit) / 2);
  width: var(--agenda-dot-hit); height: var(--agenda-dot-hit);
  background: transparent; outline: 0;
}
.agenda-list:not(.agenda-list--compact) .agenda-item:not(.agenda-item--outline) .agenda-icon-slot > .agenda-icon.is-empty {
  width: 100%; height: 100%; min-height: 0;
}
.agenda-icon-button.is-empty:hover { background: transparent; box-shadow: inset 0 0 0 1px var(--muted); }
.agenda-list--compact .agenda-item:not(.agenda-item--outline) .agenda-icon-button.is-empty::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor;
}
/* A section gets no dot: while its picker is open without an icon, the
   empty trigger it anchors to stays invisible. */
.agenda-item--outline .agenda-icon-button.is-empty { visibility: hidden; }

/* The saved/saving mark sits as a small superscript at the field's top-right,
   never over the text that follows ("min", the next pill). */
.inline-feedback { top: -.55em; inset-inline-start: calc(100% - 3px); width: 10px; font-size: 9px; line-height: 1; pointer-events: none; }
/* Rundown pills are quieter than the program and the current page. */
.rundown-nav-link:not(.is-program):not(.is-current) { min-height: 26px; padding: 0 8px; border-color: color-mix(in srgb, var(--line) 70%, transparent); color: var(--muted); font-size: .6875rem; }
.rundown-nav-link:not(.is-program):not(.is-current) .rundown-nav-title { font-weight: 600; }
.rundown-nav-link:not(.is-program):not(.is-current):hover { color: var(--ink); }
.rundown-nav { align-items: center; }

/* "Saved" is a short green wash over the field that fades out, not a tick
   floating beside it. Errors keep their visible mark and retry. */
/* Still announced to screen readers ("Gespeichert"), just not drawn. */
.inline-feedback[data-state="saved"], .inline-feedback[data-state="saving"] { width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.inline-text-line:has(> .inline-feedback[data-state="saved"]) > [data-inline-field]:not(:focus) {
  animation: inline-saved 1.1s ease-out;
}
@keyframes inline-saved {
  0% { background-color: color-mix(in srgb, var(--green) 22%, transparent); }
  100% { background-color: transparent; }
}
@media (prefers-reduced-motion: reduce) {
  .inline-text-line:has(> .inline-feedback[data-state="saved"]) > [data-inline-field]:not(:focus) { animation: none; }
}


/* Share panel. */
.share-panel { position: fixed; inset: auto; margin: 0; width: min(300px, calc(100vw - 16px)); padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: 0 12px 32px rgb(34 43 35 / 12%); }
.share-heading { margin: 0 0 8px; font-size: .9375rem; }
.share-option { display: flex; align-items: center; gap: 8px; min-height: 30px; font-size: .8125rem; cursor: pointer; }
.share-option[hidden] { display: none; }
.share-option input { margin: 0; accent-color: var(--green); }
.share-group { margin: 8px 0; padding: 6px 10px 8px; border: 1px solid var(--line); border-radius: 8px; }
.share-group legend { padding: 0 4px; color: var(--muted); font-size: .75rem; font-weight: 650; }
.share-rundown-list { margin: 0 0 4px 22px; }
.share-rundown-list[hidden] { display: none; }
.share-copy { width: 100%; min-height: 36px; margin-top: 6px; border: 0; border-radius: 8px; background: var(--ink); color: var(--paper); font-weight: 650; cursor: pointer; }
.share-status { min-height: 1.2em; margin: 6px 0 0; color: var(--green); font-size: .75rem; }
.share-note { margin: 4px 0 0; color: var(--muted); font-size: .6875rem; }
.share-panel { max-height: calc(100vh - 80px); overflow-y: auto; }
.share-name { width: 100%; box-sizing: border-box; min-height: 32px; margin: 0 0 4px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); font: inherit; font-size: .8125rem; }
.share-option input:disabled + span { color: var(--muted); }
.share-links[hidden] { display: none; }
.share-subheading { margin: 12px 0 4px; color: var(--muted); font-size: .75rem; font-weight: 650; }
.share-link-list { margin: 0; padding: 0; list-style: none; }
.share-link-item { display: flex; flex-direction: column; gap: 4px; padding: 6px 0; border-top: 1px solid var(--line); }
.share-link-text { display: flex; flex-direction: column; min-width: 0; }
.share-link-text strong { font-size: .8125rem; font-weight: 600; overflow-wrap: anywhere; }
.share-link-text small { color: var(--muted); font-size: .6875rem; }
.share-link-actions { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.share-link-action { padding: 0; border: 0; background: none; color: var(--green); font: inherit; font-size: .75rem; font-weight: 600; cursor: pointer; }
.share-link-revoke { color: var(--accent-dark); }

/* Shared (read-only) pages: fields read as plain text. No caret, focus ring,
   editing background or text cursor; text can still be selected and copied. */
[data-read-only="true"] :is(input, textarea)[readonly] { cursor: default; caret-color: transparent; }
[data-read-only="true"] :is(input, textarea)[readonly]:is(:focus, :focus-visible) { outline: none; background: transparent; box-shadow: none; }

/* A question in a field is still open: its text turns reddish. A leading '
   (literal text) turns this off. */
.is-question, .is-question::placeholder { color: color-mix(in srgb, var(--accent-dark) 85%, var(--ink, #1f2a26)); }

/* Link picker: matching plans or program points right under a link field. */
.has-link-picker { position: relative; }
.link-picker {
  position: absolute; z-index: 30; top: 100%; left: 0; margin: 0.25rem 0 0; padding: 0.25rem;
  min-width: min(22rem, 90vw); max-height: 18rem; overflow-y: auto; list-style: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: 0.5rem;
  box-shadow: 0 0.5rem 1.5rem rgb(0 0 0 / 0.12);
}
.link-picker[hidden] { display: none; }
.link-picker-option { display: flex; flex-direction: column; gap: 0.05rem; padding: 0.35rem 0.5rem; border-radius: 0.35rem; cursor: pointer; }
.link-picker-option:hover, .link-picker-option:focus { background: color-mix(in srgb, var(--accent) 10%, transparent); outline: none; }
.link-picker-label { font-size: 0.9rem; }
.link-picker-detail, .link-picker-empty { font-size: 0.78rem; color: var(--muted); }
.link-picker-empty { padding: 0.35rem 0.5rem; }
.link-picker-heading { padding: 0.45rem 0.5rem 0.15rem; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.02em; color: var(--muted); }
.link-picker-option--plan .link-picker-label { font-weight: 600; }
.link-picker-option--back .link-picker-label { font-size: 0.8rem; color: var(--muted); }

/* An account jenda opened without a link that covers it. */
.shared-only { max-width: 36rem; margin: 4rem auto; padding: 0 16px; }
.shared-only h1 { font-size: 1.5rem; margin: 0 0 0.75rem; }
.shared-only p { color: var(--muted); }

/* Presence: who else has the plan open (#159). */
.presence { margin-top: .4rem; font-size: .78rem; color: var(--muted); }
.presence ul { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin: 0; padding: 0; list-style: none; }
.presence-person { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .5rem .15rem .2rem; border-radius: 999px; background: #eef1ee; font-weight: 600; }
.presence-dot { display: inline-grid; place-items: center; width: 1.3rem; height: 1.3rem; border-radius: 50%; color: #fff; font-size: .7rem; font-weight: 700; background: #49735f; }
.presence-person[data-color="coral"] .presence-dot { background: #c2573f; }
.presence-person[data-color="blue"] .presence-dot { background: #3d6a9e; }
.presence-person[data-color="amber"] .presence-dot { background: #a5761d; }
.presence-person[data-color="violet"] .presence-dot { background: #7556a3; }
.presence-person[data-color="teal"] .presence-dot { background: #2f7f7a; }
.presence-person[data-kind="ai"] .presence-dot { background: #1f2d27; }
.presence-viewers, .presence-count { padding: .15rem .3rem; }

/* Presenter view (present=1): the agenda on a screen. Type is in rem, so the
   root size scales the whole page with the screen. */
html:has(.app-shell--presenter) { font-size: clamp(16px, .9vw + .55rem, 40px); }
.app-shell--presenter { width: min(calc(100% - 4vw), 1600px); padding-bottom: 30vh; }
.app-shell--presenter > :is(.topbar, .flash, .rundown-nav, .mini-app-access) { display: none; }
.presenter-bar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding-block: .75rem; background: var(--paper);
}
.presenter-clock { font-size: 2.6rem; font-weight: 750; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1; }
.presenter-actions { display: flex; gap: .5rem; transition: opacity .4s ease, visibility 0s; }
html:has(.app-shell--presenter.is-idle) { cursor: none; scrollbar-width: none; }
html:has(.app-shell--presenter.is-idle)::-webkit-scrollbar { display: none; }
.app-shell--presenter.is-idle .presenter-actions { opacity: 0; visibility: hidden; transition: opacity .4s ease, visibility 0s .4s; }
.presenter-action {
  min-width: 44px; min-height: 44px; padding: 0; border: 1px solid var(--line); border-radius: 6px;
  color: var(--muted); background: var(--surface); font-size: 1.1rem; line-height: 1; text-decoration: none; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.presenter-action:hover { color: var(--ink); }
.presenter-action:hover { border-color: var(--green); }
.presenter-action:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.app-shell--presenter .plan-heading { padding-top: 0; }
.app-shell--presenter .plan-title { font-size: 2.4rem; }
.app-shell--presenter .agenda-title { font-size: 1.35rem; }
.app-shell--presenter .agenda-subtitle { font-size: 1rem; }
.app-shell--presenter .agenda-time { font-size: 1rem; }
.app-shell--presenter .agenda-item { transition: opacity .4s ease, background-color .4s ease; border-radius: 0 8px 8px 0; scroll-margin-top: 6rem; }
.app-shell--presenter :is(.agenda-item.is-presenter-past, .agenda-pause.is-presenter-folded, .is-presenter-gone) { display: none; }
/* Past points as one line of titles. When too long, it aligns to the end, so
   the newest stay readable and the oldest are clipped (and faded) on the left. */
.presenter-ticker {
  position: relative; margin-left: 5px; padding: .35rem 0 .35rem 20px;
  color: var(--muted); font-size: .95rem;
}
.presenter-ticker-clip { display: flex; justify-content: flex-start; overflow: hidden; white-space: nowrap; }
.presenter-ticker.is-overflowing .presenter-ticker-clip { justify-content: flex-end; }
.presenter-ticker::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 1px; background: var(--line); }
.presenter-ticker-text { flex: none; display: inline-flex; align-items: center; }
.presenter-ticker-dot { width: .4em; height: .4em; margin-inline: .6em; border-radius: 50%; background: currentColor; opacity: .55; flex: none; }
.presenter-ticker.is-overflowing .presenter-ticker-clip { mask-image: linear-gradient(to right, transparent, #000 4rem); }
.app-shell--presenter .agenda-item.is-presenter-now { background: #e6eed8; }
.app-shell--presenter .agenda-item.is-presenter-now .agenda-title { font-size: 1.7rem; }

/* The current and next point colour their stretch of the timeline, centred on its dot. */
.app-shell--presenter .agenda-item:is(.is-presenter-now, .is-presenter-next)::before { left: -1.5px; width: 4px; border-radius: 2px; }
.app-shell--presenter .agenda-item:is(.is-presenter-now, .is-presenter-next)::after { left: -4px; width: 9px; height: 9px; top: calc(var(--agenda-dot-offset) - 2px); outline: 0; }
/* The current point's dot runs down its line as its time passes: run in full
   colour above it, still to come lighter below. */
.app-shell--presenter :is(.agenda-item.is-presenter-now, .agenda-pause.is-presenter-pause) {
  /* From its own dot to the next marker's dot (set by presenter.js), so the run hands over. */
  --presenter-dot-top: calc(var(--presenter-dot-start, calc(var(--agenda-dot-offset) - 2px)) + var(--presenter-progress, 0) * (var(--presenter-dot-end, calc(100% - 9px)) - var(--presenter-dot-start, calc(var(--agenda-dot-offset) - 2px))));
}
.app-shell--presenter .agenda-item.is-presenter-now::before {
  background: linear-gradient(var(--green) calc(var(--presenter-dot-top) + 4px), color-mix(in srgb, var(--green) 30%, transparent) 0);
}
.app-shell--presenter .agenda-item.is-presenter-now::after { background: var(--green); top: var(--presenter-dot-top); transition: top 1s linear; z-index: 2; }
/* The playhead: a ring around the running dot. */
.app-shell--presenter :is(.agenda-item.is-presenter-now, .agenda-pause.is-presenter-pause)::after {
  box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px color-mix(in srgb, var(--green) 55%, transparent);
  animation: presenter-playhead 2.4s ease-in-out infinite;
}
.app-shell--presenter .agenda-item.is-presenter-now::after { box-shadow: 0 0 0 3px #e6eed8, 0 0 0 5px color-mix(in srgb, var(--green) 55%, transparent); }
@keyframes presenter-playhead { 50% { outline: 6px solid color-mix(in srgb, var(--green) 12%, transparent); outline-offset: 3px; } }
/* A running pause: its dot runs down the dashed line into the next point. */
.app-shell--presenter .agenda-pause.is-presenter-pause { color: var(--green); }
.app-shell--presenter .agenda-pause.is-presenter-pause::before { border-left-color: var(--green); }
.app-shell--presenter .agenda-pause.is-presenter-pause::after {
  content: ""; position: absolute; left: -4px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--green); top: var(--presenter-dot-top); transition: top 1s linear; z-index: 2;
}
@media (prefers-reduced-motion: reduce) {
  .app-shell--presenter :is(.agenda-item.is-presenter-now, .agenda-pause.is-presenter-pause)::after { animation: none; transition: none; }
}
::view-transition-group(*) { animation-duration: .6s; }
.app-shell--presenter .agenda-item.is-presenter-next::before, .app-shell--presenter .agenda-item.is-presenter-next::after { background: #2563a6; }
/* The row's own ::before/::after draw the timeline; the label sits on its copy. */
.app-shell--presenter .agenda-item:is(.is-presenter-now, .is-presenter-next) > .agenda-copy::before {
  position: absolute; top: .55rem; right: .75rem;
  font-size: .75rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
}
.app-shell--presenter .agenda-item.is-presenter-now > .agenda-copy::before { content: "Jetzt"; color: var(--green); }
.app-shell--presenter .agenda-item.is-presenter-next > .agenda-copy::before { content: "Als Nächstes"; color: #2563a6; }
/* The live panel speaks for itself on a screen: NOW and UP NEXT, large. */
.app-shell--presenter .live-panel { border: 0; padding-block: 0 1rem; }
.app-shell--presenter :is(.live-heading, .live-clock-row, .live-note, .live-history) { display: none; }
.app-shell--presenter .live-halves { margin-top: 0; }
.app-shell--presenter .live-half h3 { font-size: .9rem; }
.app-shell--presenter .live-item strong { font-size: 2rem; line-height: 1.15; }
.app-shell--presenter .live-item > span, .app-shell--presenter .live-item p { font-size: 1rem; }
.app-shell--presenter .live-announcement { font-size: 1.3rem; }
@media (max-width: 720px) {
  .presenter-clock { font-size: 2rem; }
  .app-shell--presenter .plan-title { font-size: 1.8rem; }
}
/* Dots follow the scaled time line (1rem at line-height 1.5). */
.app-shell--presenter .agenda-list { --agenda-dot-offset: calc(var(--agenda-row-space) + .75rem); }
/* Room for the dot to run through a pause. */
.app-shell--presenter .agenda-pause { padding-block: .6rem; }

/* Layout check (toggled in agenda_editor.js): every hover-only control at once. */
.agenda-editor--reveal-all .insert-controls { opacity: 1; pointer-events: auto; }
.agenda-editor--reveal-all :is(.item-inline-actions, .item-inline-action--in-place),
.agenda-editor--reveal-all .agenda-move { opacity: 1; visibility: visible; }
.agenda-editor--reveal-all .agenda-icon-slot:has(> .agenda-drag-mark:not(.is-empty)) { outline-color: var(--muted); }
@media (hover: hover) and (pointer: fine) {
  .agenda-editor--reveal-all .agenda-title-line > .item-inline-action--in-place { display: inline-flex; }
}
