/* ========================================================================== 
   整理券・番号札作成ツール
   PC: 左に設定 / 右にstickyプレビュー
   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 { font-family: inherit; }

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

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

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

.ntm-seo-header {
  margin-top: 10px;
  margin-bottom: 18px;
  padding: 0 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px 28px;
  align-items: center;
}

.ntm-hero-copy { min-width: 0; }

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

.ntm-seo-lead {
  margin: 0 0 12px;
  color: #444;
  line-height: 1.75;
}

.ntm-usecases {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.ntm-usecases li {
  padding: 4px 10px;
  border: 1px solid #dbe7f3;
  border-radius: 999px;
  background: #f7faff;
  color: #315d8c;
  font-size: 0.8rem;
}

.ntm-mini-sample {
  padding: 12px;
  background: #fff;
  border: 1px solid #e0e7ef;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
}

.ntm-mini-sample-label {
  margin: 0 0 7px;
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 600;
  text-align: center;
}

.ntm-mini-ticket-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.ntm-mini-ticket {
  min-width: 0;
  padding: 10px 4px;
  border: 1px dashed #64748b;
  background: #fff;
  text-align: center;
  line-height: 1.15;
}

.ntm-mini-ticket span {
  display: block;
  margin-bottom: 4px;
  color: #475569;
  font-size: 0.58rem;
}

.ntm-mini-ticket b {
  display: block;
  color: #111827;
  font-size: 1.14rem;
  font-variant-numeric: tabular-nums;
}

.ntm-quick-flow {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: 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;
}

.ntm-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;
}

/* ── メイン：PC左右配置 ───────────────────────────────────────── */
.ntm-main-container {
  margin-bottom: 48px;
  padding: 0 16px;
  display: grid;
  grid-template-columns: minmax(350px, .78fr) minmax(0, 1.22fr);
  gap: 20px;
  align-items: start;
}

.ntm-settings-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.ntm-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  color: #1f4f8a;
  font-size: 1.04rem;
  font-weight: 700;
}

.ntm-section-title > 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;
}

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

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

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

.ntm-form-field input[type="text"],
.ntm-form-field input[type="number"],
.ntm-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;
}

.ntm-form-field input:focus,
.ntm-form-field select:focus {
  border-color: #6b9ccc;
}

.ntm-form-field input[aria-invalid="true"] {
  border-color: #dc2626;
  background: #fffafa;
}

.ntm-field-note {
  margin: 6px 0 0;
  color: #6b7280;
  font-size: .76rem;
}

.ntm-error-text {
  min-height: 1em;
  margin: 5px 0 0;
  color: #b91c1c;
  font-size: .78rem;
  font-weight: 600;
}
.ntm-error-text:empty { display: none; }

.ntm-number-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 2px;
  padding: 10px 12px;
  border: 1px solid #cfe1f3;
  border-radius: 9px;
  background: #f5f9fe;
  color: #315d8c;
}

.ntm-number-summary-count { font-weight: 700; }
.ntm-number-summary-range {
  font-size: .9rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.ntm-number-summary-error {
  border-color: #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}

/* ── サイズ選択 ───────────────────────────────────────────────── */
.ntm-segmented {
  display: flex;
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  overflow: hidden;
}

.ntm-segmented-option {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
}

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

.ntm-segmented-option span {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 76px;
  padding: 9px 5px;
  border-right: 1px solid #cbd5e1;
  color: #475569;
  text-align: center;
  line-height: 1.3;
}

.ntm-segmented-option:last-child span { border-right: none; }
.ntm-segmented-option span b { font-size: .86rem; }
.ntm-segmented-option span small { margin-top: 2px; font-size: .7rem; font-weight: 500; }
.ntm-segmented-option span em { margin-top: 4px; color: #64748b; font-size: .65rem; font-style: normal; font-weight: 400; }

.ntm-segmented-option input:checked + span {
  background: #2f6fb0;
  color: #fff;
}
.ntm-segmented-option input:checked + span em { color: #eaf2fb; }
.ntm-segmented-option input:focus-visible + span { outline: 2px solid #2f6fb0; outline-offset: -2px; }

/* ── 詳細設定 ─────────────────────────────────────────────────── */
.ntm-details {
  margin-top: 4px;
  border-top: 1px solid #e5e7eb;
}

.ntm-details summary {
  position: relative;
  padding: 13px 26px 2px 0;
  color: #315d8c;
  font-size: .86rem;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}
.ntm-details summary::-webkit-details-marker { display: none; }
.ntm-details summary::after {
  content: "+";
  position: absolute;
  right: 2px;
  top: 11px;
  color: #64748b;
  font-size: 1.1rem;
  font-weight: 400;
}
.ntm-details[open] summary::after { content: "−"; }

.ntm-details-inner {
  margin-top: 10px;
  padding: 13px;
  border-radius: 9px;
  background: #f8fafc;
}

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

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

.ntm-preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

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

.ntm-preview-status { margin: 0 0 6px; color: #64748b; font-size: .8rem; font-weight: 600; }

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

.ntm-preview-zoom-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin: 0 0 12px;
  color: #64748b;
  font-size: .78rem;
  font-weight: 600;
  flex-wrap: wrap;
}

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

.ntm-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;
}
.ntm-zoom-btn:last-child { border-right: 0; }
.ntm-zoom-btn:hover { background: #f1f5f9; }
.ntm-zoom-btn.is-active { background: #2f6fb0; color: #fff; }
.ntm-zoom-btn:focus-visible {
  position: relative;
  z-index: 1;
  outline: 2px solid #2f6fb0;
  outline-offset: -2px;
}

.ntm-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;
}

.ntm-preview-placeholder {
  margin: 0 0 10px;
  padding: 18px 12px;
  border: 1px solid #fecaca;
  border-radius: 9px;
  background: #fef2f2;
  color: #b91c1c;
  text-align: center;
  font-size: .86rem;
}

.ntm-scale-wrap {
  overflow: auto;
  padding: 26px 14px 14px;
  border-radius: 10px;
  background: #e5e7eb;
}

.ntm-sheet-scale-item {
  position: relative;
  overflow: visible;
  margin: 0 auto 28px;
}
.ntm-sheet-scale-item:last-child { margin-bottom: 0; }

.ntm-sheet-page-label {
  position: absolute;
  top: -20px;
  left: 0;
  color: #4b5563;
  font-size: .72rem;
}

.ntm-sheet {
  position: relative;
  width: 210mm;
  height: 297mm;
  background: #fff;
  box-shadow: 0 2px 10px rgba(0,0,0,.18);
  transform-origin: top left;
}

.ntm-grid { position: absolute; display: grid; }

.ntm-ticket {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .3em;
  padding: 4px;
  border: 1px solid transparent;
  text-align: center;
}

.ntm-grid.ntm-border-solid .ntm-ticket { border-style: solid; border-color: #333; }
.ntm-grid.ntm-border-dashed .ntm-ticket { border-style: dashed; border-color: #555; }
.ntm-grid.ntm-border-none .ntm-ticket { border-color: transparent; }

.ntm-ticket-title {
  color: #374151;
  font-size: var(--ntm-title-size, 11pt);
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.ntm-ticket-number {
  color: #111827;
  font-size: var(--ntm-number-size, 32pt);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  line-height: 1.05;
}
.ntm-grid.ntm-bold .ntm-ticket-number { font-weight: 700; }

.ntm-ticket-supplement {
  color: #4b5563;
  font-size: var(--ntm-supp-size, 8pt);
  line-height: 1.3;
  overflow-wrap: anywhere;
}

/* ── 出力操作 ─────────────────────────────────────────────────── */
.ntm-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;
}
.ntm-btn:hover { background: #eef2f7; }

.ntm-btn-primary {
  border-color: #2f6fb0;
  background: #2f6fb0;
  color: #fff;
}
.ntm-btn-primary:hover { background: #245a91; }

.ntm-btn-outline {
  background: #fff;
  border-color: #2f6fb0;
  color: #2f6fb0;
}
.ntm-btn-outline:hover { background: #eaf2fb; }

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

.ntm-reset-row { margin-top: 8px; text-align: right; }

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

/* ── 解説 ─────────────────────────────────────────────────────── */
.ntm-doc-section {
  margin-top: 40px;
  margin-bottom: 60px;
  padding: 0 16px;
  color: #374151;
  line-height: 1.85;
}

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

.ntm-steps { counter-reset: ntm-step; margin: 0; padding: 0; list-style: none; }
.ntm-steps li { counter-increment: ntm-step; position: relative; margin-bottom: 14px; padding-left: 2.4em; }
.ntm-steps li::before {
  content: counter(ntm-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;
}

.ntm-usecase-list,
.related-links {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ntm-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; }

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

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

  .ntm-seo-header {
    max-width: 900px;
    grid-template-columns: 1fr;
  }
  .ntm-mini-sample { display: none; }

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

  .ntm-preview-sticky { position: static; }

  .ntm-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);
  }
  .ntm-mobile-action-bar .ntm-btn { flex: 1 1 0; min-height: 43px; }

  .ntm-preview-toolbar { align-items: stretch; flex-direction: column; }
  .ntm-preview-toolbar .ntm-btn { width: 100%; }
  .ntm-preview-zoom-row { justify-content: flex-start; }
  .ntm-zoom-buttons { flex: 1 1 auto; }
  .ntm-zoom-btn { flex: 1 1 0; }
}

@media (max-width: 560px) {
  .ntm-seo-header h1 { font-size: 1.42rem; }
  .ntm-quick-flow { justify-content: flex-start; font-size: .77rem; }

  .ntm-main-container { gap: 14px; }
  .ntm-section-card { padding: 16px; }
  .ntm-form-grid { grid-template-columns: 1fr; gap: 0; }

  .ntm-layout-segmented { display: grid; grid-template-columns: repeat(3, 1fr); }
  .ntm-segmented-option span { min-height: 72px; padding: 8px 3px; }
  .ntm-segmented-option span em { display: none; }

  .ntm-zoom-label { display: none; }

  .ntm-scale-wrap { padding: 25px 8px 10px; }
}

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

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

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

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

  .ntm-preview-area {
    padding: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }

  .ntm-preview-sticky { position: static !important; }

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

  .ntm-sheet-scale-item {
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
    overflow: visible !important;
  }

  .ntm-sheet {
    width: 210mm;
    height: 296mm;
    margin: 0;
    box-shadow: none;
    transform: none !important;
    page-break-after: always;
    break-after: page;
  }

  .ntm-sheet-scale-item:last-child .ntm-sheet {
    page-break-after: auto;
    break-after: auto;
  }

  .ntm-sheet-page-label { display: none !important; }

  @page { size: A4 portrait; margin: 0; }
}
