/* ===== 当番表メーカー ===== */

.tb-privacy-note {
  background-color: var(--accent-bg, #eef6ff);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 12px 16px;
  margin: 0 auto 20px;
  max-width: 1120px;
  font-size: 0.95rem;
  color: #333;
  text-align: center;
}

.tb-layout {
  display: flex;
  gap: 28px;
  max-width: 1120px;
  margin: 24px auto 40px;
  padding: 0 4px;
  align-items: flex-start;
}

/* --- フォーム --- */
.tb-form {
  width: 380px;
  flex-shrink: 0;
  text-align: left;
}

.tb-form .fs-title {
  font-size: 15px;
  font-weight: 700;
  color: #333;
  margin: 20px 0 8px;
  padding-bottom: 5px;
  border-bottom: 2px solid var(--accent, #2a9d8f);
}

.tb-form .fs-title:first-child {
  margin-top: 0;
}

.tb-form label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: #555;
  margin: 10px 0 4px;
}

.tb-form input[type="text"],
.tb-form input[type="number"],
.tb-form input[type="date"],
.tb-form select,
.tb-form textarea {
  width: 100%;
  box-sizing: border-box;
  font-size: 14px;
  color: #333;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fff;
  font-family: inherit;
}

.tb-form textarea {
  resize: vertical;
  line-height: 1.7;
}

.tb-form .fg-row {
  display: flex;
  gap: 8px;
}

.tb-form .fg-row > div {
  flex: 1;
  min-width: 0;
}

.tb-form .radio-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  margin-top: 6px;
}

.tb-form .radio-line label {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  font-size: 13.5px;
  font-weight: normal;
  color: #333;
  cursor: pointer;
}

.tb-form .radio-line input {
  width: auto;
}

.tb-form .field-hint {
  font-size: 11.5px;
  color: #888;
  margin: 6px 0 0;
  line-height: 1.6;
}

.tb-names-info {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent, #2a9d8f);
  margin: 6px 0 0;
  min-height: 1.2em;
}

.tb-btn-line {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.tb-sub-btn {
  padding: 6px 14px;
  font-size: 12.5px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fff;
  color: #555;
  cursor: pointer;
}

.tb-sub-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.tb-sub-btn.danger:hover {
  color: #c0392b;
  border-color: #c0392b;
}

/* --- 当番の種類 --- */
.tb-preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.tb-preset-chip {
  padding: 7px 10px;
  font-size: 12.5px;
  font-weight: 600;
  border: 1px solid #cbd5e1;
  border-radius: 16px;
  background: #fff;
  color: #444;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.tb-preset-chip:hover {
  border-color: var(--accent, #2a9d8f);
  color: var(--accent, #2a9d8f);
}

.tb-duty-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.tb-duty-color {
  flex: 0 0 14px;
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.12);
}

.tb-duty-row .tb-duty-name {
  flex: 1;
  min-width: 0;
}

.tb-duty-row .tb-duty-count {
  flex: 0 0 58px;
  width: 58px;
  text-align: center;
}

.tb-duty-unit {
  font-size: 12.5px;
  color: #555;
  flex-shrink: 0;
}

.tb-duty-del {
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
  border: 1px solid #ccc;
  border-radius: 50%;
  background: #fff;
  color: #888;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}

.tb-duty-del:hover {
  color: #c0392b;
  border-color: #c0392b;
}

.tb-add-duty {
  width: 100%;
  padding: 8px;
  font-size: 13px;
  font-weight: 600;
  border: 1px dashed #94a3b8;
  border-radius: 6px;
  background: #f8fafc;
  color: #475569;
  cursor: pointer;
}

.tb-add-duty:hover {
  border-color: var(--accent, #2a9d8f);
  color: var(--accent, #2a9d8f);
}

.tb-duty-info {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--accent, #2a9d8f);
  margin: 6px 0 0;
  min-height: 1.2em;
}

.tb-reset-btn {
  padding: 6px 14px;
  font-size: 12.5px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fff;
  color: #555;
  cursor: pointer;
  margin-top: 20px;
}

.tb-reset-btn:hover {
  color: #c0392b;
  border-color: #c0392b;
}

/* --- プレビュー側 --- */
.tb-preview {
  flex: 1;
  min-width: 0;
  position: sticky;
  top: 16px;
  align-self: flex-start;
  text-align: center;
}

.tb-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}

.tb-tab {
  flex: 1;
  padding: 11px 8px;
  font-size: 14px;
  font-weight: 700;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  color: #64748b;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.tb-tab.is-active {
  background: var(--accent, #2a9d8f);
  border-color: var(--accent, #2a9d8f);
  color: #fff;
}

.tb-btn-row {
  display: flex;
  gap: 10px;
}

.tb-print-btn,
.tb-png-btn {
  flex: 1;
  border: none;
  border-radius: 8px;
  padding: 14px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.tb-print-btn {
  background: var(--accent);
  color: #fff;
}

.tb-png-btn {
  background: #fff;
  color: var(--accent);
  border: 2px solid var(--accent);
  padding: 12px;
}

.tb-print-btn:hover,
.tb-png-btn:hover {
  opacity: 0.8;
}

.tb-print-note {
  font-size: 12px;
  color: #888;
  margin: 8px 0 12px;
  line-height: 1.5;
}

.tb-circle-guide {
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid #f0b429;
  background: #fff8e6;
  border-radius: 6px;
  font-size: 12.5px;
  color: #6b4e00;
  line-height: 1.6;
  text-align: left;
}

.tb-warn {
  display: none;
  margin: 0 0 10px;
  padding: 8px 10px;
  border: 1px solid #f5b7b1;
  background: #fdf2f0;
  border-radius: 6px;
  color: #c0392b;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.5;
  text-align: left;
}

.tb-preview-caption {
  font-size: 12px;
  color: #888;
  margin-top: 8px;
}

/* ===== A4シート（プレビュー兼 印刷対象） ===== */
.tb-sheet-box {
  overflow: hidden;
  border-radius: 4px;
}

.tb-sheet {
  background: #fff;
  box-sizing: border-box;
  position: relative;
  transform-origin: top left;
  overflow: hidden;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.18);
}

.tb-sheet[data-orient="landscape"] {
  width: 297mm;
  height: 210mm;
}

.tb-sheet[data-orient="portrait"] {
  width: 210mm;
  height: 297mm;
}

/* common.cssのレガシーグローバル（* { font-size:14px; color:#313838 }）対策 */
.tb-sheet * {
  font-size: inherit;
  color: inherit;
  font-family: inherit;
  line-height: inherit;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.tb-sheet .tb-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  font-size: 6mm;
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
}

/* --- ローテーション表 --- */
.tb-rot-inner {
  position: absolute;
  inset: 0;
  padding: 10mm 12mm;
  display: flex;
  flex-direction: column;
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
  color: #1e293b;
  line-height: 1.4;
}

.tb-rot-title {
  text-align: center;
  font-weight: 700;
  letter-spacing: 0.06em;
  flex-shrink: 0;
}

.tb-rot-table {
  width: 100%;
  flex: 1;
  border-collapse: collapse;
  table-layout: fixed;
  margin-top: 4mm;
}

.tb-rot-table th,
.tb-rot-table td {
  border: 0.45mm solid #64748b;
  text-align: center;
  vertical-align: middle;
  padding: 1mm 0.8mm;
  overflow: hidden;
}

.tb-rot-table thead th {
  background: #f1f5f9;
  font-weight: 700;
}

.tb-week-dates {
  display: block;
  font-weight: 500;
  color: #475569;
}

.tb-rot-table tbody th {
  font-weight: 700;
}

.tb-duty-sub {
  display: block;
  font-weight: 500;
}

.tb-rot-name {
  display: block;
  overflow-wrap: anywhere;
}

/* --- 円形当番表 --- */
.tb-circle-inner {
  position: absolute;
  inset: 0;
  padding: 10mm 12mm;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
  color: #1e293b;
  line-height: 1.4;
}

.tb-circle-title {
  text-align: center;
  font-weight: 700;
  letter-spacing: 0.06em;
  width: 100%;
}

.tb-circle-inner svg {
  display: block;
  width: 184mm;
  height: 184mm;
  margin-top: 3mm;
  flex-shrink: 0;
}

.tb-circle-footnote {
  margin-top: auto;
  font-size: 3.4mm;
  color: #64748b;
  text-align: center;
  line-height: 1.6;
  width: 100%;
}

/* ===== レスポンシブ ===== */
@media (max-width: 940px) {
  .tb-layout {
    flex-direction: column;
  }

  .tb-form {
    width: 100%;
  }

  .tb-preview {
    position: static;
    width: 100%;
  }
}

/* ===== 印刷用：アクティブなタブのシートだけをA4いっぱいに ===== */
@media print {
  @page {
    margin: 0;
  }

  html,
  body {
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
    height: auto !important;
  }

  body > *:not(.container) {
    display: none !important;
  }

  .container {
    margin: 0 !important;
    padding: 0 !important;
    max-width: none !important;
    width: auto !important;
  }

  .container > *:not(.tb-layout) {
    display: none !important;
  }

  .tb-layout {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    max-width: none !important;
  }

  .tb-layout > *:not(.tb-preview) {
    display: none !important;
  }

  .tb-preview {
    position: static !important;
    margin: 0 !important;
    padding: 0 !important;
    width: auto !important;
  }

  .tb-preview > *:not(.tb-panel) {
    display: none !important;
  }

  .tb-panel[hidden] {
    display: none !important;
  }

  .tb-panel > *:not(.tb-sheet-wrap) {
    display: none !important;
  }

  .tb-sheet-box {
    height: auto !important;
    margin: 0 !important;
    overflow: visible !important;
    border-radius: 0 !important;
  }

  .tb-sheet {
    transform: none !important;
    box-shadow: none !important;
    margin: 0 !important;
    overflow: hidden !important;
  }

  /* 長辺を1mm縮めて2ページ目への溢れを防ぐ */
  .tb-sheet[data-orient="landscape"] {
    width: 296mm !important;
    height: 209mm !important;
  }

  .tb-sheet[data-orient="portrait"] {
    width: 209mm !important;
    height: 296mm !important;
  }
}
