:root { font-family: Inter, "Segoe UI", sans-serif; color: #20332e; background: #f7f9f8; font-synthesis: none; letter-spacing: 0; }
* { box-sizing: border-box; }
body { margin: 0; }
header { height: 76px; padding: 0 28px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #dce4df; background: #fff; gap: 16px; }
.identity { display: flex; align-items: center; gap: 12px; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; background: #143c32; color: #fff; font-size: 25px; font-weight: 600; border-radius: 4px; }
.identity strong { display: block; font-size: 14px; }
.identity div > span { display: block; font-size: 10px; margin-top: 4px; color: #718179; }
.connection { font-size: 12px; display: flex; align-items: center; gap: 8px; }
#connection-dot { width: 8px; height: 8px; border-radius: 50%; background: #99a49e; }
#connection-dot.live { background: #229965; }
#connection-dot.error { background: #cf7537; }
main { display: grid; grid-template-columns: 360px minmax(0,1fr); height: calc(100dvh - 76px); min-height: 580px; }
aside { background: #fff; padding: 26px 24px 16px; border-right: 1px solid #dce4df; overflow: auto; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
h1 { font-size: 19px; margin: 0; font-weight: 600; }
h2 { font-size: 15px; margin: 0; font-weight: 600; }
.interval { font: 12px ui-monospace, monospace; color: #64766c; }
form { margin-top: 25px; }
label { font-size: 12px; }
.access-row { display: flex; gap: 8px; margin-top: 7px; }
input[type=password] { width: 0; flex: 1; min-width: 0; border: 1px solid #bac9c0; border-radius: 4px; padding: 9px; font-size: 14px; }
button { background: #143c32; color: white; border: 1px solid transparent; border-radius: 4px; padding: 9px 13px; cursor: pointer; font-family: inherit; font-size: 12px; font-weight: 500; }
button:hover { background: #285846; }
button:disabled { opacity: .45; cursor: default; }
button:focus-visible,input:focus-visible { outline: 3px solid #75aad1; outline-offset: 2px; }
#message { font-size: 12px; line-height: 1.5; min-height: 18px; color: #707e76; overflow-wrap: anywhere; }
#session { display: flex; align-items: center; justify-content: space-between; margin-top: 20px; font-size: 12px; }
[hidden] { display: none !important; }
.text-button { background: none; padding: 5px 0; color: #365d4f; }
.text-button:hover { background: none; color: #10291f; text-decoration: underline; }
.device { border-top: 1px solid #e6ebe8; padding: 24px 0; }
.eyebrow { font-size: 10px; color: #74857a; margin-bottom: 8px; }
.device h2 { font-size: 24px; max-width: 100%; overflow-wrap: anywhere; }
.status { display: inline-block; color: #8b5c24; background: #fff2d9; padding: 4px 7px; margin-top: 10px; font-size: 11px; border-radius: 3px; }
.status.live { color: #246742; background: #e5f3e9; }
.device-statuses { display: grid; gap: 8px; margin-top: 16px; font-size: 12px; }
.device-statuses > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.device-statuses .status { margin-top: 0; }
.metrics { margin: 0; display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid #e6ebe8; }
.metrics > div { min-width: 0; padding: 17px 0; border-bottom: 1px solid #e6ebe8; }
dt { color: #7c8982; font-size: 11px; margin-bottom: 7px; }
dd { margin: 0; font: 15px ui-monospace, "Cascadia Mono", monospace; overflow-wrap: anywhere; }
#point-count { font-size: 11px; color: #738379; }
.empty { color: #8b968f; padding: 24px 0; }
footer { color: #8b968f; font-size: 10px; margin-top: 25px; } footer span { padding: 0 9px; color: #c1cac4; }
.map-area { position: relative; min-width: 0; min-height: 350px; background: #e5ebe6; }
#map { width: 100%; height: 100%; z-index: 0; }
.map-toolbar { position: absolute; z-index: 500; top: 20px; left: 20px; right: 20px; display: flex; align-items: center; gap: 14px; padding: 10px 14px; background: #ffffffed; border: 1px solid #dfe5e1; border-radius: 4px; }
.map-toolbar button { background: white; color: #244e3c; border-color: #d5ded7; white-space: nowrap; }
.map-toolbar label { display: flex; gap: 5px; align-items: center; white-space: nowrap; }
input[type=checkbox] { accent-color: #1a6248; }
.leaflet-top.leaflet-left { top: 83px; left: 10px; }
.leaflet-container { font-family: inherit; }
button.secondary { background: #fff; color: #244e3c; border-color: #cfdad3; }
button.secondary:hover { background: #eef4f0; }
select { font: inherit; font-size: 12px; color: #20332e; background: #fff; border: 1px solid #cfdad3; border-radius: 4px; padding: 7px 6px; }
.status.alert { color: #fff; background: #c2412d; }
#point-count { font-size: 11px; color: #738379; }

.panel { border-top: 1px solid #e6ebe8; padding: 22px 0 6px; margin-top: 22px; }
.panel .section-head { margin-bottom: 12px; }
.panel .status { margin-top: 0; }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.hint { font-size: 11px; color: #74857a; line-height: 1.5; margin: 10px 0 0; }
.fence-clock { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 2px 12px; padding: 12px 14px; border-radius: 4px; background: #fbe9e5; color: #8c2717; }
.fence-clock span { font-size: 12px; }
.fence-clock strong { font: 600 22px ui-monospace, "Cascadia Mono", monospace; grid-row: span 2; }
.fence-clock small { font-size: 11px; color: #a3503f; }
.fence-total { display: flex; justify-content: space-between; align-items: baseline; margin: 12px 0 0; }
.fence-total dt { margin: 0; }
.log { list-style: none; margin: 12px 0 0; padding: 0; max-height: 160px; overflow: auto; }
.log li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-top: 1px solid #edf0ee; font: 11px ui-monospace, monospace; }
.log li strong { color: #a0321f; font-weight: 600; white-space: nowrap; }
.config-grid { display: grid; grid-template-columns: 1fr 110px; align-items: center; gap: 8px 12px; margin: 0; }
.config-grid button { grid-column: 1 / -1; justify-self: start; margin-top: 4px; }

.activity { list-style: none; margin: 0; padding: 0; max-height: 280px; overflow: auto; }
.activity .empty { font-size: 12px; padding: 16px 0; }
.entry { width: 100%; display: grid; grid-template-columns: 14px 1fr; gap: 2px 10px; align-items: center; text-align: left; background: none; color: inherit; border: 0; border-top: 1px solid #edf0ee; border-radius: 0; padding: 9px 2px; }
.entry:hover { background: #f3f7f4; }
.entry strong { font-size: 12px; font-weight: 600; }
.entry span { grid-column: 2; font: 11px ui-monospace, monospace; color: #6d7d74; }
.mark { width: 8px; height: 8px; border-radius: 50%; background: #1d6b4f; justify-self: center; }
.entry.idle .mark { width: 12px; height: 12px; background: #fff4dc; border: 2.5px solid #b8761a; box-sizing: border-box; }
.mark.out, .entry.idle .mark.out { background: #c2412d; border-color: #c2412d; }

.map-toolbar { flex-wrap: wrap; row-gap: 8px; }
.map-toolbar label { font-size: 12px; }
.map-toolbar select { padding: 6px 4px; }
.spacer { flex: 1; }
.toggle { background: #fff; color: #244e3c; border-color: #d5ded7; padding-left: 28px; position: relative; }
.toggle::before { content: ""; position: absolute; left: 10px; top: 50%; width: 11px; height: 11px; margin-top: -6.5px; border: 1.5px solid #7d9187; border-radius: 3px; }
.toggle[aria-pressed=true] { background: #143c32; color: #fff; border-color: #143c32; }
.toggle[aria-pressed=true]::before { background: #7fd1a8; border-color: #7fd1a8; }
.toggle[aria-pressed=true]:hover { background: #285846; }
.draw-bar { position: absolute; z-index: 600; left: 50%; bottom: 84px; transform: translateX(-50%); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: center; padding: 10px 12px; background: #fff; border: 1px solid #b9cde2; border-radius: 4px; box-shadow: 0 4px 16px #0f2a3a26; width: max-content; max-width: calc(100% - 40px); }
.draw-bar span { font-size: 12px; color: #1f4b73; margin-right: 6px; }
#map.drawing { cursor: crosshair; }
#map.drawing .leaflet-interactive { cursor: crosshair; }
.outside-alert { position: absolute; z-index: 550; right: 20px; top: 84px; padding: 9px 14px; background: #c2412d; color: #fff; border-radius: 4px; font-size: 11px; letter-spacing: .04em; box-shadow: 0 4px 14px #7a1d0f40; }
.outside-alert strong { font: 600 15px ui-monospace, monospace; margin-left: 8px; letter-spacing: 0; }
.map-caption { position: absolute; z-index: 500; bottom: 28px; left: 20px; display: grid; gap: 6px; background: #fff; padding: 10px 14px; border-radius: 4px; border: 1px solid #dfe5e1; font-size: 12px; max-width: calc(100% - 40px); }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 11px; color: #5d6f65; }
.legend i { display: inline-block; margin-right: -7px; vertical-align: middle; }
.legend .dot { width: 8px; height: 8px; border-radius: 50%; background: #1d6b4f; }
.legend .idle { width: 12px; height: 12px; border-radius: 50%; background: #fff4dc; border: 2.5px solid #b8761a; box-sizing: border-box; }
.legend .out { width: 8px; height: 8px; border-radius: 50%; background: #c2412d; }
.legend .gap { width: 18px; border-top: 2px dashed #8a968f; }

.lamb-marker { background: none; border: 0; }
.lamb-marker svg { position: relative; display: block; filter: drop-shadow(0 3px 4px #0b201a55); overflow: visible; }
.lamb-marker .pin { fill: #143c32; }
.lamb-marker.outside .pin { fill: #c2412d; }
.lamb-marker.stale svg { filter: grayscale(.85) drop-shadow(0 3px 4px #0b201a40); opacity: .85; }
.lamb-marker .pulse { position: absolute; left: 3px; top: 1px; width: 46px; height: 46px; border-radius: 50%; }
.lamb-marker.live .pulse { animation: pulse 2.4s ease-out infinite; background: #229965; }
.lamb-marker.outside .pulse { animation: pulse 1.2s ease-out infinite; background: #c2412d; }
@keyframes pulse { 0% { transform: scale(.9); opacity: .5; } 100% { transform: scale(1.9); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .lamb-marker .pulse { animation: none !important; } }

.track-tip { padding: 8px 10px; border-radius: 4px; border-color: #d5ded7; box-shadow: 0 4px 14px #0b201a26; font-size: 12px; color: #20332e; }
.tip-head { font-weight: 600; margin-bottom: 4px; }
.tip-row { display: flex; gap: 8px; align-items: baseline; white-space: nowrap; padding: 2px 0; }
.tip-row b { font-weight: 600; min-width: 46px; color: #1d6b4f; }
.tip-row b.idle { color: #9a6112; }
.tip-row b.gap { color: #6f7c75; }
.tip-row span { font-family: ui-monospace, monospace; font-size: 11px; }
.tip-row em { font-style: normal; font-size: 11px; color: #6d7d74; }
.tip-row em.out { color: #c2412d; }
.tip-more { font-size: 11px; color: #6d7d74; margin-top: 2px; }

@media(max-width: 760px) {
  header { padding: 0 16px; height: 66px; }
  main { height: auto; min-height: 0; grid-template-columns: 1fr; }
  .map-area { grid-row: 1; height: 60dvh; min-height: 380px; }
  aside { padding: 22px 20px; border-right: 0; }
  .map-toolbar { top: 10px; left: 10px; right: 10px; padding: 8px; gap: 8px; }
  .spacer { display: none; }
  .leaflet-top.leaflet-left { top: 112px; left: 2px; }
  .outside-alert { top: 112px; right: 10px; }
  .map-caption { left: 10px; bottom: 22px; max-width: calc(100% - 20px); }
  .draw-bar { bottom: auto; top: 112px; max-width: calc(100% - 20px); }
  .connection { font-size: 11px; }
}
