/* ==========================================================
   利用規約 (/terms) — 社内規程書レイアウト
   - 角丸・影・グラデーション・アニメーション・アイコンは使わない
   - 本文/見出し: Noto Serif JP、ナビ/ラベル/注記: Noto Sans JP
   - 色はこの変数の中だけで組む
   ========================================================== */
.tm-page, #terms-consent {
  --tm-bg: #fbfaf7;
  --tm-paper: #ffffff;
  --tm-ink: #1a1c20;
  --tm-ink-2: #44474d;
  --tm-note: #7a7d83;
  --tm-rule: #d6d3cc;
  --tm-rule-strong: #1a1c20;
  --tm-navy: #1c2433;
  --tm-vermilion: #a3241c;
  --tm-serif: 'Noto Serif JP', 'Hiragino Mincho ProN', 'Yu Mincho', 'YuMincho', serif;
  --tm-sans: 'Noto Sans JP', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', sans-serif;
}

/* ---------- ページ骨格 ---------- */
.tm-page {
  min-height: 100vh; background: var(--tm-bg); color: var(--tm-ink);
  font-family: var(--tm-sans); -webkit-font-smoothing: antialiased;
}
html:has(.tm-page) { scroll-padding-top: 72px; scroll-behavior: auto; }

.tm-bar {
  position: sticky; top: 0; z-index: 20; height: 56px; background: var(--tm-navy); color: #fff;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 24px;
}
.tm-bar-brand { display: inline-flex; align-items: baseline; gap: 14px; color: #fff; text-decoration: none; }
.tm-bar-name { font-family: var(--tm-serif); font-weight: 500; font-size: 18px; letter-spacing: .28em; }
.tm-bar-sub { font-family: var(--tm-sans); font-weight: 400; font-size: 11px; letter-spacing: .22em; color: rgba(255, 255, 255, .72); }
.tm-bar-btn {
  display: inline-flex; align-items: center; height: 32px; padding: 0 14px; border: 1px solid rgba(255, 255, 255, .7);
  color: #fff; font-size: 12.5px; font-weight: 500; letter-spacing: .06em; text-decoration: none; border-radius: 0; background: transparent;
}
.tm-bar-btn:hover { background: #fff; color: var(--tm-navy); border-color: #fff; }

.tm-layout {
  max-width: 1120px; margin: 0 auto; padding: 40px 24px 72px;
  display: grid; grid-template-columns: 240px minmax(0, 1fr); column-gap: 48px; align-items: start;
}
.tm-side { position: sticky; top: 72px; }
.tm-main { min-width: 0; }

/* ---------- 目次 ---------- */
.tm-toc { font-family: var(--tm-sans); }
.tm-toc-title { font-size: 12px; font-weight: 700; letter-spacing: .3em; color: var(--tm-ink-2); margin: 0 0 8px; padding-bottom: 8px; border-bottom: 2px solid var(--tm-rule-strong); }
.tm-toc-list { list-style: none; margin: 0; padding: 0; max-height: calc(100vh - 140px); overflow-y: auto; }
.tm-toc-list li { border-bottom: 1px solid var(--tm-rule); }
.tm-toc-list a {
  display: flex; gap: 8px; align-items: baseline; padding: 7px 4px; color: var(--tm-ink-2); text-decoration: none;
  font-size: 12.5px; line-height: 1.5; font-weight: 400;
}
.tm-toc-list a:hover { color: var(--tm-ink); }
.tm-toc-list a.is-current { color: var(--tm-ink); font-weight: 700; }
.tm-toc-no { flex: 0 0 auto; min-width: 3.6em; color: var(--tm-note); font-variant-numeric: tabular-nums; }
.tm-toc-list a.is-current .tm-toc-no { color: var(--tm-ink); }
.tm-toc-name { min-width: 0; }

/* ---------- 文書面 ---------- */
.tm-doc {
  background: var(--tm-paper); border: 1px solid var(--tm-rule); border-radius: 0; box-shadow: none;
  padding: 64px 72px; color: var(--tm-ink);
  font-family: var(--tm-serif); font-weight: 400; font-size: 15.5px; line-height: 1.95;
  font-feature-settings: 'palt' 0;
}
.tm-doc p { margin: 0; }

.tm-doc-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; font-family: var(--tm-sans); }
.tm-doc-no { font-size: 12px; letter-spacing: .08em; color: var(--tm-ink-2); padding-top: 6px; }
.tm-stamp {
  display: inline-block; border: 2px solid var(--tm-vermilion); color: var(--tm-vermilion);
  font-family: var(--tm-serif); font-weight: 700; font-size: 15px; letter-spacing: .3em; text-indent: .3em;
  padding: 6px 10px 6px 12px; line-height: 1; border-radius: 0;
}

.tm-head { text-align: center; margin: 36px 0 32px; }
.tm-subtitle { font-family: var(--tm-sans); font-size: 12.5px; letter-spacing: .14em; color: var(--tm-ink-2); margin-bottom: 10px; }
.tm-title { font-family: var(--tm-serif); font-weight: 700; font-size: 32px; letter-spacing: .6em; text-indent: .6em; line-height: 1.3; color: var(--tm-ink); margin: 0; }

.tm-meta-table {
  width: 100%; border-collapse: collapse; margin: 0 0 40px;
  border-top: 2px solid var(--tm-rule-strong); border-bottom: 2px solid var(--tm-rule-strong);
  font-size: 14px;
}
.tm-meta-table th, .tm-meta-table td { padding: 9px 12px; text-align: left; vertical-align: top; border-top: 1px solid var(--tm-rule); }
.tm-meta-table tr:first-child th, .tm-meta-table tr:first-child td { border-top: none; }
.tm-meta-table th { width: 7.5em; font-family: var(--tm-sans); font-weight: 500; color: var(--tm-ink-2); letter-spacing: .1em; }
.tm-meta-table td { font-family: var(--tm-serif); color: var(--tm-ink); }

/* ---------- 遵守事項の要点 ---------- */
.tm-summary { margin: 0 0 44px; }
.tm-band {
  background: var(--tm-ink); color: #fff; font-family: var(--tm-sans); font-weight: 700; font-size: 14px; letter-spacing: .2em;
  padding: 8px 14px; margin: 0; line-height: 1.5;
}
.tm-summary-table { width: 100%; border-collapse: collapse; border-bottom: 1px solid var(--tm-rule); font-size: 14.5px; }
.tm-summary-table th, .tm-summary-table td { padding: 14px 14px; vertical-align: top; border-top: 1px solid var(--tm-rule); text-align: left; }
.tm-summary-table tr:first-child th, .tm-summary-table tr:first-child td { border-top: none; }
.tm-summary-table th { width: 3.5em; font-family: var(--tm-serif); font-weight: 500; font-size: 18px; color: var(--tm-ink); text-align: center; border-right: 1px solid var(--tm-rule); }
.tm-summary-table td p { line-height: 1.85; color: var(--tm-ink-2); }
.tm-summary-table .tm-lead { font-weight: 700; color: var(--tm-ink); margin-bottom: 4px; }

/* ---------- 条文 ---------- */
.tm-article { margin: 0 0 36px; scroll-margin-top: 72px; }
.tm-art-head {
  display: flex; align-items: baseline; gap: 14px; margin: 0 0 14px; padding-bottom: 8px;
  border-bottom: 2px solid var(--tm-rule-strong);
  font-family: var(--tm-serif); font-weight: 700; font-size: 17px; line-height: 1.5; color: var(--tm-ink);
}
.tm-art-no { flex: 0 0 auto; min-width: 4em; letter-spacing: .04em; }
.tm-art-title { min-width: 0; }
.tm-tag-important {
  margin-left: auto; flex: 0 0 auto; align-self: center;
  font-family: var(--tm-sans); font-weight: 700; font-size: 11.5px; letter-spacing: .2em; text-indent: .2em;
  color: var(--tm-vermilion); border: 1px solid var(--tm-vermilion); padding: 2px 7px; line-height: 1.4; border-radius: 0;
}

/* 項 (1, 2, …) と 号 ((1), (2), …) — 法令の書き方に合わせる */
.tm-doc ol, .tm-doc ul { margin: 0; padding: 0; list-style: none; }
.tm-article > ol, .tm-article > div > ol, .tm-supp > ol { counter-reset: tm-para; }
.tm-article > ol > li, .tm-article > div > ol > li, .tm-supp > ol > li {
  position: relative; padding-left: 2em; margin: 0 0 6px; counter-increment: tm-para;
}
.tm-article > ol > li::before, .tm-article > div > ol > li::before, .tm-supp > ol > li::before {
  content: counter(tm-para); position: absolute; left: .3em; top: 0; font-variant-numeric: tabular-nums; color: var(--tm-ink);
}
.tm-article > div > p { margin-bottom: 6px; }
/* 号: 第7条の一覧 (ol.tm-go) と、項の中の ul */
.tm-article ol.tm-go, .tm-article li > ul { counter-reset: tm-item; margin-top: 4px; }
.tm-article ol.tm-go > li, .tm-article li > ul > li {
  position: relative; padding-left: 2.6em; margin: 0 0 4px; counter-increment: tm-item; color: var(--tm-ink-2);
}
.tm-article ol.tm-go > li::before, .tm-article li > ul > li::before {
  content: '（' counter(tm-item) '）'; position: absolute; left: 0; top: 0; letter-spacing: -.1em; color: var(--tm-ink-2); font-variant-numeric: tabular-nums;
}
/* 第7条は項立てではなく号のみ: 「1」番号の代わりに（1）を使う */
.tm-article > div > ol.tm-go > li::before { content: '（' counter(tm-item) '）'; left: 0; }
.tm-article > div > ol.tm-go > li { padding-left: 2.6em; }

/* 第6条 強調ブロック: 色箱ではなく上下の二重線で区切る。強調語は下線 */
.tm-must { border-top: 3px double var(--tm-rule-strong); border-bottom: 3px double var(--tm-rule-strong); padding: 16px 4px; margin: 0 0 16px; background: none; border-radius: 0; }
.tm-must-title { font-weight: 700; font-size: 16px; margin: 0 0 8px; color: var(--tm-ink); }
.tm-must p { color: var(--tm-ink); }
.tm-must strong { font-weight: 700; color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }

/* ---------- 附則 / 署名 / フッター ---------- */
.tm-supp { margin-top: 48px; }
.tm-supp-head { text-align: center; font-family: var(--tm-serif); font-weight: 700; font-size: 17px; letter-spacing: .3em; text-indent: .3em; margin: 0 0 14px; }
.tm-sign { text-align: right; margin-top: 40px; font-size: 15px; line-height: 2; }
.tm-foot { margin-top: 56px; padding-top: 12px; border-top: 1px solid var(--tm-rule); font-family: var(--tm-sans); font-size: 11.5px; color: var(--tm-note); letter-spacing: .06em; }
.tm-foot-note { margin-top: 2px; }

/* ---------- レスポンシブ ---------- */
@media (max-width: 900px) {
  .tm-layout { grid-template-columns: minmax(0, 1fr); padding: 24px 16px 56px; }
  .tm-side { display: none; }
  .tm-doc { padding: 36px 24px; }
  .tm-title { font-size: 26px; letter-spacing: .4em; text-indent: .4em; }
  .tm-bar { padding: 0 16px; }
  .tm-bar-sub { display: none; }
}
@media (max-width: 520px) {
  .tm-doc { padding: 28px 16px; font-size: 15px; }
  .tm-doc-top { flex-direction: column-reverse; align-items: flex-end; gap: 8px; }
  .tm-art-head { flex-wrap: wrap; gap: 6px 12px; }
  .tm-tag-important { margin-left: 0; }
}

/* ---------- 同意モーダル (他ページから読み込む) ---------- */
#terms-consent {
  position: fixed; inset: 0; z-index: 10000; background: rgba(26, 28, 32, .7);
  display: flex; align-items: center; justify-content: center; padding: 1rem;
  font-family: var(--tm-sans);
}
#terms-consent .tc-box {
  background: var(--tm-paper); border: 1px solid var(--tm-rule); border-radius: 0; width: 100%; max-width: 860px; max-height: 92vh;
  display: flex; flex-direction: column; overflow: hidden; box-shadow: none;
}
#terms-consent .tc-head { padding: 14px 20px; background: var(--tm-navy); color: #fff; }
#terms-consent .tc-head h2 { font-family: var(--tm-serif); font-size: 17px; font-weight: 700; letter-spacing: .08em; display: flex; align-items: center; gap: .5rem; }
#terms-consent .tc-head p { font-size: 12px; color: rgba(255, 255, 255, .78); margin-top: 4px; }
#terms-consent .tc-body { flex: 1; overflow: auto; padding: 20px; background: var(--tm-bg); }
#terms-consent .tc-body .tm-doc { padding: 32px 36px; font-size: 14px; line-height: 1.85; }
#terms-consent .tc-body .tm-title { font-size: 24px; }
#terms-consent .tc-foot { padding: 14px 20px; border-top: 1px solid var(--tm-rule); background: var(--tm-paper); }
#terms-consent .tc-check { display: flex; gap: .6rem; align-items: flex-start; font-size: 14px; cursor: pointer; color: var(--tm-ink); }
#terms-consent .tc-check input { margin-top: .3rem; width: 1.05rem; height: 1.05rem; accent-color: var(--tm-navy); }
#terms-consent .tc-actions { display: flex; justify-content: space-between; align-items: center; gap: .75rem; margin-top: .75rem; flex-wrap: wrap; }
#terms-consent .tc-hint { font-size: 12px; color: var(--tm-note); }
body.terms-consent-open { overflow: hidden; }

/* ---------- 印刷 ---------- */
@media print {
  .tm-bar, .tm-side, .no-print { display: none !important; }
  .tm-page { background: #fff; }
  .tm-layout { display: block; max-width: none; padding: 0; }
  .tm-doc { border: none; padding: 0; font-size: 10.5pt; line-height: 1.8; }
  .tm-title { font-size: 20pt; }
  .tm-art-head { font-size: 12pt; break-after: avoid; }
  .tm-article, .tm-summary, .tm-must, .tm-meta-table, .tm-sign { break-inside: avoid; }
  .tm-article > ol > li, .tm-article > div > ol > li { break-inside: avoid; }
  .tm-band { background: #000 !important; color: #fff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .tm-stamp, .tm-tag-important { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .tm-foot { position: static; }
}

/* 附則: 改定履歴 */
.tm-rev-table { width: 100%; border-collapse: collapse; margin-top: 18px; font-size: 13.5px; border-top: 1px solid var(--tm-rule); border-bottom: 1px solid var(--tm-rule); }
.tm-rev-table caption { text-align: left; font-family: var(--tm-sans); font-size: 12px; font-weight: 700; letter-spacing: .12em; color: var(--tm-ink-2); padding: 0 0 6px; caption-side: top; }
.tm-rev-table th, .tm-rev-table td { padding: 8px 10px; vertical-align: top; text-align: left; border-top: 1px solid var(--tm-rule); }
.tm-rev-table tr:first-child th, .tm-rev-table tr:first-child td { border-top: none; }
.tm-rev-table th { width: 9em; font-family: var(--tm-sans); font-weight: 500; color: var(--tm-ink-2); white-space: nowrap; }
.tm-rev-ver { width: 5em; white-space: nowrap; }
/* 条文中の強調 (第17条など) — 第6条と同じく下線で示す */
.tm-article li strong { font-weight: 700; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
