:root {
  --command-orange: #ff4f17;
  --command-orange-deep: #e9430f;
  --command-ink: #15181d;
  --command-muted: #707782;
  --command-line: #d9dee5;
  --command-soft: #f5f7f9;
  --command-green: #258a42;
  --command-red: #d92d20;
  --command-amber: #b54708;
  --command-shadow: 0 8px 28px rgba(17, 24, 39, .06);
}

body {
  color: var(--command-ink);
  background: #f3f5f7;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.lift-title-row { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.lift-class-badge,
.lift-readiness-badge {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  padding: 4px 9px;
  border: 1px solid #ffc3b0;
  border-radius: 7px;
  color: #b42318;
  background: #fff7f4;
  font-size: 11px;
  font-weight: 800;
}
.lift-readiness-badge { border-color: #a6d9b3; color: #176b34; background: #f3fbf5; }
.lift-readiness-badge[data-tone="warning"] { border-color: #f5c98c; color: #8a4b08; background: #fff9ef; }
.lift-readiness-badge[data-tone="danger"] { border-color: #f4a6a0; color: #a92118; background: #fff5f4; }

@media (min-width: 1200px) {
  body.minimal-app-ui .global-nav.lift-plan-step-nav {
    width: 186px;
    padding: 28px 18px 18px;
    gap: 3px;
  }
  body.minimal-app-ui .global-nav.lift-plan-step-nav::before {
    margin-bottom: 18px;
    color: var(--command-orange);
  }
  body.minimal-app-ui .global-nav.lift-plan-step-nav a,
  body.minimal-app-ui .global-nav.lift-plan-step-nav button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 42px;
    padding: 7px 8px;
    border: 0;
    border-radius: 8px;
    color: #cdd3db;
    background: transparent;
    box-shadow: none;
    text-align: left;
    font-size: 12px;
  }
  body.minimal-app-ui .global-nav.lift-plan-step-nav a:hover,
  body.minimal-app-ui .global-nav.lift-plan-step-nav button:hover { color: #fff; background: rgba(255,255,255,.07); }
  .lift-nav-home { margin-bottom: 8px; }
  .lift-nav-heading {
    margin: 0 8px 8px;
    color: #737b87;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 1.2px;
    text-transform: uppercase;
  }
  .lift-step-button span {
    display: grid;
    place-items: center;
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    border: 1px solid #59616d;
    border-radius: 50%;
    color: #e5e7eb;
    font-size: 11px;
  }
  .lift-step-button b { font-weight: 700; }
  .lift-step-button.is-active { color: var(--command-orange) !important; background: rgba(255,79,23,.08) !important; }
  .lift-step-button.is-active span { border-color: var(--command-orange); color: #fff; background: var(--command-orange); }
  .lift-nav-progress { margin: 14px 0 2px; padding: 10px; border: 1px solid #424a56; border-radius: 8px; color: #fff; }
  .lift-nav-progress > div:first-child { display: flex; justify-content: space-between; gap: 8px; font-size: 8px; }
  .lift-nav-progress strong { font-size: 8px; }
  .lift-nav-progress-track { height: 5px; margin-top: 7px; overflow: hidden; border-radius: 4px; background: #343b45; }
  .lift-nav-progress-track i { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--command-orange); transition: width .25s ease; }
  .lift-nav-spacer { flex: 1; min-height: 18px; }
  body.minimal-app-ui .page { width: calc(100% - 186px); max-width: none; margin-left: 186px; }
  .safety-banner { display: none; }
}

.app-header {
  min-height: 78px;
  padding: 13px 22px;
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(18px);
}
.app-title img { width: 40px; height: 40px; }
.app-title h1 { font-size: 26px; }
.header-actions button { min-height: 40px; padding: 8px 17px; border-radius: 8px; font-size: 12px; }
.header-actions .success { border-color: var(--command-orange); background: var(--command-orange); }

.lift-command-center { padding: 14px 20px 28px; }
.lift-mobile-step-strip { display: none; }
.lift-mobile-command-actions { display: none; }
.command-dashboard { display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 12px; max-width: 1500px; margin: 0 auto; }
.command-primary { display: grid; gap: 10px; min-width: 0; }
.command-card {
  border: 1px solid var(--command-line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 1px 1px rgba(17,24,39,.025);
}
.command-meta {
  display: grid;
  grid-template-columns: .72fr 1.1fr 1.35fr .48fr .48fr;
  min-height: 72px;
  padding: 12px 14px;
  align-items: center;
}
.command-meta-item { min-width: 0; padding: 0 14px; border-right: 1px solid var(--command-line); }
.command-meta-item:first-child { padding-left: 0; }
.command-meta-item:last-child { padding-right: 0; border-right: 0; }
.command-meta-item span { display: block; color: var(--command-muted); font-size: 9px; text-transform: uppercase; letter-spacing: .45px; }
.command-meta-item strong { display: block; overflow: hidden; margin-top: 5px; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.command-meta-item small { display: block; overflow: hidden; margin-top: 2px; color: var(--command-muted); text-overflow: ellipsis; white-space: nowrap; font-size: 9px; }

.command-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); min-height: 84px; }
.command-kpi { display: grid; grid-template-columns: 42px 1fr; gap: 10px; align-items: center; padding: 13px 16px; border-right: 1px solid var(--command-line); }
.command-kpi:last-child { border-right: 0; }
.command-kpi-icon { display: grid; place-items: center; width: 40px; height: 40px; color: var(--command-orange); }
.command-kpi-icon svg { width: 38px; height: 38px; stroke: currentColor; fill: none; stroke-width: 1.7; }
.command-kpi span { display: block; color: var(--command-muted); font-size: 10px; }
.command-kpi > .command-kpi-icon { color: var(--command-orange); }
.command-kpi strong { display: inline-block; margin-top: 2px; font-size: clamp(21px, 2.2vw, 31px); line-height: 1; letter-spacing: -.7px; }
.command-kpi em { margin-left: 3px; color: #39404a; font-size: 13px; font-style: normal; font-weight: 700; }

.command-lift-visual { position: relative; min-height: 365px; overflow: hidden; padding: 42px 12px 10px; }
.command-panel-title { position: absolute; z-index: 3; top: 14px; left: 16px; font-size: 11px; font-weight: 900; }
.command-lift-visual .geometry-figure { height: 310px; margin: 0; padding: 0; border: 0; box-shadow: none; background: transparent; }
.command-lift-visual .geometry-figure svg { width: 100%; height: 100%; max-height: none; }
.command-lift-visual .geometry-figure svg > .diagram-title,
.command-lift-visual .geometry-figure svg > .diagram-title + .diagram-note { display: none; }
.command-crane-asset { position: absolute; inset: 39px 18px 25px 18px; width: calc(100% - 36px); height: calc(100% - 64px); object-fit: contain; object-position: center bottom; }
.command-ground-line { position: absolute; right: 24px; bottom: 24px; left: 24px; border-top: 1px solid #9ca3af; }
.command-dimension { position: absolute; z-index: 3; color: #3b424c; font-size: 9px; font-weight: 700; }
.command-dimension strong { display: block; color: #111318; font-size: 11px; }
.command-dimension--boom { top: 37%; left: 31%; transform: rotate(-27deg); transform-origin: left center; }
.command-dimension--radius { bottom: 14px; left: 53%; min-width: 118px; padding: 3px 9px; border-bottom: 1px solid #555d67; background: rgba(255,255,255,.9); text-align: center; }
.command-dimension--height { top: 28%; right: 7%; padding-left: 8px; border-left: 1px solid #555d67; }
.command-exclusion { position: absolute; z-index: 2; right: 19%; bottom: 25px; height: 55%; border-left: 1px dashed #ef4444; color: #e11d48; }
.command-exclusion span { position: absolute; bottom: 4px; left: 7px; width: 90px; font-size: 9px; font-weight: 800; }
.command-visual-note { position: absolute; z-index: 3; right: 16px; bottom: 7px; color: var(--command-muted); font-size: 8px; }

.command-mini-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.command-mini-card { position: relative; min-height: 244px; overflow: hidden; padding: 36px 12px 9px; }
.command-mini-card h3 { position: absolute; top: 12px; left: 14px; margin: 0; font-size: 12px; }
.command-mini-card .geometry-figure { height: 196px; margin: 0; padding: 0; border: 0; box-shadow: none; background: transparent; }
.command-mini-card .geometry-figure svg { width: 100%; height: 100%; max-height: none; }
.command-mini-card .geometry-figure svg > .diagram-title,
.command-mini-card .geometry-figure svg > .diagram-title + .diagram-note { display: none; }
.command-top-view { position: relative; height: 166px; }
.command-top-view::before,
.command-top-view::after { content: ""; position: absolute; top: 8px; bottom: 8px; left: 50%; border-left: 1px dashed #9ca3af; }
.command-top-view::after { inset: 50% 8px auto; border-top: 1px dashed #9ca3af; border-left: 0; }
.command-radius-ring { position: absolute; top: 13px; left: 50%; width: 138px; height: 138px; transform: translateX(-50%); border: 1.5px dashed var(--command-green); border-radius: 50%; }
.command-radius-ring::after { content: ""; position: absolute; inset: -18px; border: 1.5px dashed #ef4444; border-radius: 50%; }
.command-crane-top { position: absolute; top: 50%; left: 50%; width: 108px; height: 24px; transform: translate(-50%,-50%); border: 2px solid #5b6470; border-radius: 4px; background: #eef1f4; }
.command-crane-top::after { content: ""; position: absolute; top: 8px; left: 46px; width: 76px; border-top: 5px solid #5b6470; transform: rotate(-30deg); transform-origin: left center; }
.command-radius-label { position: absolute; right: 2px; top: 15px; color: var(--command-green); font-size: 9px; font-weight: 800; }

.command-signatures { display: grid; grid-template-columns: repeat(3, 1fr); min-height: 66px; padding: 10px 14px; }
.command-signature { padding: 0 15px; border-right: 1px solid var(--command-line); }
.command-signature:last-child { border-right: 0; }
.command-signature span { display: block; color: var(--command-muted); font-size: 9px; }
.command-signature strong { display: block; margin-top: 4px; font-size: 11px; }
.command-signature small { display: block; margin-top: 8px; color: var(--command-muted); font-size: 8px; }

.command-side { display: grid; align-content: start; gap: 10px; }
.command-side-card { padding: 14px; }
.command-side-card h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 11px; font-size: 13px; }
.command-side-card h3 svg { width: 22px; height: 22px; color: var(--command-green); }
.command-check { display: grid; grid-template-columns: 24px 1fr; gap: 8px; align-items: start; padding: 10px 0; border-top: 1px solid var(--command-line); }
.command-check-icon { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; color: #fff; background: var(--command-green); font-size: 12px; font-weight: 900; }
.command-check[data-state="pending"] .command-check-icon { background: #d97706; }
.command-check[data-state="blocked"] .command-check-icon { background: var(--command-red); }
.command-check strong { display: block; font-size: 11px; }
.command-check span { display: block; margin-top: 3px; color: var(--command-muted); font-size: 9px; line-height: 1.3; }
.command-chart-table { width: 100%; border-collapse: collapse; font-size: 9px; }
.command-chart-table td { padding: 7px 0; border-top: 1px solid var(--command-line); vertical-align: top; }
.command-chart-table td:first-child { color: var(--command-muted); }
.command-chart-table td:last-child { text-align: right; font-weight: 700; }
.command-chart-table .is-good { color: var(--command-green); font-size: 13px; }
.command-editor-cta { width: 100%; border-color: var(--command-orange); color: #fff; background: var(--command-orange); }

.lift-editor-heading { display: none; align-items: center; justify-content: space-between; gap: 16px; margin: 18px 20px 0; padding: 14px 16px; border: 1px solid var(--command-line); border-radius: 10px; background: #fff; }
.lift-editor-heading span { display: block; color: var(--command-orange); font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: .8px; }
.lift-editor-heading strong { display: block; margin-top: 4px; font-size: 13px; }
.workspace { display: none; grid-template-columns: minmax(0, 1fr); max-width: 1100px; margin: 0 auto; padding: 12px 20px 36px; }
body.lift-editor-open .lift-command-center { display: none; }
body.lift-editor-open .lift-editor-heading { display: flex; }
body.lift-editor-open .workspace { display: grid; }
.editor { max-height: none; overflow: visible; }
.preview-shell { display: none; }
body.lift-preview-open .workspace { display: block; }
body.lift-preview-open .editor { display: none; }
.preview-shell.is-open {
  position: fixed;
  z-index: 250;
  inset: 0;
  display: block;
  overflow: auto;
  padding: 54px 18px 32px;
  background: rgba(14,18,23,.88);
}
.preview-shell.is-open .preview-close {
  position: fixed !important;
  z-index: 2;
  top: 12px !important;
  right: 18px !important;
  bottom: auto !important;
  left: auto !important;
  display: inline-flex !important;
  width: auto !important;
  min-width: 116px;
  min-height: 36px;
  padding: 7px 13px !important;
  border-color: #fff !important;
  border-radius: 8px !important;
  color: #fff !important;
  background: #20242a !important;
  box-shadow: 0 8px 22px rgba(0,0,0,.25);
}
.preview-shell.is-open .paper { width: min(297mm, 96vw); margin: 0 auto; }

.doc-command-page { position: relative; display: grid; grid-template-columns: 34mm minmax(0, 1fr); min-height: 210mm; margin: -10mm -10mm 0; color: var(--command-ink); background: #f5f6f8; break-after: page; page-break-after: always; }
.command-doc-rail { display: flex; padding: 7mm 4mm; flex-direction: column; color: #fff; background: linear-gradient(180deg, #171a1f 0%, #111318 100%); }
.command-doc-rail > strong { color: var(--command-orange); font-size: 13pt; letter-spacing: .4pt; }
.command-doc-rail > span { font-size: 11pt; }
.command-doc-rail ol { display: grid; gap: 5mm; margin: 9mm 0 0; padding: 0; list-style: none; counter-reset: lift-step; }
.command-doc-rail li { display: grid; grid-template-columns: 6mm 1fr; gap: 2mm; align-items: center; color: #d3d8df; font-size: 6.8pt; counter-increment: lift-step; }
.command-doc-rail li::before { content: counter(lift-step); display: grid; place-items: center; width: 6mm; height: 6mm; border: .3mm solid #77808b; border-radius: 50%; color: #fff; }
.command-doc-rail li:first-child { color: var(--command-orange); }
.command-doc-rail li:first-child::before { border-color: var(--command-orange); background: var(--command-orange); }
.command-doc-body { min-width: 0; padding: 5mm; }
.command-doc-header { display: flex; align-items: center; justify-content: space-between; gap: 4mm; min-height: 10mm; margin-bottom: 2mm; }
.command-doc-header > div { display: flex; align-items: center; gap: 3mm; }
.command-doc-header h1 { margin: 0; font-size: 20pt; letter-spacing: -.5pt; }
.command-doc-header span,
.command-doc-header > strong { padding: 1.4mm 2.4mm; border: .3mm solid #f4a38a; border-radius: 1.5mm; color: #b42318; background: #fff7f4; font-size: 6.5pt; }
.command-doc-header > strong { border-color: #a6d9b3; color: #176b34; background: #f3fbf5; }
.doc-command-page .command-dashboard { grid-template-columns: minmax(0, 1fr) 52mm; gap: 2.3mm; max-width: none; }
.doc-command-page .command-primary { gap: 2.1mm; }
.doc-command-page .command-card { border-radius: 2mm; box-shadow: none; }
.doc-command-page .command-meta { min-height: 15mm; padding: 2.6mm 3mm; }
.doc-command-page .command-meta-item { padding: 0 2.5mm; }
.doc-command-page .command-meta-item span { font-size: 5.7pt; }
.doc-command-page .command-meta-item strong { margin-top: 1mm; font-size: 7.7pt; }
.doc-command-page .command-meta-item small { font-size: 5.5pt; }
.doc-command-page .command-kpis { min-height: 18mm; }
.doc-command-page .command-kpi { grid-template-columns: 8mm 1fr; gap: 1.5mm; padding: 2mm 3mm; }
.doc-command-page .command-kpi-icon { width: 7mm; height: 7mm; }
.doc-command-page .command-kpi-icon svg { width: 7mm; height: 7mm; }
.doc-command-page .command-kpi span { font-size: 5.8pt; }
.doc-command-page .command-kpi strong { font-size: 17pt; }
.doc-command-page .command-kpi em { font-size: 7.5pt; }
.doc-command-page .command-lift-visual { min-height: 82mm; }
.doc-command-page .command-panel-title { top: 2.5mm; left: 3mm; font-size: 6.8pt; }
.doc-command-page .command-lift-visual .geometry-figure { height: 73mm; }
.doc-command-page .command-crane-asset { inset: 8mm 3mm 4mm; width: calc(100% - 6mm); height: calc(100% - 12mm); }
.doc-command-page .command-dimension { font-size: 5.6pt; }
.doc-command-page .command-dimension strong { font-size: 6.7pt; }
.doc-command-page .command-visual-note { font-size: 5pt; }
.doc-command-page .command-mini-grid { gap: 2mm; }
.doc-command-page .command-mini-card { min-height: 47mm; padding: 7mm 2mm 1mm; }
.doc-command-page .command-mini-card h3 { top: 2.4mm; left: 2.7mm; font-size: 6.2pt; }
.doc-command-page .command-mini-card .geometry-figure,
.doc-command-page .command-top-view { height: 37mm; }
.doc-command-page .command-radius-ring { width: 30mm; height: 30mm; }
.doc-command-page .command-signatures { min-height: 14mm; padding: 2mm 3mm; }
.doc-command-page .command-signature { padding: 0 2.5mm; }
.doc-command-page .command-signature span,
.doc-command-page .command-signature small { font-size: 5.5pt; }
.doc-command-page .command-signature strong { font-size: 7pt; }
.doc-command-page .command-side { gap: 2mm; }
.doc-command-page .command-side-card { padding: 2.7mm; }
.doc-command-page .command-side-card h3 { margin-bottom: 2mm; font-size: 8pt; }
.doc-command-page .command-check { grid-template-columns: 5mm 1fr; gap: 1.4mm; padding: 2mm 0; }
.doc-command-page .command-check-icon { width: 4.5mm; height: 4.5mm; font-size: 6pt; }
.doc-command-page .command-check strong { font-size: 6.4pt; }
.doc-command-page .command-check span { margin-top: .5mm; font-size: 5.5pt; }
.doc-command-page .command-chart-table { font-size: 5.6pt; }
.doc-command-page .command-chart-table td { padding: 1.6mm 0; }
.doc-command-page .command-editor-cta { display: none; }
.doc-detail-pages { break-before: page; page-break-before: always; }

@media (max-width: 1199px) {
  .lift-plan-step-nav { display: none !important; }
  .page { width: 100%; margin: 0; }
  .lift-command-center { padding: 10px 12px 28px; }
  .lift-mobile-step-strip { display: flex; gap: 7px; overflow-x: auto; margin-bottom: 10px; padding: 2px 0 5px; scrollbar-width: none; }
  .lift-mobile-step-strip::-webkit-scrollbar { display: none; }
  .lift-mobile-step-strip button { flex: 0 0 auto; min-height: 34px; padding: 6px 12px; border-radius: 18px; font-size: 11px; }
  .lift-mobile-step-strip button.is-active { color: #fff; border-color: var(--command-orange); background: var(--command-orange); }
  .command-dashboard { grid-template-columns: minmax(0, 1fr); }
  .command-side { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .command-side .command-editor-cta { grid-column: 1 / -1; }
  .safety-banner { margin: 10px 12px 0; }
}

@media (max-width: 767px) {
  .app-header, .mobile-install-prompt, .mobile-bottom-tabs, .mobile-fab { display: none !important; }
  .lift-mobile-command-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin: 0 0 10px; }
  .lift-mobile-command-actions button { min-height: 37px; padding: 7px 8px; font-size: 10px; }
  .lift-mobile-command-actions .success { border-color: var(--command-orange); background: var(--command-orange); }
  .safety-banner { padding: 9px 10px; font-size: 11px; }
  .command-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 10px; }
  .command-meta-item { padding: 8px; border-right: 0; border-bottom: 1px solid var(--command-line); }
  .command-meta-item:last-child { border-bottom: 0; }
  .command-meta-item:nth-last-child(2) { border-bottom: 0; }
  .command-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .command-kpi { min-height: 74px; padding: 10px; border-bottom: 1px solid var(--command-line); }
  .command-kpi:nth-child(2) { border-right: 0; }
  .command-kpi:nth-last-child(-n+2) { border-bottom: 0; }
  .command-kpi strong { font-size: 23px; }
  .command-lift-visual { min-height: 270px; }
  .command-lift-visual .geometry-figure { height: 225px; }
  .command-crane-asset { inset: 42px 4px 28px; width: calc(100% - 8px); height: calc(100% - 70px); }
  .command-dimension--boom { top: 39%; left: 27%; }
  .command-dimension--height { right: 2%; }
  .command-mini-grid { grid-template-columns: 1fr; }
  .command-mini-card { min-height: 205px; }
  .command-signatures { grid-template-columns: 1fr; gap: 9px; }
  .command-signature { padding: 0; border-right: 0; border-bottom: 1px solid var(--command-line); }
  .command-signature:last-child { border-bottom: 0; }
  .command-side { grid-template-columns: 1fr; }
  .lift-editor-heading { align-items: flex-start; margin: 10px 10px 0; }
  .lift-editor-heading button { min-width: 92px; font-size: 10px; }
  .workspace { padding: 8px 10px 90px; }
  .preview-shell.is-open { padding: 50px 0 20px; }
  .preview-shell.is-open .paper { width: 297mm; transform: scale(.34); transform-origin: top left; margin: 0; }
}

@media print {
  @page { size: A4 landscape; margin: 0; }
  html, body { width: 297mm; background: #fff; }
  .global-nav, .app-header, .safety-banner, .lift-command-center, .lift-editor-heading, .editor, .preview-close, .mobile-nav-shell, .mobile-app-topbar, .mobile-bottom-tabs { display: none !important; }
  .page, .workspace, .preview-shell { display: block !important; width: 297mm !important; max-width: none !important; margin: 0 !important; padding: 0 !important; }
  .preview-shell { position: static !important; overflow: visible !important; background: #fff !important; }
  .paper, .preview-shell.is-open .paper { width: 297mm !important; min-height: 210mm !important; margin: 0 !important; padding: 10mm !important; transform: none !important; box-shadow: none !important; }
  .doc-photo { min-height: 183mm; }
  .doc-photo img { height: 160mm; }
  .document-annex-page { min-height: 183mm; }
  .document-annex-image { min-height: 148mm; }
  .document-annex-image img { max-height: 148mm; }
}
