/* ── Shared Nav Styles ─────────────────────────────────────────── */
.site-nav {
  display: flex;
  align-items: center;
  padding: 0 32px;
  height: 60px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  gap: 32px;
  font-family: 'Inter', sans-serif;
}
.site-nav .nav-brand {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.3px;
}
.site-nav .nav-brand span { color: var(--accent); }
.site-nav .nav-links {
  display: flex;
  gap: 24px;
  flex: 1;
}
.site-nav .nav-links a {
  color: var(--text2);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.15s;
}
.site-nav .nav-links a:hover { color: var(--text); }
.site-nav .nav-links a.active { color: var(--accent); }
.site-nav .nav-cta {
  padding: 8px 18px;
  background: var(--accent);
  color: #fff;
  border-radius: 6px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.15s;
  white-space: nowrap;
}
.site-nav .nav-cta:hover { background: var(--accent2); }

/* ── Reset & Base ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
:root {
  --bg:        #0f1117;
  --surface:   #1a1d27;
  --surface2:  #22263a;
  --surface3:  #2a2e42;
  --border:    #2e3250;
  --border2:   #3a3f5c;
  --text:      #e2e4f0;
  --text2:     #8b90b0;
  --text3:     #555a7a;
  --accent:    #4f7cff;
  --accent2:   #3a62e0;
  --green:     #2dd4bf;
  --orange:    #f97316;
  --red:       #f43f5e;
  --yellow:    #fbbf24;
  --radius:    8px;
  --radius-sm: 5px;
}
body { margin:0; font-family:'Inter',sans-serif; background:var(--bg); color:var(--text); font-size:14px; line-height:1.5; height:100vh; overflow:hidden; display:flex; flex-direction:column; }

/* ── Topbar ───────────────────────────────────────────────────── */
#topbar {
  display:flex; align-items:center; gap:8px; flex-shrink:0;
  background:var(--surface); border-bottom:1px solid var(--border);
  padding:0 16px; height:52px;
}
#topbar .brand { font-weight:700; font-size:15px; color:var(--text); letter-spacing:-0.3px; margin-right:8px; white-space:nowrap; }
#topbar .brand span { color:var(--accent); }
.tb-sep { width:1px; height:24px; background:var(--border); margin:0 4px; flex-shrink:0; }
.tb-btn {
  display:inline-flex; align-items:center; gap:5px; padding:5px 11px;
  border:1px solid var(--border2); border-radius:var(--radius-sm);
  background:var(--surface2); color:var(--text2); font-size:12px; font-weight:500;
  cursor:pointer; white-space:nowrap; transition:all 0.15s; line-height:1;
}
.tb-btn:hover { background:var(--surface3); color:var(--text); border-color:var(--accent); }
.tb-btn.active { background:var(--accent); color:#fff; border-color:var(--accent); }
.tb-btn svg { width:13px; height:13px; flex-shrink:0; }
.tb-label { position:relative; }
.tb-label input[type=file] { position:absolute; inset:0; opacity:0; cursor:pointer; width:100%; }
#unitToggle { display:flex; border:1px solid var(--border2); border-radius:var(--radius-sm); overflow:hidden; }
#unitToggle button { border:none; background:var(--surface2); color:var(--text2); font-size:12px; font-weight:500; padding:5px 10px; cursor:pointer; transition:all 0.15s; }
#unitToggle button:first-child { border-right:1px solid var(--border2); }
#unitToggle button.active { background:var(--accent); color:#fff; }
.tb-spacer { flex:1; }

/* ── Layout ───────────────────────────────────────────────────── */
#app { display:flex; flex:1; overflow:hidden; }

/* ── Resizable panel ── */
#resizeHandle {
  width: 5px; flex-shrink:0; cursor:col-resize;
  background: var(--border);
  transition: background 0.15s;
  position: relative; z-index: 10;
}
#resizeHandle:hover, #resizeHandle.dragging { background: var(--accent); }

/* ── Canvas area ──────────────────────────────────────────────── */
#canvasArea { flex:1; display:flex; flex-direction:column; overflow:hidden; padding:12px; gap:8px; min-height:0; }

#shapeTabs {
  display:flex; align-items:center; gap:6px; flex-shrink:0;
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius);
  padding:6px 10px;
}
.shape-tab {
  display:inline-flex; align-items:center; gap:5px;
  padding:4px 10px; border-radius:20px; border:1px solid var(--border2);
  background:transparent; color:var(--text2); font-size:12px; font-weight:500;
  cursor:pointer; transition:all 0.15s; line-height:1;
}
.shape-tab.active { background:var(--accent); color:#fff; border-color:var(--accent); }
.shape-tab .dot { font-size:10px; }
.tab-del { font-size:14px; line-height:1; opacity:0.5; margin-left:1px; }
.tab-del:hover { opacity:1; color:var(--red); }
#addShapeBtn {
  display:inline-flex; align-items:center; gap:4px;
  padding:4px 10px; border-radius:20px; border:1px dashed var(--accent);
  background:transparent; color:var(--accent); font-size:12px; font-weight:500;
  cursor:pointer; transition:all 0.15s;
}
#addShapeBtn:hover { background:rgba(79,124,255,0.1); }

#canvasCard {
  flex:1; background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius); overflow:hidden; position:relative; display:flex; align-items:stretch;
}
#drawingCanvas { display:block; width:100%; height:100%; background:#fff; cursor:crosshair; }
.cursor-draw { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20'%3E%3Cline x1='10' y1='1' x2='10' y2='19' stroke='%23000' stroke-width='1.5'/%3E%3Cline x1='1' y1='10' x2='19' y2='10' stroke='%23000' stroke-width='1.5'/%3E%3Ccircle cx='10' cy='10' r='1.5' fill='%23000'/%3E%3C/svg%3E") 10 10, crosshair !important; }

#canvasFooter {
  display:flex; align-items:center; gap:8px; flex-shrink:0;
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius);
  padding:8px 12px; flex-wrap:wrap;
}
.cf-btn {
  display:inline-flex; align-items:center; gap:4px;
  padding:4px 10px; border-radius:var(--radius-sm); border:1px solid var(--border2);
  background:var(--surface2); color:var(--text2); font-size:12px; font-weight:500;
  cursor:pointer; transition:all 0.15s; white-space:nowrap;
}
.cf-btn:hover { color:var(--text); border-color:var(--accent); background:var(--surface3); }
.cf-btn.on { background:var(--orange); color:#fff; border-color:var(--orange); }
#refLineHint {
  font-size:11px; color:var(--yellow); background:rgba(251,191,36,0.1);
  border:1px solid rgba(251,191,36,0.3); border-radius:var(--radius-sm);
  padding:3px 8px; display:none;
}
#refLineHint.visible { display:inline-block; }
#canvasFooter .hint { font-size:11px; color:var(--text3); margin-left:auto; }
#snapIndicator { font-size:11px; color:var(--green); font-weight:600; display:none; }
#snapIndicator.snapping { display:inline; }

/* ── Right panel ──────────────────────────────────────────────── */
#rightPanel {
  width:320px; flex-shrink:0; min-width:240px; max-width:600px;
  background:var(--surface); border-left:1px solid var(--border);
  display:flex; flex-direction:column; overflow:hidden;
}
#panelTabs {
  display:flex; border-bottom:1px solid var(--border); flex-shrink:0;
}
.panel-tab {
  flex:1; padding:11px 6px; border:none; background:transparent;
  color:var(--text2); font-size:12px; font-weight:500; cursor:pointer;
  border-bottom:2px solid transparent; transition:all 0.15s; text-align:center;
  font-family:'Inter',sans-serif;
}
.panel-tab:hover { color:var(--text); }
.panel-tab.active { color:var(--accent); border-bottom-color:var(--accent); }
#panelContent { flex:1; overflow-y:auto; padding:16px; }

/* ── Panel sections ───────────────────────────────────────────── */
.pane { display:none; }
.pane.active { display:block; }

.field-label {
  display:block; font-size:11px; font-weight:600; color:var(--text2);
  text-transform:uppercase; letter-spacing:0.6px; margin-bottom:5px;
}
.field-label span { font-weight:400; text-transform:none; letter-spacing:0; color:var(--text3); font-size:11px; }

.dark-input {
  width:100%; background:var(--surface2); border:1px solid var(--border2);
  border-radius:var(--radius-sm); color:var(--text); padding:7px 10px;
  font-size:13px; font-family:'Inter',sans-serif; transition:border 0.15s;
  -moz-appearance:textfield;
}
.dark-input:focus { outline:none; border-color:var(--accent); }
.dark-input::-webkit-outer-spin-button,
.dark-input::-webkit-inner-spin-button { -webkit-appearance:none; }

.dark-select {
  width:100%; background:var(--surface2); border:1px solid var(--border2);
  border-radius:var(--radius-sm); color:var(--text); padding:7px 10px;
  font-size:13px; font-family:'Inter',sans-serif; cursor:pointer;
  appearance:none; background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%238b90b0'/%3E%3C/svg%3E");
  background-repeat:no-repeat; background-position:right 10px center;
}
.dark-select:focus { outline:none; border-color:var(--accent); }

.scale-row { display:flex; gap:8px; align-items:center; }
.scale-row input[type=range] { flex:1; accent-color:var(--accent); }
.scale-row .dark-input { width:70px; flex-shrink:0; text-align:center; }

.info-box {
  background:var(--surface2); border:1px solid var(--border);
  border-radius:var(--radius-sm); padding:10px 12px; font-size:12px;
  color:var(--text2); line-height:1.6; margin-bottom:12px;
}
.info-box strong { color:var(--green); font-size:14px; }

.seg-header {
  display:flex; align-items:center; justify-content:space-between;
  margin-bottom:6px;
}
.seg-header span { font-size:11px; font-weight:600; color:var(--text2); text-transform:uppercase; letter-spacing:0.6px; }
.lock-badge {
  font-size:10px; background:rgba(251,191,36,0.15); color:var(--yellow);
  border-radius:10px; padding:2px 7px; font-weight:600;
}

.mlist {
  background:var(--surface2); border:1px solid var(--border);
  border-radius:var(--radius-sm); max-height:200px; overflow-y:auto;
  font-size:12px;
}
.mlist table { width:100%; border-collapse:collapse; }
.mlist th { padding:6px 8px; color:var(--text3); font-weight:600; font-size:10px; text-transform:uppercase; letter-spacing:0.5px; border-bottom:1px solid var(--border); }
.mlist td { padding:5px 8px; border-bottom:1px solid var(--border); color:var(--text); vertical-align:middle; }
.mlist tr:last-child td { border-bottom:none; }
.mlist tr.locked-row td { background:rgba(251,191,36,0.05); }
.mlist input[type=number] { width:60px; background:var(--surface3); border:1px solid var(--border2); border-radius:3px; color:var(--text); padding:2px 5px; font-size:11px; font-family:'Inter',sans-serif; -moz-appearance:textfield; }
.mlist input[type=number]::-webkit-outer-spin-button,
.mlist input[type=number]::-webkit-inner-spin-button { -webkit-appearance:none; }
.mlist input[type=number]:focus { outline:none; border-color:var(--accent); }
.mlist input[type=checkbox] { accent-color:var(--accent); }
.mlist .focus-btn { background:none; border:none; color:var(--accent); font-size:11px; cursor:pointer; padding:0; }
.locked-badge { font-size:9px; background:rgba(251,191,36,0.2); color:var(--yellow); border-radius:3px; padding:1px 4px; margin-left:3px; }

.field-group { margin-bottom:14px; }

.action-btn {
  display:block; width:100%; padding:9px; border-radius:var(--radius-sm);
  font-size:13px; font-weight:600; font-family:'Inter',sans-serif;
  cursor:pointer; transition:all 0.15s; text-align:center; border:none;
}
.action-btn.primary { background:var(--accent); color:#fff; }
.action-btn.primary:hover { background:var(--accent2); }
.action-btn.danger { background:transparent; border:1px solid var(--red); color:var(--red); }
.action-btn.danger:hover { background:var(--red); color:#fff; }
.action-btn.secondary { background:var(--surface2); border:1px solid var(--border2); color:var(--text2); }
.action-btn:disabled { opacity:0.35; cursor:not-allowed; pointer-events:none; }


.btn-row { display:grid; grid-template-columns:repeat(2,1fr); gap:6px; margin-top:6px; }
.btn-row .action-btn { padding:7px; font-size:12px; }

.divider { height:1px; background:var(--border); margin:16px 0; }

/* Drawing tools */
.mode-toggle { display:flex; border:1px solid var(--border2); border-radius:var(--radius-sm); overflow:hidden; margin-bottom:14px; }
.mode-toggle button { flex:1; padding:7px; border:none; background:var(--surface2); color:var(--text2); font-size:12px; font-weight:500; cursor:pointer; transition:all 0.15s; font-family:'Inter',sans-serif; }
.mode-toggle button.active { background:var(--accent); color:#fff; }

/* Volume pane */
.vol-card {
  background:var(--surface2); border:1px solid var(--border);
  border-radius:var(--radius); padding:12px; margin-bottom:10px;
}
.vol-card .shape-name { font-size:11px; color:var(--text2); margin-bottom:6px; font-weight:600; text-transform:uppercase; letter-spacing:0.5px; }
.vol-card .vol-num { font-size:26px; font-weight:700; color:var(--green); letter-spacing:-1px; line-height:1; }
.vol-card .vol-unit { font-size:13px; color:var(--text2); margin-left:4px; }
.vol-card .vol-hints { display:flex; gap:10px; margin-top:8px; }
.vol-hint { flex:1; background:var(--surface3); border-radius:var(--radius-sm); padding:6px 8px; text-align:center; }
.vol-hint .hint-val { font-size:13px; font-weight:600; color:var(--text); }
.vol-hint .hint-lbl { font-size:10px; color:var(--text3); margin-top:1px; }
.combined-box { background:rgba(79,124,255,0.08); border:1px solid rgba(79,124,255,0.25); border-radius:var(--radius-sm); padding:8px 12px; margin-bottom:10px; font-size:12px; color:var(--text2); display:none; }
.combined-box strong { color:var(--accent); }
.vol-table { width:100%; border-collapse:collapse; font-size:12px; }
.vol-table th { color:var(--text3); font-size:10px; text-transform:uppercase; letter-spacing:0.5px; padding:5px 6px; border-bottom:1px solid var(--border); text-align:center; }
.vol-table td { padding:6px 6px; border-bottom:1px solid var(--border); text-align:center; color:var(--text); }
.vol-table tr:last-child td { border-bottom:none; }
.vol-table tr.total-row td { background:rgba(79,124,255,0.08); color:var(--accent); font-weight:700; }

/* Materials pane */
.mat-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:8px; margin-bottom:14px; }
.mat-result { background:var(--surface2); border:1px solid var(--border); border-radius:var(--radius-sm); padding:10px; text-align:center; }
.mat-result .mat-val { font-size:18px; font-weight:700; color:var(--green); }
.mat-result .mat-lbl { font-size:10px; color:var(--text3); margin-top:2px; text-transform:uppercase; letter-spacing:0.4px; }

/* Cost pane */
#costSheet { width:100%; border-collapse:collapse; font-size:12px; }
#costSheet th { color:var(--text3); font-size:10px; text-transform:uppercase; letter-spacing:0.5px; padding:5px 6px; border-bottom:1px solid var(--border); text-align:left; }
#costSheet td { padding:4px 5px; border-bottom:1px solid var(--border); vertical-align:middle; }
#costSheet tbody tr:hover { background:rgba(79,124,255,0.04); }
.cs-cell { display:block; cursor:pointer; border-radius:3px; padding:3px 5px; transition:background 0.12s; color:var(--text); }
.cs-cell:hover { background:var(--surface3); }
.cs-cell.auto-qty { color:var(--accent); font-weight:600; }
.cs-cell.editing { padding:0; background:transparent !important; }
.cs-cell input { width:100%; border:1px solid var(--accent); border-radius:3px; padding:2px 5px; font-size:12px; font-family:'Inter',sans-serif; background:var(--surface); color:var(--text); outline:none; }
.cs-item-input { width:100%; border:none; border-bottom:1px solid transparent; background:transparent; font-size:12px; padding:2px 4px; color:var(--text); font-family:'Inter',sans-serif; }
.cs-item-input:hover { border-bottom-color:var(--border2); }
.cs-item-input:focus { outline:none; border-bottom-color:var(--accent); background:var(--surface3); border-radius:3px; }
.cs-unit-select { border:none; background:transparent; font-size:12px; padding:2px; width:100%; cursor:pointer; color:var(--text2); font-family:'Inter',sans-serif; }
.cs-unit-select:focus { outline:none; }
.cs-del { padding:2px 5px; font-size:14px; line-height:1; color:var(--text3); background:none; border:none; cursor:pointer; }
.cs-del:hover { color:var(--red); }
.waste-col { display:none; }
body.show-waste .waste-col { display:table-cell; }
.badge-auto { font-size:9px; background:rgba(79,124,255,0.15); color:var(--accent); border-radius:3px; padding:1px 4px; margin-left:3px; font-weight:700; }
.cost-foot { margin-top:10px; background:var(--surface2); border:1px solid var(--border); border-radius:var(--radius-sm); padding:10px 12px; }
.cost-foot-row { display:flex; justify-content:space-between; align-items:center; font-size:12px; margin-bottom:4px; }
.cost-foot-row:last-child { margin-bottom:0; }
.cost-foot-row .lbl { color:var(--text2); }
.cost-foot-row .val { font-weight:600; color:var(--text); }
.cost-foot-row.grand .lbl { color:var(--green); font-weight:700; font-size:13px; }
.cost-foot-row.grand .val { color:var(--green); font-weight:700; font-size:15px; }
.margin-row { display:flex; align-items:center; gap:6px; margin-bottom:10px; }
.margin-row .dark-input { width:70px; }
.cost-actions { display:flex; gap:6px; flex-wrap:wrap; margin-top:10px; }
.cost-actions .action-btn { width:auto; flex:1; font-size:11px; padding:6px 8px; display:inline-flex; align-items:center; justify-content:center; gap:4px; }

/* ── Footings & Walls ── */
.fw-section { background:var(--surface2); border:1px solid var(--border); border-radius:var(--radius); overflow:hidden; margin-bottom:10px; }
.fw-section-header {
  display:flex; align-items:center; justify-content:space-between;
  padding:9px 12px; cursor:pointer; user-select:none;
  border-bottom:1px solid transparent; transition:border-color 0.15s;
}
.fw-section-header:hover { background:var(--surface3); }
.fw-section-header.open { border-bottom-color:var(--border); }
.fw-section-title { font-size:12px; font-weight:600; color:var(--text); display:flex; align-items:center; gap:7px; }
.fw-section-title .fw-icon { font-size:14px; }
.fw-chevron { font-size:10px; color:var(--text3); transition:transform 0.2s; }
.fw-chevron.open { transform:rotate(180deg); }
.fw-body { padding:12px; display:none; }
.fw-body.open { display:block; }
.fw-row { display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-bottom:10px; }
.fw-row.three { grid-template-columns:1fr 1fr 1fr; }
.fw-field label { display:block; font-size:10px; font-weight:600; color:var(--text3); text-transform:uppercase; letter-spacing:0.5px; margin-bottom:4px; }
.fw-result { background:var(--surface3); border:1px solid var(--border); border-radius:var(--radius-sm); padding:8px 10px; margin-top:4px; }
.fw-result-row { display:flex; justify-content:space-between; font-size:12px; padding:2px 0; }
.fw-result-row .r-lbl { color:var(--text2); }
.fw-result-row .r-val { font-weight:600; color:var(--green); }
.fw-list { margin-top:10px; }
.fw-item { background:var(--surface3); border:1px solid var(--border); border-radius:var(--radius-sm); padding:8px 10px; margin-bottom:6px; display:flex; align-items:center; gap:8px; font-size:12px; }
.fw-item-icon { font-size:16px; flex-shrink:0; }
.fw-item-info { flex:1; }
.fw-item-name { font-weight:600; color:var(--text); }
.fw-item-detail { color:var(--text2); font-size:11px; margin-top:1px; }
.fw-item-vol { font-weight:700; color:var(--green); font-size:13px; white-space:nowrap; }
.fw-item-del { background:none; border:none; color:var(--text3); cursor:pointer; font-size:16px; padding:0 2px; flex-shrink:0; }
.fw-item-del:hover { color:var(--red); }
.fw-total { display:flex; justify-content:space-between; align-items:center; padding:8px 10px; background:rgba(79,124,255,0.08); border:1px solid rgba(79,124,255,0.2); border-radius:var(--radius-sm); margin-top:6px; font-size:12px; }
.fw-total .t-lbl { color:var(--text2); font-weight:600; }
.fw-total .t-val { color:var(--accent); font-weight:700; font-size:14px; }

/* ── Segment context menu ── */
#segCtxMenu {
  position:fixed; z-index:9999; min-width:180px;
  background:var(--surface2); border:1px solid var(--border2);
  border-radius:var(--radius); box-shadow:0 8px 24px rgba(0,0,0,0.4);
  padding:4px 0; display:none; font-family:'Inter',sans-serif;
}
#segCtxMenu.visible { display:block; }
.ctx-item {
  display:flex; align-items:center; gap:10px;
  padding:8px 14px; font-size:12px; font-weight:500;
  color:var(--text2); cursor:pointer; transition:background 0.1s;
  white-space:nowrap;
}
.ctx-item:hover { background:var(--surface3); color:var(--text); }
.ctx-item .ctx-icon { font-size:14px; width:16px; text-align:center; flex-shrink:0; }
.ctx-item.danger { color:var(--red); }
.ctx-item.danger:hover { background:rgba(244,63,94,0.1); }
.ctx-divider { height:1px; background:var(--border); margin:4px 0; }
.ctx-label { padding:4px 14px 2px; font-size:10px; font-weight:700;
  text-transform:uppercase; letter-spacing:0.6px; color:var(--text3); }

/* ── Floating canvas buttons ── */
#calcVolumeFloat {
  position:absolute; bottom:12px; left:12px; z-index:5;
  background:var(--accent); color:#fff; border:none; border-radius:var(--radius-sm);
  padding:6px 12px; font-size:12px; font-weight:600; font-family:'Inter',sans-serif;
  cursor:pointer; display:flex; align-items:center; gap:5px;
  box-shadow:0 2px 8px rgba(0,0,0,0.3); transition:background 0.15s, transform 0.1s;
  white-space:nowrap;
}
#calcVolumeFloat:hover { background:var(--accent2); transform:translateY(-1px); }
#calcVolumeFloat:active { transform:translateY(0); }

/* ── Shape picker grid ── */
.shape-picker-grid {
  display:grid; grid-template-columns:repeat(4,1fr); gap:5px; margin-bottom:12px;
}
.shape-pick-btn {
  aspect-ratio:1; border:1.5px solid var(--border2); border-radius:var(--radius-sm);
  background:var(--surface2); color:var(--text2); cursor:pointer;
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:3px; font-size:9px; font-weight:600; text-transform:uppercase; letter-spacing:0.3px;
  transition:all 0.15s; padding:6px 2px;
  max-height:72px; /* prevent oversized buttons on wide panels */
}
.shape-pick-btn svg { width:22px; height:22px; }
.shape-pick-btn:hover { border-color:var(--accent); color:var(--text); background:var(--surface3); }
.shape-pick-btn.armed { border-color:var(--accent); background:rgba(79,124,255,0.15); color:var(--accent); }

/* ── Mode toggle — better styling ── */
.mode-toggle { display:flex; flex-direction:column; gap:4px; margin-bottom:14px; }
.mode-toggle-row { display:flex; gap:4px; }
.mode-toggle button {
  flex:1; padding:8px 4px; border-radius:var(--radius-sm);
  border:1.5px solid var(--border2); background:var(--surface2);
  color:var(--text2); font-size:11px; font-weight:600; cursor:pointer;
  transition:all 0.15s; font-family:'Inter',sans-serif; letter-spacing:0.2px;
}
.mode-toggle button:hover { border-color:var(--accent); color:var(--text); background:var(--surface3); }
.mode-toggle button.active { background:var(--accent); color:#fff; border-color:var(--accent); }
.mode-toggle button.active-footing { background:#f97316; color:#fff; border-color:#f97316; }
.mode-toggle button.active-wall    { background:#8b5cf6; color:#fff; border-color:#8b5cf6; }

/* ── Draw pane sections ── */
.draw-section { margin-bottom:14px; }
.draw-section-label {
  font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:0.6px;
  color:var(--text3); margin-bottom:6px; display:block;
}
.pour-row {
  background:var(--surface2); border:1px solid var(--border);
  border-radius:var(--radius-sm); padding:8px 10px; margin-bottom:6px;
  font-size:12px; cursor:grab; user-select:none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.pour-row:active { cursor:grabbing; }
.pour-row.dragging { opacity:0.4; border-style:dashed; }
.pour-row.drag-over { border-color:var(--accent); box-shadow:0 0 0 2px rgba(79,124,255,0.3); }
.pour-row-header { display:flex; align-items:center; gap:7px; margin-bottom:6px; }
.pour-seq { font-size:10px; font-weight:700; color:var(--text3); background:var(--surface3); border-radius:10px; padding:1px 6px; flex-shrink:0; }
.pour-icon { font-size:13px; flex-shrink:0; }
.pour-name { flex:1; font-weight:600; color:var(--text); min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.pour-status { font-size:10px; font-weight:700; padding:2px 6px; border-radius:8px; white-space:nowrap; flex-shrink:0; }
.pour-status.ok     { background:rgba(45,212,191,0.15); color:var(--green); }
.pour-status.warn   { background:rgba(249,115,22,0.2);  color:var(--orange); }
.pour-status.alert  { background:rgba(244,63,94,0.2);   color:var(--red); }
.pour-status.nodata { background:var(--surface3);        color:var(--text3); }
.pour-fields { display:grid; grid-template-columns:1fr 1fr; gap:6px; }
.pour-field label { display:block; font-size:10px; color:var(--text3); margin-bottom:3px; text-transform:uppercase; letter-spacing:0.4px; }
.pour-field select.dark-select { font-size:11px; padding:4px 6px; }
.pour-date-input {
  width:100%; background:var(--surface3); border:1px solid var(--border2);
  border-radius:var(--radius-sm); color:var(--text); padding:4px 6px;
  font-size:11px; font-family:'Inter',sans-serif;
}
.pour-date-input:focus { outline:none; border-color:var(--accent); }
.cure-bar { margin-top:6px; }
.cure-bar-label { font-size:10px; color:var(--text3); margin-bottom:3px; }
.cure-bar-track { height:6px; background:var(--surface3); border-radius:3px; overflow:hidden; position:relative; }
.cure-bar-fill { height:100%; border-radius:3px; transition:width 0.3s; }
.cure-milestones { display:flex; justify-content:space-between; margin-top:4px; font-size:10px; color:var(--text3); }
.cure-milestone { text-align:center; }
.cure-milestone.reached { color:var(--green); font-weight:600; }
.pour-dep { margin-top:6px; font-size:11px; color:var(--text2); }
.pour-dep select { background:var(--surface3); border:1px solid var(--border2); border-radius:3px; color:var(--text); padding:2px 5px; font-size:11px; font-family:'Inter',sans-serif; margin-left:4px; }
.pour-dep select:focus { outline:none; border-color:var(--accent); }
.pour-hint-row { font-size:10px; color:var(--text3); margin-top:4px; display:flex; gap:10px; flex-wrap:wrap; }
.pour-hint-row span { white-space:nowrap; }
.pour-hint-row .warn-dep { color:var(--orange); font-weight:600; }
/* Gantt chart */
.gantt-wrap { min-width:280px; font-size:11px; }
.gantt-header { display:flex; margin-bottom:4px; padding-left:90px; }
.gantt-header-tick { flex:1; color:var(--text3); font-size:9px; text-align:left; border-left:1px solid var(--border); padding:1px 2px; }
.gantt-row { display:flex; align-items:center; margin-bottom:3px; }
.gantt-label { width:90px; flex-shrink:0; color:var(--text2); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; padding-right:6px; font-size:10px; }
.gantt-track { flex:1; background:var(--surface3); border-radius:3px; height:20px; position:relative; overflow:visible; }
.gantt-bar { position:absolute; height:100%; border-radius:3px; display:flex; align-items:center; padding:0 5px; font-size:9px; font-weight:700; color:#fff; white-space:nowrap; overflow:hidden; min-width:6px; cursor:default; }
.gantt-milestone { position:absolute; width:7px; height:7px; border-radius:50%; top:50%; transform:translateY(-50%); border:1.5px solid rgba(255,255,255,0.7); cursor:default; }
.gantt-today-line { position:absolute; top:-4px; bottom:-4px; width:2px; background:rgba(244,63,94,0.8); pointer-events:none; z-index:2; }
.gantt-today-label { position:absolute; top:-13px; font-size:8px; color:var(--red); transform:translateX(-50%); white-space:nowrap; font-weight:700; }
.gantt-divider { height:1px; background:var(--border); margin:6px 0 6px 90px; }

.weather-card { background:var(--surface2); border:1px solid var(--border); border-radius:var(--radius-sm); padding:10px 12px; font-size:12px; }
.weather-day { display:flex; justify-content:space-between; padding:5px 0; border-bottom:1px solid var(--border); color:var(--text2); }
.weather-day:last-child { border-bottom:none; }
.weather-day strong { color:var(--text); }

/* New weather day card */
.wx-day {
  background:var(--surface2); border:1px solid var(--border);
  border-radius:var(--radius); padding:10px 12px; margin-bottom:8px;
}
.wx-day.wx-warn  { border-color:rgba(249,115,22,0.5); background:rgba(249,115,22,0.05); }
.wx-day.wx-alert { border-color:rgba(244,63,94,0.5);  background:rgba(244,63,94,0.05); }
.wx-day.wx-ok    { border-color:rgba(45,212,191,0.3); }
.wx-day-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:6px; }
.wx-date  { font-size:13px; font-weight:700; color:var(--text); }
.wx-badge { font-size:10px; font-weight:700; padding:2px 7px; border-radius:10px; }
.wx-badge-ok    { background:rgba(45,212,191,0.15); color:var(--green); }
.wx-badge-warn  { background:rgba(249,115,22,0.2);  color:var(--orange); }
.wx-badge-alert { background:rgba(244,63,94,0.2);   color:var(--red); }
.wx-stats { display:flex; gap:10px; flex-wrap:wrap; margin-bottom:6px; font-size:12px; color:var(--text2); }
.wx-stats span strong { color:var(--text); }
.wx-warnings { display:flex; flex-direction:column; gap:3px; }
.wx-warning-item { font-size:11px; padding:3px 8px; border-radius:4px; display:flex; align-items:center; gap:5px; }
.wx-warning-item.level-info  { background:rgba(79,124,255,0.1);  color:#7da4ff; }
.wx-warning-item.level-warn  { background:rgba(249,115,22,0.12); color:var(--orange); }
.wx-warning-item.level-alert { background:rgba(244,63,94,0.12);  color:var(--red); }
.wx-city { font-size:11px; color:var(--text3); margin-bottom:10px; }

/* ── Project info bar ── */
#projectBar {
  display:flex; align-items:center; gap:8px; flex-shrink:0;
  background:var(--surface2); border-bottom:1px solid var(--border);
  padding:0 16px; height:38px; flex-wrap:wrap;
}
.proj-field {
  display:flex; align-items:center; gap:5px; font-size:12px;
}
.proj-field label { color:var(--text3); white-space:nowrap; font-size:11px; }
.proj-input {
  background:transparent; border:none; border-bottom:1px solid transparent;
  color:var(--text); font-size:12px; font-family:'Inter',sans-serif;
  padding:2px 4px; min-width:80px; max-width:160px;
  transition:border-color 0.15s;
}
.proj-input:hover { border-bottom-color:var(--border2); }
.proj-input:focus { outline:none; border-bottom-color:var(--accent); background:var(--surface3); border-radius:3px; }
.proj-sep { width:1px; height:18px; background:var(--border); flex-shrink:0; }

/* ── Pour schedule pane ── */
.pour-row {
  background:var(--surface2); border:1px solid var(--border);
  border-radius:var(--radius-sm); padding:8px 10px; margin-bottom:6px;
  display:flex; align-items:center; gap:8px; font-size:12px;
}
.pour-row .pour-icon { font-size:14px; flex-shrink:0; }
.pour-row .pour-name { flex:1; font-weight:600; color:var(--text); min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.pour-row .pour-date-input {
  background:var(--surface3); border:1px solid var(--border2);
  border-radius:var(--radius-sm); color:var(--text); padding:4px 6px;
  font-size:11px; font-family:'Inter',sans-serif; width:130px; flex-shrink:0;
}
.pour-row .pour-date-input:focus { outline:none; border-color:var(--accent); }
.pour-status { font-size:10px; font-weight:700; padding:2px 6px; border-radius:8px; white-space:nowrap; flex-shrink:0; }
.pour-status.ok    { background:rgba(45,212,191,0.15); color:var(--green); }
.pour-status.warn  { background:rgba(249,115,22,0.2);  color:var(--orange); }
.pour-status.alert { background:rgba(244,63,94,0.2);   color:var(--red); }
.pour-status.nodata{ background:var(--surface3); color:var(--text3); }
.pour-hint { font-size:10px; color:var(--text3); margin-top:2px; }
/* Scale bar overlay */
#scaleBar {
  position:absolute; bottom:12px; right:12px;
  background:rgba(26,29,39,0.85); border:1px solid var(--border2);
  border-radius:var(--radius-sm); padding:5px 10px;
  font-size:11px; color:var(--text2); pointer-events:none;
  display:flex; align-items:center; gap:8px; z-index:5;
}
#scaleBar .bar-line { height:3px; background:var(--text); border-radius:2px; }
#scaleBar .bar-txt  { white-space:nowrap; font-weight:600; color:var(--text); }

/* Angle indicator overlay */
#angleIndicator {
  position:absolute; top:10px; left:50%; transform:translateX(-50%);
  background:rgba(26,29,39,0.92); border:1px solid var(--accent);
  border-radius:20px; padding:5px 16px; font-size:13px; font-weight:700;
  color:var(--accent); pointer-events:none; display:none; z-index:5;
  white-space:nowrap; letter-spacing:0.3px;
}

/* Site work checklist */
.sw-row { display:flex; align-items:center; gap:6px; font-size:12px; color:var(--text2); cursor:pointer; padding:3px 0; }
.sw-row input[type="checkbox"] { accent-color:var(--accent); width:14px; height:14px; flex-shrink:0; }
.sw-row span:first-of-type { flex:1; }
.sw-price { width:64px !important; padding:3px 5px !important; font-size:11px !important; }
.sw-unit { font-size:10px; color:var(--text3); white-space:nowrap; }
::-webkit-scrollbar-track { background:transparent; }
::-webkit-scrollbar-thumb { background:var(--border2); border-radius:3px; }
::-webkit-scrollbar-thumb:hover { background:var(--text3); }

/* ── Full Estimate Pane ───────────────────────────────────────── */
.est-section {
  background:var(--surface2); border:1px solid var(--border);
  border-radius:var(--radius); padding:12px; margin-bottom:10px;
}
.est-section-title {
  font-size:11px; font-weight:700; text-transform:uppercase;
  letter-spacing:0.6px; color:var(--text2); margin-bottom:10px;
  display:flex; align-items:center; gap:6px;
}
.est-row2 { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.est-row3 { display:grid; grid-template-columns:1fr 1fr 1fr; gap:8px; }
.est-field { display:flex; flex-direction:column; gap:4px; }
.est-field label { font-size:11px; color:var(--text3); font-weight:500; }
.est-unit { font-weight:400; }
.est-check-row {
  display:flex; align-items:center; gap:6px;
  font-size:12px; color:var(--text2); cursor:pointer;
}
.est-check-row input[type=checkbox] { accent-color:var(--accent); width:14px; height:14px; flex-shrink:0; }
.est-waste-btn {
  border:none; background:var(--surface3); color:var(--text3);
  font-size:10px; font-weight:600; padding:4px 7px; cursor:pointer;
  font-family:'Inter',sans-serif; transition:all 0.15s;
}
.est-waste-btn.active { background:var(--accent); color:#fff; }
.est-qty-table { width:100%; border-collapse:collapse; font-size:12px; }
.est-qty-table th {
  color:var(--text3); font-size:10px; text-transform:uppercase;
  letter-spacing:0.5px; padding:4px 6px; border-bottom:1px solid var(--border);
  text-align:left;
}
.est-qty-table td { padding:5px 6px; border-bottom:1px solid var(--border); color:var(--text); }
.est-qty-table tr:last-child td { border-bottom:none; }
.est-qty-table .qty-val { color:var(--green); font-weight:600; text-align:right; }
.est-qty-table .qty-unit { color:var(--text3); font-size:11px; }
.est-breakdown-table { width:100%; border-collapse:collapse; font-size:11px; margin-bottom:10px; }
.est-breakdown-table th {
  color:var(--text3); font-size:9px; text-transform:uppercase;
  letter-spacing:0.5px; padding:3px 6px; border-bottom:1px solid var(--border); text-align:right;
}
.est-breakdown-table th:first-child { text-align:left; }
.est-breakdown-table td { padding:4px 6px; border-bottom:1px solid var(--border); text-align:right; color:var(--text2); }
.est-breakdown-table td:first-child { text-align:left; color:var(--text); }
.est-breakdown-table tr:last-child td { border-bottom:none; }
.est-breakdown-table .est-cat-hdr td {
  background:var(--surface3); color:var(--accent); font-weight:700;
  font-size:10px; text-transform:uppercase; letter-spacing:0.5px; padding:5px 6px;
}
.est-breakdown-table .est-subtotal-row td { font-weight:600; color:var(--text); border-top:1px solid var(--border2); }
.est-summary-card {
  background:var(--surface3); border-radius:var(--radius-sm); padding:8px 12px;
  margin-bottom:5px; display:flex; justify-content:space-between; align-items:center;
}
.est-summary-card .s-lbl { font-size:12px; color:var(--text2); }
.est-summary-card .s-val { font-size:13px; font-weight:600; color:var(--text); }
.est-summary-grand {
  background:var(--surface2); border:1px solid var(--green);
  border-radius:var(--radius); padding:14px 16px; text-align:center; margin-top:8px;
}
.est-summary-grand .bid-label { font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:0.8px; color:var(--text3); margin-bottom:4px; }
.est-summary-grand .bid-price { font-size:36px; font-weight:700; color:var(--green); letter-spacing:-1.5px; line-height:1; }
.est-summary-grand .bid-persf { font-size:12px; color:var(--text3); margin-top:6px; }

/* ── Job History Modal ────────────────────────────────────────── */
#jobHistoryModal {
  display:none; position:fixed; inset:0; z-index:9000;
  background:rgba(0,0,0,0.6); backdrop-filter:blur(4px);
  align-items:center; justify-content:center;
}
#jobHistoryModal.open { display:flex; }
#jobHistoryBox {
  background:var(--surface); border:1px solid var(--border2);
  border-radius:12px; width:520px; max-width:95vw; max-height:80vh;
  display:flex; flex-direction:column; box-shadow:0 24px 64px rgba(0,0,0,0.5);
}
#jobHistoryBox .jh-header {
  display:flex; align-items:center; justify-content:space-between;
  padding:14px 16px; border-bottom:1px solid var(--border); flex-shrink:0;
}
#jobHistoryBox .jh-title { font-size:14px; font-weight:700; color:var(--text); }
#jobHistoryBox .jh-close { background:none; border:none; color:var(--text3); font-size:20px; cursor:pointer; padding:0 4px; line-height:1; }
#jobHistoryBox .jh-close:hover { color:var(--text); }
#jobHistoryList { flex:1; overflow-y:auto; padding:8px; }
.jh-empty { padding:24px; text-align:center; color:var(--text3); font-size:13px; }
.jh-item {
  background:var(--surface2); border:1px solid var(--border);
  border-radius:var(--radius); padding:10px 12px; margin-bottom:6px;
  display:flex; align-items:center; gap:10px; transition:border-color 0.15s;
}
.jh-item:hover { border-color:var(--border2); }
.jh-item-info { flex:1; min-width:0; }
.jh-item-name { font-size:13px; font-weight:600; color:var(--text); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.jh-item-meta { font-size:11px; color:var(--text3); margin-top:2px; }
.jh-item-bid  { font-size:14px; font-weight:700; color:var(--green); white-space:nowrap; }
.jh-item-actions { display:flex; gap:5px; flex-shrink:0; }
.jh-btn { padding:4px 9px; border-radius:var(--radius-sm); border:1px solid var(--border2); background:var(--surface3); color:var(--text2); font-size:11px; font-weight:600; cursor:pointer; font-family:'Inter',sans-serif; transition:all 0.15s; }
.jh-btn:hover { border-color:var(--accent); color:var(--accent); }
.jh-btn.danger:hover { border-color:var(--red); color:var(--red); }
#jobHistoryBox .jh-footer { padding:10px 16px; border-top:1px solid var(--border); flex-shrink:0; display:flex; justify-content:space-between; align-items:center; }
.jh-count { font-size:11px; color:var(--text3); }

/* ── Labor Productivity Modal (right-click) ──────────────────── */
#laborRatesModal {
  display:none; position:fixed; z-index:9500;
  background:var(--surface); border:1px solid var(--border2);
  border-radius:var(--radius); box-shadow:0 12px 40px rgba(0,0,0,0.5);
  padding:14px 16px; width:280px; font-family:'Inter',sans-serif;
}
#laborRatesModal.open { display:block; }
#laborRatesModal .lrm-title {
  font-size:11px; font-weight:700; text-transform:uppercase;
  letter-spacing:0.6px; color:var(--text2); margin-bottom:4px;
  display:flex; justify-content:space-between; align-items:center;
}
#laborRatesModal .lrm-sub {
  font-size:10px; color:var(--text3); margin-bottom:12px; line-height:1.5;
}
#laborRatesModal .lrm-row {
  display:flex; align-items:center; justify-content:space-between;
  margin-bottom:8px; gap:8px;
}
#laborRatesModal .lrm-lbl { font-size:11px; color:var(--text2); flex:1; line-height:1.3; }
#laborRatesModal .lrm-unit { font-size:10px; color:var(--text3); white-space:nowrap; }
#laborRatesModal .lrm-inp {
  width:60px; background:var(--surface2); border:1px solid var(--border2);
  border-radius:3px; color:var(--text); padding:3px 6px;
  font-size:12px; font-family:'Inter',sans-serif; text-align:right;
  -moz-appearance:textfield;
}
#laborRatesModal .lrm-inp:focus { outline:none; border-color:var(--accent); }
#laborRatesModal .lrm-inp::-webkit-outer-spin-button,
#laborRatesModal .lrm-inp::-webkit-inner-spin-button { -webkit-appearance:none; }
#laborRatesModal .lrm-footer {
  display:flex; gap:6px; margin-top:12px; padding-top:10px;
  border-top:1px solid var(--border);
}
#laborRatesModal .lrm-close { background:none; border:none; color:var(--text3); cursor:pointer; font-size:16px; line-height:1; padding:0; }
#laborRatesModal .lrm-close:hover { color:var(--text); }
.lrm-open-btn {
  display:inline-flex; align-items:center; gap:3px;
  background:var(--surface2); border:1px solid var(--border2);
  border-radius:3px; color:var(--text3); cursor:pointer;
  font-size:9px; font-family:'Inter',sans-serif;
  padding:2px 5px; margin-left:6px; vertical-align:middle;
  transition:border-color .15s, color .15s;
}
.lrm-open-btn:hover { border-color:var(--accent); color:var(--accent); }

/* Quick Estimate */
#quickEstOverlay {
  display:none; position:fixed; inset:0; z-index:8000;
  background:rgba(0,0,0,0.55); backdrop-filter:blur(3px);
  align-items:center; justify-content:center;
}
#quickEstOverlay.open { display:flex; }
#quickEstBox {
  background:var(--surface); border:1px solid var(--border2);
  border-radius:12px; width:340px; max-width:95vw;
  box-shadow:0 20px 60px rgba(0,0,0,0.5); padding:20px;
}
#quickEstBox .qe-title { font-size:15px; font-weight:700; color:var(--text); margin-bottom:4px; display:flex; align-items:center; gap:8px; }
#quickEstBox .qe-disclaimer {
  font-size:11px; color:var(--orange); background:rgba(249,115,22,0.1);
  border:1px solid rgba(249,115,22,0.25); border-radius:var(--radius-sm);
  padding:6px 10px; margin-bottom:14px; line-height:1.5;
}
#quickEstBox .qe-field { margin-bottom:10px; }
#quickEstBox .qe-field label { display:block; font-size:11px; color:var(--text3); font-weight:500; margin-bottom:4px; }
#quickEstResult {
  background:var(--surface2); border:1px solid var(--border);
  border-radius:var(--radius); padding:14px; text-align:center;
  margin:14px 0 10px; display:none;
}
#quickEstResult .qr-range { font-size:26px; font-weight:700; color:var(--green); letter-spacing:-1px; line-height:1.1; }
#quickEstResult .qr-persf { font-size:12px; color:var(--text3); margin-top:4px; }
#quickEstResult .qr-warn  { font-size:10px; color:var(--orange); margin-top:8px; font-style:italic; }
#quickEstBox .qe-actions { display:flex; gap:6px; margin-top:4px; }

/* ── Price staleness banner ───────────────────────────────────── */
#priceStaleBar {
  display:none; background:rgba(249,115,22,0.12); border-bottom:1px solid rgba(249,115,22,0.3);
  padding:5px 16px; font-size:12px; color:var(--orange);
  align-items:center; gap:8px; flex-shrink:0;
}
#priceStaleBar.visible { display:flex; }
#priceStaleBar button { background:none; border:1px solid var(--orange); border-radius:var(--radius-sm); color:var(--orange); padding:2px 8px; font-size:11px; cursor:pointer; font-family:'Inter',sans-serif; margin-left:auto; }
#priceStaleBar button:hover { background:var(--orange); color:#fff; }

/* ── Pump / Short load quick-add ─────────────────────────────── */
.est-quick-add { display:flex; gap:6px; margin-top:8px; flex-wrap:wrap; }
.est-qa-btn {
  display:inline-flex; align-items:center; gap:5px;
  padding:5px 10px; border-radius:var(--radius-sm);
  border:1px dashed var(--border2); background:transparent;
  color:var(--text2); font-size:11px; font-weight:600; cursor:pointer;
  font-family:'Inter',sans-serif; transition:all 0.15s; white-space:nowrap;
}
.est-qa-btn:hover { border-color:var(--accent); color:var(--accent); background:rgba(79,124,255,0.06); }
.est-qa-btn.active { border-style:solid; border-color:var(--accent); color:var(--accent); background:rgba(79,124,255,0.1); }

/* Print */
/* Panel toggle button — hidden on desktop, shown on mobile */
#panelToggleBtn    { display:none; }
#panelBackdrop     { display:none; }
/* Mobile-only elements hidden on desktop */
#mobileToolbar     { display:none; }
#mobileVolChip     { display:none; }
#mobileCrosshairLabel { display:none; }

/* ── Mobile / Touch ───────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Slim topbar */
  #topbar { padding:6px 10px; }
  #topbar .tb-logo { font-size:16px; }
  #unitToggle, .tb-btn:not(#saveProjectBtn):not(#jobHistoryBtn) { display:none; }
  #topbar .tb-spacer { flex:1; }

  /* Full-screen layout */
  #app { position:relative; height:100%; display:flex; }
  #projectBar { display:none; }
  #canvasArea {
    padding:0; gap:0;
    /* topbar~44px + shapeTabs~36px + toolbar~96px = 176px; use 180px for safety */
    height: calc(100vh - 180px);
    min-height: 200px;
    transition: height 0.3s cubic-bezier(0.4,0,0.2,1);
  }
  /* Shrink canvas when panel is open */
  body.mob-panel-open #canvasArea {
    height: calc(100vh - 180px - 70vh);
    min-height: 80px;
  }
  #shapeTabs {
    display:flex; overflow-x:auto; flex-wrap:nowrap;
    -webkit-overflow-scrolling:touch; flex-shrink:0;
  }
  #canvasFooter { display:none; }
  #resizeHandle { display:none; }
  #canvasCard { border-radius:0; border:none; flex:1; height:100%; }
  #drawingCanvas { touch-action:none; }

  /* Panel drag handle */
  #panelDragHandle {
    display:flex; align-items:center; justify-content:center;
    height:28px; flex-shrink:0; cursor:grab;
  }
  #panelDragHandle::before {
    content:''; width:40px; height:4px;
    background:var(--border2); border-radius:2px;
  }
  #panelBackdrop {
    display:none; position:fixed; inset:0; z-index:199;
    background:rgba(0,0,0,0.5);
  }
  #panelBackdrop.visible { display:block; }
  #panelContent { padding:12px; }
  .panel-tab { padding:12px 4px; font-size:10px; }
  .shape-picker-grid { grid-template-columns:repeat(2,1fr); gap:8px; }
  .shape-pick-btn { min-height:64px; font-size:11px; }
  .action-btn { padding:11px; font-size:13px; }
  .mode-toggle button { padding:11px 4px; font-size:12px; }
  button { touch-action:manipulation; }
  .gantt-wrap { overflow-x:auto; }

  /* Fixed crosshair in center — drawn by JS overlay */
  #mobileCrosshair {
    position:absolute; top:50%; left:50%;
    transform:translate(-50%,-50%);
    width:40px; height:40px; pointer-events:none; z-index:10;
    display:none;
  }
  #mobileCrosshair.visible { display:block; }

  /* Volume chip above toolbar */
  #mobileVolChip {
    position:fixed; bottom:88px; left:50%; transform:translateX(-50%);
    background:rgba(15,17,29,0.85); border:1px solid var(--border2);
    border-radius:20px; padding:5px 16px; font-size:13px; font-weight:700;
    color:var(--green); z-index:201; pointer-events:none;
    white-space:nowrap; display:none; backdrop-filter:blur(8px);
  }
  #mobileVolChip.visible { display:block; }

  /* Panel drawer */
  #rightPanel {
    position:fixed; bottom:96px; left:0; right:0;
    width:100% !important; max-width:100% !important;
    height:70vh; border-left:none; border-top:1px solid var(--border);
    border-radius:16px 16px 0 0; z-index:200;
    transform:translateY(110%);
    transition:transform 0.3s cubic-bezier(0.4,0,0.2,1);
    display:flex !important;
  }
  #rightPanel.panel-open { transform:translateY(0); }

  /* Bottom action bar */
  #mobileToolbar {
    display:flex; flex-direction:column;
    position:fixed; bottom:0; left:0; right:0;
    background:var(--surface); border-top:1px solid var(--border);
    z-index:202; padding:8px 12px 12px;
    padding-bottom:calc(12px + env(safe-area-inset-bottom));
  }

  /* Info row */
  #mobInfoRow {
    display:flex; justify-content:space-between; align-items:center;
    margin-bottom:8px; min-height:28px;
  }
  #mobInfoLeft { font-size:12px; color:var(--text2); }
  #mobInfoLeft strong { color:var(--green); font-size:14px; font-weight:700; }
  #mobShapeName {
    font-size:10px; color:var(--text3); font-weight:600;
    text-transform:uppercase; letter-spacing:0.4px;
  }

  /* Action row — hidden when panel is open */
  #mobActionRow {
    display:flex; align-items:center; gap:6px;
    transition: opacity 0.2s, max-height 0.2s;
    max-height: 60px; overflow:hidden;
  }
  body.mob-panel-open #mobActionRow {
    opacity:0; max-height:0; pointer-events:none;
  }
  body.mob-panel-open #mobInfoRow {
    margin-bottom:0;
  }

  .mob-sm-btn {
    flex:1; display:flex; align-items:center; justify-content:center;
    gap:3px; padding:8px 4px; border-radius:8px; border:none;
    background:var(--surface2); color:var(--text2);
    font-size:10px; font-weight:700; text-transform:uppercase;
    letter-spacing:0.3px; cursor:pointer; touch-action:manipulation;
    transition:all 0.15s; white-space:nowrap;
  }
  .mob-sm-btn:active { opacity:0.7; transform:scale(0.96); }
  .mob-sm-btn:disabled { opacity:0.3; pointer-events:none; }
  .mob-sm-btn.success { background:var(--green); color:#fff; }
  .mob-sm-btn.danger  { color:var(--red); }

  /* Big center Add Point button */
  #mobAddPtBtn {
    flex:2; display:flex; align-items:center; justify-content:center;
    gap:5px; padding:11px 8px; border-radius:10px; border:none;
    background:var(--accent); color:#fff;
    font-size:13px; font-weight:700;
    cursor:pointer; touch-action:manipulation;
    box-shadow:0 3px 10px rgba(79,124,255,0.35);
    transition:all 0.15s;
  }
  #mobAddPtBtn:active { transform:scale(0.97); background:var(--accent2); }

  #mobileCrosshairLabel {
    position:fixed; top:50%; left:50%;
    transform:translate(-50%, -44px);
    background:rgba(15,17,29,0.8); color:#fff;
    font-size:11px; font-weight:600; padding:3px 10px;
    border-radius:20px; pointer-events:none; z-index:11;
    white-space:nowrap; backdrop-filter:blur(4px);
    display:none;
  }
  #mobileCrosshairLabel.visible { display:block; }

  /* Hide floating calculate button */
  #calcVolumeFloat { display:none; }

  /* ── Job info bottom sheet ── */
  #mobInfoBackdrop {
    display:none; position:fixed; inset:0; z-index:249; background:rgba(0,0,0,0.5);
  }
  #mobInfoBackdrop.visible { display:block; }
  #projectBar.mob-open {
    display:flex !important;
    flex-direction:column;
    position:fixed;
    bottom:0; left:0; right:0;
    z-index:250;
    background:var(--surface);
    border-top:1px solid var(--border2);
    border-radius:12px 12px 0 0;
    padding:12px 16px calc(16px + env(safe-area-inset-bottom));
    gap:10px;
    overflow-y:auto;
    max-height:65vh;
    height:auto;
    box-shadow:0 -8px 32px rgba(0,0,0,0.4);
  }
  #projectBar.mob-open::before {
    content:''; display:block; width:40px; height:4px;
    background:var(--border2); border-radius:2px; margin:0 auto 4px; flex-shrink:0;
  }
  #projectBar.mob-open .proj-sep { display:none; }
  #projectBar.mob-open .proj-field {
    display:flex; flex-direction:column; gap:4px; width:100%;
  }
  #projectBar.mob-open .proj-field label {
    font-size:10px; font-weight:600; text-transform:uppercase; letter-spacing:0.5px; color:var(--text3);
  }
  #projectBar.mob-open .proj-input {
    min-width:unset !important; max-width:unset !important; width:100%;
    background:var(--surface2) !important;
    border:1px solid var(--border2) !important;
    border-bottom-color:var(--border2) !important;
    border-radius:var(--radius-sm) !important;
    padding:8px 10px !important; font-size:14px !important;
  }
  #projectBar.mob-open #activeShapeNameField { display:none !important; }
}

@media print {
  #topbar, #shapeTabs, #canvasFooter, #panelTabs, #resizeHandle,
  #mobileToolbar, #mobileVolChip, #mobileCrosshair,
  #panelToggleBtn, #panelBackdrop { display:none !important; }
  #projectBar { border:none; background:#fff; color:#000; padding:8px 0; }
  body { background:#fff; color:#000; overflow:auto; height:auto; }
  #app { display:block; }
  #rightPanel { width:100%; border:none; }
  .pane { display:block !important; }
}
