/* Layout and the few pieces the OSO component library doesn't ship. Values come from oso-tokens.css. */
html, body { margin: 0; height: 100%; }
body { background: var(--paper); }
a { color: var(--brand-text); }
a:hover { color: var(--ink); }
button, input, select { font-family: var(--font-sans); }

.app { min-height: 100vh; display: flex; align-items: stretch; background: var(--paper); }
.app__nav { flex: 0 0 248px; display: flex; position: sticky; top: 0; height: 100vh; z-index: var(--z-nav); }
.app__nav .oso-sidenav { width: 100%; overflow: auto; }
.app__main { flex: 1 1 auto; min-width: 0; max-width: 1440px; box-sizing: border-box; padding: 32px 48px 64px;
  display: flex; flex-direction: column; gap: 32px; outline: none; }
.app__main.is-tight { gap: 24px; }

.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; }
.page-head__title { display: flex; flex-direction: column; gap: 6px; }
.page-head__actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.grid-kpi { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 24px; }
.row { display: flex; flex-wrap: wrap; gap: 24px; align-items: stretch; }
.row.is-top { align-items: flex-start; }
.col-2 { flex: 2 1 520px; min-width: 0; }
.col-1 { flex: 1 1 320px; min-width: 0; }
.col-3 { flex: 3 1 560px; min-width: 0; }
.col-aside { flex: 2 1 340px; min-width: 0; }
.panel { padding: 16px 20px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); box-sizing: border-box; }
.panel.is-stack { display: flex; flex-direction: column; gap: 16px; }
.stack-4 { display: flex; flex-direction: column; gap: 4px; }
.filters { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; }
.filters > .is-wide { flex: 2 1 280px; }
.filters > .is-narrow { flex: 1 1 180px; }
.trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.muted { color: var(--muted); }
.empty { padding: 40px 20px; display: grid; justify-items: center; gap: 8px; text-align: center; color: var(--muted); font: 400 14px/20px var(--font-sans); }
.oso-table tbody tr.is-click { cursor: pointer; }
.oso-table tbody tr.is-sel td { background: var(--brand-tint); }
.oso-table__wrap { overflow-x: auto; }
.table-foot { padding: 12px 16px; font: 600 12px/16px var(--font-sans); color: var(--muted); border-top: 1px solid var(--line); }
.code { font: 500 15px/1 var(--font-mono); letter-spacing: .04em; }
.code-big { font: 500 32px/36px var(--font-mono); letter-spacing: .06em; }

/* map */
.map { position: relative; border-radius: var(--radius-md); overflow: hidden; background: var(--sunk); }
.map .leaflet-container { background: var(--sunk); font-family: var(--font-sans); }
.map__legend { position: absolute; left: 12px; bottom: 12px; z-index: 500; max-width: calc(100% - 24px); }
.map__note { position: absolute; right: 12px; bottom: 12px; z-index: 500; }
.map__tools { position: absolute; top: 12px; right: 12px; z-index: 500; display: flex; gap: 8px; }
.leaflet-pane .oso-map__hex, .leaflet-pane .oso-map__none { stroke: var(--surface); stroke-width: 1; }
.leaflet-pane .oso-map__hex.is-low { opacity: .35; }
.leaflet-pane .oso-map__trace { fill: none; stroke: var(--ink); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.leaflet-pane .is-picked { stroke: var(--ink); stroke-width: 2.5; }
.map-dot { width: 16px; height: 16px; border-radius: 50%; background: var(--brand); border: 3px solid var(--surface); box-sizing: border-box; box-shadow: var(--elev-1); position: relative; }
.map-dot.is-idle { background: var(--ink); }
.map-dot.is-live::after { content: ""; position: absolute; inset: -9px; border-radius: 50%; background: var(--brand); opacity: .25; animation: oso-ripple 1.6s var(--ease-out) infinite; }
.map-name { background: var(--ink); color: var(--paper); border: 0; border-radius: 6px; padding: 2px 6px; font: 600 11px/14px var(--font-sans); box-shadow: none; }
.map-name::before { display: none; }
.leaflet-popup-content-wrapper { border-radius: 12px; box-shadow: var(--elev-1); }
.leaflet-control-attribution { font: 400 10px/14px var(--font-sans); background: rgba(255,255,255,.7) !important; }
[data-theme="night"] .leaflet-control-attribution { background: rgba(23,26,31,.7) !important; color: var(--muted); }
[data-theme="night"] .leaflet-control-attribution a { color: var(--muted); }
.leaflet-control-zoom a { color: var(--ink) !important; background: var(--surface) !important; border-color: var(--line) !important; }

/* person avatar in tables */
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--sunk); display: inline-grid; place-items: center; font: 700 12px/1 var(--font-sans); color: var(--ink); flex: none; }

/* sign in */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--paper); }
.gate__card { width: min(400px, 100%); display: grid; gap: 24px; }

@media (max-width: 1023px) {
  .app { flex-direction: column; }
  .app__nav { position: static; height: auto; flex-basis: auto; }
  .app__nav .oso-sidenav { min-height: 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .app__nav .oso-sidenav nav { grid-auto-flow: column; grid-auto-columns: max-content; overflow-x: auto; }
  .app__nav .oso-sidenav__section, .app__nav .oso-sidenav__foot { display: none; }
  .app__main { padding: 24px 16px 48px; }
}
@media print { .app__nav { display: none; } .app__main { padding: 0; } }

.col-aside.panel { position: sticky; top: 24px; }
