/* ゲンチョウPro v2 — ダッシュボードUI v2
   基盤 = maintenance.nextflow-app.com の実測トークン（2026-08-09 computed styleで採取）:
   sidebar #0b262c(252px) / primary #087f5b / bg #f4f7f6 / text #182b2f / heading #10333a
   card 白 border #dce5e3 radius14 二重ソフト影 / 状態ピル4色 / th=極小英大文字 #71827f
   モーション = ease-out 150-200ms・小さな移動のみ（emilkowalski/skills の原則） */

:root {
  --primary: #087f5b;
  --primary-deep: #06694b;
  --primary-soft: #dff7ed;
  --primary-soft-text: #087153;
  --info-soft: #e8f3f9;
  --info-text: #1e658b;
  --danger-soft: #fee9e7;
  --danger-text: #a43631;
  --neutral-soft: #edf1f0;
  --neutral-text: #657572;
  --warn: #b7791f;
  --warn-soft: #fdf3e3;
  --side-bg: #0b262c;
  --side-text: #bcd0cd;
  --side-text-dim: #779693;
  --side-active-bg: rgba(255, 255, 255, .08);
  --bg: #f4f7f6;
  --card: #ffffff;
  --text: #182b2f;
  --heading: #10333a;
  --muted: #71827f;
  --line: #dce5e3;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(8, 35, 38, .05), 0 4px 12px rgba(8, 35, 38, .04);
  --shadow-lift: 0 2px 4px rgba(8, 35, 38, .06), 0 8px 20px rgba(8, 35, 38, .07);
  --font: "Inter", "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.65; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: 14px; color: var(--text); }

/* モーション原則 */
.btn, .nav-item, .kpi, .role-card, .list-row, .type-card, .label-chip, .photo-cell, .bn-item, .side-user-btn {
  transition: background-color .15s ease-out, border-color .15s ease-out, color .15s ease-out,
              transform .18s ease-out, box-shadow .18s ease-out;
}
.btn:active, .role-card:active, .type-card:active { transform: scale(.985); }
input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-visible, .role-card:focus-visible,
.kpi:focus-visible, .list-row:focus-visible, .lg-demo-btn:focus-visible, .sheet-item:focus-visible {
  outline: 2px solid var(--primary); outline-offset: 1px;
}

/* ===== 入口: 左=ブランド（濃ティール全面）/ 右=ログイン白パネル
   実測トークン: bg #0b262c / ロゴ緑 #52dda9 14.7px ls2.5 / 見出し白64px 700 /
   説明 #aec3c0 / チップ枠 rgba(255,255,255,.13) 文字 #d6e3e1 / 右パネル白512px pad90px /
   input #c8d6d3 r9 / ログイン緑 #087f5b r10 全幅 / デモボタン白枠 #dce5e3 r8 11.5px ===== */
.role-gate { min-height: 100vh; display: flex; background: var(--side-bg); }
.lg-left { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: clamp(28px, 6vw, 84px); color: #d6e3e1; min-width: 0; }
.lg-brandrow { display: flex; align-items: center; gap: 10px; }
.lg-app-icon { width: 34px; height: 34px; border-radius: 9px; flex: none; }
.lg-brand { font-size: 15px; font-weight: 700; letter-spacing: .17em; color: #52dda9; }
.lg-brand span { color: #fff; }

/* 提供元 NEXT FLOW（実サイト実測: NEXT=#e8420a / FLOW=#0f172a・fw950・ls-0.04em。
   濃色地に置くため FLOW は白へ置換） */
.lg-provider {
  display: inline-flex; align-items: center; gap: 10px; margin-top: clamp(22px, 5vh, 44px);
  padding: 9px 14px; border-radius: 10px; text-decoration: none; width: fit-content;
  border: 1px solid rgba(255, 255, 255, .13); background: rgba(255, 255, 255, .04);
  transition: background-color .15s ease-out, border-color .15s ease-out, transform .18s ease-out;
}
.lg-provider:hover { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .24); transform: translateY(-1px); }
.lg-provider-label { font-size: 10.5px; font-weight: 700; letter-spacing: .14em; color: #94a4a1; }
.lg-nf-logo { font-size: 17px; font-weight: 900; letter-spacing: -.04em; line-height: 1; color: #fff; }
.lg-nf-logo .nf-next { color: #ff7a45; }
.lg-provider-arrow { font-size: 11px; color: #94a4a1; }
.lg-eyebrow { font-size: 11.5px; font-weight: 700; letter-spacing: .24em; color: #52dda9; margin: clamp(20px, 4vh, 48px) 0 14px; }
.lg-heading { font-size: clamp(30px, 4.6vw, 60px); font-weight: 700; line-height: 1.16; letter-spacing: -.02em; color: #fff; margin: 0 0 18px; }
.lg-desc { font-size: 15.5px; line-height: 1.65; color: #aec3c0; max-width: 34em; margin: 0 0 22px; }
.lg-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.lg-chip { font-size: 11.5px; font-weight: 600; padding: 6px 12px; border-radius: 20px; border: 1px solid rgba(255, 255, 255, .13); color: #d6e3e1; }
.lg-chip.is-demo { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); font-weight: 700; }

.lg-right { flex: none; width: min(500px, 100%); background: #fff; display: flex; align-items: center; }
.lg-panel { width: 100%; padding: clamp(28px, 5vw, 76px); }
.lg-panel-h { font-size: 25px; font-weight: 700; letter-spacing: -.03em; color: var(--text); margin: 0 0 4px; }
.lg-panel-sub { font-size: 13.5px; color: var(--muted); margin: 0 0 22px; }
.lg-panel .form-group label { color: var(--heading); font-weight: 700; font-size: 12.5px; letter-spacing: 0; }
.lg-panel .form-group input { border-color: #c8d6d3; border-radius: 9px; padding: 10px 12px; }
.lg-login-btn { width: 100%; padding: 11px 16px; font-size: 14px; }
.lg-demo-label { font-size: 11.5px; font-weight: 700; color: var(--muted); margin: 26px 0 8px; }
.lg-demo-hint { display: block; font-weight: 500; font-size: 11px; color: #94a4a1; margin-top: 2px; }
.lg-demo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.lg-demo-btn { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px 6px; font-size: 11.5px; font-weight: 600; color: var(--heading); text-align: center; line-height: 1.4; }
.lg-demo-btn:hover { border-color: var(--primary); color: var(--primary); }
.lg-demo-btn small { display: block; font-size: 9.5px; font-weight: 500; color: var(--muted); }
.lg-note { font-size: 10.5px; color: #94a4a1; margin-top: 18px; }
/* 運営者ログインの入口。文末の点。知らなければ気づかない程度に留める */
.lg-staff-dot { cursor: default; color: #cfd8d6; padding: 0 4px; user-select: none; }
.lg-staff-dot:hover { color: var(--muted); }
.lg-staff-dot:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 3px; }
.lg-staff-box { margin-top: 14px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #f8faf9; }
.lg-staff-h { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .06em; margin-bottom: 10px; }

@media (max-width: 860px) {
  .role-gate { flex-direction: column; }
  .lg-left { padding: 34px 22px 26px; justify-content: flex-start; }
  .lg-eyebrow { margin-top: 18px; }
  .lg-right { width: 100%; flex: 1; }
  .lg-demo-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ゲスト無効リンク等がroleGateへ差し込む旧マークアップ用の最低限 */
.role-gate-inner { margin: auto; padding: 40px 16px; width: 100%; max-width: 640px; color: #d6e3e1; }
.role-gate-inner .brand-logo { font-size: 26px; font-weight: 700; color: #fff; text-align: center; }
.role-gate-inner .brand-logo span { color: #52dda9; }

/* ===== アプリ骨格（濃色サイドバー基盤） ===== */
.topbar { display: none; }
.layout { display: flex; min-height: 100vh; }
.sidenav {
  width: 252px; flex: none; background: var(--side-bg); color: var(--side-text);
  display: flex; flex-direction: column; padding: 18px 14px;
  position: sticky; top: 0; height: 100vh;
}
.side-brand { font-size: 19px; font-weight: 700; letter-spacing: -.01em; color: #fff; padding: 4px 10px 16px; cursor: pointer; }
.side-brand span { color: #35c48f; }
.side-brand-sub { font-size: 10.5px; font-weight: 600; letter-spacing: .18em; color: var(--side-text-dim); margin-top: 2px; }
.side-nav-items { flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; text-align: left;
  padding: 10px 12px; border-radius: var(--radius-sm); color: var(--side-text); font-size: 13.5px; margin-bottom: 2px;
}
.nav-item:hover { background: rgba(255, 255, 255, .05); color: #fff; }
.nav-item.active { background: var(--side-active-bg); color: #fff; font-weight: 600; }
.nav-item .badge { margin-left: auto; }
.side-user { border-top: 1px solid rgba(255, 255, 255, .09); padding-top: 12px; }
.side-user-btn {
  width: 100%; text-align: left; background: none; border: 0; color: var(--side-text);
  font-size: 12px; line-height: 1.5; padding: 8px 10px; border-radius: var(--radius-sm);
}
.side-user-btn:hover { background: rgba(255, 255, 255, .05); color: #fff; }
.main { flex: 1; padding: 28px 32px 48px; max-width: 1080px; min-width: 0; }

.bottomnav { display: none; }
.role-chip { display: none; }

/* ===== 見出し（実測: 24.8px/700/字間タイト・説明はミュート） ===== */
.page-title { font-size: 22px; font-weight: 700; color: var(--heading); letter-spacing: -.02em; margin-bottom: 4px; }
.page-sub { color: var(--muted); font-size: 12.5px; margin-bottom: 18px; }

/* ===== カード（実測: 白・#dce5e3・radius14・二重ソフト影） ===== */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 14px; }
.card h3 { font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .08em; text-transform: none; margin-bottom: 12px; }

/* ===== ボタン（実測: 緑CTA #087f5b・radius10・緑ソフト影） ===== */
.btn { border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: var(--radius-sm); padding: 9px 16px; font-size: 13.5px; font-weight: 500; }
.btn:hover { background: #f8faf9; border-color: #c7d4d1; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; box-shadow: 0 6px 16px rgba(8, 127, 91, .16); }
.btn-primary:hover { background: var(--primary-deep); }
/* QA F-07: 無効時は primary の緑を残さない（45%不透明度でも色が残り「押せそう」に見えていた）。
   有効なボタンと明確に別物に見える中立色へ落とす。 */
.btn:disabled, .btn-primary:disabled, .btn-ok:disabled, .btn-warn:disabled {
  background: var(--neutral-soft); color: var(--muted); border-color: var(--line);
  opacity: 1; cursor: not-allowed; box-shadow: none;
}
.btn-ok { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.btn-ok:hover { background: var(--primary-deep); }
.btn-warn { background: #fff; border-color: #eecfcb; color: var(--danger-text); }
.btn-warn:hover { background: var(--danger-soft); }
.btn-ghost { background: none; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--neutral-soft); }
.btn-sm { padding: 5px 12px; font-size: 12.5px; }

.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 10px; background: #e5484d; color: #fff; }

/* 状態ピル（実測4色） */
.status-badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 20px; white-space: nowrap; }
.st-draft { background: var(--neutral-soft); color: var(--neutral-text); }
.st-submitted { background: var(--info-soft); color: var(--info-text); }
.st-returned { background: var(--danger-soft); color: var(--danger-text); }
.st-accepted { background: var(--primary-soft); color: var(--primary-soft-text); }

/* ===== KPIカード ===== */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; cursor: pointer; }
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); border-color: #c7d4d1; }
.kpi .kpi-num { font-size: 25px; font-weight: 700; color: var(--heading); line-height: 1.25; letter-spacing: -.02em; }
.kpi .kpi-label { font-size: 11.5px; font-weight: 600; color: var(--muted); margin-top: 2px; }
.kpi.k-warn .kpi-num { color: var(--danger-text); }
.kpi.k-ok .kpi-num { color: var(--primary); }
.kpi.k-accent .kpi-num { color: var(--info-text); }
.kpi .kpi-note { font-size: 11px; color: var(--danger-text); }

/* ===== リスト行 ===== */
.list-row { display: flex; align-items: center; gap: 10px; padding: 12px 6px; border-bottom: 1px solid #eef2f1; cursor: pointer; border-radius: 8px; }
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: #f8faf9; }
.list-main { flex: 1; min-width: 0; }
.list-title { font-weight: 600; color: var(--heading); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-meta { font-size: 12px; color: var(--muted); }
.empty-note { color: var(--muted); font-size: 13px; padding: 20px 4px; text-align: center; }

/* テーブル見出し（実測: 極小・太字・字間・ミュート） */
table th { font-size: 10.5px; font-weight: 700; letter-spacing: .04em; color: var(--muted); text-align: left; padding: 4px 6px; background: #f8faf9; }
table td { padding: 4px 6px; }

/* ===== フォーム ===== */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 11.5px; font-weight: 600; color: var(--muted); letter-spacing: .03em; margin-bottom: 5px; }
.form-group label .req { color: var(--danger-text); margin-left: 3px; }
.form-group input[type=text], .form-group input[type=email], .form-group input[type=password], .form-group input[type=number],
.form-group textarea, .form-group select {
  width: 100%; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 9px 12px; background: #fff;
}
.form-group textarea { min-height: 76px; resize: vertical; }

.type-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.type-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; text-align: left; box-shadow: var(--shadow); }
.type-card:hover { border-color: var(--primary); transform: translateY(-1px); box-shadow: var(--shadow-lift); }
.type-card .tc-name { font-weight: 700; color: var(--heading); }
.type-card .tc-labels { font-size: 11.5px; color: var(--muted); margin-top: 4px; }

/* ===== 写真ラベリング ===== */
.label-checklist { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.label-chip { font-size: 12px; font-weight: 500; padding: 4px 13px; border-radius: 20px; border: 1px solid var(--line); background: #fff; color: var(--muted); }
.label-chip.filled { background: var(--primary-soft); border-color: #bfe8d8; color: var(--primary-soft-text); }
.label-chip.missing { background: var(--danger-soft); border-color: #f3cdc8; color: var(--danger-text); }
.label-chip.selectable:hover { border-color: var(--primary); color: var(--primary); }
.label-chip.selected { background: var(--primary); border-color: var(--primary); color: #fff; }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 10px; }
.photo-cell { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: #fff; }
.photo-cell.unlabeled { border-color: #f3cdc8; }
.photo-thumb { height: 84px; background-size: cover; background-position: center; cursor: pointer; }
.photo-cell .pc-body { padding: 7px 9px; }
.photo-cell .pc-label { font-size: 11.5px; font-weight: 600; color: var(--heading); }
.photo-cell .pc-label.none { color: var(--danger-text); }
.photo-cell .pc-desc { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.photo-cell input, .photo-cell select { width: 100%; border: 1px solid var(--line); border-radius: 6px; font-size: 11.5px; padding: 3px 6px; margin-top: 4px; }
.photo-cell.sel { outline: 2px solid var(--primary); }
.photo-add { display: flex; align-items: center; justify-content: center; min-height: 130px; border: 1.5px dashed #c2cfcb; border-radius: var(--radius-sm); color: var(--muted); font-size: 12.5px; background: none; }
.photo-add:hover { border-color: var(--primary); color: var(--primary); }
.bulk-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; background: #f8faf9; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 9px 12px; margin: 10px 0; font-size: 12.5px; color: var(--muted); }

.warn-box { background: var(--danger-soft); border: 1px solid #f3cdc8; border-radius: var(--radius-sm); padding: 10px 13px; font-size: 12.5px; color: var(--danger-text); margin: 10px 0; }
.ok-box { background: var(--primary-soft); border: 1px solid #bfe8d8; border-radius: var(--radius-sm); padding: 10px 13px; font-size: 12.5px; color: var(--primary-soft-text); margin: 10px 0; }

/* ===== スレッド ===== */
.thread { margin-top: 4px; }
.thread-msg { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px dashed #e7edeb; }
.thread-msg:last-child { border-bottom: 0; }
.thread-avatar { flex: none; width: 32px; height: 32px; border-radius: 50%; background: var(--info-soft); color: var(--info-text); display: flex; align-items: center; justify-content: center; font-size: 12.5px; font-weight: 700; }
.thread-msg.mine .thread-avatar { background: var(--primary-soft); color: var(--primary-soft-text); }
.thread-who { font-size: 11.5px; color: var(--muted); }
.thread-text { font-size: 13px; }
.thread-input { display: flex; gap: 8px; margin-top: 10px; }
.thread-input input { flex: 1; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 9px 12px; }

.hist-item { display: flex; gap: 10px; font-size: 12.5px; padding: 5px 0; color: var(--muted); }
.hist-item .h-act { color: var(--text); }
.provider-note { font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.action-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; align-items: center; }

/* ===== モバイルのメニューシート ===== */
.sheet-modal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; }
.sheet-panel {
  position: relative; width: 100%; background: var(--card);
  border-radius: 18px 18px 0 0; padding: 10px 14px calc(16px + env(safe-area-inset-bottom));
  box-shadow: 0 -6px 24px rgba(8, 35, 38, .18);
  animation: sheetUp .2s ease-out;
}
@keyframes sheetUp { from { transform: translateY(14px); opacity: .6; } to { transform: none; opacity: 1; } }
.sheet-handle { width: 38px; height: 4px; border-radius: 2px; background: #d6dedc; margin: 2px auto 12px; }
.sheet-item { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; background: none; text-align: left; padding: 13px 10px; border-radius: var(--radius-sm); font-size: 14px; color: var(--text); }
.sheet-item:hover, .sheet-item:active { background: #f2f6f5; }
.sheet-item.active { background: var(--primary-soft); color: var(--primary-soft-text); font-weight: 600; }
.sheet-item .badge { margin-left: auto; }

/* ===== モーダル ===== */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(8, 30, 34, .55); }
.modal-body { position: relative; background: var(--card); border-radius: var(--radius); padding: 16px; max-width: 90vw; max-height: 86vh; overflow: auto; box-shadow: var(--shadow-lift); }
.photo-modal-img { width: min(640px, 80vw); height: min(420px, 50vh); background-size: contain; background-repeat: no-repeat; background-position: center; background-color: #f0f4f3; border-radius: var(--radius-sm); }
.photo-modal-cap { font-size: 13px; margin: 10px 0; }

/* ===== 見積: 現調入力（部屋カード・面ごとの単価選択）— v1移植 ===== */
.field-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 9px; }
.room-card .room-head { display: flex; align-items: center; gap: 8px; margin-bottom: 11px; }
.room-card .room-head input { flex: 1; font-weight: 700; font-size: 15px; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 7px 10px; }
.surface-row { display: grid; grid-template-columns: 116px 1fr 90px; gap: 8px; align-items: center; padding: 6px 0; border-top: 1px dashed #e7edeb; }
.surface-row .sur-name { font-size: 12.5px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.surface-row select, .surface-row input.qty { border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; font-size: 12.5px; min-width: 0; }
.surface-row .sur-qty { font-size: 12px; color: var(--primary); white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 700; text-align: right; }
.surface-row.off select { opacity: .4; pointer-events: none; }
.surface-row.off .sur-qty { opacity: .4; color: var(--muted); }
.surface-row.extra-row { grid-template-columns: 34px 1fr 90px; }

/* ===== 見積: 明細テーブル（原価/売価/実費/上書き）— v1移植 ===== */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
table.est { width: 100%; min-width: 720px; border-collapse: collapse; font-size: 12px; }
table.est td { padding: 6px 10px; border-bottom: 1px solid #eef2f1; vertical-align: middle; color: var(--text); }
table.est th { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; color: var(--muted); font-size: 10.5px; font-weight: 700; letter-spacing: .04em; background: #f8faf9; white-space: nowrap; }
table.est td.num, table.est th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.est td input { padding: 6px 8px; font-size: 12.5px; border: 1px solid var(--line); border-radius: 6px; }
table.est td input.qty { width: 78px; }
table.est td input.price { width: 94px; }
table.est td.sell { font-weight: 700; white-space: nowrap; }
table.est td.amount { font-weight: 700; }
table.est .src { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
table.est .overridden input { border-color: #e0a45a; background: var(--warn-soft); }
table.est .cell-del { white-space: nowrap; }
.reset-link { color: var(--warn); font-size: 10.5px; cursor: pointer; border: none; background: none; padding: 2px; font-weight: 700; }
.tag-internal { display: inline-block; background: var(--neutral-soft); border: 1px solid #d3dcd9; color: var(--muted); font-size: 9px; font-weight: 700; padding: 1px 6px; border-radius: 3px; letter-spacing: .04em; margin-right: 6px; vertical-align: middle; }
.totals-box { max-width: 420px; margin-left: auto; }
.totals-box .trow { display: flex; justify-content: space-between; align-items: center; padding: 7px 4px; font-size: 13px; }
.totals-box .trow.grand { border-top: 2px solid var(--heading); margin-top: 8px; padding-top: 11px; font-size: 18px; font-weight: 700; color: var(--heading); }
.totals-box .trow.grand span:last-child { color: var(--primary); }
.totals-box .trow.internal { color: var(--muted); }
.totals-box .inline-input { width: 108px; border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; font-size: 13px; }
.totals-box .amount { font-variant-numeric: tabular-nums; font-weight: 700; }
.print-actions { display: flex; gap: 10px; justify-content: center; margin: 12px 0; flex-wrap: wrap; }

/* ===== 帳票の紙面（見積書・請求書・報告書。印刷=PDF保存。白黒基調・明朝）— v1移植 ===== */
.sheet-wrap { background: #e4e9ee; padding: 18px 6px; border-radius: var(--radius); }
.sheet { background: #fff; width: 210mm; max-width: 100%; min-height: 250mm; margin: 0 auto; padding: 16mm 14mm; box-shadow: 0 8px 26px rgba(8,35,38,.18); color: #111; font-size: 12.5px; font-family: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", "Noto Sans JP", serif; border: 0; border-radius: 0; }
.sheet h1.doc-title { text-align: center; font-size: 26px; letter-spacing: .5em; margin: 0 0 18px; padding-left: .5em; font-weight: 700; color: #111; }
.sheet .doc-head { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 14px; }
.sheet .to .client { font-size: 17px; font-weight: 700; border-bottom: 2px solid #111; padding: 0 24px 4px 2px; margin-bottom: 6px; }
.sheet .from { text-align: left; font-size: 12px; line-height: 1.6; }
.sheet .from .co { font-size: 14px; font-weight: 700; }
.sheet .grand-box { display: flex; align-items: baseline; gap: 14px; border: 2px solid #111; padding: 8px 16px; margin: 12px 0 16px; width: fit-content; }
.sheet .grand-box .lbl { font-size: 13px; font-weight: 700; }
.sheet .grand-box .val { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; }
.sheet table.lines { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
.sheet table.lines th, .sheet table.lines td { border: 1px solid #333; padding: 5px 7px; font-size: 12px; color: #111; background: none; letter-spacing: 0; text-transform: none; }
.sheet table.lines th { background: #eef0f4; font-weight: 700; }
.sheet table.lines td.num { text-align: right; font-variant-numeric: tabular-nums; }
.sheet .sheet-totals { width: 260px; margin-left: auto; }
.sheet .sheet-totals .trow { display: flex; justify-content: space-between; padding: 3px 6px; font-size: 12.5px; }
.sheet .sheet-totals .trow.grand { border-top: 1.5px solid #111; font-weight: 800; font-size: 14px; padding-top: 6px; }
.sheet .notes { margin-top: 16px; font-size: 11.5px; color: #333; white-space: pre-wrap; }
.sheet .notes .h { font-weight: 700; margin-bottom: 2px; }
/* 報告書（既存）: 同じ .sheet 内で使う簡易ヘッダ */
.sheet h2 { font-size: 18px; letter-spacing: .1em; text-align: center; margin-bottom: 14px; font-weight: 600; color: #222; }
.sheet table.meta { width: 100%; border-collapse: collapse; margin-bottom: 14px; font-size: 12.5px; }
.sheet table.meta th, .sheet table.meta td { border: 1px solid #999; padding: 5px 8px; text-align: left; background: none; color: #222; font-size: 12.5px; letter-spacing: 0; }
.sheet table.meta th { background: #f2f3f5; width: 120px; font-weight: 600; }
.sheet .sheet-photos { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sheet .sp-cell { border: 1px solid #bbb; }
.sheet .sp-img { height: 150px; background-size: cover; background-position: center; }
.sheet .sp-cap { font-size: 11.5px; padding: 4px 8px; border-top: 1px solid #bbb; }
.sheet .sp-cap b { font-weight: 600; }

@media print {
  body { background: #fff; }
  .topbar, .sidenav, .bottomnav, .action-bar, .no-print, .page-title, .page-sub, #bridgeBar { display: none !important; }
  .main { padding: 0; max-width: none; }
  .sheet-wrap { background: none; padding: 0; }
  .sheet { border: 0; padding: 0; max-width: none; box-shadow: none; width: auto; min-height: 0; }
  @page { margin: 14mm 12mm; }
}

@media (max-width: 860px) {
  .field-grid-3 { grid-template-columns: 1fr; }
  .surface-row { grid-template-columns: 1fr; gap: 4px; }
  .surface-row .sur-qty { text-align: left; }
  .sheet { padding: 10mm 6mm; }
  .sheet .doc-head { flex-direction: column; }
}

/* ===== モバイル（サイドバー→下部ナビ・上部に細いブランドバー） ===== */
@media (max-width: 860px) {
  .topbar { display: flex; position: sticky; top: 0; z-index: 30; height: 50px; background: var(--side-bg); color: #fff; align-items: center; justify-content: space-between; padding: 0 16px; }
  .topbar-brand { font-size: 16px; font-weight: 700; color: #fff; cursor: pointer; }
  .topbar-brand span { color: #35c48f; }
  .role-chip { display: inline-block; background: rgba(255, 255, 255, .1); color: #e8f0ee; border: 0; border-radius: 20px; padding: 5px 12px; font-size: 11.5px; max-width: 60vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .sidenav { display: none; }
  .main { padding: 16px 14px 84px; }
  .bottomnav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; background: var(--card); border-top: 1px solid var(--line); padding: 4px 2px calc(4px + env(safe-area-inset-bottom)); box-shadow: 0 -2px 12px rgba(8, 35, 38, .06); }
  .bn-item { flex: 1; border: 0; background: none; padding: 7px 2px; font-size: 10.5px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 1px; position: relative; }
  .bn-item.active { color: var(--primary); font-weight: 600; }
  .bn-item .bn-ic { font-size: 16px; line-height: 1; }
  .bn-item .badge { position: absolute; top: 0; right: 18%; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .sheet { padding: 14px; }
  .sheet .sheet-photos { grid-template-columns: 1fr; }
  .page-title { font-size: 19px; }
}
