/* LINE CRM / 顧客管理 管理画面 */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --green: #06C755;
  --green-dark: #05a648;
  --dark: #1f2937;
  --gray: #6b7280;
  --border: #e5e7eb;
  --bg: #f3f4f6;
  --danger: #dc2626;
  --amber: #d97706;
  --blue: #2563eb;
  --orange: #ea580c;
  --slate: #475569;
  --unread: #dc2626;
  --tap: 44px;
  --slot-h: 48px;
  --bottomnav-h: 56px;
  /* 予約ステータス色（帯・背景） */
  --st-pending: #d97706;      --st-pending-bg: #fffbeb;
  --st-accepted: #2563eb;     --st-accepted-bg: #eff6ff;
  --st-inservice: #16a34a;    --st-inservice-bg: #f0fdf4;
  --st-visitpending: #ea580c; --st-visitpending-bg: #fff7ed;
  --st-done: #475569;         --st-done-bg: #f1f5f9;
  --st-paid: #6b7280;         --st-paid-bg: #f3f4f6;
  --st-cancel: #9ca3af;       --st-cancel-bg: #f9fafb;
  --st-noshow: #dc2626;
}
body { font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, system-ui, sans-serif; background: var(--bg); color: #111827; font-size: 14px; }
body.has-bottomnav { padding-bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom, 0px)); }

/* ---- トップバー ---- */
.topbar { background: var(--dark); color: #fff; }
.topbar-inner { max-width: 1100px; margin: 0 auto; display: flex; align-items: center; gap: 12px; padding: 6px 16px; min-height: 52px; flex-wrap: wrap; }
.brand { font-weight: bold; color: var(--green); font-size: 16px; letter-spacing: .5px; text-decoration: none; white-space: nowrap; }
.groupnav { display: flex; gap: 2px; flex: 1; }
.groupnav a { color: #d1d5db; text-decoration: none; padding: 6px 12px; border-radius: 6px; font-weight: 600; }
.groupnav a:hover { background: #374151; color: #fff; }
.groupnav a.active { background: #374151; color: #fff; }
.subnav-wrap { background: #374151; }
.mainnav { max-width: 1100px; margin: 0 auto; display: flex; gap: 2px; padding: 4px 16px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.mainnav a { color: #d1d5db; text-decoration: none; padding: 6px 10px; border-radius: 6px; white-space: nowrap; }
.mainnav a:hover { background: #4b5563; color: #fff; }
.mainnav a.active { background: var(--green); color: #fff; }
.navcount { display: inline-block; background: var(--unread); color: #fff; font-size: 11px; border-radius: 999px; padding: 0 6px; margin-left: 4px; font-weight: 700; }
.chsel select { padding: 5px 8px; border-radius: 6px; border: none; max-width: 200px; }
.logoutform { display: inline; margin-left: auto; }
button.logout { background: none; border: none; cursor: pointer; }
.logout { color: #9ca3af; text-decoration: none; font-size: 12px; }
.logout:hover { color: #fff; }

.container { max-width: 1100px; margin: 24px auto; padding: 0 16px; }
h1 { font-size: 20px; margin-bottom: 16px; }
h2 { font-size: 16px; margin: 20px 0 10px; }
h3 { font-size: 14px; margin: 12px 0 6px; }

.flash { background: #ecfdf5; border: 1px solid var(--green); color: #065f46; padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }
.error { background: #fef2f2; border: 1px solid var(--danger); color: #991b1b; padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }
.note { color: var(--gray); font-size: 12px; margin: 6px 0; }
.warn-box { background: #fffbeb; border: 1px solid #f59e0b; color: #92400e; padding: 12px 14px; border-radius: 8px; margin: 12px 0; }
.banner-caution { background: #fef2f2; border-left: 4px solid var(--danger); color: #991b1b; padding: 8px 12px; border-radius: 6px; margin: 8px 0; font-weight: 600; }
.empty { color: var(--gray); text-align: center; padding: 28px 12px; }

.card { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.stat .num { font-size: 26px; font-weight: bold; }
.stat .label { color: var(--gray); font-size: 12px; }
.stat-big { font-size: 28px; font-weight: bold; }

table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { background: #f9fafb; color: var(--gray); font-size: 12px; font-weight: 600; }
tr:last-child td { border-bottom: none; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll table { min-width: 560px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; text-decoration: none; }
.badge.ok { background: #ecfdf5; color: #047857; }
.badge.ng { background: #fef2f2; color: #b91c1c; }
.badge.warn { background: #fffbeb; color: #92400e; }
.tagchip { display: inline-flex; align-items: center; gap: 4px; background: #eef2ff; color: #3730a3; border-radius: 999px; padding: 1px 8px; font-size: 12px; margin: 1px 2px 1px 0; }
.tagchip form { display: inline; }
.tagchip button { border: none; background: none; color: #6366f1; cursor: pointer; font-size: 12px; padding: 0; }
.chip { display: inline-block; background: #f3f4f6; color: #374151; border-radius: 999px; padding: 2px 10px; font-size: 12px; }

.btn { display: inline-block; background: var(--green); color: #fff; border: none; padding: 8px 16px; border-radius: 8px; cursor: pointer; text-decoration: none; font-size: 14px; line-height: 1.4; }
.btn:hover { background: var(--green-dark); }
.btn.secondary { background: #fff; color: #374151; border: 1px solid var(--border); }
.btn.secondary:hover { background: #f9fafb; }
.btn.danger { background: var(--danger); }
.btn.warn { background: var(--amber); }
.btn.small { padding: 4px 10px; font-size: 12px; border-radius: 6px; }
.btn.lg { display: block; width: 100%; padding: 13px 16px; font-size: 16px; font-weight: 600; text-align: center; min-height: 48px; }
.btn[disabled], .btn.disabled { opacity: .5; pointer-events: none; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 10px 0; }

input[type=text], input[type=email], input[type=password], input[type=number], input[type=tel], input[type=date], input[type=time], input[type=datetime-local], input[type=search], textarea, select {
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; font-family: inherit; background: #fff; max-width: 100%;
}
textarea { width: 100%; min-height: 120px; resize: vertical; }
textarea.short { min-height: 60px; }
label.inline { display: inline-flex; align-items: center; gap: 6px; }
.filterbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.inline-form { display: inline-flex; gap: 4px; align-items: center; }
.field { display: block; margin: 0 0 12px; }
.field-label { display: block; font-size: 13px; color: var(--gray); margin-bottom: 4px; }
.field-help { display: block; font-size: 12px; color: var(--gray); margin-top: 3px; }
.field input:not([type=checkbox]):not([type=radio]), .field select, .field textarea { width: 100%; }
.field.half { display: inline-block; width: calc(50% - 8px); margin-right: 8px; vertical-align: top; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: #fff; }
.seg label { cursor: pointer; display: inline-flex; border-right: 1px solid var(--border); }
.seg label:last-child { border-right: none; }
.seg input { position: absolute; opacity: 0; width: 0; height: 0; }
.seg span { padding: 8px 14px; min-height: 40px; display: inline-flex; align-items: center; }
.seg input:checked + span { background: var(--dark); color: #fff; }

.avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; background: #e5e7eb; }
.pager { margin: 14px 0; display: flex; gap: 8px; flex-wrap: wrap; }
.pager a, .pager span { padding: 5px 11px; border: 1px solid var(--border); border-radius: 6px; background: #fff; text-decoration: none; color: #374151; }
.pager span.cur { background: var(--green); color: #fff; border-color: var(--green); }

.login-wrap { max-width: 380px; margin: 60px auto; }
.login-wrap .card { padding: 28px; }
.login-wrap label { display: block; margin: 12px 0 4px; font-size: 13px; color: var(--gray); }
.login-wrap input:not([type=checkbox]) { width: 100%; }
.login-wrap .btn { width: 100%; margin-top: 18px; }

.preview-bubble { background: #d3f2c2; border-radius: 14px; padding: 10px 14px; display: inline-block; max-width: 480px; white-space: pre-wrap; word-break: break-word; }
.muted { color: var(--gray); }
.right { text-align: right; }

/* ---- リスト（スマホ向けカード行） ---- */
.list-card { display: block; background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-bottom: 8px; text-decoration: none; color: inherit; }
.list-card:active { background: #f9fafb; }
.list-card .title { font-weight: 600; font-size: 15px; }
.list-card .sub { color: var(--gray); font-size: 12px; margin-top: 2px; }
.list-card .meta { float: right; font-size: 12px; color: var(--gray); }

/* ---- 設定行（マスタ編集） ---- */
.row-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row-form input[type=text] { flex: 1; min-width: 120px; }
.sortable-hint { color: var(--gray); font-size: 12px; }

/* ---- 日付バー ---- */
.datebar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 6px; background: var(--bg); padding: 6px 0 8px; }
.datebar .btn { padding: 8px 12px; min-height: var(--tap); }
.datebar input[type=date] { min-height: var(--tap); font-size: 16px; font-weight: 600; }
.datebar .spacer { flex: 1; }
.datebar .info { font-size: 12px; color: var(--gray); white-space: nowrap; }

/* ---- 予約台帳（CSS grid） ---- */
/* コンテナ側で縦スクロールさせる（列ヘッダ sticky と時間列 sticky-left を同じスクロールポートに置く） */
.ledger-wrap { overflow: auto; max-height: calc(100vh - 200px); min-height: 320px; overscroll-behavior: contain; background: #fff; border: 1px solid var(--border); border-radius: 10px; }
@supports (height: 100dvh) { .ledger-wrap { max-height: calc(100dvh - 200px); } }
.ledger { display: grid; grid-template-columns: 40px repeat(var(--cols, 2), minmax(120px, 1fr)); grid-auto-rows: var(--slot-h); position: relative; }
.ledger .head { position: sticky; top: 0; z-index: 5; background: #f9fafb; border-bottom: 1px solid var(--border); font-size: 12px; color: var(--gray); font-weight: 600; display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden; line-height: 1.2; }
.ledger .time { position: sticky; left: 0; z-index: 4; background: #fff; border-right: 1px solid var(--border); border-bottom: 1px solid #f3f4f6; font-size: 11px; color: var(--gray); text-align: right; padding: 2px 4px 0 0; }
.ledger .time.hour { font-weight: 600; }
.ledger .cell { display: block; border-bottom: 1px solid #f3f4f6; border-right: 1px solid #f3f4f6; text-decoration: none;
  -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
/* 目盛り線の濃淡: 「時」の区切り＝濃い・30分＝薄い（下線が正時に当たるのは .he の付くマス。オーナー要望 2026-08-20） */
.ledger .time.he, .ledger .cell.he { border-bottom-color: #d1d5db; }
.ledger .cell:active { background: #ecfdf5; }
.ledger .cell.closed { background: repeating-linear-gradient(135deg, #f9fafb 0 6px, #f3f4f6 6px 12px); pointer-events: none; }
.ledger .cell.is-full { background: repeating-linear-gradient(135deg, #fff 0 6px, #f3f4f6 6px 12px); }
.ledger .cell.is-full::after { content: "満"; font-size: 10px; color: #9ca3af; padding-left: 4px; }
.ledger .cell.past { background: #fafafa; }
.ledger-block { position: relative; z-index: 3; margin: 1px 2px; border-radius: 6px; padding: 3px 6px 3px 8px; font-size: 12px; line-height: 1.3; overflow: hidden; text-decoration: none; color: #111827; border-left: 4px solid var(--st-accepted); background: var(--st-accepted-bg); box-shadow: 0 1px 2px rgba(0,0,0,.08);
  -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.ledger-block .nm { font-weight: 700; font-size: 13px; }
.ledger-block .st { font-size: 11px; color: var(--gray); }
.ledger-block .dot { position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--unread); }
.ledger-block[data-status=pending_confirm] { border-left-color: var(--st-pending); background: var(--st-pending-bg); border-style: dashed; }
.ledger-block[data-status=accepted] { border-left-color: var(--st-accepted); background: var(--st-accepted-bg); }
.ledger-block[data-status=in_service] { border-left-color: var(--st-inservice); background: var(--st-inservice-bg); }
.ledger-block[data-status=visit_pending] { border-left-color: var(--st-visitpending); background: var(--st-visitpending-bg); }
.ledger-block[data-status=done] { border-left-color: var(--st-done); background: var(--st-done-bg); }
.ledger-block[data-status=paid] { border-left-color: var(--st-paid); background: var(--st-paid-bg); color: #6b7280; }
.ledger-block[data-status=declined], .ledger-block[data-status=canceled_customer], .ledger-block[data-status=canceled_salon], .ledger-block[data-status=canceled_auto] { border-left-color: var(--st-cancel); background: var(--st-cancel-bg); color: #9ca3af; text-decoration: line-through; }
.ledger-block[data-status=no_show] { border-left-color: var(--st-noshow); background: #fff; color: #9ca3af; text-decoration: line-through; outline: 1px solid var(--st-noshow); }
.ledger-block.overridden::before { content: "!"; position: absolute; top: 2px; right: 16px; color: var(--amber); font-weight: 700; }
.now-line { position: absolute; left: 40px; right: 0; height: 0; border-top: 2px solid var(--danger); z-index: 6; pointer-events: none; }

/* ステータスの文字バッジ（一覧・詳細） */
.stbadge { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; background: var(--st-accepted-bg); color: var(--st-accepted); }
.stbadge[data-status=pending_confirm] { background: var(--st-pending-bg); color: var(--st-pending); }
.stbadge[data-status=in_service] { background: var(--st-inservice-bg); color: var(--st-inservice); }
.stbadge[data-status=visit_pending] { background: var(--st-visitpending-bg); color: var(--st-visitpending); }
.stbadge[data-status=done] { background: var(--st-done-bg); color: var(--st-done); }
.stbadge[data-status=paid] { background: var(--st-paid-bg); color: var(--st-paid); }
.stbadge[data-status=declined], .stbadge[data-status=canceled_customer], .stbadge[data-status=canceled_salon], .stbadge[data-status=canceled_auto] { background: var(--st-cancel-bg); color: #6b7280; }
.stbadge[data-status=no_show] { background: #fef2f2; color: var(--st-noshow); }
.unread-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--unread); margin-right: 4px; vertical-align: middle; }

/* ---- ボトムシート ---- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 90; display: none; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-radius: 16px 16px 0 0; padding: 12px 16px calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 91; display: none; max-height: 85vh; overflow-y: auto; box-shadow: 0 -4px 20px rgba(0,0,0,.15); }
.sheet.open, .sheet-backdrop.open { display: block; }
.sheet .grab { width: 40px; height: 4px; border-radius: 2px; background: #d1d5db; margin: 0 auto 10px; }
.sheet-actions { display: flex; gap: 8px; margin-top: 12px; }
.sheet-actions .btn { flex: 1; text-align: center; min-height: var(--tap); display: inline-flex; align-items: center; justify-content: center; }
@media (min-width: 768px) { .sheet { left: 50%; right: auto; width: 480px; transform: translateX(-50%); border-radius: 16px 16px 0 0; } }

/* ---- 固定合計バー・金額チップ・FAB ---- */
.sticky-total { position: sticky; bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom, 0px)); background: var(--dark); color: #fff; padding: 10px 14px; border-radius: 10px; margin: 12px 0; display: flex; align-items: center; justify-content: space-between; z-index: 15; }
body:not(.has-bottomnav) .sticky-total { bottom: 0; }
.sticky-total .amt { font-size: 18px; font-weight: 700; }
.money-chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0; }
.money-chips .btn { min-height: 40px; }
.fab { position: fixed; right: 16px; bottom: calc(var(--bottomnav-h) + 16px + env(safe-area-inset-bottom, 0px)); background: var(--green); color: #fff; border-radius: 999px; padding: 12px 18px; font-weight: 700; text-decoration: none; box-shadow: 0 4px 12px rgba(0,0,0,.25); z-index: 30; min-height: 48px; display: inline-flex; align-items: center; gap: 4px; }
body:not(.has-bottomnav) .fab { bottom: 24px; }

/* ---- 台帳の補助 ---- */
.ledger .head .sub { display: block; font-size: 10px; font-weight: normal; color: #9ca3af; }
.ledger-block.hl { outline: 2px solid var(--green); animation: hlfade 3s ease-out 1; }
@keyframes hlfade { 0% { box-shadow: 0 0 0 4px rgba(6,199,85,.35); } 100% { box-shadow: 0 1px 2px rgba(0,0,0,.08); } }
.ledger-block.cx { opacity: .7; z-index: 2; }
.ledger-block:hover { filter: brightness(.97); }
.ledger-toolbar { display: flex; justify-content: space-between; align-items: center; font-size: 12px; margin: 8px 2px; gap: 8px; flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; overflow-x: auto; -webkit-overflow-scrolling: touch; margin-bottom: 10px; padding-bottom: 2px; }
.tabs a { white-space: nowrap; padding: 8px 12px; border-radius: 999px; background: #fff; border: 1px solid var(--border); color: #374151; text-decoration: none; min-height: 40px; display: inline-flex; align-items: center; }
.tabs a.active { background: var(--dark); color: #fff; border-color: var(--dark); }
.navcount.warn { background: var(--orange); }
.list-card.unread .title { font-weight: 700; }
.list-card.cx .title { text-decoration: line-through; color: #9ca3af; }

/* ---- 予約登録フォーム ---- */
.menu-group { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.menu-pick { display: flex; align-items: center; gap: 10px; min-height: var(--tap); padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; background: #fff; cursor: pointer; }
.menu-pick input { width: 20px; height: 20px; flex: none; }
.menu-pick .mp-name { flex: 1; }
.menu-pick .mp-meta { color: var(--gray); font-size: 12px; white-space: nowrap; }
.menu-pick.on { border-color: var(--green); background: #ecfdf5; }
.menu-pick.inactive { border-style: dashed; color: #6b7280; }
.cust-card { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border: 1px solid var(--green); border-radius: 8px; background: #ecfdf5; }
.cust-card .sub { color: var(--gray); font-size: 12px; margin-top: 2px; }
.cust-suggest { display: flex; flex-direction: column; gap: 4px; margin: -6px 0 10px; }
.cs-item { text-align: left; background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; min-height: var(--tap); cursor: pointer; font: inherit; }
.cs-item .sub { display: block; color: var(--gray); font-size: 12px; }
.cs-item:active { background: #ecfdf5; }
.cs-empty { color: var(--gray); font-size: 12px; padding: 4px 2px; }

/* ---- 会計（POS） ---- */
.pos-item { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.pos-item .pi-name { flex: 1; min-width: 0; }
.pos-item .pi-price { width: 92px; flex: none; text-align: right; }
.pos-item .pi-qty { width: 52px; flex: none; text-align: center; }
.pos-item .pi-x { color: var(--gray); }
.pos-item .pi-del { border: none; background: #f3f4f6; color: #6b7280; border-radius: 8px; width: 36px; min-height: 36px; cursor: pointer; flex: none; }
.pos-item.bad input { border-color: var(--danger); background: #fef2f2; }
.pos-item.is-coupon .pi-name { border-left: 3px solid var(--amber); }
.menu-picker { border: 1px dashed var(--border); border-radius: 10px; padding: 8px 10px; margin: 8px 0; max-height: 50vh; overflow-y: auto; }
.menu-picker .mp-btn { width: 100%; text-align: left; font: inherit; }
.pos-total { display: flex; justify-content: space-between; align-items: center; background: #f9fafb; border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; margin-top: 8px; }
.pos-total .amt { font-size: 22px; font-weight: 700; }
.pos-change { font-size: 18px; margin-top: 6px; }
.pos-change strong { font-size: 24px; color: var(--green-dark); }
@media (max-width: 767px) {
  .pos-item .pi-price { width: 84px; }
  .pos-item .pi-qty { width: 48px; }
}

/* ---- 下部ナビ（スマホ） ---- */
.bottomnav { display: none; }
/* PC幅では下部ナビが出ないので下駄も外す（body.has-bottomnav の既定より後ろに置いて後勝ちさせる） */
@media (min-width: 768px) {
  body.has-bottomnav { padding-bottom: 0; }
  body.has-bottomnav .fab { bottom: 24px; }
  body.has-bottomnav .sticky-total { bottom: 0; }
}

/* ---- モバイル ---- */
@media (max-width: 767px) {
  body { font-size: 16px; }
  .container { margin: 12px auto; padding: 0 10px; }
  h1 { font-size: 18px; margin-bottom: 10px; }
  .topbar-inner { min-height: 48px; gap: 8px; padding: 4px 10px; }
  .groupnav { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; flex: 1 1 auto; }
  .groupnav a { white-space: nowrap; padding: 6px 10px; }
  body.has-bottomnav .groupnav { display: none; }
  body.has-bottomnav .logoutform { display: none; }
  .subnav-wrap .mainnav { padding: 4px 8px; }
  .subnav-wrap .mainnav a { padding: 8px 10px; }
  body.has-bottomnav .subnav-wrap { display: none; }
  .card { padding: 12px; }
  .btn { min-height: var(--tap); display: inline-flex; align-items: center; justify-content: center; }
  .btn.small { min-height: 34px; }
  input[type=text], input[type=email], input[type=password], input[type=number], input[type=tel], input[type=date], input[type=time], input[type=datetime-local], input[type=search], textarea, select { font-size: 16px; min-height: var(--tap); }
  th, td { padding: 8px 8px; }
  .field.half { display: block; width: 100%; margin-right: 0; }
  .grid2 { grid-template-columns: 1fr; }
  .bottomnav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--bottomnav-h) + env(safe-area-inset-bottom, 0px)); padding-bottom: env(safe-area-inset-bottom, 0px); background: #fff; border-top: 1px solid var(--border); z-index: 80; }
  .bottomnav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-decoration: none; color: #6b7280; font-size: 11px; gap: 2px; position: relative; }
  .bottomnav a.active { color: var(--green); font-weight: 700; }
  .bottomnav .ico { font-size: 20px; line-height: 1; position: relative; }
  .bottomnav .count { position: absolute; top: -6px; right: -12px; background: var(--unread); color: #fff; font-size: 10px; border-radius: 999px; padding: 1px 5px; font-weight: 700; }
  .chsel select { max-width: 140px; }
  .ledger-wrap { max-height: calc(100vh - var(--bottomnav-h) - 150px); }
  @supports (height: 100dvh) { .ledger-wrap { max-height: calc(100dvh - var(--bottomnav-h) - 150px); } }
}

/* ---- 報告・集計（C2b） ---- */
.seg a { padding: 8px 14px; min-height: 40px; display: inline-flex; align-items: center; text-decoration: none; color: inherit; border-right: 1px solid var(--border); }
.seg a:last-child { border-right: none; }
.seg a.on { background: var(--dark); color: #fff; }
.print-only { display: none; }
table.report-daily th, table.report-daily td { white-space: nowrap; }
table.report-daily thead th { background: #f9fafb; }
table.report-daily tfoot th { background: #f9fafb; border-top: 2px solid var(--border); font-weight: 700; }
table.report-daily tr.closed-day td { color: #9ca3af; background: #fafafa; }
table.report-daily tr.is-today td, table.stats tr.is-today td { background: #ecfdf5; }
table.report-daily tr.sat td:first-child a { color: var(--blue); }
table.report-daily tr.sun td:first-child a { color: var(--danger); }
table.stats th, table.stats td { white-space: nowrap; }
table.stats tfoot th { background: #f9fafb; border-top: 2px solid var(--border); font-weight: 700; color: #111827; font-size: 14px; }
/* 日報/週報/月報の「予約経路別」: 横スクロール無しの4列。数値列は折り返さず、長い経路ラベル側で折り返す（375px 実測でカード内 329px に収まる） */
table.by-route { width: 100%; max-width: 560px; }
table.by-route thead th { font-size: 12px; color: var(--gray); font-weight: 500; border-bottom: 1px solid var(--border); }
table.by-route tbody th { text-align: left; color: #111827; font-size: 14px; overflow-wrap: anywhere; }
table.by-route td.num, table.by-route th.num { white-space: nowrap; }
table.by-route tfoot th { border-top: 2px solid var(--border); font-weight: 700; text-align: left; color: #111827; font-size: 14px; }
table.by-route tfoot th.num { text-align: right; }
table.stats td.barcol, table.stats th.barcol { width: 30%; min-width: 120px; padding-left: 4px; }
.hbar { display: block; height: 10px; background: #f3f4f6; border-radius: 4px; overflow: hidden; }
.hbar span { display: block; height: 100%; border-radius: 4px; }
.table-scroll table.report-daily { min-width: 760px; }
.table-scroll table.stats { min-width: 480px; }

/* ---- 台帳 週表示（PC） ---- */
.ledger.week { grid-template-columns: 40px repeat(7, minmax(120px, 1fr)); }
.ledger.week .head.today { background: #ecfdf5; color: var(--green-dark); }
.ledger.week .head.closed-day { color: #9ca3af; }
.ledger.week .cell.closed { pointer-events: none; }
.ledger.week .ledger-block .nm { font-size: 12px; }
.ledger.week .ledger-block .st { font-size: 10px; }
.view-switch { display: none; }
@media (min-width: 768px) { .view-switch { display: inline-flex; } }

/* ---- 印刷 ---- */
@media print {
  .topbar, .bottomnav, .fab, .datebar .btn, .datebar form, .datebar .seg, .sheet, .sheet-backdrop, .no-print, .ledger-toolbar, .subnav-wrap { display: none !important; }
  .print-only { display: block !important; }
  body { background: #fff; padding: 0; font-size: 11px; color: #000; }
  .container { margin: 0; max-width: none; padding: 0; }
  .card, .stat { border: 1px solid #999; border-radius: 0; box-shadow: none; page-break-inside: avoid; break-inside: avoid; margin-bottom: 8px; padding: 8px 10px; }
  .cards { grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 8px; }
  .stat .num { font-size: 16px; }
  .grid2 { grid-template-columns: 1fr 1fr; }
  h1 { font-size: 14px; margin-bottom: 6px; }
  h2 { font-size: 12px; margin: 6px 0 4px; }
  th, td { padding: 3px 6px; font-size: 10px; border-bottom: 1px solid #ccc; }
  a { color: #000; text-decoration: none; }
  .table-scroll { overflow: visible; }
  /* 画面用の min-width（.report-daily 760px / .stats 480px）より詳細度を上げて解除する（@media は詳細度に寄与しない） */
  .table-scroll table, .table-scroll table.report-daily, .table-scroll table.stats { min-width: 0; width: 100%; }
  table.report-daily th, table.report-daily td, table.stats th, table.stats td { white-space: normal; }
  .hbar { border: 1px solid #ccc; }
  .hbar span { background: #666 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  /* 台帳: 全体を1ページに収める（内側スクロールを解除・スロットを縮める・列は用紙幅まで縮む・見出し行は内容の高さ） */
  .ledger-wrap { max-height: none; overflow: visible; border: none; }
  .ledger, .ledger.week { grid-template-columns: 28px repeat(var(--cols, 2), minmax(0, 1fr)); grid-auto-rows: 22px; grid-template-rows: auto; }
  .ledger .head, .ledger .time { position: static; }
  .ledger-block { box-shadow: none; border: 1px solid #999; border-left-width: 4px; font-size: 9px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .ledger-block .nm { font-size: 10px; }
  .ledger-block .st { font-size: 8px; }
  .now-line { display: none; }
  .datebar { position: static; padding: 0; }
  .datebar .info { font-size: 11px; color: #000; }
  .stbadge { border: 1px solid #999; }
}

/* 予約不可（ネット受付停止）の帯 — 台帳グリッドに全列で重ねる。
   帯本体は z-index を持たせない（スタッキングコンテキストを作ると解除ボタンが予約ブロック z-index:3 の下に沈むため）。
   帯はDOM順で予約ブロックより先＝下に描かれ、解除ボタンだけ z-index:4 で上に浮かせる */
.ledger .block-zone { position: relative; pointer-events: none; margin: 0 1px;
  background: repeating-linear-gradient(135deg, rgba(220,38,38,.05) 0 6px, rgba(220,38,38,.12) 6px 12px);
  border-top: 2px dashed var(--danger); border-bottom: 2px dashed var(--danger); }
.block-zone .bz-label { display: inline-block; font-size: 11px; font-weight: 700; color: #991b1b; padding: 3px 6px 0; }
.block-zone form { position: absolute; top: 2px; right: 4px; pointer-events: auto; z-index: 4; }
.block-zone .bz-del { font-size: 12px; padding: 8px 14px; min-height: var(--tap); background: #fff; color: #991b1b;
  border: 1px solid var(--danger); border-radius: 8px; font-weight: 600; }
@media print {
  table.by-route thead th { font-size: 10px; }
  table.by-route tfoot th, table.stats tfoot th { border-top-color: #999; }
  .block-zone form { display: none; }
  .block-zone { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
/* 空きセルシート「予約不可にする」の長さ選択（ワンタップ確定・終了時刻を小さく添える） */
.cs-durs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cs-durs .btn { min-height: var(--tap); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 6px 4px; line-height: 1.3; }
.cs-durs .btn b { font-size: 15px; }
.cs-durs .btn span { font-size: 11px; font-weight: 400; opacity: .85; }
