:root {
  color-scheme: dark;
  --local-analysis-panel-width: 520px;
  --bg: #061219;
  --panel: rgba(8, 24, 32, .97);
  --panel-raised: #0d2530;
  --line: #294651;
  --line-soft: rgba(88, 130, 143, .25);
  --ink: #e9f5f6;
  --muted: #9eb5bd;
  --teal: #59ddc5;
  --cyan: #7dd7ed;
  --amber: #ffca6b;
  --danger: #ff8f81;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { width:100%; height:100%; margin:0; overflow:hidden; background:var(--bg); color:var(--ink); }
button, input, select { font:inherit; }
button, label { -webkit-tap-highlight-color:transparent; }
svg { width:22px; height:22px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }

.local-header {
  position:fixed; z-index:50; inset:0 0 auto 0; height:70px; display:flex; align-items:center; gap:20px;
  padding:0 20px; border-bottom:1px solid var(--line); background:rgba(5,18,25,.94); backdrop-filter:blur(18px);
  box-shadow:0 12px 35px rgba(0,0,0,.24);
}
.local-brand { display:flex; align-items:center; gap:11px; color:var(--ink); text-decoration:none; }
.local-brand img { width:44px; height:44px; object-fit:contain; }
.local-brand span { display:grid; gap:2px; }
.local-brand strong { font-size:18px; letter-spacing:-.35px; }
.local-brand small { color:var(--muted); font-size:8px; font-weight:800; letter-spacing:1.45px; }
.local-session-badge { display:inline-flex; align-items:center; gap:8px; padding:8px 11px; border:1px solid rgba(89,221,197,.42); border-radius:999px; color:#aef5e6; background:rgba(20,76,70,.26); font:800 9px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing:.35px; }
.local-session-badge span { width:7px; height:7px; border-radius:50%; background:var(--teal); box-shadow:0 0 0 4px rgba(89,221,197,.12); }
.local-delivery-profile { padding:7px 10px; border:1px solid #45616b; border-radius:999px; color:var(--muted); background:rgba(12,34,43,.75); font-size:9px; font-weight:800; }
.local-delivery-profile[data-kind="lossless"] { border-color:rgba(89,221,197,.45); color:#aef5e6; background:rgba(20,76,70,.26); }
.local-delivery-profile[data-kind="compact-q92"] { border-color:rgba(255,202,107,.48); color:var(--amber); background:rgba(91,63,18,.24); }
.local-contract { margin-left:auto; color:var(--muted); font:700 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace; }

#local-workspace { position:fixed; inset:70px 0 0; display:grid; grid-template-columns:minmax(0,1fr) var(--local-analysis-panel-width); grid-template-rows:minmax(0,1fr); }
.local-map-stage { position:relative; min-width:0; min-height:0; isolation:isolate; overflow:hidden; background:#0a1a20; }
#local-map { position:absolute; z-index:0; inset:0; background:radial-gradient(circle at 42% 38%,#153741 0,#0b222b 32%,#07171e 72%); }
#local-map::before { content:""; position:absolute; inset:0; opacity:.22; background-image:linear-gradient(rgba(110,194,200,.18) 1px,transparent 1px),linear-gradient(90deg,rgba(110,194,200,.18) 1px,transparent 1px); background-size:40px 40px; }
.leaflet-container { font-family:inherit; }

.local-file-fallback { position:absolute; z-index:5; left:50%; top:50%; width:min(440px,calc(100% - 40px)); transform:translate(-50%,-50%); display:flex; flex-direction:column; align-items:center; padding:31px; border:1px solid #345661; border-radius:22px; background:linear-gradient(150deg,rgba(13,37,47,.98),rgba(6,22,29,.98)); box-shadow:0 30px 90px rgba(0,0,0,.46); text-align:center; }
.local-file-fallback[hidden] { display:none; }
.local-file-fallback img { width:70px; height:70px; margin-bottom:6px; object-fit:contain; }
.eyebrow { margin:0 0 7px; color:var(--teal); font-size:9px; font-weight:820; letter-spacing:1.25px; text-transform:uppercase; }
.local-file-fallback h1 { margin:0; font-size:25px; letter-spacing:-.7px; }
.local-file-fallback > p:not(.eyebrow) { max-width:340px; margin:12px 0 19px; color:var(--muted); font-size:11px; line-height:1.6; }
.local-file-fallback > small { margin-top:14px; color:#78929b; font-size:9px; line-height:1.5; }

.local-button, .local-icon-button, .local-text-button { border:1px solid #36545f; color:var(--ink); background:#102a34; cursor:pointer; }
.local-button { min-height:42px; display:inline-flex; align-items:center; justify-content:center; gap:9px; padding:0 15px; border-radius:10px; font-size:11px; font-weight:780; }
.local-button.primary { border-color:transparent; color:#04221e; background:linear-gradient(135deg,#77ead5,#4fcab9); box-shadow:0 10px 25px rgba(61,207,183,.18); }
.local-button.wide { width:100%; }
.local-button:hover, .local-icon-button:hover { border-color:#67c9c0; filter:brightness(1.08); }
.local-button:disabled, .local-icon-button:disabled, .local-text-button:disabled { opacity:.42; cursor:not-allowed; filter:none; }
.local-icon-button { width:42px; height:42px; display:grid; place-items:center; padding:0; border-radius:11px; }
.local-icon-button.accent { color:var(--teal); border-color:#397b77; }
.local-text-button { padding:5px 8px; border:0; border-radius:7px; color:var(--cyan); background:transparent; font-size:9px; font-weight:800; }
.local-text-button.danger { color:var(--danger); }

.local-map-tools { position:absolute; z-index:4; left:18px; top:18px; display:flex; gap:7px; padding:7px; border:1px solid var(--line); border-radius:14px; background:rgba(6,22,29,.92); box-shadow:0 15px 35px rgba(0,0,0,.25); }
.local-map-status { position:absolute; z-index:4; left:18px; right:18px; bottom:18px; display:flex; align-items:center; justify-content:space-between; gap:16px; padding:11px 14px; border:1px solid var(--line); border-radius:11px; background:rgba(6,22,29,.9); backdrop-filter:blur(12px); }
.local-map-status strong { font-size:10px; }.local-map-status span { color:var(--muted); font:600 9px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace; }

.local-analysis-panel { position:relative; z-index:10; width:var(--local-analysis-panel-width); min-width:0; overflow:hidden; border-left:1px solid var(--line); background:var(--panel); box-shadow:-18px 0 50px rgba(0,0,0,.2); transition:width .22s ease; }
.local-analysis-panel.is-collapsed { width:68px; }
.local-analysis-panel.is-collapsed .panel-heading { padding-inline:12px; justify-content:center; }
.local-analysis-panel.is-collapsed .panel-heading > div, .local-analysis-panel.is-collapsed .panel-scroll { display:none; }
.local-analysis-panel.is-collapsed #toggle-local-analysis-panel svg { transform:rotate(180deg); }
.panel-heading { height:82px; display:flex; align-items:center; justify-content:space-between; gap:12px; padding:16px 19px; border-bottom:1px solid var(--line); }
.panel-heading h2 { margin:0; font-size:20px; letter-spacing:-.45px; }
.panel-heading .eyebrow { margin-bottom:3px; }
.panel-scroll { height:calc(100% - 82px); overflow:auto; overscroll-behavior:contain; transition:opacity .15s ease; }
.panel-section { padding:20px; border-bottom:1px solid var(--line-soft); }
.section-title { display:flex; align-items:center; gap:9px; margin-bottom:16px; }
.section-title > span { width:25px; height:25px; display:grid; place-items:center; border-radius:8px; color:var(--teal); background:#12343a; font:800 8px/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
.section-title h3 { margin:0; font-size:14px; letter-spacing:-.2px; }
.field { display:grid; gap:7px; margin:0 0 13px; color:#b6c8ce; font-size:10px; font-weight:700; }
select, input[type=number], input[type=text] { width:100%; height:42px; border:1px solid #38525c; border-radius:9px; padding:0 12px; color:var(--ink); outline:none; background:#0a1e27; font-size:11px; }
select:focus, input:focus { border-color:var(--teal); box-shadow:0 0 0 3px rgba(89,221,197,.1); }
.unit-input { position:relative; }.unit-input input { padding-right:40px; }.unit-input span { position:absolute; right:13px; top:50%; transform:translateY(-50%); color:var(--muted); font-size:9px; }
.polygon-state { display:grid; grid-template-columns:auto 1fr auto; align-items:center; gap:10px; padding:11px; border:1px dashed #38525c; border-radius:10px; background:rgba(14,38,47,.55); }
.polygon-mark { width:11px; height:11px; transform:rotate(45deg); border:2px solid var(--teal); }
.polygon-state div { display:grid; gap:2px; }.polygon-state strong { font-size:10px; }.polygon-state small { color:var(--muted); font-size:8px; }

.topo-toolbar, .topo-actions { display:flex; flex-wrap:wrap; align-items:center; gap:7px; }
.topo-toolbar { margin-bottom:13px; }
.topo-toolbar .local-icon-button.is-active, .topo-actions .local-icon-button.is-active, .local-icon-button.is-active { color:#041f1b; border-color:var(--teal); background:var(--teal); box-shadow:0 0 0 3px rgba(89,221,197,.12); }
.local-icon-button.danger { color:var(--danger); }
.local-button.compact { min-height:36px; padding-inline:11px; font-size:9px; }
.topo-fields { display:grid; grid-template-columns:1fr 1.4fr; gap:9px; }
.topo-fields .field { min-width:0; }
.check-field { display:flex; align-items:center; gap:8px; margin:-3px 0 13px; color:var(--muted); font-size:9px; line-height:1.35; }
.check-field input { width:15px; height:15px; margin:0; accent-color:var(--teal); }
.topo-actions { margin:0 0 10px; }
.topo-actions .local-button { flex:1; }
.topo-status { min-height:31px; margin:0; padding:8px 10px; border-radius:8px; color:var(--muted); background:rgba(12,34,43,.75); font-size:8px; line-height:1.45; }
.topo-status[data-kind="success"] { color:#aef5e6; }.topo-status[data-kind="error"] { color:var(--danger); }
.slope-box { display:grid; grid-template-columns:1fr auto; gap:8px; margin-top:13px; padding:12px; border:1px solid var(--line); border-radius:11px; background:#091d25; }
.slope-box > div:first-child { display:grid; gap:3px; }.slope-box strong { font-size:10px; }.slope-box small { color:var(--muted); font-size:8px; }
.slope-box .topo-actions { margin:0; }.slope-box p { grid-column:1/-1; margin:2px 0 0; color:#d0dfe2; font:600 8px/1.55 ui-monospace,SFMono-Regular,Menlo,monospace; }
.topo-export-actions { display:grid; grid-template-columns:repeat(3,1fr); gap:7px; margin-top:10px; }
.leaflet-container.is-picking-slope { cursor:crosshair; }
.leaflet-container.is-interpolating-vector { cursor:copy; }
.derived-tools { display:grid; gap:9px; margin-top:10px; padding:12px; border:1px solid var(--line); border-radius:11px; background:rgba(7,25,33,.72); }
.derived-tool { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:end; gap:8px; }
.derived-tool .field { margin:0; }.derived-tool .local-button { min-width:145px; }
.derived-tools > p { margin:0; color:var(--muted); font-size:8px; line-height:1.45; }
#local-profile-chart { display:block; width:100%; height:100px; border:1px solid var(--line); border-radius:8px; background:#06151c; }
#local-profile-chart[hidden] { display:none; }
#local-profile-chart .profile-grid { stroke:#24434e; stroke-width:1; }
#local-profile-chart .profile-line { fill:none; stroke:var(--cyan); stroke-width:2; vector-effect:non-scaling-stroke; }

.result-message { margin-bottom:13px; padding:10px 11px; border-left:3px solid var(--amber); border-radius:3px 9px 9px 3px; color:#c6d5d9; background:rgba(255,202,107,.07); font-size:9px; line-height:1.5; }
.result-grid { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.result-grid > div { min-height:72px; display:flex; flex-direction:column; justify-content:center; gap:6px; padding:12px; border:1px solid var(--line); border-radius:11px; background:#0a2029; }
.result-grid small { color:var(--muted); font-size:8px; font-weight:720; }.result-grid strong { font-size:18px; letter-spacing:-.4px; }
.result-grid .featured-result { border-color:rgba(89,221,197,.45); background:linear-gradient(145deg,rgba(19,61,62,.72),rgba(9,34,41,.9)); }
.result-grid .featured-result strong { color:#b0f4e7; font-size:23px; }
.result-grid .result-wide { grid-column:1/-1; min-height:60px; }.result-grid .result-wide strong { font-size:12px; }
.report-actions { display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-top:12px; }
.calculation-progress { display:grid; gap:7px; margin-top:10px; padding:10px; border:1px solid var(--line); border-radius:9px; background:#091d25; }
.calculation-progress[hidden] { display:none; }
.calculation-progress progress { width:100%; height:7px; accent-color:var(--teal); }
.calculation-progress > div { display:flex; align-items:center; justify-content:space-between; gap:8px; color:var(--muted); font-size:8px; }
.project-actions { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.project-message { margin:10px 0 0; color:var(--muted); font-size:8px; line-height:1.5; }
.local-report-modal { position:fixed; z-index:120; inset:70px 0 0; background:#061219; }
.local-report-modal[hidden] { display:none; }
.local-report-bar { height:52px; display:flex; align-items:center; justify-content:space-between; gap:18px; padding:0 14px 0 20px; border-bottom:1px solid var(--line); background:#0a2029; }
.local-report-bar strong { font-size:11px; letter-spacing:.2px; }
.local-report-bar .local-icon-button { width:34px; height:34px; font-size:24px; line-height:1; }
#local-report-frame { display:block; width:100%; height:calc(100% - 52px); border:0; background:#07151b; }
.local-analysis-panel.is-collapsed + * { pointer-events:auto; }

noscript { position:fixed; z-index:100; inset:auto 20px 20px; padding:14px; border:1px solid var(--danger); border-radius:10px; background:#391e1d; }

@media (max-width: 980px) {
  :root { --local-analysis-panel-width: min(520px, 46vw); }
  .local-contract { display:none; }
  .local-file-fallback { left:46%; }
}
@media (max-width: 760px) {
  html, body { overflow:auto; }
  .local-header { position:sticky; height:62px; padding:0 12px; }.local-brand img { width:38px; height:38px; }.local-brand small { display:none; }
  .local-session-badge { margin-left:auto; }.local-contract { display:none; }
  #local-workspace { position:relative; inset:auto; display:flex; flex-direction:column; min-height:calc(100vh - 62px); }
  .local-map-stage { min-height:56vh; }.local-file-fallback { left:50%; padding:22px; }.local-map-status { align-items:flex-start; flex-direction:column; gap:5px; }
  .local-analysis-panel, .local-analysis-panel.is-collapsed { width:100%; min-height:44vh; border-left:0; border-top:1px solid var(--line); }
  .local-report-modal { inset:62px 0 0; }
  .local-analysis-panel.is-collapsed { min-height:68px; height:68px; }.panel-heading { height:68px; }.panel-scroll { height:auto; }
}
@media (max-width: 480px) {
  .local-brand strong { font-size:15px; }.local-session-badge { padding:7px 8px; font-size:7px; }
  .local-file-fallback img { display:none; }.local-file-fallback h1 { font-size:21px; }
  .report-actions { grid-template-columns:1fr; }
}

/* Panoul și bara rămân în afara straturilor transformate Leaflet. */
#local-workspace.analysis-collapsed { grid-template-columns:minmax(0,1fr) 68px; }
#toggle-local-analysis-panel { flex:0 0 42px; }
.local-analysis-panel { min-height:0; }
.local-map-tools { left:58px; }
.local-map-status { flex-wrap:wrap; pointer-events:none; }
.local-map-status > strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:100%; }
.local-cursor-readout { display:flex; flex-direction:column; gap:4px; min-width:0; }
.local-map-status .local-cursor-readout span { font-size:12px; color:var(--ink); overflow-wrap:anywhere; }
.local-map-status #local-map-elevation { font:700 14px/1.35 ui-monospace,monospace; color:var(--teal); }
@media (max-width:800px) { #local-workspace.analysis-collapsed { grid-template-columns:1fr; } }

/* Rezervă spațiu pentru Feedback când harta ocupă lățimea ferestrei. */
#local-workspace.analysis-collapsed .local-map-status { right:112px; }
@media(max-width:800px) { #local-workspace.analysis-collapsed .local-map-status { right:18px; bottom:76px; } }

.local-dxf-actions {display:flex;flex-wrap:wrap;gap:8px;}
#local-dxf-layers {display:grid;gap:8px;max-height:200px;overflow:auto;}
#local-dxf-layers label {display:flex;gap:9px;align-items:center;color:#ffdc57;overflow-wrap:anywhere;}
#local-dxf-layers input {width:auto;}
#local-dxf-status {overflow-wrap:anywhere;max-height:180px;overflow:auto;}
