/* ==========================================================================
   月間予定表作成ツール
   PC: 左に設定 / 右に大きめのプレビュー
   SP: 設定 → プレビューの1カラム
   ========================================================================== */

*, *::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, input, select, textarea { font-family: inherit; }

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

/* ── パンくず・導入 ───────────────────────────────────────────── */
.mpm-breadcrumb,
.mpm-seo-header,
.mpm-main-container,
.mpm-doc-section {
  max-width: 1180px;
  margin-left: auto;
  margin-right: auto;
}

.mpm-breadcrumb { margin-top: 14px; padding: 0 16px; }

.mpm-seo-header {
  margin-top: 10px;
  margin-bottom: 14px;
  padding: 0 16px;
}

.mpm-seo-header h1 {
  margin: 0 0 8px;
  font-size: 1.58rem;
  font-weight: 700;
  line-height: 1.4;
}

.mpm-seo-lead {
  margin: 0 0 12px;
  max-width: 760px;
  color: #444;
  line-height: 1.75;
}


.mpm-quick-flow {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 9px;
  margin: 0;
  padding: 9px 12px;
  border: 1px solid #dbe7f3;
  border-radius: 9px;
  background: #f7faff;
  color: #315d8c;
  font-size: 0.82rem;
  font-weight: 600;
  list-style: none;
}
.mpm-quick-flow li span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin-right: 4px;
  border-radius: 50%;
  background: #2f6fb0;
  color: #fff;
  font-size: 0.72rem;
}

/* ── メインレイアウト ─────────────────────────────────────────── */
.mpm-main-container {
  margin-bottom: 48px;
  padding: 0 16px;
  display: grid;
  grid-template-columns: minmax(300px, .48fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.mpm-settings-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mpm-section-card {
  background: #fff;
  border: 1px solid #e4e9f0;
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: 0 2px 8px rgba(0,0,0,.05);
}

.mpm-section-card > summary {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0 30px 0 0;
  color: #1f4f8a;
  font-size: 1.02rem;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}
.mpm-section-card > summary::-webkit-details-marker { display: none; }
.mpm-section-card > summary::after {
  content: "+";
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  color: #64748b;
  font-size: 1.3rem;
  font-weight: 400;
}
.mpm-section-card[open] > summary::after { content: "\2212"; }

.mpm-section-card > summary > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 25px;
  height: 25px;
  flex: 0 0 25px;
  border-radius: 50%;
  background: #eaf2fb;
  color: #1f4f8a;
  font-size: .82rem;
}

.mpm-section-body { margin-top: 16px; }

/* ── フォーム ─────────────────────────────────────────────────── */
.mpm-two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.mpm-form-field { margin-bottom: 14px; }
.mpm-form-field:last-child { margin-bottom: 0; }

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

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

.mpm-checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  color: #333;
  font-size: .88rem;
  cursor: pointer;
}
.mpm-checkbox-row input { width: 18px; height: 18px; flex: 0 0 18px; }

/* ── セグメント選択 ───────────────────────────────────────────── */
.mpm-segmented {
  display: flex;
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  overflow: hidden;
}
.mpm-segmented-option { position: relative; flex: 1 1 0; min-width: 0; }
.mpm-segmented-option input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.mpm-segmented-option span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 9px 5px;
  border-right: 1px solid #cbd5e1;
  color: #475569;
  text-align: center;
  line-height: 1.3;
  font-size: .86rem;
}
.mpm-segmented-option:last-child span { border-right: none; }
.mpm-segmented-option input:checked + span { background: #2f6fb0; color: #fff; }
.mpm-segmented-option input:focus-visible + span { outline: 2px solid #2f6fb0; outline-offset: -2px; }

/* ── 保存の案内・クリア ───────────────────────────────────────── */
.mpm-storage-note {
  margin: 4px 0 0;
  padding: 9px 12px;
  border-radius: 8px;
  background: #f8fafc;
  color: #6b7280;
  font-size: .78rem;
  line-height: 1.6;
}

.mpm-clear-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.mpm-btn-text-danger {
  min-height: 40px;
  padding: 8px 4px;
  border: none;
  background: none;
  color: #a83232;
  font-size: .82rem;
  text-decoration: underline;
  cursor: pointer;
}
.mpm-btn-text-danger:hover { color: #7a1f1f; }

.mpm-btn-text-outline {
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #fff;
  color: #475569;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
}
.mpm-btn-text-outline:hover:not(:disabled) { background: #f1f5f9; }
.mpm-btn-text-outline:disabled { opacity: .45; cursor: not-allowed; }

/* ── プレビュー ───────────────────────────────────────────────── */
.mpm-preview-area {
  position: sticky;
  top: 16px;
  align-self: start;
  min-width: 0;
  padding: 14px;
  background: #f8fafc;
  border-radius: 12px;
}

.mpm-preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}
.mpm-preview-toolbar h2 {
  margin: 0;
  color: #1f4f8a;
  font-size: 1.04rem;
  font-weight: 700;
}
.mpm-preview-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.mpm-preview-guide {
  margin: 0 0 10px;
  color: #64748b;
  font-size: .78rem;
}

.mpm-zoom-buttons {
  display: inline-flex;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  overflow: hidden;
  background: #fff;
}
.mpm-zoom-btn {
  min-height: 34px;
  padding: 6px 10px;
  border: 0;
  border-right: 1px solid #cbd5e1;
  background: #fff;
  color: #475569;
  font: inherit;
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
}
.mpm-zoom-btn:last-child { border-right: 0; }
.mpm-zoom-btn:hover { background: #f1f5f9; }
.mpm-zoom-btn.is-active { background: #2f6fb0; color: #fff; }
.mpm-zoom-btn:focus-visible { position: relative; z-index: 1; outline: 2px solid #2f6fb0; outline-offset: -2px; }

.mpm-scale-wrap {
  overflow: auto;
  padding: 18px 12px 12px;
  border-radius: 10px;
  background: #e5e7eb;
}

#mpmPreviewContainer {
  position: relative;
  margin: 0 auto;
}

/* ── 用紙（.mpm-paper） ───────────────────────────────────────── */
.mpm-paper {
  position: relative;
  display: flex;
  flex-direction: column;
  background: #fff;
  box-shadow: 0 2px 10px rgba(0,0,0,.18);
  transform-origin: top left;
  color: #23282f;
}
.mpm-orientation-landscape { width: 297mm; height: 210mm; }
.mpm-orientation-portrait { width: 210mm; height: 297mm; }
.mpm-margin-standard { padding: 10mm; }
.mpm-margin-narrow { padding: 5mm; }

.mpm-paper-title {
  flex: none;
  margin: 0 0 1mm;
  color: #1f2937;
  font-size: 6mm;
  font-weight: 700;
  line-height: 1.3;
}
.mpm-paper-subtitle {
  flex: none;
  margin: 0 0 2mm;
  color: #556072;
  font-size: 3.2mm;
  line-height: 1.4;
}

/* ── カレンダーグリッド ───────────────────────────────────────── */
.mpm-calendar-wrap {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1mm;
  overflow: hidden;
}

.mpm-weekday-head {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1mm 0;
  color: #475569;
  font-size: 3mm;
  font-weight: 700;
  border-bottom: 0.4mm solid #cbd5e1;
}
.mpm-weekday-head.mpm-sun { color: #b93838; }
.mpm-weekday-head.mpm-sat { color: #2f6fb0; }

.mpm-day {
  position: relative;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 0.25mm solid #d8dee6;
  background: #fff;
}
.mpm-day.mpm-out-of-month { background: #fafafa; }
.mpm-day.mpm-cell-blank { border-color: transparent; background: transparent; }

.mpm-day-head {
  flex: none;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1mm;
  padding: 0.8mm 1.2mm 0;
}

.mpm-day-num {
  color: #23282f;
  font-size: 3.4mm;
  font-weight: 700;
  line-height: 1;
}
.mpm-day.mpm-out-of-month .mpm-day-num { color: #b6bcc6; }
.mpm-day.mpm-sun .mpm-day-num,
.mpm-day.mpm-holiday .mpm-day-num { color: #b93838; }
.mpm-day.mpm-sat .mpm-day-num { color: #2f6fb0; }
.mpm-day.mpm-out-of-month.mpm-sun .mpm-day-num,
.mpm-day.mpm-out-of-month.mpm-sat .mpm-day-num,
.mpm-day.mpm-out-of-month.mpm-holiday .mpm-day-num { color: #d8b3b3; }

.mpm-holiday-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #b93838;
  font-size: 2mm;
  font-weight: 600;
}
.mpm-day.mpm-out-of-month .mpm-holiday-name { color: #d8b3b3; }

.mpm-day-note {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 1mm 1.2mm;
  color: #23282f;
  font-size: 2.8mm;
  line-height: 1.35;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  cursor: text;
}
.mpm-day-note:empty::before {
  content: "";
}
.mpm-day:hover .mpm-day-note:empty::before,
.mpm-day-note:focus:empty::before {
  content: attr(data-placeholder);
  color: #b3bac4;
}
.mpm-day-note:focus { outline: 1.5px solid #2f6fb0; outline-offset: -1.5px; }
.mpm-day.mpm-out-of-month .mpm-day-note { color: #9aa2b1; }

/* 文字サイズ設定 */
.mpm-font-sm .mpm-day-note { font-size: 2.3mm; }
.mpm-font-md .mpm-day-note { font-size: 2.8mm; }
.mpm-font-lg .mpm-day-note { font-size: 3.4mm; }


/* ── 月間メモ ─────────────────────────────────────────────────── */
.mpm-memo {
  flex: none;
  margin-top: 2mm;
  padding-top: 2mm;
  border-top: 0.3mm solid #cbd5e1;
}
.mpm-memo-label {
  margin-bottom: 1mm;
  color: #475569;
  font-size: 2.8mm;
  font-weight: 700;
}
.mpm-memo-body {
  min-height: 16mm;
  padding: 1.2mm;
  color: #23282f;
  font-size: 2.8mm;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  cursor: text;
}
.mpm-memo-body:empty::before {
  content: attr(data-placeholder);
  color: #b3bac4;
}
.mpm-memo-body:focus { outline: 1.5px solid #2f6fb0; outline-offset: -1.5px; }

/* ── 出力操作 ─────────────────────────────────────────────────── */
.mpm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 16px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  color: #1f2937;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
}
.mpm-btn:hover { background: #eef2f7; }
.mpm-btn-primary { border-color: #2f6fb0; background: #2f6fb0; color: #fff; }
.mpm-btn-primary:hover { background: #245a91; }
.mpm-btn-outline { background: #fff; border-color: #2f6fb0; color: #2f6fb0; }
.mpm-btn-outline:hover { background: #eaf2fb; }

/* ── モバイル固定操作 ─────────────────────────────────────────── */
.mpm-mobile-action-bar { display: none; }

/* ── 解説 ─────────────────────────────────────────────────────── */
.mpm-doc-section {
  margin-top: 40px;
  margin-bottom: 60px;
  padding: 0 16px;
  color: #374151;
  line-height: 1.85;
}
.mpm-doc-section h2 {
  margin: 38px 0 14px;
  padding-left: 10px;
  border-left: 4px solid #1d4ed8;
  color: #111827;
  font-size: 1.22rem;
  font-weight: 700;
}
.mpm-doc-section h2:first-of-type { margin-top: 0; }
.mpm-doc-section h3 { margin: 0 0 6px; color: #1d4ed8; font-size: 1rem; font-weight: 700; }
.mpm-doc-section p,
.mpm-doc-section li { color: #374151; font-size: .92rem; line-height: 1.85; }
.mpm-doc-section p { margin: 0 0 12px; }
.mpm-doc-section a { color: #1d4ed8; font-weight: 600; }

.mpm-steps { counter-reset: mpm-step; margin: 0; padding: 0; list-style: none; }
.mpm-steps li { counter-increment: mpm-step; position: relative; margin-bottom: 14px; padding-left: 2.4em; }
.mpm-steps li::before {
  content: counter(mpm-step);
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.7em;
  height: 1.7em;
  border-radius: 50%;
  background: #1d4ed8;
  color: #fff;
  font-size: .875rem;
  font-weight: 700;
}

.mpm-usecase-list,
.related-links {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.mpm-usecase-list li,
.related-links li a {
  display: block;
  margin: 0;
  padding: 11px 13px;
  border: 1px solid #e5e7eb;
  border-radius: 9px;
  background: #fff;
  font-size: .88rem;
}
.related-links li a { text-decoration: none; }
.related-links li a:hover { background: #eff6ff; }

.mpm-faq-item {
  margin-bottom: 10px;
  padding: 13px 16px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
}
.mpm-faq-item p { margin: 0; }

/* ── レスポンシブ ─────────────────────────────────────────────── */
@media (max-width: 991px) {
  body { padding-bottom: 66px; }

  .mpm-seo-header { max-width: 900px; }
  .mpm-main-container {
    max-width: 900px;
    grid-template-columns: 1fr;
  }

  .mpm-preview-area { position: static; }

  .mpm-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));
    border-top: 1px solid #e4e9f0;
    background: #fff;
    box-shadow: 0 -2px 10px rgba(0,0,0,.06);
  }
  .mpm-mobile-action-bar .mpm-btn { flex: 1 1 0; min-height: 43px; }

  .mpm-preview-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }
  .mpm-preview-actions {
    width: 100%;
    justify-content: flex-start;
  }
  .mpm-preview-toolbar #mpmPrintBtnTop { display: none; }
  .mpm-zoom-buttons { width: 100%; }
  .mpm-zoom-btn { flex: 1 1 0; }
}

@media (max-width: 560px) {
  .mpm-seo-header h1 { font-size: 1.42rem; }
  .mpm-quick-flow { font-size: .77rem; }
  .mpm-main-container { gap: 14px; }
  .mpm-section-card { padding: 16px; }
  .mpm-two-col { grid-template-columns: 1fr; gap: 0; }
  .mpm-scale-wrap { padding: 16px 8px 10px; }
}

/* ── 印刷 ─────────────────────────────────────────────────────── */
@media print {
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

  .no-print { display: none !important; }

  body { margin: 0; padding: 0; background: #fff; }

  .mpm-main-container {
    display: block !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .mpm-settings-column { display: none !important; }

  .mpm-preview-area {
    padding: 0 !important;
    background: none !important;
    border-radius: 0 !important;
  }

  .mpm-scale-wrap {
    all: unset !important;
    display: block !important;
  }

  #mpmPreviewContainer {
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
  }

  .mpm-paper {
    margin: 0 !important;
    box-shadow: none !important;
    transform: none !important;
  }

  .mpm-day-note,
  .mpm-memo-body { overflow: hidden !important; }
}
