:root {
  --portal-bg: #f3f5f9;
  --portal-ink: #171b20;
  --portal-card-ink: #0a1628;
  --portal-green: #006a4e;
  --portal-green-soft: #e8f3ee;
  --portal-subtle: #59636f;
  --green-900: #0b3a26;
  --green-800: #11532c;
  --green-700: #15803d;
  --green-600: #16a34a;
  --green-100: #dcfce7;
  --green-50: #f0fdf4;
  --ink: #0f1a13;
  --muted: #5b6b62;
  --line: #e2eae5;
  --line-strong: #cfdcd4;
  --panel: #ffffff;
  --page: #f3f5f9;
  --blue: #2563eb;
  --amber: #b7791f;
  --red: #dc2626;
  --shadow: 0 12px 28px rgba(16, 42, 28, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html {
  min-height: 100%;
  background: var(--page);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--portal-bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  line-height: 1.45;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.visually-hidden {
  position: fixed;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

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

.portal-oneui-page,
.login-page {
  min-height: 100vh;
  background: var(--portal-bg);
}

.login-page {
  display: grid;
  place-items: start center;
  padding: 18px;
}

.login-card {
  width: min(100%, 520px);
  border: 0;
  border-radius: 24px;
  background: var(--panel);
  box-shadow: 0 10px 28px rgba(20, 31, 45, 0.07);
  padding: 22px;
}

.portal-login-card {
  margin-top: min(8vh, 58px);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: var(--portal-green);
  color: #fff;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(0, 106, 78, 0.18);
}

.brand-title {
  margin: 0;
  font-size: 1.28rem;
  line-height: 1.15;
}

.brand-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.login-title-row {
  margin-bottom: 22px;
}

.portal-hub,
.main {
  width: min(1020px, 100%);
  margin: 0 auto;
}

.portal-hub {
  padding: 12px 18px 34px;
}

.portal-oneui-header {
  padding: 8px 2px 12px;
}

.portal-oneui-toprow {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 10px;
}

.portal-oneui-brand {
  color: #1b1f24;
  font-size: 0.96rem;
  font-weight: 900;
}

.portal-oneui-logo {
  width: 38px;
  height: 38px;
  font-size: 0.78rem;
}

.portal-clock {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  border-radius: 999px;
  background: #fff;
  color: var(--portal-subtle);
  padding: 6px 10px;
  font-size: 0.78rem;
  white-space: nowrap;
}

.portal-command-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.portal-status,
.portal-command-badge,
.portal-command-user {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 999px;
  background: var(--portal-green-soft);
  color: var(--portal-green);
  padding: 5px 10px;
  font-size: 0.72rem;
  font-weight: 900;
}

.portal-command-user {
  color: #3b4652;
  background: #fff;
}

.portal-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #15803d;
  box-shadow: 0 0 0 3px rgba(21, 128, 61, 0.12);
  margin-right: 6px;
}

.portal-hero-copy h1 {
  margin: 0;
  color: var(--portal-ink);
  font-size: clamp(3rem, 8vw, 4.25rem);
  line-height: 0.96;
  font-weight: 900;
}

.portal-hero-copy p {
  margin: 16px 0 22px;
  color: var(--portal-subtle);
  font-size: 1.03rem;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
}

.field label {
  color: #32443a;
  font-size: 0.9rem;
  font-weight: 800;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 14px;
  background: #f7f9fb;
  color: var(--ink);
  padding: 10px 12px;
}

.field textarea {
  min-height: 92px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 3px solid rgba(0, 106, 78, 0.16);
}

.hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.error-text {
  min-height: 20px;
  color: var(--red);
  font-size: 0.9rem;
  font-weight: 800;
}

.topbar {
  position: static;
  z-index: 20;
  display: block;
  min-height: 0;
  border-bottom: 0;
  background: transparent;
  box-shadow: none;
}

.topbar .brand-title {
  font-size: clamp(1rem, 2vw, 1.18rem);
}

.user-strip,
.toolbar,
.row-actions,
.photo-actions,
.modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.user-strip {
  justify-content: flex-end;
}

.user-pill {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 7px 10px;
  color: #33463b;
  font-size: 0.86rem;
  font-weight: 800;
}

.main {
  padding: 0;
}

.module-head,
.panel-head,
.site-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.module-head h2,
.panel-head h3,
.site-head h3 {
  margin: 0;
}

.module-head h2 {
  color: var(--portal-ink);
  font-size: 1.65rem;
  line-height: 1.05;
  font-weight: 900;
}

.dashboard-head {
  margin-bottom: 12px;
}

.dashboard-head h2 {
  font-size: 2rem;
}

.compact-head {
  margin: 10px 0 12px;
  padding-top: 4px;
}

.compact-head h2 {
  font-size: 1.2rem;
}

.compact-head p {
  font-size: 0.88rem;
}

.module-head p,
.panel-head p,
.site-head p {
  margin: 4px 0 0;
  color: var(--muted);
}

.btn,
.tab-btn,
.icon-btn {
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: var(--portal-green-soft);
  color: var(--portal-green);
  padding: 8px 13px;
  font-weight: 900;
  text-decoration: none;
}

.btn.primary,
.tab-btn.active {
  background: var(--portal-green);
  color: #fff;
}

.btn.ghost {
  background: #fff;
  border-color: transparent;
  color: var(--portal-green);
}

.portal-logout {
  min-height: 30px;
  padding: 5px 12px;
  font-size: 0.72rem;
}

.btn.danger {
  background: #fee2e2;
  color: #991b1b;
}

.btn.blue {
  background: #dbeafe;
  color: #1d4ed8;
}

.btn.success {
  background: #16a34a;
  color: #fff;
}

.btn:disabled,
.tab-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 10px;
}

.tab-btn {
  white-space: nowrap;
  color: var(--portal-green);
  background: var(--portal-green-soft);
  font-size: 0.9rem;
}

.content-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 14px;
}

.span-12 {
  grid-column: span 12;
}

.span-8 {
  grid-column: span 8;
}

.span-6 {
  grid-column: span 6;
}

.span-4 {
  grid-column: span 4;
}

.panel,
.stat-card,
.site-card,
.checkin-card,
.photo-box {
  border: 0;
  border-radius: 22px;
  background: var(--panel);
  box-shadow: 0 10px 28px rgba(20, 31, 45, 0.07);
}

.panel {
  padding: 18px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.overview-map-shell {
  display: block;
  margin-top: 14px;
}

.overview-progress-panel {
  margin-bottom: 14px;
}

.overview-progress-head,
.overview-progress-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.overview-progress-head h3 {
  margin: 0;
  font-size: 1.35rem;
}

.overview-progress-head p {
  margin: 4px 0 0;
  color: var(--muted);
}

.overview-progress-head > strong {
  color: var(--portal-green);
  font-size: 2rem;
  font-weight: 900;
}

.overview-progress-bar {
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8f2ed;
  margin: 16px 0;
}

.overview-progress-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0f766e, #22c55e);
}

.overview-map-panel {
  padding: 16px;
}

.map-status-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.map-status-strip span {
  border-radius: 999px;
  background: #eff7f2;
  color: #315444;
  padding: 8px 11px;
  font-size: 0.82rem;
  font-weight: 900;
}

.map-status-strip strong {
  color: var(--portal-green);
}

.stat-card {
  padding: 18px;
}

.stat-label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.stat-value {
  margin-top: 8px;
  color: var(--portal-card-ink);
  font-size: clamp(1.35rem, 4vw, 2rem);
  font-weight: 900;
}

.stat-foot {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.82rem;
}

.site-grid,
.card-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.route-list {
  display: grid;
  gap: 16px;
}

.route-section {
  border: 0;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(20, 31, 45, 0.07);
  padding: 16px;
}

.route-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}

.route-head h3 {
  margin: 0;
  color: var(--portal-card-ink);
  font-size: 1.1rem;
  font-weight: 900;
}

.route-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.route-vehicles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
  max-width: 56%;
}

.route-vehicles span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  background: var(--portal-green-soft);
  color: var(--portal-green);
  padding: 4px 9px;
  font-size: 0.76rem;
  font-weight: 900;
}

.route-crew-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
  margin: 0 0 14px;
}

.route-crew-card {
  display: grid;
  gap: 5px;
  border-radius: 18px;
  background: #f7faf8;
  padding: 12px;
}

.route-crew-card strong {
  color: var(--portal-card-ink);
  font-size: 0.9rem;
}

.route-crew-card span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.route-search-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px 12px;
  margin: 14px 0;
}

.route-search-panel label {
  grid-column: 1 / -1;
  color: #32443a;
  font-size: 0.9rem;
  font-weight: 900;
}

.route-search-panel input {
  min-height: 44px;
  border: 0;
  border-radius: 14px;
  background: #f7f9fb;
  color: var(--ink);
  padding: 10px 12px;
  font: inherit;
}

.route-search-panel input:focus {
  outline: 3px solid rgba(0, 106, 78, 0.16);
}

.route-search-panel span {
  border-radius: 999px;
  background: #eff7f2;
  color: var(--portal-green);
  padding: 10px 12px;
  font-size: 0.84rem;
  font-weight: 900;
  white-space: nowrap;
}

.route-search-empty {
  grid-column: 1 / -1;
}

.route-points .site-card[hidden],
.route-search-empty[hidden] {
  display: none !important;
}

.route-points {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 12px;
  align-items: stretch;
}

.site-card,
.checkin-card {
  padding: 18px;
}

.site-card {
  display: grid;
  grid-template-rows: auto auto auto;
  min-height: 0;
}

.site-card .site-head {
  min-height: 0;
}

.site-card .site-head > div {
  min-width: 0;
}

.site-card .site-head h3 {
  overflow-wrap: anywhere;
  line-height: 1.2;
}

.site-card .site-head p {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.site-actions {
  align-self: end;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #eef2ef;
}

.site-actions .btn {
  min-width: 150px;
}

.site-card.done {
  border-color: #a7d7b5;
  background: #fbfffc;
}

.site-card.flagged {
  border-color: #facc15;
  background: #fffdf4;
}

.site-quick-info {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.site-quick-info span {
  border-radius: 999px;
  background: #f5faf7;
  color: var(--muted);
  padding: 7px 10px;
  font-size: 0.82rem;
  font-weight: 900;
}

.site-meta,
.meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  color: var(--muted);
  font-size: 0.88rem;
  align-content: start;
}

.site-meta > div,
.meta-grid > div {
  min-width: 0;
  overflow-wrap: anywhere;
}

.site-meta strong,
.meta-grid strong {
  display: block;
  color: #27372e;
  font-size: 0.8rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 9px;
  background: #edf2f7;
  color: #334155;
  font-size: 0.78rem;
  font-weight: 900;
}

.badge.done,
.badge.valid {
  color: var(--portal-green);
  background: var(--portal-green-soft);
}

.badge.pending {
  color: #854d0e;
  background: #fef3c7;
}

.badge.flagged,
.badge.error {
  color: #991b1b;
  background: #fee2e2;
}

.badge.open {
  color: #1d4ed8;
  background: #dbeafe;
}

.badge.demo {
  color: #365314;
  background: #ecfccb;
}

.map-strip {
  display: grid;
  grid-template-columns: repeat(50, minmax(10px, 1fr));
  gap: 3px;
  margin-top: 12px;
}

.map-dot {
  height: 24px;
  border-radius: 8px;
  background: #e5e7eb;
}

.map-dot.done {
  background: var(--green-600);
}

.map-dot.flagged {
  background: #f59e0b;
}

.ops-map {
  position: relative;
  min-height: 430px;
  margin-top: 14px;
  border-radius: 22px;
  overflow: hidden;
  background: #dbe7de;
  box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.12);
}

.overview-map-panel .ops-map {
  min-height: 660px;
}

.ops-map.empty-map {
  display: grid;
  place-items: center;
  color: var(--portal-green);
  font-weight: 900;
}

.actual-map {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.ops-map-metrics,
.ops-map-legend,
.ops-map-routes {
  position: absolute;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ops-map-metrics {
  left: 16px;
  top: 16px;
}

.ops-map-metrics span,
.ops-map-legend span,
.ops-map-routes span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  border: 1px solid rgba(15, 118, 110, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  color: #10241a;
  padding: 5px 10px;
  font-size: 0.78rem;
  font-weight: 900;
  backdrop-filter: blur(10px);
}

.ops-map-metrics strong {
  color: var(--portal-green);
}

.ops-map-routes {
  left: 16px;
  bottom: 16px;
}

.ops-map-routes span {
  color: var(--portal-green);
}

.ops-map-routes span.route-1 {
  color: #2563eb;
}

.ops-map-routes span.route-2 {
  color: #f59e0b;
}

.ops-map-routes span.route-3 {
  color: #7c3aed;
}

.ops-map-routes span.route-4 {
  color: #0891b2;
}

.ops-map-legend {
  right: 16px;
  bottom: 16px;
}

.ops-map-legend i {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  box-shadow: 0 0 12px currentColor;
}

.ops-map-legend i.done {
  background: #22c55e;
  color: #22c55e;
}

.ops-map-legend i.pending {
  background: #f59e0b;
  color: #f59e0b;
}

.ops-map-legend i.flagged {
  background: #ef4444;
  color: #ef4444;
}

.ops-map-legend i.route-1 {
  background: #2563eb;
  color: #2563eb;
}

.ops-map-legend i.route-2 {
  background: #f59e0b;
  color: #f59e0b;
}

.ops-map-legend i.route-3 {
  background: #7c3aed;
  color: #7c3aed;
}

.ops-map-legend i.route-4 {
  background: #0891b2;
  color: #0891b2;
}

.actual-map-marker {
  display: grid;
  place-items: center;
  width: 22px !important;
  height: 22px !important;
  border: 2px solid #fff;
  border-radius: 999px;
}

.actual-map-marker span {
  position: absolute;
  left: 50%;
  top: 22px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: rgba(12, 24, 18, 0.8);
  color: #fff;
  padding: 2px 6px;
  font-size: 0.62rem;
  font-weight: 900;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
}

.actual-map-marker:hover span {
  opacity: 1;
}

.actual-map-marker.done {
  background: #22c55e;
  box-shadow: 0 0 0 5px rgba(34, 197, 94, 0.2), 0 2px 14px rgba(34, 197, 94, 0.45);
}

.actual-map-marker.pending {
  background: #f59e0b;
  box-shadow: 0 0 0 5px rgba(245, 158, 11, 0.22), 0 2px 14px rgba(245, 158, 11, 0.45);
}

.actual-map-marker.pending.route-1 {
  background: #2563eb;
  box-shadow: 0 0 0 5px rgba(37, 99, 235, 0.2), 0 2px 14px rgba(37, 99, 235, 0.45);
}

.actual-map-marker.pending.route-2 {
  background: #f59e0b;
  box-shadow: 0 0 0 5px rgba(245, 158, 11, 0.22), 0 2px 14px rgba(245, 158, 11, 0.45);
}

.actual-map-marker.pending.route-3 {
  background: #7c3aed;
  box-shadow: 0 0 0 5px rgba(124, 58, 237, 0.2), 0 2px 14px rgba(124, 58, 237, 0.45);
}

.actual-map-marker.pending.route-4 {
  background: #0891b2;
  box-shadow: 0 0 0 5px rgba(8, 145, 178, 0.2), 0 2px 14px rgba(8, 145, 178, 0.45);
}

.actual-map-marker.flagged {
  background: #ef4444;
  box-shadow: 0 0 0 5px rgba(239, 68, 68, 0.22), 0 2px 14px rgba(239, 68, 68, 0.45);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 12px;
}

.form-grid .field {
  grid-column: span 4;
  margin: 0;
}

.form-grid .field.half {
  grid-column: span 6;
}

.form-grid .field.wide {
  grid-column: span 12;
}

.toolbar {
  margin-bottom: 12px;
}

.toolbar input,
.toolbar select {
  min-height: 40px;
  border: 0;
  border-radius: 14px;
  background: #f7f9fb;
  padding: 8px 10px;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
}

.photo-box {
  padding: 12px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 0;
}

.photo-box.locked {
  opacity: 0.72;
}

.photo-preview {
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 1px dashed #d8dee5;
  border-radius: 18px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #fbfdfc;
  color: var(--muted);
  text-align: center;
  font-weight: 800;
}

.photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.proof-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.progress-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.overview-map-shell + .progress-hero {
  margin-top: 14px;
}

.progress-hero h3 {
  margin: 0;
  font-size: 1.35rem;
}

.progress-hero p {
  margin: 4px 0 0;
  color: var(--muted);
}

.route-progress-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 12px;
}

.points-route-selector {
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
}

.progress-detail-grid {
  margin-top: 14px;
}

.route-progress-card {
  width: 100%;
  border: 0;
  border-radius: 18px;
  background: var(--panel);
  box-shadow: 0 10px 28px rgba(20, 31, 45, 0.07);
  padding: 16px;
  color: inherit;
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.route-progress-card:hover,
.route-progress-card:focus-visible {
  box-shadow: 0 16px 34px rgba(20, 31, 45, 0.11);
  transform: translateY(-1px);
}

.route-progress-card:focus-visible {
  outline: 3px solid rgba(0, 106, 78, 0.18);
  outline-offset: 2px;
}

.route-progress-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.route-progress-head h3 {
  margin: 4px 0 0;
}

.route-progress-head > strong {
  color: var(--portal-green);
  font-size: 1.55rem;
}

.progress-bar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8f2ed;
  margin: 14px 0;
}

.progress-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0f766e, #22c55e);
}

.progress-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.progress-metrics div {
  border-radius: 12px;
  background: #f7faf8;
  padding: 10px 8px;
  text-align: center;
}

.progress-metrics strong {
  display: block;
  color: var(--portal-ink);
  font-size: 1.2rem;
}

.progress-metrics span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.progress-point-list {
  display: grid;
  gap: 8px;
}

.progress-point-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid #eef2ef;
  border-radius: 14px;
  background: #fbfdfc;
  padding: 10px 12px;
}

.progress-point-row strong,
.progress-point-row span,
.progress-point-row small {
  display: block;
}

.progress-point-row span {
  color: var(--muted);
  font-size: 0.84rem;
}

.progress-point-row small {
  color: var(--portal-green);
  font-weight: 900;
  text-align: right;
  white-space: nowrap;
}

.progress-point-row.flagged {
  border-color: #fecaca;
  background: #fff7f7;
}

.compact-empty {
  min-height: 96px;
}

.photo-preview-modal {
  width: min(100%, 760px);
}

.approval-photo {
  width: 100%;
  max-height: 58vh;
  object-fit: contain;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  background: #0f172a;
}

.proof-workspace {
  grid-template-columns: minmax(270px, 340px) minmax(0, 1fr);
  align-items: start;
}

.proof-workspace .gps-proof-panel,
.proof-workspace .photo-proof-panel {
  grid-column: auto;
}

.proof-workspace .checkin-form-panel {
  grid-column: 1 / -1;
}

.gps-proof-panel .btn {
  width: 100%;
  justify-content: center;
}

.gps-meter .muted {
  overflow-wrap: anywhere;
}

.gps-meter.warn .distance {
  color: #b45309;
}

.gps-meter.bad .distance {
  color: var(--red);
}

.photo-proof-panel {
  padding: 18px;
}

.photo-proof-panel .photo-grid {
  gap: 16px;
}

.photo-proof-panel .photo-box {
  border: 1px solid #edf2f3;
  box-shadow: none;
}

.photo-proof-panel .photo-box .panel-head {
  min-height: 56px;
  margin-bottom: 10px;
}

.photo-proof-panel .photo-box .panel-head h3 {
  font-size: 1.05rem;
  line-height: 1.2;
}

.photo-proof-panel .photo-box .panel-head p {
  line-height: 1.35;
}

.photo-proof-panel .photo-preview {
  aspect-ratio: 16 / 10;
  min-height: 230px;
  max-height: 360px;
}

.photo-actions {
  margin-top: 12px;
  align-self: end;
}

.photo-actions .btn {
  min-width: 150px;
  justify-content: center;
}

.merged-preview {
  margin-top: 12px;
  border-radius: 18px;
  overflow: hidden;
  background: #f8fafc;
}

.merged-preview img {
  width: 100%;
  display: block;
}

.gps-panel {
  display: grid;
  gap: 10px;
}

.gps-meter {
  min-height: 88px;
  border-radius: 18px;
  border: 0;
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 12px;
  background: #fbfdfc;
}

.gps-meter.good {
  border-color: #86efac;
  background: #f0fdf4;
}

.gps-meter.warn {
  border-color: #fde68a;
  background: #fffbeb;
}

.gps-meter.bad {
  border-color: #fecaca;
  background: #fff1f2;
}

.distance {
  color: var(--portal-green);
  font-size: 1.7rem;
  font-weight: 900;
}

.empty {
  border: 1px dashed #b8c7be;
  border-radius: var(--radius);
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  background: #fbfdfc;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 0;
  border-radius: 22px;
  background: #fff;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid #edf2ef;
  text-align: left;
  vertical-align: top;
  font-size: 0.9rem;
}

th {
  background: #f7f9fb;
  color: #30473b;
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

.thumbs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.thumb {
  width: 54px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  object-fit: cover;
  background: #f8fafc;
}

.photo-history-panel {
  margin-bottom: 16px;
}

.history-controls {
  display: grid;
  grid-template-columns: minmax(240px, 1.4fr) minmax(160px, 0.6fr) auto;
  gap: 12px;
  align-items: end;
}

.history-load-btn {
  min-height: 48px;
  white-space: nowrap;
}

.history-result {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.history-result-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.history-result-head strong,
.history-result-head span {
  display: block;
}

.history-result-head span {
  color: var(--muted);
  margin-top: 3px;
}

.history-photo-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.history-photo-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  background: #fbfdfc;
}

.history-photo-card strong {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
}

.history-photo-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid #dce7e1;
  background: #fff;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 18, 0.42);
}

.modal {
  width: min(100%, 620px);
  max-height: calc(100vh - 36px);
  overflow: auto;
  border: 0;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(15, 42, 28, 0.2);
  padding: 18px;
}

.modal img {
  width: 100%;
  border-radius: var(--radius);
}

.toast-stack {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 100;
  display: grid;
  gap: 8px;
}

.toast {
  max-width: min(360px, calc(100vw - 28px));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 11px 13px;
  color: #fff;
  background: var(--green-800);
  font-weight: 900;
}

.toast.error {
  background: #991b1b;
}

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

@media (max-width: 880px) {
  .proof-workspace {
    grid-template-columns: 1fr;
  }

  .proof-workspace .gps-proof-panel,
  .proof-workspace .photo-proof-panel,
  .proof-workspace .checkin-form-panel {
    grid-column: 1 / -1;
  }

  .span-8,
  .span-6,
  .span-4 {
    grid-column: span 12;
  }

  .form-grid .field,
  .form-grid .field.half {
    grid-column: span 12;
  }

  .topbar {
    align-items: stretch;
  }

  .user-strip {
    width: 100%;
    justify-content: space-between;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 15px;
  }

  .main {
    padding: 0;
  }

  .login-card,
  .panel {
    padding: 12px;
    border-radius: 16px;
  }

  .portal-hub {
    padding: 12px 10px 24px;
  }

  .portal-oneui-toprow {
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
  }

  .portal-oneui-logo {
    width: 32px;
    height: 32px;
    border-radius: 10px;
  }

  .portal-oneui-brand {
    font-size: 0.86rem;
  }

  .portal-clock {
    gap: 7px;
    padding: 6px 8px;
    font-size: 0.72rem;
  }

  .portal-command-meta {
    gap: 6px;
  }

  .portal-command-meta .btn {
    min-height: 32px;
    padding: 7px 10px;
  }

  .dashboard-head {
    margin: 10px 0 8px;
  }

  .dashboard-head h2 {
    font-size: 1.55rem;
  }

  .dashboard-head p,
  .compact-head p {
    font-size: 0.84rem;
  }

  .tabs {
    gap: 6px;
    margin-bottom: 12px;
  }

  .tabs .tab-btn {
    flex: 1 1 0;
    min-height: 38px;
    padding: 8px 10px;
    font-size: 0.86rem;
  }

  .compact-head {
    margin: 8px 0 10px;
  }

  .compact-head h2 {
    font-size: 1.05rem;
  }

  .module-head,
  .panel-head,
  .site-head,
  .route-head,
  .map-status-strip,
  .overview-progress-head,
  .overview-progress-footer,
  .progress-hero {
    flex-direction: column;
    align-items: stretch;
  }

  .route-vehicles {
    justify-content: flex-start;
    max-width: none;
  }

  .route-progress-grid,
  .points-route-selector {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .route-progress-card {
    border-radius: 16px;
    padding: 14px;
  }

  .route-progress-head h3 {
    font-size: 1.15rem;
  }

  .route-progress-head > strong {
    font-size: 1.35rem;
  }

  .progress-metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  .progress-metrics div {
    padding: 8px 4px;
    border-radius: 10px;
  }

  .progress-metrics strong {
    font-size: 1.05rem;
  }

  .progress-metrics span {
    font-size: 0.66rem;
  }

  .route-section {
    border-radius: 16px;
    padding: 12px;
  }

  .route-head {
    gap: 8px;
  }

  .route-head h3 {
    font-size: 1rem;
  }

  .route-crew-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .route-crew-card {
    padding: 10px;
    border-radius: 12px;
  }

  .ops-map {
    min-height: 520px;
  }

  .overview-map-panel .ops-map {
    min-height: 560px;
  }

  .ops-map-metrics,
  .ops-map-legend,
  .ops-map-routes {
    left: 12px;
    right: 12px;
  }

  .ops-map-metrics {
    top: 12px;
  }

  .ops-map-routes {
    bottom: 58px;
  }

  .ops-map-legend {
    bottom: 12px;
  }

  .actual-map-marker {
    width: 20px;
    height: 20px;
  }

  .btn,
  .tab-btn {
    width: 100%;
  }

  .tabs .tab-btn,
  .row-actions .btn,
  .photo-actions .btn,
  .modal-actions .btn {
    width: auto;
    flex: 1 1 130px;
  }

  .photo-grid,
  .site-meta,
  .meta-grid {
    grid-template-columns: 1fr;
  }

  .photo-proof-panel .photo-preview {
    min-height: 190px;
    max-height: none;
  }

  .route-search-panel {
    grid-template-columns: 1fr;
    gap: 7px;
    margin: 12px 0;
  }

  .route-search-panel label {
    font-size: 0.82rem;
  }

  .route-search-panel input {
    min-height: 42px;
    border-radius: 12px;
    padding: 9px 11px;
    font-size: 0.95rem;
  }

  .route-search-panel span {
    padding: 8px 10px;
    font-size: 0.78rem;
    width: fit-content;
  }

  .route-points {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .site-card,
  .checkin-card {
    padding: 12px;
    border-radius: 16px;
  }

  .site-card {
    min-height: 0;
  }

  .site-card .site-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 8px;
    min-height: 0;
  }

  .site-card .site-head h3 {
    font-size: 1.05rem;
    line-height: 1.18;
  }

  .site-card .site-head p {
    margin-top: 6px;
    font-size: 0.9rem;
    line-height: 1.35;
    -webkit-line-clamp: 2;
  }

  .badge {
    min-height: 24px;
    padding: 5px 9px;
    font-size: 0.75rem;
  }

  .site-quick-info {
    margin-top: 10px;
  }

  .site-quick-info span {
    padding: 6px 9px;
    font-size: 0.76rem;
  }

  .site-actions {
    margin-top: 10px;
    padding-top: 10px;
  }

  .site-actions .btn {
    min-height: 42px;
    flex: 1 1 100%;
    font-size: 0.96rem;
    min-width: 0;
  }

  .toolbar input,
  .toolbar select,
  .toolbar .btn {
    width: 100%;
  }

  .history-controls,
  .history-photo-grid {
    grid-template-columns: 1fr;
  }

  .history-result-head {
    display: grid;
    gap: 8px;
  }

  .history-load-btn {
    width: 100%;
  }

  .map-strip {
    grid-template-columns: repeat(25, minmax(10px, 1fr));
  }

  .table-wrap {
    border: 0;
    background: transparent;
    overflow: visible;
  }

  table,
  thead,
  tbody,
  th,
  td,
  tr {
    display: block;
    min-width: 0;
  }

  thead {
    display: none;
  }

  tr {
    margin-bottom: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: 0 5px 14px rgba(21, 64, 38, 0.04);
    overflow: hidden;
  }

  td {
    display: grid;
    grid-template-columns: 114px 1fr;
    gap: 8px;
    border-bottom: 1px solid #edf2ef;
  }

  td::before {
    content: attr(data-label);
    color: #30473b;
    font-size: 0.78rem;
    font-weight: 900;
    text-transform: uppercase;
  }
}
