/* Hoopo tester additions on top of the MVP theme (styles.css) and the GSE mock
   (gse/gse.css): Leaflet integration, tester/admin screens and form controls. */

/* Shell */
.brand-mark .icon { transform: none; }
.login .brand-mark { display: inline-grid; }
.login-alt { margin-top: 14px; }
.identity { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.topbar-right .button.quiet { padding: 7px 12px; font-size: 15px; }
.tab-badge[hidden], .connection[hidden] { display: none; }
.page-heading { gap: 10px 24px; }
.title-line { flex-wrap: wrap; row-gap: 2px; }
.site-select { display: flex; align-items: center; gap: 10px; font-size: 15px; color: var(--text-3); font-weight: 650; }
.site-select select { width: auto; min-width: 240px; font-size: 15px; padding: 7px 12px; }
.page-errors:empty { display: none; }
.error { padding: 12px 14px; border: 1px solid #ff8a8a66; background: #ff8a8a0f; border-radius: var(--radius); color: var(--danger); font-size: 15px; white-space: pre-wrap; }
.note { color: var(--text-3); font-size: 14px; line-height: 1.6; margin-top: 12px; }
.empty { padding: 30px; color: var(--text-3); text-align: center; }
.empty-state .muted { font-size: 15px; }
.section-heading h2 { font-size: 20px; }
.section-heading.compact { margin: 14px 0 6px; }
.section-help { max-width: 90ch; margin-top: 4px; line-height: 1.6; }
.side-subhead { font-size: 15px; color: var(--text-2); font-weight: 650; margin: 18px 0 8px; }
.panel > .side-subhead:first-child, .endpoint-body .side-subhead { margin-top: 0; }
.grid-2.even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.warning-text { color: var(--warn); }
.danger-text { color: var(--danger) !important; }
.mono, .mono-input { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.nowrap { white-space: nowrap; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; padding: 1px 6px; border-radius: 4px; background: var(--surface-3); }
.caveat.compact { margin-top: 10px; padding: 7px 12px; font-size: 14px; }
.caveat .button { margin-left: auto; align-self: center; }
.json { margin: 8px 0; white-space: pre-wrap; overflow-wrap: anywhere; font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--bg); color: var(--text-2); border: 1px solid var(--line); padding: 14px 16px; max-height: 420px; overflow: auto; border-radius: var(--radius-s); }
dialog:not([open]) { display: none; }

/* Buttons */
.button.compact { padding: 5px 10px; font-size: 14px; }
.button.icon-only { padding: 8px; }
.button.icon-only .icon { width: 18px; height: 18px; }
.button[aria-pressed='true'].quiet { background: var(--surface-3); color: var(--text); }
.link-like { border: 0; background: transparent; padding: 0; cursor: pointer; margin-top: 4px; }
div.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
td.row-actions { text-align: right; white-space: nowrap; }
td.row-actions .button + .button { margin-left: 6px; }

/* Leaflet map, styled like the mock's map component */
.map-host { min-width: 0; }
.map-frame.leaflet-frame { height: clamp(420px, 64dvh, 880px); max-height: none; cursor: auto; touch-action: auto; background: #05080c; font: inherit; z-index: 0; }
.route-map.leaflet-frame { height: clamp(380px, 54dvh, 720px); }
.dialog-map .leaflet-frame { height: min(420px, 48dvh); }
.overview-map .leaflet-frame { height: 440px; }
.leaflet-frame[data-layer='photo'] .leaflet-tile-pane { filter: var(--map-dim); }
.leaflet-frame[data-layer='std'] .leaflet-tile-pane, .leaflet-frame[data-layer='pale'] .leaflet-tile-pane { filter: brightness(.86) saturate(.85); }
.leaflet-frame.placing, .leaflet-frame.placing .leaflet-interactive { cursor: crosshair; }
.leaflet-frame .leaflet-control { clear: none; }
.leaflet-control.map-controls { position: static; margin: 10px 10px 0 0; }
.leaflet-control.map-controls button { cursor: pointer; }
.map-controls .map-compass { color: var(--accent); }
.map-compass-needle { display: flex; flex-direction: column; align-items: center; font-size: 9px; font-weight: 700; line-height: 10px; }
.map-compass-needle .icon { width: 16px; height: 16px; }
.map-layer-switch.leaflet-control { margin: 10px 0 0 10px; background: #0b121ae6; border-color: #ffffff26; }
.map-layer-switch .button.tab { font-size: 13px; padding: 4px 11px; }
.leaflet-control-scale.leaflet-control { margin: 0 0 8px 10px; }
.leaflet-control-scale-line { background: transparent; border: 2px solid #e8eef5; border-top: 0; color: #e8eef5; font-size: 12px; line-height: 1.3; text-shadow: 0 1px 2px #000; padding: 0 4px; }
.leaflet-container .leaflet-control-attribution { margin: 0 8px 6px 0; font-size: 11px; color: #d6dee6; background: #000a; padding: 1px 6px; border-radius: 4px; }
.leaflet-container .leaflet-control-attribution a { color: #d6dee6; text-decoration: underline; }
.leaflet-tooltip { background: #0b121a; color: var(--text); border: 1px solid var(--line-strong); box-shadow: var(--shadow); font: 13px/1.4 inherit; }
.leaflet-tooltip::before { display: none; }
.dom-marker { background: none; border: 0; overflow: visible; }
.dom-marker:focus { outline: none; }
.dom-marker:focus-visible .vmark, .dom-marker:focus-visible .stand-pin, .dom-marker:focus-visible .route-stop { outline: 2px solid var(--accent); outline-offset: 3px; }
.dom-marker .vmark, .dom-marker .route-stop { cursor: pointer; }
.dom-marker .vmark.dimmed { cursor: default; }
.dom-marker .stand-pin { pointer-events: auto; cursor: pointer; }
.dom-marker .stand-pin:hover { border-color: #fff; }
.target-pin { position: absolute; width: 20px; height: 20px; transform: translate(-50%, -50%); border-radius: 50%; background: var(--accent); border: 3px solid #fff; box-shadow: 0 0 0 7px #4fb3ff4d, 0 2px 6px #000c; pointer-events: none; }
.leaflet-frame .site-boundary { pointer-events: none; }
/* Geoman toolbar on the dark theme */
.leaflet-pm-toolbar.leaflet-bar { border: 1px solid #ffffff26; border-radius: 8px; }
.leaflet-pm-toolbar .leaflet-buttons-control-button { background: #0b121ae6; border-color: #ffffff1a; }
.leaflet-pm-toolbar .leaflet-buttons-control-button:hover, .leaflet-pm-toolbar .active .leaflet-buttons-control-button { background: var(--surface-3); }
.leaflet-pm-toolbar .control-icon { filter: invert(1) brightness(1.4); }
.leaflet-pm-actions-container .leaflet-pm-action { background: #0b121a; color: var(--text); }

/* Map view additions */
.map-toolbar { min-height: 36px; }
.selected-row td { background: #4fb3ff12; }
.vehicle-table td { padding-top: 8px; padding-bottom: 8px; }
.vehicle-link { display: inline-flex; align-items: center; gap: 10px; border: 0; background: transparent; padding: 0; color: var(--text); font: inherit; font-weight: 650; cursor: pointer; }
.vehicle-link:hover { color: var(--accent); }
.cell-sub { display: block; font-size: 13px; color: var(--text-3); font-weight: 400; margin-top: 2px; }
.small-cell { font-size: 13px; }
.table-empty { text-align: center; color: var(--text-3); padding: 30px 10px !important; }
.mini-events-host { min-height: 24px; }
.side .actions .button { padding: 7px 12px; font-size: 15px; }

/* Route view additions */
.route-controls .date-field, .date-field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--text-3); font-weight: 650; min-width: 0; }
.date-field input { width: auto; padding: 7px 10px; font-size: 15px; }
.date-field.inline { flex-direction: row; align-items: center; gap: 10px; }
.route-head { margin-bottom: 4px; }
.day-track.no-data { background: repeating-linear-gradient(135deg, var(--surface-2) 0 4px, var(--surface) 4px 8px); }
.day-still { position: absolute; top: 12px; bottom: 12px; background: #2f4054; border-radius: 2px; }
.key i.key-moving { background: var(--st-in-use); }
.key i.key-still { background: #2f4054; }
.key i.key-nodata { background: repeating-linear-gradient(135deg, var(--surface-3) 0 3px, var(--surface) 3px 6px); box-shadow: inset 0 0 0 1px var(--line); }

/* Alerts */
.alert-kind.tone-critical strong { color: var(--sev-critical); }
.alert-kind.tone-warning strong { color: var(--sev-warning); }
.alert-kind.tone-info strong { color: var(--sev-info); }
.alert-row .actions { margin-top: 4px; }

/* Reports and verification */
.head-aside { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.report-summary { font-size: 14px; color: var(--text-2); }
.report-table tr.expanded td { border-bottom-color: transparent; }
.detail-row td { padding-top: 0; }
.detail-row:hover td { background: transparent; }
.bar-list { display: flex; flex-direction: column; gap: 10px; }
.bar-item { display: grid; grid-template-columns: minmax(150px, 2fr) minmax(0, 3fr); gap: 4px 14px; align-items: center; font-size: 14px; }
.bar-label { color: var(--text-2); }
.bar-item .util-bar { min-width: 0; }
.bar-item .util-bar span { width: auto; min-width: 3.2em; }

/* Admin: endpoints */
.endpoint-card { display: flex; flex-direction: column; gap: 16px; }
.endpoint-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px 16px; }
.endpoint-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.endpoint-title h3 { font-size: 21px; color: var(--text); }
.mini-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.mini-stat { padding: 10px 14px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mini-stat span { font-size: 13px; color: var(--text-3); font-weight: 650; }
.mini-stat strong { font-size: 20px; font-variant-numeric: tabular-nums; }
.mini-stat em { font-style: normal; font-size: 12px; color: var(--text-3); overflow-wrap: anywhere; }
.endpoint-body { gap: 20px 28px; }
.endpoint-body .muted.small { font-size: 14px; line-height: 1.6; margin-bottom: 10px; }
.endpoint-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.spacer { flex: 1; }
.copy-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.copy-row { display: flex; gap: 6px; align-items: center; }
.copy-row input { flex: 1; min-width: 0; font-size: 14px; padding: 8px 10px; color: var(--text-2); }
.credential-dialog { width: min(640px, calc(100% - 32px)); }
.credential-set { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 14px; }
.credential-set h3 { font-size: 16px; margin-bottom: 10px; }

/* Admin: inbox */
.filter-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; padding: 14px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); }
.filter-bar .form-field { min-width: 180px; flex: 0 1 220px; }
.filter-bar input, .filter-bar select { padding: 7px 10px; font-size: 15px; }
.muted-row td { color: var(--text-3); }
.meta-details { margin-top: 12px; }
.meta-details summary { color: var(--text-2); font-size: 14px; }

/* Forms and dialogs */
.gate-dialog.wide { width: min(1100px, calc(100% - 32px)); }
.gate-dialog .dialog-head h2 { font-size: 22px; }
.gate-dialog .dialog-head .muted { margin-top: 4px; max-width: 70ch; }
.gate-dialog .icon-button .icon { width: 22px; height: 22px; }
.dialog-body { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.form-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.form-label { font-size: 14px; color: var(--text-3); font-weight: 650; }
.form-hint { font-size: 13px; color: var(--text-3); line-height: 1.5; }
.form-field input, .form-field select, .form-field textarea { font-size: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; align-items: end; }
.form-grid > [hidden] { display: none; }
textarea { width: 100%; font: 14px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; background: #0c131b; color: var(--text); border: 1px solid var(--line-strong); border-radius: 8px; padding: 10px 12px; resize: vertical; }
.check-field { display: inline-flex; align-items: center; gap: 9px; font-size: 15px; color: var(--text-2); min-height: 44px; }
input[type='checkbox'] { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.check-group { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px 12px; margin: 0; display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; }
.check-group legend { font-size: 14px; color: var(--text-3); font-weight: 650; padding: 0 6px; }
.check-group label { display: inline-flex; align-items: center; gap: 7px; font-size: 15px; }
.day-checks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.inline-inputs { display: flex; align-items: center; gap: 8px; }
.inline-inputs input, .inline-inputs select { width: 110px; }
.time-input { width: 100px !important; font-variant-numeric: tabular-nums; }
.rule-hint { line-height: 1.6; margin-top: -2px; }
.shape-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; }
.stand-list { display: flex; flex-direction: column; gap: 6px; }
.stand-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 8px; align-items: center; }
.stand-row input { padding: 7px 10px; font-size: 15px; }

@media (max-width: 1250px) {
  .mini-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .grid-2.even, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .site-select select { min-width: 0; }
  .identity { display: none; }
}
@media (max-width: 760px) {
  .mini-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bar-item { grid-template-columns: minmax(0, 1fr); }
  .map-frame.leaflet-frame { height: 62dvh; }
  .head-aside { margin-left: 0; align-items: flex-start; }
  .vehicle-head { flex-wrap: wrap; }
}
@media (max-width: 650px) {
  .topbar-right { gap: 10px; }
  .wall-clock { display: none; }
  .topbar-right .button.quiet span, .topbar-right .button.quiet { font-size: 14px; }
  .site-select { width: 100%; }
  .site-select select { flex: 1; }
}
/* Half-width panels hold narrow tables; the mock's 720px minimum is for full-width ones. */
.grid-2 .data-table { min-width: 0; }
