.rc-main {
  padding-bottom: 2.5rem;
}

.rc-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.rc-stats {
  font-size: 0.9rem;
  color: var(--muted);
}

.rc-dot {
  margin: 0 0.25rem;
}

.rc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.rc-actions button {
  margin: 0;
  font-size: 0.85rem;
}

.rc-export-area {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1rem;
  box-shadow: var(--shadow);
}

.rc-print-header {
  display: none;
}

.rc-pattern-grid .rc-day {
  cursor: grab;
  user-select: none;
  touch-action: none;
  transition: box-shadow 0.12s ease, transform 0.12s ease;
}

.rc-pattern-grid .rc-day:active {
  cursor: grabbing;
}

.rc-pattern-grid .rc-day.is-dragging {
  opacity: 0.45;
  transform: scale(0.96);
}

.rc-pattern-grid .rc-day.is-drop-target {
  outline: 2px solid #6366f1;
  outline-offset: 1px;
}

.rc-pattern-grid .rc-day.is-picked {
  outline: 2px solid #6366f1;
  outline-offset: 1px;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

.rc-pattern-grid .rc-day.is-changed {
  box-shadow: inset 0 0 0 2px rgba(99, 102, 241, 0.85);
}

.rc-pattern-grid .rc-day.is-rest {
  background: var(--surface-2);
  color: var(--muted);
}

.rc-changes-summary {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
}

.rc-changes-summary h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.rc-changes-summary ul {
  margin: 0;
  padding-left: 1.2rem;
  font-size: 0.88rem;
}

.rc-changes-summary li {
  margin-bottom: 0.25rem;
}

.rc-legend {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.rc-legend h3 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
}

.rc-legend-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.rc-legend-item {
  font-size: 0.78rem;
  padding: 0.2rem 0.45rem;
  border-radius: 0.35rem;
  border: 1px solid var(--border);
  color: #111;
}

.rc-legend-note {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

@media print {
  @page {
    size: A4 landscape;
    margin: 8mm;
  }

  body {
    background: #fff !important;
    color: #111 !important;
  }

  .site-header,
  .rc-no-print {
    display: none !important;
  }

  .rc-main {
    padding: 0;
    max-width: none;
  }

  .rc-export-area {
    border: none;
    box-shadow: none;
    padding: 0;
  }

  .rc-print-header {
    display: block;
    margin-bottom: 0.35rem;
  }

  .rc-print-header h2 {
    margin: 0 0 0.15rem;
    font-size: 1rem;
  }

  .rc-print-meta {
    margin: 0;
    font-size: 0.75rem;
    color: #444;
  }

  .rc-pattern-grid {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .ww-pattern-grid {
    gap: 1px;
  }

  .rc-pattern-grid .rc-day {
    font-size: 0.48rem !important;
    min-height: 0 !important;
    padding: 0.12rem 0.05rem !important;
    line-height: 1.15;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .rc-legend {
    margin-top: 0.35rem;
    padding-top: 0.35rem;
    border-top: 1px solid #ccc;
  }

  .rc-legend h3 {
    font-size: 0.75rem;
    margin-bottom: 0.25rem;
  }

  .rc-legend-note {
    display: none;
  }

  .rc-legend-item {
    font-size: 0.6rem;
    padding: 0.1rem 0.3rem;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .rc-changes-summary {
    margin-top: 0.5rem;
    padding: 0.5rem 0.65rem;
    page-break-before: avoid;
    break-inside: auto;
  }

  .rc-changes-summary h3 {
    font-size: 0.8rem;
    margin-bottom: 0.35rem;
  }

  .rc-changes-summary ul {
    font-size: 0.65rem;
    columns: 2;
    column-gap: 1.5rem;
  }

  .rc-changes-summary li {
    break-inside: avoid;
  }
}

@media (max-width: 640px) {
  .rc-actions {
    width: 100%;
  }

  .rc-actions button {
    flex: 1 1 calc(50% - 0.25rem);
  }
}
