/* car.css — 배차관리 전체 스타일 (기존 css/style.css + css/print.css + index.php 인라인 스타일 통합) */

/* ===== style.css ===== */
/* ================================================
   차량 배차 관리 시스템 — 메인 스타일
   ================================================ */

:root {
  --primary:      #1a56db;
  --primary-dark: #1447c0;
  --primary-light:#e8effd;
  --success:      #057a55;
  --success-light:#def7ec;
  --warning:      #c27803;
  --warning-light:#fdf3dc;
  --danger:       #c81e1e;
  --danger-light: #fde8e8;
  --grey-light:   #f3f4f6;
  --grey:         #9ca3af;
  --grey-dark:    #6b7280;
  --border:       #e5e7eb;
  --text:         #111827;
  --text-muted:   #6b7280;
  --sidebar-w:    220px;
  --topbar-h:     56px;
  --radius:       8px;
  --shadow:       0 1px 3px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.08);
  --shadow-md:    0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --font: 'Pretendard', 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; font-family: var(--font); font-size: 14px; color: var(--text); background: #f9fafb; }

a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 14px; }

.hidden { display: none !important; }

/* ── Login ───────────────────────────────── */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a56db 0%, #0e3a8f 100%);
}

.login-box {
  background: #fff;
  border-radius: 16px;
  padding: 48px 40px;
  width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo .logo-icon { font-size: 48px; display: block; margin-bottom: 8px; }
.login-logo h1 { font-size: 22px; font-weight: 700; color: var(--text); }
.login-logo p  { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ── App Layout ──────────────────────────── */
/* 사이드바/헤더는 시간외 근무·타임시트와 같은 구성 (사이드바: '외출현황 (메인)' 버튼만, 헤더: 좌측 제목 + 우측 메뉴 버튼)
   테마(다크/화이트)는 외출현황과 localStorage 'app_theme' 를 공유한다. 본문(달력·표·모달)은 기존 밝은 스타일 유지. */
body.theme-dark {
  --sb-bg:#212121; --sb-card:#2f2f2f; --sb-card2:#383838;
  --sb-border:rgba(255,255,255,0.08); --sb-border2:rgba(255,255,255,0.13);
  --sb-text:#ececec; --sb-sub:#8e8ea0; --sb-accent:#c17f3a;
  --hd-bg:#1e1b4b; --hd-sub:#a5b4fc;
}
body.theme-light {
  --sb-bg:#ffffff; --sb-card:#ffffff; --sb-card2:#f0f0ee;
  --sb-border:#e5e5e5; --sb-border2:#d0d0d0;
  --sb-text:#1a1a1a; --sb-sub:#888888; --sb-accent:#1C3F6E;
  --hd-bg:#1e1b4b; --hd-sub:#a5b4fc;
}

#app { min-height: 100vh; display: flex; flex-direction: column; }

/* 좌측 사이드바 — 모바일(1024px 미만)에서는 숨겼다가 헤더의 🚗 아이콘을 누르면 열림 */
.pc-sidebar {
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  width: 220px;
  background: var(--sb-bg);
  border-right: 1px solid var(--sb-border);
  z-index: 900;
  overflow: hidden;
}
.pc-sidebar-header {
  display: flex; align-items: center; justify-content: center;
  padding: 10px 6px 16px 6px;
  border-bottom: 1px solid var(--sb-border);
  flex-shrink: 0;
}
.pc-sidebar-header .sidebar-logo-img { width: 100%; max-width: 180px; height: auto; max-height: 52px; object-fit: contain; }
.pc-sidebar-nav {
  flex: 1; display: flex; flex-direction: column; gap: 10px;
  padding: 20px 14px 0 14px; overflow-y: auto;
}
.pc-side-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px;
  border-radius: 8px;
  border: 1px solid var(--sb-border);
  background: var(--sb-card);
  color: var(--sb-text);
  font-size: 14px; font-weight: 600;
  cursor: pointer; text-decoration: none; font-family: inherit;
  transition: all .15s; text-align: left;
}
.pc-side-btn:hover { background: var(--sb-accent); color: #fff; border-color: var(--sb-accent); }
.pc-side-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

/* 사이드바 하단 사용자 정보 + 팝업(테마/로그아웃) */
.pc-sidebar-footer {
  position: relative; cursor: pointer;
  padding: 12px 16px;
  border-top: 1px solid var(--sb-border);
  display: flex; align-items: center; gap: 8px;
  flex-shrink: 0;
}
.pc-sidebar-footer:hover { background: var(--sb-card2); }
.pc-sidebar-footer.logged-out { opacity: .6; }
.pc-sidebar-footer.logged-out:hover { opacity: 1; }
.pc-sidebar-footer.logged-out .pc-sidebar-user small { color: #f87171; }
.pc-sidebar-user { flex: 1; overflow: hidden; }
.pc-sidebar-user span { display: block; color: var(--sb-text); font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-sidebar-user small { color: var(--sb-sub); font-size: 11px; }
.sidebar-user-popup {
  position: absolute; bottom: calc(100% + 8px); left: 12px; right: 12px;
  background: var(--sb-card);
  border: 1px solid var(--sb-border2);
  border-radius: 12px;
  box-shadow: 0 -4px 24px rgba(0,0,0,.45);
  z-index: 9100; overflow: hidden;
  animation: carPopupUp .18s ease both;
}
@keyframes carPopupUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.sidebar-user-popup-item {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px;
  font-size: 14px; font-weight: 600; color: var(--sb-text);
  cursor: pointer; border-bottom: 1px solid var(--sb-border);
  transition: background .12s; user-select: none;
}
.sidebar-user-popup-item:last-child { border-bottom: none; }
.sidebar-user-popup-item:hover { background: var(--sb-card2); }
.sidebar-user-popup-item svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; color: var(--sb-sub); }
.sidebar-user-popup-item.danger, .sidebar-user-popup-item.danger svg { color: #f87171; }

/* 모바일 사이드바 오버레이 */
.mobile-sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 1800; }
.mobile-sidebar-overlay.open { display: block; }

/* 본문은 PC 에서 사이드바 폭만큼 오른쪽으로 */
@media (min-width: 1024px) {
  body { padding-left: 220px; }
  .car-logo-btn { cursor: default; }
}
@media (max-width: 1023px) {
  .pc-sidebar {
    width: 240px; z-index: 1900;
    transform: translateX(-100%);
    transition: transform .25s cubic-bezier(.4,0,.2,1);
  }
  .pc-sidebar.mobile-open { transform: translateX(0); }
  .car-logo-btn { cursor: pointer; }
}

/* 글로벌 헤더 (시간외 근무의 indigo 헤더와 동일 톤) */
.car-header {
  position: sticky; top: 0; z-index: 400;
  background: var(--hd-bg); color: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
  padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
}
.car-header-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.car-header-text { display: flex; align-items: center; gap: 12px; min-width: 0; }
.car-logo-btn {
  width: 42px; height: 42px; border-radius: 12px; background: #4f46e5;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  box-shadow: inset 0 1px 3px rgba(0,0,0,.25);
}
.car-logo-btn svg { width: 24px; height: 24px; stroke: #fff; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.page-title { font-size: 18px; font-weight: 700; letter-spacing: -.01em; color: #fff; white-space: nowrap; }
.badge-role {
  font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 20px;
  background: rgba(16,185,129,.2); color: #6ee7b7; border: 1px solid rgba(16,185,129,.4);
}
.badge-role:empty { display: none; }

/* 우측 메뉴 버튼 (배차신청 및 현황 · 배차승인 · 차량관리) */
.car-tabs {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px;
  background: rgba(49,46,129,.9); padding: 4px; border-radius: 12px;
  border: 1px solid rgba(67,56,202,.5);
}
.car-tab {
  background: transparent; border: none; color: var(--hd-sub);
  padding: 7px 14px; border-radius: 8px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  transition: all .15s;
}
.car-tab:hover { color: #fff; }
.car-tab.active { background: #4f46e5; color: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); }

/* 배차신청 및 현황: 달력/목록 전환 바 */
.car-viewbar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.car-viewbar.hidden { display: none; }
.car-viewbar-hint { flex: 1; font-size: 12px; color: var(--text-muted); text-align: right; }
.car-seg { display: inline-flex; gap: 4px; padding: 4px; background: #e5e7eb; border-radius: 10px; }
.car-seg-btn { border: none; background: transparent; color: var(--text-muted); font-size: 12px; font-weight: 700; padding: 7px 16px; border-radius: 7px; transition: all .15s; }
.car-seg-btn:hover { color: var(--text); }
.car-seg-btn.active { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.15); }

/* Main */
.main-content { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.page-content { flex: 1; padding: 20px; }

@media (max-width: 768px) {
  .car-header { padding: 10px 12px; gap: 8px; }
  .car-header-left { width: 100%; }
  .car-tabs { width: 100%; }
  /* 시간외 근무와 동일: 아이콘 오른쪽에 제목(위) / 사용자 배지(아래) 2단 배치 */
  .car-header-text { flex: 1 1 auto; flex-direction: column; align-items: flex-start; gap: 4px; }
  .car-header-text .page-title,
  .car-header-text .badge-role { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .page-title { font-size: 18px; }
  .badge-role { padding: 3px 8px; }
  .car-viewbar-hint { display: none; }
  .car-viewbar { justify-content: space-between; }
  .page-content { padding: 12px; }
}

/* ── Page ────────────────────────────────── */
.page { display: none; }
.page.active { display: block; }

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}

/* ── Buttons ─────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  border: none;
  transition: background .15s, opacity .15s;
}
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-full { width: 100%; justify-content: center; }

.btn-primary  { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--grey-light); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-success  { background: var(--success); color: #fff; }
.btn-danger   { background: var(--danger); color: #fff; }
.btn-warning  { background: var(--warning); color: #fff; }
.btn-outline  { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover { background: var(--grey-light); }
.btn-icon { background: none; border: 1px solid var(--border); border-radius: 4px; padding: 2px 8px; font-size: 18px; color: var(--primary); }
.btn-icon:hover { background: var(--primary-light); }

/* ── Forms ───────────────────────────────── */
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field label { font-weight: 600; font-size: 13px; color: var(--text-muted); }
.field input, .field select, .field textarea {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  transition: border .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,86,219,.1);
}
.field input.readonly { background: var(--grey-light); color: var(--text-muted); }

.req { color: var(--danger); }
.hint { font-size: 12px; color: var(--text-muted); }
.error-msg { color: var(--danger); font-size: 13px; padding: 8px 12px; background: var(--danger-light); border-radius: var(--radius); }

.form-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  max-width: 800px;
}

.form-title { font-size: 18px; font-weight: 700; margin-bottom: 24px; color: var(--text); }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form-grid .full { grid-column: 1 / -1; }

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* Passenger rows */
.passenger-row { display: flex; gap: 8px; margin-bottom: 8px; }
.passenger-input { flex: 1; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius); }
.rm-passenger { background: none; border: 1px solid var(--border); border-radius: 4px; padding: 2px 8px; color: var(--danger); }

/* Vehicle selector */
.vehicle-selector {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

.vehicle-card {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.vehicle-card:hover { border-color: var(--primary); background: var(--primary-light); }
.vehicle-card.selected { border-color: var(--primary); background: var(--primary-light); }
.vehicle-card .veh-num { font-weight: 700; font-size: 15px; }
.vehicle-card .veh-info { font-size: 12px; color: var(--text-muted); margin-top: 3px; }

/* ── Tables ──────────────────────────────── */
.table-wrapper {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}
.data-table th {
  background: #f9fafb;
  padding: 10px 14px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: #f9fafb; }

/* Status badges */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}
.badge-pending  { background: var(--warning-light);  color: var(--warning); }
.badge-approved { background: var(--success-light);  color: var(--success); }
.badge-rejected { background: var(--danger-light);   color: var(--danger); }
.badge-cancelled{ background: var(--grey-light);     color: var(--grey-dark); }
.badge-returned { background: var(--grey-light);     color: var(--grey-dark); }
/* 리스 종료: 다른 상태(가능/불가/기간불가)와 색상으로 확실히 구분 */
.badge-lease-ended { background: #ede9fe; color: #6d28d9; }

/* Filters */
.filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.select-sm, .input-sm {
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
}

/* ── 모바일 필터 레이아웃 (배차목록 / 배차승인) ── */
@media (max-width: 768px) {
  /* 필터 전체: 2줄 구조 */
  #page-list .filters,
  #page-admin-dispatch .filters {
    display: grid;
    grid-template-columns: 1fr;   /* 기본: 한 열 */
    gap: 6px;
    width: 100%;
  }

  /* 1번째 줄: 상태 + 기간 + 조회 한 행 */
  #page-list .filters .filter-row-1,
  #page-admin-dispatch .filters .filter-row-1 {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    width: 100%;
  }

  /* 상태 드롭다운: 고정폭 */
  #filter-status,
  #admin-filter-status {
    flex-shrink: 0;
    width: auto;
    min-width: 80px;
    max-width: 90px;
    font-size: 12px;
    padding: 5px 6px;
  }

  /* 날짜 인풋: 균등 + 내부 여백 최소화 */
  #page-list .filters .filter-row-1 .input-sm,
  #page-admin-dispatch .filters .filter-row-1 .input-sm {
    flex: 1;
    min-width: 0;
    width: 0;
    font-size: 11px;
    padding: 5px 2px;
    text-align: center;
  }
  /* 날짜 피커 내부 여백 제거 (WebKit/Blink) */
  #page-list .filters .filter-row-1 input[type="date"]::-webkit-date-and-time-value,
  #page-admin-dispatch .filters .filter-row-1 input[type="date"]::-webkit-date-and-time-value {
    margin: 0;
    padding: 0;
    text-align: center;
  }
  #page-list .filters .filter-row-1 input[type="date"]::-webkit-calendar-picker-indicator,
  #page-admin-dispatch .filters .filter-row-1 input[type="date"]::-webkit-calendar-picker-indicator {
    display: none;
  }

  /* ~ 구분자 */
  #page-list .filters .filter-sep,
  #page-admin-dispatch .filters .filter-sep {
    flex-shrink: 0;
    font-size: 12px;
    color: var(--text-muted);
  }

  /* 조회 버튼 */
  #filter-btn,
  #admin-filter-btn {
    flex-shrink: 0;
    padding: 5px 10px;
    font-size: 12px;
    white-space: nowrap;
  }
}

/* Legend */
.legend { display: flex; gap: 16px; font-size: 12px; }
.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-item.approved { color: var(--success); }
.legend-item.pending  { color: var(--warning); }

/* ── Toggle Switch ───────────────────────── */
.toggle { position: relative; display: inline-block; width: 44px; height: 24px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: #ccc;
  border-radius: 24px;
  cursor: pointer;
  transition: background .2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  left: 3px; bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
}
.toggle input:checked + .toggle-slider { background: var(--primary); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ── Modals ──────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal {
  background: #fff;
  border-radius: 12px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.modal-large { max-width: 720px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-header h3 { font-size: 16px; font-weight: 700; }

.modal-close {
  background: none;
  border: none;
  font-size: 18px;
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: 4px;
}
.modal-close:hover { background: var(--grey-light); color: var(--danger); }

.modal-body { padding: 20px; display: flex; flex-direction: column; gap: 14px; flex: 1; }
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-shrink: 0;
}

/* Detail content */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 24px;
}
.detail-item { display: flex; flex-direction: column; gap: 3px; }
.detail-item .d-label { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.detail-item .d-value { font-size: 14px; color: var(--text); }
.detail-full { grid-column: 1 / -1; }

.dispatch-form-print {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 12px;
}
.dispatch-form-print h4 {
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--text);
}

/* ── Calendar Customization ──────────────── */
#calendar { background: #fff; border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.fc .fc-toolbar-title { font-size: 18px; font-weight: 700; }
.fc .fc-button-primary { background-color: var(--primary) !important; border-color: var(--primary) !important; }
.fc .fc-button-primary:hover { background-color: var(--primary-dark) !important; }
.fc-event { cursor: pointer; }
.fc-event.status-approved { background-color: var(--success) !important; border-color: var(--success) !important; }
.fc-event.status-pending  { background-color: var(--warning) !important; border-color: var(--warning) !important; }

/* 반납완료 배차 이벤트: 진행중(승인/대기) 배차와 구분되도록 점선 테두리 + 살짝 흐리게 */
.fc-event.dispatch-returned-event {
  border-style: dashed !important;
  opacity: .8;
}
.fc-event-returned-content { opacity: .85; }

/* ── Toast ───────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1f2937;
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  z-index: 2000;
  box-shadow: var(--shadow-md);
  animation: slideUp .2s ease;
}
.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }

@keyframes slideUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ──────────────────────────── */
@media (max-width: 768px) {
  .form-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
}

/* ── 모바일 카드 컨테이너 ── */
.mobile-cards { display: none; }

@media (max-width: 768px) {
  .mobile-cards { display: block; }

  .m-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 12px;
    overflow: hidden;
  }

  .m-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    background: var(--grey-light);
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    flex-wrap: wrap;
  }

  .m-card-body { padding: 4px 0; }

  .m-row {
    display: flex;
    align-items: flex-start;
    padding: 8px 14px;
    border-bottom: 1px solid #f3f4f6;
    font-size: 13px;
    gap: 10px;
  }
  .m-row:last-child { border-bottom: none; }

  .m-label {
    font-weight: 700;
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    min-width: 60px;
    flex-shrink: 0;
    padding-top: 1px;
  }

  .m-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 14px;
    background: var(--grey-light);
    border-top: 1px solid var(--border);
    justify-content: flex-end;
  }

  .mobile-empty {
    text-align: center;
    padding: 24px 14px;
    color: #9ca3af;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
  }
}

/* ── SSO 로딩 스플래시 ───────────────────────────────── */
.sso-loading {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #1a56db 0%, #0e3a8f 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.sso-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  color: #fff;
}
.logo-icon-lg { font-size: 64px; animation: pulse 1.5s ease-in-out infinite; }
.sso-spinner p { font-size: 16px; font-weight: 500; opacity: .85; }
@keyframes pulse {
  0%, 100% { transform: scale(1);   opacity: 1; }
  50%       { transform: scale(1.1); opacity: .7; }
}

/* ── 날짜+시간 분리 입력 ─────────────────────────────── */
.datetime-wrap {
  display: flex;
  gap: 8px;
}
.datetime-wrap input[type="date"] { flex: 1.5; }
.datetime-wrap input[type="time"] { flex: 1; }

/* ── PC 전용 표시 제어 ─────────────────────────────── */
.pc-only { display: table-cell; }
@media (max-width: 768px) {
  .pc-only { display: none !important; }
}

/* ── 반납 처리 모달 그리드 ─────────────────────────── */
.return-form-grid {
  grid-template-columns: 1fr 1fr;
}
@media (max-width: 768px) {
  .return-form-grid {
    grid-template-columns: 1fr;
  }
}


/* ===== print.css (인쇄용) ===== */
/* ================================================
   배차 신청서 출력용 CSS  (@media print)
   ================================================ */
@media print {
  /* 전체 레이아웃 숨김 */
  .pc-sidebar,
  .car-header,
  .car-viewbar,
  .mobile-sidebar-overlay,
  .page-header,
  .modal-header .modal-close,
  .modal-footer,
  .filters,
  .btn,
  #toast,
  .legend {
    display: none !important;
  }

  /* 본문 여백 초기화 */
  body { margin: 0; padding: 0 !important; font-family: 'Malgun Gothic', '맑은 고딕', sans-serif; }
  .main-content { overflow: visible !important; }
  .page-content { padding: 0 !important; overflow: visible !important; }
  #app { display: block !important; }

  /* 모달 overlay 제거하고 전체 출력 */
  .modal-overlay {
    position: static !important;
    background: none !important;
    padding: 0 !important;
    display: block !important;
  }
  .modal {
    box-shadow: none !important;
    max-width: none !important;
    max-height: none !important;
    border-radius: 0 !important;
    overflow: visible !important;
  }
  .modal-body { padding: 0 !important; }

  /* 배차 신청서 출력 레이아웃 */
  .print-sheet {
    width: 100%;
    padding: 20mm 15mm;
    font-size: 11pt;
    color: #000;
  }

  .print-title {
    text-align: center;
    font-size: 18pt;
    font-weight: bold;
    margin-bottom: 8mm;
    letter-spacing: 6px;
  }

  .print-subtitle {
    text-align: right;
    font-size: 9pt;
    color: #444;
    margin-bottom: 6mm;
  }

  .print-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 6mm;
  }
  .print-table th,
  .print-table td {
    border: 1px solid #000;
    padding: 4mm 5mm;
    font-size: 10pt;
    vertical-align: middle;
  }
  .print-table th {
    background: #f0f0f0;
    font-weight: bold;
    width: 25%;
    text-align: center;
  }
  .print-table td { width: 75%; }
  .print-table td.split { display: flex; gap: 8mm; }

  .print-sign-area {
    width: 100%;
    margin-top: 10mm;
  }
  .print-sign-area table {
    float: right;
    border-collapse: collapse;
  }
  .print-sign-area th,
  .print-sign-area td {
    border: 1px solid #000;
    padding: 3mm 8mm;
    font-size: 10pt;
    text-align: center;
    min-width: 24mm;
    min-height: 18mm;
  }

  .print-footer {
    margin-top: 15mm;
    text-align: center;
    font-size: 9pt;
    color: #555;
    border-top: 1px solid #ccc;
    padding-top: 4mm;
  }

  @page {
    size: A4 portrait;
    margin: 0;
  }
}


/* ===== 화면 전용 보조 스타일 (구 index.php 인라인) ===== */
    /* 달력 이벤트 커스텀 렌더링 */
    .fc-event-custom {
      font-size: 1.1em;
      padding: 1px 3px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .fc-event-time-ko {
      font-weight: 600;
      margin-right: 2px;
    }
    /* 주/시간 뷰: 자동 줄바꿈 */
    .fc-timeGridWeek-view .fc-event-custom,
    .fc-timeGridDay-view  .fc-event-custom,
    .fc-listWeek-view     .fc-event-custom {
      white-space: normal;
      word-break: keep-all;
      text-overflow: unset;
    }
    .fc-timeGridWeek-view .fc-event-main,
    .fc-timeGridDay-view  .fc-event-main {
      overflow: visible;
    }
    /* 달력 헤더 필터 정렬 */
    #page-calendar .page-header {
      display: flex;
      align-items: center;
      gap: 12px;
      flex-wrap: wrap;
    }
    /* 차량별 범례 */
    #cal-legend {
      display: flex;
      flex-wrap: wrap;
      gap: 6px 16px;
      align-items: center;
    }
    .legend-vehicle {
      display: flex;
      align-items: center;
      gap: 5px;
      font-size: 1.3em;
      white-space: nowrap;
    }
    .legend-vehicle-number {
      font-weight: 600;
      color: var(--text-primary, #111827);
      margin-right: 2px;
    }
    .legend-swatch {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      padding: 1px 7px;
      border-radius: 3px;
      font-size: 1em;
      font-weight: 500;
      letter-spacing: 0.02em;
    }

    /* ── 달력 이벤트 Popover ── */
    #cal-popover {
      position: absolute;
      z-index: 9999;
      width: 220px;
      background: #fff;
      border: 1px solid #e5e7eb;
      border-radius: 8px;
      box-shadow: 0 4px 16px rgba(0,0,0,0.15);
      font-size: 0.85em;
      overflow: hidden;
    }
    .cal-pop-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 8px 10px;
      background: #f3f4f6;
      border-bottom: 1px solid #e5e7eb;
    }
    .cal-pop-close {
      background: none;
      border: none;
      cursor: pointer;
      font-size: 0.9em;
      color: #6b7280;
      padding: 0 2px;
    }
    .cal-pop-body {
      padding: 8px 10px;
      display: flex;
      flex-direction: column;
      gap: 4px;
    }
    .cal-pop-label {
      display: inline-block;
      width: 44px;
      color: #9ca3af;
      font-size: 0.9em;
    }
    .cal-pop-footer {
      padding: 6px 10px;
      border-top: 1px solid #e5e7eb;
      text-align: right;
    }
  /* ── 모바일: 달력 툴바 조정 ── */
  @media (max-width: 768px) {
    /* 좌우(prev/next) 버튼 숨김 — 스와이프로 대체 */
    .fc .fc-prev-button,
    .fc .fc-next-button {
      display: none !important;
    }
    /* title이 들어있는 가운데 chunk: flex:1로 나머지 공간 점유, 넘침 방지 */
    .fc-toolbar-chunk:nth-child(2) {
      flex: 1;
      min-width: 0;
      text-align: center;
      overflow: hidden;
    }
    /* 주·일·목록 뷰 title: JS에서 날짜 텍스트로 교체 + 줄바꿈 방지 */
    .fc-timeGridWeek-view .fc-toolbar-title,
    .fc-timeGridDay-view  .fc-toolbar-title,
    .fc-listWeek-view     .fc-toolbar-title {
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    /* 차량 모달: 모바일에서 1컬럼으로 전환 */
    #modal-vehicle .modal-body > div[style*="grid-template-columns"] {
      grid-template-columns: 1fr !important;
    }
    #modal-vehicle .modal-body > div[style*="grid-template-columns"] .field[style*="grid-column"] {
      grid-column: auto !important;
    }
  }
  /* ── 상세 모달 — 기본 정보 그리드 ── */
  .detail-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 24px;
    padding: 4px 0;
  }
  .detail-info-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
  }
  .detail-info-item.detail-info-full {
    grid-column: 1 / -1;
  }
  .detail-info-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary, #6b7280);
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }
  .detail-info-val {
    font-size: 14px;
    color: var(--text-primary, #111827);
  }

  /* ── 상세 모달 — 반납 정보 섹션 ── */
  .return-info-section {
    background: #EEEDFE;
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 14px;
  }
  .return-info-title {
    font-size: 13px;
    font-weight: 700;
    color: #3C3489;
    margin-bottom: 12px;
  }
  .return-mileage-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 10px;
  }
  .return-mileage-chip {
    background: #fff;
    border: 1px solid #AFA9EC;
    border-radius: 8px;
    padding: 8px 10px;
  }
  .return-chip-label {
    font-size: 10px;
    font-weight: 600;
    color: #534AB7;
    margin-bottom: 3px;
  }
  .return-chip-val {
    font-size: 13px;
    font-weight: 600;
    color: #26215C;
  }
  .return-mileage-row.two-col { grid-template-columns: repeat(2, 1fr); }
  .prev-return-sub { font-weight: 500; opacity: .75; }
  .return-meta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 14px;
  }
  .return-meta-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }
  .return-meta-item.return-meta-full {
    grid-column: 1 / -1;
  }
  .return-meta-label {
    font-size: 10px;
    font-weight: 600;
    color: #534AB7;
  }
  .return-meta-val {
    font-size: 12px;
    font-weight: 500;
    color: #3C3489;
  }
  @media (max-width: 480px) {
    /* detail-info-grid: 모바일에서도 2열 유지 */
    /* 반납정보: 모바일에서도 주행거리 3칸 / 위치·반납자 2칸을 1줄로 유지 */
    .return-mileage-row { grid-template-columns: repeat(3, 1fr); gap: 6px; }
    .return-mileage-row.two-col { grid-template-columns: repeat(2, 1fr); }
    .return-mileage-chip { padding: 6px 6px; min-width: 0; }
    .return-chip-label { white-space: nowrap; }
    .return-chip-val { font-size: 12px; word-break: keep-all; overflow-wrap: anywhere; }
    .return-meta-grid { grid-template-columns: 1fr 1fr; }
    /* 출력 버튼 모바일 숨김 */
    #modal-print-btn { display: none !important; }
  }

  /* ── 사용불가 기간 (달력 이벤트) ── */
  .unavail-period-event {
    opacity: 0.9;
    font-weight: 600;
    font-size: 0.82em;
    letter-spacing: 0.01em;
  }
  .unavail-event-content {
    color: #dc2626 !important;
    font-weight: 600;
  }
  .unavail-icon { margin-right: 2px; }

  /* ── 사용불가 기간 관리 (차량 모달 내) ── */
  .unavail-section {
    border-top: 1px solid var(--border, #e5e7eb);
    margin-top: 12px;
    padding-top: 12px;
  }
  .unavail-section-title {
    font-weight: 600;
    font-size: 0.9em;
    color: #374151;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
  }
  .unavail-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
  }
  .unavail-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    padding: 6px 10px;
    gap: 8px;
  }
  .unavail-item-info {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
    flex-wrap: wrap;
  }
  .unavail-badge { font-size: 1em; }
  .unavail-dates {
    font-size: 0.85em;
    font-weight: 600;
    color: #dc2626;
    white-space: nowrap;
  }
  .unavail-reason {
    font-size: 0.8em;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .unavail-add-form {
    background: #f9fafb;
    border: 1px dashed #d1d5db;
    border-radius: 6px;
    padding: 10px;
  }
  .unavail-add-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    overflow: hidden;
  }
  .unavail-add-row .input-sm[id="unavail-reason"] {
    min-width: 0;
    flex: 1;
  }

  /* 반납완료 배지 */
  .badge-returned {
    background: #ede9fe;
    color: #6d28d9;
    border: 1px solid #c4b5fd;
  }

  
/* 로그인 확인이 끝나기 전에는 화면을 숨긴다 */
    body:not(.car-ready) #app { visibility: hidden; }


/* ══════════════════════════════════════════════════════════════
   다크 모드 — 본문(달력·표·모달·입력창)
   - body.theme-dark 일 때만 적용 (화이트 모드는 위의 기존 스타일 그대로)
   - 인쇄(@media print)에는 영향 없도록 screen 에서만 적용
   - 테마는 외출현황·타임시트와 localStorage 'app_theme' 공유 (car.js _applyTheme)
   ══════════════════════════════════════════════════════════════ */
@media screen {
  body.theme-dark {
    color-scheme: dark;
    background: #1a1a1a;
    --text:#ececec; --text-muted:#9a9aa8;
    --border:rgba(255,255,255,.12);
    --grey-light:#383838; --grey:#8e8ea0; --grey-dark:#b4b4c0;
    --primary-light:rgba(59,130,246,.2);
    --success-light:rgba(16,185,129,.2);
    --warning-light:rgba(245,158,11,.2);
    --danger-light:rgba(239,68,68,.2);
    --shadow:0 1px 3px rgba(0,0,0,.5);
    --shadow-md:0 4px 8px rgba(0,0,0,.5);
  }
  html:has(body.theme-dark) { background: #1a1a1a; }

  /* 카드/표면 */
  body.theme-dark .form-card,
  body.theme-dark .table-wrapper,
  body.theme-dark #calendar,
  body.theme-dark .modal,
  body.theme-dark .m-card,
  body.theme-dark .mobile-empty,
  body.theme-dark #cal-popover { background: #2f2f2f; }
  body.theme-dark .modal { box-shadow: 0 20px 60px rgba(0,0,0,.7); }
  body.theme-dark .modal-overlay { background: rgba(0,0,0,.65); }

  /* 입력창·선택창·버튼 */
  body.theme-dark .field input,
  body.theme-dark .field select,
  body.theme-dark .field textarea,
  body.theme-dark .select-sm,
  body.theme-dark .input-sm { background: #383838; color: var(--text); border-color: rgba(255,255,255,.16); }
  body.theme-dark .field input.readonly { background: #262626; color: var(--text-muted); }
  body.theme-dark .field input::placeholder,
  body.theme-dark .field textarea::placeholder { color: #70707c; }
  body.theme-dark .btn-outline { background: transparent; color: var(--text); border-color: rgba(255,255,255,.22); }
  body.theme-dark .btn-outline:hover { background: #383838; }
  body.theme-dark .btn-secondary:hover { background: #454545; }
  body.theme-dark .toggle-slider { background: #555; }

  /* 표 */
  body.theme-dark .data-table th { background: #383838; color: var(--text-muted); }
  body.theme-dark .data-table tbody tr:hover { background: #353535; }
  body.theme-dark .m-row { border-bottom-color: rgba(255,255,255,.08); }

  /* 배지·범례·오류 문구 (밝은 배경용 진한 글자색 → 다크용 밝은 글자색) */
  body.theme-dark .badge-pending  { color: #fbbf24; }
  body.theme-dark .badge-approved { color: #34d399; }
  body.theme-dark .badge-rejected { color: #f87171; }
  body.theme-dark .badge-cancelled,
  body.theme-dark .badge-returned { color: #b4b4c0; border-color: rgba(255,255,255,.18); background: rgba(139,92,246,.18); }
  body.theme-dark .badge-lease-ended { background: rgba(139,92,246,.2); color: #c4b5fd; }
  body.theme-dark .legend-item.approved { color: #34d399; }
  body.theme-dark .legend-item.pending  { color: #fbbf24; }
  body.theme-dark .error-msg { color: #f87171; }
  body.theme-dark .legend-vehicle-number { color: var(--text); }

  /* 달력 (FullCalendar 변수) */
  body.theme-dark #calendar {
    --fc-page-bg-color:#2f2f2f;
    --fc-border-color:rgba(255,255,255,.13);
    --fc-neutral-bg-color:#383838;
    --fc-neutral-text-color:#9a9aa8;
    --fc-today-bg-color:rgba(250,204,21,.12);
    --fc-list-event-hover-bg-color:#383838;
    --fc-non-business-color:rgba(255,255,255,.04);
  }
  body.theme-dark .fc-day-other .fc-daygrid-day-number { color: #70707c; }

  /* 달력 날짜 클릭 팝오버 */
  body.theme-dark #cal-popover { border-color: rgba(255,255,255,.16); color: var(--text); }
  body.theme-dark .cal-pop-header { background: #383838; border-bottom-color: rgba(255,255,255,.12); }
  body.theme-dark .cal-pop-footer { border-top-color: rgba(255,255,255,.12); }
  body.theme-dark .cal-pop-close,
  body.theme-dark .cal-pop-label { color: #9a9aa8; }

  body.theme-dark .unavail-event-content { color: #f87171 !important; }

  /* 상세/반납/기간불가 영역 */
  body.theme-dark .detail-info-label { color: var(--text-muted); }
  body.theme-dark .detail-info-val { color: var(--text); }
  body.theme-dark .return-info-section { background: rgba(99,102,241,.14); }
  body.theme-dark .return-info-title,
  body.theme-dark .return-meta-val { color: #c7c9ff; }
  body.theme-dark .return-chip-label,
  body.theme-dark .return-meta-label { color: #a5a8f5; }
  body.theme-dark .return-chip-val { color: #ececec; }
  body.theme-dark .return-mileage-chip { background: #383838; border-color: rgba(165,168,245,.45); }
  body.theme-dark .unavail-section { border-color: rgba(255,255,255,.12); }
  body.theme-dark .unavail-section-title { color: var(--text); }
  body.theme-dark .unavail-item { background: rgba(220,38,38,.14); border-color: rgba(248,113,113,.4); }
  body.theme-dark .unavail-dates { color: #f87171; }
  body.theme-dark .unavail-reason { color: #9a9aa8; }
  body.theme-dark .unavail-add-form { background: #2a2a2a; border-color: rgba(255,255,255,.22); }

  /* JS 가 인라인 style 로 넣는 밝은 색 요소 */
  body.theme-dark [style*="background:#fef2f2"] { background: rgba(220,38,38,.16) !important; border-color: rgba(248,113,113,.45) !important; color: #f87171 !important; }
  body.theme-dark [style*="background:#f3f4f6"] { background: #383838 !important; border-color: #6b6b78 !important; color: #b4b4c0 !important; }
  body.theme-dark [style*="color:#c81e1e"] { color: #f87171 !important; }
  body.theme-dark [style*="color:#6b7280"] { color: #9a9aa8 !important; }

  /* 달력/목록 전환 바 */
  body.theme-dark .car-seg { background: #2f2f2f; }
  body.theme-dark .car-seg-btn.active { background: #4f46e5; color: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.4); }
}


/* ══════════════════════════════════════════════════════════════
   배차신청서 PDF 미리보기 / 인쇄 (A4 세로)
   시간외 근무 관리자 탭의 PDF 출력(#ot-print-modal)과 같은 화면 구성
   ══════════════════════════════════════════════════════════════ */
#car-print-modal { position: fixed; inset: 0; z-index: 3000; background: #475569; overflow: auto; padding: 0 0 40px; }
#car-print-modal.hidden { display: none !important; }
.car-print-toolbar { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 18px; background: #1e293b; color: #fff; }
.car-print-info { font-size: 14px; font-weight: 700; }
.car-print-actions { display: flex; gap: 8px; }
.car-print-btn { border: 1px solid #64748b; background: #334155; color: #fff; padding: 7px 14px; border-radius: 8px; font-size: 13px; font-weight: 700; cursor: pointer; font-family: inherit; }
.car-print-btn:hover { filter: brightness(1.15); }
.car-print-btn.primary { background: #4f46e5; border-color: #6366f1; }
.car-print-hint { text-align: center; font-size: 12px; color: #e2e8f0; padding: 8px; }
#car-print-root { display: flex; flex-direction: column; align-items: center; gap: 18px; padding-top: 6px; }

/* 미리보기 전용 (양식 본체 스타일은 car.js 의 CP_FORM_CSS 하나만 사용 — 출력과 동일) */
#car-print-root .cp-page { height: 297mm; overflow: hidden; box-shadow: 0 6px 24px rgba(0,0,0,.4); }
@media (max-width: 860px) { #car-print-root .cp-page { zoom: .55; } }


/* ── '내 정보' 창(time/sign-settings.js) 색상 변수 연결 ──
   이 창은 --card/--text/--sub 등을 쓰는데 배차 CSS 는 --sb-* 이므로 테마(다크/화이트)에 맞게 연결 */
.sgs-overlay {
  --card: var(--sb-card); --card2: var(--sb-card2);
  --border: var(--sb-border); --border2: var(--sb-border2);
  --text: var(--sb-text); --sub: var(--sb-sub); --accent: var(--sb-accent);
  --radius: 12px; --radius-sm: 8px;
}


/* ── 달력 '목록' 뷰 이벤트 글자색 (테마별) ── */
.fc-event-custom.fc-list-text { color: #1f2937; }
.fc-event-custom.fc-list-text.fc-event-returned-content { color: #9ca3af; }
body.theme-dark .fc-event-custom.fc-list-text { color: #ececec; }
body.theme-dark .fc-event-custom.fc-list-text.fc-event-returned-content { color: #9a9aa8; }

/* ── 달력 보기 전환 버튼(월·주·일·목록): 선택된 버튼을 확실히 구분 ──
   선택됨 = 진한 파랑 + 굵은 흰 글자 + 아래 막대 / 선택 안 됨 = 연한 회색 + 흐린 글자 */
.fc .fc-dayGridMonth-button,
.fc .fc-timeGridWeek-button,
.fc .fc-timeGridDay-button,
.fc .fc-listWeek-button {
  background-color: #e5e7eb !important; border-color: #d1d5db !important;
  color: #6b7280 !important; font-weight: 500; opacity: 1;
  transition: background-color .15s, color .15s;
}
.fc .fc-dayGridMonth-button:hover,
.fc .fc-timeGridWeek-button:hover,
.fc .fc-timeGridDay-button:hover,
.fc .fc-listWeek-button:hover { background-color: #d1d5db !important; color: #111827 !important; }
.fc .fc-dayGridMonth-button.fc-button-active,
.fc .fc-timeGridWeek-button.fc-button-active,
.fc .fc-timeGridDay-button.fc-button-active,
.fc .fc-listWeek-button.fc-button-active {
  background-color: #1a56db !important; border-color: #1a56db !important;
  color: #fff !important; font-weight: 800;
  box-shadow: inset 0 -3px 0 #fbbf24 !important;   /* 아래 노란 막대로 현재 선택 표시 */
}
body.theme-dark .fc .fc-dayGridMonth-button,
body.theme-dark .fc .fc-timeGridWeek-button,
body.theme-dark .fc .fc-timeGridDay-button,
body.theme-dark .fc .fc-listWeek-button { background-color: #383838 !important; border-color: rgba(255,255,255,.13) !important; color: #9a9aa8 !important; }
body.theme-dark .fc .fc-dayGridMonth-button:hover,
body.theme-dark .fc .fc-timeGridWeek-button:hover,
body.theme-dark .fc .fc-timeGridDay-button:hover,
body.theme-dark .fc .fc-listWeek-button:hover { background-color: #454545 !important; color: #ececec !important; }
body.theme-dark .fc .fc-dayGridMonth-button.fc-button-active,
body.theme-dark .fc .fc-timeGridWeek-button.fc-button-active,
body.theme-dark .fc .fc-timeGridDay-button.fc-button-active,
body.theme-dark .fc .fc-listWeek-button.fc-button-active { background-color: #4f46e5 !important; border-color: #6366f1 !important; color: #fff !important; }

/* ══════════════════════════════════════════════════════════════
   모바일(768px 이하) 달력 상단 범례·필터 압축
   - 차량 범례: 글자 축소 + 칩 형태로 가로 배치 (차량이 늘어도 최소 줄 수)
   - 사용불가/반납완료 범례 + 차량 선택을 한 줄로 합침
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  #page-calendar .page-header { gap: 6px; margin-bottom: 8px; }

  /* 차량별 범례: 한 줄 고정 (글자 크기는 car.js fitCalLegend 가 폭에 맞춰 조절) */
  #page-calendar #cal-legend {
    display: flex; flex-wrap: nowrap; justify-content: space-between; align-items: center;
    gap: 4px; width: 100%; overflow-x: auto; scrollbar-width: none; font-size: 10px;
  }
  #page-calendar #cal-legend::-webkit-scrollbar { display: none; }
  #page-calendar .legend-vehicle {
    flex: 0 0 auto; font-size: 1em; gap: 2px;
    padding: 2px 4px; border-radius: 6px;
    background: rgba(128,128,128,.10);
  }
  #page-calendar .legend-vehicle-number { margin-right: 0; font-weight: 700; }
  #page-calendar .lv-br { display: none; }   /* 대괄호 숨김 (폭 절약) */
  #page-calendar .legend-swatch { padding: 0 3px; font-size: 1em; line-height: 1.5; letter-spacing: -.02em; }

  /* 필터 줄: [차량 선택(남는 폭)] [🚫 사용불가] [✅ 반납완료] 한 줄 */
  #page-calendar .filters {
    display: flex; align-items: center; gap: 4px; width: 100%; flex-wrap: nowrap;
  }
  #page-calendar .filters select { order: 0; flex: 1 1 auto; min-width: 0; height: 30px; padding: 3px 8px; font-size: 12px; }
  #page-calendar #cal-unavail-legend { order: 1; display: inline-flex; gap: 4px; flex: 0 0 auto; }
  #page-calendar #cal-unavail-legend .legend-swatch {
    font-size: 10px !important; padding: 3px 6px !important; margin: 0 !important; line-height: 1.3;
  }
}
