.schedule-page {
  --deadline-color: #b85d00;
  --deadline-soft: #fff3e6;
}

[data-theme="dark"] .schedule-page {
  --deadline-color: #ffb261;
  --deadline-soft: #3a2818;
}

.schedule-intro {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 34px;
}

.schedule-intro p {
  margin-top: 9px;
  color: var(--color-secondary);
  font-size: var(--font-size-body);
}

.schedule-actions {
  display: flex;
  gap: 10px;
}

.schedule-toolbar {
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--color-hairline);
}

.schedule-toolbar > p {
  color: var(--color-muted);
  font-size: var(--font-size-small);
}

.schedule-filters {
  display: flex;
  align-self: stretch;
  gap: 4px;
  padding-block: 5px;
}

.schedule-filters button {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: var(--button-radius-sm);
  background: transparent;
  color: var(--color-secondary);
  cursor: pointer;
  font-size: var(--font-size-small);
  font-weight: 620;
  transition: background-color var(--motion-fast), color var(--motion-fast);
}

.schedule-filters button:hover {
  background: var(--button-secondary-hover);
}

.schedule-filters button[aria-selected="true"] {
  color: var(--button-soft-ink);
  background: var(--button-soft);
}

.schedule-filters span,
.long-term-count {
  min-width: 22px;
  display: inline-grid;
  place-items: center;
  padding-inline: 6px;
  border-radius: var(--radius-full);
  background: var(--color-surface-subtle);
  color: var(--color-muted);
  font-size: var(--font-size-caption);
  line-height: 22px;
}

.schedule-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(310px, 0.8fr);
  gap: 20px;
  align-items: start;
}

.schedule-panel,
.long-term-panel {
  overflow: hidden;
  border: 1px solid var(--color-hairline);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
}

.panel-heading {
  min-height: 76px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--color-hairline);
}

.panel-heading h2 {
  font-size: var(--font-size-section);
  font-weight: 670;
  letter-spacing: -0.025em;
}

.panel-heading p {
  margin-top: 3px;
  color: var(--color-muted);
  font-size: var(--font-size-small);
}

.schedule-day + .schedule-day {
  border-top: 1px solid var(--color-hairline);
}

.schedule-day-heading {
  display: flex;
  align-items: baseline;
  gap: 9px;
  padding: 18px 22px 10px;
}

.schedule-day-heading strong {
  font-size: var(--font-size-body);
  font-weight: 680;
}

.schedule-day-heading span {
  color: var(--color-muted);
  font-size: var(--font-size-caption);
}

.schedule-row {
  position: relative;
  display: grid;
  grid-template-columns: 92px 68px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 96px;
  margin: 0 14px 14px;
  padding: 16px 16px 16px 18px;
  border: 1px solid var(--color-hairline);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  transition: border-color var(--motion-fast), background var(--motion-fast), transform var(--motion-fast);
}

.schedule-row:hover {
  border-color: var(--color-hairline-strong);
  background: var(--color-surface-subtle);
  transform: translateY(-1px);
}

.schedule-row.dual-time {
  grid-template-columns: minmax(210px, .85fr) minmax(0, 1.35fr) auto;
}

.schedule-date-pair {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  gap: 5px 10px;
  min-width: 0;
  font-size: var(--font-size-caption);
}

.schedule-date-pair span { color: var(--color-muted); }
.schedule-date-pair strong {
  display: flex;
  flex-wrap: wrap;
  gap: 0 5px;
  color: var(--color-charcoal);
  font-family: var(--font-mono);
  font-weight: 600;
  line-height: 1.45;
  overflow-wrap: normal;
  word-break: normal;
}

.schedule-point { white-space: nowrap; }
.schedule-period-separator { color: var(--color-muted); }

.long-term-time {
  display: grid;
  gap: 4px;
  margin-top: 9px;
  color: var(--color-secondary);
  font-family: var(--font-mono);
  font-size: var(--font-size-caption);
}

@media (max-width: 900px) {
  .schedule-row.dual-time { grid-template-columns: 1fr; align-items: start; }
  .schedule-row.dual-time .row-actions { justify-content: flex-start; }
}

.schedule-kind {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--color-brand-ink);
  font-size: var(--font-size-small);
  font-weight: 680;
  white-space: nowrap;
}

.schedule-kind::before {
  content: "";
  width: 9px;
  height: 9px;
  border: 2px solid currentColor;
  border-radius: 50%;
  background: var(--color-surface);
}

.schedule-row.is-deadline .schedule-kind {
  color: var(--deadline-color);
}

.schedule-time {
  color: var(--color-ink);
  font-family: var(--font-mono);
  font-size: var(--font-size-small);
  font-weight: 650;
}

.schedule-copy {
  min-width: 0;
}

.schedule-copy h3 {
  overflow: hidden;
  color: var(--color-ink);
  font-size: var(--font-size-body);
  font-weight: 660;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-meta,
.schedule-description {
  margin-top: 4px;
  overflow: hidden;
  color: var(--color-secondary);
  font-size: var(--font-size-caption);
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-description {
  color: var(--color-muted);
}

.row-actions {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}



.row-action .icon {
  width: 17px;
  height: 17px;
}

.long-term-list {
  display: grid;
}

.long-term-item {
  padding: 20px 20px 18px;
}

.long-term-item + .long-term-item {
  border-top: 1px solid var(--color-hairline);
}

.long-term-item h3 {
  color: var(--color-ink);
  font-size: var(--font-size-body);
  font-weight: 670;
  line-height: 1.45;
}

.long-term-range {
  margin-top: 9px;
  color: var(--color-charcoal);
  font-family: var(--font-mono);
  font-size: var(--font-size-caption);
  font-weight: 600;
}

.long-term-progress {
  height: 4px;
  margin-top: 13px;
  overflow: hidden;
  border-radius: var(--radius-full);
  background: var(--color-surface-subtle);
}

.long-term-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--color-brand);
}

.long-term-status {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 6px;
  color: var(--color-muted);
  font-size: var(--font-size-caption);
}

.long-term-item p {
  display: -webkit-box;
  margin-top: 12px;
  overflow: hidden;
  color: var(--color-secondary);
  font-size: var(--font-size-small);
  line-height: 1.6;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.long-term-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  color: var(--color-muted);
  font-size: var(--font-size-caption);
}

.long-term-footer a {
  color: var(--color-brand-ink);
  font-weight: 600;
  text-decoration: none;
}

.schedule-empty {
  padding: 52px 24px 58px;
  text-align: center;
}

.schedule-empty strong {
  display: block;
  font-size: var(--font-size-body);
}

.schedule-empty span {
  display: block;
  margin-top: 4px;
  color: var(--color-secondary);
  font-size: var(--font-size-small);
}

.schedule-loading {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.schedule-loading .skeleton {
  height: 82px;
  border-radius: var(--radius-md);
}

.schedule-loading.compact .skeleton {
  height: 150px;
}

.page-message {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 200;
  max-width: min(420px, calc(100vw - 32px));
  padding: 12px 16px;
  border: 1px solid var(--color-hairline-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-md);
  color: var(--color-charcoal);
  font-size: var(--font-size-small);
}

.page-message.is-error {
  border-color: color-mix(in srgb, var(--color-error) 35%, var(--color-hairline));
  color: var(--color-error);
}

@media (max-width: 999px) {
  .schedule-layout {
    grid-template-columns: 1fr;
  }

  .long-term-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .long-term-item:nth-child(even) {
    border-left: 1px solid var(--color-hairline);
  }
}

@media (max-width: 719px) {
  .schedule-intro {
    align-items: flex-start;
    flex-direction: column;
    margin-bottom: 24px;
  }

  .schedule-actions {
    width: 100%;
  }

  .schedule-actions .button {
    flex: 1;
  }

  .schedule-toolbar {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
    padding-bottom: 10px;
  }

  .schedule-filters {
    min-height: 46px;
    gap: 18px;
    overflow-x: auto;
  }

  .schedule-toolbar > p {
    display: none;
  }

  .schedule-row {
    grid-template-columns: 84px minmax(0, 1fr);
    gap: 8px 12px;
    min-height: 0;
    margin-inline: 10px;
    padding: 14px;
  }

  .schedule-time {
    grid-column: 1;
  }

  .schedule-copy {
    grid-column: 2;
    grid-row: 1 / span 2;
  }

  .row-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
    padding-top: 9px;
    border-top: 1px solid var(--color-hairline);
  }

  .long-term-list {
    grid-template-columns: 1fr;
  }

  .long-term-item:nth-child(even) {
    border-left: 0;
  }

  .page-message {
    right: 16px;
    bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom) + 12px);
    left: 16px;
  }
}

@media (max-width: 420px) {
  .schedule-filters {
    gap: 4px;
  }

  .schedule-filters button {
    font-size: var(--font-size-small);
  }

  .row-action span {
    display: none;
  }
}
