/* ---------- shared bits used by the calendar, event editor and courses ---------- */
.row.between { justify-content: space-between; }
.grid-2 { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 520px) { .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.label-like { display: block; font-weight: 700; margin-bottom: 4px; }
.pre-wrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.plain-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }

.swatches { display: flex; gap: 4px; flex-wrap: wrap; }
.swatch {
  width: 44px; height: 44px; border-radius: 50%; border: 3px solid transparent; background: transparent; padding: 0;
  display: grid; place-items: center; cursor: pointer; position: relative; color: #fff;
}
.swatch::before { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: var(--sw); }
.swatch .icon { position: relative; }
.swatch[aria-checked="true"] { border-color: var(--ink); }

.kind-tile {
  --ev: var(--c-blue);
  flex: none; width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center;
  color: var(--ev); background: color-mix(in srgb, var(--ev) 18%, var(--surface));
}

.chip-day {
  min-width: 44px; min-height: 44px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface-2); font-weight: 700; cursor: pointer;
}
.chip-day[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.weekday-chips { display: flex; gap: 4px; flex-wrap: wrap; }
.reminder-list { display: grid; gap: 0 16px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.reminder-list legend, .reminder-list .field-hint { grid-column: 1 / -1; }

.course-row {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; min-height: 56px; padding: 10px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer;
}
.course-row:hover { background: var(--surface-2); }
.dot { width: 14px; height: 14px; border-radius: 50%; flex: none; }

/* ---------- calendar screen ---------- */
.cal { display: grid; gap: 12px; }
.cal-toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); }
.seg-btn { min-height: 44px; padding: 8px 14px; border: 0; background: none; font-weight: 700; cursor: pointer; border-right: 1px solid var(--line); }
.seg-btn:last-child { border-right: 0; }
.seg-btn[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); }
.cal-nav { display: flex; align-items: center; gap: 8px; }
.cal-title { flex: 1; text-align: center; font-size: 1.2rem; }
@media (max-width: 719px) {
  .cal-toolbar .btn span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .cal-toolbar .btn-primary span { position: static; width: auto; height: auto; clip: auto; }
  .seg { flex: 1 1 100%; }
  .seg-btn { flex: 1; padding-inline: 4px; }
}
.hint-card {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 14px 16px;
  background: var(--brand-soft); border: 1px solid var(--line); border-radius: 16px;
}
.hint-card p { margin: 0; }

/* ---------- list rows ---------- */
.ev-list { display: grid; gap: 8px; }
.ev-row {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 10px 12px; min-height: 56px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; color: var(--ink);
}
.ev-row:hover { background: var(--surface-2); }
.ev-text { display: grid; min-width: 0; flex: 1; }
.ev-title { font-weight: 700; overflow-wrap: anywhere; }
.ev-title.done { text-decoration: line-through; color: var(--muted); }
.ev-time, .ev-course, .ev-loc { color: var(--muted); font-size: 0.9375rem; }
.ev-course { font-weight: 700; font-size: 0.8125rem; }
.ev-loc { display: flex; align-items: center; gap: 4px; font-size: 0.8125rem; }
.ev-done { color: var(--ok); }

/* ---------- month ---------- */
.month-head, .month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.month-head span { text-align: center; font-size: 0.8125rem; font-weight: 700; color: var(--muted); padding: 4px 0; }
.mcell {
  display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 56px; padding: 4px 2px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; cursor: pointer; color: var(--ink); min-width: 0;
}
.mcell.out { background: transparent; color: var(--muted); }
.mcell[aria-pressed="true"] { border: 2px solid var(--brand); background: var(--brand-soft); }
.mnum { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; font-weight: 400; }
.mcell.today .mnum { background: var(--brand); color: var(--brand-ink); font-weight: 700; }
.mdots { display: flex; gap: 3px; align-items: center; height: 8px; }
.mdot { width: 6px; height: 6px; border-radius: 50%; background: var(--ev); }
.mplus { font-size: 0.6875rem; line-height: 1; }
.mchips { display: none; }
.day-panel { margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--line); display: grid; gap: 10px; }

@media (min-width: 720px) {
  .mcell { align-items: stretch; min-height: 96px; padding: 6px; text-align: left; }
  .mnum { align-self: flex-start; }
  .mdots { display: none; }
  .mchips { display: grid; gap: 2px; }
  .mchip {
    display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.8125rem; font-weight: 700;
    padding: 1px 6px; border-radius: 5px; border-left: 3px solid var(--ev);
    background: color-mix(in srgb, var(--ev) 20%, var(--surface));
  }
  .mchip.done { text-decoration: line-through; opacity: 0.7; }
  .mmore { font-size: 0.75rem; color: var(--muted); padding-left: 4px; }
}

/* ---------- week and day ---------- */
.tg { --gutter-w: 48px; --hour-h: calc(56px * var(--note-scale, 1)); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.tg-row { display: grid; align-items: start; }
.tg-head { padding: 6px 0; border-bottom: 1px solid var(--line); }
.tg-dayhead { display: grid; justify-items: center; gap: 2px; background: none; border: 0; padding: 2px; color: var(--ink); min-height: 44px; }
button.tg-dayhead { cursor: pointer; border-radius: 8px; }
button.tg-dayhead:hover { background: var(--surface-2); }
.tg-dayhead .wd { font-size: 0.75rem; color: var(--muted); }
.tg-dayhead .dn { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; font-weight: 700; }
.tg-dayhead .dn.today { background: var(--brand); color: var(--brand-ink); }
.tg-allday { padding: 4px 0 6px; border-bottom: 1px solid var(--line); }
.tg-label { font-size: 0.6875rem; color: var(--muted); text-align: right; padding-right: 6px; }
.tg-allday-col { display: grid; gap: 2px; padding: 0 1px; min-width: 0; }
.tg-chip {
  display: flex; align-items: center; gap: 3px; width: 100%; min-height: 24px; padding: 2px 4px; border: 0; border-radius: 5px; cursor: pointer;
  color: var(--ink); font-size: 0.75rem; font-weight: 700; text-align: left; background: color-mix(in srgb, var(--ev) 22%, var(--surface));
}
.tg-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tg-scroll { overflow-y: auto; max-height: calc(100dvh - 330px); min-height: 320px; position: relative; }
.tg-body { position: relative; height: calc(var(--hour-h) * 24); }
.tg-hours { position: absolute; inset: 0; }
.tg-hour { height: var(--hour-h); border-top: 1px solid var(--line); position: relative; }
.tg-hour:first-child { border-top-color: transparent; }
.tg-hour-label { position: absolute; top: -9px; left: 0; width: calc(var(--gutter-w) - 6px); text-align: right; font-size: 0.6875rem; color: var(--muted); background: var(--surface); }
.tg-cols { position: absolute; inset: 0; display: grid; }
.tg-col { position: relative; border-left: 1px solid var(--line); min-width: 0; }
.tg-block {
  position: absolute; display: block; overflow: hidden; padding: 2px 4px 2px 7px; text-align: left; cursor: pointer; color: var(--ink);
  border: 0; border-left: 3px solid var(--ev); border-radius: 6px; font-size: 0.8125rem;
  background: color-mix(in srgb, var(--ev) 22%, var(--surface));
}
.tg-block.compact { font-size: 0.75rem; padding-left: 5px; }
.tg-block.done { opacity: 0.65; text-decoration: line-through; }
.tg-block-title { display: block; font-weight: 700; overflow-wrap: anywhere; line-height: 1.25; }
.tg-block-time { display: block; font-size: 0.6875rem; color: var(--muted); }
.tg-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--c-red); z-index: 2; pointer-events: none; }

/* ---------- agenda ---------- */
.agenda { display: grid; gap: 18px; }
.agenda-group h3 { display: flex; align-items: center; gap: 6px; margin: 0 0 8px; font-size: 1rem; }
.agenda-group.overdue h3 { color: var(--danger); }

/* ---------- event detail ---------- */
.detail { display: grid; gap: 14px; }
.detail-head { display: flex; gap: 12px; align-items: center; }
.detail-head .kind-tile { width: 48px; height: 48px; border-radius: 12px; }
.detail-title { font-size: 1.25rem; overflow-wrap: anywhere; }
.detail-title.done { text-decoration: line-through; color: var(--muted); }
.detail-head p { margin: 0; }
.detail-section h3 { font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin-bottom: 4px; }
.detail-section p { margin: 0 0 2px; }
.detail-actions { display: grid; gap: 8px; }
@media (min-width: 520px) { .detail-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
