/* Family Sangkuriang — dashboard extensions (dark blue glow theme) */

:root {
  --accent: #5eb8ff;
  --accent-soft: rgba(94, 184, 255, 0.14);
  --accent-glow: rgba(56, 189, 248, 0.42);
  --accent-deep: #2563eb;
}

/* ── Logo ── */
.brand-logo {
  object-fit: contain;
  border-radius: 12px;
  flex-shrink: 0;
  background: transparent;
}

.brand-logo-login {
  width: 180px;
  height: 180px;
  margin: 0 auto 0.85rem;
  display: block;
  filter: drop-shadow(0 0 22px rgba(96, 165, 250, 0.38));
}


.enroll-logo {
  display: block;
  margin: 0 auto 0.75rem;
  border-radius: 12px;
  background: transparent;
}

/* ── Header modular ── */
.header-modular {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.65rem 1.25rem;
  flex-wrap: wrap;
}

.header-modular .brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 0 0 auto;
  min-width: 0;
}

.brand-logo-header {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  filter: drop-shadow(0 0 14px rgba(96, 165, 250, 0.28));
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
  min-width: 0;
}

.header-modular .brand h1 {
  font-size: 1.05rem;
  line-height: 1.15;
  margin: 0;
}

.brand-date {
  font-size: 0.62rem;
  font-weight: 500;
  color: #facc15;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.layout-modular .nav-top-btn {
  flex: 0 0 auto;
  white-space: nowrap;
  padding: 0.5rem 0.8rem;
  font-size: 0.78rem;
  font-weight: 600;
  background: rgba(10, 18, 32, 0.9);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.layout-modular .nav-top-btn:hover {
  border-color: var(--border-strong);
  background: var(--panel-hover);
}

.layout-modular .nav-top-btn.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.18);
}

.nav-logout-btn {
  margin-top: 0.15rem;
  background: rgba(248, 113, 113, 0.1) !important;
  border: 1px solid rgba(248, 113, 113, 0.28) !important;
  color: #fca5a5 !important;
  font-weight: 600;
}

.nav-logout-btn:hover {
  background: rgba(248, 113, 113, 0.18) !important;
  border-color: rgba(248, 113, 113, 0.45) !important;
  color: #fecaca !important;
}

.nav-logout-label {
  margin-top: 0.35rem;
  padding-top: 0.45rem;
  border-top: 1px solid var(--border);
}

.running-text-color-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  margin: 0.15rem 0 0.35rem;
}

.running-text-color-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
}

.running-text-color-row input[type="color"] {
  width: 2.75rem;
  height: 2.25rem;
  padding: 0.15rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  cursor: pointer;
}

.running-text-color-row input[type="text"] {
  flex: 1;
  padding: 0.55rem 0.65rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.85rem;
  font-family: ui-monospace, monospace;
}

@media (min-width: 768px) {
  .brand-logo-header {
    width: 72px;
    height: 72px;
  }

  .header-modular .brand h1 {
    font-size: 1.12rem;
  }
}

.header-stats {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  justify-content: center;
  align-items: center;
}

.hdr-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.35rem 0.65rem;
  min-width: 64px;
}

.hdr-stat.hdr-datetime {
  min-width: 180px;
}

.hdr-label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
}

.hdr-stat b,
.hdr-stat span {
  font-size: 0.78rem;
  color: var(--text);
  font-weight: 600;
  text-align: center;
  line-height: 1.25;
}

#hdr-ip {
  font-size: 0.68rem;
  word-break: break-all;
  max-width: 120px;
}

#hdr-datetime {
  font-size: 0.72rem;
  font-weight: 500;
}

/* ── Running text ── */
.running-text {
  overflow: hidden;
  background: linear-gradient(90deg, rgba(56, 189, 248, 0.12), rgba(37, 99, 235, 0.06));
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.running-text-track {
  display: inline-flex;
  gap: 2rem;
  padding: 0.45rem 0;
  animation: running-marquee 28s linear infinite;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--running-text-color, #ffffff);
  letter-spacing: 0.04em;
}

.running-sep {
  color: var(--running-text-color, #ffffff);
  opacity: 0.55;
  font-weight: 400;
}

@keyframes running-marquee {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* ── Layout modular: menu dropdown (atas) + panel konten ── */
main.layout-modular {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  height: auto;
  overflow: hidden;
  gap: 0;
}

.layout-modular .side-nav {
  position: relative;
  z-index: 300;
  flex: 0 0 auto;
  width: 100%;
  min-width: 0;
  height: auto;
  max-height: none;
  overflow: visible;
  padding: 0.5rem 0.65rem;
  border-right: none;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(12, 22, 40, 0.98), rgba(8, 14, 28, 0.96));
}

.layout-modular .nav-menu-track {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: flex-start;
  gap: 0.4rem;
  width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.layout-modular .nav-menu-track::-webkit-scrollbar {
  display: none;
}

.layout-modular .side-nav::-webkit-scrollbar {
  display: none;
}

.layout-modular .nav-section {
  display: none;
}

.layout-modular .nav-group {
  position: relative;
  flex: 0 0 auto;
  border: none;
}

.layout-modular .nav-toggle {
  width: auto;
  white-space: nowrap;
  padding: 0.5rem 0.8rem;
  font-size: 0.78rem;
  background: rgba(10, 18, 32, 0.9);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.layout-modular .nav-toggle:hover {
  border-color: var(--border-strong);
  background: var(--panel-hover);
}

.layout-modular .nav-group.open .nav-toggle {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.18);
}

.layout-modular .nav-submenu {
  display: none;
  position: fixed;
  z-index: 5000;
  min-width: min(260px, 88vw);
  max-width: min(340px, 94vw);
  max-height: min(58dvh, 400px);
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0.45rem;
  background: linear-gradient(165deg, rgba(14, 26, 48, 0.98), rgba(10, 18, 32, 0.99));
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: var(--glow-md), 0 14px 36px rgba(0, 0, 0, 0.45);
}

.layout-modular .nav-group.open .nav-submenu {
  display: block;
}

.layout-modular .nav-group:not(.open) .nav-submenu {
  display: none !important;
}

.layout-modular .nav-sub,
.layout-modular .filter-btn.nav-sub,
.layout-modular .nav-view-btn.nav-sub,
.layout-modular .nav-admin-btn.nav-sub,
.layout-modular .nav-action-btn.nav-sub {
  width: 100%;
  white-space: normal;
}

.layout-modular .display-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  min-height: 0;
  height: auto;
  max-height: none;
  overflow: hidden;
  position: relative;
  z-index: 1;
  background: linear-gradient(180deg, rgba(10, 18, 32, 0.6), rgba(5, 11, 22, 0.4));
}

.layout-modular .display-body {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.layout-modular .display-view.active {
  flex: 1;
  min-height: 0;
}

.layout-modular #view-map.active,
.layout-modular #view-idle.active {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.layout-modular .map-history-layout {
  flex: 1;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}

.layout-modular .map-inline-wrap {
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

.layout-modular .map-inline-wrap #map,
.layout-modular .map-inline-wrap .leaflet-container,
.layout-modular .idle-map-wrap #map-idle,
.layout-modular .idle-map-wrap .leaflet-container {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: none !important;
}

.layout-modular .idle-map-wrap {
  flex: 1;
  min-height: 0;
  position: relative;
}

.layout-modular .panel-head,
.layout-modular .control-device-bar,
.layout-modular .control-log-wrap {
  flex-shrink: 0;
}

.layout-modular #view-map.history-mode .map-inline-wrap {
  flex: 1;
  min-height: 0;
}

.device-list-page {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
}

.device-list-grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.75rem;
  padding: 0;
  margin: 0;
}

.device-list-grid li {
  margin-bottom: 0;
}

.panel-head-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.panel-head-actions .feed-hint {
  flex: 1;
  min-width: 0;
}

.panel-head-actions .idle-loc-btn {
  flex-shrink: 0;
}

#view-idle.active {
  display: flex;
  flex-direction: column;
}

#view-device-list.active {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.idle-map-wrap {
  flex: 1;
  min-height: 0;
  position: relative;
}

.idle-map-wrap #map-idle {
  background: #0d1117;
  z-index: 1;
}

.idle-map-wrap #map-idle-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  background: var(--bg);
  z-index: 0;
}

.nav-nested-label {
  display: block;
  padding: 0.35rem 0.75rem 0.15rem;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  opacity: 0.85;
}

.nav-action-btn.nav-sub.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  border: 1px solid var(--accent);
}

.action-tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.action-tool-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.85rem 0.5rem;
  background: var(--panel-hover);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 0.78rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.action-tool-btn:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.action-tool-btn.primary {
  border-color: var(--accent);
  background: var(--accent-soft);
  font-weight: 700;
}

.action-tool-btn.danger:hover:not(:disabled) {
  border-color: var(--red);
  background: rgba(239, 68, 68, 0.15);
}

.action-tool-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.action-tool-icon {
  font-size: 1.25rem;
}

.action-page.active {
  overflow-y: auto;
}

.battery-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.battery-item {
  padding: 0.85rem 1rem;
  margin-bottom: 0.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.battery-item.battery-low {
  border-left: 3px solid #ef4444;
}

.battery-item.battery-ok {
  border-left: 3px solid var(--green);
}

.battery-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.battery-pct {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
}

.battery-meta,
.battery-src {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

.adb-steps {
  margin: 0.75rem 0 0 1.1rem;
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--muted);
}

.adb-steps code {
  display: inline;
  background: var(--bg);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.78rem;
  color: var(--text);
}

#pick-device-btn {
  margin-left: auto;
}

.login-box h1 { color: var(--accent); text-shadow: 0 0 24px var(--accent-glow); }
.login-box .hint code {
  font-size: 0.78rem;
  background: var(--bg);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  color: var(--muted);
}
.login-submit {
  background: linear-gradient(135deg, #38bdf8, #2563eb);
  color: #fff;
  box-shadow: 0 4px 24px var(--accent-glow);
}

.brand h1 {
  color: var(--accent);
  font-size: 1.1rem;
  text-shadow: 0 0 18px rgba(94, 184, 255, 0.25);
}

.type-call { border-left: 3px solid #3b82f6; }
.type-contact { border-left: 3px solid #a855f7; }
.type-wa { border-left: 3px solid #22c55e; }
.type-media { border-left: 3px solid #f59e0b; }

.drawer-wide { max-width: 560px; }

.drawer-content.scrollable.drawer-wide {
  max-height: calc(100vh - 4rem);
}

.control-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  margin: 1rem 0;
}

.ctrl-btn {
  padding: 0.75rem 0.5rem;
  background: var(--panel-hover);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.ctrl-btn:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.ctrl-btn.danger:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: var(--red);
}

.command-log {
  max-height: 200px;
  overflow-y: auto;
  font-size: 0.78rem;
  color: var(--muted);
  background: var(--bg);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  margin-bottom: 1rem;
}

.command-log .cmd-row {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  padding: 0.35rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  line-height: 1.35;
}

.command-log .cmd-row:last-child {
  border-bottom: none;
}

.command-log .cmd-time {
  flex: 0 0 auto;
  min-width: 9.5rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  opacity: 0.85;
}

.command-log .cmd-text {
  flex: 1;
  min-width: 0;
  word-break: break-word;
}

.command-log .cmd-ok .cmd-text { color: var(--green); }
.command-log .cmd-err .cmd-text { color: var(--red); }
.command-log .cmd-pending .cmd-text { color: var(--muted); }
.command-log .cmd-empty { color: var(--muted); padding: 0.35rem 0; }

.command-log .cmd-ok { color: var(--green); }
.command-log .cmd-err { color: var(--red); }

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.5rem;
  margin: 1rem 0;
  max-height: 400px;
  overflow-y: auto;
}

.media-grid img {
  width: 100%;
  height: 100px;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid var(--border);
}

.media-grid .media-item {
  text-align: center;
  font-size: 0.7rem;
  color: var(--muted);
}

.enroll-result {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--bg);
  border-radius: 8px;
  text-align: center;
}

.enroll-result canvas,
.enroll-result .enroll-qr-img {
  margin: 1rem auto;
  display: block;
  border-radius: 8px;
  background: #fff;
  padding: 8px;
}

.enroll-list {
  list-style: none;
  margin-top: 1rem;
}

.enroll-list li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.enroll-list a { color: var(--accent); word-break: break-all; }

#control-panel-btn {
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  color: var(--accent);
}

/* ── Layout v2: nav | devices | feed (map on demand) ── */
main.layout-v2 {
  grid-template-columns: 200px 300px 1fr;
}

.feed-wide {
  border-right: none;
}

.feed-hint {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
}

.side-nav {
  padding: 0.75rem 0;
  border-right: 1px solid var(--border);
}

.nav-label {
  display: block;
  padding: 0.25rem 1rem 0.75rem;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.nav-group {
  border-bottom: 1px solid var(--border);
}

.nav-toggle {
  width: 100%;
  text-align: left;
  padding: 0.75rem 1rem;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-toggle::after {
  content: "▸";
  font-size: 0.7rem;
  color: var(--muted);
  transition: transform 0.15s;
}

.nav-group.open .nav-toggle::after {
  transform: rotate(90deg);
}

.nav-submenu {
  display: none;
  padding: 0 0.5rem 0.75rem;
}

.nav-group.open .nav-submenu {
  display: block;
}

.nav-sub {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.45rem 0.75rem;
  margin-bottom: 0.15rem;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.nav-sub:hover,
.nav-sub.active {
  background: var(--panel-hover);
  color: var(--text);
}

.filter-btn.nav-sub.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.nav-view-btn.nav-sub.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  border: 1px solid var(--accent);
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.18);
}

.nav-admin-btn.nav-sub.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  border: 1px solid var(--accent);
}

.nav-control-btn.nav-sub.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  border: 1px solid var(--accent);
}

.control-device-bar {
  margin: 0 1rem 0.5rem;
  padding: 0.65rem 0.85rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  flex-shrink: 0;
}

.control-device-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
}

.control-device-label {
  font-size: 0.75rem;
  color: var(--muted);
}

.control-device-meta {
  font-size: 0.75rem;
  color: var(--muted);
}

.control-offline-hint {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  color: #fcd34d;
}

.control-page.active {
  overflow-y: auto;
}

.control-page-inner {
  max-width: 640px;
  padding: 0.25rem 0 1rem;
}

.control-page .admin-section {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
}

.control-page .admin-section label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.35rem;
}

.control-page .control-grid {
  margin: 0.75rem 0 0;
}

.control-grid-single {
  grid-template-columns: 1fr;
}

.ctrl-btn-block {
  width: 100%;
  margin-top: 0.5rem;
}

.control-log-wrap {
  flex-shrink: 0;
  margin: 0 0 0.75rem;
  padding: 0 0.25rem;
}

.control-log-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.archive-browser-inline {
  max-height: none;
}

.nav-ver-badge {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: rgba(94, 184, 255, 0.12);
  border: 1px solid rgba(94, 184, 255, 0.28);
  color: var(--accent);
  font-size: 0.65rem;
  font-weight: 700;
  vertical-align: middle;
}

.admin-page.active {
  overflow-y: auto;
}

/* ── Dashboard panel ── */
.overview-page {
  padding: 0.25rem 0 0.75rem;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
  max-width: 420px;
}

.overview-card {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  background: linear-gradient(145deg, rgba(14, 26, 48, 0.85), rgba(10, 18, 32, 0.92));
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.45rem 0.55rem;
  min-width: 0;
  box-shadow: none;
  transition: border-color 0.2s, background 0.2s;
}

.overview-card:hover {
  border-color: var(--border-strong);
  background: linear-gradient(145deg, rgba(16, 30, 54, 0.9), rgba(12, 20, 36, 0.95));
}

.overview-card-wide {
  grid-column: span 1;
}

.overview-label {
  font-size: 0.55rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  line-height: 1.2;
}

.overview-value {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.15;
  word-break: break-word;
}

.overview-value.overview-mono {
  font-family: ui-monospace, "Cascadia Code", "SF Mono", monospace;
  font-size: 0.82rem;
  letter-spacing: 0.01em;
}

.overview-hint {
  font-size: 0.52rem;
  color: var(--muted);
  margin-top: 0.05rem;
  line-height: 1.2;
}

@media (min-width: 480px) {
  .overview-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    max-width: 480px;
    gap: 0.5rem;
  }

  .overview-card:not(.overview-card-wide) {
    grid-column: span 2;
  }

  .overview-card-wide {
    grid-column: span 3;
  }
}

@media (max-width: 479px) {
  .overview-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-width: 100%;
  }

  .overview-card-wide {
    grid-column: span 3;
  }

  .overview-value {
    font-size: 0.95rem;
  }

  .overview-value.overview-mono {
    font-size: 0.75rem;
  }
}

.admin-page-inner {
  max-width: 640px;
  padding: 0.25rem 0 2rem;
}

.admin-page .admin-section {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
}

.admin-page .admin-section label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.35rem;
}

.version-banner {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0.5rem 0 0.85rem;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.35);
  color: #86efac;
  font-size: 0.78rem;
}

.version-banner.large {
  font-size: 0.9rem;
  padding: 0.55rem 0.9rem;
}

.version-banner strong,
.qr-version-hint strong {
  color: #bbf7d0;
}

.ver-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.ver-item.ver-ok {
  border-left: 3px solid var(--green);
}

.ver-item.ver-warn {
  border-left: 3px solid #eab308;
}

.telegram-status-line.ok { color: var(--green); }
.telegram-status-line.warn { color: #fcd34d; }

/* ── Display panel (switchable main area) ── */
.display-panel {
  border-right: none;
}

.display-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.display-view {
  display: none;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  flex-direction: column;
}

.display-view.active {
  display: flex;
}

#view-feed.active #event-feed {
  flex: 1;
  overflow-y: auto;
}

.map-inline-wrap {
  flex: 1;
  position: relative;
  min-height: 0;
}

.map-history-layout {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

#view-map.history-mode .map-inline-wrap {
  flex: 1;
  min-height: 0;
}

/* ── Map info sidebar (History + Live) ── */
.location-timeline,
.location-live-panel,
.map-info-sidebar {
  position: absolute;
  top: 10px;
  left: 10px;
  bottom: 10px;
  z-index: 650;
  max-width: calc(100% - 20px);
  pointer-events: none;
}

.location-timeline.hidden,
.location-live-panel.hidden,
.map-info-sidebar.hidden {
  display: none !important;
}

.timeline-shell {
  display: flex;
  align-items: stretch;
  height: 100%;
  max-height: 100%;
  pointer-events: auto;
}

.timeline-panel {
  width: min(320px, calc(100vw - 88px));
  max-width: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex-shrink: 0;
  background: linear-gradient(165deg, rgba(14, 26, 48, 0.97), rgba(8, 14, 28, 0.98));
  border: 1px solid var(--border);
  border-radius: 12px 0 0 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(56, 189, 248, 0.06);
  overflow: hidden;
  backdrop-filter: blur(8px);
  transition: width 0.32s ease, opacity 0.28s ease, transform 0.32s ease, border-color 0.32s ease;
}

.location-timeline.collapsed .timeline-panel,
.location-live-panel.collapsed .timeline-panel,
.map-info-sidebar.collapsed .timeline-panel {
  width: 0;
  min-width: 0;
  opacity: 0;
  transform: translateX(-8px);
  border-color: transparent;
  pointer-events: none;
  box-shadow: none;
}

.location-timeline.collapsed .timeline-toggle,
.location-live-panel.collapsed .timeline-toggle,
.map-info-sidebar.collapsed .timeline-toggle {
  border-left: 1px solid var(--border);
  border-radius: 0 10px 10px 0;
}

.timeline-toggle {
  flex-shrink: 0;
  align-self: center;
  position: relative;
  z-index: 2;
  width: 28px;
  height: 56px;
  margin-left: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 0 10px 10px 0;
  background: linear-gradient(180deg, rgba(20, 36, 64, 0.98), rgba(12, 22, 40, 0.98));
  color: var(--accent);
  cursor: pointer;
  box-shadow: 4px 0 16px rgba(0, 0, 0, 0.3);
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.timeline-toggle::before {
  content: "";
  position: absolute;
  inset: -10px -14px -10px -8px;
}

.timeline-toggle:hover,
.timeline-toggle:focus-visible {
  background: var(--accent-soft);
  color: #fff;
  box-shadow: 4px 0 20px rgba(56, 189, 248, 0.25);
  outline: none;
}

.timeline-toggle-icon {
  display: block;
  font-size: 1.2rem;
  line-height: 1;
  font-weight: 700;
  pointer-events: none;
}

#view-map.history-mode .map-inline-wrap.timeline-sidebar-open .leaflet-top.leaflet-left,
#view-map.realtime-mode .map-inline-wrap.timeline-sidebar-open .leaflet-top.leaflet-left {
  left: calc(min(320px, calc(100vw - 88px)) + 36px);
  transition: left 0.32s ease;
}

.timeline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: rgba(56, 189, 248, 0.04);
}

.timeline-head h3 {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0;
}

.timeline-count {
  font-size: 0.68rem;
  color: var(--accent);
  font-weight: 600;
  text-align: right;
  line-height: 1.3;
}

#timeline-list {
  list-style: none;
  margin: 0;
  padding: 0.5rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}

.timeline-item {
  padding: 0.65rem 0.75rem;
  margin-bottom: 0.35rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.timeline-item:hover,
.timeline-item.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.timeline-item.timeline-last-offline {
  border-left: 3px solid var(--accent);
}

.timeline-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.timeline-time {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
}

.timeline-badge {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  white-space: nowrap;
}

.timeline-badge.offline {
  background: rgba(94, 184, 255, 0.14);
  color: #f87171;
}

.timeline-badge.last {
  background: rgba(94, 184, 255, 0.1);
  color: #fca5a5;
}

.timeline-badge.start {
  background: rgba(34, 197, 94, 0.15);
  color: #86efac;
}

.timeline-device {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

.timeline-loc {
  font-size: 0.8rem;
  color: var(--text);
  margin-top: 0.15rem;
}

.timeline-maps {
  display: inline-block;
  font-size: 0.7rem;
  color: var(--blue);
  margin-top: 0.35rem;
  text-decoration: none;
}

.timeline-maps:hover {
  text-decoration: underline;
}

.timeline-empty {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 1.5rem;
}

.timeline-coords {
  display: block;
  font-size: 0.75rem;
  color: var(--accent);
  background: var(--bg);
  padding: 0.25rem 0.4rem;
  border-radius: 4px;
  margin-top: 0.35rem;
  user-select: all;
}

.timeline-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.4rem;
}

.timeline-copy {
  background: none;
  border: none;
  font-size: 0.7rem;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
}

.timeline-copy:hover {
  color: var(--text);
}

.timeline-reason {
  font-size: 0.68rem;
  color: var(--muted);
  font-weight: 400;
}

.num-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: var(--accent);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

.leaflet-popup-content .map-popup {
  min-width: 180px;
}

.leaflet-popup-content .map-coords {
  display: block;
  font-size: 0.75rem;
  background: var(--bg, #0d1117);
  padding: 0.3rem 0.45rem;
  border-radius: 4px;
  margin: 0.4rem 0;
  user-select: all;
  color: var(--accent);
}

.leaflet-popup-content .map-popup-actions {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.leaflet-popup-content .map-popup-link {
  color: #3b82f6;
  font-size: 0.78rem;
  text-decoration: none;
}

.leaflet-popup-content .map-copy-coords {
  background: var(--panel-hover, #1e293b);
  border: 1px solid var(--border, #334155);
  border-radius: 6px;
  padding: 0.3rem 0.5rem;
  font-size: 0.72rem;
  cursor: pointer;
  color: var(--text, #e2e8f0);
}

.map-inline-wrap #map {
  width: 100%;
  height: 100%;
  background: #0d1117;
  z-index: 1;
}

.map-inline-wrap #map-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  background: var(--bg);
  z-index: 0;
  pointer-events: none;
}

.map-inline-wrap #map-fallback.hidden {
  display: none;
}

.media-grid-inline {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
  max-height: none;
  margin: 0;
}

.map-type-toggle {
  position: absolute;
  top: 12px;
  left: 52px;
  z-index: 500;
  display: flex;
  gap: 0.25rem;
  background: rgba(15, 20, 28, 0.92);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.25rem;
}

.map-type-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 0.7rem;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}

.map-type-btn:hover,
.map-type-btn.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.map-provider-badge {
  position: absolute;
  bottom: 12px;
  right: 12px;
  z-index: 500;
  font-size: 0.65rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  background: rgba(15, 20, 28, 0.85);
  color: var(--muted);
  border: 1px solid var(--border);
}

.map-provider-badge.google {
  color: #4285f4;
  border-color: rgba(66, 133, 244, 0.4);
}

.map-legend {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 500;
  background: rgba(15, 20, 28, 0.92);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  font-size: 0.72rem;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.legend-item .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.dot-start { background: #22c55e; }
.dot-trail { background: var(--accent); width: 18px; height: 3px; border-radius: 2px; }
.dot-last { background: var(--accent); box-shadow: 0 0 8px var(--accent-glow); }

.map-history-info {
  display: none;
}

.pulse-dot {
  display: block;
  width: 18px;
  height: 18px;
  background: var(--accent);
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 0 14px var(--accent-glow);
  animation: pulse-marker 1.5s ease-in-out infinite;
}

@keyframes pulse-marker {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.15); opacity: 0.85; }
}

.device-actions-row {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}

.device-actions-row .btn-sm {
  font-size: 0.72rem;
  padding: 0.2rem 0.45rem;
}

.command-log .cmd-pending { color: var(--muted); }

@media (max-width: 1100px) {
  main.layout-v2 {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    height: auto;
    min-height: calc(100dvh - 120px);
  }

  /* layout-modular: menu dropdown horizontal */
  main.layout-modular {
    flex: 1;
    min-height: 0;
  }

  .layout-modular .nav-toggle {
    font-size: 0.74rem;
    padding: 0.45rem 0.7rem;
  }

  .layout-modular .nav-sub {
    font-size: 0.72rem;
    padding: 0.4rem 0.55rem;
  }

  .header-stats {
    order: 3;
    width: 100%;
    justify-content: flex-start;
  }

  .header-modular .header-actions {
    margin-left: auto;
  }

  /* layout-v2 legacy horizontal nav — jangan dipakai layout-modular */
  main.layout-v2 .side-nav {
    flex-direction: row;
    flex-wrap: wrap;
    padding: 0.5rem;
    gap: 0.25rem;
  }

  main.layout-v2 .nav-section,
  main.layout-v2 .nav-group {
    border: none;
  }

  main.layout-v2 .nav-label { display: none; }

  main.layout-v2 .nav-toggle {
    width: auto;
    padding: 0.5rem 0.75rem;
    background: var(--bg);
    border-radius: 8px;
    border: 1px solid var(--border);
  }

  main.layout-v2 .nav-toggle::after { display: none; }

  main.layout-v2 .nav-group .nav-submenu {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 50;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.5rem;
    min-width: 160px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  }

  main.layout-v2 .nav-group {
    position: relative;
  }

  main.layout-v2 .devices-panel { max-height: 220px; }
  main.layout-v2 .display-panel { min-height: 420px; }

  .layout-modular .display-panel {
    min-height: 0;
  }

  .hdr-stat.hdr-datetime {
    min-width: 0;
    flex: 1 1 100%;
  }

  .running-text-track {
    font-size: 0.68rem;
  }
}

/* ── Phone layout (< 768px) ── */
@media (max-width: 768px) {
  main.layout-v2 {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
  }

  /* layout-modular: dropdown nav + konten penuh */
  main.layout-modular {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .layout-modular .side-nav {
    padding: 0.45rem 0.55rem;
    gap: 0.3rem;
  }

  .layout-modular .nav-submenu {
    min-width: min(240px, 92vw);
    max-height: min(52dvh, 360px);
  }

  /* layout-v2 legacy: horizontal chip nav */
  main.layout-v2 .side-nav {
    flex-direction: column;
    flex-wrap: nowrap;
    padding: 0;
    border-right: none;
    border-bottom: 1px solid var(--border);
    background: var(--panel);
    flex-shrink: 0;
  }

  main.layout-v2 .nav-section { display: none; }

  main.layout-v2 .nav-group {
    border: none;
    position: static;
  }

  main.layout-v2 .nav-toggle {
    display: none;
  }

  main.layout-v2 .nav-group .nav-submenu {
    position: static;
    display: flex !important;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 0.35rem;
    padding: 0.5rem 0.65rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  main.layout-v2 .nav-group .nav-submenu::-webkit-scrollbar {
    display: none;
  }

  main.layout-v2 .nav-group + .nav-group .nav-submenu {
    border-top: 1px solid var(--border);
  }

  main.layout-v2 .nav-sub,
  main.layout-v2 .filter-btn.nav-sub,
  main.layout-v2 .nav-view-btn.nav-sub {
    flex: 0 0 auto;
    width: auto;
    white-space: nowrap;
    padding: 0.45rem 0.65rem;
    font-size: 0.72rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 999px;
  }

  main.layout-v2 .filter-btn.nav-sub.active,
  main.layout-v2 .nav-view-btn.nav-sub.active {
    border-color: var(--accent);
  }

  /* Device list: compact horizontal cards */
  .devices-panel {
    max-height: none;
    border-right: none;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
  }

  .panel-head {
    padding: 0.65rem 0.85rem;
  }

  #device-list {
    display: flex;
    flex-direction: row;
    gap: 0.5rem;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0.5rem 0.65rem 0.75rem;
    -webkit-overflow-scrolling: touch;
  }

  #device-list li {
    flex: 0 0 min(280px, 85vw);
    margin-bottom: 0;
  }

  /* Main display fills remaining space */
  .layout-modular .display-panel {
    flex: 1;
    min-height: 0;
    border-left: none;
  }

  .layout-modular .display-body {
    flex: 1;
    min-height: 0;
  }

  /* Map: isi sisa tinggi panel — Leaflet absolute fill */
  #view-map.active,
  #view-idle.active {
    flex: 1;
    min-height: 0;
  }

  #view-idle.active .idle-map-wrap {
    flex: 1;
    min-height: 0;
  }

  #view-map.active .map-history-layout {
    flex: 1;
    min-height: 0;
  }

  #view-map.active .map-inline-wrap {
    flex: 1;
    min-height: 0;
    height: auto;
    max-height: none;
  }

  #view-map.active .map-inline-wrap #map,
  #view-map.active .map-inline-wrap .leaflet-container {
    min-height: 0;
    max-height: none;
  }

  #view-map.history-mode .map-inline-wrap {
    min-height: 0;
    height: auto;
    max-height: none;
  }

  #view-map.history-mode .map-inline-wrap #map,
  #view-map.history-mode .map-inline-wrap .leaflet-container {
    min-height: 0;
    max-height: none;
  }

  .location-timeline,
  .location-live-panel,
  .map-info-sidebar {
    top: 8px;
    left: 8px;
    bottom: 8px;
    max-width: calc(100% - 16px);
  }

  .timeline-panel {
    width: min(280px, calc(100vw - 72px));
  }

  #view-map.history-mode .map-inline-wrap.timeline-sidebar-open .leaflet-top.leaflet-left,
  #view-map.realtime-mode .map-inline-wrap.timeline-sidebar-open .leaflet-top.leaflet-left {
    left: calc(min(280px, calc(100vw - 72px)) + 32px);
  }

  .timeline-toggle {
    width: 26px;
    height: 48px;
  }

  .panel-head h2 {
    font-size: 0.68rem;
  }

  .feed-hint {
    font-size: 0.65rem;
    max-width: 55%;
    text-align: right;
    line-height: 1.3;
  }

  /* Map overlays — avoid overlap */
  .map-legend {
    top: auto;
    bottom: 36px;
    right: 8px;
    left: 8px;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    font-size: 0.62rem;
    padding: 0.4rem 0.55rem;
  }

  .map-type-toggle {
    top: 8px;
    left: 8px;
    right: 8px;
    flex-wrap: wrap;
    justify-content: center;
  }

  .map-type-btn {
    font-size: 0.65rem;
    padding: 0.3rem 0.45rem;
  }

  .map-provider-badge {
    bottom: 8px;
    right: 8px;
    left: auto;
    font-size: 0.6rem;
  }

  .control-grid {
    grid-template-columns: 1fr;
  }

  .timeline-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .timeline-actions {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }
}

@media (max-width: 480px) {
  .layout-modular .nav-toggle {
    font-size: 0.68rem;
    padding: 0.42rem 0.6rem;
  }

  .stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .header-actions .live-label {
    display: none;
  }

  #notify-btn {
    display: none;
  }

  .login-box h1 {
    font-size: 1.35rem;
  }

  .display-panel {
    min-height: 58dvh;
  }
}

@media (max-width: 900px) {
  .control-grid { grid-template-columns: 1fr; }
}

.device-select-hint {
  color: var(--muted);
  font-size: 0.85rem;
  padding: 1rem;
  text-align: center;
}
