* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: #0f172a;
  background: #f1f5f9;
}
#app {
  min-height: 100vh;
}
html.o4-signed-in body {
  background: #0b1220;
  overflow: hidden;
}
html.o4-signed-in #app,
html.o4-signed-in main {
  height: 100vh;
  height: 100dvh;
  margin: 0;
  padding: 0;
  max-width: none;
}
#map-shell {
  position: fixed;
  inset: 0;
  z-index: 10;
}
#map-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: #0f172a;
}
#map-shell {
  --o4-ink: #1d1d1b;
  --o4-paper: #f7f3e8;
  --o4-desk: #e9e4d6;
  --o4-rule: #d8d1bd;
  --o4-label: #6b6656;
  --o4-orange: #ff8200;
  --o4-bar-h: 52px;
  --o4-status-h: 30px;
  --o4-sans: "Archivo Narrow", "Arial Narrow", sans-serif;
  --o4-mono: "Martian Mono", ui-monospace, monospace;
  font-family: var(--o4-sans);
  color: var(--o4-ink);
}
#map-canvas {
  top: calc(var(--o4-bar-h) + env(safe-area-inset-top));
  bottom: var(--o4-status-h);
}
.o4-map-tools {
  position: absolute;
  z-index: 550;
  top: calc(var(--o4-bar-h) + env(safe-area-inset-top) + 12px);
  left: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.o4-annotate {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px;
  background: var(--o4-ink);
  border: 1px solid #2e2e2a;
}
.o4-annotate.hidden {
  display: none;
}
.o4-annotate button {
  width: 52px;
  margin: 0;
  padding: 6px 2px 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  border: 0;
  background: transparent;
  color: #9a968a;
  font-family: var(--o4-mono);
  font-size: 0.48rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
}
.o4-annotate button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
}
.o4-annotate button:hover,
.o4-annotate button.active {
  color: #fff;
  background: #2a2a26;
}
.o4-annotate button.active {
  color: var(--o4-orange);
}
.o4-annotate button:focus-visible {
  outline: 2px solid var(--o4-orange);
  outline-offset: -2px;
}
#map-canvas .leaflet-control.o4-map-nav {
  margin: 12px 12px 0 0;
  border-radius: 0;
  box-shadow: none;
  float: right;
  clear: both;
}
#map-canvas .o4-map-nav button:disabled {
  opacity: 0.45;
  cursor: default;
}
.o4-user-loc-wrap {
  background: none;
  border: 0;
}
.o4-user-loc {
  position: relative;
  width: 18px;
  height: 18px;
}
.o4-user-loc::before {
  content: "";
  position: absolute;
  inset: -10px;
  border: 1px solid var(--o4-orange);
  border-radius: 50%;
  opacity: 0.55;
  animation: o4-user-loc-pulse 2.2s ease-out infinite;
}
.o4-user-loc::after {
  content: "";
  position: absolute;
  inset: 3px;
  background: var(--o4-orange);
  border: 2px solid #f7f3e8;
  border-radius: 50%;
  box-shadow: 0 0 0 1px #1d1d1b;
}
@keyframes o4-user-loc-pulse {
  0% { transform: scale(0.55); opacity: 0.6; }
  100% { transform: scale(1.15); opacity: 0; }
}
.o4-draw-hud {
  position: absolute;
  z-index: 560;
  left: 76px;
  top: calc(var(--o4-bar-h) + env(safe-area-inset-top) + 12px);
  max-width: min(360px, calc(100% - 140px));
  padding: 8px 10px;
  background: var(--o4-paper);
  border: 1px solid var(--o4-ink);
  box-shadow: 4px 4px 0 var(--o4-ink);
}
.o4-draw-hud.hidden {
  display: none;
}
.o4-draw-hud p {
  margin: 0 0 8px;
  font-family: var(--o4-mono);
  font-size: 0.62rem;
  text-transform: uppercase;
  color: var(--o4-ink);
}
.o4-draw-hud-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.o4-pending-banner {
  position: absolute;
  z-index: 700;
  left: 12px;
  right: 12px;
  top: calc(var(--o4-bar-h) + env(safe-area-inset-top) + 10px);
  margin: 0;
  padding: 8px 12px;
  background: #f7f3e8;
  border: 1px solid #1d1d1b;
  font-family: var(--o4-mono);
  font-size: 0.68rem;
  line-height: 1.35;
  color: #1d1d1b;
}
.o4-rail {
  position: absolute;
  z-index: 800;
  top: 0;
  left: 0;
  right: 0;
  height: calc(var(--o4-bar-h) + env(safe-area-inset-top));
  display: flex;
  align-items: stretch;
  padding: env(safe-area-inset-top) 8px 0 16px;
  background: var(--o4-ink);
}
.o4-rail-mark {
  align-self: center;
  margin-right: 18px;
  color: var(--o4-desk);
  font-family: var(--o4-sans);
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.04em;
}
.o4-rail-spacer {
  flex: 1;
}
.o4-rail button {
  margin: 0;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: none;
  color: #9a968a;
  font-family: var(--o4-mono);
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
}
.o4-rail button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
}
.o4-rail button:hover {
  color: var(--o4-desk);
}
.o4-rail button.active {
  color: #fff;
  border-bottom-color: var(--o4-orange);
}
.o4-rail button:focus-visible {
  outline: 2px solid var(--o4-orange);
  outline-offset: -2px;
}
.o4-status {
  position: absolute;
  z-index: 800;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--o4-status-h);
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 16px;
  background: var(--o4-ink);
  color: #c9c4b4;
  font-family: var(--o4-mono);
  font-size: 0.62rem;
  white-space: nowrap;
  overflow: hidden;
}
.o4-status b {
  color: #fff;
  font-weight: 600;
}
.o4-toolbar-user {
  color: var(--o4-orange);
  text-transform: uppercase;
  overflow: hidden;
  text-overflow: ellipsis;
}
.o4-toolbar-user:empty {
  display: none;
}
.o4-legend {
  margin-left: auto;
  display: flex;
  gap: 10px;
}
.o4-legend i {
  display: inline-block;
  width: 14px;
  height: 4px;
  margin-right: 4px;
  vertical-align: middle;
}
#map-shell.o4-pin-mode #map-canvas {
  cursor: crosshair;
}
#map-shell.o4-pin-mode .o4-sheet-backdrop {
  display: none !important;
}
.o4-ticket-pin-wrap {
  background: transparent;
  border: 0;
}
.o4-ticket-pin {
  display: block;
  width: 26px;
  height: 32px;
  overflow: visible;
  filter: drop-shadow(0 0 1px #fff) drop-shadow(0 2px 3px rgba(0, 0, 0, 0.55));
}
#map-shell.o4-pin-mode .o4-ticket-pin-wrap {
  pointer-events: none !important;
}
#map-shell.o4-pin-mode .o4-near-hit {
  pointer-events: none !important;
}
.o4-near-chip {
  position: absolute;
  top: calc(var(--o4-bar-h) + env(safe-area-inset-top) + 10px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 550;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  max-width: min(420px, calc(100% - 140px));
  padding: 6px 6px 6px 10px;
  background: var(--o4-paper);
  border: 2px solid #f97316;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  font: 0.8rem/1.35 var(--o4-sans);
  color: var(--o4-ink);
}
.o4-near-chip[hidden] {
  display: none;
}
.o4-near-chip.o4-broad-chip {
  border-color: #0072ce;
}
.o4-near-chip [data-broad-research] {
  margin-top: 6px;
  width: 100%;
}
.o4-near-chip strong {
  margin-right: 4px;
}
#near-chip-close {
  border: 0;
  background: transparent;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
.o4-near-list {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  max-height: 150px;
  overflow-y: auto;
}
.o4-near-list button {
  display: flex;
  justify-content: space-between;
  width: 100%;
  gap: 8px;
  border: 0;
  border-top: 1px solid var(--o4-rule);
  background: transparent;
  padding: 3px 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.o4-near-list button span {
  font-family: var(--o4-mono);
  font-size: 0.72rem;
  color: var(--o4-label);
}
#my-nearby-ft {
  width: 100%;
}
.o4-ticket-popup {
  font-size: 0.82rem;
  line-height: 1.35;
}
.o4-ticket-popup strong {
  display: block;
}
.o4-sheet-backdrop {
  position: absolute;
  inset: 0;
  z-index: 600;
  border: 0;
  margin: 0;
  padding: 0;
  background: rgba(29, 29, 27, 0.22);
  cursor: pointer;
}
.o4-sheet[hidden] {
  display: none !important;
}
.o4-sheet {
  position: absolute;
  z-index: 700;
  top: calc(var(--o4-bar-h) + env(safe-area-inset-top) + 16px);
  left: 16px;
  max-height: calc(100% - var(--o4-bar-h) - env(safe-area-inset-top) - var(--o4-status-h) - 40px);
  width: min(calc(100% - 32px), 24rem);
  display: flex;
  flex-direction: column;
  background: var(--o4-paper);
  border: 1px solid var(--o4-ink);
  box-shadow: 6px 6px 0 var(--o4-ink);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.16s ease, transform 0.16s ease;
  pointer-events: auto;
}
.o4-sheet.is-open {
  opacity: 1;
  transform: none;
}
.o4-sheet-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 10px 14px;
  background: var(--o4-ink);
  color: var(--o4-paper);
}
.o4-sheet-header h2 {
  margin: 0;
  font-family: var(--o4-sans);
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.o4-sheet-close {
  border: 0;
  background: transparent;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  color: var(--o4-orange);
  padding: 0 0.2rem;
}
.o4-sheet-body {
  flex: 1;
  overflow: auto;
  padding: 12px 14px 14px;
  background: var(--o4-paper);
  line-height: 1.45;
  -webkit-overflow-scrolling: touch;
}
.o4-sheet-body p {
  margin: 0;
}
.o4-sheet-hint,
.o4-muted {
  font-size: 0.85rem;
  color: var(--o4-label);
}
.o4-pin-status {
  font-family: var(--o4-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  color: #e4002b;
}
.o4-pin-status.is-set {
  color: #00a651;
}
.o4-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.o4-loc-mode {
  border: 0;
  margin: 0.5rem 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  font-size: 0.9rem;
}
.o4-loc-mode label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
}
.o4-loc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}
.o4-btn-secondary {
  font: 0.78rem/1.3 var(--o4-mono);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--o4-ink);
  background: var(--o4-paper);
  color: var(--o4-ink);
  cursor: pointer;
}
.o4-btn-secondary:hover {
  background: #f4f4f0;
}
.o4-btn-danger {
  font: 0.78rem/1.3 var(--o4-mono);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.35rem 0.55rem;
  border: 1px solid #991b1b;
  background: #fff;
  color: #991b1b;
  cursor: pointer;
}
.o4-btn-danger:hover {
  background: #fee2e2;
}
.o4-btn-danger:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.o4-mine-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.55rem 0 0.25rem;
}
.o4-code-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 6px;
  border: 1px solid var(--o4-ink);
  vertical-align: middle;
}
.o4-code-row code {
  font-family: var(--o4-mono);
  font-size: 0.75rem;
}
.o4-code-form,
#admin-add-user-form {
  margin: 0.75rem 0 1rem;
}
#admin-add-user-form select {
  max-width: 16rem;
}
.o4-code-row.o4-code-form {
  padding-bottom: 1rem;
}
.o4-code-row-head {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.35rem;
}
.o4-success {
  font-family: var(--o4-mono);
  font-size: 0.7rem;
  color: #00a651;
}
@media (max-width: 640px) {
  #map-shell {
    --o4-dock-h: 58px;
  }
  #map-canvas {
    top: 0;
    bottom: calc(var(--o4-status-h) + var(--o4-dock-h) + env(safe-area-inset-bottom));
  }
  .o4-rail {
    top: auto;
    bottom: 0;
    height: calc(var(--o4-dock-h) + env(safe-area-inset-bottom));
    padding: 0 0 env(safe-area-inset-bottom);
  }
  .o4-rail-mark,
  .o4-rail-spacer {
    display: none;
  }
  .o4-rail button {
    flex: 1;
    flex-direction: column;
    gap: 4px;
    padding: 0;
    font-size: 0.5rem;
    border-bottom: 0;
    border-top: 3px solid transparent;
  }
  .o4-rail button.active {
    border-top-color: var(--o4-orange);
  }
  .o4-map-tools {
    top: 10px;
    left: 8px;
  }
  .o4-draw-hud {
    left: 70px;
    top: 10px;
    max-width: calc(100% - 118px);
  }
  .o4-pending-banner {
    top: 10px;
    left: 8px;
    right: 8px;
  }
  .o4-near-chip {
    top: calc(10px + env(safe-area-inset-top, 0px));
  }
  .o4-status {
    bottom: calc(var(--o4-dock-h) + env(safe-area-inset-bottom));
    padding: 0 12px;
    gap: 12px;
    border-bottom: 1px solid #333;
  }
  .o4-legend {
    display: none;
  }
  #map-canvas .leaflet-top.leaflet-right {
    margin-top: 0.45rem;
    margin-right: 0.45rem;
  }
  #map-canvas .leaflet-control.o4-map-nav {
    margin: 0;
  }
}

/* Phone + in-browser camera panel: sheets fill the viewport (beats pin-mode card). */
@media (max-width: 1100px) {
  .o4-sheet,
  #map-shell.o4-pin-mode .o4-sheet {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: none;
    height: 100dvh;
    max-height: 100dvh;
    min-height: 100dvh;
    z-index: 5000;
    border: 0;
    box-shadow: none;
  }
  .o4-sheet-header {
    flex-shrink: 0;
    padding-top: calc(10px + env(safe-area-inset-top));
  }
  .o4-sheet-map-toggle {
    display: inline-flex;
  }
  .o4-sheet.o4-sheet--peek,
  #map-shell.o4-pin-mode .o4-sheet.o4-sheet--peek {
    top: auto;
    height: 42dvh;
    min-height: 0;
    max-height: 42dvh;
    z-index: 5000;
  }
}
.panel {
  display: none;
  background: #fff;
  border-radius: 10px;
  padding: 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.panel.active {
  display: block;
}
.login-form label,
.o4-sheet label {
  display: block;
  margin: 0;
  font-family: "Martian Mono", ui-monospace, monospace;
  font-size: 0.6rem;
  font-weight: 600;
  line-height: 28px;
  text-transform: uppercase;
  color: #6b6656;
}
.login-form input,
.o4-sheet input,
.o4-sheet select,
.o4-sheet textarea {
  width: 100%;
  max-width: 420px;
  margin: 0;
  padding: 0 6px;
  border: 1px solid #1d1d1b;
  border-radius: 0;
  background: #fff;
  color: #1d1d1b;
  font-family: "Martian Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  line-height: 26px;
  min-height: 27px;
}
.o4-sheet textarea {
  line-height: 1.5;
  padding: 4px 6px;
}
.o4-measure-row {
  display: grid;
  grid-template-columns: 1fr minmax(6.5rem, 8rem);
  gap: 0.4rem;
  max-width: 420px;
  margin: 0 0 0.35rem;
}
.o4-measure-row input,
.o4-measure-row select {
  max-width: none;
  width: 100%;
}
.o4-sheet input:focus,
.o4-sheet select:focus,
.o4-sheet textarea:focus {
  outline: none;
  background: color-mix(in srgb, #ffd100 30%, #fff);
}
.login-form button,
.o4-sheet button.primary {
  margin-top: 14px;
  padding: 10px 16px;
  background: #1d1d1b;
  color: #fff;
  border: 1px solid #1d1d1b;
  border-radius: 0;
  font-family: "Archivo Narrow", sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
}
.o4-sheet button.primary:hover {
  background: #000;
}
.o4-sheet button:not(.primary):not(.o4-sheet-close):not(.o4-admin-user-toggle) {
  margin-top: 0.35rem;
  margin-right: 0.35rem;
  padding: 4px 10px;
  border: 1px solid #1d1d1b;
  border-radius: 0;
  background: transparent;
  color: #1d1d1b;
  font-family: "Archivo Narrow", sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
}
.o4-sheet button:not(.primary):not(.o4-sheet-close):not(.o4-admin-user-toggle):hover {
  background: #1d1d1b;
  color: #fff;
}
.error {
  color: #e4002b;
  font-size: 0.85rem;
}
.disclaimer {
  margin: 14px 0 0 !important;
  font-size: 0.85rem;
  line-height: 1.5;
  color: #1d1d1b;
  border: 2px solid #e4002b;
  padding: 0.5rem 0.75rem;
  background: #fff;
}
.o4-settings-body {
  padding-top: 6px;
}
.o4-settings-block + .o4-settings-block {
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--o4-rule);
}
.o4-settings-block .o4-admin-h {
  margin-top: 0;
}
.o4-settings-tagline {
  margin: 4px 0 8px !important;
  font-family: var(--o4-sans);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--o4-ink);
  line-height: 1.35;
}
.o4-settings-disclaimer {
  margin: 0 !important;
  padding: 8px 10px;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--o4-label);
  border: 1px solid var(--o4-rule);
  background: #fff;
}
#map-canvas .leaflet-bottom {
  padding-bottom: env(safe-area-inset-bottom);
}
@media (min-width: 641px) {
  .o4-admin-sheet {
    width: min(calc(100% - 32px), 28rem);
  }
}
.list-item {
  border-bottom: 1px solid #1d1d1b;
  padding: 0 0 6px;
  line-height: 1.5;
}
.hidden {
  display: none !important;
}

.login-indicator {
  position: fixed;
  top: 0.65rem;
  right: 0.75rem;
  z-index: 3000;
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.2;
  pointer-events: none;
  user-select: none;
}
html:not(.o4-signed-in) .login-indicator {
  background: #f7f3e8;
  color: #1d1d1b;
  border: 1px solid #1d1d1b;
  border-radius: 0;
  font-family: "Martian Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  font-weight: 400;
}
html.o4-signed-in .login-indicator {
  display: none !important;
}
.login-indicator-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  flex-shrink: 0;
  background: #94a3b8;
}
.login-indicator[data-state="pending"] .login-indicator-dot {
  background: #fbbf24;
  animation: o4-login-pulse 1s ease-in-out infinite;
}
.login-indicator[data-state="in"] .login-indicator-dot {
  background: #4ade80;
  box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.35);
}
.login-indicator[data-state="out"] .login-indicator-dot {
  background: #64748b;
}
@keyframes o4-login-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.45;
  }
}

/* Sign-in follows Field Book: paper desk, ruled sheet, ink type. */
html:not(.o4-signed-in) body {
  background: #e9e4d6;
  color: #1d1d1b;
}

html:not(.o4-signed-in) #login-gate.panel.active {
  display: flex;
  position: fixed;
  inset: 0;
  z-index: 20;
  margin: 0;
  padding: 1.5rem;
  border-radius: 0;
  box-shadow: none;
  background: #e9e4d6;
  color: #1d1d1b;
  color-scheme: light;
  align-items: center;
  justify-content: center;
}

html.o4-signed-in #login-gate {
  display: none !important;
}

#login-gate {
  --o4-t: 0.4;
  --o4-d1: 0.28s;
  --o4-d2: 0.78s;
  --o4-form: 1.45s;
}

.o4-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(100%, 22rem);
}

.o4-seq {
  margin: 0 0 0.85rem;
  color: #1d1d1b;
  font-family: "Archivo Narrow", sans-serif;
  font-size: clamp(4.4rem, 16vw, 6.4rem);
  font-weight: 800;
  letter-spacing: -0.06em;
  line-height: 0.82;
}

.o4-seq span {
  display: inline-block;
}

.o4-seq span + span {
  margin-left: 0.14em;
}

.o4-play .o4-seq span {
  opacity: 0;
  animation: o4-pop calc(var(--o4-t) * 0.55s) cubic-bezier(0.16, 0.84, 0.24, 1) forwards;
}

.o4-play .o4-seq span:nth-child(1) {
  animation-delay: calc(var(--o4-t) * var(--o4-d1));
}

.o4-play .o4-seq span:nth-child(2) {
  animation-delay: calc(var(--o4-t) * var(--o4-d2));
}

.o4-after {
  display: grid;
  grid-template-rows: 0fr;
  width: 100%;
  opacity: 0;
}

.o4-play .o4-after {
  animation: o4-open calc(var(--o4-t) * 0.55s) ease forwards;
  animation-delay: calc(var(--o4-t) * var(--o4-form));
}

.o4-after-inner {
  overflow: hidden;
  padding: 0 8px 8px 0;
}

.o4-name {
  margin: 0;
  padding: 0 14px;
  line-height: 28px;
  text-align: left;
  font-family: "Martian Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6b6656;
}

.o4-field-sheet {
  width: 100%;
  background: #f7f3e8;
  border: 1px solid #1d1d1b;
  box-shadow: 6px 6px 0 #1d1d1b;
}

.o4-field-sheet-hd {
  background: #1d1d1b;
  color: #f7f3e8;
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.o4-field-sheet-hd h2 {
  margin: 0;
  font-family: "Archivo Narrow", sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.o4-field-sheet-hd span {
  font-family: "Martian Mono", ui-monospace, monospace;
  font-size: 0.7rem;
  font-weight: 400;
  color: #ff8200;
}

.o4-field-row {
  display: grid;
  grid-template-columns: 96px 1fr;
  align-items: stretch;
  padding: 0 14px;
  min-height: 28px;
}

#login-gate .login-form {
  margin-top: 0;
}

#login-gate .login-form .o4-field-row label {
  margin: 0;
  font-family: "Martian Mono", ui-monospace, monospace;
  font-size: 0.65rem;
  font-weight: 600;
  line-height: 28px;
  text-transform: uppercase;
  color: #6b6656;
}

#login-gate .login-form .o4-field-row input {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #1d1d1b;
  font-family: "Martian Mono", ui-monospace, monospace;
  font-size: 0.85rem;
  line-height: 28px;
  height: 28px;
}

#login-gate .login-form .o4-field-row input::placeholder {
  color: #b4ad9a;
}

#login-gate .login-form .o4-field-row input:focus {
  outline: none;
  background: color-mix(in srgb, #ffd100 35%, transparent);
}

.o4-field-sheet-ft {
  padding: 12px 14px;
}

#login-gate .login-form button.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-width: 8.5rem;
  width: auto;
  margin: 0;
  padding: 10px 16px;
  border: 1px solid #1d1d1b;
  border-radius: 0;
  background: #1d1d1b;
  color: #fff;
  font-family: "Archivo Narrow", sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

#login-gate .login-form button.primary:hover {
  background: #000;
}

#login-gate .login-form button.primary:disabled,
#login-gate .login-form button.primary[aria-busy="true"] {
  cursor: wait;
  background: #1d1d1b;
}

.login-submit-ticks {
  display: none;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

.login-submit-ticks i {
  display: block;
  width: 6px;
  height: 6px;
  background: rgba(247, 243, 232, 0.28);
  animation: o4-login-ticks 1.2s steps(1, end) infinite;
}

.login-submit-ticks i:nth-child(2) {
  animation-delay: 0.2s;
}

.login-submit-ticks i:nth-child(3) {
  animation-delay: 0.4s;
}

#login-gate .login-form button.primary[aria-busy="true"] .login-submit-ticks {
  display: inline-flex;
}

@keyframes o4-login-ticks {
  0%,
  16% {
    background: rgba(247, 243, 232, 0.28);
  }
  17%,
  100% {
    background: #ff8200;
  }
}

@media (prefers-reduced-motion: reduce) {
  .login-submit-ticks i {
    animation: none;
  }
  .login-submit-ticks i:nth-child(-n + 2) {
    background: #ff8200;
  }
}

#login-gate .o4-note {
  margin: 0;
  padding: 6px 14px 12px;
  color: #6b6656;
  font-family: "Martian Mono", ui-monospace, monospace;
  font-size: 0.68rem;
  line-height: 1.45;
}

#login-gate .o4-note + .o4-note {
  padding-top: 0;
}

#login-gate .error {
  min-height: 0;
  margin: 0;
  padding: 0 14px;
  line-height: 28px;
  color: #e4002b;
  font-family: "Martian Mono", ui-monospace, monospace;
  font-size: 0.72rem;
}

#login-gate .error:empty {
  display: none;
}

@keyframes o4-pop {
  0% {
    opacity: 0;
    transform: translateY(0.45em) scale(0.86);
  }
  62% {
    opacity: 1;
    transform: translateY(-0.03em) scale(1.045);
  }
  100% {
    opacity: 1;
    transform: none;
  }
}

@keyframes o4-open {
  to {
    grid-template-rows: 1fr;
    opacity: 1;
  }
}

/* Skipped runs (daily repeat, or reduced motion) land on the final frame. */
#login-gate.o4-skip *,
#login-gate.o4-skip *::before,
#login-gate.o4-skip *::after {
  animation: none !important;
}

#login-gate.o4-skip .o4-seq span {
  opacity: 1 !important;
  transform: none !important;
}

#login-gate.o4-skip .o4-after {
  opacity: 1 !important;
  grid-template-rows: 1fr !important;
}

.o4-admin-tabs {
  display: flex;
  flex-wrap: wrap;
  margin: 14px 0;
}
.o4-sheet .o4-admin-tabs button:not(.primary) {
  margin: 0 -1px 0 0;
}
.o4-sheet .o4-admin-tabs button.active {
  background: #ffd100;
  color: #1d1d1b;
}
.o4-admin-h {
  margin: 14px 0 0;
  font-family: "Archivo Narrow", sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.o4-admin-row .o4-muted {
  display: block;
  margin-top: 0.15rem;
}
.o4-admin-user-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.o4-admin-user-role-label {
  display: block;
  margin-top: 0.5rem;
}
.o4-admin-user-details select[data-user-role] {
  max-width: 16rem;
  margin-bottom: 0;
}
.o4-admin-user-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin: 0;
  padding: 6px 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.o4-admin-user-toggle:hover {
  background: transparent;
  color: inherit;
}
.o4-admin-user-toggle::after {
  content: "";
  width: 0.45em;
  height: 0.45em;
  margin-left: 8px;
  flex-shrink: 0;
  border-right: 1.5px solid var(--o4-ink);
  border-bottom: 1.5px solid var(--o4-ink);
  transform: rotate(45deg);
  transition: transform 0.15s ease;
}
.o4-admin-user-toggle[aria-expanded="true"]::after {
  transform: rotate(-135deg);
  margin-top: 4px;
}
.o4-admin-user-details {
  padding-bottom: 8px;
}
#admin-users-search {
  max-width: none;
  margin: 0 0 10px;
}
.o4-admin-user-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.15rem 0.75rem;
  margin: 0.3rem 0 0.15rem;
  font-size: 0.82rem;
}
@media (max-width: 640px) {
  html:not(.o4-signed-in) #login-gate.panel.active {
    padding: 0;
    align-items: stretch;
    justify-content: stretch;
    background: #f7f3e8;
  }
  #login-gate .o4-stage {
    width: 100%;
    height: 100%;
    min-height: 100%;
    flex: 1;
    align-items: stretch;
  }
  #login-gate .o4-seq {
    margin: 0;
    padding: calc(10px + env(safe-area-inset-top)) 16px 4px;
    font-size: clamp(2.6rem, 12vw, 3.4rem);
  }
  #login-gate .o4-after {
    flex: 1;
    width: 100%;
    min-height: 0;
  }
  #login-gate .o4-after-inner {
    display: flex;
    flex-direction: column;
    overflow: auto;
    padding: 0;
    min-height: 0;
    height: 100%;
  }
  #login-gate .o4-field-sheet {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100%;
    border: 0;
    box-shadow: none;
  }
  #login-gate .o4-field-sheet-ft {
    margin-top: auto;
  }
}

#sheet-mine .o4-sheet-body {
  padding-top: 12px;
}
#sheet-mine .o4-mine-tabs {
  margin-top: 4px;
  margin-bottom: 14px;
}
#sheet-mine [data-mine-section="all"] > .o4-muted {
  margin: 0 0 0.75rem;
  line-height: 1.45;
}
#my-submissions-list,
#mine-all-submissions-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
#sheet-mine .list-item {
  padding: 0.55rem 0 0.75rem;
  line-height: 1.45;
}
#sheet-mine .o4-mine-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.35rem 0.75rem;
  line-height: 1.45;
}
#sheet-mine .o4-mine-summary-text {
  min-width: 0;
  flex: 1;
}
#sheet-mine .o4-mine-date {
  margin-top: 0.35rem;
}
#sheet-mine .o4-admin-row .o4-muted {
  margin-top: 0.4rem;
  margin-bottom: 0.55rem;
  line-height: 1.45;
}
#sheet-mine .list-item button:not(.o4-sheet-close) {
  margin-top: 0.5rem;
  margin-right: 0;
}
#sheet-mine .o4-mine-item .o4-feedback {
  margin-top: 0.5rem;
}
#sheet-mine .o4-list-pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.65rem;
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--o4-rule);
  font-size: 0.82rem;
  color: var(--o4-label);
  line-height: 1.35;
}
#sheet-mine .o4-list-pagination[hidden] {
  display: none;
}
#sheet-mine .o4-list-pagination-controls {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}
#sheet-mine .o4-list-pagination-label {
  font-weight: 600;
  color: var(--o4-ink);
}
#sheet-mine .o4-list-pagination .o4-btn-secondary {
  margin-top: 0;
}
#sheet-mine .o4-list-pagination .o4-btn-secondary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.o4-mine-item { cursor: pointer; }
.o4-mine-date { font-size: 0.78rem; opacity: 0.7; }
.o4-mine-action {
  margin-top: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #9a3412;
}
.o4-status-pill {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  position: static;
  left: auto;
  right: auto;
  bottom: auto;
  height: auto;
  z-index: auto;
  margin: 0.15rem 0 0;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-family: var(--o4-mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.2;
  white-space: nowrap;
  background: #e5e7eb;
  color: #1f2937;
}
.o4-status-pill-approved { background: #dcfce7; color: #166534; }
.o4-status-pill-in_review { background: #dbeafe; color: #1e40af; }
.o4-status-pill-received { background: #e5e7eb; color: #374151; }
.o4-status-pill-needs_info { background: #fef3c7; color: #92400e; }
.o4-status-pill-declined { background: #fee2e2; color: #991b1b; }
.o4-req {
  color: #b45309;
  font-weight: 700;
}
.o4-opt {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  opacity: 0.75;
}
.o4-req-legend {
  margin: 0 0 0.75rem;
}
.o4-feedback { margin-top: 0.4rem; padding: 0.4rem 0.55rem; border-left: 3px solid #f59e0b; background: rgba(245, 158, 11, 0.08); font-size: 0.85rem; }
.o4-feedback-declined { border-left-color: #dc2626; background: rgba(220, 38, 38, 0.08); }
.o4-feedback-meta { font-size: 0.75rem; opacity: 0.75; margin-bottom: 0.15rem; }
#sheet-mine .o4-mine-detail { margin-top: 0.65rem; }
.o4-mine-detail { margin-top: 0.5rem; cursor: default; font-size: 0.85rem; }
.o4-detail-row { display: grid; grid-template-columns: 6.5rem 1fr; gap: 0.5rem; padding: 0.1rem 0; }
.o4-detail-row > span:first-child { opacity: 0.7; }
.o4-mine-photos { display: flex; gap: 0.4rem; flex-wrap: wrap; margin: 0.4rem 0; }
.o4-mine-photos img { width: 88px; height: 88px; object-fit: cover; border-radius: 6px; }
.o4-resubmit { margin-top: 0.6rem; display: grid; gap: 0.4rem; }
.o4-resubmit h3 { margin: 0; font-size: 0.95rem; }
.o4-resubmit label { display: grid; gap: 0.15rem; }
.o4-sheet label.o4-inline,
.o4-resubmit label.o4-inline {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.o4-sheet label.o4-inline input[type="checkbox"] {
  width: auto;
  min-height: auto;
  margin: 0;
  flex-shrink: 0;
}

.o4-sheet-map-toggle {
  display: none;
  margin-left: auto;
  border: 1px solid var(--o4-orange);
  background: transparent;
  color: var(--o4-orange);
  font: 600 0.68rem/1 var(--o4-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 8px;
  cursor: pointer;
}
.o4-sheet-header .o4-sheet-close {
  margin-left: 0.35rem;
}
.o4-photo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.25rem 0 0.5rem;
}
.o4-photo-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 0.75rem;
}
.o4-photo-thumbs img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border: 1px solid var(--o4-ink);
}

.o4-camera {
  position: fixed;
  inset: 0;
  z-index: 20000;
  background: #000;
  color: #fff;
}
.o4-camera[hidden] {
  display: none !important;
}
.o4-camera-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.o4-camera-bar {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.55), transparent);
}
.o4-camera-top {
  top: 0;
  padding-top: calc(12px + env(safe-area-inset-top));
}
.o4-camera-bottom {
  bottom: 0;
  justify-content: center;
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(0, 0, 0, 0.55), transparent);
}
.o4-camera-bar button {
  border: 1px solid #fff;
  background: transparent;
  color: #fff;
  font: 600 0.75rem/1 "Archivo Narrow", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 8px 12px;
  cursor: pointer;
}
.o4-camera-count {
  font: 600 0.75rem/1 "Martian Mono", ui-monospace, monospace;
}
.o4-camera-shutter {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 76px;
  height: 76px;
  padding: 8px 6px 7px !important;
  border: 2px solid #f7f3e8 !important;
  border-radius: 0;
  background: #1d1d1b !important;
  box-shadow: 4px 4px 0 #ff8200;
  color: #f7f3e8;
}
.o4-camera-shutter:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 #ff8200;
}
.o4-camera-shutter-mark {
  position: relative;
  width: 28px;
  height: 28px;
}
.o4-camera-shutter-mark::before,
.o4-camera-shutter-mark::after {
  content: "";
  position: absolute;
  background: #ff4f9a;
}
.o4-camera-shutter-mark::before {
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
}
.o4-camera-shutter-mark::after {
  top: 50%;
  left: 0;
  right: 0;
  height: 2px;
  margin-top: -1px;
}
.o4-camera-shutter-label {
  font: 700 0.68rem/1 "Archivo Narrow", sans-serif;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
