/* ==========================================================================
   当番表作成ツール 専用CSS
   すべてのカスタムクラスは drm- プレフィックスを付け、既存Bizroute CSSと
   衝突しないようにする。
   ========================================================================== */

/* ── Reset & Base ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  background: #f3f5f8;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI',
    'Hiragino Kaku Gothic Pro', 'Yu Gothic', 'Meiryo', sans-serif;
  color: #1f2937;
  line-height: 1.6;
}

button { font-family: inherit; }

:focus-visible {
  outline: 2px solid #2f6fb0;
  outline-offset: 2px;
}

@media (max-width: 991px) {
  body { padding-bottom: 64px; }
}

/* ── パンくず ──────────────────────────────────────────────────────── */
.drm-breadcrumb {
  max-width: 1180px;
  margin: 14px auto 0;
  padding: 0 16px;
}

/* ── SEO Header ───────────────────────────────────────────────────── */
.drm-seo-header {
  max-width: 1180px;
  margin: 10px auto 16px;
  padding: 0 16px;
}

.drm-seo-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 8px;
}

.drm-seo-lead {
  color: #444;
  margin-bottom: 4px;
  line-height: 1.75;
}

.drm-seo-lead-sub {
  color: #6b7280;
  font-size: 0.82rem;
  margin: 0 0 10px;
}

/* ── Main Layout ──────────────────────────────────────────────────── */
.drm-main-container {
  max-width: 1180px;
  margin: 0 auto 48px;
  padding: 0 16px;
}

.drm-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
}

@media (min-width: 992px) {
  .drm-main-grid {
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.25fr);
    align-items: start;
  }

  .drm-col-preview {
    align-self: start;
    min-width: 0;
  }

  .drm-col-preview .drm-section-card {
    position: sticky;
    top: 20px;
  }
}

/* ── 5ステップ案内 ───────────────────────────────────────────────── */
.drm-quick-flow {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 9px;
  margin: 0 0 12px;
  padding: 9px 12px;
  border: 1px solid #dbe7f3;
  border-radius: 8px;
  background: #f7faff;
  color: #315d8c;
  font-size: 0.8rem;
  font-weight: 600;
}

@media (max-width: 480px) {
  .drm-quick-flow {
    justify-content: flex-start;
    font-size: 0.74rem;
  }
}

.drm-sample-row {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 16px;
}

.drm-sample-msg {
  margin: -8px 0 16px;
  padding: 8px 10px;
  border-radius: 7px;
  background: #eef8f0;
  border: 1px solid #cfe9d4;
  color: #2c6b3a;
  font-size: 0.8rem;
}

/* ── Section Cards ────────────────────────────────────────────────── */
.drm-section-card {
  background: #fff;
  border-radius: 12px;
  padding: 18px 20px;
  border: 1px solid #e4e9f0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.drm-setting-section {
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid #eef1f5;
}

.drm-setting-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.drm-section-title {
  font-size: 1rem;
  font-weight: 700;
  color: #1f4f8a;
  margin: 0 0 10px;
}

/* ── フォーム部品 ─────────────────────────────────────────────────── */
.drm-form-field {
  margin-bottom: 14px;
}

.drm-form-field:last-child { margin-bottom: 0; }

.drm-two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.drm-two-col .drm-form-field { margin-bottom: 0; }

.drm-form-field label,
.drm-form-field-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #444;
  margin-bottom: 6px;
}

.drm-form-field input[type="text"],
.drm-form-field input[type="date"],
.drm-form-field select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.92rem;
  min-height: 42px;
  background: #fff;
  color: #111827;
}

.drm-form-field input:focus,
.drm-form-field select:focus {
  outline: none;
  border-color: #2f6fb0;
  box-shadow: 0 0 0 2px rgba(47, 111, 176, 0.2);
}

.drm-hint {
  font-size: 0.78rem;
  color: #6b7280;
  margin: 0 0 12px;
  line-height: 1.6;
}

.drm-field-help {
  display: block;
  margin-top: 5px;
  color: #6b7280;
  font-size: 0.76rem;
  font-weight: 400;
  line-height: 1.5;
}

.drm-field-error {
  margin: 6px 0 0;
  color: #a83232;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.5;
}

.drm-privacy-note {
  font-size: 0.78rem;
  color: #6b7280;
  margin: 8px 0 12px;
  line-height: 1.6;
}

.drm-save-status {
  font-size: 0.78rem;
  color: #2f6fb0;
  min-height: 1.2em;
  margin: 0 0 4px;
}

/* ── 曜日チェックボックス ─────────────────────────────────────────── */
.drm-weekday-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.drm-weekday-item {
  position: relative;
}

.drm-weekday-item input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}

.drm-weekday-item span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 38px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.86rem;
  font-weight: 700;
  color: #475569;
  background: #fff;
}

.drm-weekday-item input:checked + span {
  background: #2f6fb0;
  border-color: #2f6fb0;
  color: #fff;
}

.drm-weekday-item input:focus-visible + span {
  outline: 2px solid #2f6fb0;
  outline-offset: 2px;
}

.drm-weekday-item.is-sat input:checked + span { background: #4c7fb8; border-color: #4c7fb8; }
.drm-weekday-item.is-sun input:checked + span { background: #b85a5a; border-color: #b85a5a; }

.drm-btn-tiny {
  padding: 6px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #fff;
  color: #2f6fb0;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 32px;
}

.drm-btn-tiny:hover { background: #eaf2fb; }

/* ── セグメント切替 ───────────────────────────────────────────────── */
.drm-segmented {
  display: inline-flex;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  overflow: hidden;
  width: 100%;
}

.drm-segmented-option {
  position: relative;
  flex: 1 1 0;
}

.drm-segmented-option input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}

.drm-segmented-option span {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 10px;
  font-size: 0.86rem;
  font-weight: 600;
  color: #475569;
  min-height: 38px;
  border-right: 1px solid #cbd5e1;
  text-align: center;
}

.drm-segmented-option:last-child span { border-right: none; }

.drm-segmented-option input:checked + span {
  background: #2f6fb0;
  color: #fff;
}

.drm-segmented-option input:focus-visible + span {
  outline: 2px solid #2f6fb0;
  outline-offset: 2px;
}

/* ── 担当者入力 ───────────────────────────────────────────────────── */
.drm-members-textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 9px 11px;
  font: inherit;
  font-size: 0.9rem;
  resize: vertical;
  min-height: 140px;
}

.drm-members-textarea:focus {
  outline: none;
  border-color: #2f6fb0;
  box-shadow: 0 0 0 2px rgba(47, 111, 176, 0.2);
}

.drm-members-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.drm-members-count {
  font-size: 0.82rem;
  font-weight: 700;
  color: #2f6fb0;
}

.drm-members-warn {
  font-size: 0.78rem;
  color: #9a6b16;
  font-weight: 600;
}

/* ── 当番設定 ─────────────────────────────────────────────────────── */
.drm-duty-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.drm-duty-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid #e4e9f0;
  border-radius: 8px;
  background: #fafbfc;
}

.drm-duty-name {
  flex: 1 1 auto;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  font-size: 0.88rem;
  background: #fff;
}

.drm-duty-name:focus {
  outline: none;
  border-color: #2f6fb0;
  box-shadow: 0 0 0 2px rgba(47, 111, 176, 0.2);
}

.drm-duty-count {
  flex: none;
  width: 72px;
  padding: 8px 6px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  font-size: 0.86rem;
  background: #fff;
}

.drm-duty-remove {
  flex: none;
  width: 32px;
  height: 32px;
  border: 1px solid #f0d3d3;
  border-radius: 6px;
  background: #fff;
  color: #a83232;
  font-size: 0.9rem;
  cursor: pointer;
}

.drm-duty-remove:hover:not(:disabled) { background: #fbecec; }

.drm-duty-remove:disabled { opacity: 0.35; cursor: default; }

/* ── ボタン群 ─────────────────────────────────────────────────────── */
.drm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 16px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  color: #333;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s;
  min-height: 42px;
}

.drm-btn:hover { background: #eef2f7; }

.drm-btn-primary {
  background: #2f6fb0;
  border-color: #2f6fb0;
  color: #fff;
}

.drm-btn-primary:hover { background: #245a91; }

.drm-btn-outline {
  background: #fff;
  border-color: #2f6fb0;
  color: #2f6fb0;
}

.drm-btn-outline:hover { background: #eaf2fb; }

.drm-btn-subtle {
  background: #fff;
  border-color: #cbd5e1;
  color: #475569;
}

.drm-btn-subtle:hover { background: #f1f5f9; }

.drm-btn-block { width: 100%; }

.drm-btn-text-danger {
  background: none;
  border: none;
  color: #a83232;
  font-size: 0.82rem;
  text-decoration: underline;
  cursor: pointer;
  padding: 10px 4px;
  min-height: 40px;
}

.drm-btn-text-danger:hover { color: #7a1f1f; }

.drm-clear-row {
  display: flex;
  justify-content: flex-end;
}

/* ── 割り当てセクション ───────────────────────────────────────────── */
.drm-assign-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.drm-assign-actions .drm-btn { flex: 1 1 160px; }

/* ── 当番表編集テーブル ───────────────────────────────────────────── */
.drm-edit-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid #e4e9f0;
  border-radius: 8px;
}

.drm-edit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
  min-width: 360px;
}

.drm-edit-table th,
.drm-edit-table td {
  border-bottom: 1px solid #eef1f5;
  padding: 6px 7px;
  vertical-align: middle;
  text-align: left;
}

.drm-edit-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 700;
  font-size: 0.78rem;
  white-space: nowrap;
  position: sticky;
  top: 0;
}

.drm-edit-table tbody tr:last-child td { border-bottom: none; }

.drm-edit-table tr.is-sat td.drm-edit-daycol,
.drm-edit-table tr.is-sat th.drm-edit-daycol { background: #eaf3fc; }

.drm-edit-table tr.is-sun td.drm-edit-daycol,
.drm-edit-table tr.is-sun th.drm-edit-daycol { background: #fdecec; }

.drm-edit-daycol {
  white-space: nowrap;
  font-weight: 600;
  color: #1f2937;
}

.drm-edit-daycol.is-sat-text { color: #2f6fb0; }
.drm-edit-daycol.is-sun-text { color: #a83232; }

.drm-edit-cell-selects {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.drm-assign-select {
  min-width: 92px;
  padding: 6px 6px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 0.82rem;
  background: #fff;
  color: #111827;
}

.drm-assign-select:focus {
  outline: none;
  border-color: #2f6fb0;
  box-shadow: 0 0 0 2px rgba(47, 111, 176, 0.15);
}

.drm-edit-empty {
  padding: 18px 10px;
  text-align: center;
  color: #6b7280;
  font-size: 0.84rem;
}

/* ── 除外日 ───────────────────────────────────────────────────────── */
.drm-exclude-add-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.drm-exclude-add-row input[type="date"] {
  flex: 1 1 auto;
  padding: 9px 11px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.9rem;
  min-height: 42px;
}

.drm-exclude-add-row .drm-btn { flex: none; }

.drm-exclude-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.drm-exclude-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 6px 5px 10px;
  border: 1px solid #dbe3ec;
  border-radius: 999px;
  background: #f8fafc;
  font-size: 0.8rem;
  color: #334155;
}

.drm-exclude-chip button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: #e2e8f0;
  color: #475569;
  font-size: 0.78rem;
  cursor: pointer;
}

.drm-exclude-chip button:hover { background: #cbd5e1; }

.drm-exclude-empty {
  font-size: 0.8rem;
  color: #94a3b8;
}

/* ── 備考欄 ───────────────────────────────────────────────────────── */
.drm-checkbox-field {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.drm-checkbox-field input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #2f6fb0;
  cursor: pointer;
}

.drm-checkbox-field label {
  font-size: 0.88rem;
  font-weight: 600;
  color: #1f2937;
  cursor: pointer;
}

.drm-note-textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 9px 11px;
  font: inherit;
  font-size: 0.88rem;
  resize: vertical;
  min-height: 70px;
}

.drm-note-textarea:focus {
  outline: none;
  border-color: #2f6fb0;
  box-shadow: 0 0 0 2px rgba(47, 111, 176, 0.2);
}

/* ── 詳細設定 ─────────────────────────────────────────────────────── */
.drm-advanced-settings {
  margin: 2px 0 16px;
  border: 1px solid #dbe3ec;
  border-radius: 9px;
  background: #fbfcfe;
  overflow: hidden;
}

.drm-advanced-settings > summary {
  cursor: pointer;
  list-style: none;
  padding: 11px 13px;
  font-size: 0.88rem;
  font-weight: 700;
  color: #2f6fb0;
  display: flex;
  align-items: center;
  gap: 7px;
}

.drm-advanced-settings > summary::-webkit-details-marker { display: none; }

.drm-advanced-settings > summary::before {
  content: '▶';
  font-size: 0.68rem;
  transition: transform 0.15s;
}

.drm-advanced-settings[open] > summary::before { transform: rotate(90deg); }

.drm-advanced-inner {
  padding: 4px 13px 14px;
  border-top: 1px solid #edf1f5;
}

/* ── プレビュー・ツールバー ───────────────────────────────────────── */
.drm-preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.drm-preview-toolbar .drm-section-title { margin: 0; }

.drm-preview-guide {
  margin: 0 0 12px;
  padding: 8px 10px;
  border-radius: 7px;
  background: #f6f9fc;
  color: #64748b;
  font-size: 0.78rem;
  line-height: 1.55;
}

.drm-preview-zoom-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #475569;
}

.drm-preview-zoom-row select {
  padding: 6px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  background: #fff;
  color: #111827;
  min-height: 34px;
}

.drm-preview-zoom-row select:focus {
  outline: none;
  border-color: #2f6fb0;
  box-shadow: 0 0 0 2px rgba(47, 111, 176, 0.2);
}

/* ── A4プレビュー用紙 ─────────────────────────────────────────────── */
.drm-paper-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.drm-paper-stage {
  position: relative;
  margin: 0 auto;
}

.drm-paper {
  background: #fff;
  border: 1px solid #dbe3ec;
  border-radius: 4px;
  padding: 20px 18px;
  width: max-content;
  transform-origin: top left;
}

.drm-table-scroll {
  overflow-x: visible;
}

.drm-preview-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: #111827;
  margin: 0 0 10px;
  text-align: center;
}

.drm-preview-meta {
  text-align: center;
  margin: 0 0 18px;
}

.drm-preview-meta p {
  font-size: 0.88rem;
  color: #555;
  margin: 0;
}

.drm-preview-empty {
  color: #888;
  font-size: 0.88rem;
  text-align: center;
  padding: 30px 0;
}

.drm-preview-table {
  width: auto;
  min-width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}

.drm-preview-table th,
.drm-preview-table td {
  border: 1px solid #cbd5e1;
  vertical-align: middle;
  padding: 7px 8px;
  word-break: break-word;
  min-width: 70px;
}

.drm-preview-table th {
  background: #f2f6fb;
  color: #1f4f8a;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}

.drm-preview-table td { color: #111827; }

.drm-preview-table td.drm-col-day { text-align: center; white-space: nowrap; }

.drm-preview-table tr.is-sat td.drm-col-day,
.drm-preview-table tr.is-sat th.drm-col-day { background: #eaf3fc; }

.drm-preview-table tr.is-sun td.drm-col-day,
.drm-preview-table tr.is-sun th.drm-col-day { background: #fdecec; }

.drm-preview-table tr.is-sat td.drm-col-day { color: #1f4f8a; }
.drm-preview-table tr.is-sun td.drm-col-day { color: #a83232; }

.drm-preview-table td.drm-col-duty { text-align: center; }

/* 文字サイズ */
.drm-preview-table[data-fontsize="sm"] { font-size: 0.8rem; }
.drm-preview-table[data-fontsize="md"] { font-size: 0.9rem; }
.drm-preview-table[data-fontsize="lg"] { font-size: 1.02rem; }

/* 行の高さ */
.drm-preview-table[data-rowheight="compact"] th,
.drm-preview-table[data-rowheight="compact"] td { padding: 4px 6px; }

.drm-preview-table[data-rowheight="standard"] th,
.drm-preview-table[data-rowheight="standard"] td { padding: 8px 8px; }

.drm-preview-table[data-rowheight="relaxed"] th,
.drm-preview-table[data-rowheight="relaxed"] td { padding: 14px 8px; }

.drm-preview-note {
  margin-top: 16px;
  padding: 10px 12px;
  border: 1px solid #e4e9f0;
  border-radius: 8px;
  background: #fafbfc;
}

.drm-preview-note-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: #64748b;
  margin: 0 0 4px;
}

.drm-preview-note-body {
  font-size: 0.86rem;
  color: #1f2937;
  white-space: pre-wrap;
  min-height: 1.4em;
}

/* ── スマートフォン固定操作バー ───────────────────────────────────── */
.drm-mobile-action-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 900;
  display: flex;
  gap: 8px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
  background: #fff;
  border-top: 1px solid #e4e9f0;
  box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.1);
}

.drm-mobile-action-bar .drm-btn {
  flex: 1 1 0;
  min-height: 40px;
  padding: 8px 10px;
  font-size: 0.86rem;
}

@media (min-width: 992px) {
  .drm-mobile-action-bar { display: none; }
}

/* ── 解説エリア ───────────────────────────────────────────────────── */
.drm-doc-section {
  max-width: 1180px;
  margin: 40px auto 60px;
  padding: 0 16px;
  line-height: 1.8;
  color: #374151;
}

.drm-doc-section h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 40px 0 14px;
  color: #111827;
  border-left: 4px solid #2f6fb0;
  padding-left: 10px;
}

.drm-doc-section h2:first-of-type { margin-top: 0; }

.drm-doc-section h3 {
  font-size: 1.02rem;
  font-weight: 700;
  margin: 18px 0 8px;
  color: #1f2937;
}

.drm-doc-section p,
.drm-doc-section li {
  font-size: 0.92rem;
  line-height: 1.85;
  color: #374151;
}

.drm-doc-section p { margin: 0 0 12px; }

.drm-doc-section ul { margin: 0 0 12px; padding-left: 1.4em; }

.drm-doc-section li { margin-bottom: 4px; }

.drm-steps {
  list-style: none;
  counter-reset: drm-step;
  padding: 0;
  margin: 0 0 14px;
}

.drm-steps li {
  position: relative;
  padding: 10px 0 12px 34px;
  border-bottom: 1px solid #f3f4f6;
}

.drm-steps li:last-child { border-bottom: none; }

.drm-steps li::before {
  counter-increment: drm-step;
  content: counter(drm-step);
  position: absolute;
  left: 0;
  top: 10px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #2f6fb0;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.drm-faq-item {
  border-bottom: 1px solid #f3f4f6;
  padding: 12px 0;
}

.drm-faq-item:last-child { border-bottom: none; }

.drm-faq-q {
  font-weight: 700;
  color: #111827;
  margin: 0 0 6px;
}

.drm-faq-a {
  margin: 0;
}

/* 関連ページ */
.drm-related-link-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.drm-related-link-list li {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 12px 14px;
  background: #fff;
}

.drm-related-link-list a {
  color: #1d4ed8;
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
}

.drm-related-link-list a:hover { text-decoration: underline; }

.drm-related-link-list .drm-note {
  display: block;
  font-size: 0.8rem;
  color: #6b7280;
  font-weight: 400;
  margin-top: 2px;
}

/* ── レスポンシブ ─────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .drm-two-col { grid-template-columns: minmax(0, 1fr); }
  .drm-section-card { padding: 14px 14px 16px; }
  .drm-preview-toolbar { align-items: stretch; flex-direction: column; }
  .drm-preview-toolbar .drm-btn { width: 100%; }
  .drm-weekday-item span { width: 36px; height: 36px; font-size: 0.8rem; }
  .drm-exclude-add-row { flex-wrap: wrap; }
  .drm-exclude-add-row .drm-btn { flex: 1 1 100%; }
}

/* ── 印刷 ─────────────────────────────────────────────────────────── */
@media print {
  .no-print { display: none !important; }

  body {
    background: #fff;
    padding-bottom: 0;
  }

  .drm-main-grid { display: block; }

  .drm-col-preview .drm-section-card {
    position: static;
    box-shadow: none;
    border: none;
    padding: 0;
  }

  .drm-paper-wrap { overflow: visible; }

  .drm-table-scroll { overflow: visible; }

  .drm-paper-stage {
    width: auto !important;
    height: auto !important;
  }

  .drm-paper {
    border: none;
    padding: 0;
    width: auto !important;
    transform: none !important;
  }

  .drm-preview-table th,
  .drm-preview-table td { border: 1px solid #333; }

  .drm-preview-table tbody tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .drm-preview-table thead {
    display: table-header-group;
  }

  @page {
    size: A4 portrait;
    margin: 15mm;
  }
}

/* ========================================================================== 
   2026-08 UI整理版：操作順を明確化
   ========================================================================== */

.drm-visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* 上部フローは「入力 → 作成 → 確認」の3段階に絞る */
.drm-quick-flow {
  justify-content: flex-start;
  gap: 8px 10px;
  padding: 10px 12px;
  margin-bottom: 18px;
  background: #f6f9fd;
}

.drm-quick-flow span:not([aria-hidden="true"]) {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.drm-quick-flow b {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #2f6fb0;
  color: #fff;
  font-size: 0.74rem;
  line-height: 1;
}

/* 見出し右側に補助操作を置く */
.drm-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.drm-section-heading .drm-section-title {
  margin-bottom: 0;
}

/* 各入力ブロックを薄いカードとして認識しやすくする */
.drm-setting-section {
  padding: 16px;
  margin-bottom: 14px;
  border: 1px solid #e8edf3;
  border-radius: 10px;
  background: #fff;
}

.drm-setting-section:last-child {
  border-bottom: 1px solid #e8edf3;
  padding-bottom: 16px;
}

.drm-create-section {
  border-color: #cddff1;
  background: #f7faff;
}

.drm-create-section .drm-section-title {
  color: #174f88;
}

.drm-btn-create {
  width: 100%;
  min-height: 48px;
  font-size: 1rem;
  box-shadow: 0 2px 5px rgba(47, 111, 176, 0.16);
}

.drm-assign-actions {
  margin-top: 14px;
}

/* 自動作成前の編集欄はコンパクトに見せる */
.drm-edit-section:has(.drm-edit-empty) {
  padding-bottom: 12px;
}

.drm-edit-section:has(.drm-edit-empty) .drm-section-title {
  margin-bottom: 4px;
}

.drm-edit-section:has(.drm-edit-empty) .drm-edit-table-wrap {
  border-style: dashed;
  background: #fafbfc;
}

.drm-edit-section:has(.drm-edit-empty) .drm-edit-empty {
  padding: 12px 10px;
  font-size: 0.8rem;
}

/* 追加設定 */
.drm-extra-settings {
  margin-top: 2px;
  margin-bottom: 16px;
}

.drm-extra-settings > summary {
  justify-content: flex-start;
  min-height: 44px;
}

.drm-extra-settings > summary span {
  margin-left: auto;
  color: #7b8794;
  font-size: 0.75rem;
  font-weight: 500;
}

.drm-extra-block {
  padding: 14px 0;
  border-bottom: 1px solid #edf1f5;
}

.drm-extra-block:last-child {
  border-bottom: none;
  padding-bottom: 2px;
}

.drm-extra-title {
  margin: 0 0 9px;
  font-size: 0.9rem;
  font-weight: 700;
  color: #334155;
}

/* プレビュー上部を簡潔に */
.drm-preview-guide {
  padding: 7px 9px;
  margin-bottom: 10px;
}

.drm-preview-zoom-row {
  justify-content: flex-end;
  margin-bottom: 12px;
}

.drm-zoom-label {
  font-size: 0.78rem;
  color: #64748b;
}

.drm-zoom-buttons {
  display: inline-flex;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  overflow: hidden;
  background: #fff;
}

.drm-zoom-btn {
  min-height: 34px;
  padding: 6px 10px;
  border: 0;
  border-right: 1px solid #cbd5e1;
  background: #fff;
  color: #475569;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.drm-zoom-btn:last-child {
  border-right: 0;
}

.drm-zoom-btn:hover {
  background: #f1f5f9;
}

.drm-zoom-btn.is-active {
  background: #2f6fb0;
  color: #fff;
}

.drm-zoom-btn:focus-visible {
  position: relative;
  z-index: 1;
  outline: 2px solid #2f6fb0;
  outline-offset: -2px;
}

/* プレビュー領域を少し落ち着かせる */
.drm-col-preview .drm-section-card {
  background: #fbfcfe;
}

.drm-paper-wrap {
  padding: 6px;
  border-radius: 8px;
  background: #eef2f6;
}

.drm-paper {
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08);
}

/* 下部保存・初期化は主操作より弱く */
.drm-bottom-section {
  background: transparent;
  border: 0;
  padding: 4px 0 0;
}

.drm-bottom-section:last-child {
  border: 0;
  padding-bottom: 0;
}

@media (max-width: 640px) {
  .drm-section-heading {
    align-items: flex-start;
  }

  .drm-section-heading .drm-btn-tiny {
    white-space: nowrap;
  }

  .drm-setting-section {
    padding: 14px 12px;
  }

  .drm-extra-settings > summary span {
    display: none;
  }

  .drm-preview-zoom-row {
    justify-content: flex-start;
  }

  .drm-zoom-buttons {
    flex: 1 1 auto;
  }

  .drm-zoom-btn {
    flex: 1 1 0;
  }
}

@media print {
  .drm-paper-wrap {
    padding: 0;
    background: transparent;
  }

  .drm-paper {
    box-shadow: none;
  }
}
