/* Casa Vale — painel administrativo */
:root {
  --verde-950: #0b2522; --verde-900: #0e2f2b; --verde-800: #133d38; --verde-700: #17524b;
  --verde-600: #1e6a61; --verde-100: #dcebe7; --verde-50: #eef5f3;
  --ouro-600: #a96c22; --ouro-500: #c98a3b; --ouro-100: #f6ead8;
  --bg: #f5f3ee; --surface: #ffffff; --texto: #1b2422; --texto-2: #3b4744; --muted: #66726f;
  --borda: #e5e0d6; --borda-2: #d6d0c4;
  --erro: #b42318; --erro-bg: #fdecea; --ok: #16794c; --ok-bg: #e6f4ec; --info: #1d5fa8; --info-bg: #e8f0fb;
  --serif: "Fraunces", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --r: 12px; --r-sm: 8px;
  --sombra: 0 1px 2px rgba(16,32,30,.05), 0 1px 3px rgba(16,32,30,.07);
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--sans); font-size: 15px; line-height: 1.5; color: var(--texto); background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.icon { flex-shrink: 0; vertical-align: middle; }
.muted { color: var(--muted); font-size: .88rem; }
:focus-visible { outline: 3px solid #dba45e; outline-offset: 2px; border-radius: 4px; }

.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand__name { display: block; font-family: var(--serif); font-size: 1.25rem; font-weight: 600; color: var(--verde-950); line-height: 1; }
.brand__tag { display: block; font-size: .62rem; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); margin-top: 4px; font-weight: 600; }

/* botões */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px; border-radius: var(--r-sm); border: 1px solid transparent; font-weight: 600; font-size: .92rem; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s; }
.btn--primary { background: var(--verde-700); color: #fff; }
.btn--primary:hover { background: var(--verde-800); }
.btn--ghost { background: transparent; border-color: var(--borda-2); }
.btn--ghost:hover { background: #fff; border-color: var(--muted); }
.btn--danger { background: var(--erro); color: #fff; }
.btn--danger:hover { background: #8f1c13; }
.btn--block { width: 100%; height: 48px; }
.btn[disabled] { opacity: .6; cursor: progress; }
.icon-btn { width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: var(--r-sm); border: 1px solid transparent; background: transparent; cursor: pointer; color: var(--texto-2); }
.icon-btn:hover { background: var(--bg); border-color: var(--borda); color: var(--verde-700); }
.icon-btn--danger:hover { color: var(--erro); background: var(--erro-bg); border-color: #f5c6c0; }
.link { display: inline-flex; align-items: center; gap: 4px; color: var(--verde-700); font-weight: 600; font-size: .88rem; }

/* campos */
.stack { display: grid; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: .84rem; font-weight: 600; color: var(--texto-2); }
.field input, .field select, .field textarea, .input-icon input {
  width: 100%; min-height: 42px; padding: 9px 12px; border: 1px solid var(--borda-2); border-radius: var(--r-sm); background: #fff; font-size: .95rem;
}
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .input-icon input:focus { outline: none; border-color: var(--verde-600); box-shadow: 0 0 0 3px rgba(30,106,97,.15); }
.field [aria-invalid="true"] { border-color: var(--erro); }
.input-icon { position: relative; }
.input-icon > .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon input { padding-left: 40px; }
.alert { padding: 10px 14px; border-radius: var(--r-sm); font-size: .9rem; }
.alert--erro { background: var(--erro-bg); color: var(--erro); }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1200px 600px at 10% -10%, rgba(201,138,59,.14), transparent 60%), linear-gradient(160deg, var(--verde-900), var(--verde-950)); }
.login__card { width: 100%; max-width: 420px; background: #fff; border-radius: 18px; padding: 36px 32px; box-shadow: 0 30px 70px -20px rgba(0,0,0,.45); }
.login__card h1 { font-family: var(--serif); font-weight: 500; font-size: 1.7rem; margin-top: 28px; color: var(--verde-950); }
.login__card .muted { margin: 6px 0 24px; }
.login__back { display: inline-flex; align-items: center; gap: 6px; margin-top: 22px; font-size: .88rem; color: var(--muted); }
.login__back:hover { color: var(--verde-700); }

/* layout */
.app { display: grid; min-height: 100vh; }
@media (min-width: 1024px) { .app { grid-template-columns: 248px 1fr; } }
.side { background: var(--verde-950); color: rgba(255,255,255,.75); padding: 22px 16px; display: flex; flex-direction: column; gap: 28px; }
.side .brand { padding: 0 8px; }
.side .brand__name { color: #fff; }
.side .brand__tag { color: rgba(255,255,255,.5); }
.side__nav { display: grid; gap: 4px; }
.side__nav a, .side__foot a, .side__foot button { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r-sm); font-weight: 500; font-size: .93rem; background: none; border: 0; cursor: pointer; width: 100%; text-align: left; color: inherit; }
.side__nav a:hover, .side__foot a:hover, .side__foot button:hover { background: rgba(255,255,255,.06); color: #fff; }
.side__nav a[aria-current="page"] { background: rgba(255,255,255,.1); color: #fff; box-shadow: inset 3px 0 0 #dba45e; }
.side__foot { margin-top: auto; display: grid; gap: 2px; border-top: 1px solid rgba(255,255,255,.1); padding-top: 16px; }
.pill { margin-left: auto; background: var(--ouro-500); color: #fff; font-size: .72rem; font-weight: 700; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; display: inline-grid; place-items: center; }
@media (max-width: 1023px) {
  .side { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 40; transform: translateX(-100%); transition: transform .25s; }
  .side.is-open { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.4); }
}
@media (min-width: 1024px) { .only-mobile { display: none; } .side { position: sticky; top: 0; height: 100vh; } }

.main { min-width: 0; padding: 0 16px 48px; }
@media (min-width: 768px) { .main { padding: 0 32px 56px; } }
.topbar { display: flex; align-items: center; gap: 12px; padding: 22px 0; flex-wrap: wrap; }
.topbar h1 { font-family: var(--serif); font-weight: 500; font-size: 1.65rem; color: var(--verde-950); }
.topbar__actions { margin-left: auto; display: flex; gap: 8px; }
.view { display: grid; gap: 20px; }

/* painéis */
.panel { background: var(--surface); border: 1px solid var(--borda); border-radius: var(--r); padding: 20px; box-shadow: var(--sombra); min-width: 0; }
.panel--flush { padding: 0; overflow: hidden; }
.panel__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.panel__head h2 { font-size: 1rem; font-weight: 600; }
.grid-2 { display: grid; gap: 20px; }
@media (min-width: 1100px) { .grid-2 { grid-template-columns: 1.4fr 1fr; } }

.kpis { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.kpi { background: var(--surface); border: 1px solid var(--borda); border-radius: var(--r); padding: 20px; display: flex; gap: 14px; align-items: flex-start; box-shadow: var(--sombra); }
.kpi__icon { width: 40px; height: 40px; border-radius: 10px; background: var(--verde-50); color: var(--verde-700); display: grid; place-items: center; flex-shrink: 0; }
.kpi--accent .kpi__icon { background: var(--ouro-100); color: var(--ouro-600); }
.kpi__label { font-size: .84rem; color: var(--muted); font-weight: 500; }
.kpi__value { font-family: var(--serif); font-size: 2rem; font-weight: 600; color: var(--verde-950); line-height: 1.15; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi__sub { font-size: .8rem; color: var(--muted); margin-top: 2px; }

/* gráfico de colunas (SVG) */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid line { stroke: #ece8e0; stroke-width: 1; }
.chart .axis text { fill: var(--muted); font-size: 11px; font-family: var(--sans); }
.chart .bar { fill: var(--verde-600); transition: fill .15s; }
.chart .hit:hover + .bar, .chart .bar.is-hover { fill: var(--verde-800); }
.chart .hit { fill: transparent; cursor: default; }
.chart .val { fill: var(--texto-2); font-size: 11px; font-weight: 600; font-family: var(--sans); }

/* barras horizontais */
.hbars { display: grid; gap: 14px; }
.hbar { display: grid; grid-template-columns: 110px 1fr 32px; align-items: center; gap: 12px; font-size: .88rem; }
.hbar__track { height: 10px; background: #f0ece4; border-radius: 4px; overflow: hidden; }
.hbar__fill { height: 100%; background: var(--verde-600); border-radius: 0 4px 4px 0; }
.hbar__n { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

/* funil */
.funnel { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.funnel__item { border: 1px solid var(--borda); border-radius: var(--r-sm); padding: 14px 16px; display: grid; gap: 8px; }
.funnel__top { display: flex; justify-content: space-between; align-items: center; }
.funnel__n { font-size: 1.4rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.funnel__bar { height: 6px; background: #f0ece4; border-radius: 3px; overflow: hidden; }
.funnel__bar span { display: block; height: 100%; background: var(--verde-600); border-radius: 3px; }

/* status */
.status { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status--novo { background: var(--ouro-100); color: var(--ouro-600); }
.status--em_atendimento { background: var(--info-bg); color: var(--info); }
.status--fechado { background: var(--ok-bg); color: var(--ok); }
.status--ativo { background: var(--ok-bg); color: var(--ok); }
.status--inativo { background: #efedea; color: var(--muted); }
select.status-select { border: 1px solid var(--borda-2); border-radius: 999px; padding: 5px 28px 5px 12px; font-size: .82rem; font-weight: 600; appearance: none; cursor: pointer;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2366726f' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 9px center; }
select.status-select.s-novo { background-color: var(--ouro-100); color: var(--ouro-600); border-color: #ecd3b0; }
select.status-select.s-em_atendimento { background-color: var(--info-bg); color: var(--info); border-color: #c6d8f0; }
select.status-select.s-fechado { background-color: var(--ok-bg); color: var(--ok); border-color: #bfe0cc; }

/* toolbar */
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.toolbar__search { flex: 1 1 280px; max-width: 420px; }
.segmented { display: inline-flex; background: #fff; border: 1px solid var(--borda); border-radius: var(--r-sm); padding: 3px; gap: 2px; flex-wrap: wrap; }
.segmented button { border: 0; background: none; padding: 7px 12px; border-radius: 6px; font-size: .86rem; font-weight: 500; cursor: pointer; color: var(--texto-2); }
.segmented button[aria-pressed="true"] { background: var(--verde-700); color: #fff; }

/* tabela */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-weight: 600; font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 12px 16px; background: #faf9f6; border-bottom: 1px solid var(--borda); white-space: nowrap; }
.panel:not(.panel--flush) .table th { background: none; padding: 8px 12px; }
.table td { padding: 12px 16px; border-bottom: 1px solid #efebe4; vertical-align: middle; }
.panel:not(.panel--flush) .table td { padding: 10px 12px; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fcfbf8; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.prop { display: flex; align-items: center; gap: 12px; min-width: 260px; }
.prop img { width: 64px; height: 48px; border-radius: 6px; object-fit: cover; background: #eee; flex-shrink: 0; }
.prop strong { display: block; font-weight: 600; line-height: 1.3; }
.prop span { font-size: .82rem; color: var(--muted); }
.star-on { color: var(--ouro-500); }
.star-on .icon { fill: currentColor; }
.star-off { color: #cfc9bd; }
.acoes { display: flex; gap: 2px; justify-content: flex-end; }
.lead-msg { max-width: 340px; color: var(--texto-2); font-size: .86rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.contato { display: grid; gap: 2px; font-size: .86rem; white-space: nowrap; }
.contato a { display: inline-flex; align-items: center; gap: 6px; color: var(--texto-2); }
.contato a:hover { color: var(--verde-700); }
.contato a .icon { color: #1f9d57; }
.vazio { text-align: center; padding: 48px 16px; color: var(--muted); }
.vazio .icon { color: var(--borda-2); margin-bottom: 8px; }

/* modal */
.modal { border: 0; padding: 0; border-radius: 16px; width: min(760px, calc(100vw - 24px)); max-height: calc(100vh - 32px); box-shadow: 0 30px 80px -20px rgba(0,0,0,.45); }
.modal--sm { width: min(420px, calc(100vw - 24px)); }
.modal::backdrop { background: rgba(11,37,34,.55); }
.modal form { display: flex; flex-direction: column; max-height: calc(100vh - 32px); }
.modal__head { display: flex; justify-content: space-between; align-items: center; padding: 18px 24px; border-bottom: 1px solid var(--borda); }
.modal__head h2, .modal--sm h2 { font-family: var(--serif); font-weight: 500; font-size: 1.35rem; }
.modal--sm .modal__body p { margin-top: 8px; }
.modal__body { padding: 22px 24px; overflow-y: auto; }
.modal__foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--borda); background: #faf9f6; }
.form-grid { display: grid; gap: 16px; }
@media (min-width: 640px) { .form-grid { grid-template-columns: 1fr 1fr; } .span-2 { grid-column: 1 / -1; } }
.field-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.thumbs img { width: 72px; height: 54px; object-fit: cover; border-radius: 6px; background: #eee; border: 1px solid var(--borda); }
.switches { display: flex; flex-wrap: wrap; gap: 12px 28px; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; font-size: .92rem; }
.switch input { position: absolute; opacity: 0; }
.switch__ui { width: 40px; height: 22px; border-radius: 999px; background: var(--borda-2); position: relative; transition: background .15s; }
.switch__ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + .switch__ui { background: var(--verde-600); }
.switch input:checked + .switch__ui::after { transform: translateX(18px); }
.switch input:focus-visible + .switch__ui { outline: 3px solid #dba45e; outline-offset: 2px; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--verde-950); color: #fff; padding: 12px 20px; border-radius: 10px; font-size: .9rem; font-weight: 500; box-shadow: 0 12px 30px -8px rgba(0,0,0,.4); z-index: 100; }
.toast.is-erro { background: var(--erro); }
.tooltip { position: fixed; z-index: 90; pointer-events: none; background: var(--verde-950); color: #fff; padding: 8px 12px; border-radius: 8px; font-size: .8rem; line-height: 1.35; box-shadow: 0 8px 20px -6px rgba(0,0,0,.35); transform: translate(-50%, calc(-100% - 10px)); white-space: nowrap; }
.tooltip strong { display: block; font-size: .95rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
@media (min-width: 1024px) { .app { background: linear-gradient(to right, var(--verde-950) 248px, var(--bg) 248px); } }
.field select { appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2366726f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center; }
.table .link, .table td > strong { white-space: nowrap; }
