/* estimate.css ― 見積原価計算(サンプル製作所)の画面。業務システム風: ヘッダ／サイドナビ／コンテンツの3領域、PC前提。
   .est の CSS 変数を差し替えると配色が変わる(右下の ANDY の「ダークテーマにして」は .est-dark を付ける) */
.est {
  --e-bg: #eef1f5; --e-panel: #fff; --e-line: #cfd6e0; --e-line2: #e3e8ef; --e-text: #1b2430; --e-muted: #5b6672;
  --e-head-bg: #1f3a5f; --e-head-text: #fff; --e-nav-bg: #f7f9fb; --e-nav-hover: #eceff4;
  --e-accent: #1f5fbf; --e-accent-dark: #174a97; --e-accent-bg: #e6eefb;
  --e-ok: #1a7f37; --e-ok-bg: #e3f5e9; --e-ng: #c0392b; --e-ng-bg: #fbe4e1; --e-warn: #9a6700; --e-warn-bg: #fff3c4;
  --e-calc-bg: #f3f6fa; --e-th-bg: #edf1f6; --e-input: #fff; --e-sub-bg: #f7f9fc; --e-ddp: #ffb257;
  display: flex; flex-direction: column; height: 100%; min-height: 100%; min-width: 1120px; font-size: 14px; line-height: 1.5; color: var(--e-text); background: var(--e-bg); font-family: var(--font-ui);
}
.est.est-dark {
  --e-bg: #15191f; --e-panel: #1e242c; --e-line: #3a4350; --e-line2: #2b323b; --e-text: #e6e9ee; --e-muted: #9aa5b1;
  --e-head-bg: #0f1a2b; --e-nav-bg: #1a2029; --e-nav-hover: #242c36; --e-accent-bg: #223450; --e-ok-bg: #173826; --e-ng-bg: #4a1f1b; --e-warn-bg: #4a3a0f; --e-warn: #ffd866; --e-ok: #6fd48d; --e-ng: #ff8a7a;
  --e-calc-bg: #232b35; --e-th-bg: #262e38; --e-input: #121619; --e-sub-bg: #222a33;
}
.est * { box-sizing: border-box; }
.est h2 { font-size: 18px; margin: 0; }
.est .muted { color: var(--e-muted); }
.est .ng { color: var(--e-ng); } .est .ok { color: var(--e-ok); }
.est .spacer { flex: 1; }
.est code { font-family: var(--font-mono); background: var(--e-th-bg); padding: 0 4px; border-radius: 3px; font-size: 13px; }
/* ---- 3領域 ---- */
.est-top { height: 48px; flex: none; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 16px; background: var(--e-head-bg); color: var(--e-head-text); }
.est-top .hd-left { display: flex; align-items: center; gap: 18px; }
.est-top .brand { font-weight: bold; font-size: 16px; color: #fff; letter-spacing: 0.02em; }
.est-top .hd-nav { color: #fff; font-size: 13px; padding: 4px 8px; border-radius: 4px; background: rgba(255,255,255,0.12); }
.est-top .hd-mid { flex: 1; display: flex; align-items: center; gap: 18px; min-width: 0; }
.est-top .hd-case { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 420px; }
.est-top .hd-case .muted { color: #b9c6d8; font-size: 12px; }
.est-top .hd-ddp { white-space: nowrap; font-size: 13px; color: #d5e0f0; }
.est-top .hd-ddp b { color: #fff; font-size: 15px; }
.est-top .hd-ddp b.big { color: var(--e-ddp); font-size: 24px; font-weight: bold; }
.est-top .hd-right { display: flex; align-items: center; gap: 8px; }
.est-top button { background: rgba(255,255,255,0.1); color: #fff; border: 1px solid rgba(255,255,255,0.3); border-radius: 4px; padding: 5px 12px; font-size: 14px; }
.est-top button:hover { background: rgba(255,255,255,0.2); }
.est-top button.primary { background: #fff; color: var(--e-head-bg); border-color: #fff; font-weight: bold; }
.est-top .save-state { font-size: 13px; padding: 2px 10px; border-radius: 10px; background: rgba(255,255,255,0.12); white-space: nowrap; color: #c7f0d2; }
.est-layout { display: grid; grid-template-columns: 232px minmax(0, 1fr); flex: 1; min-height: 0; }
.est-nav { background: var(--e-nav-bg); border-right: 1px solid var(--e-line); padding: 10px 0; overflow-y: auto; display: flex; flex-direction: column; }
.est .nav-title { font-size: 12px; color: var(--e-muted); padding: 4px 16px 6px; letter-spacing: 0.08em; }
.est .nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 14px; color: var(--e-text); text-decoration: none; border-left: 4px solid transparent; }
.est .nav-item:hover { background: var(--e-nav-hover); }
.est .nav-item.cur { background: var(--e-panel); border-left-color: var(--e-accent); font-weight: bold; }
.est .nav-item.done .nav-n { background: var(--e-ok); color: #fff; border-color: var(--e-ok); }
.est .nav-n { width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--e-line); background: var(--e-panel); display: inline-flex; align-items: center; justify-content: center; font-size: 13px; flex: none; }
.est .nav-body { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.est .nav-label { font-size: 14px; }
.est .nav-desc { font-size: 11px; color: var(--e-muted); font-weight: normal; }
.est .nav-badges { display: flex; flex-direction: column; gap: 2px; align-items: flex-end; }
.est .nav-foot { margin-top: auto; padding: 12px 16px; font-size: 12px; border-top: 1px solid var(--e-line2); }
.est .nav-ok { color: var(--e-ok); }
.est .nav-link { color: var(--e-ng); font-weight: bold; }
.est .nav-home { border-top: 1px solid var(--e-line2); color: var(--e-muted); }
.est-content { overflow: auto; padding: 16px 20px 110px; min-width: 0; }
.est .page-head { margin-bottom: 12px; }
.est .lead { margin: 4px 0 0; color: var(--e-muted); font-size: 13px; }
/* ---- パネル ---- */
.est .panel { background: var(--e-panel); border: 1px solid var(--e-line); border-radius: 6px; padding: 12px 16px 14px; margin-bottom: 14px; }
.est .panel-title { font-size: 14px; margin: 0 0 10px; color: var(--e-text); display: flex; align-items: center; gap: 6px; border-bottom: 1px solid var(--e-line2); padding-bottom: 6px; }
.est .panel-right { margin-left: auto; font-weight: normal; font-size: 12px; color: var(--e-muted); }
.est .warn-panel { border-color: #e9c46a; background: var(--e-warn-bg); }
.est .cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.est .cols2 > .panel { margin-bottom: 0; }
.est .cols2 + .panel, .est .cols2 + details { margin-top: 14px; }
.est .note { color: var(--e-muted); font-size: 12px; margin: 0 0 8px; }
.est .toolbar { display: flex; gap: 8px; align-items: center; margin: 0 0 10px; flex-wrap: wrap; }
.est .tb-label { display: inline-flex; align-items: center; gap: 6px; color: var(--e-muted); font-size: 13px; }
.est .kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; align-items: center; }
.est .kv2 { grid-template-columns: max-content 1fr max-content 1fr; }
.est .kv > label { color: var(--e-text); white-space: nowrap; font-size: 13px; }
.est .kv-v { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-height: 28px; }
.est .req-mark { color: var(--e-ng); margin-left: 2px; font-weight: bold; }
.est .field-msg { font-size: 12px; margin: 6px 0 0; }
.est details.adv > summary { cursor: pointer; color: var(--e-muted); padding: 6px 0; }
.est details.adv .panel { margin-top: 8px; }
/* ---- ボタン・入力 ---- */
.est-content button { font: inherit; font-size: 14px; padding: 5px 12px; border: 1px solid var(--e-line); background: var(--e-panel); border-radius: 4px; cursor: pointer; color: var(--e-text); line-height: 1.3; }
.est-content button:hover { background: var(--e-th-bg); }
.est-content button.primary { background: var(--e-accent); color: #fff; border-color: var(--e-accent); }
.est-content button.primary:hover { background: var(--e-accent-dark); }
.est-content button.danger { color: var(--e-ng); }
.est-content button.small { padding: 2px 8px; font-size: 13px; }
.est-content button.icon { padding: 2px 6px; min-width: 26px; }
.est input, .est select, .est textarea { font: inherit; font-size: 14px; padding: 4px 6px; border: 1px solid var(--e-line); border-radius: 3px; background: var(--e-input); color: var(--e-text); height: 28px; }
.est textarea { height: auto; width: 100%; }
.est input.num { text-align: right; font-variant-numeric: tabular-nums; }
.est input.txt { width: 160px; max-width: 100%; }
.est input.wide, .est textarea.wide { width: 100%; }
.est .w7 { width: 7.5em !important; } .est .w8 { width: 8.5em !important; } .est .w18 { width: 18em !important; } .est .w24 { width: 24em !important; }
.est .missing, .est .combo .combo-in.missing { border-color: var(--e-ng) !important; box-shadow: inset 0 0 0 1px var(--e-ng); }
.est .issue, .est .combo .combo-in.issue, .est input.issue { border-color: var(--e-ng) !important; background: var(--e-ng-bg) !important; }
.est td.issue { color: var(--e-ng); font-weight: bold; }
.est .auto-field { display: inline-flex; align-items: center; gap: 4px 6px; flex-wrap: wrap; }
.est .auto-val { display: inline-block; text-align: right; padding: 4px 6px; border: 1px dashed var(--e-line); border-radius: 3px; background: var(--e-calc-bg); color: var(--e-text); min-width: 5em; height: 28px; line-height: 18px; font-variant-numeric: tabular-nums; }
.est .auto-src { color: var(--e-muted); font-size: 10px; white-space: nowrap; line-height: 1.1; }
.est .auto-link { font-size: 12px; white-space: nowrap; color: var(--e-accent); }
.est .combo { display: inline-flex; align-items: stretch; position: relative; }
.est .combo .combo-in { border-radius: 3px 0 0 3px; }
.est .combo-tog { border: 1px solid var(--e-line); border-left: none; border-radius: 0 3px 3px 0; background: var(--e-th-bg); padding: 0 6px; cursor: pointer; font-size: 11px; display: inline-flex; align-items: center; }
.est .badge { display: inline-block; padding: 0 7px; border-radius: 10px; font-size: 11px; background: var(--e-th-bg); color: var(--e-text); line-height: 18px; white-space: nowrap; }
.est .badge.ok { background: var(--e-ok-bg); color: var(--e-ok); }
.est .badge.ng { background: var(--e-ng-bg); color: var(--e-ng); }
.est .badge.warn { background: var(--e-warn-bg); color: var(--e-warn); }
.est .status { display: inline-block; padding: 1px 8px; border-radius: 3px; font-size: 12px; background: var(--e-th-bg); }
/* ---- 表 ---- */
.est .wrap { overflow: auto; }
.est table.grid { border-collapse: collapse; width: 100%; background: var(--e-panel); font-size: 13px; min-width: 0; }
.est table.grid th, .est table.grid td { border: 1px solid var(--e-line2); padding: 3px 6px; vertical-align: middle; white-space: nowrap; }
.est table.grid th { background: var(--e-th-bg); font-weight: normal; color: var(--e-text); text-align: center; font-size: 12px; }
.est table.grid td.n, .est table.grid th.n { text-align: right; font-variant-numeric: tabular-nums; }
.est table.grid td.c { text-align: center; }
.est table.grid td.calc { background: var(--e-calc-bg); }
.est table.grid tfoot td, .est table.grid tr.sub td { font-weight: bold; background: var(--e-sub-bg); }
.est table.cost tr.ddp td { font-size: 16px; font-weight: bold; background: var(--e-accent-bg); }
.est .diff0 { color: var(--e-ok); }
.est table.proc th:first-child, .est table.proc td:first-child { position: sticky; left: 0; background: var(--e-panel); z-index: 1; }
.est table.proc input, .est table.proc select { height: 26px; }
.est table.coef td:first-child { white-space: normal; }
.est .caselist a { color: var(--e-accent); }
.est .caselist tr.flash td { background: var(--e-ok-bg); }
.est .row-ops { display: inline-flex; gap: 4px; }
.est .md-layout { display: grid; grid-template-columns: 500px minmax(0, 1fr); gap: 14px; align-items: start; }
.est .md-list { padding: 10px 10px 12px; position: sticky; top: 0; }
.est table.list { font-size: 13px; }
.est table.list th, .est table.list td { padding: 3px 5px; }
.est .list-wrap { max-height: calc(100vh - 300px); overflow: auto; border: 1px solid var(--e-line2); }
.est table.sticky thead th { position: sticky; top: 0; z-index: 3; background: var(--e-th-bg); box-shadow: inset 0 -1px 0 var(--e-line2); }
.est table.sticky tfoot td { position: sticky; bottom: 0; z-index: 3; background: var(--e-sub-bg); box-shadow: inset 0 1px 0 var(--e-line2); }
.est table.list tr.sel-row { cursor: pointer; }
.est table.list tr.sel-row:hover td { background: var(--e-th-bg); }
.est table.list tr.sel-row.cur td { background: var(--e-accent-bg); font-weight: bold; }
.est table.list td:nth-child(2) { max-width: 10em; overflow: hidden; text-overflow: ellipsis; }
.est .md-detail { min-width: 0; }
.est .result-strip { display: flex; gap: 10px; margin: 0 0 14px; flex-wrap: wrap; }
.est .stat { background: var(--e-panel); border: 1px solid var(--e-line2); border-radius: 6px; padding: 10px 16px; display: flex; flex-direction: column; min-width: 180px; }
.est .stat-l { font-size: 11px; color: var(--e-muted); }
.est .stat-v { font-size: 20px; font-weight: bold; font-variant-numeric: tabular-nums; text-align: right; }
.est .stat-v.ddp { color: var(--e-accent-dark); font-size: 26px; }
.est.est-dark .stat-v.ddp { color: #8fb5f0; }
.est .stat-v.ddp.big { color: var(--e-ddp); font-size: 32px; }
.est .issues { margin: 0; padding-left: 20px; }
.est .issues li { margin: 3px 0; }
.est .issues a { color: var(--e-text); }
.est .checks { list-style: none; padding: 0; margin: 0 0 12px; }
.est .checks li { padding: 3px 0; }
.est .checks li.ok { color: var(--e-ok); }
.est .checks li.ng { color: var(--e-ng); font-weight: bold; }
.est ol.steps { padding-left: 20px; margin: 6px 0; }
.est ol.steps li { margin: 4px 0; }
/* ---- 提出用シート(A4縦) ---- */
.est .sheet-wrap { margin-top: 10px; }
.est .sheet { width: 210mm; max-width: 100%; min-height: 200mm; margin: 0 auto; background: #fff; padding: 14mm 14mm; border: 1px solid var(--e-line); box-shadow: 0 2px 10px rgba(0,0,0,0.08); color: #000; font-size: 11px; }
.est .sheet h1 { text-align: center; font-size: 20px; letter-spacing: 0.3em; margin: 0 0 2px; }
.est .sheet .lvl { text-align: center; font-size: 11px; margin-bottom: 10px; }
.est .sheet .hdr { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.est .sheet .hdr .to { font-size: 13px; }
.est .sheet .hdr .to b { font-size: 14px; }
.est .sheet table { border-collapse: collapse; font-size: 11px; }
.est .sheet table th, .est .sheet table td { border: 1px solid #888; padding: 2px 6px; }
.est .sheet table th { background: #d9e1f2; font-weight: bold; text-align: center; }
.est .sheet .meta th { background: #f2f2f2; }
.est .sheet .cols { display: flex; gap: 10mm; margin-top: 8px; align-items: flex-start; }
.est .sheet .cols > div { flex: 1; }
.est .sheet .cols h4 { margin: 0 0 4px; font-size: 12px; }
.est .sheet td.n { text-align: right; font-variant-numeric: tabular-nums; }
.est .sheet td.c { text-align: center; }
.est .sheet tr.sub td { background: #f2f2f2; font-weight: bold; }
.est .sheet tr.ddp td { background: #d9e1f2; font-weight: bold; font-size: 13px; border-top: 2px solid #000; border-bottom: 2px solid #000; }
.est .sheet .foot { font-size: 10px; margin-top: 10px; color: #333; }
/* 2026-11-15: ①案件情報 の右カードが 1366px で画面外に切れていた → 列を縮められるようにし、狭いときは1列に */
.est .cols2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.est .cols2 > .panel { min-width: 0; }
.est .kv2 { grid-template-columns: max-content minmax(0, 1fr) max-content minmax(0, 1fr); }
.est .kv-v { min-width: 0; }
.est .kv-v input.txt { width: 100%; max-width: 160px; min-width: 0; }
@media (max-width: 1280px) { .est .cols2 { grid-template-columns: minmax(0, 1fr); } }
body.andy-open .est .cols2 { grid-template-columns: minmax(0, 1fr); }
