:root {
  --bg: #f3f5f9; --surface: #ffffff; --surface-2: #f7f8fb; --border: #e1e5ec;
  --text: #1b2330; --text-2: #5b6575; --text-3: #8a93a3;
  --brand: #004386; --brand-2: #0a5cb0; --brand-soft: #e6eef8;
  --ok: #1f9d55; --ok-soft: #e3f5ea; --bad: #d64545; --bad-soft: #fbe6e6;
  --warn: #d98a00; --warn-soft: #fdf1d9; --idle: #7c8698; --idle-soft: #eceef2;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  --radius: 12px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0f141b; --surface: #171e27; --surface-2: #1d2530; --border: #2a3442;
  --text: #e6ebf2; --text-2: #a7b1c0; --text-3: #758195;
  --brand: #5aa2ec; --brand-2: #7ab6f2; --brand-soft: #18293d;
  --ok: #3cc47a; --ok-soft: #133224; --bad: #f06a6a; --bad-soft: #3a1c1f;
  --warn: #f0b03c; --warn-soft: #382a12; --idle: #8a95a8; --idle-soft: #232b36;
  --shadow: 0 1px 2px rgba(0,0,0,.4);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
  font-size: 14px; line-height: 1.5; -webkit-text-size-adjust: 100%;
}
a { color: var(--brand); }
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--text-2); }
.small { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }

/* ── header ── */
.topbar {
  position: sticky; top: 0; z-index: 50; background: var(--surface);
  border-bottom: 1px solid var(--border); box-shadow: var(--shadow);
}
.topbar-inner { display: flex; align-items: center; gap: 12px; padding: 8px 16px; max-width: 1480px; margin: 0 auto; }
.logo { height: 34px; width: auto; display: block; }
.logo-dark { display: none; }
:root[data-theme="dark"] .logo-light { display: none; }
:root[data-theme="dark"] .logo-dark { display: block; }
.app-title { font-weight: 700; font-size: 16px; white-space: nowrap; padding-left: 12px; border-left: 1px solid var(--border); }
.spacer { flex: 1; }
.user-box { display: flex; align-items: center; gap: 8px; }
.user-name { font-size: 13px; color: var(--text-2); white-space: nowrap; }
.tabs { display: flex; gap: 2px; padding: 0 12px; max-width: 1480px; margin: 0 auto; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  border: 0; background: none; padding: 10px 14px; cursor: pointer; color: var(--text-2);
  border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 600;
}
.tab.active { color: var(--brand); border-bottom-color: var(--brand); }
.tab .badge { margin-left: 4px; }

main { max-width: 1480px; margin: 0 auto; padding: 16px; }
.page { display: none; }
.page.active { display: block; }

/* ── buttons / forms ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 7px 12px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 13px; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
:root[data-theme="dark"] .btn.primary { color: #0b1420; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); border-color: var(--bad); background: transparent; }
.btn.on { background: var(--warn); border-color: var(--warn); color: #1b1300; }
.btn.sm { padding: 4px 8px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn { width: 34px; height: 34px; padding: 0; border-radius: 50%; }
input[type=text], input[type=password], input[type=number], input[type=email], input[type=tel],
input[type=datetime-local], input[type=date], select, textarea {
  border: 1px solid var(--border); background: var(--surface); border-radius: 8px; padding: 7px 10px; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-2); font-weight: 600; }
label.field > input, label.field > select, label.field > textarea { font-size: 14px; color: var(--text); font-weight: 400; }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; align-items: end; }

/* ── cards ── */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-h { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.panel-h h3 { margin: 0; font-size: 15px; }
.panel-b { padding: 14px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 12px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.card .k { font-size: 12px; color: var(--text-2); font-weight: 600; }
.card .v { font-size: 26px; font-weight: 800; margin-top: 2px; font-variant-numeric: tabular-nums; }
.card .v small { font-size: 13px; color: var(--text-2); font-weight: 600; margin-left: 2px; }
.card .sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--brand); }
.card.ok::before { background: var(--ok); } .card.bad::before { background: var(--bad); }
.card.warn::before { background: var(--warn); } .card.idle::before { background: var(--idle); }
.card.bad .v { color: var(--bad); }
.env-cards .card .v { font-size: 22px; }
.section-title { display: flex; align-items: baseline; gap: 8px; margin: 4px 2px 8px; }
.section-title h2 { margin: 0; font-size: 16px; }
.type-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 12px; }
.type-card { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; }
.type-card .bar { flex: 1; height: 6px; border-radius: 3px; background: var(--bad-soft); overflow: hidden; }
.type-card .bar > i { display: block; height: 100%; background: var(--ok); }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.badge.normal { background: var(--ok-soft); color: var(--ok); }
.badge.offline, .badge.never { background: var(--bad-soft); color: var(--bad); }
.badge.unused { background: var(--idle-soft); color: var(--idle); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.info { background: var(--brand-soft); color: var(--brand); }
.badge.count { background: var(--bad); color: #fff; padding: 0 6px; }

/* ── dashboard layout ── */
.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 12px; align-items: start; }
@media (max-width: 1100px) { .dash-grid { grid-template-columns: 1fr; } }
.legend { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; vertical-align: -1px; }

.map-wrap { position: relative; width: 100%; user-select: none; -webkit-user-select: none; border-radius: 0 0 var(--radius) var(--radius); overflow: hidden; background: #2b3a2b; }
.map-wrap img.map { display: block; width: 100%; height: auto; pointer-events: none; }
.map-wrap.moving { outline: 3px dashed var(--warn); outline-offset: -3px; }
.building { position: absolute; border: 2px dashed rgba(255,255,255,.85); border-radius: 6px; pointer-events: none; }
.building span { position: absolute; left: 50%; bottom: 100%; transform: translate(-50%, -4px); background: rgba(0,0,0,.65); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 4px; white-space: nowrap; }
.marker {
  position: absolute; transform: translate(-50%, -50%); width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; font-size: 10px; font-weight: 800; color: #fff; cursor: pointer;
  border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.45); touch-action: none; z-index: 2;
}
.marker.normal { background: var(--ok); }
.marker.offline, .marker.never { background: var(--bad); animation: pulse 1.6s infinite; }
.marker.unused { background: var(--idle); }
.marker .lbl { position: absolute; top: 100%; left: 50%; transform: translate(-50%, 2px); background: rgba(0,0,0,.7); color: #fff; font-size: 10px; font-weight: 600; padding: 0 4px; border-radius: 3px; white-space: nowrap; pointer-events: none; }
.map-wrap.hide-labels .marker .lbl { display: none; }
.marker .lb { position: absolute; right: -4px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--warn); border: 1px solid #fff; }
.moving .marker { cursor: grab; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(214,69,69,.7); } 50% { box-shadow: 0 0 0 8px rgba(214,69,69,0); } }
.drag-ghost { position: fixed; z-index: 1000; pointer-events: none; transform: translate(-50%, -50%) scale(1.15); opacity: .9; }

.side-stack { display: flex; flex-direction: column; gap: 12px; }
.chip-list { display: flex; flex-wrap: wrap; gap: 6px; min-height: 44px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px 4px 4px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); font-size: 12px; cursor: pointer; touch-action: none; }
.chip .dot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 9px; font-weight: 800; }
.chip .dot.normal { background: var(--ok); } .chip .dot.offline, .chip .dot.never { background: var(--bad); } .chip .dot.unused { background: var(--idle); }
.zone-unused { border: 2px dashed var(--idle); border-radius: 10px; padding: 10px; background: var(--idle-soft); }
.zone-unused.over, .palette.over { border-color: var(--warn); background: var(--warn-soft); }
.palette { border: 2px dashed transparent; border-radius: 10px; padding: 4px; }
.alarm-list { list-style: none; margin: 0; padding: 0; max-height: 360px; overflow: auto; }
.alarm-list li { display: flex; gap: 8px; align-items: center; padding: 8px 2px; border-bottom: 1px solid var(--border); cursor: pointer; }
.alarm-list li:last-child { border-bottom: 0; }
.alarm-list .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }

/* ── tables ── */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
.tbl th { color: var(--text-2); font-size: 12px; background: var(--surface-2); position: sticky; top: 0; }
.tbl tr:hover td { background: var(--surface-2); }
.tbl td.actions { text-align: right; }
.tbl .mono, .mono { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 12px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ── modal ── */
.modal-bg { position: fixed; inset: 0; background: rgba(5,10,20,.55); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--surface); border-radius: 14px; width: 100%; max-width: 560px; max-height: calc(100vh - 32px); overflow: auto; box-shadow: 0 20px 50px rgba(0,0,0,.35); }
.modal.wide { max-width: 860px; }
.modal-h { display: flex; align-items: center; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.modal-h h3 { margin: 0; font-size: 16px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.modal-b { padding: 16px; }
.modal-f { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; word-break: break-all; }
.vals { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin: 12px 0; }
.vals .card { padding: 8px 10px; } .vals .card .v { font-size: 20px; }
.box { border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin-top: 12px; }
.box h4 { margin: 0 0 8px; font-size: 13px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #1b2330; color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 500; box-shadow: 0 8px 24px rgba(0,0,0,.3); max-width: calc(100vw - 32px); }
.toast.err { background: var(--bad); }

/* ── stats ── */
.stats-ctrl { display: grid; grid-template-columns: 1fr; gap: 12px; }
.sensor-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 12px; max-height: 220px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; padding: 8px; }
.metric-pick { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 560px), 1fr)); gap: 12px; margin-top: 12px; }
.chart-box { height: 320px; position: relative; }
.quick { display: flex; gap: 4px; flex-wrap: wrap; }

/* ── cctv ── */
.cctv-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 12px; align-items: start; }
@media (max-width: 960px) { .cctv-grid { grid-template-columns: 1fr; } }
.viewer { background: #000; border-radius: 10px; aspect-ratio: 16/9; display: grid; place-items: center; overflow: hidden; color: #9aa4b2; position: relative; }
.viewer img, .viewer video, .viewer iframe { width: 100%; height: 100%; object-fit: contain; border: 0; }
.viewer .cap { position: absolute; left: 8px; bottom: 8px; background: rgba(0,0,0,.6); color: #fff; font-size: 12px; padding: 2px 8px; border-radius: 4px; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.thumb { border: 2px solid transparent; border-radius: 8px; overflow: hidden; cursor: pointer; background: var(--surface-2); }
.thumb.sel { border-color: var(--brand); }
.thumb img { display: block; width: 100%; aspect-ratio: 4/3; object-fit: cover; background: #111; }
.thumb div { font-size: 11px; padding: 2px 6px; color: var(--text-2); }
.pager { display: flex; gap: 4px; align-items: center; justify-content: center; margin-top: 10px; flex-wrap: wrap; }
.empty { padding: 32px 12px; text-align: center; color: var(--text-3); }

/* ── login ── */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(1200px 600px at 10% -10%, var(--brand-soft), transparent), var(--bg); }
.login-card { width: 100%; max-width: 400px; padding: 28px 24px; }
.login-card .logo { height: 46px; margin: 0 auto 10px; }
.login-card h1 { font-size: 19px; text-align: center; margin: 4px 0 20px; }
.login-card form { display: flex; flex-direction: column; gap: 12px; }
.login-card .btn { padding: 10px; }
.msg { font-size: 13px; padding: 8px 10px; border-radius: 8px; }
.msg.err { background: var(--bad-soft); color: var(--bad); }
.msg.ok { background: var(--ok-soft); color: var(--ok); }

/* ── mobile ── */
@media (max-width: 720px) {
  .topbar-inner { padding: 8px 12px; gap: 8px; }
  .logo { height: 26px; }
  .app-title { font-size: 14px; padding-left: 8px; }
  .user-name { display: none; }
  main { padding: 12px; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .card .v { font-size: 22px; }
  .marker { width: 24px; height: 24px; font-size: 9px; }
  .kv { grid-template-columns: 96px 1fr; }
  .chart-box { height: 260px; }
  .modal-bg { padding: 0; align-items: flex-end; }
  .modal { border-radius: 14px 14px 0 0; max-height: 92vh; }
  .hide-sm { display: none !important; }
}
@media (max-width: 420px) { .app-title .full { display: none; } }
.palette { max-height: 320px; overflow: auto; align-content: flex-start; }
.zone-unused { max-height: 260px; overflow: auto; align-content: flex-start; }
@media (max-width: 720px) { .palette { max-height: 220px; } }

/* 배치도 여러 장 */
.layout-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.layout-tabs .btn { padding: 3px 10px; font-size: 12px; }
.map-stage { background: #1d261d; border-radius: 0 0 var(--radius) var(--radius); overflow: hidden; }
.map-stage .map-wrap { width: fit-content; max-width: 100%; margin: 0 auto; border-radius: 0; }
.map-wrap img.map { width: auto; max-width: 100%; max-height: 78vh; }
.building span { pointer-events: auto; cursor: pointer; }
/* 양지·음지 비교표 */
table.cmp td.v { font-variant-numeric: tabular-nums; font-weight: 700; text-align: right; }
table.cmp td.diff { font-variant-numeric: tabular-nums; text-align: right; color: var(--text-2); }
table.cmp td.v.stale { color: var(--text-3); font-weight: 400; }
table.cmp th.site-y { color: #c77700; } table.cmp th.site-e { color: var(--brand); }
table.cmp .grp td { border-top: 2px solid var(--border); }
.site-tag { font-size: 11px; font-weight: 700; padding: 0 5px; border-radius: 4px; margin-right: 4px; }
.site-tag.YANGJI { background: var(--warn-soft); color: #c77700; } .site-tag.EUMJI { background: var(--brand-soft); color: var(--brand); }

.only-sm { display: none; }
@media (max-width: 720px) {
  .only-sm { display: inline-flex; margin-bottom: 2px; }
  table.cmp .c-type, table.cmp .names { display: none; }
  table.cmp th, table.cmp td { padding: 6px; white-space: normal; }
  table.cmp td.v, table.cmp td.diff { white-space: nowrap; }
}

/* ═════════ v3 레이아웃: 좌측 사이드바 + 지도 중심 대시보드 ═════════ */
.sidebar { position: fixed; inset: 0 auto 0 0; width: 216px; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; z-index: 60; }
.sb-brand { padding: 16px 16px 14px; border-bottom: 1px solid var(--border); }
.sb-brand .logo { height: 34px; }
.sb-title { font-weight: 800; font-size: 15px; margin-top: 8px; }
.sb-nav { flex: 1; padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; overflow: auto; }
.sb-nav .tab { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 0; border-radius: 8px; background: none; color: var(--text-2); font-weight: 600; text-align: left; cursor: pointer; }
.sb-nav .tab:hover { background: var(--surface-2); color: var(--text); }
.sb-nav .tab.active { background: var(--brand-soft); color: var(--brand); border: 0; }
.sb-nav .tab .badge { margin-left: auto; }
.sb-foot { padding: 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.sb-foot .user-name { display: block; font-size: 12px; }
.sb-backdrop { display: none; }
.main-col { margin-left: 216px; min-height: 100vh; }
.mobile-bar { display: none; }
main { max-width: none; padding: 16px; }

/* 대시보드: 화면 꽉 채움 */
#page-dash.active { display: flex; flex-direction: column; height: calc(100dvh - 32px); gap: 10px; }
.dash-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.status-strip { display: flex; gap: 6px; flex-wrap: wrap; }
.stat { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: 13px; color: var(--text-2); white-space: nowrap; }
.stat i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.stat b { font-size: 16px; color: var(--text); font-variant-numeric: tabular-nums; }
.stat.bad { border-color: var(--bad); background: var(--bad-soft); } .stat.bad b { color: var(--bad); }
.stat.warn { border-color: var(--warn); background: var(--warn-soft); }
.dash-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 10px; }
.dash-body.panel-closed { grid-template-columns: minmax(0, 1fr); }
.dash-body.panel-closed .side-panel { display: none; }
.map-area { display: flex; flex-direction: column; min-height: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.map-toolbar { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.map-stage { flex: 1; min-height: 0; position: relative; display: flex; align-items: center; justify-content: center; background: #1d261d; overflow: hidden; border-radius: 0; }
.map-stage .map-wrap { margin: 0; flex: none; border-radius: 0; overflow: visible; }
.map-wrap img.map, #mapImg { width: 100%; height: 100%; max-width: none; max-height: none; display: block; }
.map-legend { position: absolute; left: 10px; bottom: 10px; display: flex; gap: 10px; background: rgba(0,0,0,.55); color: #fff; font-size: 11px; padding: 4px 10px; border-radius: 999px; pointer-events: none; }
.map-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; }
.move-hint { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); background: var(--warn); color: #1b1300; font-size: 12px; font-weight: 700; padding: 5px 12px; border-radius: 999px; white-space: nowrap; max-width: calc(100% - 20px); overflow: hidden; text-overflow: ellipsis; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: 4px 10px; font-size: 12px; font-weight: 600; cursor: pointer; color: var(--text-2); }
.seg button + button { border-left: 1px solid var(--border); }
.seg button.on { background: var(--brand); color: #fff; }
:root[data-theme="dark"] .seg button.on { color: #0b1420; }

/* 마커 값 표시 / 풍향 화살표 */
.marker .lbl.val { font-size: 11px; font-weight: 800; padding: 1px 5px; background: rgba(0,0,0,.78); }
.marker .warrow { position: absolute; left: 50%; top: 50%; width: 64px; height: 64px; margin: -32px 0 0 -32px; pointer-events: none; z-index: -1; }
.wind-widget { position: absolute; right: 10px; top: 10px; background: rgba(0,0,0,.6); color: #fff; border-radius: 14px; padding: 8px 12px; text-align: center; font-size: 12px; min-width: 104px; }
.wind-widget svg { display: block; margin: 0 auto 4px; }
.wind-widget b { font-size: 16px; }

/* 우측 패널 */
.side-panel { display: flex; flex-direction: column; min-height: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.sp-tabs { display: flex; border-bottom: 1px solid var(--border); }
.sp-tabs button { flex: 1; border: 0; background: none; padding: 10px 4px; font-weight: 700; color: var(--text-2); border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; }
.sp-tabs button.active { color: var(--brand); border-bottom-color: var(--brand); }
.sp-body { flex: 1; min-height: 0; overflow: auto; padding: 10px; }
.sp-h { margin: 6px 0 6px; font-size: 13px; }
.sp-body .palette, .sp-body .zone-unused { max-height: none; }
.type-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.type-list .type-card { padding: 6px 10px; }

/* 양지·음지 비교 카드 */
.cmp-card { border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; margin-bottom: 8px; }
.cmp-h { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 13px; margin-bottom: 4px; }
.cmp-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 2px 14px; align-items: baseline; }
.cmp-grid .hd { font-size: 11px; font-weight: 700; text-align: right; }
.cmp-grid .hd.y { color: #c77700; } .cmp-grid .hd.e { color: var(--brand); }
.cmp-grid .ml { font-size: 12px; color: var(--text-2); }
.cmp-v { font-size: 19px; font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; cursor: pointer; white-space: nowrap; }
.cmp-v small { font-size: 11px; font-weight: 600; color: var(--text-2); margin-left: 1px; }
.cmp-v.stale { color: var(--text-3); font-weight: 500; }
.cmp-d { font-size: 12px; color: var(--text-2); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cmp-d.pos { color: #c77700; } .cmp-d.neg { color: var(--brand); }

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 30px rgba(0,0,0,.3); }
  body.sb-open .sidebar { transform: none; }
  body.sb-open .sb-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 55; }
  .main-col { margin-left: 0; }
  .mobile-bar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 50; background: var(--surface); border-bottom: 1px solid var(--border); padding: 8px 12px; }
  .mobile-bar .logo { height: 26px; }
  main { padding: 10px; }
  #page-dash.active { height: auto; }
  .dash-body, .dash-body.panel-closed { display: flex; flex-direction: column; }
  .dash-body.panel-closed .side-panel { display: flex; }
  .map-area { height: 62vh; min-height: 320px; }
  .side-panel { max-height: none; }
  .sp-body { max-height: 70vh; }
  .stat { padding: 4px 9px; font-size: 12px; } .stat b { font-size: 14px; }
}

/* ═════════ 센서 종류별 색·아이콘 (상태는 테두리) ═════════ */
.marker, .marker.normal, .marker.offline, .marker.never { background: var(--tc, #7c8698); color: #fff; }
.marker { width: 32px; height: 32px; border: 2.5px solid #fff; }
.marker.offline, .marker.never { border-color: #ff3b3b; border-width: 3px; }
.marker.unused { background: #7c8698; }
.marker .ticon { display: block; }
.marker .io { position: absolute; left: -6px; bottom: -4px; width: 15px; height: 15px; border-radius: 50%; background: #fff; color: #b34700; font-size: 9px; font-weight: 800; display: grid; place-items: center; line-height: 1; box-shadow: 0 1px 2px rgba(0,0,0,.4); }
.marker .lbl { top: calc(100% + 2px); }
.chip .dot, .chip .dot.normal, .chip .dot.offline, .chip .dot.never { background: var(--tc, #7c8698); border: 2px solid transparent; }
.chip .dot.offline, .chip .dot.never { border-color: #ff3b3b; }
.chip .dot.unused { background: #7c8698; }
.tbadge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px 1px 6px; border-radius: 999px; font-size: 12px; font-weight: 700; color: #fff; background: var(--tc); white-space: nowrap; }
.map-legend { flex-wrap: wrap; row-gap: 4px; max-width: calc(100% - 20px); align-items: center; }
.map-legend .lg { display: inline-flex; align-items: center; gap: 4px; }
.map-legend .lgi { width: 17px; height: 17px; border-radius: 50%; background: var(--tc); display: grid; place-items: center; border: 1.5px solid #fff; }
.map-legend .lgs { width: 12px; height: 12px; border-radius: 50%; border: 2.5px solid; display: inline-block; }
.map-legend .lgs.bad { border-color: #ff3b3b; } .map-legend .lgs.idle { border-color: #7c8698; background: #7c8698; } .map-legend .lgs.warn { border-color: var(--warn); background: var(--warn); }
@media (max-width: 720px) { .marker { width: 28px; height: 28px; } .marker .ticon { width: 14px; height: 14px; } }

/* 미배치/미사용 종류별 묶음 */
.palette, .zone-unused { display: flex; flex-direction: column; gap: 6px; flex-wrap: nowrap; }
.cgroup { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.zone-unused .cgroup { background: transparent; }
.cgroup summary { display: flex; align-items: center; gap: 8px; padding: 7px 10px; cursor: pointer; list-style: none; user-select: none; }
.cgroup summary::-webkit-details-marker { display: none; }
.cgroup summary::after { content: "▸"; margin-left: auto; color: var(--text-3); transition: transform .15s; }
.cgroup[open] summary::after { transform: rotate(90deg); }
.cgroup .chip-list { padding: 0 8px 8px; min-height: 0; }

/* 상태 표시 축소: 불통 = 작은 빨간 점, 미수신 = 점선 테두리 (알람처럼 보이지 않게) */
.marker.offline, .marker.never { animation: none; box-shadow: 0 2px 6px rgba(0,0,0,.45); border: 2.5px solid #fff; }
.marker.never { border-style: dashed; opacity: .78; }
.marker .od { position: absolute; right: -3px; top: -3px; width: 11px; height: 11px; border-radius: 50%; background: #ff3b3b; border: 1.5px solid #fff; animation: odblink 1.6s infinite; }
@keyframes odblink { 50% { opacity: .35; } }
.marker .lb { right: auto; left: -3px; top: -3px; }
.chip .dot.offline { border: 0; box-shadow: 0 0 0 2px #ff3b3b; }
.chip .dot.never { border: 1.5px dashed #fff; opacity: .78; }
.map-legend .lgs.bad { width: 9px; height: 9px; border: 0; background: #ff3b3b; }
.map-legend .lgs.never { border: 1.5px dashed #fff; background: transparent; }

.home-link { display: block; color: inherit; text-decoration: none; cursor: pointer; }
.mobile-bar .home-link { display: flex; align-items: center; }
.sb-brand.home-link:hover .sb-title { color: var(--brand); }
