:root {
  --pl-navy: #05213f;
  --pl-blue: #0b5fc0;
  --pl-green: #159455;
  --pl-teal: #0f9f9a;
  --pl-safe: #16a34a;
  --pl-caution: #f59e0b;
  --pl-danger: #dc2626;
  --pl-closed: #475569;
}

.pamaligtas-brand-logo {
  display: block;
  width: auto;
  height: auto;
  object-fit: contain;
}
.pamaligtas-auth-logo { display: block; width: 150px; height: 110px; margin: -14px auto 4px; object-fit: contain; }

.pamaligtas-map-legend {
  min-width: 200px;
  max-width: 260px;
  border: 1px solid rgba(255,255,255,.82);
  border-radius: 14px;
  background: rgba(255,255,255,.92);
  box-shadow: 0 8px 28px rgba(5,33,63,.18);
  color: #19324a;
  font: 600 11px/1.35 "Segoe UI", Arial, sans-serif;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  overflow: hidden;
  transition: all .3s cubic-bezier(.4,0,.2,1);
}
.pamaligtas-map-legend__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  gap: 8px;
}
.pamaligtas-map-legend__title {
  color: var(--pl-navy);
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.pamaligtas-map-legend__title i { color: var(--pl-blue); font-size: 11px; }
.pamaligtas-map-legend__toggle {
  background: rgba(15,23,42,.06);
  border: none;
  border-radius: 6px;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #475569;
  font-size: 11px;
  transition: all .15s;
  flex-shrink: 0;
}
.pamaligtas-map-legend__toggle:hover { background: rgba(15,23,42,.12); color: #1e293b; }
.pamaligtas-map-legend__content {
  max-height: 0;
  overflow: hidden;
  transition: max-height .35s cubic-bezier(.4,0,.2,1);
}
.pamaligtas-map-legend--collapsed .pamaligtas-map-legend__content { max-height: 0 !important; }
.pamaligtas-map-legend--expanded .pamaligtas-map-legend__content {
  max-height: 40vh;
  overflow-y: auto;
}

.pamaligtas-map-legend__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 10px;
  padding: 4px 12px 12px;
}
.pamaligtas-map-legend__item {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  font-size: 10px;
  font-weight: 600;
}

/* ── Legend route lines (match map route colors) ── */
.pamaligtas-map-legend__line {
  width: 22px;
  height: 0;
  border-top: 4px solid var(--pl-blue);
  border-radius: 99px;
  flex: 0 0 auto;
}
.pamaligtas-map-legend__line.main { border-color: #2563eb; }
.pamaligtas-map-legend__line.small-dash {
  border-color: #0f9f9a;
  border-top-style: dashed;
}

/* ── Legend marker miniatures (match actual map icons) ── */
.pamaligtas-map-legend__marker-mini {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
}
.pamaligtas-marker-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(15,23,42,.25);
  flex-shrink: 0;
}
.pamaligtas-map-legend__marker-mini.port-marker .pamaligtas-marker-dot { width: 22px; height: 22px; font-size: 10px; }
.pamaligtas-map-legend__marker-mini.boat-marker .pamaligtas-marker-dot { width: 24px; height: 24px; font-size: 10px; }

/* ── Mobile responsive ── */
@media(max-width:600px){
  .pamaligtas-map-legend { max-width: 180px; min-width: 140px; font-size: 10px; }
  .pamaligtas-map-legend__grid { grid-template-columns: 1fr; gap: 4px 8px; }
  .pamaligtas-map-legend__title { font-size: 10px; }
  .pamaligtas-map-legend__item { font-size: 9px; gap: 5px; }
  .pamaligtas-marker-dot { width: 16px; height: 16px; font-size: 7px; }
  .pamaligtas-map-legend__marker-mini.port-marker .pamaligtas-marker-dot { width: 18px; height: 18px; font-size: 8px; }
  .pamaligtas-map-legend__marker-mini.boat-marker .pamaligtas-marker-dot { width: 20px; height: 20px; font-size: 8px; }
  .pamaligtas-map-legend__header { padding: 8px 10px; }
}

.pamaligtas-boat-marker { background: transparent !important; border: 0 !important; }
.pamaligtas-boat-marker__body {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 3px solid #fff;
  border-radius: 50%;
  background: linear-gradient(145deg, #0b5fc0, #159455);
  box-shadow: 0 7px 18px rgba(5,33,63,.42);
  color: #fff;
  font-size: 22px;
  position: relative;
}
.pamaligtas-boat-marker.is-moving .pamaligtas-boat-marker__body::after {
  content: "";
  position: absolute;
  inset: -8px;
  border: 2px solid rgba(21,148,85,.58);
  border-radius: 50%;
  animation: pamaligtasBoatPulse 1.8s ease-out infinite;
}
@keyframes pamaligtasBoatPulse { 0% { transform: scale(.72); opacity: .9; } 100% { transform: scale(1.38); opacity: 0; } }
.pamaligtas-port-marker { background: transparent !important; border: 0 !important; }
.pamaligtas-port-marker__body { width: 28px; height: 28px; display: grid; place-items: center; border: 3px solid #fff; border-radius: 50%; background: var(--pl-blue); color: #fff; box-shadow: 0 4px 13px rgba(5,33,63,.36); font-size: 13px; }
.pamaligtas-emergency-marker { background: transparent !important; border: 0 !important; }
.pamaligtas-emergency-marker__body { width: 44px; height: 44px; display: grid; place-items: center; border: 3px solid #fff; border-radius: 50%; background: var(--pl-danger); color: #fff; box-shadow: 0 6px 18px rgba(220,38,38,.42); font-size: 19px; }

.pl-weather-card {
  overflow: hidden;
  border: 1px solid #dbe7ef;
  border-radius: 18px;
  background: linear-gradient(145deg, #fff, #f3faff);
  box-shadow: 0 10px 28px rgba(5,33,63,.08);
  color: #17324d;
}
.pl-weather-card__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 15px 8px; }
.pl-weather-card__title { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--pl-navy); font-size: 14px; font-weight: 800; }
.pl-live-badge { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 4px 8px; background: #dcfce7; color: #166534; font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .35px; }
.pl-live-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.14); }
.pl-weather-card__main { display: flex; align-items: center; gap: 14px; padding: 5px 15px 12px; }
.pl-weather-card__icon { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 15px; background: linear-gradient(145deg,#dbeafe,#ecfeff); color: var(--pl-blue); font-size: 27px; }
.pl-weather-card__temp { color: #0f2942; font-size: 31px; line-height: 1; font-weight: 850; }
.pl-weather-card__description { margin-top: 4px; color: #64748b; font-size: 11px; font-weight: 600; }
.pl-weather-card__metrics { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 7px; padding: 0 12px 12px; }
.pl-weather-metric { padding: 8px 5px; border: 1px solid #e5edf3; border-radius: 11px; background: rgba(255,255,255,.78); text-align: center; }
.pl-weather-metric__value { display: block; color: #17324d; font-size: 12px; font-weight: 800; }
.pl-weather-metric__label { display: block; margin-top: 2px; color: #7a8da0; font-size: 8px; font-weight: 700; text-transform: uppercase; }
.pl-weather-card__updated { padding: 7px 13px; border-top: 1px solid #e6eef4; color: #718398; background: rgba(248,250,252,.72); font-size: 9px; text-align: right; }

/* Unified Panasahan–Pamarawan River Status card. All rules are component-scoped. */
.pl-river-status-card { --river-color:#16a34a; --river-soft:#f0fdf4; --river-border:#bbf7d0; overflow:hidden; border:1px solid var(--river-border); border-left:4px solid var(--river-color); border-radius:16px; background:linear-gradient(140deg,#fff,var(--river-soft)); box-shadow:0 8px 22px rgba(5,33,63,.07); color:#17324d; }
.pl-river-status-card--caution { --river-color:#d97706; --river-soft:#fffbeb; --river-border:#fde68a; }
.pl-river-status-card--danger { --river-color:#dc2626; --river-soft:#fef2f2; --river-border:#fecaca; }
.pl-river-status-card--unavailable { --river-color:#64748b; --river-soft:#f8fafc; --river-border:#cbd5e1; }
.pl-river-status-card__head { display:flex; align-items:flex-start; justify-content:space-between; gap:10px; padding:13px 14px 9px; }
.pl-river-status-card__eyebrow { display:block; margin-bottom:3px; color:#718398; font-size:8px; font-weight:800; letter-spacing:.08em; text-transform:uppercase; }
.pl-river-status-card__head h3 { margin:0; color:#0f2942; font-size:13px; line-height:1.25; font-weight:850; }
.pl-river-status-card__body { display:grid; gap:12px; padding:5px 14px 12px; }
.pl-river-status-card__main { display:flex; align-items:center; min-width:0; gap:10px; }
.pl-river-status-ring { width:64px; height:64px; position:relative; display:grid; flex:0 0 auto; place-items:center; color:var(--river-color); }
.pl-river-status-ring svg { position:absolute; inset:0; width:100%; height:100%; transform:rotate(-90deg); }
.pl-river-status-ring circle { fill:none; stroke-width:4; }
.pl-river-status-ring__track { stroke:#dbe7ef; }
.pl-river-status-ring__value { stroke:var(--river-color); stroke-linecap:round; stroke-dasharray:132; stroke-dashoffset:10; }
.pl-river-status-ring i { position:relative; font-size:22px; }
.pl-river-status-card__copy { min-width:0; display:grid; gap:3px; }
.pl-river-status-card__copy strong { color:var(--river-color); font-size:24px; line-height:1; letter-spacing:.04em; }
.pl-river-status-card__copy span { color:#5e7388; font-size:10px; font-weight:600; line-height:1.35; }
.pl-river-status-route { display:flex; align-items:center; gap:8px; color:#597289; font-size:9px; font-weight:800; letter-spacing:.04em; text-transform:uppercase; }
.pl-river-status-route::before,.pl-river-status-route::after { content:""; height:2px; flex:1; border-radius:2px; background:linear-gradient(90deg,var(--river-color),rgba(148,163,184,.26)); }
.pl-river-status-route::after { background:linear-gradient(90deg,rgba(148,163,184,.26),var(--river-color)); }
.pl-river-status-route i { display:grid; width:22px; height:22px; place-items:center; border-radius:50%; background:var(--river-color); color:#fff; font-size:10px; box-shadow:0 0 0 4px rgba(22,163,74,.11); }
.pl-river-status-updated { padding:7px 14px; border-top:1px solid rgba(148,163,184,.18); color:#708398; font-size:8px; text-align:right; }
.pl-river-status-updated i { margin-right:3px; color:var(--river-color); }

@media (max-width: 600px) {
  .pamaligtas-map-legend { min-width: 176px; padding: 10px 11px; font-size: 10px; }
  .pamaligtas-map-legend__grid { gap: 6px 9px; }
  .pamaligtas-boat-marker__body { width: 44px; height: 44px; }
  .pl-weather-card__metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .pl-river-status-card__body { gap:10px; }
}
@media (prefers-reduced-motion: reduce) { .pamaligtas-boat-marker.is-moving .pamaligtas-boat-marker__body::after { animation: none; } }

/* ═══════════════════════════════════════════
   GLOBAL UX IMPROVEMENTS
   ═══════════════════════════════════════════ */

/* ── Smoother transitions on interactive elements ── */
a, button, .btn, input[type="submit"] { transition: all .18s cubic-bezier(.4,0,.2,1); }

/* ── Better table styling ── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table thead th {
  background: #f8fafc;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: #64748b;
  font-weight: 700;
  padding: 10px 14px;
  border-bottom: 2px solid #e2e8f0;
  white-space: nowrap;
}
.data-table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
  vertical-align: middle;
}
.data-table tbody tr:hover { background: #f8fafc; }
.data-table tbody tr:last-child td { border-bottom: none; }

/* ── Consistent status badges ── */
.status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .3px;
  white-space: nowrap;
}
.status.green { background: #dcfce7; color: #166534; }
.status.yellow, .status.orange { background: #fffbeb; color: #92400e; }
.status.red { background: #fef2f2; color: #991b1b; }
.status.gray { background: #f1f5f9; color: #475569; }
.status.blue { background: #dbeafe; color: #1e40af; }

/* ── Panel refinements ── */
.panel {
  background: white;
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  border: 1px solid #e2e8f0;
  transition: box-shadow .2s;
}
.panel:hover { box-shadow: 0 4px 12px rgba(0,0,0,.08); }
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f1f5f9;
}
.panel-head h3 {
  font-size: 15px;
  font-weight: 700;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Uniform card heights in grids ── */
.dashboard-grid, .page-grid {
  align-items: start;
}

/* ── Better loading states ── */
.pl-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  color: #94a3b8;
  font-size: 12px;
  gap: 8px;
}
.pl-loading::before {
  content: "";
  width: 18px;
  height: 18px;
  border: 2px solid #e2e8f0;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: plSpin .6s linear infinite;
}
@keyframes plSpin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════
   FINAL POLISH — scrollbars, focus, selection
   ═══════════════════════════════════════════ */

/* Consistent thin scrollbars (Firefox + WebKit) */
* { scrollbar-width: thin; scrollbar-color: #c5d2e4 transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: #c5d2e4; border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: #9fb3cc; }

/* Accessible focus outlines */
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid #0b5fc0;
  outline-offset: 2px;
  border-radius: 6px;
}

/* Text selection */
::selection { background: rgba(11, 95, 192, 0.16); }

/* Mobile tap highlight */
a, button, [role="button"] { -webkit-tap-highlight-color: transparent; }

/* Respect reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ── Better focus states for accessibility ── */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

/* ── Consistent icon sizing in navigation ── */
.sidebar nav a i { font-size: 15px; }

/* ── Responsive table wrapping ── */
@media(max-width:768px){
  .data-table-wrap, .panel > table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .panel { padding: 14px; }
  .panel-head h3 { font-size: 13px; }
}
