:root {
  color-scheme: light dark;
  --bg: #0f172a;
  --card: #1e293b;
  --text: #f8fafc;
  --accent: #dc2626;
  --muted: #cbd5e1;
  --ok: #16a34a;
}

* {
  box-sizing: border-box;
  font-family: Inter, Segoe UI, Arial, sans-serif;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

.container {
  max-width: 760px;
  margin: 0 auto;
  padding: 16px;
  width: 100%;
}

.card {
  background: var(--card);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
}

h1,
h2 {
  margin-top: 0;
}

label {
  display: block;
  margin: 8px 0 4px;
}

input,
select,
textarea,
button {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #334155;
  margin-bottom: 8px;
}

.btn-sos {
  min-height: 92px;
  font-size: clamp(1.2rem, 2.6vw, 1.6rem);
  font-weight: 700;
  border: 0;
  background: var(--accent);
  color: white;
  cursor: pointer;
}

.btn-safe {
  border: 0;
  background: var(--ok);
  color: white;
  cursor: pointer;
}

.warning {
  color: #fecaca;
}

.muted {
  color: var(--muted);
  font-size: 0.95rem;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.alert-row {
  border-bottom: 1px solid #334155;
  padding: 8px 0;
}

.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: #334155;
  font-size: 0.85rem;
}

.chat-box {
  max-height: 32vh;
  overflow: auto;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 8px;
  margin-bottom: 8px;
}

.chat-line {
  margin-bottom: 6px;
  padding: 6px 8px;
  border-radius: 8px;
  background: #243244;
}

.chat-line-user {
  background: #1d4ed8;
  color: #eff6ff;
}

.chat-line-dispatcher {
  background: #166534;
  color: #ecfdf5;
}

.chat-line-system {
  background: #334155;
  color: #e2e8f0;
}

.board-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(280px, 1fr));
  gap: 12px;
}

.case-item {
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 8px;
  background: #172336;
}

.case-item h3 {
  margin: 0 0 6px 0;
  font-size: 1rem;
}

.col-new {
  background: #4c1d1d;
  border: 1px solid #7f1d1d;
}

.col-progress {
  background: #4a2a10;
  border: 1px solid #9a3412;
}

.col-resolved {
  background: #113123;
  border: 1px solid #166534;
}

.dispatch-wide {
  max-width: 1500px;
}

.filter-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

@media (max-width: 980px) {
  .board-3 {
    grid-template-columns: 1fr;
  }

  .filter-actions {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .container {
    padding: 12px;
  }

  .card {
    padding: 12px;
    border-radius: 10px;
  }

  h1 {
    font-size: 1.35rem;
  }

  h2 {
    font-size: 1.05rem;
  }

  input,
  select,
  textarea,
  button {
    padding: 12px;
    font-size: 1rem;
  }

  .grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .btn-sos {
    min-height: 82px;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 10px;
  }

  .filter-actions {
    grid-template-columns: 1fr;
  }

  .chat-box {
    max-height: 38vh;
  }
}

@keyframes flashPulse {
  0% { box-shadow: 0 0 0 rgba(250, 204, 21, 0); }
  50% { box-shadow: 0 0 0 4px rgba(250, 204, 21, 0.95); }
  100% { box-shadow: 0 0 0 rgba(250, 204, 21, 0); }
}

.flash-alert {
  animation: flashPulse 0.6s ease-in-out 6;
}

.flash-alert-persistent {
  animation: flashPulse 0.9s ease-in-out infinite;
}
