/* ── Page header ──────────────────────────────────── */
.plan-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.plan-title {
  font-size: 22px;
  font-weight: 700;
  color: #1e293b;
  margin: 0;
}

/* ── Card ─────────────────────────────────────────── */
.plan-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 22px 24px;
  margin-bottom: 16px;
}
.plan-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.plan-card-title {
  font-size: 15px;
  font-weight: 700;
  color: #1e293b;
  margin: 0;
}
.plan-mode-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
}
.plan-hint {
  font-size: 13px;
  color: #64748b;
  margin: 0 0 18px;
  line-height: 1.5;
}

/* ── Params row ───────────────────────────────────── */
.plan-params {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.plan-param {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.plan-param label {
  font-size: 12px;
  font-weight: 600;
  color: #475569;
}
.plan-param input[type="number"] {
  width: 110px;
  padding: 8px 10px;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
  font-family: inherit;
  background: #f8fafc;
}
.plan-param input[type="number"]:focus {
  outline: none;
  border-color: #2563eb;
  background: #fff;
}

.plan-notify-row {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}

.plan-notify-row .plan-toggle {
  min-width: 260px;
}

.plan-notify-row .plan-param {
  min-width: 170px;
}

.plan-notify-row .plan-btn {
  flex-shrink: 0;
}

.plan-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid #dbe2ea;
  background: #f8fafc;
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}

.plan-toggle input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.plan-toggle-switch {
  position: relative;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: #cbd5e1;
  flex-shrink: 0;
  transition: background .15s;
}

.plan-toggle-switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .25);
  transition: transform .15s;
}

.plan-toggle-copy {
  line-height: 1.35;
}

.plan-toggle.is-active {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1d4ed8;
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, .08);
}

.plan-toggle.is-active .plan-toggle-switch {
  background: #2563eb;
}

.plan-toggle.is-active .plan-toggle-switch::after {
  transform: translateX(18px);
}

.plan-toggle.is-inactive {
  background: #f8fafc;
  border-color: #e2e8f0;
  color: #64748b;
}

.plan-notify-row.is-disabled,
.plan-toggle.is-disabled {
  cursor: not-allowed;
}

.plan-toggle.is-disabled {
  opacity: .7;
}

#matchReminderMinutesWrap.is-disabled {
  opacity: .5;
}

#matchReminderMinutesWrap.is-disabled input {
  cursor: not-allowed;
}

#matchReminderMinutesWrap input:disabled {
  background: #f1f5f9;
  color: #94a3b8;
}

.plan-soon-notice {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  color: #475569;
  font-size: 13px;
  font-weight: 600;
}

.plan-soon-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 10px;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

/* ── Round list (multi-day) ───────────────────────── */
.plan-round-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 20px;
}
.plan-round-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  flex-wrap: wrap;
}
.plan-round-label {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
  min-width: 160px;
}
.plan-round-count {
  font-size: 11px;
  color: #94a3b8;
  font-weight: 500;
  flex-shrink: 0;
}
.plan-dt-input {
  padding: 7px 10px;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  color: #1e293b;
  background: #fff;
  flex-shrink: 0;
  min-width: 170px;
  cursor: pointer;
}
.plan-dt-input:focus {
  outline: none;
  border-color: #2563eb;
}
.plan-dt-input.has-value {
  border-color: #86efac;
  background: #f0fdf4;
}

/* ── Primary button ───────────────────────────────── */
.plan-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, transform .1s;
}
.plan-btn:active { transform: scale(.98); }
.plan-btn-primary {
  background: #2563eb;
  color: #fff;
}
.plan-btn-primary:hover { background: #1d4ed8; }
.plan-btn-primary:disabled { background: #94a3b8; cursor: not-allowed; }
.plan-btn-secondary {
  background: #fff;
  color: #1e293b;
  border: 1px solid #cbd5e1;
}
.plan-btn-secondary:hover { background: #f8fafc; }
.plan-btn-secondary:disabled {
  background: #f8fafc;
  color: #94a3b8;
  border-color: #e2e8f0;
  cursor: not-allowed;
  opacity: 1;
}
.plan-btn-inline {
  padding: 8px 12px;
  font-size: 12px;
  min-width: 74px;
}

/* ── Section label ────────────────────────────────── */
.plan-section {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #94a3b8;
  margin: 20px 0 8px;
}
.plan-section:first-child { margin-top: 0; }

.plan-round-header {
  font-size: 12px;
  font-weight: 700;
  color: #475569;
  margin: 12px 0 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid #f1f5f9;
}

/* ── Match row (manual) ───────────────────────────── */
.plan-match-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.plan-match-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #e8edf5;
  background: #fff;
  transition: border-color .15s;
  flex-wrap: wrap;
}
.plan-match-row:hover { border-color: #cbd5e1; }
.plan-match-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.plan-group-name {
  font-size: 10px;
  font-weight: 800;
  color: #2563eb;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.plan-meta-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.plan-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .02em;
}
.plan-badge-group {
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
}
.plan-badge-home {
  background: #f8fafc;
  color: #475569;
  border: 1px solid #e2e8f0;
}
.plan-teams-stack {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-right: 36px;
}
.plan-team-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.plan-home-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.plan-team-line-away {
  opacity: .9;
}
.plan-team-name {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.plan-home-tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 999px;
  background: #f8fafc;
  color: #94a3b8;
  border: 1px solid #e2e8f0;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
  flex-shrink: 0;
}
.plan-swap-icon {
  position: static;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid #dbe2ea;
  background: #fff;
  color: #94a3b8;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, border-color .15s, color .15s, transform .15s;
}
.plan-swap-icon:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #1e293b;
}
.plan-swap-icon:active {
  transform: scale(.97);
}
.plan-venue {
  font-size: 11px;
  color: #64748b;
}
.plan-match-dt {
  padding: 6px 10px;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: 12px;
  font-family: inherit;
  color: #1e293b;
  background: #f8fafc;
  flex-shrink: 0;
  min-width: 150px;
  cursor: pointer;
}
.plan-match-dt:focus {
  outline: none;
  border-color: #2563eb;
  background: #fff;
}
.plan-match-dt.has-value {
  border-color: #86efac;
  background: #f0fdf4;
}
.plan-save-status {
  font-size: 11px;
  font-weight: 600;
  color: #16a34a;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity .2s;
  min-width: 24px;
  text-align: center;
}
.plan-save-status.visible { opacity: 1; }

/* ── Phase break row ─────────────────────────────── */
.plan-phase-break {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  margin: 14px 0;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px dashed #cbd5e1;
  font-size: 12px;
  color: #64748b;
}
.plan-phase-break-input {
  width: 65px;
  padding: 5px 8px;
  border: 1.5px solid #e2e8f0;
  border-radius: 6px;
  font-size: 12px;
  font-family: inherit;
  color: #1e293b;
  text-align: center;
  background: #fff;
}
.plan-phase-break-input:focus {
  outline: none;
  border-color: #2563eb;
}
.plan-phase-break-status {
  font-size: 11px;
  font-weight: 600;
  color: #16a34a;
  opacity: 0;
  transition: opacity .2s;
}
.plan-phase-break-status.visible { opacity: 1; }

.plan-actions-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 18px;
}

/* ── Empty state ──────────────────────────────────── */
.plan-empty {
  text-align: center;
  padding: 40px 20px;
  color: #94a3b8;
  font-size: 14px;
}

/* ── Mobile ───────────────────────────────────────── */
@media (max-width: 600px) {
  .plan-card {
    padding: 16px;
  }

  .plan-params,
  .plan-notify-row {
    gap: 12px;
  }

  .plan-param,
  .plan-param input[type="number"],
  .plan-dt-input,
  .plan-match-dt,
  .plan-btn,
  .plan-btn-inline {
    width: 100%;
  }

  .plan-round-row {
    gap: 8px;
  }

  .plan-round-label,
  .plan-round-count {
    min-width: 0;
    width: 100%;
  }

  .plan-match-row {
    align-items: stretch;
    gap: 12px;
    padding: 12px;
  }

  .plan-match-info {
    width: 100%;
  }

  .plan-teams-stack {
    padding-right: 0;
  }

  .plan-team-line {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .plan-team-name {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    line-height: 1.35;
    word-break: break-word;
  }

  .plan-venue {
    line-height: 1.4;
  }

  .plan-dt-input,
  .plan-match-dt {
    font-size: 12px;
    min-width: 0;
  }

  .plan-actions-footer {
    justify-content: stretch;
  }

  .plan-phase-break {
    flex-wrap: wrap;
    align-items: center;
  }

  .flatpickr-calendar {
    width: min(calc(100vw - 24px), 320px);
    max-width: min(calc(100vw - 24px), 320px);
  }

  .flatpickr-calendar .flatpickr-rContainer,
  .flatpickr-calendar .flatpickr-days,
  .flatpickr-calendar .dayContainer,
  .flatpickr-calendar .flatpickr-time {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .flatpickr-calendar .dayContainer {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }

  .flatpickr-calendar .flatpickr-day {
    max-width: none;
    width: 100%;
  }
}
