/* Innova CRM: graphite, charcoal, copper e linen. Uma família tipográfica (Archivo). */
@font-face { font-family: Archivo; font-weight: 400; font-display: swap; src: url(/fonts/archivo-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: Archivo; font-weight: 500; font-display: swap; src: url(/fonts/archivo-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: Archivo; font-weight: 600; font-display: swap; src: url(/fonts/archivo-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: Archivo; font-weight: 700; font-display: swap; src: url(/fonts/archivo-latin-700-normal.woff2) format('woff2'); }

:root {
  /* Marca */
  --graphite: #1F1F1F;
  --charcoal: #2E2C29;
  --copper: #C98556;
  --linen: #EAE3D8;
  /* Tema claro */
  --bg: #FFFFFF;
  --surface: #FFFFFF;
  --text: #2E2C29;
  --heading: #1F1F1F;
  --rule: #DDD4C6;
  --input-border: #CFC5B6;
  --muted: #6B655C;
  --tint: #EAE3D8;          /* avisos e destaques */
  --link: #8F5A33;          /* copper escurecido: legível sobre fundo claro */
  --accent-hover: #BA7748;
  --ok: #3F6B4A;
  --ok-bg: #E1EBDF;
  --danger: #A23E2C;
  --pill-active-bg: #2E2C29;
  --pill-active-text: #EAE3D8;
  --lead-bg: #F3E3D4;
  --lead-text: #7A4A28;
  /* Menu lateral (escuro nos dois temas) */
  --rail-bg: #1F1F1F;
  --rail-text: #CFC7BB;
  --rail-hover: #2A2826;
  --rail-line: #34312D;
  --rail-sub: #A39B8F;
  --radius-control: 6px;
  --font: Archivo, system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
}
@media all {
  :root[data-theme="dark"] {
    --bg: #1A1918; --surface: #242220; --text: #E6DFD4; --heading: #F3EEE6; --rule: #3A3632;
    --input-border: #4A4540; --muted: #A39B8F; --tint: #2C2926; --link: #D9A07A; --accent-hover: #D6966B;
    --ok: #8DBB97; --ok-bg: #22302A; --danger: #E68A73; --pill-active-bg: #EAE3D8; --pill-active-text: #1F1F1F; --lead-bg: #3A2A1E; --lead-text: #E8B48C;
    --rail-bg: #121212; --rail-hover: #1E1D1C; --rail-line: #2A2826;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1A1918; --surface: #242220; --text: #E6DFD4; --heading: #F3EEE6; --rule: #3A3632;
  --input-border: #4A4540; --muted: #A39B8F; --tint: #2C2926; --link: #D9A07A; --accent-hover: #D6966B;
  --ok: #8DBB97; --ok-bg: #22302A; --danger: #E68A73; --pill-active-bg: #EAE3D8; --pill-active-text: #1F1F1F; --lead-bg: #3A2A1E; --lead-text: #E8B48C;
  --rail-bg: #121212; --rail-hover: #1E1D1C; --rail-line: #2A2826;
  color-scheme: dark;
}
html { scroll-padding-top: env(safe-area-inset-top, 0px); }

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
#app { min-height: 100%; }
body { font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2, legend { font-weight: 600; color: var(--heading); }
h1 { font-size: 1.95rem; line-height: 1.15; letter-spacing: -0.015em; margin: 0; }
h2 { font-size: 1.15rem; margin: 0 0 .35rem; }
a { color: var(--link); }
small { font-size: .82rem; }
code { font-size: .78rem; color: var(--muted); word-break: break-word; }
:focus-visible { outline: 2px solid var(--copper); outline-offset: 2px; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.boot { padding: 2rem; color: var(--muted); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Estrutura ---------- */
.shell { display: grid; grid-template-columns: 228px 1fr; min-height: 100%; }
.rail { background: var(--rail-bg); color: var(--linen); display: flex; flex-direction: column; padding: 1.25rem 0; position: sticky; top: 0; height: 100vh; height: 100dvh; }
.brand { display: flex; align-items: center; gap: .65rem; padding: 0 1.25rem 1.5rem; color: var(--linen); text-decoration: none; font-weight: 600; font-size: 1.05rem; letter-spacing: .02em; }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; border: 1.5px solid var(--copper); color: var(--copper); font-weight: 700; border-radius: 4px; }
.rail nav { display: flex; flex-direction: column; }
.rail-link { display: flex; align-items: center; gap: .75rem; padding: .62rem 1.25rem; color: var(--rail-text); text-decoration: none; border-left: 3px solid transparent; }
.rail-link:hover { color: #fff; background: var(--rail-hover); }
.rail-link[aria-current="page"] { color: #fff; border-left-color: var(--copper); background: var(--rail-hover); }
.rail-link svg, .tab-link svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.rail-user { margin-top: auto; padding: 1rem 1.25rem 0; border-top: 1px solid var(--rail-line); display: flex; flex-direction: column; font-size: .85rem; }
.rail-user span { color: var(--rail-sub); }
.content { min-width: 0; outline: none; }
.page { max-width: 980px; padding: 2.25rem 2.5rem 4rem; }
.page-head { padding-bottom: 1.1rem; margin-bottom: 1.5rem; border-bottom: 1px solid var(--rule); }
.tabbar { display: none; }

/* ---------- Blocos ---------- */
.panel { padding: 1.4rem 0; border-bottom: 1px solid var(--rule); }
.panel:last-child { border-bottom: 0; }
.panel-quiet p { margin: .15rem 0; }
.notice { background: var(--tint); padding: .7rem 1rem; border-radius: var(--radius-control); margin: 0 0 1.25rem; }
.callout { background: var(--tint); border-left: 3px solid var(--copper); padding: .8rem 1rem; margin: .25rem 0 1.2rem; }
.callout p { margin: .3rem 0 0; }
.plain-list { margin: .5rem 0 0; padding-left: 1.1rem; }
.plain-list li { margin: .3rem 0; }

.checklist { list-style: none; margin: 1rem 0 0; padding: 0; }
.checklist li { display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: .85rem; padding: .7rem 0; border-top: 1px solid var(--rule); }
.check { width: 18px; height: 18px; border: 1.5px solid var(--muted); border-radius: 3px; }
.is-done .check { background: var(--ok); border-color: var(--ok); position: relative; }
.is-done .check::after { content: ''; position: absolute; left: 5px; top: 1px; width: 5px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.is-done .check-label { color: var(--muted); }
.check-label small { display: block; color: var(--muted); }

.subnav { display: flex; gap: .25rem; flex-wrap: wrap; margin: -0.5rem 0 1.5rem; }
.subnav a { padding: .45rem .8rem; border-radius: 999px; color: var(--text); text-decoration: none; }
.subnav a:hover { background: var(--tint); }
.subnav a[aria-current="page"] { background: var(--pill-active-bg); color: var(--pill-active-text); }

/* ---------- Formulários ---------- */
.form { margin-bottom: 1.75rem; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { font-size: 1.15rem; padding: 0; margin-bottom: 1rem; }
.field { display: flex; flex-direction: column; gap: .3rem; margin-bottom: 1rem; min-width: 0; }
label { font-size: .86rem; font-weight: 500; color: var(--text); }
input, select, textarea { font: inherit; color: var(--heading); background: var(--surface); border: 1px solid var(--input-border); border-radius: var(--radius-control); padding: .58rem .7rem; min-height: 42px; width: 100%; }
input:disabled, select:disabled, textarea:disabled { background: transparent; color: var(--text); border-style: dashed; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--copper); outline-offset: 0; border-color: var(--copper); }
.hint { font-size: .82rem; color: var(--muted); margin: 0; }
.grid-2, .grid-3 { display: grid; gap: 0 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-actions { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-top: .5rem; }
.form-inline { padding-top: 1.4rem; border-top: 1px solid var(--rule); margin-top: 1.25rem; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; font: inherit; font-weight: 500; min-height: 42px; padding: .5rem 1.05rem; border-radius: var(--radius-control); border: 1px solid var(--text); background: transparent; color: var(--text); cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--tint); }
.btn-primary { background: var(--copper); border-color: var(--copper); color: var(--graphite); font-weight: 600; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { border-color: transparent; color: var(--link); }
.btn-small { min-height: 34px; padding: .3rem .7rem; font-size: .86rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: progress; }
.link { background: none; border: 0; color: var(--link); font: inherit; cursor: pointer; padding: .3rem; text-decoration: underline; }

/* ---------- Listas e tabelas ---------- */
.rows { list-style: none; padding: 0; margin: .75rem 0 0; border-top: 1px solid var(--rule); }
.rows li { display: flex; align-items: center; gap: .9rem; padding: .7rem .25rem; border-bottom: 1px solid var(--rule); background: var(--bg); }
.rows-fixed { margin-top: 0; border-top: 0; }
.rows-fixed li { color: var(--muted); }
.row-main { flex: 1; min-width: 0; }
.row-main small { display: block; color: var(--muted); }
.prob { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 3.5rem; text-align: right; }
.grip { width: 12px; height: 18px; cursor: grab; background: radial-gradient(circle, var(--muted) 1.2px, transparent 1.6px) 0 0 / 6px 6px; }
[draggable="true"] { cursor: grab; }
.dragging { opacity: .5; }
.is-off { opacity: .6; }
.move { display: inline-flex; }
.move .btn { min-width: 34px; padding: .2rem; font-size: 1rem; line-height: 1; }
.tag { font-size: .78rem; padding: .12rem .55rem; border-radius: 999px; background: var(--tint); color: var(--text); white-space: nowrap; }
.tag-ok { background: var(--ok-bg); color: var(--ok); }

.table-wrap { overflow-x: auto; margin-bottom: 1.5rem; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: .82rem; font-weight: 600; color: var(--muted); padding: .5rem .6rem; border-bottom: 1px solid var(--text); }
td { padding: .7rem .6rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
td select { min-height: 36px; padding: .3rem .5rem; width: auto; }
td.actions { white-space: nowrap; text-align: right; }
.audit td { font-size: .88rem; }

.logo-preview { display: flex; align-items: center; min-height: 96px; padding: 1rem; background: var(--surface); border: 1px dashed var(--input-border); border-radius: var(--radius-control); margin-bottom: .6rem; }
.logo-preview img { max-height: 80px; max-width: 260px; object-fit: contain; }

/* ---------- Login ---------- */
.login { min-height: 100%; display: grid; place-items: center; align-content: center; gap: 1rem; padding: 1.5rem; background: var(--rail-bg); }
.login-card { width: min(400px, 100%); background: var(--bg); padding: 2rem; border-radius: 8px; border-top: 4px solid var(--copper); }
.login-card h1 { font-size: 1.35rem; margin: 1.1rem 0 1.4rem; }
.login-logo { max-height: 56px; max-width: 220px; object-fit: contain; }
.login-wordmark { font-weight: 700; font-size: 1.6rem; letter-spacing: .04em; color: var(--heading); }
.login-lang { display: flex; gap: 1rem; }
.login-lang .link { color: var(--linen); }
.error-text { color: var(--danger); min-height: 1.4em; margin: 0 0 .75rem; font-size: .9rem; }

/* ---------- Diálogo e aviso ---------- */
.dialog { max-height: calc(100dvh - 2rem); overflow-y: auto; border: 0; border-radius: 8px; padding: 1.5rem; width: min(460px, calc(100vw - 2rem)); background: var(--bg); color: var(--text); }
.dialog::backdrop { background: rgba(31, 31, 31, .55); }
.temp-pw { font-size: 1.35rem; font-weight: 600; letter-spacing: .06em; background: var(--surface); border: 1px solid var(--rule); padding: .8rem 1rem; border-radius: var(--radius-control); user-select: all; word-break: break-all; }
.toast { position: fixed; left: 50%; bottom: 1.5rem; transform: translate(-50%, 1rem); opacity: 0; pointer-events: none; background: var(--graphite); color: var(--linen); padding: .7rem 1.1rem; border-radius: var(--radius-control); border-left: 3px solid var(--copper); max-width: calc(100vw - 2rem); z-index: 50; transition: opacity .18s, transform .18s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast-error { border-left-color: #E07A62; }

/* ---------- Celular ---------- */
@media (max-width: 760px) {
  body { font-size: 16px; } /* 16px evita zoom automático no iPhone */
  .shell { grid-template-columns: 1fr; }
  .rail { display: none; }
  .page { padding: 1.4rem 1.1rem calc(5.5rem + env(safe-area-inset-bottom)); }
  h1 { font-size: 1.6rem; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .tabbar { display: flex; position: fixed; inset: auto 0 0 0; background: var(--rail-bg); padding-bottom: env(safe-area-inset-bottom); z-index: 20; }
  .tab-link { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .15rem; padding: .55rem 0 .5rem; color: var(--rail-text); text-decoration: none; font-size: .74rem; border-top: 2px solid transparent; }
  .tab-link[aria-current="page"] { color: #fff; border-top-color: var(--copper); }
  .subnav { flex-wrap: nowrap; overflow-x: auto; margin-right: -1.1rem; padding-bottom: .25rem; }
  .subnav a { white-space: nowrap; }
  .toast { bottom: calc(4.75rem + env(safe-area-inset-bottom)); }
  table.stack thead { display: none; }
  table.stack tr { display: block; padding: .8rem 0; border-bottom: 1px solid var(--rule); }
  table.stack td { display: flex; align-items: center; gap: .75rem; border: 0; padding: .3rem 0; }
  table.stack td[data-label]::before { content: attr(data-label); min-width: 7.5rem; font-size: .82rem; color: var(--muted); }
  table.stack td.actions { justify-content: flex-start; flex-wrap: wrap; white-space: normal; }
  .grip { display: none; }
}

/* ---------- Etapa 2: listas, ficha do cliente, Kanban, tarefas ---------- */
h3 { font-size: .95rem; font-weight: 600; margin: 1.1rem 0 .4rem; color: var(--heading); }
.small, small.small { font-size: .82rem; }
.pre { white-space: pre-wrap; }
.empty { padding: 2rem 0; }
.page-wide { max-width: 1180px; }
.page-full { max-width: none; }
.page-head-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.head-actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.head-actions select { width: auto; }
.back { display: inline-block; font-size: .86rem; margin-bottom: .6rem; text-decoration: none; }
.tags { display: flex; gap: .3rem; flex-wrap: wrap; margin: .6rem 0 0; }
.next-action { margin: .5rem 0 0; }
.tag-lead { background: var(--lead-bg); color: var(--lead-text); }
.tag-small { font-size: .7rem; padding: .05rem .4rem; margin-left: .4rem; vertical-align: middle; }
.due { font-size: .82rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.due-today { color: var(--link); font-weight: 600; }
.due-late { color: var(--danger); font-weight: 600; }

.filters { display: grid; grid-template-columns: minmax(0, 1fr) 180px 180px; gap: .6rem; margin-bottom: .6rem; }
.list { border-top: 1px solid var(--rule); }
.list-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 1rem; padding: .8rem .25rem; border-bottom: 1px solid var(--rule); color: inherit; text-decoration: none; }
.list-row:hover { background: var(--tint); }
.list-main, .list-side { display: flex; flex-direction: column; min-width: 0; }
.list-main small, .list-side small { color: var(--muted); }
.list-side { align-items: flex-end; text-align: right; }

.client-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 0 2.5rem; align-items: start; }
.card-section { padding: 1.1rem 0; border-bottom: 1px solid var(--rule); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.section-head h2 { margin: 0; }
.contact-links { display: flex; gap: .8rem; flex-wrap: wrap; font-size: .86rem; margin-top: .15rem; }
.row-button { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; display: flex; flex-direction: column; }
.row-button:hover span:first-child { text-decoration: underline; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.btn-danger { color: var(--danger); }
.check-row { display: flex; align-items: center; gap: .5rem; margin-bottom: 1rem; }
.check-row input { width: auto; min-height: 0; }
fieldset.sub { border-top: 1px solid var(--rule); padding-top: .9rem; margin-top: .3rem; }
fieldset.sub legend { font-size: .95rem; padding-right: .5rem; }
.dup-box { background: var(--tint); border-left: 3px solid var(--danger); padding: .8rem 1rem; color: var(--text); font-size: .9rem; }
.dup-box ul { margin: .4rem 0 0; padding-left: 1.1rem; }

.log-form { margin: .7rem 0 1rem; }
.log-row { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: .5rem; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: .6rem 0 .6rem .9rem; border-left: 2px solid var(--rule); position: relative; }
.timeline li::before { content: ''; position: absolute; left: -5px; top: 1rem; width: 8px; height: 8px; border-radius: 50%; background: var(--rule); }
.timeline li:not(.tl-system)::before { background: var(--copper); }
.timeline p { margin: .15rem 0 0; white-space: pre-wrap; }
.tl-meta { display: flex; gap: .6rem; flex-wrap: wrap; font-size: .78rem; color: var(--muted); }
.tl-kind { font-weight: 600; color: var(--text); }
.tl-system p { color: var(--muted); font-size: .9rem; }

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin: .4rem 0 1.4rem; }
.stat { display: flex; flex-direction: column; gap: .1rem; padding: .8rem 1rem; border-left: 3px solid var(--rule); }
.stat:nth-child(2) { border-left-color: var(--copper); }
.stat:nth-child(3) { border-left-color: var(--ok); }
.stat span { font-size: .82rem; color: var(--muted); }
.stat strong { font-size: 1.35rem; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--heading); }
.stat small { color: var(--muted); font-size: .76rem; line-height: 1.35; }

.kanban { display: flex; gap: .7rem; overflow-x: auto; padding-bottom: .9rem; scroll-snap-type: x proximity; scrollbar-width: thin; scrollbar-color: var(--copper) var(--tint);
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); }
.kanban::after { content: ''; flex: 0 0 20px; }
.kanban-col { flex: 1 0 215px; }
.kanban-col.col-won, .kanban-col.col-lost { flex: 0 0 185px; }
.kanban-col { background: var(--tint); border-radius: 8px; padding: .7rem; min-height: 320px; scroll-snap-align: start; display: flex; flex-direction: column; }
.kanban-col.drop { outline: 2px dashed var(--copper); outline-offset: -2px; }
.kanban-col header { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 0 .5rem; padding: .1rem .2rem .6rem; }
.kanban-col h2 { font-size: .95rem; margin: 0; }
.col-meta { grid-column: 1; font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.col-prob { grid-row: 1; grid-column: 2; font-size: .78rem; color: var(--muted); }
.col-won { background: color-mix(in srgb, var(--ok-bg) 70%, var(--tint)); }
.col-lost { opacity: .85; }
.kanban-cards { display: flex; flex-direction: column; gap: .5rem; flex: 1; }
.opp-card { display: flex; flex-direction: column; gap: .2rem; text-align: left; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--rule); border-radius: 6px; padding: .65rem .75rem; cursor: grab; }
.opp-card:hover { border-color: var(--copper); }
.opp-card.is-closed { opacity: .75; }
.opp-client { font-weight: 600; color: var(--heading); }
.opp-title { font-size: .86rem; }
.opp-meta { display: flex; justify-content: space-between; align-items: baseline; font-variant-numeric: tabular-nums; }
.opp-meta small, .opp-service { color: var(--muted); font-size: .76rem; }
.opp-next { font-size: .8rem; color: var(--muted); }

.dialog-wide { width: min(720px, calc(100vw - 2rem)); max-height: calc(100vh - 3rem); }
.opp-head { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.opp-value { font-size: 1.2rem; font-variant-numeric: tabular-nums; }
label.inline { display: flex; align-items: center; gap: .5rem; margin-left: auto; }
label.inline select { width: auto; }

.task-group h2 { display: flex; align-items: center; gap: .5rem; margin-top: 1.2rem; }
.count { font-size: .78rem; font-weight: 600; background: var(--tint); border-radius: 999px; padding: .05rem .5rem; }
.group-overdue h2 { color: var(--danger); }
.rows li.task { gap: .7rem; }
.task-check { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--muted); background: transparent; cursor: pointer; padding: 0; }
.task-check:hover { border-color: var(--ok); background: var(--ok-bg); }
.task-follow .task-check { border-color: var(--copper); }
.task-actions { display: flex; align-items: center; gap: .2rem; }
.mini-select { width: auto; min-height: 32px; padding: .2rem .4rem; font-size: .82rem; }
.mobile-only { display: none; }

@media (max-width: 1000px) {
  .client-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .filters { grid-template-columns: 1fr 1fr; }
  .filters input { grid-column: 1 / -1; }
  .list-row { grid-template-columns: minmax(0, 1fr) auto; }
  .list-side { display: none; }
  .stats { grid-template-columns: 1fr; gap: .4rem; }
  .stat { padding: .5rem .8rem; }
  .kanban { margin-right: -1.1rem; }
  .kanban-col, .kanban-col.col-won, .kanban-col.col-lost { flex: 0 0 82vw; }
  .log-row { grid-template-columns: 1fr; }
  .rows li.task { flex-wrap: wrap; }
  .task-actions { margin-left: auto; }
  .mobile-only { display: inline-flex; }
  label.inline { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- Etapa 3: estimates e Price Book ---------- */
.subnav { display: flex; gap: .25rem; border-bottom: 1px solid var(--rule); margin: -.6rem 0 1rem; overflow-x: auto; }
.subnav a { padding: .55rem .9rem; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 600; font-size: .92rem; }
.subnav a[aria-current="page"] { color: var(--heading); border-bottom-color: var(--copper); }
.filters-2 { grid-template-columns: minmax(0, 1fr) 220px; align-items: center; }
.row-button-wide { width: 100%; background: none; border: 0; border-bottom: 1px solid var(--rule); font: inherit; text-align: left; cursor: pointer; }
.row-tools { display: flex; align-items: center; gap: .4rem; }
.list-row.is-off { opacity: .6; }
.bad { color: var(--danger); }
.good { color: var(--ok); }
.warn { color: var(--danger); font-weight: 600; font-size: .9rem; }
.calc { font-size: .88rem; background: var(--tint); padding: .6rem .8rem; border-radius: 6px; }
.tag-off { background: var(--tint); color: var(--muted); }

.est-status { display: flex; gap: .6rem; align-items: center; margin-top: .4rem; }
.est-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 2rem; align-items: start; }
.est-side.sticky { position: sticky; top: 1rem; }
.est-header textarea { min-height: 5.5rem; }
.est-totals { border: 1px solid var(--rule); border-radius: 8px; padding: .8rem 1rem; background: var(--surface); }
.est-totals div { display: flex; justify-content: space-between; padding: .2rem 0; font-variant-numeric: tabular-nums; }
.est-totals .grand { border-top: 1px solid var(--rule); margin-top: .3rem; padding-top: .5rem; font-size: 1.15rem; }
.internal { margin-top: 1rem; padding: .8rem 1rem; border-radius: 8px; background: var(--tint); border-left: 3px solid var(--copper); }
.internal h3 { margin: 0 0 .5rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.internal dl, dl.kv { display: grid; grid-template-columns: auto 1fr; gap: .25rem 1rem; margin: 0; font-size: .9rem; }
.internal dd, dl.kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; word-break: break-word; }
dl.kv dd { text-align: left; font-weight: 400; }
.internal .warn { margin: .6rem 0 0; }
.dirty { color: var(--danger); font-size: .85rem; font-weight: 600; }
.versions { list-style: none; margin: 0; padding: 0; }
.versions li { display: flex; align-items: center; gap: .5rem; padding: .4rem 0; border-bottom: 1px solid var(--rule); }
.versions li.current strong { color: var(--copper); }
.versions small { color: var(--muted); margin-left: auto; }

.line-list { display: flex; flex-direction: column; gap: .7rem; margin-top: .8rem; }
.line { border: 1px solid var(--rule); border-left: 3px solid var(--rule); border-radius: 6px; padding: .6rem .7rem; background: var(--surface); display: flex; flex-direction: column; gap: .45rem; }
.line-optional { border-left-color: var(--link); }
.line-alternative { border-left-color: var(--copper); }
.line-top { display: flex; gap: .4rem; align-items: center; }
.line-top select { width: auto; min-height: 36px; padding: .25rem .5rem; }
.line-top input { min-height: 36px; padding: .25rem .55rem; }
.line-section { max-width: 200px; }
.line-group { max-width: 160px; }
.line-tools { margin-left: auto; display: flex; gap: .1rem; }
.line textarea { min-height: 2.6rem; }
.line-nums { display: grid; grid-template-columns: 90px 120px 120px 120px auto 1fr; gap: .5rem; align-items: end; }
.line-nums label { display: flex; flex-direction: column; gap: .15rem; font-size: .74rem; color: var(--muted); font-weight: 600; }
.line-nums input, .line-nums select { min-height: 38px; padding: .3rem .5rem; }
.internal-field input { background: var(--tint); }
.check-inline { flex-direction: row !important; align-items: center; gap: .35rem !important; padding-bottom: .55rem; }
.check-inline input { width: auto; min-height: 0; }
.line-amount { text-align: right; font-weight: 600; padding-bottom: .55rem; }

.pick-list { max-height: 50vh; overflow-y: auto; border-top: 1px solid var(--rule); margin-top: .5rem; }
.pick-row { display: flex; align-items: center; gap: .8rem; padding: .5rem 0; border-bottom: 1px solid var(--rule); }
.pick-qty { width: 90px; flex: none; }
.import-report ul { max-height: 30vh; overflow-y: auto; }
.import-report li.bad { color: var(--danger); }

/* Documento do cliente dentro do app (mesmo visual da página pública) */
.doc-embed { background: #fff; color: #2E2C29; border: 1px solid var(--rule); border-top: 5px solid #1F1F1F; border-radius: 4px; padding: 2rem 2.2rem; color-scheme: light; }
.dialog-doc { width: min(920px, calc(100vw - 2rem)); background: #E9E4DB; }
.doc-embed .doc-tools { display: none; }
.doc-embed .doc-head { display: flex; justify-content: space-between; gap: 1.5rem; padding-bottom: 1.2rem; border-bottom: 1px solid #DDD4C6; }
.doc-embed .doc-brand { display: flex; flex-direction: column; gap: .5rem; }
.doc-embed .doc-logo { max-height: 56px; max-width: 220px; object-fit: contain; align-self: flex-start; }
.doc-embed .doc-wordmark { font-size: 1.3rem; color: #1F1F1F; }
.doc-embed .doc-company, .doc-embed .doc-id, .doc-embed .doc-parties > div { display: flex; flex-direction: column; font-size: .84rem; }
.doc-embed .doc-id { text-align: right; }
.doc-embed .doc-id strong { font-size: 1.4rem; color: #1F1F1F; }
.doc-embed .doc-kicker { font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: #A7653B; font-weight: 700; }
.doc-embed .doc-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; padding: 1rem 0; }
.doc-embed .doc-title { font-size: 1.5rem; color: #1F1F1F; margin: .4rem 0 .8rem; }
.doc-embed h2, .doc-embed h3 { color: #1F1F1F; font-size: .95rem; margin: 1rem 0 .3rem; }
.doc-embed .doc-table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.doc-embed .doc-table th { text-align: left; font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: #6B655C; padding: .35rem .4rem; border-bottom: 1.5px solid #1F1F1F; }
.doc-embed .doc-table td { padding: .45rem .4rem; border-bottom: 1px solid #DDD4C6; vertical-align: top; }
.doc-embed .c-num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.doc-embed .c-unit { color: #6B655C; }
.doc-embed .c-desc input { width: 18px; height: 18px; min-height: 0; padding: 0; margin: 0 .55rem 0 0; display: inline-block; vertical-align: -3px; accent-color: #C98556; box-shadow: none; }
.doc-embed tr.is-out td { color: #A39B8F; }
.doc-embed .mob-qty { display: none; }
.doc-embed .allow { margin-left: .5rem; font-size: .66rem; text-transform: uppercase; color: #A7653B; border: 1px solid #C98556; border-radius: 3px; padding: 0 .3rem; }
.doc-embed .doc-totals { margin: .8rem 0 0 auto; width: min(320px, 100%); }
.doc-embed .tot-row { display: flex; justify-content: space-between; padding: .3rem 0; font-variant-numeric: tabular-nums; }
.doc-embed .tot-total { border-top: 1.5px solid #1F1F1F; font-weight: 700; font-size: 1.15rem; color: #1F1F1F; }
.doc-embed .doc-banner { padding: .7rem .9rem; border-radius: 6px; margin-bottom: 1rem; font-weight: 600; background: #EAE3D8; }
.doc-embed .doc-banner.accepted { background: #E1EBDF; color: #3F6B4A; }
.doc-embed .pre { white-space: pre-wrap; margin: 0; }
.doc-embed .doc-accept { margin-top: 1.5rem; padding: 1.1rem; background: #F7F4EF; border-left: 4px solid #C98556; }
.doc-embed .acc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; margin: .6rem 0; }
.doc-embed .acc-grid label { display: flex; flex-direction: column; gap: .3rem; font-size: .84rem; font-weight: 600; color: #2E2C29; }
.doc-embed .acc-grid input { background: #fff; color: #2E2C29; border-color: #CFC5B6; }
.doc-embed .acc-agree { display: flex; gap: .6rem; font-size: .9rem; color: #2E2C29; }
.doc-embed .acc-agree input { width: 20px; height: 20px; min-height: 0; flex: none; accent-color: #C98556; }
.doc-embed .acc-note { font-size: .78rem; color: #6B655C; }
.doc-embed .acc-actions { display: flex; gap: .6rem; flex-wrap: wrap; }
.doc-embed .doc-btn { font: inherit; font-weight: 600; min-height: 44px; padding: .5rem 1.1rem; border-radius: 6px; border: 1px solid #DDD4C6; background: transparent; color: #1F1F1F; cursor: pointer; }
.doc-embed .doc-btn.primary { background: #C98556; border-color: #C98556; }
.doc-embed .doc-error { color: #A23E2C; }
.doc-embed .dec-box { display: flex; flex-direction: column; gap: .4rem; flex: 1; }

@media (max-width: 1100px) {
  .est-grid { grid-template-columns: 1fr; }
  .est-side.sticky { position: static; }
}
@media (max-width: 760px) {
  .filters-2 { grid-template-columns: 1fr; }
  .line-top { flex-wrap: wrap; }
  .line-section, .line-group { max-width: none; flex: 1; }
  .line-nums { grid-template-columns: 1fr 1fr; }
  .line-amount { grid-column: 1 / -1; padding: 0; }
  .doc-embed { padding: 1.1rem; }
  .doc-embed .doc-head { flex-direction: column; }
  .doc-embed .doc-id { text-align: left; }
  .doc-embed .doc-parties, .doc-embed .acc-grid { grid-template-columns: 1fr; }
}

/* ---------- Etapas 4 e 5: obras, invoices, financeiro ---------- */
.stats-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stats-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat-bad { border-left-color: var(--danger, #A4442B); }
.stat-bad strong { color: var(--danger, #A4442B); }
.bad { color: var(--danger, #A4442B); }
.aging { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .8rem; align-items: end; }
.aging-col { display: flex; flex-direction: column; gap: .2rem; }
.aging-col small { order: 3; } .aging-col .aging-bar { order: 1; } .aging-col strong { order: 2; }
.aging-bar { height: 90px; display: flex; align-items: flex-end; border-bottom: 1px solid var(--rule); }
.aging-bar span { display: block; width: 100%; height: var(--h, 0%); min-height: 2px; background: var(--linen); }
.aging-col.is-late .aging-bar span { background: var(--copper); }
.aging-col strong { font-variant-numeric: tabular-nums; font-size: .95rem; color: var(--heading); }
.aging-col small { color: var(--muted); font-size: .76rem; }
.inv-lines { display: flex; flex-direction: column; gap: .4rem; margin-bottom: .6rem; }
.inv-line { display: grid; grid-template-columns: minmax(0, 1fr) 5rem 8rem auto; gap: .4rem; align-items: center; }
.inv-line input:nth-child(2), .inv-line input:nth-child(3) { text-align: right; font-variant-numeric: tabular-nums; }
.inv-total { text-align: right; font-weight: 600; margin: .6rem 0 1rem; }
.table td small { font-size: .76rem; }
.table td .tag { margin: 0 .2rem .2rem 0; }
@media (max-width: 900px) { .stats-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .stats-4, .stats-3 { grid-template-columns: 1fr; }
  .aging { grid-template-columns: 1fr; gap: .45rem; }
  .aging-col { display: grid; grid-template-columns: 5.2rem minmax(0, 1fr) 6.5rem; align-items: center; gap: .6rem; }
  .aging-col small { order: 1; } .aging-col .aging-bar { order: 2; } .aging-col strong { order: 3; text-align: right; font-size: .88rem; }
  .aging-bar { height: 12px; border-bottom: 0; background: color-mix(in srgb, var(--rule) 45%, transparent); }
  .aging-bar span { width: var(--h, 0%); height: 100%; min-width: 2px; }
  .inv-line { grid-template-columns: minmax(0, 1fr) 3.6rem 6rem auto; }
}
/* Linhas com vários botões: os botões vão para uma linha própria em vez de espremer o texto. */
.rows li:has(> .row-tools > :nth-child(2)) { flex-wrap: wrap; row-gap: .3rem; }
.rows li > .row-tools:has(> :nth-child(2)) { flex-basis: 100%; justify-content: flex-end; flex-wrap: wrap; }
.rows li > .num { white-space: nowrap; }
@media (max-width: 640px) {
  .rows li:has(> .row-tools), .rows li:has(> .tag + .num), .rows li:has(> .num + .tag) { flex-wrap: wrap; row-gap: .35rem; }
  .rows li:has(> .row-tools) > .row-main, .rows li:has(> .tag + .num) > .row-main, .rows li:has(> .num + .tag) > .row-main { flex-basis: 100%; }
  .rows li > .row-tools { flex-basis: 100%; justify-content: flex-end; flex-wrap: wrap; }
}
@media (max-width: 640px) { .list-side.keep { display: flex; } .list-side.keep strong { font-size: .92rem; } }
@media (max-width: 640px) {
  .aging-bar { background: color-mix(in srgb, var(--rule) 35%, transparent); }
  .aging-col:not(.is-late) .aging-bar span { background: color-mix(in srgb, var(--muted) 45%, transparent); }
  .list-row > .tag { justify-self: start; align-self: start; width: auto; }
}

/* ===================== Revisão visual (dashboard) — identidade Innova ===================== */
:root:not([data-theme="dark"]) {
  --bg: #FFFFFF;              /* fundo branco (pedido do Lucas) */
  --surface: #FFFFFF;
  --text: #1F1F1F;
  --heading: #1F1F1F;
  --muted: #595959;           /* secundário: 7:1 sobre branco */
  --rule: #E2DBD0;
  --input-border: #C9BFB1;
  --link: #9E5F34;            /* cobre escuro: 5,1:1 sobre branco */
  --tint: #F3EEE7;
  --ok: #2F6B3C; --ok-bg: #E3F0E5;
  --danger: #A3321F; --danger-bg: #F9E3DE;
  --warn: #7A4E06; --warn-bg: #FCEFD6;
  --info: #3D4F63; --info-bg: #E6ECF2;
  --neutral: #4D4D4D; --neutral-bg: #ECEAE6;
  --lead-bg: var(--warn-bg); --lead-text: var(--warn);
  --rail-bg: #1F1F1F; --rail-active: #2E2C29; --rail-text: #D9D3C9; --rail-hover: #292725; --rail-line: #34312D;
  --shadow: 0 1px 2px rgba(31, 31, 31, .06), 0 2px 8px rgba(31, 31, 31, .04);
  --radius: 12px;
}
body { background: var(--bg); color: var(--text); }
a { color: var(--link); }
small, .muted, .hint { color: var(--muted); }

/* ---- Esqueleto: menu fixo + área de trabalho com barra superior ---- */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100dvh; }
.workspace { min-width: 0; display: flex; flex-direction: column; }
.rail { position: sticky; top: 0; height: 100dvh; overflow-y: auto; }
.rail-link { position: relative; display: flex; align-items: center; gap: .7rem; min-height: 42px; padding: 0 1.1rem; margin: 1px .6rem; border-radius: 8px; color: var(--rail-text); }
.rail-link:hover { background: var(--rail-hover); color: #fff; }
.rail-link[aria-current="page"] { background: var(--rail-active); color: #fff; font-weight: 600; }
.rail-link[aria-current="page"]::before { content: ''; position: absolute; left: -.6rem; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--copper); }
.rail-link[aria-current="page"] svg { stroke: var(--copper); }
.rail-link:focus-visible, .shortcut:focus-visible, .menu-toggle:focus-visible { outline: 3px solid var(--copper); outline-offset: 2px; }
.tabbar { display: none !important; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: .75rem; min-height: 56px; padding: 0 1.5rem;
  background: rgba(255, 255, 255, .96); border-bottom: 1px solid var(--rule); backdrop-filter: blur(6px); }
.topbar-brand, .menu-toggle { display: none; }
.shortcuts { display: flex; gap: .25rem; margin-left: auto; }
.shortcut { display: inline-flex; align-items: center; gap: .45rem; min-height: 38px; padding: 0 .8rem; border-radius: 8px; color: var(--text); text-decoration: none; font-weight: 500; font-size: .92rem; }
.shortcut svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.shortcut:hover { background: var(--tint); }
.shortcut[aria-current="page"] { background: #F6E9DE; color: #7A4526; box-shadow: inset 0 -2px 0 var(--copper); }

/* ---- Largura: ocupa a área disponível ---- */
.page, .page-wide { max-width: none; padding: 1.75rem 2rem 3rem; }
.page > * + * { margin-top: 0; }

/* ---- Cards ---- */
.card, .stat, .card-section, .panel, .list > .list-row, .kpi { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-section, .panel { padding: 1.15rem 1.25rem; margin-bottom: 1.25rem; }
.stat { padding: 1rem 1.1rem; border-left-width: 1px; }
.stat strong { color: var(--heading); }
.stats { gap: 1rem; }
.list { display: flex; flex-direction: column; gap: .5rem; border: 0; }
.list > .list-row { padding: .8rem 1rem; }
.list > .list-row:hover { border-color: #CDBFAE; }
.stat-bad { border-color: #E8B9AF; } .stat-bad strong { color: var(--danger); }

/* ---- Botões e estados ---- */
.btn { min-height: 40px; border-radius: 8px; font-weight: 600; transition: background-color .15s, border-color .15s, color .15s; }
.btn-primary { background: var(--copper); border-color: var(--copper); color: #1F1F1F; }  /* 5,5:1 — branco sobre este cobre não passa no AA */
.btn-primary:hover { background: #9E5F34; border-color: #9E5F34; color: #FFFFFF; }       /* 5,1:1 */
.btn:not(.btn-primary):not(.btn-danger) { background: var(--surface); border: 1px solid var(--input-border); color: var(--text); }
.btn:not(.btn-primary):not(.btn-danger):hover { border-color: #9E8B76; background: var(--tint); }
.btn-ghost { border-color: transparent !important; background: transparent !important; color: var(--link) !important; }
.btn-ghost:hover { background: var(--tint) !important; }
.btn-danger { background: var(--surface); border: 1px solid #D9A79C; color: var(--danger); }
.btn-danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid #9E5F34; outline-offset: 2px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 1; background: #EEEBE6 !important; border-color: #DDD7CE !important; color: #6F6A63 !important; cursor: not-allowed; }
.btn[aria-busy="true"] { position: relative; color: transparent !important; }
.btn[aria-busy="true"]::after { content: ''; position: absolute; inset: 0; margin: auto; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid #1F1F1F; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .btn[aria-busy="true"]::after { animation-duration: 2s; } }

/* ---- Status: cor sempre com texto ---- */
.tag { border-radius: 999px; font-weight: 600; font-size: .78rem; padding: .18rem .6rem; background: var(--neutral-bg); color: var(--neutral); }
.tag-ok { background: var(--ok-bg); color: var(--ok); }
.tag-bad { background: var(--danger-bg); color: var(--danger); }
.tag-lead, .tag-warn { background: var(--warn-bg); color: var(--warn); }
.tag-info { background: var(--info-bg); color: var(--info); }
.tag-off { background: var(--neutral-bg); color: var(--neutral); }

/* ---- Tablet ---- */
@media (max-width: 1100px) and (min-width: 761px) {
  .shell { grid-template-columns: 76px minmax(0, 1fr); }
  .rail .brand span:last-child, .rail-user { display: none; }
  .rail-link span, .shortcut span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .rail-link { justify-content: center; padding: 0; }
  .page, .page-wide { padding: 1.4rem 1.25rem 3rem; }
}
/* ---- Celular: menu recolhível ---- */
@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail { display: flex; position: fixed; z-index: 40; inset: 0 auto 0 0; width: min(84vw, 300px); transform: translateX(-102%); transition: transform .2s ease; box-shadow: 8px 0 24px rgba(0, 0, 0, .25); }
  .rail.is-open { transform: none; }
  .rail-backdrop { position: fixed; inset: 0; z-index: 30; background: rgba(31, 31, 31, .45); }
  body.menu-open { overflow: hidden; }
  .topbar { padding: 0 .5rem; gap: .25rem; min-height: 52px; }
  .menu-toggle { display: inline-grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 8px; background: transparent; color: var(--text); }
  .menu-toggle svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
  .topbar-brand { display: none; }
  .shortcuts { margin-left: auto; gap: 0; }
  .shortcut { flex-direction: column; gap: .1rem; min-height: 48px; min-width: 52px; padding: .2rem .3rem; font-size: .68rem; justify-content: center; }
  .page, .page-wide { padding: 1.1rem .9rem calc(2rem + env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) { .rail { transition: none; } }

/* ---------- Dashboard ---------- */
.dashboard { display: flex; flex-direction: column; gap: 1.25rem; }
.dashboard .card-section { margin-bottom: 0; }
.dash-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .6rem 1rem; align-items: end; }
.dash-head h1 { margin: 0; font-size: 1.6rem; }
.dash-head p { margin: .25rem 0 0; }
.dash-actions { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: flex-end; }
.dash-filter { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; padding: .6rem .75rem; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); }
.dash-filter label { font-weight: 600; font-size: .9rem; }
.dash-filter select, .dash-filter input { width: auto; min-height: 38px; }
.custom-range { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
@media (min-width: 1280px) { .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1680px) { .kpi-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.kpi { display: flex; flex-direction: column; gap: .3rem; padding: 1rem 1.1rem; min-width: 0; }
.kpi-head { display: flex; align-items: center; gap: .5rem; }
.kpi-head h3 { margin: 0; font-size: .95rem; font-weight: 600; color: var(--text); flex: 1; }
.kpi-icon { width: 20px; height: 20px; flex: none; fill: none; stroke: #9E5F34; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.kpi-info { flex: none; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--input-border); background: var(--surface); color: var(--muted); font: italic 600 .82rem/1 Georgia, serif; cursor: pointer; }
.kpi-info:hover, .kpi-info[aria-expanded="true"] { border-color: #9E5F34; color: #9E5F34; }
.kpi-value { margin: .1rem 0 0; font-size: 1.65rem; font-weight: 700; color: var(--heading); font-variant-numeric: tabular-nums; line-height: 1.15; overflow-wrap: anywhere; }
.kpi.is-empty .kpi-value { font-size: 1.05rem; font-weight: 600; color: var(--muted); }
.kpi.is-alert { border-color: #E3B2A7; } .kpi.is-alert .kpi-value { color: var(--danger); }
.kpi-sub { margin: 0; font-size: .86rem; color: var(--muted); }
.kpi-delta { font-weight: 600; white-space: nowrap; }
.kpi-delta.is-up { color: var(--ok); } .kpi-delta.is-down { color: var(--danger); }
.kpi-help { margin: .3rem 0 0; padding: .55rem .7rem; background: var(--tint); border-radius: 8px; font-size: .86rem; color: var(--text); }
.kpi-open { margin-top: auto; align-self: flex-start; padding: .3rem 0; border: 0; background: none; color: var(--link); font-weight: 600; font-size: .88rem; cursor: pointer; }
.kpi-open:hover { text-decoration: underline; }
.dash-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.dash-row.two-one { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.dash-row.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dash-block { display: flex; flex-direction: column; gap: 1rem; }
.block-title { margin: .5rem 0 0; font-size: 1.15rem; }
.dash-secondary .card-section { box-shadow: none; }
.chart { width: 100%; height: auto; display: block; }
.ch-grid { stroke: #E7E1D7; stroke-width: 1; }
.ch-axis { fill: #595959; font-size: 11px; }
.ch-val { fill: #1F1F1F; font-size: 11px; font-weight: 600; }
.ch-cur { fill: none; stroke: #C98556; stroke-width: 2.5; stroke-linejoin: round; }
.ch-area { fill: rgba(201, 133, 86, .12); }
.ch-prev { fill: none; stroke: #8C8C8C; stroke-width: 1.8; stroke-dasharray: 5 4; }
.ch-pt { fill: #9E5F34; } .ch-bar { fill: #C98556; } .ch-bar:hover, .ch-pt:hover { fill: #9E5F34; }
.legend-inline { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .5rem; font-size: .86rem; color: var(--muted); }
.lg { display: inline-block; width: 18px; height: 3px; border-radius: 2px; margin-left: .4rem; }
.lg-cur { background: #C98556; } .lg-prev { background: repeating-linear-gradient(90deg, #8C8C8C 0 5px, transparent 5px 9px); }
.chart-data summary { cursor: pointer; color: var(--link); font-size: .88rem; margin-top: .4rem; }
.donut-wrap { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 1rem; align-items: center; }
.donut { width: 100%; max-width: 170px; }
.donut-total { fill: #1F1F1F; font-size: 18px; font-weight: 700; }
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.legend li { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto 3rem; gap: .5rem; align-items: center; font-size: .9rem; }
.legend small { text-align: right; color: var(--muted); }
.sw { width: 12px; height: 12px; border-radius: 3px; }
.sw-material { background: #C98556; } .sw-labor { background: #2E2C29; } .sw-subcontractor { background: #8C7B6B; }
.sw-permit { background: #5E7A8C; } .sw-delivery { background: #D8C4AC; } .sw-other { background: #A9A29A; }
.hbars { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.hbars li { display: grid; grid-template-columns: minmax(0, 9rem) minmax(0, 1fr) auto; gap: .6rem; align-items: center; font-size: .9rem; }
.hb-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-track, .meter { display: block; height: 10px; border-radius: 6px; background: #EEE8DF; overflow: hidden; }
.hb-fill, .meter-fill { display: block; height: 100%; width: var(--w, 0%); background: #C98556; border-radius: 6px; }
.meter { display: inline-block; width: 90px; vertical-align: middle; }
.meter-fill.is-over { background: var(--danger); }
.rank { margin: 0; padding-left: 1.3rem; display: grid; gap: .4rem; }
.rank li { padding-left: .2rem; } .rank li > * { display: inline; } .rank strong { float: right; }
.action-center h3 { font-size: .95rem; margin: 0 0 .4rem; }
.big-num { font-size: 1.5rem; font-weight: 700; margin: .2rem 0 0; color: var(--heading); }
.more { display: inline-block; margin-top: .6rem; font-weight: 600; font-size: .9rem; }
.empty-state { margin: .5rem 0; padding: 1rem; border: 1px dashed var(--input-border); border-radius: 10px; color: var(--muted); text-align: center; }
.notice-warn { background: var(--warn-bg); color: var(--warn); border: 1px solid #F0D49E; border-radius: 10px; padding: .7rem .9rem; margin: 0; }
.dialog-rows { max-height: 60vh; overflow-y: auto; }
@media (max-width: 1100px) { .dash-row.two-one, .dash-row.three { grid-template-columns: repeat(2, minmax(0, 1fr)); } .dash-row.two-one > :first-child { grid-column: 1 / -1; } }
@media (max-width: 760px) {
  .dash-head { grid-template-columns: minmax(0, 1fr); }
  .dash-actions { justify-content: flex-start; }
  .dash-actions .btn { flex: 1 1 auto; }
  .kpi-grid, .dash-row, .dash-row.two-one, .dash-row.three { grid-template-columns: minmax(0, 1fr); }
  .donut-wrap { grid-template-columns: minmax(0, 1fr); justify-items: center; }
  .legend { width: 100%; }
  .hbars li { grid-template-columns: minmax(0, 7rem) minmax(0, 1fr) auto; }
}
.stats .stat, .stats .stat:nth-child(n) { border-left: 1px solid var(--rule); }
.stats .stat.stat-bad { border-color: #E3B2A7; }

/* ---------- Seletor de período (painel e cada gráfico) ---------- */
.pp { position: relative; flex: none; }
.pp-btn { display: inline-flex; align-items: center; gap: .45rem; min-height: 38px; padding: 0 .65rem 0 .7rem; border: 1px solid var(--input-border); border-radius: 8px;
  background: var(--surface); color: var(--text); font: inherit; font-size: .9rem; font-weight: 500; cursor: pointer; max-width: 100%; }
.pp-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pp-btn svg { width: 16px; height: 16px; flex: none; fill: none; stroke: #9E5F34; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pp-btn .pp-caret { stroke: var(--muted); }
.pp-btn:hover { border-color: #9E8B76; background: var(--tint); }
.pp-btn[aria-expanded="true"] { border-color: #9E5F34; box-shadow: 0 0 0 3px rgba(201, 133, 86, .2); }
.pp-btn:focus-visible { outline: 3px solid #9E5F34; outline-offset: 2px; }
.pp-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 25; min-width: 240px; max-width: calc(100vw - 1.5rem); padding: .35rem 0;
  background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; box-shadow: 0 10px 28px rgba(31, 31, 31, .16); }
.pp-item { display: flex; align-items: center; width: 100%; min-height: 40px; padding: 0 1rem 0 2rem; border: 0; background: none; color: var(--text);
  font: inherit; font-size: .93rem; text-align: left; cursor: pointer; position: relative; }
.pp-item:hover, .pp-item:focus-visible { background: var(--tint); outline: none; }
.pp-item:focus-visible { box-shadow: inset 3px 0 0 #9E5F34; }
.pp-item[aria-checked="true"] { color: #7A4526; font-weight: 600; }
.pp-item[aria-checked="true"]::before { content: '✓'; position: absolute; left: .8rem; color: #9E5F34; }
.pp-sep { height: 1px; margin: .3rem 0; background: var(--rule); }
.pp-custom { display: grid; gap: .5rem; padding: .6rem 1rem .4rem; border-top: 1px solid var(--rule); margin-top: .3rem; }
.pp-custom label { display: grid; gap: .2rem; font-size: .85rem; color: var(--muted); }
.pp-custom input { min-height: 38px; }
.pp-error { margin: 0; color: var(--danger); font-size: .84rem; }
.pp-error:empty { display: none; }
.pc-period { margin: -.2rem 0 .6rem; font-size: .84rem; color: var(--muted); }
.pc-body[aria-busy="true"] { opacity: .55; transition: opacity .15s; }
.section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem .75rem; }
.section-head h2 { margin: 0; }
.dash-filter { align-items: center; }
.dash-filter-label { font-weight: 600; font-size: .9rem; }
@media (max-width: 760px) {
  .pp-menu { position: fixed; left: .75rem; right: .75rem; top: auto; bottom: .75rem; max-height: 75vh; overflow-y: auto; min-width: 0; }
  .section-head { align-items: flex-start; }
}
.pp-custom[hidden], .pp-menu[hidden] { display: none; }
.pp-menu { min-width: 270px; }

/* ---------- Período nas listas (estimates, jobs, invoices) ---------- */
.filters-period { display: flex; flex-wrap: wrap; gap: .6rem .75rem; align-items: center; margin-bottom: 1rem; }
.filters-period > input[type="search"] { flex: 1 1 220px; min-width: 0; }
.filters-period > select { flex: 0 1 200px; }
.list-period { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; flex: 1 1 auto; }
.list-summary { margin: 0; font-size: .88rem; color: var(--muted); }
.filters-period .pp-menu { left: 0; right: auto; }
@media (max-width: 760px) {
  .filters-period > input[type="search"], .filters-period > select, .list-period { flex: 1 1 100%; }
}

/* Abas internas (Estimates / Price Book / Templates): sublinhado cobre, sem fundo escuro (texto escuro sobre fundo escuro era ilegível) */
.subnav a { border-radius: 0; }
.subnav a:hover { background: var(--tint); color: var(--heading); }
.subnav a[aria-current="page"] { background: none; color: var(--heading); border-bottom-color: var(--copper); }

/* ---------- Cards com período: mesmo cabeçalho em todos ----------
   Linha 1: título (uma linha, reticências se não couber).
   Linha 2: seletor à esquerda + período ao lado. Igual em todos os cards, com título curto ou longo. */
.period-card { display: flex; flex-direction: column; }
.period-card .pc-title { margin: 0; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .75rem; margin: .65rem 0 1rem; min-height: 38px; }
.pc-toolbar .pc-period { margin: 0; flex: 1 1 180px; min-width: 0; }
.pc-toolbar .pp-menu { left: 0; right: auto; }
.period-card .pc-body { flex: 1 1 auto; }
/* padrão final: título, seletor e período um embaixo do outro — mesma posição em qualquer largura */
.pc-toolbar { flex-direction: column; align-items: flex-start; flex-wrap: nowrap; gap: .4rem; min-height: 0; }
.pc-toolbar .pc-period { flex: none; }

/* ================= Estimates no formato do QuoteIQ ================= */
.eb-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin: 0 0 1rem; }
.eb-search-wrap { position: relative; flex: 1 1 320px; min-width: 0; }
.eb-search-wrap .ec-ico { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; stroke: var(--muted); }
.eb-search { width: 100%; min-height: 42px; padding-left: 2.4rem !important; }
.eb-filter { position: relative; display: inline-flex; align-items: center; }
.eb-filter .ec-ico { position: absolute; left: .65rem; width: 16px; height: 16px; stroke: var(--link); pointer-events: none; }
.eb-filter select { min-height: 42px; padding-left: 2.1rem; min-width: 150px; }
.eb-bar .pp-btn { min-height: 42px; }
.eb-bar .btn-primary { min-height: 42px; white-space: nowrap; }

.eb-tabs { display: flex; gap: .25rem; overflow-x: auto; border-bottom: 1px solid var(--rule); margin: 0 0 .4rem; scrollbar-width: thin; }
.eb-tab { flex: none; display: grid; justify-items: center; gap: .1rem; padding: .55rem .9rem .6rem; border: 0; border-bottom: 3px solid transparent; background: none;
  font: inherit; color: var(--muted); cursor: pointer; }
.eb-tab-name { font-weight: 600; font-size: .92rem; color: var(--heading); white-space: nowrap; }
.eb-tab-total { font-size: .88rem; }
.eb-tab:hover { background: var(--tint); }
.eb-tab[aria-selected="true"] { border-bottom-color: var(--copper); }
.eb-tab[aria-selected="true"] .eb-tab-total { color: var(--heading); font-weight: 600; }
.eb-tab:focus-visible { outline: 3px solid var(--link); outline-offset: -3px; }
.eb-hint { margin: 0 0 1rem; font-size: .86rem; color: var(--muted); }

.eb-day { margin: 0 0 1.25rem; }
.eb-day-head { margin: 0 0 .6rem; padding: .45rem .9rem; font-size: 1rem; font-weight: 600; background: var(--tint); color: var(--heading); border-radius: 6px; }
.est-card { max-width: 1040px; background: var(--surface); border: 1px solid var(--rule); border-left: 4px solid var(--rule); border-radius: 10px;
  box-shadow: 0 1px 2px rgba(31, 31, 31, .05); margin: 0 0 .9rem; }
.est-card.stage-open { border-left-color: #C99A2E; }
.est-card.stage-accepted, .est-card.stage-scheduled { border-left-color: var(--copper); }
.est-card.stage-paid { border-left-color: var(--ok); }
.est-card.stage-declined { border-left-color: var(--danger); }
.est-card.stage-draft, .est-card.stage-archive { border-left-color: #9A9389; }

.ec-head { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; padding: .6rem .9rem; border-bottom: 1px solid var(--rule); background: #FBF9F6; border-radius: 10px 10px 0 0; }
.ec-chip { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .55rem; border: 1px solid var(--rule); border-radius: 6px; background: var(--surface);
  color: var(--link); font-size: .85rem; font-weight: 600; text-decoration: none; }
.ec-chip:hover { border-color: var(--link); }
.ec-date { font-weight: 600; font-size: .92rem; color: var(--heading); }
.ec-ico { width: 15px; height: 15px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.ec-menu { margin-left: auto; position: relative; }
.ec-menu summary { list-style: none; width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--rule); border-radius: 6px; background: var(--surface);
  cursor: pointer; font-size: 1.2rem; line-height: 1; color: var(--heading); }
.ec-menu summary::-webkit-details-marker { display: none; }
.ec-menu summary:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; }
.ec-menu-list { position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; min-width: 180px; padding: .3rem 0; background: var(--surface); border: 1px solid var(--rule);
  border-radius: 8px; box-shadow: 0 10px 24px rgba(31, 31, 31, .14); }
.ec-menu-list a, .ec-menu-list button { display: block; width: 100%; padding: .55rem 1rem; border: 0; background: none; font: inherit; text-align: left; color: var(--text); text-decoration: none; cursor: pointer; }
.ec-menu-list a:hover, .ec-menu-list button:hover, .ec-menu-list a:focus-visible, .ec-menu-list button:focus-visible { background: var(--tint); outline: none; }

.ec-body { display: flex; gap: 1rem; padding: .85rem .9rem .6rem; }
.ec-main { flex: 1 1 auto; min-width: 0; display: grid; gap: .3rem; justify-items: start; }
.ec-client { margin: 0; font-size: 1.15rem; }
.ec-client a { color: var(--heading); text-decoration: none; }
.ec-client a:hover { color: var(--link); text-decoration: underline; }
.ec-title { margin: 0; color: var(--text); font-size: .92rem; }
.ec-sub { margin: 0; color: var(--text); }
.ec-creator { display: inline-flex; align-items: center; gap: .4rem; margin: .1rem 0; padding: .15rem .55rem .15rem .2rem; border: 1px solid var(--rule); border-radius: 999px;
  font-size: .84rem; background: #FBF9F6; }
.ec-avatar { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: var(--charcoal); color: var(--linen); font-size: .7rem; font-weight: 700; }
.ec-line { display: inline-flex; align-items: center; gap: .45rem; color: var(--link); text-decoration: none; font-size: .93rem; overflow-wrap: anywhere; }
.ec-line:hover { text-decoration: underline; }
.ec-line .ec-ico { color: var(--muted); }
.ec-note { margin: .15rem 0 0; font-size: .85rem; color: var(--muted); }
.ec-side { flex: none; display: flex; align-items: flex-start; gap: .6rem; }
.ec-amount { font-size: 1.3rem; color: var(--heading); white-space: nowrap; }

.ec-foot { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; padding: .5rem .9rem; border-top: 1px solid var(--rule); background: #FBF9F6; }
.ec-link { display: inline-flex; align-items: center; gap: .35rem; padding: .25rem 0; border: 0; background: none; font: inherit; font-weight: 600; color: var(--heading); cursor: pointer; }
.ec-link:last-child { margin-left: auto; color: var(--link); }
.ec-link:hover { text-decoration: underline; }
.ec-link:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; border-radius: 4px; }
.ec-viewed { display: inline-flex; align-items: center; gap: .35rem; margin-left: auto; font-size: .85rem; color: var(--muted); }
.ec-viewed + .ec-link { margin-left: 0; }
.ec-comment, .ec-log { padding: .6rem .9rem; border-top: 1px solid var(--rule); }
.ec-comment textarea { width: 100%; }
.ec-comment-actions { display: flex; gap: .5rem; margin-top: .4rem; }
.ec-log-list { margin: 0; padding-left: 1.1rem; display: grid; gap: .3rem; font-size: .88rem; }
.ec-log-list time { color: var(--muted); font-variant-numeric: tabular-nums; }
.ec-actions { display: flex; flex-wrap: wrap; gap: .5rem; padding: .7rem .9rem .85rem; border-top: 1px solid var(--rule); }
.ec-actions .btn { min-height: 38px; }

@media (max-width: 760px) {
  .eb-search-wrap, .eb-filter, .eb-filter select, .eb-bar .pp, .eb-bar .pp-btn, .eb-bar .btn-primary { flex: 1 1 100%; width: 100%; }
  .ec-body { flex-direction: column-reverse; gap: .5rem; }
  .ec-side { justify-content: space-between; width: 100%; }
  .ec-viewed { margin-left: 0; width: 100%; order: 3; }
  .ec-actions .btn { flex: 1 1 calc(50% - .5rem); justify-content: center; }
}

/* ---------- Activity Log (janela do estimate) ---------- */
.al-dialog { width: min(560px, calc(100vw - 1.5rem)); padding: 1.4rem 1.4rem 1rem; border-radius: 14px; position: relative; }
.al-dialog > h2 { margin: 0; text-align: center; font-size: 1.35rem; }
.al-sub { margin: .35rem 0 1rem; text-align: center; color: var(--muted); }
.al-refresh { position: absolute; top: 1.1rem; right: 1.1rem; width: 38px; height: 38px; display: grid; place-items: center; border: 0; border-radius: 50%;
  background: var(--tint); color: var(--heading); cursor: pointer; }
.al-refresh:hover { background: var(--linen); }
.al-refresh:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; }
.al-refresh .ec-ico { width: 18px; height: 18px; }
.al-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; margin-bottom: 1rem; }
.al-stat { display: grid; justify-items: center; gap: .15rem; padding: .7rem .4rem; border-radius: 10px; background: var(--tint); }
.al-stat strong { font-size: 1.35rem; color: var(--heading); font-variant-numeric: tabular-nums; }
.al-stat span { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.al-list { list-style: none; margin: 0; padding: 0; position: relative; max-height: min(55vh, 460px); overflow-y: auto; }
.al-item { position: relative; }
/* linha vertical ligando os ícones */
.al-item:not(:last-child)::after { content: ''; position: absolute; left: 19px; top: 42px; bottom: -4px; width: 2px; background: var(--rule); }
.al-row, .al-views > summary { display: flex; align-items: flex-start; gap: .8rem; padding: .55rem 0; }
.al-views > summary { cursor: pointer; list-style: none; border-radius: 8px; }
.al-views > summary::-webkit-details-marker { display: none; }
.al-views > summary:hover { background: #FBF9F6; }
.al-views > summary:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; }
.al-caret { margin-left: auto; padding: .2rem .4rem; color: var(--muted); transition: transform .15s; }
.al-views[open] .al-caret { transform: rotate(180deg); }
.al-dot { position: relative; flex: none; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; background: var(--tint); color: var(--muted); }
.al-dot .ec-ico { width: 18px; height: 18px; }
.al-sent, .al-resent { background: #EEE7F6; color: #5B3F86; }
.al-viewed { background: #EAF0F6; color: #34546F; }
.al-accepted, .al-job_created { background: var(--ok-bg); color: var(--ok); }
.al-declined { background: #F6E3DF; color: var(--danger); }
.al-comment { background: var(--lead-bg); color: var(--lead-text); }
.al-badge { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--charcoal); color: var(--linen);
  font-size: .68rem; font-weight: 700; display: grid; place-items: center; }
.al-text { display: grid; gap: .1rem; min-width: 0; padding-top: .15rem; }
.al-text strong { color: var(--heading); font-weight: 600; }
.al-meta { font-size: .85rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.al-quote { font-size: .88rem; color: var(--text); margin-top: .15rem; overflow-wrap: anywhere; }
.al-times { margin: 0 0 .4rem 3.3rem; padding: 0; list-style: none; display: grid; gap: .25rem; font-size: .86rem; color: var(--text); font-variant-numeric: tabular-nums; }
.al-dialog .form-actions { justify-content: flex-end; margin-top: .9rem; }

/* ================= Invoices no formato do QuoteIQ ================= */
.iv-subtitle { margin: .2rem 0 0; }
.iv-tabs { margin-top: .5rem; gap: .5rem; }
.iv-tab { display: flex; align-items: flex-start; gap: .55rem; justify-items: start; text-align: left; padding: .6rem 1rem .7rem; }
.iv-tab > .ec-ico { width: 20px; height: 20px; margin-top: .1rem; color: var(--muted); }
.iv-tab[aria-selected="true"] > .ec-ico { color: var(--link); }
.iv-tab-text { display: grid; gap: .1rem; }
.iv-count { display: inline-grid; place-items: center; min-width: 1.6rem; margin-left: .45rem; padding: 0 .4rem; border-radius: 999px; background: var(--tint); font-size: .8rem; }
.iv-overdue { font-size: .78rem; font-weight: 600; color: var(--danger); }
.iv-tool { display: inline-flex; align-items: center; gap: .4rem; min-height: 42px; }
.iv-bar2 { justify-content: space-between; }
.iv-send { min-height: 42px; }
.iv-send:disabled { opacity: .55; cursor: not-allowed; }

.iv-table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; }
.iv-table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.iv-table th, .iv-table td { padding: .75rem .8rem; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--rule); }
.iv-table thead th { background: #FBF9F6; font-weight: 600; white-space: nowrap; position: sticky; top: 0; z-index: 1; }
.iv-table tbody tr:last-child td { border-bottom: 0; }
.iv-table tbody tr:hover { background: #FCFAF7; }
.iv-table tbody tr.is-selected { background: #F6EFE6; }
.iv-table .num { text-align: right; white-space: nowrap; }
.iv-table th.num .iv-sort { margin-left: auto; }
.iv-check { width: 2.4rem; }
.iv-check input { width: 18px; height: 18px; }
.iv-sort { display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .25rem; border: 0; background: none; font: inherit; font-weight: 600; color: var(--heading); cursor: pointer; border-radius: 4px; }
.iv-sort:hover { background: var(--tint); }
.iv-sort:focus-visible { outline: 3px solid var(--link); outline-offset: 1px; }
.iv-sort-ico { color: var(--muted); font-size: .85em; }
[aria-sort="ascending"] .iv-sort-ico, [aria-sort="descending"] .iv-sort-ico { color: var(--link); }
.it-strong { display: block; font-weight: 600; color: var(--heading); text-decoration: none; }
.it-strong:hover { color: var(--link); text-decoration: underline; }
.it-sub { display: block; font-size: .82rem; color: var(--muted); }
.it-clip { display: block; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.it-paid { color: var(--ok); font-weight: 600; }
.iv-c-number a { font-weight: 600; }

.am-btn { display: inline-flex; align-items: center; gap: .35rem; background: var(--tint); border: 1px solid var(--rule); }
.am-caret { font-size: .8em; }
.am-menu { position: fixed; z-index: 60; min-width: 220px; padding: .35rem 0; background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; box-shadow: 0 12px 30px rgba(31, 31, 31, .18); }
.am-item { display: block; width: 100%; padding: .6rem 1rem; border: 0; background: none; font: inherit; text-align: left; color: var(--text); cursor: pointer; }
.am-item:hover, .am-item:focus-visible { background: var(--tint); outline: none; }
.am-item:focus-visible { box-shadow: inset 3px 0 0 var(--link); }
.am-item[disabled] { color: var(--muted); cursor: not-allowed; }
.am-danger { color: var(--danger); font-weight: 600; }
.am-sep { height: 1px; margin: .3rem 0; background: var(--rule); }

.iv-foot { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.5rem; padding: .9rem .2rem; }
.iv-showing { margin: 0 auto 0 0; color: var(--muted); }
.iv-per { display: inline-flex; align-items: center; gap: .5rem; color: var(--muted); }
.iv-per select { min-height: 36px; width: auto; }
.iv-pages { display: flex; align-items: center; gap: .3rem; }
.iv-page { min-width: 38px; height: 38px; padding: 0 .5rem; border: 1px solid var(--rule); border-radius: 8px; background: var(--surface); font: inherit; color: var(--heading); cursor: pointer; }
.iv-page.is-current { background: var(--charcoal); border-color: var(--charcoal); color: var(--linen); font-weight: 700; }
.iv-page:disabled { opacity: .4; cursor: default; }
.iv-page:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; }
.iv-gap { color: var(--muted); padding: 0 .2rem; }

.iv-links { list-style: none; margin: 0 0 .5rem; padding: 0; display: grid; gap: .6rem; }
.iv-links li { display: grid; grid-template-columns: 1fr auto; gap: .3rem .5rem; align-items: center; }
.iv-links li strong { grid-column: 1 / -1; }
.iv-colgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .5rem; }
.iv-colopt { display: flex; align-items: center; gap: .5rem; }
.iv-bulk-list { margin: .5rem 0; padding-left: 1.1rem; max-height: 40vh; overflow: auto; }

/* Tabela vira cartões no celular */
@media (max-width: 760px) {
  .iv-table-wrap { border: 0; background: none; overflow: visible; }
  .iv-table, .iv-table tbody, .iv-table tr, .iv-table td { display: block; width: 100%; }
  .iv-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .iv-table tr { position: relative; margin-bottom: .8rem; padding: .6rem .9rem .8rem; background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; }
  .iv-table td { display: flex; justify-content: space-between; gap: 1rem; padding: .35rem 0; border: 0; text-align: right; }
  .iv-table td::before { content: attr(data-label); color: var(--muted); font-size: .85rem; text-align: left; flex: none; }
  .iv-table td.iv-check { position: absolute; top: .65rem; right: .8rem; width: auto; padding: 0; }
  .iv-table td.iv-check::before { content: none; }
  .iv-table td.iv-c-customer { display: block; text-align: left; padding-right: 2.5rem; }
  .iv-table td.iv-c-customer::before { content: none; }
  .it-clip { max-width: 55vw; }
  .iv-foot { justify-content: center; }
  .iv-showing { margin: 0; width: 100%; text-align: center; }
  .iv-bar2 > * { flex: 1 1 100%; }
}

/* "View PDF": imprime só o documento */
@media print {
  body.print-doc > *:not(dialog) { display: none !important; }
  body.print-doc dialog.dialog-doc { position: static; inset: auto; width: auto; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; box-shadow: none; overflow: visible; }
  body.print-doc dialog.dialog-doc > h2, body.print-doc .no-print { display: none !important; }
  body.print-doc dialog::backdrop { background: none; }
}
/* tabela de invoices mais compacta, para caber sem rolar em telas de notebook */
.iv-table { font-size: .9rem; }
.iv-table th, .iv-table td { padding: .65rem .55rem; }
.iv-table th:first-child, .iv-table td:first-child { padding-left: .9rem; }
.iv-table .ec-chip { white-space: nowrap; padding: .15rem .45rem; font-size: .8rem; }
.iv-table .ec-chip .ec-ico { width: 13px; height: 13px; }
.iv-table .am-btn { padding: .3rem .55rem; min-height: 34px; }
.iv-c-date, .iv-c-created, .iv-c-due, .iv-c-number { white-space: nowrap; }
.it-clip { max-width: 210px; }
.iv-c-customer .it-strong, .iv-c-customer .it-sub { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.iv-table thead th { font-size: .84rem; }
.iv-table thead th { white-space: normal; line-height: 1.2; }
.iv-sort { text-align: left; }
.iv-table th, .iv-table td { padding: .6rem .45rem; }
.iv-check { width: 2rem; }
.it-clip { max-width: 180px; }
.iv-c-customer .it-strong, .iv-c-customer .it-sub { max-width: 170px; }

/* ---------- Menu lateral recolhível (≡) ---------- */
.rail-head { display: flex; align-items: center; justify-content: space-between; gap: .4rem; padding-right: .7rem; }
.rail-head .brand { flex: 1 1 auto; min-width: 0; }
.rail-collapse { flex: none; width: 36px; height: 36px; margin-bottom: 1.5rem; display: grid; place-items: center; border: 0; border-radius: 8px;
  background: transparent; color: var(--rail-text); cursor: pointer; }
.rail-collapse:hover { background: var(--rail-hover); color: #fff; }
.rail-collapse:focus-visible { outline: 3px solid var(--copper); outline-offset: 2px; }
.rail-collapse svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
/* recolhido (desktop): só ícones, como no tablet */
@media (min-width: 761px) {
  .shell.rail-collapsed { grid-template-columns: 76px minmax(0, 1fr); }
  .shell.rail-collapsed .rail .brand span:last-child, .shell.rail-collapsed .rail-user { display: none; }
  .shell.rail-collapsed .rail-link span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .shell.rail-collapsed .rail-link { justify-content: center; padding: 0; }
  .shell.rail-collapsed .rail-head { flex-direction: column; padding: 0; gap: .2rem; }
  .shell.rail-collapsed .rail-head .brand { padding: 0 0 .4rem; justify-content: center; }
  .shell.rail-collapsed .rail-collapse { margin-bottom: 1rem; }
}
/* no tablet o menu já fica só com ícones: o botão não teria efeito */
@media (max-width: 1100px) { .rail-collapse { display: none; } }
/* no celular o menu é a gaveta do ≡ da barra de cima */
@media (max-width: 760px) { .rail-head { padding-right: 0; } }

/* cabeçalhos da tabela de invoices quebram linha ("Amount paid") */
.iv-sort { white-space: normal; flex-wrap: wrap; max-width: 7.5rem; }
.iv-table th, .iv-table td { padding: .6rem .38rem; }
.iv-table th:first-child, .iv-table td:first-child { padding-left: .75rem; }

/* Settings → Data (importação e exportação) */
.choices { border: 0; padding: 0; margin: 0 0 1rem; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .6rem; }
.choices legend { font-weight: 600; margin-bottom: .4rem; padding: 0; }
.choice { display: flex; gap: .6rem; align-items: flex-start; padding: .7rem .85rem; border: 1px solid var(--rule); border-radius: var(--radius-control); cursor: pointer; background: var(--surface); }
.choice:has(input:checked) { border-color: var(--link); box-shadow: inset 0 0 0 1px var(--link); }
.choice input { margin-top: .2rem; }
.choice span { display: flex; flex-direction: column; gap: .15rem; }
.label { font-weight: 600; font-size: .9rem; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: .6rem 0 1rem; }
.chip { border: 1px solid transparent; cursor: pointer; font: inherit; font-size: .82rem; }
.chip[aria-pressed="true"] { border-color: currentColor; }
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .5rem 1rem; margin: .6rem 0 1rem; }
.map-row { display: grid; grid-template-columns: 9rem minmax(0, 1fr); gap: .5rem; align-items: center; font-size: .9rem; }
.card-section details summary { cursor: pointer; font-weight: 600; margin: .2rem 0 .4rem; }
.btn-sm { padding: .3rem .7rem; font-size: .85rem; }
.sig-thumb { display: block; max-width: 220px; max-height: 70px; background: #fff; border: 1px solid var(--rule); border-radius: 6px; padding: 2px; }
.portal-url { display: flex; gap: .5rem; align-items: center; margin: .5rem 0; }
.portal-url input { flex: 1; min-width: 0; font-family: ui-monospace, monospace; font-size: .82rem; }
/* Portal visto pela equipe (mesmo visual da página do cliente) */
.portal-embed .p-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; margin: 1rem 0; }
.portal-embed .p-kpis div { border: 1px solid #DDD4C6; border-radius: 6px; padding: .6rem .8rem; display: flex; flex-direction: column; }
.portal-embed .p-kpis span { font-size: .74rem; color: #6B655C; text-transform: uppercase; letter-spacing: .06em; }
.portal-embed .p-kpis strong { font-size: 1.15rem; color: #1F1F1F; font-variant-numeric: tabular-nums; }
.portal-embed .p-list { list-style: none; margin: 0; padding: 0; }
.portal-embed .p-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .7rem 0; border-bottom: 1px solid #DDD4C6; }
.portal-embed .p-main { display: flex; flex-direction: column; min-width: 0; }
.portal-embed .p-side { display: flex; align-items: center; gap: .7rem; flex-shrink: 0; }
.portal-embed .p-amount { font-weight: 600; font-variant-numeric: tabular-nums; min-width: 6rem; text-align: right; }
.portal-embed .p-muted { color: #6B655C; font-size: .86rem; }
.portal-embed .p-tag { font-size: .74rem; font-weight: 600; padding: .12rem .5rem; border-radius: 999px; background: #EAE3D8; }
.portal-embed .p-ok { background: #E1EBDF; color: #3F6B4A; }
.portal-embed .p-warn { background: #F6E7C8; color: #7A5410; }
.portal-embed .p-bad { background: #F4DCD6; color: #A23E2C; }
.portal-embed .doc-btn { font: inherit; font-weight: 600; font-size: .85rem; padding: .35rem .9rem; border-radius: 6px; border: 1px solid #DDD4C6; color: #1F1F1F; text-decoration: none; background: transparent; }
.portal-embed .doc-btn.primary { background: #C98556; border-color: #C98556; }
.portal-embed .doc-banner { padding: .6rem .9rem; border-radius: 6px; margin: 0 0 1rem; font-weight: 600; background: #EAE3D8; }
@media (max-width: 640px) {
  .portal-embed .p-kpis { grid-template-columns: 1fr; }
  .portal-embed .p-row { flex-direction: column; align-items: stretch; }
  .portal-embed .p-side { justify-content: space-between; flex-wrap: wrap; }
}
/* Assinatura dentro do app (proposta e change order embutidos) */
.doc-embed .sig { margin: 1rem 0; }
.doc-embed .sig-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .4rem; }
.doc-embed .sig-tabs { display: inline-flex; border: 1px solid #DDD4C6; border-radius: 6px; overflow: hidden; }
.doc-embed .sig-tab { font: inherit; font-size: .85rem; padding: .35rem .9rem; border: 0; background: #fff; color: #2E2C29; cursor: pointer; min-height: 36px; }
.doc-embed .sig-tab[aria-pressed="true"] { background: #1F1F1F; color: #fff; }
.doc-embed .sig-canvas { display: block; width: 100%; max-width: 600px; aspect-ratio: 10 / 3; height: auto; border: 1px dashed #6B655C; border-radius: 6px; background: #fff; touch-action: none; cursor: crosshair; }
.doc-embed .sig-row { display: flex; justify-content: space-between; align-items: center; gap: .6rem; margin-top: .35rem; max-width: 600px; }
.doc-embed .sig-row small, .doc-embed .sig-type small { color: #6B655C; }
.doc-embed .sig-typed { font-family: "Brush Script MT", "Segoe Script", "Snell Roundhand", cursive; font-size: 2.2rem; color: #1F1F1F; border-bottom: 1px solid #1F1F1F; padding: .2rem .4rem; max-width: 600px; min-height: 3.4rem; }
.doc-embed .sig-img { display: block; max-width: 260px; max-height: 80px; margin-top: .5rem; background: #fff; border-radius: 4px; }
/* Menu ⋮ do card de estimate */
.ec-more { margin-left: auto; width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--rule); border-radius: 6px; background: var(--surface); color: var(--text); font-size: 1.1rem; line-height: 1; cursor: pointer; }
.ec-more:hover, .ec-more[aria-expanded="true"] { background: var(--tint); }
.ec-more:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; }
.am-item { display: flex; flex-direction: column; gap: .05rem; }
.am-item[disabled] { cursor: not-allowed; }
.am-item[disabled] .am-label { color: var(--muted); }
.am-hint { font-size: .76rem; color: var(--muted); line-height: 1.3; }
.am-danger .am-label { color: var(--danger); }
.am-menu { max-height: calc(100vh - 16px); overflow-y: auto; }
.am-item.am-danger[disabled], .am-item.am-danger[disabled] .am-label, .am-item.am-danger[disabled] .am-hint { color: var(--muted); font-weight: 400; }
.am-item[disabled]:hover { background: none; }

/* ===== Calendário ===== */
.cal-page { max-width: none; }
.cal-layout { display: grid; grid-template-columns: 330px 1fr; gap: 0; border: 1px solid var(--rule); border-radius: 12px; overflow: hidden; background: var(--surface); min-height: 70vh; }
.cal-side { padding: 1.25rem 1rem; border-right: 1px solid var(--rule); }
.cal-mhead { display: flex; align-items: center; justify-content: space-between; margin-bottom: .75rem; }
.cal-mhead h2 { font-size: 1.15rem; margin: 0; text-transform: capitalize; }
.cal-arrows { display: flex; gap: .25rem; }
.cal-arrow, .cal-arrow-btn { min-width: 34px; height: 34px; border: 0; background: none; font-size: 1.4rem; line-height: 1; color: var(--text); cursor: pointer; border-radius: 6px; }
.cal-arrow-btn { border: 1px solid var(--rule); font-size: 1.2rem; }
.cal-arrow:hover, .cal-arrow-btn:hover { background: var(--tint); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); row-gap: .35rem; text-align: center; }
.cal-dow { font-size: .78rem; font-weight: 600; color: var(--muted); padding-bottom: .25rem; }
.cal-d { position: relative; justify-self: center; width: 38px; height: 38px; border-radius: 50%; border: 2px solid transparent; background: none; font: inherit; color: var(--text); cursor: pointer; display: grid; place-items: center; }
.cal-d:hover { background: var(--tint); }
.cal-d.out { color: var(--muted); opacity: .7; }
.cal-d.today { border-color: var(--danger); }
.cal-d.sel { background: var(--graphite); color: #fff; border-color: var(--graphite); }
.cal-d:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; }
.cal-dot { position: absolute; bottom: 3px; left: 50%; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: var(--copper); }
.cal-d.sel .cal-dot { background: #fff; }
.cal-count { margin: 1rem 0 .5rem; padding-bottom: .75rem; border-bottom: 1px solid var(--rule); font-weight: 600; font-size: .9rem; color: var(--muted); text-transform: capitalize; }
.cal-types summary { cursor: pointer; font-size: .78rem; font-weight: 700; letter-spacing: .06em; color: var(--muted); padding: .4rem 0; }
.cal-types ul { list-style: none; margin: .25rem 0 0; padding: 0; display: grid; gap: .45rem; }
.cal-types label { display: flex; align-items: center; gap: .5rem; cursor: pointer; }
.cal-sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.cal-main { padding: 1.25rem 1.5rem; background: #FAF8F5; min-width: 0; }
.cal-top { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.cal-title { display: flex; align-items: baseline; gap: .6rem; }
.cal-title h2 { margin: 0; font-size: 1.35rem; }
.cal-actions { margin-left: auto; display: flex; gap: .5rem; }
.seg { display: inline-flex; border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; padding: .5rem 1.1rem; font: inherit; font-weight: 600; cursor: pointer; color: var(--text); }
.seg button + button { border-left: 1px solid var(--rule); }
.seg button.on { background: var(--graphite); color: #fff; }
.seg button:focus-visible { outline: 3px solid var(--link); outline-offset: -3px; }
.cal-create { position: relative; }
.cal-create summary { list-style: none; cursor: pointer; }
.cal-create summary::-webkit-details-marker { display: none; }
.cal-create .ec-menu-list { right: 0; left: auto; }
.cal-tools { display: flex; align-items: center; gap: .5rem; margin: 1rem 0; }
.cal-spacer { flex: 1; }
.cal-totals { display: grid; grid-template-columns: auto auto; gap: 0 .5rem; margin: 0; font-size: .85rem; text-align: right; }
.cal-totals dt { color: var(--muted); }
.cal-totals dd { margin: 0; font-weight: 700; }
/* tempo */
.wx { display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; padding: 1rem 1.25rem; border: 1px solid var(--rule); border-radius: 12px; margin-bottom: 1rem;
  background: linear-gradient(90deg, #fff 45%, #E9EDF2); }
.wx-sun, .wx-partly { background: linear-gradient(90deg, #fff 45%, #FBF0DC); }
.wx-place { display: flex; align-items: center; gap: .35rem; font-weight: 600; }
.wx-place svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.wx-icon svg { width: 42px; height: 42px; fill: none; stroke: #7E8A99; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.wx-sun .wx-icon svg, .wx-partly .wx-icon svg { stroke: #C98556; }
.wx-temp { font-size: 2.4rem; line-height: 1; }
.wx-desc { display: grid; }
.wx-desc small, .wx-stat small { color: var(--muted); }
.wx-stat { display: grid; text-align: center; padding-left: 1.25rem; border-left: 1px solid var(--rule); }
/* google */
.gcal { border: 1px solid var(--rule); border-radius: 12px; background: var(--surface); margin-bottom: 1rem; }
.gcal > summary, .gcal-off { display: flex; align-items: center; gap: .9rem; padding: .9rem 1.1rem; cursor: pointer; list-style: none; }
.gcal-off { cursor: default; }
.gcal summary::-webkit-details-marker { display: none; }
.gcal summary div, .gcal-off div { display: grid; }
.gcal-ic { width: 44px; height: 44px; border-radius: 10px; background: #EAF0FB; display: grid; place-items: center; }
.gcal-ic svg { width: 22px; height: 22px; fill: none; stroke: #4A6FB5; stroke-width: 1.8; }
.gcal-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.gcal-list li { display: flex; justify-content: space-between; gap: 1rem; padding: .75rem 1.1rem; border-left: 4px solid #6C8CD5; font-weight: 600; }
.gcal-time { color: #3E5FA8; background: #EAF0FB; border-radius: 6px; padding: .1rem .5rem; font-weight: 500; white-space: nowrap; }
/* itens */
.cal-c-job { --c: var(--copper); } .cal-c-task { --c: #3F6B4A; } .cal-c-fu { --c: #8A6AB3; } .cal-c-google { --c: #6C8CD5; }
.cal-sw.cal-c-job, .cal-sw.cal-c-task, .cal-sw.cal-c-fu, .cal-sw.cal-c-google { background: var(--c); }
.cal-list { display: grid; gap: .6rem; }
.cal-item { display: flex; justify-content: space-between; gap: 1rem; padding: .9rem 1.1rem; background: var(--surface); border: 1px solid var(--rule); border-left: 4px solid var(--c);
  border-radius: 10px; color: var(--text); text-decoration: none; }
.cal-item:hover { box-shadow: 0 4px 14px rgba(31,31,31,.08); }
.cal-item:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; }
.cal-item.done { opacity: .65; }
.cal-item-main { display: grid; gap: .15rem; min-width: 0; }
.cal-item-side { display: grid; justify-items: end; gap: .25rem; text-align: right; }
.cal-time { font-weight: 700; }
.cal-empty { display: grid; place-items: center; min-height: 240px; background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; color: var(--text); font-size: 1.05rem; }
.cal-chip { display: block; padding: .2rem .45rem; margin-top: .25rem; font-size: .78rem; border-radius: 5px; border-left: 3px solid var(--c);
  background: color-mix(in srgb, var(--c) 12%, #fff); color: var(--text); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--rule); border-radius: 12px; overflow: hidden; background: var(--surface); }
.cal-wcol { min-height: 320px; border-left: 1px solid var(--rule); }
.cal-wcol:first-child { border-left: 0; }
.cal-wcol.sel { background: #FBF8F4; }
.cal-whead { width: 100%; display: grid; justify-items: center; padding: .55rem 0; border: 0; border-bottom: 1px solid var(--rule); background: none; font: inherit; cursor: pointer; color: var(--text); }
.cal-whead strong { font-size: 1.2rem; }
.cal-wcol.today .cal-whead strong { color: var(--danger); }
.cal-wbody { padding: .35rem; }
.cal-none { display: block; text-align: center; margin-top: .5rem; }
.cal-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--rule); border-radius: 12px; overflow: hidden; background: var(--surface); }
.cal-mdow { padding: .5rem; font-size: .78rem; font-weight: 700; color: var(--muted); text-align: center; border-bottom: 1px solid var(--rule); }
.cal-mcell { min-height: 104px; padding: .3rem; border-top: 1px solid var(--rule); border-left: 1px solid var(--rule); min-width: 0; }
.cal-mcell:nth-child(7n + 1) { border-left: 0; }
.cal-mcell.out { background: #FAF8F5; }
.cal-mcell.out .cal-mnum { color: var(--muted); }
.cal-mnum { border: 0; background: none; font: inherit; font-weight: 600; cursor: pointer; width: 28px; height: 28px; border-radius: 50%; color: var(--text); }
.cal-mcell.today .cal-mnum { background: var(--danger); color: #fff; }
.cal-more { border: 0; background: none; font-size: .76rem; color: var(--link); cursor: pointer; padding: .2rem .3rem; }
@media (max-width: 900px) {
  .cal-layout { grid-template-columns: 1fr; }
  .cal-side { border-right: 0; border-bottom: 1px solid var(--rule); }
  .cal-main { padding: 1rem; }
  .wx-stat { padding-left: .75rem; }
  .cal-week { grid-template-columns: 1fr; }
  .cal-wcol { min-height: 0; border-left: 0; border-top: 1px solid var(--rule); }
  .cal-whead { grid-auto-flow: column; justify-content: start; gap: .5rem; padding-left: .75rem; }
  .cal-mcell { min-height: 64px; }
  .cal-chip { font-size: .7rem; }
}

/* Barra de atalhos no modelo do QuoteIQ: cápsula clara centralizada, aba ativa branca com ícone em cobre */
@media (min-width: 901px) {
  .topbar { justify-content: center; min-height: 72px; border-bottom: 0; background: rgba(255, 255, 255, .96); }
  .shortcuts { margin: 0 auto; gap: .2rem; padding: .35rem; background: #F2EFEB; border-radius: 16px; }
  .shortcut { min-height: 44px; padding: 0 1.1rem; border-radius: 12px; font-size: 1rem; font-weight: 500; color: #6B655C; }
  .shortcut svg { width: 19px; height: 19px; stroke: #8A837A; }
  .shortcut:hover { background: rgba(255, 255, 255, .6); color: var(--text); }
  .shortcut[aria-current="page"] { background: #FFFFFF; color: var(--heading); font-weight: 600; box-shadow: 0 1px 3px rgba(31, 31, 31, .12); }
  .shortcut[aria-current="page"] svg { stroke: var(--copper); }
}

/* YTD Sales */
.ytd-card { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem 1.3rem; }
.ytd-card header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.ytd-card h2 { display: flex; align-items: center; gap: .5rem; margin: 0; font-size: 1.15rem; }
.ytd-card h2 .kpi-icon { width: 22px; height: 22px; }
.ytd-body { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: .6rem; }
.ytd-value { display: block; font-size: clamp(2rem, 4vw, 2.8rem); line-height: 1.1; color: var(--heading); letter-spacing: -.01em; }
.ytd-delta { margin: .35rem 0 0; color: var(--muted); }
.ytd-delta .is-up { color: var(--ok); font-weight: 700; } .ytd-delta .is-down { color: var(--danger); font-weight: 700; }
.ytd-chart { display: inline-flex; align-items: center; gap: .4rem; background: #F6E9DE; border-color: #EBD3BF; color: #7A4526; }
.ytd-chart .kpi-icon { width: 18px; height: 18px; }
/* Cursor do gráfico de receita */
.chart-hover { cursor: crosshair; touch-action: pan-y; }
.chart-hover:focus-visible { outline: 3px solid var(--link); outline-offset: 4px; border-radius: 6px; }
.ch-hit { fill: transparent; }
.ch-cursor { stroke: #8A837A; stroke-width: 1; stroke-dasharray: 3 3; }
.ch-dot { fill: #fff; stroke: var(--copper); stroke-width: 2.5; }
.ch-tip-bg { fill: #fff; stroke: var(--rule); filter: drop-shadow(0 2px 4px rgba(31,31,31,.12)); }
.ch-tip-date { font-size: 11px; fill: var(--muted); }
.ch-tip-val { font-size: 13px; font-weight: 700; fill: var(--heading); }
/* Cabeçalho e tabela no modelo do QuoteIQ */
.doc-embed .doc-head-q { display: flex; justify-content: space-between; align-items: flex-start; gap: 2rem; padding-bottom: 1.6rem; border-bottom: 0; }
.doc-embed .doc-head-q .doc-company { display: grid; gap: .1rem; font-size: .88rem; color: #2E2C29; }
.doc-embed .doc-kind { margin: 0 0 .35rem; font-size: 2.1rem; line-height: 1; letter-spacing: .01em; font-weight: 700; color: #1F1F1F; }
.doc-embed .doc-co-name { font-size: .98rem; letter-spacing: .02em; color: #1F1F1F; }
.doc-embed .doc-co-addr { font-size: .95rem; }
.doc-embed .doc-head-q .lic { color: #6B655C; font-size: .78rem; margin-top: .2rem; }
.doc-embed .doc-head-q .doc-logo { max-width: 120px; max-height: 90px; object-fit: contain; }
.doc-embed .doc-mark { display: grid; justify-items: center; gap: .2rem; color: #A0683F; }
.doc-embed .doc-mark b { display: grid; place-items: center; width: 52px; height: 56px; border: 2px solid currentColor; font-size: 1.6rem; font-weight: 600; }
.doc-embed .doc-mark small { font-size: .7rem; letter-spacing: .25em; color: #2E2C29; }
.doc-embed .doc-parties-q { display: grid; grid-template-columns: 1fr minmax(240px, 300px); gap: 2rem; padding: 1.2rem 0 1.4rem; border-top: 0; border-bottom: 0; }
.doc-embed .doc-parties-q > div { display: grid; gap: .12rem; align-content: start; font-size: .86rem; }
.doc-embed .doc-sub { margin: 0 0 .55rem; font-size: .95rem; font-weight: 500; color: #6B655C; }
.doc-embed .doc-dl { display: grid; grid-template-columns: auto 1fr; gap: .3rem 1rem; margin: 0; }
.doc-embed .doc-dl dt { font-weight: 600; color: #1F1F1F; }
.doc-embed .doc-dl dd { margin: 0; text-align: right; }
.doc-embed .doc-status { display: inline-block; padding: .05rem .5rem; border-radius: 4px; font-size: .82rem; }
.doc-embed .st-pending { background: #FBE4E1; color: #A23E2C; } .doc-embed .st-accepted { background: #E1EBDF; color: #3F6B4A; }
.doc-embed .st-declined, .doc-embed .st-expired, .doc-embed .st-superseded { background: #EFEBE6; color: #6B655C; }
.doc-embed .doc-title { font-size: 1.2rem; margin: .4rem 0 .6rem; }
.doc-embed .doc-table th { background: #F3F1EE; border-top: 1px solid #DDD4C6; border-bottom: 1px solid #DDD4C6; padding: .55rem .7rem; font-size: .72rem; letter-spacing: .08em; color: #6B655C; }
.doc-embed .doc-table td { padding: .75rem .7rem; vertical-align: top; }
.doc-embed .doc-table .desc { display: block; font-weight: 600; color: #1F1F1F; }
.doc-embed .doc-table .desc-more { display: block; white-space: pre-line; color: #4A4640; font-size: .86rem; line-height: 1.5; margin-top: .25rem; }
.doc-embed .doc-table.is-simple .c-amt { width: 9rem; font-weight: 500; }
@media (max-width: 640px) { .doc-embed .doc-head-q { flex-direction: column-reverse; gap: 1rem; } .doc-embed .doc-parties-q { grid-template-columns: 1fr; gap: 1rem; } }

/* Email form */
.dialog-email { width: min(640px, 96vw); }
.em-who { display: flex; align-items: center; gap: .8rem; padding: .7rem .9rem; border: 1px solid var(--rule); border-radius: 10px; margin-bottom: 1rem; }
.em-who > span:nth-child(2) { display: grid; flex: 1; }
.em-who small { font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.em-av { width: 38px; height: 38px; border-radius: 8px; background: var(--tint); display: grid; place-items: center; font-weight: 700; }
.em-amt { background: #F2EFEB; border-radius: 999px; padding: .2rem .7rem; font-weight: 700; }
.em-field { margin-bottom: .85rem; }
.em-field label { display: grid; gap: .35rem; }
.em-lbl { font-size: .74rem; font-weight: 700; letter-spacing: .1em; border-left: 3px solid var(--graphite); padding-left: .45rem; }
.em-lbl small { font-weight: 400; letter-spacing: 0; color: var(--muted); font-size: .78rem; }
.em-field input, .em-field textarea { width: 100%; padding: .65rem .75rem; border: 1px solid var(--input-border); border-radius: 8px; font: inherit; background: #FAF8F5; }
.em-field textarea { line-height: 1.5; resize: vertical; }
.em-switch { display: flex; justify-content: space-between; align-items: center; padding: .7rem .9rem; border: 1px solid var(--rule); border-radius: 10px; margin-bottom: .85rem; font-weight: 600; cursor: pointer; }
.em-switch input { width: 40px; height: 22px; accent-color: var(--graphite); }
.em-link { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin: -.2rem 0 .6rem; }
.em-link .muted { flex: 1; }
.em-choice { border: 1px solid var(--rule); border-radius: 12px; padding: .6rem; margin-bottom: .75rem; box-shadow: 0 6px 20px rgba(31,31,31,.1); }
.em-choice-title { display: grid; margin: .1rem .4rem .5rem; }
.em-opt { display: flex; align-items: center; gap: .8rem; width: 100%; text-align: left; padding: .7rem .6rem; border: 0; border-top: 1px solid var(--rule); background: none; font: inherit; color: var(--text); cursor: pointer; border-radius: 6px; }
.em-opt:hover:not([disabled]) { background: var(--tint); }
.em-opt[disabled] { cursor: not-allowed; opacity: .55; }
.em-opt > span:nth-child(2) { display: grid; flex: 1; }
.em-opt small { color: var(--muted); }
.em-opt-ic { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: #ECEEF5; font-size: 1.1rem; }
.em-opt-ic.ok { background: var(--ok-bg); color: var(--ok); }
.btn-danger-ghost { color: var(--danger); border-color: #E8B9AF; background: #fff; }
.em-switch input { appearance: none; width: 42px; height: 24px; border-radius: 999px; background: #D6CFC4; position: relative; cursor: pointer; transition: background .15s; }
.em-switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; }
.em-switch input:checked { background: var(--graphite); }
.em-switch input:checked::after { transform: translateX(18px); }
.em-switch input:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; }
