/* BLObra — sistema visual "tijolinhos" */
:root {
  --terra: #B65F42;
  --terra-hover: #A2533A;
  --brick: #783D2D;
  --sand: #F3E9D9;
  --sand-2: #EADCC6;
  --white: #FFFFFF;
  --bg: #F7F7F5;
  --ink: #292724;
  --ink-2: #5E5852;
  --ink-3: #8A837C;
  --line: #E7E2DA;
  --line-2: #D9D2C7;
  --green: #39845B;
  --green-bg: #E8F3EC;
  --red: #B23A35;
  --red-bg: #FBECEA;
  --amber: #9A6A12;
  --amber-bg: #FBF3E2;
  --brick-soft: #EAD7C3;
  --brick-mid: #D9A98F;

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --shadow: 0 1px 2px rgba(60, 40, 30, .05), 0 2px 8px rgba(60, 40, 30, .04);
  --shadow-lg: 0 10px 30px rgba(60, 40, 30, .14);
  --font: 'Archivo', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --nav-h: 64px;
  --side-w: 248px;
  --t: 140ms ease;

  /* padrão de alvenaria: fiadas com juntas desencontradas */
  --bricks: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='24' viewBox='0 0 48 24'%3E%3Cg fill='%23B65F42'%3E%3Crect x='1' y='1' width='22' height='10' rx='1.2'/%3E%3Crect x='25' y='1' width='22' height='10' rx='1.2'/%3E%3Crect x='-11' y='13' width='22' height='10' rx='1.2'/%3E%3Crect x='13' y='13' width='22' height='10' rx='1.2'/%3E%3Crect x='37' y='13' width='22' height='10' rx='1.2'/%3E%3C/g%3E%3C/svg%3E");
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
body.no-scroll { overflow: hidden; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
p { margin: 0; }
a { color: var(--terra); }
button { font: inherit; color: inherit; }
.ic { flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid rgba(182, 95, 66, .45); outline-offset: 2px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* ---------- marca ---------- */
.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.logo-text { display: flex; flex-direction: column; line-height: 1.05; }
.logo-name { font-size: 1.32rem; font-weight: 500; letter-spacing: -.02em; font-stretch: 112%; }
.logo-name b { font-weight: 800; color: var(--brick); }
.logo-sub { font-size: .72rem; color: var(--ink-3); margin-top: 3px; letter-spacing: .01em; }

/* ---------- estrutura ---------- */
.shell { min-height: 100vh; min-height: 100dvh; }
.main-col { min-width: 0; }
.side { display: none; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: rgba(255, 255, 255, .94); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar .logo-sub { display: none; }
.save-dot { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; color: var(--ink-3); }
.save-dot::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.save-dot.err { color: var(--red); }
.save-dot.err::before { background: var(--red); }
main { padding: 16px 16px calc(var(--nav-h) + 28px + env(safe-area-inset-bottom)); max-width: 1120px; margin: 0 auto; }

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--white); border-top: 1px solid var(--line);
}
.bottom-nav a, .bottom-nav button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: .72rem; font-weight: 600; color: var(--ink-3); text-decoration: none;
  border: 0; background: none; cursor: pointer; position: relative;
}
.bottom-nav .on { color: var(--terra); }
.bottom-nav .on::before { content: ''; position: absolute; top: 0; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--terra); }

@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: var(--side-w) 1fr; }
  .topbar, .bottom-nav { display: none; }
  .side {
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
    background: var(--white); border-right: 1px solid var(--line); padding: 22px 14px 0;
  }
  .side .logo { padding: 0 8px 22px; }
  .side nav { display: flex; flex-direction: column; gap: 2px; }
  .side nav a {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
    color: var(--ink-2); text-decoration: none; font-weight: 550; font-size: .95rem;
  }
  .side nav a:hover { background: var(--bg); color: var(--ink); }
  .side nav a.on { background: var(--sand); color: var(--brick); }
  .side nav a.on .ic { color: var(--terra); }
  .side .side-sep { height: 1px; background: var(--line); margin: 10px 8px; }
  .side-foot { margin-top: auto; padding: 14px 8px 18px; position: relative; }
  .side-foot::before { content: ''; position: absolute; left: -14px; right: -14px; bottom: 0; height: 84px; background: var(--bricks); opacity: .08; -webkit-mask-image: linear-gradient(transparent, #000); mask-image: linear-gradient(transparent, #000); }
  .side-foot .save-dot { position: relative; }
  main { padding: 32px 40px 60px; }
}

/* ---------- cabeçalho de página ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head > div:first-child { flex: 1 1 260px; min-width: 0; }
.page-head .sub { color: var(--ink-2); margin-top: 4px; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-2); text-decoration: none; font-size: .9rem; font-weight: 550; margin-bottom: 10px; border: 0; background: none; padding: 4px 0; cursor: pointer; }
.back:hover { color: var(--terra); }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 18px; border-radius: 11px; border: 1px solid transparent;
  font-weight: 650; font-size: .97rem; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background var(--t), border-color var(--t), color var(--t), transform var(--t);
  position: relative;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--terra); color: #fff; }
.btn-primary:hover { background: var(--terra-hover); }
.btn-dark { background: var(--brick); color: #fff; }
.btn-dark:hover { background: #64321F; }
.btn-ghost { background: var(--white); border-color: var(--line-2); color: var(--ink); }
.btn-ghost:hover { border-color: var(--terra); color: var(--brick); }
.btn-soft { background: var(--sand); color: var(--brick); }
.btn-soft:hover { background: var(--sand-2); }
.btn-danger { background: var(--red); color: #fff; }
.btn-link { background: none; border: 0; color: var(--terra); padding: 0 6px; min-height: 36px; }
.btn-sm { min-height: 38px; padding: 6px 12px; font-size: .9rem; border-radius: 9px; white-space: normal; text-align: left; line-height: 1.25; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn.is-busy { color: transparent !important; pointer-events: none; }
.btn.is-busy::after { content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid currentColor; border-color: rgba(255,255,255,.9) rgba(255,255,255,.9) transparent transparent; animation: spin .7s linear infinite; }
.btn-ghost.is-busy::after, .btn-soft.is-busy::after { border-color: var(--terra) var(--terra) transparent transparent; }
.btn.is-ok { background: var(--green); color: #fff; border-color: var(--green); }
.btn.is-err { animation: shake .3s; border-color: var(--red); }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shake { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 0; background: transparent; color: var(--ink-2); cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--bg); color: var(--ink); }
.icon-btn.danger:hover { color: var(--red); background: var(--red-bg); }

/* ---------- superfícies ---------- */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.card-pad { padding: 18px; }
.card + .card, .card + .section, .section + .section, .section + .card { margin-top: 16px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.section-title h2 { font-size: 1.08rem; }
.muted { color: var(--ink-2); }
.small { font-size: .86rem; }
.tiny { font-size: .78rem; color: var(--ink-3); }
.row { display: flex; gap: 10px; align-items: center; }
.row-wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.spacer { height: 16px; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }
.grid-2 { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.grid-3 { display: grid; gap: 12px; grid-template-columns: repeat(3, 1fr); }
@media (max-width: 560px) { .grid-3 { grid-template-columns: 1fr 1fr; } .grid-3 > .span-all, .grid-2 > .span-all { grid-column: 1 / -1; } }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 99px; font-size: .78rem; font-weight: 600; background: var(--bg); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.chip-terra { background: var(--sand); color: var(--brick); border-color: transparent; }
.chip-green { background: var(--green-bg); color: var(--green); border-color: transparent; }
.chip-red { background: var(--red-bg); color: var(--red); border-color: transparent; }
.chip-amber { background: var(--amber-bg); color: var(--amber); border-color: transparent; }

/* ---------- formulários ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field .label { font-size: .88rem; font-weight: 600; color: var(--ink); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.req { color: var(--terra); }
.input { position: relative; display: flex; align-items: stretch; background: var(--white); border: 1.5px solid var(--line-2); border-radius: 10px; transition: border-color var(--t), box-shadow var(--t); }
.input:focus-within { border-color: var(--terra); box-shadow: 0 0 0 3px rgba(182, 95, 66, .14); }
.input input { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; font-size: 1.02rem; padding: 0 12px; height: 46px; color: var(--ink); outline: none; border-radius: 10px; }
.input .unit, .input .prefix { display: flex; align-items: center; padding: 0 12px; color: var(--ink-3); font-size: .9rem; font-weight: 600; white-space: nowrap; }
.input .unit { border-left: 1px solid var(--line); background: #FBFAF8; border-radius: 0 9px 9px 0; }
.input .prefix { padding-right: 0; }
.select { position: relative; }
.select select, textarea { width: 100%; font: inherit; font-size: 1rem; color: var(--ink); background: var(--white); border: 1.5px solid var(--line-2); border-radius: 10px; outline: none; transition: border-color var(--t); }
.select select { height: 46px; padding: 0 38px 0 12px; appearance: none; -webkit-appearance: none; cursor: pointer; }
.select::after { content: ''; position: absolute; right: 15px; top: 50%; width: 8px; height: 8px; border: solid var(--ink-3); border-width: 0 2px 2px 0; transform: translateY(-70%) rotate(45deg); pointer-events: none; }
textarea { padding: 10px 12px; resize: vertical; min-height: 80px; }
.select select:focus, textarea:focus { border-color: var(--terra); box-shadow: 0 0 0 3px rgba(182, 95, 66, .14); }
.help { font-size: .8rem; color: var(--ink-3); }
.err { font-size: .82rem; color: var(--red); font-weight: 550; display: none; }
.field.has-err .err { display: block; }
.field.has-err .input, .field.has-err select, .field.has-err textarea { border-color: var(--red); }
.form-err { display: none; background: var(--red-bg); color: var(--red); padding: 10px 12px; border-radius: 10px; font-size: .9rem; font-weight: 550; }
.form-err.on { display: flex; gap: 8px; align-items: flex-start; }
.seg { display: flex; background: var(--bg); border: 1px solid var(--line); border-radius: 11px; padding: 3px; gap: 3px; flex-wrap: wrap; }
.seg-btn { flex: 1 1 auto; min-height: 40px; border: 0; background: none; border-radius: 8px; font-weight: 600; font-size: .9rem; color: var(--ink-2); cursor: pointer; padding: 0 12px; }
.seg-btn.on { background: var(--white); color: var(--brick); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: .95rem; }
.check input { width: 20px; height: 20px; accent-color: var(--terra); }
.form-grid { display: grid; gap: 14px; }
.src { display: inline-flex; padding: 1px 7px; border-radius: 6px; font-size: .7rem; font-weight: 650; }
.src-est { background: var(--amber-bg); color: var(--amber); }
.src-fab { background: #E9EEF7; color: #3C5A8C; }
.src-geom { background: var(--green-bg); color: var(--green); }
.src-user { background: var(--sand); color: var(--brick); }

/* listas editáveis (paredes, aberturas, linhas do orçamento) */
.lines { display: flex; flex-direction: column; gap: 10px; }
.line { display: grid; gap: 10px; align-items: end; padding: 12px; border: 1px solid var(--line); border-radius: var(--r); background: #FCFBFA; }
.line-head { display: flex; justify-content: space-between; align-items: center; grid-column: 1 / -1; margin-bottom: -4px; }
.line-head strong { font-size: .9rem; }
.add-line { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

/* ---------- painel ---------- */
.hello { position: relative; overflow: hidden; padding: 22px 20px; border-radius: var(--r-lg); background: var(--white); border: 1px solid var(--line); }
.hello::after { content: ''; position: absolute; right: -6px; top: 0; bottom: 0; width: 42%; background: var(--bricks); opacity: .07; -webkit-mask-image: linear-gradient(90deg, transparent, #000 60%); mask-image: linear-gradient(90deg, transparent, #000 60%); pointer-events: none; }
.hello h1 { font-size: 1.5rem; position: relative; }
.hello p { position: relative; color: var(--ink-2); margin-top: 4px; }
.hello .row { margin-top: 16px; position: relative; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; }
.stat { padding: 14px; border-radius: var(--r); background: var(--white); border: 1px solid var(--line); }
.stat b { display: block; white-space: nowrap; font-size: 1.5rem; font-weight: 750; letter-spacing: -.02em; font-stretch: 105%; }
.stat span { font-size: .8rem; color: var(--ink-2); }
@media (max-width: 480px) { .stat b { font-size: 1rem; } .stats { gap: 8px; grid-template-columns: .6fr 1fr 1fr; } .stat { padding: 12px 10px; } }
.calc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.calc-tile { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: var(--r); background: var(--white); border: 1px solid var(--line); text-decoration: none; color: var(--ink); transition: border-color var(--t); min-height: 108px; }
.calc-tile:hover { border-color: var(--terra); }
.calc-tile .tile-ic { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--sand); color: var(--terra); }
.calc-tile strong { font-size: .95rem; line-height: 1.25; }
.calc-tile span { font-size: .8rem; color: var(--ink-3); line-height: 1.35; }
.calc-grid.big .calc-tile { flex-direction: row; align-items: center; min-height: 0; padding: 14px 16px; }
.calc-grid.big { grid-template-columns: 1fr; }
@media (min-width: 640px) { .calc-grid.big { grid-template-columns: 1fr 1fr; } }

/* lista de itens */
.list { display: flex; flex-direction: column; }
.item { display: flex; align-items: center; gap: 12px; padding: 13px 16px; text-decoration: none; color: var(--ink); border-top: 1px solid var(--line); background: none; border-left: 0; border-right: 0; border-bottom: 0; width: 100%; text-align: left; cursor: pointer; }
.item:first-child { border-top: 0; }
a.item:hover, button.item:hover { background: #FCFBF9; }
.item .it-ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--bg); color: var(--ink-2); flex: none; }
.item .it-main { flex: 1; min-width: 0; }
.item .it-title { display: block; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .it-sub { display: block; font-size: .84rem; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .it-end { text-align: right; flex: none; }
.item .it-val { font-weight: 700; display: block; }

/* ---------- calculadora ---------- */
.calc-layout { display: grid; gap: 16px; }
@media (min-width: 1000px) { .calc-layout { grid-template-columns: minmax(0, 1fr) 400px; align-items: start; } .calc-layout .result-col { position: sticky; top: 24px; } }
.form-card { padding: 18px; }
.form-card h3 { margin-bottom: 12px; }
.form-card + .form-card { margin-top: 12px; }
details.params { border: 1px solid var(--line); border-radius: var(--r); background: #FCFBFA; }
details.params summary { padding: 13px 14px; cursor: pointer; font-weight: 650; display: flex; align-items: center; gap: 8px; list-style: none; }
details.params summary::-webkit-details-marker { display: none; }
details.params summary::after { content: ''; margin-left: auto; width: 8px; height: 8px; border: solid var(--ink-3); border-width: 0 2px 2px 0; transform: rotate(45deg); transition: transform var(--t); }
details.params[open] summary::after { transform: rotate(-135deg); }
details.params .params-body { padding: 0 14px 14px; display: grid; gap: 12px; }

/* resultado: o número grande "assentado" sobre uma fiada de tijolos */
.result { overflow: hidden; }
.result-hero { padding: 20px 20px 0; background: var(--sand); position: relative; }
.result-hero .rh-label { font-size: .9rem; color: var(--brick); font-weight: 600; }
.result-hero .rh-value { display: flex; align-items: baseline; gap: 8px; margin-top: 2px; padding-bottom: 14px; }
.result-hero .rh-value b { font-size: 3.1rem; line-height: 1; font-weight: 800; letter-spacing: -.035em; font-stretch: 112%; color: var(--brick); }
.result-hero .rh-value span { font-size: 1.05rem; font-weight: 650; color: var(--brick); }
.course { height: 19px; margin: 0 -20px; background: var(--bricks) 0 0 / 38px 19px repeat-x; opacity: .55; }
.result-empty { padding: 26px 20px; text-align: center; color: var(--ink-2); }
.result-empty .wall-illus { margin: 0 auto 12px; display: block; opacity: .9; }
.summary { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border-bottom: 1px solid var(--line); }
.summary div { background: var(--white); padding: 12px 16px; }
.summary b { display: block; font-size: 1.12rem; font-weight: 750; }
.summary span { font-size: .8rem; color: var(--ink-2); }
.summary .odd-last { grid-column: 1 / -1; }
.mat-list { padding: 6px 0; }
.mat-row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 18px; font-size: .93rem; }
.mat-row .mr-name { color: var(--ink); }
.mat-row .mr-qty { font-weight: 700; text-align: right; white-space: nowrap; }
.mat-row .mr-qty small { display: block; font-weight: 500; color: var(--ink-3); font-size: .78rem; }
.block-title { font-size: .85rem; font-weight: 700; color: var(--ink-2); padding: 14px 18px 4px; }
.steps { padding: 4px 18px 14px; display: flex; flex-direction: column; gap: 10px; }
.step { font-size: .86rem; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; }
.step .s-l { font-weight: 600; }
.step .s-v { font-weight: 700; text-align: right; }
.step .s-f { grid-column: 1 / -1; color: var(--ink-3); font-size: .8rem; word-break: break-word; }
.warns { padding: 0 18px 14px; display: flex; flex-direction: column; gap: 8px; }
.warn { display: flex; gap: 8px; font-size: .84rem; background: var(--amber-bg); color: #6B4A0C; padding: 9px 11px; border-radius: 9px; }
.warn .ic { color: var(--amber); margin-top: 1px; }
.result-actions { padding: 14px 18px 18px; display: grid; gap: 8px; border-top: 1px solid var(--line); }
.est-tag { display: inline-block; font-size: .68rem; font-weight: 700; color: var(--amber); background: var(--amber-bg); border-radius: 5px; padding: 0 5px; margin-left: 6px; vertical-align: 1px; }

/* barra fixa do resultado no celular */
.result-bar { display: none; }
@media (max-width: 999px) {
  .result-bar.on { display: flex; position: fixed; left: 10px; right: 10px; bottom: calc(var(--nav-h) + 10px + env(safe-area-inset-bottom)); z-index: 25; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 10px 10px 16px; border-radius: 14px; background: var(--brick); color: #fff; box-shadow: var(--shadow-lg); }
  .result-bar b { font-size: 1.25rem; font-weight: 800; }
  .result-bar span { font-size: .8rem; opacity: .85; display: block; }
  .result-bar .btn { background: #fff; color: var(--brick); min-height: 40px; }
}
@media (min-width: 900px) and (max-width: 999px) { .result-bar.on { bottom: 16px; left: calc(var(--side-w) + 16px); } }

/* ---------- tabela ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tbl th { text-align: left; font-weight: 650; font-size: .8rem; color: var(--ink-2); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #FCFBFA; }
.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: right; white-space: nowrap; }
.tbl tr.done td { color: var(--ink-3); }
.tbl tr.done .mname { text-decoration: line-through; }

/* lista de materiais da obra (cartões no celular) */
.mat-cards { display: flex; flex-direction: column; }
.mat-card { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 12px; padding: 13px 16px; border-top: 1px solid var(--line); align-items: start; }
.mat-card:first-child { border-top: 0; }
.mat-card input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--green); margin-top: 2px; }
.mat-card .mc-name { font-weight: 650; }
.mat-card .mc-sub { font-size: .8rem; color: var(--ink-3); }
.mat-card .mc-qty { text-align: right; font-weight: 750; white-space: nowrap; }
.mat-card .mc-qty .u { font-weight: 550; font-size: .85rem; color: var(--ink-2); }
.mat-card .mc-qty small { display: block; font-weight: 500; font-size: .78rem; color: var(--ink-2); }
.mat-card.done .mc-name { text-decoration: line-through; color: var(--ink-3); }
.mat-total b { white-space: nowrap; }
.mat-total { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-top: 1px solid var(--line); background: #FCFBFA; border-radius: 0 0 var(--r-lg) var(--r-lg); }

/* ---------- orçamento ---------- */
.budget-layout { display: grid; gap: 16px; }
@media (min-width: 1000px) { .budget-layout { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; } .budget-layout .totals-col { position: sticky; top: 24px; } }
.b-line { display: grid; grid-template-columns: 1fr; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r); background: #FCFBFA; }
.b-line .bl-top { display: flex; gap: 8px; align-items: center; }
.b-line .bl-top .input { flex: 1; }
.b-line .bl-nums { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; align-items: end; }
.b-line .bl-total { font-weight: 750; text-align: right; padding-bottom: 12px; white-space: nowrap; }
.b-line .bl-nums.two { grid-template-columns: 1fr 1fr; }
.b-line .field > label { font-size: .78rem; font-weight: 600; color: var(--ink-2); }
.b-line .input input { height: 42px; font-size: .97rem; }
.b-line .select select { height: 42px; font-size: .95rem; }
.totals { padding: 18px; }
.tot-row { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; font-size: .95rem; }
.tot-row span:first-child { color: var(--ink-2); }
.tot-row.strong { font-weight: 750; font-size: 1.02rem; }
.tot-final { margin: 12px -18px; padding: 16px 18px 0; background: var(--sand); }
.tot-final .rh-label { color: var(--brick); font-weight: 600; font-size: .9rem; }
.tot-final b { display: block; font-size: 2.2rem; font-weight: 800; color: var(--brick); letter-spacing: -.03em; font-stretch: 110%; padding-bottom: 10px; }
.tot-final .course { margin: 0 -18px; }
.profit-good { color: var(--green); }
.profit-bad { color: var(--red); }
.internal-note { font-size: .8rem; color: var(--ink-3); display: flex; gap: 6px; align-items: center; }
.status-pill { font-size: .78rem; }

/* ---------- abas ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { text-decoration: none; padding: 10px 14px; border: 0; background: none; font-weight: 650; color: var(--ink-2); cursor: pointer; border-bottom: 2.5px solid transparent; margin-bottom: -1px; white-space: nowrap; font-size: .95rem; }
.tab.on { color: var(--brick); border-color: var(--terra); }
.tab .count { font-size: .76rem; color: var(--ink-3); margin-left: 4px; }

/* ---------- vazio ---------- */
.empty { text-align: center; padding: 34px 20px; }
.empty .wall-illus { display: block; margin: 0 auto 16px; }
.empty h3 { font-size: 1.1rem; }
.empty p { color: var(--ink-2); margin: 6px auto 0; max-width: 380px; }
.empty-actions { display: flex; gap: 8px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }

/* ---------- boas-vindas ---------- */
.welcome { min-height: 100vh; min-height: 100dvh; display: grid; background: var(--bg); }
@media (min-width: 900px) { .welcome { grid-template-columns: 1.05fr 1fr; } }
.welcome-art { position: relative; background: var(--brick); overflow: hidden; display: none; }
@media (min-width: 900px) { .welcome-art { display: block; } }
.welcome-art::before { content: ''; position: absolute; inset: 0; background: var(--bricks) 0 0 / 72px 36px; opacity: .18; filter: brightness(1.6); }
.welcome-art .wa-text { position: absolute; left: 48px; bottom: 48px; right: 48px; color: #fff; }
.welcome-art .wa-text p { font-size: 1.9rem; font-weight: 700; line-height: 1.15; letter-spacing: -.02em; max-width: 440px; font-stretch: 108%; }
.welcome-art .wa-text span { display: block; margin-top: 12px; opacity: .78; max-width: 420px; }
.welcome-mobile-art { height: 120px; background: var(--brick); position: relative; overflow: hidden; }
.welcome-mobile-art::before { content: ''; position: absolute; inset: 0; background: var(--bricks) 0 0 / 56px 28px; opacity: .2; filter: brightness(1.6); }
@media (min-width: 900px) { .welcome-mobile-art { display: none; } }
.welcome-form { display: flex; flex-direction: column; justify-content: center; padding: 28px 22px 40px; max-width: 480px; width: 100%; margin: 0 auto; }
.welcome-form h1 { margin: 26px 0 8px; font-size: 1.7rem; }
.welcome-form .lead { color: var(--ink-2); margin-bottom: 22px; }
.welcome-form .note { font-size: .82rem; color: var(--ink-3); margin-top: 16px; display: flex; gap: 8px; }

/* ---------- modal ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 100; background: rgba(41, 39, 36, .44); display: flex; align-items: flex-end; justify-content: center; animation: fade .15s ease; }
@media (min-width: 640px) { .modal-wrap { align-items: center; padding: 24px; } }
.modal { background: var(--white); width: 100%; max-width: 520px; max-height: 92vh; max-height: 92dvh; display: flex; flex-direction: column; border-radius: 18px 18px 0 0; box-shadow: var(--shadow-lg); animation: up .18s ease; }
@media (min-width: 640px) { .modal { border-radius: 18px; } }
.modal-wide { max-width: 860px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 14px 10px 20px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 1.1rem; }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-msg { color: var(--ink-2); }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 20px; padding-bottom: max(12px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); flex-wrap: wrap; }
@media (max-width: 480px) { .modal-foot .btn { flex: 1; } }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(16px); opacity: 0; } }

/* ---------- toast ---------- */
#toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 18px + env(safe-area-inset-bottom)); z-index: 200; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
@media (min-width: 900px) { #toasts { bottom: 24px; } }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--ink); color: #fff; font-size: .93rem; font-weight: 550; box-shadow: var(--shadow-lg); animation: up .18s ease; transition: opacity .2s, transform .2s; }
.toast-ok .ic { color: #8FD3AA; }
.toast-err { background: var(--red); }
.toast.out { opacity: 0; transform: translateY(6px); }

/* ---------- prévia do orçamento ---------- */
.doc-preview { background: #EEEBE6; padding: 14px; border-radius: 12px; }
.doc { background: #fff; max-width: 760px; margin: 0 auto; padding: 32px 30px; font-size: .9rem; color: #222; box-shadow: 0 2px 10px rgba(0,0,0,.08); }
.doc-head { display: flex; justify-content: space-between; gap: 20px; padding-bottom: 14px; border-bottom: 3px solid var(--terra); }
.doc-head .dh-pro { font-weight: 750; font-size: 1.15rem; }
.doc-head .dh-meta { text-align: right; font-size: .82rem; color: #555; }
.doc-head .dh-meta b { color: var(--brick); font-size: 1.05rem; display: block; }
.doc h4 { font-size: .9rem; color: var(--brick); margin: 18px 0 6px; }
.doc .doc-kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 14px; font-size: .86rem; }
.doc .doc-kv span:nth-child(odd) { color: #666; }
.doc table { width: 100%; border-collapse: collapse; font-size: .84rem; }
.doc th { background: var(--sand); text-align: left; padding: 7px 8px; font-weight: 650; }
.doc td { padding: 7px 8px; border-bottom: 1px solid #eee; }
.doc .num { text-align: right; white-space: nowrap; }
.doc .doc-total { margin-top: 12px; display: flex; justify-content: flex-end; }
.doc .doc-total div { min-width: 260px; }
.doc .doc-total .tot-row { font-size: .88rem; padding: 3px 0; }
.doc .doc-total .grand { background: var(--brick); color: #fff; padding: 10px 12px; border-radius: 6px; margin-top: 6px; font-weight: 750; font-size: 1.05rem; display: flex; justify-content: space-between; }
.doc .doc-foot { margin-top: 26px; padding-top: 10px; border-top: 1px solid #ddd; font-size: .74rem; color: #888; display: flex; justify-content: space-between; }
@media (max-width: 560px) { .doc-preview { padding: 6px; margin: 0 -8px; } .doc { padding: 18px 12px; font-size: .78rem; overflow-x: auto; } .doc th, .doc td { padding: 6px 5px; } .doc-head { flex-direction: column; } .doc-head .dh-meta { text-align: left; } }

/* ---------- utilidades ---------- */
.ok-text { color: var(--green); }
.err-text { color: var(--red); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.filters { display: grid; gap: 10px; grid-template-columns: 1fr; margin-bottom: 14px; }
@media (min-width: 720px) { .filters { grid-template-columns: 2fr 1fr 1fr 1fr; align-items: end; } }
.info-box { display: flex; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--white); border: 1px dashed var(--line-2); font-size: .88rem; color: var(--ink-2); }
.info-box .ic { color: var(--terra); margin-top: 2px; }
.param-row { display: grid; grid-template-columns: 1fr 150px; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.param-row:first-child { border-top: 0; }
.param-row .pr-l { font-weight: 600; font-size: .93rem; }
.param-row .help { margin-top: 3px; }
@media (max-width: 560px) { .param-row { grid-template-columns: 1fr; } }
.kbd-note { font-size: .78rem; color: var(--ink-3); }
@media (max-width: 999px) { .calc-layout { padding-bottom: 72px; } }

@media (max-width: 480px) { .stack-sm { grid-template-columns: 1fr; } }

.save-dot.pending::before { background: var(--amber); }
.splash { min-height: 100vh; min-height: 100dvh; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--ink-3); }
.note .btn-link { display: inline; min-height: 0; padding: 0; font-size: inherit; }
