/* RED WING レンタカー予約管理システム */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --border: #e5e7eb;
  --text: #1f2937;
  --muted: #6b7280;
  --primary: #dc2626;
  --primary-dark: #b91c1c;
  --sidebar-bg: #17191d;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(17, 24, 39, 0.08), 0 1px 2px rgba(17, 24, 39, 0.04);
  --header-h: 58px;
  --ticker-h: 30px;
}
html, body { height: 100%; }
body {
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic UI", "Noto Sans JP", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea {
  font-family: inherit; font-size: 14px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 8px;
  background: #fff; color: var(--text); width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(220, 38, 38, 0.25); border-color: var(--primary); }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; font-weight: 600; }

/* ── ボタン ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 8px; border: 1px solid transparent;
  font-size: 13px; font-weight: 600; background: #fff; color: var(--text);
  transition: filter 0.15s, background 0.15s; white-space: nowrap;
}
.btn:hover { filter: brightness(0.96); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); filter: none; }
.btn-outline { border-color: var(--border); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }

/* ── ログイン ── */
.login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #17191d, #3a3d44); padding: 20px;
}
.login-card {
  background: #fff; border-radius: 16px; padding: 36px 32px; width: 100%; max-width: 380px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35); text-align: center;
}
.login-logo { color: var(--primary); margin-bottom: 6px; }
.login-logo .logo-car { width: 64px; height: 36px; }
.login-card h1 { font-size: 24px; margin-bottom: 2px; color: var(--primary); letter-spacing: 1px; }
.login-sub { color: var(--muted); font-size: 13px; margin-bottom: 20px; }
.login-card input { margin-bottom: 12px; text-align: center; }
.login-error { color: var(--primary); font-size: 13px; margin-top: 12px; }
.login-hint { color: #9ca3af; font-size: 11px; margin-top: 16px; }

/* ── ヘッダー ── */
.header {
  display: flex; align-items: center; gap: 14px;
  background: #fff; border-bottom: 1px solid var(--border);
  padding: 0 20px; height: var(--header-h);
  position: sticky; top: 0; z-index: 50;
}
.ticker-bar {
  height: var(--ticker-h); overflow: hidden;
  background: var(--primary); color: #fff;
  position: sticky; top: var(--header-h); z-index: 49;
  display: flex; align-items: center;
}
.ticker-track {
  display: inline-flex; white-space: nowrap;
  animation: ticker-scroll 16s linear infinite;
}
.ticker-bar:hover .ticker-track { animation-play-state: paused; }
.ticker-item {
  padding: 0 48px; font-size: 12.5px; font-weight: 600; letter-spacing: 0.3px;
}
.ticker-item b { font-size: 14px; font-weight: 900; margin: 0 1px; }
@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
.brand { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.logo-car { width: 44px; height: 26px; color: var(--primary); flex-shrink: 0; }
.brand-name { font-size: 21px; font-weight: 900; color: var(--primary); letter-spacing: 1px; white-space: nowrap; }
.brand-sub { font-size: 13px; color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-right { display: flex; align-items: center; gap: 14px; }
.bell-btn { position: relative; background: none; border: none; font-size: 18px; padding: 6px; }
.bell-badge {
  position: absolute; top: 0; right: -2px;
  background: var(--primary); color: #fff; font-size: 10px; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
}
.user-chip { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; }
.menu-btn { display: none; background: none; border: none; font-size: 20px; }

/* ── レイアウト ── */
.body-wrap { display: flex; min-height: calc(100vh - var(--header-h) - var(--ticker-h)); }
.sidebar {
  width: 216px; background: var(--sidebar-bg); flex-shrink: 0;
  display: flex; flex-direction: column;
  position: sticky; top: calc(var(--header-h) + var(--ticker-h)); height: calc(100vh - var(--header-h) - var(--ticker-h)); overflow-y: auto;
}
.sidebar-nav { padding: 14px 10px; display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 11px 14px; background: transparent; border: none;
  color: #d1d5db; font-size: 13.5px; font-weight: 600;
  border-radius: 8px; transition: background 0.15s, color 0.15s;
}
.nav-icon { width: 18px; text-align: center; filter: grayscale(1) brightness(1.6); }
.nav-item:hover { background: rgba(255,255,255,0.07); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-item.active .nav-icon { filter: none; }
.nav-item.logout { color: #f87171; margin-top: 6px; }

.summary-card {
  margin: auto 10px 14px; padding: 14px;
  background: #23262c; border-radius: 12px;
}
.summary-title { color: #e5e7eb; font-size: 12px; font-weight: 700; margin-bottom: 12px; }
.summary-item { display: flex; gap: 10px; align-items: center; padding: 7px 0; }
.summary-icon { font-size: 15px; }
.summary-label { color: #9ca3af; font-size: 11px; }
.summary-value { color: #fff; font-size: 17px; font-weight: 800; }
.summary-value small { font-size: 11px; color: #9ca3af; font-weight: 500; }

.view { flex: 1; min-width: 0; padding: 18px 20px 40px; }

/* ── カード ── */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-body { padding: 16px; }
.card-title { font-size: 14px; font-weight: 700; margin-bottom: 12px; }

/* ── ビュー見出し ── */
.view-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.view-head h2 { font-size: 18px; display: flex; align-items: center; gap: 8px; }
.view-head .desc { color: var(--muted); font-size: 12px; width: 100%; margin-top: -6px; }
.view-head .spacer { flex: 1; }

/* ── カレンダーツールバー ── */
/* ── カレンダー・スケジュール ツールバー ── */
.cal-bar1 {
  display: flex; align-items: center; gap: 12px; padding: 10px 16px;
  background: #fff; border-bottom: 1px solid var(--border); flex-wrap: wrap;
  position: sticky; top: calc(var(--header-h) + var(--ticker-h)); z-index: 20;
}
.cal-ptitle { font-size: 16px; font-weight: 700; margin: 0; display: flex; align-items: center; gap: 6px; }
.cal-datenav { display: flex; gap: 4px; align-items: center; }
.cal-date-text { font-size: 16px; font-weight: 700; margin-left: 4px; white-space: nowrap; }
.nav-arrow {
  background: #f3f4f6; border: 1px solid var(--border); padding: 4px 7px;
  border-radius: 6px; font-size: 13px; color: var(--text); font-weight: 600;
  transition: background 0.15s;
}
.nav-arrow:hover { background: #e5e7eb; }
.cal-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.cal-bar2 {
  display: flex; align-items: center; gap: 10px; padding: 6px 16px;
  background: #fff; border-bottom: 1px solid var(--border);
  position: sticky; top: calc(var(--header-h) + var(--ticker-h) + 42px); z-index: 19;
}
.cal-vfilter { width: 140px; padding: 5px 8px; font-size: 11px; }
.mode-group { display: flex; gap: 2px; }
.mode-btn {
  padding: 4px 10px; border: 1px solid var(--border); background: #f9fafb;
  border-radius: 5px; font-size: 11px; font-weight: 600; color: var(--muted);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.mode-btn:hover { background: #f0f1f3; }
.mode-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.nav-arrow { width: 34px; height: 34px; border: 1px solid var(--border); background: #fff; border-radius: 8px; font-size: 14px; }
.nav-arrow:hover { background: #f9fafb; }
.spacer { flex: 1; }
.mode-group { display: flex; background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 3px; gap: 2px; }
.mode-btn { border: 1px solid transparent; background: transparent; padding: 5px 14px; border-radius: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.mode-btn.active { color: var(--primary); border-color: var(--primary); background: #fff; }

/* ── 月カレンダー ── */
.cal-month { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.cal-dow { display: grid; grid-template-columns: repeat(7, 1fr); border-bottom: 1px solid var(--border); }
.cal-dow div { text-align: center; padding: 9px 0; font-size: 13px; font-weight: 700; }
.cal-dow .sun { color: var(--primary); }
.cal-dow .sat { color: #2563eb; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-cell {
  min-height: 120px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
  padding: 8px; cursor: pointer; transition: background 0.12s; display: flex; flex-direction: column;
}
.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell:hover { background: #f9fafb; }
.cal-cell.other { background: #fafafa; }
.cal-cell.other .cal-date { color: #c3c9d1; }
.cal-cell.has-res { background: #fafbfc; border-left: 3px solid var(--primary); }
.cal-res-list { flex: 1; font-size: 11px; margin-top: 6px; }
.cal-res-line { display: flex; gap: 5px; align-items: flex-start; padding: 3px 0; border-bottom: 1px solid #e5e7eb; }
.cal-res-line:last-child { border-bottom: none; }
.cal-res-tag { font-weight: 700; font-size: 10px; color: var(--primary); white-space: nowrap; min-width: 55px; flex-shrink: 0; }
.cal-res-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.cal-res-more { font-size: 9px; color: var(--muted); padding: 3px 0; }
.cal-date { font-size: 13px; font-weight: 700; margin-bottom: 4px; display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; border-radius: 999px; padding: 0 4px; }
.cal-cell .sun { color: var(--primary); }
.cal-cell .sat { color: #2563eb; }
.cal-date.today { background: var(--primary); color: #fff !important; }

/* ── ステータス凡例バー ── */
.cal-legend {
  display: flex; flex-wrap: wrap; gap: 14px; align-items: center;
  padding: 10px 14px; margin-bottom: 10px;
  background: #eef2f7; border: 1px solid #dbe2ea; border-radius: var(--radius);
}
.lg-item {
  display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: #1f2937;
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans JP", "Meiryo", sans-serif;
}
.lg-swatch { width: 24px; height: 14px; border-radius: 3px; display: inline-block; border: 1px solid rgba(0,0,0,0.18); }

/* ── 月カレンダー（ガントチャート風） ── */
.cal-month-container {
  background: #fff; border: 1px solid #d5dbe3; border-radius: var(--radius);
  overflow: auto; box-shadow: 0 1px 3px rgba(0,0,0,0.08); display: block;
  height: calc(100vh - 240px - var(--ticker-h));
}
.cal-month-header {
  display: grid;
  border-bottom: 2px solid #cbd5e1; position: sticky; top: 0; z-index: 10;
  min-height: 56px; background: #f1f5f9;
  width: max-content; min-width: 100%;
}
.cal-label-col {
  border-right: 2px solid #cbd5e1; padding: 8px 10px;
  display: flex; flex-direction: column; justify-content: center; gap: 4px;
  background: #fff; color: #334155; text-align: left;
  position: sticky; left: 0; z-index: 6;
}
.cal-month-header .cal-label-col {
  z-index: 12; background: #f1f5f9; justify-content: center; gap: 2px; overflow: hidden;
}
.cal-equip-col {
  border-right: 2px solid #cbd5e1; padding: 6px 8px;
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px;
  background: #fff; text-align: left; overflow: hidden;
  position: sticky; left: 190px; z-index: 6;
}
.cal-month-header .cal-equip-col {
  z-index: 12; background: #f1f5f9; font-size: 11px; font-weight: 700; color: #64748b;
  align-items: center; text-align: center;
}
.cal-equip-col .eq-item {
  font-size: 10px; color: #475569; font-weight: 700; background: #f1f5f9; border-radius: 4px;
  padding: 1px 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}
.cal-equip-col .eq-empty { color: #cbd5e1; font-size: 11px; }
.cal-color-col {
  border-right: 2px solid #cbd5e1; padding: 6px 4px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  background: #fff; text-align: center;
  position: sticky; left: 290px; z-index: 6;
}
.cal-month-header .cal-color-col {
  z-index: 12; background: #f1f5f9; font-size: 11px; font-weight: 700; color: #64748b;
}
.cal-color-col .cc-swatch {
  width: 20px; height: 20px; border-radius: 5px; border: 1px solid rgba(0,0,0,0.15);
  flex-shrink: 0;
}
.cal-color-col .cc-label { font-size: 10px; color: #475569; font-weight: 700; word-break: break-word; line-height: 1.2; }
.cal-label-col .lc-title { font-size: 13px; font-weight: 800; color: #1e293b; }
.cal-label-col .lc-sub { font-size: 10px; font-weight: 600; color: #94a3b8; }
.lc-badges { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.cal-label-col .lc-name {
  font-size: 15px; font-weight: 800; color: #1e293b;
  white-space: normal; word-break: break-word; line-height: 1.3;
}
.cal-label-col .lc-plate {
  font-size: 12px; color: #64748b; font-weight: 600;
  white-space: normal; word-break: break-word;
}
.cal-label-col .lc-cap {
  display: block; font-size: 10px; color: #475569; font-weight: 700; white-space: nowrap;
}
.badge-bodytype {
  display: inline-block; padding: 1px 7px; border-radius: 999px;
  font-size: 9px; font-weight: 800; white-space: nowrap;
}
.cal-date-col {
  border-right: 1px solid #e2e8f0; padding: 6px 2px; text-align: center;
  font-size: 12px; min-height: 56px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; background: #f8fafc;
}
.cal-date-col.other { background: #eef1f5; }
.cal-date-col.today { background: #dc2626; }
.cal-date-col.today .cal-header-date,
.cal-date-col.today .cal-header-dow { color: #fff !important; }
.cal-header-date { font-weight: 700; font-size: 14px; color: #1e293b; }
.cal-header-dow { font-size: 10px; color: #94a3b8; margin-top: 2px; }
.cal-header-dow.sun { color: #dc2626; font-weight: 700; }
.cal-header-dow.sat { color: #2563eb; font-weight: 700; }

.cal-month-rows {
  background: #fff; width: max-content; min-width: 100%;
}
.cal-row {
  display: grid; grid-template-columns: 190px 100px 60px 1fr;
  border-bottom: 1px solid #e2e8f0; min-height: 64px; align-items: stretch;
}
.cal-row:nth-child(even) { background: #fbfcfe; }
.cal-row:hover { background-color: #f1f5f9; }
.cal-row-blocks {
  display: grid;
  padding: 6px 0; position: relative; align-items: center;
}
.cal-gcell {
  border-right: 1px solid #e2e8f0;
  height: 100%; align-self: stretch; z-index: 0;
}
.cal-gcell.today {
  background: rgba(220, 38, 38, 0.1);
  border-left: 1px solid #dc2626;
  border-right: 1px solid #dc2626;
}
.cal-res-block {
  margin: 0 1px; padding: 3px 7px; border-radius: 5px; font-size: 12px;
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans JP", "Meiryo", sans-serif;
  font-weight: 700; cursor: pointer; transition: transform 0.12s, box-shadow 0.12s;
  border: 1px solid rgba(0,0,0,0.14); overflow: hidden;
  display: flex; flex-direction: column; justify-content: center; min-height: 34px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.12);
  position: relative; z-index: 2; line-height: 1.25;
}
.cal-res-block:hover { transform: translateY(-1px); box-shadow: 0 3px 6px rgba(0,0,0,0.2); z-index: 3; }
.cal-res-block .rb-status { font-size: 10px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-res-block .rb-name { font-size: 12px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-res-block .rb-time { font-size: 9px; font-weight: 700; opacity: 0.9; line-height: 1.2; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cal-res-block.res-overdue,
.today-slot.res-overdue { animation: overdue-blink 1s step-start infinite; }
@keyframes overdue-blink {
  0%, 49%   { border: 2px solid #dc2626; box-shadow: 0 0 0 2px rgba(220,38,38,0.35); }
  50%, 100% { border: 2px solid transparent; box-shadow: none; }
}
.cal-res-block.res-duetoday,
.today-slot.res-duetoday {
  background: #a7f3d0 !important; color: #065f46 !important;
  animation: duetoday-blink 1.2s step-start infinite;
}
.cal-res-block.res-duetoday .rb-status,
.today-slot.res-duetoday .rb-status { font-size: 11px; }
@keyframes duetoday-blink {
  0%, 49%   { border: 2px solid #dc2626; box-shadow: 0 0 0 2px rgba(220,38,38,0.3); }
  50%, 100% { border: 2px solid transparent; box-shadow: none; }
}
.cal-res-block.res-pickuptoday,
.today-slot.res-pickuptoday {
  background: #fecaca !important; color: #991b1b !important;
  animation: pickuptoday-blink 1.2s step-start infinite;
}
.cal-res-block.res-pickuptoday .rb-status,
.today-slot.res-pickuptoday .rb-status { font-size: 11px; }
@keyframes pickuptoday-blink {
  0%, 49%   { border: 2px solid #dc2626; box-shadow: 0 0 0 2px rgba(220,38,38,0.25); }
  50%, 100% { border: 2px solid transparent; box-shadow: none; }
}
.cal-res-block.dragging { opacity: 0.4; }
.cal-gcell.drag-over { background: rgba(37, 99, 235, 0.18); }
.cal-maint-block {
  background-color: #a855f7;
  background-image: repeating-linear-gradient(45deg, rgba(255,255,255,0.16) 0 6px, transparent 6px 12px);
  color: #fff; border-color: #7e22ce;
}
.cal-maint-block .rb-status,
.cal-maint-block .rb-name,
.cal-maint-block .rb-time { text-shadow: 0 1px 1px rgba(0,0,0,0.25); }
.cal-maint-narrow { justify-content: center; align-items: center; padding: 0; }
.rb-maint-icon { font-size: 18px; line-height: 1; filter: drop-shadow(0 1px 1px rgba(0,0,0,0.35)); }

.chip {
  display: flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600; border-radius: 6px;
  padding: 3px 6px; margin-bottom: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  border: none; width: 100%; text-align: left;
}
.chip:hover { filter: brightness(0.95); }
.chip-more { font-size: 11px; color: var(--muted); font-weight: 600; padding-left: 4px; }

/* ── 週カレンダー ── */
.cal-week .cal-cell { min-height: 300px; cursor: pointer; }

/* ── 日表示（車種×時間軸） ── */
.day-view { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.day-head-row { display: flex; border-bottom: 2px solid var(--border); position: sticky; top: calc(var(--header-h) + var(--ticker-h)); background: #fff; z-index: 10; }
.day-time-gutter { width: 58px; flex-shrink: 0; border-right: 1px solid var(--border); }
.day-col-head {
  flex: 1; min-width: 130px; text-align: center; padding: 10px 6px;
  border-right: 1px solid var(--border); font-weight: 700; font-size: 13px;
}
.day-col-head:last-child { border-right: none; }
.day-col-head .cnt { display: block; font-size: 11px; color: var(--muted); font-weight: 500; }
.day-col-head .dot { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; }
.day-scroll { overflow: auto; max-height: calc(100vh - 250px - var(--ticker-h)); }
.day-body { display: flex; position: relative; }
.day-times { width: 58px; flex-shrink: 0; border-right: 1px solid var(--border); position: relative; }
.day-hour-label { position: absolute; right: 8px; transform: translateY(-50%); font-size: 11px; color: var(--muted); }
.day-col { flex: 1; min-width: 130px; border-right: 1px solid var(--border); position: relative; cursor: pointer; }
.day-col:last-child { border-right: none; }
.day-hour-line { position: absolute; left: 0; right: 0; border-top: 1px solid #f0f1f3; }
.day-hour-line.major { border-top-color: var(--border); }
.day-bar {
  position: absolute; border-radius: 8px; border: none;
  color: #fff; font-size: 11px; font-weight: 600; text-align: left;
  padding: 5px 7px; overflow: hidden; cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.day-bar:hover { filter: brightness(1.08); }
.day-bar .bar-time { display: block; font-size: 10px; opacity: 0.9; }
.day-now-line { position: absolute; left: 0; right: 0; border-top: 2px solid var(--primary); z-index: 5; pointer-events: none; }

/* ── テーブル ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; min-width: max-content; border-collapse: collapse; font-size: 13px; }
th { text-align: left; padding: 8px 10px; color: var(--muted); font-size: 11px; font-weight: 700; border-bottom: 2px solid var(--border); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
tr:hover td { background: #f9fafb; }
.td-right { text-align: right; }
.mono { font-family: "SF Mono", Menlo, monospace; font-size: 12px; }
.sub-text { color: var(--muted); font-size: 11px; }

/* ── バッジ（予約ステータスはカレンダーのSTATUS配色と統一） ── */
.badge { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: 11.5px; font-weight: 800; white-space: nowrap; }
.badge.pending   { background: #fee2e2; color: #b91c1c; }
.badge.confirmed { background: #fee2e2; color: #b91c1c; }
.badge.rented    { background: #a7f3d0; color: #065f46; }
.badge.returned  { background: #dcfce7; color: #15803d; }
.badge.cancelled { background: #e5e7eb; color: #4b5563; }
.badge.no_show   { background: #d1d5db; color: #374151; }
.badge.active      { background: #dcfce7; color: #15803d; }
.badge.maintenance { background: #fef3c7; color: #b45309; }
.badge.retired     { background: #f3f4f6; color: #6b7280; }

.badge-delegation {
  display: inline-block; padding: 1px 6px; border-radius: 4px;
  font-size: 9px; font-weight: 800; white-space: nowrap;
  background: #ede9fe; color: #6d28d9; margin-right: 5px;
  vertical-align: middle;
}

/* ── ステータス変更プルダウン（一覧から直接ステータスを修正できる） ── */
.status-select {
  appearance: none; -webkit-appearance: none; border: none; border-radius: 999px;
  padding: 4px 24px 4px 12px; font-size: 11.5px; font-weight: 800; cursor: pointer;
  background-repeat: no-repeat; background-position: right 8px center; background-size: 9px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'><path d='M0 0l5 6 5-6z' fill='%23666'/></svg>");
}
.status-select:hover { filter: brightness(0.96); }
.status-select.status-pending   { background-color: #fee2e2; color: #b91c1c; }
.status-select.status-confirmed { background-color: #fee2e2; color: #b91c1c; }
.status-select.status-rented    { background-color: #a7f3d0; color: #065f46; }
.status-select.status-returned  { background-color: #dcfce7; color: #15803d; }
.status-select.status-cancelled { background-color: #e5e7eb; color: #4b5563; }
.status-select.status-no_show   { background-color: #d1d5db; color: #374151; }

/* ── フィルターバー ── */
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 14px; }
.filter-bar > div { min-width: 130px; }
.filter-bar .grow { flex: 1; min-width: 180px; }

/* ── 集計カード ── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat-card { display: flex; gap: 12px; align-items: center; padding: 16px; }
.stat-icon { width: 42px; height: 42px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.stat-label { font-size: 11px; color: var(--muted); font-weight: 600; }
.stat-value { font-size: 20px; font-weight: 800; line-height: 1.2; }
.stat-value small { font-size: 11px; color: var(--muted); font-weight: 500; }

/* ── 売上グラフ ── */
.sales-chart { display: flex; align-items: flex-end; gap: 8px; height: 160px; padding-top: 10px; }
.sales-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.sales-bar { width: 100%; max-width: 42px; background: linear-gradient(180deg, #ef4444, #dc2626); border-radius: 5px 5px 0 0; min-height: 2px; }
.sales-val { font-size: 9px; color: var(--muted); }
.sales-label { font-size: 10px; color: var(--muted); }

/* ── アラート ── */
.alert-box { background: #fffbeb; border: 1px solid #fde68a; border-radius: var(--radius); padding: 14px 16px; margin-bottom: 18px; }
.alert-box h3 { font-size: 13px; color: #b45309; margin-bottom: 8px; }
.alert-box ul { list-style: none; }
.alert-box li { font-size: 13px; padding: 3px 0; }
.alert-days { font-weight: 700; color: #b45309; }
.alert-days.over { color: var(--primary); }
.empty-note { color: #9ca3af; font-size: 13px; padding: 12px 0; text-align: center; }

/* ── モーダル ── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(17, 24, 39, 0.55);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal {
  background: #fff; border-radius: 14px; width: 100%; max-width: 620px;
  max-height: 90vh; overflow-y: auto; padding: 22px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
}
.modal.modal-wide { max-width: 980px; }
.modal h2 { font-size: 16px; margin-bottom: 16px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.form-row2 { display: flex; gap: 8px; }
.form-row2 input[type="time"] { width: 110px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.avail-note { grid-column: 1 / -1; border-radius: 8px; padding: 9px 12px; font-size: 13px; }
.avail-ok { background: #f0fdf4; border: 1px solid #bbf7d0; color: #15803d; }
.avail-ng { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; }
.check-line { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #b91c1c; }
.check-line input { width: auto; }

/* ── 当日予約表（カレンダーと同じ配色のミニ表示） ── */
.today-sheet-container {
  border: 1px solid #d5dbe3; border-radius: var(--radius); overflow: auto;
  max-height: 62vh;
}
.today-sheet-page { max-height: calc(100vh - 220px - var(--ticker-h)); background: #fff; }
.sheet-today-badge {
  display: inline-block; margin-left: 8px; padding: 2px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 800; background: var(--primary); color: #fff; vertical-align: middle;
}
.today-sheet-container .cal-row { grid-template-columns: 190px 100px 60px 1fr; min-height: 56px; }
.today-header-row {
  background: #f1f5f9; position: sticky; top: 0; z-index: 2;
}
.today-header-row .cal-label-col,
.today-header-row .cal-equip-col,
.today-header-row .cal-color-col { position: static; background: transparent; }
.today-cell {
  padding: 8px 12px; display: flex; flex-direction: column; gap: 6px; justify-content: center;
}
.today-cell-header { font-size: 12px; font-weight: 700; color: #64748b; }
.today-slot {
  border-radius: 8px; padding: 7px 14px; display: flex; align-items: center; gap: 14px;
  border: 1px solid rgba(0,0,0,0.08); cursor: pointer;
}
.today-slot .rb-status { font-size: 12px; font-weight: 800; white-space: nowrap; }
.today-slot .rb-name { font-size: 15px; font-weight: 800; white-space: nowrap; }
.today-slot .rb-time { font-size: 12px; font-weight: 700; opacity: 0.85; white-space: nowrap; }
.today-slot-empty {
  color: #94a3b8; font-weight: 700; font-size: 13px; background: #f8fafc;
  border-radius: 8px; padding: 8px 14px; border: 1px dashed #d5dbe3;
}
@media (max-width: 600px) {
  .today-sheet-container .cal-row { grid-template-columns: 110px 50px 40px 1fr; }
  .cal-equip-col .eq-item { font-size: 8px; padding: 0 3px; }
  .today-slot { flex-wrap: wrap; gap: 4px 10px; }
}

/* ── トースト ── */
.toast-container { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast {
  background: #1f2937; color: #fff; padding: 11px 18px; border-radius: 10px;
  font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  animation: toast-in 0.25s ease;
}
.toast.error { background: var(--primary-dark); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ── アクション ── */
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.icon-btn { background: none; border: none; font-size: 14px; padding: 4px 6px; border-radius: 6px; }
.icon-btn:hover { background: #f3f4f6; }
.drag-handle { cursor: grab; font-size: 16px; color: #94a3b8; padding: 4px 8px; user-select: none; }
.drag-handle:active { cursor: grabbing; }
tr.dragging-row { opacity: 0.4; }
tr.drag-over-row { box-shadow: inset 0 2px 0 var(--primary); }
.link-btn { background: none; border: none; color: var(--primary); font-size: 12px; font-weight: 600; padding: 4px 6px; }
.link-btn:hover { text-decoration: underline; }
.link-btn.green { color: #15803d; }

/* ── 予約一覧テーブル ── */
.res-table tbody tr:nth-child(even) { background: #fafbfc; }
.res-table tbody tr:hover td { background: #f1f5f9; }
.res-table td { padding: 12px 10px; }
.res-table .cust-name { font-size: 14px; color: var(--text); }
.res-table .price-cell { font-weight: 800; font-size: 13.5px; }
.overdue-tag {
  margin-top: 3px; font-size: 10px; font-weight: 800; color: #dc2626;
  white-space: nowrap;
}
tr.res-row-overdue td:first-child { border-left: 3px solid #dc2626; }
tr.res-row-flash { animation: res-row-flash-anim 1.5s ease-out; }
@keyframes res-row-flash-anim {
  0%   { background: #fde68a; }
  100% { background: transparent; }
}

/* ── スケジュール表（週表示テーブル） ── */
.sched-table-wrap { overflow-x: auto; }
.sched-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
  background: #fff; border: 1px solid var(--border);
}
.sched-table th, .sched-table td { border: 1px solid var(--border); padding: 0; }
.sched-table thead { background: #f9fafb; position: sticky; top: 0; z-index: 10; }
.sched-table th { padding: 8px 6px; text-align: center; font-weight: 600; font-size: 12px; }
.tbl-corner { width: 140px; min-width: 140px; text-align: left; padding: 8px 10px; }
.tbl-dateheader {
  width: 100px; min-width: 100px; background: #f0f9ff;
}
.tbl-dateheader.today { background: #fef2f2; }
.dh-date { font-weight: 700; line-height: 1.3; }
.dh-dow { font-size: 11px; color: var(--muted); }
.tbl-row { background: #fff; transition: background 0.15s; }
.tbl-row:hover { background: #fafbfc; }
.tbl-row.type { background: #f9fafb; }
.tbl-row[data-category="delegation"] { background: #f5f5f5; }
.tbl-row[data-category="delegation"]:hover { background: #f0f0f0; }
.tbl-label {
  width: 140px; min-width: 140px; padding: 10px;
  background: #f9fafb; border-right: 2px solid var(--border);
  position: sticky; left: 0; z-index: 5; font-size: 12px; font-weight: 600;
}
.v-name { display: block; font-weight: 700; font-size: 18px; }
.v-grade { display: block; font-size: 12px; color: var(--muted); font-weight: 500; }
.v-cap { display: block; font-size: 11px; color: var(--muted); }
.v-type { display: block; font-weight: 700; color: var(--primary); }
.tbl-cell {
  width: 100px; min-width: 100px; height: 70px; padding: 3px;
  vertical-align: middle; background: #f9fafb; position: relative;
  text-align: center;
}
.tbl-cell.confirmed { background: #86efac; }
.tbl-cell.rented { background: #fcd34d; }
.tbl-cell.returned { background: #d1d5db; }
.tbl-cell.pending { background: #93c5fd; }
.res-cell {
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  width: 100%; height: 100%; padding: 3px 2px; border: 1px solid rgba(0,0,0,0.1); background: none;
  color: inherit; font-size: 11px; text-align: center; cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s; border-radius: 3px;
}
.res-cell:hover:not(.empty) { transform: scale(0.98); box-shadow: inset 0 0 0 1px rgba(0,0,0,0.2); }
.res-cell.empty { cursor: default; border: 1px dashed rgba(0,0,0,0.1); }
.rc-tag { font-size: 10px; font-weight: 700; opacity: 0.95; }
.rc-name { font-weight: 600; line-height: 1.1; }
.rc-time { font-size: 9px; opacity: 0.85; }
.tbl-legend {
  display: flex; align-items: center; gap: 16px; padding: 12px 16px;
  border-top: 1px solid var(--border); font-size: 12px;
}
.tbl-legend i {
  display: inline-block; width: 8px; height: 8px; border-radius: 2px;
}
.tbl-legend .stat { width: 10px; height: 10px; border-radius: 3px; }
.stat.confirmed { background: #dcfce7; }
.stat.rented { background: #a7f3d0; }
.stat.returned { background: #f3f4f6; }
.stat.pending { background: #dbeafe; }
.lg { width: 12px; height: 12px; }

/* ── 日表示テーブル ── */
.day-tbl-card { margin: 0; }
.day-tbl-wrap { overflow-x: auto; min-height: 600px; display: flex; flex-direction: column; }
.day-tbl {
  width: 100%; min-width: 1000px; border-collapse: collapse; font-size: 13px;
  background: #fff; border: 1px solid var(--border);
}
.day-tbl thead { background: #f0f9ff; position: sticky; top: 0; z-index: 10; }
.day-tbl th, .day-tbl td { border: 1px solid var(--border); padding: 0; }
.day-tbl th { padding: 10px 8px; text-align: center; font-weight: 600; }
.day-tbl-time {
  width: 100px; min-width: 100px; text-align: center; font-weight: 700;
  background: #f9fafb; padding: 12px 8px; font-size: 12px;
}
.day-tbl-head {
  width: 140px; min-width: 140px; padding: 10px;
}
.dth-name { display: block; font-weight: 700; font-size: 14px; }
.dth-stock { display: block; font-size: 12px; color: var(--muted); }
.dth-cap { display: block; font-size: 11px; color: var(--muted); }
.day-tbl-cell {
  width: 140px; min-width: 140px; height: 70px; padding: 4px;
  vertical-align: middle; background: #f9fafb; text-align: center;
}
.day-tbl-cell.confirmed { background: #86efac; }
.day-tbl-cell.pending { background: #93c5fd; }
.day-tbl-cell.rented { background: #fcd34d; }
.day-tbl-cell.returned { background: #d1d5db; }
.day-res-btn {
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  width: 100%; height: 100%; border: none; background: none; cursor: pointer;
  padding: 2px; color: inherit; font-size: 11px; transition: transform 0.1s;
}
.day-res-btn:hover:not(.empty) { transform: scale(0.98); }
.day-res-btn.empty { cursor: default; border: 1px dashed rgba(0,0,0,0.1); }
.drb-tag { font-size: 10px; font-weight: 700; opacity: 0.95; }
.drb-name { font-weight: 600; line-height: 1.1; font-size: 11px; }
.drb-time { font-size: 9px; opacity: 0.85; }

/* ── 設定 ── */
.settings-grid { display: grid; grid-template-columns: 1fr; gap: 14px; max-width: 480px; }

/* ── レスポンシブ ── */
@media (max-width: 860px) {
  .sidebar {
    position: fixed; left: 0; top: calc(var(--header-h) + var(--ticker-h)); bottom: 0; z-index: 90;
    transform: translateX(-100%); transition: transform 0.2s ease; height: calc(100vh - var(--header-h) - var(--ticker-h));
  }
  .sidebar.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,0.4); }
  .menu-btn { display: block; }
  .brand-sub { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .view { padding: 14px 12px 40px; }
  .cal-cell { min-height: 78px; padding: 3px; }
  .chip { font-size: 9px; padding: 2px 4px; }
}

/* スマホ幅では車両情報・カラー列を縮めてカレンダー本体の表示幅を確保する（JS側のLABEL_COL_WIDTH/COLOR_COL_WIDTHと合わせる） */
@media (max-width: 480px) {
  .cal-row { grid-template-columns: 92px 34px 30px 1fr; }
  .cal-equip-col { left: 92px; }
  .cal-color-col { left: 126px; }
  .cal-label-col { padding: 4px 5px; gap: 2px; }
  .cal-label-col .lc-title { font-size: 11px; }
  .cal-label-col .lc-sub { display: none; }
  .cal-label-col .lc-name { font-size: 11px; line-height: 1.15; }
  .cal-label-col .lc-plate { font-size: 9px; }
  .cal-label-col .lc-cap { font-size: 9px; }
  .lc-badges { gap: 2px; }
  .badge-bodytype { font-size: 7px; padding: 0 4px; }
  .badge-delegation { font-size: 7px; padding: 0 4px; margin-right: 2px; }
  .cal-equip-col { padding: 4px 3px; gap: 1px; }
  .cal-equip-col .eq-item { font-size: 7px; padding: 0 3px; }
  .cal-color-col { padding: 4px 2px; gap: 2px; }
  .cal-color-col .cc-label { display: none; }
  .cal-color-col .cc-swatch { width: 14px; height: 14px; }
}
