* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; font-family: -apple-system, "Segoe UI", Roboto, sans-serif; }
body { display: grid; grid-template-columns: 1fr 320px; grid-template-rows: 64px 1fr 28px; height: 100vh; background: #0d1117; color: #e6edf3; }

header {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 24px;
  padding: 0 20px; background: #161b22; border-bottom: 1px solid #30363d;
}
header h1 { font-size: 20px; margin: 0; }
.legend { display: flex; align-items: center; gap: 16px; font-size: 14px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend .dot { display: inline-block; width: 14px; height: 14px; border-radius: 3px; border: 1px solid #30363d; flex-shrink: 0; }
.dot.safe      { background: transparent; }
.dot.attention { background: #f9d56e; }
.dot.uav       { background: #f5c518; }
.dot.usv       { background: #38bdf8; }
.dot.missile   { background: #e5484d; }
#status { margin-left: auto; font-size: 13px; opacity: 0.75; }

#map { background: #0d1117; }
.maplibregl-map { background: #0d1117; font: inherit; }
.maplibregl-popup { max-width: 240px; }
.maplibregl-popup-content {
  background: #161b22;
  color: #e6edf3;
  border: 1px solid #30363d;
  border-radius: 4px;
  padding: 6px 8px;
  font-size: 12px;
  line-height: 1.35;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}
.maplibregl-popup-tip { display: none; }
.maplibregl-ctrl-attrib { background: rgba(22, 27, 34, 0.7); }
.maplibregl-ctrl-attrib, .maplibregl-ctrl-attrib a { color: #8a99a8; }

#panel { background: #161b22; border-left: 1px solid #30363d; padding: 16px; overflow-y: auto; }
#panel h2 { font-size: 15px; margin: 0 0 12px; opacity: 0.8; text-transform: uppercase; letter-spacing: 0.5px; }
#alerts { list-style: none; padding: 0; margin: 0; }
#alerts li { margin-bottom: 8px; border-radius: 6px; border-left: 3px solid #30363d; background: #0d1117; font-size: 13px; line-height: 1.4; overflow: hidden; transition: background 0.15s, transform 0.1s; }
#alerts li.attention { border-left-color: #f9d56e; }
#alerts li.uav       { border-left-color: #f5c518; }
#alerts li.usv       { border-left-color: #38bdf8; }
#alerts li.missile   { border-left-color: #e5484d; }
#alerts li:hover           { background: #1a2230; }
#alerts li.attention:hover { background: #25220f; }
#alerts li.uav:hover       { background: #2a2410; }
#alerts li.usv:hover       { background: #102030; }
#alerts li.missile:hover   { background: #2a1416; }
#alerts li:active           { transform: scale(0.99); }
#alerts li > .tile,
#alerts li > .region { display: block; padding: 10px 12px; }
#alerts a.tile { color: inherit; text-decoration: none; }
#alerts li .region { font-weight: 600; margin-bottom: 2px; padding: 0; }
#alerts li > .tile > .region { padding: 0; margin-bottom: 2px; }
#alerts li .text   { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; opacity: 0.8; }
#alerts li .time   { display: block; font-size: 11px; opacity: 0.55; margin-top: 4px; }
#alerts li .region, #alerts li .text { display: block; }
#alerts .empty { opacity: 0.55; font-style: italic; padding: 10px 12px; }

#footer {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 6px;
  padding: 0 16px;
  background: #161b22; border-top: 1px solid #30363d;
  font-size: 11px; color: #8a99a8;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#footer a { color: #c9d1d9; text-decoration: none; }
#footer a:hover { text-decoration: underline; }

@media (max-width: 720px) {
  body { grid-template-columns: 1fr; grid-template-rows: 64px 1fr 220px 28px; }
  #panel { border-left: none; border-top: 1px solid #30363d; }
}
