:root {
  --ink: #14243f;
  --ink-soft: #33435f;
  --paper: #f5f2ea;
  --paper-2: #ece7db;
  --card: #fffdf8;
  --line: #e7e1d2;
  --line-2: #d8d1be;
  --brand: #a97f2e;
  --brand-2: #c0963c;
  --gold: #a97f2e;
  --danger: #a6392c;
  --danger-soft: #f6e3de;
  --ok: #2f6b3a;
  --muted: #7c7566;
  --shadow: 0 1px 2px rgba(20, 36, 63, 0.05), 0 6px 22px rgba(20, 36, 63, 0.06);
  --radius: 14px;
}

body.dark {
  --ink: #e8ecf3;
  --ink-soft: #c2c9d6;
  --paper: #0f1622;
  --paper-2: #17202e;
  --card: #161f2c;
  --line: #26303f;
  --line-2: #333f52;
  --brand: #d0a24a;
  --brand-2: #e0b869;
  --gold: #d0a24a;
  --danger: #e2705f;
  --danger-soft: #3a2420;
  --ok: #6bbf7a;
  --muted: #8994a6;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 26px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Inter", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-size: 14px;
  line-height: 1.5;
}
h1, h2, h3, h4 { font-family: "Nunito Sans", system-ui, sans-serif; margin: 0; font-weight: 800; letter-spacing: -0.01em; }
button, input, select { font-family: inherit; font-size: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

.app { display: grid; grid-template-columns: 244px 1fr; height: 100vh; }

/* ---------- Nav rail ---------- */
.rail {
  background: linear-gradient(180deg, #14243f 0%, #101b2e 100%);
  color: #dfe4ee; padding: 20px 14px; display: flex; flex-direction: column; gap: 22px;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 6px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 11px;
  background: linear-gradient(135deg, var(--brand-2), var(--brand));
  color: #eafaf7; font-family: "Nunito Sans"; font-weight: 900; font-size: 22px;
  display: grid; place-items: center; box-shadow: inset 0 0 0 1px rgba(255,255,255,.16);
}
.brand h1 { font-size: 19px; font-weight: 800; }
.brand span { font-size: 10.5px; color: #93a2ba; text-transform: uppercase; letter-spacing: 1.4px; }

.nav { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 13px; border-radius: 10px;
  color: #c3ccdb; cursor: pointer; font-weight: 600; font-size: 14px; transition: background .15s, color .15s;
}
.nav-item .ic { font-size: 15px; width: 18px; text-align: center; opacity: .85; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: var(--brand); color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }

.rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.sync-info { font-size: 11px; color: #93a2ba; margin: 0; text-align: center; }

/* ---------- Buttons ---------- */
.btn {
  border: 1px solid transparent; border-radius: 10px; padding: 10px 15px; cursor: pointer;
  font-weight: 700; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  transition: transform .05s, background .15s, border-color .15s;
}
.btn:active { transform: translateY(1px); }
.btn-block { width: 100%; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-2); }
.btn-ghost { background: var(--card); border-color: var(--line-2); color: var(--ink-soft); }
.btn-ghost:hover { background: var(--paper-2); }
.btn-sm { padding: 6px 11px; font-size: 12px; border-radius: 8px; }
.sync-ico { display: inline-block; }
.syncing .sync-ico { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Main ---------- */
.main { display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 30px; background: var(--card); border-bottom: 1px solid var(--line);
}
.topbar h2 { font-size: 22px; }
.view-sub { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.search-wrap { position: relative; width: 320px; }
.search-ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 16px; }
.search-wrap input { width: 100%; padding: 10px 12px 10px 34px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--paper); }
.search-wrap input:focus { outline: none; border-color: var(--brand); background: #fff; }

.scroll { flex: 1; overflow-y: auto; padding: 24px 30px 48px; }
.view[hidden] { display: none; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.stat .n { font-family: "Nunito Sans"; font-size: 27px; font-weight: 800; line-height: 1.1; }
.stat .l { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-top: 4px; }
.stat.brand .n { color: var(--brand); }
.stat.alerta .n { color: var(--danger); }
.stat.gold .n { color: var(--gold); }

/* ---------- Panels ---------- */
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.panel-narrow { max-width: 620px; margin-bottom: 18px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.panel-head h3 { font-size: 16px; }
.panel-tag { font-size: 12px; font-weight: 700; color: var(--danger); background: var(--danger-soft); padding: 2px 9px; border-radius: 999px; }

.feed { max-height: 420px; overflow-y: auto; }
.feed-item { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 13px 18px; border-bottom: 1px solid var(--paper-2); cursor: pointer; }
.feed-item:last-child { border-bottom: none; }
.feed-item:hover { background: #f8fbfa; }
.feed-item .fi-doc { font-weight: 700; }
.feed-item .fi-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.feed-item .fi-date { color: var(--ink-soft); font-weight: 600; font-size: 12.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- Pills / tags ---------- */
.pill { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.pill-trib { background: #edf0f6; color: #2b4066; border: 1px solid #dbe1ee; }
.pill-count { background: var(--paper-2); color: var(--ink-soft); border: 1px solid var(--line-2); }
.pill-novo { background: #fbecc9; color: #7a5410; border: 1px solid #ecd190; }
.pill-alerta { background: var(--danger-soft); color: var(--danger); border: 1px solid #f0c3bc; }
.tag { font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 6px; }
.tag-dec { background: var(--danger-soft); color: var(--danger); }
.tag-sen { background: #e3efe0; color: var(--ok); }
.tag-des { background: #edf0f6; color: #2b4066; }
.tag-def { background: var(--paper-2); color: var(--ink-soft); }

/* ---------- Clientes ---------- */
.cli-toolbar { display: flex; justify-content: flex-end; margin-bottom: 16px; }
.segmented { display: inline-flex; background: var(--paper-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 3px; gap: 3px; }
.segmented button { border: none; background: transparent; color: var(--muted); font-weight: 700; font-size: 13px; padding: 7px 14px; border-radius: 8px; cursor: pointer; }
.segmented button:hover { color: var(--ink-soft); }
.segmented button.on { background: var(--card); color: var(--brand); box-shadow: var(--shadow); }

.avatar.sm { width: 30px; height: 30px; border-radius: 8px; font-size: 12px; }
.estagio { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--paper-2); color: var(--ink-soft); white-space: nowrap; }
.est-Novo { background: #eaf1f0; color: #205e59; border-color: #cfe4e1; }
.est-Emandamento { background: #edf0f6; color: #2b4066; border-color: #dbe1ee; }
.est-Aguardando { background: #fbecc9; color: #7a5410; border-color: #ecd190; }
.est-Concluído { background: #e3efe0; color: #2f6b3a; border-color: #cfe3ca; }

/* Lista */
.cli-tab { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.clt-head, .clt-row { display: grid; grid-template-columns: 2.2fr 1.1fr 0.6fr 1.2fr 0.8fr 1fr; gap: 12px; align-items: center; padding: 12px 18px; }
.clt-head { background: var(--paper); border-bottom: 1px solid var(--line); font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 700; }
.clt-head .num, .clt-row .num { text-align: right; }
.clt-row { border-bottom: 1px solid var(--paper-2); cursor: pointer; }
.clt-row:last-child { border-bottom: none; }
.clt-row:hover { background: #fffaf0; }
body.dark .clt-row:hover { background: var(--paper-2); }
.clt-cli { display: flex; align-items: center; gap: 11px; min-width: 0; }
.clt-nome { font-weight: 700; font-family: "Nunito Sans"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clt-row .money { color: var(--brand); font-weight: 800; }

/* Kanban */
.kanban { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; align-items: start; }
.kb-col { background: var(--paper-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; min-height: 140px; transition: background .12s, box-shadow .12s; }
.kb-col.over { background: var(--paper); box-shadow: inset 0 0 0 2px var(--brand); }
.kb-head { display: flex; align-items: center; justify-content: space-between; font-family: "Nunito Sans"; font-weight: 800; font-size: 14px; }
.kb-count { background: var(--card); border: 1px solid var(--line-2); color: var(--ink-soft); border-radius: 999px; font-size: 12px; padding: 1px 9px; }
.kb-sum { font-size: 12px; color: var(--brand); font-weight: 800; margin: 4px 0 12px; }
.kb-body { display: flex; flex-direction: column; gap: 10px; min-height: 40px; }
.kb-vazio { text-align: center; color: var(--muted); font-size: 12px; padding: 18px 6px; border: 1.5px dashed var(--line-2); border-radius: 10px; }
.kb-card { background: var(--card); border: 1px solid var(--line); border-radius: 11px; padding: 11px 12px; box-shadow: var(--shadow); cursor: grab; }
.kb-card:active { cursor: grabbing; }
.kb-card.dragging { opacity: .5; }
.kb-top { display: flex; align-items: center; gap: 9px; }
.kb-nome { font-family: "Nunito Sans"; font-weight: 700; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kb-figs { display: flex; align-items: baseline; gap: 8px; margin-top: 9px; }
.kb-val { font-family: "Nunito Sans"; font-weight: 800; color: var(--brand); font-size: 15px; }
.kb-meta { font-size: 11.5px; color: var(--muted); }
.kb-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 9px; }

.clientes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.cliente {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column;
}
.cli-head { padding: 16px 18px; cursor: pointer; }
.cli-top { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 42px; height: 42px; border-radius: 11px; flex-shrink: 0; display: grid; place-items: center;
  font-family: "Nunito Sans"; font-weight: 800; font-size: 16px; color: #fff;
}
.cli-name { font-family: "Nunito Sans"; font-weight: 800; font-size: 16px; line-height: 1.2; }
.cli-name-wrap { min-width: 0; }
.cli-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.cli-figures { display: flex; gap: 22px; margin-top: 14px; }
.figure .fv { font-family: "Nunito Sans"; font-weight: 800; font-size: 18px; }
.figure .fl { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.figure .fv.money { color: var(--brand); }
.cli-badges { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.cli-body { border-top: 1px solid var(--line); display: none; }
.cliente.open .cli-body { display: block; }
.cli-proc { padding: 12px 18px; border-bottom: 1px solid var(--paper-2); }
.cli-proc:last-child { border-bottom: none; }
.cli-proc-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cli-proc-num { font-family: "Nunito Sans"; font-weight: 700; font-size: 14px; cursor: pointer; }
.cli-proc-num:hover { color: var(--brand); }
.cli-proc-meta { color: var(--muted); font-size: 12px; margin-top: 3px; }
.valor-edit { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.valor-edit label { font-size: 11.5px; color: var(--muted); }
.valor-edit input {
  width: 150px; border: 1px solid var(--line-2); border-radius: 8px; padding: 6px 9px;
  background: var(--paper); font-variant-numeric: tabular-nums;
}
.valor-edit input:focus { outline: none; border-color: var(--brand); background: #fff; }

/* ---------- Processos view ---------- */
.proc-filters { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.proc-filters select { border: 1px solid var(--line-2); border-radius: 9px; padding: 9px 11px; background: var(--card); cursor: pointer; }
.chk { display: flex; align-items: center; gap: 6px; color: var(--ink-soft); font-size: 13px; cursor: pointer; }

.proc { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 13px; box-shadow: var(--shadow); overflow: hidden; }
.proc-head { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; padding: 15px 18px; cursor: pointer; }
.proc-head:hover { background: #f8fbfa; }
.chevron { color: var(--muted); transition: transform .18s; font-size: 12px; }
.proc.open .chevron { transform: rotate(90deg); }
.proc-title { min-width: 0; }
.proc-num { font-family: "Nunito Sans"; font-size: 16px; font-weight: 800; letter-spacing: -0.01em; }
.proc-meta { color: var(--muted); font-size: 12.5px; margin-top: 3px; display: flex; gap: 8px; flex-wrap: wrap; }
.proc-meta .cli { color: var(--brand); font-weight: 700; }
.proc-meta .val { color: var(--ink-soft); font-weight: 700; }
.proc-right { display: flex; align-items: center; gap: 7px; }
.proc-body { display: none; border-top: 1px solid var(--line); }
.proc.open .proc-body { display: block; }

.proc-toolbar { display: flex; align-items: center; gap: 14px; padding: 12px 18px; background: var(--paper); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.proc-toolbar .valor-edit { margin: 0; }
.proc-toolbar .field { display: flex; align-items: center; gap: 6px; }
.proc-toolbar .field label { font-size: 11.5px; color: var(--muted); }
.proc-toolbar select, .proc-toolbar input.cli-pick { border: 1px solid var(--line-2); border-radius: 8px; padding: 6px 9px; background: #fff; }

.comu { display: grid; grid-template-columns: 96px 1fr auto; gap: 14px; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--paper-2); cursor: pointer; }
.comu:last-child { border-bottom: none; }
.comu:hover { background: #f8fbfa; }
.comu.nao-lida { box-shadow: inset 3px 0 0 var(--gold); }
.comu-data { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ink-soft); font-size: 13px; }
.comu-data small { display: block; color: var(--muted); font-weight: 500; font-size: 11px; }
.comu-main { min-width: 0; }
.comu-prev { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 3px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); }
.comu.lida .dot { background: transparent; border: 1px solid var(--line-2); }

/* ---------- Empty ---------- */
.empty { text-align: center; color: var(--muted); padding: 64px 20px; }
.empty-ico { font-size: 44px; opacity: .5; }
.empty h3 { font-size: 19px; margin: 12px 0 6px; color: var(--ink-soft); }

/* ---------- Config forms ---------- */
.oab-list { list-style: none; margin: 0; padding: 16px 18px 6px; display: flex; flex-direction: column; gap: 8px; }
.oab-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.oab-item b { font-weight: 700; }
.oab-item small { color: var(--muted); font-size: 12px; margin-left: 8px; }
.oab-item .del { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 15px; padding: 2px 6px; border-radius: 6px; }
.oab-item .del:hover { background: var(--danger-soft); color: var(--danger); }
.oab-form { padding: 8px 18px 18px; display: flex; flex-direction: column; gap: 10px; }
.oab-form .row { display: grid; grid-template-columns: 1fr 60px 1.4fr; gap: 8px; }
.oab-form input { border: 1px solid var(--line-2); border-radius: 9px; padding: 9px 11px; background: var(--paper); }
.oab-form input:focus { outline: none; border-color: var(--brand); background: #fff; }
.hint { color: var(--muted); font-size: 12.5px; padding: 0 18px 18px; line-height: 1.6; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(20,36,63,.45); backdrop-filter: blur(2px); }
.modal-card { position: relative; width: min(860px, 94vw); max-height: 90vh; background: var(--card); border-radius: 16px; box-shadow: 0 24px 70px rgba(20,36,63,.35); display: flex; flex-direction: column; border: 1px solid var(--line); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 20px 24px 12px; }
.modal-head h3 { font-size: 20px; }
.modal-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.icon-btn { background: none; border: none; font-size: 18px; color: var(--muted); cursor: pointer; padding: 4px 8px; border-radius: 8px; }
.icon-btn:hover { background: var(--paper-2); }
.modal-meta { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 24px 14px; border-bottom: 1px solid var(--line); }
.modal-body { overflow-y: auto; padding: 18px 24px; }
.integra { font-family: "Inter", sans-serif; white-space: pre-wrap; word-wrap: break-word; font-size: 14px; line-height: 1.72; color: #23324c; margin: 0; }
.modal-foot { border-top: 1px solid var(--line); padding: 14px 24px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.nota { flex: 1; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; min-width: 240px; }
.nota input { flex: 1; border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 10px; background: var(--paper); }
.nota input:focus { outline: none; border-color: var(--brand); }
.modal-actions { display: flex; gap: 8px; }

/* ---------- Toast ---------- */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #f4f0e6; padding: 11px 18px; border-radius: 10px; box-shadow: var(--shadow); font-size: 13px; z-index: 60; }
.toast[hidden] { display: none; }
.toast.err { background: var(--danger); }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .rail { display: none; }
  .dash-grid { grid-template-columns: 1fr; }
}

/* ---------- Nav badge ---------- */
.nav-item { position: relative; }
.nav-badge { background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 800; border-radius: 999px; padding: 1px 7px; margin-left: auto; }

/* ---------- Topbar actions ---------- */
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.icon-btn2 { width: 38px; height: 38px; border: 1px solid var(--line-2); background: var(--paper); border-radius: 10px; cursor: pointer; font-size: 16px; color: var(--ink-soft); display: grid; place-items: center; transition: background .15s, border-color .15s; }
.icon-btn2:hover { background: var(--paper-2); }
.icon-btn2.on { border-color: var(--brand); color: var(--brand); }

/* ---------- Prazo badges ---------- */
.prz { font-size: 10.5px; font-weight: 800; padding: 2px 8px; border-radius: 999px; white-space: nowrap; letter-spacing: .2px; }
.prz-vencido { background: #7a1d13; color: #fff; }
.prz-hoje { background: var(--danger); color: #fff; }
.prz-critico { background: #f6d9ac; color: #7a4a10; border: 1px solid #e6b35a; }
.prz-atencao { background: #fbecc9; color: #7a5410; border: 1px solid #ecd190; }
.prz-ok { background: var(--paper-2); color: var(--muted); border: 1px solid var(--line-2); }
.mini-star { color: var(--gold); font-size: 12px; }
.comu.concluido { opacity: .55; }
.comu.concluido .comu-prev { text-decoration: line-through; }

.mini-empty { padding: 30px 18px; text-align: center; color: var(--muted); font-size: 13px; }

/* ---------- Agenda ---------- */
.tarefa-form { display: grid; grid-template-columns: 1fr 170px 220px auto; gap: 10px; margin-bottom: 20px; }
.tarefa-form input { border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px; background: var(--card); color: var(--ink); }
.tarefa-form input:focus { outline: none; border-color: var(--brand); }
.ag-sec { margin-bottom: 22px; }
.ag-h { font-size: 14px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.ag-h span { background: var(--paper-2); color: var(--ink-soft); border-radius: 999px; font-size: 12px; padding: 1px 8px; font-weight: 800; }
.ag-h.sec-venc { color: var(--danger); }
.ag-h.sec-hoje { color: #b06a10; }
.ag-item { display: grid; grid-template-columns: auto 1fr auto; gap: 13px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 13px 16px; margin-bottom: 9px; box-shadow: var(--shadow); cursor: pointer; }
.ag-item:hover { border-color: var(--line-2); }
.ag-check { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line-2); background: transparent; color: var(--brand); cursor: pointer; font-size: 14px; display: grid; place-items: center; }
.ag-check:hover { border-color: var(--brand); }
.ag-titulo { font-family: "Nunito Sans"; font-weight: 700; font-size: 14.5px; }
.ag-badge { font-size: 10px; font-weight: 800; background: var(--paper-2); color: var(--muted); border-radius: 5px; padding: 1px 6px; text-transform: uppercase; }
.ag-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.ag-right { display: flex; align-items: center; gap: 8px; }
.ag-del { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 13px; padding: 2px 6px; border-radius: 6px; }
.ag-del:hover { background: var(--danger-soft); color: var(--danger); }

/* ---------- Calendário (Agenda) ---------- */
.cal { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; margin-bottom: 20px; }
.cal-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.cal-nav { display: flex; align-items: center; gap: 10px; }
.cal-mes { font-size: 18px; text-transform: capitalize; min-width: 190px; text-align: center; }
.cal-btn { width: 34px; height: 34px; border: 1px solid var(--line-2); background: var(--paper); border-radius: 9px; cursor: pointer; font-size: 18px; color: var(--ink-soft); line-height: 1; }
.cal-btn:hover { background: var(--paper-2); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-wd { margin-bottom: 6px; }
.cal-wdh { text-align: center; font-size: 11px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.cal-cell { min-height: 94px; border: 1px solid var(--line); border-radius: 10px; padding: 6px 6px 8px; background: var(--paper); cursor: pointer; overflow: hidden; display: flex; flex-direction: column; gap: 3px; transition: border-color .12s, background .12s; }
.cal-cell:hover { border-color: var(--brand); }
.cal-cell.outro { opacity: .38; }
.cal-cell.hoje { box-shadow: inset 0 0 0 2px var(--brand); }
.cal-cell.sel { border-color: var(--brand); background: var(--paper-2); }
.cal-num { font-size: 12.5px; font-weight: 800; color: var(--ink-soft); }
.cal-chip { font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip-tar { background: #edf0f6; color: #2b4066; }
body.dark .chip-tar { background: #24304a; color: #b9c6e0; }
.cal-mais { font-size: 10px; color: var(--muted); font-weight: 800; padding-left: 4px; }
.dia-painel { margin-bottom: 18px; }
.dia-h { font-size: 15px; text-transform: capitalize; margin-bottom: 10px; color: var(--ink-soft); }

/* ---------- Relatórios ---------- */
.rel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.bars { padding: 16px 18px; display: flex; flex-direction: column; gap: 11px; }
.bar-row { display: grid; grid-template-columns: 130px 1fr auto; gap: 12px; align-items: center; }
.bar-label { font-size: 12.5px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.bar-track { background: var(--paper-2); border-radius: 999px; height: 12px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand-2)); border-radius: 999px; min-width: 3px; }
.bar-val { font-size: 12.5px; font-weight: 800; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

/* ---------- Config extra ---------- */
.cfg-row { display: flex; align-items: center; gap: 12px; padding: 16px 18px 4px; }
.cfg-row label { font-size: 13px; color: var(--ink-soft); font-weight: 600; }
.cfg-row select { border: 1px solid var(--line-2); border-radius: 9px; padding: 9px 12px; background: var(--card); color: var(--ink); cursor: pointer; }

/* ---------- Modal controls ---------- */
.modal-controls { display: flex; align-items: center; gap: 14px; padding: 12px 24px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.mc-field { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.mc-field input { border: 1px solid var(--line-2); border-radius: 8px; padding: 7px 10px; background: var(--paper); color: var(--ink); }
.mc-info { font-size: 12px; color: var(--muted); }
.mc-info em { color: var(--muted); }
.mc-toggles { display: flex; gap: 6px; margin-left: auto; }
.toggle { width: 34px; height: 34px; border: 1px solid var(--line-2); background: var(--paper); border-radius: 9px; cursor: pointer; font-size: 15px; font-weight: 800; color: var(--muted); }
.toggle:hover { background: var(--paper-2); }
.toggle.on { background: var(--brand); color: #fff; border-color: var(--brand); }

/* select/input backgrounds honor theme */
.filters select, .proc-filters select, .search-wrap input, .oab-form input, .valor-input,
.proc-toolbar select, .proc-toolbar input, .nota input, .mc-field input, .cfg-row select { color: var(--ink); }
body.dark .search-wrap input, body.dark .proc-filters select, body.dark .valor-input { background: var(--paper-2); }

/* ---------- Impressão ---------- */
#printArea { display: none; }
@media print {
  .app, .modal, .toast { display: none !important; }
  #printArea { display: block; padding: 24px; color: #000; }
  #printArea h1 { font-size: 18px; margin: 0 0 10px; }
  #printArea pre { white-space: pre-wrap; font-family: "Inter", sans-serif; font-size: 12px; line-height: 1.6; }
  #printArea hr { border: none; border-top: 1px solid #999; margin: 12px 0; }
}
body.printing > .app { display: none; }
