:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --ink: #1c1f23;
  --muted: #6b727c;
  --line: #d9dde3;
  --accent: #1f5fa9;
  --warn: #b4451f;
  --ok: #1d7a4c;
  --grid: #b9c0ca;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.7;
}

main { max-width: 1080px; margin: 0 auto; padding: 24px 16px 64px; }

h1 { font-size: 22px; margin: 8px 0 16px; }
h2 { font-size: 17px; margin: 24px 0 8px; }

a { color: var(--accent); }

.site-header {
  display: flex;
  align-items: center;
  gap: 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  padding: 12px 20px;
}
.site-header .brand { font-weight: 700; color: var(--ink); text-decoration: none; }
.site-header nav { display: flex; gap: 16px; flex: 1; }
.site-header .logout { display: flex; align-items: center; gap: 10px; margin: 0; }
.site-header .user { color: var(--muted); font-size: 13px; }

button, .primary {
  font: inherit;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 6px;
  padding: 7px 14px;
  cursor: pointer;
}
button.primary, .primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  text-decoration: none;
}
button.link {
  border: none;
  background: none;
  color: var(--accent);
  padding: 0;
}
a.link { text-decoration: none; }
button.wide { width: 100%; padding: 14px; font-size: 17px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
}

label { display: block; margin-bottom: 14px; font-size: 13px; color: var(--muted); }
label input, label select {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 9px 10px;
  font: inherit;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin: 0 0 20px; }
legend { font-size: 13px; color: var(--muted); padding: 0 6px; }
.row { display: flex; gap: 16px; }
.row > label { flex: 1; }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 16px;
}
.filters input[type="search"] { flex: 1 1 260px; padding: 8px 10px; font: inherit; border: 1px solid var(--line); border-radius: 6px; }
.filters select { padding: 8px 10px; font: inherit; border: 1px solid var(--line); border-radius: 6px; background: #fff; }

.inline-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.inline-form label { margin-bottom: 0; }

table.list { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
table.list th, table.list td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; font-size: 14px; }
table.list th { background: #eef1f5; font-size: 13px; color: var(--muted); }
table.list tr.is-left td { color: var(--muted); }
table.list td.empty { text-align: center; color: var(--muted); padding: 32px; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; background: #eceff3; font-size: 12px; color: var(--muted); }
.badge.warn { background: #fbe9e2; color: var(--warn); }
.badge.ok { background: #e3f2ea; color: var(--ok); }

.muted { color: var(--muted); font-size: 13px; }
.summary { margin: 4px 0 12px; }
.breadcrumb { margin: 0 0 4px; font-size: 13px; }
.error { color: var(--warn); font-size: 13px; }
.notice { background: #fff8e6; border: 1px solid #efdca6; border-radius: 6px; padding: 10px 12px; }
.notice.ok { background: #e8f5ee; border-color: #b6ddc6; }

.files { list-style: none; padding: 0; margin: 0 0 16px; }
.files li { display: flex; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.tile {
  display: block;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  text-decoration: none;
  color: var(--ink);
}
.tile:hover { border-color: var(--accent); }
.tile strong { display: block; font-size: 16px; margin-bottom: 4px; }
.tile span { color: var(--muted); font-size: 13px; }
.tile.wide { grid-column: 1 / -1; }

.login-wrap { max-width: 380px; margin: 12vh auto; padding: 0 16px; }
.login-wrap h1 { text-align: center; }

.qr-card { text-align: center; }
.qr-card img { max-width: 320px; height: auto; }
.qr-card .url { word-break: break-all; font-size: 13px; background: #f0f2f5; padding: 10px; border-radius: 6px; }

/* 面接者フォーム（スマホ） */
body.intake { background: #fff; }
.intake-wrap { max-width: 560px; margin: 0 auto; padding: 24px 18px 64px; }
.intake-wrap.center { text-align: center; padding-top: 18vh; }
.intake-header h1 { font-size: 20px; margin-bottom: 0; }
.intake .step { display: none; }
.intake .step.active { display: block; }
.intake .step h2 { font-size: 18px; margin: 16px 0 18px; }
.intake label { font-size: 14px; }
.intake input, .intake select { font-size: 16px; padding: 12px; }
.intake .choice { display: flex; gap: 18px; margin-bottom: 14px; }
.intake .radio { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 15px; color: var(--ink); }
.intake .radio input { width: auto; margin: 0; }
.step-nav { display: flex; gap: 12px; margin-top: 24px; }
.step-nav button { flex: 1; padding: 12px; }
.progress { height: 4px; background: #e7eaee; border-radius: 999px; overflow: hidden; margin-bottom: 8px; }
.progress-bar { height: 100%; width: 0; background: var(--accent); transition: width .2s; }

@media (max-width: 640px) {
  .row { flex-direction: column; gap: 0; }
  .site-header { flex-wrap: wrap; gap: 10px; }
}

/* ---- 書類 ---- */
.doc-frame { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 12px; }
.doc-actions { display: flex; gap: 16px; align-items: center; margin-bottom: 16px; }
.doc-body { white-space: pre-wrap; line-height: 1.9; }
.summary .add-doc { float: right; padding: 6px 14px; font-size: 14px; }

label.checkbox { display: flex; gap: 8px; align-items: flex-start; color: var(--ink); font-size: 14px; }
label.checkbox input { width: auto; margin: 4px 0 0; }

textarea {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 10px;
  font: inherit;
  line-height: 1.8;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  resize: vertical;
}

.table-scroll { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; font-size: 14px; }
table.data th { background: #eef1f5; font-size: 13px; }

.table-editor { overflow-x: auto; }
table.editable input {
  width: 100%;
  min-width: 110px;
  padding: 6px 8px;
  font: inherit;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
}
table.editable input:focus { border-color: var(--accent); background: #fff; outline: none; }
table.editable th { vertical-align: top; }
button.tiny { font-size: 11px; padding: 2px 8px; margin-top: 4px; color: var(--muted); }
.table-editor-actions { display: flex; gap: 10px; margin: 12px 0; }

.store-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.store-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  text-decoration: none;
  color: var(--ink);
  font-size: 14px;
}
.store-tab:hover { border-color: var(--accent); }
.store-tab.current { background: var(--accent); border-color: var(--accent); color: #fff; }
.store-tab .count { font-size: 12px; color: var(--muted); }
.store-tab.current .count { color: #dce8f6; }

/* ---- 表の閲覧（料金表など） ---- */
/* 紙の料金表と同じく、全セルを罫線で囲った枠にする */
.table-scroll { overflow: auto; max-height: 72vh; border: 2px solid var(--grid); border-radius: 6px; }
.table-scroll table.sheet { border-collapse: separate; border-spacing: 0; width: 100%; margin: 0; }
table.sheet th, table.sheet td {
  border: 0;
  border-bottom: 1px solid var(--grid);
  border-right: 1px solid var(--grid);
  padding: 11px 14px;
  font-size: 14px;
  white-space: nowrap;
  background: var(--panel);
}
table.sheet th:last-child, table.sheet td:last-child { border-right: 0; }
table.sheet tbody tr:last-child td { border-bottom: 0; }
table.sheet thead th { border-bottom: 2px solid var(--grid); }

/* ヘッダー行を固定 */
table.sheet thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #eef1f5;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

/* 1列目（ルーム名など）を固定 */
table.sheet th.rowhead, table.sheet td.rowhead {
  position: sticky;
  left: 0;
  z-index: 1;
  font-weight: 600;
  color: var(--ink);
  box-shadow: 1px 0 0 var(--grid);
}
table.sheet thead th.rowhead { z-index: 3; }

table.sheet td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.sheet td.dash { text-align: center; color: #b6bcc4; }
table.sheet td.empty-cell { background: var(--panel); }

table.sheet tbody tr:nth-child(even) td { background: #fafbfc; }
table.sheet tbody tr:hover td { background: #eef4fb; }
table.sheet tbody tr.note-row td { background: #fff8e6; color: var(--warn); font-size: 13px; white-space: normal; }
table.sheet tbody tr.note-row:hover td { background: #fdf1d4; }

.table-hint { margin: 8px 0 0; }

@media (max-width: 640px) {
  table.sheet th, table.sheet td { padding: 9px 10px; font-size: 13px; }
}

/* 編集画面の表も枠を出す */
.table-editor table.editable { border-collapse: collapse; width: 100%; border: 2px solid var(--grid); }
table.editable th, table.editable td { border: 1px solid var(--grid); padding: 4px 6px; vertical-align: middle; }
table.editable thead th { background: #eef1f5; }
table.editable input { border: 1px solid transparent; background: #fff; }
table.editable input:hover { border-color: var(--line); }

button.danger { background: var(--warn); border-color: var(--warn); color: #fff; }
a.danger-link { color: var(--warn); }
/* 危ない操作は本文から離して、いちばん下に置く */
/* 書きながらプレビューを見る。左に本文、右に紙 */
.compose { display: flex; gap: 20px; align-items: flex-start; }
.compose-edit { flex: 1 1 0; min-width: 0; }
.compose-preview { flex: 1 1 0; min-width: 0; }
.compose-edit .doc-edit { min-height: 460px; }

.paper-wrap { overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.paper { border: 0; display: block; transform-origin: top left; background: #fff; }

.scale-row { display: flex; align-items: center; gap: 6px; }
.scale-row input { width: 70px; }
.paper-pages { margin: 0 0 6px; font-size: 13px; font-weight: 700; }
.paper-pages.ok { color: var(--ok); }
.paper-pages.over { color: var(--warn); }

/* 幅が足りないときは縦に積む */
@media (max-width: 900px) {
  .compose { flex-direction: column; }
  .compose-edit, .compose-preview { width: 100%; }
}

/* 書類の部品のボタン。本文欄のすぐ上に並べる */
.part-bar-label { font-size: 13px; color: var(--muted); margin: 12px 0 4px; }
.part-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0 0 8px; }
.part-edit { min-height: 90px; }

/* 書類をつくる の本文欄。条文をそのまま貼るので広く取る */
.doc-edit { width: 100%; min-height: 380px; line-height: 1.8; font-family: inherit; resize: vertical; }

.danger-area { margin-top: 28px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 13px; }

ol.flow { margin: 0 0 8px; padding-left: 1.4em; }
ol.flow li { margin-bottom: 6px; }

/* ---- パック表 ---- */
.pack-box {
  border: 1px solid #d6dbe0;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 14px;
  background: #fafbfc;
}
.pack-box-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }

.pack-options { list-style: none; margin: 0 0 10px; padding: 0; }
.pack-options li {
  display: flex; align-items: center; gap: 10px;
  padding: 5px 0; border-bottom: 1px dotted #dfe3e7;
}
.pack-options li.empty { color: #8a9099; border-bottom: none; }
.pack-options .name { flex: 1; }
.pack-options .num { font-variant-numeric: tabular-nums; white-space: nowrap; }

.pack-picker { width: 100%; max-width: 420px; }

.pack-sum { margin: 10px 0 0; font-size: 15px; }
.pack-sum .was { text-decoration: line-through; color: #767c85; }
.pack-sum .arrow { margin: 0 6px; }
.pack-sum .now { font-weight: 700; font-size: 17px; }
.pack-sum .off { margin-left: 10px; color: #c1272d; font-weight: 700; }
.pack-sum .off.none { color: #8a9099; font-weight: 400; font-size: 13px; }


.pack-card {
  border: 1px solid #e3c3ce;
  border-radius: 8px;
  padding: 14px 18px;
  margin-bottom: 14px;
  background: #fdf7f9;
}
.pack-card h2 { margin: 0 0 6px; font-size: 17px; line-height: 1.5; }
.pack-card .pack-price .was { text-decoration: line-through; color: #767c85; }
.pack-card .pack-price .now { font-weight: 700; font-size: 18px; margin-left: 8px; }
.pack-card .pack-price .off { margin-left: 10px; color: #c1272d; font-weight: 700; }
.pack-card .pack-price .off.none { color: #8a9099; font-weight: 400; font-size: 13px; }

.secret-list { list-style: none; margin: 0; padding: 0; }
.secret-list li {
  display: flex; justify-content: space-between; gap: 20px;
  padding: 5px 0; border-bottom: 1px dotted #e3c3ce;
}
.secret-list .num { font-variant-numeric: tabular-nums; }

.copy-source { width: 100%; font-family: ui-monospace, "Consolas", monospace; font-size: 13px; }

/* 面接フォームで読んでもらう書類 */
.agree-doc {
  border: 1px solid #d6dbe0;
  border-radius: 8px;
  margin-bottom: 18px;
  background: #fff;
}
.agree-doc h3 {
  margin: 0;
  padding: 12px 14px;
  font-size: 16px;
  border-bottom: 1px solid #e5e9ed;
  background: #f6f8fa;
  border-radius: 8px 8px 0 0;
}
.agree-doc h3 .ver { margin-left: 10px; font-size: 12px; font-weight: 400; color: #6b7280; }

/* 長い契約書をその場で読ませるので、枠の中だけを縦にスクロールさせる */
.agree-body {
  max-height: 46vh;
  overflow-y: auto;
  padding: 14px;
  margin: 0;
  white-space: pre-wrap;
  font-size: 14px;
  line-height: 1.85;
  -webkit-overflow-scrolling: touch;
}

.agree-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-top: 1px solid #e5e9ed;
  background: #fffdf5;
  font-weight: 700;
  border-radius: 0 0 8px 8px;
}
.agree-check input { margin-top: 3px; width: 20px; height: 20px; flex: none; }

/* サイン。フォームの中の枠は指には狭すぎるので、
   書くときは画面いっぱいに広げる（.sign-sheet）。
   ここに出るのは書き終えたものの控え。 */
.sign-pad { margin: 14px 0 4px; }
.sign-label { font-size: 13px; color: var(--muted); margin: 0 0 6px; }
.sign-preview {
  display: block;
  width: 100%;
  max-height: 140px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.sign-actions { margin: 8px 0 0; }
.sign-open { padding: 12px; font-size: 15px; }
.sign-open.wide { width: 100%; }

/* 全画面のサイン面。
   touch-action: none が無いと、書いている間に画面がスクロールしてしまう。 */
.sign-open-body { overflow: hidden; }
.sign-sheet {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.sign-sheet[hidden] { display: none; }
.sign-sheet-bar,
.sign-sheet-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.sign-sheet-foot { border-bottom: none; border-top: 1px solid var(--line); }
.sign-sheet-bar .sign-done { margin-left: auto; }
.sign-sheet-hint,
.sign-rotate-hint { font-size: 13px; color: var(--muted); }
.sign-rotate-hint { margin-left: auto; text-align: right; }
.sign-sheet-area { flex: 1; min-height: 0; padding: 10px 14px; }
.sign-sheet-area canvas {
  display: block;
  width: 100%;
  height: 100%;
  border: 1px dashed #9aa4b1;
  border-radius: 8px;
  background: #fff;
  touch-action: none;
}

/* 管理画面で見るサイン */
.signature-image { display: block; max-width: 420px; width: 100%; border: 1px solid var(--line); border-radius: 8px; background: #fff; }

/* 面接フォームの身分証の例 */
.id-list { margin: 4px 0 10px 1.2em; padding: 0; }
.id-list li { margin-bottom: 4px; }

/* 面接のあとにやること */
.next-steps .steps { list-style: none; margin: 0 0 10px; padding: 0; }
.next-steps .steps li {
  display: flex; align-items: baseline; gap: 10px;
  padding: 7px 0; border-bottom: 1px dotted #e0e4e8;
}
.next-steps .steps li:last-child { border-bottom: none; }
.next-steps .mark { width: 1.6em; flex: none; color: #8a9099; font-weight: 700; }
.next-steps li.done .mark { color: #2e7d4f; }
.next-steps li.done .label { color: #6b7280; }
.next-steps .label { flex: 1; }
