/* ===== 現場利益シミュレーター v2 ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --nav: #ffffff; --nav2: #f2f5f9; --accent: #2563eb; --accent-d: #1d4ed8;
  --profit: #15803d; --cost: #dc2626; --amber: #b45309;
  --bg: #f5f6f8; --card: #fff; --line: #e5e8ee; --ink: #101828; --sub: #667085;
  --radius: 16px;
}
html { -webkit-text-size-adjust: 100%; }   /* iPhoneが勝手に文字を拡大して崩れるのを防ぐ */
body { font-family: "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", "Segoe UI", sans-serif; background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; overflow-x: hidden; }

/* 現場かんたんモードでは、時間・行程表・売上入力など詳細を隠す */
body.mode-site .full-only { display: none !important; }

/* レイアウト：左ナビ＋メイン */
.app { display: flex; min-height: 100vh; }
.nav {
  width: 188px; background: var(--nav); border-right: 1px solid var(--line); flex: none;
  display: flex; flex-direction: column; padding: 18px 12px; gap: 2px;
  position: sticky; top: 0; height: 100vh;
}
.nav .logo { display: flex; align-items: center; gap: 9px; padding: 2px 8px 16px; }
.nav .logo svg { width: 30px; height: 30px; flex: none; }
.nav .logo .logo-t { font-size: 0.95rem; font-weight: 800; color: var(--ink); letter-spacing: .02em; line-height: 1.2; }
.nav .logo .logo-t small { display: block; font-size: 0.58rem; font-weight: 700; color: #98a2b3; letter-spacing: .14em; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 9px;
  color: #46536b; text-decoration: none; font-size: 0.82rem; font-weight: 600; cursor: pointer;
  transition: background .12s, color .12s;
}
.nav a .ico { display: flex; flex: none; }
.nav a .ico svg { width: 19px; height: 19px; }
.nav a .lbl { line-height: 1; }
.nav a.active { background: #e9f0fe; color: var(--accent-d); }
.nav a:hover:not(.active) { background: var(--nav2); color: var(--ink); }
.nav a.locked { opacity: 0.45; }

.main { flex: 1; max-width: 860px; margin: 0 auto; padding: 20px 18px 60px; width: 100%; }
.head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.head h1 { font-size: 1.4rem; font-weight: 800; letter-spacing: -.01em; }
.head .tag { font-size: 0.7rem; background: #dbe8fd; color: var(--accent-d); padding: 2px 8px; border-radius: 6px; }
.head-sub { color: var(--sub); font-size: 0.85rem; margin-bottom: 18px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; box-shadow: 0 1px 2px rgba(16,24,40,.04), 0 4px 16px rgba(16,24,40,.04); }
.card h2 { font-size: 1rem; margin-bottom: 12px; display: flex; align-items: center; gap: 6px; }
.card h2 .n { background: var(--accent); color: #fff; width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 0.8rem; flex: none; }

label { display: block; font-size: 0.8rem; font-weight: 600; margin: 10px 0 4px; color: #334155; }
input, select, textarea { width: 100%; padding: 11px 12px; border: 1px solid #d1d5db; border-radius: 10px; font-size: 1rem; background: #fff; color: var(--ink); transition: border-color .12s, box-shadow .12s; font-family: inherit; }
textarea { line-height: 1.7; resize: vertical; }
textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
/* iPhoneで時刻入力が「枠なしの素の文字」になるのを防ぐ */
input[type="time"] { -webkit-appearance: none; appearance: none; min-height: 46px; }
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
.row { display: flex; gap: 10px; } .row > div { flex: 1; }
.hint { font-size: 0.76rem; color: var(--sub); margin-top: 4px; line-height: 1.5; }

/* 地点入力 */
.stop { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.stop .badge { width: 26px; height: 26px; border-radius: 50%; background: #e2e8f0; color: #475569; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.8rem; flex: none; }
.stop input.addr { flex: 1; }
.stop input.stay { width: 96px; flex: none; }
.stop input.stay::placeholder { font-size: 0.74rem; }
.stop .del { background: #fee2e2; color: #b91c1c; border: none; border-radius: 8px; width: 34px; height: 40px; font-size: 1.1rem; cursor: pointer; flex: none; }
.stop:first-child .stay, .stop:first-child .del { visibility: hidden; }

.btn { border: none; border-radius: 10px; font-size: 1rem; font-weight: 600; cursor: pointer; padding: 12px; }
.btn-add { background: #edf3fe; color: var(--accent-d); padding: 9px 14px; font-size: 0.88rem; transition: background .12s; }
.btn-add:hover { background: #dbe8fd; }
.btn-go { width: 100%; background: var(--accent); color: #fff; padding: 15px; font-size: 1.05rem; margin-top: 6px; box-shadow: 0 2px 10px rgba(37,99,235,.28); transition: background .12s, box-shadow .12s, transform .05s; }
.btn-go:hover { background: var(--accent-d); }
.btn-go:active { transform: translateY(1px); }
.btn-go:disabled { background: #9ca3af; box-shadow: none; }
.err { background: #fef2f2; color: #b91c1c; border-radius: 9px; padding: 11px; font-size: 0.85rem; margin-top: 10px; display: none; line-height: 1.6; }

/* 結果：利益ヒーロー */
#result { display: none; }
.profit-hero {
  background: linear-gradient(135deg, #065f46, #16a34a); color: #fff;
  border-radius: 16px; padding: 22px; text-align: center; margin-bottom: 16px;
}
.profit-hero.loss { background: linear-gradient(135deg, #7f1d1d, #dc2626); }
.profit-hero .lbl { font-size: 0.85rem; opacity: 0.9; }
.profit-hero .amt { font-size: 2.6rem; font-weight: 800; line-height: 1.2; }
.profit-hero .rate { font-size: 1.1rem; font-weight: 700; opacity: 0.98; margin-top: 4px; }

/* コスト内訳（ウォーターフォール） */
.wf { background: var(--card); border-radius: 14px; padding: 16px; margin-bottom: 16px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.wf-row { display: flex; align-items: center; padding: 9px 0; border-bottom: 1px solid #f1f5f9; font-size: 0.95rem; }
.wf-row:last-child { border-bottom: none; }
.wf-row .ic { width: 26px; flex: none; }
.wf-row .nm { flex: 1; }
.wf-row .vl { font-weight: 700; font-variant-numeric: tabular-nums; }
.wf-row.rev .vl { color: var(--profit); }
.wf-row.cost .vl { color: var(--cost); }
.wf-row.cost .vl::before { content: "−"; }
.wf-row.total { border-top: 2px solid #cbd5e1; margin-top: 4px; padding-top: 12px; font-weight: 700; }
.wf-row.total .vl { font-size: 1.2rem; }
.wf-row .sub { font-size: 0.72rem; color: var(--sub); font-weight: 400; margin-left: 6px; }
.wf-row.missing .nm { color: #94a3b8; }
.wf-row.missing .set { font-size: 0.72rem; color: var(--accent); cursor: pointer; margin-left: auto; text-decoration: underline; }

/* サマリー小カード */
.mini { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; margin-bottom: 16px; }
.mini > div { background: var(--card); border-radius: 12px; padding: 12px; text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.mini .num { font-size: 1.2rem; font-weight: 700; color: #1e3a8a; }
.mini .lbl { font-size: 0.72rem; color: var(--sub); margin-top: 2px; }

/* いくらで見積もる？（価格提案） */
.price-card { background: linear-gradient(135deg,#1e3a8a,#2563eb); color: #fff; text-align: center; border: none; }
.price-card .pc-lbl { font-size: .85rem; opacity: .92; }
.price-card .pc-amt { font-size: 2rem; font-weight: 800; line-height: 1.2; }
.price-card .pc-amt span { font-size: 1rem; font-weight: 600; opacity: .9; }
.price-card .pc-sub { font-size: .8rem; opacity: .92; margin-top: 3px; }

/* 期限逆算 */
.deadline { border-radius: 11px; padding: 12px 14px; margin-bottom: 16px; font-size: 0.9rem; line-height: 1.7; }
.deadline b { font-size: 1.15rem; }
.deadline.ok { background: #ecfdf5; border: 1px solid #86efac; color: #166534; }
.deadline.ng { background: #fef2f2; border: 1px solid #fca5a5; color: #b91c1c; font-weight: 600; }

/* 行程表 */
.itin-stop { display: flex; align-items: center; gap: 10px; background: #f8fafc; border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; }
.itin-time { font-weight: 700; color: #1d4ed8; min-width: 52px; flex: none; }
.itin-mark { width: 24px; height: 24px; border-radius: 50%; color: #fff; font-size: 0.66rem; font-weight: 700; flex: none; display: flex; align-items: center; justify-content: center; }
.itin-mark.s { background: var(--accent); } .itin-mark.g { background: var(--cost); }
.itin-name { font-weight: 600; }
.itin-stay { margin-left: auto; font-size: 0.75rem; color: var(--amber); background: #fef3c7; border-radius: 6px; padding: 2px 8px; white-space: nowrap; }
.itin-leg { border-left: 3px solid #cbd5e1; margin-left: 23px; padding: 8px 0 8px 14px; font-size: 0.84rem; color: #475569; }
.itin-ic { margin-top: 4px; font-weight: 600; color: var(--ink); }
.icb { display: inline-block; background: var(--profit); color: #fff; border-radius: 4px; padding: 1px 7px; font-size: 0.7rem; margin-right: 6px; }
.icb-out { background: #0d9488; }
.itin-jct { font-size: 0.76rem; color: var(--sub); margin-top: 3px; }
#map { height: 300px; border-radius: 12px; margin-top: 14px; }

/* 設定パネル（車両・人件費・処分場） */
.panel { display: none; }
.panel.show { display: block; }
.view.hide { display: none; }
.calc-out { background: #edf3fe; border: 1px solid #dbe8fd; border-radius: 12px; padding: 16px; margin-top: 12px; text-align: center; }
.calc-out .big { font-size: 1.7rem; font-weight: 800; color: var(--accent-d); letter-spacing: -.01em; }
.calc-out .lbl { font-size: 0.78rem; color: var(--sub); }
.saved-note { font-size: 0.8rem; color: var(--profit); margin-left: 8px; }

/* 🔒 有料ゲート */
.gate { position: fixed; inset: 0; background: rgba(15,23,42,.55); z-index: 100; display: none; align-items: center; justify-content: center; padding: 20px; }
.gate.show { display: flex; }
.gate .box { background: #fff; border-radius: 14px; max-width: 440px; width: 100%; padding: 26px; }
.gate h3 { margin-bottom: 12px; }
.gate ul { margin: 10px 0 16px 18px; font-size: 0.9rem; line-height: 1.9; }
.gate .now { background: #f1f5f9; border-radius: 8px; padding: 10px; font-size: 0.85rem; margin-bottom: 14px; }

.chip { display: inline-flex; align-items: center; gap: 6px; background: #edf3fe; border-radius: 8px; padding: 6px 10px; margin: 4px 4px 0 0; font-size: 0.85rem; cursor: pointer; }
.chip .x { color: #b91c1c; cursor: pointer; }
.chip.empty { background: transparent; color: #94a3b8; cursor: default; }

@media (max-width: 640px) {
  .nav {
    flex-direction: row; width: 100%; height: auto; position: sticky; top: 0; z-index: 50;
    padding: 5px 6px; gap: 2px; overflow-x: auto; overflow-y: hidden;
    border-right: none; border-bottom: 1px solid var(--line);
    -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain;
    scrollbar-width: none; scroll-snap-type: x proximity;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav .logo { display: none; }
  /* flex:1 で伸ばすと文字が折り返して高さがガタつく。幅は固定して横スクロールにする */
  .nav a { flex: 0 0 auto; flex-direction: column; justify-content: center; gap: 3px; padding: 7px 4px; font-size: 0.6rem; min-width: 56px; height: 52px; border-radius: 8px; scroll-snap-align: start; }
  .nav a .ico svg { width: 20px; height: 20px; }
  .nav a .lbl { white-space: nowrap; }   /* 「決まったルート」等が2行に折れて高さが変わるのを防ぐ */
  .pc-only { display: none; }            /* 長いラベルはスマホで短縮（決まったルート → ルート） */
  .app { flex-direction: column; }
  .main { padding: 14px 12px 70px; }
  .card { padding: 16px 14px; border-radius: 14px; }
  .head h1 { font-size: 1.2rem; }
  .head { flex-wrap: wrap; }
  .mini { grid-template-columns: repeat(2,1fr); }
  .profit-hero .amt { font-size: 2.1rem; }

  /* 入力の行は折り返して、1つあたりの幅を確保（潰れ防止） */
  .row { flex-wrap: wrap; }
  .row > div { flex: 1 1 140px; min-width: 0; }
  .tollmode { flex: 1 1 100%; }

  /* 地点行: 折り返し任せだと画面幅で並びが変わるので、位置を決め打ちにする
     1段目 = 番号＋住所（画面いっぱい）／2段目 = ⠿並べ替え・作業時間・×削除 */
  .stop {
    display: grid; grid-template-columns: 34px minmax(0,1fr) 40px;
    grid-template-areas: "badge addr addr" "grip stay del";
    gap: 6px 8px; align-items: center; margin-bottom: 10px;
  }
  .stop .badge { grid-area: badge; width: 24px; height: 24px; font-size: 0.74rem; }
  .stop input.addr { grid-area: addr; width: 100%; min-width: 0; }
  .stop .grip { grid-area: grip; height: 44px; }
  .stop input.stay { grid-area: stay; width: 100%; flex: none; }
  .stop .del { grid-area: del; width: 40px; height: 44px; }
  .stop .sd-toggle, .stop .stop-detail { grid-column: 1 / -1; }
  /* 出発地は並べ替えも削除もしないので1段だけ */
  .stop:first-child { grid-template-columns: 34px minmax(0,1fr); grid-template-areas: "badge addr"; }
  .stop:first-child .stay, .stop:first-child .del, .stop:first-child .grip { display: none; }
}

/* 履歴テーブル */
table.hist { width: 100%; border-collapse: collapse; font-size: 0.82rem; background: #fff; }
.hist th, .hist td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.hist th { background: #f8fafc; color: #475569; font-size: 0.74rem; }
.hist th:nth-child(-n+2), .hist td:nth-child(-n+2) { text-align: left; }
.hist td:nth-child(2) { white-space: normal; min-width: 160px; }
.hist .p { color: var(--profit); font-weight: 700; }
.hist .m { color: var(--cost); font-weight: 700; }

/* 地点行の売上入力 */
.stop input.rev { width: 100px; flex: none; }
.stop:first-child .rev { visibility: hidden; }

/* 選択タイル（車両・人）— タップして選ぶ・文字少なめ */
.chip.pick { cursor: pointer; user-select: none; flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px 16px; min-width: 130px; border: 2px solid #c6d9fb; border-radius: 12px; background: #fff; }
.chip.pick.sel { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: 0 4px 12px rgba(37,99,235,.28); }
.chip.pick .vt-name { font-weight: 700; font-size: 1rem; }
.chip.pick .vt-sub { font-size: 0.72rem; opacity: 0.8; }
body.mode-site .chip.pick .vt-sub { display: none; }   /* 現場は文字少なめ・名前だけ */
body.mode-site .mini { grid-template-columns: repeat(2,1fr); }

/* 行程表の売上バッジ・処分場警告 */
.itin-rev { margin-left: 8px; font-size: 0.75rem; color: #166534; background: #dcfce7; border-radius: 6px; padding: 2px 8px; white-space: nowrap; font-weight: 700; }
.itin-warn { border-radius: 8px; padding: 8px 12px; margin: 6px 0 6px 23px; font-size: 0.82rem; font-weight: 600; }
.itin-warn.ng { background: #fef2f2; border: 1px solid #fca5a5; color: #b91c1c; }
.itin-warn.amber { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }

/* 高速料金モード選択 */
.tollmode { display: block; background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; font-weight: 400; }
.tollmode:has(input:checked) { border-color: var(--accent); background: #eff6ff; }
.tollmode input { width: auto; margin-right: 4px; }
.tollmode .hint { display: block; margin-top: 3px; }

/* カレンダーボタンを右寄せできるように */
.card h2 { flex-wrap: wrap; }

/* 現場（緑）と処分場（オレンジ）の色分け */
.btn-genba { background: #dcfce7; color: #166534; }
.btn-shobun { background: #fef3c7; color: #92400e; margin-left: 6px; }
.stop.start .badge { background: var(--accent); color: #fff; }
.stop.genba .badge { background: var(--profit); color: #fff; }
.stop.site .badge { background: var(--amber); color: #fff; }
.stop.genba input.addr { border-left: 4px solid var(--profit); }
.stop.site input.addr { border-left: 4px solid var(--amber); background: #fffdf5; }
.itin-mark.site { background: var(--amber); }

/* 処分費の行の削除ボタン */
.dc-row .del { background: #fee2e2; color: #b91c1c; border: none; border-radius: 8px; width: 34px; cursor: pointer; flex: none; }

/* 準備中の機能（見積書など） */
.tag-wip { background: #fef3c7 !important; color: #92400e !important; }
.wip-card { display: flex; gap: 16px; align-items: flex-start; background: linear-gradient(180deg,#fff,#fbfcfe); }
.wip-ico { flex: none; width: 46px; height: 46px; border-radius: 12px; background: #fff7ed; color: var(--amber); display: flex; align-items: center; justify-content: center; }
.wip-ico svg { width: 24px; height: 24px; }

@media print {
  body { background: #fff; }
  .nav, .no-print, .login { display: none !important; }
  .app, .main { display: block !important; padding: 0 !important; max-width: none !important; margin: 0 !important; }
}

/* 地点の並べ替え（長押しドラッグ） */
.stop .grip { flex: none; width: 34px; align-self: stretch; display: flex; align-items: center; justify-content: center; color: #64748b; font-size: 1.2rem; cursor: grab; touch-action: none; user-select: none; background: #f1f5f9; border-radius: 8px; }
.stop:first-child .grip { visibility: hidden; }
.stop.pressing { background: #edf3fe; border-radius: 9px; }        /* 押した瞬間の反応 */
.stop.dragging { background: #fff; border-radius: 9px; box-shadow: 0 14px 30px rgba(0,0,0,.3); position: relative; z-index: 20; will-change: transform; }
.stop.dragging .grip { color: var(--accent); background: #d8e7fc; cursor: grabbing; }
#stops.sorting { touch-action: none; }
#stops.sorting .stop:not(.dragging) { transition: transform .14s ease; }

/* 処分場チップ：編集リンクと編集中の強調 */
.chip .ed { font-size: 0.72rem; color: var(--accent); margin-left: 4px; }
.chip.editing { background: var(--accent); color: #fff; }
.chip.editing .ed { color: #fff; }

/* ===== 処分費（自動計算UI・大手風の入力） ===== */
.dc-card { background: #f8fafc; border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-top: 10px; }
/* 処分場｜品目｜数量｜処分費（自動）｜売上（入力）｜＝｜× */
.dc-head { display: grid; grid-template-columns: 1.05fr 1.2fr .62fr .74fr .84fr 38px 34px; gap: 8px; font-size: 0.72rem; color: var(--sub); font-weight: 700; padding: 0 2px 6px; }
.dc-row { display: grid; grid-template-columns: 1.05fr 1.2fr .62fr .74fr .84fr 38px 34px; gap: 8px; align-items: center; margin-top: 8px; }
.dc-row > div { min-width: 0; }
.dc-row select, .dc-row input { width: 100%; }
.dc-row .del { height: 44px; }
.btn-dc-add { width: 100%; margin-top: 10px; background: #dbe8fd; color: var(--accent-d); font-weight: 700; padding: 12px; }

/* 行ごとの処分費（自動計算＝読むだけ） */
.dc-c-cost { text-align: right; }
.dc-cost { font-weight: 800; font-size: 0.92rem; color: #0f172a; white-space: nowrap; }
.is-kaitori .dc-cost { color: var(--profit); }
.dc-lbl { display: none; }                                  /* スマホでだけ項目名を出す */

/* 行ごとの売上（請求）＝ここが目玉。入力できることが見て分かるよう白＋枠を強調 */
input.dc-rev { font-weight: 800; text-align: right; background: #fff; border-color: #93c5fd; }
input.dc-rev:focus { border-color: var(--accent); }
.dc-eq { background: #dbe8fd; color: var(--accent-d); border: none; border-radius: 8px; height: 44px; font-weight: 800; font-size: 1rem; cursor: pointer; flex: none; }
.dc-eq:hover { background: #bfdbfe; }
.is-kaitori .dc-c-rev, .is-kaitori .dc-eq { visibility: hidden; }   /* 有価買取は収入なので売上欄を出さない */

.dc-acts { display: flex; gap: 8px; align-items: stretch; }
.dc-acts .btn-dc-add { flex: 1 1 auto; }
.btn-eqall { flex: 0 0 auto; margin-top: 10px; background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; font-weight: 700; font-size: .88rem; padding: 9px 14px; white-space: nowrap; }
.btn-eqall:hover { background: #d1fae5; }
.dc-revsum { margin-top: 10px; font-size: 0.85rem; color: #334155; font-weight: 700; }
.dc-revsum:empty { display: none; }
.dc-diff { font-size: 0.78rem; font-weight: 700; border-radius: 6px; padding: 2px 8px; }
.dc-diff.pos { background: #dcfce7; color: #166534; }
.dc-diff.neg { background: #fee2e2; color: #b91c1c; }
.bill-sum { font-size: 0.85rem; font-weight: 700; color: #334155; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }

/* ===== 🛣 決まったルート（グループ＝便を複数持つ） ===== */
.route-loaded { background: #eff6ff; border: 1px solid #bfdbfe; color: var(--accent-d); border-radius: 10px; padding: 10px 12px; font-size: 0.85rem; margin-bottom: 12px; }
.r-leg { background: #f8fafc; border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-top: 10px; }
.rl-top { display: flex; align-items: center; gap: 8px; }
.rl-no { flex: none; background: var(--accent); color: #fff; border-radius: 8px; padding: 4px 9px; font-size: 0.74rem; font-weight: 800; white-space: nowrap; }
.rl-top input.rl-name { flex: 1; min-width: 0; }
.rl-top .del { background: #fee2e2; color: #b91c1c; border: none; border-radius: 8px; width: 34px; height: 40px; font-size: 1.1rem; cursor: pointer; flex: none; }
.r-leg textarea.rl-genba { width: 100%; font-family: inherit; font-size: 0.9rem; padding: 10px; border: 1px solid var(--line); border-radius: 8px; resize: vertical; }
.r-leg .mini-lbl { margin-top: 10px; }

.r-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-top: 10px; }
.rc-top { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.rc-name { font-weight: 800; font-size: 1rem; color: #0f172a; }
.rc-meta { font-size: 0.76rem; color: var(--sub); font-weight: 700; background: #f1f5f9; border-radius: 6px; padding: 2px 8px; }
.rc-legs { margin-top: 10px; }
.rc-leg { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; margin-top: 6px; cursor: pointer; background: #f8fafc; }
.rc-leg input { width: auto; flex: none; }
.rc-lname { font-weight: 700; color: #0f172a; }
.rc-lsub { color: var(--sub); font-size: 0.78rem; margin-left: auto; text-align: right; }
.rc-acts { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.rc-acts .btn { flex: 0 0 auto; }
.rc-acts .rc-use { flex: 1 1 auto; }
@media (max-width: 640px) {
  .rc-leg { flex-wrap: wrap; }
  .rc-lsub { margin-left: 0; flex: 1 1 100%; text-align: left; }
  .rc-acts .btn { flex: 1 1 auto; }
}

/* ===== 🚚 収集運搬費（現場ごとの売上）＝「1.ルート」から「2」へ移した入力欄 ===== */
.stop input.rev { display: none !important; }        /* 本体は残すが隠す（住所欄を広く使うため） */
.rev-block { margin-top: 16px; background: #f8fafc; border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.rev-block-lbl { font-size: 0.85rem; font-weight: 700; color: #334155; margin-bottom: 4px; }
/* 1現場＝1枚のカード。売上欄は迷いようがない大きさにする（小さくて分かりにくいという指摘への対応） */
.rev-row { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-top: 10px; }
.rv-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.rv-no { flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%; background: var(--profit); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.8rem; }
.rv-name { font-weight: 700; font-size: 0.88rem; color: #0f172a; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rv-name.empty { color: var(--sub); font-weight: 400; }
.rv-field { display: block; margin-top: 10px; }
.rv-lbl { display: block; font-size: 0.82rem; font-weight: 700; color: var(--accent-d); margin-bottom: 6px; }
.rv-wrap { position: relative; display: block; }
.rv-yen, .rv-unit { position: absolute; top: 50%; transform: translateY(-50%); font-style: normal; font-weight: 700; color: var(--sub); pointer-events: none; }
.rv-yen { left: 14px; font-size: 1.1rem; }
.rv-unit { right: 14px; font-size: 0.9rem; }
input.rv-amt { width: 100%; height: 58px; padding: 0 44px 0 34px; font-size: 1.35rem; font-weight: 800; text-align: right; background: #f8fbff; border: 2px solid #93c5fd; border-radius: 10px; }
input.rv-amt:focus { border-color: var(--accent); background: #fff; box-shadow: 0 0 0 4px rgba(37, 99, 235, .13); }
.rev-summary { margin-top: 14px; background: #fff; border: 2px dashed #cbd5e1; border-radius: 12px; padding: 14px; display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; }
.rev-summary:empty { display: none; }
.rs-l { font-size: 0.85rem; font-weight: 700; color: #334155; }
.rs-v { font-size: 1.35rem; font-weight: 800; color: var(--profit); }
.rs-b { font-size: 0.78rem; color: var(--sub); flex: 1 1 100%; }
@media (max-width: 640px) {
  .rv-name { white-space: normal; }
  input.rv-amt { height: 56px; font-size: 1.25rem; }
}
.dc-total { margin-top: 14px; background: #fff; border: 2px dashed #cbd5e1; border-radius: 12px; padding: 14px; }
.dc-total-lbl { font-size: 0.85rem; font-weight: 700; color: #334155; display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.auto-badge { font-size: 0.68rem; background: #dcfce7; color: #166534; border-radius: 6px; padding: 2px 8px; font-weight: 700; }
input.auto-field { background: #f1f5f9; color: #0f172a; font-weight: 800; font-size: 1.2rem; text-align: right; cursor: default; }
.dc-edit { background: none; border: none; color: var(--accent); font-size: 0.78rem; cursor: pointer; margin-top: 8px; padding: 2px 0; text-decoration: underline; }
@media (max-width: 640px) {
  .dc-head { display: none; }
  /* スマホは1品目=1枚のカード。処分場／品目／(数量・処分費)／(売上・＝・×) の4段 */
  .dc-row {
    grid-template-columns: 1fr 1fr 44px 40px; gap: 8px 6px;
    grid-template-areas: "site site site site" "item item item item" "kg kg cost cost" "rev rev eq del";
    background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px;
  }
  .dc-c-site { grid-area: site; }
  .dc-c-item { grid-area: item; }
  .dc-c-kg   { grid-area: kg; }
  .dc-c-cost { grid-area: cost; display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
  .dc-c-rev  { grid-area: rev; display: flex; align-items: center; gap: 6px; }
  .dc-c-rev input.dc-rev { width: auto; flex: 1 1 0; min-width: 0; }   /* ラベルの幅を先に確保してから残りを入力欄に */
  .dc-eq     { grid-area: eq; height: 40px; }
  .dc-row .del { grid-area: del; width: 40px; height: 40px; }
  .dc-lbl { display: inline; font-size: 0.64rem; color: var(--sub); font-weight: 700; white-space: nowrap; flex: 0 0 auto; }
  .dc-acts { flex-direction: column; gap: 0; }
  .btn-eqall { width: 100%; margin-top: 8px; }
}

/* 処分場の品目入力（単位つき） */
.s-item { background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-top: 8px; }
.s-item .si-main { display: flex; gap: 8px; align-items: center; }
.s-item .si-main .si-name { flex: 1; min-width: 0; }
.s-item .si-main .si-kind { flex: 0 0 108px; }
.s-item .si-main .del { flex: none; width: 36px; height: 42px; background: #fee2e2; color: #b91c1c; border: none; border-radius: 8px; font-size: 1.1rem; cursor: pointer; }
.s-item .si-sub { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 8px; margin-top: 8px; }
.mini-lbl { display: block; font-size: 0.68rem; color: var(--sub); font-weight: 600; margin: 0 0 2px; }
@media (max-width: 640px) {
  .s-item .si-main { flex-wrap: wrap; }
  .s-item .si-main .si-name { flex: 1 1 100%; }
  .s-item .si-main .si-kind { flex: 1 1 auto; }
  .s-item .si-sub { grid-template-columns: 1fr 1fr; }
}

/* ガイド：FAQアコーディオン（困ったら開く） */
.guide-h { font-size: 0.9rem; font-weight: 700; color: var(--sub); margin: 22px 0 6px; }
.faq { background: #fff; border: 1px solid var(--line); border-radius: 10px; margin-top: 8px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.faq > summary { cursor: pointer; padding: 14px 16px; font-weight: 700; font-size: 0.92rem; list-style: none; display: flex; align-items: center; gap: 10px; }
.faq > summary::-webkit-details-marker { display: none; }
.faq > summary::before { content: "＋"; color: var(--accent); font-weight: 800; font-size: 1.1rem; }
.faq[open] > summary::before { content: "−"; }
.faq[open] > summary { border-bottom: 1px solid var(--line); background: #f8fafc; }
.faq .faq-body { padding: 14px 16px; font-size: 0.85rem; line-height: 1.85; color: #334155; }
.faq .faq-body b { color: var(--ink); }

/* 設定のまとまり（車両の按分・詳しい設定など） */
.subcard { background: #f8fafc; border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.lbl-note { display: inline; font-weight: 400; font-size: 0.72rem; color: var(--sub); margin-left: 6px; }

/* ⚖️ ルート比較 — 「表で見る」はPCで右の列に。「並べて見る」は横幅がいるので画面いっぱい */
.compare-pane { margin-top: 4px; }
@media (min-width: 1100px) {
  body.has-compare .main { max-width: 1280px; }
  .calc-cols.has-compare:not(.cmp-wide) { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 18px; align-items: start; }
  .calc-cols.has-compare:not(.cmp-wide) .compare-pane { position: sticky; top: 16px; margin-top: 0; }
}

/* 見方の切り替えタブ */
.cmp-tabs { display: flex; background: #f1f5f9; border-radius: 10px; padding: 4px; gap: 4px; margin: 0 0 10px; }
.cmp-tab {
  flex: 1; border: none; background: none; border-radius: 7px; padding: 9px 6px;
  font-family: inherit; font-size: .84rem; font-weight: 700; color: var(--sub); cursor: pointer; transition: .14s;
}
.cmp-tab.active { background: #fff; color: var(--accent-d); box-shadow: 0 1px 3px rgba(16,24,40,.12); }

/* 並べて見る＝1案=1枚。スマホでも必ず2列（隣同士で見比べたい、が要望の芯） */
.cmp-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.cmp-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; min-width: 0; }
.cmp-card.is-cur { border-color: #93c5fd; background: #fbfdff; }
.cmp-card.is-win { border-color: #86efac; }
.cc-top { display: flex; align-items: flex-start; gap: 6px; margin-bottom: 8px; }
.cc-name { flex: 1; min-width: 0; font-weight: 800; font-size: .92rem; color: #0f172a; line-height: 1.35; word-break: break-word; }
.cmp-x { flex: none; color: #b91c1c; cursor: pointer; font-weight: 700; padding: 0 4px; }
.cc-hero { background: linear-gradient(135deg,#065f46,#16a34a); color: #fff; border-radius: 11px; padding: 12px 10px; text-align: center; }
.cc-hero.loss { background: linear-gradient(135deg,#7f1d1d,#dc2626); }
.cc-hero.none { background: #f1f5f9; color: var(--sub); }
.cc-l { font-size: .7rem; opacity: .92; line-height: 1.5; }
.cc-amt { font-size: 1.45rem; font-weight: 800; line-height: 1.25; letter-spacing: -.02em; }
.cc-rate { font-size: .78rem; font-weight: 700; opacity: .96; }
.cc-badge { margin-top: 10px; text-align: center; font-size: .74rem; font-weight: 800; border-radius: 7px; padding: 5px 6px; background: #dcfce7; color: #166534; }
.cc-badge.hi { background: #fef2f2; color: #b91c1c; }
.cc-total { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; margin-top: 8px; font-size: .78rem; color: var(--sub); font-weight: 700; }
.cc-total b { font-size: 1.05rem; color: var(--ink); }
.cc-sub { font-size: .74rem; color: var(--sub); margin-top: 3px; }
.cc-rows { margin-top: 8px; border-top: 1px solid var(--line); padding-top: 6px; }
.cc-r { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; font-size: .76rem; color: var(--sub); padding: 3px 0; }
.cc-r b { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.cc-old { margin-top: 10px; font-size: .7rem; color: var(--sub); text-align: center; line-height: 1.5; }
/* 「作ったページに戻る」— 表からもカードからも同じボタン */
.cmp-open {
  margin-top: 10px; width: 100%; background: #edf3fe; color: var(--accent-d); border: 1px solid #c6d9fb;
  border-radius: 9px; padding: 10px 6px; font-family: inherit; font-size: .82rem; font-weight: 800; cursor: pointer;
  transition: background .12s;
}
.cmp-open:hover { background: #dbe8fd; }
.cmp-open.sm { margin-top: 0; width: auto; padding: 4px 9px; font-size: .7rem; font-weight: 700; }
.cmp-h { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.cmp-hn { white-space: normal; }
@media (max-width: 640px) {
  .cmp-cards { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
  .cmp-card { padding: 10px 8px; }
  .cc-amt { font-size: 1.15rem; }
  .cc-name { font-size: .82rem; }
}
table.cmp { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.cmp th, .cmp td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cmp thead th { font-size: 0.76rem; color: var(--ink); border-bottom: 2px solid #cbd5e1; }
.cmp td:first-child, .cmp th:first-child { text-align: left; color: var(--sub); font-weight: 600; font-size: 0.74rem; }
.cmp .cur-col { background: #edf3fe; }
.cmp .win { color: var(--profit); font-weight: 800; }
.cmp .diff { display: block; font-size: 0.68rem; color: var(--cost); font-weight: 400; }
.cmp tr.total td { font-weight: 700; border-top: 2px solid #cbd5e1; }
.cmp .x { color: #b91c1c; cursor: pointer; margin-left: 6px; font-weight: 700; }

/* 現場の受入時間（⏱トグルと詳細行） */
.stop .sd-toggle { flex: 1 1 100%; background: none; border: none; text-align: left; color: var(--accent); font-size: 0.72rem; cursor: pointer; padding: 0 0 2px 34px; font-weight: 600; }
.stop .sd-toggle.set { color: var(--amber); }
.stop-detail { flex: 1 1 100%; display: flex; align-items: center; gap: 6px; font-size: 0.78rem; color: #334155; background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; margin: 0 0 4px 34px; }
.stop-detail .sd-lbl { font-weight: 600; white-space: nowrap; }
.stop-detail input[type="time"] { width: auto; min-height: 38px; padding: 6px 8px; font-size: 0.9rem; }
.stop-detail .sd-hint { color: var(--sub); font-size: 0.7rem; margin-left: auto; }
@media (max-width: 640px) {
  .stop .sd-toggle { padding-left: 0; }
  .stop-detail { margin-left: 0; flex-wrap: wrap; }
  .stop-detail .sd-hint { flex: 1 1 100%; margin-left: 0; }
}

/* 💰 売上の詳細設定（処分費の別途請求） */
.bill-row { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; margin-top: 6px; flex-wrap: wrap; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.bill-row .b-name { font-weight: 700; }
.bill-row .b-kg { color: var(--sub); }
.bill-row input.b-price { width: 110px; flex: none; }
.bill-row .b-sub { font-size: 0.72rem; color: var(--sub); }
.bill-row .b-amt { margin-left: auto; font-weight: 800; color: var(--profit); }

/* ===== 🔐 ログイン画面（入口） ===== */
body.locked { overflow: hidden; }
.login {
  position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center;
  padding: 20px; overflow-y: auto;
  background: radial-gradient(1200px 600px at 20% -10%, #e8effc 0%, transparent 60%), linear-gradient(160deg, #f7f9fd 0%, #eef2f8 100%);
}
.login.hide { display: none; }
.lg-box {
  background: #fff; border: 1px solid var(--line); border-radius: 20px; width: 100%; max-width: 400px;
  padding: 30px 28px 26px; box-shadow: 0 24px 60px rgba(16,24,40,.14), 0 2px 6px rgba(16,24,40,.05);
  margin: auto;
}
.lg-logo { display: flex; align-items: center; gap: 10px; justify-content: center; }
.lg-logo svg { width: 34px; height: 34px; }
.lg-logo-t { font-size: 1.05rem; font-weight: 800; line-height: 1.2; letter-spacing: .02em; }
.lg-logo-t small { display: block; font-size: .58rem; font-weight: 700; color: #98a2b3; letter-spacing: .14em; }
.lg-lead { text-align: center; color: var(--sub); font-size: .84rem; margin: 14px 0 16px; }
.lg-tabs { display: flex; background: #f1f5f9; border-radius: 11px; padding: 4px; gap: 4px; margin-bottom: 8px; }
.lg-tab {
  flex: 1; border: none; background: none; border-radius: 8px; padding: 9px 6px;
  font-family: inherit; font-size: .82rem; font-weight: 700; color: var(--sub); cursor: pointer; transition: .14s;
}
.lg-tab.active { background: #fff; color: var(--accent-d); box-shadow: 0 1px 3px rgba(16,24,40,.12); }
.lg-check { display: flex; align-items: flex-start; gap: 8px; font-weight: 500; font-size: .78rem; line-height: 1.5; color: var(--sub); margin: 14px 0 16px; }
.lg-check input { width: auto; margin-top: 2px; flex: none; }
.lg-msg { font-size: .8rem; line-height: 1.7; color: #b45309; margin-top: 10px; min-height: 1px; }
.lg-msg b { color: var(--accent-d); }
.lg-note { font-size: .74rem; line-height: 1.75; color: var(--sub); margin-top: 12px; background: #f8fafc; border-radius: 10px; padding: 10px 12px; }
.lg-link {
  display: block; width: 100%; margin-top: 14px; padding: 10px; border: 1px dashed #cbd5e1; border-radius: 10px;
  background: none; color: var(--accent-d); font-family: inherit; font-size: .8rem; font-weight: 700; cursor: pointer;
}
.lg-link:hover { background: #f8fafc; }

/* 入口：会社のキーを主役にしたので「または → この端末だけで試す」を下に小さく置く */
.lg-or { display: flex; align-items: center; gap: 10px; margin: 18px 0 12px; color: #98a2b3; font-size: .72rem; font-weight: 700; }
.lg-or::before, .lg-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.lg-solo-btn { margin-top: 0; border-style: solid; border-color: var(--line); color: var(--sub); font-weight: 600; }
.lg-solo-btn:hover { background: #f1f5f9; color: var(--ink); }
.lg-warn { background: #fffbeb; color: #92400e; }
.lg-warn b { color: #7c2d12; }

/* ===== クラウドの状態を知らせる帯（画面のいちばん上・全ページ共通） ===== */
.sync-bar {
  position: relative; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  border-radius: 11px; padding: 11px 34px 11px 13px; margin-bottom: 14px;
  font-size: .82rem; line-height: 1.6; border: 1px solid;
}
.sync-bar .sb-t { flex: 1 1 200px; min-width: 0; }
.sync-bar.solo { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.sync-bar.warn { background: #fef2f2; border-color: #fca5a5; color: #b91c1c; }
.sync-bar.ok   { background: #ecfdf5; border-color: #a7f3d0; color: #166534; }
.sync-bar b { font-weight: 800; }
.sb-a {
  flex: none; border: none; border-radius: 8px; padding: 8px 13px; cursor: pointer;
  font-family: inherit; font-size: .8rem; font-weight: 800; background: var(--accent); color: #fff; white-space: nowrap;
}
.sb-a:hover { background: var(--accent-d); }
.sb-a.alt { background: #fff; color: var(--accent-d); border: 1px solid #c6d9fb; }
.sb-a.alt:hover { background: #edf3fe; }
.sb-x { position: absolute; top: 7px; right: 9px; background: none; border: none; color: inherit; opacity: .55; font-size: 1.15rem; cursor: pointer; padding: 0 2px; line-height: 1; }
.sb-x:hover { opacity: 1; }
@media (max-width: 640px) {
  .sync-bar { font-size: .78rem; padding: 10px 12px; }
  .sb-a { flex: 1 1 auto; }
}

/* ⏪ 上書きしてしまったときに戻すカード */
.undo-card {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  margin-top: 12px; background: #fff7ed; border: 1px solid #fed7aa; border-left: 4px solid var(--amber);
  border-radius: 12px; padding: 13px 14px;
}
.uc-txt { flex: 1 1 220px; min-width: 0; }
.uc-t { font-size: .9rem; font-weight: 800; color: #7c2d12; }
.uc-s { font-size: .76rem; color: #92400e; line-height: 1.7; margin-top: 3px; }
@media (max-width: 640px) { .undo-card .btn { width: 100%; } }

/* ログイン中の会社・担当者（サイドバー下） */
.nav-who { margin-top: auto; border-top: 1px solid var(--line); padding: 12px 10px 2px; }
.nav-who .who-co { font-size: .78rem; font-weight: 700; color: var(--ink); line-height: 1.35; word-break: break-all; }
.nav-who .who-me { font-size: .7rem; color: var(--sub); margin-top: 1px; }
.nav-who .who-out { margin-top: 8px; width: 100%; background: #f5f7fa; border: 1px solid var(--line); border-radius: 8px; padding: 7px 4px; font-family: inherit; font-size: .68rem; font-weight: 600; color: var(--sub); cursor: pointer; }
.nav-who .who-out:hover { background: #eef1f6; color: var(--ink); }
.who-card { background: #f8fafc; border: 1px solid var(--line); border-radius: 12px; padding: 14px; font-size: .88rem; line-height: 2; }
.who-card .who-k { display: inline-block; width: 62px; font-size: .74rem; color: var(--sub); font-weight: 600; }
.who-card .btn { margin-top: 8px; }

/* ===== 📤 共有（計算がおわったら、ここから相手に渡す） ===== */
.share-card {
  background: linear-gradient(180deg, #ffffff 0%, #f6faff 100%);
  border: 1px solid #d7e3fb; border-left: 4px solid var(--accent); border-radius: 14px;
  padding: 16px 18px; margin-bottom: 16px;
  box-shadow: 0 1px 2px rgba(16,24,40,.04), 0 10px 26px rgba(37,99,235,.09);
  transition: border-color .2s, background .2s;
}
.share-h { font-size: 1.02rem; font-weight: 800; letter-spacing: -.01em; }
.share-s { font-size: .78rem; color: var(--sub); line-height: 1.65; margin: 4px 0 12px; }
.share-s b, .share-note b { color: #344054; }
.share-note { font-size: .74rem; color: var(--sub); line-height: 1.6; margin: 10px 0 0; }
.push-to { font-size: .72rem; color: var(--accent-d); margin-top: 8px; background: #eef4ff; border-radius: 6px; padding: 5px 9px; display: inline-block; }
/* 渡し方は2つ。どちらも同じ大きさの横長ボタンにして「どっちを押せばいいか」で迷わせない */
.btn-share {
  width: 100%; display: flex; align-items: center; gap: 12px; text-align: left;
  border-radius: 12px; padding: 14px 16px; font-family: inherit; cursor: pointer;
  border: 1px solid #d7e3fb; background: #fff; color: var(--ink);
  transition: transform .12s, box-shadow .18s, background .18s, border-color .18s;
}
.btn-share + .btn-share { margin-top: 10px; }
.sh-ico { flex: 0 0 auto; font-size: 1.35rem; line-height: 1; }
.sh-txt { flex: 1 1 auto; min-width: 0; }
.sh-txt > b { display: block; font-size: 1rem; font-weight: 800; }
.sh-txt small { display: block; font-size: .74rem; color: var(--sub); line-height: 1.55; margin-top: 2px; }
.sh-txt small b { font-size: inherit; color: inherit; }
.sh-go { flex: 0 0 auto; font-size: 1.3rem; color: var(--sub); }
.btn-share:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(37,99,235,.16); border-color: var(--accent); }
.btn-share:active { transform: translateY(0); }
.sh-push { background: linear-gradient(180deg, #3b82f6, #2563eb); border-color: transparent; color: #fff;
  box-shadow: 0 8px 20px rgba(37,99,235,.30), inset 0 1px 0 rgba(255,255,255,.22);
  animation: pushBreathe 2.8s ease-in-out infinite; }
.sh-push .sh-txt small, .sh-push .sh-go { color: rgba(255,255,255,.85); }
.sh-push:hover { background: linear-gradient(180deg, #2f7bf0, #1d4ed8); box-shadow: 0 14px 28px rgba(37,99,235,.44); animation: none; }
.sh-push:disabled { background: #94a3b8; box-shadow: none; animation: none; cursor: default; transform: none; }
@keyframes pushBreathe {
  0%, 100% { box-shadow: 0 8px 20px rgba(37,99,235,.30), inset 0 1px 0 rgba(255,255,255,.22); }
  50%      { box-shadow: 0 10px 30px rgba(37,99,235,.55), inset 0 1px 0 rgba(255,255,255,.22); }
}
.share-card.done { border-color: #a7f3d0; border-left-color: var(--profit); background: linear-gradient(180deg, #ffffff 0%, #f2fdf7 100%); }
.share-card.done .sh-push { background: var(--profit); box-shadow: none; animation: none; }
@media (prefers-reduced-motion: reduce) { .sh-push { animation: none; } }
@media (max-width: 640px) {
  .share-card { padding: 14px; }
  .nav-who { display: none; }   /* スマホは「保存」ページのログイン情報カードから操作します */
}

/* 履歴の「▶開く」（その計算を再現） */
.hist-open { background: #edf3fe; color: var(--accent-d); border: none; border-radius: 6px; padding: 4px 8px; font-size: 0.72rem; font-weight: 700; cursor: pointer; white-space: nowrap; }
.hist-open:hover { background: #dbe8fd; }
.hist .x { color: #b91c1c; cursor: pointer; font-weight: 700; padding: 0 4px; }

/* ===== 💾 保存（名前を付けて残す） ===== */
/* 結果の中の保存カード。「保存の場所が分からない」への答えなので、結果を見た直後に目に入る位置に置く */
.save-card {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  background: linear-gradient(180deg, #ffffff 0%, #fbfaf5 100%);
  border: 1px solid #e7e0cd; border-left: 4px solid var(--amber); border-radius: 14px;
  padding: 15px 16px; margin-bottom: 12px;
  box-shadow: 0 1px 2px rgba(16,24,40,.04), 0 8px 20px rgba(180,83,9,.07);
}
.sv-txt { flex: 1 1 220px; min-width: 0; }
.sv-t { font-size: 0.98rem; font-weight: 800; letter-spacing: -.01em; }
.sv-s { font-size: .76rem; color: var(--sub); line-height: 1.65; margin-top: 3px; }
.sv-s b { color: #344054; }
.sv-name { font-size: .8rem; font-weight: 700; color: #166534; margin-top: 6px; background: #dcfce7; border-radius: 6px; padding: 4px 8px; display: inline-block; }
.btn-save {
  flex: none; display: inline-flex; align-items: center; gap: 8px;
  background: #fff; color: var(--amber); border: 2px solid var(--amber); border-radius: 12px;
  padding: 13px 20px; font-family: inherit; font-size: .95rem; font-weight: 800; cursor: pointer; white-space: nowrap;
  transition: background .14s, color .14s, transform .1s;
}
.btn-save svg { width: 18px; height: 18px; }
.btn-save:hover { background: var(--amber); color: #fff; }
.btn-save:active { transform: translateY(1px); }
.save-card.done { border-color: #a7f3d0; border-left-color: var(--profit); background: linear-gradient(180deg,#fff 0%,#f2fdf7 100%); }
.save-card.done .btn-save { border-color: var(--profit); color: var(--profit); background: #fff; }
.save-card.done .btn-save:hover { background: var(--profit); color: #fff; }

.hist-filter { display: inline-flex; align-items: center; gap: 8px; font-size: .84rem; font-weight: 700; color: #334155; margin: 0; cursor: pointer; }
.hist-filter input { width: auto; flex: none; }
.hist-name { background: #fffbeb; color: var(--amber); border: 1px solid #fde68a; border-radius: 6px; padding: 4px 8px; font-family: inherit; font-size: .74rem; font-weight: 700; cursor: pointer; white-space: nowrap; }
.hist-name:hover { background: #fef3c7; }
.hist-name.named { background: #dcfce7; border-color: #a7f3d0; color: #166534; white-space: normal; text-align: left; max-width: 190px; }
.hist tr.is-named td { background: #fffdf5; }

@media (max-width: 640px) {
  .btn-save { width: 100%; justify-content: center; }
  .save-card { padding: 14px; }
  /* 保存の一覧はスマホだと9列の表が横スクロールになって読めない。1件=1枚のカードに組み直す */
  #histTable, #histTable tbody, #histTable tr, #histTable td,
  #sharedTable, #sharedTable tbody, #sharedTable tr, #sharedTable td { display: block; width: 100%; }
  #histTable tr:first-child, #sharedTable tr:first-child { display: none; }   /* 見出し行はカードの項目名に置き換わる */
  #histTable tr, #sharedTable tr { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; }
  #histTable tr.is-named { border-color: #a7f3d0; background: #fbfffd; }
  #histTable td, #sharedTable td { border: none; padding: 4px 0; text-align: right; white-space: normal; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  #histTable td::before, #sharedTable td::before { content: attr(data-l); color: var(--sub); font-size: .72rem; font-weight: 700; text-align: left; flex: none; }
  #histTable td:empty, #histTable td:first-child::before,
  #sharedTable td:empty, #sharedTable td:first-child::before { display: none; }
  #histTable td:first-child, #sharedTable td:first-child { justify-content: flex-end; }
  /* 案件欄だけは「事業所／品目」を縦に積む（横並びだと折り返して読めない） */
  #histTable td.case-cell, #sharedTable td.case-cell { display: block; text-align: left; padding: 6px 0 8px; }
  #histTable td.case-cell::before, #sharedTable td.case-cell::before { display: block; margin-bottom: 2px; }
  #sharedTable td:last-child { justify-content: flex-end; gap: 8px; }
  #histTable .hist-name.named { max-width: none; }
  /* ガイドの中の表がはみ出して切れていたので、中だけ横スクロールさせる */
  .faq .faq-body { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  /* 小さい文字の入力欄はiPhoneでフォーカスすると勝手に拡大されるため16px以上にする */
  .stop-detail input[type="time"] { font-size: 16px; }
  .lg-box { padding: 24px 18px 20px; }
}

/* ===== 📊 利益分析（⑤ どのルートが儲かっていないか） ===== */
.ana-sum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 4px; }
.ana-sum > div { background: var(--nav2); border-radius: 12px; padding: 12px 8px; text-align: center; }
.ana-sum .num { font-size: 1.25rem; font-weight: 800; color: var(--ink); line-height: 1.2; }
.ana-sum .lbl { font-size: .72rem; color: var(--sub); margin-top: 3px; }

.ana-item { padding: 10px 0 12px; border-bottom: 1px solid var(--line); }
.ana-item:last-child { border-bottom: 0; }
.ana-head { display: flex; align-items: baseline; gap: 10px; }
.ana-name { flex: 1; min-width: 0; font-weight: 700; font-size: .92rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ana-pct { flex: none; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.ana-item.ana-ng .ana-pct { color: var(--cost); }
.ana-item.ana-warn .ana-pct { color: var(--amber); }
.ana-item .ana-pct { color: var(--profit); }

.ana-bar { height: 9px; border-radius: 5px; background: var(--nav2); overflow: hidden; margin: 6px 0 5px; }
.ana-bar span { display: block; height: 100%; border-radius: 5px; }
.ana-sub { font-size: .75rem; color: var(--sub); }

.ana-key { display: inline-block; width: 11px; height: 11px; border-radius: 3px;
  background: var(--profit); vertical-align: -1px; margin: 0 3px 0 8px; }
.ana-key.ana-ng { background: var(--cost); }
.ana-key.ana-warn { background: #f59e0b; }

@media (max-width: 720px) {
  .ana-sum { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .ana-sum > div { padding: 10px 4px; }
  .ana-sum .num { font-size: 1.05rem; }
  .ana-sum .lbl { font-size: .66rem; }
  .ana-name { font-size: .85rem; }
}

/* ===== 売上を入れる場所を「3 もらうお金」1か所にまとめた（初めての人が迷わないように） ===== */
/* 「2 かかるお金」の表からは売上の列を消す。入力の本体は残してあり、下の請求欄から書き込む */
.dc-h-rev, .dc-c-rev, .dc-eq { display: none !important; }

.bill-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 4px 12px;
  align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.bill-row:last-of-type { border-bottom: 0; }
.br-what { min-width: 0; }
.br-what b { display: block; font-size: .92rem; }
.br-what span { display: block; font-size: .74rem; color: var(--sub); }
.br-lbl { display: block; font-size: .72rem; font-weight: 700; color: var(--sub); margin-bottom: 3px; }
.br-f-rev .br-lbl { color: var(--accent-d); }
.br-cost { text-align: right; white-space: nowrap; }
.br-cost b { font-size: .95rem; color: var(--cost); }
/* 単価と金額はどちらから入れてもよい（片方を打つともう片方が自動で埋まる） */
.br-fields { grid-column: 1 / -1; display: flex; align-items: flex-end; gap: 8px; margin-top: 4px; }
.br-f { flex: 1 1 0; min-width: 0; }
.br-wrap { display: flex; align-items: center; gap: 4px; }
.br-wrap input { flex: 1 1 auto; width: auto; min-width: 0; height: 50px; font-size: 1.1rem; font-weight: 700; text-align: right; }
.br-wrap i { flex: 0 0 auto; }
.br-f-rev .br-wrap input { font-size: 1.25rem; font-weight: 800; background: #f8fbff; border: 2px solid #93c5fd; }
.br-f-rev .br-wrap input:focus { border-color: var(--accent); background: #fff; box-shadow: 0 0 0 4px rgba(37, 99, 235, .13); }
.br-wrap i { font-style: normal; font-size: .72rem; color: var(--sub); white-space: nowrap; }
.br-eq { flex: 0 0 auto; width: 44px; height: 50px; border: 1px solid var(--accent); background: #eef3ff;
  color: var(--accent); border-radius: 9px; font-weight: 800; cursor: pointer; }
.br-eq:active { background: #dbe6ff; }

/* 🔰 初めての人向け「空でも0でもいい」の案内 */
.zero-ok { background: #f0f7ff; border: 1px solid #cfe0ff; border-radius: 10px;
  padding: 10px 12px; font-size: .8rem; color: #1e40af; line-height: 1.7; margin: 0 0 14px; }

/* 「▼ もっと詳しく」— 画面を1つにした代わりの出し入れ */
.detail-toggle { width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
  background: transparent; border: 1px dashed var(--line); color: var(--sub);
  border-radius: 12px; padding: 12px; font-size: .85rem; font-weight: 600;
  cursor: pointer; margin-bottom: 12px; }
.detail-toggle:hover { border-color: var(--accent); color: var(--accent); }
.dt-arrow { font-size: .7rem; }

@media (max-width: 720px) {
  .br-cost { text-align: right; }
  .br-what b { font-size: .88rem; }
  .br-wrap i { font-size: .68rem; }
  /* スマホでは単価を1段目、金額と［＝］を2段目に。1段だと金額欄が細くなって「小さくて分かりにくい」に逆戻りする */
  .br-fields { flex-wrap: wrap; }
  .br-f { flex: 1 1 100%; }
  .br-f-rev { flex: 1 1 0; min-width: 0; }
  .br-eq { align-self: flex-end; }
}

/* ===== 🔗 共有リンクで開いた人に見せる帯（ログイン不要でここまで見える） ===== */
.share-recv {
  background: linear-gradient(180deg, #ffffff 0%, #f4f9ff 100%);
  border: 1px solid #bfdbfe; border-left: 4px solid var(--accent); border-radius: 14px;
  padding: 15px 17px; margin-bottom: 16px;
  box-shadow: 0 1px 2px rgba(16,24,40,.04), 0 10px 26px rgba(37,99,235,.10);
}
.sr-h { font-size: 1rem; font-weight: 800; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.sr-by { font-size: .74rem; font-weight: 600; color: var(--accent-d); background: #eef4ff; border-radius: 6px; padding: 3px 8px; }
.sr-name { font-size: .92rem; font-weight: 700; margin-top: 6px; }
.sr-route { font-size: .78rem; color: var(--sub); margin-top: 2px; line-height: 1.5; }
.sr-nums { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 11px; }
.sr-nums > div { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 9px 6px; text-align: center; }
.sr-nums span { display: block; font-size: .68rem; color: var(--sub); font-weight: 600; }
.sr-nums b { display: block; font-size: 1.05rem; font-weight: 800; margin-top: 2px; }
.sr-nums .sr-ok b { color: var(--profit); }
.sr-nums .sr-ng b { color: var(--cost); }
.sr-note { font-size: .74rem; color: var(--sub); line-height: 1.65; margin-top: 10px; }
.sr-note b { color: #344054; }

/* ⭐ 見積画面で組んだ並びを、そのまま決まったルートにするボタン */
.btn-asroute { border-color: #fcd34d; background: #fffbeb; color: #92400e; }
.btn-asroute:hover { background: #fef3c7; }
/* 保存・分析のページから見積画面へ戻る導線 */
.to-calc { width: 100%; margin-bottom: 14px; border-color: #bfdbfe; background: #eff6ff; color: var(--accent-d); font-weight: 700; }
.to-calc:hover { background: #dbeafe; }

/* ===== 📦 立米（㎥）で出す売上 ===== */
.btn-m3-add { border-color: #c7d2fe; background: #eef2ff; color: #4338ca; }
.btn-m3-add:hover { background: #e0e7ff; }
.m3-row { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-top: 10px; }
.m3-top { display: flex; align-items: center; gap: 8px; }
.m3-top .m3-name { flex: 1 1 auto; min-width: 0; }
.m3-fields { display: flex; gap: 10px; margin-top: 10px; }
.m3-f { flex: 1 1 0; min-width: 0; }
.m3-lbl { display: block; font-size: .78rem; font-weight: 700; color: var(--accent-d); margin-bottom: 5px; }
.m3-wrap { display: flex; align-items: center; gap: 4px; }
.m3-wrap input { flex: 1 1 auto; width: auto; min-width: 0; height: 54px; font-size: 1.2rem; font-weight: 800;
  text-align: right; background: #f8fbff; border: 2px solid #93c5fd; border-radius: 10px; }
.m3-wrap input:focus { border-color: var(--accent); background: #fff; box-shadow: 0 0 0 4px rgba(37, 99, 235, .13); }
.m3-wrap i { flex: 0 0 auto; font-style: normal; font-size: .78rem; font-weight: 700; color: var(--sub); white-space: nowrap; }
.m3-out { display: flex; align-items: baseline; justify-content: flex-end; gap: 8px; margin-top: 10px;
  padding-top: 10px; border-top: 1px dashed var(--line); }
.m3-out span { font-size: .76rem; color: var(--sub); font-weight: 600; }
.m3-out b { font-size: 1.2rem; font-weight: 800; color: var(--sub); }
.m3-out b.on { color: var(--profit); }
@media (max-width: 640px) {
  .m3-fields { flex-wrap: wrap; }
  .m3-f { flex: 1 1 100%; }
}

/* ===== 📄 見積書（実物の様式に合わせている：囲み枠ではなく横罫。A4 1枚に収める） ===== */
.quote-sheet { background: #fff; color: #111; border: 1px solid var(--line); border-radius: 12px;
  padding: 26px 30px; margin-bottom: 16px; font-size: .84rem; line-height: 1.6; }
.qs-title { text-align: center; font-size: 1.5rem; font-weight: 700; letter-spacing: .35em; text-indent: .35em; }
.qs-dateline { text-align: right; margin-top: 18px; }
.qs-date { display: inline-block; font-size: .82rem; }

/* 宛名。「御中」は会社名のすぐ後ろに続ける（実物どおり） */
.qs-toname { font-size: 1.15rem; font-weight: 700; border-bottom: 1px solid #111;
  padding-bottom: 3px; margin-top: 16px; }
.qs-toname span { min-width: 12em; display: inline-block; }
.qs-toname i { font-style: normal; }
.qs-attn { margin-top: 6px; font-size: .84rem; }
.qs-attn i { font-style: normal; color: #333; }
.qs-attn span { min-width: 7em; display: inline-block; }

/* 上段: 左＝前書き／右＝自社名と住所 */
.qs-top { display: flex; gap: 20px; align-items: flex-start; margin-top: 14px; }
.qs-left { flex: 1 1 auto; min-width: 0; }
.qs-lead { margin-left: 3em; font-size: .82rem; }
.qs-right { flex: 0 0 46%; font-size: .78rem; }
.qs-right .qs-co { font-size: 1.15rem; font-weight: 700; margin-bottom: 3px; }
.qs-right .qs-reg { color: #444; }

/* 中段: 左＝件名ブロックと合計金額／右＝営業担当と印欄 */
.qs-mid { display: flex; gap: 18px; align-items: flex-start; margin-top: 10px; }
.qs-midL { flex: 1 1 auto; min-width: 0; }
.qs-midR { flex: 0 0 34%; }

/* 件名ブロックは囲み枠ではなく横罫だけ（実物どおり） */
.qs-head { width: 100%; border-collapse: collapse; font-size: .8rem; table-layout: fixed; }
.qs-head th { width: 34%; text-align: left; padding: 4px 4px; font-weight: 400;
  border: 0; border-bottom: 1px solid #111; }
.qs-head td { padding: 4px 4px; border: 0; border-bottom: 1px solid #111; }
/* ★.quote-sheet td[contenteditable] の「下線なし」に負けて罫線が消えていたので勝たせる。
   これが無いと、横罫がラベルの幅ぶんしか引かれない */
.quote-sheet .qs-head td[contenteditable] { border-bottom: 1px solid #111; }

/* 件名だけ全幅の1行（実物どおり） */
.qs-subject { display: flex; align-items: baseline; gap: 14px;
  border-bottom: 1px solid #111; padding: 4px 4px; margin-top: 16px; font-size: .8rem; }
.qs-sl { flex: 0 0 auto; }
.qs-sv { flex: 1 1 auto; min-width: 0; }
.quote-sheet .qs-sv[contenteditable] { border-bottom: 0; }

/* 合計金額も横罫だけ */
.qs-total { display: flex; align-items: baseline; gap: 10px; margin-top: 16px;
  border-top: 1px solid #111; border-bottom: 1px solid #111; padding: 7px 4px; }
.qs-total span { font-size: .95rem; }
.qs-total b { font-size: 1.45rem; font-weight: 700; }
.qs-total i { font-style: normal; margin-left: 6px; font-size: 1.1rem; }

/* 営業担当 */
.qs-staff { font-size: .84rem; text-align: center; margin-top: 26px; }
.qs-staff span { min-width: 6em; display: inline-block; }

/* 明細表（ここだけ囲み枠） */
.qs-tbl { width: 100%; border-collapse: collapse; margin-top: 18px; font-size: .78rem; table-layout: fixed; }
.qs-tbl th, .qs-tbl td { border: 1px solid #999; padding: 5px 7px; vertical-align: top; word-break: break-word; }
.qs-tbl .qs-th th { text-align: center; font-weight: 400; }
.qs-tbl col, .qs-tbl .qs-no { width: 26px; }
.qs-tbl .qs-no { text-align: center; padding: 5px 2px; }
.qs-tbl .num { text-align: right; }
.qs-tbl .qs-th th:nth-child(2) { width: 17%; }
.qs-tbl .qs-th th:nth-child(3) { width: 25%; }
.qs-tbl .qs-th th:nth-child(4) { width: 9%; }
.qs-tbl .qs-th th:nth-child(5) { width: 9%; }
.qs-tbl .qs-th th:nth-child(6) { width: 16%; }
.qs-tbl .qs-th th:nth-child(7) { width: 17%; }
.qs-tbl .qs-group td { font-weight: 700; }
.qs-tbl .qs-pad td { height: 1.9em; }
.qs-tbl .qs-sum td:not(.num):not(.qs-no) { border-left: 0; border-right: 0; }
.qs-tbl .qs-sum th { text-align: center; font-weight: 400; letter-spacing: .1em; }
.qs-tbl .qs-grand th, .qs-tbl .qs-grand td.num { font-weight: 700; }
.qs-tbl [contenteditable]:focus { outline: 2px solid var(--accent); background: #f4f9ff; }
/* 行を消すボタン（印刷には出ない） */
.qs-tbl .qs-del { width: 30px; border: 0; text-align: center; padding: 0 2px; }
.qs-tbl .qs-del button { border: 0; background: none; color: #b91c1c; font-size: 1rem; cursor: pointer; padding: 2px 5px; line-height: 1; }
.qs-tbl .qs-del button:hover { background: #fee2e2; border-radius: 5px; }

.qs-note { margin-top: 16px; border: 1px solid #999; }
.qs-notelbl { border-bottom: 1px solid #999; padding: 3px 8px; font-size: .8rem; letter-spacing: .25em; }
.qs-notebody { padding: 8px; font-size: .78rem; min-height: 3.4em; }
.qs-notebody:focus { outline: 2px solid var(--accent); background: #f4f9ff; }

@media (max-width: 720px) {
  .quote-sheet { padding: 16px 13px; font-size: .78rem; }
  .qs-title { font-size: 1.1rem; letter-spacing: .2em; text-indent: .2em; }
  .qs-toname { font-size: 1rem; }
  .qs-toname span { min-width: 8em; }
  .qs-top, .qs-mid { flex-direction: column; gap: 12px; }
  .qs-subject { font-size: .78rem; }
  .qs-right, .qs-midR { flex: 1 1 auto; }
  .qs-lead { margin-left: 0; }
  .qs-staff { margin-top: 4px; text-align: left; }
  .qs-total b { font-size: 1.25rem; }
  .qs-tbl { font-size: .68rem; }
  .qs-tbl th, .qs-tbl td { padding: 4px 4px; }
}

/* 印刷: A4 1枚に収める。
   ★@page の余白を 0 にすると、ブラウザが勝手に付ける
     「日付・ページ名・URL・ページ番号」が出なくなる（入る余白が無くなるため）。
     そのぶんの余白は .quote-sheet の padding で取る。 */
@page { size: A4 portrait; margin: 0; }
@media print {
  .nav, .sync-bar, .no-print, .head, .head-sub, .to-calc, .login, .qs-del { display: none !important; }
  .app, .main { display: block; padding: 0; margin: 0; background: #fff; }
  .view.hide { display: none !important; }
  .qs-tbl [contenteditable]:focus, .qs-notebody:focus { outline: 0; background: none; }

  .quote-sheet { border: 0; border-radius: 0; margin: 0; padding: 7mm 13mm 6mm;
    font-size: 9.6pt; line-height: 1.4; page-break-inside: avoid; }

  /* ★スマホから印刷すると、画面幅が狭いせいで上の
     @media (max-width: 720px) が同時に効いてしまい、縦積みのまま2枚に分かれる。
     紙は必ずA4の横幅があるので、印刷では横並びに戻す。 */
  .qs-top, .qs-mid { flex-direction: row; }
  .qs-right { flex: 0 0 46%; }
  .qs-midR { flex: 0 0 34%; }
  .qs-lead { margin-left: 3em; }
  .qs-staff { text-align: center; }
  .qs-toname span { min-width: 12em; }

  .qs-title { font-size: 17pt; }
  .qs-dateline { margin-top: 6mm; }
  .qs-toname { font-size: 12pt; margin-top: 5mm; }
  .qs-top { margin-top: 3mm; }
  .qs-right .qs-co { font-size: 13pt; }
  .qs-mid { margin-top: 2.5mm; }
  .qs-subject { margin-top: 5mm; padding: 1.4mm 1mm; font-size: 9.4pt; }
  .qs-head { font-size: 9.4pt; }
  .qs-head th, .qs-head td { padding: 1.4mm 1mm; }
  .qs-total { margin-top: 5mm; padding: 1.8mm 1mm; }
  .qs-total b { font-size: 16pt; }
  .qs-staff { margin-top: 6mm; }
  .qs-tbl { margin-top: 5mm; font-size: 9pt; }
  .qs-tbl th, .qs-tbl td { padding: 1.2mm 1.6mm; }
  .qs-tbl .qs-pad td { height: 5mm; }
  .qs-note { margin-top: 4mm; }
  .qs-notelbl { padding: 1mm 2mm; font-size: 8.8pt; }
  .qs-notebody { font-size: 8.8pt; padding: 1.6mm 2mm; min-height: 0; }
}

/* 見積書ページの操作バーと、直接編集できることを示す下線 */
.q-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.q-bar .btn { flex: 0 1 auto; width: auto; }
.btn-toquote { border-color: #fbcfe8; background: #fdf2f8; color: #9d174d; }
.btn-toquote:hover { background: #fce7f3; }
/* 直せる場所が見て分かるように、うすい下線を出す（印刷には出さない） */
.quote-sheet [contenteditable] { border-bottom: 1px dashed #cbd5e1; min-width: 2em; }
.quote-sheet td[contenteditable], .quote-sheet .qs-notebody { border-bottom: 0; background: #fcfdff; }
.quote-sheet td[contenteditable]:hover, .quote-sheet .qs-notebody:hover { background: #f1f7ff; }
.quote-sheet [data-ph]:empty::before { content: attr(data-ph); color: #9aa4b2; font-weight: 400; font-size: .8rem; }

.qs-noco { color: #b45309; background: #fffbeb; border-radius: 6px; padding: 4px 7px; margin-top: 6px; font-size: .72rem; }
#qAddRow { margin-top: 8px; }

/* スマホでだけ出す案内（PDFの送り方） */
.sp-only { display: none; }
@media (max-width: 720px) { .sp-only { display: block; } }
.pdf-tip { background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 11px; padding: 12px 13px; margin: 10px 0 12px; }
.pdf-tip-t { font-size: .82rem; font-weight: 800; color: var(--accent-d); margin-bottom: 7px; }
.pdf-tip-l { margin: 0; padding-left: 1.25em; font-size: .78rem; line-height: 1.75; color: #1e3a5f; }
.pdf-tip-l li { margin-bottom: 3px; }
.pdf-tip-n { margin-top: 8px; font-size: .74rem; line-height: 1.7; color: #334155; }

/* 手書き風の丸いアイコン（絵文字は機種で形が変わるので使わない） */
.bi { width: 21px; height: 21px; flex: none; }
.bi-sm { width: 17px; height: 17px; }
.btn-ico { display: inline-flex; align-items: center; justify-content: center; gap: 9px; }
.btn-go.btn-ico .bi { width: 23px; height: 23px; }
.pdf-tip-t { display: flex; align-items: center; gap: 7px; }
.hint-ico .bi { vertical-align: -3px; margin-right: 5px; }
@media print {
  .quote-sheet [contenteditable] { border-bottom: 0 !important; background: none !important; }
  .quote-sheet [data-ph]:empty::before { content: ""; }
  .qs-attn.is-empty, .qs-staff.is-empty { display: none !important; }
}

/* 一覧で「どの案件か」を出す欄（事業所＋品目） */
.case-cell { min-width: 180px; }
.case-place { display: block; font-weight: 700; font-size: .84rem; color: #0f172a; line-height: 1.4; }
.case-items { display: block; font-size: .74rem; color: var(--accent-d); margin-top: 2px; }
.case-none { color: var(--sub); font-size: .78rem; }
@media (max-width: 720px) {
  .case-cell { min-width: 0; }
  .case-place { font-size: .88rem; }
  .case-items { font-size: .78rem; }
}

/* 共有保存に添える「取引・頻度・コメント」 */
.sh-meta { background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 12px; }
.sh-meta label { font-size: .78rem; }
.sh-meta textarea { min-height: 54px; }
/* 一覧に出る 取引区分 と コメント */
.case-tag { display: inline-block; margin-top: 4px; font-size: .7rem; font-weight: 700; color: #7c3aed;
  background: #f3e8ff; border-radius: 999px; padding: 2px 9px; }
.case-memo { display: block; margin-top: 4px; font-size: .74rem; color: #475569; line-height: 1.5; }
/* 共有一覧のボタン（📄見積書・🔗リンク・×） */
.sh-acts { white-space: nowrap; }
.sh-acts .hist-open { margin-right: 4px; }
@media (max-width: 720px) {
  .sh-acts { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
  .sh-acts .hist-open { margin-right: 0; }
}

/* 説明は折りたたむ（文字が多いと読みにくい、というユーザー指摘 2026-10-29） */
.help { margin-top: 10px; }
.help > summary { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; list-style: none;
  font-size: .78rem; font-weight: 700; color: var(--accent-d); background: #eef3fe;
  border-radius: 999px; padding: 4px 12px; user-select: none; }
.help > summary::-webkit-details-marker { display: none; }
.help > summary::before { content: "？"; font-weight: 800; }
.help > summary::after { content: "▾"; font-size: .7rem; }
.help[open] > summary::after { content: "▴"; }
.help > summary:hover { background: #dbe8fd; }
.help-body { font-size: .78rem; color: var(--sub); line-height: 1.75; margin-top: 8px;
  padding: 10px 12px; background: #f8fafc; border-radius: 9px; }
.help-body b { color: #344054; }

/* 人数・台数を数で選ぶ（なるべくシンプルに。2026-10-29） */
.count-pick { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.cp-btn { width: 42px; height: 42px; border: 1px solid var(--line); background: #fff; border-radius: 10px;
  font-size: 1.2rem; font-weight: 800; color: var(--accent-d); cursor: pointer; line-height: 1; }
.cp-btn:hover { background: #eef3fe; border-color: var(--accent); }
.cp-n { min-width: 64px; text-align: center; }
.cp-n b { font-size: 1.5rem; font-weight: 800; }
.cp-n span { font-size: .8rem; color: var(--sub); margin-left: 3px; }
.cp-max { font-size: .74rem; color: var(--sub); }
.count-veh { margin-bottom: 8px; }
/* 必ず会社へ戻る、の注釈 */
.note-fixed { font-size: .8rem; color: #475569; background: #f8fafc; border: 1px solid var(--line);
  border-radius: 9px; padding: 8px 11px; margin-top: 12px; }
.note-fixed b { color: #0f172a; }
/* 高速料金の調べ方（トラックカーナビへ） */
.btn-toll { display: flex; align-items: center; gap: 9px; width: 100%; margin-top: 10px;
  background: #eef3fe; color: var(--accent-d); border: 1px solid #bfdbfe; text-decoration: none;
  font-size: .92rem; font-weight: 700; padding: 12px 14px; border-radius: 10px; }
.btn-toll:hover { background: #dbe8fd; }
.btn-toll .bi { width: 20px; height: 20px; flex: none; }
.btn-toll span { flex: 1 1 auto; }
.btn-toll i { font-style: normal; font-size: .85rem; color: var(--sub); }

/* 📊 利益を3段で出す（2026-11-03） */
.profit-hero .goal { margin-top: 14px; padding-top: 13px; border-top: 1px solid rgba(255,255,255,.28); text-align: left; }
.mg-ttl { font-size: .76rem; opacity: .85; margin-bottom: 7px; }
.mg-step { display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 7px 0; border-bottom: 1px dashed rgba(255,255,255,.22); }
.mg-step:last-of-type { border-bottom: 0; }
.mg-k { min-width: 0; flex: 1 1 auto; }
.mg-k b { display: block; font-size: .82rem; font-weight: 700; }
.mg-k span { display: block; font-size: .68rem; opacity: .75; margin-top: 1px; line-height: 1.5; }
.mg-val { flex: 0 0 auto; text-align: right; }
.mg-val b { font-size: 1.3rem; font-weight: 800; }
.mg-val span { display: block; font-size: .7rem; opacity: .8; }
.mg-step.ng .mg-val b { color: #fecaca; }
.mg-goal { font-size: .82rem; margin-top: 10px; padding-top: 9px; border-top: 1px solid rgba(255,255,255,.28); }
.mg-goal b { font-size: 1rem; font-weight: 800; }
.mg-goal span { display: block; font-size: .72rem; opacity: .8; margin-top: 2px; }
.goal-set { display: inline-block; margin-top: 6px; font-size: .76rem; color: #fff; opacity: .9; text-decoration: underline; }
.goal-set:hover { opacity: 1; }
/* 赤字のときは下地が赤くなるので、バーの色だけ調整 */
.profit-hero.loss .goal-bar { background: rgba(255,255,255,.3); }

/* 実額／目安のしるし（③は按分なので目安だと明示する・2026-11-03） */
.mg-tag { font-style: normal; font-size: .62rem; font-weight: 700; border-radius: 999px; white-space: nowrap;
  padding: 1px 7px; margin-left: 6px; vertical-align: middle; }
.mg-tag.real { background: rgba(255,255,255,.26); }
.mg-tag.est { background: rgba(253,230,138,.34); }
.mg-note { font-size: .7rem; opacity: .8; line-height: 1.6; margin-top: 9px; }
.mg-note b { opacity: 1; font-weight: 700; }

/* 3段を同じ大きさで。②だけ枠で「基準」と分かるようにする（2026-11-03） */
.profit-hero .amt:empty { display: none; }
.profit-hero .rate { font-size: .86rem; opacity: .92; }
.mg-step.main { background: rgba(255,255,255,.14); border-radius: 10px;
  padding: 9px 11px; margin: 4px -4px; border-bottom: 0; }
.mg-step.main .mg-k b { font-size: .9rem; }
.mg-step.main .mg-val b { font-size: 1.5rem; }

/* 各段の「どういうお金か」の一行と、中身の折りたたみ（2026-11-03） */
.mg-k span i { display: block; font-style: normal; opacity: .82; margin-top: 2px; }
.mg-help { margin-top: 10px; }
.mg-help > summary { background: rgba(255,255,255,.2); color: #fff; }
.mg-help > summary:hover { background: rgba(255,255,255,.3); }
.mg-help .help-body { background: rgba(0,0,0,.14); color: #fff; font-size: .74rem; }
.mg-help .help-body b { color: #fff; }
