:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #17231d;
  background: #eef2ed;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 30px max(24px, calc((100vw - 1300px) / 2));
  color: white; background: #173f32;
}
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(1.5rem, 3vw, 2.6rem); letter-spacing: -0.04em; }
h2 { margin-bottom: 8px; letter-spacing: -0.025em; }
.eyebrow { display: block; margin-bottom: 7px; color: #91d6b5; font-size: .7rem; font-weight: 800; letter-spacing: .18em; }
main { max-width: 1300px; margin: 0 auto; padding: 28px 24px 60px; }
.card { border: 1px solid #dce4dd; border-radius: 18px; background: white; box-shadow: 0 14px 35px rgba(24, 58, 45, .06); }
.narrow { max-width: 440px; margin: 60px auto; padding: 28px; }
label { display: grid; gap: 7px; margin-bottom: 15px; color: #48564f; font-size: .86rem; font-weight: 700; }
input, select, textarea {
  width: 100%; border: 1px solid #cbd5ce; border-radius: 10px; padding: 11px 12px;
  color: #17231d; background: white; font: inherit;
}
input:focus, select:focus, textarea:focus { outline: 3px solid #bde9d3; border-color: #287a57; }
button, .button {
  display: inline-flex; justify-content: center; align-items: center; border: 0; border-radius: 10px;
  padding: 11px 16px; color: white; background: #287a57; font: inherit; font-weight: 800;
  text-decoration: none; cursor: pointer;
}
button:hover, .button:hover { background: #1f6748; }
.secondary { color: #244a39; background: #e4eee8; }
.secondary:hover { background: #d4e5da; }
.ghost { color: #526059; background: transparent; font-size: 1.5rem; }
.muted { color: #68756e; }
.hidden { display: none !important; }
.toolbar { display: flex; justify-content: space-between; gap: 16px; align-items: end; padding: 18px; }
.toolbar label { margin: 0; min-width: 260px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 14px 0; }
.stats article { padding: 20px; }
.stats span { display: block; color: #718077; font-weight: 700; }
.stats strong { display: block; margin-top: 5px; font-size: 2rem; }
.map-card { margin-bottom: 14px; padding: 22px; }
#map { height: 420px; margin-top: 14px; border-radius: 13px; background: #e6ece8; }
.grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(320px, .75fr); gap: 14px; }
.grid > article { padding: 22px; min-width: 0; }
.section-title { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 10px; border-bottom: 1px solid #e8ece9; text-align: left; white-space: nowrap; }
th { color: #6b786f; font-size: .76rem; text-transform: uppercase; letter-spacing: .08em; }
.event-list { display: grid; gap: 10px; }
.event-filters { display: grid; grid-template-columns: 1fr 170px; gap: 8px; margin: 12px 0; }
.event-filters input, .event-filters select { margin: 0; }
.event { padding: 13px; border: 1px solid #e3e9e5; border-radius: 12px; }
.event strong, .event span { display: block; }
.event span { margin-top: 4px; color: #66736c; font-size: .85rem; }
.device-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 0; border-bottom: 1px solid #e3e9e5; }
.device-row:last-child { border-bottom: 0; }
.device-row strong, .device-row span { display: block; }
.device-row span { margin-top: 3px; color: #66736c; font-size: .82rem; }
.badge { display: inline-block !important; width: fit-content; margin-top: 7px; border-radius: 99px; padding: 4px 8px; font-size: .72rem !important; font-weight: 800; }
.confirmed { color: #15613e !important; background: #d9f5e6; }
.review { color: #8b4b0f !important; background: #fff0d5; }
dialog { width: min(560px, calc(100vw - 32px)); border: 0; border-radius: 18px; padding: 24px; box-shadow: 0 35px 80px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(15, 32, 24, .65); backdrop-filter: blur(3px); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.notice { border-radius: 10px; padding: 12px; background: #e8f4ed; }
.toast { position: fixed; right: 20px; bottom: 20px; max-width: 380px; border-radius: 12px; padding: 14px 18px; color: white; background: #173f32; box-shadow: 0 12px 30px rgba(0,0,0,.2); }

@media (max-width: 850px) {
  header, .toolbar { align-items: stretch; flex-direction: column; }
  .grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr 1fr; }
  .toolbar label { min-width: 0; }
}

@media (max-width: 520px) {
  .stats { grid-template-columns: 1fr; }
  .actions > * { flex: 1; }
  .event-filters { grid-template-columns: 1fr; }
}
