:root { color-scheme: light; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: #f3f5f8; color: #162033; }
* { box-sizing: border-box; }
body { margin: 0; }
a { color: #2457c5; text-decoration: none; }
a:hover { text-decoration: underline; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 32px; min-height: 64px; padding: 0 32px; color: white; background: #111827; box-shadow: 0 4px 18px rgba(0,0,0,.12); }
.topbar a { color: #e5e7eb; }
.brand { font-size: 1.25rem; font-weight: 800; letter-spacing: .03em; }
.topbar nav { display: flex; gap: 20px; }
.top-actions { margin-left: auto; display: flex; gap: 14px; }
.container { max-width: 1580px; margin: 0 auto; padding: 30px; }
h1, h2, h3 { margin-top: 0; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.page-heading h1 { margin: 8px 0 4px; }
.page-heading p, small { color: #657087; }
.card { background: white; border: 1px solid #dfe4ec; border-radius: 14px; padding: 22px; box-shadow: 0 8px 28px rgba(26, 39, 66, .06); margin-bottom: 24px; }
.login-card { width: min(420px, 100%); margin: 10vh auto; }
.stack, .form-grid { display: grid; gap: 16px; }
.form-grid { grid-template-columns: repeat(3, minmax(180px, 1fr)) auto; align-items: end; }
label { display: grid; gap: 7px; font-weight: 650; font-size: .9rem; }
input, select { width: 100%; min-height: 42px; border: 1px solid #c9d1de; border-radius: 8px; padding: 9px 11px; font: inherit; background: white; }
button, .button { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; border: 0; border-radius: 8px; padding: 9px 15px; color: white; background: #2457c5; font: inherit; font-weight: 750; cursor: pointer; text-decoration: none; }
button:hover, .button:hover { filter: brightness(.95); text-decoration: none; }
button:disabled, .button:disabled { opacity: .5; cursor: not-allowed; }
.secondary { background: #e8edf7; color: #20365f; }
.danger { background: #b42318; color: white; }
.button-row, .download-row { display: flex; flex-wrap: wrap; gap: 10px; }
.table-card { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 12px; border-bottom: 1px solid #e6eaf0; text-align: left; vertical-align: middle; }
th { color: #5d687d; font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; }
td strong, td small { display: block; }
.status { display: inline-block; padding: 4px 9px; border-radius: 999px; background: #edf1f7; font-size: .82rem; }
.status-completed { background: #dcfce7; color: #166534; }
.status-failed { background: #fee2e2; color: #991b1b; }
.status-active { background: #dbeafe; color: #1d4ed8; }
.status-processing, .status-queued { background: #fef3c7; color: #92400e; }
.status-not_processed { background: #f1f5f9; color: #475569; }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }
.metric { background: white; border: 1px solid #dfe4ec; border-radius: 12px; padding: 16px; }
.metric span, .metric strong { display: block; }
.metric span { color: #6a7487; font-size: .82rem; margin-bottom: 6px; }
.viewer-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 16px; }
.viewer-controls { display: grid; align-content: start; gap: 14px; }
.checkbox { display: flex; align-items: center; gap: 8px; }
.checkbox input { width: auto; min-height: auto; }
.ply-viewer { position: relative; width: 100%; height: min(72vh, 760px); min-height: 520px; overflow: hidden; border-radius: 10px; background: #111827; }
.projection-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.projection-grid article { min-width: 0; }
.projection-grid img { width: 100%; max-height: 520px; object-fit: contain; border: 1px solid #dfe4ec; border-radius: 8px; background: #111827; margin-bottom: 10px; }
.inline-form { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; margin: 12px 0; }
.image-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.image-gallery .card { margin: 0; display: grid; gap: 8px; }
.image-gallery img { width: 100%; border-radius: 8px; }
.error { color: #b42318; background: #fff0ee; border-radius: 8px; padding: 10px; }
.language-links { margin-top: 18px; text-align: center; }

/* RoboOS Mapping Platform v2 */
.back-link { display: inline-block; margin-bottom: 4px; font-weight: 700; }
.mapping-detail-heading { align-items: center; }
.mapping-metrics { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.mapping-metrics .metric strong { overflow-wrap: anywhere; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 18px; }
.section-heading h2 { margin-bottom: 5px; }
.section-heading p { margin: 0; color: #657087; max-width: 920px; }
.section-heading.compact { margin-bottom: 14px; }
.is-hidden { display: none !important; }
.progress-track { width: 100%; height: 12px; overflow: hidden; border-radius: 999px; background: #e8edf5; }
.progress-fill { height: 100%; min-width: 2px; border-radius: inherit; background: linear-gradient(90deg, #2563eb, #06b6d4); transition: width .3s ease; }
.processing-card { border-color: #bfdbfe; background: linear-gradient(135deg, #ffffff, #eff6ff); }
.viewer-inline-controls { display: flex; align-items: flex-end; gap: 14px; }
.viewer-inline-controls label { min-width: 150px; }
.subtle-status { color: #64748b; font-size: .88rem; padding-bottom: 11px; }
.modern-viewer-layout { grid-template-columns: 235px minmax(0, 1fr); }
.viewer-controls label > span { margin-left: auto; color: #475569; font-variant-numeric: tabular-nums; }
.viewer-controls label:not(.checkbox) { grid-template-columns: 1fr auto; }
.viewer-controls label:not(.checkbox) input { grid-column: 1 / -1; }
.viewer-placeholder { position: absolute; inset: 0; display: grid; place-items: center; color: #cbd5e1; z-index: 1; pointer-events: none; }
.button-grid { display: grid; gap: 8px; }
.button-grid.two-column { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.plan-card { padding-bottom: 24px; }
.plan-toolbar { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.plan-toolbar button { min-height: 36px; padding: 7px 11px; }
.plan-toolbar .active-layer { background: #2457c5; color: white; }
.plan-workspace { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 16px; min-height: 660px; }
.plan-sidebar { display: grid; align-content: start; gap: 12px; padding: 16px; border: 1px solid #dfe4ec; border-radius: 12px; background: #f8fafc; }
.plan-sidebar h3 { margin: 0 0 2px; font-size: 1rem; }
.plan-sidebar hr { width: 100%; border: 0; border-top: 1px solid #dfe4ec; margin: 4px 0; }
.plan-sidebar .hint { margin: 0; color: #64748b; font-size: .82rem; line-height: 1.45; }
.active-tool { background: #1d4ed8; box-shadow: 0 0 0 4px rgba(37, 99, 235, .18); }
.plan-scale-readout { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 2px; padding: 9px 11px; border-radius: 8px; background: #e8edf7; color: #334155; font-size: .84rem; }
.plan-viewport { position: relative; min-width: 0; min-height: 660px; overflow: hidden; border: 1px solid #cfd8e6; border-radius: 12px; background: #f8fafc; touch-action: none; }
.plan-viewport:fullscreen { width: 100vw; height: 100vh; border: 0; border-radius: 0; }
.plan-viewport svg { width: 100%; height: 100%; display: block; cursor: grab; user-select: none; }
.plan-viewport svg:active { cursor: grabbing; }
#measurementLayer text { pointer-events: none; }
.empty-state { display: grid; place-items: center; min-height: 260px; padding: 30px; text-align: center; border: 1px dashed #cbd5e1; border-radius: 12px; background: #f8fafc; }
.empty-state h3 { margin-bottom: 8px; }
.empty-state p { margin: 0; color: #64748b; }
.two-card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.two-card-grid > .card { min-width: 0; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: end; }
.settings-grid > button { grid-column: 1 / -1; }
.settings-grid .checkbox { align-self: center; min-height: 42px; }
.hint { color: #64748b; font-size: .84rem; line-height: 1.5; }
details.card { padding: 0; }
details.card > summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 22px; cursor: pointer; list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::after { content: "+"; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: #e8edf7; color: #20365f; font-size: 1.25rem; }
details.card[open] > summary::after { content: "−"; }
details.card > summary span { margin-left: auto; color: #64748b; font-size: .84rem; font-weight: 500; }
.legacy-content, .diagnostic-links { padding: 0 22px 22px; }
.legacy-form { grid-template-columns: repeat(4, minmax(130px, 1fr)) auto; }
.legacy-downloads, .diagnostic-links { margin-top: 16px; }
.diagnostic-links a, .legacy-downloads a { display: inline-flex; min-height: 36px; align-items: center; padding: 7px 11px; border-radius: 8px; background: #edf2f9; }
.mapping-table-card td small { margin-top: 4px; }
.mapping-table-card .status + small { margin-top: 5px; }
.upload-card input[type="file"] { padding-top: 8px; }

@media (max-width: 1200px) {
  .mapping-metrics { grid-template-columns: repeat(3, 1fr); }
  .two-card-grid { grid-template-columns: 1fr; }
  .plan-workspace { grid-template-columns: 205px minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .form-grid, .metrics, .projection-grid, .viewer-layout, .plan-workspace, .settings-grid { grid-template-columns: 1fr; }
  .topbar { padding: 0 16px; gap: 14px; }
  .container { padding: 18px; }
  .page-heading, .section-heading { align-items: flex-start; flex-direction: column; }
  .ply-viewer { min-height: 420px; }
  .plan-viewport { min-height: 520px; }
  .plan-workspace { min-height: 0; }
  .plan-toolbar { justify-content: flex-start; }
  .legacy-form { grid-template-columns: 1fr; }
  .mapping-metrics { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .mapping-metrics { grid-template-columns: 1fr; }
  .topbar nav { display: none; }
  .button-row { width: 100%; }
  .button-row > * { flex: 1 1 auto; }
}
