/* ==========================================================
   GJ CRM · camada própria sobre o app.css da base
   (verde-oliva da GJ no menu, ouro da marca no destaque, Manrope)
   ========================================================== */

:root:not([data-theme="dark"]) { --accent-soft: #f1e8da; --line: #e1e8e3; --line-2: #d2dcd5; }
:root { --gold: #bd9f7b; --green: #8a6a3c; --blue: #454f3c; --navy: #2e3528; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--primary:hover { filter: brightness(1.06); }
.side .side-nav a.is-active { box-shadow: inset 3px 0 0 #d9bf9c; }
.side .side-brand img { max-height: 40px; width: auto; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; }
.hint { margin-bottom: 4px; }
.sticky { position: sticky; top: 16px; }
.money-block { min-width: 0; }
.alert-bar--info { background: var(--accent-soft); color: var(--ink); border-color: transparent; }
.csec { font-size: 1.05rem; margin: 26px 0 12px; }
.dash-cols { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.dash-cols > div { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.side-actions--end { display: flex; justify-content: flex-end; margin-top: 12px; }
.badge--grp { background: var(--accent-soft); border-color: transparent; color: #6b5535; }
.pill--rascunho { background: var(--bg); }
.pill--enviada { background: var(--warn-soft); color: #8a5a00; }
.pill--aberta { background: #e3eefa; color: var(--blue); }
.pill--aceita { background: var(--ok-soft); color: #0f6f12; }
.pill--cancelado { background: var(--late-soft); color: #9b1c1c; }
.mini-list li.is-done strong { text-decoration: line-through; opacity: .6; }
.inline-add { margin-top: 12px; }
.inline-add > summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--accent); list-style: none; display: inline-flex; align-items: center; gap: 6px; }
.inline-add[open] > summary { margin-bottom: 12px; }
.row-start { background: var(--bg); }

/* Empreendimentos */
.area-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.area-card { display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: var(--ink); border-top: 3px solid var(--accent); transition: transform .3s var(--ease), box-shadow .3s var(--ease); }
.area-card:hover { transform: translateY(-3px); box-shadow: 0 14px 30px -18px rgba(46,53,40,.45); }
.area-card--warn { border-top-color: var(--warn); }
.area-card--late { border-top-color: var(--late); }
.area-ic { display: inline-flex; width: 36px; height: 36px; border-radius: 10px; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 4px; }
.area-card small { color: var(--muted); font-size: 12.5px; }
.area-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.area-tags .pill { font-style: normal; }
.emp-head { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 18px; align-items: stretch; }
.emp-head:not(:has(.emp-map)) { grid-template-columns: 1fr; }
.emp-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px 18px; align-content: start; }
.emp-facts small { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.emp-facts strong { font-size: 14.5px; overflow-wrap: anywhere; }
.emp-wide { grid-column: span 2; }
.emp-map { display: flex; flex-direction: column; gap: 6px; min-height: 220px; }
.emp-map iframe { flex: 1; width: 100%; min-height: 220px; border: 0; border-radius: 12px; }
.proc-card .card-head { align-items: flex-start; }
.proc-card h3 small { font-weight: 500; }
.cond-list { list-style: none; display: grid; gap: 8px; }
.cond-list li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.cond-list li > span:nth-child(2) { flex: 1; min-width: 0; }
.cond-list li small { display: block; font-size: 12px; color: var(--muted); }
.cond-list li.is-done strong { text-decoration: line-through; opacity: .6; }
.cond-check { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line-2); background: var(--card); color: #fff; font-weight: 700; cursor: pointer; padding: 0; flex-shrink: 0; }
.cond-check:hover { border-color: var(--accent); }
.is-done .cond-check { background: var(--accent); border-color: var(--accent); }
.progress--big { height: 12px; margin: 4px 0 16px; }
.stage-track { display: flex; gap: 6px; overflow-x: auto; padding: 14px 16px; }
.stage-track span { flex: 1; min-width: 110px; display: flex; flex-direction: column; gap: 8px; font-size: 12px; color: var(--muted); }
.stage-track i { height: 6px; border-radius: 6px; background: var(--line); }
.stage-track .is-done i { background: var(--accent); }
.stage-track .is-now i { background: linear-gradient(90deg, var(--accent), #d9bf9c); }
.stage-track .is-now { color: var(--ink); font-weight: 600; }

/* Gráficos */
.hbars { display: grid; gap: 10px; }
.hbar { display: grid; grid-template-columns: minmax(110px, 170px) minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 13px; }
.hbar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar div { height: 10px; border-radius: 6px; background: var(--bg); overflow: hidden; }
.hbar i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--accent), #d9bf9c); }
.hbar b { font-weight: 600; text-align: right; min-width: 50px; }
.donut { position: relative; width: 180px; margin: 4px auto 0; }
.donut svg { width: 100%; transform: rotate(-90deg); }
.donut-c { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.donut-c b { font-size: 28px; line-height: 1; font-family: var(--head); }
.donut-c small { font-size: 11.5px; color: var(--muted); }
.donut-leg { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; margin-top: 12px; font-size: 12.5px; }
.donut-leg i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.spark { display: flex; align-items: flex-end; gap: 8px; height: 110px; padding: 16px 0 4px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
.spark span { position: relative; flex: 1; max-width: 44px; border-radius: 6px 6px 0 0; background: linear-gradient(180deg, #d9bf9c, var(--accent)); }
.spark b { position: absolute; top: -17px; left: 0; right: 0; text-align: center; font-size: 11px; font-weight: 600; }
.bars--12 .bar-col small { font-size: 10.5px; }
.thumbs--sm { margin-top: 6px; }
.thumbs--sm img { width: 72px; height: 54px; object-fit: cover; border-radius: 6px; }

/* Propostas */
.q-items .row-line { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1.4fr) 90px 70px 130px; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.q-total { font-size: 15px; margin: 6px 0 4px; }
.q-total strong { font-size: 22px; font-family: var(--head); color: var(--accent); }
.quote-side { min-width: 0; }

/* Fichas técnicas */
.sheet-sec h3 { margin-bottom: 12px; }
.sheet-note { font-size: 13px; color: var(--muted); padding: 10px 12px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 10px 10px 0; margin-bottom: 10px; }
.sheet-item { padding: 10px 0; border-bottom: 1px dashed var(--line); }
.sheet-item:last-child { border-bottom: 0; }
.sheet-item--check { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; align-items: center; }
.sheet-check { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.sheet-check input { width: 20px; height: 20px; accent-color: var(--accent); flex-shrink: 0; }
.sheet-obs { width: 100%; }
.sheet-actions { position: sticky; bottom: 0; background: var(--bg); padding: 12px 0; z-index: 5; }
.tpl-edit { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; }
.tpl-edit summary { cursor: pointer; font-weight: 600; }
.tpl-edit[open] summary { margin-bottom: 10px; }
.sheet-new select { min-width: 260px; }

/* Rendimento lenhoso */
.lenho-row { display: grid; grid-template-columns: minmax(0, 2fr) 70px 100px 100px 90px 110px 34px; gap: 8px; align-items: center; padding: 6px 0; }
.lenho-head { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.lenho-row output { font-weight: 600; text-align: right; }
.lenho-total { margin-top: 14px; font-size: 15px; }
.lenho-total strong { font-size: 20px; color: var(--accent); font-family: var(--head); }

/* E-mails */
.mail-rows { list-style: none; display: grid; }
.mail-rows > li { border-bottom: 1px solid var(--line); }
.mail-rows > li > a, .mail-view summary { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 4px; text-decoration: none; color: var(--ink); cursor: pointer; list-style: none; }
.mail-rows strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.mail-rows small { display: block; color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-rows .is-unread strong { font-weight: 700; }
.mail-rows .is-unread .mail-ic { background: var(--accent); color: #fff; }
.mail-ic { display: inline-flex; width: 34px; height: 34px; border-radius: 50%; align-items: center; justify-content: center; background: var(--bg); font-size: 12px; font-weight: 600; color: var(--muted); }
.mail-ic--erro { background: var(--late-soft); color: var(--late); }
.mail-body { white-space: normal; font-size: 14px; line-height: 1.7; padding: 4px 4px 16px 52px; color: var(--ink-3); overflow-wrap: anywhere; }
.mail-open .mail-body { padding: 8px 0 14px; }
.mail-list { list-style: none; display: grid; gap: 8px; }
.mail-list li { display: flex; gap: 10px; align-items: center; }
.mail-list small { display: block; color: var(--muted); font-size: 12px; }

/* Contratos (portado do Expresso) */
.contract-doc h3, .contract-doc h4 { font-size: 14px; margin: 16px 0 6px; padding: 6px 10px; background: var(--navy); color: #fff; border-radius: 6px; }
.contract-doc p, .contract-doc li { font-size: 14px; line-height: 1.7; margin-bottom: 8px; }
.contract-doc ul { padding-left: 20px; }
.link-box { display: flex; gap: 8px; }
.link-box input { flex: 1; min-width: 0; }
.kv div { display: contents; }
dl.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; font-size: 14px; }
dl.kv dt { color: var(--muted); }
.qa { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.qa > div { display: flex; flex-direction: column; gap: 6px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; font-size: 13px; }
.qa small { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.ev-list { display: grid; }
.ev-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 12px 4px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.ev-row small { display: block; color: var(--muted); font-size: 12.5px; }
.datebox { display: inline-flex; width: 42px; height: 42px; border-radius: 12px; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent); }
.datebox--y { background: var(--warn-soft); color: var(--warn); }
.sig-pad { position: relative; margin: 6px 0 12px; border: 1.5px dashed var(--line-2); border-radius: 14px; background: #fff; overflow: hidden; }
.sig-pad canvas { display: block; width: 100%; height: 160px; touch-action: none; cursor: crosshair; }
.sig-pad-t { position: absolute; left: 14px; top: 10px; font-size: 12px; color: #889; pointer-events: none; }
.sig-pad.is-signed .sig-pad-t { display: none; }
.sig-clear { position: absolute; right: 10px; top: 8px; border: 0; background: rgba(0,0,0,.07); border-radius: 8px; padding: 4px 10px; font-size: 12px; cursor: pointer; }

/* Simular cliente */
.test-users { list-style: none; display: grid; gap: 12px; margin-top: 14px; }
.test-users li { display: grid; gap: 8px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; }
.test-users small { display: block; color: var(--muted); font-size: 12.5px; }

/* Arquivos do serviço */
.file-add { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.file-add input[type=text], .file-add input[type=url] { flex: 1 1 180px; min-width: 0; }

@media (max-width: 1100px) {
	.dash-cols, .emp-head { grid-template-columns: 1fr; }
	.q-items .row-line { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 700px) {
	.q-items .row-line { grid-template-columns: 1fr 1fr; }
	.q-items .row-line > label:first-child, .q-items .row-line > label:nth-child(2) { grid-column: 1 / -1; }
	.sheet-item--check { grid-template-columns: 1fr; }
	.lenho-row { grid-template-columns: 1fr 1fr 1fr; }
	.lenho-row select { grid-column: 1 / -1; }
	.lenho-head { display: none; }
	.hbar { grid-template-columns: 100px minmax(0, 1fr) auto; }
	.qa { grid-template-columns: 1fr; }
	.emp-wide { grid-column: auto; }
	.mail-body { padding-left: 4px; }
	.sheet-new select { min-width: 0; width: 100%; }
}
@media print {
	.side, .topbar, .page-actions, .wa-float, .fb-btn, .sheet-actions, .back { display: none !important; }
	.app, .main { display: block !important; margin: 0 !important; }
	.card { break-inside: avoid; box-shadow: none !important; }
}

/* Textos longos não empurram a tela no celular */
.mini-list li > a, .mini-list li > span:first-child { min-width: 0; flex: 1 1 auto; }
.mini-list li strong, .mini-list li small { overflow-wrap: anywhere; }
.lenho-row > * { min-width: 0; width: 100%; }
.lenho-row .icon-btn { width: auto; }
.mini-list li a small { white-space: normal; }
.toolbar { min-width: 0; }
.toolbar .seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.toolbar .seg::-webkit-scrollbar { display: none; }

/* Contraste (WCAG AA) com a paleta GJ: verde-oliva + ouro */
:root:not([data-theme="dark"]) { --muted: #5c5c58; --muted-2: #6f6f6a; --accent-soft: #f6efe3; }
.side-label { color: #c2c7b9; }
.side-user-name small, .side .side-user small { color: #c9cdc0; }
.eleve-credit { opacity: 1; }
.eleve-credit--dark, .eleve-credit--dark span { color: #e2e5da; }
.stars { color: #8a6a3c; }
.step-n { color: #6f5530; }
.alert-bar { color: #a61b1b; }
.due--soon { color: #8a5600; }
.btn--wa { background: #117a27; }
.btn--wa:hover { background: #0e6a21; }
.seg a { color: #55554f; }
:root:not([data-theme="dark"]) { --ok-text: #0f6f12; }
.round-ic--in, .text-ok { color: #0f6f12; }
.btn--danger, .round-ic--out { color: #b91c1c; }
.is-ok { color: #0f6f12; }
