/* ================================================
   QUANTO CUSTA MINHA CASA
   Design System: Terracota · Sálvia · Azul-profundo · Areia · Off-white  v4.0
   Tipografia: Poppins (títulos) + Inter (interface)
   ================================================ */

:root {
  /* Paleta oficial do Brand */
  --terracota:   #E76F51;
  --terracota-d: #C9573A;
  --salvia:      #2F7D72;
  --azul:        #1F3A56;
  --areia:       #EAD9C6;
  --offwhite:    #FBF9F4;

  /* Tokens do sistema (os nomes antigos --gold-* foram mantidos para não mexer na estrutura) */
  --bg:          #FBF9F4;
  --surface:     #FFFFFF;
  --card:        #FFFFFF;
  --input-bg:    #FAF5EC;
  --border:      #EADFD0;
  --border-l:    #D9C8B0;
  --gold:        #E76F51;   /* ação principal (terracota) */
  --gold-l:      #C9573A;   /* texto de destaque / hover (terracota escuro, legível) */
  --gold-p:      #1F3A56;   /* títulos e valores (azul-profundo) */
  --gold-dim:    #EAD9C6;   /* areia: bordas suaves e fundos acolhedores */
  --text:        #1F3A56;
  --text-m:      #58708A;
  --text-d:      #9AA9BA;
  --danger:      #B5382F;
  --danger-dim:  #F8E2DE;
  --success:     #2F7D72;
  --warn:        #B7791F;
  --blue:        #3B6A94;
  --panel-1:     rgba(31,58,86,0.035);
  --panel-2:     rgba(31,58,86,0.055);
  --overlay:     rgba(31,58,86,0.5);
  --sidebar-w:   248px;
  --header-h:    68px;
  --radius:      14px;
  --font:        'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-display:'Poppins', 'Inter', 'Segoe UI', system-ui, sans-serif;
  --shadow:      0 2px 14px rgba(31,58,86,0.07);
  --shadow-lg:   0 10px 32px rgba(31,58,86,0.16);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; overflow-x: hidden; }
/* Blindagem: qualquer elemento que extrapole a largura da viewport (ex.: cabeçalho
   com botões demais no celular) nunca deve criar rolagem horizontal da página —
   isso já causou menus/links ficarem "fora de alcance" no toque em telas pequenas. */
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.55; min-height: 100vh; overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: var(--font); }
input, select, textarea { font-family: var(--font); }
::placeholder { color: var(--text-d); }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-l); border-radius: 3px; }

/* ── Header (marca centralizada) ── */
.app-header {
  position: fixed; top: 0; left: 0; right: 0; height: var(--header-h);
  background: rgba(255,255,255,0.95); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  display: grid; grid-template-columns: minmax(0,1fr) auto minmax(0,1fr); align-items: center; gap: 14px;
  padding: 0 20px; z-index: 100; box-shadow: var(--shadow); max-width: 100vw;
}
.header-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.header-brand { display: flex; align-items: center; gap: 11px; justify-self: center; text-decoration: none; color: inherit; }
.header-brand .qcmc-mark { width: 46px; height: 46px; flex-shrink: 0; }
.header-brand .qcmc-word { font-size: 15.5px; }
.brand-slogan { display: block; margin-top: 3px; font-size: 10.5px; font-weight: 500; color: var(--text-m); letter-spacing: 0.01em; white-space: nowrap; }
.header-period { display: flex; align-items: center; gap: 8px; min-width: 0; }
.header-period label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-m); }
.header-period select {
  background: var(--input-bg); border: 1px solid var(--border); color: var(--text); font-weight: 600;
  padding: 8px 30px 8px 12px; border-radius: 10px; font-size: 13px; cursor: pointer; max-width: 210px; min-width: 0;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2358708A' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.header-period select:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(231,111,81,0.15); }
.header-actions { display: flex; align-items: center; gap: 8px; justify-self: end; min-width: 0; flex-shrink: 1; }
.header-actions .btn { min-width: 0; }
.header-actions .btn svg, .header-left .btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.autosave-badge { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-m); padding: 4px 8px; border-radius: 20px; transition: all 0.3s; white-space: nowrap; }
.autosave-badge.saved { color: var(--success); }
.autosave-badge.saving { color: var(--gold-l); }
.autosave-badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ── Cloud Status ── */
#btn-cloud { font-size: 16px; padding: 6px 8px; transition: all 0.2s; }
#btn-cloud.cloud-ok { color: var(--success); }
#btn-cloud.cloud-err { color: var(--danger); }
#btn-cloud.cloud-sync { color: var(--gold); }

/* ── Hamburger (mobile) ── */
.btn-menu:hover { color: var(--text); }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 10px; font-size: 12.5px; font-weight: 600; transition: all 0.18s; white-space: nowrap; }
.btn-gold { background: var(--terracota); color: #FFFFFF; font-weight: 700; box-shadow: 0 4px 12px rgba(231,111,81,0.30); }
.btn-gold:hover { background: var(--terracota-d); transform: translateY(-1px); box-shadow: 0 6px 16px rgba(231,111,81,0.38); }
.btn-gold:active { transform: translateY(0); }
.btn-outline { background: transparent; border: 1px solid var(--border-l); color: var(--text-m); }
.btn-outline:hover { border-color: var(--gold); color: var(--gold-l); }
.btn-confirm-danger { background: var(--danger-dim); border-color: var(--danger); color: var(--danger); font-weight: 700; }
.btn-confirm-danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-ghost { background: transparent; color: var(--text-m); padding: 7px 10px; }
.btn-ghost:hover { color: var(--text); background: var(--input-bg); border-radius: 7px; }
.btn-add { display: inline-flex; align-items: center; gap: 5px; padding: 5px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; background: transparent; border: 1px dashed var(--gold-dim); color: var(--gold); transition: all 0.18s; }
.btn-add:hover { background: rgba(231,111,81,0.12); border-color: var(--gold); }
.btn-remove { width: 24px; height: 24px; border-radius: 50%; background: transparent; border: 1px solid var(--danger-dim); color: var(--danger); font-size: 14px; display: inline-flex; align-items: center; justify-content: center; transition: all 0.18s; opacity: 0.6; line-height: 1; }
.btn-remove:hover { opacity: 1; background: var(--danger-dim); }
.btn-save { width: 24px; height: 24px; border-radius: 50%; background: transparent; border: 1px solid var(--border-l); color: var(--text-m); padding: 0; display: inline-flex; align-items: center; justify-content: center; transition: all 0.18s; opacity: 0.6; }
.btn-save svg { width: 13px; height: 13px; }
.btn-save:hover { opacity: 1; color: var(--gold-l); border-color: var(--gold); background: var(--input-bg); }

/* ── Dropdown ── */
.dropdown { position: relative; }
.dropdown-menu { position: absolute; top: calc(100% + 6px); right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; min-width: 190px; box-shadow: var(--shadow-lg); z-index: 200; display: none; }
.dropdown.open .dropdown-menu { display: block; }
.dropdown-menu button { width: 100%; padding: 11px 16px; text-align: left; color: var(--text); font-size: 13px; transition: background 0.15s; border-bottom: 1px solid var(--border); }
.dropdown-menu button:last-child { border-bottom: none; }
.dropdown-menu button:hover { background: rgba(231,111,81,0.1); color: var(--gold-l); }

/* ── Sidebar ── */
.sidebar { position: fixed; top: var(--header-h); left: 0; bottom: 0; width: var(--sidebar-w); background: var(--surface); border-right: 1px solid var(--border); overflow-y: auto; padding: 12px 0 24px; z-index: 90; transition: transform 0.28s ease; }
.nav-list { list-style: none; }
.nav-group-label { font-size: 9px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-d); padding: 20px 20px 6px; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 9px 20px; color: var(--text-m); font-size: 12.5px; transition: all 0.15s; border-left: 3px solid transparent; }
.nav-link:hover { color: var(--text); background: rgba(231,111,81,0.06); }
.nav-link.active { color: var(--gold-l); background: rgba(231,111,81,0.1); border-left-color: var(--gold); }
.nav-n { font-size: 10px; font-weight: 700; color: var(--gold-dim); min-width: 24px; }
.nav-link.active .nav-n { color: var(--gold); }

/* ── Main Content ── */
.main-content { margin-left: var(--sidebar-w); margin-top: var(--header-h); padding: 28px 28px 80px; max-width: 1300px; }

/* ── Section Cards ── */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 24px; overflow: visible; scroll-margin-top: calc(var(--header-h) + 20px); box-shadow: var(--shadow); transition: border-color 0.3s; }
.card-header, .card-body { overflow: hidden; }
.card-header { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--border); background: rgba(31,58,86,0.035); border-radius: var(--radius) var(--radius) 0 0; }
.card-num { font-size: 11px; font-weight: 700; color: var(--gold); background: rgba(231,111,81,0.12); border: 1px solid var(--gold-dim); border-radius: 6px; padding: 2px 8px; letter-spacing: 0.05em; flex-shrink: 0; }
.card-header h2 { font-size: 15px; font-weight: 700; color: var(--gold-p); flex: 1; }
.card-body { padding: 20px; border-radius: 0 0 var(--radius) var(--radius); }

/* ── Progress Badge (Plano de Ação) ── */
.progress-badge { font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 20px; background: rgba(217,200,176,0.4); color: var(--text-m); border: 1px solid var(--border); transition: all 0.3s; white-space: nowrap; }
.progress-badge.progress-partial { background: rgba(231,111,81,0.12); color: var(--gold); border-color: var(--gold-dim); }
.progress-badge.progress-complete { background: rgba(47,125,114,0.15); color: var(--success); border-color: var(--success); }

/* ── Form Elements ── */
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.form-grid-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-m); }
input[type=text], input[type=tel], input[type=email], input[type=number], input[type=date], input[type=password], select, textarea {
  background: var(--input-bg); border: 1px solid var(--border); color: var(--text);
  border-radius: 7px; padding: 9px 12px; font-size: 13.5px; width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(231,111,81,0.12); }
textarea { resize: vertical; min-height: 100px; line-height: 1.6; }
select { appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2358708A' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; cursor: pointer; }
input[type=number] { appearance: textfield; -moz-appearance: textfield; }
input[type=number]::-webkit-outer-spin-button, input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; }

/* ── Tables ── */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table thead tr { background: rgba(31,58,86,0.05); }
.data-table th { padding: 10px 12px; text-align: left; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-m); border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table td { padding: 6px 8px; border-bottom: 1px solid rgba(217,200,176,0.4); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: rgba(231,111,81,0.04); }
.data-table td input, .data-table td select, .data-table td textarea { background: transparent; border: 1px solid transparent; border-radius: 5px; padding: 6px 8px; color: var(--text); font-size: 13px; width: 100%; min-width: 80px; transition: border-color 0.15s; }
.data-table td input:hover, .data-table td select:hover, .data-table td textarea:hover { border-color: var(--border); }
.data-table td input:focus, .data-table td select:focus, .data-table td textarea:focus { background: var(--input-bg); border-color: var(--gold); box-shadow: 0 0 0 2px rgba(231,111,81,0.1); outline: none; }
.data-table td:last-child { width: 40px; text-align: center; }
.data-table td.row-actions { width: 64px; display: flex; align-items: center; justify-content: flex-end; gap: 6px; text-align: right; }
.data-table td input.input-sm { min-width: 60px; }
.data-table select { appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5' fill='none'%3E%3Cpath d='M1 1l3 3 3-3' stroke='%2358708A' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 6px center; padding-right: 22px; background-color: transparent; }
.data-table select:focus { background-color: var(--input-bg); }

/* ── Subsections ── */
.subsection { margin-bottom: 28px; }
.subsection:last-child { margin-bottom: 0; }
.subsection-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.subsection-header h3 { font-size: 13.5px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 6px; }
.text-hot { color: #E76F51; }
.text-warm { color: var(--blue); }

/* ── Rotina Grid ── */
.rotina-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.rotina-bloco { background: rgba(31,58,86,0.035); border: 1px solid var(--border); border-radius: 8px; padding: 16px; }
.rotina-bloco h3 { font-size: 13px; font-weight: 700; color: var(--text-m); margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.rotina-bloco textarea { background: transparent; border: none; padding: 0; resize: none; font-size: 13px; line-height: 1.65; min-height: 130px; }
.rotina-bloco textarea:focus { outline: none; box-shadow: none; border: none; }

/* ── Plano de Ação ── */
.plano-wrap { min-width: 660px; }
.plano-row { display: grid; grid-template-columns: 32px 210px 140px 110px 130px 38px; gap: 6px; align-items: center; padding: 8px 4px; border-bottom: 1px solid rgba(217,200,176,0.4); transition: background 0.2s; }
.plano-row:last-child { border-bottom: none; }
.plano-row-header { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-d); padding: 4px 4px 8px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.plano-row.overdue { background: rgba(181,56,47,0.07) !important; }
.plano-row.overdue input { border-color: rgba(181,56,47,0.3) !important; }
.plano-row.overdue::before { content: '⚠️'; font-size: 10px; position: absolute; }
.plano-check { width: 22px; height: 22px; appearance: none; -webkit-appearance: none; background: var(--input-bg); border: 2px solid var(--border-l); border-radius: 6px; cursor: pointer; transition: all 0.15s; flex-shrink: 0; position: relative; }
.plano-check:checked { background: var(--gold); border-color: var(--gold); }
.plano-check:checked::after { content: '✓'; position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); color: #FFFFFF; font-size: 12px; font-weight: 900; }

/* ── KPI Grid ── */
.kpi-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.kpi-table th { padding: 10px 12px; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-m); background: rgba(31,58,86,0.05); border: 1px solid var(--border); text-align: center; white-space: nowrap; }
.kpi-table th.kpi-label-col { text-align: left; min-width: 180px; }
.kpi-table td { border: 1px solid rgba(217,200,176,0.5); padding: 0; }
.kpi-table td.kpi-label { padding: 10px 14px; font-weight: 600; color: var(--text); background: rgba(31,58,86,0.03); }
.kpi-table td .kpi-unit { font-size: 10px; color: var(--text-m); font-weight: 400; }
.kpi-table input { background: transparent; border: none; color: var(--text); padding: 10px 12px; width: 100%; text-align: center; font-size: 13px; min-width: 80px; }
.kpi-table input:focus { outline: none; background: var(--input-bg); }
.kpi-table .kpi-meta input { color: var(--gold-l); }
.kpi-table .kpi-total { background: rgba(231,111,81,0.06); }
.kpi-table .kpi-total input { color: var(--gold-p); font-weight: 600; }
.kpi-table tr.kpi-auto td.kpi-label::after { content: ' ↩'; font-size: 9px; color: var(--gold-dim); }

/* ── Compromisso ── */
.assinatura-box { margin-top: 24px; border-top: 1px dashed var(--border-l); padding-top: 16px; }
.assinatura-line { height: 40px; border-bottom: 1px solid var(--border-l); margin-bottom: 6px; }
.assinatura-label { font-size: 11px; color: var(--text-m); text-align: center; }

/* ── Weekly Reports ── */
.weekly-meta { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 12px; margin-bottom: 20px; padding: 16px; background: rgba(31,58,86,0.03); border-radius: 8px; border: 1px solid var(--border); }
.weekly-grid-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; }
.weekly-grid { width: 100%; border-collapse: collapse; min-width: 780px; }
.weekly-grid th { background: rgba(31,58,86,0.05); border: 1px solid rgba(217,200,176,0.6); padding: 8px 10px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-m); text-align: center; white-space: nowrap; }
.weekly-grid th.time-header { color: var(--gold); min-width: 100px; text-align: left; padding-left: 12px; }
.weekly-grid td { border: 1px solid rgba(217,200,176,0.4); padding: 0; vertical-align: top; }
.weekly-grid td.time-label { padding: 8px 12px; background: rgba(31,58,86,0.035); font-size: 11px; font-weight: 700; color: var(--gold-dim); white-space: nowrap; vertical-align: middle; }
.weekly-grid td textarea { background: transparent; border: none; color: var(--text); padding: 6px 8px; resize: none; width: 100%; min-width: 100px; height: 72px; font-size: 11.5px; line-height: 1.5; }
.weekly-grid td textarea:focus { outline: none; background: rgba(231,111,81,0.06); }

/* ════════════════════════════════════════════════
   DASHBOARD (s0)
   ════════════════════════════════════════════════ */
.dash-kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.dash-kpi-card { background: rgba(31,58,86,0.035); border: 1px solid var(--border); border-radius: 10px; padding: 18px 16px; text-align: center; transition: border-color 0.2s, background 0.2s; }
.dash-kpi-card:hover { background: rgba(231,111,81,0.06); }
.dash-kpi-icon { font-size: 24px; margin-bottom: 8px; }
.dash-kpi-value { font-size: 24px; font-weight: 800; margin-bottom: 4px; line-height: 1.1; }
.dash-kpi-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-m); margin-bottom: 10px; }
.dash-kpi-progress { height: 4px; background: var(--input-bg); border-radius: 2px; overflow: hidden; margin-bottom: 4px; }
.dash-kpi-prog-bar { height: 100%; border-radius: 2px; transition: width 0.6s ease; }
.dash-kpi-meta { font-size: 11px; color: var(--text-m); }

/* VGV Thermometer */
.dash-vgv-section { margin-bottom: 24px; }
.dash-section-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-m); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.thermo-labels { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-m); margin-bottom: 6px; }
.thermo-labels strong { color: var(--text); font-size: 14px; }
.thermo-bar-bg { height: 20px; background: var(--input-bg); border-radius: 10px; overflow: hidden; border: 1px solid var(--border); }
.thermo-bar-fill { height: 100%; border-radius: 10px; display: flex; align-items: center; justify-content: flex-end; padding-right: 8px; transition: width 0.8s cubic-bezier(0.4,0,0.2,1); min-width: 40px; }
.thermo-pct { font-size: 11px; font-weight: 800; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.4); white-space: nowrap; }

/* Bottom 2-col: chart + ranking */
.dash-bottom { display: grid; grid-template-columns: 1fr 320px; gap: 20px; margin-top: 24px; }
.dash-chart-wrap { background: rgba(31,58,86,0.03); border: 1px solid var(--border); border-radius: 10px; padding: 16px; }
.dash-chart-container { position: relative; height: 220px; }
.dash-ranking-wrap { background: rgba(31,58,86,0.03); border: 1px solid var(--border); border-radius: 10px; padding: 16px; }
.rank-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid rgba(217,200,176,0.4); }
.rank-item:last-child { border-bottom: none; }
.rank-pos { font-size: 16px; font-weight: 900; color: var(--gold-dim); min-width: 22px; text-align: center; }
.rank-pos.top1 { color: var(--gold); }
.rank-pos.top2 { color: var(--text-m); }
.rank-pos.top3 { color: #B5700F; }
.rank-info { flex: 1; min-width: 0; }
.rank-info strong { display: block; font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-info span { font-size: 11px; color: var(--text-m); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.rank-chance { text-align: right; flex-shrink: 0; }
.rank-pct { display: block; font-size: 16px; font-weight: 800; color: var(--gold-l); line-height: 1.1; }
.rank-value { display: block; font-size: 10px; color: var(--text-m); }
.no-data { font-size: 13px; color: var(--text-d); text-align: center; padding: 20px; }

/* ── Modal ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(31,58,86,0.55); z-index: 500; display: flex; align-items: center; justify-content: center; padding: 20px; backdrop-filter: blur(4px); }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; width: 100%; max-width: 520px; box-shadow: var(--shadow-lg); overflow: hidden; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px; border-bottom: 1px solid var(--border); background: rgba(31,58,86,0.035); }
.modal-header h3 { font-size: 15px; font-weight: 700; color: var(--gold-p); }
.modal-header button { font-size: 20px; color: var(--text-m); padding: 2px 8px; border-radius: 6px; }
.modal-header button:hover { color: var(--text); background: var(--input-bg); }
.modal-body { padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.modal-body p { font-size: 13px; color: var(--text-m); line-height: 1.6; }
.modal-body code { background: var(--input-bg); padding: 2px 6px; border-radius: 4px; font-size: 11px; color: var(--gold-l); }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 24px; border-top: 1px solid var(--border); }
.modal-sql { background: var(--input-bg); border: 1px solid var(--border); border-radius: 6px; padding: 12px; font-size: 11px; color: var(--gold-l); font-family: monospace; white-space: pre; overflow-x: auto; line-height: 1.5; }

/* ── Toast ── */
.toast { position: fixed; bottom: 24px; right: 24px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 18px; font-size: 13px; color: var(--text); box-shadow: var(--shadow-lg); transform: translateY(80px); opacity: 0; transition: all 0.28s cubic-bezier(0.34,1.56,0.64,1); z-index: 999; pointer-events: none; max-width: 320px; display: flex; align-items: center; gap: 10px; }
.toast.show { transform: translateY(0); opacity: 1; }
.toast-icon { font-size: 16px; flex-shrink: 0; }
.toast-success { border-color: var(--success); }
.toast-error   { border-color: var(--danger); }
.toast-info    { border-color: var(--gold); }

/* ── Mobile Overlay ── */
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(31,58,86,0.5); z-index: 89; backdrop-filter: blur(2px); }
body.sidebar-open .sidebar-overlay { display: block; }
body.sidebar-open .sidebar { transform: translateX(0) !important; box-shadow: var(--shadow-lg); }

/* ════════════════════════════════════════════════
   RESPONSIVE — TABLET (max 1100px)
   ════════════════════════════════════════════════ */
@media (max-width: 1100px) {
  .dash-kpi-row { grid-template-columns: repeat(2, 1fr); }
  .dash-bottom { grid-template-columns: 1fr; }
  .dash-ranking-wrap { max-height: 300px; overflow-y: auto; }
}

@media (max-width: 900px) {
  .form-grid-3 { grid-template-columns: 1fr 1fr; }
  .form-grid-4 { grid-template-columns: 1fr 1fr; }
  .rotina-grid { grid-template-columns: 1fr; }
  .weekly-meta { grid-template-columns: 1fr 1fr; }
}

/* ════════════════════════════════════════════════
   RESPONSIVE — MOBILE (max 768px)
   ════════════════════════════════════════════════ */
@media (max-width: 768px) {
  :root { --sidebar-w: 280px; }

  .sidebar { transform: translateX(calc(-1 * var(--sidebar-w))); }

  .main-content { margin-left: 0; padding: 20px 16px 60px; }

  .dash-kpi-row { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .dash-kpi-value { font-size: 20px; }
  .form-grid-2, .form-grid-3, .form-grid-4 { grid-template-columns: 1fr; }
  .weekly-meta { grid-template-columns: 1fr 1fr; }

  .card-header { flex-wrap: wrap; row-gap: 8px; }
  .card-header h2 { flex-basis: 100%; order: -1; }
  .card-header .btn { font-size: 11.5px; padding: 7px 10px; }
  .card-body { padding: 16px; }

  .btn, button[type="submit"], .btn-add { min-height: 38px; }
  .btn-remove { width: 30px; height: 30px; }
}

/* ════════════════════════════════════════════════
   TABELAS → CARTÕES EMPILHADOS (telas pequenas)
   Mesmo dado de .data-table, só muda a apresentação: cada <tr> vira um
   cartão e cada <td> vira uma linha "rótulo: valor" (rótulo via
   atributo data-label no <td>, preenchido nos templates). Evita precisar
   rolar a tabela na horizontal para preencher a planilha pelo celular.
   ════════════════════════════════════════════════ */
@media (max-width: 640px) {
  .table-scroll { overflow-x: visible; }
  .data-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100% !important; }
  .data-table tbody tr {
    border: 1px solid var(--border); border-radius: 10px; background: var(--card);
    margin-bottom: 12px; padding: 6px 10px; box-shadow: var(--shadow);
  }
  .data-table tbody tr:hover { background: var(--card); }
  .data-table td {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 8px 2px; border-bottom: 1px dashed rgba(217,200,176,0.5);
    min-width: 0 !important;
  }
  .data-table td:last-child { border-bottom: none; }
  .data-table td:empty { display: none; }
  .data-table td[data-label]::before {
    content: attr(data-label); flex-shrink: 0; min-width: 0;
    font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-m);
  }
  .data-table td input, .data-table td select, .data-table td textarea { width: auto; min-width: 0; flex: 1 1 auto; text-align: right; }
  .data-table td:not([data-label]) { justify-content: flex-start; }

  /* Linha de cabeçalho de grupo/seção continua como uma faixa única (não é par rótulo/valor) */
  .data-table tr.grupo-row { border: none; background: none; box-shadow: none; padding: 0; margin-bottom: 6px; }
  .data-table tr.grupo-row td {
    display: flex; justify-content: space-between; border-bottom: none;
    background: rgba(31,58,86,0.05) !important; border-radius: 8px; padding: 8px 12px;
  }
  .data-table tr.grupo-row td.grupo-titulo {
    font-weight: 700; color: var(--gold-l); text-transform: uppercase; letter-spacing: 0.06em; font-size: 11.5px;
  }
  .data-table tr.grupo-row td.grupo-titulo::before { content: none; }

  /* Linha de ações (salvar/remover) fica lado a lado, sem rótulo */
  .data-table td.row-actions { justify-content: flex-end; gap: 10px; }
  .data-table td.row-actions::before { content: none; }
}

@media (max-width: 480px) {
  .dash-kpi-row { grid-template-columns: 1fr 1fr; }
}

/* ════════════════════════════════════════════════
   PRINT / PDF EXPORT
   ════════════════════════════════════════════════ */
@media print {
  * { print-color-adjust: exact; -webkit-print-color-adjust: exact; }

  .sidebar, .app-header, .btn-remove, .btn-add,
  .header-actions, .autosave-badge,
  .dropdown, .btn-menu, .sinapi-dropdown,
  .modal-overlay, .sidebar-overlay, .btn-excel,
  .sinapi-import-box, #btn-gerar-auto, .no-print { display: none !important; }

  @page { size: A4; margin: 15mm 15mm 15mm 15mm; }

  body { background: #fff; color: #1A1A1A; font-size: 11pt; }

  .main-content { margin: 0 !important; padding: 0 !important; max-width: 100%; }
  .module-view { display: none !important; }
  .module-view.print-active { display: block !important; }
  .module-view.print-quebra { page-break-after: always; }
  .wizard-card { display: none !important; } /* card de ação (botões) não faz sentido no PDF */

  .card {
    break-inside: avoid; border: 1px solid #CCC; background: #fff;
    box-shadow: none; margin-bottom: 12px;
  }
  .card-header { background: #FBF5EC !important; border-bottom: 1px solid #CCC !important; border-radius: 0 !important; }
  .card-header h2 { color: #1F3A56 !important; font-size: 12pt; }
  .card-num { background: #FBE7DF !important; border-color: #E76F51 !important; color: #1F3A56 !important; }
  .card-body { border-radius: 0 !important; }

  input, select, textarea { background: transparent !important; border: 1px solid #DDD !important; color: #1A1A1A !important; box-shadow: none !important; font-size: 10pt !important; }

  .data-table th { background: #F3EADD !important; color: #58708A !important; }
  .data-table tbody tr:nth-child(even) { background: #FBF8F2 !important; }
  .kpi-table th { background: #F3EADD !important; color: #58708A !important; }
  .kpi-table td.kpi-label { background: #FBF5EC !important; }
  .kpi-table input { color: #1A1A1A !important; }
  .kpi-table .kpi-total { background: #F3EADD !important; }

  .table-scroll { overflow: visible !important; }
}

/* ════════════════════════════════════════════════
   ORÇAMENTO DE CASAS — Componentes específicos do app
   ════════════════════════════════════════════════ */

/* Módulos (uma view visível por vez) */
.module-view { display: none; }
.module-view.active { display: block; }

/* Placeholder "em construção" (Fase 2) */
.stub-card { text-align: center; padding: 60px 24px; }
.stub-icon { font-size: 40px; margin-bottom: 14px; opacity: 0.7; }
.stub-card h3 { font-size: 16px; color: var(--gold-p); margin-bottom: 8px; }
.stub-card p { color: var(--text-m); font-size: 13px; max-width: 440px; margin: 0 auto; line-height: 1.6; }

/* Busca SINAPI (autocomplete) */
.sinapi-search-cell { position: relative; }
.sinapi-dropdown {
  position: fixed; min-width: 420px; max-width: 560px;
  max-height: 320px; overflow-y: auto; background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; box-shadow: var(--shadow-lg); z-index: 300;
}
.sinapi-dropdown.hidden { display: none; }
.sinapi-opt { display: block; width: 100%; text-align: left; padding: 9px 12px; border-bottom: 1px solid rgba(217,200,176,0.4); }
.sinapi-opt:last-child { border-bottom: none; }
.sinapi-opt:hover, .sinapi-opt.hi { background: rgba(231,111,81,0.12); }
.sinapi-opt-desc { display: block; font-size: 12.5px; color: var(--text); white-space: normal; line-height: 1.4; }
.sinapi-opt-meta { display: block; font-size: 10.5px; color: var(--gold-dim); margin-top: 2px; }
.sinapi-opt-empty { padding: 14px; text-align: center; color: var(--text-d); font-size: 12px; }

/* Badges de grupo/classificação */
.badge-grupo { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; }
.badge-grupo[data-g="Mão-de-obra"]    { background: rgba(59,106,148,0.15); color: var(--blue); }
.badge-grupo[data-g="Material"]      { background: rgba(47,125,114,0.15);  color: var(--success); }
.badge-grupo[data-g="Taxas/Impostos"]{ background: rgba(181,56,47,0.15);  color: var(--danger); }
.badge-grupo[data-g="Outros"]        { background: rgba(231,111,81,0.15); color: var(--gold-l); }

/* Grupo header row dentro da tabela de orçamento */
.grupo-row td { background: rgba(31,58,86,0.05) !important; font-weight: 700; color: var(--gold-l); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em; padding: 8px 12px !important; }
.grupo-row .grupo-subtotal { float: right; color: var(--gold-p); font-variant-numeric: tabular-nums; }

/* Resumo/totais do orçamento */
.orc-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 18px; }
.orc-summary-card { background: rgba(31,58,86,0.035); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.orc-summary-card .lbl { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-m); margin-bottom: 6px; }
.orc-summary-card .val { font-size: 19px; font-weight: 800; color: var(--gold-p); font-variant-numeric: tabular-nums; }
.orc-summary-card.highlight { border-color: var(--gold-dim); background: rgba(231,111,81,0.08); }
.orc-summary-card.highlight .val { color: var(--gold-l); }

/* Cotação — view imprimível */
.cotacao-doc-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; padding-bottom: 18px; border-bottom: 2px solid var(--gold-dim); }
.cotacao-doc-header h2 { font-size: 20px; color: var(--gold-p); }
.cotacao-doc-header .sub { font-size: 12px; color: var(--text-m); margin-top: 4px; }
.cotacao-meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 24px; font-size: 12.5px; color: var(--text); margin-bottom: 20px; }
.cotacao-meta-grid strong { color: var(--text-m); font-weight: 600; }
.cotacao-total-row td { font-weight: 800; font-size: 14px; color: var(--gold-p); background: rgba(231,111,81,0.08) !important; }

@media print {
  .cotacao-doc-header, .cotacao-meta-grid { break-inside: avoid; }
}

/* BDI result banner */
.bdi-result { display: flex; align-items: center; justify-content: space-between; background: rgba(231,111,81,0.1); border: 1px solid var(--gold-dim); border-radius: 10px; padding: 18px 22px; margin-top: 8px; }
.bdi-result .bdi-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-m); }
.bdi-result .bdi-value { font-size: 30px; font-weight: 800; color: var(--gold-l); }
.bdi-formula { font-size: 11px; color: var(--text-d); margin-top: 10px; font-family: monospace; }

@media (max-width: 900px) {
  .orc-summary { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  .orc-summary { grid-template-columns: 1fr 1fr; }
  .cotacao-meta-grid { grid-template-columns: 1fr; }
  .sinapi-dropdown { max-width: calc(100vw - 32px); min-width: 260px; }
}
@media (max-width: 480px) {
}

/* ════════════════════════════════════════════════
   Calculadoras Técnicas (tabs internas)
   ════════════════════════════════════════════════ */
.calc-tab-btn.active { background: linear-gradient(135deg, var(--gold), #C9573A); color: #FFFFFF; border-color: transparent; }
.calc-panel { display: none; }
.calc-panel.active { display: block; }
.linha-vao-toggle { width: auto !important; }

/* ════════════════════════════════════════════════
   Contrato — documento gerado
   ════════════════════════════════════════════════ */
.contrato-doc { background: rgba(31,58,86,0.03); border: 1px solid var(--border); border-radius: 10px; padding: 28px 32px; font-size: 12.5px; line-height: 1.9; color: var(--text); }
.contrato-doc h3.ctr-titulo { text-align: center; font-size: 16px; color: var(--gold-p); letter-spacing: 0.05em; margin-bottom: 18px; }
.contrato-doc h4.ctr-secao { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--gold-l); margin: 22px 0 8px; border-bottom: 1px solid var(--border-l); padding-bottom: 4px; }
.contrato-doc p { margin-bottom: 6px; text-align: justify; }
.contrato-doc .ctr-assinaturas { display: flex; justify-content: space-between; margin-top: 60px; gap: 40px; }
.contrato-doc .ctr-linha-assinatura { flex: 1; text-align: center; border-top: 1px solid var(--border-l); padding-top: 6px; font-size: 11px; color: var(--text-m); }

@media print {
  .contrato-doc { background: #fff !important; border-color: #ccc !important; color: #1A1A1A !important; }
  .contrato-doc h3.ctr-titulo, .contrato-doc h4.ctr-secao { color: #1F3A56 !important; }
  .calc-tabs { display: none !important; }
}

@media (max-width: 768px) {
  .contrato-doc { padding: 18px 16px; }
  .calc-tabs { flex-wrap: wrap; }
}

/* ════════════════════════════════════════════════
   Assistente de Orçamento (wizard na Dashboard)
   ════════════════════════════════════════════════ */
.wizard-card { border-color: var(--gold-dim); box-shadow: 0 0 0 1px rgba(231,111,81,0.15), var(--shadow); }
.wizard-card .card-header h2 { color: var(--gold-l); }
.wizard-step { display: flex; gap: 18px; padding: 18px 4px; border-bottom: 1px solid var(--border); }
.wizard-step:last-child { border-bottom: none; padding-bottom: 4px; }
.wizard-step-num {
  flex-shrink: 0; width: 32px; height: 32px; border-radius: 50%;
  background: var(--input-bg); border: 2px solid var(--gold-dim); color: var(--gold);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px;
  transition: all 0.25s;
}
.wizard-step-num.done { background: var(--success); border-color: var(--success); color: #fff; }
.wizard-step-body { flex: 1; min-width: 0; }
.wizard-step-body h3 { font-size: 14.5px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.wizard-step-body p { font-size: 12px; color: var(--text-m); line-height: 1.6; margin-bottom: 12px; }
.tag-obrigatorio { font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--danger); background: var(--danger-dim); padding: 2px 8px; border-radius: 20px; }
.wizard-step-body .btn:disabled { opacity: 0.4; cursor: not-allowed; }
.wizard-step-body .btn { white-space: normal; text-align: center; max-width: 100%; line-height: 1.4; }

/* Indicador de item de orçamento auto-sincronizado */
.auto-sync-dot { display: inline-block; font-size: 11px; margin-right: 4px; cursor: help; opacity: 0.85; }

/* Importação da base SINAPI (Configuração) */
.sinapi-import-box { background: rgba(31,58,86,0.035); border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; }
.sinapi-status-text { font-size: 12.5px; color: var(--text); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sinapi-status-badge { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; padding: 2px 9px; border-radius: 20px; background: rgba(47,125,114,0.15); color: var(--success); white-space: nowrap; }
.sinapi-import-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.sinapi-import-hint { font-size: 11.5px; color: var(--text-m); line-height: 1.6; }

/* ════════════════════════════════════════════════
   QUANTO CUSTA MINHA CASA — Marca, tipografia e componentes v4
   ════════════════════════════════════════════════ */

/* Tipografia: Poppins nos títulos e chamadas; Inter na interface, planilhas e valores */
h1, h2, h3, .card-header h2, .subsection-header h3, .wizard-step-body h3, .cotacao-doc-header h2,
.contrato-doc h3.ctr-titulo, .modal-header h3, .stub-card h3 { font-family: var(--font-display); letter-spacing: -0.005em; }
.card-header h2 { font-weight: 600; }
.card-header { background: linear-gradient(180deg, rgba(234,217,198,0.30), rgba(234,217,198,0.12)); }
.card-num { background: rgba(231,111,81,0.12); color: var(--terracota-d); border-color: rgba(231,111,81,0.35); font-family: var(--font-display); }
input[type=text], input[type=tel], input[type=email], input[type=number], input[type=date], input[type=password], select, textarea { border-radius: 10px; }
input:focus, select:focus, textarea:focus { border-color: var(--terracota); box-shadow: 0 0 0 3px rgba(231,111,81,0.16); }
.card { box-shadow: var(--shadow); }
.data-table thead tr, .kpi-table th { background: rgba(234,217,198,0.45); }
.grupo-row td { background: rgba(234,217,198,0.60) !important; color: var(--azul); }
.cotacao-total-row td { color: var(--azul); background: rgba(231,111,81,0.10) !important; }
.orc-summary-card { border-radius: 14px; background: #FFFFFF; box-shadow: 0 1px 6px rgba(31,58,86,0.05); }
.orc-summary-card .val, .dash-kpi-value { font-variant-numeric: tabular-nums; }
.dash-kpi-card { background: #FFFFFF; border-radius: 14px; box-shadow: 0 1px 6px rgba(31,58,86,0.05); }
.dash-kpi-card:hover { background: rgba(234,217,198,0.25); }
.dash-section-title { color: var(--salvia); }
.btn-outline { border-color: var(--border-l); color: var(--azul); }
.btn-outline:hover { border-color: var(--terracota); color: var(--terracota-d); background: rgba(231,111,81,0.05); }
.wizard-card { background: linear-gradient(135deg, #FFF8F1 0%, #FFFFFF 70%); }
.wizard-card .card-header h2 { color: var(--azul); }
.wizard-card .card-header { display: flex; align-items: center; gap: 14px; }
.wizard-step-num { border-color: var(--terracota); color: var(--terracota-d); }
.nav-link .nav-n svg { width: 18px; height: 18px; }

/* ── Logotipo (símbolo + palavra) ── */
.qcmc-mark { display: inline-flex; line-height: 0; }
.qcmc-mark svg { width: 100%; height: 100%; display: block; }
.qcmc-word { display: flex; flex-direction: column; font-family: var(--font-display); font-weight: 800; line-height: 1.02; letter-spacing: -0.012em; text-transform: uppercase; }
.qcmc-word .w1 { color: var(--azul); }
.qcmc-word .w2 { color: var(--salvia); }
.qcmc-word .w2 em { font-style: normal; color: var(--terracota); }
.qcmc-logo { display: inline-flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; }
.qcmc-logo .qcmc-mark { width: 120px; height: 120px; }
.qcmc-logo .qcmc-word { font-size: 38px; align-items: center; }
.qcmc-logo .qcmc-slogan { font-family: var(--font); font-size: 14px; color: var(--azul); border-top: 2px solid var(--terracota); padding-top: 8px; margin-top: 2px; font-weight: 500; }
.qcmc-logo--sm .qcmc-mark { width: 84px; height: 84px; }
.qcmc-logo--sm .qcmc-word { font-size: 26px; }
.qcmc-logo--sm .qcmc-slogan { font-size: 12px; }

/* ── Menu lateral (ícones) ── */
.sidebar { background: #FFFFFF; display: flex; flex-direction: column; padding: 14px 0 0; }
.nav-list { flex: 1; }
.nav-link { gap: 12px; padding: 10px 18px; margin: 2px 10px; border-radius: 10px; border-left: none; font-weight: 500; font-size: 13px; }
.nav-link:hover { background: rgba(234,217,198,0.35); color: var(--azul); }
.nav-link.active { background: rgba(231,111,81,0.12); color: var(--terracota-d); font-weight: 700; border-left: none; box-shadow: inset 3px 0 0 var(--terracota); }
.nav-n { min-width: 20px; display: inline-flex; align-items: center; justify-content: center; color: var(--text-d); }
.nav-link.active .nav-n { color: var(--terracota); }
.sidebar-company { margin: 12px; padding: 12px; border: 1px solid var(--border); border-radius: 14px; background: linear-gradient(180deg, #FFFFFF, rgba(234,217,198,0.25)); display: flex; align-items: center; gap: 10px; }
.sidebar-company img { width: 40px; height: 40px; object-fit: contain; border-radius: 8px; background: #fff; border: 1px solid var(--border); flex-shrink: 0; }
.sidebar-company .sc-label { font-size: 9.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-d); }
.sidebar-company .sc-name { font-size: 12.5px; font-weight: 700; color: var(--azul); line-height: 1.25; word-break: break-word; }

/* ── Menu (mobile) ── */
.btn-menu { display: none; width: 38px; height: 38px; border-radius: 10px; color: var(--azul); align-items: center; justify-content: center; border: 1px solid var(--border); background: #fff; }
.btn-menu svg { width: 20px; height: 20px; }

/* ── Tela de abertura ── */
.splash { position: fixed; inset: 0; z-index: 2000; background: radial-gradient(circle at 50% 40%, #FFFFFF 0%, var(--offwhite) 60%, #F6EBDD 100%); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 26px; transition: opacity .55s ease, visibility .55s ease; }
.splash.hide { opacity: 0; visibility: hidden; }
.splash .qcmc-logo { animation: splashIn .7s cubic-bezier(.2,.8,.2,1) both; }
.splash-bar { width: 140px; height: 4px; border-radius: 4px; background: rgba(234,217,198,0.8); overflow: hidden; }
.splash-bar span { display: block; height: 100%; width: 40%; border-radius: 4px; background: var(--terracota); animation: splashBar 1.1s ease-in-out infinite; }
@keyframes splashIn { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes splashBar { 0% { transform: translateX(-100%); } 100% { transform: translateX(350%); } }

/* ── Tela inicial ── */
.home-hero { position: relative; display: grid; grid-template-columns: 1.08fr 0.92fr; align-items: center; gap: 8px; background: linear-gradient(135deg, #FFF8F0 0%, #FCE9DC 55%, #F8DAC7 100%); border: 1px solid var(--border); border-radius: 24px; padding: 40px 0 0 44px; overflow: hidden; box-shadow: var(--shadow); min-height: 400px; }
.home-hero-copy { padding-bottom: 40px; position: relative; z-index: 2; }
.home-hero .qcmc-logo { align-items: flex-start; text-align: left; flex-direction: row; gap: 16px; }
.home-hero .qcmc-logo .qcmc-mark { width: 92px; height: 92px; }
.home-hero .qcmc-logo .qcmc-word { font-size: 31px; align-items: flex-start; }
.home-hero .home-slogan { margin: 10px 0 0 0; font-size: 14px; color: var(--azul); font-weight: 500; padding-top: 8px; border-top: 2px solid var(--terracota); display: inline-block; }
.home-hero h1 { font-size: clamp(26px, 3vw, 36px); line-height: 1.12; color: var(--azul); margin: 26px 0 12px; font-weight: 700; }
.home-hero p.lead { font-size: 15.5px; color: var(--text-m); max-width: 470px; line-height: 1.6; }
.btn-cta { display: inline-flex; align-items: center; gap: 10px; margin-top: 24px; padding: 15px 28px; border-radius: 14px; background: var(--terracota); color: #fff; font-family: var(--font-display); font-weight: 700; font-size: 14.5px; letter-spacing: 0.03em; text-transform: uppercase; box-shadow: 0 10px 24px rgba(231,111,81,0.38); transition: transform .18s, box-shadow .18s, background .18s; }
.btn-cta:hover { background: var(--terracota-d); transform: translateY(-2px); box-shadow: 0 14px 28px rgba(231,111,81,0.42); }
.btn-cta svg { width: 18px; height: 18px; }
.home-hero-art { position: relative; align-self: stretch; min-height: 340px; }
.home-hero-art .home-house { position: absolute; right: -2%; bottom: 0; width: 100%; height: auto; max-height: 96%; }
.home-hero-art .home-guide { position: absolute; left: 2%; bottom: 0; height: 100%; width: auto; max-width: 60%; object-fit: contain; object-position: bottom; z-index: 2; }
.home-hero-art .home-bubble { position: absolute; left: 34%; top: 6%; background: rgba(255,255,255,0.92); border: 1px solid var(--border); border-radius: 16px 16px 16px 4px; padding: 9px 13px; font-size: 12px; font-weight: 600; color: var(--azul); box-shadow: var(--shadow); max-width: 170px; z-index: 3; line-height: 1.35; }
.home-features { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 20px; }
.home-feature { text-align: left; background: #FFFFFF; border: 1px solid var(--border); border-radius: 18px; padding: 20px 18px; display: flex; flex-direction: column; gap: 6px; box-shadow: 0 1px 8px rgba(31,58,86,0.05); transition: transform .18s, box-shadow .18s, border-color .18s; cursor: pointer; }
.home-feature:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: rgba(231,111,81,0.5); }
.home-feature .hf-ico { width: 46px; height: 46px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 6px; }
.home-feature .hf-ico svg { width: 24px; height: 24px; }
.home-feature .hf-ico.t { background: rgba(231,111,81,0.14); color: var(--terracota-d); }
.home-feature .hf-ico.s { background: rgba(47,125,114,0.14); color: var(--salvia); }
.home-feature .hf-ico.a { background: rgba(31,58,86,0.10); color: var(--azul); }
.home-feature .hf-ico.y { background: rgba(244,166,42,0.18); color: #B7791F; }
.home-feature strong { font-family: var(--font-display); font-size: 14.5px; color: var(--azul); font-weight: 600; }
.home-feature span.hf-sub { font-size: 12px; color: var(--text-m); line-height: 1.45; }
.home-company { margin-top: 20px; display: flex; align-items: center; gap: 14px; background: #fff; border: 1px dashed var(--border-l); border-radius: 16px; padding: 14px 18px; font-size: 13px; color: var(--text-m); }
.home-company img { height: 44px; max-width: 140px; object-fit: contain; }
.home-company strong { color: var(--azul); font-family: var(--font-display); font-weight: 600; }
.home-company a { color: var(--terracota-d); font-weight: 600; cursor: pointer; text-decoration: underline; }
.pulse-focus { animation: pulseFocus 1.4s ease 2; }
@keyframes pulseFocus { 0%,100% { box-shadow: 0 0 0 0 rgba(231,111,81,0); } 50% { box-shadow: 0 0 0 6px rgba(231,111,81,0.35); } }

/* ── Guia da construção (avatar) ── */
.guide-mini { width: 54px; height: 54px; border-radius: 50%; object-fit: cover; border: 3px solid #fff; box-shadow: 0 2px 10px rgba(31,58,86,0.18); flex-shrink: 0; background: #F7F4F1; }
.guide-tip { display: flex; align-items: center; gap: 16px; background: linear-gradient(135deg, rgba(47,125,114,0.10), rgba(234,217,198,0.35)); border: 1px solid rgba(47,125,114,0.25); border-radius: 18px; padding: 16px 18px; margin: 0 0 24px; }
.guide-tip .gt-title { font-family: var(--font-display); font-weight: 600; font-size: 13.5px; color: var(--salvia); margin-bottom: 2px; }
.guide-tip .gt-text { font-size: 13px; color: var(--azul); line-height: 1.55; }
.guide-tip .gt-text strong { font-weight: 700; }

/* ── Ajuda nos campos ── */
.help-btn { display: inline-flex; align-items: center; justify-content: center; width: 17px; height: 17px; margin-left: 6px; border-radius: 50%; border: 1px solid var(--border-l); background: #fff; color: var(--text-m); font-size: 10px; font-weight: 800; line-height: 1; cursor: pointer; vertical-align: middle; padding: 0; text-transform: none; letter-spacing: 0; transition: all .15s; }
.help-btn:hover, .help-btn[aria-expanded="true"] { background: var(--terracota); border-color: var(--terracota); color: #fff; }
.help-pop { position: fixed; z-index: 1500; width: min(320px, calc(100vw - 24px)); background: #fff; border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 14px; display: flex; gap: 12px; align-items: flex-start; animation: splashIn .22s ease both; }
.help-pop .guide-mini { width: 42px; height: 42px; border-width: 2px; }
.help-pop .hp-title { font-family: var(--font-display); font-weight: 600; font-size: 12.5px; color: var(--salvia); margin-bottom: 3px; }
.help-pop .hp-text { font-size: 12.5px; color: var(--azul); line-height: 1.5; font-weight: 400; text-transform: none; letter-spacing: 0; }

/* ── Identidade (Configuração) ── */
.brand-card { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; background: linear-gradient(135deg, #FFF8F0, #FFFFFF); border: 1px solid var(--border); border-radius: 18px; padding: 20px 24px; margin-bottom: 16px; }
.brand-card .bc-note { max-width: 420px; font-size: 12.5px; color: var(--text-m); line-height: 1.6; }
.brand-card .bc-note strong { color: var(--azul); }
.identity-box { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; border: 1px solid var(--border); border-radius: 18px; padding: 18px; background: #fff; }
.identity-logo { width: 150px; height: 110px; border: 2px dashed var(--border-l); border-radius: 14px; display: flex; align-items: center; justify-content: center; background: var(--offwhite); color: var(--text-d); font-size: 11.5px; text-align: center; padding: 8px; overflow: hidden; flex-shrink: 0; }
.identity-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.identity-fields { flex: 1; min-width: 260px; display: flex; flex-direction: column; gap: 12px; }
.identity-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.identity-hint { font-size: 11.5px; color: var(--text-m); line-height: 1.6; }

/* ── Cabeçalho de documento (só na impressão/PDF) ── */
.print-doc-header { display: none; }

/* ── Cabeçalho responsivo ── */
@media (max-width: 1180px) { .brand-slogan { display: none; } }
@media (max-width: 1000px) { .autosave-badge { display: none; } .header-period label { display: none; } .home-hero { grid-template-columns: 1fr; padding: 32px 26px 0; } .home-hero-art { min-height: 300px; } .home-features { grid-template-columns: 1fr 1fr; } }
@media (max-width: 768px) {
  .app-header { padding: 0 10px; gap: 8px; }
  .btn-menu { display: inline-flex; }
  .header-brand .qcmc-mark { width: 36px; height: 36px; }
  .header-brand .qcmc-word { font-size: 11.5px; }
  .header-period select { max-width: 120px; padding: 7px 24px 7px 9px; font-size: 12px; }
  .header-actions .btn-label, .header-left .btn-label { display: none; }
  .header-actions .btn, #btn-nova-obra { padding: 8px 10px; }
  .home-hero { border-radius: 20px; }
  .home-hero .qcmc-logo .qcmc-mark { width: 64px; height: 64px; }
  .home-hero .qcmc-logo .qcmc-word { font-size: 22px; }
}
@media (max-width: 480px) {
  .app-header { padding: 0 8px; gap: 6px; }
  .header-brand { gap: 6px; }
  .header-brand .qcmc-mark { width: 30px; height: 30px; }
  .header-brand .qcmc-word { font-size: 9.5px; }
  .header-left { gap: 6px; }
  .btn-menu { width: 34px; height: 34px; }
  .header-period select { max-width: 70px; font-size: 11px; padding: 6px 18px 6px 7px; background-position: right 6px center; }
  .header-actions { gap: 4px; }
  .header-actions .btn, #btn-nova-obra { padding: 8px 9px; }
  .home-features { grid-template-columns: 1fr 1fr; gap: 10px; }
  .home-feature { padding: 14px 12px; }
  .home-hero { padding: 24px 18px 0; }
  .home-hero h1 { margin-top: 18px; }
  .guide-tip { flex-direction: column; text-align: center; }
  .identity-box { flex-direction: column; align-items: stretch; }
  .identity-logo { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .splash, .splash .qcmc-logo, .splash-bar span, .help-pop, .pulse-focus, .btn-cta, .home-feature { animation: none !important; transition: none !important; }
}

/* ── Impressão: cabeçalho de documento com a marca ── */
@media print {
  .splash, .help-btn, .help-pop, .sidebar-company, .btn-cta, .home-features, .home-company, .guide-tip .guide-mini, .identity-actions, .identity-hint, .brand-card .bc-note { display: none !important; }
  .print-doc-header { display: flex !important; align-items: center; justify-content: space-between; gap: 16px; padding: 0 0 12px; margin: 0 0 14px; border-bottom: 2px solid #E76F51; break-inside: avoid; }
  .print-doc-header .pdh-brand { display: flex; align-items: center; gap: 12px; }
  .print-doc-header .qcmc-mark { width: 54px; height: 54px; }
  .print-doc-header .qcmc-word { font-size: 18px; }
  .print-doc-header .pdh-slogan { font-size: 9.5pt; color: #58708A; margin-top: 3px; }
  .print-doc-header .pdh-meta { text-align: right; font-size: 9.5pt; color: #1F3A56; line-height: 1.5; }
  .print-doc-header .pdh-meta strong { color: #58708A; font-weight: 600; }
  .print-doc-header .pdh-empresa { display: flex; align-items: center; gap: 8px; margin-top: 4px; justify-content: flex-end; font-weight: 700; }
  .print-doc-header .pdh-empresa img { height: 30px; max-width: 110px; object-fit: contain; }
  .card-header { background: #FBF1E6 !important; }
  .grupo-row td { background: #F1E4D3 !important; color: #1F3A56 !important; }
}

[hidden] { display: none !important; }

.dash-kpi-icon { display: flex; justify-content: center; margin-bottom: 10px; }
.dash-kpi-icon svg { width: 32px; height: 32px; }
.dash-kpi-icon.ki-t { color: var(--terracota); } .dash-kpi-icon.ki-s { color: var(--salvia); } .dash-kpi-icon.ki-a { color: var(--azul); }
.btn svg { width: 15px; height: 15px; }

.row-total { color: var(--azul) !important; }
@media (max-width: 480px) {
  .orc-summary { grid-template-columns: 1fr; }
  .dash-kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-kpi-value { font-size: 16.5px; }
  .dash-kpi-card { padding: 14px 8px; }
  .card-body { padding: 14px; }
}

/* Data da última atualização da base SINAPI (informativa, sem alerta) */
.sinapi-info { display: flex; align-items: center; gap: 8px; margin: 0 4px 16px; font-size: 12.5px; font-weight: 500; color: var(--text-m); }
.sinapi-info svg { width: 16px; height: 16px; color: var(--salvia); flex-shrink: 0; }
.sinapi-status-text { flex-direction: column; align-items: flex-start; gap: 2px; }
.sinapi-status-text strong { color: var(--azul); font-weight: 600; }
.sinapi-status-sub { font-size: 11.5px; color: var(--text-m); }

/* Botão Exportar Excel (discreto: contorno verde-sálvia) */
.btn-excel { border-color: rgba(47,125,114,0.45); color: var(--salvia); background: rgba(47,125,114,0.05); }
.btn-excel:hover { border-color: var(--salvia); color: #fff; background: var(--salvia); }
.btn-excel:disabled { opacity: .6; cursor: progress; }
.btn-excel svg { width: 16px; height: 16px; }

/* Cabeçalhos de cartão com vários botões: quebram em linhas no celular/tablet */
@media (max-width: 768px) {
  .card-header { flex-wrap: wrap; row-gap: 10px; }
  .card-header h2 { flex: 1 1 140px; min-width: 0; }
  .card-header > div[style*="margin-left:auto"] { margin-left: 0 !important; width: 100%; flex-wrap: wrap; }
  .card-header > .btn { margin-left: 0 !important; }
  .card-header .btn-excel, .card-header .btn-gold, .card-header .js-zerar { flex: 1 1 auto; justify-content: center; }
}

/* ════════════════════════════════════════════════
   Adições da migração Django — não existiam no app original.
   Mesma linguagem visual (tokens de :root acima), só componentes novos que a
   camada de apresentação em Django precisa e o app original não tinha porque
   era tudo renderizado direto no JS (mensagens do Django, erros de formulário).
   ════════════════════════════════════════════════ */
.django-messages { list-style: none; margin-bottom: 20px; display: flex; flex-direction: column; gap: 8px; }
.django-messages li { padding: 10px 16px; border-radius: 8px; font-size: 13px; border: 1px solid var(--border); }
.django-messages li.success { background: rgba(47,125,114,0.1); border-color: var(--success); color: var(--success); }
.django-messages li.error { background: var(--danger-dim); border-color: var(--danger); color: var(--danger); }
.django-messages li.info { background: rgba(231,111,81,0.1); border-color: var(--gold-dim); color: var(--gold-p); }

.form-errors { color: var(--danger); font-size: 11.5px; margin-top: 2px; }
.form-actions { margin-top: 20px; display: flex; gap: 10px; }
.linha-form-inline { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.linha-form-inline .form-group { flex: 1; min-width: 90px; }

.modulo-oculto-aviso {
  font-size: 11px; color: var(--text-m); background: rgba(31,58,86,0.035);
  border: 1px dashed var(--border-l); border-radius: 8px; padding: 8px 12px; margin-bottom: 16px;
}

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-shell {
  width: 100%;
  max-width: 380px;
  padding: 20px;
}

.login-card .card-header {
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}
