:root {
  color-scheme: light;
  --ink: #172a25;
  --ink-strong: #0c1e19;
  --muted: #63746e;
  --muted-strong: #465a53;
  --paper: #f3f6f3;
  --surface: #ffffff;
  --surface-soft: #f7f9f7;
  --surface-tint: #edf5f0;
  --line: #dce5df;
  --line-strong: #c6d3cb;
  --green: #176b52;
  --green-strong: #0f503d;
  --green-soft: #dff1e8;
  --lime: #d8f27c;
  --orange: #b65e21;
  --danger: #a43d2b;
  --shadow-sm: 0 1px 2px rgba(17, 43, 35, .04), 0 8px 28px rgba(17, 43, 35, .045);
  --shadow-lg: 0 24px 64px rgba(7, 27, 21, .22);
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --sidebar-width: 272px;
  --sidebar-collapsed-width: 80px;
}

html {
  min-width: 320px;
  background: var(--paper);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100dvh;
  margin: 0;
  background:
    radial-gradient(circle at 78% -8%, rgba(216, 242, 124, .14), transparent 28rem),
    var(--paper);
  color: var(--ink);
  font: 14px/1.55 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body.nav-open {
  overflow: hidden;
}

::selection {
  background: #c9eadb;
  color: var(--ink-strong);
}

a {
  color: var(--green);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
select,
input[type="checkbox"] {
  touch-action: manipulation;
}

:where(a, button, input, select, textarea, summary):focus-visible {
  outline: 3px solid #2d8a6c !important;
  outline-offset: 3px !important;
}

.skip-link {
  position: fixed;
  z-index: 2000;
  top: 10px;
  left: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  color: var(--ink);
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.app-shell {
  min-height: 100dvh;
}

.app-sidebar {
  position: fixed;
  z-index: 1200;
  inset: 0 auto 0 0;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid rgba(255, 255, 255, .08);
  background:
    radial-gradient(circle at 15% 5%, rgba(216, 242, 124, .11), transparent 15rem),
    #132b25;
  color: #f4f9f6;
}

.sidebar-head {
  display: flex;
  min-height: 86px;
  align-items: center;
  justify-content: space-between;
  padding: 18px 18px 14px;
}

.app-brand {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
  color: #fff;
  text-decoration: none;
}

.app-brand-mark,
.mobile-brand span {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 12px;
  background: var(--lime);
  color: #153228;
  font-size: 16px;
  font-weight: 850;
  box-shadow: inset 0 0 0 1px rgba(11, 37, 29, .08);
}

.app-brand strong,
.app-brand small {
  display: block;
}

.app-brand strong {
  font-size: 14px;
  letter-spacing: .02em;
}

.app-brand small {
  margin-top: 1px;
  color: #9fb5ad;
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.sidebar-collapse,
.sidebar-close {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border: 0;
  border-radius: 11px;
  background: rgba(255, 255, 255, .08);
  color: #fff;
  cursor: pointer;
}

.sidebar-collapse:hover,
.sidebar-close:hover {
  background: rgba(255, 255, 255, .14);
}

.sidebar-collapse {
  font-size: 25px;
}

.collapse-glyph {
  display: block;
  line-height: 1;
  transition: transform .2s ease;
}

.sidebar-close {
  display: none;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, .08);
  color: #fff;
  font-size: 27px;
  line-height: 1;
  cursor: pointer;
}

.app-sidebar .sidebar-nav {
  display: block;
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px 24px;
  scrollbar-width: thin;
  scrollbar-color: #3c574e transparent;
}

.nav-label {
  margin: 22px 12px 8px;
  color: #78938a;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.nav-label:first-child {
  margin-top: 4px;
}

.nav-item {
  position: relative;
  display: grid;
  min-height: 54px;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  margin: 3px 0;
  padding: 8px 10px;
  border-radius: 12px;
  color: #dbe8e3;
  text-decoration: none;
  transition: background-color .16s ease, color .16s ease, transform .16s ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, .07);
  color: #fff;
}

.nav-item[aria-current="page"] {
  background: #f2f8f4;
  color: #17382e;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .14);
}

.nav-item[aria-current="page"]::before {
  position: absolute;
  left: -5px;
  width: 3px;
  height: 26px;
  border-radius: 0 4px 4px 0;
  background: var(--lime);
  content: "";
}

.nav-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px;
  background: rgba(255, 255, 255, .07);
  color: #d8f27c;
  font-size: 17px;
  font-weight: 800;
}

.nav-item[aria-current="page"] .nav-icon {
  background: #dff1e8;
  color: var(--green);
}

.nav-item strong,
.nav-item small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-item strong {
  font-size: 12px;
  font-weight: 680;
}

.nav-item small {
  margin-top: 1px;
  color: #8fa79f;
  font-size: 10px;
  white-space: nowrap;
}

.nav-item[aria-current="page"] small {
  color: #647970;
}

.sidebar-foot {
  padding: 16px 20px calc(18px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(255, 255, 255, .08);
  background: rgba(5, 25, 19, .18);
}

.system-state {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #b5c8c1;
  font-size: 10px;
}

.system-state i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #8fdb9d;
  box-shadow: 0 0 0 4px rgba(143, 219, 157, .1);
}

.system-links {
  display: flex;
  gap: 16px;
  margin-top: 10px;
}

.system-links a {
  min-height: 28px;
  color: #819c93;
  font-size: 10px;
}

.session-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, .08);
}

.session-controls form { margin: 0; }

.session-user {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  color: #b5c8c1;
  font-size: 11px;
}

.session-user i {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--lime);
}

.session-user span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-action {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 9px;
  background: rgba(255, 255, 255, .06);
  color: #dbe8e3;
  font: inherit;
  font-size: 11px;
  text-decoration: none;
  cursor: pointer;
}

.session-action:hover {
  background: rgba(255, 255, 255, .12);
  color: white;
}

/* Compact desktop navigation */
.app-sidebar {
  transition: width .2s ease;
}

.app-main {
  transition: width .2s ease, margin-left .2s ease;
}

.sidebar-collapsed .app-sidebar {
  width: var(--sidebar-collapsed-width);
}

.sidebar-collapsed .sidebar-head {
  min-height: 76px;
  gap: 4px;
  padding: 14px 4px;
}

.sidebar-collapsed .app-brand {
  flex: 0 0 auto;
  justify-content: center;
}

.sidebar-collapsed .app-brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
}

.sidebar-collapsed .app-brand-copy,
.sidebar-collapsed .nav-copy,
.sidebar-collapsed .system-state > span,
.sidebar-collapsed .system-links,
.sidebar-collapsed .session-user,
.sidebar-collapsed .session-copy {
  display: none;
}

.sidebar-collapsed .sidebar-collapse {
  width: 32px;
  height: 36px;
}

.sidebar-collapsed .collapse-glyph {
  transform: rotate(180deg);
}

.sidebar-collapsed .app-sidebar .sidebar-nav {
  padding-right: 10px;
  padding-left: 10px;
}

.sidebar-collapsed .nav-label {
  height: 1px;
  margin: 20px 8px 12px;
  overflow: hidden;
  border-top: 1px solid rgba(255, 255, 255, .1);
  font-size: 0;
}

.sidebar-collapsed .nav-label:first-child {
  margin-top: 8px;
}

.sidebar-collapsed .nav-item {
  width: 54px;
  min-height: 54px;
  grid-template-columns: 34px;
  justify-content: center;
  margin-right: auto;
  margin-left: auto;
  padding: 10px;
}

.sidebar-collapsed .sidebar-foot {
  display: grid;
  min-height: 58px;
  place-items: center;
  padding: 14px 0 calc(14px + env(safe-area-inset-bottom));
}

.sidebar-collapsed .system-state {
  justify-content: center;
}

.sidebar-collapsed .session-controls {
  display: block;
  margin-top: 10px;
  padding-top: 10px;
}

.sidebar-collapsed .session-action {
  width: 38px;
  padding: 7px;
}

.sidebar-collapsed .app-main {
  width: calc(100% - var(--sidebar-collapsed-width));
  margin-left: var(--sidebar-collapsed-width);
}
.mobile-bar,
.sidebar-scrim {
  display: none;
}

.app-main {
  width: calc(100% - var(--sidebar-width));
  min-width: 0;
  min-height: 100dvh;
  max-width: none;
  margin: 0 0 0 var(--sidebar-width);
  padding: clamp(24px, 3.1vw, 52px) clamp(22px, 3.5vw, 60px) 44px;
}

.app-main.workbench,
.app-main.sightings-page {
  max-width: none;
  padding: clamp(22px, 2.4vw, 40px) clamp(18px, 2.7vw, 44px) 48px;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Shared content */
.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin: 0 0 28px;
}

.page-heading > div:first-child {
  min-width: 0;
}

.page-heading h1,
.page-heading .subhead {
  overflow-wrap: anywhere;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  color: var(--ink-strong);
  font-size: clamp(28px, 3vw, 42px);
  font-weight: 720;
  letter-spacing: -.045em;
  line-height: 1.08;
}

h2,
h3,
h4 {
  color: var(--ink-strong);
  letter-spacing: -.015em;
}

h2 {
  font-size: 17px;
}

.subhead {
  max-width: 68ch;
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.muted {
  color: var(--muted);
}

.panel,
.wb-panel,
.data-bar {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .94);
  box-shadow: var(--shadow-sm);
}

.panel {
  overflow: hidden;
}

.panel-heading,
.wb-heading {
  min-height: 68px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}

.panel-heading h2,
.wb-heading h2 {
  font-size: 15px;
  font-weight: 700;
}

.panel-heading p {
  margin-top: 3px;
}

.button,
button.button,
.workbench button,
.mission-workbench button {
  min-height: 44px;
  border-radius: 11px;
  font-weight: 650;
}

.button {
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 15px;
  border-color: var(--line-strong);
  box-shadow: 0 1px 1px rgba(13, 40, 31, .025);
}

.button:hover {
  border-color: #b9c9bf;
  background: var(--surface-tint);
}

.button.primary,
.primary,
.workbench button:not(.secondary):not(.text-button) {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.button.primary:hover,
.primary:hover {
  background: var(--green-strong);
}

input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
  min-height: 44px;
  border-color: var(--line-strong) !important;
  border-radius: 10px !important;
  background: #fff;
}

input[type="checkbox"],
input[type="radio"] {
  width: 18px !important;
  height: 18px !important;
  flex: 0 0 18px;
  accent-color: var(--green);
}

.notice,
.alert,
.warning {
  border: 1px solid transparent;
  border-radius: 13px;
}

.notice {
  border-color: #d4e5c7;
  background: #edf5dd;
}

.alert,
.warning {
  border-color: #f0d4c5;
  background: #fff1e9;
}

.metrics {
  gap: 14px;
}

.metrics article {
  min-height: 132px;
  padding: 20px 22px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.metrics strong {
  color: var(--ink-strong);
  font-variant-numeric: tabular-nums;
}

.workspace {
  gap: 18px;
}

.table-scroll {
  max-width: 100%;
  overflow: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
}

table {
  font-variant-numeric: tabular-nums;
}

th {
  height: 42px;
  color: var(--muted-strong);
  background: var(--surface-soft);
}

td,
th {
  padding: 14px 16px;
}

tbody tr:hover {
  background: #f8faf8;
}

.pill,
.status-chip,
.count {
  border-radius: 999px;
}

/* Overview and utility pages */
.auth-page,
.location-page,
.report-page {
  max-width: 1320px;
  margin-right: auto;
}

.auth-page .panel,
.location-page .panel,
.report-page .panel {
  margin-bottom: 18px;
}

.auth-content {
  padding: 22px;
}

.auth-config {
  grid-template-columns: minmax(110px, 150px) minmax(0, 1fr);
}

.auth-actions {
  gap: 10px;
}

.location-search {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.location-search label {
  margin-right: 4px;
}

.location-search input {
  width: min(100%, 360px);
}

.report-page > header {
  margin-bottom: 24px;
}

.report-page > header h1 {
  margin-bottom: 8px;
}

.report-page .panel > h2 {
  margin: 0;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
}

/* Mission Workbench */
.app-main.workbench {
  --wb-border: var(--line);
}

.workbench-split {
  grid-template-columns: minmax(300px, 350px) minmax(0, 1fr);
}

.wb-panel {
  border-radius: var(--radius);
}

.workbench .builder-column {
  top: 24px;
  max-height: calc(100dvh - 48px);
}

.workbench form {
  padding: 6px 22px 20px;
}

.workbench input,
.workbench select,
.workbench textarea {
  padding: 10px 12px;
}

.workbench .check-label {
  min-height: 36px;
}

.workbench .build-button {
  min-height: 48px;
}

.result-column {
  min-height: 720px;
}

.result-section {
  padding: 20px 24px;
}

.stop-card {
  border-radius: 12px;
}

.mission-map {
  border-radius: 13px;
}

/* Sightings */
.sightings-layout {
  grid-template-columns: minmax(280px, 320px) minmax(0, 1fr);
}

.sightings-layout > *,
.controls {
  min-width: 0;
}

.controls {
  top: 24px;
  padding: 22px;
  border-radius: var(--radius);
}

.controls .checkbox {
  min-height: 38px;
}

#sightings-map {
  height: min(65dvh, 700px);
  min-height: 480px;
}

.export-panel,
.points-panel,
.route-result {
  border-radius: var(--radius);
}

#point-list {
  scrollbar-width: thin;
}

.point-row {
  min-height: 48px;
}

@media (max-width: 1240px) {
  .workbench-split {
    grid-template-columns: 310px minmax(0, 1fr);
    gap: 16px;
  }

  .sightings-layout {
    grid-template-columns: 270px minmax(0, 1fr);
    gap: 16px;
  }

  .app-main {
    padding-right: 26px;
    padding-left: 26px;
  }
}

@media (max-width: 900px) {
  .app-sidebar {
    width: min(86vw, 292px);
    box-shadow: var(--shadow-lg);
    transition: transform .2s ease;
  }

  .shell-ready .app-sidebar {
    transform: translateX(-102%);
  }

  .shell-ready.nav-open .app-sidebar {
    transform: translateX(0);
  }

  .sidebar-collapse {
    display: none;
  }

  .sidebar-close {
    display: grid;
    place-items: center;
  }

  .sidebar-scrim {
    position: fixed;
    z-index: 1100;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    background: rgba(7, 22, 18, .52);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
  }

  .nav-open .sidebar-scrim {
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-bar {
    position: fixed;
    z-index: 1050;
    inset: 0 0 auto;
    display: grid;
    min-height: calc(64px + env(safe-area-inset-top));
    grid-template-columns: 44px 36px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
    border-bottom: 1px solid rgba(198, 211, 203, .82);
    background: rgba(250, 252, 250, .9);
    box-shadow: 0 6px 30px rgba(20, 45, 36, .06);
    backdrop-filter: blur(18px);
  }

  .menu-button {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    color: var(--ink);
    cursor: pointer;
  }

  .menu-glyph {
    display: grid;
    gap: 4px;
  }

  .menu-glyph i {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 4px;
    background: currentColor;
  }

  .mobile-brand span {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    font-size: 14px;
  }

  .mobile-context {
    min-width: 0;
  }

  .mobile-context small,
  .mobile-context strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-context small {
    color: var(--muted);
    font-size: 9px;
    letter-spacing: .08em;
    text-transform: uppercase;
  }

  .mobile-context strong {
    color: var(--ink-strong);
    font-size: 13px;
  }

  .app-main,
  .app-main.workbench,
  .app-main.sightings-page,
  .sidebar-collapsed .app-main {
    width: 100%;
    min-height: 100dvh;
    max-width: none;
    margin: 0;
    padding: calc(88px + env(safe-area-inset-top)) 20px 36px;
    overflow-x: clip;
  }

  .page-heading {
    align-items: flex-start;
  }

  .workbench .builder-column {
    position: static;
    max-height: none;
  }

  .workbench-split,
  .sightings-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .controls {
    position: static;
  }

  #sightings-map {
    height: 58dvh;
    min-height: 420px;
  }
}

@media (max-width: 640px) {
  .app-main,
  .app-main.workbench,
  .app-main.sightings-page,
  .sidebar-collapsed .app-main {
    padding-right: 14px;
    padding-left: 14px;
  }

  .page-heading {
    flex-direction: column;
    gap: 16px;
    margin-bottom: 20px;
  }

  h1 {
    font-size: clamp(27px, 9vw, 36px);
  }

  .subhead {
    font-size: 13px;
  }

  .button,
  button.button {
    max-width: 100%;
    white-space: normal;
    text-align: center;
  }

  .panel,
  .wb-panel,
  .data-bar {
    border-radius: 13px;
  }

  .panel-heading,
  .wb-heading,
  .auth-content,
  .result-section {
    padding-right: 16px;
    padding-left: 16px;
  }

  .metrics {
    grid-template-columns: 1fr;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .auth-actions,
  .action-row,
  .export-actions {
    align-items: stretch;
  }

  .auth-actions .button,
  .action-row button,
  .export-actions .button {
    flex: 1 1 100%;
    width: 100%;
  }

  .auth-config {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .auth-config dd {
    margin: 0 0 10px;
  }

  .location-search {
    display: grid;
    grid-template-columns: 1fr;
  }

  .location-search input {
    width: 100%;
  }

  .workbench form {
    padding-right: 16px;
    padding-left: 16px;
  }

  .form-pair {
    grid-template-columns: 1fr;
  }

  .result-metrics,
  .result-metrics.four-metrics {
    grid-template-columns: 1fr;
  }

  .result-metrics > div,
  .result-metrics.four-metrics > div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .result-metrics > div:last-child,
  .result-metrics.four-metrics > div:last-child {
    border-bottom: 0;
  }

  .debug-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #sightings-map {
    height: 56dvh;
    min-height: 360px;
  }

  .map-legend {
    padding-right: 16px;
    padding-left: 16px;
  }

  footer {
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media (forced-colors: active) {
  .nav-item[aria-current="page"] {
    outline: 2px solid CanvasText;
  }

  .system-state i {
    border: 1px solid CanvasText;
  }
}


/* Public employee surface: no protected navigation or feature names. */
.public-session .app-shell { min-height: 100dvh; }
.public-session .app-main,
.public-session .app-main.sightings-page {
  width: 100%;
  max-width: none;
  margin-left: 0;
  padding: clamp(18px, 2.4vw, 36px) clamp(14px, 2.8vw, 42px) 40px;
}
@media (max-width: 900px) {
  .public-session .app-main,
  .public-session .app-main.sightings-page {
    padding-top: 18px;
  }
}
