/* IMOS 웹 콘솔 디자인 토큰 — 앱 디자인 시스템(navy/gold/상태색) + 웹 정의서의 teal 액센트 */
:root {
  --imos-navy: #1A2849;
  --imos-navy-deep: #131E38;
  --imos-gold: #C9A227;
  --imos-teal: #0E8074;
  --imos-teal-bg: #E3F1EF;
  --imos-grey: #6B7280;
  --imos-grey-light: #9CA3AF;
  --imos-green: #2E7D5B;   --imos-green-bg: #E5F1EB;
  --imos-amber: #B8860B;   --imos-amber-bg: #FDF6E3;
  --imos-red: #C0392B;     --imos-red-bg: #FDECEA;
  --imos-line: #E5E7EB;
  --imos-chip-bg: #F3F4F6;
  --imos-page-bg: #F6F7F9;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Apple SD Gothic Neo', 'Malgun Gothic', 'Noto Sans KR', sans-serif;
  color: #1F2937;
  background: var(--imos-page-bg);
  font-size: 14px;
}
button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; font-size: 14px; }
a { color: var(--imos-teal); text-decoration: none; }

/* ── 로그인 ─────────────────────────────────────────── */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card {
  width: 340px; background: #fff; border: 1px solid var(--imos-line); border-radius: 12px;
  padding: 26px 32px 40px; box-shadow: 0 8px 30px rgba(26, 40, 73, 0.08); text-align: center;
}
/* 부제를 없애면서 로고가 폼에 붙어 아래로 치우쳐 보였음 — 위 여백을 줄이고 아래 간격 확보 */
.login-logo { margin-bottom: 26px; }
.login-logo .dot { color: var(--imos-gold); }
.login-sub { font-size: 11px; letter-spacing: 4px; color: var(--imos-grey-light); margin: 6px 0 28px; }
.login-card input {
  width: 100%; padding: 12px 14px; margin-bottom: 10px;
  border: 1px solid var(--imos-line); border-radius: 8px; background: var(--imos-chip-bg);
}
.login-card input:focus { outline: 2px solid var(--imos-teal); background: #fff; }
.btn-login {
  width: 100%; padding: 13px; margin-top: 8px; border: none; border-radius: 8px;
  background: var(--imos-navy); color: #fff; font-size: 15px; font-weight: 700;
}
.btn-login:hover { background: var(--imos-navy-deep); }
.login-error { color: var(--imos-red); font-size: 12px; min-height: 18px; margin-top: 10px; }
.login-links { margin-top: 14px; font-size: 12px; }
.login-hint {
  margin-top: 22px; padding: 10px; border-radius: 8px; background: var(--imos-chip-bg);
  font-size: 11px; color: var(--imos-grey); text-align: left; line-height: 1.7;
}

/* ── 콘솔 레이아웃 ──────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 216px; flex: none; background: var(--imos-navy); color: #fff;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
/* CI 로고(검정 글자)는 네이비 사이드바에서 안 보이므로 로고 영역 전체를 흰 배경으로.
   영역 전체가 대시보드(첫 화면)로 가는 링크입니다. */
.sidebar .brand { display:block; background:#fff; padding: 16px 18px; border:1px solid var(--imos-line); }
.sidebar .brand img { display:block; width:100%; }
.sidebar nav { flex: 1; }
.sidebar .nav-item {
  display: flex; align-items: center; gap: 10px; padding: 13px 20px;
  color: #C7CDDA; font-size: 14px; cursor: pointer; border-left: 3px solid transparent;
}
.sidebar .nav-item:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.sidebar .nav-item.active { background: var(--imos-teal); color: #fff; border-left-color: var(--imos-gold); }
.sidebar .nav-item svg { width: 17px; height: 17px; flex: none; }
.sidebar .foot { padding: 16px 20px; font-size: 11px; color: #8792A8; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 28px; background: #fff; border-bottom: 1px solid var(--imos-line);
}
.topbar h1 { font-size: 19px; color: var(--imos-navy); }
.topbar-right { display: flex; align-items: center; gap: 16px; }

/* 상단바 범위 선택: 본사 관리자 = 회사 드롭다운 / 현장 관리자 = 소속 고정 표시 */
.scope-box { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--imos-grey); }
.scope-box select { max-width: 170px; font-size: 12.5px; }
.scope-fixed {
  background: var(--imos-chip-bg); color: var(--imos-navy); font-weight: 700;
  padding: 6px 14px; border-radius: 999px; font-size: 12.5px;
}

.user-chip { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--imos-grey); }
.user-chip .role-badge {
  background: var(--imos-teal-bg); color: var(--imos-teal); font-weight: 700;
  padding: 3px 10px; border-radius: 999px; font-size: 12px;
}
.btn-logout {
  border: 1px solid var(--imos-line); background: #fff; border-radius: 6px;
  padding: 5px 12px; font-size: 12px; color: var(--imos-grey);
}
.btn-logout:hover { border-color: var(--imos-red); color: var(--imos-red); }
.content { padding: 24px 28px; }

/* ── 공통 컴포넌트 ──────────────────────────────────── */
.card { background: #fff; border: 1px solid var(--imos-line); border-radius: 10px; }
.section-title { font-size: 17px; font-weight: 700; color: var(--imos-navy); }
.toolbar { display: flex; align-items: center; gap: 10px; margin: 14px 0; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }

.btn {
  border: none; border-radius: 7px; padding: 9px 16px; font-size: 13px; font-weight: 700;
}
.btn-teal { background: var(--imos-teal); color: #fff; }
.btn-teal:hover { filter: brightness(1.08); }
.btn-ghost { background: #fff; border: 1px solid var(--imos-line); color: var(--imos-grey); }

select.filter, input.filter {
  padding: 8px 12px; border: 1px solid var(--imos-line); border-radius: 7px; background: #fff;
}

/* 표 */
table.imos { width: 100%; border-collapse: collapse; background: #fff; }
table.imos thead th {
  background: var(--imos-navy); color: #fff; font-size: 12.5px; font-weight: 600;
  padding: 11px 14px; text-align: left; white-space: nowrap;
}
table.imos thead th.sortable { cursor: pointer; user-select: none; }
table.imos thead th.sortable:hover,
table.imos thead th.sortable:focus-visible { background-image: linear-gradient(rgba(255,255,255,.14), rgba(255,255,255,.14)); outline: none; }
table.imos thead th .sort-ind { display: inline-block; margin-left: 5px; font-size: 10px; opacity: .45; }
table.imos thead th.sorted .sort-ind { opacity: 1; color: var(--imos-gold); }
table.imos tbody td { padding: 13px 14px; border-bottom: 1px solid var(--imos-line); white-space: nowrap; }
table.imos tbody tr:nth-child(even) { background: #FAFBFC; }
table.imos tbody tr.clickable { cursor: pointer; }
table.imos tbody tr.clickable:hover { background: var(--imos-teal-bg); }
table.imos tbody td.wrap { white-space: normal; }

/* 대시보드 회사별 현황 — 사이트 칩 나열 */
.co-sites { display: flex; flex-wrap: wrap; gap: 6px; }

/* 배터리 모니터링 카드 (SOC 게이지 + 사용 추이) */
.mon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.mon-card { padding: 16px; }
.mon-card.clickable { cursor: pointer; }
.mon-card.clickable:hover { border-color: var(--imos-teal); box-shadow: 0 2px 8px rgba(14, 128, 116, .12); }
.mon-title { font-weight: 700; font-size: 14px; color: var(--imos-navy); display: flex; align-items: center; gap: 6px; }
.mon-title .mon-info { color: var(--imos-grey-light); font-weight: 400; cursor: help; }
.mon-sub { font-size: 11.5px; color: var(--imos-grey); margin: 3px 0 8px; }
.mon-alerts { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.mon-legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: 11px; color: var(--imos-grey); margin-top: 8px; }
.mon-legend .sw { width: 10px; height: 10px; border-radius: 2px; display: inline-block; margin-right: 4px; vertical-align: -1px; }
.mon-x { font-size: 10.5px; color: var(--imos-grey-light); margin-top: 4px; }
.table-note { font-size: 12px; color: var(--imos-grey); margin-top: 10px; }

/* 상태 칩 */
.chip { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.chip-green { background: var(--imos-green-bg); color: var(--imos-green); }
.chip-amber { background: var(--imos-amber-bg); color: var(--imos-amber); }
.chip-red   { background: var(--imos-red-bg);   color: var(--imos-red); }
.chip-gray  { background: var(--imos-chip-bg);  color: var(--imos-grey); }
.chip-teal  { background: var(--imos-teal-bg);  color: var(--imos-teal); }
.t-green { color: var(--imos-green); font-weight: 700; }
.t-amber { color: var(--imos-amber); font-weight: 700; }
.t-red   { color: var(--imos-red);   font-weight: 700; }
.t-teal  { color: var(--imos-teal);  font-weight: 700; }
.t-grey  { color: var(--imos-grey); }

/* KPI 카드 */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.kpi { padding: 18px 20px; }
.kpi .num { font-size: 28px; font-weight: 800; }
.kpi .label { font-size: 12.5px; color: var(--imos-grey); margin-top: 4px; }

/* 대시보드 지도 패널 (OpenFreeMap + MapLibre) */
.dash-grid { display: grid; grid-template-columns: 1fr 300px; gap: 14px; margin-top: 14px; }
.map-panel { padding: 0; overflow: hidden; }
.map-panel .map-head { display: flex; justify-content: space-between; padding: 12px 16px; font-size: 12.5px; color: var(--imos-grey); border-bottom: 1px solid var(--imos-line); }
.map-head-meta { color: var(--imos-grey-light); }
.map-wrap { position: relative; height: 380px; background: #f2f3f0; }

/* 모니터링 전체화면 (2026-09-05) — 상단 현황 + 사이트 맵만. ESC 로 복귀 */
.monitor-mode { background: var(--imos-bg, #F5F6F8); padding: 18px; overflow: auto; }
.monitor-mode > :not(.kpi-row):not(.dash-grid) { display: none; }
.monitor-mode .dash-grid { grid-template-columns: 1fr !important; }
.monitor-mode .drift-panel { display: none; }
.monitor-mode .map-wrap { height: calc(100vh - 240px); }
.monitor-mode #btn-monitor { display: none; }
.map-canvas { position: absolute; inset: 0; }
.site-marker {
  border: 2px solid #fff; padding: 0;
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 14px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25); cursor: pointer;
}
.site-marker.s-green { background: #17A589; }
.site-marker.s-amber { background: #D69E2E; }
.site-marker.s-red   { background: #C0392B; }
.site-marker.s-grey  { background: #8792A8; }
.site-marker:focus-visible { outline: 3px solid rgba(14, 128, 116, 0.45); outline-offset: 2px; }
.map-legend {
  position: absolute; z-index: 2; left: 14px; bottom: 12px; display: flex; gap: 14px;
  background: rgba(255, 255, 255, 0.92); border-radius: 8px; padding: 8px 14px; font-size: 12px;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.12);
}
.map-legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; }
.map-notice {
  position: absolute; z-index: 2; top: 12px; left: 12px; max-width: calc(100% - 100px);
  padding: 7px 10px; border-radius: 7px; background: rgba(255, 255, 255, 0.94);
  color: var(--imos-grey); font-size: 11.5px; box-shadow: 0 1px 5px rgba(0, 0, 0, 0.12);
}
.map-error { height: 100%; display: grid; place-items: center; color: var(--imos-grey); font-size: 13px; }
.maplibregl-popup-content { color: var(--imos-navy); font-family: inherit; font-size: 12.5px; line-height: 1.5; border-radius: 8px; }
.maplibregl-popup-content b { display: block; margin-right: 12px; }

.drift-panel { padding: 14px 16px; }
.drift-panel h3 { font-size: 13.5px; color: var(--imos-navy); margin-bottom: 10px; }
.drift-item { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--imos-line); font-size: 13px; }
.drift-item:last-child { border-bottom: none; }
.drift-item .dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 4px; flex: none; }

/* 점검 상세 팝업의 요약 문구 */
.insp-extra { margin-top: 8px; font-size: 13px; }

/* 배터리 Detail (정의서의 다크 패널 톤) */
.batt-dark { background: var(--imos-navy-deep); border-radius: 12px; padding: 20px 22px; color: #E7EAF2; }
.batt-dark .head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.batt-dark .head .title { font-size: 18px; font-weight: 800; }
.batt-dark .head .title .site { font-size: 13px; color: #9AA5BD; font-weight: 400; margin-left: 8px; }
.sync-chip {
  background: rgba(14, 128, 116, 0.25); border: 1px solid rgba(14, 128, 116, 0.5);
  color: #7BD8CC; font-size: 12px; padding: 6px 12px; border-radius: 8px;
}
.cell-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-top: 16px; }
.cell-card {
  background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 8px; padding: 10px 12px; cursor: pointer;
}
.cell-card:hover { border-color: var(--imos-teal); }
.cell-card .cn { font-size: 11px; color: #9AA5BD; }
.cell-card .cv { font-size: 17px; font-weight: 800; margin-top: 3px; }
.cell-card.low { border-color: rgba(192, 57, 43, 0.7); }
.cell-card.low .cv { color: #FF8A7A; }
.batt-info-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 12px; }
.batt-info {
  background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 8px; padding: 12px 14px;
}
.batt-info .k { font-size: 11px; color: #9AA5BD; }
.batt-info .v { font-size: 19px; font-weight: 800; margin-top: 4px; }
.batt-info .s { font-size: 11px; color: #7BD8CC; margin-top: 4px; }
.overall-panel {
  background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 10px; padding: 14px 16px; margin-top: 14px;
}
.overall-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.range-btns button {
  background: transparent; border: 1px solid rgba(255, 255, 255, 0.2); color: #C7CDDA;
  border-radius: 6px; padding: 4px 12px; font-size: 12px; margin-left: 6px;
}
.range-btns button.on { background: var(--imos-gold); border-color: var(--imos-gold); color: #1A2849; font-weight: 700; }
.chart-legend { display: flex; gap: 14px; font-size: 11.5px; color: #9AA5BD; margin-top: 6px; }
.chart-legend .sw { display: inline-block; width: 14px; height: 3px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }

/* 모달 */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.55);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal {
  background: #fff; border-radius: 12px; width: 420px; max-width: calc(100vw - 40px);
  padding: 20px 22px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}
.modal.wide { width: 680px; max-height: calc(100vh - 40px); overflow-y: auto; }
.modal.dark { background: var(--imos-navy-deep); color: #E7EAF2; border: 1px solid rgba(255, 255, 255, 0.15); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-head .title { font-size: 15px; font-weight: 800; }
.modal-close { background: none; border: none; font-size: 18px; color: inherit; opacity: 0.6; }
.modal-close:hover { opacity: 1; }
.modal label { display: block; font-size: 12px; color: var(--imos-grey); margin: 10px 0 4px; }
.modal input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--imos-line);
  border-radius: 7px; background: var(--imos-chip-bg);
}
.modal input:focus { outline: 2px solid var(--imos-teal); background: #fff; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* 고객사 사이트·장비 공용 위치 검색/선택기 */
.location-search-row { display: flex; gap: 8px; align-items: center; }
.location-search-row input { min-width: 0; flex: 1; }
.location-search-row .btn { flex: none; }
.location-results { display: grid; gap: 4px; max-height: 150px; overflow-y: auto; margin-top: 6px; }
.location-results.message { display: block; color: var(--imos-grey); font-size: 12px; padding: 5px 2px; }
.location-result {
  width: 100%; border: 1px solid var(--imos-line); border-radius: 6px; background: #fff;
  padding: 7px 9px; text-align: left; color: var(--imos-navy); font-size: 12px; line-height: 1.4;
}
.location-result:hover, .location-result:focus-visible { border-color: var(--imos-teal); background: var(--imos-teal-bg); }
.location-map { height: 270px; margin-top: 8px; border: 1px solid var(--imos-line); border-radius: 8px; overflow: hidden; background: #f2f3f0; }
.location-map .maplibregl-canvas { cursor: crosshair; }
.location-coordinate-row { display: flex; align-items: center; gap: 8px; margin-top: 7px; font-size: 11.5px; color: var(--imos-grey); }
.location-coordinate-row span { flex: 1; }
.location-coordinate-row .btn { padding: 4px 9px; font-size: 11px; }
.location-attribution { margin-top: 5px; color: var(--imos-grey-light); font-size: 10.5px; line-height: 1.4; }
.location-attribution a { color: inherit; }

/* 빈 상태 */
.empty { padding: 40px; text-align: center; color: var(--imos-grey-light); font-size: 13px; }

/* ── 배터리 현황 (WEB-02) — 서준송 팀장 제안 기반 ───────────────────── */
.bo-alert { display:flex; padding:14px 18px; border-left:3px solid var(--imos-red); }
.bo-alert-head { display:flex; align-items:center; gap:12px; width:100%; flex-wrap:wrap; }
.bo-ok { display:flex; align-items:center; gap:10px; padding:14px 18px; border-left:3px solid var(--imos-green); }

.batt-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(300px, 1fr)); gap:14px; }
.batt-card { display:flex; flex-direction:column; gap:11px; padding:18px; }
.batt-card.risk { border-color:#F0C2BC; box-shadow:0 0 0 1px #F0C2BC inset; }
.batt-card:hover { border-color:var(--imos-teal); }
.batt-head { display:flex; align-items:flex-start; justify-content:space-between; gap:10px; }
.batt-id { font-size:15px; font-weight:800; }
.batt-loc { font-size:11.5px; color:var(--imos-grey); margin-top:2px; }

.batt-gauge-row { display:flex; align-items:center; gap:14px; }
.batt-gauge-row > svg { flex:0 0 186px; }
.batt-stats { display:flex; flex-direction:column; gap:5px; font-size:12.5px; flex:1; }
.batt-stats .row { display:flex; justify-content:space-between; gap:12px; }
.batt-stats .k { color:var(--imos-grey); }
.batt-stats .v { font-weight:700; }

.batt-est { background:var(--imos-teal-bg); color:#1F2937; border-radius:8px;
  padding:9px 12px; font-size:12.5px; line-height:1.5; }
.batt-foot { display:flex; justify-content:space-between; font-size:11.5px; color:var(--imos-grey);
  border-top:1px solid var(--imos-line); padding-top:9px; }
.batt-flags { display:flex; flex-wrap:wrap; gap:6px; }

/* 로그인 — 임시 비밀번호 변경 안내 */
.login-notice {
  background: var(--imos-amber-bg); color: var(--imos-amber);
  border-radius: 8px; padding: 12px 14px; font-size: 12.5px; line-height: 1.6;
  margin-bottom: 14px; text-align: left;
}

/* ── 배터리 상태 · 사용 현황 카드 (2026-08-31 시안) ─────────────────── */
.chip-blue { background:#E8F0FE; color:#2563EB; }
.bo2-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(320px, 1fr)); gap:16px; }
.bo2-card { padding:20px; display:flex; flex-direction:column; gap:12px; }
.bo2-card.clickable { cursor:pointer; }
.bo2-card.clickable:hover { border-color:var(--imos-teal); }
.bo2-card.risk { border-color:#F0A99E; box-shadow:0 0 0 1px #F0A99E inset; background:#FFFBFA; }
.bo2-head { display:flex; align-items:flex-start; justify-content:space-between; gap:10px; }
.bo2-serial { font-size:19px; font-weight:800; letter-spacing:-0.2px; }
.bo2-sub { font-size:12.5px; color:var(--imos-grey); margin-top:3px; }
.bo2-body { display:flex; align-items:center; gap:18px; }
.bo2-body > svg { flex:0 0 116px; }
.bo2-kv { flex:1; display:flex; flex-direction:column; gap:9px; font-size:13px; }
.bo2-kv .row { display:flex; justify-content:space-between; gap:12px; }
.bo2-kv .k { color:var(--imos-grey); }
.bo2-kv .v { font-weight:800; }
.bo2-divider { border-top:1px solid var(--imos-line); }
.bo2-usage { font-size:12.5px; }
.bo2-bar { height:8px; border-radius:5px; background:#EDEFF2; overflow:hidden; margin-top:7px; }
.bo2-bar > div { height:100%; border-radius:5px; background:#2E9E77; }
.bo2-warnbox { background:#FEF6E7; color:#8A5A00; border-radius:8px; padding:10px 12px;
  font-size:12.5px; font-weight:700; }
.bo2-graybox { background:#F3F4F6; color:#4B5563; border-radius:8px; padding:10px 12px;
  font-size:12.5px; font-weight:600; }
.bo2-foot { display:flex; justify-content:space-between; font-size:12.5px; }
.mon2-grid { grid-template-columns:repeat(auto-fill, minmax(360px, 1fr)); }

