/* 設計工事管理 — トレーシングペーパーの地に製図ペンの青、印影の朱は「状況」だけに使う */
:root {
  --paper: #F2F4F3;
  --sheet: #FFFFFF;
  --ink: #1D2A30;
  --muted: #5B686D;
  --rule: #BAC4C2;
  --rule-soft: #DCE2E0;
  --pen: #2F4E8C;
  --pen-soft: #E6ECF6;
  --stamp: #B8322A;
  --ok: #2E6B4F;
  --warn: #9A5B00;
  --radius: 4px;
  --mincho: "Shippori Mincho B1", "Hiragino Mincho ProN", "Yu Mincho", serif;
  --gothic: "BIZ UDPGothic", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.7 var(--gothic);
  font-variant-numeric: tabular-nums;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--pen); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--pen); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- アプリバー ---------- */
.appbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 20px; padding-top: max(10px, env(safe-area-inset-top));
  background: var(--paper); border-bottom: 1px solid var(--rule);
}
.brand { font-family: var(--mincho); font-weight: 800; font-size: 19px; letter-spacing: .08em; color: var(--ink); text-decoration: none; }
.appbar-actions { display: flex; gap: 8px; }

/* ---------- ボタン ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; padding: 6px 14px; border-radius: var(--radius);
  border: 1px solid var(--rule); background: var(--sheet); color: var(--ink);
  font-size: 14px; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--pen); }
.btn.primary { background: var(--pen); border-color: var(--pen); color: #fff; }
.btn.primary:hover { background: #253f73; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--stamp); border-color: #e3b9b5; background: transparent; }
.btn.small { min-height: 30px; padding: 2px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------- レイアウト ---------- */
.layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); min-height: calc(100vh - 59px); }
.rail { border-right: 1px solid var(--rule); background: var(--paper); position: sticky; top: 59px; height: calc(100vh - 59px); overflow: auto; }
.rail-search { display: grid; gap: 6px; padding: 14px 14px 10px; border-bottom: 1px solid var(--rule-soft); }
.rail-search input, .rail-search select { width: 100%; padding: 7px 10px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--sheet); }
.rail-list { list-style: none; margin: 0; padding: 6px 0; }
.rail-list a { display: block; padding: 9px 16px; text-decoration: none; color: var(--ink); border-left: 3px solid transparent; }
.rail-list a:hover { background: var(--sheet); }
.rail-list a[aria-current="page"] { background: var(--sheet); border-left-color: var(--pen); }
.rail-list .r-name { font-weight: 700; display: block; }
.rail-list .r-meta { font-size: 12px; color: var(--muted); display: flex; gap: 10px; }
.rail-empty { padding: 16px; color: var(--muted); font-size: 13px; }

main { padding: 24px 28px 96px; min-width: 0; }
main:focus { outline: none; }

/* ---------- 表題欄（図面右下のタイトルブロックを模した物件ヘッダー） ---------- */
.titleblock {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 96px;
  grid-template-areas:
    "name name name stamp"
    "code kind owner stamp"
    "addr addr upd stamp";
  border: 1.5px solid var(--ink); background: var(--sheet);
}
.titleblock > div { border-right: 1px solid var(--ink); border-bottom: 1px solid var(--ink); padding: 6px 12px; min-width: 0; }
.titleblock .tb-label { display: block; font-size: 11px; color: var(--muted); letter-spacing: .04em; }
.titleblock .tb-value { display: block; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-name { grid-area: name; padding: 10px 14px !important; }
.tb-name .tb-value { font-family: var(--mincho); font-weight: 800; font-size: 30px; line-height: 1.3; letter-spacing: .04em; white-space: normal; }
.tb-code { grid-area: code; } .tb-kind { grid-area: kind; } .tb-owner { grid-area: owner; }
.tb-addr { grid-area: addr; border-bottom: none !important; } .tb-upd { grid-area: upd; border-bottom: none !important; }
.tb-stamp { grid-area: stamp; border-right: none !important; border-bottom: none !important; display: grid; place-items: center; }

/* 印影：状況を示す唯一の朱 */
.stamp {
  width: 68px; height: 68px; border-radius: 50%;
  border: 2.5px solid var(--stamp); color: var(--stamp);
  display: grid; place-items: center; text-align: center;
  font-family: var(--mincho); font-weight: 800; font-size: 15px; line-height: 1.1; letter-spacing: .06em;
  transform: rotate(-9deg);
  box-shadow: inset 0 0 0 2px #fff, inset 0 0 0 3px rgba(184, 50, 42, .55);
  background: radial-gradient(circle at 35% 30%, rgba(184,50,42,.06), transparent 60%);
}
.stamp.muted { --stamp: #8C9396; }
.stamp.sm { width: 44px; height: 44px; font-size: 11px; border-width: 2px; box-shadow: none; }

/* ---------- タブ ---------- */
.tabs {
  display: flex; gap: 0; margin: 18px 0 0; overflow-x: auto; scrollbar-width: none;
  border-bottom: 1.5px solid var(--ink);
  position: sticky; top: 59px; z-index: 10; background: var(--paper);
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  flex: none; padding: 10px 16px 9px; text-decoration: none; color: var(--muted);
  border: 1px solid transparent; border-bottom: none; margin-bottom: -1.5px; border-radius: var(--radius) var(--radius) 0 0;
}
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--ink); font-weight: 700; background: var(--sheet); border-color: var(--ink); border-bottom: 1.5px solid var(--sheet); }
.tabs .count { font-size: 12px; color: var(--muted); margin-left: 4px; font-weight: 400; }

.sheet { background: var(--sheet); border: 1px solid var(--ink); border-top: none; padding: 22px 24px 28px; }
.sheet h2 { font-size: 17px; margin: 0 0 12px; }
.sheet h3 { font-size: 15px; margin: 22px 0 8px; padding-bottom: 4px; border-bottom: 1px solid var(--rule-soft); }
.sheet-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.sheet-head h2 { margin: 0; }
.lead { color: var(--muted); font-size: 13px; margin: -4px 0 14px; max-width: 70ch; }

/* ---------- フォーム ---------- */
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px 16px; }
.field { display: grid; gap: 3px; position: relative; }
.field.wide { grid-column: 1 / -1; }
.field > span { font-size: 12px; color: var(--muted); }
.field input, .field select, .field textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--rule); border-radius: var(--radius); background: #fff; min-height: 40px;
}
.field textarea { resize: vertical; line-height: 1.6; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--pen); outline: 2px solid var(--pen-soft); outline-offset: 0; }
.field .unit { position: absolute; right: 10px; bottom: 9px; font-style: normal; font-size: 13px; color: var(--muted); pointer-events: none; }
.field:has(.unit) input { padding-right: 40px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.form-actions .spacer { flex: 1; }

/* ---------- 一覧（図面リスト風の台帳） ---------- */
.register { width: 100%; border-collapse: collapse; background: var(--sheet); border: 1.5px solid var(--ink); }
.register th, .register td { padding: 9px 12px; border-bottom: 1px solid var(--rule-soft); text-align: left; vertical-align: middle; }
.register th { font-size: 12px; font-weight: 400; color: var(--muted); border-bottom: 1px solid var(--ink); background: #F8FAF9; white-space: nowrap; }
.register tbody tr { cursor: pointer; }
.register tbody tr:hover { background: var(--pen-soft); }
.register .name { font-weight: 700; }
.register .sub { display: block; font-size: 12px; color: var(--muted); }
.num { text-align: right !important; white-space: nowrap; }

.page-title { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-title h1 { font-family: var(--mincho); font-weight: 800; font-size: 26px; margin: 0; letter-spacing: .04em; }

.empty { border: 1.5px dashed var(--rule); border-radius: var(--radius); padding: 28px; text-align: center; color: var(--muted); background: rgba(255,255,255,.5); }
.empty p { margin: 0 0 12px; }

/* 状況ラベル（助成金・工程） */
.tag { display: inline-block; padding: 1px 8px; border-radius: 2px; font-size: 12px; border: 1px solid var(--rule); color: var(--muted); white-space: nowrap; background: #fff; }
.tag.pen { border-color: var(--pen); color: var(--pen); }
.tag.red { border-color: var(--stamp); color: var(--stamp); font-weight: 700; }
.tag.ok { border-color: var(--ok); color: var(--ok); }
.tag.warn { border-color: var(--warn); color: var(--warn); }
.tag.strike { text-decoration: line-through; }

/* ---------- 顧客：メーラー連携 ---------- */
.mailer { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; padding: 14px 16px; border: 1px solid var(--rule); border-radius: var(--radius); background: #F8FAF9; margin-bottom: 18px; }
.mailer .addr { font-size: 16px; font-weight: 700; word-break: break-all; }
.mailer .hint { font-size: 12px; color: var(--muted); }

/* ---------- 助成金カード ---------- */
.subsidy { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; padding: 14px 0; border-bottom: 1px solid var(--rule-soft); cursor: pointer; }
.subsidy:hover .s-name { color: var(--pen); }
.subsidy .s-name { font-weight: 700; font-size: 16px; }
.subsidy .s-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; color: var(--muted); }
.subsidy .s-right { text-align: right; grid-row: span 2; display: grid; gap: 6px; justify-items: end; align-content: start; }
.subsidy .s-amount { font-size: 18px; font-weight: 700; }
.due-soon { color: var(--stamp); font-weight: 700; }
.summary-line { display: flex; gap: 24px; flex-wrap: wrap; padding: 10px 14px; background: #F8FAF9; border: 1px solid var(--rule-soft); border-radius: var(--radius); font-size: 13px; margin-bottom: 8px; }
.summary-line b { font-size: 17px; margin-left: 6px; }

/* ---------- 案内図 ---------- */
.map-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px; }
.map-frame { width: 100%; aspect-ratio: 4 / 3; border: 1px solid var(--ink); background: #e9eeec; }
.map-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
.map-file { border: 1px solid var(--rule); padding: 10px; background: #fff; }
.map-file img { width: 100%; height: auto; display: block; }
.map-file object { width: 100%; height: 480px; }

/* ---------- 工程表（ガント） ---------- */
.gantt-wrap { overflow-x: auto; border: 1px solid var(--ink); background: #fff; margin-bottom: 18px; }
.gantt { position: relative; min-width: 100%; }
.g-row { display: grid; grid-template-columns: 190px 1fr; border-bottom: 1px solid var(--rule-soft); min-height: 34px; }
.g-row:last-child { border-bottom: none; }
.g-label { position: sticky; left: 0; z-index: 2; background: #fff; border-right: 1px solid var(--rule); padding: 6px 10px; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.g-label:hover { color: var(--pen); }
.g-track { position: relative; }
.g-head .g-label { background: #F8FAF9; color: var(--muted); font-size: 12px; cursor: default; }
.g-head .g-track { background: #F8FAF9; height: 34px; }
.g-tick { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--rule-soft); font-size: 11px; color: var(--muted); padding: 8px 0 0 4px; white-space: nowrap; }
.g-tick.month { border-left-color: var(--rule); color: var(--ink); }
.g-bar { position: absolute; top: 8px; height: 18px; border-radius: 2px; border: 1.5px solid var(--pen); background: var(--pen-soft); cursor: pointer; }
.g-bar.doing { background: var(--pen); }
.g-bar.done { background: repeating-linear-gradient(45deg, #C7CFCD, #C7CFCD 3px, #E4E9E7 3px, #E4E9E7 6px); border-color: #9AA5A3; }
.g-bar.late { border-color: var(--stamp); background: #F6E2E0; }
.g-today { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1.5px dashed var(--stamp); z-index: 1; pointer-events: none; }
.g-today span { position: absolute; bottom: 2px; right: 3px; white-space: nowrap; font-size: 10px; color: var(--stamp); background: #fff; padding: 0 2px; }

.gantt-wrap { margin-bottom: 8px; }
.g-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12px; color: var(--muted); margin-bottom: 18px; }
.g-legend span { display: inline-flex; align-items: center; gap: 6px; }
.g-legend .g-bar { position: static; display: inline-block; width: 22px; height: 12px; cursor: default; }
.task-list { width: 100%; border-collapse: collapse; }
.task-list td, .task-list th { padding: 8px 10px; border-bottom: 1px solid var(--rule-soft); text-align: left; font-size: 14px; }
.task-list th { font-size: 12px; color: var(--muted); font-weight: 400; }
.task-list tbody tr { cursor: pointer; }
.task-list tbody tr:hover { background: var(--pen-soft); }
.task-list .dates { white-space: nowrap; color: var(--muted); font-size: 13px; }

/* ---------- 現場確認 ---------- */
.check-cards { display: grid; gap: 12px; }
.check-card { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 14px 16px; border: 1px solid var(--rule); border-radius: var(--radius); background: #fff; text-decoration: none; color: inherit; }
.check-card:hover { border-color: var(--pen); }
.check-card .c-title { font-weight: 700; font-size: 16px; }
.check-card .c-meta { font-size: 13px; color: var(--muted); display: flex; gap: 14px; flex-wrap: wrap; }
.check-card .c-thumbs { display: flex; gap: 4px; margin-top: 8px; }
.check-card .c-thumbs img { width: 56px; height: 56px; object-fit: cover; border: 1px solid var(--rule-soft); }
.tally { display: flex; gap: 6px; align-items: start; flex-wrap: wrap; justify-content: end; }

.checklist { width: 100%; border-collapse: collapse; }
.checklist td { padding: 8px 6px; border-bottom: 1px solid var(--rule-soft); vertical-align: middle; }
.checklist .ck-label input, .checklist .ck-note input { width: 100%; padding: 6px 8px; border: 1px solid transparent; border-radius: var(--radius); background: transparent; }
.checklist .ck-label input:hover, .checklist .ck-note input:hover { border-color: var(--rule-soft); }
.checklist .ck-label input:focus, .checklist .ck-note input:focus { border-color: var(--pen); background: #fff; outline: none; }
.checklist .ck-label { width: 42%; }
.seg { display: inline-flex; border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; }
.seg span { display: block; padding: 5px 10px; font-size: 13px; cursor: pointer; border-right: 1px solid var(--rule-soft); white-space: nowrap; }
.seg label:last-child span { border-right: none; }
.seg input:checked + span { background: var(--pen); color: #fff; }
.seg input[value="要是正"]:checked + span { background: var(--stamp); }
.seg input[value="対象外"]:checked + span { background: #8C9396; }
.seg input:focus-visible + span { outline: 2px solid var(--pen); outline-offset: -2px; }
.ck-del { border: none; background: none; color: var(--muted); cursor: pointer; font-size: 18px; padding: 2px 8px; }
.ck-del:hover { color: var(--stamp); }

/* ---------- 写真 ---------- */
.photo-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.photo-toolbar select { padding: 7px 10px; border: 1px solid var(--rule); border-radius: var(--radius); background: #fff; }
.photo-day { font-size: 13px; color: var(--muted); margin: 18px 0 8px; padding-bottom: 4px; border-bottom: 1px solid var(--rule-soft); }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.photo { position: relative; background: #fff; border: 1px solid var(--rule-soft); }
.photo button.open { display: block; width: 100%; padding: 0; border: 0; background: #E4E9E7; cursor: zoom-in; aspect-ratio: 1; }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo .p-cap { font-size: 12px; padding: 4px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 26px; }
.photo .p-sel { position: absolute; top: 6px; left: 6px; width: 26px; height: 26px; display: grid; place-items: center; background: rgba(255,255,255,.92); border-radius: 3px; border: 1px solid var(--rule); }
.photo .p-sel input { width: 17px; height: 17px; margin: 0; accent-color: var(--pen); cursor: pointer; }
.photo.selected { outline: 3px solid var(--pen); outline-offset: -1px; }
.photo .p-status { position: absolute; top: 6px; right: 6px; display: flex; gap: 3px; }
.badge { font-size: 10px; line-height: 1; padding: 4px 5px; border-radius: 2px; background: rgba(255,255,255,.94); border: 1px solid var(--rule); color: var(--muted); }
.badge.sent { border-color: var(--ok); color: var(--ok); }
.badge.error { border-color: var(--stamp); color: var(--stamp); font-weight: 700; }

.sendbar {
  position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 30;
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: center;
  padding: 10px 14px; background: var(--ink); color: #fff; border-radius: 6px; box-shadow: 0 8px 24px rgba(29,42,48,.25);
  max-width: calc(100vw - 32px);
}
.sendbar .btn { background: transparent; color: #fff; border-color: rgba(255,255,255,.4); }
.sendbar .btn.primary { background: #fff; color: var(--ink); border-color: #fff; }

.fab {
  position: fixed; right: max(18px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom)); z-index: 25;
  display: none; align-items: center; gap: 8px; padding: 14px 20px; border-radius: 999px; border: none;
  background: var(--pen); color: #fff; font-weight: 700; font-size: 16px; box-shadow: 0 6px 18px rgba(47,78,140,.35); cursor: pointer;
}
.fab svg { width: 22px; height: 22px; }

/* ---------- ダイアログ ---------- */
dialog { border: 1.5px solid var(--ink); border-radius: 6px; padding: 0; width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 32px); background: var(--sheet); color: var(--ink); }
dialog::backdrop { background: rgba(29, 42, 48, .45); }
.dlg-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--rule); }
.dlg-head h2 { margin: 0; font-size: 17px; }
.dlg-close { border: none; background: none; font-size: 24px; line-height: 1; cursor: pointer; color: var(--muted); padding: 4px 8px; }
.dlg-body { padding: 18px 20px 20px; overflow: auto; }

.lightbox { width: min(1100px, calc(100vw - 24px)); }
.lb-body { display: grid; grid-template-columns: minmax(0, 1fr) 300px; }
.lb-img { background: #1D2A30; display: grid; place-items: center; min-height: 300px; max-height: calc(100vh - 100px); position: relative; }
.lb-img img { max-width: 100%; max-height: calc(100vh - 100px); display: block; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); border: none; background: rgba(255,255,255,.85); width: 40px; height: 56px; cursor: pointer; font-size: 22px; }
.lb-nav.prev { left: 0; } .lb-nav.next { right: 0; }
.lb-side { padding: 16px; display: grid; gap: 12px; align-content: start; overflow: auto; max-height: calc(100vh - 100px); }
.lb-side .meta { font-size: 12px; color: var(--muted); }
.lb-side .status-line { font-size: 13px; }
.lb-side .err { color: var(--stamp); font-size: 12px; }

/* ---------- 設定 ---------- */
.settings-sec { margin-bottom: 24px; }
.settings-sec .state { margin-left: 8px; }
.help { font-size: 13px; color: var(--muted); max-width: 72ch; }
.help ol { padding-left: 1.4em; margin: 6px 0; }
.result { font-size: 13px; padding: 8px 12px; border-radius: var(--radius); margin-top: 10px; }
.result.ok { background: #E6F1EB; color: var(--ok); }
.result.ng { background: #F6E2E0; color: var(--stamp); }
.switch { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.switch input { width: 18px; height: 18px; accent-color: var(--pen); }

/* ---------- トースト ---------- */
.toast {
  position: fixed; left: 50%; top: 72px; transform: translate(-50%, -12px); z-index: 100;
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 6px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--stamp); }

.back-link { display: none; margin-bottom: 10px; font-size: 14px; text-decoration: none; }

/* ---------- スマホ・タブレット ---------- */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .rail { display: none; }
  main { padding: 16px 16px 110px; }
  .appbar { padding: 10px 16px; }
  .appbar .btn { padding: 6px 10px; }
  .back-link { display: inline-block; }
  .fab { display: inline-flex; }
  .titleblock { grid-template-columns: 1fr 1fr 76px; grid-template-areas: "name name stamp" "code kind stamp" "owner owner owner" "addr addr addr"; }
  .tb-upd { display: none; }
  .tb-owner { border-right: none !important; }
  .tb-stamp { border-bottom: 1px solid var(--ink) !important; }
  .tb-addr { border-right: none !important; }
  .tb-name .tb-value { font-size: 22px; }
  .stamp { width: 56px; height: 56px; font-size: 13px; }
  .sheet { padding: 16px 14px 22px; }
  .map-grid, .lb-body { grid-template-columns: 1fr; }
  .lb-img, .lb-img img { max-height: 60vh; }
  .lb-side { max-height: none; }
  .register thead { display: none; }
  .register, .register tbody, .register tr, .register td { display: block; }
  .register tr { padding: 10px 12px; border-bottom: 1px solid var(--rule-soft); }
  .register td { padding: 0; border: none; }
  .register td.hide-sm { display: none; }
  .photo-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px; }
  .checklist .ck-label { width: auto; }
  .checklist tr { display: grid; grid-template-columns: 1fr auto auto; align-items: center; border-bottom: 1px solid var(--rule-soft); padding: 4px 0; }
  .checklist td { border: none; padding: 4px; }
  .checklist .ck-note { grid-column: 1 / -1; grid-row: 2; }
  .mailer { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .toast { transition: none; }
}

@media print {
  .appbar, .rail, .tabs, .btn, .fab, .sendbar, .back-link, .no-print { display: none !important; }
  .layout { display: block; }
  main { padding: 0; }
  body { background: #fff; }
  .sheet { border: none; padding: 0; }
  .map-frame { break-inside: avoid; }
}

/* ---------- ログイン画面 ---------- */
.gate { display: grid; place-items: start center; padding: 48px 16px 80px; min-height: calc(100vh - 59px); }
.gate-card {
  width: min(400px, 100%); background: var(--sheet); border: 1.5px solid var(--ink);
  padding: 28px 24px 24px; display: grid; gap: 14px;
}
.gate-card h1 { font-family: var(--mincho); font-weight: 800; font-size: 28px; letter-spacing: .08em; margin: 0 0 4px; }
.gate-card .fields { grid-template-columns: 1fr; }
.gate-card .field input, .gate-card .field select { min-height: 48px; font-size: 17px; }
.gate-btn { min-height: 48px; font-size: 16px; margin-top: 4px; }

/* ---------- Box の保存先を選ぶ ---------- */
.crumbs { font-size: 14px; margin: 0 0 10px; }
.linklike { border: none; background: none; color: var(--pen); padding: 0; cursor: pointer; text-decoration: underline; }
.folder-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--rule); border-radius: var(--radius); max-height: 50vh; overflow: auto; }
.folder-list li + li { border-top: 1px solid var(--rule-soft); }
.folder-list button { display: block; width: 100%; text-align: left; padding: 10px 12px; border: none; background: #fff; cursor: pointer; }
.folder-list button:hover { background: var(--pen-soft); }
.folder-list .lead { padding: 10px 12px; margin: 0; }

.box-dest { margin: -4px 0 12px; word-break: break-all; }
