﻿:root {
  --ink: #211d19;
  --muted: #6e655c;
  --paper: #f4f0ea;
  --surface: #fffdf9;
  --surface-2: #eee6db;
  --line: #d9cdc0;
  --brand: #3a1513;
  --brand-2: #7a3e35;
  --green: #53685a;
  --gold: #b98c58;
  --danger: #9f332d;
  --shadow: 0 18px 44px rgba(33, 29, 25, 0.09);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: Arial, Helvetica, sans-serif; letter-spacing: 0; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.login { display: grid; min-height: 100vh; place-items: center; padding: 28px; background: linear-gradient(135deg, #3a1513, #7a3e35 48%, #53685a); }
.login-panel { display: grid; width: min(980px, 100%); grid-template-columns: 1.15fr .85fr; gap: 36px; align-items: end; padding: 42px; border: 1px solid rgba(255,255,255,.28); border-radius: 8px; background: rgba(255,253,249,.94); box-shadow: var(--shadow); }
.mark { display: inline-grid; width: 46px; height: 46px; place-items: center; border-radius: 6px; background: var(--brand); color: #fff8ef; font-weight: 800; }
.eyebrow { margin: 0 0 8px; color: var(--brand-2); font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
h1, h2, h3, h4, p { margin-top: 0; }
h1 { max-width: 620px; margin-bottom: 16px; font-size: clamp(36px, 6vw, 66px); line-height: .95; }
h2 { margin-bottom: 0; font-size: 30px; }
h3 { margin-bottom: 0; font-size: 22px; }
h4 { margin: 0 0 10px; font-size: 15px; text-transform: uppercase; }
p, .hint { color: var(--muted); line-height: 1.55; }
form { display: grid; gap: 14px; }
label { display: grid; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); padding: 11px 12px; outline: 0; }
textarea { min-height: 80px; resize: vertical; text-transform: none; }
input:focus, select:focus, textarea:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(122,62,53,.12); }

.primary, .secondary, .text-button, .tab, .nav, .icon { border: 0; border-radius: 6px; min-height: 40px; padding: 10px 13px; font-weight: 800; }
.primary { background: var(--brand); color: #fff8ef; }
.secondary { border: 1px solid var(--line); background: #fff; color: var(--ink); }
.text-button { background: transparent; color: var(--muted); padding-inline: 0; text-align: left; }
.icon { width: 38px; min-height: 38px; border: 1px solid var(--line); background: #fff; color: var(--danger); padding: 0; }

.app { display: grid; min-height: 100vh; grid-template-columns: 270px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; display: grid; height: 100vh; grid-template-rows: auto 1fr auto; gap: 28px; border-right: 1px solid var(--line); background: var(--surface); padding: 24px; }
.brand { display: flex; gap: 12px; align-items: start; }
.brand strong, .brand small, .side small { display: block; }
.brand small, .side small { color: var(--muted); }
nav { display: grid; align-content: start; gap: 8px; }
.nav { display: flex; align-items: start; justify-content: flex-start; gap: 10px; background: transparent; color: var(--muted); text-align: left; }
.nav.active { background: var(--brand); color: #fff8ef; }
.nav span { display: grid; width: 24px; height: 24px; place-items: center; border-radius: 4px; background: rgba(255,255,255,.18); font-size: 12px; }
main { min-width: 0; padding: 26px; }
.top { display: flex; justify-content: space-between; gap: 20px; align-items: start; margin-bottom: 22px; }
.actions, .tabs, .inline-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: start; }
.view { display: grid; gap: 18px; }
.grid { display: grid; gap: 18px; }
.two { grid-template-columns: minmax(0, 1.2fr) minmax(340px, .8fr); }
.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.panel { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); padding: 20px; box-shadow: 0 10px 30px rgba(33,29,25,.04); }
.head { display: flex; justify-content: space-between; gap: 16px; align-items: start; margin-bottom: 18px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.full { grid-column: 1 / -1; }
.pill { display: inline-flex; align-items: start; border-radius: 999px; background: #edf2ed; color: var(--green); padding: 7px 10px; font-size: 12px; font-weight: 800; }

.summary { background: var(--brand); color: #fff8ef; }
.summary .eyebrow, .summary p, .summary dt { color: #d7b8a6; }
.total { display: block; margin: 10px 0 16px; font-size: clamp(34px, 5vw, 54px); }
dl { margin: 0; }
.summary dl, .analysis-list { display: grid; gap: 10px; }
.summary dl div, .analysis-list div { display: flex; justify-content: space-between; gap: 18px; border-top: 1px solid rgba(255,255,255,.16); padding-top: 10px; }
.analysis-list div { border-color: var(--line); }
dd { margin: 0; font-weight: 800; text-align: right; }

.environment { display: grid; gap: 14px; }
.env-header { display: grid; grid-template-columns: minmax(180px, .8fr) minmax(0, 1.3fr) auto; gap: 12px; align-items: end; }
.env-total { display: grid; gap: 2px; justify-items: end; border-left: 1px solid var(--line); padding-left: 16px; }
.env-total strong { font-size: 24px; color: var(--brand); }
.env-total span { color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 1120px; }
th, td { border-top: 1px solid var(--line); padding: 9px 7px; text-align: left; vertical-align: middle; }
th { color: var(--muted); font-size: 11px; text-transform: uppercase; }
td input, td select { min-width: 96px; padding: 9px 10px; }
.desc-input { min-width: 210px; }
.notes-input { min-width: 180px; }
.money { min-width: 130px; font-weight: 900; }
.subrow { display: flex; flex-wrap: wrap; gap: 10px 16px; color: var(--muted); font-size: 12px; }
.subrow strong { color: var(--ink); }

.tab { border: 1px solid var(--line); background: #fff; color: var(--muted); }
.tab.active { background: var(--brand); color: #fff8ef; }
.records { display: grid; gap: 10px; }
.record { display: flex; justify-content: space-between; gap: 14px; align-items: start; border: 1px solid var(--line); border-radius: 7px; background: #fff; padding: 12px; }
.record strong, .record small { display: block; }
.record small { color: var(--muted); line-height: 1.5; }
.record-actions { display: flex; gap: 8px; }
.table-form { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 18px; }

.budget-report { display: grid; gap: 16px; }
.report-env { border: 1px solid var(--line); border-radius: 8px; background: #fff; overflow: hidden; }
.report-env header { display: flex; justify-content: space-between; gap: 16px; align-items: start; background: var(--surface-2); padding: 14px 16px; }
.report-env header strong { font-size: 18px; }
.report-env table { min-width: 760px; }
.report-env tfoot td { font-weight: 900; background: #fbf7f1; }
.final-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, .65fr); gap: 18px; align-items: start; }
.big-total { font-size: clamp(34px, 5vw, 58px); color: var(--brand); margin: 0; }

@media (max-width: 1050px) {
  .app, .login-panel, .two, .three, .final-grid { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .top, .head, .env-header { align-items: stretch; grid-template-columns: 1fr; flex-direction: column; }
  .form-grid, .table-form { grid-template-columns: 1fr; }
  .env-total { justify-items: start; border-left: 0; border-top: 1px solid var(--line); padding: 12px 0 0; }
}

@media print {
  body { background: #fff; }
  .sidebar, .top, .no-print { display: none !important; }
  .app, main { display: block; padding: 0; }
  .panel { box-shadow: none; break-inside: avoid; }
}

.environment-list { display: grid; gap: 18px; }
.env-group { display: grid; gap: 8px; }
.env-group > strong { color: var(--brand); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--muted); padding: 8px 11px; font-weight: 800; }
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff8ef; }
.config-env-form { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 18px; }
.template-tools {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto auto;
  gap: 10px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbf7f1;
  padding: 12px;
  margin: 14px 0;
}

@media (max-width: 1050px) {
  .template-tools { grid-template-columns: 1fr; }
}
.environment-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 1050px) {
  .environment-picker { grid-template-columns: 1fr; }
}
.spreadsheet-summary .table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.summary-table {
  min-width: 900px;
}

.summary-table th {
  background: #f3ece2;
  color: var(--brand);
  font-size: 12px;
}

.summary-table th small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
  text-transform: uppercase;
}

.summary-table td:nth-child(n+2),
.summary-table th:nth-child(n+2) {
  text-align: right;
}

.summary-table tbody td {
  background: #fff;
}

.summary-table .summary-adjustment td {
  background: #fbf7f1;
  color: var(--muted);
}

.summary-table tfoot td {
  background: var(--brand);
  color: #fff8ef;
  font-size: 16px;
  font-weight: 900;
  text-transform: uppercase;
}
.sheet-client-name {
  background: #4f83bd;
  color: #fff;
  font-size: 17px;
  font-weight: 900;
  letter-spacing: .02em;
  padding: 4px 12px;
  text-align: center;
  text-transform: uppercase;
}

.spreadsheet-summary {
  background: #fff;
  padding: 0;
  overflow: hidden;
}

.sheet-wrap {
  border: 0;
  border-radius: 0;
  background: #fff;
}

.summary-table {
  min-width: 1040px;
  border-collapse: collapse;
  background: #fff;
}

.summary-table th,
.summary-table td {
  border: 1px solid #e2e2e2;
  padding: 3px 5px;
  height: 20px;
  background: #fff;
  color: #000;
  font-size: 13px;
  line-height: 1.15;
}

.summary-table th {
  color: #000;
  font-weight: 400;
  text-align: left;
  text-transform: none;
}

.summary-table th small {
  display: inline;
  color: #000;
  font-size: 12px;
  font-weight: 400;
  text-transform: none;
}

.summary-table th:nth-child(1),
.summary-table td:nth-child(1) {
  min-width: 310px;
}

.summary-table th:nth-child(2),
.summary-table th:nth-child(3),
.summary-table td:nth-child(2),
.summary-table td:nth-child(3) {
  min-width: 150px;
  text-align: right;
}

.summary-table th:nth-child(4),
.summary-table td:nth-child(4) {
  min-width: 430px;
  text-align: right;
}

.summary-table .soft-money {
  color: #9aa0a6;
}

.summary-table .final-money {
  color: #000;
  font-weight: 900;
}

.summary-table .summary-adjustment td {
  background: #fff;
}

.summary-table tfoot td {
  background: #fff;
  color: #000;
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.summary-table tfoot .final-total-cell {
  border: 2px solid #000;
  font-weight: 900;
}
.login-logo {
  display: block;
  width: min(360px, 82vw);
  height: auto;
  margin: 0 0 24px;
  object-fit: contain;
}

.brand {
  display: grid;
  gap: 6px;
  align-items: start;
}

.brand-logo {
  display: block;
  width: 180px;
  max-width: 100%;
  height: auto;
  object-fit: contain;
}

.brand small {
  padding-left: 2px;
  color: var(--muted);
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.summary-table td small {
  display: block;
  margin-top: 2px;
  color: #8f969c;
  font-size: 10px;
  font-weight: 400;
  text-transform: none;
}
.spreadsheet-summary {
  border-color: #cfc3b6;
  box-shadow: 0 16px 34px rgba(33, 29, 25, .06);
}

.sheet-client-name {
  padding: 8px 14px;
  font-size: 18px;
}

.summary-table th,
.summary-table td {
  padding: 5px 7px;
  height: 25px;
}

.summary-table tbody tr:hover td {
  background: #fbf7f1;
}

.summary-table th {
  border-bottom: 2px solid #cfcfcf;
}

.summary-table tfoot td {
  border-top: 2px solid #222;
  padding-top: 8px;
  padding-bottom: 8px;
}

.summary-table tfoot .final-total-cell {
  background: #fffaf4;
  color: #000;
  font-size: 15px;
}
/* Resumo com identidade Detalhe */
.sheet-client-name {
  background: var(--brand);
  color: #fff8ef;
  border-bottom: 3px solid var(--brand-2);
}

.spreadsheet-summary {
  border-color: rgba(58, 21, 19, .22);
  background: #fffdf9;
}

.summary-table th {
  background: #f4eee7;
  border-color: #e4d7c9;
  border-bottom: 2px solid rgba(58, 21, 19, .38);
  color: var(--brand);
  font-weight: 800;
}

.summary-table th small {
  color: var(--brand-2);
  font-weight: 700;
}

.summary-table td {
  border-color: #eadfd4;
}

.summary-table tbody tr:hover td {
  background: #fff7ef;
}

.summary-table .soft-money {
  color: #9b8f86;
}

.summary-table .final-money {
  color: var(--brand);
  font-weight: 900;
}

.summary-table tfoot td {
  background: #f4eee7;
  border-top: 2px solid var(--brand);
  color: var(--brand);
}

.summary-table tfoot .final-total-cell {
  background: #fffaf4;
  border: 2px solid var(--brand);
  color: var(--brand);
}
.budget-record.active-budget {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(58, 21, 19, .08);
}

.history-search {
  margin-bottom: 16px;
}

.budget-records,
.client-records {
  margin-top: 14px;
}
.backup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: start;
  margin-top: 18px;
}

.file-action {
  display: inline-flex;
  width: auto;
  align-items: start;
  justify-content: center;
  color: var(--ink);
  text-transform: none;
}

.file-action input {
  display: none;
}

/* Exportação do resumo em PDF */
.print-summary-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid #eadfd4;
  background: #fffdf9;
}

.print-summary-header img {
  display: block;
  width: min(260px, 38vw);
  height: auto;
}

.print-summary-header div {
  display: grid;
  justify-items: end;
  gap: 3px;
  text-align: right;
}

.print-summary-header strong {
  color: var(--brand);
  font-size: 18px;
  text-transform: uppercase;
}

.print-summary-header span {
  color: var(--ink);
  font-size: 16px;
  font-weight: 900;
  text-transform: uppercase;
}

.print-summary-header small,
.print-summary-footer {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.print-summary-footer {
  padding: 10px 14px 14px;
  text-align: right;
}

@media print {
  @page { size: A4 landscape; margin: 11mm; }
  body { background: #fff !important; color: #000; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .sidebar, .top, .no-print { display: none !important; }
  .app, main, .view { display: block !important; padding: 0 !important; min-height: 0 !important; }
  .spreadsheet-summary { border: 0 !important; border-radius: 0 !important; box-shadow: none !important; overflow: visible !important; background: #fff !important; }
  .print-summary-header { padding: 0 0 8mm !important; margin-bottom: 0 !important; background: #fff !important; }
  .print-summary-header img { width: 58mm !important; max-width: 58mm !important; }
  .print-summary-header strong { font-size: 12pt !important; }
  .print-summary-header span { font-size: 11pt !important; }
  .sheet-client-name { padding: 6px 10px !important; font-size: 12pt !important; }
  .sheet-wrap { overflow: visible !important; border: 0 !important; }
  .summary-table { width: 100% !important; min-width: 0 !important; table-layout: fixed; }
  .summary-table th, .summary-table td { padding: 4px 5px !important; height: auto !important; font-size: 9pt !important; line-height: 1.2 !important; }
  .summary-table th:nth-child(1), .summary-table td:nth-child(1) { width: 34% !important; min-width: 0 !important; }
  .summary-table th:nth-child(2), .summary-table td:nth-child(2), .summary-table th:nth-child(3), .summary-table td:nth-child(3) { width: 18% !important; min-width: 0 !important; }
  .summary-table th:nth-child(4), .summary-table td:nth-child(4) { width: 30% !important; min-width: 0 !important; }
  .summary-table tfoot td { font-size: 10pt !important; }
  .summary-table tfoot .final-total-cell { border: 2px solid var(--brand) !important; }
  .print-summary-footer { display: block !important; padding: 6mm 0 0 !important; font-size: 8pt !important; }
}

/* Biblioteca de orçamentos salvos */
.history-overview {
  display: grid;
  grid-template-columns: 150px 150px minmax(260px, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.history-overview > div {
  display: grid;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbf7f1;
  padding: 12px;
}

.history-overview small,
.budget-record-total small,
.history-result-line {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.history-overview strong {
  color: var(--brand);
  font-size: 22px;
  line-height: 1.1;
}

.history-overview span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.history-search {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 10px;
}

.history-result-line {
  margin-bottom: 12px;
}

.budget-record {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, auto) auto;
  align-items: start;
  gap: 16px;
  padding: 14px;
}

.budget-record-main {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.record-title-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: start;
}

.record-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.record-meta span {
  display: inline-flex;
  align-items: start;
  border: 1px solid #eadfd4;
  border-radius: 999px;
  background: #fffaf4;
  color: var(--muted);
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 800;
}

.budget-record-total {
  display: grid;
  justify-items: end;
  gap: 3px;
  white-space: nowrap;
}

.budget-record-total strong {
  color: var(--brand);
  font-size: 20px;
}

.budget-record .record-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.budget-record.active-budget {
  background: #fffaf4;
}

@media (max-width: 900px) {
  .history-overview,
  .history-search,
  .budget-record {
    grid-template-columns: 1fr;
  }
  .budget-record-total,
  .budget-record .record-actions {
    justify-items: start;
    justify-content: flex-start;
  }
}

/* Backup mais visível */
.backup-main {
  display: grid;
  gap: 16px;
}

.backup-main.backup-alert {
  border-color: rgba(58, 21, 19, .35);
  box-shadow: 0 0 0 2px rgba(58, 21, 19, .06), 0 16px 34px rgba(33, 29, 25, .06);
}

.backup-status-card {
  display: grid;
  gap: 8px;
  border: 1px solid #eadfd4;
  border-radius: 8px;
  background: #fffaf4;
  padding: 14px;
}

.backup-status-card small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.backup-status-card strong {
  display: block;
  color: var(--brand);
  font-size: 18px;
  line-height: 1.25;
}

.backup-status-card p {
  margin: 0;
  font-size: 13px;
}

.backup-restore-note {
  background: #fffdf9;
}

.backup-checklist {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.backup-checklist span {
  display: block;
  border-left: 3px solid var(--brand);
  background: #fbf7f1;
  padding: 10px 12px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

/* Proporções refinadas do resumo */
.spreadsheet-summary {
  max-width: 1180px;
  margin: 0 auto;
}

.sheet-wrap {
  overflow-x: auto;
}

.summary-table {
  width: 100%;
  min-width: 860px;
  table-layout: fixed;
}

.summary-table th,
.summary-table td {
  padding: 8px 10px;
  height: 32px;
}

.summary-table th:nth-child(1),
.summary-table td:nth-child(1) {
  width: 34%;
  min-width: 0;
}

.summary-table th:nth-child(2),
.summary-table td:nth-child(2) {
  width: 19%;
  min-width: 0;
}

.summary-table th:nth-child(3),
.summary-table td:nth-child(3) {
  width: 20%;
  min-width: 0;
}

.summary-table th:nth-child(4),
.summary-table td:nth-child(4) {
  width: 27%;
  min-width: 0;
}

.summary-table th:nth-child(n+2),
.summary-table td:nth-child(n+2) {
  text-align: right;
}

.summary-table th {
  font-size: 12px;
  line-height: 1.25;
  vertical-align: bottom;
}

.summary-table th small {
  display: block;
  margin-top: 3px;
  font-size: 10px;
  line-height: 1.2;
}

.summary-table td:first-child {
  font-weight: 700;
}

.summary-table .soft-money {
  font-variant-numeric: tabular-nums;
}

.summary-table .final-money {
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.summary-table tfoot td {
  padding-top: 10px;
  padding-bottom: 10px;
  font-size: 14px;
}

.summary-table tfoot .final-total-cell {
  font-size: 16px;
}

@media (max-width: 900px) {
  .spreadsheet-summary {
    max-width: none;
  }
  .summary-table {
    min-width: 820px;
  }
}

@media print {
  .spreadsheet-summary { max-width: none !important; margin: 0 !important; }
  .summary-table { min-width: 0 !important; table-layout: fixed !important; }
  .summary-table th:nth-child(1), .summary-table td:nth-child(1) { width: 35% !important; }
  .summary-table th:nth-child(2), .summary-table td:nth-child(2) { width: 18% !important; }
  .summary-table th:nth-child(3), .summary-table td:nth-child(3) { width: 19% !important; }
  .summary-table th:nth-child(4), .summary-table td:nth-child(4) { width: 28% !important; }
}

/* Atalhos de montagem do orçamento */
.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  min-width: 118px;
}

button.compact {
  width: auto;
  padding: 7px 9px;
  font-size: 11px;
}

.environment .inline-actions {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.environment th:last-child,
.environment td:last-child {
  text-align: right;
}

@media (max-width: 900px) {
  .environment .inline-actions {
    justify-content: flex-start;
  }
}

/* Ambiente com ações simplificadas */
.environment .inline-actions {
  justify-content: space-between;
}

.environment .inline-actions .icon {
  margin-left: auto;
}

/* Linhas de itens mais rápidas de preencher */
.environment table {
  min-width: 1180px;
  table-layout: fixed;
}

.environment th,
.environment td {
  padding: 8px 7px;
}

.environment .item-cell,
.environment th:nth-child(1) { width: 24%; }
.environment .qty-cell,
.environment th:nth-child(2) { width: 7%; }
.environment .unit-cell,
.environment th:nth-child(3) { width: 6%; }
.environment .base-cell,
.environment th:nth-child(4) { width: 10%; }
.environment .adjust-mode-cell,
.environment th:nth-child(5) { width: 10%; }
.environment .adjust-value-cell,
.environment th:nth-child(6) { width: 10%; }
.environment .subtotal-cell,
.environment th:nth-child(7) { width: 11%; }
.environment .note-cell,
.environment th:nth-child(8) { width: 14%; }
.environment .actions-cell,
.environment th:nth-child(9) { width: 8%; }

.budget-item-row select,
.budget-item-row input {
  min-width: 0;
}

.budget-item-row .qty-cell input,
.budget-item-row .base-cell input,
.budget-item-row .adjust-value-cell input {
  text-align: right;
}

.manual-item-input {
  display: none;
  margin-top: 6px;
  background: #fffaf4;
  border-color: rgba(58, 21, 19, .22);
}

.manual-line .manual-item-input {
  display: block;
}

.unit-cell input {
  text-align: center;
  text-transform: lowercase;
}

.subtotal-cell {
  color: var(--brand);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.row-actions {
  min-width: 0;
  justify-content: flex-end;
}

.row-actions .compact {
  padding: 7px 8px;
  white-space: nowrap;
}

.actions-cell .icon {
  flex: 0 0 auto;
}

@media (max-width: 900px) {
  .environment table {
    min-width: 1080px;
  }
}

/* Ações principais na montagem */
.budget-primary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: start;
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.budget-primary-actions button {
  width: auto;
}

/* Cadastro iniciado a partir de novo orçamento */
.client-new-budget-panel {
  border-color: rgba(58, 21, 19, .28);
  background: #fffdf9;
}

/* Organização visual geral */
body {
  background: #f6f2ec;
}

.app {
  grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
  gap: 22px;
  padding: 22px 18px;
  background: #fffdf9;
}

.brand {
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}

.brand-logo {
  width: 150px;
}

.nav-section {
  display: block;
  margin: 14px 6px 4px;
  color: var(--brand-2);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.nav {
  min-height: 38px;
  border: 1px solid transparent;
  padding: 9px 10px;
}

.nav:hover {
  border-color: #eadfd4;
  background: #fff8f1;
  color: var(--brand);
}

.nav.active {
  box-shadow: 0 8px 18px rgba(58, 21, 19, .12);
}

.nav.active span {
  background: rgba(255, 248, 239, .22);
}

main {
  padding: 22px 28px 32px;
}

.top {
  position: sticky;
  top: 0;
  z-index: 5;
  margin: -22px -28px 22px;
  border-bottom: 1px solid rgba(217, 205, 192, .72);
  background: rgba(246, 242, 236, .94);
  padding: 18px 28px;
  backdrop-filter: blur(10px);
}

.top h2 {
  font-size: 26px;
}

.panel {
  border-color: #e0d5c9;
  box-shadow: none;
}

.view {
  gap: 16px;
}

.grid {
  gap: 16px;
}

.head {
  margin-bottom: 15px;
}

.summary {
  box-shadow: 0 14px 34px rgba(58, 21, 19, .12);
}

.environment {
  border-left: 4px solid rgba(58, 21, 19, .24);
}

.environment:hover {
  border-left-color: var(--brand);
}

.side {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

@media (max-width: 1050px) {
  .top {
    position: static;
    margin: 0 0 18px;
    padding: 0;
    border-bottom: 0;
    background: transparent;
    backdrop-filter: none;
  }
  main {
    padding: 20px;
  }
}

/* Clientes dentro da central de orçamentos */
.clients-hub {
  background: #fffdf9;
}

.clients-hub-grid {
  align-items: start;
}
.new-client-budget-grid {
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, .65fr);
}

.new-budget-return {
  border: 1px solid rgba(58, 21, 19, .14);
  border-radius: 8px;
  background: #f8f2ea;
  padding: 18px;
  display: grid;
  gap: 10px;
}

.new-budget-return h4 {
  margin: 0;
  font-size: 18px;
}

.new-budget-return p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
}

.client-search-box {
  display: grid;
  gap: 12px;
}

.clients-hub .client-records {
  max-height: 520px;
  overflow: auto;
  padding-right: 4px;
}

.clients-hub .record-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* Busca principal de orçamentos em destaque */
.featured-search {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  border: 1px solid rgba(58, 21, 19, .22);
  border-radius: 8px;
  background: #fffaf4;
  padding: 16px;
  margin: 4px 0 8px;
}

.featured-search .eyebrow {
  margin-bottom: 6px;
}

.featured-search label {
  color: var(--brand);
  font-size: 13px;
}

.featured-search input {
  min-height: 48px;
  border-color: rgba(58, 21, 19, .32);
  font-size: 15px;
  font-weight: 700;
}

.featured-search input::placeholder {
  color: #9b8f86;
  font-weight: 600;
}

.featured-search .secondary {
  min-height: 48px;
}

.history-result-line {
  color: var(--brand);
  letter-spacing: .08em;
}

@media (max-width: 900px) {
  .featured-search {
    grid-template-columns: 1fr;
  }
}

/* Busca de orçamentos acima dos indicadores */
.history-overview {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.history-overview > div {
  min-height: 64px;
  padding: 9px 10px;
  background: #fffdf9;
}

.history-overview small {
  font-size: 9px;
  letter-spacing: .12em;
}

.history-overview strong {
  font-size: 16px;
  line-height: 1.15;
}

.history-overview span {
  font-size: 11px;
  line-height: 1.25;
}

.featured-search {
  border-width: 2px;
  border-color: rgba(58, 21, 19, .38);
  background: #fff7ef;
  padding: 20px;
  margin: 8px 0 10px;
  box-shadow: 0 12px 28px rgba(58, 21, 19, .07);
}

.featured-search label {
  font-size: 14px;
}

.featured-search input {
  min-height: 56px;
  font-size: 17px;
  padding: 13px 15px;
}

.featured-search .secondary {
  min-height: 56px;
}

@media (max-width: 900px) {
  .history-overview {
    grid-template-columns: 1fr;
  }
}

/* Retângulo de destaque da pesquisa de orçamento */
.featured-search {
  background: linear-gradient(135deg, #3a1513 0%, #5b2722 100%);
  border-color: rgba(58, 21, 19, .72);
  box-shadow: 0 16px 34px rgba(58, 21, 19, .18);
}

.featured-search .eyebrow,
.featured-search label {
  color: #fff8ef;
}

.featured-search input {
  border-color: rgba(255, 248, 239, .38);
  background: #fffdf9;
  color: var(--ink);
  box-shadow: 0 8px 18px rgba(33, 29, 25, .12);
}

.featured-search input:focus {
  border-color: #d7b8a6;
  box-shadow: 0 0 0 3px rgba(255, 248, 239, .22), 0 8px 18px rgba(33, 29, 25, .12);
}

.featured-search .secondary {
  border-color: rgba(255, 248, 239, .38);
  background: rgba(255, 248, 239, .96);
  color: var(--brand);
}

/* Divisões de modelos */
.model-division-panel {
  background: #fffdf9;
}

.model-division-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(140px, 1fr));
  gap: 10px;
}

.model-card {
  display: grid;
  gap: 6px;
  min-height: 124px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
}

.model-card span {
  color: var(--brand);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.model-card strong {
  font-size: 28px;
  color: var(--brand);
  line-height: 1;
}

.model-card small {
  color: var(--muted);
  font-weight: 800;
  font-size: 11px;
  text-transform: uppercase;
}

.model-card em {
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
  line-height: 1.35;
}

.model-card:hover {
  border-color: rgba(58, 21, 19, .42);
  box-shadow: 0 10px 24px rgba(58, 21, 19, .08);
}

.model-card.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff8ef;
}

.model-card.active span,
.model-card.active strong,
.model-card.active small,
.model-card.active em {
  color: #fff8ef;
}

@media (max-width: 1200px) {
  .model-division-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .model-division-grid {
    grid-template-columns: 1fr;
  }
}


/* Análise interna do resumo */
.summary-details {
  max-width: 1180px;
  margin: 0 auto;
  background: #fffdf9;
  border-color: rgba(58, 21, 19, .22);
}

.summary-details .head strong {
  color: var(--brand);
  font-size: 22px;
  font-variant-numeric: tabular-nums;
}

.summary-detail-list {
  display: grid;
  gap: 14px;
}

.summary-detail-env {
  overflow: hidden;
  border: 1px solid #eadfd4;
  border-radius: 8px;
  background: #fff;
}

.summary-detail-env header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  background: #f4eee7;
  color: var(--brand);
}

.summary-detail-env header strong {
  font-size: 16px;
}

.summary-detail-env header span {
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.detail-lines-table {
  min-width: 760px;
}

.detail-lines-table th {
  color: var(--brand);
  background: #fffaf4;
  font-size: 11px;
  text-transform: uppercase;
}

.detail-lines-table th:nth-child(n+2),
.detail-lines-table td:nth-child(n+2) {
  text-align: right;
}

.detail-lines-table td:first-child {
  font-weight: 700;
}

.detail-lines-table .money {
  color: var(--brand);
  font-weight: 900;
}

@media (max-width: 900px) {
  .summary-details {
    max-width: none;
  }
}

/* PDF completo com análise interna */
@media print {
  body.print-details .summary-details.no-print {
    display: block !important;
    max-width: none !important;
    margin-top: 8mm !important;
    padding: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
    background: #fff !important;
    break-before: page;
  }

  body.print-details .summary-details .head {
    padding: 0 0 4mm !important;
    border-bottom: 2px solid var(--brand) !important;
  }

  body.print-details .summary-details .head h3 {
    font-size: 13pt !important;
  }

  body.print-details .summary-detail-list {
    gap: 6mm !important;
  }

  body.print-details .summary-detail-env {
    break-inside: avoid;
    border: 1px solid #d8cec2 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }

  body.print-details .summary-detail-env header {
    padding: 5px 7px !important;
    background: #f4eee7 !important;
  }

  body.print-details .detail-lines-table {
    width: 100% !important;
    min-width: 0 !important;
    table-layout: fixed !important;
  }

  body.print-details .detail-lines-table th,
  body.print-details .detail-lines-table td {
    padding: 4px 5px !important;
    font-size: 8.5pt !important;
    line-height: 1.15 !important;
  }

  body.print-details .detail-lines-table th:nth-child(1),
  body.print-details .detail-lines-table td:nth-child(1) { width: 34% !important; }
  body.print-details .detail-lines-table th:nth-child(2),
  body.print-details .detail-lines-table td:nth-child(2) { width: 9% !important; }
  body.print-details .detail-lines-table th:nth-child(3),
  body.print-details .detail-lines-table td:nth-child(3) { width: 8% !important; }
  body.print-details .detail-lines-table th:nth-child(4),
  body.print-details .detail-lines-table td:nth-child(4) { width: 17% !important; }
  body.print-details .detail-lines-table th:nth-child(5),
  body.print-details .detail-lines-table td:nth-child(5) { width: 14% !important; }
  body.print-details .detail-lines-table th:nth-child(6),
  body.print-details .detail-lines-table td:nth-child(6) { width: 18% !important; }
}

/* Conferência do orçamento */
.audit-panel {
  max-width: 1180px;
  margin: 0 auto;
  background: #fffdf9;
  border-color: rgba(58, 21, 19, .22);
}

.audit-panel .head strong {
  color: var(--brand);
  font-size: 13px;
  text-transform: uppercase;
}

.audit-error {
  border-left: 5px solid var(--brand);
}

.audit-warning {
  border-left: 5px solid #b8773f;
}

.audit-ok {
  border-left: 5px solid var(--green);
}

.audit-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.audit-grid > div {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 13px;
  border: 1px solid #eadfd4;
  border-radius: 8px;
  background: #fff;
}

.audit-grid h4 {
  margin: 0;
  color: var(--brand);
  font-size: 12px;
  text-transform: uppercase;
}

.audit-list {
  display: grid;
  gap: 7px;
}

.audit-list span {
  display: block;
  padding: 8px 9px;
  border-left: 3px solid #d7b8a6;
  background: #fffaf4;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
}

.audit-list .ok {
  border-left-color: var(--green);
  color: var(--green);
  font-weight: 800;
}

@media (max-width: 1000px) {
  .audit-grid {
    grid-template-columns: 1fr;
  }
}

/* Montagem do orçamento mais clara */
.environment .inline-actions {
  align-items: start;
}

.environment .inline-actions .primary,
.environment .inline-actions .secondary {
  width: auto;
}

.budget-item-row.base-line {
  background: #fff;
}

.budget-item-row.manual-line td {
  background: #fffaf4;
}

.budget-item-row.manual-line .item-cell {
  border-left: 4px solid var(--brand);
}

.line-type {
  display: inline-flex;
  align-items: start;
  width: fit-content;
  margin-bottom: 6px;
  padding: 3px 7px;
  border-radius: 999px;
  background: #f4eee7;
  color: var(--brand);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.manual-line .line-type {
  background: var(--brand);
  color: #fff8ef;
}

.subtotal-cell strong {
  display: block;
  padding: 8px 9px;
  border-radius: 6px;
  background: #fffaf4;
  color: var(--brand);
  text-align: right;
}

.manual-line .subtotal-cell strong {
  background: #f4eee7;
}

.budget-item-row:focus-within td {
  background: #fff7ef;
}

.row-actions {
  gap: 5px;
}

.row-actions .compact {
  font-size: 11px;
  padding: 7px 7px;
}

.actions-cell .icon {
  width: 32px;
  height: 32px;
}

.config-save-hint {
  padding: 10px 12px;
  border-left: 4px solid var(--brand);
  background: #fffaf4;
  border-radius: 6px;
}

.budget-edit-status {
  border: 1px solid rgba(58, 21, 19, .16);
  border-radius: 8px;
  padding: 12px 14px;
  margin: -4px 0 16px;
  display: grid;
  gap: 4px;
  background: #fffaf4;
}

.budget-edit-status strong {
  color: var(--wine);
}

.budget-edit-status span {
  color: var(--muted);
  font-size: 13px;
}

.budget-edit-status.saved-edit {
  background: #f8f2ea;
  border-color: rgba(58, 21, 19, .26);
}
.audit-dashboard {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 18px;
}

.audit-metric {
  border: 1px solid #eadfd4;
  border-radius: 8px;
  background: #fffaf4;
  padding: 12px;
  display: grid;
  gap: 5px;
  min-height: 98px;
}

.audit-metric small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.audit-metric strong {
  color: var(--brand);
  font-size: 20px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.audit-metric span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.audit-metric.strong {
  background: var(--brand);
  border-color: var(--brand);
}

.audit-metric.strong small,
.audit-metric.strong span {
  color: #d7b8a6;
}

.audit-metric.strong strong {
  color: #fff8ef;
}

.audit-metric.error {
  border-color: rgba(58, 21, 19, .38);
  background: #fff1ee;
}

.audit-metric.warning {
  border-color: rgba(184, 119, 63, .42);
  background: #fff7e8;
}

.audit-metric.ok {
  border-color: rgba(59, 106, 83, .34);
  background: #f1f7f2;
}

.checklist-grid .critical-list span {
  border-left-color: var(--brand);
}

.checklist-grid .warning-list span {
  border-left-color: #b8773f;
}

.checklist-grid .ok-list span {
  border-left-color: var(--green);
}

@media (max-width: 1180px) {
  .audit-dashboard {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .audit-dashboard {
    grid-template-columns: 1fr;
  }
}
/* Conferência mais compacta */
.audit-panel {
  padding-bottom: 16px;
}

.audit-panel .head {
  margin-bottom: 12px;
}

.audit-dashboard {
  gap: 8px;
  margin-bottom: 12px;
}

.audit-metric {
  min-height: 82px;
  padding: 10px 11px;
  gap: 3px;
}

.audit-metric strong {
  font-size: 19px;
}

.audit-metric span {
  font-size: 11px;
}

.checklist-grid {
  gap: 8px;
}

.audit-grid > div {
  padding: 10px 12px;
  gap: 8px;
  background: #fffdf9;
  border-color: #eadfd4;
}

.audit-grid h4 {
  font-size: 11px;
  letter-spacing: .04em;
}

.audit-list {
  gap: 5px;
}

.audit-list span {
  padding: 6px 8px;
  font-size: 12px;
  line-height: 1.25;
  background: #fffaf4;
}

.audit-list .muted-ok {
  color: var(--muted);
  font-weight: 700;
}
/* Conferência focada em atenção */
.compact-audit-dashboard {
  grid-template-columns: 1.1fr repeat(4, minmax(0, 1fr));
}

.audit-focus-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.audit-focus-grid.has-errors {
  grid-template-columns: minmax(260px, .85fr) minmax(0, 1.15fr);
}

.audit-focus-card {
  padding: 10px 12px;
  border: 1px solid #eadfd4;
  border-radius: 8px;
  background: #fffdf9;
  display: grid;
  gap: 8px;
}

.audit-focus-card h4 {
  margin: 0;
  color: var(--brand);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.attention-card {
  background: #fffaf4;
}

@media (max-width: 1180px) {
  .compact-audit-dashboard {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .compact-audit-dashboard,
  .audit-focus-grid.has-errors {
    grid-template-columns: 1fr;
  }
}
/* Montagem compacta */
.budget-view {
  gap: 12px;
}

.budget-overview {
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, .65fr);
  gap: 12px;
  align-items: stretch;
}

.budget-info-panel,
.budget-total-card {
  padding: 16px 18px;
}

.compact-head {
  margin-bottom: 12px;
  align-items: start;
}

.compact-head h3 {
  font-size: 20px;
}

.budget-status-inline {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.compact-general-grid {
  grid-template-columns: minmax(220px, 1.15fr) minmax(180px, .9fr) minmax(150px, .55fr);
  gap: 10px;
}

.compact-general-grid label {
  gap: 6px;
}

.compact-general-grid input {
  min-height: 38px;
}

.compact-actions {
  margin-top: 12px;
  padding-top: 10px;
  gap: 8px;
}

.compact-actions button {
  padding: 10px 12px;
}

.budget-total-card {
  display: grid;
  align-content: start;
  min-height: 0;
}

.compact-total-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 12px;
}

.compact-total-head h3 {
  font-size: 20px;
}

.compact-total-head strong {
  color: #fff8ef;
  font-size: clamp(30px, 3vw, 42px);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.budget-total-card dl {
  gap: 6px;
}

.budget-total-card dl div {
  padding-top: 7px;
}

.budget-items-panel {
  padding-top: 16px;
}

@media (max-width: 1180px) {
  .budget-overview,
  .compact-general-grid {
    grid-template-columns: 1fr;
  }
}
/* Linhas de orçamento compactas */
.environment {
  padding: 14px 16px;
}

.environment .env-header {
  gap: 10px;
  margin-bottom: 10px;
}

.environment .env-total strong {
  font-size: 20px;
}

.environment table {
  min-width: 1060px;
}

.environment th,
.environment td {
  padding: 5px 6px;
}

.environment th {
  font-size: 10px;
}

.budget-item-row select,
.budget-item-row input,
.budget-item-row td input,
.budget-item-row td select {
  padding: 6px 7px;
  min-height: 32px;
  font-size: 12px;
}

.line-type {
  display: none;
}

.manual-item-input {
  margin-top: 4px;
}

.budget-item-row.manual-line .item-cell {
  border-left-width: 3px;
}

.subtotal-cell {
  font-size: 12px;
}

.subtotal-cell strong {
  padding: 6px 7px;
  border-radius: 5px;
}

.row-actions {
  gap: 3px;
}

.row-actions .icon,
.mini-action {
  width: 30px;
  min-width: 30px;
  height: 30px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  font-size: 12px;
}

.environment .inline-actions {
  padding-top: 8px;
  margin-top: 8px;
}

.environment .inline-actions button {
  padding: 9px 11px;
}

@media (max-width: 900px) {
  .environment table {
    min-width: 1000px;
  }
}
.environment .item-cell,
.environment th:nth-child(1) { width: 28%; }
.environment .qty-cell,
.environment th:nth-child(2) { width: 6%; }
.environment .unit-cell,
.environment th:nth-child(3) { width: 5%; }
.environment .base-cell,
.environment th:nth-child(4) { width: 10%; }
.environment .adjust-mode-cell,
.environment th:nth-child(5) { width: 9%; }
.environment .adjust-value-cell,
.environment th:nth-child(6) { width: 9%; }
.environment .subtotal-cell,
.environment th:nth-child(7) { width: 11%; }
.environment .note-cell,
.environment th:nth-child(8) { width: 13%; }
.environment .actions-cell,
.environment th:nth-child(9) { width: 9%; }
/* Resumo com comissão opcional */
.summary-table.no-architect-column {
  min-width: 720px;
}

.summary-table.no-architect-column th:nth-child(1),
.summary-table.no-architect-column td:nth-child(1) {
  width: 42%;
}

.summary-table.no-architect-column th:nth-child(2),
.summary-table.no-architect-column td:nth-child(2) {
  width: 26%;
}

.summary-table.no-architect-column th:nth-child(3),
.summary-table.no-architect-column td:nth-child(3) {
  width: 32%;
  text-align: right;
}

.summary-table.no-architect-column tfoot td:nth-child(3) {
  background: #fffaf4;
  border: 2px solid var(--brand);
  color: var(--brand);
  font-weight: 900;
}

@media print {
  .summary-table.no-architect-column th:nth-child(1),
  .summary-table.no-architect-column td:nth-child(1) { width: 44% !important; }
  .summary-table.no-architect-column th:nth-child(2),
  .summary-table.no-architect-column td:nth-child(2) { width: 26% !important; }
  .summary-table.no-architect-column th:nth-child(3),
  .summary-table.no-architect-column td:nth-child(3) { width: 30% !important; }
}
.description-panel {
  margin-top: 10px;
  border: 1px solid #eadfd4;
  border-radius: 8px;
  background: #fffdf9;
  overflow: hidden;
}

.description-panel summary {
  cursor: pointer;
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  color: var(--brand);
  font-weight: 900;
  list-style: none;
}

.description-panel summary::-webkit-details-marker {
  display: none;
}

.description-panel summary span::before {
  content: "+";
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-right: 8px;
  border-radius: 50%;
  background: #f2ece3;
  color: var(--brand);
  font-size: 14px;
}

.description-panel[open] summary span::before {
  content: "-";
}

.description-panel summary strong {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.description-groups {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 14px;
  padding: 0 12px 12px;
}

.description-group {
  display: grid;
  align-content: start;
  gap: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.description-group h4 {
  margin: 0;
  color: var(--brand);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.description-option {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 7px;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.25;
}

.description-option input {
  margin-top: 2px;
  accent-color: var(--brand);
}

@media (max-width: 1000px) {
  .description-groups {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .description-groups {
    grid-template-columns: 1fr;
  }
}
.proposal-view {
  max-width: 820px;
  margin: 0 auto;
}

.proposal-document {
  background: #fffdf9;
  color: #16110f;
  padding: 0;
  overflow: hidden;
  font-size: 13px;
}

.proposal-hero {
  padding: 18px 28px 8px;
  border-bottom: 0;
}

.proposal-company-brand {
  display: grid;
  grid-template-columns: 46% 54%;
  align-items: center;
  border: 1px solid #d7d7d7;
  background: #fff;
}

.proposal-company-brand img {
  display: block;
  width: min(100%, 320px);
  height: auto;
  max-height: 86px;
  justify-self: center;
  object-fit: contain;
  padding: 8px 14px;
  border-right: 1px solid #d7d7d7;
}

.proposal-company-data {
  display: grid;
  gap: 2px;
  padding: 8px 12px;
  color: #000;
  font-size: 13px;
  line-height: 1.18;
  text-align: center;
}

.proposal-company-data strong {
  color: #000;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0;
}

.proposal-client-line {
  padding: 10px 28px 2px;
  color: #000;
  font-size: 16px;
}

.proposal-client-line strong {
  font-weight: 900;
}

.proposal-date-line {
  display: flex;
  justify-content: flex-start;
  gap: 18px;
  padding: 0 28px 8px;
  color: #7b716c;
  font-size: 10px;
  line-height: 1.2;
}

.proposal-main-title {
  max-width: calc(100% - 56px);
  margin: 8px auto 15px;
  padding: 8px 10px;
  border-top: 2px solid var(--brand);
  border-bottom: 2px solid var(--brand);
  background: #fff7ef;
  color: var(--brand);
  font-size: 19px;
  line-height: 1.18;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.proposal-section {
  padding: 15px 34px;
  border-bottom: 1px solid var(--line);
}

.proposal-opening-section {
  padding-top: 0;
}

.proposal-section h3 {
  margin: 0 0 9px;
  color: #000;
  font-size: 17px;
  text-transform: uppercase;
}

.proposal-section p {
  margin: 0 0 7px;
  line-height: 1.48;
}

.proposal-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.proposal-value-table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
}

.proposal-value-table th,
.proposal-value-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.proposal-value-table th:last-child,
.proposal-value-table td:last-child {
  text-align: right;
  font-weight: 800;
}

.proposal-value-table thead th {
  background: #f5eee6;
  color: #2b2422;
  font-size: 12px;
  text-transform: uppercase;
}

.proposal-value-table tbody tr:nth-child(even) td {
  background: #fffaf4;
}

.proposal-value-table tfoot td {
  background: #fff7ef;
  color: var(--brand);
  border-top: 2px solid var(--brand);
  font-size: 16px;
  font-weight: 900;
  text-transform: uppercase;
}

.proposal-descriptions {
  display: grid;
  gap: 8px;
}

.proposal-env {
  padding-top: 8px;
  border-top: 1px solid var(--line);
  background: transparent;
}

.proposal-env-head {
  padding: 0 0 5px;
  color: var(--brand);
}

.proposal-env-head h4 {
  margin: 0;
  font-size: 13px;
  line-height: 1.2;
  text-transform: uppercase;
}

.proposal-env ul,
.two-column-text ul {
  margin: 0;
  padding: 0 0 0 18px;
  line-height: 1.35;
}

.proposal-env li,
.two-column-text li {
  margin-bottom: 3px;
}

.proposal-env .hint {
  margin: 0 0 2px;
  font-size: 12px;
}

.two-column-text {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 22px;
}

.proposal-delivery-section {
  padding-top: 12px;
  padding-bottom: 12px;
  border-bottom: 0;
}

.condition-line {
  padding: 5px 0 5px 12px;
  border-left: 3px solid var(--brand);
}

.condition-line span,
.payment-options span {
  display: block;
  color: var(--brand);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.condition-line strong {
  display: block;
  margin-top: 3px;
  color: #1f1816;
  font-size: 15px;
}

.proposal-delivery-section small,
.payment-options small {
  color: #625752;
  font-size: 11px;
}

.proposal-payment-section {
  background: #fffaf4;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.proposal-payment-section h3 {
  margin-bottom: 10px;
  padding-bottom: 6px;
  color: var(--brand);
  border-bottom: 1px solid #d9cabe;
}

.payment-editor-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.payment-options {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 0;
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: #fffdf9;
}

.payment-options article {
  padding: 11px 13px;
  background: transparent;
}

.payment-options article + article {
  border-left: 1px solid #d9cabe;
  background: #fffaf4;
}

.payment-options strong {
  display: block;
  margin: 5px 0 3px;
  color: #1f1816;
  font-size: 15px;
  line-height: 1.25;
}

.proposal-payment-section img,
.payment-condition img {
  display: block;
  width: 100%;
  max-width: 323px;
  margin-top: 10px;
  object-fit: contain;
}

.proposal-footer {
  display: grid;
  grid-template-columns: 1fr 105px;
  align-items: center;
  gap: 18px;
  padding: 16px 34px 18px;
  color: var(--ink);
  background: #fffdf9;
  border-top: 3px solid var(--brand);
  line-height: 1.35;
}

.proposal-footer p,
.proposal-footer strong,
.proposal-footer span {
  display: block;
  margin: 0 0 6px;
}

.proposal-footer p {
  color: #544945;
  font-size: 13px;
}

.proposal-footer strong {
  color: var(--brand);
  font-size: 13px;
}

.proposal-footer span {
  color: #2b2422;
  font-size: 12px;
}

.proposal-footer-text {
  min-width: 0;
}

.proposal-footer-qr {
  display: grid;
  justify-items: center;
  gap: 5px;
  color: #544945;
  font-size: 10px;
  line-height: 1.15;
  text-align: center;
}

.proposal-footer-qr img {
  width: 84px;
  height: 84px;
  object-fit: contain;
  border: 1px solid var(--line);
  background: #fff;
  padding: 3px;
}

.proposal-editor {
  margin-bottom: 14px;
}

.proposal-editor-grid {
  display: grid;
  gap: 12px;
}

.proposal-editor textarea {
  min-height: 64px;
  resize: vertical;
}

@media (max-width: 900px) {
  .payment-editor-grid,
  .payment-options {
    grid-template-columns: 1fr;
  }

  .payment-options article + article {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 800px) {
  .proposal-company-brand,
  .two-column-text {
    grid-template-columns: 1fr;
  }

  .proposal-company-brand img {
    border-right: 0;
    border-bottom: 1px solid #d7d7d7;
  }

  .proposal-date-line {
    display: grid;
    gap: 2px;
  }

  .proposal-main-title {
    font-size: 17px;
  }
}

@media (max-width: 700px) {
  .proposal-footer {
    grid-template-columns: 1fr;
  }

  .proposal-footer-qr {
    justify-items: start;
    text-align: left;
  }
}

@media print {
  body.proposal-print .proposal-view {
    max-width: none;
  }

  body.proposal-print .proposal-document {
    width: 100%;
    border: 0 !important;
    box-shadow: none !important;
  }

  body.proposal-print .proposal-main-title {
    font-size: 18px;
  }

  body.proposal-print .proposal-section,
  body.proposal-print .proposal-hero,
  body.proposal-print .proposal-footer {
    break-inside: avoid;
  }

  body.proposal-print .proposal-descriptions {
    break-inside: auto;
  }

  body.proposal-print .proposal-footer-qr img {
    width: 78px;
    height: 78px;
  }
}


.proposal-footer .proposal-footer-message {
  margin-bottom: 12px;
}

.proposal-footer-text strong {
  margin-bottom: 5px;
}

.proposal-footer .proposal-footer-links {
  margin-top: 4px;
  color: var(--brand);
  font-weight: 700;
}

.browser-storage-note {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  border: 1px solid rgba(72, 80, 67, 0.22);
  border-left: 4px solid #485043;
  border-radius: 8px;
  background: #f7f8f4;
  padding: 12px 14px;
  margin: 0 0 14px;
}

.browser-storage-note strong,
.browser-storage-note span {
  display: block;
}

.browser-storage-note strong {
  color: var(--brand);
  font-size: 13px;
  margin-bottom: 3px;
}

.browser-storage-note span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.browser-storage-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.compact-file-action {
  min-height: 38px;
  padding: 0 12px;
}

@media (max-width: 780px) {
  .browser-storage-note {
    grid-template-columns: 1fr;
  }

  .browser-storage-actions {
    justify-content: flex-start;
  }
}

.backup-export-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  background: rgba(24, 18, 16, 0.48);
  padding: 20px;
}

.backup-export-box {
  width: min(760px, 100%);
  max-height: min(720px, calc(100vh - 40px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffdf9;
  box-shadow: 0 24px 80px rgba(54, 3, 3, 0.28);
  padding: 20px;
}

.backup-export-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  margin-bottom: 10px;
}

.backup-export-head h3 {
  margin: 0;
}

.backup-export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0;
}

.backup-export-actions a {
  text-decoration: none;
}

.backup-export-box textarea {
  width: 100%;
  min-height: 180px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbf7f1;
  padding: 12px;
  color: var(--ink);
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  line-height: 1.45;
}


@media print {
  body.proposal-print .proposal-company-brand {
    grid-template-columns: 42% 58%;
  }

  body.proposal-print .proposal-company-brand img {
    width: 72mm !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: 24mm !important;
    object-fit: contain !important;
    padding: 4mm 5mm !important;
  }
}

.proposal-not-included {
  margin-top: 8px;
  padding-top: 6px;
  color: #544945;
  font-style: italic;
}

.proposal-not-included strong {
  display: block;
  margin-bottom: 3px;
  color: var(--brand);
  font-size: 12px;
  font-style: italic;
  font-weight: 800;
}

.proposal-not-included ul {
  margin: 0;
  padding: 0;
  list-style: none;
  line-height: 1.35;
}

.proposal-not-included li {
  margin-bottom: 3px;
}

.proposal-not-included li::before {
  content: "* ";
  color: var(--brand);
  font-weight: 800;
}


.card-brands-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.card-brands-line img {
  margin-top: 0;
}

.card-brands-line small {
  color: #625752;
  font-size: 10px;
  line-height: 1.25;
}

.env-order-actions {
  display: flex;
  gap: 6px;
  justify-content: center;
  align-items: end;
}

.env-order-actions .icon {
  width: 34px;
  min-height: 34px;
  color: var(--brand);
  font-size: 16px;
}

.env-order-actions .icon:disabled {
  opacity: 0.34;
  cursor: not-allowed;
}

.environment-highlight {
  outline: 3px solid rgba(72, 80, 67, 0.28);
  box-shadow: 0 0 0 6px rgba(72, 80, 67, 0.08);
  transition: outline-color 0.25s ease, box-shadow 0.25s ease;
}

.history-save-status {
  display: grid;
  gap: 2px;
  min-width: 190px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  background: #fffdf9;
  text-align: right;
}

.history-save-status strong {
  color: var(--brand);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.history-save-status span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.history-save-status.saved {
  border-color: rgba(72, 80, 67, 0.26);
  background: #f7f8f4;
}

.history-save-status.saved strong {
  color: #485043;
}

.history-save-status.unsaved {
  border-color: rgba(116, 76, 45, 0.26);
  background: #fff8ef;
}

.brand-home {
  width: 100%;
  display: grid;
  gap: 5px;
  justify-items: start;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  cursor: pointer;
}

.home-view {
  max-width: 980px;
  margin: 0 auto;
}

.home-panel {
  display: grid;
  gap: 18px;
  padding: 30px;
}

.home-brand-line {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.home-brand-line img {
  width: 210px;
  max-height: 58px;
  object-fit: contain;
}

.home-brand-line span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.home-panel h3 {
  margin: 0;
  color: var(--brand);
  font-size: 28px;
}

.home-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.home-status-grid {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 10px;
}

.home-status-grid > div {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbf7f1;
  padding: 14px;
}

.home-status-grid small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.home-status-grid strong {
  color: var(--brand);
  font-size: 20px;
}

.home-status-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

@media (max-width: 760px) {
  .home-status-grid {
    grid-template-columns: 1fr;
  }

  .home-brand-line {
    align-items: start;
    flex-direction: column;
  }
}

.budget-client-group {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffdf9;
  padding: 14px;
}

.budget-client-group > header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.budget-client-group h4 {
  margin: 0 0 4px;
  color: var(--brand);
  font-size: 20px;
}

.budget-client-group header span,
.budget-client-group header small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.budget-client-actions {
  display: grid;
  gap: 6px;
  justify-items: end;
  text-align: right;
}

.budget-client-actions strong {
  color: var(--brand);
  font-size: 18px;
}

.budget-version-records {
  gap: 8px;
}

@media (max-width: 760px) {
  .budget-client-group > header {
    grid-template-columns: 1fr;
  }

  .budget-client-actions {
    justify-items: start;
    text-align: left;
  }
}

.compact-client-group {
  gap: 12px;
  padding: 12px;
}

.compact-client-group > header {
  padding-bottom: 8px;
}

.compact-client-group .budget-client-actions {
  align-self: center;
}

.latest-budget-block {
  display: grid;
  gap: 6px;
}

.latest-budget-block > small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.older-versions-panel {
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.older-versions-panel summary {
  cursor: pointer;
  color: var(--brand);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.older-versions-panel summary strong {
  display: inline-flex;
  min-width: 22px;
  min-height: 22px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #fbf7f1;
  margin-left: 6px;
}

.older-versions-panel .budget-version-records {
  margin-top: 8px;
}

.compact-client-group .budget-record {
  grid-template-columns: minmax(0, 1fr) minmax(120px, auto) auto;
  padding: 10px;
}

.permission-note {
  margin: 6px 4px 10px;
  border: 1px solid rgba(58, 21, 19, .12);
  border-radius: 6px;
  background: #fbf6ef;
  color: var(--muted);
  padding: 10px 11px;
  font-size: 11px;
  line-height: 1.45;
}

.permission-panel {
  max-width: 680px;
}

.online-setup-panel .setup-steps {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(58, 21, 19, .12);
  border-radius: 8px;
  background: #fbf6ef;
  padding: 18px;
  color: var(--muted);
}

.online-setup-panel .setup-steps strong {
  color: var(--brand);
}

.login-error {
  border-left: 3px solid var(--brand);
  background: #fbf6ef;
  color: var(--brand);
  padding: 10px 12px;
  font-weight: 700;
}
