:root {
  --bg: #f4f5f4; --panel: #ffffff; --line: #dadfdd; --line-soft: #e9ecea;
  --ink: #23292e; --muted: #66707a; --accent: #1f7a84; --accent-ink: #ffffff; --accent-soft: #e3f1f2;
  --plan-bg: #ffffff; --grid-minor: #eef2f1; --grid-major: #dce4e2; --wall: #3b4046; --dim: #1f4e8c;
  --counter: rgba(160, 154, 142, .38); --sel: #e0692a;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 13px; color: var(--ink);
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); display: flex; flex-direction: column; overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
.muted { color: var(--muted); } .small { font-size: 12px; }

/* barra superior */
.topbar { display: flex; align-items: center; gap: 14px; height: 40px; padding: 0 12px; background: #1d3236; color: #eef6f6; flex: none; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 650; letter-spacing: .2px; white-space: nowrap; }
.filebar { display: flex; align-items: center; gap: 2px; }
.filebar .sep { width: 1px; height: 20px; background: #3f5a5e; margin: 0 6px; }
.tb { background: transparent; border: 0; color: #d9ebeb; padding: 5px 9px; border-radius: 5px; cursor: pointer; white-space: nowrap; }
.tb:hover:not(:disabled) { background: #2d4a4f; color: #fff; }
.tb:disabled { opacity: .4; cursor: default; }
.projname { margin-left: auto; background: #2a4448; border: 1px solid #3c5a5e; color: #fff; border-radius: 5px; padding: 4px 8px; width: min(320px, 35vw); text-align: center; }
.projname:focus { outline: 2px solid #6cc3cb; }

/* ferramentas */
.toolbar { display: flex; gap: 0; background: var(--panel); border-bottom: 1px solid var(--line); padding: 4px 6px 0; flex: none; overflow-x: auto; }
.toolbar .group { display: flex; flex-direction: column; padding: 0 8px; border-right: 1px solid var(--line-soft); }
.toolbar .group .btns { display: flex; align-items: center; gap: 2px; min-height: 52px; }
.glabel { font-size: 11px; color: var(--muted); text-align: center; padding: 1px 0 3px; }
.tool { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 58px; padding: 4px 6px; border: 1px solid transparent; border-radius: 6px; background: transparent; cursor: pointer; font-size: 12px; }
.tool svg { width: 22px; height: 22px; fill: currentColor; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; stroke-linecap: round; }
.tool:hover:not(:disabled) { background: var(--accent-soft); }
.tool.active { background: var(--accent-soft); border-color: #9fcfd4; color: #134d54; }
.tool:disabled { opacity: .35; cursor: default; }
.check { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; cursor: pointer; padding: 0 6px; }

/* layout */
.layout { flex: 1; display: grid; grid-template-columns: 250px 1fr 270px; min-height: 0; }
.panel { background: var(--panel); display: flex; flex-direction: column; min-height: 0; overflow: auto; }
.panel.left { border-right: 1px solid var(--line); }
.panel.right { border-left: 1px solid var(--line); }
.panel-h { font-weight: 650; padding: 9px 12px 7px; border-bottom: 1px solid var(--line-soft); background: #fafbfa; position: sticky; top: 0; z-index: 1; }
.panel-b { padding: 10px 12px; }
.search { width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 8px; }
.catlist details { border-bottom: 1px solid var(--line-soft); }
.catlist summary { cursor: pointer; padding: 7px 2px; font-weight: 600; list-style: none; display: flex; justify-content: space-between; }
.catlist summary::after { content: '▸'; color: var(--muted); }
.catlist details[open] summary::after { content: '▾'; }
.catlist summary .n { color: var(--muted); font-weight: 400; margin-left: auto; margin-right: 6px; }
.cat-item { display: grid; grid-template-columns: 34px 1fr; gap: 8px; align-items: center; width: 100%; text-align: left; background: none; border: 1px solid transparent; border-radius: 6px; padding: 5px; cursor: pointer; margin-bottom: 2px; }
.cat-item:hover { background: #f2f6f6; border-color: var(--line-soft); }
.cat-item.placing { background: var(--accent-soft); border-color: #9fcfd4; }
.cat-item .ico { width: 34px; height: 30px; border: 1.5px solid #59636b; border-radius: 3px; background: #f3efe7; position: relative; }
.cat-item .ico.aereo { border-style: dashed; background: #eef4f7; }
.cat-item .ico.eletro { background: #e6e9ec; }
.cat-item .ico::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1.5px; height: 3px; background: #59636b; }
.cat-item b { display: block; font-size: 12.5px; }
.cat-item small { color: var(--muted); }

/* centro */
.center { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.tabs { display: flex; gap: 2px; padding: 6px 8px 0; background: var(--bg); flex: none; }
.tab { border: 1px solid var(--line); border-bottom: 0; background: #e9eceb; padding: 6px 16px; border-radius: 7px 7px 0 0; cursor: pointer; }
.tab[aria-selected="true"] { background: var(--panel); font-weight: 600; color: #134d54; }
.views { flex: 1; position: relative; min-height: 0; background: var(--panel); border-top: 1px solid var(--line); }
.view { position: absolute; inset: 0; display: flex; flex-direction: column; }
.view[hidden] { display: none; }
.view.scroll { overflow: auto; }
.canvas-wrap { flex: 1; position: relative; min-height: 0; overflow: hidden; }
.canvas-wrap canvas { position: absolute; inset: 0; display: block; outline: none; }
#planCanvas { cursor: default; }
#planCanvas.crosshair { cursor: crosshair; }
.length-input { position: absolute; width: 90px; padding: 4px 6px; border: 2px solid var(--accent); border-radius: 5px; background: #fff; z-index: 3; }
.layerbar { display: flex; gap: 2px; padding: 4px 8px; border-top: 1px solid var(--line); background: #fafbfa; flex: none; overflow-x: auto; }
.layerbar button { border: 1px solid var(--line); background: #fff; padding: 3px 12px; border-radius: 4px; cursor: pointer; white-space: nowrap; }
.layerbar button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.status { display: flex; justify-content: space-between; gap: 12px; padding: 4px 10px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); background: var(--bg); flex: none; white-space: nowrap; overflow: hidden; }
.bar3d { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 6px 8px; border-bottom: 1px solid var(--line); flex: none; }
.hint3d { margin-left: auto; }
.glfail { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }

/* botões e campos */
.btn { border: 1px solid var(--line); background: #fff; padding: 5px 11px; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.btn:hover { background: #f1f5f5; }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.primary:hover { background: #18656d; }
.btn.danger { color: #a3321a; border-color: #ecc9bf; }
.form { display: grid; gap: 8px; }
.field { display: grid; grid-template-columns: 1fr 110px; align-items: center; gap: 8px; }
.field > span { color: #3f474e; }
.field input, .field select { width: 100%; padding: 4px 6px; border: 1px solid var(--line); border-radius: 5px; background: #fff; text-align: right; }
.field select { text-align: left; }
.field input[type=text] { text-align: left; }
.field.wide { grid-template-columns: 1fr; }
.field.wide input { text-align: left; }
.sel-title { font-weight: 650; font-size: 14px; margin: 0 0 2px; }
.sel-sub { color: var(--muted); margin: 0 0 10px; }
.info { width: 100%; border-collapse: collapse; margin: 6px 0 10px; font-variant-numeric: tabular-nums; }
.info td { padding: 2px 0; border-bottom: 1px dotted var(--line-soft); }
.info td:last-child { text-align: right; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.swatches { display: flex; flex-wrap: wrap; gap: 4px; margin: 2px 0 6px; }
/* amostras de cor em formato de porta (quadro + painel) */
.swatch { position: relative; width: 26px; height: 38px; border-radius: 2px; border: 0; padding: 0; cursor: pointer;
  background: var(--c); box-shadow: 0 0 0 1px rgba(0,0,0,.18); --ln: rgba(0,0,0,.28); }
.swatch.dk { --ln: rgba(255,255,255,.3); }
.swatch::before { content: ''; position: absolute; left: 0; right: 0; top: 9px; border-top: 1px solid var(--ln); }
.swatch::after { content: ''; position: absolute; left: 5px; right: 5px; top: 14px; bottom: 5px; border: 1px solid var(--ln); }
.swatch.door-slim::after { left: 3px; right: 3px; top: 12px; bottom: 3px; }
.swatch.door-bevel::after, .swatch.door-raised::after { box-shadow: inset 0 0 0 2px rgba(255,255,255,.18), inset 0 0 0 3px var(--ln); }
.swatch.door-raised-ornate::after { box-shadow: inset 0 0 0 2px rgba(255,255,255,.22), inset 0 0 0 3px var(--ln), 0 0 0 2px rgba(255,255,255,.18); }
.swatch.grain { background-image: repeating-linear-gradient(92deg, rgba(0,0,0,.05) 0 1px, transparent 1px 3px, rgba(255,255,255,.05) 3px 4px, transparent 4px 7px); background-color: var(--c); }
.swatch i { position: absolute; top: -3px; right: -3px; width: 8px; height: 8px; border-radius: 50%; background: #d9772b; border: 1px solid #fff; }
.swatch.on { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--sel); }
.swatches { gap: 6px; }
.fin-name { margin: 0 0 8px; font-weight: 600; font-size: 12.5px; }
hr.soft { border: 0; border-top: 1px solid var(--line-soft); margin: 10px 0; }

/* posicionamento */
.pad { display: grid; grid-template-columns: repeat(3, 40px); grid-template-rows: repeat(3, 40px); gap: 4px; justify-content: center; margin: 4px 0 10px; }
.pad button { border: 1px solid var(--line); background: #f7f9f9; border-radius: 50%; cursor: pointer; font-size: 16px; }
.pad button:hover { background: var(--accent-soft); }
.pad .c { border-radius: 8px; font-size: 13px; }

/* orçamento */
.budget-wrap { padding: 18px 22px 40px; max-width: 1100px; }
.budget-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.budget-head h2 { margin: 0 0 2px; font-size: 20px; }
.budget-head p { margin: 0; }
.budget-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.budget-actions input { width: 70px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 5px; margin-left: 4px; }
table.budget { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
table.budget th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; border-bottom: 2px solid var(--line); padding: 6px; }
table.budget td { padding: 5px 6px; border-bottom: 1px solid var(--line-soft); }
table.budget .num { text-align: right; white-space: nowrap; }
table.budget tr.grp td { background: #f1f5f4; font-weight: 650; color: #1c4d53; padding-top: 8px; }
table.budget tr.sub td { color: var(--muted); font-size: 12px; }
table.budget tfoot td { font-weight: 600; text-align: right; border-bottom: 0; padding-top: 8px; }
table.budget tr.grand td { font-size: 16px; color: #134d54; border-top: 2px solid var(--line); }
.empty { color: var(--muted); padding: 16px 0; }

/* diálogos */
dialog { border: 1px solid var(--line); border-radius: 10px; padding: 0; box-shadow: 0 20px 60px rgba(0,0,0,.25); max-width: calc(100vw - 32px); }
dialog::backdrop { background: rgba(20, 30, 32, .35); }
dialog.wide { width: 1100px; }
.dlg { padding: 16px 18px; display: grid; gap: 10px; }
.dlg h3 { margin: 0; }
.dlg p { margin: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid2 label { display: grid; gap: 3px; }
.grid2 input { padding: 5px 7px; border: 1px solid var(--line); border-radius: 5px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.dlg-actions.spread { justify-content: space-between; flex-wrap: wrap; }
.dlg-actions.spread > div { display: flex; gap: 6px; flex-wrap: wrap; }
.cat-table-wrap { max-height: 60vh; overflow: auto; border: 1px solid var(--line); border-radius: 6px; }
.cat-table { border-collapse: collapse; width: 100%; font-size: 12px; }
.cat-table th { position: sticky; top: 0; background: #f3f6f5; text-align: left; padding: 5px 4px; font-weight: 600; }
.cat-table td { padding: 2px 3px; border-top: 1px solid var(--line-soft); }
.cat-table input, .cat-table select { width: 100%; padding: 3px 4px; border: 1px solid var(--line); border-radius: 4px; font-size: 12px; }
.cat-table input[type=number] { width: 62px; }
.cat-table input[type=checkbox] { width: auto; }
.cat-table .x { border: 0; background: none; color: #a3321a; cursor: pointer; font-size: 15px; }

/* responsivo */
@media (max-width: 1000px) {
  .layout { grid-template-columns: 210px 1fr; }
  .panel.right { grid-column: 1 / -1; max-height: 34vh; border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 680px) {
  body { overflow: auto; height: auto; }
  .topbar { overflow-x: auto; }
  .layout { display: flex; flex-direction: column; flex: none; }
  .panel.left { max-height: 32vh; border-right: 0; border-bottom: 1px solid var(--line); }
  .center { height: 78vh; flex: none; }
  .panel.right { max-height: none; }
  .projname { display: none; }
  .hint3d { display: none; }
}

/* impressão: só o orçamento */
@media print {
  body { overflow: visible; background: #fff; display: block; }
  .topbar, .toolbar, .panel, .tabs, .status, .no-print, #view-plan, #view-3d, .mbar { display: none !important; }
  body.print-cut #view-budget { display: none !important; }
  body.print-cut #view-cut { position: static; display: block !important; }
  body:not(.print-cut) #view-cut { display: none !important; }
  .cut-card { break-inside: avoid; }
  .layout { display: block; }
  .views { position: static; border: 0; }
  #view-budget { position: static; display: block !important; }
  .budget-wrap { padding: 0; max-width: none; }
}
.glfail[hidden] { display: none; }
table.budget td:nth-child(2), table.budget td:nth-child(4) { white-space: nowrap; }

select.mini { padding: 3px 4px; border: 1px solid var(--line); border-radius: 5px; background: #fff; }

.sub-title { font-weight: 650; margin: 0 0 6px; }
.warn { color: #a3501a; background: #fdf1e6; border: 1px solid #f1d2b6; border-radius: 6px; padding: 5px 8px; font-size: 12px; margin: 6px 0; }
.field.wide select { width: 100%; padding: 4px 6px; border: 1px solid var(--line); border-radius: 5px; background: #fff; }

.swatch.img { width: 30px; height: 64px; background-size: cover; background-position: center; }
.swatch.img::before, .swatch.img::after { display: none; }

.bar3d.light { gap: 10px; background: #fafbfa; }
.bar3d.light input[type=range] { width: 90px; }

.cut-title { margin: 22px 0 4px; font-size: 15px; }
table.budget.cut { margin-top: 8px; }
table.budget.cut thead tr:first-child th { color: #134d54; font-size: 13px; background: #f1f5f4; }
table.budget.cut td.bars { text-align: left; font-weight: 400; font-size: 12px; line-height: 1.6; }

.stones { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; margin: 2px 0 8px; }
.stone { aspect-ratio: 1; border: 0; border-radius: 4px; cursor: pointer; background-size: cover; box-shadow: 0 0 0 1px rgba(0,0,0,.2); padding: 0; }
.stone.on { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--sel); }
/* amostras de cor do puxador: bolinhas metálicas */
.swatches.pulls .swatch { width: 24px; height: 24px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.25); }
.swatches.pulls .swatch::before, .swatches.pulls .swatch::after { display: none; }

/* ===================== Versão mobile (celular / tablet) ===================== */
.mbar, .sheet-x, .sheet-shade { display: none; }
.modebtn { margin-left: 4px; border: 1px solid #3f5a5e !important; }
button, .tab, .cat-item, .tool, .btn { touch-action: manipulation; }
html.mobile, html.mobile body { height: 100%; overflow: hidden; overscroll-behavior: none; }
html.mobile body { -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; padding-bottom: env(safe-area-inset-bottom); }
html.mobile input, html.mobile select, html.mobile textarea { -webkit-user-select: text; user-select: text; font-size: 16px; }
/* topo e ferramentas compactos, rolagem lateral */
html.mobile .topbar { height: 46px; gap: 6px; padding: 0 6px; overflow-x: auto; scrollbar-width: none; }
html.mobile .brand span { display: none; }
html.mobile .filebar { flex: none; }
html.mobile .tb { padding: 8px 10px; }
html.mobile .projname { display: block; width: 130px; flex: none; margin-left: 4px; }
html.mobile .modebtn { flex: none; margin-left: auto; }
html.mobile .toolbar { padding: 2px 4px; scrollbar-width: none; }
html.mobile .toolbar .group { padding: 0 4px; }
html.mobile .toolbar .group .btns { min-height: 50px; }
html.mobile .glabel { display: none; }
html.mobile .tool { min-width: 54px; padding: 5px 4px; font-size: 11px; }
html.mobile .tool svg { width: 24px; height: 24px; }
/* área central ocupa tudo; catálogo e painel viram gavetas */
html.mobile .layout { display: block; position: relative; flex: 1; min-height: 0; }
html.mobile .center { height: 100%; }
html.mobile .tabs { padding: 4px 6px 0; }
html.mobile .tab { padding: 9px 16px; flex: 1; text-align: center; }
html.mobile .layerbar button { padding: 7px 12px; }
html.mobile .bar3d { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
html.mobile .bar3d .btn, html.mobile .bar3d select { padding: 8px 12px; flex: none; }
html.mobile .status { font-size: 12px; }
html.mobile .status #statusPos { display: none; }
html.mobile .panel.left, html.mobile .panel.right {
  display: flex; position: fixed; left: 0; right: 0; bottom: calc(60px + env(safe-area-inset-bottom)); z-index: 40;
  max-height: none; height: min(64vh, 560px); border: 0; border-top: 1px solid var(--line); border-radius: 14px 14px 0 0;
  box-shadow: 0 -10px 30px rgba(0,0,0,.18); transform: translateY(115%); transition: transform .22s ease; overflow: auto;
}
html.mobile.sheet-catalog .panel.left, html.mobile.sheet-props .panel.right { transform: none; }
html.mobile .panel-h { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; font-size: 15px; }
html.mobile .panel-h::before { content: ''; position: absolute; left: 50%; top: 5px; width: 40px; height: 4px; margin-left: -20px; border-radius: 3px; background: #cfd5d3; }
html.mobile .sheet-x { display: inline-grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 50%; background: #eef1f0; font-size: 16px; cursor: pointer; }
html.mobile .sheet-shade { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.18); z-index: 39; opacity: 0; pointer-events: none; transition: opacity .2s; }
html.mobile.sheet-catalog .sheet-shade, html.mobile.sheet-props .sheet-shade { opacity: 1; pointer-events: auto; }
/* alvos de toque maiores */
html.mobile .cat-item { padding: 10px 8px; grid-template-columns: 40px 1fr; }
html.mobile .catlist summary { padding: 12px 4px; }
html.mobile .search { padding: 10px; }
html.mobile .btn { padding: 10px 14px; }
html.mobile .field { grid-template-columns: 1fr 150px; }
html.mobile .field input, html.mobile .field select { padding: 8px; min-height: 40px; }
html.mobile .swatch { width: 34px; height: 48px; }
html.mobile .swatch.img { width: 36px; height: 72px; }
html.mobile .swatches.pulls .swatch { width: 34px; height: 34px; }
html.mobile dialog { max-width: 96vw; }
/* barra de ações embaixo */
html.mobile .mbar { display: flex; flex: none; justify-content: space-around; gap: 2px; height: calc(60px + env(safe-area-inset-bottom)); padding: 4px 4px env(safe-area-inset-bottom);
  background: var(--panel); border-top: 1px solid var(--line); position: relative; z-index: 41; }
html.mobile .mbar button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border: 0; background: none; border-radius: 8px; font-size: 11px; color: var(--ink); min-width: 0; }
html.mobile .mbar button:active { background: var(--accent-soft); }
html.mobile .mbar svg { width: 24px; height: 24px; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
html.mobile.sheet-catalog .mbar [data-m="catalog"], html.mobile.sheet-props .mbar [data-m="props"] { color: var(--accent); background: var(--accent-soft); }
@media (max-width: 420px) { html.mobile .mbar [data-cmd="redo"] { display: none; } html.mobile .projname { display: none; } }
/* celular em pé: ferramentas em uma linha mais baixa, só ícone */
@media (max-width: 600px) {
  html.mobile .tool span { display: none; }
  html.mobile .tool { min-width: 46px; }
  html.mobile .toolbar .group .btns { min-height: 44px; }
  html.mobile .toolbar .check { font-size: 12px; }
  html.mobile .filebar .tb[data-cmd="undo"], html.mobile .filebar .tb[data-cmd="redo"], html.mobile .filebar .sep { display: none; }
  html.mobile .tab { padding: 8px 6px; font-size: 13px; }
  html.mobile .modebtn { font-size: 12px; padding: 6px 8px; }
}

/* ---- mobile: travas de gesto, modo caneta, tablet deitado e celular deitado ---- */
html.mobile .views, html.mobile .canvas-wrap { touch-action: none; }
html.mobile .view.scroll { touch-action: pan-x pan-y; }
html.mobile .panel, html.mobile .view.scroll { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
html.mobile .panel { touch-action: pan-y; }
html.mobile .toolbar, html.mobile .topbar, html.mobile .layerbar, html.mobile .bar3d { touch-action: pan-x; overscroll-behavior: contain; }
html.mobile .mbar [data-m="pen"][aria-pressed="true"] { color: #fff; background: var(--accent); }
.offer { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 60; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: #1d3236; color: #fff; padding: 10px 14px; border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.25); max-width: 94vw; }
.offer .btn:not(.primary) { background: transparent; color: #fff; border-color: #5a7a7e; }

/* tablet deitado (tela larga): catálogo e painel fixos dos lados, como no computador, com alvos de toque grandes */
@media (min-width: 1100px) {
  html.mobile .layout { display: grid; grid-template-columns: 270px 1fr 310px; }
  html.mobile .panel.left, html.mobile .panel.right { position: static; transform: none; height: auto; border-radius: 0; box-shadow: none; border-top: 0; transition: none; }
  html.mobile .panel.left { border-right: 1px solid var(--line); }
  html.mobile .panel.right { border-left: 1px solid var(--line); }
  html.mobile .sheet-x, html.mobile .sheet-shade, html.mobile .panel-h::before, html.mobile .mbar [data-m="catalog"], html.mobile .mbar [data-m="props"] { display: none !important; }
}
/* celular deitado: barra de ações vira coluna à direita e as gavetas abrem pela lateral */
@media (orientation: landscape) and (max-height: 540px) {
  html.mobile body { padding-right: calc(66px + env(safe-area-inset-right)); padding-bottom: 0; }
  html.mobile .mbar { position: fixed; top: 0; right: 0; bottom: 0; width: calc(66px + env(safe-area-inset-right)); height: auto; flex-direction: column;
    border-top: 0; border-left: 1px solid var(--line); padding: 4px env(safe-area-inset-right) 4px 4px; overflow-y: auto; }
  html.mobile .mbar button { flex: 1 1 0; min-height: 40px; font-size: 10px; }
  html.mobile .mbar svg { width: 20px; height: 20px; }
  html.mobile .panel.left, html.mobile .panel.right { top: 0; bottom: 0; left: 0; right: auto; width: min(380px, 62vw); height: auto; border-radius: 0 14px 14px 0; transform: translateX(-105%); }
  html.mobile.sheet-catalog .panel.left, html.mobile.sheet-props .panel.right { transform: none; }
  html.mobile .topbar { height: 38px; }
  html.mobile .tool span, html.mobile .glabel { display: none; }
  html.mobile .tool { min-width: 42px; padding: 3px; }
  html.mobile .toolbar .group .btns { min-height: 38px; }
  html.mobile .tab { padding: 5px 6px; }
  html.mobile .layerbar { display: none; }
}

/* ---------- Projeto de corte ---------- */
.cut-wrap { padding: 16px 20px 40px; max-width: 1200px; margin: 0 auto; }
.cut-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.cut-head h2 { margin: 0 0 4px; }
.cut-legend { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; margin: 10px 0 14px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fafbfa; }
.cut-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cut-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 14px; }
.cut-card { border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 10px 12px; cursor: pointer; }
.cut-card.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); cursor: default; }
.cut-card header { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; justify-content: space-between; margin-bottom: 4px; }
.cut-card .small-btn { padding: 3px 10px; }
.cut-edit { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line-soft); }
.cut-svg { display: block; }
.cut-svg .stone, .bs-card .stone { fill: #f6f5f1; stroke: #222; stroke-width: 1.4; }
.cut-svg .cut { fill: #fff; stroke: #222; stroke-width: 1.2; }
.cut-svg .hole { fill: #fff; stroke: #222; stroke-width: 1.1; }
.cut-svg .ctr { stroke: #b0461b; stroke-dasharray: 4 3; stroke-width: 1; }
svg .dim line, svg .dim path, svg line.dim { stroke: #9aa0a6; stroke-width: 1; fill: none; }
svg .dim text { font: 11px system-ui, sans-serif; fill: #333; }
svg .dim.c text { fill: #b0461b; } svg .dim.c line, svg .dim.c path { stroke: #d9a08a; }
svg .splash { stroke: #1f3fd6; stroke-width: 1.6; }
svg .eased { fill: #fff; stroke: #222; stroke-width: 1.3; }
svg .unf { stroke: #222; stroke-width: 1.5; }
.bs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 8px 14px; }
.bs-card { display: flex; flex-direction: column; }
.bs-card .bs-t { font: 600 10px system-ui, sans-serif; fill: #555; } .bs-card .bs-l { font: 11px system-ui, sans-serif; fill: #333; }
.cut-sum { columns: 2; padding-left: 18px; }
@media (max-width: 700px) { .cut-grid { grid-template-columns: 1fr; } .cut-sum { columns: 1; } }
.cut-svg .stone-f { fill: #f6f5f1; stroke: none; }
.cut-svg .outline { stroke: #222; stroke-width: 1.4; }
.cut-edit .sub-title { margin: 8px 0 2px; color: var(--accent); }
/* orçamento: grupos fora (desmarcados) ficam apagados na tela e somem na impressão */
.grp-chk { display: inline-flex; align-items: center; gap: 4px; font-weight: 400; font-size: 12px; margin-right: 10px; color: var(--muted); cursor: pointer; }
.grp-chk input { margin: 0; }
.grp-chk.opt-f { float: right; margin: 0; }
tbody.off td { opacity: .45; } tbody.off tr.grp td { opacity: 1; }
tbody.off tr.grp td, tbody.off tr.grp td * { text-decoration: none; }
tbody.off tr:not(.grp) { display: none; }
div.off > :not(.grp-line) { display: none; }
.grp-line { margin: 18px 0 4px; }
@media print { tbody.off, div.off, .grp-chk { display: none !important; } }
/* arquivos (.ora) */
.file-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.ftabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.ftabs button { border: 1px solid transparent; border-bottom: none; background: none; padding: 7px 12px; border-radius: 6px 6px 0 0; cursor: pointer; font: inherit; color: var(--muted); }
.ftabs button.on { border-color: var(--line); background: var(--panel, #fff); color: inherit; font-weight: 600; margin-bottom: -1px; }
#fileBody { display: grid; gap: 8px; min-height: 220px; align-content: start; }
.file-tools { display: flex; gap: 6px; flex-wrap: wrap; }
.file-tools input { flex: 1; min-width: 180px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; }
.file-table td { padding: 6px 6px; vertical-align: middle; }
.file-table tr.cur td { background: rgba(31,122,132,.07); }
.file-table td.acts { white-space: nowrap; text-align: right; }
.file-table td.acts .btn { padding: 3px 8px; font-size: 12px; margin-left: 3px; }
.btn.danger { color: #b3261e; }
.tag { font-size: 11px; background: #1f7a84; color: #fff; border-radius: 9px; padding: 1px 7px; }
.drop { border: 2px dashed var(--line); border-radius: 10px; padding: 28px; text-align: center; display: grid; gap: 10px; justify-items: center; }
.drop.over { border-color: #1f7a84; background: rgba(31,122,132,.06); }
.offer.recover { bottom: 70px; }
html.mobile .file-table td.acts { white-space: normal; }
/* miniaturas 3D do catálogo e prévia rápida */
.thumb-host { position: absolute; left: -10000px; top: 0; width: 400px; height: 300px; overflow: hidden; pointer-events: none; visibility: visible; }
.cat-item { grid-template-columns: 56px 1fr; }
.cat-item .thumb { width: 56px; height: 46px; position: relative; display: grid; place-items: center; background: #f5f6f5; border-radius: 5px; overflow: hidden; }
.cat-item .thumb img { width: 100%; height: 100%; object-fit: contain; display: none; }
.cat-item .thumb img.ok { display: block; }
.cat-item .thumb img.ok + .ico { display: none; }
.cat-item .thumb .ico { width: 30px; height: 26px; }
.cat-pv-opt { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin: -2px 0 8px; cursor: pointer; }
.cat-preview { position: fixed; z-index: 70; width: 260px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 34px rgba(0,0,0,.18); padding: 8px 10px 10px; pointer-events: none; }
.cat-preview img { width: 100%; height: 210px; object-fit: contain; display: block; background: linear-gradient(#f7f8f8, #eceeed); border-radius: 6px; }
.cat-preview .pv-t { font-size: 13px; margin-top: 7px; }
.cat-preview .pv-s { font-size: 12px; color: var(--muted); margin-top: 2px; }
html.mobile .cat-pv-opt { display: none; }
/* aviso flutuante */
.toasts { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 90; display: grid; gap: 8px; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; background: #1f2b2d; color: #fff; padding: 10px 16px; border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.25); font-size: 14px; opacity: 0; transform: translateY(-8px); transition: opacity .25s, transform .25s; }
.toast.in { opacity: 1; transform: none; }
.toast .tick { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #2e9d6a; font-weight: 700; }
.btn.icon-dl { display: inline-grid; place-items: center; padding: 3px 7px; }
/* novo projeto: escolha do catálogo */
.cat-line { font-size: 11px; font-weight: 600; background: var(--accent-soft, #e3f1f2); color: #1f6f78; border-radius: 9px; padding: 1px 8px; margin-left: 6px; vertical-align: 1px; }
.cat-line-ro { justify-self: end; }
.new-dlg { width: min(520px, 92vw); }
.line-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.line-pick input { position: absolute; opacity: 0; }
.lp-card { display: grid; justify-items: center; gap: 4px; text-align: center; border: 2px solid var(--line); border-radius: 10px; padding: 12px 10px; cursor: pointer; }
.lp-card svg { width: 64px; height: 74px; }
.lp-card small { color: var(--muted); font-size: 12px; }
.lp-box { fill: #e9e4da; stroke: #59636b; stroke-width: 1.2; }
.lp-door { fill: #fff; stroke: #59636b; stroke-width: 1; }
.line-pick input:checked + .lp-card { border-color: #1f7a84; background: rgba(31,122,132,.06); }
.line-pick input:focus-visible + .lp-card { outline: 2px solid #1f7a84; outline-offset: 2px; }
.np-name { display: grid; gap: 4px; }
.np-name input { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; }
/* Salvo Cloud (servidor) */
.cloud-bar { display: flex; align-items: center; gap: 8px; font-size: 13px; background: #f3f7f7; border: 1px solid var(--line-soft, #e3e8e8); border-radius: 8px; padding: 6px 8px 6px 10px; }
.cloud-bar > span:nth-child(2) { flex: 1; }
.cloud-dot { width: 9px; height: 9px; border-radius: 50%; background: #2e9d6a; flex: none; }
.cloud-dot.off { background: #c0392b; }
.legacy { font-size: 13px; background: #fff8e6; border: 1px solid #f0dca8; border-radius: 8px; padding: 7px 10px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cloud-login { display: grid; gap: 10px; max-width: 420px; margin: 8px auto; }
.cloud-login label { display: grid; gap: 4px; font-size: 13px; }
.cloud-login input { padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; }
.cloud-err { color: #b3261e; font-size: 13px; min-height: 1em; margin: 0; }
/* tela de entrada: login / criar usuário */
html.gated body > *:not(.auth-screen):not(.toasts) { filter: blur(2px); }
.auth-screen { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 16px; background: rgba(22, 34, 36, .55); }
.auth-card { width: min(400px, 100%); background: #fff; border-radius: 14px; box-shadow: 0 24px 70px rgba(0,0,0,.3); padding: 22px 22px 18px; display: grid; gap: 14px; }
.auth-brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 18px; color: #1f2b2d; }
.auth-brand svg { color: #1f7a84; }
.auth-tabs { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: #eef2f2; border-radius: 8px; padding: 3px; }
.auth-tabs button { border: 0; background: none; padding: 8px; border-radius: 6px; font: inherit; color: var(--muted); cursor: pointer; }
.auth-tabs button.on { background: #fff; color: #1f2b2d; font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.auth-form { display: grid; gap: 10px; }
.auth-form label { display: grid; gap: 4px; font-size: 13px; }
.auth-form input { padding: 9px 10px; border: 1px solid var(--line); border-radius: 7px; font-size: 15px; }
.auth-form .auth-go { padding: 10px; font-size: 15px; }
.auth-err { color: #b3261e; font-size: 13px; min-height: 1.1em; margin: 0; }
.auth-alt { margin: 0; text-align: center; font-size: 13px; color: var(--muted); }
.linkbtn { border: 0; background: none; color: #1f7a84; font: inherit; cursor: pointer; padding: 0; text-decoration: underline; }
.auth-off { font-size: 12px; color: var(--muted); }
.tb.userchip { margin-left: auto; margin-right: 6px; border: 1px solid rgba(255,255,255,.25); border-radius: 14px; padding: 3px 12px 3px 10px; }
.tb.userchip::before { content: '●'; color: #4cc38a; margin-right: 6px; font-size: 10px; vertical-align: 1px; }
/* conta, planos e pagamento */
.auth-title { margin: 0; font-size: 17px; }
.auth-info { margin: 0; font-size: 14px; color: #33413f; line-height: 1.45; }
.auth-info.ok { background: #eaf6ef; border: 1px solid #bfe3cd; border-radius: 8px; padding: 10px 12px; }
.auth-alt.left { text-align: left; margin-top: -4px; }
.acct-menu { position: fixed; z-index: 120; min-width: 240px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 14px 40px rgba(0,0,0,.18); padding: 6px; display: grid; }
.acct-menu .am-head { padding: 8px 10px 4px; display: grid; }
.acct-menu .am-head small { color: var(--muted); }
.acct-menu .am-plan { padding: 2px 10px 8px; display: flex; gap: 8px; align-items: center; border-bottom: 1px solid var(--line-soft, #e8ecec); margin-bottom: 4px; }
.acct-menu .am-plan small { color: var(--muted); }
.acct-menu button { text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 6px; font: inherit; cursor: pointer; }
.acct-menu button:hover, .acct-menu button:focus-visible { background: #f0f5f5; }
.plan-badge { font-size: 11px; font-weight: 700; border-radius: 9px; padding: 2px 8px; background: #e9eeee; color: #33413f; }
.plan-badge.p-basic { background: #e3f1f2; color: #1f6f78; }
.plan-badge.p-premium { background: #fbefd5; color: #8a5a00; }
.plan-badge.p-master { background: #1f2b2d; color: #fff; }
.plan-now { font-size: 14px; }
.plan-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 12px 0; }
.plan-card { border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: grid; gap: 6px; align-content: start; }
.plan-card.cur { border-color: #1f7a84; box-shadow: 0 0 0 2px rgba(31,122,132,.15) inset; }
.plan-card h4 { margin: 0; font-size: 16px; }
.plan-card p { margin: 0; font-size: 13px; color: #4b5856; }
.pc-price { font-size: 24px; font-weight: 700; }
.pc-price small { font-size: 13px; font-weight: 400; color: var(--muted); }
.pc-tag { justify-self: start; font-size: 12px; color: #1f6f78; font-weight: 600; }
.plan-card .btn { justify-self: start; margin-top: 4px; }
.plan-manage { margin: 0 0 6px; }
.pay-err { color: #b3261e; font-size: 13px; min-height: 1em; margin: 6px 0 0; }
.pay-msg { display: grid; justify-items: center; text-align: center; gap: 8px; padding: 18px 8px 8px; }
.pay-msg h4 { margin: 0; font-size: 18px; }
.pay-msg p { margin: 0; max-width: 460px; }
.pay-ico { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 22px; color: #fff; background: #2e9d6a; }
.pay-ico.warn { background: #d08a00; }
.pay-ico.spin { background: none; border: 4px solid #d6e4e4; border-top-color: #1f7a84; animation: payspin 1s linear infinite; }
@keyframes payspin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .pay-ico.spin { animation: none; } }
/* escolha do período (mensal / trimestral / anual) */
.period-pick { display: inline-flex; gap: 2px; background: #eef2f2; border-radius: 9px; padding: 3px; margin-top: 10px; }
.period-pick button { border: 0; background: none; padding: 7px 14px; border-radius: 7px; font: inherit; color: var(--muted); cursor: pointer; }
.period-pick button.on { background: #fff; color: #1f2b2d; font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.pc-eq { color: #1f6f78; font-size: 12px; margin-top: -2px; }
.pc-price.na { color: var(--muted); }

/* ---------- recursos dos planos pagos (bloqueados no Grátis) ---------- */
.locked { position: relative; opacity: .62; }
.locked:hover { opacity: .85; }
.tab.locked::after, .tool.locked::after, .btn.locked::after {
  content: ''; display: inline-block; width: 11px; height: 11px; margin-left: 5px; vertical-align: -1px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 10V7a5 5 0 0 1 10 0v3h1a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V11a1 1 0 0 1 1-1zm2 0h6V7a3 3 0 0 0-6 0z'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 10V7a5 5 0 0 1 10 0v3h1a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V11a1 1 0 0 1 1-1zm2 0h6V7a3 3 0 0 0-6 0z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.tool.locked::after { position: absolute; top: 3px; right: 3px; margin: 0; }
.btn.icon-dl.locked::after { position: absolute; top: -3px; right: -3px; margin: 0; width: 10px; height: 10px; }
.plan-lock { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; margin: 0 0 12px; border-radius: 8px;
  background: color-mix(in srgb, var(--accent, #1f7a7a) 10%, transparent); border: 1px solid color-mix(in srgb, var(--accent, #1f7a7a) 35%, transparent); }
.plan-lock small { color: var(--muted, #666); }
.lock-ico { flex: none; width: 18px; height: 18px; margin-top: 1px; background: var(--accent, #1f7a7a);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 10V7a5 5 0 0 1 10 0v3h1a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V11a1 1 0 0 1 1-1zm2 0h6V7a3 3 0 0 0-6 0z'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 10V7a5 5 0 0 1 10 0v3h1a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V11a1 1 0 0 1 1-1zm2 0h6V7a3 3 0 0 0-6 0z'/%3E%3C/svg%3E") center / contain no-repeat; }
.pc-feat { list-style: none; padding: 0; margin: 4px 0 10px; font-size: 12.5px; }
.pc-feat li { padding: 2px 0 2px 18px; position: relative; }
.pc-feat li::before { position: absolute; left: 0; font-weight: 700; }
.pc-feat li.yes::before { content: '✓'; color: #1f7a4a; }
.pc-feat li.no { color: var(--muted, #888); text-decoration: line-through; }
.pc-feat li.no::before { content: '✕'; color: #b04040; text-decoration: none; }

/* ---------- idioma e configurações ---------- */
.tb.setbtn { display: inline-flex; align-items: center; padding: 5px 7px; }
.tb.userchip[hidden] + .tb.setbtn { margin-left: auto; }
.settings-dlg { min-width: min(420px, 92vw); }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 12px; font-weight: 600; }
.set-row select { min-width: 170px; padding: 6px 8px; }
.settings-dlg p.small { margin: 4px 0 6px; }
.auth-top { display: flex; justify-content: flex-end; margin: -6px -6px 2px 0; }
.auth-lang { font-size: 12.5px; padding: 3px 6px; border-radius: 6px; border: 1px solid #d5dbe0; background: #fff; color: inherit; }
.auth-form label small { display: block; font-weight: 400; margin-top: 3px; }
.auth-form select.lang-pick:not(.auth-lang) { width: 100%; padding: 8px; margin-top: 4px; }
