/* ===================================
   성심로지스 배차관리센터 V1 - 메인 스타일
   =================================== */

:root {
  --primary: #4a7ec7;
  --primary-light: #5b93d6;
  --secondary: #e8720c;
  --success: #2e7d32;
  --danger: #c62828;
  --warning: #f57c00;
  --info: #0277bd;
  --bg: #f0f2f5;
  --card-bg: #ffffff;
  --border: #dde1e7;
  --text: #1a1a2e;
  --text-light: #555;
  --shadow: 0 2px 8px rgba(0,0,0,0.1);
  --radius: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Noto Sans KR', sans-serif; background: var(--bg); color: var(--text); font-size: 13px; }

/* ===== 전체 레이아웃: 사이드바 + 콘텐츠 ===== */
#app-layout {
  display: flex;
  min-height: 100vh;
}

/* ===== 상단 헤더 (로고+사용자) ===== */
#main-header {
  background: linear-gradient(135deg, #2c4f8c 0%, #4a7ec7 55%, #5e94d8 100%);
  color: white;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 60px;
  z-index: 200;
  box-shadow: 0 2px 12px rgba(30,60,130,0.40);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px 0 14px;
}
.header-logo {
  display: flex;
  align-items: center;
  gap: 0;
}
.logo-img {
  height: 48px;
  width: auto;
  filter: brightness(0) invert(1);
  display: block;
}
.logo-divider {
  width: 1px;
  height: 32px;
  background: rgba(255,255,255,0.25);
  margin: 0 12px;
}
.logo-text-block {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.logo-system-name {
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.3px;
}
.logo-system-ver {
  font-size: 9.5px;
  color: rgba(255,255,255,0.55);
  letter-spacing: 0.8px;
}
.logo-title { font-size: 18px; font-weight: 700; line-height: 1.2; }
.logo-sub { font-size: 11px; opacity: 0.8; }

/* 헤더 우측 영역 */
.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.header-user-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 11.5px;
  font-weight: 600;
  color: white;
}
.header-logout-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(220,60,60,0.25);
  border: 1px solid rgba(255,100,100,0.35);
  border-radius: 20px;
  padding: 5px 13px;
  font-size: 11.5px;
  font-weight: 700;
  color: #ffb3b3;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}
.header-logout-btn:hover {
  background: rgba(220,60,60,0.5);
  color: white;
}
.header-info { display:flex;flex-direction:column;align-items:flex-end;gap:4px; }
.header-info span { font-size: 11px; opacity: 0.85; }
.header-policy { font-size: 10px !important; opacity: 0.7 !important; }
.header-cloud-row { display: flex; align-items: center; gap: 8px; }
.cloud-toggle-btn {
  background: rgba(255,255,255,0.15);
  color: white;
  border: 1px solid rgba(255,255,255,0.25);
  padding: 4px 10px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 10px;
  font-family: inherit;
  font-weight: 600;
  transition: all 0.2s;
}
.cloud-toggle-btn:hover { background: rgba(255,255,255,0.25); }

/* ===== 사이드바 ===== */
#sidebar {
  width: 210px;
  min-width: 210px;
  background: #1a2f5e;
  position: fixed;
  top: 60px;
  left: 0;
  bottom: 0;
  z-index: 150;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
  transition: transform 0.25s ease;
  display: flex;
  flex-direction: column;
}
#sidebar::-webkit-scrollbar { width: 4px; }
#sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }

.sidebar-section-label {
  font-size: 9.5px;
  font-weight: 700;
  color: rgba(255,255,255,0.35);
  letter-spacing: 1.5px;
  padding: 14px 16px 5px;
  text-transform: uppercase;
}
.nav-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: none;
  border: none;
  border-left: 3px solid transparent;
  color: rgba(255,255,255,0.65);
  padding: 10px 16px;
  cursor: pointer;
  font-size: 12.5px;
  font-family: inherit;
  white-space: nowrap;
  text-align: left;
  transition: all 0.15s;
  border-radius: 0;
}
.nav-tab i { width: 16px; text-align: center; font-size: 13px; flex-shrink: 0; }
.nav-tab:hover {
  background: rgba(255,255,255,0.08);
  color: white;
}
.nav-tab.active {
  background: rgba(255,255,255,0.12);
  border-left-color: #f5a623;
  color: white;
  font-weight: 700;
}
.nav-tab.admin-tab { color: rgba(255,210,80,0.75); }
.nav-tab.admin-tab:hover { color: #ffd54f; }
.nav-tab.admin-tab.active { color: #ffd54f; border-left-color: #ffd54f; }
.nav-tab.analysis-tab { color: rgba(150,210,255,0.75); }
.nav-tab.analysis-tab:hover { color: #90caf9; }
.nav-tab.analysis-tab.active { color: #90caf9; border-left-color: #90caf9; }
.nav-divider { height: 1px; background: rgba(255,255,255,0.08); margin: 6px 0; }

/* 사이드바 열고닫기 토글 버튼 */
#sidebar-toggle {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 300;
  background: none;
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
}

/* ===== 메인 콘텐츠 영역 ===== */
#page-container {
  margin-left: 210px;
  margin-top: 60px;
  padding: 14px 16px 20px !important;
  min-height: calc(100vh - 60px);
  flex: 1;
  transition: margin-left 0.25s ease;
}

/* nav 스타일은 위 사이드바 섹션에 통합 */

/* ===== 페이지 ===== */
.page { display: none; }
.page.active { display: block; }
.page-content { max-width: 1600px; margin: 0 auto; }
.page-header { background: white; padding: 8px 14px !important; border-radius: var(--radius); margin-bottom: 8px !important; border-left: 5px solid var(--primary); box-shadow: var(--shadow); }
.page-header h1 { font-size: 15px !important; color: var(--primary); margin-bottom: 1px; }
.page-header p { color: var(--text-light); font-size: 11px; margin: 0; }
.admin-header { border-left-color: var(--secondary); }
.admin-header h1 { color: var(--secondary); }

/* ===== 홈 페이지 ===== */
.home-hero { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%); color: white; padding: 32px; border-radius: var(--radius); margin-bottom: 20px; text-align: center; }
.home-hero h1 { font-size: 22px; margin-bottom: 8px; }
.hero-sub { font-size: 13px; opacity: 0.85; margin-bottom: 4px; }
.hero-policy { font-size: 11px; opacity: 0.7; }

/* 워크플로우 */
.workflow-section { background: white; padding: 20px; border-radius: var(--radius); margin-bottom: 16px; box-shadow: var(--shadow); }
.workflow-section h2 { font-size: 15px; color: var(--primary); margin-bottom: 16px; }
.workflow-steps { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; justify-content: center; }
.wf-step { background: var(--primary); color: white; padding: 12px 16px; border-radius: var(--radius); text-align: center; min-width: 100px; }
.wf-num { font-size: 18px; font-weight: 700; margin-bottom: 4px; color: var(--secondary); }
.wf-text { font-size: 11px; line-height: 1.4; }
.wf-arrow { font-size: 18px; color: var(--primary); font-weight: bold; }

/* 시트 안내 테이블 */
.sheet-nav-section { background: white; padding: 20px; border-radius: var(--radius); margin-bottom: 16px; box-shadow: var(--shadow); }
.sheet-nav-section h2 { font-size: 15px; color: var(--primary); margin-bottom: 12px; }
.sheet-table { width: 100%; border-collapse: collapse; }
.sheet-table th { background: var(--primary); color: white; padding: 8px 12px; text-align: left; font-size: 12px; }
.sheet-table td { padding: 8px 12px; border-bottom: 1px solid var(--border); font-size: 12px; }
.sheet-table tr:hover td { background: #f8f9ff; }
.admin-row td { background: #fffbf0; }
.admin-row:hover td { background: #fff3cd; }

/* 배지 */
.badge { padding: 2px 8px; border-radius: 12px; font-size: 10px; font-weight: 600; }
.badge.staff { background: #e3f2fd; color: #1565c0; }
.badge.admin { background: #fff3e0; color: #e65100; }

/* 버튼 이동 */
.btn-go { background: var(--primary); color: white; border: none; padding: 4px 12px; border-radius: 4px; cursor: pointer; font-size: 11px; }
.btn-go:hover { background: var(--primary-light); }
.btn-go.admin { background: var(--secondary); }
.btn-go.admin:hover { background: #d4600a; }

/* 핵심 원칙 */
.principles-section { background: white; padding: 20px; border-radius: var(--radius); margin-bottom: 16px; box-shadow: var(--shadow); }
.principles-section h2 { font-size: 15px; color: var(--primary); margin-bottom: 16px; }
.principles-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.principle-card { padding: 16px; border-radius: var(--radius); text-align: center; }
.principle-card.speed { background: #e3f2fd; border: 2px solid #42a5f5; }
.principle-card.compare { background: #e8f5e9; border: 2px solid #66bb6a; }
.principle-card.raise { background: #fff3e0; border: 2px solid #ffa726; }
.principle-card.record { background: #fce4ec; border: 2px solid #ef5350; }
.p-icon { font-size: 28px; margin-bottom: 8px; }
.p-title { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.p-desc { font-size: 11px; color: var(--text-light); line-height: 1.5; }

/* ===== 배차 계산기 (통합 3탭) ===== */
.calc-workflow { display: none; } /* 워크플로우 진행바 숨김 (3탭으로 대체) */
.calc-grid { display: block; } /* 단일 컬럼으로 전환 */
.calc-grid-single { display: flex; flex-direction: column; gap: 8px; }

/* 탭 폼 2컬럼 */
.form-row.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.form-row.two-col label { font-size: 11.5px; display: block; margin-bottom: 3px; font-weight: 600; color: var(--text-light); }
.form-row.two-col input, .form-row.two-col select {
  width: 100%; padding: 7px 9px; border: 1px solid var(--border);
  border-radius: 6px; font-size: 12px; font-family: inherit; box-sizing: border-box;
}

.calc-section { background: white; padding: 16px; border-radius: var(--radius); margin-bottom: 14px; box-shadow: var(--shadow); }
.section-title { font-size: 13px; font-weight: 700; padding: 6px 12px; border-radius: 4px; margin-bottom: 12px; }
.section-title.s1 { background: #e3f2fd; color: #1565c0; }
.section-title.s2 { background: #fff9c4; color: #f57f17; }
.section-title.s3 { background: #e8f5e9; color: #2e7d32; }
.section-title.s4 { background: #fce4ec; color: #c62828; }
.section-title.s5 { background: #f3e5f5; color: #6a1b9a; }

.input-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.input-row { display: flex; flex-direction: column; gap: 3px; }
.input-row label { font-size: 11px; font-weight: 600; color: var(--text-light); }
.input-row input, .input-row select { padding: 6px 8px; border: 1px solid var(--border); border-radius: 4px; font-size: 12px; font-family: inherit; }
.input-row input:focus, .input-row select:focus { outline: none; border-color: var(--primary); }
.auto-field { background: #f0f4ff; color: var(--primary); font-weight: 600; }
.auto-field.highlight { background: #fff3e0; color: var(--secondary); font-size: 13px !important; }

/* 시나리오 테이블 */
.scenario-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.scenario-table th { background: #37474f; color: white; padding: 6px 8px; text-align: center; }
.scenario-table td { padding: 6px 8px; border-bottom: 1px solid #eee; text-align: center; }
.step-cell { font-weight: 700; font-size: 10px; }
.step1 { color: #1565c0; }
.step2 { color: #2e7d32; }
.step3 { color: #37474f; }
.step4 { color: #f57c00; }
.step5 { color: #e65100; }
.step6 { color: #c62828; }
.step-base { background: #f9fbe7; }
.price-cell { font-weight: 700; font-size: 13px; color: var(--primary); }
.judge-ok { background: #4caf50; color: white; padding: 1px 6px; border-radius: 10px; font-size: 10px; }
.judge-warn { background: #ff9800; color: white; padding: 1px 6px; border-radius: 10px; font-size: 10px; }
.judge-bad { background: #f44336; color: white; padding: 1px 6px; border-radius: 10px; font-size: 10px; }
.judge-wait { background: #9e9e9e; color: white; padding: 1px 6px; border-radius: 10px; font-size: 10px; }

/* 결과 그리드 */
.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.result-item { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; background: #f8f9fa; border-radius: 4px; }
.result-item.highlight-box { grid-column: span 2; background: var(--primary); color: white; padding: 12px 16px; }
.r-label { font-size: 11px; color: var(--text-light); }
.result-item.highlight-box .r-label { color: rgba(255,255,255,0.8); }
.r-value { font-weight: 700; font-size: 13px; color: var(--primary); }
.result-item.highlight-box .r-value { color: #ffd54f; }
.r-value.big { font-size: 20px; }
.r-value.surcharge { color: var(--secondary); }

/* 할증 체크 */
.surcharge-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px; }
.check-item { display: flex; align-items: center; gap: 6px; padding: 5px 8px; background: #f8f9fa; border-radius: 4px; cursor: pointer; font-size: 11px; }
.check-item:hover { background: #e8f0fe; }
.check-item input { cursor: pointer; }

/* 차량 다중선택 체크박스 */
.veh-check-label { display:inline-flex; align-items:center; gap:0; cursor:pointer; user-select:none; }
.veh-check-label input[type="checkbox"] { display:none; }
.veh-tag {
  display:inline-block; padding:5px 12px; border-radius:20px;
  font-size:12px; font-weight:600; cursor:pointer; transition:all 0.15s;
  background:#f0f0f0; color:#666; border:1.5px solid #ddd;
}
.veh-check-label input[type="checkbox"]:checked + .veh-tag,
.veh-tag-on {
  background:#1565c0; color:#fff; border-color:#1565c0;
  box-shadow: 0 2px 6px rgba(21,101,192,0.3);
}
.veh-check-label:hover .veh-tag { background:#e3f2fd; color:#1565c0; border-color:#90caf9; }
.veh-check-label input[type="checkbox"]:checked + .veh-tag:hover { background:#1976d2; }

/* 선택된 차량 태그 */
.sel-veh-badge {
  display:inline-flex; align-items:center; gap:5px;
  padding:3px 10px 3px 8px; border-radius:20px;
  background:linear-gradient(135deg,#1565c0,#42a5f5); color:#fff;
  font-size:12px; font-weight:700; cursor:pointer;
  box-shadow:0 1px 4px rgba(21,101,192,0.3);
}
.sel-veh-badge:hover { background:linear-gradient(135deg,#0d47a1,#1e88e5); }
.sel-veh-badge .rm { font-size:13px; line-height:1; opacity:0.8; }

/* 과거운임 톤수 탭 */
.hist-ton-tab {
  padding:5px 14px; border-radius:20px; font-size:12px; font-weight:700;
  cursor:pointer; border:1.5px solid #b0bec5; background:#f5f5f5; color:#546e7a;
  transition:all 0.15s;
}
.hist-ton-tab.active {
  background:#1565c0; color:#fff; border-color:#1565c0;
  box-shadow:0 2px 8px rgba(21,101,192,0.35);
}
.hist-ton-tab:hover:not(.active) { background:#e3f2fd; color:#1565c0; border-color:#90caf9; }

/* 배차 폼 */
.dispatch-form { display: flex; flex-direction: column; gap: 8px; }
.form-row { display: flex; flex-direction: column; gap: 3px; }
.form-row.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.form-row label { font-size: 11px; font-weight: 600; color: var(--text-light); }
.form-row input, .form-row select { padding: 7px 10px; border: 1px solid var(--border); border-radius: 4px; font-size: 12px; font-family: inherit; }
.form-row input:focus, .form-row select:focus { outline: none; border-color: var(--primary); }

/* 발송 텍스트 */
.dispatch-text-area { display: flex; flex-direction: column; gap: 8px; }
.dispatch-text-area textarea { width: 100%; padding: 10px; border: 1px solid var(--border); border-radius: 4px; font-family: 'Malgun Gothic', sans-serif; font-size: 12px; resize: vertical; background: #fafafa; }

/* ===== 배차 일정표 ===== */
.schedule-summary { margin-bottom: 16px; }
#day-summary-cards { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.day-card { background: white; border-radius: var(--radius); padding: 12px; text-align: center; box-shadow: var(--shadow); border-top: 4px solid var(--primary); }
.day-card.today { border-top-color: var(--secondary); background: #fff8f0; }
.day-card-date { font-weight: 700; font-size: 13px; color: var(--primary); margin-bottom: 4px; }
.day-card-count { font-size: 24px; font-weight: 700; color: var(--secondary); }
.day-card-label { font-size: 10px; color: var(--text-light); margin-top: 2px; }
.day-card-status { font-size: 10px; margin-top: 4px; }

.day-tabs { display: flex; gap: 4px; margin-bottom: 12px; flex-wrap: wrap; }
.day-tab { padding: 7px 16px; background: white; border: 1px solid var(--border); border-radius: 20px; cursor: pointer; font-size: 12px; transition: all 0.2s; }
.day-tab.active { background: var(--primary); color: white; border-color: var(--primary); font-weight: 600; }
.day-tab:hover:not(.active) { background: #e8f0fe; }

.schedule-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.legend { display: flex; gap: 12px; align-items: center; font-size: 11px; }
.leg { display: flex; align-items: center; gap: 4px; }
.leg.confirmed { color: #2e7d32; }
.leg.progress { color: #f57c00; }
.leg.waiting { color: #0277bd; }
.leg.cancelled { color: #9e9e9e; }

/* ===== 공통 테이블 ===== */
.data-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.data-table th { background: var(--primary); color: white; padding: 8px 8px; text-align: center; white-space: nowrap; position: sticky; top: 0; }
.data-table td { padding: 7px 8px; border-bottom: 1px solid #eee; text-align: center; white-space: nowrap; }
.data-table tr:hover td { background: #f0f4ff; }
.status-confirmed { background: #c8e6c9; color: #1b5e20; padding: 2px 8px; border-radius: 10px; font-size: 10px; }
.status-progress { background: #fff9c4; color: #f57f17; padding: 2px 8px; border-radius: 10px; font-size: 10px; }
.status-waiting { background: #e3f2fd; color: #0d47a1; padding: 2px 8px; border-radius: 10px; font-size: 10px; }
.status-cancelled { background: #f5f5f5; color: #757575; padding: 2px 8px; border-radius: 10px; text-decoration: line-through; font-size: 10px; }
.margin-pos { color: var(--success); font-weight: 700; }
.margin-neg { color: var(--danger); font-weight: 700; }

/* 테이블 스크롤 */
.table-scroll { overflow-x: auto; border-radius: var(--radius); box-shadow: var(--shadow); background: white; }
.schedule-table-section { background: white; border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }

/* ===== 단가표 ===== */
.rates-section { background: white; padding: 20px; border-radius: var(--radius); margin-bottom: 16px; box-shadow: var(--shadow); }
.rates-section h3 { font-size: 14px; color: var(--primary); margin-bottom: 12px; padding-bottom: 8px; border-bottom: 2px solid var(--border); }
.rates-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.rates-table th { background: var(--primary); color: white; padding: 8px 10px; text-align: center; }
.rates-table td { padding: 8px 10px; border-bottom: 1px solid #eee; text-align: right; }
.rates-table .ton-cell { text-align: left; font-weight: 700; color: var(--primary); }
.highlight-green { background: #c8e6c9; font-weight: 700; color: #1b5e20; }
.row-5ton td { background: #fff8e1; }
.rates-table.compact td, .rates-table.compact th { padding: 6px 10px; }
.zone-inner { color: #1565c0; font-weight: 700; }
.zone-near { color: #2e7d32; font-weight: 700; }
.zone-mid { color: #6a1b9a; font-weight: 700; }
.zone-far { color: #e65100; font-weight: 700; }
.zone-vfar { color: #c62828; font-weight: 700; }
.zone-nego { color: #37474f; font-weight: 700; }

/* ===== 할증 테이블 ===== */
.surcharge-section { background: white; padding: 20px; border-radius: var(--radius); margin-bottom: 16px; box-shadow: var(--shadow); }
.surcharge-section h3 { font-size: 14px; color: var(--primary); margin-bottom: 12px; }
.surcharge-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.surcharge-table th { background: #37474f; color: white; padding: 8px 10px; }
.surcharge-table td { padding: 8px 10px; border-bottom: 1px solid #eee; }
.cat-label { font-weight: 700; text-align: center; border-right: 2px solid #ddd; }
.cat-label.time { background: #e3f2fd; color: #1565c0; }
.cat-label.work { background: #e8f5e9; color: #2e7d32; }
.cat-label.dist { background: #fff3e0; color: #e65100; }
.cat-label.cargo { background: #fce4ec; color: #c62828; }
.cat-time td { background: #f8fbff; }
.cat-work td { background: #f9fdf9; }
.cat-dist td { background: #fffbf5; }
.cat-cargo td { background: #fff8f8; }
.surcharge-val { font-weight: 700; color: #c62828; }
.priority { padding: 2px 8px; border-radius: 10px; font-size: 10px; font-weight: 600; }
.priority.must { background: #ffcdd2; color: #c62828; }
.priority.often { background: #fff9c4; color: #f57f17; }
.priority.occur { background: #e0f2f1; color: #00695c; }

/* ===== DB 요약 ===== */
.db-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin-bottom: 10px; }
.summary-card { background: white; padding: 14px 16px; border-radius: var(--radius); box-shadow: var(--shadow); text-align: center; }
.summary-card .s-val { font-size: 22px; font-weight: 700; color: var(--primary); }
.summary-card .s-label { font-size: 11px; color: var(--text-light); margin-top: 2px; }

/* ===== 툴바 ===== */
.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar input { flex: 1; min-width: 200px; padding: 7px 12px; border: 1px solid var(--border); border-radius: 4px; font-size: 12px; }
.toolbar select { padding: 7px 10px; border: 1px solid var(--border); border-radius: 4px; font-size: 12px; }

/* ===== 버튼 ===== */
.btn-primary { background: var(--primary); color: white; border: none; padding: 8px 16px; border-radius: 4px; cursor: pointer; font-size: 12px; font-family: inherit; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; transition: background 0.2s; }
.btn-primary:hover { background: var(--primary-light); }
.btn-secondary { background: #546e7a; color: white; border: none; padding: 8px 16px; border-radius: 4px; cursor: pointer; font-size: 12px; font-family: inherit; display: inline-flex; align-items: center; gap: 6px; }
.btn-secondary:hover { background: #37474f; }
.btn-copy { background: #4caf50; color: white; border: none; padding: 8px 16px; border-radius: 4px; cursor: pointer; font-size: 12px; font-family: inherit; display: inline-flex; align-items: center; gap: 6px; }
.btn-copy:hover { background: #388e3c; }
.btn-edit    { background: #1976d2; color: white; border: none; padding: 3px 8px; border-radius: 3px; cursor: pointer; font-size: 10px; }
.btn-delete  { background: #e53935; color: white; border: none; padding: 3px 8px; border-radius: 3px; cursor: pointer; font-size: 10px; }

/* ── 다중선택 행 하이라이트 ── */
tr.row-selected td {
  background: #e3f2fd !important;
  border-top: 1px solid #90caf9;
  border-bottom: 1px solid #90caf9;
}
tr.row-selected td:first-child { border-left: 3px solid #1565c0; }

/* 드래그 중 텍스트 선택 방지 */
#orders-table { user-select: none; }
#orders-table td input[type="checkbox"] { pointer-events: all; }

/* 선택 툴바 슬라이드인 애니메이션 */
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* 전송 모달 */
#send-modal .modal-box { border-radius: 14px; overflow: hidden; }
#send-modal textarea   { font-size: 12px; line-height: 1.7; }

/* km 셀 클릭 수정 */
.km-cell {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  transition: background .15s;
}
td:hover .km-cell {
  background: #e3f2fd;
  color: #1565c0;
  font-weight: 700;
}
td:hover .km-cell::after {
  content: ' ✏️';
  font-size: 9px;
}
.btn-import  { background: #2e7d32; color: white; border: none; padding: 8px 14px; border-radius: 4px; cursor: pointer; font-size: 12px; font-family: inherit; display: inline-flex; align-items: center; gap: 6px; }
.btn-import:hover  { background: #1b5e20; }
.btn-export  { background: #0277bd; color: white; border: none; padding: 8px 14px; border-radius: 4px; cursor: pointer; font-size: 12px; font-family: inherit; display: inline-flex; align-items: center; gap: 6px; }
.btn-export:hover  { background: #01579b; }
.btn-template{ background: #6a1b9a; color: white; border: none; padding: 8px 14px; border-radius: 4px; cursor: pointer; font-size: 12px; font-family: inherit; display: inline-flex; align-items: center; gap: 6px; }
.btn-template:hover{ background: #4a148c; }

/* 폼 그리드 */
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
@media (max-width: 560px) { .form-grid-2 { grid-template-columns: 1fr; } }
.form-row { display: flex; flex-direction: column; gap: 3px; }
.form-row label { font-size: 11px; font-weight: 600; color: var(--text-light); }
.form-row input, .form-row select, .form-row textarea {
  padding: 7px 10px; border: 1px solid var(--border); border-radius: 4px;
  font-size: 12px; font-family: inherit; transition: border-color 0.2s;
}
.form-row input:focus, .form-row select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(26,60,110,0.1); }

/* 임포트 모달 */
.import-guide-box { display: flex; gap: 12px; padding: 14px; background: #e8f5e9; border-radius: 8px; margin-bottom: 14px; }
.import-guide-icon { font-size: 24px; flex-shrink: 0; }
.import-guide-box strong { display: block; font-size: 13px; color: #1b5e20; margin-bottom: 6px; }
.import-guide-box p { font-size: 11px; color: #333; line-height: 1.8; margin: 0; }
.import-upload-zone {
  border: 2px dashed #bdbdbd; border-radius: 8px; padding: 28px 16px;
  text-align: center; cursor: pointer; transition: all 0.2s; color: #9e9e9e;
}
.import-upload-zone:hover { border-color: var(--primary); background: #f0f4ff; color: var(--primary); }
.import-upload-zone p { margin: 4px 0; font-size: 13px; }

/* ===== 대시보드 ===== */
.kpi-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px !important; margin-bottom: 8px !important; }
.kpi-card { background: white; padding: 10px 12px !important; border-radius: var(--radius); box-shadow: var(--shadow); border-left: 4px solid var(--primary); }
.kpi-card .kpi-val { font-size: 20px; font-weight: 700; color: var(--primary); }
.kpi-card .kpi-val.neg { color: var(--danger); }
.kpi-card .kpi-label { font-size: 11px; color: var(--text-light); margin-top: 4px; }
.kpi-card .kpi-sub { font-size: 10px; color: var(--text-light); margin-top: 2px; }
.kpi-card.orange { border-left-color: var(--secondary); }
.kpi-card.orange .kpi-val { color: var(--secondary); }
.kpi-card.green { border-left-color: var(--success); }
.kpi-card.green .kpi-val { color: var(--success); }

.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 10px !important; }
.dash-card { background: white; padding: 12px !important; border-radius: var(--radius); box-shadow: var(--shadow); }
.dash-card h3 { font-size: 13px; color: var(--primary); margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }

#top-customers-list { display: flex; flex-direction: column; gap: 6px; }
.top-item { display: flex; justify-content: space-between; align-items: center; padding: 7px 10px; background: #f8f9fa; border-radius: 4px; font-size: 12px; }
.top-rank { font-weight: 700; color: var(--primary); width: 30px; }
.top-name { flex: 1; }
.top-val { font-weight: 700; color: var(--secondary); }

/* ===== 페이지네이션 ===== */
.pagination { display: flex; gap: 4px; justify-content: center; margin-top: 12px; flex-wrap: wrap; }
.page-btn { padding: 4px 10px; border: 1px solid var(--border); background: white; cursor: pointer; border-radius: 4px; font-size: 11px; }
.page-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

/* ===== 모달 ===== */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 9000; display: flex; align-items: center; justify-content: center; padding: 12px; }
.modal-box { background: white; border-radius: var(--radius); width: 94%; max-width: 560px; max-height: 92vh; overflow-y: auto; box-shadow: 0 12px 40px rgba(0,0,0,0.4); position: relative; z-index: 9001; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; background: var(--primary); color: white; border-radius: var(--radius) var(--radius) 0 0; }
.modal-header h3 { font-size: 15px; }
.modal-close { background: none; border: none; color: white; font-size: 18px; cursor: pointer; }
.modal-body { padding: 20px; display: flex; flex-direction: column; gap: 10px; }

/* ===== 토스트 ===== */
.toast { position: fixed; bottom: 24px; right: 24px; background: #37474f; color: white; padding: 12px 20px; border-radius: 6px; font-size: 13px; z-index: 9999; box-shadow: 0 4px 12px rgba(0,0,0,0.3); animation: slideUp 0.3s ease; }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* 등급 */
.grade-stars { color: #ffc107; }
.grade-new { color: #9e9e9e; font-size: 11px; }
.grade-excellent { color: #2e7d32; }
.exclusive-y { background: #fff176; color: #f57f17; padding: 2px 8px; border-radius: 10px; font-size: 10px; font-weight: 700; }
.exclusive-n { color: #9e9e9e; font-size: 11px; }

/* ===== 노선 빠른 선택 바 ===== */
.quick-route-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: white; padding: 10px 14px; border-radius: var(--radius);
  margin-bottom: 14px; box-shadow: var(--shadow);
  border-left: 4px solid #ffd54f;
}
.qr-label { font-size: 12px; font-weight: 700; color: var(--secondary); white-space: nowrap; }
.qr-btns  { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.qr-btn   {
  display: flex; flex-direction: column; align-items: center;
  padding: 4px 12px; border: 2px solid var(--primary); border-radius: 6px;
  background: white; cursor: pointer; transition: all 0.2s; min-width: 70px;
}
.qr-btn:hover { background: var(--primary); color: white; }
.qr-code  { font-size: 9px; color: var(--secondary); font-weight: 700; }
.qr-btn:hover .qr-code { color: #ffd54f; }
.qr-route { font-size: 12px; font-weight: 700; }
.qr-ton   { font-size: 9px; color: #9e9e9e; }
.qr-btn:hover .qr-ton { color: rgba(255,255,255,0.7); }
.qr-manage { background: #546e7a; color: white; border: none; padding: 6px 12px; border-radius: 4px; cursor: pointer; font-size: 11px; font-family: inherit; white-space: nowrap; }
.qr-manage:hover { background: #37474f; }

/* ===== 발송 템플릿 탭 ===== */
.template-tabs { display: flex; gap: 4px; margin-bottom: 8px; flex-wrap: wrap; }
.tpl-tab {
  padding: 5px 14px; border: 2px solid var(--border); background: white;
  border-radius: 4px; cursor: pointer; font-size: 11px; font-family: inherit; font-weight: 600;
  transition: all 0.2s;
}
.tpl-tab:hover  { border-color: var(--primary); color: var(--primary); }
.tpl-tab.active { background: var(--primary); color: white; border-color: var(--primary); }

/* 반응형 */
@media (max-width: 768px) {
  #day-summary-cards { grid-template-columns: repeat(3, 1fr); }
  .input-grid { grid-template-columns: 1fr; }
  .result-grid { grid-template-columns: 1fr; }
  .result-item.highlight-box { grid-column: span 1; }
  .workflow-steps { gap: 8px; }
  .wf-arrow { display: none; }
  .dashboard-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  #day-summary-cards { grid-template-columns: repeat(2, 1fr); }
  .principles-grid { grid-template-columns: 1fr 1fr; }
}

/* ============================================================
   신규 페이지 공통 스타일 (노선마스터 / 유가관리 / 분석 탭)
   ============================================================ */

/* 분석 탭 */
.nav-tab.analysis-tab { color: rgba(255,220,150,0.85); }
.nav-tab.analysis-tab.active { color: #ffe082; border-bottom-color: #ffe082; }
.nav-divider { width: 1px; background: rgba(255,255,255,0.2); margin: 6px 4px; }

/* 분석 페이지 헤더 */
.analysis-header { border-left-color: #7b1fa2; }
.analysis-header h1 { color: #7b1fa2; }

/* ===== 노선 마스터 ===== */
.route-grade-summary { display: flex; flex-direction: column; gap: 8px; }
.rgs-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: var(--radius); }
.rgs-item.a { background: #e8f5e9; border-left: 5px solid #2e7d32; }
.rgs-item.b { background: #fff9c4; border-left: 5px solid #f57c00; }
.rgs-item.c { background: #ffebee; border-left: 5px solid #c62828; }
.rgs-grade { font-weight: 700; font-size: 16px; min-width: 56px; }
.rgs-item.a .rgs-grade { color: #2e7d32; }
.rgs-item.b .rgs-grade { color: #f57c00; }
.rgs-item.c .rgs-grade { color: #c62828; }
.rgs-count { font-weight: 600; font-size: 13px; min-width: 72px; }
.rgs-desc { font-size: 12px; color: var(--text-light); }

/* ===== 유가관리 ===== */
.fuel-dashboard { display: grid; grid-template-columns: 260px 1fr; gap: 12px; margin-bottom: 10px; }
@media (max-width: 900px) { .fuel-dashboard { grid-template-columns: 1fr; } }

.fuel-control-card { background: white; padding: 12px !important; border-radius: var(--radius); box-shadow: var(--shadow); }
.fuel-control-card h3 { font-size: 13px; color: var(--primary); margin-bottom: 10px; }
.fuel-input-row { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.fuel-input-row label { font-size: 11px; font-weight: 600; color: var(--text-light); }
.fuel-input-row input { padding: 8px 12px; border: 1px solid var(--border); border-radius: 4px; font-size: 14px; font-family: inherit; width: 100%; }

.fuel-diff-display { text-align: center; padding: 16px; background: #f5f5f5; border-radius: var(--radius); margin-bottom: 12px; }
.fuel-diff-val { font-size: 28px; font-weight: 700; }
.fuel-diff-sub { font-size: 13px; margin-top: 4px; color: var(--text-light); }
.fuel-base-info { font-size: 11px; color: #9e9e9e; text-align: center; margin-top: 4px; }

.fuel-info-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.fuel-info-card { background: white; padding: 14px 16px; border-radius: var(--radius); box-shadow: var(--shadow); border-left: 4px solid var(--info); }
.fuel-info-card.warn { border-left-color: var(--warning); }
.fuel-info-card.danger { border-left-color: var(--danger); }
.fuel-info-card .fi-label { font-size: 11px; color: var(--text-light); margin-bottom: 6px; }
.fuel-info-card .fi-val { font-size: 20px; font-weight: 700; color: var(--primary); }
.fuel-info-card .fi-sub { font-size: 10px; color: #9e9e9e; margin-top: 2px; }

/* 매트릭스 테이블 */
.matrix-table-wrap { overflow-x: auto; }
.matrix-table { border-collapse: collapse; font-size: 11px; min-width: 700px; }
.matrix-table th, .matrix-table td { border: 1px solid #ddd; padding: 6px 10px; text-align: center; white-space: nowrap; }
.matrix-table thead th { background: var(--primary); color: white; font-weight: 600; }
.matrix-table tbody tr:hover td { filter: brightness(0.95); }

/* ===== 트레닛 분석 ===== */
.trenit-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px !important; margin-bottom: 8px !important; }
@media (max-width: 1100px) { .trenit-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 700px)  { .trenit-grid { grid-template-columns: 1fr; } }

.trenit-chart-card { background: white; padding: 12px 14px; border-radius: var(--radius); box-shadow: var(--shadow); }
.trenit-chart-card h3 { font-size: 12px; color: var(--primary); margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }

/* ===== Heatmap ===== */
.heatmap-wrap { overflow-x: auto; margin-bottom: 16px; }

.heatmap-table { border-collapse: collapse; font-size: 12px; min-width: 640px; width: 100%; }
.heatmap-table th { background: var(--primary); color: white; padding: 8px 12px; text-align: center; font-size: 11px; white-space: nowrap; }
.heatmap-table td { border: 2px solid white; padding: 0; }
.hm-corner { background: #263238 !important; }
.hm-avg-col { background: #37474f !important; min-width: 72px; }
.hm-day-label { background: #f5f5f5 !important; font-weight: 600; padding: 10px 12px !important; min-width: 80px; font-size: 12px; }
.hm-cell { width: 80px; min-width: 72px; height: 48px; text-align: center; vertical-align: middle; position: relative; cursor: default; transition: filter 0.15s; }
.hm-cell:hover { filter: brightness(1.12); }
.hm-val { font-size: 12px; font-weight: 700; display: block; }
.hm-crown { font-size: 14px; position: absolute; top: 2px; right: 4px; }
.hm-day-avg { font-weight: 700; font-size: 12px; text-align: center; padding: 8px 10px !important; min-width: 68px; }
.hm-time-avg-row td { border-top: 3px solid #333 !important; }
.hm-time-avg { font-weight: 700; font-size: 12px; text-align: center; padding: 8px 10px !important; }
.hm-weekend td { opacity: 0.95; }

.hm-legend { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; padding: 10px 0; font-size: 11px; }
.hm-legend-title { font-weight: 700; color: var(--text-light); }
.hm-litem { padding: 3px 10px; border-radius: 12px; font-size: 10px; font-weight: 600; }

/* 주말 패턴 분석 */
.weekend-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 700px) { .weekend-grid { grid-template-columns: 1fr; } }
.wg-section { background: white; padding: 16px; border-radius: var(--radius); box-shadow: var(--shadow); }
.wg-section h4 { font-size: 13px; color: var(--primary); margin-bottom: 12px; }
.wg-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 6px; margin-bottom: 6px; }
.wg-item.rank1 { background: #fff9c4; }
.wg-item.rank2 { background: #f5f5f5; }
.wg-item.rank3 { background: #fafafa; }
.wg-item.weekend { opacity: 0.85; }
.wg-rank { font-size: 18px; font-weight: 700; color: var(--secondary); min-width: 28px; }
.wg-hour { font-size: 14px; font-weight: 600; flex: 1; }
.wg-rate { font-size: 14px; font-weight: 700; color: var(--success); }
.wg-warning { margin-top: 8px; padding: 8px 12px; background: #fff3e0; border-radius: 4px; font-size: 11px; color: var(--warning); font-weight: 600; }

/* Insight box */
.insight-box { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.insight-item { display: flex; gap: 12px; align-items: flex-start; padding: 14px; background: white; border-radius: var(--radius); box-shadow: var(--shadow); }
.insight-item i { font-size: 22px; margin-top: 2px; flex-shrink: 0; }
.insight-item.best i { color: #ffd700; }
.insight-item.good i { color: var(--success); }
.insight-item.warn i { color: var(--warning); }
.insight-item.info i { color: var(--info); }
.insight-item strong { display: block; font-size: 13px; margin-bottom: 4px; color: var(--primary); }
.insight-item p { font-size: 12px; color: var(--text); }
.insight-item small { font-size: 10px; color: var(--text-light); }
.insight-rate { color: var(--success); font-weight: 700; }
.insight-rate-bad { color: var(--danger); font-weight: 700; }

/* ===== KPI 분석 ===== */
.kpi-section { margin-bottom: 8px !important; }
.kpi-section h2 { font-size: 13px; color: var(--primary); margin-bottom: 10px; padding: 6px 12px; background: #e8eaf6; border-radius: 4px; }

.kpi-analysis-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-bottom: 12px; }
.kpi-analysis-card { background: white; padding: 12px !important; border-radius: var(--radius); box-shadow: var(--shadow); position: relative; overflow: hidden; }
.kpi-analysis-card.achieved { border-top: 4px solid var(--success); }
.kpi-analysis-card.not-achieved { border-top: 4px solid var(--danger); }
.kac-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.kac-badge { background: var(--primary); color: white; font-size: 10px; padding: 2px 8px; border-radius: 10px; font-weight: 700; }
.kac-status { font-size: 11px; font-weight: 700; }
.kac-title { font-size: 12px; color: var(--text-light); margin-bottom: 8px; }
.kac-val { font-size: 32px; font-weight: 700; margin-bottom: 4px; }
.kac-target { font-size: 11px; color: var(--text-light); margin-bottom: 4px; }
.kac-count { font-size: 11px; color: var(--text-light); margin-bottom: 8px; }
.kac-bar { background: #eee; border-radius: 4px; height: 6px; overflow: hidden; }
.kac-fill { height: 100%; border-radius: 4px; transition: width 0.5s ease; }

.kpi-charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
@media (max-width: 900px) { .kpi-charts-grid { grid-template-columns: 1fr; } }

.kpi-chart-card { background: white; padding: 16px; border-radius: var(--radius); box-shadow: var(--shadow); }
.kpi-chart-card h3 { font-size: 13px; color: var(--primary); margin-bottom: 12px; }

/* ===== 시장가 DB ===== */
.market-section { background: white; padding: 16px; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; }
.market-section h3 { font-size: 13px; color: var(--primary); margin-bottom: 4px; }
.market-section .market-sub { font-size: 11px; color: var(--text-light); margin-bottom: 12px; }

.market-tabs { display: flex; gap: 4px; margin-bottom: 16px; flex-wrap: wrap; }
.market-tab-btn { padding: 7px 16px; border: 2px solid var(--border); background: white; border-radius: 20px; cursor: pointer; font-size: 12px; font-family: inherit; font-weight: 500; transition: all 0.2s; }
.market-tab-btn:hover { border-color: var(--primary); color: var(--primary); }
.market-tab-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.market-panel { display: none; }
.market-panel.active { display: block; }

.market-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 20px; font-size: 11px; font-weight: 700; margin-bottom: 12px; }
.market-badge.gov { background: #e3f2fd; color: #1565c0; }
.market-badge.call { background: #fff3e0; color: #e65100; }
.market-badge.khf { background: #e8f5e9; color: #2e7d32; }

/* 비교표 강조 */
.compare-highlight { background: #fff3e0 !important; }
.compare-best { color: var(--success) !important; font-weight: 700; }
.compare-worst { color: var(--danger) !important; font-weight: 700; }

/* section card 공통 */
.analysis-card { background: white; padding: 12px !important; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 8px !important; }
.analysis-card h3 { font-size: 13px; color: var(--primary); margin-bottom: 8px; padding-bottom: 6px; border-bottom: 2px solid var(--primary); display: flex; align-items: center; gap: 6px; }

/* 반응형 추가 */
@media (max-width: 768px) {
  .trenit-grid { grid-template-columns: 1fr; }
  .weekend-grid { grid-template-columns: 1fr; }
  .kpi-analysis-cards { grid-template-columns: 1fr; }
  .kpi-charts-grid { grid-template-columns: 1fr; }
  .fuel-dashboard { grid-template-columns: 1fr; }
}

/* ===== 모바일: 사이드바 오버레이 방식 ===== */
@media (max-width: 768px) {
  #sidebar-toggle { display: block !important; }

  #sidebar {
    transform: translateX(-100%);
    z-index: 250;
    width: 220px;
    box-shadow: 4px 0 20px rgba(0,0,0,0.3);
  }
  #sidebar.open {
    transform: translateX(0);
  }

  /* 사이드바 열렸을 때 배경 딤 */
  #sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 240;
  }
  #sidebar-overlay.show { display: block; }

  #page-container {
    margin-left: 0 !important;
    padding: 12px 10px 16px !important;
  }

  .header-right .header-user-badge { display: none; }
  #today-date { display: none; }
}

/* ===================================================
   📱 발주톡 파싱 반응형
   =================================================== */
@media (max-width: 900px) {
  #kp-grid { grid-template-columns: 1fr !important; }
}

/* ===================================================
   🅒 PWA + 모바일 UI 전면 개선
   =================================================== */

/* PWA 설치 배너 */
.pwa-banner {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 9998;
  display: flex; align-items: center; gap: 10px;
  background: var(--primary); color: white;
  padding: 12px 16px;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.25);
}
.pwa-icon { font-size: 28px; flex-shrink: 0; }
.pwa-text { flex: 1; }
.pwa-text strong { display: block; font-size: 13px; }
.pwa-text span   { font-size: 11px; opacity: 0.85; }
.pwa-install-btn {
  background: var(--secondary); color: white; border: none;
  padding: 8px 16px; border-radius: 6px; cursor: pointer;
  font-size: 13px; font-family: inherit; font-weight: 700;
  white-space: nowrap;
}
.pwa-close-btn {
  background: none; border: none; color: white; font-size: 18px;
  cursor: pointer; padding: 4px 8px; opacity: 0.7; flex-shrink: 0;
}

/* 모바일 전용 스타일 */
@media (max-width: 768px) {
  /* 헤더 축약 */
  .header-top { padding: 6px 10px; }
  .logo-title  { font-size: 15px; }
  .logo-sub    { display: none; }
  .header-policy { display: none; }

  /* 네비: 스크롤 + 작은 버튼 */
  #main-nav { padding: 0 4px; }
  .nav-tab  { padding: 8px 10px; font-size: 10px; }
  .nav-tab i { display: block; font-size: 14px; margin-bottom: 2px; }

  /* 페이지 패딩 축소 */
  #page-container { padding: 4px 6px 10px !important; }
  .page-header { padding: 6px 10px !important; margin-bottom: 6px !important; }
  .page-header h1 { font-size: 13px !important; }

  /* 계산기 그리드 → 1열 */
  .calc-grid { grid-template-columns: 1fr !important; }

  /* 노선 빠른선택 */
  .quick-route-bar { flex-wrap: wrap; gap: 6px; }
  .qr-btn { min-width: 58px; padding: 4px 8px; }

  /* 툴바 버튼 축소 */
  .toolbar { gap: 6px; }
  .btn-import, .btn-export, .btn-template { padding: 6px 10px; font-size: 11px; }

  /* 테이블: 가로 스크롤 */
  .table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .data-table { min-width: 600px; }

  /* KPI 카드 2열 */
  .kpi-cards { grid-template-columns: 1fr 1fr; }

  /* 모달 풀스크린 */
  .modal-box { width: 96% !important; max-height: 85vh; margin: 0 auto; }

  /* 발주이력 테이블 간소화 */
  .data-table th, .data-table td { padding: 6px 8px; font-size: 11px; }

  /* 대시보드 1열 */
  .dashboard-grid { grid-template-columns: 1fr; }

  /* 워크플로우 간소화 */
  .cwf-arrow { display: none; }
  .calc-workflow { gap: 4px; }
  .cwf-step { font-size: 10px; padding: 5px 8px; }

  /* 시나리오 테이블 */
  .scenario-table { font-size: 10px; }
  .scenario-table th, .scenario-table td { padding: 4px 6px; }
}

@media (max-width: 480px) {
  /* 극소형 화면 */
  .kpi-cards { grid-template-columns: 1fr; }
  .nav-tab span { display: none; } /* 텍스트 숨김, 아이콘만 */
  .nav-tab i { font-size: 16px; margin: 0; }
  .nav-tab { padding: 10px 8px; min-width: 40px; }

  /* 빠른선택 숨김 처리 */
  .qr-label { display: none; }

  /* 헤더 더 축약 */
  .logo-icon { font-size: 22px; }
  .logo-title { font-size: 13px; }
}

/* ── 배차등록 & 발송 / 노선이력 반응형 ── */
@media (max-width: 860px) {
  #page-dispatch-mgr .page-content > div[style*="grid-template-columns:1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
  #page-route-history .page-content > div[style*="grid-template-columns:1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
  #page-route-history .page-content > div[style*="grid-template-columns:repeat(4"] {
    grid-template-columns: 1fr 1fr !important;
  }
}
@media (max-width: 540px) {
  .calc-tab-nav { flex-wrap: wrap; }
  .calc-tab { padding: 8px 10px; font-size: 11.5px; }
  .ctab-arrow { display: none; }
}

/* =====================================================
   📂 엑셀 업로드 UI
   ===================================================== */

/* 헤더 엑셀 버튼 */
.header-excel-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}
.header-excel-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(46,125,50,0.25);
  color: white;
  border: 1px solid rgba(255,255,255,0.3);
  padding: 3px 10px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 10px;
  font-family: inherit;
  font-weight: 600;
  transition: all 0.2s;
  white-space: nowrap;
}
.header-excel-btn:hover { background: rgba(46,125,50,0.5); border-color: white; }
.header-excel-btn.heatmap-btn { background: rgba(26,60,110,0.4); }
.header-excel-btn.heatmap-btn:hover { background: rgba(26,60,110,0.7); }
.header-excel-status {
  font-size: 10px;
  color: #a5d6a7;
  font-weight: 600;
  display: none;
}

/* 업로드 패널 */
.excel-upload-panel {
  background: white;
  border: 2px solid #e8f5e9;
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(46,125,50,0.08);
}
.eup-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: linear-gradient(135deg, #f1f8e9, #e8f5e9);
  border-bottom: 1px solid #c8e6c9;
  flex-wrap: wrap;
}
.eup-header strong { font-size: 13px; color: #2e7d32; }
.eup-badge {
  flex: 1;
  font-size: 11px;
  color: #666;
  background: white;
  border: 1px solid #c8e6c9;
  padding: 3px 10px;
  border-radius: 10px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: all 0.3s;
}
.eup-toggle {
  background: none;
  border: 1px solid #a5d6a7;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  cursor: pointer;
  color: #2e7d32;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}
.eup-toggle:hover { background: #e8f5e9; }
.eup-body {
  padding: 16px;
  display: none;
}

/* 드래그 앤 드롭 영역 */
.excel-drop-zone {
  border: 2px dashed #90caf9;
  border-radius: var(--radius);
  padding: 24px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: #f8fbff;
}
.excel-drop-zone:hover,
.excel-drop-zone.drag-over {
  border-color: var(--primary);
  background: #e3f2fd;
  transform: scale(1.01);
}
.excel-drop-zone p {
  color: #555;
  font-size: 13px;
  margin-bottom: 4px;
}
.eup-hint {
  margin-top: 12px;
  padding: 10px 14px;
  background: #fff8e1;
  border-radius: 6px;
  border-left: 3px solid #ffc107;
  font-size: 11px;
  color: #555;
  line-height: 1.8;
}

/* 엑셀 데이터 테이블 */
#excel-dispatch-table .data-table { font-size: 11px; }
#excel-dispatch-table th { font-size: 10px; padding: 6px 8px; }
#excel-dispatch-table td { padding: 5px 8px; }

@media (max-width: 768px) {
  .header-excel-row { display: none; } /* 모바일에서 헤더 버튼 숨김 */
  .eup-header { padding: 10px 12px; }
  .eup-badge { font-size: 10px; }
}

/* =====================================================
   📋 발주이력 상세 필터 패널
   ===================================================== */
.advanced-filter-panel {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
}
.af-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.af-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 160px;
}
.af-group label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-light);
}
.af-group input,
.af-group select {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 12px;
  font-family: inherit;
  transition: border-color 0.2s;
}
.af-group input:focus,
.af-group select:focus {
  outline: none;
  border-color: var(--primary);
}
.af-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 8px;
  border-top: 1px solid #f0f0f0;
}
.af-count {
  background: var(--primary);
  color: white;
  padding: 3px 12px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  margin-right: 4px;
}

/* 엑셀 내보내기 버튼 */
.btn-excel-export {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #2e7d32, #43a047);
  color: white;
  border: none;
  padding: 7px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
  font-weight: 600;
  transition: all 0.2s;
  box-shadow: 0 2px 6px rgba(46,125,50,0.3);
}
.btn-excel-export:hover {
  background: linear-gradient(135deg, #1b5e20, #2e7d32);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(46,125,50,0.4);
}
.btn-excel-export:active { transform: translateY(0); }

@media (max-width: 768px) {
  .af-row { gap: 8px; }
  .af-group { min-width: 140px; }
  .advanced-filter-panel { padding: 10px 12px; }
}

/* =====================================================
   ⚡ 스마트 배차요청 탭 전용 스타일
   ===================================================== */

/* 입력 폼 카드 */
.dr-form-card {
  background: white;
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
  border-top: 4px solid #e74c3c;
}
.dr-form-title {
  font-size: 14px;
  font-weight: 700;
  color: #c0392b;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* 폼 그리드 */
.dr-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.dr-field { display: flex; flex-direction: column; gap: 4px; }
.dr-field-wide { grid-column: span 2; }
.dr-field label { font-size: 11px; font-weight: 600; color: var(--text-light); }
.dr-field input, .dr-field select {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 12px;
  font-family: inherit;
  transition: border-color 0.2s;
}
.dr-field input:focus, .dr-field select:focus {
  outline: none;
  border-color: #e74c3c;
  box-shadow: 0 0 0 2px rgba(231,76,60,0.1);
}

/* 특이상황 */
.dr-special-toggle { margin-bottom: 8px; }
.dr-special-label { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: #c0392b; cursor: pointer; }
.dr-special-label input { cursor: pointer; }
.dr-special-panel {
  background: #fff8f0;
  border: 1px solid #ffccbc;
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 10px;
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 10px;
}

/* 실행 버튼 */
.dr-action-row { display: flex; gap: 10px; margin-top: 4px; }
.dr-submit-btn {
  background: linear-gradient(135deg, #c0392b, #e74c3c);
  color: white;
  border: none;
  padding: 11px 24px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 3px 10px rgba(231,76,60,0.35);
  transition: all 0.2s;
}
.dr-submit-btn:hover { background: linear-gradient(135deg, #a93226, #c0392b); transform: translateY(-1px); }
.dr-reset-btn {
  background: #ecf0f1; color: #555; border: 1px solid #bdc3c7;
  padding: 11px 18px; border-radius: 6px; font-size: 12px;
  cursor: pointer; font-family: inherit; display: flex; align-items: center; gap: 6px;
}
.dr-reset-btn:hover { background: #d5d8dc; }

/* 결과 카드 공통 */
.dr-card {
  background: white;
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
}
.dr-card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding-bottom: 8px;
  border-bottom: 2px solid #f0f0f0;
}

/* 산출 근거 */
.dr-basis-wrap { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.dr-basis-item {
  background: #f8f9fa;
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  color: #555;
}
.dr-basis-item b { color: var(--primary); }
.dr-basis-final { background: #e8f5e9; border-color: #a5d6a7; }
.dr-basis-final b { color: #2e7d32; }

/* 단계별 금액 그리드 */
.dr-step-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}
@media (max-width: 900px) { .dr-step-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 560px) { .dr-step-grid { grid-template-columns: repeat(2, 1fr); } }

.dr-step-card {
  border: 2px solid #ddd;
  border-radius: 8px;
  padding: 12px 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: #f9f9f9;
}
.dr-step-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.12); }
.dr-step-card.active {
  border-width: 3px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  transform: translateY(-2px);
}
.drs-step-label { font-size: 10px; font-weight: 600; margin-bottom: 6px; }
.drs-price { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.drs-ratio { font-size: 10px; color: #999; }
.drs-next  { font-size: 10px; margin-top: 4px; color: #888; font-weight: 600; }

/* 타이머 + 현재금액 섹션 */
.dr-timer-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}
@media (max-width: 700px) { .dr-timer-section { grid-template-columns: 1fr; } }

.dr-timer-box {
  background: white;
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  text-align: center;
}
.dr-timer-label { font-size: 11px; color: var(--text-light); margin-bottom: 6px; font-weight: 600; }
.dr-timer-bar {
  height: 6px; background: #eee; border-radius: 4px;
  overflow: hidden; margin: 8px 0;
}
.dr-timer-fill { height: 100%; border-radius: 4px; transition: width 1s linear, background 1s; }
.dr-timer-btns { display: flex; gap: 6px; justify-content: center; margin-top: 8px; }
.dr-timer-btn {
  background: #f8f9fa; border: 1px solid var(--border);
  padding: 5px 12px; border-radius: 4px; cursor: pointer;
  font-size: 11px; font-family: inherit;
}
.dr-timer-btn:hover { background: #e8f0fe; border-color: var(--primary); }

.dr-current-price-box {
  background: linear-gradient(135deg, #1a3c6e, #2557a7);
  border-radius: var(--radius);
  padding: 14px;
  color: white;
  box-shadow: var(--shadow);
}
.dr-cp-label { font-size: 11px; opacity: 0.85; margin-bottom: 4px; }
.dr-cp-val { font-size: 30px; font-weight: 700; color: #ffd54f; margin-bottom: 8px; }

/* 청구 박스 */
.dr-billing-box {
  background: rgba(255,255,255,0.1);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 12px;
}
.dr-billing-row {
  display: flex; justify-content: space-between;
  padding: 3px 0;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.dr-billing-row:last-child { border-bottom: none; }
.dr-billing-val { font-weight: 700; }
.driver-pay { color: #81d4fa; }
.margin-amt { color: #a5d6a7; }
.billing-total { color: #ffd54f; font-size: 14px; }
.total-row { margin-top: 2px; }
.dr-billing-note { font-size: 10px; opacity: 0.7; margin-top: 4px; }

/* 자동 인상 로그 */
.dr-escalate-log {
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 10px;
  font-size: 12px;
  max-height: 120px;
  overflow-y: auto;
}
.dr-log-entry { padding: 3px 0; border-bottom: 1px solid #fff3cd; }
.dr-log-time { font-weight: 700; color: #f57c00; margin-right: 6px; }

/* 완료 버튼 */
.dr-complete-row { text-align: center; margin-bottom: 12px; }
.dr-complete-btn {
  background: linear-gradient(135deg, #1b5e20, #2e7d32);
  color: white;
  border: none;
  padding: 14px 36px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(46,125,50,0.4);
  transition: all 0.2s;
}
.dr-complete-btn:hover { background: linear-gradient(135deg, #145214, #1b5e20); transform: translateY(-1px); }
.dr-complete-btn:disabled { background: #9e9e9e; cursor: default; transform: none; }

/* 완료 요약 카드 */
.dr-complete-card {
  background: white;
  border: 2px solid #a5d6a7;
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 10px;
  box-shadow: 0 2px 10px rgba(46,125,50,0.15);
}
.dr-complete-badge {
  display: inline-block;
  background: #2e7d32;
  color: white;
  padding: 4px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 12px;
}
.dr-complete-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}
.dr-cs-item {
  background: #f8f9fa;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 12px;
}
.dr-cs-item span { display: block; color: var(--text-light); font-size: 10px; margin-bottom: 2px; }
.dr-cs-item b { font-size: 13px; }
.pay-val { color: #1565c0; }
.billing-val { color: #e65100; }
.margin-val { color: #2e7d32; }

/* 문자 탭 */
.dr-msg-tabs {
  display: flex; gap: 4px; margin-bottom: 10px; flex-wrap: wrap;
}
.dr-msg-tab {
  padding: 6px 14px;
  border: 2px solid var(--border);
  background: white;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
  font-weight: 600;
  transition: all 0.2s;
}
.dr-msg-tab:hover { border-color: var(--primary); color: var(--primary); }
.dr-msg-tab.active { background: var(--primary); color: white; border-color: var(--primary); }
.dr-msg-textarea {
  width: 100%;
  font-family: 'Malgun Gothic', 'Noto Sans KR', sans-serif;
  font-size: 12px;
  line-height: 1.8;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fafafa;
  resize: vertical;
  box-sizing: border-box;
}
.dr-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary);
  color: white;
  border: none;
  padding: 7px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
  margin-top: 8px;
  transition: background 0.2s;
}
.dr-copy-btn:hover { background: var(--primary-light); }

/* 탭 네비: 배차요청 강조 */
.dispatch-req-tab {
  color: #ff8a80 !important;
  border-bottom: 3px solid transparent;
}
.dispatch-req-tab.active {
  color: #ff5252 !important;
  border-bottom-color: #ff5252 !important;
  background: rgba(231,76,60,0.15) !important;
}

@media (max-width: 768px) {
  .dr-form-grid { grid-template-columns: 1fr 1fr; }
  .dr-field-wide { grid-column: span 2; }
  .dr-special-panel { grid-template-columns: 1fr; }
  .dr-step-grid { grid-template-columns: repeat(2, 1fr); }
  .dr-timer-section { grid-template-columns: 1fr; }
}

/* =====================================================
   🔧 분석탭 섹션 자체 여백 강제 제거
   ===================================================== */

/* 유가관리 section */
.fuel-current-section,
.fuel-history-section,
.fuel-sim-section,
.fuel-matrix-section {
  background: white;
  border-radius: var(--radius);
  padding: 12px 14px !important;
  margin-bottom: 8px !important;
  box-shadow: var(--shadow);
}
.fuel-current-section h3,
.fuel-history-section h3,
.fuel-sim-section h3,
.fuel-matrix-section h3 {
  font-size: 13px;
  color: var(--primary);
  margin-bottom: 8px !important;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

/* 유가 현황 카드 그리드 */
.fuel-current-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px !important;
}
.fuel-card {
  background: #f8f9fa;
  border-radius: 6px;
  padding: 10px 12px !important;
  border-left: 4px solid var(--primary);
}
.fuel-card.base { border-left-color: #546e7a; }
.fuel-card.current { border-left-color: var(--secondary); }
.fuel-card.diff { border-left-color: var(--warning); }
.fuel-card.adjust { border-left-color: var(--success); }
.fc-label { font-size: 11px; color: var(--text-light); margin-bottom: 4px; }
.fc-val { font-size: 18px; font-weight: 700; color: var(--primary); }
.fc-sub { font-size: 10px; color: var(--text-light); margin-top: 2px; }
.fc-input-wrap { display: flex; align-items: center; gap: 4px; }
.fc-input-wrap input { padding: 4px 8px; border: 1px solid var(--border); border-radius: 4px; font-size: 15px; font-weight: 700; width: 80px; font-family: inherit; }
.fc-input-wrap span { font-size: 12px; color: var(--text-light); }

/* 트레닛 탭 section */
.trenit-section,
.trenit-chart-section {
  margin-bottom: 8px !important;
}

/* 노선마스터 toolbar */
.page-routes .toolbar,
.page-fuel .toolbar {
  margin-bottom: 8px !important;
}

/* 모든 분석탭 내 첫번째 child 상단여백 제거 */
.page-content > *:first-child {
  margin-top: 0 !important;
}
.page-content > .page-header {
  margin-top: 0 !important;
}

/* fuel-formula */
.fuel-formula {
  margin-top: 8px;
  padding: 8px 12px;
  background: #fff8e1;
  border-radius: 4px;
  font-size: 11px;
  color: #795548;
  border-left: 3px solid #ffc107;
}

/* 모바일 섹션 여백 추가 조정 */
@media (max-width: 768px) {
  .fuel-current-section,
  .fuel-history-section,
  .fuel-sim-section,
  .fuel-matrix-section {
    padding: 10px !important;
    margin-bottom: 6px !important;
  }
}
