/* Fabrin Engenharia - Sistema Web de Orçamentos e Propostas
   Identidade Visual: Clara, Executiva, Arquitetônica e Clean */

:root {
  --bg-canvas: #f5f5f2;
  --bg-surface: #ffffff;
  --bg-subtle: #fafaf8;
  --ink-primary: #22272a;
  --ink-secondary: #4a5358;
  --ink-muted: #6c767c;
  --brand-red: #a30d18;
  --brand-red-hover: #830912;
  --brand-red-soft: #fdf2f3;
  --brand-red-border: #f3c8cc;
  --border-light: #e4e5df;
  --border-mid: #cfd2ca;
  --green: #15803d;
  --green-soft: #f0fdf4;
  --amber: #b45309;
  --amber-soft: #fffbeb;
  --blue: #1d4ed8;
  --blue-soft: #eff6ff;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-xs: 0 1px 2px rgba(24, 28, 32, 0.04);
  --shadow-sm: 0 2px 10px rgba(24, 28, 32, 0.05);
  --shadow-md: 0 10px 28px rgba(24, 28, 32, 0.09);
  --shadow-lg: 0 20px 48px rgba(24, 28, 32, 0.14);
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--ink-primary);
  background: var(--bg-canvas);
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* =========================================================
   LOGIN VIEW
   ========================================================= */
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top right, rgba(163, 13, 24, 0.05), transparent 45%),
    var(--bg-canvas);
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-top: 4px solid var(--brand-red);
  border-radius: var(--radius-lg);
  padding: 36px 34px;
  box-shadow: var(--shadow-md);
}

.login-logo-wrap {
  text-align: center;
  margin-bottom: 22px;
}

.login-logo-wrap img {
  width: 96px;
  height: 96px;
  object-fit: contain;
  margin: 0 auto 12px;
  display: block;
}

.login-logo-wrap h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.login-logo-wrap p {
  margin: 4px 0 0;
  font-size: 13.5px;
  color: var(--ink-muted);
}

/* =========================================================
   APP HEADER & NAVIGATION
   ========================================================= */
.app-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-light);
}

.topbar-inner {
  max-width: 1380px;
  margin: 0 auto;
  padding: 0 24px;
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}

.brand-block img {
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.brand-titles strong {
  display: block;
  font-size: 13.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-primary);
}

.brand-titles span {
  display: block;
  font-size: 12px;
  color: var(--ink-muted);
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-secondary);
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.nav-tab:hover {
  background: var(--bg-subtle);
  color: var(--ink-primary);
}

.nav-tab.active {
  background: var(--brand-red-soft);
  color: var(--brand-red);
  border-color: var(--brand-red-border);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.env-badge {
  font-size: 11.5px;
  font-weight: 650;
  padding: 4px 10px;
  border-radius: 99px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  color: var(--ink-muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.env-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
}

/* =========================================================
   MAIN CONTAINER & COMMON LAYOUT
   ========================================================= */
.app-main {
  max-width: 1380px;
  margin: 0 auto;
  padding: 26px 24px 72px;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.page-header h1 {
  margin: 0;
  font-size: 23px;
  font-weight: 750;
  letter-spacing: -0.025em;
}

.page-header p {
  margin: 4px 0 0;
  color: var(--ink-muted);
  font-size: 13.8px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* =========================================================
   CARDS & PANELS
   ========================================================= */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  margin-bottom: 20px;
}

.card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.card-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.step-badge {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: var(--brand-red);
  color: #fff;
  font-weight: 750;
  font-size: 12.5px;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
}

.card-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.card-subtitle {
  margin: 2px 0 0;
  font-size: 12.8px;
  color: var(--ink-muted);
}

.card-body {
  padding: 22px;
}

/* =========================================================
   KPI SUMMARY STRIP (DASHBOARD)
   ========================================================= */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 22px;
}

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-xs);
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--border-mid);
}

.kpi-card.kpi-red::before { background: var(--brand-red); }
.kpi-card.kpi-amber::before { background: var(--amber); }
.kpi-card.kpi-green::before { background: var(--green); }
.kpi-card.kpi-dark::before { background: var(--ink-primary); }

.kpi-label {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
  margin-bottom: 6px;
}

.kpi-value {
  font-size: 24px;
  font-weight: 750;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
  color: var(--ink-primary);
}

.kpi-foot {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--ink-muted);
}

/* =========================================================
   BUTTONS
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-weight: 650;
  font-size: 13.5px;
  border: 1px solid var(--border-mid);
  background: var(--bg-surface);
  color: var(--ink-primary);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.14s ease;
  white-space: nowrap;
}

.btn:hover {
  background: var(--bg-subtle);
  border-color: var(--ink-secondary);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--brand-red);
  border-color: var(--brand-red);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--brand-red-hover);
  border-color: var(--brand-red-hover);
  color: #ffffff;
}

.btn-dark {
  background: var(--ink-primary);
  border-color: var(--ink-primary);
  color: #ffffff;
}

.btn-dark:hover {
  background: #111416;
  border-color: #111416;
  color: #ffffff;
}

.btn-soft {
  background: var(--brand-red-soft);
  border-color: var(--brand-red-border);
  color: var(--brand-red);
}

.btn-soft:hover {
  background: #fbe4e6;
}

.btn-success {
  background: var(--green);
  border-color: var(--green);
  color: #ffffff;
}

.btn-success:hover {
  background: #116932;
}

.btn-sm {
  padding: 6px 11px;
  font-size: 12.5px;
}

.btn-xs {
  padding: 4px 8px;
  font-size: 12px;
}

.btn-icon {
  padding: 6px 8px;
  line-height: 1;
}

.btn-danger-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--ink-muted);
}

.btn-danger-ghost:hover {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}

/* =========================================================
   FORMS & INPUTS
   ========================================================= */
.form-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
}

.col-12 { grid-column: span 12; }
.col-8 { grid-column: span 8; }
.col-7 { grid-column: span 7; }
.col-6 { grid-column: span 6; }
.col-5 { grid-column: span 5; }
.col-4 { grid-column: span 4; }
.col-3 { grid-column: span 3; }
.col-2 { grid-column: span 2; }

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field label {
  font-size: 12.5px;
  font-weight: 650;
  color: var(--ink-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.field-hint {
  font-size: 11.8px;
  color: var(--ink-muted);
  font-weight: 400;
}

.input, .select, .textarea {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-mid);
  background: #ffffff;
  color: var(--ink-primary);
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}

.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--brand-red);
  box-shadow: 0 0 0 3px rgba(163, 13, 24, 0.11);
}

.textarea {
  resize: vertical;
  min-height: 76px;
  line-height: 1.55;
}

.code-preview-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
}

.code-preview-tag {
  font-family: 'Consolas', 'SFMono-Regular', monospace;
  font-weight: 700;
  font-size: 15px;
  color: var(--brand-red);
  letter-spacing: 0.02em;
}

/* =========================================================
   EDITOR WORKSPACE SWITCHER (INTERNAL VS CLIENT PROPOSAL)
   ========================================================= */
.workspace-bar {
  position: sticky;
  top: 68px;
  z-index: 30;
  background: var(--bg-canvas);
  padding: 12px 0 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.mode-pills {
  display: inline-flex;
  background: var(--bg-surface);
  border: 1px solid var(--border-mid);
  padding: 4px;
  border-radius: 8px;
  gap: 4px;
}

.mode-pill {
  padding: 8px 16px;
  border-radius: 6px;
  border: 0;
  background: transparent;
  font-weight: 650;
  font-size: 13.5px;
  color: var(--ink-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.mode-pill.active {
  background: var(--ink-primary);
  color: #ffffff;
}

/* =========================================================
   COST ITEMS SPREADSHEET (ITEM 2)
   ========================================================= */
.sheet-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 22px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-light);
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.cat-chip-btn {
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid var(--border-mid);
  background: #fff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.12s ease;
}

.cat-chip-btn:hover {
  border-color: var(--brand-red);
  color: var(--brand-red);
}

.sheet-scroll {
  width: 100%;
  overflow-x: auto;
}

.cost-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 820px;
}

.cost-table thead th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-muted);
  padding: 11px 12px;
  background: #fafaf8;
  border-bottom: 1px solid var(--border-light);
}

.cost-table thead th.num,
.cost-table tbody td.num {
  text-align: right;
}

.cost-table tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: background 0.1s ease;
}

.cost-table tbody tr:hover {
  background: #fcfcfb;
}

.cost-table tbody td {
  padding: 8px 10px;
  vertical-align: middle;
}

.sheet-input, .sheet-select {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 5px;
  font-size: 13.8px;
  transition: all 0.12s ease;
}

.sheet-input:hover, .sheet-select:hover {
  border-color: var(--border-light);
  background: #ffffff;
}

.sheet-input:focus, .sheet-select:focus {
  outline: none;
  border-color: var(--brand-red);
  background: #ffffff;
  box-shadow: 0 0 0 2px rgba(163, 13, 24, 0.1);
}

.sheet-input.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.row-total-cell {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink-primary);
  padding-right: 14px !important;
  white-space: nowrap;
}

.cat-select-pill {
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  border-radius: 6px;
  padding: 6px 8px;
  border: 1px solid var(--border-light);
  background: var(--bg-subtle);
}

.sheet-footer {
  padding: 14px 22px;
  background: #fafaf8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* =========================================================
   CATEGORY BREAKDOWN & PRICING / BDI (ITEMS 3 & 4)
   ========================================================= */
.closing-grid {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 20px;
  align-items: start;
}

.cat-summary-list {
  display: grid;
  gap: 13px;
}

.cat-summary-row {
  padding: 11px 14px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
}

.cat-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
}

.cat-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 4px;
  margin-right: 6px;
}

.cat-bar-track {
  height: 6px;
  background: #e7e8e3;
  border-radius: 99px;
  overflow: hidden;
}

.cat-bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.2s ease;
}

.cat-total-banner {
  margin-top: 16px;
  padding: 15px 18px;
  background: var(--ink-primary);
  color: #ffffff;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cat-total-banner strong {
  font-size: 19px;
  font-variant-numeric: tabular-nums;
}

/* Pricing & BDI Controls */
.suggested-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-mid);
  border-left: 4px solid var(--brand-red);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 16px 0;
}

.suggested-box .price {
  font-size: 24px;
  font-weight: 780;
  color: var(--ink-primary);
  font-variant-numeric: tabular-nums;
}

.adopted-panel {
  background: #ffffff;
  border: 1.5px solid var(--brand-red-border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  margin-bottom: 18px;
}

.adopted-input-big {
  font-size: 24px;
  font-weight: 780;
  color: var(--brand-red);
  font-variant-numeric: tabular-nums;
  padding: 8px 12px;
  width: 210px;
  text-align: right;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
}

.range-slider {
  width: 100%;
  accent-color: var(--brand-red);
  margin: 14px 0 6px;
  cursor: pointer;
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--ink-muted);
}

.net-waterfall {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 16px 18px;
}

.wf-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  font-size: 13.8px;
  border-bottom: 1px dashed var(--border-light);
  font-variant-numeric: tabular-nums;
}

.wf-row.wf-net {
  border-bottom: 0;
  border-top: 2px solid var(--border-mid);
  margin-top: 6px;
  padding-top: 12px;
  font-size: 16.5px;
  font-weight: 780;
}

.wf-positive { color: var(--green); }
.wf-negative { color: #b91c1c; }

/* =========================================================
   PROPOSAL BUILDER & LIVE PREVIEW (ITEM 5)
   ========================================================= */
.publish-banner {
  background: var(--bg-surface);
  border: 1px solid var(--border-mid);
  border-left: 5px solid var(--brand-red);
  border-radius: var(--radius-md);
  padding: 18px 22px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.slug-url-box {
  display: inline-flex;
  align-items: center;
  background: var(--bg-subtle);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  padding: 6px 11px;
  font-family: 'Consolas', monospace;
  font-size: 13px;
  gap: 4px;
  margin-top: 6px;
}

.slug-url-box input {
  border: 0;
  background: #fff;
  padding: 3px 7px;
  border-radius: 4px;
  font-family: inherit;
  font-weight: 700;
  color: var(--brand-red);
  width: 135px;
  border: 1px solid var(--border-light);
}

.proposal-split {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 22px;
  align-items: start;
}

.preview-sticky {
  position: sticky;
  top: 138px;
}

.preview-frame-wrap {
  background: #e5e6e0;
  padding: 16px;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  display: flex;
  justify-content: center;
}

.preview-iframe {
  width: 100%;
  height: 680px;
  border: 1px solid var(--border-mid);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow-md);
  transition: width 0.22s ease;
}

.preview-iframe.mobile-mode {
  width: 390px;
  max-width: 100%;
  border: 6px solid #23282b;
  border-radius: 22px;
}

.repeater-item {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 10px;
}

.repeater-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

/* =========================================================
   DASHBOARD BUDGET LIST & STATUS PILLS (ITEM 6)
   ========================================================= */
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
}

.status-pills-filter {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-pill {
  padding: 6px 12px;
  border-radius: 99px;
  border: 1px solid var(--border-light);
  background: var(--bg-subtle);
  font-size: 12.5px;
  font-weight: 650;
  color: var(--ink-secondary);
  cursor: pointer;
}

.filter-pill.active {
  background: var(--ink-primary);
  border-color: var(--ink-primary);
  color: #fff;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table thead th {
  text-align: left;
  padding: 12px 16px;
  font-size: 11.5px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-muted);
  background: #fafaf8;
  border-bottom: 1px solid var(--border-light);
}

.data-table tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: background 0.12s ease;
}

.data-table tbody tr:hover {
  background: #fcfcfa;
}

.data-table tbody td {
  padding: 14px 16px;
  vertical-align: middle;
}

.status-select {
  font-size: 12.5px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 99px;
  border: 1px solid;
  cursor: pointer;
}

.code-mono {
  font-family: 'Consolas', monospace;
  font-weight: 750;
  font-size: 13.5px;
  color: var(--brand-red);
}

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--ink-muted);
}

/* =========================================================
   MODALS & TOASTS
   ========================================================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(20, 24, 28, 0.48);
  backdrop-filter: blur(3px);
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-card {
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-lg);
}

.toast-stack {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 120;
  display: grid;
  gap: 8px;
}

.toast {
  background: #1f2428;
  color: #ffffff;
  padding: 12px 18px;
  border-radius: 8px;
  border-left: 4px solid var(--brand-red);
  box-shadow: var(--shadow-md);
  font-size: 13.5px;
  font-weight: 550;
  max-width: 380px;
}

.toast.success {
  border-left-color: #22c55e;
}

/* =========================================================
   RESPONSIVE DESIGN (TABLET & MOBILE)
   ========================================================= */
@media (max-width: 1100px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .closing-grid,
  .proposal-split {
    grid-template-columns: 1fr;
  }
  .preview-sticky {
    position: static;
  }
}

@media (max-width: 820px) {
  .col-8, .col-7, .col-6, .col-5, .col-4, .col-3, .col-2 {
    grid-column: span 12;
  }

  .topbar-inner {
    padding: 10px 16px;
    flex-wrap: wrap;
  }

  .brand-titles span,
  .env-badge span {
    display: none;
  }

  .app-main {
    padding: 18px 14px 80px;
  }

  .workspace-bar {
    top: 60px;
  }

  /* Transforma tabela de gestão em cards limpos no celular */
  .data-table thead {
    display: none;
  }
  .data-table, .data-table tbody, .data-table tr, .data-table td {
    display: block;
    width: 100%;
  }
  .data-table tbody tr {
    padding: 14px;
    border-bottom: 6px solid var(--bg-canvas);
  }
  .data-table tbody td {
    padding: 6px 4px;
  }
}

@media (max-width: 520px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }
  .mode-pills {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .mode-pill {
    text-align: center;
    padding: 8px 8px;
    font-size: 12.5px;
  }
}

.live-notice { border-left: 3px solid var(--green); padding: .4rem .7rem; background: #f0fdf4; }
.card-rates-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(76px, 1fr)); gap: 10px; margin-top: 10px; }
.cover-thumb { width: 84px; height: 84px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border-light); }
#p-cover-thumb[hidden], #p-cover-remove[hidden] { display: none; }
.card-pricing-controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 185px), 1fr)); gap: 10px; margin: 12px 0; }
.card-breakdown { margin: 14px 0; padding: 14px; border: 1px solid var(--border-light); border-radius: 10px; }
.card-breakdown:empty { display: none; }
.card-breakdown p, .card-breakdown li { font-size: 14px; margin: 6px 0; line-height: 1.45; }
.card-breakdown ul { list-style: none; padding: 0; }
.card-breakdown li + li { padding-top: 8px; border-top: 1px solid var(--border-light); }
.card-pricing-error { color: #9d1521; }
#p-cash-field[hidden], #p-card-options[hidden] { display: none; }
.card-rates-grid input:invalid { border-color: var(--brand-red); }
.est-settings { margin-top: 20px; }
.est-form { display: grid; gap: 22px; }
.est-form section + section { padding-top: 16px; border-top: 1px solid var(--border-light); }
.est-form h3 { font-size: 15px; margin: 0 0 12px; }
.est-form .field > span { font-size: 13px; font-weight: 600; }
.est-form .card-subtitle { margin: 8px 0 2px; }
.est-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%,175px),1fr)); gap: 12px; }
.est-rows { display: grid; gap: 10px; }
.est-row { display: grid; grid-template-columns: minmax(150px,2fr) repeat(auto-fit,minmax(95px,1fr)); gap: 10px; align-items: end; }
.est-row > button { justify-self: start; }
.est-form [data-est-add] { margin: 10px 0 14px; }
.est-equation { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px; padding: 7px 0; border-bottom: 1px solid var(--border-light); }
.est-warning { color: #835007; background: #fff8e8; padding: 10px 12px 10px 30px; }
.estimate-source { font-size: 11px; font-weight: 650; color: var(--brand-red); white-space: normal; }
.est-form > button { justify-self: start; }
@media (max-width: 650px) {
  .est-row { grid-template-columns: repeat(2, minmax(0,1fr)); padding-bottom: 10px; border-bottom: 1px solid var(--border-light); }
  .est-row > .field:first-child { grid-column: 1/-1; }
  .est-equation { flex-direction: column; }
}
