:root {
  --ink: #071018;
  --panel: rgba(8, 16, 28, 0.78);
  --line: rgba(212, 178, 74, 0.22);
  --gold: #d4b24a;
  --gold-soft: #f0d78c;
  --cyan: #1ee0ff;
  --fog: #c8d4e2;
  --muted: #8ea0b5;
  --tanker: #f0b429;
  --cargo: #1ee0ff;
  --passenger: #e86cff;
  --fishing: #3ee0a0;
  --service: #f4f1e8;
  --other: #7aa2ff;
}

* { box-sizing: border-box; }
html, body, .app { height: 100%; margin: 0; }
body {
  font-family: Outfit, sans-serif;
  color: var(--fog);
  background: radial-gradient(circle at 20% -10%, #16324a 0%, var(--ink) 42%);
  overflow: hidden;
}

.app {
  display: grid;
  grid-template-columns: 360px 1fr;
  grid-template-rows: 84px 1fr;
}

.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(8,14,24,0.94), rgba(12,24,38,0.72));
  backdrop-filter: blur(16px);
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 14px; }
.logo-ring {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  padding: 2px;
  background: conic-gradient(from 120deg, #8a6a1e, #f0d78c, #8a6a1e);
  box-shadow: 0 0 24px rgba(212, 178, 74, 0.28);
}
.logo-ring img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}
.brand-kicker {
  margin: 0;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-size: 10px;
  color: var(--gold);
}
.brand h1 {
  margin: 2px 0 0;
  font-family: Cinzel, serif;
  font-size: 22px;
  letter-spacing: 0.04em;
  color: #f7f1de;
}

.status-cluster { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pill {
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.04em;
}
.pill.gold { color: var(--gold-soft); border-color: rgba(212,178,74,0.4); }
.pill.live { color: var(--cyan); }
.pill.alert { color: #ffb36b; border-color: rgba(255, 122, 61, 0.55); }
.pill.danger { color: #ff8d8d; border-color: rgba(255, 80, 80, 0.55); }
.pulse {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cyan);
  margin-right: 6px;
  box-shadow: 0 0 10px var(--cyan);
  animation: pulse 1.6s infinite;
}
.clock {
  font-variant-numeric: tabular-nums;
  color: var(--gold-soft);
  min-width: 86px;
  text-align: right;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  overflow: auto;
  z-index: 12;
}
.panel {
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.025);
  border-radius: 18px;
  padding: 14px;
}
.panel.grow { flex: 1; min-height: 220px; display: flex; flex-direction: column; }
.panel h2 {
  margin: 0 0 8px;
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold-soft);
}
.hint, .credit-note { color: var(--muted); font-size: 12px; line-height: 1.5; }
.subhead {
  margin: 14px 0 8px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
}
.scan-panel { padding-bottom: 10px; }
.weather-list, .signal-list, .alert-list { display: grid; gap: 8px; }
.weather-list {
  max-height: 420px;
  overflow: auto;
  padding-right: 2px;
}
.weather-card, .signal-card, .alert-item {
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(2, 8, 16, 0.45);
  border-radius: 12px;
  padding: 10px;
}
.weather-card strong, .signal-card strong { display: block; color: #f7f1de; }
.weather-card span, .signal-card span, .alert-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}
.weather-days {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  margin-top: 8px;
}
.weather-days b {
  display: block;
  font-size: 10px;
  color: var(--gold-soft);
}
.weather-days small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}
.alert-item { border-color: rgba(255, 122, 61, 0.35); }
.alert-item.tinggi { border-color: rgba(255, 80, 80, 0.5); }
.alert-banner {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 24;
  max-width: min(720px, calc(100% - 32px));
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(48, 14, 12, 0.92);
  border: 1px solid rgba(255, 120, 80, 0.5);
  color: #ffd7c2;
  font-size: 13px;
  text-align: center;
}
.alert-banner[hidden] { display: none; }
label {
  display: block;
  margin: 12px 0 6px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
input, select, button { font: inherit; }
input, select {
  width: 100%;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(2, 8, 16, 0.7);
  color: var(--fog);
  border-radius: 12px;
  padding: 11px 12px;
  outline: none;
}
input:focus, select:focus { border-color: rgba(30,224,255,0.5); }

.scope-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.scope-btn, .ghost-btn, .primary-btn, .close-btn {
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
  color: var(--fog);
  border-radius: 12px;
  cursor: pointer;
}
.scope-btn { padding: 9px 6px; font-size: 11px; }
.scope-btn.active {
  background: linear-gradient(180deg, rgba(212,178,74,0.22), rgba(212,178,74,0.08));
  color: var(--gold-soft);
  border-color: rgba(212,178,74,0.55);
}
.combo { position: relative; }
.combo-list {
  position: absolute;
  left: 0; right: 0; top: calc(100% + 4px);
  max-height: 220px;
  overflow: auto;
  background: #0b1522;
  border: 1px solid var(--line);
  border-radius: 12px;
  z-index: 30;
}
.combo-item {
  padding: 9px 12px;
  cursor: pointer;
  font-size: 13px;
}
.combo-item:hover, .combo-item.active { background: rgba(30,224,255,0.08); }

.primary-btn {
  width: 100%;
  margin-top: 14px;
  padding: 13px 14px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  background: linear-gradient(180deg, #e6c56a, #9c7a24);
  color: #1a1406;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.primary-btn:disabled { opacity: 0.6; cursor: wait; }
.radar-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: #1a1406;
  box-shadow: 0 0 0 4px rgba(26,20,6,0.15);
}
.search-row { display: flex; gap: 8px; }
.ghost-btn { padding: 0 14px; }
.ghost-btn.full { width: 100%; margin-top: 12px; height: 42px; }
.logout-btn { height: 34px; padding: 0 12px; }
a.nav-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
.zone-list {
  margin: 0 0 12px;
  padding-left: 18px;
  color: var(--fog);
  font-size: 13px;
}
.user-list { display: grid; gap: 8px; margin-bottom: 12px; }
.user-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.08);
}
.user-row strong { display: block; color: #fff; }
.user-row span { display: block; color: var(--muted); font-size: 11px; }
.user-row .ghost-btn { height: 30px; padding: 0 8px; font-size: 11px; }
.list-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.list-head select { width: auto; min-width: 140px; padding: 7px 8px; }
.list-actions { display: flex; gap: 6px; align-items: center; }
.pdf-btn { height: 36px; padding: 0 8px; white-space: nowrap; font-size: 12px; }

.vessel-list { overflow: auto; margin-top: 10px; flex: 1; }
.empty, .vessel-card { padding: 12px; border-radius: 12px; }
.empty { color: var(--muted); font-size: 13px; }
.vessel-card {
  border: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 8px;
  cursor: pointer;
  background: rgba(255,255,255,0.02);
  display: flex;
  gap: 10px;
  align-items: center;
}
.vessel-card:hover { border-color: rgba(30,224,255,0.3); }
.vessel-card strong { display: block; color: #fff; }
.vessel-card span { display: block; color: var(--muted); font-size: 12px; }
.card-ship { width: 22px; height: 42px; flex: 0 0 22px; }
.card-ship svg { width: 100%; height: 100%; display: block; }

.map-wrap { position: relative; }
#map { height: 100%; width: 100%; background: #061018; }
.radar-overlay {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background: repeating-radial-gradient(circle at 50% 50%, transparent 0 38px, rgba(30,224,255,0.035) 39px 40px);
  mix-blend-mode: screen;
}
.radar-overlay::after {
  content: "";
  position: absolute;
  inset: -20%;
  background: conic-gradient(from 0deg, transparent 0 74%, rgba(30,224,255,0.08) 86%, transparent 100%);
  animation: sweep 7s linear infinite;
}
.map-legend {
  position: absolute;
  left: 16px;
  bottom: 16px;
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(6,16,24,0.78);
  border: 1px solid var(--line);
  font-size: 12px;
}
.legend-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.legend-row b { color: var(--gold-soft); letter-spacing: 0.08em; text-transform: uppercase; font-size: 10px; }
.legend-toggle { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); cursor: pointer; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.dot.tanker { background: var(--tanker); }
.dot.cargo { background: var(--cargo); }
.dot.passenger { background: var(--passenger); }
.dot.fishing { background: var(--fishing); }
.dot.service { background: var(--service); }
.dot.other { background: var(--other); }
.dot.quake { background: #ff6b6b; clip-path: polygon(50% 0, 100% 100%, 0 100%); border-radius: 0; }
.dot.fire { background: #ff8a3d; }

.hazard-icon { background: none !important; border: none !important; }
.hazard-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  color: #1a0b06;
  box-shadow: 0 0 12px rgba(255, 120, 60, 0.45);
}
.hazard-mark.quake {
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  background: #ff6b6b;
}
.hazard-mark.fire {
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  background: #ff8a3d;
}
.hazard-mark.fire span { transform: rotate(45deg); }
.hazard-wrap { display: flex; flex-direction: column; align-items: center; width: 120px; }
.hazard-coord {
  display: block;
  margin-top: 3px;
  color: #ffd7c2;
  font-size: 9px;
  text-shadow: 0 1px 4px #061018;
  white-space: nowrap;
}

.route-card {
  display: grid;
  gap: 8px;
  margin: 12px 0 14px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(30, 224, 255, 0.06);
  border: 1px solid rgba(30, 224, 255, 0.2);
}
.route-stop small {
  display: block;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 10px;
  color: var(--gold);
}
.route-stop strong { display: block; color: #fff; margin: 3px 0; }
.route-stop span { display: block; color: var(--muted); font-size: 12px; }
.route-stop.dest strong { color: var(--cyan); }
.route-line {
  height: 14px;
  width: 2px;
  margin-left: 8px;
  background: linear-gradient(180deg, var(--gold), var(--cyan));
}
.detail {
  position: absolute;
  top: 100px;
  right: 18px;
  width: 360px;
  max-height: calc(100vh - 130px);
  overflow: auto;
  padding: 18px;
  border-radius: 20px;
  background: rgba(8,16,26,0.92);
  border: 1px solid var(--line);
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  z-index: 15;
}
.detail h2 { font-family: Cinzel, serif; margin: 4px 0 6px; }
.detail-type { color: var(--cyan); margin-top: 0; }
.detail-grid { display: grid; gap: 8px; }
.kv { border-top: 1px solid rgba(255,255,255,0.06); padding-top: 8px; }
.kv b { display: block; color: var(--muted); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; }
.close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

.toast {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(8,16,24,0.92);
  border: 1px solid var(--line);
  padding: 10px 14px;
  border-radius: 12px;
  z-index: 25;
}
.loader {
  position: fixed;
  inset: 0;
  background: rgba(4,8,14,0.55);
  display: grid;
  place-items: center;
  z-index: 40;
}
.loader[hidden], .detail[hidden], .toast[hidden] { display: none; }
.loader-ring {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: 2px solid rgba(212,178,74,0.2);
  border-top-color: var(--gold);
  animation: spin 1s linear infinite;
}
.vessel-icon { background: none !important; border: none !important; }
.vessel-marker {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 120px;
  pointer-events: auto;
}
.vessel-hull {
  width: 28px;
  height: 56px;
  filter: drop-shadow(0 0 8px rgba(30, 224, 255, 0.28));
  transform-origin: 50% 50%;
}
.vessel-hull svg { width: 100%; height: 100%; display: block; overflow: visible; }
.vessel-caption {
  margin-top: 2px;
  text-align: center;
  line-height: 1.15;
  max-width: 118px;
}
.vessel-caption strong,
.vessel-caption small {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vessel-caption strong {
  color: #f7f1de;
  font-size: 11px;
  text-shadow: 0 1px 4px #061018;
}
.vessel-caption small {
  color: #d4b24a;
  font-size: 10px;
  text-shadow: 0 1px 4px #061018;
}
.labels-compact .vessel-caption small { display: none; }
.labels-hidden .vessel-caption { display: none; }

@keyframes sweep { to { transform: rotate(360deg); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: 0.35; } }

.leaflet-container { background: #061018; font-family: Outfit, sans-serif; }
.leaflet-control-zoom a {
  background: #0d1824 !important;
  color: var(--gold-soft) !important;
  border-color: var(--line) !important;
}

@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; grid-template-rows: 76px auto 1fr; }
  .sidebar { max-height: 42vh; }
  .detail { left: 12px; right: 12px; width: auto; }
}
