:root {
  color-scheme: light;
  --ink: #17231e;
  --muted: #78827b;
  --line: #e8ebe6;
  --paper: #fff;
  --canvas: #f5f6f2;
  --green: #245d45;
  --green-2: #39775b;
  --lime: #d7ed75;
  --shadow: 0 8px 26px rgba(27, 44, 34, .045);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--canvas); color: var(--ink); }
button, select, input { font: inherit; }
button { cursor: pointer; }
.app { display: flex; min-height: 100vh; }

.sidebar { width: 244px; flex: 0 0 244px; display: flex; flex-direction: column; padding: 27px 17px 19px; background: #fff; border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 10px 34px; color: var(--ink); text-decoration: none; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 11px; color: #fff; background: var(--green); }
.brand-name { font-size: 17px; font-weight: 750; letter-spacing: -.7px; }
.brand-name span { color: #90a191; font-weight: 500; }
.nav-label, .eyebrow { margin: 0; color: #98a198; font-size: 9px; font-weight: 750; letter-spacing: 1.05px; }
.nav-label { padding: 0 11px 9px; }
.nav-list { display: grid; gap: 5px; }
.nav-item { display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 0 12px; border-radius: 9px; color: #717b74; font-size: 11px; font-weight: 600; text-decoration: none; }
.nav-item:hover { background: #f7f8f6; color: var(--ink); }
.nav-item.active { color: var(--green); background: #eef4ef; font-weight: 700; }
.nav-icon { width: 18px; color: currentColor; text-align: center; font-size: 16px; }
.sidebar-note { display: flex; gap: 10px; margin: auto 2px 18px; padding: 13px 11px; border: 1px solid var(--line); border-radius: 10px; }
.note-icon { width: 16px; height: 16px; flex: 0 0 16px; display: grid; place-items: center; border-radius: 50%; background: #f0f3ed; color: #6a7968; font: 700 10px Georgia, serif; }
.sidebar-note p { margin: 0; color: #78827b; font-size: 9px; line-height: 1.6; }
.sidebar-footer { display: flex; align-items: center; gap: 10px; padding: 14px 6px 0; border-top: 1px solid var(--line); }
.avatar { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 50%; background: #f0dfc8; color: #815d3c; font-size: 9px; font-weight: 800; }
.sidebar-footer b, .sidebar-footer small { display: block; }
.sidebar-footer b { font-size: 10px; }
.sidebar-footer small { margin-top: 3px; color: var(--muted); font-size: 8px; }

.main { width: min(100% - 244px, 1510px); margin: 0 auto; padding: 24px 34px 32px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 30px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.breadcrumb { color: #89938b; font-size: 10px; }
.breadcrumb span { padding: 0 7px; color: #bdc3bd; }
.breadcrumb b { color: #35423a; font-weight: 650; }
.connection { display: flex; align-items: center; gap: 8px; padding: 8px 11px; border: 1px solid #e3e9e2; border-radius: 20px; background: #fff; color: #67736a; font-size: 9px; font-weight: 650; }
.connection-dot, .live-badge i { width: 7px; height: 7px; display: inline-block; border-radius: 50%; background: #d3a454; box-shadow: 0 0 0 3px #f7f0e2; }
.connection.connected .connection-dot { background: #63a775; box-shadow: 0 0 0 3px #e8f3e9; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 20px; }
h1 { margin: 9px 0 0; font-size: clamp(24px, 2.8vw, 32px); letter-spacing: -1.2px; line-height: 1.15; }
.subtitle { margin: 8px 0 0; color: var(--muted); font-size: 11px; }
.location-control { min-width: 195px; }
.location-control label { display: block; margin: 0 0 6px 2px; color: #929a93; font-size: 8px; font-weight: 750; letter-spacing: .8px; }
.location-control select, .event-filter select { padding: 0 29px 0 11px; appearance: auto; border: 1px solid #e1e6e0; border-radius: 8px; background: #fff; color: #37443a; font-size: 10px; font-weight: 650; }
.location-control select { width: 100%; height: 36px; }
.card { border: 1px solid #eaede8; border-radius: 12px; background: var(--paper); box-shadow: var(--shadow); }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.metric-card { min-height: 110px; padding: 14px 16px; }
.metric-top { display: flex; justify-content: space-between; align-items: center; color: #727d75; font-size: 10px; font-weight: 600; }
.metric-icon { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 8px; color: #315d43; background: #f0f5f0; font-size: 12px; font-weight: 750; }
.metric-icon.lime { color: #677642; background: #f3f6e5; }
.metric-icon.yellow { color: #927d48; background: #f7f3e9; }
.metric-icon.lilac { color: #78678c; background: #f3eff7; font-size: 9px; }
.metric-value { margin-top: 11px; font-size: 24px; font-weight: 760; letter-spacing: -.8px; line-height: 1; }
.metric-value.small { font-size: 18px; }
.metric-foot { display: flex; gap: 5px; margin-top: 7px; color: #9aa29b; font-size: 9px; }

.content-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(310px, .9fr); gap: 14px; margin-bottom: 14px; align-items: stretch; }
.section-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 16px 17px 0; }
.section-header h2 { margin: 5px 0 0; font-size: 13px; font-weight: 750; letter-spacing: -.15px; }
.section-subtitle { margin: 5px 0 0; color: #89938b; font-size: 9px; line-height: 1.55; }
.section-header.compact { align-items: center; }
.method-body { display: grid; gap: 0; padding: 14px 17px 17px; }
.method-body p { margin: 0; padding: 11px 0; border-top: 1px solid #f0f2ef; color: #78827b; font-size: 10px; line-height: 1.65; }
.method-body b { color: #435147; }
.manual-tag { display: flex; align-items: center; gap: 6px; padding: 5px 7px; border: 1px solid #eceee8; border-radius: 20px; color: #7c867c; font-size: 8px; white-space: nowrap; }
.manual-tag i { width: 6px; height: 6px; border-radius: 50%; background: #9ca89c; }
.report-form { padding: 15px 17px 14px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 9px; }
.field { display: grid; gap: 7px; color: #536057; font-size: 9px; font-weight: 650; }
.field > span { display: flex; align-items: center; gap: 5px; }
.field > span b { color: #cc6657; }
.field > span small { color: #98a098; font-size: 8px; font-weight: 500; }
.input-wrap { min-width: 0; height: 37px; display: flex; align-items: center; gap: 5px; padding: 0 8px; border: 1px solid #e3e8e1; border-radius: 7px; background: #fff; }
.input-wrap:focus-within { border-color: #7ca28a; box-shadow: 0 0 0 2px rgba(89, 143, 106, .1); }
.input-wrap input { width: 100%; min-width: 30px; height: 100%; padding: 0; border: 0; outline: 0; background: transparent; color: #25342a; font-size: 12px; font-weight: 650; }
.input-wrap input::placeholder { color: #c1c8c0; font-size: 10px; font-weight: 500; }
.input-wrap input::-webkit-inner-spin-button { appearance: none; }
.input-wrap small { flex: 0 0 auto; color: #a1a9a2; font-size: 8px; }
.currency { color: #869187; font-size: 9px; }
.form-bottom { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 12px; }
.form-bottom p { margin: 0; color: #929b93; font-size: 8px; }
.primary-button { display: inline-flex; align-items: center; gap: 7px; min-height: 34px; padding: 0 12px; border: 0; border-radius: 7px; color: #fff; background: var(--green); font-size: 9px; font-weight: 700; }
.primary-button:hover { background: #1b4d38; }
.primary-button:disabled { cursor: wait; opacity: .7; }
.primary-button span { font-size: 15px; font-weight: 400; }
.form-message { margin-top: 0; color: #47704f; font-size: 9px; }
.form-message:not(:empty) { margin-top: 10px; }
.form-message.error { color: #b64f45; }

.live-card { padding-bottom: 0; }
.live-badge { display: inline-flex; align-items: center; gap: 7px; padding: 6px 8px; border-radius: 20px; background: #f5f6f3; color: #7f887f; font-size: 8px; font-weight: 700; white-space: nowrap; }
.live-badge.live { background: #edf5ee; color: #47704f; }
.live-badge.live i { background: #63a775; box-shadow: 0 0 0 3px #e1efe4; }
.live-badge.stale { background: #f8f1e7; color: #94723d; }
.reading-state { min-height: 147px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 18px; text-align: center; }
.reading-state[hidden] { display: none; }
.empty-graphic { width: 38px; height: 38px; display: grid; place-items: center; margin-bottom: 9px; border-radius: 12px; background: #f3f5f1; color: #708174; font-size: 21px; }
.reading-state b { font-size: 10px; }
.reading-state p { max-width: 225px; margin: 5px 0 0; color: #939c94; font-size: 9px; line-height: 1.5; }
.reading-details { display: grid; gap: 10px; padding: 17px 18px; }
.reading-details[hidden] { display: none; }
.reading-details div { display: flex; justify-content: space-between; gap: 10px; }
.reading-details span { color: #8c958d; font-size: 9px; }
.reading-details b { max-width: 60%; overflow: hidden; color: #435147; font-size: 9px; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.card-foot { padding: 10px 16px; border-top: 1px solid #eff1ee; color: #919a91; font-size: 8px; }

.lower-grid { grid-template-columns: minmax(0, 1.15fr) minmax(310px, .9fr); }
.secondary-button, .refresh-button { border: 1px solid #e6eae4; border-radius: 7px; background: #fff; color: #627067; font-size: 9px; font-weight: 650; }
.secondary-button { padding: 7px 9px; white-space: nowrap; }
.refresh-button { width: 29px; height: 29px; font-size: 17px; }
.chart-wrap { height: 136px; display: flex; align-items: flex-end; gap: 7px; margin: 21px 17px 0; padding: 5px 5px 0; border-bottom: 1px solid #e8ece6; background: repeating-linear-gradient(to bottom, transparent 0, transparent 32px, #f1f3f0 33px); }
.chart-empty { width: 100%; align-self: center; color: #98a199; font-size: 9px; text-align: center; }
.bar-group { min-width: 6px; height: 100%; display: flex; flex: 1; align-items: flex-end; justify-content: center; position: relative; }
.bar { width: min(22px, 85%); min-width: 4px; border-radius: 4px 4px 0 0; background: linear-gradient(180deg, #88b492, #5d916d); transition: height .2s ease; }
.bar-label { position: absolute; bottom: calc(100% + 4px); display: none; color: #647168; font-size: 8px; white-space: nowrap; }
.bar-group:hover .bar-label { display: block; }
.chart-legend { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 9px 18px 11px; color: #858e86; font-size: 8px; }
.chart-legend i { width: 7px; height: 7px; display: inline-block; margin-right: 5px; border-radius: 2px; background: #72a27c; vertical-align: middle; }
.chart-window { text-align: right; }
.history-list { display: grid; gap: 0; padding: 0 17px; }
.history-item { display: flex; justify-content: space-between; gap: 10px; padding: 9px 2px; border-top: 1px solid #f0f2ef; font-size: 9px; }
.history-item span { color: #7e887f; }
.history-item b { color: #3b4b3f; }
.history-item small { color: #9ca49d; }
.history-item:first-child { border-top: 0; }
.event-filter { display: flex; align-items: center; gap: 8px; padding: 12px 17px 9px; border-bottom: 1px solid #f0f2ef; }
.event-filter label { color: #869087; font-size: 8px; }
.event-filter select { height: 27px; padding-right: 22px; font-size: 9px; }
.event-filter > span { margin-left: auto; color: #929a92; font-size: 8px; white-space: nowrap; }
.event-list { max-height: 260px; overflow-y: auto; padding: 5px 17px; }
.event-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 11px 2px; border-bottom: 1px solid #f0f2ef; }
.event-item:last-child { border-bottom: 0; }
.event-title { color: #354239; font-size: 9px; font-weight: 700; line-height: 1.4; text-decoration: none; }
.event-title:hover { color: var(--green); text-decoration: underline; }
.event-meta { margin-top: 4px; color: #8b948b; font-size: 8px; line-height: 1.5; }
.event-distance { align-self: start; padding: 4px 5px; border-radius: 5px; background: #eef4ee; color: #527258; font-size: 8px; font-weight: 700; white-space: nowrap; }
.event-placeholder { padding: 18px 0; color: #8c968d; font-size: 9px; line-height: 1.55; }
.event-placeholder.error { color: #a95549; }
.event-footer { display: flex; justify-content: space-between; gap: 8px; padding: 10px 17px; border-top: 1px solid #eff1ee; color: #9aa19a; font-size: 8px; }
.event-footer a { color: var(--green); font-weight: 700; text-decoration: none; }
.event-footer a:hover { text-decoration: underline; }
.footer-note { display: flex; justify-content: space-between; gap: 12px; padding: 4px 1px; color: #939c93; font-size: 8px; line-height: 1.55; }
.toast { position: fixed; right: 22px; bottom: 20px; z-index: 5; max-width: min(360px, calc(100vw - 32px)); padding: 11px 14px; transform: translateY(12px); border-radius: 9px; background: #263c30; color: #fff; box-shadow: 0 8px 25px #0002; opacity: 0; pointer-events: none; font-size: 10px; transition: .2s ease; }
.toast.visible { transform: translateY(0); opacity: 1; }
@media (max-width: 1050px) {
  .sidebar { width: 200px; flex-basis: 200px; }
  .main { width: calc(100% - 200px); padding: 22px; }
  .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .content-grid { grid-template-columns: minmax(0, 1.2fr) minmax(250px, .9fr); }
  .lower-grid { grid-template-columns: 1fr; }
}
@media (max-width: 730px) {
  .sidebar { width: 58px; flex-basis: 58px; align-items: center; padding: 19px 7px; }
  .brand { padding: 0 0 28px; }
  .brand-name, .nav-label, .nav-item:not(.active)::after, .nav-item { font-size: 0; }
  .nav-list { width: 100%; }
  .nav-item { justify-content: center; padding: 0; }
  .nav-item .nav-icon { font-size: 17px; }
  .sidebar-note, .sidebar-footer > span:not(.avatar) { display: none; }
  .sidebar-footer { justify-content: center; width: 100%; padding: 13px 0 0; }
  .main { width: calc(100% - 58px); padding: 17px 13px 24px; }
  .content-grid, .lower-grid { grid-template-columns: 1fr; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .location-control { width: 100%; max-width: 320px; }
  .topbar { margin-bottom: 22px; }
  .report-card { order: 0; }
  .live-card { order: 1; }
}
@media (max-width: 470px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .metric-card { min-height: 104px; padding: 11px; }
  .metric-top { font-size: 9px; }
  .metric-value { font-size: 21px; }
  .metric-foot { font-size: 8px; }
  .section-header { padding-right: 12px; padding-left: 12px; }
  .report-form { padding-right: 12px; padding-left: 12px; }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .field:last-child { grid-column: 1 / -1; }
  .form-bottom { align-items: flex-end; }
  .form-bottom p { max-width: 160px; line-height: 1.5; }
  .event-filter, .event-list, .event-footer { padding-right: 12px; padding-left: 12px; }
  .footer-note { flex-direction: column; gap: 4px; }
  .breadcrumb { font-size: 9px; }
  .connection { gap: 6px; padding: 7px 8px; font-size: 8px; }
}
