/* Presentation only. Schedule geometry, gestures and persistence stay in app.js. */
:root {
  --ink: #171717;
  --muted: #525252;
  --line: #d4d4d4;
  --page: #fff;
  --blue: #1763bb;
  --blue-dark: #114b91;
  --blue-soft: #e5f2ff;
  --punk-yellow: #ffe765;
  --card-shadow: 3px 3px 0 #171717;
}
body { background: #fff; }
button { transition: background-color .12s, box-shadow .12s; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid #1763bb; outline-offset: 3px;
}
button:disabled { opacity: .48; cursor: not-allowed; }
.app-header { background: #fff; border-bottom: 2px solid var(--ink); box-shadow: none; }
.app-header h1 { color: var(--ink); font-weight: 850; }
.brand-mark { border: 2px solid var(--ink); border-radius: 50%; background: var(--punk-yellow); box-shadow: 2px 2px 0 var(--ink); }
.brand-mark svg { stroke: var(--ink); }
.app-header .logout-button { border: 2px solid var(--ink); border-radius: 0; background: #fff; color: var(--ink); box-shadow: 2px 2px 0 var(--ink); white-space: nowrap; }
.panel, html.embedded .schedule-panel { border: 2px solid var(--ink); border-radius: 0; box-shadow: 4px 4px 0 var(--ink); }
.schedule-header, html.embedded .schedule-header { background: #121212; color: #fff; border-color: #121212; gap: 9px; }
.schedule-actions { gap: 8px; }
.schedule-header .header-button, .schedule-header .logout-button,
html.embedded .schedule-header .header-button, html.embedded .schedule-header .logout-button {
  border: 2px solid #fff; border-radius: 0; background: #121212; color: #fff;
  box-shadow: 2px 2px 0 #fff; font-weight: 800;
}
.schedule-header .header-button:hover, .schedule-header .logout-button:hover { background: #303030; transform: none; }
.schedule-header #open-workouts { background: #a5d9ff; color: var(--ink); }
.workout-recent { color: #fff; font-variant-numeric: tabular-nums; padding-top: 8px; }
.workout-recent-row { grid-template-columns: 3.5em 3.5em minmax(0, 1fr); column-gap: 6px; }
.schedule-header .create-button, html.embedded .schedule-header .create-button {
  background: var(--punk-yellow); color: var(--ink); border: 2px solid #fff; box-shadow: 3px 3px 0 #fff;
  font-weight: 850; border-radius: 50%; transition: background-color .12s, box-shadow .12s;
}
.schedule-header .create-button:hover { background: #fff18f; transform: none; }
.zoom-controls button, html.embedded .zoom-controls button {
  border: 2px solid #fff; border-radius: 50%; background: var(--punk-yellow); color: var(--ink); font-weight: 850; box-shadow: 1px 1px 0 #fff;
}
.zoom-controls #zoom-reset, html.embedded .zoom-controls #zoom-reset { background: transparent; color: #fff; border-color: transparent; border-radius: 0; box-shadow: none; }
.remaining-panel { background: #121212; border: 1px solid #777; border-radius: 0; padding: 7px; gap: 7px; }
.remaining-panel.drop-active { background: #26394b; border-color: #ffe765; box-shadow: inset 0 0 0 2px #ffe765; }
#create-remaining { width: auto; background: var(--punk-yellow); color: #171717; padding: 4px 8px; font-weight: 850; }
.remaining-hint { color: #ccc; }
.remaining-list { gap: 7px; padding: 1px 4px 4px 0; }
.remaining-item, .remaining-item[data-color] { border: 2px solid #fff; border-radius: 0; color: #171717; box-shadow: 2px 2px 0 #fff; }
.remaining-item-note { color: #303030; }
.remaining-item-count { border: 1px solid #171717; border-radius: 2px; color: #171717; background: #fff; }
.event-card[data-color="red"], .remaining-item[data-color="red"] { background: #ffb3c5; }
.event-card[data-color="blue"], .remaining-item[data-color="blue"] { background: #a5d9ff; }
.event-card[data-color="green"], .remaining-item[data-color="green"] { background: #b4efa1; }
.event-card[data-color="yellow"], .remaining-item[data-color="yellow"] { background: #fff18a; }
.event-card[data-color="purple"], .remaining-item[data-color="purple"] { background: #d9bbff; }
.event-card[data-color="orange"], .remaining-item[data-color="orange"] { background: #FFD0A1; }
.list-color.orange { background: #e58b32; }
.event-card[data-color="gray"], .remaining-item, .remaining-item[data-color="gray"] { background: #e5e8ee; }
.timeline-column-headings { background: #fff18a; color: #171717; border-bottom: 2px solid #171717; }
.timeline-column-headings strong { font-weight: 850; }
.time-label { color: #333; font-weight: 700; }
.grid-line { border-color: #eee; }
.grid-line.hour, .time-grid, .time-grid::after { border-color: #c6c6c6; }
.event-card, .event-card[data-color], html.embedded .event-card {
  border: 2px solid #171717; border-radius: 0; color: #171717; box-shadow: var(--card-shadow);
}
.event-card:hover { box-shadow: var(--card-shadow); filter: brightness(1.025); }
.event-card.dragging { box-shadow: 4px 4px 0 #171717; }
.event-card.completed { opacity: .52; filter: saturate(.6); }
.event-name { font-weight: 800; }
.card-note { opacity: 1; color: #303030; }
.card-link { color: #143e73; font-weight: 750; }
.card-checklist-badge, .overlap-count { background: #fff; color: #171717; border: 1px solid #171717; border-radius: 2px; }
.event-check, .status-check, .task-completed-control input, .template-check input { accent-color: #171717; }
.event-check { border-radius: 0; }
.resize-handle::after { background: #17171780; }
.mobile-drag-grip { color: #333; }
/* Filled, irregular lightning silhouette; shadow is displaced, never an outline.
   The center baseline is still positioned by the existing time/zoom calculation. */
.current-time-indicator span, html.embedded .current-time-indicator span {
  background: #f32e25; color: #fff; border: 0; border-radius: 0; padding: 3px 4px;
  box-shadow: 2px 2px 0 #171717; font-weight: 850; position: relative; z-index: 1;
}
.current-time-indicator i { height: 12px; background: transparent; filter: drop-shadow(2px 2px 0 #171717); }
.current-time-indicator i::before {
  content: ''; position: absolute; inset: 0; width: auto; height: auto; border-radius: 0; background: #f32e25;
  clip-path: polygon(0 46%, 24% 20%, 23% 42%, 33% 30%, 32% 56%, 73% 8%, 72% 54%, 91% 34%, 90% 55%, 100% 46%, 90% 75%, 91% 59%, 70% 92%, 71% 63%, 30% 82%, 31% 59%, 22% 64%, 23% 51%, 0 57%);
}
.modal-backdrop { background: #0007; backdrop-filter: blur(2px); }
.modal, .modal.workout-modal, html.embedded #modal-backdrop .modal, .auth-card {
  border: 2px solid #171717; border-radius: 0; background: #fff; box-shadow: 5px 5px 0 #171717;
}
.close-button, html.embedded #modal-backdrop .close-button { border: 2px solid #171717; border-radius: 50%; background: #fff; color: #171717; }
.field, .kind-switch legend, .task-completed-control, .page-items-field legend { color: #262626; }
.field input, .field textarea, .field select, .time-picker-trigger,
#task-form .field input, #task-form .field textarea, #task-form .field select,
html.embedded #task-form .field input, html.embedded #task-form .field textarea,
.page-item-add input, #task-form .page-item-add input, .workout-types span {
  border: 2px solid #333; border-radius: 0; background: #fff; color: #171717;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: #1763bb; box-shadow: 0 0 0 2px #1763bb33; }
.kind-switch span, #task-form .kind-switch span, html.embedded #task-form .kind-switch span {
  border: 2px solid #333; border-radius: 0; color: #333; white-space: nowrap;
}
.kind-switch input:checked + span, .workout-types input:checked + span { border-color: #171717; background: var(--punk-yellow); color: #171717; box-shadow: 2px 2px 0 #171717; }
.page-items-field, #task-form .page-items-field, html.embedded #task-form .page-items-field { border: 1px solid #999; border-radius: 0; }
.page-items-help, .field-help { color: #525252; }
.save-button, .use-template, .edit-template, .edit-day-template, .duplicate-button,
.cancel-button, .delete-button, .page-item-add button, .weekday-picker button,
.manager-item, .preview-row, .empty-manager { border: 2px solid #171717; border-radius: 0; }
.save-button, .use-template, .page-item-add button { background: var(--punk-yellow); color: #171717; box-shadow: 2px 2px 0 #171717; }
.save-button:hover, .use-template:hover, .page-item-add button:hover { background: #fff18f; }
.cancel-button, .duplicate-button, .edit-template, .edit-day-template { background: #fff; color: #171717; }
.delete-button, .item-delete { background: #ffe1e1; color: #9c1818; }
.weekday-picker button { border-radius: 50%; }
.weekday-picker button.active { background: var(--punk-yellow); color: #171717; border-color: #171717; box-shadow: 2px 2px 0 #171717; }
.workout-tile, .workout-record { border: 2px solid #171717; border-radius: 0; box-shadow: 2px 2px 0 #171717; }
.workout-summary, .workout-records { padding: 0 4px 4px 0; }
.workout-back { background: #a5d9ff; color: #171717; }
.workout-chest { background: #ffb3c5; color: #171717; }
.workout-legs { background: #b4efa1; color: #171717; }
.workout-rest { background: #e5e8ee; color: #171717; }
.workout-remove { color: #333; }
@media (min-width: 801px) {
  .schedule-header .create-button { align-self: center; width: 78px; height: 78px; min-height: 78px; margin: 3px 0 5px; font-size: .9rem; }
  .schedule-header .header-button, .schedule-header .logout-button { min-height: 34px; }
}
html.embedded .schedule-header { padding-top: 8px; }
html.embedded .schedule-header .create-button { align-self: center; width: 72px; height: 72px; min-height: 72px; font-size: .8rem; margin-bottom: 5px; }
@media (max-width: 800px) {
  html:not(.embedded) .schedule-header { padding: 9px 8px; gap: 9px 6px; grid-template-columns: 44px minmax(74px, 1fr) 130px; }
  html:not(.embedded) .mobile-menu-toggle { border: 2px solid #fff; border-radius: 50%; background: #121212; color: #fff; }
  html:not(.embedded) .schedule-header .create-button { height: 44px; border-radius: 24px; font-size: .87rem; }
  html:not(.embedded) .zoom-controls { grid-template-columns: 38px minmax(0, 1fr) 38px; gap: 3px; }
  html:not(.embedded) .zoom-controls button { min-height: 38px; align-self: center; }
  html:not(.embedded) .schedule-header.menu-open .schedule-actions { top: 62px; padding: 10px; width: min(290px, calc(100% - 16px)); border: 2px solid #fff; border-radius: 0; background: #121212; box-shadow: 3px 3px 0 #171717; gap: 10px; max-height: min(65dvh, 500px); overflow-y: auto; }
  html:not(.embedded) .schedule-actions .header-button { border-radius: 0; padding: 0 10px; }
  html:not(.embedded) .remaining-panel { padding: 5px; max-height: 85px; }
  html:not(.embedded) .remaining-panel h3 { text-align: left; }
  html:not(.embedded) .remaining-item { min-height: 32px; }
  html:not(.embedded) .event-card { border-radius: 0; box-shadow: 2px 2px 0 #171717; }
  html:not(.embedded) .event-card.roomy { padding-top: 37px; }
  html:not(.embedded) .event-card .mobile-drag-grip { color: #333; }
  .current-time-indicator i { height: 9px; filter: drop-shadow(1px 2px 0 #171717); }
  .app-header h1 { font-size: clamp(.85rem, 3.9vw, 1.1rem); }
  .app-header .brand-mark { flex: 0 0 auto; }
  .app-header .logout-button { flex: 0 0 auto; }
  /* A separate row for kind/category prevents Japanese labels wrapping vertically. */
  #task-form .compact-options { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  #task-form .compact-options .field { grid-column: 1; }
  #task-form .kind-switch span { min-height: 42px; font-size: .86rem; }
  #task-form .field input, #task-form .field select, #task-form .time-picker-trigger,
  #task-form .field textarea, #task-form .page-item-add input { font-size: 16px; }
  #task-form .time-picker-trigger { min-height: 42px; }
  #task-form .modal-actions { flex-wrap: wrap; gap: 12px; }
  #task-form .task-secondary-actions { flex: 1 1 100%; }
  #task-form .primary-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); flex: 1 1 100%; gap: 9px; }
  #task-form .primary-actions .template-check, #task-form .primary-actions .task-completed-control { grid-column: 1 / -1; margin: 0; white-space: normal; }
  #task-form .primary-actions button { min-height: 44px; white-space: nowrap; }
  #task-form .page-item-add button { min-height: 42px; }
  .modal, html.embedded #modal-backdrop .modal { max-height: calc(100dvh - 20px); }
  .time-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  .event-card, button { transition: none; }
}

/* Workout records: six muscles, one daily entry, independent of the timetable. */
.workout-summary { grid-template-columns: repeat(7, minmax(0, 110px)); gap: 12px; margin-bottom: 10px; }
.workout-tile { aspect-ratio: 1; min-width: 0; padding: 8px; border-radius: 50%; justify-content: center; box-shadow: 3px 3px 0 #171717; }
.workout-tile-name { font-size: .85rem; }
.workout-days { font-size: 1.15rem; }
.workout-shoulders { background: #fff18a; color: #171717; }
.workout-abs { background: #b4efa1; color: #171717; }
.workout-legs { background: #d9bbff; color: #171717; }
.workout-arms { background: #e5e8ee; color: #171717; }
.workout-rest-summary { display: inline-block; margin: 0 0 16px; padding: 5px 9px; background: #e5e8ee; border: 1px solid #171717; font-size: .78rem; font-weight: 700; }
#workout-inputs { display: grid; grid-template-columns: 160px minmax(0, 1fr) auto; align-items: end; gap: 10px 16px; }
#workout-inputs > .field { min-width: 0; }
.workout-types { grid-column: 2 / -1; display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; min-width: 0; }
.workout-types legend, .workout-rating-options legend { margin-bottom: 6px; font-size: .78rem; font-weight: 700; }
.workout-types label { min-width: 0; }
.workout-types span { min-height: 40px; }
.workout-types input:checked + span::before { content: '✓'; margin-right: 3px; }
.workout-types span { display: flex; justify-content: center; align-items: center; }
.workout-selection-help { grid-column: 2 / -1; margin: -3px 0 3px; color: #525252; font-size: .72rem; }
.workout-rating-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; min-width: 0; padding: 0; margin: 0; border: 0; }
.workout-rating-options:first-of-type { grid-column: 1; }
#workout-inputs > .workout-rating-options { grid-column: auto; }
#workout-inputs > .workout-rating-options:nth-of-type(2) { grid-column: 1; }
#workout-inputs > .workout-rating-options:nth-of-type(3) { grid-column: 2; }
.workout-rating-options label { position: relative; min-width: 0; }
.workout-rating-options input { position: absolute; opacity: 0; }
.workout-rating-options span { display: grid; place-items: center; min-height: 40px; padding: 4px 6px; border: 2px solid #333; color: #171717; font-size: .8rem; font-weight: 700; }
.workout-rating-options input:checked + span { background: var(--punk-yellow); box-shadow: 2px 2px 0 #171717; }
.workout-rating-options input:focus-visible + span, .workout-types input:focus-visible + span { outline: 3px solid #1763bb; outline-offset: 2px; }
#workout-inputs > .save-button { grid-column: 3; min-height: 40px; }
.workout-records { display: flex; flex-direction: column; gap: 7px; max-height: 290px; }
.workout-record { flex: 0 0 auto; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto; gap: 10px; padding: 6px 9px; background: #fff; align-items: center; }
.workout-record > .workout-record-main { display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px 14px; min-width: 0; }
.workout-record-date { color: #333; white-space: nowrap; font-weight: 700; }
.workout-part-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.workout-part-tag { border: 1px solid #333; padding: 2px 6px; font-size: .75rem; font-weight: 700; white-space: nowrap; }
.workout-record > .workout-record-ratings { display: flex; flex-direction: row; flex-wrap: wrap; gap: 4px 14px; font-size: .75rem; }
.workout-record-rating, .workout-recent-rating { display: inline-flex; align-items: baseline; gap: 4px; }
.workout-rating-label { font-weight: 500; }
.workout-remove { border: 1px solid #333; min-height: 32px; background: #fff; }

/* Compact, high-contrast sidebar; no changes to the red time-indicator rules. */
.schedule-header #open-templates { background: #fff1ad; color: #171717; }
.schedule-header #open-weekday { background: #d9bbff; color: #171717; }
.schedule-header #open-status { background: #b4efa1; color: #171717; }
.schedule-header #open-templates:hover, .schedule-header #open-weekday:hover, .schedule-header #open-status:hover, .schedule-header #open-workouts:hover { filter: brightness(.96); }
.workout-recent { display: grid; gap: 5px; padding: 6px 0 2px; font-size: .62rem; }
.workout-recent-entry { display: grid; grid-template-columns: 65px minmax(0, 1fr); gap: 1px 5px; padding: 4px 5px; color: #171717; background: #e7f2fb; border: 1px solid #fff; box-shadow: 1px 1px 0 #fff; }
.workout-recent-entry:nth-child(2) { background: #fff5cf; }
.workout-recent-heading { display: flex; align-items: baseline; gap: 6px; white-space: nowrap; line-height: 1.5; }
.workout-recent-heading > span { min-width: 3em; }
.workout-recent-parts { min-width: 0; overflow-wrap: anywhere; line-height: 1.5; }
.workout-recent-ratings { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 0 7px; line-height: 1.5; }
@media (min-width: 801px) {
  .schedule-header, html.embedded .schedule-header { gap: 5px; padding: 6px; overflow-y: auto; }
  .schedule-actions { gap: 5px; flex-shrink: 0; }
  .schedule-header .header-button, .schedule-header .logout-button,
  html.embedded .schedule-header .header-button, html.embedded .schedule-header .logout-button { min-height: 27px; height: 27px; font-size: .67rem; }
  .schedule-header .create-button, html.embedded .schedule-header .create-button { width: 48px; height: 48px; min-height: 48px; flex: 0 0 48px; margin: 0 0 3px; font-size: .68rem; }
  .remaining-panel { min-height: 244px; flex: 1 0 244px; padding: 5px; gap: 5px; }
  .remaining-list { gap: 4px; padding-bottom: 3px; }
  .remaining-item { min-height: 30px; height: 30px; flex: 0 0 30px; padding: 2px 4px; }
  #create-remaining { padding: 3px 6px; }
  .remaining-item-name { font-size: .62rem; }
  .remaining-item-note { font-size: .54rem; }
  .zoom-controls { grid-template-columns: 25px minmax(0, 1fr) 25px; flex-shrink: 0; gap: 3px; }
  .zoom-controls button, html.embedded .zoom-controls button { min-height: 25px; height: 25px; font-size: .7rem; }
}
@media (max-width: 800px) {
  .workout-summary { grid-template-columns: repeat(3, minmax(0, 100px)); gap: 10px; justify-content: start; }
  .workout-tile { padding: 6px; }
  .workout-tile-name { font-size: .8rem; }
  .workout-days { font-size: 1rem; }
  #workout-inputs { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  #workout-inputs > .field, .workout-types, .workout-selection-help,
  #workout-inputs > .workout-rating-options:nth-of-type(2), #workout-inputs > .workout-rating-options:nth-of-type(3), #workout-inputs > .save-button { grid-column: 1; }
  .workout-types { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .workout-types span, .workout-rating-options span { min-height: 44px; }
  #workout-date { font-size: 16px; }
  .workout-selection-help { font-size: .7rem; }
  .workout-record { grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }
  .workout-record > .workout-record-main { grid-column: 1; gap: 5px 10px; }
  .workout-record > .workout-record-ratings { grid-column: 1; grid-row: 2; }
  .workout-record > .workout-remove { grid-column: 2; grid-row: 1 / 3; min-height: 44px; }
  .workout-records { max-height: 320px; }
  html:not(.embedded) .schedule-header.menu-open .schedule-actions { max-height: min(72dvh, 570px); }
  html:not(.embedded) .schedule-header .create-button { height: 40px; min-height: 40px; border-radius: 0; }
  html:not(.embedded) .zoom-controls { grid-template-columns: 32px minmax(0, 1fr) 32px; }
  html:not(.embedded) .zoom-controls button { min-height: 32px; height: 32px; }
  .workout-recent { font-size: .72rem; }
  .workout-recent-entry { grid-template-columns: 82px minmax(0, 1fr); padding: 5px 6px; }
}
/* Embedded views also use the compact vertical sidebar on narrow windows. */
html.embedded .schedule-header { overflow-y: auto; }
html.embedded .schedule-header .create-button { width: 48px; height: 48px; min-height: 48px; flex: 0 0 48px; margin: 0 0 3px; font-size: .68rem; }

/* Separate utilities from workout history without reducing the task area. */
.schedule-actions .workout-menu { border-top: 1px solid #a6a6a6; padding-top: 8px; margin-top: 3px; }
.workout-summary { justify-content: center; }
.workout-rest-summary { display: table; margin-left: auto; margin-right: auto; }
#workout-inputs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#workout-inputs > .field { grid-column: 1; max-width: 190px; }
#workout-inputs > .workout-types, .workout-selection-help { grid-column: 1 / -1; }
#workout-inputs > .workout-rating-options:nth-of-type(2) { grid-column: 1; }
#workout-inputs > .workout-rating-options:nth-of-type(3) { grid-column: 2; }
.workout-form-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 10px; }
.workout-form-actions button { min-height: 40px; }
.workout-record > .workout-record-actions { display: flex; flex-direction: row; gap: 6px; }
@media (max-width: 800px) {
  .workout-summary { justify-content: center; }
  #workout-inputs { grid-template-columns: minmax(0, 1fr); }
  #workout-inputs > .field { max-width: none; }
  #workout-inputs > .workout-rating-options:nth-of-type(3) { grid-column: 1; }
  .workout-record > .workout-record-actions { grid-column: 2; grid-row: 1 / 3; flex-direction: column; }
  .workout-form-actions button { min-height: 44px; }
}

/* Dark status colors remain readable on white and pale history cards. */
.workout-rating-value.workout-rating-good { color: #16703b; }
.workout-rating-value.workout-rating-fair { color: #856000; }
.workout-rating-value.workout-rating-bad { color: #bf2929; }

.workout-cardio { background: #a6ece4; color: #171717; }

/* Three manually chosen columns; card theme and current-time line unchanged. */
.time-grid::before, .time-grid::after { content: ''; position: absolute; top: 0; bottom: 0; border-left: 1px solid #c6c6c6; }
.time-grid::before { left: 33.333333%; }
.time-grid::after { left: 66.666667%; }
@media (min-width: 801px) {
  .schedule-panel { grid-template-rows: minmax(0, 1fr); }
  .schedule-header { grid-row: 1; }
  .timeline-scroll { grid-row: 1; }
}
html.embedded .schedule-panel { grid-template-rows: minmax(0, 1fr); }
html.embedded .schedule-header, html.embedded .timeline-scroll { grid-row: 1; }

#task-kind-switch, #template-type-switch { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
#task-kind-switch label, #template-type-switch label { width: auto; min-width: 0; }
#task-kind-switch span, #template-type-switch span { padding-left: 2px; padding-right: 2px; font-size: .8rem; white-space: nowrap; }

.schedule-header #open-memos { background: #ffd4aa; color: #171717; }
.schedule-header #open-memos:hover { filter: brightness(.96); }
.modal.memo-modal { width: min(860px, calc(100vw - 32px)); min-height: min(520px, calc(100dvh - 32px)); display: flex; flex-direction: column; }
.memo-list { flex: 1; min-height: 160px; max-height: 50dvh; overflow-y: auto; padding: 12px 0; }
.memo-row { display: flex; align-items: flex-start; gap: 12px; padding: 10px 2px; cursor: pointer; }
.memo-row input { flex: 0 0 22px; width: 22px; height: 22px; margin: 1px 0 0; accent-color: #171717; }
.memo-row span { min-width: 0; overflow-wrap: anywhere; line-height: 1.5; }
.memo-row.checked span { color: #737373; text-decoration: line-through; }
.memo-empty { color: #737373; }
#memo-form { display: flex; gap: 10px; }
#memo-text { min-width: 0; flex: 1; min-height: 44px; padding: 10px; border: 2px solid #333; border-radius: 0; background: #fff; color: #171717; font: inherit; }
#memo-form button { min-height: 44px; }
#memo-message { min-height: 1.5em; color: #525252; font-size: .8rem; }
.memo-modal .modal-actions { justify-content: flex-end; margin-top: 12px; }
.event-card.dragging { will-change: transform; }
@media (max-width: 800px) {
  .modal.memo-modal { width: calc(100vw - 24px); min-height: min(560px, calc(100dvh - 24px)); }
  #memo-text { font-size: 16px; }
  .memo-row { min-height: 44px; }
}
#memo-form button, .memo-modal .modal-actions button { flex: 0 0 auto; }

.memo-row { align-items: center; cursor: auto; }
.memo-item-label { display: flex; flex: 1; min-width: 0; align-items: flex-start; gap: 12px; cursor: pointer; }
.memo-delete { flex: 0 0 auto; min-height: 36px; padding: 0 10px; font-size: .8rem; }
.memo-modal .modal-actions { justify-content: space-between; gap: 10px; }
@media (max-width: 800px) { .memo-delete { min-height: 44px; } }
.memo-row { padding-top: 4px; padding-bottom: 4px; }
.memo-list { margin-bottom: 10px; }
#memo-form { flex-shrink: 0; }

/* Mobile agenda only; desktop timeline geometry and theme are unchanged. */
.agenda-kind, .agenda-time { display: none; }
@media (min-width: 0px) {
  html.mobile-agenda .zoom-controls { display: none; }
  html.mobile-agenda .timeline { height: auto !important; min-height: 0; background: #fff; }
  html.mobile-agenda #time-labels, html.mobile-agenda #time-grid,
  html.mobile-agenda #current-time-indicator, html.mobile-agenda #drop-indicator { display: none; }
  html.mobile-agenda .events-layer { position: static; inset: auto; display: flex; flex-direction: column; gap: 14px; padding: 12px 12px 18px; }
  html.mobile-agenda .event-card.agenda-card { position: relative; inset: auto; width: 100%; height: auto; min-height: 94px; padding: 12px 10px 12px 48px; border: 2px solid #171717; border-radius: 0; box-shadow: 3px 3px 0 #171717; overflow: visible; touch-action: pan-y; container-type: normal; }
  html.mobile-agenda .agenda-content { min-width: 0; }
  html.mobile-agenda .agenda-kind { display: block; font-size: .7rem; font-weight: 700; margin-bottom: 5px; }
  html.mobile-agenda .agenda-time { display: block; font-size: .9rem; font-weight: 700; margin-top: 4px; }
  html.mobile-agenda .agenda-card .event-name { display: block; max-width: none; font-size: 1.05rem; line-height: 1.4; white-space: normal; overflow: visible; overflow-wrap: anywhere; -webkit-line-clamp: unset; }
  html.mobile-agenda .agenda-card .event-check-hit { top: 9px; left: 0; width: 44px; height: 44px; }
  html.mobile-agenda .agenda-card .card-note { display: block; font-size: .85rem; line-height: 1.45; white-space: normal; overflow: visible; overflow-wrap: anywhere; margin-top: 5px; }
  html.mobile-agenda .agenda-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; }
  html.mobile-agenda .agenda-card .card-link { display: inline-flex; align-items: center; min-height: 32px; font-size: .85rem; }
  html.mobile-agenda .agenda-now { display: flex; align-items: center; gap: 6px; min-height: 22px; pointer-events: none; }
  html.mobile-agenda .agenda-now span { background: #ff3029; color: #fff; font-size: .8rem; font-weight: 800; padding: 2px 5px; box-shadow: 2px 2px 0 #171717; }
  html.mobile-agenda .agenda-now i { flex: 1; height: 9px; filter: drop-shadow(1px 2px 0 #171717); position: relative; }
  html.mobile-agenda .agenda-now i::before { content: ''; position: absolute; inset: 0; background: #f32e25; clip-path: polygon(0 46%, 24% 20%, 23% 42%, 33% 30%, 32% 56%, 73% 8%, 72% 54%, 91% 34%, 90% 55%, 100% 46%, 90% 75%, 91% 59%, 70% 92%, 71% 63%, 30% 82%, 31% 59%, 22% 64%, 23% 51%, 0 57%); }
  html.mobile-agenda .agenda-empty { font-size: .9rem; line-height: 1.6; }
}
/* Keep five typical agenda entries visible on a phone, including browser chrome. */
@media (min-width: 0px) {
  html.mobile-agenda .schedule-header { grid-template-columns: 40px minmax(0, 1fr); grid-template-areas: "menu create" "remaining remaining"; padding: 6px 7px; gap: 6px; }
  html.mobile-agenda .mobile-menu-toggle { min-height: 40px; height: 40px; }
  html.mobile-agenda .schedule-header .create-button { width: 110px; min-height: 40px; height: 40px; justify-self: start; }
  html.mobile-agenda .remaining-panel { min-height: 0; max-height: none; padding: 3px 5px; }
  html.mobile-agenda .remaining-panel h3 { margin: 0 0 3px; font-size: .7rem; }
  html.mobile-agenda .remaining-panel h3 button { padding: 2px 6px; }
  html.mobile-agenda .remaining-list { flex: none; min-height: 38px; gap: 6px; }
  html.mobile-agenda .remaining-item { min-height: 28px; padding: 3px 5px; }
  html.mobile-agenda .remaining-item-name, html.mobile-agenda .remaining-item-note { font-size: .68rem; line-height: 1.2; }
  html.mobile-agenda .events-layer { gap: 7px; padding: 8px 8px 12px; }
  html.mobile-agenda .event-card.agenda-card { min-height: 60px; padding: 5px 7px 5px 40px; }
  html.mobile-agenda .agenda-content { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 6px; align-items: center; }
  html.mobile-agenda .agenda-card .event-name { grid-column: 1 / -1; font-size: .9rem; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  html.mobile-agenda .agenda-time { grid-column: 1; grid-row: 2; font-size: .78rem; line-height: 1.4; margin: 0; }
  html.mobile-agenda .agenda-kind { grid-column: 2; grid-row: 2; font-size: .62rem; margin: 0; }
  html.mobile-agenda .agenda-card .card-note { grid-column: 1; grid-row: 3; font-size: .72rem; line-height: 1.4; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  html.mobile-agenda .agenda-meta { grid-column: 2; grid-row: 3; gap: 5px; margin: 0; justify-content: flex-end; }
  html.mobile-agenda .agenda-card .card-link { min-height: 24px; font-size: .72rem; }
  html.mobile-agenda .agenda-card .card-checklist-badge { font-size: .68rem; padding: 0 4px; }
  html.mobile-agenda .agenda-card .event-check-hit { top: 3px; width: 38px; height: 44px; }
  html.mobile-agenda .agenda-now { min-height: 18px; }
}

@media (min-width: 0px) { html.mobile-agenda .events-layer { padding-bottom: var(--agenda-tail-space, 12px); } }
#open-remaining-mobile { display: none; }
@media (min-width: 0px) {
  html.mobile-agenda .schedule-header { grid-template-columns: 40px minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "menu create remaining-button"; }
  html.mobile-agenda .schedule-header > .remaining-panel { display: none; }
  html.mobile-agenda .schedule-header .create-button { width: 100%; }
  html.mobile-agenda #open-remaining-mobile { display: block; grid-area: remaining-button; border: 2px solid #fff; background: #ffe765; color: #171717; border-radius: 0; box-shadow: 2px 2px 0 #fff; min-height: 40px; font-size: .8rem; font-weight: 800; }
  html.mobile-agenda .remaining-mobile-modal { width: 100%; max-height: calc(100dvh - 24px); }
  html.mobile-agenda .remaining-mobile-list { max-height: 60dvh; overflow-y: auto; padding: 3px 5px 8px 0; display: flex; flex-direction: column; gap: 8px; }
  html.mobile-agenda .remaining-mobile-list .agenda-card { flex: 0 0 auto; touch-action: pan-y; }
  html.mobile-agenda .remaining-mobile-list .card-note { grid-row: 2; }
  html.mobile-agenda .remaining-mobile-list .agenda-meta { grid-row: 2; }
  html.mobile-agenda .remaining-mobile-modal .modal-actions { justify-content: space-between; }
}

/* Embedded agendas use the same compact list and toolbar at every frame width. */
html.embedded.mobile-agenda .schedule-panel { display: flex; flex-direction: column; }
html.embedded.mobile-agenda .schedule-header { position: relative; display: grid; grid-column: auto; grid-row: auto; flex: 0 0 auto; min-height: 0; border-left: 0; border-bottom: 2px solid #171717; background: #121212; align-items: center; }
html.embedded.mobile-agenda .timeline-scroll { flex: 1; min-height: 0; grid-column: auto; grid-row: auto; }
html.embedded.mobile-agenda .mobile-menu-toggle { display: block; grid-area: menu; padding: 0; border: 2px solid #fff; border-radius: 50%; background: #121212; color: #fff; font-size: 1.3rem; }
html.embedded.mobile-agenda .schedule-header .create-button { grid-area: create; margin: 0; padding: 0 8px; border-radius: 0; order: initial; font-size: .85rem; }
html.embedded.mobile-agenda .schedule-actions { display: none; }
html.embedded.mobile-agenda .schedule-header.menu-open .schedule-actions { position: absolute; display: flex; left: 7px; top: 54px; z-index: 25; width: min(290px, calc(100% - 16px)); max-height: 70dvh; overflow-y: auto; margin: 0; padding: 10px; gap: 10px; border: 2px solid #fff; background: #121212; box-shadow: 3px 3px 0 #171717; }
html.embedded.mobile-agenda .schedule-actions .header-button { min-height: 40px; padding: 0 10px; font-size: .85rem; text-align: left; }
html.embedded.mobile-agenda .agenda-card .event-check { width: 22px; height: 22px; }
html.embedded.mobile-agenda .app-header { display: none; }
html.embedded.mobile-agenda .app-header .logout-button { display: none; }
html.embedded.mobile-agenda .agenda-card .event-check-hit { display: grid; place-items: center; padding: 0; }
html.embedded.mobile-agenda .schedule-header { grid-template-columns: 40px minmax(0, 1fr) 110px 125px; grid-template-areas: "menu . create remaining-button"; }
html.embedded.mobile-agenda .schedule-actions .logout-button { min-height: 40px; font-size: .85rem; }
@media (max-width: 420px) { html.embedded.mobile-agenda .schedule-header { grid-template-columns: 40px minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "menu create remaining-button"; } }
/* Workout activity and eight content choices. */
.workout-summary { grid-template-columns: repeat(8, minmax(0, 110px)); }
.workout-biceps { background: #FFD0A1; color: #171717; }
.workout-triceps { background: #e5e8ee; color: #171717; }
#workout-inputs > .workout-activities { grid-template-columns: repeat(3, minmax(0, 1fr)); }
#workout-parts span { font-size: .75rem; white-space: normal; text-align: center; }
#workout-parts:disabled { opacity: .45; }
#workout-inputs > .workout-rating-options:has([name="workout-condition"]) { grid-column: 1; }
#workout-inputs > .workout-rating-options:has([name="workout-fatigue"]) { grid-column: 2; }
.workout-rating-options input:disabled + span { opacity: .45; }
.workout-activity-label { font-size: .72rem; }
@media (max-width: 800px) {
  .workout-summary { grid-template-columns: repeat(3, minmax(0, 100px)); }
  .workout-tile-name { font-size: .73rem; }
  #workout-inputs > .workout-rating-options:has([name="workout-fatigue"]) { grid-column: 1; }
  #workout-parts { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* Recent workout cards: date/activity, contents, then ratings. */
.workout-recent-entry { grid-template-columns: minmax(0, 1fr); }
.workout-recent-heading { grid-column: 1 / -1; gap: 10px; }
.workout-recent-parts { grid-column: 1 / -1; }
@media (max-width: 800px) { .workout-recent-entry { grid-template-columns: minmax(0, 1fr); } }

/* Narrow independent routine rail; the three timetable columns stay equal. */
.routine-rail { display: none; }
@media (min-width: 801px) {
  html:not(.embedded) .schedule-panel { grid-template-columns: minmax(0, 86fr) 57px minmax(132px, 14fr); }
  html:not(.embedded) .schedule-header { grid-column: 3; }
  html:not(.embedded) .routine-rail { display: flex; flex-direction: column; grid-column: 2; grid-row: 1; min-height: 0; overflow: hidden; border-left: 2px solid var(--ink); border-right: 2px solid var(--ink); }
  .routine-rail button { writing-mode: vertical-rl; text-orientation: upright; flex: none; width: 100%; min-height: 0; padding: 0; border: 0; border-radius: 0; box-shadow: none; overflow: hidden; font-size: 14px; font-weight: 800; background: #dcc2ff; color: #171717; }
  .routine-rail button + button { background: #fff2a6; border-top: 2px solid #171717; }
  .routine-rail button[hidden] { display: none; }
}
.routine-modal { width: min(900px, calc(100vw - 32px)); }
#routine-page-items { max-height: min(62vh, 680px); overflow: auto; }
#routine-page-items .page-item-row { margin: 0; }

/* The mobile list keeps its existing cards; only reserve a narrow routine strip. */
html.mobile-agenda .schedule-panel { position: relative; }
html.mobile-agenda .timeline-scroll .events-layer { padding-right: 62px; }
html.mobile-agenda .routine-rail { display: flex; position: absolute; right: 0; width: 48px; flex-direction: column; overflow: hidden; border-left: 2px solid #171717; z-index: 3; }
html.mobile-agenda .routine-rail button { writing-mode: vertical-rl; text-orientation: upright; flex: none; width: 100%; min-height: 0; padding: 0; border: 0; border-radius: 0; box-shadow: none; overflow: hidden; font-size: 13px; font-weight: 800; background: #dcc2ff; color: #171717; }
html.mobile-agenda .routine-rail button + button { background: #fff2a6; border-top: 2px solid #171717; }
html.mobile-agenda .routine-rail button[hidden] { display: none; }
html.mobile-agenda .routine-rail button { white-space: nowrap; }

/* Gray offset shadows for the routine cards. */
html.mobile-agenda .routine-rail { right: 3px; overflow: hidden; }
html.mobile-agenda .routine-rail button { box-shadow: 3px 3px 0 #808080; }
@media (min-width: 801px) {
  html:not(.embedded) .routine-rail button { width: calc(100% - 3px); box-shadow: 3px 3px 0 #808080; }
}

.routine-rail button { margin-bottom: 6px; }
html.mobile-agenda .routine-rail { background: #fff; }

#routine-page-items .routine-divider { grid-template-columns: 22px minmax(0, 1fr); align-items: center; min-height: 25px; }
#routine-page-items .routine-divider hr { width: 100%; margin: 0; border: 0; border-top: 1px solid #808080; }
.routine-modal .page-item-add { grid-template-columns: minmax(0, 1fr) auto auto; }
.routine-modal #add-routine-divider { background: #fff; color: #171717; }
@media (max-width: 600px) { .routine-modal #add-routine-divider { grid-column: 1 / -1; justify-self: end; } }

/* Independent completion controls stay above the vertical routine labels. */
.routine-rail { position: relative; }
.routine-completion { position: absolute; top: 6px; left: calc(50% - 11px); width: 22px; height: 22px; margin: 0; accent-color: #171717; z-index: 1; cursor: default; opacity: 1; }
.routine-completion[hidden] { display: none; }
.routine-list-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 7px; }
.routine-list-toolbar .page-items-help { margin: 0; }
#toggle-routine-checks { flex: none; width: 38px; min-height: 34px; padding: 0; font-size: 22px; line-height: 1; }
#toggle-routine-checks[aria-pressed="true"] { background: #ffe765; }

/* Avoid iPhone focus zoom in the routine editor, including inline item editing. */
@media (max-width: 800px) {
  #routine-modal #new-routine-item, #routine-page-items .page-item-text { font-size: 16px; }
}
html.embedded #routine-modal #new-routine-item, html.embedded #routine-page-items .page-item-text { font-size: 16px; }
