/* ============================================================
   指針工房 作成画面
   左が設問票、右が原稿。公開サイトと同じく、白に近い地と黒の文字と細い罫線で組む。
   右の原稿は会社のブランド色で描かれるので、画面の側は色を足さない。
   朱は、答えで書き換わった行の印（校正の朱入れと同じ意味）と、必須の印にだけ使う。
   ============================================================ */
:root {
  --bg: #faf9f6;
  --paper: #ffffff;
  --paper-2: #f2f0eb;
  --desk: #ebe9e3;
  --rule: #d9d5cc;
  --rule-soft: #e9e6df;
  --ink: #1c1c1c;
  --ink-2: #3a3a3a;
  --ink-3: #6b6b6b;
  --ink-4: #9a9a9a;
  --shu: #b5412d;
  --shu-deep: #8f3121;
  --shu-wash: #f7ece8;
  --serif: "Noto Serif JP", "Noto Serif CJK JP", serif;
  --sans: "Noto Sans JP", "Noto Sans CJK JP", sans-serif;
  --head-h: 60px;
  --tabs-h: 46px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans); color: var(--ink); background: var(--bg);
  word-break: normal; line-break: strict; overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}
:focus-visible { outline: 2px solid var(--shu); outline-offset: 2px; }

/* ---- 上の帯 ---- */
header.app {
  background: var(--bg); border-bottom: 1px solid var(--rule);
  padding: 0 22px; height: var(--head-h); display: flex; align-items: center; gap: 18px;
  position: sticky; top: 0; z-index: 30;
}
header.app .brand { display: flex; align-items: center; text-decoration: none; color: inherit; flex: 0 0 auto; }
header.app .brand img { height: 32px; width: auto; display: block; }
header.app .ver { font-size: 11.5px; color: var(--ink-3); border-left: 1px solid var(--rule); padding-left: 14px; line-height: 1.5; }
header.app .spacer { flex: 1 1 auto; }
.status { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.status b { font-family: var(--serif); font-size: 15px; color: var(--ink); margin: 0 1px 0 4px; }
.status .sep { display: inline-block; width: 18px; }
.status .ready { color: var(--ink); font-weight: 700; border-bottom: 2px solid var(--shu); padding-bottom: 1px; }
@media (max-width: 860px) {
  header.app { padding: 0 12px; gap: 10px; }
  header.app .ver, #btn-print { display: none; }
  header.app .brand img { height: 26px; }
  .status { font-size: 11.5px; }
}
.status .s { display: none; }
@media (max-width: 520px) { .status .sep { width: 10px; } .status .l { display: none; } .status .s { display: inline; } }

.actions { display: flex; gap: 8px; align-items: center; }
button.btn {
  font-family: var(--sans); font-size: 13px; font-weight: 700; letter-spacing: .03em; cursor: pointer;
  border: 1px solid var(--ink); background: var(--ink); color: #fff;
  padding: 9px 16px; border-radius: 0; line-height: 1.5;
}
button.btn:hover { background: var(--shu-deep); border-color: var(--shu-deep); color: #fff; }
header.app button.btn, nav.tabs button { white-space: nowrap; }
button.btn.ghost { background: transparent; color: var(--ink); }
button.btn.ghost:hover { background: var(--ink); color: #fff; border-color: var(--ink); }
button.btn.quiet { background: transparent; color: var(--ink-3); border-color: var(--rule); }
button.btn.quiet:hover { color: var(--ink); border-color: var(--ink-3); background: var(--paper); }
button.btn:disabled { opacity: .35; cursor: default; }
button.btn.sm { font-size: 12px; padding: 6px 12px; }

/* ---- 書き出しのメニュー ---- */
.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); background: var(--paper);
  border: 1px solid var(--ink); min-width: 260px; padding: 6px; display: none; z-index: 40;
  box-shadow: 0 18px 40px -18px rgba(28, 28, 28, .35);
}
.menu.open { display: block; }
.menu button {
  display: block; width: 100%; text-align: left; font-family: inherit; font-size: 13px;
  background: none; border: 0; padding: 10px 12px; cursor: pointer; color: var(--ink);
}
.menu button:hover { background: var(--bg); }
.menu button:disabled { color: var(--ink-4); cursor: default; }
.menu button small { display: block; font-size: 11px; color: var(--ink-3); margin-top: 1px; }
.menu hr { border: 0; border-top: 1px solid var(--rule-soft); margin: 5px 4px; }

/* ---- 画面の切り替え ---- */
nav.tabs {
  background: var(--bg); border-bottom: 1px solid var(--rule); padding: 0 22px; height: var(--tabs-h);
  display: flex; gap: 2px; position: sticky; top: var(--head-h); z-index: 25; overflow-x: auto; scrollbar-width: none;
}
nav.tabs::-webkit-scrollbar { display: none; }
@media (max-width: 860px) { nav.tabs { padding: 0 8px; } }
nav.tabs button {
  font-family: var(--sans); font-size: 14px; font-weight: 700; color: var(--ink-3);
  background: none; border: 0; border-bottom: 2px solid transparent;
  padding: 0 14px; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 8px;
}
nav.tabs button:hover { color: var(--ink); }
nav.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }
nav.tabs button .n { font-size: 11.5px; font-weight: 500; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* ---- 骨組み。広い画面では原稿の欄だけを独立して送れるようにする ---- */
.layout { display: grid; grid-template-columns: minmax(420px, 44%) 1fr; align-items: start; }
.panel { border-right: 1px solid var(--rule); min-height: calc(100vh - var(--head-h) - var(--tabs-h)); }
.panel-inner { padding: 30px 32px 64px; max-width: 760px; }
.preview-wrap {
  background: var(--desk); padding: 26px; position: sticky; top: calc(var(--head-h) + var(--tabs-h));
  height: calc(100vh - var(--head-h) - var(--tabs-h)); overflow-y: auto; overscroll-behavior: contain;
}
@media (max-width: 1000px) {
  .layout { grid-template-columns: 1fr; }
  .panel { border-right: 0; min-height: 0; }
  .panel-inner { padding: 24px 16px 48px; }
  .preview-wrap { position: static; height: auto; overflow: visible; padding: 12px; }
  /* 狭い画面では、作業する面と原稿の面を切り替えて見せる */
  body.mode-doc .panel { display: none; }
  body:not(.mode-doc) .preview-wrap { display: none; }
}

/* ---- 見出しと文 ---- */
.sec-h { font-family: var(--serif); font-size: 22px; font-weight: 600; margin: 0 0 10px; line-height: 1.5; letter-spacing: .02em; }
.sec-p { font-size: 14px; line-height: 1.9; color: var(--ink-2); margin: 0 0 22px; }
.sub-h { font-family: var(--serif); font-size: 16px; font-weight: 600; margin: 36px 0 12px; padding-top: 22px; border-top: 1px solid var(--rule); scroll-margin-top: 120px; }
.counts { font-size: 13px; color: var(--ink-2); margin: 0 0 14px; padding: 10px 0; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--rule); font-variant-numeric: tabular-nums; }

/* ---- 知らせ ---- */
.notice { border: 1px solid var(--ink); background: var(--paper); padding: 16px 18px; margin-bottom: 22px; font-size: 13.5px; line-height: 1.8; }
.notice .nh { font-weight: 700; margin-bottom: 6px; }
.notice ul { margin: 6px 0 0; padding-left: 1.2em; }
.notice li { margin-bottom: 3px; }

/* ---- 下敷きの一覧 ---- */
.pattern-list { border-top: 1px solid var(--ink); }
.pattern {
  display: grid; grid-template-columns: minmax(0, 12em) minmax(0, 1fr); gap: 4px 16px; width: 100%; text-align: left;
  font-family: var(--sans); cursor: pointer; background: transparent; border: 0; border-bottom: 1px solid var(--rule);
  padding: 13px 10px 13px 30px; color: var(--ink); position: relative; line-height: 1.6;
}
.pattern::before { content: ""; position: absolute; left: 6px; top: 18px; width: 12px; height: 12px; border: 1.5px solid var(--ink-4); border-radius: 50%; background: var(--paper); }
.pattern:hover { background: var(--paper); }
.pattern[aria-pressed="true"] { background: var(--paper); }
.pattern[aria-pressed="true"]::before { border-color: var(--ink); background: radial-gradient(circle, var(--ink) 0 3px, var(--paper) 3.5px); }
.pattern .pn { font-family: var(--serif); font-size: 15px; font-weight: 600; }
.pattern .pd { font-size: 13px; color: var(--ink-3); }
@media (max-width: 560px) { .pattern { grid-template-columns: minmax(0, 1fr); } }
.mixer { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 560px) { .mixer { grid-template-columns: minmax(0, 1fr); } }
.mixer label.fl { display: block; font-size: 12px; font-weight: 700; color: var(--ink-3); margin-bottom: 6px; letter-spacing: .06em; }

/* ---- 設問票 ---- */
.q-head { display: flex; align-items: baseline; gap: 10px; border-top: 1px solid var(--ink); padding-top: 14px; flex-wrap: wrap; }
.q-head .qn { font-family: var(--serif); font-size: 22px; font-weight: 600; color: var(--shu); }
.q-head .qof { font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.q-head .qcat { font-size: 12.5px; color: var(--ink-3); margin-left: 6px; }
.q-head .qst { margin-left: auto; font-size: 11px; font-weight: 700; padding: 1px 8px; border: 1px solid var(--ink); }
.q-text { font-family: var(--serif); font-size: 21px; font-weight: 600; line-height: 1.7; margin: 10px 0 8px; }
.q-help { font-size: 13.5px; color: var(--ink-3); line-height: 1.85; margin: 0 0 18px; }
.place-line { font-size: 13px; line-height: 1.8; margin: 22px 0 0; padding: 10px 14px; background: var(--paper); border-left: 2px solid var(--shu); }
.place-line:empty { display: none; }
.place-line .place-k { display: block; font-size: 11.5px; color: var(--ink-3); letter-spacing: .06em; }
.place-line .place-none { color: var(--ink-3); }
.answered { margin-top: 8px; }
.ans-row {
  display: grid; grid-template-columns: 3.4em minmax(0, 1fr) minmax(0, 11em); gap: 10px; width: 100%; text-align: left;
  font-family: var(--sans); font-size: 13px; line-height: 1.6; color: var(--ink-2);
  background: none; border: 0; border-bottom: 1px solid var(--rule-soft); padding: 8px 0; cursor: pointer;
}
.ans-row:hover { color: var(--ink); }
.ans-row .an { font-family: var(--serif); color: var(--ink-3); }
.ans-row .aa { color: var(--ink); font-weight: 700; text-align: right; }
@media (max-width: 560px) { .ans-row { grid-template-columns: 3.2em minmax(0, 1fr); } .ans-row .aa { grid-column: 2; text-align: left; } }

/* ---- 入力部品 ---- */
input[type=text], textarea, select {
  width: 100%; font-family: var(--sans); font-size: 15px; padding: 11px 13px;
  border: 1px solid var(--rule); border-bottom: 1.5px solid var(--ink-3); border-radius: 0;
  background: var(--paper); color: var(--ink); resize: vertical; line-height: 1.7;
}
input[type=text]:focus, textarea:focus, select:focus { outline: none; border-bottom-color: var(--shu); box-shadow: 0 2px 0 -.5px var(--shu); }
.opts { display: grid; gap: 8px; }
.opt {
  display: block; width: 100%; text-align: left; position: relative; cursor: pointer;
  border: 1px solid var(--rule); background: transparent; padding: 12px 16px 12px 44px;
  font-family: var(--sans); font-size: 14px; color: var(--ink); line-height: 1.6;
}
.opt::before { content: ""; position: absolute; left: 16px; top: 16px; width: 14px; height: 14px; border: 1.5px solid var(--ink-4); border-radius: 50%; background: var(--paper); }
.opt:hover { border-color: var(--ink-3); }
.opt[aria-pressed="true"] { border-color: var(--ink); background: var(--paper); }
.opt[aria-pressed="true"]::before { border-color: var(--ink); background: radial-gradient(circle, var(--ink) 0 4px, var(--paper) 4.5px); }
.opt .ol { font-weight: 700; }
.opt .od { font-size: 13px; color: var(--ink-3); margin-top: 2px; line-height: 1.7; }
.toggle-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.checks { display: flex; flex-direction: column; gap: 4px; max-height: 340px; overflow-y: auto; padding: 1px; }
.chk { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; padding: 9px 11px; border: 1px solid var(--rule-soft); cursor: pointer; background: var(--paper); line-height: 1.65; }
.chk:hover { border-color: var(--ink-3); }
.chk input { margin-top: 4px; flex: 0 0 auto; accent-color: var(--ink); }
.row { display: flex; gap: 8px; align-items: center; margin-top: 14px; flex-wrap: wrap; }
.row.end { justify-content: space-between; }
.colorpick { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.colorpick input[type=color] { width: 52px; height: 40px; padding: 2px; border: 1px solid var(--rule); background: var(--paper); }
.swatches { display: flex; gap: 6px; }
.sw { width: 26px; height: 26px; cursor: pointer; border: 2px solid var(--paper); box-shadow: 0 0 0 1px var(--rule); }

/* ---- 確認表 ---- */
.cl-cat { border: 1px solid var(--rule); margin-bottom: 12px; background: var(--paper); }
.cl-cat > summary { cursor: pointer; padding: 14px 16px; font-family: var(--serif); font-size: 15.5px; font-weight: 600; display: flex; align-items: center; gap: 10px; list-style: none; }
.cl-cat > summary::-webkit-details-marker { display: none; }
.cl-cat > summary::before { content: "＋"; font-family: var(--sans); font-weight: 400; color: var(--ink-4); width: 14px; }
.cl-cat[open] > summary::before { content: "－"; }
.cl-cat > summary:hover { background: var(--bg); }
.cl-cat > summary .cnt { font-family: var(--sans); font-size: 12px; font-weight: 500; color: var(--ink-3); margin-left: auto; font-variant-numeric: tabular-nums; }
.cl-cat .why { font-size: 12.5px; color: var(--ink-3); padding: 0 16px 12px 40px; line-height: 1.75; }
.cl-item { border-top: 1px solid var(--rule-soft); padding: 15px 16px 16px; }
.cl-item .ih { display: flex; align-items: flex-start; gap: 8px; flex-wrap: wrap; }
.cl-item .q { font-size: 14px; font-weight: 700; line-height: 1.7; flex: 1 1 200px; }
.cl-item .q .qno { font-family: var(--serif); font-weight: 600; color: var(--ink-3); margin-right: 8px; }
.cl-item .hint { font-size: 12.5px; color: var(--ink-3); line-height: 1.75; margin-top: 4px; }
.cl-item .ed { margin-top: 10px; }
.cl-item .cur { font-size: 12.5px; color: var(--ink-3); margin-top: 8px; line-height: 1.75; }
.cl-item .cur b { color: var(--ink); font-weight: 700; }
.pin { flex: 0 0 auto; font-size: 11px; font-weight: 700; padding: 1px 7px; border: 1px solid var(--ink); white-space: nowrap; margin-top: 2px; line-height: 1.6; }
.pin.done { background: var(--ink); color: #fff; }
.pin.sample { background: var(--paper); color: var(--ink); }
.pin.empty { background: var(--paper); color: var(--ink-3); border-color: var(--ink-4); border-style: dashed; }
.pin.req { background: var(--paper); color: var(--shu); border-color: var(--shu); }
.conf-item { display: flex; gap: 11px; align-items: flex-start; border-top: 1px solid var(--rule-soft); padding: 13px 16px; cursor: pointer; }
.conf-item:first-child { border-top: 0; }
.conf-item input { margin-top: 4px; flex: 0 0 auto; accent-color: var(--ink); width: 16px; height: 16px; }
.conf-item .ct { font-size: 14px; line-height: 1.7; font-weight: 700; }
.conf-item .ch { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; line-height: 1.75; }

/* ---- 法令の確認予定 ---- */
.watch { border-top: 1px solid var(--ink); }
.watch table { width: 100%; border-collapse: collapse; font-size: 13px; }
.watch th, .watch td { text-align: left; padding: 10px 10px 10px 0; border-bottom: 1px solid var(--rule); vertical-align: top; line-height: 1.7; }
.watch th { font-weight: 500; color: var(--ink-3); font-size: 12px; }
.watch td.d { white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---- 原稿 ---- */
.mini-nav { font-size: 12px; color: var(--ink-3); text-align: center; margin-bottom: 14px; letter-spacing: .04em; }
.paper {
  position: relative; background: #fff; max-width: 820px; margin: 0 auto; padding: 40px 48px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .04), 0 24px 50px -26px rgba(28, 28, 28, .4);
}
@media (max-width: 1000px) { .paper { padding: 24px 18px; } }
@media (max-width: 700px) {
  .paper { padding: 18px 13px; }
  .paper table { display: block; width: 100%; overflow-x: auto; }
  .paper .gl-cover .meta-table { min-width: 0; }
}
/* 答えで書き換わった行。校正で朱を入れたときと同じく、朱の線を引く */
.paper .just-changed:not(tr) {
  background: var(--shu-wash); text-decoration: underline; text-decoration-color: var(--shu);
  text-decoration-thickness: 1.5px; text-underline-offset: .28em;
}
/* 見出しは余白まで色が広がるので、下線だけにする */
.paper h1.just-changed, .paper h2.just-changed, .paper h3.just-changed { background: none; }
.paper tr.just-changed > td, .paper tr.just-changed > th { background: var(--shu-wash); }
.paper tr.just-changed > :first-child { box-shadow: inset 3px 0 0 var(--shu); }

/* ---- プランとキー ---- */
.plans { display: grid; gap: 1px; background: var(--rule); border: 1px solid var(--rule); }
.plan { padding: 14px 16px; background: var(--bg); }
.plan.on { background: var(--paper); box-shadow: inset 3px 0 0 var(--ink); }
.plan .pn { font-family: var(--serif); font-size: 15px; font-weight: 600; }
.plan .pp { font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.plan .pf { font-size: 12px; color: var(--ink-3); margin-top: 6px; line-height: 1.75; }
.lic-row { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.lic-row input { flex: 1 1 200px; }
.msg { font-size: 13px; margin-top: 8px; line-height: 1.7; }
.msg.ok { color: var(--ink); font-weight: 700; }
.msg.ng { color: var(--shu-deep); }

footer.app { padding: 20px 32px 34px; font-size: 12px; color: var(--ink-3); line-height: 1.9; border-top: 1px solid var(--rule); background: var(--bg); }
footer.app p { margin: 0 0 8px; }
footer.app nav { display: flex; flex-wrap: wrap; gap: 4px 18px; }
footer.app a { color: var(--ink-2); }

/* ---- 印刷 ---- */
@media print {
  header.app, nav.tabs, .panel, .mini-nav, footer.app { display: none !important; }
  body { background: #fff; }
  .layout { display: block; }
  .preview-wrap, body:not(.mode-doc) .preview-wrap { display: block !important; position: static; height: auto; overflow: visible; padding: 0; background: #fff; }
  .paper { box-shadow: none; max-width: none; margin: 0; padding: 0; }
  .paper .just-changed, .paper .just-changed > * { background: none !important; text-decoration: none !important; box-shadow: none !important; }
}
