.schedule-page {
  display: grid;
  gap: 24px;
}

.schedule-create-card,
.schedule-list {
  min-width: 0;
}

.card-heading,
.section-heading,
.list-heading,
.schedule-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.card-heading {
  margin-bottom: 22px;
}

.card-heading h2,
.section-heading h3,
.schedule-summary h3 {
  margin: 0;
}

.card-heading p,
.section-heading p,
.schedule-summary p {
  margin: 3px 0 0;
}

.schedule-form {
  display: grid;
  gap: 18px;
}

.form-section {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
}

.section-heading {
  justify-content: flex-start;
  margin-bottom: 20px;
}

.section-number {
  display: grid;
  place-items: center;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--blue);
  color: white;
  font-weight: 800;
}

.form-fields,
.repeat-fields {
  display: grid;
  gap: 16px;
}

.time-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.schedule-form label {
  display: grid;
  gap: 7px;
  min-width: 0;
  font-weight: 700;
}

.schedule-form input,
.schedule-form select,
.schedule-form textarea {
  width: 100%;
  min-width: 0;
  padding: 11px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: white;
  font: inherit;
}

.schedule-form textarea {
  resize: vertical;
}

.compact-field {
  max-width: 360px;
}

.file-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
}

.file-field button {
  white-space: nowrap;
}

.selected-file-info,
.schedule-form label small {
  color: var(--muted);
  font-weight: 500;
}

.repeat-fields {
  grid-template-columns: minmax(260px, 1fr) minmax(220px, 360px);
  align-items: end;
}

.schedule-form .check {
  display: flex;
  align-items: center;
  min-height: 44px;
  font-weight: 600;
}

.schedule-form .check input {
  width: auto;
}

.expected-end {
  margin-top: 16px;
  padding: 11px 14px;
  border-radius: 8px;
  background: #eff6ff;
  color: #1e40af;
  font-weight: 700;
}

.form-error {
  display: none;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fee2e2;
  color: #991b1b;
}

.form-error.visible {
  display: block;
}

.schedule-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 4px;
}

.schedule-count {
  padding: 5px 10px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #475569;
  font-weight: 800;
}

.schedule-cards {
  display: grid;
  gap: 12px;
}

.schedule-item {
  display: grid;
  grid-template-columns: 144px minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
}

.schedule-thumbnail {
  width: 144px;
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  border-radius: 9px;
  background: #e2e8f0;
  color: var(--muted);
  font-size: 12px;
}

.schedule-thumbnail img {
  position: absolute;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

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

.schedule-title-row h3,
.schedule-title-row p,
.schedule-meta span {
  overflow-wrap: anywhere;
}

.schedule-meta {
  display: grid;
  grid-template-columns: minmax(170px, auto) minmax(180px, 1fr) auto;
  gap: 8px 20px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.schedule-meta span {
  min-width: 0;
}

.schedule-meta b {
  margin-right: 7px;
  color: #334155;
}

.schedule-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.schedule-empty {
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
}

.media-browser {
  width: min(680px, calc(100% - 32px));
  border: 0;
  border-radius: 14px;
  padding: 0;
  box-shadow: 0 20px 60px #0f172a55;
}

.media-browser::backdrop {
  background: #0f172a99;
}

.media-browser-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.media-browser-header small {
  display: block;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.media-browser-list {
  display: grid;
  gap: 7px;
  max-height: 55vh;
  overflow: auto;
  padding: 16px 20px 22px;
}

.media-entry {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  text-align: left;
}

.media-entry.selected {
  border-color: var(--blue);
  background: #dbeafe;
}

.entry-icon {
  flex: 0 0 28px;
  font-size: 21px;
}

.entry-copy {
  display: grid;
  min-width: 0;
}

.entry-copy strong,
.entry-copy small {
  overflow-wrap: anywhere;
}

.entry-copy small {
  color: var(--muted);
  font-weight: 500;
}

.media-entry:hover {
  border-color: #93c5fd;
  background: #eff6ff;
}

.media-browser-error {
  padding: 0 20px;
  color: #991b1b;
}

.media-browser-error:not(:empty) {
  padding-top: 14px;
}

.media-selection {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  min-height: 86px;
  margin: 0 20px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
}

.media-selection-preview {
  width: 96px;
  height: 60px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 7px;
  background: #e2e8f0;
}

.media-selection-preview:empty::after {
  content: "미리보기";
  color: var(--muted);
  font-size: 11px;
}

.media-selection-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-selection p {
  overflow-wrap: anywhere;
}

.media-browser-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px 20px;
}

.media-browser-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

@media (max-width: 900px) {
  .time-fields,
  .repeat-fields {
    grid-template-columns: 1fr;
  }

  .schedule-item {
    grid-template-columns: 120px minmax(0, 1fr);
  }

  .schedule-thumbnail {
    width: 120px;
  }

  .schedule-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }

  .schedule-meta {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .form-section {
    padding: 16px;
  }

  .file-field {
    grid-template-columns: 1fr 1fr;
  }

  .file-field input {
    grid-column: 1 / -1;
  }

  .schedule-item {
    grid-template-columns: 1fr;
  }

  .schedule-thumbnail {
    width: 100%;
    max-width: 320px;
  }

  .schedule-title-row {
    flex-direction: column;
  }

  .schedule-actions,
  .schedule-form-actions {
    justify-content: stretch;
  }

  .schedule-actions > *,
  .schedule-form-actions > * {
    flex: 1;
    text-align: center;
  }
}
