:root {
  color-scheme: dark;
  --bg: #071018;
  --panel: rgba(13, 25, 38, 0.84);
  --panel-strong: rgba(17, 31, 47, 0.96);
  --line: rgba(166, 194, 224, 0.16);
  --text: #eef7ff;
  --muted: #9bb1c5;
  --cyan: #39d5ff;
  --blue: #4f7cff;
  --violet: #a06cff;
  --green: #3be0a2;
  --amber: #ffbd59;
  --coral: #ff6f7d;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 28% 0%, rgba(57, 213, 255, 0.12), transparent 32%),
    linear-gradient(135deg, #071018 0%, #0a1520 47%, #111526 100%);
  color: var(--text);
}

body.light {
  color-scheme: light;
  --bg: #f5f8fc;
  --panel: rgba(255, 255, 255, 0.82);
  --panel-strong: rgba(255, 255, 255, 0.96);
  --line: rgba(15, 35, 55, 0.14);
  --text: #071018;
  --muted: #5a6e82;
  --shadow: 0 22px 56px rgba(37, 57, 79, 0.16);
  background: linear-gradient(135deg, #f5f8fc, #eaf4ff 52%, #f8f6ff);
}

button, input, select { font: inherit; }
button { cursor: pointer; }

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px;
  border-right: 1px solid var(--line);
  background: rgba(5, 14, 23, 0.72);
  backdrop-filter: blur(20px);
}

body.light .sidebar { background: rgba(255, 255, 255, 0.7); }

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  color: inherit;
  text-decoration: none;
  margin-bottom: 34px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  color: #05101b;
  font-weight: 900;
}

.brand strong, .brand small { display: block; }
.brand small, .eyebrow, small, label, .chart-caption { color: var(--muted); }
.brand .creator { color: var(--cyan); }

nav {
  display: grid;
  gap: 8px;
}

nav a {
  padding: 12px 14px;
  border-radius: 10px;
  color: var(--muted);
  text-decoration: none;
}

nav a.active, nav a:hover {
  color: var(--text);
  background: rgba(79, 124, 255, 0.15);
}

.plan-panel, .search-panel, .results, .radar-card, .mini-card, .map-section, .alert-builder, .admin-card, .kpi-grid article {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.plan-panel {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 24px;
  padding: 16px;
  border-radius: 14px;
}

.meter {
  height: 8px;
  margin: 14px 0 8px;
  border-radius: 999px;
  background: rgba(155, 177, 197, 0.22);
  overflow: hidden;
}

.meter i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--cyan), var(--violet));
}

main {
  padding: 28px;
  max-width: 1520px;
  width: 100%;
  margin: 0 auto;
}

.topbar, .section-heading, .map-section, .result-top, .result-meta, .top-actions, .segmented, .urgency, .alert-row, .admin-card li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar {
  margin-bottom: 22px;
}

h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 760px; margin-bottom: 0; font-size: clamp(2rem, 4vw, 4.5rem); line-height: 0.95; letter-spacing: 0; }
h2 { margin-bottom: 8px; font-size: clamp(1.35rem, 2vw, 2rem); letter-spacing: 0; }
h3 { margin-bottom: 8px; }
p { color: var(--muted); line-height: 1.65; }

.eyebrow {
  display: inline-flex;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  font-weight: 800;
}

.top-actions { flex-wrap: wrap; }

.primary-button, .ghost-button, .icon-button, .segmented button {
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  min-height: 42px;
}

.primary-button {
  border: 0;
  padding: 0 18px;
  background: linear-gradient(135deg, var(--cyan), var(--blue), var(--violet));
  color: white;
  font-weight: 800;
}

.ghost-button, .icon-button, .segmented button {
  background: rgba(255, 255, 255, 0.04);
  padding: 0 14px;
}

.icon-button { width: 42px; padding: 0; }
.wide { width: 100%; }

.search-panel {
  padding: 18px;
  border-radius: 16px;
  margin-bottom: 18px;
}

form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

label {
  display: grid;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 700;
}

input, select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 12px;
  background: rgba(7, 16, 24, 0.66);
  color: var(--text);
}

body.light input, body.light select { background: rgba(255, 255, 255, 0.82); }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.kpi-grid article {
  padding: 18px;
  border-radius: 14px;
}

.kpi-grid span, .kpi-grid small { display: block; }
.kpi-grid strong { display: block; margin: 8px 0; font-size: 1.7rem; }

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 18px;
}

.results, .radar-card, .mini-card, .map-section, .alert-builder, .admin-card {
  border-radius: 16px;
  padding: 20px;
}

.segmented {
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
}

.segmented button {
  min-height: 34px;
  border: 0;
  border-radius: 8px;
}

.segmented button.active { background: rgba(57, 213, 255, 0.18); }

.result-list {
  display: grid;
  gap: 12px;
}

.result-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-strong);
  transition: transform 180ms ease, border-color 180ms ease;
}

.result-card:hover {
  transform: translateY(-2px);
  border-color: rgba(57, 213, 255, 0.42);
}

.route {
  display: flex;
  gap: 10px;
  align-items: center;
  font-weight: 900;
  font-size: 1.2rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: rgba(59, 224, 162, 0.14);
  color: var(--green);
  font-weight: 800;
  font-size: 0.78rem;
}

.result-meta {
  margin-top: 16px;
  flex-wrap: wrap;
  color: var(--muted);
}

.metric strong {
  display: block;
  color: var(--text);
  font-size: 1.1rem;
}

.radar-column {
  display: grid;
  gap: 14px;
  align-content: start;
}

.hot {
  background:
    linear-gradient(145deg, rgba(255, 111, 125, 0.24), rgba(57, 213, 255, 0.11)),
    var(--panel);
}

.urgency {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.urgency strong { color: var(--coral); }

.chart {
  display: flex;
  align-items: end;
  gap: 10px;
  height: 140px;
}

.chart i {
  flex: 1;
  min-width: 18px;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(180deg, var(--cyan), var(--violet));
}

.map-section {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
}

.world-map {
  position: relative;
  min-height: 270px;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background:
    linear-gradient(90deg, transparent 31px, rgba(155, 177, 197, 0.08) 32px),
    linear-gradient(transparent 31px, rgba(155, 177, 197, 0.08) 32px);
  background-size: 64px 64px;
}

.world-map svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.world-map path {
  fill: none;
  stroke: var(--cyan);
  stroke-width: 3;
  stroke-dasharray: 8 10;
  animation: dash 4s linear infinite;
}

@keyframes dash {
  to { stroke-dashoffset: -120; }
}

.pin {
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 46px;
  height: 34px;
  border-radius: 999px;
  background: #071018;
  border: 1px solid var(--cyan);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 900;
}

.gru { left: 29%; top: 61%; }
.mia { left: 50%; top: 58%; }
.mad { left: 62%; top: 39%; }
.hnd { left: 85%; top: 43%; }

.bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 18px;
}

.alert-row, .admin-card li {
  border-top: 1px solid var(--line);
  padding: 14px 0;
}

.admin-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: 360px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-strong);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.creator-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
  padding: 18px 0 6px;
  color: var(--muted);
}

.creator-line strong {
  color: var(--text);
}

@media (max-width: 1180px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    display: grid;
    grid-template-columns: 1fr;
  }
  .plan-panel { position: static; margin-top: 18px; }
  form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-grid, .content-grid, .map-section, .bottom-grid { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  main { padding: 18px; }
  .topbar, .section-heading, .result-top, .map-section { align-items: flex-start; flex-direction: column; }
  .creator-line { align-items: flex-start; flex-direction: column; }
  form, .kpi-grid { grid-template-columns: 1fr; }
  h1 { font-size: 2.35rem; }
  .sidebar { padding: 18px; }
  nav { grid-template-columns: repeat(2, 1fr); }
}
