/* ============================================================
   ui.css — v307: 画面の決まりと共通部品（統一された見た目）
   使い方: ページの入れ物（.page）に class="ui2" を付けると、この決まりで描く。
   決まり（引き継ぎメモ §6「画面の決まり（v307〜）」と同じ）:
     1. ページの頭: 題名（絵文字なし）＋ 1 行の説明 ＋ 右に操作。くわしい決まりは「？ 使い方」（.ui-help → .ui-help-pop）
     2. 数字のタイル（.ui-tiles > .ui-tile）: ラベル／数字／補足。押せるタイルは絞り込み
     3. 絞り込み（.ui-chips > .ui-chip）: 1 列。選択中は黒。右に検索（.ui-search）
     4. カード（.ui-card）: 白・1px の枠。見出しは細い（.ui-card-h）。色の帯・黒い帯は使わない。重要度は左の線だけ（.ui-card.alert）
     5. 表（.ui-table）: 見出し行は薄い背景。数字は右寄せ（.num）。区分の行は薄い帯（.ui-divider）
     6. 状態のバッジ（.ui-badge）: 5 色だけ。b-todo=要対応（赤）／b-doing=進行中（橙）／b-done=済（緑）／b-closed=閉じた（灰）／b-info=情報（青）
     7. ボタン: 主（btn-primary）・副（btn-secondary）・控えめ（btn-ghost）・危険（btn-danger）の 4 つ。btn-success / btn-info / btn-danger-outline は副・危険に寄せる。絵文字なし
     8. 空のとき（.ui-empty）: 1 行＋必要なら主ボタン 1 つ。アイコンなし
     9. 文章: 画面の補足は 1 行まで（.ui-note）。決まり・例外は「？ 使い方」へ
    10. スマホ: 黒い帯（題名）／タイル 2 列／チップは横スクロール／行は 2 段（.ui-row）
   ============================================================ */

/* ---------- 1. ページの頭 ---------- */
.ui2 .page-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.ui2 .page-header h2 { font-size: 1.35rem; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 0.2rem; font-family: var(--font-display); }
.ui2 .page-header p { font-size: 0.85rem; color: var(--text-muted); margin: 0; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; line-height: 1.5; }
.ui2 .page-header .ui-actions { display: flex; gap: 0.5rem; align-items: center; flex: none; margin-top: 0.15rem; }
.ui-help { display: inline-flex; align-items: center; gap: 0.3rem; border: 1px solid var(--border); background: var(--bg-card); color: var(--text-secondary); border-radius: 999px; padding: 0.1rem 0.6rem 0.1rem 0.35rem; font-size: 0.78rem; cursor: pointer; font-family: inherit; line-height: 1.5; }
.ui-help:hover { border-color: var(--border-hover); background: var(--bg-section); }
.ui-help b { display: inline-grid; place-items: center; width: 1.05rem; height: 1.05rem; border-radius: 50%; background: var(--bg-section); font-weight: 700; font-size: 0.72rem; color: var(--text-secondary); }
.ui-help-wrap { position: relative; display: inline-block; }
.ui-help-pop { display: none; position: absolute; left: 0; top: calc(100% + 0.4rem); width: min(440px, 86vw); background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 0.8rem 1rem; box-shadow: 0 10px 30px rgba(0,0,0,0.12); font-size: 0.82rem; color: var(--text-secondary); z-index: 60; line-height: 1.65; text-align: left; }
.ui-help-pop.open { display: block; }
.ui-help-pop b { color: var(--text-primary); }
.ui-help-pop .l { display: block; margin: 0 0 0.45rem; }
.ui-help-pop .l:last-child { margin-bottom: 0; }

/* ---------- 2. 数字のタイル ---------- */
.ui-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.75rem; margin-bottom: 1rem; }
.ui-tile { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 0.7rem 0.9rem; min-width: 0; }
.ui-tile.click { cursor: pointer; }
.ui-tile.click:hover { border-color: var(--border-hover); background: var(--bg-hover); }
.ui-tile.on { border-color: var(--text-primary); box-shadow: inset 0 0 0 1px var(--text-primary); }
.ui-tile .k { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ui-tile .v { font-size: 1.5rem; font-weight: 700; font-family: var(--font-display); font-variant-numeric: tabular-nums; line-height: 1.2; margin-top: 0.1rem; color: var(--text-primary); }
.ui-tile .v.warn, .ui-tile .v.text-danger { color: var(--error); }
.ui-tile .s { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.1rem; min-height: 1.1em; }

/* ---------- 3. 絞り込み ---------- */
.ui-chips { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.9rem; }
.ui-chip { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.3rem 0.75rem; border-radius: 999px; border: 1px solid var(--border); background: var(--bg-card); font-size: 0.8rem; color: var(--text-secondary); cursor: pointer; font-family: inherit; line-height: 1.3; white-space: nowrap; }
.ui-chip:hover { border-color: var(--border-hover); background: var(--bg-section); }
.ui-chip.on, .ui-chip.active { background: var(--text-primary); color: #fff; border-color: var(--text-primary); font-weight: 600; }
.ui-chip .n { background: var(--bg-section); color: var(--text-secondary); border-radius: 999px; padding: 0 0.4rem; font-size: 0.72rem; line-height: 1.4; }
.ui-chip.on .n, .ui-chip.active .n { background: rgba(255,255,255,0.22); color: #fff; }
.ui-chip.warn { border-color: var(--error-light); color: var(--error-dark); }
.ui-chip.warn.on, .ui-chip.warn.active { background: var(--error); border-color: var(--error); color: #fff; }
.ui-tile .v .u { font-size: 0.72rem; font-weight: 500; color: var(--text-muted); margin-left: 0.25rem; font-family: var(--font-sans); }
.ui-search { display: flex; align-items: center; gap: 0.4rem; border: 1px solid var(--border); background: var(--bg-card); border-radius: 8px; padding: 0 0.6rem; height: 34px; font-size: 0.85rem; color: var(--text-muted); min-width: 240px; margin-left: auto; }
.ui-search input { border: none; outline: none; background: transparent; font-size: 0.85rem; flex: 1; min-width: 0; font-family: inherit; color: var(--text-primary); height: 100%; }
.ui-search input::placeholder { color: var(--text-muted); }
.ui-count { font-size: 0.8rem; color: var(--text-muted); white-space: nowrap; }
.ui-toolbar { display: flex; align-items: center; gap: 0.5rem 0.75rem; flex-wrap: wrap; margin-bottom: 0.9rem; }
.ui-toolbar .ui-chips { margin-bottom: 0; flex: 1 1 auto; min-width: 0; }
.ui-toolbar-r { display: flex; align-items: center; gap: 0.75rem; margin-left: auto; }
.ui-toolbar .ui-search { margin-left: 0; }
.ui-search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }

/* ---------- 4. カード ---------- */
.ui2 .ui-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; margin-bottom: 1rem; box-shadow: none; }
.ui2 .ui-card-h { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.65rem 1rem; border-bottom: 1px solid var(--border); font-weight: 600; font-size: 0.95rem; color: var(--text-primary); background: var(--bg-card); }
.ui2 .ui-card-h .sub { font-weight: 400; color: var(--text-muted); font-size: 0.8rem; margin-left: 0.5rem; }
.ui2 .ui-card-h .ui-right { display: flex; align-items: center; gap: 0.5rem; }
.ui2 .ui-card.alert { border-left: 3px solid var(--error); }
.ui2 .ui-card-b { padding: 0.75rem 1rem; }
.ui-cnt { display: inline-flex; align-items: center; justify-content: center; min-width: 1.6rem; height: 1.4rem; padding: 0 0.45rem; border-radius: 999px; background: var(--bg-section); color: var(--text-secondary); font-size: 0.78rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.ui-cnt.warn { background: var(--error-light); color: var(--error); }
.ui-cnt.hot { background: var(--primary); color: #fff; }

/* ---------- 5. 表 ---------- */
.ui2 .ui-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.ui2 .ui-table th { text-align: left; font-weight: 500; color: var(--text-muted); font-size: 0.75rem; padding: 0.55rem 0.9rem; background: var(--bg-section); border-bottom: 1px solid var(--border); white-space: nowrap; }
.ui2 .ui-table td { padding: 0.6rem 0.9rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.ui2 .ui-table tbody tr:last-child td { border-bottom: none; }
.ui2 .ui-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.ui2 .ui-table tr.clickable:hover td, .ui2 .ui-table tr[onclick]:hover td { background: var(--bg-hover); }
.ui2 .ui-divider td { background: var(--bg-section); color: var(--text-secondary); font-size: 0.78rem; padding: 0.4rem 0.9rem; }
.ui2 .ui-divider td .btn { margin-left: 0.5rem; }
.ui-kind { display: inline-block; padding: 0.1rem 0.45rem; border-radius: 5px; background: var(--bg-section); color: var(--text-secondary); font-size: 0.72rem; margin-right: 0.4rem; white-space: nowrap; vertical-align: middle; }
.ui-muted { color: var(--text-muted); font-size: 0.8rem; }
.ui-warn { color: var(--error); font-weight: 600; }
.ui-sub { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.1rem; }

/* ---------- 6. 状態のバッジ ---------- */
.ui-badge, .ui-badge.badge { display: inline-flex; align-items: center; justify-content: center; gap: 0.3rem; padding: 0.12rem 0.55rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; white-space: nowrap; line-height: 1.5; vertical-align: middle; min-width: 0; }
.ui-badge.dot::before { content: ""; width: 0.42rem; height: 0.42rem; border-radius: 50%; background: currentColor; flex: none; }
.ui-badge.b-todo { background: var(--error-light); color: var(--error-dark); }
.ui-badge.b-doing { background: var(--primary-light); color: var(--primary-dark); }
.ui-badge.b-done { background: var(--success-light); color: var(--success-dark); }
.ui-badge.b-closed { background: var(--bg-section); color: var(--text-tertiary); }
.ui-badge.b-info { background: var(--info-light); color: var(--info-dark); }

/* ---------- 7. ボタン（この決まりの中では 4 つだけ。大きさは標準と小） ---------- */
.ui2 .btn { height: 36px; padding: 0 0.9rem; font-size: 0.875rem; font-weight: 600; border-radius: 8px; gap: 0.35rem; box-shadow: none; transition: background 0.15s, border-color 0.15s; }
.ui2 .btn-sm { height: 30px; padding: 0 0.65rem; font-size: 0.8rem; border-radius: 7px; }
.ui2 .btn-primary { background: var(--primary); color: #fff; box-shadow: none; }
.ui2 .btn-primary:hover { background: var(--primary-dark); transform: none; box-shadow: none; }
.ui2 .btn-secondary, .ui2 .btn-success, .ui2 .btn-info, .ui2 .btn-phone, .ui2 .btn-map { background: var(--bg-card); color: var(--text-primary); border: 1px solid var(--border); }
.ui2 .btn-secondary:hover, .ui2 .btn-success:hover, .ui2 .btn-info:hover { background: var(--bg-section); border-color: var(--border-hover); color: var(--text-primary); }
.ui2 .btn-ghost { background: transparent; color: var(--text-secondary); border: 1px solid transparent; }
.ui2 .btn-ghost:hover { background: var(--bg-section); }
.ui2 .btn-danger, .ui2 .btn-danger-outline { background: var(--bg-card); color: var(--error); border: 1px solid var(--error); }
.ui2 .btn-danger:hover, .ui2 .btn-danger-outline:hover { background: var(--error-bg); border-color: var(--error); color: var(--error-dark); }
.ui2 .btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- 8. 空のとき ---------- */
.ui-empty { padding: 1.6rem 1rem; text-align: center; color: var(--text-muted); font-size: 0.875rem; display: flex; flex-direction: column; align-items: center; gap: 0.6rem; }
.ui2 .empty-state { padding: 1.6rem 1rem; }
.ui2 .empty-state-icon { display: none; }
.ui2 .empty-state-title { font-size: 0.875rem; font-weight: 400; color: var(--text-muted); margin: 0; }
.ui2 .empty-state-description, .ui2 .empty-state-desc { display: none; }

/* ---------- 9. 文章 ---------- */
.ui-note { font-size: 0.8rem; color: var(--text-muted); margin: 0 0 0.75rem; }

/* ---------- 10. スマホの行 ---------- */
.ui-row { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--border); background: var(--bg-card); }
.ui-row:last-child { border-bottom: none; }
.ui-row.clickable { cursor: pointer; }
.ui-row .t { font-weight: 600; font-size: 0.9rem; min-width: 0; }
.ui-row .m { color: var(--text-muted); font-size: 0.78rem; margin-top: 0.1rem; }
.ui-row > div:first-child { min-width: 0; flex: 1; }
.ui-row .ui-right { display: flex; flex-direction: column; align-items: flex-end; gap: 0.35rem; flex: none; }
.ui-rows { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; margin-bottom: 0.9rem; }
.ui-rows .ui-divider-row { background: var(--bg-section); color: var(--text-secondary); font-size: 0.76rem; padding: 0.4rem 0.9rem; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }

@media (max-width: 768px) {
  .ui2 .page-header { display: none; }
  .ui2 .ui-mobile-head { display: flex; gap: 0.5rem; align-items: center; padding: 0.6rem 0.75rem 0; }
  /* タイルは 1 列に並べて横にスクロール（4〜5 枚でも縦に伸びない）。補足は出さない */
  .ui-tiles { display: flex; overflow-x: auto; gap: 0.5rem; padding: 0.75rem 0.75rem 0; margin-bottom: 0.6rem; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .ui-tiles::-webkit-scrollbar { display: none; }
  .ui-tile { flex: 0 0 auto; min-width: 118px; padding: 0.5rem 0.7rem; border-radius: 10px; }
  .ui-tile .v { font-size: 1.25rem; }
  .ui-tile .s { display: none; }
  .ui-chips { flex-wrap: nowrap; overflow-x: auto; padding: 0 0.75rem; margin-bottom: 0.6rem; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .ui-chips::-webkit-scrollbar { display: none; }
  .ui-search { margin: 0 0.75rem 0.6rem; min-width: 0; }
  .ui-rows { margin: 0 0.75rem 0.9rem; }
  .ui-note { padding: 0 0.75rem; }
  .ui-help-pop { position: fixed; left: 12px; right: 12px; top: auto; width: auto; max-height: 60vh; overflow: auto; }
  .ui2 .ui-card, .ui2 > .card, .ui2 .card.mobile-only { margin: 0 0.75rem 0.9rem; }
  .ui2 #ordersMobileList { padding: 0 0.75rem 0.9rem; }
}

/* ============================================================
   11. 既存の部品を決まりに写す（.ui2 の中だけ。古い class 名のまま新しい見た目にする）
   ============================================================ */
/* カード（.card / .card-header / .card-title）: 白・細い枠・細い見出し。色の帯（card--accent-*）はやめる */
.ui2 .card { padding: 0; box-shadow: none; border-radius: 12px; border: 1px solid var(--border); margin-bottom: 1rem; overflow: hidden; }
.ui2 .card-header { margin: 0; padding: 0.6rem 1rem; min-height: 0; background: var(--bg-card); border-bottom: 1px solid var(--border); border-radius: 0; gap: 0.75rem; flex-wrap: wrap; }
.ui2 .card-header--light { background: var(--bg-card); }
.ui2 .card-title { font-size: 0.95rem; font-weight: 600; color: var(--text-primary); display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin: 0; }
.ui2 .card-header .sub, .ui2 .card-title .sub { font-weight: 400; color: var(--text-muted); font-size: 0.8rem; }
.ui2 .card-header .sub a { color: var(--primary); text-decoration: none; }
.ui2 .card-header .sub a:hover { text-decoration: underline; }
.ui2 .card-header .btn { height: 30px; padding: 0 0.65rem; font-size: 0.8rem; }
.ui2 .ui-chevron { color: var(--text-muted); font-size: 0.75rem; }
.ui2 .card.ui-alert { border-left: 4px solid var(--error); }
.ui2 .card.ui-alert .card-title { color: var(--error); }
.ui2 .card-body { padding: 0.75rem 1rem; }
/* 件数の印を古い .badge で出している所 */
.ui2 .badge.ui-cnt { min-width: 1.6rem; height: 1.4rem; padding: 0 0.45rem; font-size: 0.78rem; font-weight: 600; }
/* 表（.table）: 見出し行は薄い背景・細い線。箱の影はカードに任せる */
.ui2 .table-container { border: none; border-radius: 0; box-shadow: none; background: transparent; overflow-x: auto; }
.ui2 .table th { background: var(--bg-section); color: var(--text-muted); font-weight: 500; font-size: 0.75rem; padding: 0.55rem 0.9rem; border-bottom: 1px solid var(--border); }
.ui2 .table td { padding: 0.6rem 0.9rem; border-bottom: 1px solid var(--border); font-size: 0.875rem; }
.ui2 .table tbody tr:last-child td { border-bottom: none; }
.ui2 .booking-table th, .ui2 .booking-table td { padding: 0.6rem 0.9rem; }
.ui2 .parts-table td { padding: 0.6rem 0.9rem; }
/* 空の表示（古い .empty-state） */
.ui2 .empty-state { padding: 1.6rem 1rem; }
.ui2 .empty-state-icon { display: none; }
.ui2 .empty-state-title { font-size: 0.875rem; font-weight: 400; color: var(--text-muted); margin: 0; }
.ui2 .empty-state-description, .ui2 .empty-state-desc { display: none; }
/* 書類発行: 種類の印・状態・入金・期限 → 灰の種類 ＋ 5 色のバッジ */
.ui2 .doc-kind { background: var(--bg-section) !important; color: var(--text-secondary) !important; border-radius: 5px; padding: 0.1rem 0.45rem; font-size: 0.72rem; font-weight: 500; }
.ui2 .doc-state, .ui2 .doc-pay, .ui2 .doc-due, .ui2 .est-stat { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.12rem 0.55rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; white-space: nowrap; line-height: 1.5; vertical-align: middle; }
.ui2 .doc-state::before, .ui2 .doc-pay::before, .ui2 .est-stat::before { content: ""; width: 0.42rem; height: 0.42rem; border-radius: 50%; background: currentColor; flex: none; }
.ui2 .doc-state.new { background: var(--error-light); color: var(--error-dark); }
.ui2 .doc-state.issued { background: var(--primary-light); color: var(--primary-dark); }
.ui2 .doc-state.sent { background: var(--success-light); color: var(--success-dark); }
.ui2 .doc-pay.unpaid { background: var(--bg-section); color: var(--text-tertiary); }
.ui2 .doc-pay.paid { background: var(--success-light); color: var(--success-dark); }
.ui2 .doc-due { background: var(--bg-section); color: var(--text-secondary); }
.ui2 .doc-due.over { background: var(--error-light); color: var(--error-dark); }
.ui2 .est-stat.draft { background: var(--primary-light); color: var(--primary-dark); }
.ui2 .est-stat.sent { background: var(--success-light); color: var(--success-dark); }
.ui2 .est-stat.issued { background: var(--primary-light); color: var(--primary-dark); }
.ui2 .est-stat.conv { background: var(--info-light); color: var(--info-dark); }
.ui2 .est-stat.rej, .ui2 .est-stat.expired { background: var(--bg-section); color: var(--text-tertiary); }
.ui2 .est-doc-notice { margin: 0 0 0.9rem; background: var(--primary-light); border-left: 3px solid var(--primary); }
/* 書類発行の表・行（schedule-gantt.css の .estimates-table を決まりに） */
.ui2 .estimates-table-wrap { padding: 0; overflow-x: auto; }
.ui2 .estimates-table { border: none; border-radius: 0; }
.ui2 .estimates-table th { padding: 0.55rem 0.9rem; font-size: 0.75rem; font-weight: 500; }
.ui2 .estimates-table td { padding: 0.6rem 0.9rem; font-size: 0.875rem; }
.ui2 .estimates-table tbody tr:hover { background: var(--bg-hover); }
.ui2 .estimates-table tbody tr:last-child td { border-bottom: none; }
.ui2 .est-name { font-weight: 600; }
.ui2 .est-tel { color: var(--text-secondary); }
@media (min-width: 1300px) {
  .ui2 .est-tel, .ui2 .est-date, .ui2 .est-deadline { white-space: nowrap; }
  .ui2 .estimates-table td.est-name { min-width: 170px; }
}
.ui2 .est-deadline.warn { color: var(--error); }
.ui2 .est-sent-done { color: var(--text-muted); font-weight: 500; padding: 0; }
.ui2 .estimates-table tr.est-divider td, .ui2 #estimatesList > .est-divider { background: var(--bg-section); color: var(--text-secondary); font-size: 0.78rem; font-weight: 500; padding: 0.45rem 0.9rem; }
.ui2 #estimatesList > .est-divider { margin: 0; border-radius: 0; border-bottom: 1px solid var(--border); }
.ui2 .est-fold-btn { background: var(--bg-card); color: var(--text-secondary); border: 1px solid var(--border); border-radius: 6px; padding: 0.1rem 0.55rem; font-size: 0.76rem; font-weight: 500; margin-left: 0.6rem; }
.ui2 .est-conv-sub { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }
.ui2 .est-sub { font-size: 0.75rem; color: var(--text-muted); }
.ui2 .doc-mismatch { color: var(--error-dark); }
/* スマホのカード（.est-card）を行に */
.ui2 .est-card { border: none; border-left: none; border-bottom: 1px solid var(--border); border-radius: 0; margin: 0; padding: 0.7rem 0.9rem; background: var(--bg-card); }
.ui2 .est-card:last-child { border-bottom: none; }
.ui2 .est-card:hover, .ui2 .est-card:active { background: var(--bg-hover); }
.ui2 .est-card-name { font-size: 0.9rem; font-weight: 600; }
.ui2 .est-card-tel { color: var(--text-muted); }
.ui2 .est-card-actions { gap: 0.4rem; flex-wrap: wrap; }
/* 絞り込み（見積／請求書・領収書／期限切れ）: 描画した行の表示を切り替える */
#estimatesList.kind-estimate [data-doc-type], #estimatesList.kind-doc .est-row:not([data-doc-type]), #estimatesList.kind-doc .est-card:not([data-doc-type]), #estimatesList.kind-doc .est-divider { display: none !important; }
#estimatesList.kind-doc .est-expired-row { display: none !important; }
#estimatesList.kind-expired .est-fold-btn { display: none; }
#estimatesList.kind-expired .est-row:not(.est-expired-row), #estimatesList.kind-expired .est-card:not(.est-expired-row), #estimatesList.kind-expired .est-divider:not([data-key="expired"]) { display: none !important; }
#estimatesList.kind-expired .est-expired-row { display: table-row !important; }
#estimatesList.kind-expired .est-card.est-expired-row { display: block !important; }
/* 発注管理: 案件の印（pa-ready）・チップ（pa-chip）・部品の印（pa-tag）を 5 色に。表の案件の行は薄い帯 ＋ 左の線 */
.ui2 .pa-ready { font-size: 0.75rem; font-weight: 600; padding: 0.12rem 0.55rem; gap: 0.3rem; }
.ui2 .pa-ready::before { content: ""; width: 0.42rem; height: 0.42rem; border-radius: 50%; background: currentColor; flex: none; }
.ui2 .pa-ready.red { background: var(--error-light); color: var(--error-dark); }
.ui2 .pa-ready.yellow { background: var(--primary-light); color: var(--primary-dark); }
.ui2 .pa-ready.gray { background: var(--bg-section); color: var(--text-tertiary); }
.ui2 .pa-ready.green { background: var(--info-light); color: var(--info-dark); }
.ui2 .pa-ready.ok { background: var(--success-light); color: var(--success-dark); }
.ui2 .pa-ready.closed { background: var(--bg-section); color: var(--text-tertiary); }
.ui2 .pa-chips { padding: 0; gap: 0.4rem; font-size: 0.75rem; }
.ui2 .pa-chip { font-weight: 600; padding: 0.1rem 0.55rem; display: inline-flex; align-items: center; gap: 0.3rem; }
.ui2 .pa-chip::before { content: ""; width: 0.42rem; height: 0.42rem; border-radius: 50%; background: currentColor; flex: none; }
.ui2 .pa-chip.red { background: var(--error-light); color: var(--error-dark); }
.ui2 .pa-chip.yel { background: var(--primary-light); color: var(--primary-dark); }
.ui2 .pa-chip.gray { background: var(--bg-section); color: var(--text-tertiary); }
.ui2 .pa-chip.ok { background: var(--info-light); color: var(--info-dark); }
.ui2 .pa-chip.done { background: var(--success-light); color: var(--success-dark); }
.ui2 .pa-chips-note { font-size: 0.74rem; color: var(--error-dark); }
.ui2 .pa-tag { font-weight: 600; padding: 0.05rem 0.5rem; }
.ui2 .pa-tag.red { background: var(--error-light); color: var(--error-dark); }
.ui2 .pa-tag.yellow { background: var(--primary-light); color: var(--primary-dark); }
.ui2 .pa-tag.gray { background: var(--bg-section); color: var(--text-tertiary); }
.ui2 .pa-tag.new { background: var(--info-light); color: var(--info-dark); }
.ui2 tr.pa-bk > td { background: var(--bg-section); border-top: 1px solid var(--border); padding-top: 0.45rem; padding-bottom: 0.45rem; }
.ui2 tr.pa-bk.red > td:first-child { box-shadow: inset 3px 0 0 var(--error); }
.ui2 tr.pa-bk.yellow > td:first-child { box-shadow: inset 3px 0 0 var(--primary); }
.ui2 tr.pa-bk.gray > td:first-child { box-shadow: inset 3px 0 0 var(--border-hover); }
.ui2 tr.pa-bk.green > td:first-child { box-shadow: inset 3px 0 0 var(--info); }
.ui2 tr.pa-bk.ok > td:first-child { box-shadow: inset 3px 0 0 var(--success); }
.ui2 tr.pa-bk.closed > td:first-child { box-shadow: inset 3px 0 0 var(--text-disabled); }
.ui2 tr.pa-bk.stock > td:first-child { box-shadow: none; }
.ui2 .pa-bk-name { font-weight: 600; }
.ui2 .pa-bk-open { color: var(--primary); text-decoration: none; font-weight: 600; }
.ui2 .pa-bk-open::after { content: " ›"; }
.ui2 tr.pa-pt > td:first-child { padding-left: 1.6rem; }
.ui2 .pa-pt-reg { font-size: 0.72rem; color: var(--text-muted); }
.ui2 .orders-table { min-width: 960px; }
.ui2 .orders-table .btn-sm { height: 30px; padding: 0 0.5rem; font-size: 0.78rem; }
.ui2 .mobile-card.pa-bk-card { border-left-width: 3px; }
.ui2 .mobile-card.pa-bk-card.green { border-left-color: var(--info); }
.ui2 .mobile-card.pa-bk-card.gray { border-left-color: var(--border-hover); }
.ui2 div.pa-red, .ui2 .mobile-card.pa-red { background: var(--error-bg); box-shadow: inset 3px 0 0 var(--error); }
.ui2 div.pa-yel, .ui2 .mobile-card.pa-yel { background: var(--primary-light); box-shadow: inset 3px 0 0 var(--primary); }
/* 架電案件: 要対応の札・日程の調整の表・自分宛ての部品・ゴミ箱の行 */
.ui2 .pa-alert-item, .ui2 .ui-alert-item { display: flex; align-items: center; gap: 0.75rem; background: var(--error-bg); border-left: 3px solid var(--error); border-radius: 8px; padding: 0.6rem 0.9rem; font-size: 0.875rem; }
.ui2 .ui-alert-item.overdue { background: var(--error-light); }
/* 1 行の知らせ（押すとそのページへ） */
.ui2 .ui-line { display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 0.9rem; border-radius: 8px; background: var(--primary-light); border-left: 3px solid var(--primary); cursor: pointer; margin-bottom: 1rem; font-size: 0.875rem; }
.ui2 .ui-line-link { font-size: 0.8rem; color: var(--primary); font-weight: 600; white-space: nowrap; }
.ui2 .parts-cust-name { font-weight: 600; font-size: 0.875rem; }
.ui2 .parts-phone { color: var(--text-muted); }
.ui2 .parts-dt-bad { font-size: 0.75rem; font-weight: 600; padding: 0.12rem 0.55rem; border-radius: 999px; }
.ui2 .parts-dt-bad.ok { background: var(--bg-section); color: var(--text-secondary); }
.ui2 .parts-dt-bad.warn { background: var(--primary-light); color: var(--primary-dark); transform: none; }
.ui2 .parts-dt-bad.warn:hover { transform: none; background: var(--primary-light); }
.ui2 .parts-row.pa-red td { background: var(--error-bg); }
.ui2 .parts-row.pa-yel td { background: var(--primary-light); }
.ui2 .parts-row.pa-red td:first-child { box-shadow: inset 3px 0 0 var(--error); }
.ui2 .parts-row.pa-yel td:first-child { box-shadow: inset 3px 0 0 var(--primary); }
.ui2 .pa-mypart { padding: 0.6rem 0.9rem; }
.ui2 .trash-row { padding: 0.6rem 0.9rem; }
.ui2 .trash-ch { background: var(--bg-section) !important; color: var(--text-secondary) !important; border-radius: 5px !important; font-weight: 500; }
.ui2 .trash-row:last-child { border-bottom: none; }
.ui2 .booking-table tr.clickable { cursor: pointer; }
.ui2 .booking-table .ui-badge { min-width: 0; }
.ui2 .booking-table td:last-child { white-space: normal; }
@media (max-width: 768px) {
  .ui2 .btn { width: auto; }
  .ui2 .btn-sm { height: 36px; padding: 0 0.8rem; }
  .ui-toolbar { flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 0.5rem; margin-bottom: 0.6rem; }   /* wrap のままだと列の幅が中身の幅になる */
  .ui-toolbar .ui-chips { margin: 0; }
  .ui-toolbar .ui-toolbar-r { flex-direction: column; align-items: stretch; gap: 0.35rem; margin: 0 0.75rem; }
  .ui-toolbar-r .ui-select { height: 40px; }
  .ui-toolbar .ui-search { margin: 0; }
  .ui-toolbar .ui-count { padding: 0; }
  .ui2 #ordersMobileList .ui-note { padding: 0; }
  .ui-search input { font-size: 16px; }
  .ui2 .pa-mypart .btn { width: 100%; }
  .ui2 .ui-empty .btn { width: auto; }
  .ui2 .main-tabs { margin: 0.6rem 0.75rem; }
  .ui2 .main-tab { font-size: 0.78rem; padding: 8px 0; min-width: 0; display: inline-flex; align-items: center; justify-content: center; gap: 0.25rem; white-space: nowrap; }
  .ui2 .main-tab .n { background: var(--bg-card); border: 1px solid var(--border); color: var(--text-secondary); border-radius: 999px; padding: 0 0.4rem; font-size: 0.7rem; line-height: 1.4; font-weight: 600; }
  .ui2 .main-tab.active .n { background: var(--text-primary); color: #fff; border-color: var(--text-primary); }
  .ui2 .booking-card { border-radius: 12px; }
  .ui2 .booking-card.urgent { border-left: 3px solid var(--primary); }
  .ui2 .booking-card-time { font-size: 0.95rem; color: var(--text-primary); }
  .ui2 .action-btn { height: 36px; font-size: 0.85rem; border-radius: 8px; }
  .ui2 .action-btn.primary { background: var(--primary); }
  .ui2 .mobile-card { border-radius: 12px; }
  .ui2 .estimates-table-wrap { padding: 0; }
  .ui2 .est-card-actions .btn { width: auto; }
}

/* ============================================================
   12. v308: スケジュール・TS点検・未収金・顧客・作業報告・在庫 の写し層
   ============================================================ */
/* ツールバーの中の選択（並び順など） */
.ui-select { height: 34px; padding: 0 1.8rem 0 0.6rem; font-size: 0.85rem; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-card); color: var(--text-primary); font-family: inherit; width: auto; min-width: 0; }
.ui-select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
/* 古い .badge--* の修飾を 5 色に（到着の印・戻し・報告済 など） */
.ui2 .badge.badge--sm { padding: 0.12rem 0.55rem; font-size: 0.75rem; font-weight: 600; min-width: 0; }
.ui2 .badge--success { background: var(--success-light); color: var(--success-dark); }
.ui2 .badge--warn { background: var(--primary-light); color: var(--primary-dark); }
.ui2 .badge--danger { background: var(--error-light); color: var(--error-dark); }
.ui2 .badge--info, .ui2 .badge--purple { background: var(--info-light); color: var(--info-dark); }
.ui2 .badge--gray { background: var(--bg-section); color: var(--text-tertiary); }
.ui2 .badge-prepaid { background: var(--success-light); color: var(--success-dark); border-radius: 999px; font-size: 0.72rem; }
/* 部品の印（スケジュールの行・カード）: 5 色 */
.ui2 .pa-mark { font-weight: 600; font-size: 0.75rem; border-radius: 6px; padding: 0.12rem 0.55rem; margin: 0.3rem 0 0; }
.ui2 .pa-mark.red { background: var(--error-light); color: var(--error-dark); }
.ui2 .pa-mark.yellow { background: var(--primary-light); color: var(--primary-dark); }
.ui2 .pa-mark .pa-who { font-weight: 500; }
/* 部品の箱（今後の予約の行） */
.ui-parts-box { margin-top: 0.4rem; padding: 0.35rem 0.6rem; background: var(--bg-section); border-radius: 6px; border-left: 2px solid var(--border-hover); font-size: 0.78rem; }
.ui-parts-box .ui-parts-line { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.1rem; }
.ui-parts-box .ui-parts-name { font-weight: 600; color: var(--text-primary); }
/* 未収金: 行はカードの中の行（箱・赤い線はやめる） */
.ui2 .unpaid-list { padding: 0; }
.ui2 .unpaid-row { border: none; border-bottom: 1px solid var(--border); border-radius: 0; margin: 0; padding: 0.7rem 1rem; box-shadow: none; background: var(--bg-card); }
.ui2 .unpaid-row:last-child { border-bottom: none; }
.ui2 .unpaid-row:hover { border-color: var(--border); box-shadow: none; background: var(--bg-hover); }
.ui2 .unpaid-row.overdue { background: var(--error-bg); }
.ui2 .unpaid-row.overdue:hover { background: var(--error-light); }
.ui2 .unpaid-customer { font-weight: 600; font-size: 0.9rem; }
.ui2 .unpaid-badge { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.12rem 0.55rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; white-space: nowrap; line-height: 1.5; }
.ui2 .unpaid-badge::before { content: ""; width: 0.42rem; height: 0.42rem; border-radius: 50%; background: currentColor; flex: none; }
.ui2 .unpaid-badge.pending { background: var(--error-light); color: var(--error-dark); }
.ui2 .unpaid-badge.partial { background: var(--primary-light); color: var(--primary-dark); }
.ui2 .unpaid-tag { background: var(--bg-section); color: var(--text-secondary); border-radius: 5px; font-weight: 500; }
.ui2 .unpaid-row-amounts { border-top: 1px dashed var(--border); padding-top: 0.5rem; margin-top: 0.5rem; }
.ui2 .unpaid-overdue-note { margin: 0; border-radius: 0; background: var(--error-bg); border-left: 3px solid var(--error); border-bottom: 1px solid var(--border); }
.ui2 .recv-due { border-radius: 999px; font-size: 0.72rem; }
.ui2 .recv-due.over { background: var(--error-light); color: var(--error-dark); }
/* 在庫: サマリーの数字はタイル、タブは細い下線 */
.ui2 .inv2-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.75rem; margin-bottom: 1rem; }
.ui2 .inv2-stat { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 0.7rem 0.9rem; }
.ui2 .inv2-stat-l { font-size: 0.75rem; color: var(--text-muted); font-weight: 400; margin: 0; }
.ui2 .inv2-stat-v { font-size: 1.5rem; font-weight: 700; font-family: var(--font-display); line-height: 1.2; margin-top: 0.1rem; }
.ui2 .inv-tab-bar { border-bottom: 1px solid var(--border); gap: 0.25rem; margin-bottom: 1rem; }
.ui2 .inv-tab { height: 40px; padding: 0 1rem; font-size: 0.875rem; gap: 0.4rem; }
.ui2 .inv-tab.active { color: var(--text-primary); border-bottom-color: var(--primary); font-weight: 600; }
.ui2 .inv2-grid .card { margin-bottom: 0; }
.ui2 .inv2-card-h { font-weight: 600; margin-bottom: 0.4rem; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.ui2 .inv2-card-h .sub { font-weight: 400; color: var(--text-muted); font-size: 0.78rem; }
/* 顧客: 表の行・スマホのカード */
.ui2 .phone-link { color: var(--text-secondary); text-decoration: none; }
.ui2 .phone-link:hover { text-decoration: underline; }
/* スマホ: 日付の見出し・カードの印の列（絵文字の代わりに文字の印） */
@media (max-width: 768px) {
  .ui2 .date-section-header { padding: 0.5rem 0.25rem; margin-top: 0.5rem; font-size: 0.82rem; }
  .ui2 .mobile-card-meta { grid-template-columns: auto 1fr; align-items: baseline; }
  .ui2 .mobile-card-meta dt { color: var(--text-secondary); background: var(--bg-section); border-radius: 5px; padding: 0.05rem 0.4rem; font-size: 0.7rem; justify-self: start; }
  .ui2 .mobile-card .ui-badge { margin-left: 0.5rem; }
  .ui2 .unpaid-row { padding: 0.7rem 0.9rem; }
  .ui2 .inv2-stats { display: flex; overflow-x: auto; gap: 0.5rem; scrollbar-width: none; }
  .ui2 .inv2-stat { flex: 0 0 auto; min-width: 118px; padding: 0.5rem 0.7rem; }
  .ui2 .inv2-stat-v { font-size: 1.25rem; }
  .ui2 .ui-tile .v#tsStatRate + .s { display: block; }
}
/* スケジュールの表: 名前・担当の列は折り返さない */
@media (min-width: 1100px) { #schedulePage.ui2 .table td:nth-child(2) { min-width: 150px; } }
#schedulePage.ui2 .table td:nth-child(5), #schedulePage.ui2 .table td:nth-child(1) { white-space: nowrap; }
.ui2 .sched-event-row td { background: var(--bg-section); }
.ui2 .ts-expired-row td { background: var(--error-bg); }
/* 在庫（v308）: サマリー・全在庫・仕入れ・在庫移動・棚卸の写し層 */
.ui2 .inv2-toolbar { gap: 0.6rem; margin-bottom: 0.75rem; }
.ui2 .inv2-toolbar label { color: var(--text-secondary); white-space: nowrap; }
.ui2 .inv2-matrix thead th, .ui2 .inv2-matrix .inv2-sticky { background: var(--bg-card); }
.ui2 .inv2-matrix thead th { background: var(--bg-section); }
.ui2 .inv2-matrix thead th .ui-kind { margin-right: 0.3rem; }
.ui2 .inv2-row.low td { background: var(--error-bg); }
/* パーツの詳細パネルは body の直下（.ui2 の外）*/
.inv2-panel { box-shadow: -8px 0 24px rgba(0,0,0,0.08); border-left: 1px solid var(--border); }
.inv2-panel .inv2-stats { grid-template-columns: repeat(4, 1fr); }
.inv2-panel .modal-close { color: var(--text-muted); background: transparent; }
.inv2-panel .modal-close:hover { color: var(--text-primary); background: var(--bg-section); }
.ui2 .inv-pick-sel { border-radius: 12px; }
.ui2 .purchase-mobile-card { border: 1px solid var(--border); border-left-width: 1px; padding: 0.7rem 0.9rem; margin-bottom: 0.5rem; }
.ui2 .pmc-tag.pmc-tag-dest { background: transparent; color: var(--text-secondary); padding: 0; font-weight: 500; font-size: 0.74rem; display: inline-flex; align-items: center; }
.ui2 .pmc-tags { align-items: center; gap: 0.5rem; }
.ui2 .alert-mobile-banner { background: var(--error-bg); border: 1px solid var(--error-light); color: var(--error); border-radius: 10px; }
.ui2 .alert-mobile-card { border: 1px solid var(--border); border-left: 4px solid var(--error); border-radius: 12px; }
.ui2 .amc-stat-r { color: var(--error); }
.ui2 .amc-actions .amc-btn { flex: 1; }
.ui2 .cm-loc-card { border: 1px solid var(--border); border-radius: 12px; }
.ui2 .cm-loc-card.warehouse, .ui2 .cm-loc-card.vehicle { border-left: 1px solid var(--border); }
.ui2 .cm-loc-card:active { background: var(--bg-section); }
.ui2 .cm-loc-name .ui-kind { margin-right: 0.35rem; }
.ui2 .omp-row { border: 1px solid var(--border); border-left-width: 1px; border-radius: 12px; }
.ui2 .omp-row.low { background: var(--error-bg); border-color: var(--error-light); }
.ui2 .omp-qty { color: var(--text-primary); font-weight: 700; }
.ui2 .omp-row.low .omp-qty { color: var(--error); }
.ui2 .omp-warn { margin-top: 0.25rem; }
.ui2 .omt-select, .ui2 .omt-search { border-radius: 8px; height: 40px; font-size: 16px; }
.ui2 .overview-mobile-toolbar { background: transparent; border: none; padding: 0 0 0.5rem; }
.ui2 .overview-mobile-list { background: transparent; padding: 0; }
.ui2 #myVehicleStock .card { margin: 0.75rem 0.75rem 0; }
.ui2 #myVehicleStock .card-header { display: flex; justify-content: space-between; align-items: center; }
.ui2 .part-item-arrow { color: var(--text-muted); font-size: 1.1rem; }
.ui2 .count-mobile-section-h, .ui2 .purchase-mobile-section-h { font-size: 0.82rem; color: var(--text-muted); font-weight: 500; }
.ui2 .inv2-matrix thead th.inv2-sticky { background: var(--bg-section); }
.ui2 .inv2-matrix tbody .inv2-row.low td.inv2-sticky { background: var(--error-bg); }
.ui2 .inv-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-top: 1.5rem; }
.ui2 .inv-two-col .card { margin-bottom: 0; }
.ui2 .inv2-grid .ui-empty { padding: 1rem; }
/* スマホの段階式フォーム（仕入れ・在庫移動）: 以前は class だけで見た目の定義が無かった */
.ui2 .step-section { padding: 0.75rem 0.9rem; border-bottom: 1px solid var(--border); }
.ui2 .step-section:last-child { border-bottom: none; }
.ui2 .step-header { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.6rem; font-weight: 600; font-size: 0.9rem; }
.ui2 .step-number { width: 22px; height: 22px; border-radius: 50%; background: var(--bg-section); color: var(--text-secondary); font-size: 0.75rem; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex: none; }
.ui2 .step-header.active .step-number { background: var(--primary); color: #fff; }
.ui2 .step-header.completed .step-number { background: var(--success); color: #fff; }
.ui2 .parts-list, .ui2 .location-list { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; overflow-y: auto; max-height: 50vh; background: var(--bg-card); }
.ui2 .part-item, .ui2 .location-item { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; padding: 0.65rem 0.8rem; border-bottom: 1px solid var(--border); cursor: pointer; }
.ui2 .part-item:last-child, .ui2 .location-item:last-child { border-bottom: none; }
.ui2 .part-item:active, .ui2 .location-item:active { background: var(--bg-section); }
.ui2 .location-item.disabled { color: var(--text-muted); cursor: default; }
.ui2 .location-item-stock { font-weight: 600; white-space: nowrap; }
.ui2 .location-item-stock.zero { color: var(--text-muted); font-weight: 400; }
.ui2 .part-item-name { font-weight: 600; font-size: 0.88rem; }
.ui2 .part-item-category { font-size: 0.74rem; color: var(--text-muted); margin-top: 0.1rem; }
.ui2 .selected-part-info { background: var(--bg-section); border-radius: 8px; padding: 0.5rem 0.75rem; font-size: 0.85rem; margin-bottom: 0.6rem; }
.ui2 .selected-part-info .label { font-size: 0.72rem; color: var(--text-muted); }
.ui2 .selected-part-info .value { font-weight: 600; }
.ui2 .step-actions { display: flex; gap: 0.5rem; justify-content: space-between; margin-top: 0.75rem; }
@media (max-width: 768px) {   /* 在庫の PC／スマホの切替は元の 768px に合わせる（iPad 縦 = 768px） */
  .ui2 .inv-pc-only { display: none !important; }
  .ui2 .inv-mobile-only { display: block; }
}
@media (max-width: 768px) {
  .ui2 .inv-section > .card { margin: 0 0.75rem 0.9rem; }
  .ui2 .purchase-mobile-wrap, .ui2 .count-mobile-wrap, .ui2 #invSection-overview .inv-mobile-only, .ui2 #invSection-alert .inv-mobile-only { padding: 0 0.75rem; }
  .ui2 .inv-tab-bar { padding: 0 0.75rem; overflow-x: auto; scrollbar-width: none; }
}
.ui2 .purchase-mobile-list { background: transparent; padding: 0; }
.ui2 .count-mobile-section { border: 1px solid var(--border); border-radius: 12px; }
.ui2 .cm-section-h { font-size: 0.8rem; font-weight: 600; color: var(--text-secondary); }
.ui2 .cm-loc-card { margin: 0.5rem 0.6rem; padding: 0.75rem 0.9rem; }
/* TS点検の表: 期限・顧客（電話）・エリアの列は折り返さない */
#tsmarkPage.ui2 .table td:nth-child(1) { white-space: nowrap; }
#tsmarkPage.ui2 .table td:nth-child(2) { min-width: 150px; }
#tsmarkPage.ui2 .table td:nth-child(3) { min-width: 6em; }
#tsmarkPage.ui2 .table td:nth-child(7) .btn { margin: 0.1rem 0.15rem 0.1rem 0; }
@media (min-width: 1280px) { #tsmarkPage.ui2 .table td:nth-child(4), #tsmarkPage.ui2 .table td:nth-child(5), #tsmarkPage.ui2 .table td:nth-child(7) { white-space: nowrap; } }
/* 1280px 未満: 前回点検の列を隠し、操作のボタンは折り返す（箱の外にはみ出さない） */
@media (max-width: 1279px) { #tsmarkPage.ui2 .table th:nth-child(5), #tsmarkPage.ui2 .table td:nth-child(5) { display: none; } }
/* r1: スマホの段階式フォームの数量のボタン（CSS が無かった）・TS点検のスマホの余白 */
.ui2 .qty-stepper { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.ui2 .qty-stepper .qty-btn, .ui2 .qty-stepper .qty-btn-quick { height: 36px; min-width: 44px; padding: 0 0.6rem; border: 1px solid var(--border); background: var(--bg-card); color: var(--text-primary); border-radius: 8px; font-size: 0.9rem; font-family: inherit; cursor: pointer; }
.ui2 .qty-stepper .qty-btn-quick { font-size: 0.8rem; color: var(--text-secondary); }
.ui2 .qty-stepper .qty-input { height: 36px; width: 72px; text-align: center; border: 1px solid var(--border); border-radius: 8px; font-size: 16px; font-family: inherit; }
#tsmarkPage.ui2 #tsMobileList { padding: 0 0.75rem; }

/* ===== 13. v309: ダッシュボード（ガント）で終わった案件を押したときの「予約を確認」（js/booking-view.js。モーダルに ui2 を付けて写し層を効かせる） =====
   お客様／予約／（請求と入金）／報告 のカード。.bv-grid = 「ラベル｜値」の 2 列、.bv-rows = 明細の表（.sub 補足行・.grp 台の見出し・.total 合計） */
#bookingViewModal .modal-body { background: var(--bg-section); padding: 0.9rem 1rem; }
#bookingViewModal .card { margin-bottom: 0.75rem; }
#bookingViewModal .card:last-child { margin-bottom: 0; }
#bookingViewModal .card-header .sub { margin-left: auto; }
#bookingViewModal .card > .ui-empty { padding: 1.1rem 1rem; }
.bv-grid { display: grid; grid-template-columns: 6.5em 1fr; gap: 0.35rem 0.75rem; font-size: 0.875rem; align-items: baseline; }
.bv-grid .k { color: var(--text-muted); font-size: 0.78rem; }
.bv-grid .pre { white-space: pre-wrap; word-break: break-word; }
.bv-grid .text-danger { color: var(--error); }
.bv-grid .text-muted { color: var(--text-muted); }
.bv-rows { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; margin: 0.6rem 0; }
.bv-row { display: flex; justify-content: space-between; gap: 0.75rem; padding: 0.45rem 0.75rem; font-size: 0.875rem; border-bottom: 1px solid var(--border); background: var(--bg-card); }
.bv-row:last-child { border-bottom: none; }
.bv-row.sub { color: var(--text-secondary); font-size: 0.82rem; }
.bv-row.grp { background: var(--bg-section); color: var(--text-secondary); font-size: 0.76rem; padding: 0.3rem 0.75rem; }
.bv-row.total { background: var(--bg-section); font-weight: 700; }
.bv-row .mono, .bv-row.total span:last-child { font-variant-numeric: tabular-nums; white-space: nowrap; }
.bv-row .text-muted { color: var(--text-muted); }
.bv-line { font-size: 0.85rem; color: var(--text-secondary); display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.bv-note { margin-top: 0.6rem; padding: 0.5rem 0.75rem; background: var(--bg-section); border-radius: 8px; font-size: 0.85rem; white-space: pre-wrap; }
.bv-note.warn { background: var(--error-bg); color: var(--error-dark); }
#bookingViewModal .modal-footer { gap: 0.5rem; }
#bookingViewModal .modal-footer .sp { flex: 1; }
#bookingViewModal .card-header .sub .btn { margin-left: 0.4rem; vertical-align: middle; }   /* 報告が 2 回以上のときの「開く」 */
@media (max-width: 768px) {
  .bv-grid { grid-template-columns: 5.5em 1fr; }
  #bookingViewModal .modal-title .cf-sub-title { display: none; }
  #bookingViewModal .modal-footer { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
  #bookingViewModal .modal-footer.bv-foot-empty { display: none; }   /* 読み込み中・読めないとき（「閉じる」はスマホでは出さない。← と ✕ で閉じる） */
  #bookingViewModal .card-header .sub .btn { height: 36px; padding: 0 0.6rem; }   /* 「開く」は指で押せる大きさに（r2 L19） */
  #bookingViewModal .modal-footer .btn { width: 100%; margin: 0; }
  #bookingViewModal .modal-footer .btn-primary { grid-column: 1 / -1; }
  #bookingViewModal .modal-footer .sp { display: none; }
}

/* ===== 14. v310: スタッフの案件カード（#staffJobModal.ui2。js/staff-job.js）=====
   お伺い先のカードに「ナビで開く」（青）「電話する」（緑）。下は「次にやること」1 つだけ（到着を記録／取り消す（8 秒）／作業報告を書く）。
   ナビのアプリを選ぶ下のシート（.sj-sheet）と、到着の直後の取り消し（.sj-foot-undo） */
#staffJobModal .modal-content { position: relative; }
#staffJobModal .modal-body { background: var(--bg-section); padding: 0.9rem 1rem 1rem; }
#staffJobModal.ui2 .cf-life { margin: -0.9rem -1rem 0.75rem; }
#staffJobModal .card { margin-bottom: 0.75rem; }
#staffJobModal .sj-head { margin-bottom: 0.6rem; }
#staffJobModal .sj-time { margin: 0 0 0.75rem; }
#staffJobModal .sj-late { margin: 0 0 0.6rem; }
#staffJobModal .sj-addr { font-size: 1.05rem; font-weight: 600; line-height: 1.4; }
.sj-bldg { margin-top: 0.3rem; font-size: 1rem; display: flex; align-items: center; gap: 0.2rem; }
.sj-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; margin-top: 0.7rem; }   /* minmax(0, …): 320〜360px でもカードからはみ出さない（r3 L4） */
.ui2 .sj-actions .btn { height: 48px; min-width: 0; padding: 0 0.4rem; font-size: 1rem; font-weight: 700; gap: 0.4rem; border: none; color: #fff; border-radius: 12px; }
.ui2 .sj-actions .btn.sj-nav { background: var(--info); }        /* ナビ＝青（分かりやすいように色を付ける。ユーザー 10/21） */
.ui2 .sj-actions .btn.sj-call { background: var(--success-dark); }    /* 電話＝緑（白い文字が読める濃さ。r1 L7） */
.ui2 .sj-actions .btn.sj-nav:hover { background: var(--info-dark); color: #fff; }
.ui2 .sj-actions .btn.sj-call:hover { background: var(--success-dark); filter: brightness(0.92); color: #fff; }
.sj-bldg.sj-note { color: var(--primary-dark); }   /* （ ）の注記（停め方など）。r1 H1 */
.sj-navline { margin-top: 0.4rem; font-size: 0.8rem; color: var(--text-muted); line-height: 1.6; display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; }
.sj-navline-b { display: flex; gap: 0.25rem; }
#staffJobModal.ui2 .sj-navline .btn-ghost { height: 36px; padding: 0 0.6rem; color: var(--primary); font-size: 0.85rem; }   /* 指で押せる大きさ（r1 L8） */
/* アプリが開かなかったとき（iPhone でスキームを送って 2 秒）: 「アプリが開かないときは［ブラウザで開く］」。ボタンは 36px（r2 N9）。アプリから戻ったら消す（r2 N8） */
.sj-fallback { display: none; color: var(--error-dark); }
.sj-fallback.show { display: flex; }
#staffJobModal.ui2 .sj-fallback .btn-ghost { color: var(--error-dark); border-color: var(--error); text-decoration: none; }
.sj-phone { margin-top: 0.3rem; }
.sj-memo2 { font-size: 0.9rem; line-height: 1.5; }
.sj-memo2 > div { white-space: pre-wrap; overflow-wrap: anywhere; }   /* v339: 受付メモの改行（作業報告の備考の見出し）をそのまま（r1 LOW-2） */
.sj-memo2 b { color: var(--text-secondary); font-weight: 600; margin-right: 0.4rem; }
.sj-ng { font-size: 0.78rem; color: var(--error); margin-top: 0.3rem; }
#staffJobModal.ui2 .sj-row { font-size: 0.95rem; }
#staffJobModal.ui2 .sj-row.sj-total span:last-child { color: var(--primary); font-family: inherit; }
#staffJobModal .sj-row.pa-red > span:first-child::before, #staffJobModal .sj-row.pa-yel > span:first-child::before { content: none; }   /* 部品の行の 🔴🟡（style.css）は出さない＝絵文字なし。色の帯と左の線は残る（r2 N16） */
/* 下: 「次にやること」1 つ。下端はセーフエリア＋余白（画面の下端で押さない） */
#staffJobModal .modal-footer { display: block !important; width: 100%; box-sizing: border-box; padding: 12px 16px calc(16px + env(safe-area-inset-bottom, 0px)) !important; background: var(--bg-card); border-top: 1px solid var(--border); box-shadow: 0 -4px 16px rgba(0,0,0,0.06); }
#staffJobModal .modal-footer .btn-primary { width: 100%; height: 56px !important; min-height: 56px !important; font-size: 1.1rem; font-weight: 700; background: var(--primary) !important; border-radius: 14px; border: none; }
#staffJobModal .modal-footer .btn-primary:disabled { opacity: 0.6; }
#staffJobModal .modal-footer .sj-foot-hint { text-align: center; font-size: 0.78rem; color: var(--text-muted); margin-top: 0.4rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#staffJobModal .modal-footer .sj-foot-close { width: 100%; margin-top: 0.5rem; }
/* ナビのアプリを選ぶ（下から出る。初回と「アプリを変える」） */
.sj-sheet-wrap { display: none; }
.sj-sheet-wrap.open { display: block; }
.sj-sheet-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.35); z-index: 3000; }
.sj-sheet { position: fixed; left: 0; right: 0; bottom: 0; max-width: 480px; margin: 0 auto; background: var(--bg-card); border-radius: 16px 16px 0 0; padding: 0.75rem 1rem calc(1rem + env(safe-area-inset-bottom, 0px)); box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.18); z-index: 3001; }
.sj-sheet-h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.6rem; }
.sj-sheet-h h4 { margin: 0; font-size: 1rem; }
.sj-opt { display: flex; align-items: center; justify-content: space-between; width: 100%; height: 56px; border: 1px solid var(--border); border-radius: 12px; padding: 0 1rem; margin-bottom: 0.5rem; font-size: 1rem; background: var(--bg-card); color: var(--text-primary); font-family: inherit; cursor: pointer; }
.sj-opt:active { background: var(--bg-section); }
.sj-opt .ui-kind { margin: 0; }
.sj-sheet-remember { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; color: var(--text-secondary); margin: 0.4rem 0 0.25rem; }
.sj-sheet-remember input { width: 20px; height: 20px; accent-color: var(--primary); flex: none; }
/* 到着の直後 8 秒: 下が「到着 hh:mm を記録［取り消す（8）］」になる（主ボタンの場所には何も置かない＝二度押しで次の画面が開かない。r1 M2） */
.sj-foot-undo { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; min-height: 56px; }
.sj-foot-undo-t { font-weight: 600; font-size: 0.95rem; color: var(--success-dark); }
#staffJobModal .modal-footer .sj-undo-btn { width: auto; flex: none; height: 48px !important; min-height: 48px !important; padding: 0 1rem; border-radius: 12px; font-size: 0.95rem; font-weight: 700; }
#staffJobModal .modal-footer .sj-undo-btn.sj-undo-wait { opacity: 0.45; pointer-events: none; }   /* 到着の直後 0.6 秒は押せない見た目（同じ所の二度押しが「取り消す」に当たらない。r2 N17） */
@media (max-width: 768px) {
  #staffJobModal .modal-footer.sj-foot-empty { display: none !important; }   /* 終わった案件は下に何も無い（PC の「閉じる」はスマホでは出さない） */
  #staffJobModal .modal-footer .btn-primary { background: var(--primary) !important; }
}
@media (max-width: 359px) {
  #staffJobModal.ui2 .sj-actions .btn { font-size: 0.95rem; gap: 0.25rem; padding: 0 0.25rem; }   /* iPhone SE（320px）でも「ナビで開く」「電話する」が切れない（r3 L4） */
}

/* ===== 15. v312: 作業報告の「部品発注」の行（js/report-parts.js。全作業完了 → 部品を発注してお客様に発送／再訪 → 取り寄せる部品）=====
   案件シートの「📦 部品発注」と同じ形（部品名・数量・✕、「🔩 修理項目から」「＋ 追加」）。スタッフには仕入先・仕入値を見せない */
.rp-ship { margin-top: 0.75rem; }
.rp-toggle { display: flex; align-items: center; gap: 0.5rem; font-size: 0.95rem; font-weight: 600; cursor: pointer; flex-wrap: wrap; }
.rp-toggle input { width: 20px; height: 20px; accent-color: var(--primary); flex: none; }
.rp-toggle-sub { font-size: 0.78rem; font-weight: 400; color: var(--text-secondary); }
.rp-box { margin-top: 0.5rem; padding: 0.6rem 0.75rem; background: var(--bg-section); border-radius: 10px; }
.rp-head { display: flex; justify-content: space-between; align-items: center; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.4rem; }
.rp-head .rf-lbl { margin: 0; }
.rp-btns { display: flex; gap: 0.4rem; }
.rp-row { padding: 0.6rem 0.75rem; background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; margin-bottom: 0.5rem; }
.rp-main { display: flex; gap: 0.5rem; align-items: center; }
.modal .rp-main input[data-f="name"], .rp-main input[data-f="name"] { flex: 1 1 auto; width: auto; min-width: 0; font-size: 16px; }
.modal .rp-qty, .rp-qty { flex: 0 0 64px; width: 64px; min-width: 0; padding-left: 0.4rem; padding-right: 0.3rem; font-size: 16px; text-align: center; }
.rp-del { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 1.1rem; padding: 0.25rem; flex: none; }
.rp-price { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-top: 0.45rem; flex-wrap: wrap; }
.rp-price .rf-lbl { margin: 0; }
.rp-price-in { display: flex; align-items: center; gap: 0.3rem; }
.modal .rp-price-in input, .rp-price-in input { flex: 0 0 120px; width: 120px; min-width: 0; font-size: 16px; text-align: right; }
.rp-addr { margin-top: 0.25rem; }
.rp-addr .rf-lbl { margin: 0 0 0.25rem; }
.rp-addr input { width: 100%; font-size: 16px; }
.rp-note { margin-top: 0.5rem; font-size: 0.78rem; color: var(--text-secondary); line-height: 1.5; }
.rp-line { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.75rem; background: rgba(37, 99, 235, 0.07); border-left: 3px solid var(--info); border-radius: 6px; margin-bottom: 0.4rem; font-size: 0.9rem; }
.rp-line .ui-kind { margin: 0; }
.rp-line-n { flex: 1; min-width: 0; }
.rp-row.saved { background: var(--bg-section); }
.rp-row.saved input[readonly] { background: transparent; border-color: transparent; padding-left: 0; }
@media (max-width: 480px) {
  /* r1 L1: スマホでは部品名を 1 行に（390px で 117px しか無かった）。数量・✕ は次の行。✕ は指で押せる大きさ */
  .rp-main { flex-wrap: wrap; }
  .modal .rp-main input[data-f="name"], .rp-main input[data-f="name"] { flex: 1 1 100%; }
  .rp-del { min-width: 44px; min-height: 44px; margin-left: auto; }
  .rp-box .cf-parts-btn, .rp-del { width: auto; }
}

/* v312: 発注管理の「発送待ち（お客様へ）」（js/orders.js）。チップ・案件の印は情報の青、発送済は済の緑 */
.pa-chip.ship { background: var(--info-light, rgba(37, 99, 235, 0.12)); color: var(--info-dark); }
.pa-ready.ship { background: var(--info-light, rgba(37, 99, 235, 0.12)); color: var(--info-dark); }
.ui2 .pa-ready.ship { background: var(--info-light, rgba(37, 99, 235, 0.12)); color: var(--info-dark); }
.pa-ready.ship.ok, .ui2 .pa-ready.ship.ok { background: var(--success-light); color: var(--success-dark); }   /* r1 L4: 発送済は済の緑 */
tr.pa-bk.ship-cust > td:first-child { box-shadow: inset 4px 0 0 var(--info); }
tr.pa-bk.ship-cust.done > td:first-child { box-shadow: inset 4px 0 0 var(--success); }
.mobile-card.pa-bk-card.ship-cust { border-left-color: var(--info); }
.cs-edit { padding: 0.75rem 1rem; }
.cs-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 0.5rem 0.75rem; }
.cs-grid label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.78rem; color: var(--text-secondary); }
.cs-grid input { font-size: 0.9rem; padding: 0.4rem 0.55rem; width: 100%; }
.cs-actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.6rem; }
.cs-actions .ui-muted { font-size: 0.78rem; }
@media (max-width: 768px) { .cs-grid { grid-template-columns: 1fr; } .cs-actions .btn { width: auto; } }

/* ============================================================
   §16 v313: PWA の帯（js/pwa.js）。新しい版の知らせは下ナビの上（PC は下端）、オフラインは上端
   ============================================================ */
.pwa-bar { position: fixed; left: 0; right: 0; z-index: 9000; display: flex; align-items: center; gap: 0.6rem; padding: 0.55rem 1rem; font-size: 0.9rem; font-weight: 600; padding-left: max(1rem, env(safe-area-inset-left)); padding-right: max(1rem, env(safe-area-inset-right)); }
.pwa-bar .dot { width: 8px; height: 8px; border-radius: 50%; background: #fbbf24; flex: none; }
.pwa-bar.update { bottom: 0; background: #1e3a8a; color: #fff; box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.15); padding-bottom: calc(0.55rem + env(safe-area-inset-bottom)); }
.pwa-bar.update .pwa-txt { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }   /* 帯はいつも 1 行（320px でも） */
body.pwa-update-bar .main-content { padding-bottom: 64px; }   /* 帯（約 54px）の下に最後の行が隠れない（PC） */
.pwa-bar.update .pwa-go { width: auto; flex: none; white-space: nowrap; background: #fff; color: #1e3a8a; font-weight: 700; padding: 0.4rem 0.9rem; border-radius: 999px; border: none; font-size: 0.9rem; cursor: pointer; }   /* ボタンは折り返さない（帯はいつも 1 行） */
.pwa-bar.update .pwa-x { width: auto; flex: none; white-space: nowrap; background: none; border: none; color: #c7d2fe; font-size: 1.1rem; padding: 0.2rem 0.3rem; cursor: pointer; min-width: 36px; min-height: 36px; }
.pwa-bar.offline { top: 0; background: rgba(55, 65, 81, 0.94); color: #fff; justify-content: center; font-size: 0.75rem; line-height: 1.3; padding: 0.15rem 0.75rem; padding-top: calc(0.15rem + env(safe-area-inset-top)); white-space: nowrap; overflow: hidden; pointer-events: none; }   /* 細い帯。指は通す（モーダルの ← ✕ を隠しても押せる） */
.pwa-bar.offline span:last-child { overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 768px) {
  .pwa-bar.update { bottom: calc(80px + env(safe-area-inset-bottom)); padding-bottom: 0.55rem; }   /* 下ナビ（80px）の上 */
  body.pwa-update-bar .main-content { padding-bottom: calc(136px + env(safe-area-inset-bottom, 0px)); }   /* 下ナビ 80px ＋ 帯 56px */
  body.pwa-update-bar .fab { bottom: calc(152px + env(safe-area-inset-bottom, 0px)); }   /* 帯（約 54px）が出ている間は＋ボタンを上に（r2 L3。mobile.css の 96px ＋ 56px） */
  body.pwa-update-bar .purchase-fab { bottom: calc(136px + env(safe-area-inset-bottom, 0px)); }   /* schedule-gantt.css の 80px ＋ 56px */
}

/* ============================================================
   17. v356: 残りの 6 画面（ダッシュボード・経営分析・売上・シフト・マスタ・設定）を決まりに
       黒い帯・絵文字の題をやめる。古い class 名はそのまま（JS・テストが使う）。ここで見た目だけ写す
   ============================================================ */
/* 数字の帯（カードの中。色は付けない）: .ui-stats > .ui-stat（.k ラベル / .v 数字） */
.ui-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 0.75rem 1.25rem; padding: 0.8rem 1rem; background: var(--bg-section); border-bottom: 1px solid var(--border); }
.ui-stat .k { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; }
.ui-stat .v { font-size: 1.25rem; font-weight: 700; font-family: var(--font-display); font-variant-numeric: tabular-nums; color: var(--text-primary); line-height: 1.3; }
/* 「〇〇 の売上を表示中」のような、絞り込み中の細い帯 */
.ui-selbar { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; padding: 0.5rem 1rem; background: var(--primary-light); border-bottom: 1px solid var(--border); font-size: 0.85rem; color: var(--text-primary); }
/* 売上: カードの見出しの中の入力（絞り込み）は、見出しの高さに合わせる。売上の画面だけ（ほかの画面の見出しの入力は変えない）。select の ▼ は残す（background-color だけを変える） */
#salesPage.ui2 .card-header .form-input, #salesPage.ui2 .card-header .form-select { height: 32px; padding: 0 0.5rem; font-size: 0.82rem; border-radius: 7px; background-color: var(--bg-card); color: var(--text-primary); border: 1px solid var(--border); }
#salesPage.ui2 .card-header .form-select { padding-right: 1.6rem; background-position: right 0.55rem center; }
.ui2 .sales-filter-bar, .ui2 .sc-ctl { margin-left: auto; }
.ui2 .sc-ctl .inv-tab { height: 30px; border: 1px solid var(--border); border-radius: 7px; background: var(--bg-card); color: var(--text-secondary); font-size: 0.8rem; }
.ui2 .sc-ctl .inv-tab.active { background: var(--text-primary); color: #fff; border-color: var(--text-primary); }
.ui2 #scNote { padding: 0.5rem 1rem; font-size: 0.8rem; }
.ui2 #scBody > .text-secondary, .ui2 #sqBody > .text-secondary { padding: 1rem; }

/* --- 設定 --- */
.ui2 .set-card { max-width: 720px; }
.ui2 .set-card .ui-note { margin-bottom: 0.75rem; line-height: 1.6; }
.ui2 .set-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.ui2 #userInfo > div { padding: 0 !important; }
.ui2 #logoutBtn { margin-top: 0.9rem; }
.ui2 .dev-role-btn { border: 1px solid var(--border); background: var(--bg-card); color: var(--text-primary); }
.ui2 .dev-role-btn.active { background: var(--text-primary); color: #fff; border-color: var(--text-primary); }

/* --- ダッシュボード（dispatch）--- */
.ui2 .qs-wrap { min-width: 260px; }
.ui2 .dispatch-hint { color: var(--text-muted); font-size: 0.8rem; }
.ui2 .dispatch-expand-title { font-weight: 600; font-size: 0.95rem; }

/* --- シフト --- */
.ui2 .shift-page-header-wrap { box-shadow: none; border-radius: 12px; }
.ui2 .shift-month-bar { border-top: none; padding: 0.6rem 1rem; }
.ui2 .shift-view-toggle { background: var(--bg-section); border: 1px solid var(--border); }
.ui2 .shift-view-btn { width: auto; padding: 0 0.7rem; font-size: 0.8rem; color: var(--text-secondary); }
.ui2 .shift-view-btn.active { background: var(--bg-card); color: var(--text-primary); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,0.08); }
.ui2 .shift-filter-bar { box-shadow: none; border-radius: 12px; padding: 0.6rem 1rem; }
.ui2 .shift-table-card { box-shadow: none; border-radius: 12px; }
.ui2 .shift-table-card-header { background: var(--bg-card); border-bottom: 1px solid var(--border); min-height: 0; padding: 0.6rem 1rem; }
.ui2 .shift-table-card-title { color: var(--text-primary); font-size: 0.95rem; }
.ui2 .shift-legend-item { color: var(--text-secondary); }
.ui2 .shift-summary-card { box-shadow: none; }
.ui2 .shift-tbl thead th.shift-staff-col { background: var(--bg-section); color: var(--text-muted); font-weight: 500; }

/* --- マスタ --- */
.ui2 .master-sidenav { box-shadow: none; border-radius: 12px; }
.ui2 .master-content-card { box-shadow: none; border-radius: 12px; }
.ui2 .master-content-card-header { background: var(--bg-card); border-bottom: 1px solid var(--border); min-height: 0; padding: 0.6rem 1rem; }
.ui2 .master-content-card-title { color: var(--text-primary); font-size: 0.95rem; }
.ui2 .master-content-card-title .bm-h-n { color: var(--text-muted); font-weight: 400; }
.ui2 .master-content-card-header .btn { height: 30px; padding: 0 0.65rem; font-size: 0.8rem; }
.ui2 .master-search-input { background: var(--bg-card); }

@media (max-width: 768px) {
  .ui-stats { grid-template-columns: repeat(3, 1fr); gap: 0.6rem 0.75rem; padding: 0.7rem 0.75rem; }
  .ui-stat .v { font-size: 1.05rem; }
  /* 売上: 絞り込みは見出しの下に並べる。表は横に送れる（字を縦に折らない） */
  .ui2 .sales-filter-bar, .ui2 .sc-ctl { margin-left: 0; width: 100%; }
  #salesPage.ui2 .table th, #salesPage.ui2 .table td { white-space: nowrap; }
  #salesPage.ui2 .table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  #salesPage.ui2 .table td[colspan] { white-space: normal; }
  .ui2 .set-card { max-width: none; }
  #settingsPage.ui2 .card-body .ui-note { padding: 0; }   /* 設定: カードの中の説明の文を、二重に字下げしない（設定の画面だけ） */
  #salesPage.ui2 > div > .card { margin: 0 0.75rem 0.9rem; }   /* 売上のカードは、タブの入れ物の中にある（.ui2 > .card が当たらない）→ ほかの画面と同じ余白に */
  .ui2 .master-content-card, .ui2 .master-sidenav, .ui2 .shift-table-card { margin-left: 0.75rem; margin-right: 0.75rem; }
}

/* ---------- 18. v357: 小窓（モーダル）の決まり ----------
   題: 絵文字なし。「◯◯を追加」「◯◯を編集」「◯◯を確認」。
   下のボタン帯（.modal-footer.ui-foot）: 右端 ＝ 主ボタン（追加／保存）・その左 ＝ キャンセル（見るだけの小窓は「閉じる」）・削除は左端に離す（.ui-foot-del）。
   スマホは縦に並べ、主ボタンがいちばん上・キャンセルがその下・削除がいちばん下（並びは HTML と逆 ＝ column-reverse）。
   .ui-foot は「キャンセル → 主ボタン」の順に書いた帯にだけ付ける（受付・作業報告・見積の編集 など、専用の帯には付けない） */
.modal .btn-danger-outline { background: var(--bg-card); color: var(--error); border: 1px solid var(--error); }
.modal .btn-danger-outline:hover { background: var(--error-bg); border-color: var(--error); color: var(--error-dark); }
.modal-footer.ui-foot { flex-wrap: wrap; }
.modal-footer.ui-foot .btn { flex: none; min-width: 96px; }
.modal-footer.ui-foot .ui-foot-del { margin-right: auto; min-width: 0; }
@media (max-width: 768px) {
  .modal .modal-footer.ui-foot { flex-direction: column-reverse; flex-wrap: nowrap; }
  .modal .modal-footer.ui-foot .btn { width: 100%; flex: none; }
  .modal .modal-footer.ui-foot .ui-foot-del { margin-right: 0; }
  .modal .modal-footer .btn.btn-danger-outline { border: 1px solid var(--error); background: var(--bg-card); color: var(--error); }
}

/* ---------- 19. v358: 書類発行のタブ（やること／済み） ----------
   行（.est-row / .est-card）と区切り（.est-divider）に data-tab="todo|done"。#estimatesList に tab-todo / tab-done。絞り込み（kind-*）より後に書く（同じ強さなので、後が勝つ） */
#estimatesPage .est-tabs { margin: 0 0 0.75rem; }
#estimatesPage .est-tabs .ui-cnt { margin-left: 0.25rem; }
#estimatesList.tab-todo [data-tab="done"], #estimatesList.tab-done [data-tab="todo"] { display: none !important; }
@media (max-width: 768px) { #estimatesPage .est-tabs { margin: 0 0 0.5rem; } }

/* ---------- 20. v359: 決済待ち（Square の決済が済むまで、案件を「完了」と出さない） ----------
   バッジは UI.badge の todo（赤。決済中は info ＝ 青）に .hold-badge（config.js の holdBadge）。未収金の行の印 ＝ .unpaid-hold。
   ガントの赤い枠・札は css/schedule-gantt.css（.is-settling / .gantt-hold） */
.hold-badge { white-space: nowrap; }
.unpaid-tag.unpaid-hold, .ui2 .unpaid-tag.unpaid-hold { background: var(--error-bg); color: var(--error-dark); font-weight: 600; }
.bv-note[data-bv="hold"] .bv-hold-act { display: block; margin-top: 0.45rem; }
