.button.agenda-launch {
  flex: none;
  min-height: 44px;
  padding-inline: 10px;
  border-color: var(--control-border, var(--edge));
  background: var(--control-paper, var(--paper));
  color: var(--season-dark, var(--ink));
  white-space: nowrap;
}

@media (max-width: 530px) {
  .tray-toolbar:has(.agenda-launch) { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .tray-toolbar:has(.agenda-launch) .tray-heading-row { flex-direction: row; align-items: center; gap: 8px; }
  .tray-toolbar:has(.agenda-launch) .agenda-launch { margin-inline-start: auto; }
  .tray-toolbar:has(.agenda-launch) .tray-controls { grid-row: 2; justify-content: space-between; }
}

.agenda-dialog[open] {
  --agenda-line: color-mix(in srgb, var(--season-rim, #d6b69c) 42%, var(--paper));
  --agenda-wash: color-mix(in srgb, var(--season-pale, #f5e9df) 68%, var(--paper));
  --agenda-card: color-mix(in srgb, var(--paper) 77%, white);
  --agenda-accent: var(--season-dark, var(--ink));
  display: flex;
  flex-direction: column;
  width: min(640px, calc(100% - 32px));
  max-height: min(87dvh, 780px);
  max-width: 100%;
  padding: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scroll-padding-block: 82px 18px;
  border: 1px solid var(--agenda-line);
  border-radius: 22px 26px 24px 22px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 20px 74px #3428243d;
}

body:has(.agenda-dialog[open]) { overflow: hidden; }
.agenda-dialog::backdrop { background: #3c302d59; backdrop-filter: blur(3px); }

.agenda-header {
  position: sticky;
  inset-block-start: 0;
  z-index: 2;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 72px;
  padding: 12px clamp(16px, 4vw, 27px);
  border-bottom: 1px solid var(--agenda-line);
  background: linear-gradient(110deg, var(--agenda-wash), var(--paper));
  color: var(--agenda-accent);
}

.agenda-header h2 { font-size: clamp(1.26rem, 4vw, 1.52rem); font-weight: 730; }
.agenda-header .agenda-close { flex: none; width: 44px; min-height: 44px; }
.agenda-body { min-width: 0; padding: 18px clamp(16px, 4vw, 27px) 25px; }

.agenda-search-field {
  display: flex;
  align-items: center;
  min-width: 0;
  border: 1px solid var(--agenda-line);
  border-radius: 13px;
  background: var(--agenda-card);
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.agenda-search-field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}

.agenda-search {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding-inline-start: 13px;
  color: var(--muted);
}

.agenda-search-icon { display: inline-flex; flex: none; color: var(--agenda-accent); }
.agenda-search input {
  flex: 1;
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 6px 9px 6px 0;
  border: 0;
  border-radius: 8px;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 1rem;
}

body[data-season] .agenda-search input:focus-visible { outline: 0; }
.agenda-search input::placeholder { color: var(--muted); opacity: .86; }
.agenda-search input::-webkit-search-cancel-button { display: none; }

.agenda-clear {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  min-height: 44px;
  margin-inline-end: 2px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: .79rem;
}

.agenda-controls { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 12px; margin-block: 13px 8px; }
.agenda-segmented, .agenda-filters { display: flex; min-width: 0; }
.agenda-segmented { gap: 2px; padding: 2px; border: 1px solid var(--agenda-line); border-radius: 12px; background: var(--agenda-wash); }
.agenda-filters { gap: 3px; justify-content: flex-end; }

.agenda-controls .button {
  min-height: 44px;
  min-width: 44px;
  padding: 4px 10px;
  border-color: transparent;
  white-space: nowrap;
  background: transparent;
  color: var(--muted);
  font-size: .8rem;
}

.agenda-segmented .button { border-radius: 9px; }
.agenda-segmented .button[aria-pressed="true"] {
  border-color: var(--agenda-line);
  background: var(--agenda-card);
  color: var(--agenda-accent);
  box-shadow: 0 2px 5px #432f2310;
}
.agenda-filters .button { border-radius: 22px; }
.agenda-filters .button[aria-pressed="true"] { border-color: var(--agenda-accent); background: var(--agenda-accent); color: #fffaf4; }

.agenda-status {
  margin-block: 4px 11px;
  color: var(--muted);
  font-size: .79rem;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.agenda-status:empty { display: none; }
.agenda-list, .agenda-items { margin: 0; padding: 0; list-style: none; }
.agenda-list { display: grid; gap: 16px; }
.agenda-group, .agenda-items > li { min-width: 0; }

.agenda-group-date {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin-block: 0 6px;
  padding-inline: 3px;
  color: var(--agenda-accent);
  font-size: .89rem;
  font-weight: 690;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
}
.agenda-group-date > span { color: var(--muted); font-size: .75rem; font-weight: 500; }

.agenda-items { border: 1px solid var(--agenda-line); border-radius: 12px; background: var(--agenda-card); }
.agenda-items > li + li { border-top: 1px solid var(--agenda-line); }

.agenda-row {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 58px;
  padding: 8px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  text-align: start;
  transition: background-color 170ms ease;
}

.agenda-item-copy { flex: 1; display: grid; gap: 3px; min-width: 0; }
.agenda-item-title { font-size: .95rem; font-weight: 665; line-height: 1.3; overflow-wrap: anywhere; }
.agenda-row[data-done="true"] .agenda-item-title, .agenda-row.is-done .agenda-item-title { color: var(--muted); text-decoration: line-through; }
.agenda-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; min-width: 0; color: var(--muted); font-size: .75rem; }
.agenda-item-kind { color: var(--agenda-accent); font-weight: 620; }
.agenda-item-time { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.agenda-item-avatars { flex: none; display: inline-flex; align-items: center; gap: 2px; }
.agenda-item-avatars .author-badge { display: inline-grid; place-items: center; min-width: 21px; height: 21px; padding: 0 3px; }
.agenda-item-avatars .author-badge.has-photo { width: 24px; min-width: 24px; height: 24px; padding: 0; }
.agenda-item-chevron { flex: none; display: inline-flex; color: var(--muted); }

.agenda-empty {
  padding: 22px 14px;
  border: 1px dashed var(--agenda-line);
  border-radius: 12px;
  background: var(--agenda-card);
  color: var(--muted);
  text-align: center;
  font-size: .86rem;
  overflow-wrap: anywhere;
}
.agenda-more { display: flex; min-height: 44px; margin: 16px auto 0; }

@media (hover: hover) and (pointer: fine) {
  .agenda-clear:hover, .agenda-row:hover { background: var(--agenda-wash); }
  .agenda-controls .button[aria-pressed="false"]:hover { background: var(--agenda-wash); border-color: var(--agenda-line); }
  .agenda-filters .button[aria-pressed="true"]:hover { background: var(--agenda-accent); border-color: var(--agenda-accent); }
}

@media (prefers-reduced-motion: no-preference) {
  .agenda-dialog[open] { animation: agenda-arrive 250ms var(--control-ease, ease-out) both; }
  @keyframes agenda-arrive { from { opacity: 0; transform: translateY(5px); } }
}

@media (prefers-reduced-motion: reduce) {
  .agenda-dialog :is(.button, .agenda-search-field, .agenda-row) { transition: none; }
}

@media (max-width: 830px) {
  .agenda-dialog[open] {
    position: fixed;
    inset: auto 0 0;
    width: min(100%, 580px);
    max-height: min(88dvh, 780px);
    margin: 0 auto;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    border-radius: 20px 20px 0 0;
    scroll-padding-block-start: 69px;
  }
  .agenda-header { min-height: 66px; padding-block: 10px; }
  .agenda-body { padding-block-start: 13px; }
}

@media (max-width: 490px) {
  .agenda-controls { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .agenda-segmented, .agenda-filters { justify-content: start; width: fit-content; max-width: 100%; }
  .agenda-filters { gap: 2px; }
  .agenda-row { gap: 6px; padding-inline: 9px; }
}
