/* ==================================================
   haiyer.work 管理画面
   （/assets/style.css のトークン・ボタンを前提に読み込む）
   ================================================== */

/* ---------- ログイン ---------- */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(420px, 100%);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 34px 32px;
}
.login-logo {
  font-size: 22px; font-weight: 900; letter-spacing: -0.01em;
  color: var(--accent); text-decoration: none; display: block; margin-bottom: 4px;
}
.login-title { font-size: 18px; font-weight: 800; margin: 10px 0 4px; }
.login-sub { font-size: 13px; color: var(--ink-3); margin-bottom: 22px; }
.login-field { margin-bottom: 16px; }
.login-card .btn { width: 100%; }

/* ---------- 管理レイアウト ---------- */
.adm-body { background: var(--bg); }
.adm-shell { display: flex; min-height: 100vh; }

.adm-side {
  flex: 0 0 232px;
  background: var(--paper);
  border-right: 1px solid var(--line);
  padding: 22px 16px;
  display: flex; flex-direction: column; gap: 6px;
  position: sticky; top: 0; height: 100vh;
}
.adm-brand {
  font-size: 17px; font-weight: 900; color: var(--ink);
  text-decoration: none; padding: 0 10px 16px;
}
/* ロゴの下線。左が太く右へ細く流れる一本線（public/assets/style.css と同じ形）。
   「OPERATOR CONSOLE」は線の外に出したいので、下線は語だけを囲む内側の要素に載せる。 */
.adm-brand-mark { position: relative; display: inline-block; }
.adm-brand-mark::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 3.5px;
  background: var(--accent); clip-path: polygon(0 0, 100% 38%, 100% 62%, 0 100%);
}
.adm-brand small { display: block; margin-top: 10px; font-size: 11px; font-weight: 700; color: var(--ink-4); letter-spacing: .08em; font-family: var(--font-code); }
.adm-nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px;
  font-size: 14px; font-weight: 700; color: var(--ink-2);
  text-decoration: none; cursor: pointer; border: 0; background: transparent;
  font-family: inherit; width: 100%; text-align: left;
  transition: background .15s, color .15s;
}
.adm-nav-item:hover { background: var(--accent-soft); color: var(--accent-dk); }
.adm-nav-item.is-active { background: var(--accent); color: #fff; }
.adm-nav-item .badge-count {
  margin-left: auto; min-width: 22px; height: 20px; padding: 0 6px;
  border-radius: 999px; background: var(--color-red); color: #fff;
  font-size: 11px; font-weight: 800; display: grid; place-items: center;
  font-family: var(--font-code);
}
.adm-nav-item.is-active .badge-count { background: #fff; color: var(--accent-dk); }
.adm-side-foot { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid var(--line-2); }
.adm-user { font-size: 12px; color: var(--ink-3); margin-bottom: 10px; line-height: 1.5; }
.adm-user b { display: block; color: var(--ink); font-size: 13px; }

.adm-main { flex: 1; min-width: 0; padding: 26px 30px 60px; }
.adm-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.adm-title { font-size: 26px; font-weight: 900; letter-spacing: -0.02em; }
.adm-sub { font-size: 13px; color: var(--ink-3); margin-top: 4px; }

.card {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 22px; box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 18px; }
.card-title { font-size: 15px; font-weight: 800; margin-bottom: 14px; display: flex; align-items: center; gap: 10px; }

/* ---------- 統計カード ---------- */
.stat-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1px; background: var(--line); border: 1px solid var(--line);
  border-radius: 16px; overflow: hidden; margin-bottom: 18px;
}
.stat-cell { background: var(--paper); padding: 16px 18px; }
.stat-cell .k { font-size: 12px; font-weight: 700; color: var(--ink-3); font-family: var(--font-code); }
.stat-cell .v { font-size: 26px; font-weight: 900; letter-spacing: -0.02em; margin-top: 4px; }
.stat-cell.is-accent .v { color: var(--accent); }

/* ---------- 通知ボード ---------- */
.notif-list { display: flex; flex-direction: column; gap: 8px; }
.notif {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 13px 15px; border: 1px solid var(--line); border-radius: var(--radius-md);
  background: #fff; cursor: pointer; text-align: left; font: inherit; width: 100%;
  transition: border-color .15s, background .15s;
}
.notif:hover { border-color: var(--accent-border); background: var(--accent-soft); }
.notif.is-unread { border-color: var(--accent-border); background: color-mix(in oklab, var(--accent) 5%, white); }
.notif-dot { width: 8px; height: 8px; border-radius: 999px; background: var(--line); margin-top: 7px; flex: 0 0 auto; }
.notif.is-unread .notif-dot { background: var(--color-red); }
.notif-body { flex: 1; min-width: 0; }
.notif-title { font-size: 14px; font-weight: 700; color: var(--ink); }
.notif-meta { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.notif-empty { padding: 26px; text-align: center; color: var(--ink-4); font-size: 13px; }

/* ---------- テーブル ---------- */
.table-wrap { overflow-x: auto; }
table.adm-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.adm-table th {
  text-align: left; font-size: 11.5px; font-weight: 700; color: var(--ink-3);
  font-family: var(--font-code); letter-spacing: .04em;
  padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.adm-table td { padding: 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.adm-table tbody tr { cursor: pointer; transition: background .12s; }
.adm-table tbody tr:hover { background: var(--accent-soft); }
.adm-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.adm-table .code { font-family: var(--font-code); font-size: 12px; color: var(--ink-3); }
.empty-row { padding: 40px; text-align: center; color: var(--ink-4); font-size: 13px; }

/* ---------- ステータスバッジ ---------- */
.st {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 800; white-space: nowrap;
  border: 1px solid transparent;
}
.st-new       { background: #fdecea; color: #a3271a; border-color: #f5c2bc; }
.st-reviewing { background: var(--notice-bg); color: var(--notice-ink); border-color: var(--notice-border); }
.st-quoted    { background: var(--accent-soft); color: var(--accent-dk); border-color: var(--accent-border); }
.st-confirmed { background: #e7f7ee; color: #1c7a45; border-color: #b8e3ca; }
.st-completed { background: var(--bg-2); color: var(--ink-2); border-color: var(--line); }
.st-cancelled { background: var(--bg-2); color: var(--ink-4); border-color: var(--line); }
.st-rejected  { background: var(--bg-2); color: var(--ink-4); border-color: var(--line); }

/* ---------- 予約カレンダー ---------- */
.cal-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.cal-title {
  font-size: 16px; font-weight: 800; color: var(--ink);
  min-width: 200px; text-align: center; font-variant-numeric: tabular-nums;
}

/* 月／週／日の切り替え（セグメント） */
.cal-views { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; background: #fff; padding: 3px; gap: 2px; }
.cal-view {
  border: 0; background: transparent; cursor: pointer;
  padding: 0 14px; height: 28px; border-radius: 999px;
  font: inherit; font-size: 13px; font-weight: 700; color: var(--ink-3);
  transition: background .15s, color .15s;
}
.cal-view:hover { background: var(--accent-soft); color: var(--accent-dk); }
.cal-view.is-on { background: var(--accent); color: #fff; }
.cal-nav {
  width: 34px; height: 34px; flex: 0 0 auto;
  border: 1px solid var(--line); border-radius: 10px; background: #fff;
  cursor: pointer; font-size: 20px; line-height: 1; color: var(--ink-2);
  display: inline-flex; align-items: center; justify-content: center;
  transition: border-color .15s, background .15s, color .15s;
}
.cal-nav:hover { border-color: var(--accent-border); background: var(--accent-soft); color: var(--accent-dk); }
.cal-today { margin-left: auto; }

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; }
.cal-head > div {
  text-align: center; font-size: 11.5px; font-weight: 700; color: var(--ink-3);
  padding: 6px 0 8px; font-family: var(--font-code);
}
.cal-head > div.is-sun { color: #c0392b; }
.cal-head > div.is-sat { color: #2a6fb0; }

.cal-body {
  background: var(--line); border: 1px solid var(--line);
  border-radius: 12px; overflow: hidden;
}
.cal-cell {
  background: var(--paper); min-height: 108px;
  padding: 6px 6px 8px; display: flex; flex-direction: column; gap: 5px;
}
.cal-cell.is-out { background: var(--bg-2); }
.cal-cell.is-out .cal-date { color: var(--ink-4); }
.cal-cell.is-today { background: color-mix(in oklab, var(--accent) 7%, white); }
.cal-date {
  font-size: 12.5px; font-weight: 700; color: var(--ink-2);
  font-variant-numeric: tabular-nums; line-height: 1;
}
.cal-cell.is-today .cal-date {
  color: #fff; background: var(--accent); font-weight: 900;
  width: 22px; height: 22px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
}
.cal-chips { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-chip {
  display: flex; align-items: center; gap: 5px; width: 100%;
  padding: 3px 6px; border-radius: 6px; font: inherit; font-size: 11.5px; font-weight: 700;
  border: 1px solid transparent; cursor: pointer; text-align: left; min-width: 0;
  transition: filter .12s;
}
.cal-chip:hover { filter: brightness(.96); }
.cal-chip-t { font-family: var(--font-code); font-size: 10px; opacity: .85; flex: 0 0 auto; }
.cal-chip-n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-more { font-size: 11px; color: var(--ink-3); font-weight: 700; padding: 0 4px; }

/* ---------- 週／日の時間軸 ----------
   左に時刻の目盛り、右に日付ぶんの列。予定は列の中に絶対配置で置き、
   開始時刻を top、拘束時間を height にする（Googleカレンダーと同じ考え方）。 */
.calg { --calg-gut: 58px; border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; background: #fff; }
.calg-head, .calg-udrow, .calg-body {
  display: grid; grid-template-columns: var(--calg-gut) repeat(var(--calg-cols), minmax(0, 1fr));
}
.calg-head { border-bottom: 1px solid var(--line); background: var(--bg-2); }
.calg-dh {
  padding: 7px 4px; text-align: center; font-size: 12px; font-weight: 700; color: var(--ink-3);
  border-left: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 1px;
}
.calg-dh.is-sun { color: #c0392b; }
.calg-dh.is-sat { color: #2a6fb0; }
.calg-dh-d { font-size: 15px; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.calg-dh.is-today .calg-dh-d {
  color: #fff; background: var(--accent); border-radius: 999px;
  width: 26px; height: 26px; line-height: 26px; margin: 0 auto;
}
.calg-gut { border-right: 1px solid var(--line); }
.calg-udrow { border-bottom: 1px solid var(--line); background: var(--bg-2); min-height: 34px; }
.calg-udrow .calg-gut {
  font-size: 10.5px; color: var(--ink-4); font-weight: 700;
  display: flex; align-items: center; justify-content: center; text-align: center;
}
.calg-ud { border-left: 1px solid var(--line-2); padding: 4px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }

.calg-scroll { max-height: 560px; overflow-y: auto; }
.calg-hours { position: relative; }
.calg-hr { height: var(--calg-hour); position: relative; }
.calg-hr span {
  position: absolute; top: -7px; right: 7px;
  font-size: 10.5px; color: var(--ink-4); font-family: var(--font-code);
}
.calg-hr:first-child span { display: none; }   /* 0:00 は列の頭にかぶるので出さない */
/* 同時刻の予定が多いとき、はみ出したブロックが隣の日にかからないよう列で切る */
.calg-col { position: relative; border-left: 1px solid var(--line-2); min-width: 0; overflow: hidden; }
.calg-col.is-today { background: color-mix(in oklab, var(--accent) 5%, white); }
.calg-slot { height: var(--calg-hour); border-bottom: 1px solid var(--line-2); }

.calg-ev {
  position: absolute; overflow: hidden; cursor: pointer; text-align: left;
  border: 1px solid transparent; border-left-width: 3px; border-radius: 6px;
  padding: 2px 5px; margin-left: 2px;
  font: inherit; font-size: 11.5px; line-height: 1.35;
  display: flex; flex-direction: column; gap: 0;
}
/* 同時刻の予定は幅を等分する（重ねない）。件数が多いと細くなるが、
   どれも隠れず必ず押せる。中身は title 属性で読める。 */
.calg-ev:hover { filter: brightness(.96); }
.calg-ev-t { font-family: var(--font-code); font-size: 10px; opacity: .85; }
.calg-ev-n { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calg-ev-s { font-size: 10px; opacity: .8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 900px) {
  .calg { --calg-gut: 44px; }
  .calg-ev { font-size: 10.5px; padding: 1px 3px; }
  .calg-ev-s { display: none; }
}

.cal-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 14px; }
.cal-legend span { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--ink-3); }
.cal-legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; border: 1px solid transparent; }

@media (max-width: 640px) {
  .cal-cell { min-height: 74px; padding: 4px 3px 6px; }
  .cal-chip { padding: 2px 4px; font-size: 10.5px; gap: 3px; }
  .cal-chip-t { display: none; }
  .cal-title { font-size: 14px; min-width: 96px; }
}

/* ---------- フィルタ ---------- */
.filter-bar {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px;
}
.filter-item { display: flex; flex-direction: column; gap: 5px; }
.filter-item label { font-size: 11.5px; font-weight: 700; color: var(--ink-3); }
.filter-item .field-control { height: 40px; font-size: 13.5px; }
.filter-item.grow { flex: 1; min-width: 180px; }
/* 日付・セレクトのピッカー（.pk-field）をフィルタ帯の高さに揃える */
.filter-item .picker { min-width: 186px; }
.filter-item .pk-field { height: 40px; font-size: 13.5px; padding: 0 12px; gap: 8px; }
.filter-item .pk-value { font-weight: 700; }

.pager { display: flex; align-items: center; gap: 12px; margin-top: 16px; font-size: 13px; color: var(--ink-3); }
.pager .btn { height: 36px; padding: 0 14px; font-size: 13px; }

/* ---------- 詳細 ---------- */
/* 予約詳細のヘッダ：名前の横に大きくステータス、右に出口アクション */
.res-head { align-items: flex-start; }
.adm-title .st { vertical-align: middle; margin-left: 8px; }
.st-tag { font-size: 12.5px; }
.st-lg { font-size: 15px; padding: 6px 16px; }
.res-head-side { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.res-acts { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.res-acts-note { font-size: 11.5px; line-height: 1.6; color: var(--ink-4); text-align: right; max-width: 320px; }

/* 予約詳細の下段：社内メモ／対応履歴 */
.detail-foot { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.detail-foot .card + .card { margin-top: 0; }
@media (max-width: 900px) {
  .detail-foot { grid-template-columns: 1fr; }
  .res-head-side { align-items: stretch; width: 100%; }
  .res-acts, .res-acts-note { justify-content: flex-start; text-align: left; max-width: none; }
}

.kv { display: flex; flex-wrap: wrap; gap: 10px 24px; font-size: 14px; }
.kv > div { min-width: 0; }
.kv .k { display: block; font-size: 11.5px; font-weight: 700; color: var(--ink-4); margin-bottom: 2px; }
.kv .v { color: var(--ink); font-weight: 600; word-break: break-word; }

.day-block { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 16px; }
.day-block:first-of-type { border-top: 0; padding-top: 4px; margin-top: 4px; }
.day-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.day-badge { font-family: var(--font-code); font-size: 11.5px; font-weight: 700; color: #fff; background: var(--accent); border-radius: 999px; padding: 3px 11px; }
.day-when { font-size: 13.5px; font-weight: 700; color: var(--ink-2); }
.day-metrics { margin-left: auto; font-size: 12.5px; color: var(--ink-3); }

.memo-area {
  width: 100%; min-height: 110px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--radius-md); background: #fff;
  font: inherit; font-size: 14px; line-height: 1.7; color: var(--ink); resize: vertical;
}
.memo-area:focus { outline: 0; border-color: var(--accent-border); box-shadow: 0 0 0 3px rgba(2,141,174,.10); }

.log-list { display: flex; flex-direction: column; gap: 0; font-size: 13px; }
.log-item { padding: 10px 0; border-bottom: 1px solid var(--line-2); color: var(--ink-2); }
.log-item:last-child { border-bottom: 0; }
.log-item .when { font-size: 11.5px; color: var(--ink-4); font-family: var(--font-code); }

/* ---------- 車種マスタ ---------- */
.vh-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.vh-form-grid .full { grid-column: 1 / -1; }
.inactive-row { opacity: .5; }

/* ---------- 担当ドライバー選択 ---------- */
.drv-picker { display: flex; flex-direction: column; gap: 8px; max-height: 360px; overflow-y: auto; }
.drv-opt {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-md);
  cursor: pointer; transition: border-color .12s, background .12s, box-shadow .12s;
}
.drv-opt:hover { border-color: var(--accent-border); background: var(--accent-soft); }
.drv-opt.is-selected { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.drv-opt > input { margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.drv-main { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1; }
.drv-name { font-weight: 700; font-size: 13.5px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.drv-stats { display: flex; align-items: center; gap: 5px 10px; flex-wrap: wrap; font-size: 12px; }
.drv-metric { color: var(--ink-3); white-space: nowrap; }
.drv-metric b { color: var(--ink); font-size: 13px; }
.drv-badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 999px; line-height: 1.7; }
.drv-badge.is-free { background: #e7f7ee; color: #1c7a45; }
.drv-badge.is-busy { background: #fdecea; color: #c0392b; }
.drv-badge.is-rec  { background: var(--accent-soft); color: var(--accent-dk); border: 1px solid var(--accent-border); }

/* ---------- 会社概要 ---------- */
.pref-groups { display: flex; flex-direction: column; gap: 14px; }
.pref-group { display: grid; grid-template-columns: 108px 1fr; gap: 12px; align-items: start; }
.pref-region { font-size: 12.5px; font-weight: 700; color: var(--ink-3); padding-top: 7px; }
.pref-list { display: flex; flex-wrap: wrap; gap: 7px; }
.pref-chip, .wd-chip {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; user-select: none;
  padding: 5px 11px; border: 1px solid var(--line); border-radius: 999px;
  font-size: 12.5px; background: var(--paper); transition: border-color .12s, background .12s;
}
.pref-chip:hover, .wd-chip:hover { border-color: var(--accent-border); background: var(--accent-soft); }
.pref-chip input, .wd-chip input { accent-color: var(--accent); margin: 0; }
.pref-chip:has(input:checked), .wd-chip:has(input:checked) {
  border-color: var(--accent); background: var(--accent-soft); color: var(--accent-dk); font-weight: 700;
}
.wd-row { display: flex; flex-wrap: wrap; gap: 8px; }
.wd-chip { min-width: 46px; justify-content: center; }
.wd-chip.sun:has(input:checked) { color: var(--color-red); border-color: #f0c0bc; background: #fdecea; }
.wd-chip.sat:has(input:checked) { color: var(--accent-dk); }
.co-sub { padding: 14px 0; border-top: 1px solid var(--line-2); }
.co-sub:first-of-type { border-top: 0; padding-top: 0; }
.co-sub .field-label { margin-bottom: 10px; }
.chip-add { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.chip-list { display: flex; flex-wrap: wrap; gap: 7px; }
.tag-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 6px 4px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  background: var(--bg-2); color: var(--ink-2);
}
.tag-x {
  border: 0; background: transparent; cursor: pointer; color: var(--ink-4);
  font-size: 15px; line-height: 1; padding: 0 3px; border-radius: 50%;
}
.tag-x:hover { color: var(--color-red); }
@media (max-width: 640px) {
  .pref-group { grid-template-columns: 1fr; gap: 6px; }
  .pref-region { padding-top: 0; }
}

/* ---------- AI解析カード / 本見積エディタ ---------- */
.ai-internal { font-size: 11px; font-weight: 700; color: #b26a00; background: #fdf5e7; border-radius: 999px; padding: 2px 9px; margin-left: 8px; }
.ai-req { margin-bottom: 10px; }
.ai-req .k { display: block; font-size: 11.5px; font-weight: 700; color: var(--ink-4); margin-bottom: 3px; }
.ai-req > div:not(.k) { white-space: pre-wrap; line-height: 1.7; color: var(--ink-2); font-size: 13.5px; }
.ai-table { font-size: 13px; }
.ai-table .ai-reason { font-size: 12px; color: var(--ink-3); line-height: 1.6; white-space: pre-wrap; }
.ai-table .ai-x td { background: #fdf5e7; }

.fin-saved { font-size: 11.5px; font-weight: 700; color: #1c7a45; background: #e7f7ee; border-radius: 999px; padding: 2px 10px; margin-left: 6px; }
.fin-sec-t { display: flex; align-items: center; font-size: 12.5px; font-weight: 800; color: var(--ink-3); margin: 16px 0 8px; }
.fin-sec-t:first-child { margin-top: 0; }
.fin-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.fin-table th { font-size: 11px; font-weight: 700; color: var(--ink-4); text-align: left; padding: 4px 6px; }
.fin-table th.num, .fin-table td.num { text-align: right; }
.fin-table td { padding: 4px 6px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.fin-lbl { font-weight: 700; color: var(--ink); }
.fin-in { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font-size: 13.5px; font-family: inherit; width: 110px; text-align: right; background: var(--paper); color: var(--ink); }
.fin-in:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.fin-addons .fin-a-name { width: 100%; text-align: left; }
.fin-addons .fin-a-qty { width: 60px; }
.fin-addons .fin-a-price, .fin-addons .fin-a-sub { width: 96px; }
.fin-yen { color: var(--ink-4); font-size: 12px; margin-right: 2px; }
.fin-total-row { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; padding-top: 12px; border-top: 2px solid var(--accent); font-weight: 800; }
.fin-total-row .fin-total { width: 140px; font-size: 16px; font-weight: 900; color: var(--accent-dk); }
.fin-total-note { font-size: 12px; color: var(--ink-4); margin-top: 6px; }

/* ---------- ダブルブッキング警告 / 実車台帳 ---------- */
.dbl-warn {
  background: #fdecea; color: #b4232a; border: 1px solid #f0c0bc;
  border-radius: var(--radius-md); padding: 10px 12px; font-size: 12.5px; font-weight: 600;
  line-height: 1.6; margin-bottom: 12px;
}
.fleet-type-tag { font-size: 11px; font-weight: 700; color: var(--accent-dk); background: var(--accent-soft); border-radius: 999px; padding: 1px 8px; margin-left: 6px; }

/* ---------- 共通 ---------- */
.row-actions { display: flex; gap: 8px; }
.btn-sm { height: 34px; padding: 0 13px; font-size: 12.5px; }
.muted { color: var(--ink-4); }
.toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 200;
  background: var(--ink); color: #fff; padding: 12px 18px;
  border-radius: 12px; font-size: 13.5px; font-weight: 700;
  box-shadow: 0 10px 30px -10px rgba(0,0,0,.5);
  opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s;
  pointer-events: none;
}
.toast.is-show { opacity: 1; transform: none; }
.toast.is-error { background: var(--color-red); }

.set-note { margin-top: 8px; font-size: 12px; line-height: 1.8; color: var(--ink-3); }
.set-note b { color: var(--accent-dk); }

/* ---------- 見積（統合表示） ---------- */
.adm-quote {
  border: 1px solid var(--accent-border); border-radius: var(--radius-md);
  background: color-mix(in oklab, var(--accent) 5%, white);
  padding: 16px 18px; margin-bottom: 16px;
}
.adm-quote-total { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.adm-quote-total .k { font-size: 12px; font-weight: 700; color: var(--ink-3); }
.adm-quote-total b { font-size: 30px; font-weight: 900; color: var(--accent-dk); letter-spacing: -0.02em; }
.adm-quote-break { display: flex; align-items: stretch; gap: 8px; flex-wrap: wrap; }
.adm-quote-break > span {
  flex: 1 1 150px; background: #fff; border: 1px solid var(--accent-border);
  border-radius: 10px; padding: 9px 12px;
  display: flex; flex-direction: column; gap: 1px;
  font-size: 11.5px; font-weight: 700; color: var(--ink-3);
}
.adm-quote-break > span b { font-size: 16px; font-weight: 900; color: var(--ink); }
.adm-quote-break > span small { font-size: 10.5px; color: var(--ink-4); font-family: var(--font-code); font-weight: 500; }
.adm-quote-break .pl {
  flex: 0 0 auto; background: transparent; border: 0; padding: 0;
  display: grid; place-items: center; font-size: 15px; color: var(--ink-4);
}
.adm-quote-note { margin-top: 10px; font-size: 11.5px; color: var(--ink-4); }

/* ---------- 車種写真の管理 ---------- */
.ph-ov {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(15,25,30,.72); backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 24px;
}
.ph-modal {
  width: min(720px, 100%); max-height: 88vh; overflow: auto;
  background: #fff; border-radius: var(--radius-lg);
  box-shadow: 0 24px 70px -20px rgba(0,0,0,.5);
}
.ph-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 18px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff;
}
.ph-head b { font-size: 15px; font-weight: 800; display: block; }
.ph-sub { font-size: 12px; color: var(--ink-4); }
.ph-body { padding: 18px 20px 22px; }
.ph-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; margin-bottom: 16px; }
.ph-item { position: relative; aspect-ratio: 4/3; border-radius: 10px; overflow: hidden; background: var(--bg-2); border: 1px solid var(--line); }
.ph-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph-del {
  position: absolute; top: 6px; right: 6px; width: 26px; height: 26px;
  border: 0; border-radius: 999px; background: rgba(0,0,0,.6); color: #fff;
  cursor: pointer; display: grid; place-items: center;
}
.ph-del:hover { background: var(--color-red); }
.ph-empty { grid-column: 1/-1; padding: 26px; text-align: center; color: var(--ink-4); font-size: 13px; }
.ph-drop {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 26px; border: 2px dashed var(--accent-border); border-radius: var(--radius-md);
  background: var(--accent-soft); color: var(--accent-dk);
  font-size: 13px; font-weight: 700; cursor: pointer;
  transition: background .15s;
}
.ph-drop:hover { background: color-mix(in oklab, var(--accent) 10%, white); }
.ph-status { margin-top: 10px; font-size: 12.5px; color: var(--ink-3); }

@media (max-width: 820px) {
  .adm-shell { flex-direction: column; }
  .adm-side { position: static; height: auto; flex: none; width: 100%;
    flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px; }
  .adm-brand { padding: 0 8px 0 4px; }
  .adm-brand small { display: none; }
  .adm-nav-item { width: auto; }
  .adm-side-foot { margin: 0 0 0 auto; border: 0; padding: 0; display: flex; align-items: center; gap: 10px; }
  .adm-user { display: none; }
  .adm-main { padding: 20px 16px 50px; }
}

/* ---------- ドライバー打診 ---------- */
.offer-live { font-size: 13.5px; }
.offer-hist { margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 12px; display: flex; flex-direction: column; gap: 7px; }
.offer-hist-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.offer-hist-row .muted { margin-left: auto; }

/* ---------- 予約詳細：折りたたみ＋2ステップ ---------- */
.acc { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); margin-bottom: 16px; overflow: hidden; }
.acc > summary { list-style: none; cursor: pointer; padding: 16px 20px; font-weight: 700; font-size: 15px;
  color: var(--ink-1); display: flex; align-items: center; gap: 8px; }
.acc > summary::-webkit-details-marker { display: none; }
.acc > summary::before { content: '▸'; color: var(--accent); font-size: 12px; transition: transform .15s; }
.acc[open] > summary::before { transform: rotate(90deg); }
.acc-body { padding: 0 20px 20px; }
.fixed-veh { background: var(--bg-2); border-radius: 10px; padding: 10px 14px; font-size: 13.5px; }

.acc-mini { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 10px; }
.acc-mini > summary { list-style: none; cursor: pointer; font-size: 12.5px; color: var(--ink-3); font-weight: 700; }
.acc-mini > summary::-webkit-details-marker { display: none; }
.acc-mini > summary::before { content: '＋ '; color: var(--accent); }
.acc-mini[open] > summary::before { content: '－ '; }

.flow { margin-bottom: 16px; }
.flow-rail { display: flex; align-items: center; gap: 10px; margin: 6px 2px 14px; }
.flow-node { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 700; color: var(--ink-4); white-space: nowrap; }
.flow-node .fn-dot { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  background: var(--bg-2); color: var(--ink-4); border: 1.5px solid var(--line); font-size: 12px; }
.flow-node.active { color: var(--accent-dk); }
.flow-node.active .fn-dot { background: var(--accent); color: #fff; border-color: var(--accent); }
.flow-node.done .fn-dot { background: #0a8f4e; color: #fff; border-color: #0a8f4e; }
.flow-node.locked { opacity: .55; }
.flow-bar { flex: 1; height: 2px; background: var(--line); border-radius: 2px; }
.flow-bar.done { background: #0a8f4e; }

.step { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); margin-bottom: 14px; padding: 18px 20px; transition: box-shadow .2s, border-color .2s; }
.step.is-active { border-color: var(--accent-border); box-shadow: 0 0 0 3px var(--accent-soft); animation: stepIn .35s ease; }
.step.is-locked { opacity: .6; }
@keyframes stepIn { from { transform: translateY(6px); opacity: .4; } to { transform: none; opacity: 1; } }
.step-h { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.step-no { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 13px; }
.step.is-done .step-no { background: #0a8f4e; }
.step.is-locked .step-no { background: var(--ink-4); }
.step-t { font-weight: 700; font-size: 15px; }
.step-sub { font-size: 12px; color: var(--ink-4); }
.step-ok { background: #e3f6ec; border: 1px solid #b6e6c9; color: #0a6b3b; border-radius: 10px; padding: 12px 14px; font-weight: 700; font-size: 14px; }
.step-lock { background: var(--bg-2); border-radius: 10px; padding: 14px; text-align: center; color: var(--ink-4); font-size: 13px; }
.appr-live { font-size: 13.5px; }

/* ---------- QRコード（フォームURL） ---------- */
.qr-box { display: flex; gap: 18px; align-items: center; flex-wrap: wrap;
  margin-top: 18px; padding-top: 18px; border-top: 1px dashed var(--line); }
.qr-canvas { width: 148px; height: 148px; border: 1px solid var(--line); border-radius: 12px;
  background: #fff; padding: 6px; image-rendering: pixelated; flex: none; }
.qr-side { flex: 1; min-width: 200px; }
.qr-title { font-weight: 700; font-size: 14px; color: var(--ink-1); margin-bottom: 2px; }

/* ---------- AIチャット ---------- */
/* チャットのときだけ本体を画面いっぱいにして、入力欄を常に画面の最下部に置く。
   ページ自体はスクロールさせず、会話ログだけがスクロールする（chat-log の overflow-y）。
   dvh: iOS Safari のツールバー分で入力欄が沈まないように（未対応ブラウザは前の vh 宣言が効く） */
.adm-main.is-chat {
  display: flex; flex-direction: column;
  height: 100vh; height: 100dvh;
  padding-bottom: 18px; overflow: hidden;
}
.adm-main.is-chat .adm-head { margin-bottom: 14px; flex: none; }
.adm-main.is-chat #chat-usage-slot { flex: none; }
.adm-main.is-chat .chat-card { flex: 1; min-height: 0; height: auto; }

/* 見出し右のボタン（使用状況 / 新しい会話） */
.chat-head-actions { display: flex; gap: 8px; }
.chat-head-actions .is-active { border-color: var(--accent-border); background: var(--accent-soft); color: var(--accent-dk); }

/* 今月の使用量パネル */
.chat-usage { margin-bottom: 14px; padding: 16px 18px; }
.usage-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: 13.5px; margin-bottom: 12px; flex-wrap: wrap; }
.usage-reset { font-size: 12px; color: var(--ink-3); }
.usage-row { margin-bottom: 10px; }
.usage-label { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; color: var(--ink-2); margin-bottom: 5px; }
.usage-bar { height: 8px; background: var(--bg-2); border-radius: 999px; overflow: hidden; }
.usage-fill { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .2s; }
.usage-fill.is-warn { background: #E8A33D; }
.usage-fill.is-over { background: #D9534F; }
.usage-note { margin: 10px 0 0; }

.chat-card { display: flex; flex-direction: column; height: calc(100vh - 240px); height: calc(100dvh - 240px); min-height: 420px; }
.chat-log { flex: 1; overflow-y: auto; padding: 4px 2px 12px; display: flex; flex-direction: column; gap: 12px; }
.chat-msg { display: flex; flex-direction: column; max-width: 78%; }
.chat-msg.is-user { align-self: flex-end; align-items: flex-end; }
.chat-msg.is-ai { align-self: flex-start; align-items: flex-start; }
.chat-bubble {
  padding: 10px 14px; border-radius: 14px;
  font-size: 13.5px; line-height: 1.7;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  word-break: break-word; white-space: normal;
}
.chat-msg.is-user .chat-bubble { background: var(--accent); border-color: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.chat-msg.is-ai .chat-bubble { border-bottom-left-radius: 4px; }
.chat-msg.is-error .chat-bubble { background: var(--bg-2); color: var(--ink-3); border-style: dashed; }
.chat-busy { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-3); }
.chat-tools { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.chat-tool { font-size: 11px; font-weight: 700; color: var(--accent-dk); background: var(--accent-soft); border-radius: 999px; padding: 2px 10px; }
/* 参照した予約へのリンクボタン（押すと予約詳細へ） */
.chat-refs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.chat-ref {
  font: inherit; font-size: 12px; font-weight: 700; text-align: left;
  color: var(--ink-1); background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius-md); padding: 6px 12px 6px 26px; cursor: pointer;
  position: relative; transition: border-color .15s, background .15s;
}
.chat-ref::before {
  content: ''; position: absolute; left: 11px; top: 50%; width: 7px; height: 7px;
  margin-top: -3px; border-right: 2px solid var(--accent); border-bottom: 2px solid var(--accent);
  transform: rotate(-45deg);
}
.chat-ref:hover { border-color: var(--accent-border); background: var(--accent-soft); }
.chat-empty { margin: auto 0; text-align: center; color: var(--ink-3); font-size: 13.5px; padding: 24px 8px; }
.chat-suggest { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 12px; }
.chat-chip {
  border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: 7px 14px; font: inherit; font-size: 12.5px; color: var(--ink-2);
  cursor: pointer; transition: border-color .15s, background .15s;
}
.chat-chip:hover { border-color: var(--accent-border); background: var(--accent-soft); }
.chat-chip.is-static { cursor: default; }
.chat-chip.is-static:hover { border-color: var(--line); background: #fff; }
.chat-input-bar { display: flex; gap: 10px; align-items: flex-end; border-top: 1px solid var(--line-2); padding-top: 12px; }
.chat-input {
  flex: 1; resize: none;
  border: 1px solid var(--line); border-radius: var(--radius-md);
  padding: 10px 12px; font: inherit; font-size: 13.5px; line-height: 1.5;
  max-height: 120px; background: #fff; color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.chat-input:focus { outline: 0; border-color: var(--accent-border); box-shadow: 0 0 0 3px rgba(2,141,174,.10); }
.chat-send { height: 42px; padding: 0 20px; flex: 0 0 auto; }
.chat-note { margin: 8px 0 0; font-size: 11.5px; }
/* 820px はサイドバーが上部ナビに切り替わる幅（.adm-shell と同じ）。900pxにすると
   821〜900px でサイドバー配置のままモバイル用の高さが当たり、無用なスクロールが出る */
@media (max-width: 820px) {
  /* スマホはサイドバーが上部ナビになり、その分だけ縦に積み上がる。
     本体を 100dvh にすると入力欄が画面外に押し出されるので、従来どおり高さを見積もる。
     ⚠ メディアクエリは詳細度を上げないので、height は必ず .adm-main.is-chat .chat-card
     （詳細度 0,2,0）と同じ強さで上書きすること。.chat-card だけに書くと負けて、
     カードが会話の高さまで伸び、入力欄が画面外へ出てログの自動スクロールも死ぬ */
  .adm-main.is-chat { height: auto; overflow: visible; }
  .adm-main.is-chat .chat-card {
    flex: none;
    height: calc(100vh - 200px); height: calc(100dvh - 200px);
    min-height: 360px;
  }
  .chat-card { height: calc(100vh - 200px); height: calc(100dvh - 200px); min-height: 360px; }
  .chat-msg { max-width: 92%; }
}

/* ---------- AIチャット: アクション承認カード ----------
   モーダルにすると会話が隠れて内容を確かめられないので、入力欄のすぐ上に出す。 */
.chat-appr {
  display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap;
  margin-top: 10px; padding: 14px 16px;
  background: var(--accent-soft); border: 1px solid var(--accent-border);
  border-radius: var(--radius-md);
  animation: chatApprIn .16s ease-out;
}
@keyframes chatApprIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.chat-appr-body { flex: 1; min-width: 240px; }
.chat-appr-head { font-weight: 800; font-size: 13px; color: var(--accent-dk); margin-bottom: 6px; }
.chat-appr-summary { margin: 0; font-size: 13.5px; line-height: 1.7; color: var(--ink-1); }
.chat-appr-note { margin: 8px 0 0; font-size: 11.5px; color: var(--ink-3); line-height: 1.6; }
.chat-appr-actions { display: flex; gap: 8px; flex: none; }
.chat-appr .chat-refs { margin-top: 8px; }
@media (max-width: 820px) {
  .chat-appr-actions { width: 100%; justify-content: flex-end; }
}

/* AIの状態（使用状況パネル内）。「一時的に利用できません」の理由をここで確かめられる */
.ai-state { margin-top: 14px; padding: 11px 13px; border-radius: var(--radius-md); border: 1px solid var(--line); background: var(--bg-2); font-size: 12.5px; }
.ai-state b { display: block; font-size: 12px; color: var(--ink-2); margin-bottom: 4px; }
.ai-state.is-ok { border-color: #b8e3ca; background: #e7f7ee; }
.ai-state.is-ok b, .ai-state.is-ok span { color: #1c7a45; }
.ai-state.is-warn { border-color: var(--notice-border); background: var(--notice-bg); }
.ai-state.is-bad { border-color: #f5c2bc; background: #fdecea; }
.ai-state-list { display: flex; flex-direction: column; gap: 8px; }
.ai-state-row { display: flex; flex-direction: column; gap: 2px; }
.ai-state-head { font-weight: 700; color: var(--ink-1); }
.ai-state-cause { color: var(--ink-2); line-height: 1.6; }
.ai-state-detail { font-family: var(--font-code); font-size: 11px; color: var(--ink-3); word-break: break-all; }

/* ---------- 公式LINE連携（会社概要のカード） ---------- */
.line-steps { margin: 0; padding-left: 1.25em; font-size: 13px; color: var(--ink-2); line-height: 1.9; }
.line-steps li + li { margin-top: 4px; }
.line-copy { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.line-copy .field-control { flex: 1; min-width: 240px; font-family: var(--font-code); font-size: 12px; background: var(--bg-2); }
.line-copy .btn { flex: none; }
.line-drivers { margin-top: 14px; border-top: 1px solid var(--line); }
.line-drv { display: flex; align-items: center; gap: 12px; padding: 10px 2px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.line-drv-n { font-weight: 700; font-size: 13.5px; min-width: 120px; }
.line-drv-s { flex: 1; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.line-drv-a { flex: none; }
.line-code { font-family: var(--font-code); font-size: 17px; font-weight: 600; letter-spacing: .16em;
  background: var(--accent-soft); border: 1px solid var(--accent-border); border-radius: 8px; padding: 3px 10px; color: var(--accent-dk); }
