/* 引佐生コン System。見た目は TERACHA Hub（~/teracha-portal/web/static/app.css）をもとに、シンプルに。
   書体と文字の大きさは端末の標準のまま（rem で決め、ブラウザの文字の大きさの設定に従う）。ダークモードは端末の設定に合わせる */
:root {
  --fg: #1d1d1f; --mid: #424245; --faint: #6e6e73; --hint: #a1a1a6; --rule: #e5e5ea; --line-strong: #c7c7cc;
  --card: #f5f5f7; --bg: #fff; --canvas: #ececf0; --accent: #0071e3; --accent-soft: #e8f1fd;
  --red: #c4362c; --red-soft: #fdecea; --green: #1f7a3a; --green-soft: #e3f5e8; --fax: #6a3fc8; --fax-soft: #efe9fb;
  --font: -apple-system, BlinkMacSystemFont, 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Yu Gothic UI', 'Meiryo UI', Meiryo, sans-serif;
  --ease: cubic-bezier(.22,.61,.36,1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root {
  --fg: #f5f5f7; --mid: #d2d2d7; --faint: #98989d; --hint: #6e6e73; --rule: #38383a; --line-strong: #545458;
  --card: #1c1c1e; --bg: #000; --canvas: #111113; --accent: #0a84ff; --accent-soft: #0a2a4d;
  --red: #ff6961; --red-soft: #3a1512; --green: #30d158; --green-soft: #0f2e18; --fax: #bf9cff; --fax-soft: #2a1f40;
  color-scheme: dark;
} }
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); color: var(--fg); background: var(--bg); line-height: 1.6; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }

/* ── 立ち上げ画面 ── */
.splash { position: fixed; inset: 0; z-index: 50; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; transition: opacity .8s var(--ease), visibility .8s; }
.splash.out { opacity: 0; visibility: hidden; }
.splash[hidden] { display: none; }
.splash .name { font-size: clamp(2.4rem, 6vw, 4.2rem); font-weight: 700; letter-spacing: .06em; line-height: 1.2; opacity: 0; transform: translateY(.6rem); animation: rise 1.1s var(--ease) .15s forwards; }
.splash .bar { width: 0; height: 2px; background: var(--accent); border-radius: 2px; margin: 1.1rem 0 1rem; animation: grow 1s var(--ease) .55s forwards; }
.splash .sys { font-size: clamp(.8rem, 1.4vw, 1rem); font-weight: 600; letter-spacing: .7em; text-indent: .7em; color: var(--accent); opacity: 0; animation: fade 1s var(--ease) .8s forwards; }
.splash .by { position: absolute; bottom: 2.2rem; display: flex; align-items: center; gap: .5rem; font-size: .7rem; letter-spacing: .35em; color: var(--faint); opacity: 0; animation: fade 1s var(--ease) 1s forwards; }
.splash .by img { height: .95rem; }
@media (prefers-color-scheme: dark) { .splash .by img, .mark { filter: invert(1) brightness(.85); } }
/* ── ログイン：立ち上げ画面と同じ名前の並びの下に、欄がゆっくり出てくる ── */
.login { min-height: 100svh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 3rem 1.5rem 5rem; position: relative; transition: opacity .4s var(--ease), transform .4s var(--ease); }
body.leaving .login { opacity: 0; transform: scale(.985); }
.login-head { display: flex; flex-direction: column; align-items: center; }
.login .name { font-size: clamp(2.2rem, 5.5vw, 3.6rem); font-weight: 700; letter-spacing: .06em; line-height: 1.2; opacity: 0; transform: translateY(.6rem); animation: rise 1.1s var(--ease) .1s forwards; }
.login .bar { width: 0; height: 2px; background: var(--accent); border-radius: 2px; margin: 1rem 0 .9rem; animation: grow 1s var(--ease) .45s forwards; }
.login .sys { font-size: clamp(.8rem, 1.4vw, .95rem); font-weight: 600; letter-spacing: .7em; text-indent: .7em; color: var(--accent); opacity: 0; animation: fade 1s var(--ease) .65s forwards; }
.login-form { width: min(20rem, 100%); margin-top: 2.6rem; display: flex; flex-direction: column; opacity: 0; transform: translateY(.8rem); animation: rise 1s var(--ease) .85s forwards; }
.login-form label { font-size: .78rem; color: var(--faint); margin: .9rem 0 .35rem .15rem; }
.login-form input { height: 2.9rem; padding: 0 .9rem; border: 1px solid var(--line-strong); border-radius: .7rem; background: var(--bg); color: var(--fg); font: inherit; font-size: 1rem; outline: none; transition: border-color .25s var(--ease), box-shadow .25s var(--ease); }
.login-form input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.login-form .err { min-height: 1.4rem; margin: .7rem .15rem .2rem; font-size: .8rem; color: var(--red); line-height: 1.5; }
.login-form .btn { height: 2.9rem; justify-content: center; font-size: .95rem; border-radius: .7rem; }
.login-form .btn:disabled { opacity: .55; cursor: default; }
.login-form.shake { animation: shake .45s cubic-bezier(.36,.07,.19,.97); opacity: 1; transform: none; }
.login .by { position: absolute; bottom: 2rem; display: flex; align-items: center; gap: .5rem; font-size: .7rem; letter-spacing: .35em; color: var(--faint); opacity: 0; animation: fade 1s var(--ease) 1.1s forwards; }
.login .by img { height: .95rem; }
@media (prefers-color-scheme: dark) { .login .by img { filter: invert(1) brightness(.85); } }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
@media (prefers-reduced-motion: reduce) { .login .name, .login .sys, .login .bar, .login-form, .login .by { animation-duration: .01s; animation-delay: 0s; } .login-form.shake { animation: none; } }
@keyframes rise { to { opacity: 1; transform: none; } }
@keyframes grow { to { width: 3.2rem; } }
@keyframes fade { to { opacity: 1; } }

/* ── 上の帯 ── */
.top { position: sticky; top: 0; z-index: 10; height: 3.6rem; display: flex; align-items: center; gap: 1.2rem; padding: 0 1.5rem; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-bottom: 1px solid var(--rule); }
.top .app { font-size: 1rem; font-weight: 700; letter-spacing: .02em; white-space: nowrap; }
.top .app small { font-size: .7rem; font-weight: 600; letter-spacing: .3em; color: var(--accent); margin-left: .4rem; }
/* 検索：閉じているときは「設定」と同じ形の四角いボタン。開くと幅がなめらかに伸びて入力の欄になる */
.top .app { max-width: 14rem; overflow: hidden; transition: opacity .3s var(--ease), max-width .5s cubic-bezier(.22,1,.36,1); }
.find { display: flex; align-items: center; width: 2.2rem; height: 2.2rem; border-radius: .6rem; background: var(--card); overflow: hidden; transition: width .55s cubic-bezier(.22,1,.36,1), box-shadow .25s var(--ease); }
.find.open { width: min(20rem, calc(100vw - 19rem)); }
.find.open:focus-within { box-shadow: 0 0 0 2px var(--accent); }
.find-btn { flex: none; width: 2.2rem; height: 2.2rem; display: flex; align-items: center; justify-content: center; border-radius: .6rem; transition: background .25s var(--ease); }
.find:not(.open) .find-btn:hover { background: var(--rule); }
.find-btn svg { width: 1.1rem; height: 1.1rem; fill: none; stroke: var(--mid); stroke-width: 1.9; stroke-linecap: round; }
.find input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; outline: none; font: inherit; font-size: .85rem; color: var(--fg); opacity: 0; transition: opacity .25s var(--ease); }
.find.open input { opacity: 1; transition-delay: .12s; }
.find input::-webkit-search-cancel-button { display: none; }
.find-x { flex: none; width: 2rem; height: 2.2rem; position: relative; opacity: 0; transition: opacity .25s var(--ease); }
.find.open .find-x { opacity: 1; transition-delay: .12s; }
.find-x::before, .find-x::after { content: ''; position: absolute; left: 50%; top: 50%; width: .75rem; height: 1.6px; border-radius: 1px; background: var(--faint); transform: translate(-50%, -50%) rotate(45deg); }
.find-x::after { transform: translate(-50%, -50%) rotate(-45deg); }
/* 狭い画面では、開いている間だけ左の名前をしまって、検索の欄に場所をゆずる */
@media (max-width: 640px) {
  .top.searching .app { opacity: 0; max-width: 0; margin-right: -1.2rem; }
  .find.open { width: calc(100vw - 3rem - 4.4rem - .6rem); }
}
.top .right { margin-left: auto; display: flex; align-items: center; gap: .6rem; }
.top .back { color: var(--accent); font-size: .9rem; white-space: nowrap; }
.top h1 { font-size: 1rem; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn { flex: none; white-space: nowrap; height: 2.2rem; padding: 0 1rem; border-radius: .6rem; font-size: .85rem; font-weight: 600; display: inline-flex; align-items: center; gap: .4rem; transition: background .25s var(--ease), opacity .25s var(--ease); }
.btn.sub { background: var(--card); }
.btn.sub:hover { background: var(--rule); }
.btn.pri { background: var(--accent); color: #fff; }
.btn.pri:hover { opacity: .88; }

/* ── 画面の切り替え：一覧の紙を押すと、その紙がそのまま前に出てきて、確認の画面の紙になる（View Transitions。2026-11-17 本人）
   対応していないブラウザでは、ふつうに切り替わる ── */
@view-transition { navigation: auto; }
::view-transition-group(paper) { animation-duration: .6s; animation-timing-function: cubic-bezier(.22, 1, .36, 1); }
::view-transition-old(paper), ::view-transition-new(paper) { animation-duration: .6s; height: 100%; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .35s; }
@media (prefers-reduced-motion: reduce) { ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; } }

/* ── 一覧 ── */
.list { padding: .4rem 0 3rem; }
.sec-h { font-size: .95rem; font-weight: 700; padding: 1.3rem 1.5rem 0; display: flex; align-items: center; gap: .5rem; }
.sec-h em { font-style: normal; font-size: .72rem; font-weight: 700; color: #fff; background: var(--red); border-radius: 999px; padding: .05rem .5rem; }
.sec-h em:empty { display: none; }
/* 開け閉め：高さを決め打ちせず、0fr → 1fr でなめらかに（中身の大きさに合わせて伸びる） */
.fold { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .55s var(--ease); }
.fold-in { overflow: hidden; min-height: 0; }
.done.open > .fold, .month.open > .fold { grid-template-rows: 1fr; }
.done.open > .fold > .fold-in, .month.open > .fold > .fold-in { opacity: 1; }
.fold-in { opacity: 0; transition: opacity .45s var(--ease); }
.done { margin: 1.2rem 1.5rem 0; border-top: 1px solid var(--rule); }
.done > .done-h { width: auto; }
.done-h, .month-h { display: flex; align-items: center; gap: .45rem; text-align: left; color: var(--fg); }
/* 確認済み：閉じている間はボタン（押せると分かる形）。開くと見出しになる */
.done-h { margin: 1rem 0; padding: .6rem 1rem .6rem 1.1rem; border-radius: 999px; background: var(--card); transition: background .35s var(--ease), padding .45s var(--ease), margin .45s var(--ease); }
.done-h:hover { background: var(--rule); }
.done.open > .done-h { padding: .2rem 0; margin: 1.2rem 0 .6rem; background: transparent; }
.month-h { width: 100%; }
.done-h span { font-size: .95rem; font-weight: 700; }
.done-h small, .month-h small { font-size: .78rem; color: var(--faint); }
.chev { margin-left: .15rem; width: .5rem; height: .5rem; flex: none; border-right: 1.6px solid var(--faint); border-bottom: 1.6px solid var(--faint); transform: rotate(45deg) translate(-2px, -2px); transition: transform .45s var(--ease); }
.done.open > .done-h .chev, .month.open > .month-h .chev { transform: rotate(225deg) translate(-2px, -2px); }
.month { border-top: 1px solid var(--rule); }
.month-h { padding: .85rem .2rem; }
.month-h span { font-size: .88rem; font-weight: 600; }
.done .grid { padding: .2rem 0 1.4rem; }
.done .empty { padding: 1.5rem 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: 1.4rem 1.1rem; padding: 1.2rem 1.5rem 3rem; }
.item { display: block; min-width: 0; }
.thumb { position: relative; aspect-ratio: 1 / 1.3; border-radius: .6rem; background: var(--canvas); border: 1px solid var(--rule); overflow: hidden; transition: border-color .3s var(--ease), transform .4s var(--ease); }
.item:hover .thumb { border-color: var(--line-strong); transform: translateY(-2px); }
.item.new .thumb { border: 2px solid var(--accent); }
.thumb .paper { position: absolute; left: 50%; top: .7rem; transform-origin: top center; outline: 3px solid var(--line-strong); }
.flag { position: absolute; top: .5rem; left: .5rem; font-size: .7rem; font-weight: 700; padding: .15rem .5rem; border-radius: .35rem; background: var(--red); color: #fff; }
.flag.ok { background: var(--bg); color: var(--mid); border: 1px solid var(--rule); font-weight: 500; }
.flag.done { background: var(--bg); color: var(--green); border: 1px solid var(--rule); }
/* 複数枚：右上に丸数字。後ろにもう1枚重なっているように、紙の影を1枚分ずらして見せる */
.pages { position: absolute; top: .45rem; right: .5rem; z-index: 1; min-width: 1.5rem; height: 1.5rem; display: flex; align-items: center; justify-content: center; font-size: 1rem; line-height: 1; color: var(--fg); background: var(--bg); border: 1px solid var(--rule); border-radius: 999px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.thumb.multi .paper { box-shadow: 18px 18px 0 -3px #fff, 18px 18px 0 0 var(--line-strong); }  /* 紙は縮めて描くので、大きめにずらす */
/* 工事名は2行まで（長いものは2行目の終わりを…に）。その下に依頼業者（施工者名）、受け取った方法と日時 */
.item h2 { font-size: .98rem; font-weight: 700; line-height: 1.4; margin-top: .6rem; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
.item > .co { font-size: .8rem; color: var(--mid); margin-top: .15rem; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item p { font-size: .75rem; color: var(--faint); margin-top: .1rem; display: flex; align-items: center; gap: .4rem; }
.src { font-size: .68rem; font-weight: 600; padding: 0 .4rem; border-radius: .25rem; background: var(--accent-soft); color: var(--accent); }
.src.fax { background: var(--fax-soft); color: var(--fax); }
.empty { padding: 4rem 1.5rem; text-align: center; color: var(--faint); font-size: .9rem; }

/* ── 確認・修正 ── */
.work { display: grid; grid-template-columns: minmax(0, 1fr) 22rem; height: calc(100vh - 3.6rem); }
.view { position: relative; overflow: clip; min-width: 0; }  /* hidden だと、隣の紙を押したときに枠ごと横に動くことがある。clip は動かない */
.canvas { position: absolute; inset: 0; background: var(--canvas); overflow: auto; padding: 1.5rem 1.5rem 4.4rem; display: flex; align-items: flex-start; }  /* 下は右下の札の分だけあける */
.sizer { flex: none; margin: 0 auto; position: relative; }  /* margin:auto で真ん中に。拡大して画面より大きくなっても左が切れない */
.sizer > .paper { position: absolute; left: 0; top: 0; transform-origin: top left; outline: 1px solid var(--line-strong); }
/* 隣の紙：画面の端から少しだけ見せる。押すと入れ替わる */
.peek { position: absolute; z-index: 2; padding: 0; border: 0; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; opacity: .5; transition: opacity .35s var(--ease), translate .35s var(--ease); }
.peek .sizer { width: 100%; height: 100%; margin: 0; pointer-events: none; }
.peek.next:hover { opacity: .75; translate: -10px 0; }
.peek.prev:hover { opacity: .75; translate: 10px 0; }
/* 右下：ページ送りと拡大・縮小（紙にかからない小さな札） */
.dock { position: absolute; right: 1rem; bottom: 1rem; z-index: 3; display: flex; gap: .5rem; align-items: center; }
.pager, .zoom { display: flex; align-items: center; gap: .15rem; height: 2.2rem; padding: 0 .3rem; border-radius: 999px; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: saturate(180%) blur(16px); -webkit-backdrop-filter: saturate(180%) blur(16px); box-shadow: 0 1px 2px rgba(0,0,0,.06), 0 4px 14px rgba(0,0,0,.08); border: 1px solid var(--rule); }
.pager button, .zoom button { min-width: 1.9rem; height: 1.9rem; border-radius: 999px; font-size: 1rem; color: var(--mid); transition: background .2s var(--ease), color .2s var(--ease); }
.pager button:hover:not(:disabled), .zoom button:hover { background: var(--card); color: var(--fg); }
.pager button:disabled { color: var(--hint); cursor: default; }
.pager span { font-size: .8rem; color: var(--mid); padding: 0 .3rem; font-variant-numeric: tabular-nums; }
.zoom input { width: 6.5rem; accent-color: var(--accent); }
.pager[hidden], .peek[hidden] { display: none; }
#zVal { font-size: .75rem; min-width: 3.1rem; font-variant-numeric: tabular-nums; }
.side { border-left: 1px solid var(--rule); overflow: auto; padding: 1.2rem 1.2rem 2rem; }
.side h3 { font-size: .85rem; font-weight: 700; display: flex; align-items: center; gap: .5rem; }
.side h3 em { font-style: normal; font-size: .7rem; background: var(--red); color: #fff; padding: 0 .45rem; border-radius: 999px; }
.side .lead { font-size: .75rem; color: var(--faint); margin-top: .25rem; }
.chk { display: block; width: 100%; text-align: left; cursor: pointer; border: 1px solid var(--rule); border-left: 3px solid var(--red); border-radius: .5rem; padding: .6rem .75rem; margin-top: .6rem; transition: background .25s var(--ease), border-color .25s var(--ease); }
.chk:hover, .chk.on { background: var(--red-soft); border-color: var(--red); }
.chk.ok { border-left-color: var(--green); opacity: .7; }
.chk .f { font-size: .7rem; color: var(--faint); }
.chk .v { font-size: .85rem; font-weight: 700; color: var(--red); margin-top: .1rem; }
.chk.ok .v { color: var(--fg); }
.chk .r { font-size: .75rem; color: var(--mid); margin-top: .2rem; }
.orig { margin-top: 1.2rem; border-top: 1px solid var(--rule); padding-top: 1rem; }
.mail { margin-top: .5rem; border: 1px solid var(--rule); border-radius: .5rem; padding: .7rem .8rem; font-size: .78rem; line-height: 1.75; color: var(--mid); background: var(--card); white-space: pre-wrap; }
.mail .h { display: block; font-size: .72rem; color: var(--faint); border-bottom: 1px solid var(--rule); padding-bottom: .4rem; margin-bottom: .4rem; white-space: normal; }
.mail .h b { color: var(--fg); font-weight: 600; }
.mail mark { background: var(--red-soft); color: var(--fg); border-radius: 2px; padding: 0 1px; }
.files { margin-top: .5rem; font-size: .75rem; color: var(--mid); }
.meta { margin-top: 1rem; font-size: .72rem; color: var(--faint); }
/* 元の依頼の画像：右の欄に小さく並べ、押すと画面いっぱいに広がる。向きは手で回せる（回した向きは保存する） */
.orig-pages { margin-top: .6rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr)); gap: .5rem; }
.pg { position: relative; display: block; padding: 0; border: 1px solid var(--rule); border-radius: .4rem; overflow: hidden; background: #fff; aspect-ratio: 1 / 1; cursor: zoom-in; transition: border-color .25s var(--ease), box-shadow .35s var(--ease), translate .35s var(--ease); }
.pg:hover { border-color: var(--line-strong); box-shadow: 0 4px 14px rgba(0,0,0,.1); translate: 0 -2px; }
.pg img { width: 100%; height: 100%; object-fit: contain; display: block; transition: opacity .35s var(--ease); }
.pg small { position: absolute; right: .3rem; bottom: .25rem; font-size: .62rem; color: var(--faint); background: color-mix(in srgb, var(--bg) 85%, transparent); border-radius: 999px; padding: 0 .35rem; font-variant-numeric: tabular-nums; }
.lb { position: fixed; inset: 0; z-index: 40; background: color-mix(in srgb, var(--canvas) 0%, transparent); transition: background .45s var(--ease); }
.lb.on { background: color-mix(in srgb, var(--canvas) 94%, transparent); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.lb[hidden] { display: none; }
.lb-img { position: absolute; left: 0; top: 0; max-width: none; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.08), 0 18px 48px rgba(0,0,0,.16); transform-origin: center; will-change: transform; }
.lb-img.move { transition: transform .55s cubic-bezier(.22,1,.36,1), width .55s cubic-bezier(.22,1,.36,1), height .55s cubic-bezier(.22,1,.36,1), left .55s cubic-bezier(.22,1,.36,1), top .55s cubic-bezier(.22,1,.36,1), opacity .35s var(--ease); }
.lb-bar { position: absolute; left: 50%; bottom: 1.2rem; translate: -50% .6rem; opacity: 0; display: flex; gap: .5rem; transition: opacity .35s var(--ease), translate .45s var(--ease); }
.lb.on .lb-bar { opacity: 1; translate: -50% 0; }
.lb-bar > div { display: flex; align-items: center; gap: .15rem; height: 2.4rem; padding: 0 .3rem; border-radius: 999px; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: saturate(180%) blur(16px); -webkit-backdrop-filter: saturate(180%) blur(16px); box-shadow: 0 1px 2px rgba(0,0,0,.06), 0 4px 14px rgba(0,0,0,.08); border: 1px solid var(--rule); }
.lb-bar button { min-width: 2.1rem; height: 2.1rem; padding: 0 .55rem; border-radius: 999px; font-size: .85rem; color: var(--mid); display: inline-flex; align-items: center; justify-content: center; gap: .3rem; transition: background .2s var(--ease), color .2s var(--ease); }
.lb-bar button:hover:not(:disabled) { background: var(--card); color: var(--fg); }
.lb-bar button:disabled { color: var(--hint); cursor: default; }
.lb-bar svg { width: 1.05rem; height: 1.05rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.lb-bar span { font-size: .8rem; color: var(--mid); padding: 0 .3rem; font-variant-numeric: tabular-nums; }
.lb-bar [hidden] { display: none; }
@media (prefers-reduced-motion: reduce) { .lb-img.move { transition: opacity .2s linear; } }

.chk-a { display: flex; gap: 1rem; margin-top: .35rem; font-size: .75rem; color: var(--accent); }
.chk-a span:hover { text-decoration: underline; }
.saved { font-size: .75rem; color: var(--faint); margin-right: .4rem; opacity: 0; transition: opacity .4s var(--ease); }
.saved.show { opacity: 1; }

/* ── 打ち合わせ表（引佐生コンの様式）。紙なので、ダークモードでも白のまま。大きさは A4 を 600×848 で描き、画面に合わせて縮める ── */
.paper { width: 600px; height: 848px; background: #fff; color: #111; padding: 26px 30px 20px; font-family: 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', 'Yu Gothic', Meiryo, sans-serif; }
.paper .head { position: relative; text-align: center; margin-bottom: 9px; }
.paper h1 { font-size: 16px; font-weight: 700; letter-spacing: .08em; line-height: 24px; }
.paper .no { position: absolute; right: 0; bottom: 1px; font-size: 12px; font-weight: 700; display: flex; align-items: baseline; gap: 4px; }
.paper .no > span { display: inline-block; min-width: 54px; border-bottom: .8px solid #333; font-weight: 400; text-align: center; }
.paper table { width: 100%; border-collapse: collapse; table-layout: fixed; border: 1.3px solid #111; }
.paper td { border: .8px solid #444; padding: 1px 4px; vertical-align: middle; overflow: hidden; white-space: nowrap; }
.paper table.main { height: 646px; font-size: 8.2px; line-height: 1.3; }
.paper tr.g1 > td { border-top: 1.3px solid #111; }
.paper td.l { text-align: center; }
.paper td.l.sm { font-size: 7.6px; letter-spacing: -.02em; }
.paper td.vt { text-align: center; writing-mode: vertical-rl; letter-spacing: .7em; font-size: 9px; padding: 0; }
.paper td.c { text-align: center; font-size: 8.8px; }
.paper td .ed.wrapv { white-space: normal; overflow-wrap: anywhere; line-height: 1.1; }
.paper td.v { font-size: 8.8px; padding: 1px 4px; text-align: center; }  /* 値のマスは、すべて上下左右の真ん中に（2026-11-25 本人） */
.paper td.v.big { font-size: 10.5px; }
.paper td.v.r { text-align: center; }
.paper td i { font-style: normal; }
.paper td.v.r i { margin-left: 10px; }
.paper td i.pre { margin-right: 8px; }
.paper tr.tall > td { height: 32px; }
.paper tr.spot > td { height: 42px; }
.paper td.wrap { white-space: normal; line-height: 1.35; text-align: center; }
.paper .nm { height: 30px; overflow: hidden; display: flex; align-items: center; justify-content: center; text-align: center; }
.paper .nm .ed { display: block; width: 100%; white-space: pre-wrap; line-height: 1.3; text-wrap: balance; word-break: auto-phrase; }  /* 文節で折る。1行なら上下の真ん中、2行になったら長さを釣り合わせて折り返す */
.paper tr.nt > td { height: 30px; }
.paper tr.etc > td { height: 44px; vertical-align: top; padding: 2px 5px 2px 4px; }
.paper .etc-l { display: block; font-size: 8.2px; line-height: 1.3; }
.paper .ml { height: 32px; overflow: hidden; padding-left: 3px; }
.paper .ml .ed { display: block; width: 100%; white-space: pre-wrap; line-height: 1.3; }
.paper td.per { text-align: center; font-size: 7.2px; line-height: 1.3; padding: 2px 1px; height: 46px; }
.paper td.per .opt { display: block; width: fit-content; margin: 0 auto; padding: 0 5px; }
.paper td.bnd { position: relative; height: 19px; }
.paper .bound { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 0; font-size: 6px; line-height: 1.2; }
.paper .bound .opt { padding: 0 3px; }
.paper tr.sum > td { height: 26px; }
.paper tr.sum .opt { font-size: 9px; margin: 0 16px; padding: 1px 8px; }
.paper .opt { display: inline-block; padding: 0 4px; border: .8px solid transparent; border-radius: 999px; }
.paper .opt.on { border-color: #111; }
.paper table.foot { margin-top: -1.3px; font-size: 8px; border: 0; }
.paper table.foot td { text-align: center; height: 16px; padding: 1px 2px; line-height: 1.15; }
.paper table.foot td.l { border-left: 1.3px solid #111; border-bottom: 1.3px solid #111; }
.paper table.foot tr.r1 td:last-child, .paper table.foot tr.r2 td:last-child,
.paper table.foot tr.r3 td:last-child, .paper table.foot tr.r4 td:last-child { border-right: 1.3px solid #111; }
.paper table.foot tr.r4 td { border-bottom: 1.3px solid #111; }
.paper table.foot tr.r3 td.h.sm, .paper table.foot tr.r1 td.h.sm { font-size: 6.4px; letter-spacing: 0; }  /* 2行に分けた見出し（アルカリシリカ反応・圧縮試験機検査表） */
.paper table.foot tr.r6 td { height: 36px; }
.paper table.foot td.nb { border: 0; }
.paper table.foot td.co { border: 0; text-align: left; vertical-align: bottom; font-size: 9px; letter-spacing: .04em; padding: 0 0 1px; }
.paper table.foot td.h.sm { font-size: 6.6px; letter-spacing: -.03em; }
.paper td.ck .opt { border: 0; padding: 0 8px; color: transparent; }
.paper td.ck .opt.on { color: #111; }
.paper td.st-l { border-left: 1.6px solid #111; }
.paper td.st-r { border-right: 1.6px solid #111; }
.paper td.st-t { border-top: 1.6px solid #111; }
.paper td.st-b { border-bottom: 1.6px solid #111; }
.paper .pick { display: inline-block; min-width: 2.5em; min-height: 1.1em; vertical-align: middle; }
.paper td.v.r .pick { min-width: 1.2em; text-align: center; }
.paper td.sp { position: relative; padding: 0; }
.paper td.sp img { position: absolute; left: 50%; top: 50%; width: 30px; height: 30px; transform: translate(-50%, -50%) rotate(var(--rot, 0deg)); }

/* 赤字・赤枠（AIが確認をお願いしたい箇所）。値がないときは、空の枠を赤で囲む */
.paper .low { color: #c4362c; font-weight: 700; }
.paper .opt.low { border-style: dashed; border-color: #c4362c; }
.screen .paper .ed.low { background: #fdecea; }
.screen .paper .ed.low:empty { outline: 1.5px solid #c4362c; outline-offset: -1px; }
.screen .paper .hl { outline: 2px solid #c4362c; outline-offset: 1px; }

/* 選ぶ欄（提出部数・種類の記号・当工場担当者・押印）：押すと候補が出る */
.screen .paper td:has(.pick), .screen .paper td.sp { cursor: pointer; transition: background .2s var(--ease); }
.screen .paper td:has(.pick):hover, .screen .paper td.sp:hover { background: #eef4fd; }
.screen .paper td.sp:empty:hover::after { content: '押印'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 7px; color: #8fb8ee; }
.screen .paper .pick.low:empty, .screen .paper .pick.low { background: #fdecea; }

/* 書き換え：値の欄を押すと、その場で入力できる（Enter で決定、Esc で取り消し）。○の欄は押すと付け外しできる */
.paper .ed { display: inline-block; min-width: 2.5em; min-height: 1.1em; vertical-align: middle; }
.screen .paper td:has(.ed) { cursor: text; transition: background .2s var(--ease); }
.screen .paper td:has(.ed):hover { background: #eef4fd; }
.screen .paper .ed[contenteditable] { outline: none; white-space: pre; caret-color: #0071e3; }
.screen .paper .nm .ed[contenteditable], .screen .paper .ml .ed[contenteditable] { white-space: pre-wrap; }
/* 書き換え中は、枠を重ねずに、罫線の内側（その欄全体）の色だけを変える。欄の中いっぱいに書ける */
.screen .paper td.editing { background: #dfeafb !important; }
.screen .paper td.editing .ed { display: block; width: 100%; background: transparent; color: #111; font-weight: 400; outline: none; }
.screen .paper .ed { transition: background 1.2s var(--ease); }
.screen .paper .ed.done { background: #e3f5e8; transition: none; }
.screen .paper .opt { cursor: pointer; transition: border-color .2s var(--ease), background .2s var(--ease); }
.screen .paper .opt:not(.on):hover { border-color: #8fb8ee; border-style: dashed; }
.screen .paper td.ck { cursor: pointer; }
.screen .paper td.ck:hover .opt:not(.on) { color: #9fb5d6; }

/* ── 設定：iPhone の設定アプリのように、項目を押すとその画面が開く（2026-11-20 本人） ── */
.set { max-width: 40rem; margin: 0 auto; padding: 1.6rem 1.5rem 4rem; }
.stack { position: relative; }
/* 開いている画面だけが流れの中にあり、ほかは重ねて隠す。切り替えは横に少しずれながら、ぬるっと入れ替わる */
.pane { transition: opacity .45s var(--ease), transform .55s cubic-bezier(.22,1,.36,1), visibility 0s; }
.pane:not(.on) { position: absolute; inset: 0 0 auto; opacity: 0; transform: translateX(1.6rem); visibility: hidden; pointer-events: none; transition: opacity .3s var(--ease), transform .45s var(--ease), visibility 0s .45s; }
.pane.root:not(.on) { transform: translateX(-1.6rem); }
@media (prefers-reduced-motion: reduce) { .pane, .pane:not(.on) { transition: none; transform: none; } }
.group { list-style: none; background: var(--bg); border: 1px solid var(--rule); border-radius: .8rem; overflow: hidden; }
.group + .group { margin-top: 1.6rem; }
.group li + li .nav::before { content: ''; position: absolute; top: 0; left: 3.6rem; right: 0; border-top: 1px solid var(--rule); }
.nav { position: relative; width: 100%; display: flex; align-items: center; gap: .85rem; padding: .7rem 1rem; min-height: 3.2rem; text-align: left; font-size: .95rem; transition: background .2s var(--ease); }
.nav:hover { background: var(--card); }
.nav:active { background: var(--rule); }
.nav > span { flex: 1; min-width: 0; }
.nav small { display: block; font-size: .75rem; color: var(--faint); line-height: 1.4; }
.nav em { font-style: normal; font-size: .88rem; color: var(--faint); font-variant-numeric: tabular-nums; }
.ic { flex: none; width: 1.85rem; height: 1.85rem; border-radius: .5rem; background: var(--accent); display: flex; align-items: center; justify-content: center; }
.ic svg { width: 1.25rem; height: 1.25rem; fill: none; stroke: #fff; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.nav .go { flex: none; width: .45rem; height: .45rem; border-right: 1.8px solid var(--hint); border-top: 1.8px solid var(--hint); transform: rotate(45deg); margin-right: .2rem; }
.nav .out { flex: none; width: .55rem; height: .55rem; border-right: 1.8px solid var(--hint); border-top: 1.8px solid var(--hint); margin-right: .2rem; position: relative; }
.nav .out::after { content: ''; position: absolute; right: -1px; top: -1px; width: .7rem; border-top: 1.8px solid var(--hint); transform: rotate(-45deg); transform-origin: right; }
.set .lead { font-size: .85rem; color: var(--faint); }
.set .rows { list-style: none; margin-top: .9rem; border: 1px solid var(--rule); border-radius: .8rem; overflow: hidden; }
.set .rows li { display: flex; align-items: center; gap: .6rem; padding: .75rem 1rem; font-size: .95rem; min-height: 3rem; }
.set .rows li + li { border-top: 1px solid var(--rule); }
.set .rows li > span { min-width: 0; }
.set .rows li small { display: block; font-size: .78rem; color: var(--faint); }
.set .rows li.just { animation: just 1.6s var(--ease); }
@keyframes just { from { background: var(--accent-soft); } to { background: transparent; } }
.set .del { margin-left: auto; flex: none; font-size: .8rem; color: var(--red); padding: .25rem .55rem; border-radius: .4rem; transition: background .25s var(--ease), color .25s var(--ease); }
.set .del:hover { background: var(--red-soft); }
.set .del.sure { background: var(--red); color: #fff; font-weight: 600; }
.set .none { color: var(--faint); font-size: .88rem; }
/* 追加：はじめは「＋ 追加」だけ。押すと、色の付いた箱の中に入力の欄が開く（登録済みの一覧と見分けがつくように） */
.adder { margin-top: .7rem; }
.add-open { display: inline-flex; align-items: center; gap: .5rem; padding: .45rem .2rem; font-size: .92rem; font-weight: 600; color: var(--accent); transition: opacity .3s var(--ease); }
.add-open i { width: 1.25rem; height: 1.25rem; border-radius: 999px; background: var(--accent); position: relative; }
.add-open i::before, .add-open i::after { content: ''; position: absolute; left: 50%; top: 50%; width: .62rem; height: 1.6px; background: #fff; border-radius: 1px; transform: translate(-50%, -50%); }
.add-open i::after { transform: translate(-50%, -50%) rotate(90deg); }
.add-open:hover { opacity: .75; }
.adder.open .add-open { opacity: 0; pointer-events: none; height: 0; padding: 0; overflow: hidden; }
.adder .fold-in { opacity: 0; }
.adder.open > .fold { grid-template-rows: 1fr; }
.adder.open > .fold > .fold-in { opacity: 1; }
.set .add { display: flex; gap: .5rem; flex-wrap: wrap; background: var(--card); border-radius: .8rem; padding: .9rem; margin-top: .2rem; }
.set .add input, .set .add select { flex: 1 1 10rem; min-width: 0; height: 2.5rem; border: 1px solid var(--rule); border-radius: .6rem; padding: 0 .8rem; font: inherit; font-size: .92rem; background: var(--bg); color: var(--fg); outline: none; transition: border-color .2s var(--ease), box-shadow .2s var(--ease); }
.set .add input:focus, .set .add select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.set .add select { flex: 0 0 8rem; }
.set .add .acts { flex: 1 0 100%; display: flex; justify-content: flex-end; gap: .5rem; margin-top: .2rem; }
.set .add .btn { height: 2.3rem; }
.set .add .err { flex: 1 0 100%; font-size: .8rem; color: var(--red); }
.set .add .err:empty { display: none; }
.set .file { flex: 1 1 12rem; display: flex; align-items: center; height: 2.5rem; border: 1px dashed var(--line-strong); border-radius: .6rem; padding: 0 .8rem; font-size: .88rem; color: var(--mid); background: var(--bg); cursor: pointer; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.set .file input { display: none; }
.set-h { font-size: .8rem; font-weight: 600; color: var(--faint); margin: 1.8rem .2rem .5rem; }
.set .add.pw { flex-direction: column; }
.set .add.pw input { flex: none; }
.set .out-row { margin-top: 2rem; }
.set .logout { width: 100%; text-align: center; color: var(--red); font-size: .95rem; padding: .1rem 0; transition: color .25s var(--ease); }
.set .logout.sure { font-weight: 600; }
.toast { position: fixed; left: 50%; bottom: 1.6rem; z-index: 70; max-width: calc(100% - 2rem); padding: .6rem 1rem; border-radius: .7rem; background: var(--fg); color: var(--bg); font-size: .85rem; opacity: 0; transform: translate(-50%, .6rem); pointer-events: none; transition: opacity .3s var(--ease), transform .45s cubic-bezier(.22,1,.36,1); }
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button { margin-left: .9rem; font-weight: 700; color: var(--bg); text-decoration: underline; text-underline-offset: .2em; }
/* 一覧の削除：ふだんは見えず、紙にマウスを乗せると右下に出る（触る画面では、いつも出す） */
.thumb .trash { position: absolute; right: .5rem; bottom: .5rem; z-index: 2; height: 2rem; min-width: 2rem; padding: 0 .5rem; display: flex; align-items: center; justify-content: center; gap: .3rem; border-radius: 999px; background: var(--bg); border: 1px solid var(--rule); color: var(--mid); box-shadow: 0 1px 3px rgba(0,0,0,.08); opacity: 0; transform: scale(.9); transition: opacity .25s var(--ease), transform .35s cubic-bezier(.2,1.3,.4,1), background .25s var(--ease), color .25s var(--ease); }
.thumb .trash svg { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.thumb .trash span { display: none; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.item:hover .trash, .item:focus-within .trash, .trash.sure { opacity: 1; transform: none; }
@media (hover: none) { .thumb .trash { opacity: 1; transform: none; } }
.thumb .trash:hover { color: var(--red); }
.thumb .trash.sure { background: var(--red); border-color: var(--red); color: #fff; padding: 0 .75rem; }
.thumb .trash.sure span { display: inline; }
.item.leaving { opacity: 0; transform: scale(.96); transition: opacity .3s var(--ease), transform .3s var(--ease); }
.btn.del { color: var(--red); }
.btn.del.sure { background: var(--red); color: #fff; }
.set .hint { font-size: .78rem; color: var(--faint); margin-top: .6rem; }
.set .role { margin-top: 1rem; }
.set .role h3 { font-size: .8rem; font-weight: 600; color: var(--mid); }
.set .seals { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .45rem; }
.set figure { width: 6.4rem; border: 1px solid var(--rule); border-radius: .7rem; padding: .7rem .5rem .5rem; text-align: center; background: #fff; }
.set figure img { width: 3.6rem; height: 3.6rem; }
.set figcaption { font-size: .8rem; color: #1d1d1f; margin-top: .25rem; }
.set figure .del { margin: .15rem auto 0; display: block; }
.set figure img { transition: transform .35s cubic-bezier(.2,1.2,.4,1); }
.set .turn { display: flex; justify-content: center; gap: .3rem; margin-top: .2rem; }
.set .turn button { width: 1.8rem; height: 1.6rem; border-radius: .4rem; color: var(--mid); font-size: .9rem; transition: background .2s var(--ease); }
.set .turn button:hover { background: var(--card); }

/* ── 選択肢（menu.js） ── */
.menu { position: fixed; z-index: 60; min-width: 12rem; max-width: 18rem; background: var(--bg); border: 1px solid var(--rule); border-radius: .8rem; box-shadow: 0 14px 36px rgba(0,0,0,.14); padding: .35rem; opacity: 0; transform: translateY(-4px) scale(.97); transition: opacity .18s var(--ease), transform .32s cubic-bezier(.2,1.25,.4,1); }
.menu.show { opacity: 1; transform: none; }
.menu .t { font-size: .7rem; color: var(--faint); padding: .35rem .65rem .25rem; }
.menu button { display: flex; width: 100%; align-items: center; gap: .65rem; padding: .5rem .65rem; border-radius: .5rem; font-size: .88rem; text-align: left; transition: background .15s var(--ease); }
.menu button:hover { background: var(--card); }
.menu button.on { color: var(--accent); font-weight: 600; }
.menu button.on::after { content: '✓'; margin-left: auto; }
.menu img { width: 2rem; height: 2rem; flex: none; }
.menu hr { border: 0; border-top: 1px solid var(--rule); margin: .3rem .25rem; }
.menu .sub { display: block; padding: .5rem .65rem; font-size: .8rem; color: var(--accent); border-radius: .5rem; }
.menu .sub:hover { background: var(--card); }

/* ── カレンダー（作成日付） ── */
.menu.cal { width: 16.5rem; max-width: none; padding: .4rem .5rem .45rem; }
.cal-h { display: flex; align-items: center; justify-content: space-between; padding: .1rem .15rem .3rem; }
.cal-h b { font-size: .9rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.menu .cal-nav { width: 2rem; height: 2rem; justify-content: center; padding: 0; font-size: 1.2rem; color: var(--accent); border-radius: 999px; }
.cal-w, .cal-g { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; }
.cal-w span { font-size: .68rem; color: var(--faint); padding: .15rem 0; }
.cal-w span:first-child { color: var(--red); } .cal-w span:last-child { color: var(--accent); }
.cal-v { position: relative; overflow: hidden; transition: height .4s cubic-bezier(.22,1,.36,1); }
.cal-v .cal-g { transition: transform .42s cubic-bezier(.22,1,.36,1), opacity .3s var(--ease); }
.cal-v .cal-g + .cal-g { position: absolute; inset: 0 0 auto; }
.menu .cal-g button { justify-content: center; padding: 0; width: 2.1rem; height: 2.1rem; margin: .05rem auto; border-radius: 999px; font-size: .85rem; font-variant-numeric: tabular-nums; }
.menu .cal-g button.sun { color: var(--red); } .menu .cal-g button.sat { color: var(--accent); }
.menu .cal-g button.now { box-shadow: inset 0 0 0 1.5px var(--accent); }
.menu .cal-g button.on { background: var(--accent); color: #fff; font-weight: 600; }
.menu .cal-g button.on::after { content: none; }
.cal-f { display: flex; justify-content: space-between; padding: 0 .1rem; }
.menu .cal-f button { width: auto; font-size: .82rem; color: var(--accent); padding: .4rem .6rem; }

/* ── 印刷・PDF：表だけを A4 の大きさで出す（600px の表を 210mm に） ── */
@page { size: A4 portrait; margin: 0; }
@media print {
  html, body { background: #fff !important; }
  .top, .side, .menu, .splash { display: none !important; }
  .work { display: block; height: auto; }
  .view { overflow: visible; }
  .canvas { position: static; display: block; padding: 0; background: none; overflow: visible; }
  .peek, .dock, .lb { display: none !important; }
  .sizer { width: auto !important; height: auto !important; margin: 0 !important; transform: none !important; opacity: 1 !important; }
  .sizer > .paper { position: static; zoom: 1 !important; transform: scale(1.3228) !important; transform-origin: top left; margin: 0 !important; outline: none; }
  .paper .low { color: #111 !important; font-weight: 400 !important; background: none !important; outline: none !important; }
  .paper .opt.low { border-style: solid; border-color: transparent; }
  .paper .opt.low.on { border-color: #111; }
  .paper .hl { outline: none !important; }
  .paper td { background: none !important; }
  body.no-stamp .paper td.sp img { display: none; }
}

/* ── ネットにつながらないとき（アプリとして入れたとき） ── */
.offline { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .8rem; padding: 2rem 1.5rem; text-align: center; }
.offline img { border-radius: 1rem; margin-bottom: .4rem; }
.offline h1 { font-size: 1.1rem; font-weight: 700; }
.offline p { font-size: .88rem; color: var(--faint); margin-bottom: .6rem; }
