.scene-planning {
  --plan-border: #dee7f1;
  --plan-sub: #52637a;
  --plan-accent: #164e9f;
  min-width: 0;
}

.plan-card {
  margin-bottom: 12px;
}

.plan-card h2,
.plan-preview-modal h2 {
  margin: 0 0 10px;
  font-size: clamp(1.12rem, 2.5vw, 1.45rem);
  line-height: 1.35;
}

.plan-card .v2-btn,
.plan-preview-modal .v2-btn {
  min-height: 36px;
}

.plan-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.plan-actions .v2-select {
  width: auto;
}

.plan-hint,
.plan-status {
  margin: 6px 0 11px;
  color: var(--plan-sub, #52637a);
  line-height: 1.5;
}

.plan-create-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 168px), 1fr));
  gap: 10px;
  align-items: end;
}

.plan-create-form label,
.plan-week-nav label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--plan-sub);
  font-size: 13px;
  font-weight: 700;
}

.plan-create-form .v2-input,
.plan-week-nav .v2-select {
  min-width: 0;
  width: 100%;
}

.plan-create-form .plan-actions,
.plan-create-form .plan-status {
  grid-column: 1 / -1;
}

.plan-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 174px), 1fr));
  gap: 6px;
  margin-bottom: 12px;
}

.plan-overview > div {
  display: grid;
  gap: 3px;
  padding: 8px 10px;
  border: 1px solid var(--plan-border);
  border-radius: 8px;
}

.plan-overview span {
  color: var(--plan-sub);
  font-size: 12px;
}

.plan-week-nav {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 8px;
  flex-wrap: wrap;
}

.plan-days,
.plan-timeline,
.plan-topic-list {
  list-style: none;
  margin: 10px 0;
  padding: 0;
}

.plan-days {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 128px), 1fr));
  gap: 6px;
}

.plan-days button {
  display: grid;
  gap: 4px;
  align-content: start;
  width: 100%;
  height: 100%;
  padding: 8px;
  border: 1px solid var(--plan-border);
  border-radius: 8px;
  background: #fff;
  color: var(--text-main);
  text-align: start;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.plan-days button[aria-pressed="true"] {
  border-color: #bed6ef;
  background: #eff6ff;
}

.plan-days button:hover {
  border-color: #a4c4e8;
}

.plan-days strong,
.plan-days time {
  display: block;
}

.plan-days time {
  margin-bottom: 1px;
  color: var(--plan-accent);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.plan-alert {
  border-color: #f2c8c8;
  background: #fff8f8;
}

.plan-alert h2 {
  color: #9f2a2a;
}

.plan-timeline li,
.plan-topic-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  padding: 8px 0;
  border-bottom: 1px solid var(--plan-border);
}

.plan-timeline li {
  display: grid;
  grid-template-columns: minmax(104px, 132px) minmax(0, 1fr) auto;
}

.plan-timeline time {
  color: var(--plan-accent);
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.plan-timeline p {
  margin: 3px 0 0;
  color: var(--plan-sub);
  font-size: 13px;
}

.plan-topics {
  margin-top: 9px;
}

.plan-topics summary {
  cursor: pointer;
  font-weight: 700;
}

.plan-topics .v2-btn {
  margin: 5px 4px 0 0;
}

.plan-topic-list input[type="checkbox"] {
  margin: 0 0 0 2px;
}

.plan-topic-list small {
  display: block;
  margin-top: 3px;
  color: var(--plan-sub);
}

.plan-topic-button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  min-width: 0;
  width: 100%;
  padding: 4px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--text-main);
  text-align: start;
  font: inherit;
  cursor: pointer;
}

.plan-topic-button:hover {
  background: #f2f7fd;
}

.plan-topic-open {
  flex: 0 0 auto;
  color: var(--plan-accent);
  font-size: 13px;
  font-weight: 700;
}

.plan-preview-modal {
  width: min(100%, 860px);
  max-width: 860px;
  max-height: 90vh;
  overflow-y: auto;
}

.plan-preview-modal header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 10px;
}

.plan-preview-tools {
  margin-bottom: 10px;
}

.plan-handout-unit,
.plan-handout-question {
  margin: 0 0 12px;
  padding: 10px 0;
  border-top: 1px solid #dfe6ef;
}

.plan-handout-unit :is(h3, h4),
.plan-handout-question h4 {
  margin: 0 0 5px;
}

.plan-handout-unit details {
  margin: 4px 0;
}

.plan-handout-unit summary {
  padding: 3px;
  cursor: pointer;
  font-weight: 750;
}

.plan-micro-note {
  color: #864015;
  background: #fff8e9;
}

.plan-copy {
  margin: 5px 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.plan-question-image {
  display: block;
  max-width: 100%;
  max-height: 320px;
  object-fit: contain;
}

@media (max-width: 580px) {
  .plan-timeline li {
    grid-template-columns: minmax(0, 1fr);
    justify-items: start;
    gap: 4px;
  }
}

@media print {
  body.plan-printing .v2-main {
    display: none !important;
  }

  .plan-question-image {
    max-height: 56mm;
  }
}
