.field{ margin-bottom:14px; }
.field label{ display:block; font-size:12.5px; color:var(--text-secondary); margin-bottom:6px; font-weight:600; }
.field input, .field select{
  width:100%; padding:11px 12px; border-radius:9px; border:1px solid var(--border);
  background:var(--surface-2); color:var(--text-primary); font-size:14.5px; outline:none;
}
.field input:focus, .field select:focus{ border-color:var(--blue); }
.field-hint{ font-size:11.5px; color:var(--text-muted); margin-top:5px; }
.btn{
  appearance:none; border:none; cursor:pointer; border-radius:9px; font-weight:700; font-size:14.5px;
  padding:11px 16px; display:inline-flex; align-items:center; justify-content:center; gap:8px;
  min-height:44px; transition:.15s; text-decoration:none;
}
.btn-primary{ background:var(--blue); color:#fff; width:100%; }
.btn-primary:hover{ filter:brightness(1.08); }
.btn-ghost{ background:transparent; color:var(--text-secondary); border:1px solid var(--border); }
.btn-ghost:hover{ background:var(--surface-2); }
.btn-sm{ padding:7px 11px; font-size:12.5px; min-height:36px; }
.btn-danger{ background:var(--critical); color:#fff; }
.btn:disabled{ opacity:.5; cursor:not-allowed; }
.login-error{ color:var(--critical); font-size:12.5px; margin:-6px 0 12px; min-height:1em; }

.kpi-grid{ display:grid; grid-template-columns:repeat(auto-fit, minmax(150px,1fr)); gap:12px; margin-bottom:20px; }
.kpi-card{ background:var(--surface-1); border:1px solid var(--border); border-radius:12px; padding:14px; box-shadow:var(--shadow); }
.kpi-card .kpi-label{ font-size:11.5px; color:var(--text-secondary); font-weight:600; display:flex; align-items:center; gap:6px; margin-bottom:8px; }
.kpi-card .kpi-value{ font-size:24px; font-weight:700; font-variant-numeric:proportional-nums; line-height:1.1; }
.kpi-card .kpi-sub{ font-size:11px; color:var(--text-muted); margin-top:4px; }

.panel{ background:var(--surface-1); border:1px solid var(--border); border-radius:12px; padding:16px; margin-bottom:16px; box-shadow:var(--shadow); }
.panel h2{ font-size:14.5px; margin:0 0 12px; }
.panel h3{ font-size:13px; margin:0 0 8px; color:var(--text-secondary); }
.panel-toggle{
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  width:100%; background:none; border:0; padding:0; margin:0; cursor:pointer;
  color:inherit; font:inherit; text-align:left;
}
.panel-toggle h2{ margin:0; }
.panel-toggle .chev{
  flex:0 0 auto; font-size:13px; color:var(--text-muted); line-height:1;
  transition:transform .15s ease;
}
.panel-toggle[aria-expanded="true"] .chev{ transform:rotate(180deg); }
.panel-collapsible.is-open .panel-toggle{ margin-bottom:12px; }

.toolbar{ display:flex; gap:8px; flex-wrap:wrap; margin-bottom:14px; align-items:center; }
.toolbar-search-group{ display:flex; gap:8px; flex:1; min-width:min(100%, 320px); align-items:center; }
.search-input{
  flex:1; min-width:160px; padding:9px 12px; border-radius:9px; border:1px solid var(--border);
  background:var(--surface-2); color:var(--text-primary); font-size:13.5px; outline:none;
}
.search-input:focus{ border-color:var(--blue); }
.chip-select{ display:flex; gap:6px; flex-wrap:wrap; }
.chip{
  border:1px solid var(--border); background:var(--surface-2); color:var(--text-secondary); font-size:12px;
  font-weight:600; padding:7px 11px; border-radius:999px; cursor:pointer; display:flex; align-items:center; gap:5px;
}
.chip[aria-pressed="true"]{ background:color-mix(in srgb, var(--blue) 16%, transparent); color:var(--blue); border-color:transparent; }
.filter-combo{
  border:1px solid var(--border); background:var(--surface-2); color:var(--text-secondary); font-size:12px;
  font-weight:600; padding:7px 28px 7px 11px; border-radius:999px; cursor:pointer; outline:none;
  -webkit-appearance:none; appearance:none;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23898781'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z' clip-rule='evenodd'/%3E%3C/svg%3E");
  background-repeat:no-repeat; background-position:right 8px center; background-size:14px;
}
.filter-combo:focus{ border-color:var(--blue); color:var(--text-primary); }
.filter-combo.filter-pengelola{ max-width:220px; min-width:150px; }

.dc-id{ font-weight:700; font-size:13px; display:flex; align-items:center; gap:7px; white-space:nowrap; }
.btn-edit-inline{ min-height:30px; padding:4px 8px; font-size:11.5px; font-weight:700; }
.lamp-badge{ font-size:11px; font-weight:700; padding:3px 8px; border-radius:999px; display:inline-flex; align-items:center; gap:4px; }
.lamp-on{ background:color-mix(in srgb, var(--yellow) 22%, transparent); color:var(--yellow); }
.lamp-off{ background:var(--surface-1); color:var(--text-muted); }
.lamp-wait{ background:color-mix(in srgb, var(--blue) 18%, transparent); color:var(--blue); }
.lamp-spin{
  width:10px; height:10px; flex:none;
  border:2px solid color-mix(in srgb, currentColor 35%, transparent);
  border-top-color:currentColor; border-radius:50%;
  animation:lamp-spin .7s linear infinite;
}
@keyframes lamp-spin{ to { transform: rotate(360deg); } }

.pagination{ display:flex; align-items:center; justify-content:center; gap:16px; margin-top:14px; font-size:13px; color:var(--text-secondary); flex-wrap:wrap; }
.page-size-label{ display:flex; align-items:center; gap:6px; font-size:12.5px; color:var(--text-secondary); }
.page-size-label select{
  padding:6px 8px; border-radius:7px; border:1px solid var(--border); background:var(--surface-2);
  color:var(--text-primary); font-size:12.5px; outline:none; cursor:pointer;
}
.page-size-label select:focus{ border-color:var(--blue); }

table.device-table th.sortable-th{ user-select:none; white-space:nowrap; }
table.device-table th.sortable-th:hover{ color:var(--text-primary); }
table.device-table tbody tr.device-row:hover{ background:var(--surface-2); }
table.device-table td:first-child, table.device-table th:first-child{
  position:sticky; left:0; background:var(--surface-1); z-index:1;
}
table.device-table tbody tr.device-row:hover td:first-child{ background:var(--surface-2); }
table.device-table th.col-aksi, table.device-table td.col-aksi{
  position:sticky; right:0; background:var(--surface-1); z-index:2;
  box-shadow:-8px 0 10px -8px rgba(0,0,0,.28);
}
table.device-table tbody tr.device-row:hover td.col-aksi{ background:var(--surface-2); }
table.device-table thead th.col-aksi{ z-index:3; }

.map-page{ display:flex; flex-direction:column; flex:1; min-height:0; position:relative; }
.map-page .view-header{ flex:none; }
.map-search-wrap{ position:relative; flex:none; margin:0 0 10px; z-index:20; }
.map-search-wrap .search-input{ width:100%; flex:none; }
.map-search-results{
  position:absolute; left:0; right:0; top:calc(100% + 4px); z-index:21;
  background:var(--surface-1); border:1px solid var(--border); border-radius:10px;
  box-shadow:var(--shadow); max-height:280px; overflow:auto;
}
.map-search-group{
  padding:8px 12px 4px; font-size:10.5px; font-weight:700; text-transform:uppercase;
  letter-spacing:.06em; color:var(--text-muted);
}
.map-search-item{
  display:flex; flex-direction:column; gap:2px; width:100%; padding:9px 12px;
  border:none; background:transparent; text-align:left; cursor:pointer; color:var(--text-primary);
}
.map-search-item:hover, .map-search-item:focus{ background:var(--surface-2); outline:none; }
.map-search-item .ms-title{ font-size:13.5px; font-weight:700; }
.map-search-item .ms-sub{ font-size:12px; color:var(--text-secondary); }
.map-search-empty{ padding:12px; font-size:13px; color:var(--text-muted); }
#map{ flex:1; min-height:320px; border-radius:12px; overflow:hidden; border:1px solid var(--border); position:relative; z-index:1; }
#map-mini{
  height:280px; border-radius:12px; overflow:hidden; border:1px solid var(--border); cursor:pointer;
  position:relative; z-index:0; isolation:isolate;
}
.ov-map-head{ display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:10px; flex-wrap:wrap; }
.ov-map-head h2{ margin:0; }
.pju-cluster-icon{ background:transparent !important; border:none !important; }
.pju-cluster{
  min-width:56px; padding:5px 8px 4px; border-radius:12px; text-align:center;
  color:#fff; line-height:1.15; box-shadow:0 2px 8px rgba(0,0,0,.28);
  border:1px solid rgba(255,255,255,.22);
}
.pju-cluster b{ display:block; font-size:15px; font-weight:800; font-variant-numeric:tabular-nums; }
.pju-cluster span{ display:block; margin-top:2px; font-size:9.5px; font-weight:700; opacity:.95; white-space:nowrap; }
.pju-cluster span em{ font-style:normal; font-variant-numeric:tabular-nums; }
.pju-cluster-good{ background:var(--good); }
.pju-cluster-critical{ background:var(--critical); }
.pju-cluster-mixed{ background:var(--warning); color:#1a1a1a; }
.marker-dot{ position:relative; width:14px; height:14px; border-radius:50%; border:2px solid var(--surface-1); box-shadow:0 0 0 1px rgba(0,0,0,.25); animation:marker-blink 1.6s ease-in-out infinite; }
.marker-dot::after{ content:''; position:absolute; inset:-2px; border-radius:50%; background:inherit; opacity:.55; z-index:-1; pointer-events:none; animation:marker-pulse 1.6s ease-out infinite; }
@keyframes marker-blink{ 0%,100%{ opacity:1; } 50%{ opacity:.4; } }
@keyframes marker-pulse{ 0%{ transform:scale(1); opacity:.55; } 100%{ transform:scale(2.6); opacity:0; } }
.marker-id-label{ display:none; }
.show-marker-labels .marker-id-label{ display:block; }
.marker-id-label.leaflet-tooltip{ background:var(--surface-1); color:var(--text-primary); border:1px solid var(--border); border-radius:6px; padding:1px 6px; font-size:11px; font-weight:700; box-shadow:var(--shadow); pointer-events:none; }
.marker-id-label.leaflet-tooltip-top:before{ border-top-color:var(--border); }
.marker-id-label.leaflet-tooltip-bottom:before{ border-bottom-color:var(--border); }
.leaflet-popup-content-wrapper{ background:var(--surface-1); color:var(--text-primary); border-radius:10px; }
.leaflet-popup-tip{ background:var(--surface-1); }
.popup-title{ font-weight:700; margin-bottom:4px; }
.popup-row{ font-size:12px; display:flex; justify-content:space-between; gap:14px; }
.leaflet-control-layers{ background:var(--surface-1); color:var(--text-primary); border-radius:10px; border:1px solid var(--border); box-shadow:0 4px 16px rgba(0,0,0,.2); }
.leaflet-control-layers-toggle{ border-radius:10px; filter:var(--map-ctrl-icon-filter, none); }
.leaflet-control-layers-expanded{ padding:10px 12px; }
.leaflet-control-layers-list label{ color:var(--text-primary); font-size:12.5px; }
.leaflet-control-layers-separator{ border-color:var(--border); }
[data-theme="dark"] .leaflet-control-layers-toggle{ filter:invert(1) brightness(1.6); }
[data-theme="dark"] .leaflet-control-zoom a{ background:var(--surface-1); color:var(--text-primary); border-color:var(--border); }
[data-theme="dark"] .leaflet-bar a{ background:var(--surface-1); color:var(--text-primary); border-color:var(--border); }

.chart-grid{ display:grid; grid-template-columns:repeat(auto-fit, minmax(260px,1fr)); gap:12px; }
.chart-box{ background:var(--surface-2); border:1px solid var(--border); border-radius:11px; padding:12px; }
.chart-box .cb-head{ display:flex; align-items:baseline; justify-content:space-between; margin-bottom:6px; }
.chart-box .cb-title{ font-size:12.5px; font-weight:700; color:var(--text-secondary); }
.chart-box .cb-value{ font-size:15px; font-weight:700; font-variant-numeric:tabular-nums; }
.chart-box canvas{ max-height:130px; }

.table-wrap{ overflow-x:auto; }
table.data-table{ width:100%; border-collapse:collapse; font-size:12.8px; }
table.data-table th{ text-align:left; color:var(--text-muted); font-weight:700; font-size:11px; text-transform:uppercase; letter-spacing:.04em; padding:8px 10px; border-bottom:1px solid var(--gridline); white-space:nowrap; }
table.data-table td{ padding:9px 10px; border-bottom:1px solid var(--gridline); vertical-align:middle; white-space:nowrap; }
table.data-table tr:last-child td{ border-bottom:none; }
.row-actions{ display:flex; gap:6px; }
.bulk-action-bar{ display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; background:var(--surface-2); border:1px solid var(--border); border-radius:10px; padding:9px 12px; margin-bottom:10px; font-size:12.5px; }
.bulk-action-bar-btns{ display:flex; gap:8px; flex-wrap:wrap; }

.badge{ font-size:11px; font-weight:700; padding:4px 9px; border-radius:999px; display:inline-flex; align-items:center; gap:5px; }
.badge.good{ background:color-mix(in srgb, var(--good) 18%, transparent); color:var(--success-text); }
.badge.warning{ background:color-mix(in srgb, var(--warning) 22%, transparent); color:#8a5a00; }
[data-theme="dark"] .badge.warning, :root:where(:not([data-theme="light"])) .badge.warning{ color:var(--warning); }
.badge.serious{ background:color-mix(in srgb, var(--serious) 22%, transparent); color:#9c3d1c; }
[data-theme="dark"] .badge.serious, :root:where(:not([data-theme="light"])) .badge.serious{ color:var(--serious); }
.badge.critical{ background:color-mix(in srgb, var(--critical) 18%, transparent); color:var(--critical); }
.badge.info{ background:var(--surface-2); color:var(--text-secondary); border:1px solid var(--border); }

.alert-item{ display:flex; gap:12px; padding:11px 4px; border-bottom:1px solid var(--gridline); align-items:flex-start; }
.alert-item:last-child{ border-bottom:none; }
.alert-icon{ font-size:16px; margin-top:1px; }
.alert-body{ flex:1; min-width:0; }
.alert-title{ font-size:13px; font-weight:700; margin-bottom:2px; }
.alert-meta{ font-size:11.5px; color:var(--text-muted); }
.empty-state{ text-align:center; padding:40px 16px; color:var(--text-muted); font-size:13px; }
.empty-state .es-icon{ font-size:30px; margin-bottom:8px; }

.form-grid{ display:grid; grid-template-columns:repeat(auto-fit,minmax(160px,1fr)); gap:12px; }
.form-hint{ margin:10px 0 0; font-size:12.5px; color:var(--text-muted); line-height:1.4; }
.switch{ position:relative; width:42px; height:24px; flex:none; }
.switch input{ opacity:0; width:0; height:0; }
.switch .track{ position:absolute; inset:0; background:var(--baseline); border-radius:999px; transition:.15s; cursor:pointer; }
.switch .track::before{ content:""; position:absolute; width:18px; height:18px; left:3px; top:3px; background:#fff; border-radius:50%; transition:.15s; }
.switch input:checked + .track{ background:var(--good); }
.switch input:checked + .track::before{ transform:translateX(18px); }

.log-item{ font-size:12px; padding:7px 2px; border-bottom:1px solid var(--gridline); color:var(--text-secondary); }
.log-item:last-child{ border-bottom:none; }
.log-item b{ color:var(--text-primary); }
.log-item .log-time{ color:var(--text-muted); float:right; }

.toast-wrap{ position:fixed; top:70px; right:16px; z-index:100; display:flex; flex-direction:column; gap:8px; max-width:320px; }
.toast{ background:var(--surface-1); border:1px solid var(--border); border-radius:10px; padding:11px 13px; box-shadow:var(--shadow); font-size:12.5px; display:flex; gap:8px; align-items:flex-start; animation:toast-in .18s ease-out; }
@keyframes toast-in{ from{ opacity:0; transform:translateY(6px);} to{ opacity:1; transform:none;} }

.confirm-modal-overlay{ position:fixed; inset:0; z-index:200; background:rgba(0,0,0,.45); display:flex; align-items:center; justify-content:center; padding:16px; animation:toast-in .15s ease-out; }
.confirm-modal-overlay.hidden{ display:none; }
.confirm-modal{ background:var(--surface-1); border:1px solid var(--border); border-radius:14px; box-shadow:var(--shadow); padding:20px; max-width:360px; width:100%; }
.confirm-modal-title{ font-size:15px; font-weight:700; margin-bottom:8px; }
.confirm-modal-msg{ font-size:13px; color:var(--text-secondary); line-height:1.55; }
.confirm-modal-actions{ display:flex; justify-content:flex-end; gap:10px; margin-top:18px; }
.confirm-modal-actions .btn-primary{ width:auto; }
