/* =====================================================================
   Spinelli & Andrade — identidade visual do sistema
   Azul-marinho + dourado, como no papel timbrado.
   ===================================================================== */
:root {
  --navy: #0B2559;
  --navy-2: #13306B;
  --navy-3: #1C3C7C;
  --gold: #A8904F;
  --gold-dark: #8C7638;
  --gold-light: #F0E4C3;
  --champagne: #E3D3AE;
  --paper: #FBF8F1;
  --white: #FFFFFF;
  --ink: #1D2433;
  --ink-2: #4A5468;
  --ink-3: #7A8396;
  --line: #E7E1D3;
  --line-2: #F1ECE1;
  --ok: #2F7D5B;
  --ok-bg: #E6F2EC;
  --warn: #9A6A12;
  --warn-bg: #FBF0D9;
  --danger: #B3362D;
  --danger-bg: #FBE7E5;
  --blue: #2F5BA8;
  --blue-bg: #E7EEFA;
  --prev: #A8904F;
  --civel: #3E5C9A;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(11, 37, 89, .06), 0 2px 8px rgba(11, 37, 89, .05);
  --font: 'Montserrat', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --serif: 'Cinzel', 'Times New Roman', serif;
  --gold-grad: linear-gradient(100deg, #A8904F 0%, #D9C48F 35%, #F3E6C4 50%, #C9AF6E 70%, #A8904F 100%);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--ink); background: var(--paper); -webkit-font-smoothing: antialiased; }
a { color: var(--navy-3); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
p { margin: 0 0 .5em; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--ink); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; letter-spacing: .01em; }
.muted { color: var(--ink-3); }
.small { font-size: 12px; }
.pad { padding: 14px 18px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.danger-txt { color: var(--danger) !important; }
.ok-txt { color: var(--ok); }
.hint { display: block; color: var(--ink-3); font-size: 12px; margin-top: 6px; }
.ic { width: 18px; height: 18px; flex: none; }
.only-mobile { display: none !important; }
.print-only { display: none; }

.boot { min-height: 100vh; display: grid; place-content: center; text-align: center; background: var(--navy); color: var(--champagne); }
.boot img { width: 72px; margin: 0 auto 12px; opacity: .9; }

/* ---------- Login ---------- */
.is-login { background: var(--navy); }
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: radial-gradient(1200px 600px at 20% 30%, #14326F 0%, var(--navy) 60%); }
.login-brand { display: grid; place-items: center; padding: 40px; }
.login-logo { width: min(440px, 80%); height: auto; }
.login-card { align-self: center; justify-self: center; width: min(420px, 92%); background: var(--white); border-radius: 16px; padding: 36px 32px; box-shadow: 0 20px 60px rgba(0, 0, 0, .35); border-top: 3px solid var(--gold); }
.login-card h1 { font-family: var(--serif); font-weight: 600; color: var(--navy); font-size: 26px; margin-bottom: 6px; }
.login-users { display: grid; gap: 10px; margin: 18px 0; }
.login-user { display: flex; gap: 12px; align-items: center; text-align: left; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--white); transition: .15s; }
.login-user:hover { border-color: var(--gold); background: #FFFCF4; }
.login-user span { display: flex; flex-direction: column; }
.login-user small { color: var(--ink-3); }
.login-note { font-size: 12px; color: var(--ink-3); border-top: 1px solid var(--line); padding-top: 14px; margin: 0; }
.form-error { color: var(--danger); background: var(--danger-bg); padding: 8px 12px; border-radius: 8px; font-size: 13px; }
.link-btn { background: none; border: 0; padding: 0 2px; color: var(--navy-3); font-size: 12.5px; text-decoration: underline; text-underline-offset: 2px; }
.link-btn:hover { color: var(--gold-dark); }
.btn-block { width: 100%; justify-content: center; }
#login-form { display: grid; gap: 14px; margin-top: 18px; }

/* ---------- Estrutura ---------- */
#app { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 236px; background: var(--navy); color: var(--champagne); display: flex; flex-direction: column; z-index: 30; }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 20px 18px 18px; border-bottom: 1px solid rgba(227, 211, 174, .14); }
.side-brand img { width: 40px; height: 40px; object-fit: contain; }
.side-brand strong { display: block; font-family: var(--serif); font-weight: 600; font-size: 15px; letter-spacing: .02em; color: var(--champagne); }
.side-brand span { display: block; font-size: 9.5px; letter-spacing: .42em; text-transform: uppercase; color: #C9B98F; }
.side-nav { display: flex; flex-direction: column; gap: 2px; padding: 14px 10px; flex: 1; overflow-y: auto; }
.side-link { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px; color: #D9CCAA; font-weight: 500; position: relative; }
.side-link:hover { background: rgba(255, 255, 255, .06); text-decoration: none; color: #F3E8CC; }
.side-link.active { background: rgba(168, 144, 79, .16); color: #F6ECD2; }
.side-link.active::before { content: ''; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--gold-grad); }
.side-count { margin-left: auto; font-size: 11px; font-weight: 700; color: var(--navy); background: var(--champagne); border-radius: 10px; padding: 0 7px; line-height: 18px; }
.side-count:empty { display: none; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 14px 14px; border-top: 1px solid rgba(227, 211, 174, .14); }
.side-user div { flex: 1; min-width: 0; }
.side-user strong { display: block; font-size: 13px; color: #F3E8CC; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user small { color: #B6A87F; font-size: 11px; }
.side-user .icon-btn { color: #D9CCAA; }
.main-wrap { margin-left: 236px; min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 12px 28px; background: rgba(251, 248, 241, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.view { padding: 24px 28px 60px; max-width: 1400px; outline: none; }
.scrim { display: none; }

.search { position: relative; flex: 1; max-width: 520px; display: flex; align-items: center; gap: 8px; background: var(--white); border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; color: var(--ink-3); }
.search input { border: 0; outline: 0; flex: 1; padding: 9px 0; background: transparent; }
.search:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(168, 144, 79, .15); }
.search-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--white); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(11, 37, 89, .14); padding: 6px; max-height: 420px; overflow: auto; }
.sr-group { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); padding: 8px 10px 4px; }
.sr-item { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 8px; color: var(--ink); }
.sr-item:hover { background: var(--paper); }
.sr-item span { display: flex; flex-direction: column; }
.sr-item small { color: var(--ink-3); }
.sr-empty { padding: 12px; color: var(--ink-3); }
.area-switch { display: flex; background: var(--white); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.area-switch button { border: 0; background: none; padding: 6px 12px; border-radius: 7px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.area-switch button.on { background: var(--navy); color: var(--champagne); }
.demo-pill { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--warn); background: var(--warn-bg); border: 1px solid #EED9A8; border-radius: 20px; padding: 4px 10px; }

/* ---------- Botões ---------- */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 9px; border: 1px solid var(--line); background: var(--white); font-weight: 600; font-size: 13px; color: var(--ink); transition: .12s; white-space: nowrap; text-decoration: none !important; }
.btn:hover { border-color: #CDBF9C; background: #FFFDF8; }
.btn:disabled { opacity: .6; cursor: default; }
.btn .ic { width: 16px; height: 16px; }
.btn-primary { background: var(--navy); border-color: var(--navy); color: #F6ECD2; }
.btn-primary:hover { background: var(--navy-2); border-color: var(--navy-2); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #962A22; border-color: #962A22; }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; border: 0; background: none; color: var(--ink-2); }
.icon-btn:hover { background: rgba(11, 37, 89, .06); }
.icon-btn.flip .ic { transform: rotate(180deg); }
.back { display: inline-flex; align-items: center; gap: 4px; background: none; border: 0; color: var(--ink-3); font-weight: 600; font-size: 12.5px; padding: 0; margin-bottom: 10px; }
.back:hover { color: var(--navy); }

/* ---------- Cabeçalho de página ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-family: var(--serif); font-weight: 600; font-size: 26px; color: var(--navy); letter-spacing: .01em; }
.page-head p { margin: 4px 0 0; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.eyebrow { display: flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--gold-dark); margin-bottom: 4px; }

/* ---------- Cartões ---------- */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; overflow: hidden; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.card-head h2 { display: flex; align-items: center; gap: 8px; font-size: 14.5px; font-weight: 700; color: var(--navy); }
.card-head h2 .ic { color: var(--gold); }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--line-2); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center; }
.card > .pad h3, .card.pad h3 { font-size: 13.5px; color: var(--navy); margin: 8px 0; }
.card.pad h2 { font-size: 16px; color: var(--navy); margin-bottom: 8px; }
.sub { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); padding: 12px 18px 4px; }
.link { font-size: 12.5px; font-weight: 600; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.cols-wide-left { grid-template-columns: 1.45fr 1fr; }
.stack > .card:last-child { margin-bottom: 0; }
.stack { display: flex; flex-direction: column; gap: 0; }
.cols > .card, .cols > .stack { margin-bottom: 0; }
.cols .stack .card { margin-bottom: 16px; }

/* ---------- Indicadores ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); border-top: 3px solid var(--line); }
.kpi strong { display: block; font-size: 26px; font-weight: 700; color: var(--navy); line-height: 1.2; margin: 2px 0; font-variant-numeric: tabular-nums; }
.kpi small { color: var(--ink-3); font-size: 12px; }
.kpi-label { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }
.kpi-danger { border-top-color: var(--danger); } .kpi-danger strong { color: var(--danger); }
.kpi-warn { border-top-color: #D9A93A; }
.kpi-ok { border-top-color: var(--ok); }
.kpi-gold { border-top-color: var(--gold); }

.meta { padding: 18px 20px; }
.meta-top { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 14px; }
.meta-val { display: block; font-size: 30px; font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; }
.meta-side { display: flex; gap: 32px; }
.meta-side strong { display: block; font-size: 18px; color: var(--navy); font-variant-numeric: tabular-nums; }
.bar { position: relative; height: 12px; background: var(--line-2); border-radius: 8px; overflow: hidden; }
.bar span { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 8px; }
.bar-proj { background: var(--gold-light); }
.bar-done { background: var(--gold-grad); }
.bar-legend { display: flex; gap: 18px; margin-top: 8px; font-size: 12px; color: var(--ink-3); flex-wrap: wrap; }
.bar-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.lg-done { background: var(--gold); } .lg-proj { background: var(--gold-light); }

/* ---------- Compromissos ---------- */
.comp-list { list-style: none; margin: 0; padding: 4px 0; }
.comp { display: flex; align-items: center; gap: 12px; padding: 9px 18px; border-left: 3px solid transparent; }
.comp + .comp { border-top: 1px solid var(--line-2); }
.comp.late { border-left-color: var(--danger); background: #FFF8F7; }
.comp.today { border-left-color: #D9A93A; }
.comp.soon { border-left-color: var(--gold-light); }
.comp.done { opacity: .6; }
.comp.done .comp-title span { text-decoration: line-through; }
.comp.fatal:not(.done) .comp-title span { font-weight: 700; }
.tick { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid #C9C1AE; background: var(--white); display: grid; place-items: center; color: transparent; padding: 0; }
.tick .ic { width: 14px; height: 14px; }
.tick:hover { border-color: var(--ok); color: var(--ok); }
.tick.on { background: var(--ok); border-color: var(--ok); color: #fff; }
.comp-date { flex: none; width: 54px; display: flex; flex-direction: column; line-height: 1.2; }
.comp-date strong { font-size: 13px; color: var(--navy); font-variant-numeric: tabular-nums; }
.comp-date small { font-size: 11px; color: var(--ink-3); }
.comp-main { flex: 1; min-width: 0; cursor: pointer; }
.comp-title { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.comp-title span:last-child { font-weight: 500; }
.comp-meta { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--ink-3); margin-top: 1px; }
.late-txt { color: var(--danger); font-weight: 600; }

/* ---------- Etiquetas ---------- */
.badge { display: inline-flex; align-items: center; font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 20px; background: var(--line-2); color: var(--ink-2); white-space: nowrap; line-height: 18px; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-gold { background: #F6EDD3; color: #7A6223; }
.badge-blue { background: var(--blue-bg); color: var(--blue); }
.badge-tag { background: #EEF0F5; color: #4A5468; font-weight: 500; }
.badge-tipo-prazo { background: var(--danger-bg); color: var(--danger); }
.badge-tipo-audiencia { background: #EDE7F6; color: #5B3F99; }
.badge-tipo-pericia { background: #E3F1F4; color: #23707E; }
.badge-tipo-reuniao { background: var(--blue-bg); color: var(--blue); }
.badge-tipo-tarefa { background: #EEF0F5; color: #4A5468; }
.avatar { flex: none; display: inline-grid; place-items: center; border-radius: 50%; background: var(--c, var(--gold)); color: #fff; font-weight: 700; letter-spacing: .02em; }
.avatar-sm { width: 26px; height: 26px; font-size: 10.5px; }
.avatar-md { width: 36px; height: 36px; font-size: 13px; }
.area-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); margin-right: 8px; vertical-align: 1px; flex: none; }
.area-dot[data-area="Previdenciário"] { background: var(--prev); }
.area-dot[data-area="Cível"] { background: var(--civel); }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; margin-top: 5px; }
.dot-red { background: var(--danger); } .dot-amber { background: #D9A93A; }

/* ---------- Listas do painel ---------- */
.mov-list, .attn, .case-list { list-style: none; margin: 0; padding: 4px 0; }
.mov-item, .attn button, .case-item { display: flex; gap: 12px; align-items: flex-start; width: 100%; text-align: left; background: none; border: 0; padding: 9px 18px; }
.mov-item:hover, .attn button:hover, .case-item:hover { background: var(--paper); }
.mov-item > span:last-child, .attn button > span:last-child, .case-item .grow { display: flex; flex-direction: column; align-items: flex-start; }
.mov-item small, .attn small, .case-item small { color: var(--ink-3); font-size: 12px; }
.mov-date { font-weight: 600; color: var(--navy); font-size: 12.5px; min-width: 40px; font-variant-numeric: tabular-nums; }
.case-item { align-items: center; }
.case-item .grow { flex: 1; }
li + li > .mov-item, li + li > button { border-top: 1px solid var(--line-2); }

/* ---------- Tabelas ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar-in { margin: 0; }
.toolbar select, .toolbar input[type=search] { padding: 7px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--white); font-size: 13px; }
.search-inline { display: flex; align-items: center; gap: 8px; background: var(--white); border: 1px solid var(--line); border-radius: 9px; padding: 0 10px; color: var(--ink-3); flex: 1; min-width: 220px; max-width: 420px; }
.search-inline input { border: 0 !important; outline: 0; padding: 7px 0 !important; flex: 1; background: none !important; }
.seg { display: inline-flex; background: var(--white); border: 1px solid var(--line); border-radius: 9px; padding: 2px; margin-left: auto; }
.seg button { display: inline-flex; gap: 6px; align-items: center; border: 0; background: none; padding: 5px 9px; border-radius: 7px; color: var(--ink-2); font-size: 12.5px; font-weight: 600; }
.seg button.on { background: var(--navy); color: var(--champagne); }
.seg .ic { width: 16px; height: 16px; }
.table-wrap { overflow-x: auto; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card .table-wrap { border: 0; border-radius: 0; box-shadow: none; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); padding: 10px 14px; border-bottom: 1px solid var(--line); background: #FDFBF6; white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table-sm td { padding: 8px 14px; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row-link { cursor: pointer; }
.row-link:hover td { background: #FFFCF4; }
.who { display: flex; gap: 10px; align-items: center; }
.who span { display: flex; flex-direction: column; }
.who small { color: var(--ink-3); }

/* ---------- Abas ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 10px 14px; font-weight: 600; font-size: 13px; color: var(--ink-3); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.tabs button:hover { color: var(--navy); }
.tabs button.on { color: var(--navy); border-bottom-color: var(--gold); }
.tabs b { font-size: 10.5px; background: var(--line-2); color: var(--ink-2); border-radius: 10px; padding: 0 6px; line-height: 17px; }
.tabs b.tab-new { background: var(--gold); color: #fff; }

/* ---------- Ficha-resumo ---------- */
.alert { display: flex; gap: 10px; align-items: flex-start; background: var(--warn-bg); border: 1px solid #EED9A8; color: #6E4C0D; padding: 10px 14px; border-radius: var(--radius); margin-bottom: 16px; font-size: 13px; }
.alert .ic { color: var(--warn); margin-top: 1px; }
.ficha-block { padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.ficha-block:last-child { border-bottom: 0; }
.ficha-block h3 { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--gold-dark); margin-bottom: 8px; }
.ficha-block p { margin-bottom: 4px; }
.editable textarea { width: 100%; padding: 10px; border: 1px solid var(--gold); border-radius: 8px; resize: vertical; }
.editable-view p { display: inline; }
.editable-view .link-btn { margin-left: 6px; }
.row-actions { display: flex; gap: 10px; margin-top: 6px; }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { display: grid; grid-template-columns: 84px 1fr; gap: 12px; padding: 6px 0; position: relative; }
.timeline li > span { font-size: 12px; font-weight: 600; color: var(--navy); font-variant-numeric: tabular-nums; padding-top: 1px; }
.timeline li > div { border-left: 2px solid var(--line); padding-left: 14px; position: relative; }
.timeline li > div::before { content: ''; position: absolute; left: -6px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--white); border: 2px solid var(--gold); }
.timeline-full { padding: 8px 18px 14px; }
.timeline-full li { padding: 10px 0; }
.timeline-full li.is-new > div::before { background: var(--gold); }
.timeline-full p { margin: 4px 0; }
blockquote { margin: 0 0 10px; padding: 8px 12px; border-left: 3px solid var(--gold-light); background: #FDFBF6; border-radius: 0 8px 8px 0; }
blockquote p { margin: 0 0 4px; }
cite { font-size: 12px; color: var(--ink-3); font-style: normal; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; padding: 14px 18px; }
.info > span { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 600; }
.info strong { font-weight: 500; word-break: break-word; }
.info p { margin: 2px 0 0; }
.span-2 { grid-column: span 2; }
.notes { list-style: none; margin: 0; padding: 0 18px 10px; }
.notes li { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line-2); }
.notes p { margin: 0 0 2px; }
.note-form { padding: 14px 18px; display: grid; gap: 10px; justify-items: end; }
.note-form textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; resize: vertical; }
.hon-list { list-style: none; margin: 0; padding: 6px 18px; }
.hon-list li { padding: 8px 0; border-bottom: 1px solid var(--line-2); }
.hon-list small { display: block; color: var(--ink-3); }

/* ---------- Quadro ---------- */
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: flex-start; }
.board-col { flex: 0 0 240px; background: #F3EEE2; border-radius: var(--radius); padding: 8px; min-height: 120px; transition: background .12s; }
.board-col.over { background: #EADFC3; }
.board-col header { display: flex; justify-content: space-between; align-items: center; padding: 4px 6px 8px; font-size: 12px; font-weight: 700; color: var(--navy); }
.board-col header b { font-size: 11px; background: var(--white); border-radius: 10px; padding: 0 7px; color: var(--ink-2); }
.board-cards { display: flex; flex-direction: column; gap: 8px; }
.board-card { background: var(--white); border: 1px solid var(--line); border-radius: 9px; padding: 10px; cursor: grab; box-shadow: var(--shadow); }
.board-card.dragging { opacity: .5; }
.board-card strong { display: block; font-size: 13px; line-height: 1.3; }
.board-card small { color: var(--ink-3); font-size: 12px; }
.board-foot { display: flex; gap: 6px; align-items: center; margin-top: 8px; flex-wrap: wrap; }

/* ---------- Calendário ---------- */
.cal-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line-2); }
.cal-head h2 { font-family: var(--serif); font-size: 18px; color: var(--navy); min-width: 200px; text-align: center; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-dow { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--ink-3); padding: 8px; text-align: center; border-bottom: 1px solid var(--line-2); }
.cal-day { min-height: 104px; border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); padding: 6px; display: flex; flex-direction: column; gap: 3px; cursor: pointer; overflow: hidden; }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day.out { background: #FBFAF6; color: var(--ink-3); }
.cal-day.off { background: #F8F5EC; }
.cal-day.today .cal-num { background: var(--navy); color: var(--champagne); }
.cal-num { font-size: 12px; font-weight: 600; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; }
.cal-fer { font-size: 10px; color: var(--gold-dark); line-height: 1.2; }
.cal-ev { border: 0; text-align: left; font-size: 11px; padding: 2px 6px; border-radius: 5px; background: var(--blue-bg); color: var(--blue); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-ev.ev-prazo { background: var(--danger-bg); color: var(--danger); }
.cal-ev.ev-audiencia { background: #EDE7F6; color: #5B3F99; }
.cal-ev.ev-pericia { background: #E3F1F4; color: #23707E; }
.cal-ev.ev-tarefa { background: #EEF0F5; color: #4A5468; }
.cal-ev.done { text-decoration: line-through; opacity: .55; }
.cal-more { font-size: 11px; color: var(--ink-3); }
.month-nav { display: flex; align-items: center; gap: 6px; }
.month-nav strong { font-family: var(--serif); color: var(--navy); font-size: 16px; min-width: 170px; text-align: center; }

/* ---------- Histórico ---------- */
.act-list { list-style: none; margin: 0; padding: 4px 18px; }
.act { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line-2); }
.act:first-child { border-top: 0; }
.act p { margin: 0; }
.act em { font-style: normal; color: var(--navy-3); font-weight: 500; }
.act-link { cursor: pointer; }
.act-link:hover { background: var(--paper); }
.changes { list-style: none; margin: 4px 0; padding: 6px 10px; background: #FDFBF6; border-radius: 8px; font-size: 12.5px; }
.changes span { color: var(--ink-3); }
.changes s { color: var(--ink-3); }

/* ---------- Configurações ---------- */
.settings { display: grid; grid-template-columns: 220px 1fr; gap: 20px; align-items: start; }
.settings-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 76px; }
.settings-nav button { text-align: left; border: 0; background: none; padding: 9px 12px; border-radius: 8px; font-weight: 600; color: var(--ink-2); font-size: 13px; }
.settings-nav button:hover { background: var(--white); }
.settings-nav button.on { background: var(--white); color: var(--navy); box-shadow: var(--shadow); border-left: 3px solid var(--gold); }
.settings-body textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; font-size: 13px; line-height: 1.6; resize: vertical; }
.area-lists { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; padding: 0 18px 14px; }
.perm-list { padding-left: 18px; margin: 6px 0; }
.perm-list li { margin-bottom: 6px; }
code { background: var(--line-2); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.steps { padding-left: 20px; line-height: 1.7; }

/* ---------- Formulários e janelas ---------- */
.modal-wrap { position: fixed; inset: 0; background: rgba(11, 22, 48, .45); z-index: 100; display: grid; place-items: start center; padding: 6vh 16px; overflow-y: auto; animation: fade .12s; }
.modal { background: var(--white); border-radius: 14px; width: min(560px, 100%); box-shadow: 0 24px 80px rgba(0, 0, 0, .3); border-top: 3px solid var(--gold); }
.modal-wide { width: min(820px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line-2); }
.modal-head h2 { font-family: var(--serif); font-size: 19px; font-weight: 600; color: var(--navy); }
.modal-body { padding: 18px 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line-2); background: #FDFBF6; border-radius: 0 0 14px 14px; }
.confirm-msg { font-size: 14.5px; margin: 0; }
@keyframes fade { from { opacity: 0; } }
.grid-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.form-section { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--gold-dark); margin: 8px 0 -4px; padding-top: 10px; border-top: 1px solid var(--line-2); }
.form-section:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field input, .field select, .field textarea { width: 100%; padding: 9px 11px; border: 1px solid #DCD5C4; border-radius: 9px; background: var(--white); transition: .12s; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 0; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(168, 144, 79, .16); }
.field textarea { resize: vertical; }
.req { color: var(--danger); }
.field-check { justify-content: center; }
.check { display: inline-flex; gap: 8px; align-items: center; font-size: 13px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--navy); }
.chips-select { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-opt input { position: absolute; opacity: 0; pointer-events: none; }
.chip-opt span { display: inline-block; padding: 5px 11px; border: 1px solid var(--line); border-radius: 20px; font-size: 12.5px; cursor: pointer; background: var(--white); }
.chip-opt input:checked + span { background: var(--navy); color: var(--champagne); border-color: var(--navy); }
.chip-opt input:focus-visible + span { outline: 2px solid var(--gold); }
.calc { background: #FDFBF6; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; }
.calc summary { font-weight: 600; cursor: pointer; color: var(--navy); font-size: 13px; }
.calc-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-top: 10px; }
.calc-row label:not(.check) { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.calc-row input[type=date], .calc-row input[type=number] { padding: 7px 9px; border: 1px solid #DCD5C4; border-radius: 8px; }
.calc-row input[type=number] { width: 80px; }
.empty { text-align: center; padding: 48px 20px; color: var(--ink-2); background: var(--white); border: 1px dashed #DCD5C4; border-radius: var(--radius); }
.empty p { margin-bottom: 12px; }

#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--navy); color: #F6ECD2; padding: 10px 18px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); font-size: 13.5px; font-weight: 500; transition: .4s; border-left: 3px solid var(--gold); max-width: 90vw; }
.toast-err { background: var(--danger); color: #fff; border-left-color: #fff; }
.toast.out { opacity: 0; transform: translateY(8px); }


/* ---------- Fase 2: comercial ---------- */
.funnel .board-col { flex: 1 1 0; min-width: 168px; }
.board-col header .step { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--navy); color: var(--champagne); font-size: 10px; margin-right: 6px; }
.lead[draggable="false"] { cursor: pointer; opacity: .85; }
.steps-bar { list-style: none; display: flex; gap: 4px; padding: 0; margin: 0 0 16px; overflow-x: auto; }
.steps-bar li { flex: 1; min-width: 110px; }
.steps-bar button { width: 100%; display: flex; gap: 8px; align-items: center; text-align: left; padding: 9px 10px; border: 1px solid var(--line); background: var(--white); border-radius: 9px; font-size: 12px; font-weight: 600; color: var(--ink-3); }
.steps-bar button:disabled { cursor: default; }
.steps-bar button b { flex: none; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--line-2); color: var(--ink-2); font-size: 11px; }
.steps-bar li.done button { color: var(--ink-2); }
.steps-bar li.done button b { background: var(--gold-light); color: var(--gold-dark); }
.steps-bar li.now button { border-color: var(--navy); color: var(--navy); box-shadow: 0 0 0 2px rgba(11, 37, 89, .08); }
.steps-bar li.now button b { background: var(--navy); color: var(--champagne); }
.steps-bar button:not(:disabled):hover { border-color: var(--gold); }
.alert-ok { background: var(--ok-bg); border-color: #BFDDCD; color: #1F5A40; }
.alert-ok .ic { color: var(--ok); }

/* ---------- Metas ---------- */
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend .lg-meta { height: 0; border-top: 2px dashed var(--danger); width: 16px; border-radius: 0; vertical-align: 3px; }
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line-2); }
.chart .axis { font-size: 11px; fill: var(--ink-3); font-family: var(--font); }
.chart .axis.strong { fill: var(--navy); font-weight: 700; }
.chart .meta-line { stroke: var(--danger); stroke-width: 1.5; stroke-dasharray: 5 4; }
.funnel-bars { display: grid; gap: 8px; }
.fb-row { display: grid; grid-template-columns: 190px 1fr 36px 40px; gap: 10px; align-items: center; font-size: 12.5px; }
.fb-label { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fb-track { height: 18px; background: var(--line-2); border-radius: 5px; overflow: hidden; }
.fb-bar { display: block; height: 100%; background: var(--gold); border-radius: 5px; min-width: 2px; }
.fb-n { text-align: right; color: var(--navy); font-variant-numeric: tabular-nums; }
.fb-pct { color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* ---------- Fechamento ---------- */
.fech td { font-size: 13.5px; }
.fech tr.tot td { font-weight: 700; color: var(--navy); border-top: 1px solid var(--line); }
.fech tr.gold td { background: #FBF5E4; }
.fech-actions { display: grid; gap: 12px; justify-items: start; }
.fech-actions .field { width: 100%; }
.crit-extra { display: flex; gap: 16px; flex-wrap: wrap; }
.field.inline { min-width: 200px; }

/* ---------- Documentos ---------- */
.doc-toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.doc-toolbar select { padding: 9px 11px; border: 1px solid #DCD5C4; border-radius: 9px; min-width: 300px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.miss-count { color: var(--warn); font-weight: 700; }
.doc-sheet { background: #fff; border: 1px solid var(--line); box-shadow: 0 4px 20px rgba(11, 37, 89, .08); margin-top: 10px; max-height: 62vh; overflow: auto; position: relative; }
.doc-head { height: 96px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 800 160' preserveAspectRatio='none'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' x2='1'%3E%3Cstop offset='0' stop-color='%23A8904F'/%3E%3Cstop offset='.5' stop-color='%23F3E6C4'/%3E%3Cstop offset='1' stop-color='%23A8904F'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath d='M0 0H800V70C700 40 560 150 380 135C230 122 120 150 0 140Z' fill='url(%23g)'/%3E%3Cpath d='M0 0H800V40C690 30 560 130 380 118C230 108 110 130 0 128Z' fill='%230B2559'/%3E%3C/svg%3E") top/100% 100% no-repeat; padding: 12px 0 0 28px; }
.doc-head img { height: 52px; }
.doc-body { padding: 18px 48px 24px; font-size: 13.5px; line-height: 1.65; color: #1D2433; outline: none; }
.doc-body h1 { font-family: var(--serif); font-size: 18px; color: var(--navy); text-align: center; margin: 4px 0 18px; }
.doc-body p { text-align: justify; margin: 0 0 12px; }
.doc-body:focus { box-shadow: inset 0 0 0 2px rgba(168, 144, 79, .25); }
.doc-foot { border-top: 1px solid var(--gold); margin: 0 48px; padding: 8px 0 14px; text-align: center; font-size: 11px; color: var(--navy); }
.doc-mini .doc-body { padding: 14px 20px; font-size: 12px; }
mark.miss { background: #FFF1A8; color: #6E4C0D; padding: 0 3px; border-radius: 3px; font-weight: 600; }
.sigs { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 48px; margin: 34px 0 10px; }
.sig { text-align: center; min-width: 240px; display: flex; flex-direction: column; align-items: center; font-size: 12.5px; }
.sig-line { display: block; width: 260px; border-top: 1px solid #333; margin-bottom: 4px; }
.sig small { color: var(--ink-2); }
.sigs-test .sig { min-width: 300px; }
.model-edit { display: grid; grid-template-columns: 1fr 250px; gap: 16px; margin-top: 12px; }
.model-edit textarea { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; line-height: 1.55; }
.model-help { background: #FDFBF6; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; max-height: 420px; overflow: auto; font-size: 12px; }
.mh-group { margin: 8px 0; display: flex; flex-wrap: wrap; gap: 4px; }
.mh-group > span { width: 100%; font-weight: 700; color: var(--gold-dark); text-transform: uppercase; font-size: 10.5px; letter-spacing: .06em; }
.chip-btn { border: 1px solid var(--line); background: var(--white); border-radius: 6px; padding: 2px 6px; font-size: 11px; font-family: ui-monospace, Menlo, Consolas, monospace; color: var(--navy-3); }
.chip-btn:hover { border-color: var(--gold); }
#doc-print { display: none; }
.np { border: 1.5px dashed #B9AE94; border-radius: 6px; padding: 10px 18px 4px; margin: 0 0 14px; break-inside: avoid; page-break-inside: avoid; }
.np h1 { font-size: 15px !important; margin: 2px 0 6px !important; text-align: left !important; }
.np p { margin: 0 0 6px !important; font-size: 12.5px; }
.np .sigs { margin: 16px 0 4px; }
.btn-wa { color: #1E7A47; border-color: #BFE3CC; }
.btn-wa:hover { background: #F0FAF4; border-color: #8FCFA7; }
@media (max-width: 860px) {
  .model-edit { grid-template-columns: 1fr; }
  .fb-row { grid-template-columns: 120px 1fr 30px 34px; }
  .doc-body { padding: 14px 18px; }
}

/* ---------- Telas menores ---------- */
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .cols, .cols-wide-left { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .only-mobile { display: inline-grid !important; }
  .sidebar { transform: translateX(-100%); transition: transform .2s; }
  .menu-open .sidebar { transform: none; }
  .menu-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 25; }
  .main-wrap { margin-left: 0; }
  .topbar { padding: 10px 14px; flex-wrap: wrap; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .view { padding: 18px 14px 60px; }
  .login { grid-template-columns: 1fr; }
  .login-brand { padding: 30px 20px 0; }
  .login-logo { width: 260px; }
  .settings { grid-template-columns: 1fr; }
  .settings-nav { flex-direction: row; overflow-x: auto; position: static; }
  .settings-nav button { white-space: nowrap; }
  .grid-form, .info-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .cal-day { min-height: 70px; }
  .cal-ev { font-size: 0; padding: 0; height: 6px; }
  .page-head h1 { font-size: 22px; }
  .demo-pill { display: none; }
  .seg { margin-left: 0; }
}

/* ---------- Impressão: ficha no padrão do papel timbrado ---------- */
@media print {
  @page { size: A4; margin: 0; }
  body { background: #fff; }
  .sidebar, .topbar, #toasts, .modal-wrap { display: none !important; }
  .main-wrap { margin: 0; }
  .view { padding: 0; }
  .view .page { display: block !important; }
  .view .page > *:not(#print-area) { display: none !important; }
  #print-area { display: block !important; font-family: var(--font); color: #1D2433; font-size: 11pt; padding: 0 18mm 30mm; position: relative; min-height: 297mm; }
  .lh-head { margin: 0 -18mm 10mm; height: 42mm; background:
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 800 160' preserveAspectRatio='none'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' x2='1'%3E%3Cstop offset='0' stop-color='%23A8904F'/%3E%3Cstop offset='.5' stop-color='%23F3E6C4'/%3E%3Cstop offset='1' stop-color='%23A8904F'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath d='M0 0H800V70C700 40 560 150 380 135C230 122 120 150 0 140Z' fill='url(%23g)'/%3E%3Cpath d='M0 0H800V40C690 30 560 130 380 118C230 108 110 130 0 128Z' fill='%230B2559'/%3E%3C/svg%3E") top/100% 100% no-repeat;
    display: flex; align-items: flex-start; padding: 6mm 0 0 18mm; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .lh-head img { height: 22mm; }
  .lh-title { font-family: var(--serif); color: #0B2559; font-size: 17pt; margin: 0 0 5mm; }
  #print-area h2 { font-size: 10pt; text-transform: uppercase; letter-spacing: .08em; color: #8C7638; margin: 6mm 0 2mm; }
  #print-area p { margin: 0 0 2mm; }
  .lh-table { width: 100%; border-collapse: collapse; font-size: 10pt; }
  .lh-table th { text-align: left; width: 32mm; color: #4A5468; font-weight: 600; padding: 1.5mm 3mm 1.5mm 0; vertical-align: top; }
  .lh-table td { padding: 1.5mm 0; border-bottom: .2mm solid #E7E1D3; }
  .lh-gen { margin-top: 8mm !important; font-size: 8.5pt; color: #7A8396; }
  body.print-doc #app, body.print-doc #toasts, body.print-doc .modal-wrap { display: none !important; }
  body.print-doc #doc-print { display: block !important; font-family: var(--font); color: #1D2433; font-size: 11.5pt; padding: 0 20mm 30mm; position: relative; min-height: 297mm; }
  #doc-print .doc-body { padding: 0; font-size: 11.5pt; line-height: 1.6; }
  #doc-print .doc-body h1 { font-size: 15pt; margin: 2mm 0 7mm; }
  #doc-print .sig-line { border-top: .3mm solid #333; }
  body.print-doc #doc-print .lh-head { margin: 0 -20mm 8mm; padding-left: 20mm; }
  .lh-foot { position: absolute; left: 18mm; right: 18mm; bottom: 10mm; border-top: .5mm solid #A8904F; padding-top: 3mm; text-align: center; font-size: 8.5pt; color: #0B2559; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
