/* PDF工房 — プリセット 05 トラスト・コーポレート準拠 */
:root {
  --bg: #FBFBF9;
  --bg-alt: #F1F2EE;
  --ink: #1E2A38;
  --ink-soft: #5E6B78;
  --accent: #1F6E68;
  --accent-ink: #FBFBF9;
  --line: #DDE0DA;
  --warn: #9A3B26;       /* 不一致・要確認だけに使う */
  --warn-bg: #F7ECE7;
  --ok-bg: #E6F0EE;
  --radius: 4px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Noto Sans JP', 'Hiragino Sans', 'Yu Gothic', sans-serif;
  font-size: 16px;
  line-height: 1.8;
}
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 24px; }
h1, h2 { font-weight: 700; letter-spacing: 0.02em; }
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ヘッダー */
header.site { border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 10; }
.head-row { display: flex; align-items: baseline; gap: 24px; padding-top: 18px; flex-wrap: wrap; }
.brand { margin: 0; font-size: 26px; letter-spacing: 0.08em; }
.promise { margin: 0; color: var(--ink-soft); font-size: 14px; display: flex; align-items: center; gap: 8px; }
.lock { width: 12px; height: 14px; border: 2px solid var(--accent); border-radius: 2px; position: relative; top: 1px; display: inline-block; }
.lock::before { content: ''; position: absolute; left: 1px; top: -8px; width: 6px; height: 7px; border: 2px solid var(--accent); border-bottom: 0; border-radius: 4px 4px 0 0; }
.tabs { display: flex; gap: 4px; margin-top: 10px; overflow-x: auto; }
.tabs button {
  font: inherit; font-size: 16px; font-weight: 500; color: var(--ink-soft);
  background: none; border: 0; border-bottom: 3px solid transparent;
  padding: 10px 18px 10px; cursor: pointer; white-space: nowrap; min-height: 48px;
}
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 700; }
.tabs button:hover { color: var(--ink); }

main { padding-top: 32px; padding-bottom: 64px; min-height: 60vh; }
.intro h2 { font-size: 24px; margin: 0 0 4px; }
.intro p { margin: 0 0 20px; color: var(--ink-soft); max-width: 46em; }

/* ドロップ枠 */
.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  border: 2px dashed #B9BFB6; border-radius: var(--radius); background: var(--bg-alt);
  min-height: 190px; padding: 24px; text-align: center; cursor: pointer;
}
.drop:hover, .drop.over { border-color: var(--accent); background: var(--ok-bg); }
.drop-title { font-size: 20px; font-weight: 700; }
.drop-sub { color: var(--ink-soft); }
.drop.compact { display: none; }

/* ボタン */
.btn {
  font: inherit; font-size: 15px; font-weight: 500;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 8px 18px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--bg); color: var(--ink); cursor: pointer;
  text-decoration: none;
}
.btn:hover { border-color: var(--ink-soft); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #185954; border-color: #185954; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-small { min-height: 40px; padding: 4px 12px; font-size: 14px; }
.as-btn { margin-left: 6px; }

.status { min-height: 1.8em; margin: 12px 0 0; color: var(--ink-soft); }
.status.error { color: var(--warn); font-weight: 500; }
.note { margin: 0; color: var(--ink-soft); font-size: 14px; }

/* 結果の頭 */
.result-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin: 8px 0 20px; }
.result-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.file-name { margin: 0; font-weight: 700; font-size: 18px; word-break: break-all; }
.card-kind { margin: 2px 0 0; color: var(--ink-soft); display: flex; gap: 12px; align-items: center; flex-wrap: wrap; font-size: 14px; }
.tag { display: inline-block; border: 1px solid var(--accent); color: var(--accent); border-radius: var(--radius); padding: 0 8px; font-size: 14px; font-weight: 500; }

/* 照合（このツールの主役） */
.check {
  display: grid; grid-template-columns: 1fr auto 1fr minmax(180px, .8fr); align-items: stretch;
  border-top: 2px solid var(--ink); border-bottom: 1px solid var(--line);
}
.check-cell { padding: 18px 20px 16px 0; display: flex; flex-direction: column; }
.check-cell + .check-op + .check-cell { padding-left: 20px; }
.check-label { font-size: 14px; color: var(--ink-soft); }
.num { font-family: 'Source Serif 4', Georgia, serif; font-weight: 600; font-size: 44px; line-height: 1.2; letter-spacing: 0.01em; font-variant-numeric: tabular-nums; }
.num::after { content: '円'; font-family: 'Noto Sans JP', sans-serif; font-size: 18px; font-weight: 500; margin-left: 4px; }
.check-op { align-self: center; color: var(--ink-soft); font-size: 14px; }
.check-verdict { display: flex; flex-direction: column; justify-content: center; padding: 16px 20px; border-left: 1px solid var(--line); }
.verdict-word { font-size: 28px; font-weight: 700; letter-spacing: 0.1em; }
.verdict-sub { font-size: 14px; color: var(--ink-soft); }
.check.ok .check-verdict { background: var(--ok-bg); }
.check.ok .verdict-word { color: var(--accent); }
.check.ng .check-verdict { background: var(--warn-bg); }
.check.ng .verdict-word { color: var(--warn); }
#m-subnote { margin-top: 10px; }
.warnings { margin: 12px 0 0; padding: 0; list-style: none; }
.warnings li { color: var(--warn); background: var(--warn-bg); padding: 8px 12px; border-radius: var(--radius); margin-bottom: 6px; font-size: 15px; }

/* 表 */
.table-tools { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 28px 0 8px; }
.only-check { font-size: 15px; display: inline-flex; gap: 6px; align-items: center; cursor: pointer; min-height: 44px; }
.table-wrap { border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; max-height: 70vh; background: #fff; }
table.rows { border-collapse: collapse; width: 100%; font-size: 15px; line-height: 1.5; }
table.rows th { position: sticky; top: 0; background: var(--bg-alt); text-align: left; font-weight: 500; color: var(--ink-soft); padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; font-size: 14px; }
table.rows td { padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.rows td.date { white-space: nowrap; font-variant-numeric: tabular-nums; }
table.rows .r { text-align: right; }
table.rows td.amt { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; font-family: 'Source Serif 4', Georgia, serif; font-weight: 600; font-size: 16px; }
table.rows td.detail { color: var(--ink-soft); font-size: 14px; }
table.rows tr.flag td { background: var(--warn-bg); }
table.rows tr.flag td:first-child { box-shadow: inset 4px 0 0 var(--warn); }
table.rows td.flagtext { color: var(--warn); font-size: 14px; }
table.rows tfoot td { font-weight: 700; background: var(--bg-alt); position: sticky; bottom: 0; }

/* ページ整理 */
.thumbs { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 20px; }
.thumb { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; padding: 10px; display: flex; flex-direction: column; gap: 8px; cursor: grab; }
.thumb.dragging { opacity: .4; }
.thumb.drop-before { box-shadow: inset 4px 0 0 var(--accent); }
.thumb.drop-after { box-shadow: inset -4px 0 0 var(--accent); }
.thumb-img { display: flex; align-items: center; justify-content: center; height: 200px; background: var(--bg-alt); overflow: hidden; }
.thumb-img canvas { max-width: 100%; max-height: 200px; transition: transform .2s ease; border: 1px solid var(--line); background: #fff; }
.thumb-meta { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; }
.thumb-meta b { font-size: 16px; }
.thumb-meta span { color: var(--ink-soft); }
.thumb-actions { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 4px; }
.thumb-actions .btn { min-height: 40px; padding: 2px 4px; font-size: 14px; }
.thumb-actions .del { color: var(--warn); }

/* 文字を足す */
.text-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; align-items: start; }
.pager { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; font-variant-numeric: tabular-nums; }
.stage { position: relative; display: inline-block; border: 1px solid var(--line); background: #fff; cursor: crosshair; max-width: 100%; }
.stage canvas { display: block; max-width: 100%; }
.overlay { position: absolute; inset: 0; }
.placed-text { position: absolute; white-space: pre; line-height: 1.3; font-family: 'Noto Sans JP', sans-serif; pointer-events: none; outline: 1px dashed rgba(31,110,104,.6); outline-offset: 1px; transform-origin: 0 0; }
.side { position: sticky; top: 130px; display: flex; flex-direction: column; gap: 18px; }
.field label, .field-label { display: block; font-weight: 700; margin-bottom: 6px; }
textarea { width: 100%; font: inherit; font-size: 16px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; color: var(--ink); resize: vertical; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { font: inherit; font-size: 15px; min-width: 48px; min-height: 44px; padding: 4px 10px; border: 1px solid var(--line); background: var(--bg); border-radius: var(--radius); cursor: pointer; color: var(--ink); }
.seg button[aria-checked="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.hint { margin: 0; padding: 10px 12px; border-left: 3px solid var(--accent); background: var(--ok-bg); font-size: 15px; }
.placed { list-style: none; margin: 0; padding: 0; font-size: 15px; }
.placed li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.placed li.empty { color: var(--ink-soft); border: 0; }
.placed .ptext { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.placed .pmeta { color: var(--ink-soft); font-size: 14px; white-space: nowrap; }

/* トースト */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 12px 20px; border-radius: var(--radius); font-size: 15px; z-index: 50; max-width: calc(100vw - 32px); }

.site-foot { border-top: 1px solid var(--line); padding-top: 16px; padding-bottom: 32px; color: var(--ink-soft); font-size: 14px; }

@media (max-width: 760px) {
  .wrap { padding: 0 16px; }
  .check { grid-template-columns: 1fr; }
  .check-op { display: none; }
  .check-cell + .check-op + .check-cell { padding-left: 0; border-top: 1px solid var(--line); }
  .check-verdict { border-left: 0; border-top: 1px solid var(--line); }
  .num { font-size: 34px; }
  .text-layout { grid-template-columns: 1fr; }
  .side { position: static; }
  .thumbs { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .promise { font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
[hidden] { display: none !important; }
