/* ── Alarm page ── */
.alarm-body {
  padding: 20px;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.alarm-card {
  background: #fff;
  border-radius: 8px;
  border: 1px solid #dde3ea;
  overflow: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.alarm-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid #dde3ea;
  background: #f7f9fc;
}

.alarm-title {
  font-size: 15px;
  font-weight: 700;
  color: #1a2b45;
}

.alarm-filter {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-label {
  font-size: 13px;
  font-weight: 600;
  color: #1a2b45;
  white-space: nowrap;
}

.filter-sep {
  font-size: 13px;
  color: #888;
}

.alarm-date-input {
  border: 1px solid #c8d0da;
  border-radius: 4px;
  padding: 5px 8px;
  font-size: 13px;
  color: #333;
  outline: none;
  cursor: pointer;
}

.alarm-date-input:focus {
  border-color: #3a6fd8;
}

.alarm-search-btn {
  background: #3a6fd8;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 5px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.alarm-search-btn:hover {
  background: #2d5bbf;
}

.alarm-reset-btn {
  background: #f0f2f5;
  color: #555;
  border: 1px solid #c8d0da;
  border-radius: 4px;
  padding: 5px 12px;
  font-size: 13px;
  cursor: pointer;
}

.alarm-reset-btn:hover {
  background: #e2e6ea;
}

/* ── 결함이력분석 탭 UI ───────────────────────────────────────────────────
 * 포스트잇(연결형) 탭 스타일:
 * - .fa-tab-bar 하단에 2px 실선을 긋고,
 *   active 탭이 margin-bottom: -2px로 그 선을 덮어 콘텐츠와 연결된 것처럼 보인다.
 * - 탭들은 border-right를 공유 (margin-right: -1px)해 겹쳐 보이지 않게 한다.
 * ─────────────────────────────────────────────────────────────────────── */

/* 탭 버튼들을 담는 바: 제목과 탭을 한 줄에 배치, 하단 선으로 콘텐츠와 구분 */
.fa-tab-bar {
  display: flex;
  align-items: flex-end;
  padding: 0 16px;
  border-bottom: 2px solid #c8d0da;
}
/* 탭 바 왼쪽의 페이지 제목 */
.fa-tab-title {
  font-size: 15px;
  font-weight: 700;
  color: #222;
  padding-bottom: 8px;
  margin-right: 16px;
}
/* 비활성 탭: 회색 배경, border-bottom 없음(아래로 열린 형태) */
.fa-tab-btn {
  background: #e8eaed;
  color: #999;
  border: 1px solid #c8d0da;
  border-bottom: none;
  border-right: none;
  padding: 6px 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 4px 4px 0 0;
  margin-bottom: -2px;  /* fa-tab-bar의 border-bottom(2px)을 active 탭이 덮을 수 있도록 올림 */
  margin-right: -1px;   /* 인접 탭 간 border가 2px로 겹쳐 보이지 않도록 1px 겹침 */
  position: relative;
}
/* 마지막 탭만 오른쪽 border 복원 */
.fa-tab-btn:last-of-type {
  border-right: 1px solid #c8d0da;
}
/* 활성 탭: 흰 배경 + border-bottom을 흰색으로 덮어 아래 콘텐츠와 시각적으로 연결 */
.fa-tab-btn.active {
  background: #fff;
  color: #222;
  border-color: #c8d0da;
  border-bottom: 2px solid #fff;
  z-index: 1;
}
/* 탭 콘텐츠 패널: flex 안에서 남은 공간을 채우고 내부 스크롤 허용 */
.fa-tab-panel {
  padding: 16px 24px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.alarm-count {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: #e74c3c;
  border-radius: 12px;
  padding: 2px 10px;
}

.alarm-table-wrap {
  overflow: auto;
  flex: 1;
  min-height: 0;
}

.alarm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.alarm-table thead th {
  background: #1a2b45;
  color: #cdd6e0;
  font-weight: 600;
  padding: 7px 10px;
  text-align: center;
  white-space: nowrap;
}

.alarm-table tbody tr:nth-child(even) {
  background: #f7f9fc;
}

.alarm-table tbody tr:hover {
  background: #eaf2ff;
}

.alarm-table tbody td {
  padding: 6px 10px;
  text-align: center;
  border-bottom: 1px solid #eef0f3;
  color: #333;
  white-space: nowrap;
}

.alarm-loading {
  text-align: center;
  color: #aaa;
  padding: 32px !important;
}

/* 운전정보이력 2단 헤더 */
.drive-table {
  font-size: 12px;
}

.drive-table thead tr:first-child th {
  background: #152236;
  border-bottom: 2px solid #4a9eff;
  padding: 7px 8px;
}

.drive-table thead tr:last-child th {
  background: #2d5a8e;
  font-size: 11px;
  color: #e8f2ff;
  padding: 6px 8px;
}

.drive-table tbody td {
  padding: 6px 8px;
}

.drive-table thead th.group-start {
  border-left: 2px solid #4a9eff;
}

.drive-table tbody td.group-start {
  border-left: 2px solid #c8ddf0;
}

.error-code-badge {
  display: inline-block;
  background: #fdecea;
  color: #c0392b;
  font-weight: 700;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 12px;
}

.warn-badge {
  display: inline-block;
  background: #fff3cd;
  color: #856404;
  font-weight: 600;
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 11px;
  margin: 1px 2px;
}

/* ── Dashboard layout ── */
.dashboard-body {
  display: grid;
  grid-template-columns: 1fr 2fr;
  grid-template-rows: auto auto 2fr 1fr;
  gap: 10px;
  padding: 14px;
  height: 100%;
  box-sizing: border-box;
  overflow: auto;
}


/* ── Cards ── */
.dash-card {
  background: #fff;
  border: 1px solid #d0d7e2;
  border-radius: 4px;
  padding: 10px 12px;
}

.dash-card-title {
  font-size: 16px;
  font-weight: 700;
  color: #1a2b45;
  margin-bottom: 10px;
  border-bottom: 1px solid #eaeef3;
  padding-bottom: 6px;
}

.carbon-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.carbon-calc-link {
  font-size: 11px;
  font-weight: 500;
  color: #4a7fc1;
  text-decoration: none;
  border: 1px solid #4a7fc1;
  border-radius: 4px;
  padding: 2px 7px;
  white-space: nowrap;
}

.carbon-calc-link:hover {
  background: #4a7fc1;
  color: #fff;
}

/* ── Weather ── */
.weather-select-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.weather-select {
  padding: 4px 8px;
  font-size: 13px;
  border: 1px solid #c8d0da;
  border-radius: 4px;
  color: #1a2b45;
  background: #f7f9fc;
  cursor: pointer;
  outline: none;
}

.weather-select:focus {
  border-color: #3a6fd8;
}

.weather-display {
  display: flex;
  align-items: center;
  gap: 6px;
}

.weather-icon-big {
  font-size: 18px;
  line-height: 1;
}

.weather-temp-big {
  font-size: 15px;
  font-weight: 700;
  color: #3a6fd8;
}

.weather-loading {
  font-size: 12px;
  color: #8a9ab0;
}

/* ── Top row ── */
.dash-weather {
  grid-column: 1;
  grid-row: 1;
  font-size: 13px;
  font-weight: 600;
  color: #1a2b45;
}

/* ── Stat boxes ── */
.dash-stats {
  grid-column: 1;
  grid-row: 2;
  display: flex;
  gap: 8px;
}

.stat-box {
  flex: 1;
  background: #fff;
  border: 1px solid #d0d7e2;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.stat-box.error {
  border-color: #f5c6c6;
}

.stat-label {
  font-size: 10px;
  font-weight: 600;
  color: #fff;
  background: #3a6fd8;
  padding: 5px 10px;
  text-align: center;
}

.stat-box.error .stat-label {
  background: #e74c3c;
}

.stat-value {
  font-size: 26px;
  font-weight: 500;
  color: #1a2b45;
  text-align: center;
  padding: 10px 0;
}

.stat-box.error .stat-value {
  color: #e74c3c;
}

/* ── Carbon reduction ── */
.dash-carbon {
  grid-column: 1;
  grid-row: 3;
}

.carbon-row {
  margin-bottom: 10px;
}

.carbon-label {
  font-size: 12px;
  color: #3a4a5c;
  margin-bottom: 4px;
}

.carbon-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
  font-weight: 700;
}

.carbon-bar-track {
  background: #e8edf3;
  border-radius: 2px;
  height: 14px;
  flex: 1;
  overflow: hidden;
}

.carbon-value {
  font-size: 26px;
  font-weight: 700;
  color: #1a2b45;
  min-width: 24px;
  text-align: right;
}

.carbon-value-num {
  font-size: 26px;
  font-weight: 700;
}

.carbon-unit,
.card-subtitle {
  font-size: 12px;
  font-weight: 400;
  color: #5a6a7a;
}


.carbon-bar-fill {
  height: 100%;
  background: #3a6fd8;
  border-radius: 2px;
  transition: width 0.6s ease;
}

.carbon-formula-note {
  margin-top: 20px;
  padding-top: 10px;
  border-top: 1px solid #dde3ea;
  font-size: 11px;
  color: #aaa;
  line-height: 1.6;
}
.carbon-formula-note a {
  color: #aaa;
  text-decoration: underline;
}

/* ── Regional defect chart ── */
.dash-defect {
  grid-column: 1;
  grid-row: 4;
}

/* ── Map area ── */
.dash-map {
  grid-column: 2;
  grid-row: 1 / 4;
  display: grid;
  grid-template-rows: auto 1fr;
  padding: 6px;
  gap: 4px;
  overflow: hidden;
}

#vehicle-map {
  width: 100%;
  height: 100%;
  min-height: 0;
  border-radius: 4px;
  z-index: 0;
}

.map-legend {
  font-size: 12px;
  color: #3a4a5c;
  display: flex;
  align-items: center;
  gap: 4px;
}

.legend-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 2px rgba(0,0,0,0.3);
}

.legend-dot.ok    { background: #2ecc71; }
.legend-dot.error { background: #e74c3c; }

/* ── Regional operation table ── */
.dash-region-table {
  grid-column: 2;
  grid-row: 4;
  overflow: auto;
}

.region-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.region-table th,
.region-table td {
  border: 1px solid #d0d7e2;
  padding: 5px 8px;
  text-align: center;
  color: #3a4a5c;
}

.region-table th {
  background: #f0f4f8;
  font-weight: 600;
  color: #1a2b45;
}

.region-table tr:nth-child(even) td {
  background: #fafbfc;
}

/* ── 지도 차량 팝업 ── */
.vehicle-popup-table {
  border-collapse: collapse;
  font-size: 12px;
  width: 100%;
}

.vehicle-popup-table tr + tr {
  border-top: 1px solid #eaeef3;
}

.vp-label {
  color: #6b7a8d;
  font-weight: 600;
  padding: 4px 10px 4px 2px;
  white-space: nowrap;
}

.vp-val {
  color: #1a2b45;
  padding: 4px 2px;
}

.vehicle-popup-loading {
  font-size: 12px;
  color: #8a9ab0;
  padding: 8px;
}
