.line.schedule {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  align-items: start;
  gap: 4px 12px;
  min-height: 52px;
  padding-inline-start: 0;
}

.schedule .row-title {
  position: static;
  margin: 0;
  line-height: var(--control-field);
  white-space: nowrap;
}

.schedule-body {
  display: grid;
  grid-template-columns: fit-content(60%) minmax(0, 1fr);
  align-items: center;
  gap: 6px 8px;
  min-width: 0;
}

.schedule-controls {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  min-width: 0;
}

.schedule-field,
#when {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

#scheduled {
  appearance: none;
  flex: none;
  width: 14px;
  height: 14px;
  margin: 0;
  border: 1px solid #dcdfe6;
  border-radius: 2px;
  background: white;
  cursor: pointer;
}

#scheduled:checked {
  background: var(--blue);
  box-shadow: inset 0 0 0 3px white;
}

#when {
  min-height: var(--control-field);
  padding: 0;
  border: 0;
  background: transparent;
  color: #606266;
  font-size: var(--text-body);
  font-weight: 400;
  line-height: 1.4;
  white-space: nowrap;
  cursor: pointer;
}

#when:is(:hover, :focus-visible, [aria-expanded="true"]), #schedule-display {
  color: var(--blue);
}

#schedule-display {
  font-variant-numeric: tabular-nums;
}

#schedule-note {
  min-width: 0;
  justify-self: end;
  font-size: 13px;
  text-wrap: pretty;
}

@media (max-width: 560px) {
  .line.schedule { grid-template-columns: minmax(0, 1fr); }
  .schedule .row-title { line-height: 24px; }
  .schedule-body { grid-template-columns: minmax(0, 1fr); }
  #schedule-note { justify-self: start; }
  #when { flex-wrap: wrap; gap: 2px 6px; }
}

.schedule-date-fields input {
  width: 100%;
  border: 1px solid #dcdfe6;
  border-radius: var(--radius-control);
  background: white;
  color: #606266;
}

.schedule-date-fields input:hover { border-color: #c0c4cc; }
.schedule-date-fields input:focus { border-color: var(--blue); }

.schedule-clock {
  position: relative;
  display: inline-block;
  flex: none;
  width: 13px;
  height: 13px;
  border: 1px solid currentColor;
  border-radius: 50%;
  color: #909399;
}

.schedule-clock::before {
  position: absolute;
  top: 2px;
  left: 5px;
  width: 3px;
  height: 4px;
  border-bottom: 1px solid;
  border-left: 1px solid;
  content: "";
}

#schedule-time-toggle {
  position: absolute;
  top: 0;
  right: 3px;
  display: grid;
  width: 24px;
  height: 100%;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: #909399;
  cursor: pointer;
}

.schedule-layer {
  position: fixed;
  z-index: 3;
  outline: none;
}

.schedule-picker,
.schedule-time-picker {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #e4e7ed;
  border-radius: var(--radius-control);
  background: white;
  color: #606266;
  box-shadow: 0 2px 12px rgb(0 0 0 / 12%);
}

.schedule-picker {
  width: var(--schedule-panel-width, 322px);
  height: var(--schedule-panel-height, 428px);
}

.schedule-date-fields {
  display: grid;
  flex: none;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid #ebeef5;
}

.schedule-date-fields input {
  min-width: 0;
  height: var(--control-compact);
  padding: 0 8px;
  font-size: var(--text-input);
}

.schedule-date-fields input[aria-invalid="true"] { border-color: #d84946; }
.schedule-time-field { position: relative; }
#schedule-time { padding-right: 28px; }

.schedule-calendar {
  flex: 1 1 auto;
  min-height: 0;
  padding: 9px 12px 12px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.schedule-month-bar {
  display: grid;
  grid-template-columns: 24px 24px minmax(0, 1fr) 24px 24px;
  align-items: center;
  height: 40px;
  text-align: center;
}

.schedule-month-label { display: flex; justify-content: center; gap: 4px; }
.schedule-month-label button { font-size: var(--text-strong); font-weight: 500; }

.schedule-month-bar button,
.schedule-period button,
.schedule-days button,
.schedule-time-column button {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.schedule-month-bar button {
  display: grid;
  height: 28px;
  place-items: center;
}

.schedule-arrow {
  position: relative;
  width: 6px;
  height: 6px;
  border-top: 1px solid;
  border-right: 1px solid;
  transform: rotate(45deg);
}

.schedule-arrow.schedule-double::after {
  position: absolute;
  inset: 3px 3px -4px -4px;
  border-top: 1px solid;
  border-right: 1px solid;
  content: "";
}

.schedule-month-bar button:nth-child(-n+2) .schedule-arrow { transform: rotate(-135deg); }
.schedule-month-bar button:hover { color: var(--blue); }
.schedule-month-bar button:disabled { opacity: 0.4; cursor: default; }

.schedule-period { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 0; padding: 12px 0; }
.schedule-period button { height: var(--control-primary); font-size: var(--text-body); }
.schedule-period button[aria-pressed="true"], .schedule-period button:hover { color: var(--blue); }
.schedule-period button:disabled { color: #a8abb2; cursor: default; }

.schedule-week,
.schedule-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  text-align: center;
}

.schedule-week {
  align-items: center;
  height: var(--control-compact);
  border-bottom: 1px solid #ebeef5;
  font-size: var(--text-note);
}

.schedule-days button {
  display: grid;
  height: var(--control-field);
  place-items: center;
  font-size: var(--text-note);
}

.schedule-days button span {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 50%;
}

.schedule-days .outside { color: #909399; }
.schedule-days button:disabled { background: #f5f7fa; color: #a8abb2; cursor: default; }
.schedule-days button[aria-current="date"] { color: var(--blue); font-weight: 700; }
.schedule-days button:hover:not(:disabled) { color: var(--blue); }
.schedule-days button[aria-pressed="true"] span { background: var(--blue); color: white; }

.schedule-actions,
.schedule-time-actions {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid #ebeef5;
}

.schedule-actions { min-height: 48px; margin-top: auto; }

#schedule-error {
  min-width: 0;
  margin-right: auto;
  color: #bd3635;
  font-size: var(--text-note);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.schedule-actions button,
.schedule-time-actions button {
  flex: none;
  min-height: var(--control-compact);
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  background: white;
  color: #606266;
  font-size: var(--text-body);
  cursor: pointer;
}

.schedule-actions button:hover,
.schedule-time-actions button:hover { color: var(--blue); }
.schedule-actions .schedule-confirm,
.schedule-time-actions .schedule-confirm { border-color: #dcdfe6; color: var(--blue); }

.schedule-time-picker {
  position: absolute;
  top: calc(13px + var(--control-compact));
  right: 12px;
  width: min(182px, calc(100% - 24px));
  height: min(228px, calc(100% - 44px));
}

.schedule-time-columns {
  display: grid;
  flex: 1 1 auto;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  min-height: 0;
}

.schedule-time-column {
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-snap-type: y mandatory;
  scrollbar-width: thin;
}

.schedule-time-column + .schedule-time-column { border-left: 1px solid #ebeef5; }

.schedule-time-column::before,
.schedule-time-column::after {
  display: block;
  height: var(--schedule-time-spacer, 0px);
  content: "";
}

.schedule-time-column button {
  display: block;
  width: 100%;
  height: 30px;
  scroll-snap-align: center;
  font-size: var(--text-note);
  font-variant-numeric: tabular-nums;
}

.schedule-time-column button:hover { background: #f5f7fa; }
.schedule-time-column button[aria-selected="true"] { background: #eef3ff; color: var(--blue); font-weight: 700; }

