: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; }
.user-box { display: flex; align-items: center; gap: 9px; background: rgba(255,255,255,.06); border-radius: 11px; padding: 9px 10px; margin-top: 4px; }
.user-box img { width: 30px; height: 30px; border-radius: 50%; background: #2a3a55; }
.user-txt { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.user-txt b { font-size: 12px; color: #e8ecf3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 700; }
.user-txt span { font-size: 10.5px; color: #93a2ba; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-box button { background: none; border: none; color: #93a2ba; cursor: pointer; font-size: 15px; padding: 3px 5px; border-radius: 7px; }
.user-box button:hover { background: rgba(255,255,255,.1); color: #fff; }

/* ---------- 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; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; }
.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: 10001; 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-meta .pill { white-space: normal; word-break: break-word; border-radius: 8px; max-width: 100%; }
.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; }
body.dark .integra { color: var(--ink-soft); }
.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) {
  /* ── Layout base ── */
  /* overflow-x: clip não quebra position:fixed (ao contrário de hidden) */
  html { overflow-x: clip; }
  .app { grid-template-columns: 1fr; height: auto; min-height: 100dvh; overflow-x: clip; }
  .rail { display: none; }
  .main { overflow-x: clip; }
  .scroll { padding: 14px 12px 80px; }

  /* ── Topbar ── */
  .topbar { padding: 10px 12px; gap: 8px; min-width: 0; }
  .topbar-title { min-width: 0; flex: 1; overflow: hidden; }
  .topbar-actions { gap: 6px; flex-shrink: 0; }
  .topbar h2 { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .view-sub { font-size: 11.5px; }
  #searchWrap { display: none; }
  #btnExport, #btnNotif { display: none !important; }
  .icon-btn2 { width: 33px; height: 33px; font-size: 14px; }

  /* ── Stats ── */
  .stats { grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
  .stat { padding: 13px 14px; }
  .stat .n { font-size: 22px; }
  .stat .l { font-size: 10.5px; }

  /* ── Dashboard inbox ── */
  .dash-grid { grid-template-columns: 1fr; }
  .inbox-row { grid-template-columns: 10px 1fr auto; gap: 10px; padding: 10px 14px; }
  .ib-rem { display: none; }
  .ib-tags { display: none; }
  .ib-assunto { font-size: 13px; }
  .ib-proc { font-size: 11.5px; }
  .ib-data { font-size: 11.5px; }
  .panel-head { padding: 12px 14px; flex-wrap: wrap; gap: 8px; }
  .panel-head h3 { font-size: 14.5px; }
  .inbox-filtros { gap: 4px; }
  .inbox-f { font-size: 11.5px; padding: 4px 9px; }
  .feed-item { padding: 11px 14px; }

  /* ── Clientes: toolbar ── */
  .cli-toolbar { flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
  .segmented button { font-size: 12px; padding: 6px 10px; }

  /* ── Clientes: lista – grid único compartilhado ──
     cli-tab vira o grid, head/row usam display:contents
     assim TODOS os spans participam do mesmo grid → alinhamento garantido */
  .cli-tab {
    display: grid;
    grid-template-columns: 130px 108px 46px 105px 64px 100px;
    width: max-content;
    overflow: visible;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
  }
  .clt-head { display: contents; }
  .clt-row  { display: contents; }
  .clt-head > span {
    background: var(--paper); border-bottom: 2px solid var(--line);
    padding: 9px 10px; white-space: nowrap;
    display: flex; align-items: center;
  }
  .clt-head > span:first-child { border-radius: var(--radius) 0 0 0; }
  .clt-head > span:last-child  { border-radius: 0 var(--radius) 0 0; }
  .clt-row > span {
    padding: 9px 10px; border-bottom: 1px solid var(--paper-2);
    display: flex; align-items: center; background: var(--card);
    white-space: nowrap; overflow: hidden;
  }
  .clt-row:last-child > span { border-bottom: none; }
  .clt-row:hover > span { background: #fffaf0; }
  body.dark .clt-row:hover > span { background: var(--paper-2); }
  .clt-nome { font-size: 13px; max-width: 110px; overflow: hidden; text-overflow: ellipsis; }

  /* ── Clientes: kanban ── */
  #clientesLista { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -12px; padding: 0 12px; }
  .kanban {
    display: flex; gap: 10px;
    padding-bottom: 10px; align-items: flex-start;
    width: max-content;
  }
  .kb-col { min-width: 220px; flex-shrink: 0; }
  .kb-head { font-size: 13px; }
  .kb-card { padding: 10px 11px; }
  .kb-nome { font-size: 13px; }

  /* ── Clientes: cards ── */
  .clientes-grid { grid-template-columns: 1fr; gap: 12px; }
  .cli-figures { gap: 14px; }
  .figure .fv { font-size: 16px; }

  /* ── Processos: filtros fixos no topo – especificidade com ID ── */
  #view-processos .proc-filters {
    position: sticky; top: 0; z-index: 50;
    background: var(--paper); padding: 10px 0 12px;
    gap: 8px; box-shadow: 0 2px 10px rgba(20,36,63,.08);
    margin-bottom: 4px;
  }
  #view-processos .proc-filters select,
  #view-processos .proc-filters .chk { font-size: 13px; }
  #view-processos .proc-filters select { flex: 1 1 calc(50% - 4px); min-width: 0; padding: 8px 9px; }
  #view-processos .proc-filters .chk { flex: 0; white-space: nowrap; }

  /* ── Processos: card – 2 linhas (título / badges) ── */
  .proc-head {
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    align-items: start;
    padding: 12px 14px; gap: 6px 10px;
  }
  .proc-right { grid-row: 2; grid-column: 2; flex-wrap: wrap; gap: 5px; }
  .proc-partes { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .proc-meta { font-size: 11.5px; gap: 6px; }
  /* Toolbar interno: campos empilhados */
  .proc-toolbar { flex-direction: column; align-items: stretch; padding: 10px 12px; gap: 8px; }
  .proc-toolbar .field, .proc-toolbar .valor-edit { width: 100%; flex-direction: column; align-items: flex-start; gap: 3px; }
  .proc-toolbar input.cli-pick, .proc-toolbar select, .proc-toolbar .valor-input { width: 100%; box-sizing: border-box; }
  /* Linhas de comu: scroll horizontal */
  .proc-body { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .comu { min-width: 420px; grid-template-columns: 80px 1fr auto; padding: 9px 12px; gap: 8px; }
  .comu-data { font-size: 11.5px; }
  .comu-data small { font-size: 10px; }

  /* ── Agenda: form – especificidade maior que a regra global 4-colunas ── */
  #view-agenda .tarefa-form { grid-template-columns: 1fr; gap: 8px; }
  #view-agenda .tarefa-form input,
  #view-agenda .tarefa-form button { width: 100%; box-sizing: border-box; }

  /* ── Agenda: nav + Hoje ── */
  #view-agenda .cal-top { flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
  #view-agenda .cal-top > .btn { flex: 1; text-align: center; padding: 9px 16px; font-size: 13.5px; }
  #view-agenda .cal-btn { width: 40px; height: 40px; font-size: 18px; }
  #view-agenda .cal-mes { font-size: 15px; min-width: 120px; }

  /* ── Agenda: itens ── */
  .ag-item { padding: 11px 12px; gap: 10px; }
  .ag-titulo { font-size: 14px; }
  .ag-sub { font-size: 11.5px; }

  /* ── Calendário: células compactas com cor de evento ──
     Usa #view-agenda para ter especificidade maior que a regra global .cal-cell */
  #view-agenda .cal { padding: 10px 2px; }
  #view-agenda .cal-wdh { font-size: 9px; letter-spacing: 0; }
  #view-agenda .cal-wd { margin-bottom: 3px; }
  #view-agenda .cal-grid { gap: 3px; }
  #view-agenda .cal-cell {
    min-height: 34px; padding: 4px 2px;
    border-radius: 6px; gap: 0;
    justify-content: center; align-items: center;
    overflow: hidden;
  }
  #view-agenda .cal-num { font-size: 12px; font-weight: 800; color: var(--ink-soft); }
  #view-agenda .cal-chip { display: none; }
  #view-agenda .cal-mais { display: none; }
  /* Célula com qualquer evento: fundo azul claro */
  #view-agenda .cal-cell.tem-evento { background: rgba(22,100,180,.15); border-color: var(--brand); }
  #view-agenda .cal-cell.tem-evento .cal-num { color: var(--brand); }
  /* Célula com prazo urgente: fundo vermelho */
  #view-agenda .cal-cell.tem-prz-urg { background: var(--danger-soft); border-color: var(--danger); }
  #view-agenda .cal-cell.tem-prz-urg .cal-num { color: var(--danger); }
  /* Dia selecionado com evento: brand sólido */
  #view-agenda .cal-cell.sel.tem-evento,
  #view-agenda .cal-cell.sel { border-color: var(--brand); background: var(--brand); }
  #view-agenda .cal-cell.sel .cal-num { color: #fff; }

  /* ── Relatórios ── */
  .rel-grid { grid-template-columns: 1fr; gap: 14px; }
  .bar-row { grid-template-columns: 100px 1fr auto; gap: 8px; }
  .bar-label { font-size: 12px; }

  /* ── Modal ── */
  .modal-card { width: 98vw; max-height: 100dvh; border-radius: 16px 16px 0 0; }
  .modal { align-items: flex-end; }
  /* Esconde bottom nav quando modal/drawer estão abertos */
  body.modal-open .bottom-nav,
  body.drawer-open .bottom-nav { display: none !important; }
  .modal-head { padding: 16px 16px 10px; }
  .modal-head h3 { font-size: 16px; }
  .modal-meta { padding: 0 16px 12px; gap: 6px; }
  .modal-controls { padding: 10px 16px; gap: 10px; }
  .modal-body { padding: 14px 16px; }
  .modal-foot { padding: 12px 16px; flex-direction: column; align-items: stretch; gap: 10px; }
  .nota { min-width: 0; }
  .modal-actions { justify-content: stretch; }
  .modal-actions .btn { flex: 1; justify-content: center; font-size: 12.5px; padding: 9px 8px; }
  .mc-toggles { margin-left: 0; }

  /* ── Drawer ── */
  .drawer-panel { width: 100vw; min-width: 0; }
  .drawer-body { padding: 16px 14px 24px; }
  /* Especificidade maior para sobrescrever a regra global que vem depois no CSS */
  .drawer-body .dw-grid { grid-template-columns: 1fr; }
  .dw-fin { grid-template-columns: 1fr 1fr; }

  /* ── Toast ── */
  .toast { bottom: 76px; font-size: 12.5px; padding: 10px 16px; max-width: 90vw; text-align: center; }

  /* ── Arquivo popup ── */
  .arq-card { width: 98vw; }
  .arq-pdf { height: 300px; }
}

/* ---------- Avatar mobile (topbar) ---------- */
.mob-user { position: relative; display: none; }
@media (max-width: 900px) { .mob-user { display: block; } }
.mob-avatar-btn {
  width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--brand);
  padding: 0; cursor: pointer; overflow: hidden; background: var(--paper-2);
  display: grid; place-items: center;
}
.mob-avatar-btn img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
#mobUserInicial { font-size: 14px; font-weight: 800; color: var(--brand); }
.mob-menu {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 300;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 8px 32px rgba(20,36,63,.18); padding: 14px; min-width: 200px;
}
.mob-menu-info { display: flex; flex-direction: column; gap: 2px; margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.mob-menu-info span { font-weight: 700; font-size: 14px; color: var(--ink); }
.mob-menu-info small { font-size: 11.5px; color: var(--muted); }
.mob-menu-sair {
  width: 100%; border: 1px solid var(--danger); border-radius: 9px; padding: 9px 12px;
  background: transparent; color: var(--danger); font-weight: 700; font-size: 13px;
  cursor: pointer; transition: background .15s;
}
.mob-menu-sair:hover { background: var(--danger-soft); }

/* ---------- Bottom nav (mobile) ---------- */
.bottom-nav {
  display: none;
}
@media (max-width: 900px) {
  .bottom-nav {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 9999;
    background: var(--card);
    border-top: 1px solid var(--line);
    padding: 6px 0 env(safe-area-inset-bottom, 6px);
    box-shadow: 0 -4px 20px rgba(20,36,63,.12);
    /* Garante que não é afetado por transform/clip de ancestrais */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
  }
}
.bottom-nav .nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 5px 2px; cursor: pointer;
  color: var(--muted);
  background: transparent;
  border-radius: 0;
  font-size: inherit;
  font-weight: 500;
  transition: color .15s;
}
.bottom-nav .nav-item:hover { background: transparent; color: var(--ink); }
.bottom-nav .nav-item.active {
  background: transparent;
  box-shadow: none;
  color: var(--brand);
}
.bn-ico { font-size: 19px; line-height: 1; }
.bn-lbl { font-size: 9.5px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; }

/* ---------- 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); }

/* ---------- Dashboard: urgentes + caixa de entrada ---------- */
.panel-urgentes { margin-bottom: 18px; }
.panel-urgentes .panel-tag { background: var(--danger-soft); color: var(--danger); }
.inbox-filtros { display: flex; gap: 4px; }
.inbox-f { border: 1px solid var(--line-2); background: var(--paper); color: var(--muted); font-weight: 700; font-size: 12px; padding: 5px 11px; border-radius: 8px; cursor: pointer; }
.inbox-f.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.inbox { max-height: 62vh; overflow-y: auto; }
.inbox-row { display: grid; grid-template-columns: 10px 190px 1fr auto auto; gap: 12px; align-items: center; padding: 11px 18px; border-bottom: 1px solid var(--paper-2); cursor: pointer; }
.inbox-row:last-child { border-bottom: none; }
.inbox-row:hover { background: #fffaf0; }
body.dark .inbox-row:hover { background: var(--paper-2); }
.inbox-row.lida { opacity: .5; }
.inbox-row.lida .ib-assunto b { font-weight: 600; }
.ib-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); }
.inbox-row.lida .ib-dot { background: transparent; }
.ib-rem { font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-soft); }
.ib-assunto { min-width: 0; display: flex; align-items: baseline; gap: 8px; overflow: hidden; }
.ib-assunto b { font-family: "Nunito Sans"; font-weight: 800; white-space: nowrap; }
.ib-proc { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ib-tags { display: flex; gap: 6px; }
.ib-data { color: var(--ink-soft); font-weight: 600; font-size: 12.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- Processos: partes em destaque, número menor ---------- */
.proc-partes { font-family: "Nunito Sans"; font-weight: 800; font-size: 15px; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proc-partes .vs { color: var(--muted); font-weight: 600; margin: 0 4px; }
.proc-partes .proc-outros { color: var(--muted); font-weight: 600; font-size: 12px; }
.proc-num-sm { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; letter-spacing: 0; }

/* ---------- Estágios (cores por índice) ---------- */
.est-i0 { background: #eef1f6; color: #2b4066; border-color: #dbe1ee; }
.est-i1 { background: #e7f0fb; color: #1f5b93; border-color: #cfe1f4; }
.est-i2 { background: #fbecc9; color: #7a5410; border-color: #ecd190; }
.est-i3 { background: #f6e3d2; color: #8a4b1e; border-color: #ecc7a5; }
.est-i4 { background: #efe1f4; color: #6a3186; border-color: #ddc4ea; }
.est-i5 { background: #e3efe0; color: #2f6b3a; border-color: #cfe3ca; }
.est-i6 { background: #e0efee; color: #1f5f5b; border-color: #c6e2df; }
.est-i7 { background: var(--paper-2); color: var(--muted); border-color: var(--line-2); }

/* ---------- Agenda: nota + concluído verde esmaecido ---------- */
.ag-nota { font-size: 12px; color: var(--ink-soft); margin-top: 4px; background: var(--paper-2); padding: 3px 8px; border-radius: 6px; display: inline-block; }
.ag-item.done { background: #eef6ec; border-color: #cfe3ca; opacity: .6; }
.ag-item.done .ag-titulo { text-decoration: line-through; color: var(--ok); }
.ag-item.done .ag-check { background: var(--ok); color: #fff; border-color: var(--ok); }
.chip-done { background: #dfeeda; color: #2f6b3a; border: 1px solid #cfe3ca; }
body.dark .ag-item.done { background: #1c2a1e; }
body.dark .chip-done { background: #21361f; color: #9fd6a6; }

/* ---------- Drawer perfil do cliente ---------- */
.drawer { position: fixed; inset: 0; z-index: 10000; pointer-events: none; }
.drawer.aberto { pointer-events: auto; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(20,36,63,.4); opacity: 0; transition: opacity .22s; }
.drawer.aberto .drawer-backdrop { opacity: 1; }
.drawer-panel { position: absolute; top: 0; right: 0; height: 100%; width: 50vw; min-width: 480px; background: var(--paper); box-shadow: -10px 0 40px rgba(20,36,63,.28); transform: translateX(100%); transition: transform .26s cubic-bezier(.4,0,.2,1); display: flex; flex-direction: column; border-left: 1px solid var(--line); }
@media (max-width: 900px) { .drawer-panel { width: 96vw; min-width: 0; } }
.drawer.aberto .drawer-panel { transform: translateX(0); }
.drawer-top { display: flex; align-items: center; justify-content: space-between; padding: 16px 22px; border-bottom: 1px solid var(--line); background: var(--card); }
.drawer-top h3 { font-size: 16px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 22px 40px; }
.avatar.lg { width: 46px; height: 46px; border-radius: 12px; font-size: 16px; }
.dw-hero { display: flex; gap: 14px; align-items: center; margin-bottom: 20px; }
.dw-hero .avatar { flex: 0 0 auto; }
.dw-hero .dw-info { min-width: 0; flex: 1; }
.dw-nome { font-family: "Nunito Sans"; font-weight: 800; font-size: 20px; border: none; background: transparent; color: var(--ink); width: 100%; padding: 2px 0; border-bottom: 1px dashed transparent; }
.dw-nome:hover, .dw-nome:focus { border-bottom-color: var(--line-2); outline: none; }
.dw-estagio { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.dw-estagio select { border: 1px solid var(--line-2); border-radius: 8px; padding: 6px 10px; background: var(--card); color: var(--ink); font-weight: 700; font-size: 12.5px; }
.dw-sec { margin-bottom: 24px; }
.dw-sec > h4 { font-size: 12.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin-bottom: 12px; border-bottom: 1px solid var(--line); padding-bottom: 7px; }
.dw-count { background: var(--paper-2); color: var(--ink-soft); border-radius: 999px; padding: 1px 8px; font-size: 11px; margin-left: 4px; }
.dw-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dw-grid label { display: flex; flex-direction: column; gap: 5px; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.dw-grid label.col2 { grid-column: 1 / -1; }
.dw-grid input { border: 1px solid var(--line-2); border-radius: 9px; padding: 9px 11px; background: var(--card); color: var(--ink); font-size: 13.5px; }
.dw-grid input:focus { outline: none; border-color: var(--brand); }
.dw-fin { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.dw-fin > div { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 13px; }
.dw-fin span { font-size: 11px; color: var(--muted); display: block; }
.dw-fin b { font-family: "Nunito Sans"; font-size: 16px; }
.dw-fin b.money { color: var(--brand); }
.dw-procs { display: flex; flex-direction: column; gap: 8px; }
.dw-proc { border: 1px solid var(--line); border-radius: 11px; overflow: hidden; background: var(--card); }
.dw-proc-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; cursor: pointer; }
.dw-proc-head b { font-family: "Nunito Sans"; font-size: 13.5px; }
.dw-proc-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.dw-proc .chevron { color: var(--muted); font-size: 11px; transition: transform .18s; }
.dw-proc.open .chevron { transform: rotate(90deg); }
.dw-proc-body { display: none; padding: 4px 14px 14px; border-top: 1px solid var(--line); }
.dw-proc.open .dw-proc-body { display: block; }
.dw-proc-body .dw-grid { margin-top: 12px; }
.dw-honor { font-size: 12.5px; color: var(--ink-soft); margin: 12px 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dw-honor .money { color: var(--brand); }
.dw-honor .dw-termo { margin-left: auto; }
.dw-comus { display: flex; flex-direction: column; gap: 5px; }
.dw-comu { display: grid; grid-template-columns: auto 1fr auto; gap: 9px; align-items: center; padding: 7px 9px; border-radius: 8px; cursor: pointer; background: var(--paper); }
.dw-comu:hover { background: var(--paper-2); }
.dw-comu.lida { opacity: .55; }
.dw-comu-txt { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dw-comu-data { font-size: 11.5px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.dw-anexos { display: flex; flex-direction: column; gap: 7px; margin-bottom: 10px; }
.anexo { display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 9px; padding: 8px 11px; }
.anexo a { font-size: 13px; font-weight: 600; color: var(--brand); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.anexo-info { font-size: 11px; color: var(--muted); }
.anexo-del { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 13px; padding: 2px 6px; border-radius: 6px; }
.anexo-del:hover { background: var(--danger-soft); color: var(--danger); }
.dw-upload { display: inline-flex; align-items: center; gap: 6px; border: 1.5px dashed var(--line-2); border-radius: 10px; padding: 10px 16px; cursor: pointer; color: var(--ink-soft); font-weight: 700; font-size: 13px; }
.dw-upload:hover { border-color: var(--brand); color: var(--brand); }
.print-nota { background: #f6f0dd; padding: 6px 10px; border-radius: 6px; }

/* ---------- Popup de arquivos ---------- */
#arqModal { z-index: 10002; }
.arq-card { width: min(760px, 94vw); }
.arq-sec { margin-bottom: 22px; }
.arq-sec > h4 { font-size: 12.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 0 0 12px; border-bottom: 1px solid var(--line); padding-bottom: 7px; }
.arq-pdfbar { display: flex; gap: 8px; margin-bottom: 10px; }
.arq-pdf { width: 100%; height: 420px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }

/* ---------- 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; }
