/* CRC Pontim — sistema visual
   Princípios: calma (neutros + um acento), hierarquia por tipografia e espaço,
   cor só para estado (urgente, atenção, sucesso), detalhes sob demanda. */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --surface-3: #e9edf2;
  --ink: #111827;
  --ink-2: #374151;
  --muted: #6b7280;
  --line: #e5e7eb;
  --line-2: #d1d5db;
  --accent: #0f766e;
  --accent-hover: #115e59;
  --accent-soft: #e6f4f2;
  --accent-ink: #ffffff;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --danger: #b91c1c;
  --danger-soft: #fee2e2;
  --ok: #15803d;
  --ok-soft: #dcfce7;
  --focus: #0f766e55;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow-1: 0 1px 2px rgba(17, 24, 39, .05);
  --shadow-2: 0 4px 16px rgba(17, 24, 39, .08);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --sidebar: 228px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0e1116; --surface: #161a21; --surface-2: #1c212a; --surface-3: #242b36;
  --ink: #e8ebf0; --ink-2: #c9ced6; --muted: #8b93a1; --line: #262d38; --line-2: #333c4a;
  --accent: #2bb3a3; --accent-hover: #3cc6b5; --accent-soft: #10302d; --accent-ink: #06201d;
  --warn: #f2b84b; --warn-soft: #3a2b10; --danger: #f48a84; --danger-soft: #3b1a19; --ok: #6fd18b; --ok-soft: #133022;
  --focus: #2bb3a366; --shadow-1: none; --shadow-2: 0 6px 20px rgba(0,0,0,.4);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; color: var(--ink); }
h1 { font-size: 22px; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 15px; font-weight: 600; }
h3 { font-size: 13px; font-weight: 600; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; border-radius: 6px; }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; padding: 16px 12px;
  background: var(--surface); border-right: 1px solid var(--line);
  overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
/* O menu é mais alto que a tela: rola por dentro, sem espremer os itens. */
.sidebar > * { flex: none; }
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: var(--muted); }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; font-weight: 650; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 750; }
.brand small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.nav-group { margin-top: 10px; }
.nav-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 6px 10px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--ink-2); font-weight: 500; }
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent); }
.nav a .count { margin-left: auto; font-size: 12px; color: var(--muted); }
.nav svg { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.me { display: flex; align-items: center; gap: 10px; padding: 0 6px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--surface-3); color: var(--ink-2); display: grid; place-items: center; font-size: 12px; font-weight: 650; flex: none; }
.avatar.sm { width: 24px; height: 24px; font-size: 10.5px; }
.me-name { font-weight: 600; font-size: 13px; line-height: 1.2; }
.me-role { color: var(--muted); font-size: 12px; }
.foot-actions { display: flex; gap: 6px; }
.content { min-width: 0; }
main { padding: 28px 32px 48px; max-width: 1360px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin-top: 4px; }
.head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.head-actions > * { flex: 0 0 auto; }
.mobilebar { display: none; }

/* ---------- Componentes ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); }
.pad { padding: 18px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line-2); background: var(--surface);
  border-radius: var(--radius-sm); padding: 7px 14px; cursor: pointer; color: var(--ink); font-weight: 500; min-height: 36px; white-space: nowrap; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--danger); }
.btn.sm { min-height: 30px; padding: 4px 10px; font-size: 13px; }
.btn.lg { min-height: 42px; padding: 9px 18px; font-size: 15px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.kbd { font: 11px/1 var(--font); border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 4px; padding: 2px 5px; color: var(--muted); background: var(--surface); }
.btn.primary .kbd { background: transparent; color: inherit; border-color: rgba(255,255,255,.4); }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 500; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.pill.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.high { background: var(--accent-soft); color: var(--accent); }
.pill.mid { background: var(--surface-2); color: var(--ink-2); }
.pill.low { background: var(--surface-2); color: var(--muted); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.danger { background: var(--danger-soft); color: var(--danger); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.sim { background: var(--warn-soft); color: var(--warn); font-weight: 650; letter-spacing: .03em; }

label { display: block; font-size: 12.5px; color: var(--ink-2); margin-bottom: 6px; font-weight: 500; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=time], input[type=number], input[type=search], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--surface); min-height: 38px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); }
textarea { min-height: 72px; resize: vertical; }
.field { margin-bottom: 14px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1 1 160px; }
.grid { display: grid; gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.alert { padding: 10px 14px; border-radius: var(--radius-sm); background: var(--danger-soft); color: var(--danger); font-size: 13.5px; }
.alert.info { background: var(--accent-soft); color: var(--accent); }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert.ok { background: var(--ok-soft); color: var(--ok); }
.empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.empty h2 { margin-bottom: 6px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; color: var(--muted); font-weight: 500; background: var(--surface); position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface-2); }
.table-wrap { overflow-x: auto; }
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border-radius: 9px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 5px 12px; border-radius: 7px; cursor: pointer; color: var(--muted); font-weight: 500; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs button { border: 0; background: transparent; padding: 10px 14px; cursor: pointer; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--accent); }
details > summary { cursor: pointer; color: var(--ink-2); font-weight: 500; }
.link { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font-weight: 500; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login { width: 100%; max-width: 380px; padding: 32px; }
.login .brand { padding: 0 0 24px; }
.login h1 { font-size: 20px; margin-bottom: 4px; }
.login p { margin-bottom: 22px; }

/* ---------- Fila (modo foco) ---------- */
.focus { display: grid; grid-template-columns: 340px 1fr; gap: 20px; align-items: start; }
.qlist { display: flex; flex-direction: column; max-height: calc(100vh - 150px); overflow-y: auto; padding: 4px; }
.qhead { font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 10px 6px; display: flex; justify-content: space-between; }
.qrow { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 10px 12px; border-radius: var(--radius-sm); cursor: pointer; border: 1px solid transparent; }
.qrow:hover { background: var(--surface-2); }
.qrow.active { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.qrow .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qrow .meta { grid-column: 1 / -1; font-size: 12.5px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.flag { width: 7px; height: 7px; border-radius: 50%; background: var(--warn); display: inline-block; }
.work { min-height: 480px; display: flex; flex-direction: column; }
.work-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 22px 24px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.work-head h2 { font-size: 20px; font-weight: 650; }
.work-sub { color: var(--muted); margin-top: 4px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.work-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.work-body { padding: 20px 24px; display: grid; grid-template-columns: 1.1fr .9fr; gap: 24px; }
.why { padding: 14px 16px; border-radius: var(--radius-sm); background: var(--surface-2); }
.why strong { display: block; margin-bottom: 2px; }
.budget-line { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.budget-line:last-child { border-bottom: 0; }
.budget-line .v { font-weight: 650; }
.section-title { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 18px 0 6px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 18px; font-size: 13.5px; }
.timeline li::before { content: ""; position: absolute; left: 3px; top: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--line-2); }
.timeline li::after { content: ""; position: absolute; left: 6px; top: 16px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline li.eff::before { background: var(--accent); }
.timeline .when { color: var(--muted); font-size: 12px; }
.register { border-top: 1px solid var(--line); padding: 20px 24px; background: var(--surface); }
.register h3 { font-size: 15px; margin-bottom: 12px; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choice { border: 1px solid var(--line-2); background: var(--surface); border-radius: 9px; padding: 9px 14px; cursor: pointer; font-weight: 500; display: inline-flex; gap: 8px; align-items: center; }
.choice:hover { border-color: var(--accent); }
.choice.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.choice .kbd { margin-left: 2px; }
.step { margin-top: 18px; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.quick button { border: 1px solid var(--line-2); background: var(--surface); border-radius: 999px; padding: 4px 12px; cursor: pointer; font-size: 13px; }
.quick button.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.footer-bar { position: sticky; bottom: 0; display: flex; gap: 8px; justify-content: space-between; align-items: center; padding: 14px 24px; border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(6px); border-radius: 0 0 var(--radius) var(--radius); flex-wrap: wrap; }

/* ---------- Funil ---------- */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 12px; }
.col { background: var(--surface-2); border-radius: var(--radius); padding: 10px; min-height: 300px; display: flex; flex-direction: column; gap: 8px; }
.col.drop { outline: 2px dashed var(--accent); outline-offset: -2px; }
.col-head { padding: 4px 6px 6px; }
.col-head .sum { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.kcard { padding: 12px; cursor: grab; display: flex; flex-direction: column; gap: 6px; }
.kcard:hover { box-shadow: var(--shadow-2); }
.kcard .top { display: flex; justify-content: space-between; gap: 8px; }
.kcard .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kcard .value { font-weight: 650; }
.kcard .desc { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kcard .bottom { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.due-late { color: var(--danger); font-weight: 500; }
.no-next { color: var(--warn); font-weight: 500; }
.col-more { text-align: center; padding: 6px; }

/* ---------- Painel ---------- */
.hero { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.kpi { padding: 18px; }
.kpi.click { cursor: pointer; }
.kpi.click:hover { border-color: var(--accent); }
.kpi .label { color: var(--muted); font-size: 13px; }
.kpi .v { font-size: 28px; font-weight: 650; letter-spacing: -.02em; margin: 4px 0 2px; }
.kpi .d { font-size: 12.5px; color: var(--muted); }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.kpis .kpi .v { font-size: 22px; }
.attention { display: flex; flex-direction: column; gap: 0; margin-bottom: 24px; }
.attention button { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; border: 0; border-bottom: 1px solid var(--line); background: transparent; cursor: pointer; text-align: left; }
.attention button:last-child { border-bottom: 0; }
.attention button:hover { background: var(--surface-2); }
.hbar { display: grid; grid-template-columns: 200px 1fr 80px; gap: 12px; align-items: center; margin: 8px 0; font-size: 13.5px; }
.hbar .track { background: var(--surface-2); border-radius: 4px; height: 8px; overflow: hidden; }
.hbar .fill { background: var(--accent); height: 100%; border-radius: 4px; }
.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.filters input, .filters select { width: auto; min-width: 140px; }


/* ---------- Financeiro ---------- */
.month-picker { display: inline-flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 2px 4px; }
.month-picker strong { min-width: 150px; text-align: center; font-weight: 600; }
.close-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 20px; align-items: start; margin-bottom: 8px; }
.section-h { margin: 28px 0 12px; }
.checklist { display: flex; flex-direction: column; }
.check-item { display: grid; grid-template-columns: 28px 1fr auto; gap: 12px; align-items: start; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.check-item:last-child { border-bottom: 0; }
.check-ico { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; }
.check-ico.ok { background: var(--ok-soft); color: var(--ok); }
.check-ico.warn { background: var(--warn-soft); color: var(--warn); }
.check-ico.danger { background: var(--danger-soft); color: var(--danger); }
.check-title { font-weight: 600; }
.check-body input { margin-top: 8px; }
.dre td { padding: 8px 14px; }
.dre tr.dre-total td { font-weight: 650; background: var(--surface-2); }
.dre tr.dre-strong td { font-size: 15px; }
.dre tr.dre-below td { color: var(--muted); }
.dre tr.dre-sub td { font-size: 12.5px; color: var(--muted); padding-left: 30px; background: transparent; }
.dre-toggle { color: inherit; font-weight: inherit; text-align: left; }
.dre-toggle::after { content: " ▸"; color: var(--muted); font-size: 11px; }
.num.neg, tr.neg td { color: var(--danger); }
.num.pos, tr.pos td { color: var(--ok); }
.v.neg { color: var(--danger); } .v.pos { color: var(--ink); }
.nowrap { white-space: nowrap; }
.bulk { position: sticky; top: 8px; z-index: 5; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 12px;
  background: var(--surface); border: 1px solid var(--accent); border-radius: var(--radius); box-shadow: var(--shadow-2); }
.bulk-count { font-weight: 600; }
.cat-select { min-width: 220px; }
.cat-select.empty { border-color: var(--warn); background: var(--warn-soft); }
table.tx td { vertical-align: top; }
.report-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 20px; padding-bottom: 14px; border-bottom: 2px solid var(--ink); }
.signatures { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; margin-top: 64px; }
.signatures div { border-top: 1px solid var(--ink); padding-top: 6px; text-align: center; font-size: 12.5px; }
@media (max-width: 1100px) { .close-grid { grid-template-columns: 1fr; } }
@media print {
  :root { --bg: #fff; }
  .sidebar, .mobilebar, .no-print, .toast { display: none !important; }
  .app { display: block; }
  main { padding: 0; max-width: none; }
  .card { box-shadow: none; break-inside: avoid; }
  .dre tr.dre-sub { display: table-row !important; }
  .hero { grid-template-columns: repeat(4, 1fr); }
  .dre-toggle::after { content: ""; }
}


/* ---------- Gestão financeira ---------- */
.alloc-bar { display: flex; height: 22px; border-radius: 6px; overflow: hidden; background: var(--surface-2); }
.alloc-bar span { display: block; height: 100%; }
.alloc-0, i.alloc-0 { background: #4f6d7a; } .alloc-1, i.alloc-1 { background: #c08b2c; } .alloc-2, i.alloc-2 { background: #8d6fb5; }
.alloc-3, i.alloc-3 { background: #2f8f83; } .alloc-4, i.alloc-4 { background: #c25b56; } .alloc-5, i.alloc-5 { background: #6b7280; }
.alloc-free, i.alloc-free { background: repeating-linear-gradient(45deg, var(--ok), var(--ok) 6px, #4caf6e 6px, #4caf6e 12px); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--ink-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
details.commit, .commit { border-bottom: 1px solid var(--line); padding: 12px 16px; }
details.commit summary { display: flex; justify-content: space-between; gap: 12px; list-style: none; }
details.commit summary::-webkit-details-marker { display: none; }
.commit.total { display: flex; justify-content: space-between; background: var(--surface-2); border-bottom: 0; font-weight: 600; }
table.kv td { padding: 7px 14px; }
table.kv tr.dre-total td { font-weight: 650; background: var(--surface-2); }
table.kv tr.neg td:last-child { color: var(--danger); }
.meter { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; margin-top: 4px; width: 110px; }
.meter span { display: block; height: 100%; background: var(--warn); }
.meter span.ok { background: var(--ok); }
.text-out { width: 100%; min-height: 460px; font-family: ui-monospace, Consolas, monospace; font-size: 13px; line-height: 1.5; white-space: pre-wrap; }

/* Convenção: campo azul = entrada manual; verde = calculado */
input.in-manual { background: #eef4ff; border-color: #b9cdf3; }
.out-calc { background: #eaf6ee; color: #1f6b3a; font-weight: 600; }
:root[data-theme="dark"] input.in-manual { background: #1d2a40; border-color: #34507d; color: var(--ink); }
:root[data-theme="dark"] .out-calc { background: #183326; color: #8fd6a8; }

/* ---------- Painel de KPIs ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 16px; align-items: start; }
@media (max-width: 520px) { .kpi-grid { grid-template-columns: 1fr; } }
.kpi-row { display: flex; flex-wrap: wrap; gap: 12px 28px; }
.kpi-big { min-width: 160px; }
.kpi-value { font-size: 26px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; margin: 2px 0; }
.kpi-value.neg { color: var(--danger); }
.kpi-block table td { padding: 4px 8px; }

/* ---------- Diálogo / toast ---------- */
dialog { border: 1px solid var(--line); border-radius: 14px; padding: 0; width: min(720px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-2); }
dialog::backdrop { background: rgba(15, 23, 42, .35); }
.dlg-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.dlg-body { padding: 20px; max-height: 70vh; overflow: auto; }
.dlg-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--line); }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--surface); padding: 10px 18px; border-radius: 10px; z-index: 50; box-shadow: var(--shadow-2); max-width: calc(100vw - 32px); }

/* ---------- Responsivo ---------- */
@media (max-width: 1100px) {
  .work-body { grid-template-columns: 1fr; }
  .hero { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 30; left: 0; top: 0; width: 260px; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-2); }
  .app.menu-open .sidebar { transform: none; }
  .mobilebar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
  main { padding: 18px 16px 40px; }
  .focus { grid-template-columns: 1fr; }
  .qlist { max-height: 320px; }
  .work-head, .work-body, .register, .footer-bar { padding-left: 16px; padding-right: 16px; }
  .hbar { grid-template-columns: 120px 1fr 56px; }
}
@media (max-width: 520px) { .hero { grid-template-columns: 1fr; } }

/* Evolução e metas: variação e situação da meta */
.ok-text { color: var(--ok); }
.warn-text { color: var(--warn); }
.danger-text { color: var(--danger); }

/* ---------- Minha remuneração (CRC) ---------- */
.comp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; align-items: start; }
.comp-big { font-size: 30px; font-weight: 800; letter-spacing: -.5px; margin: 2px 0; }
.comp-line { padding: 8px 0; border-top: 1px solid var(--line); }
.comp-bar { position: relative; height: 10px; border-radius: 6px; background: var(--surface-2); margin: 6px 0 4px; overflow: hidden; }
.comp-bar i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent, #0f766e); border-radius: 6px; }
.comp-bar b { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--ink-2); opacity: .5; }
.comp-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.comp-row.spread { justify-content: space-between; }
.comp-clinic { margin-top: 10px; padding: 10px; border-radius: 10px; background: var(--surface-2); }
.comp-clinic table { width: 100%; margin: 6px 0; }

/* ---------- ficha do paciente (CRC) ---------- */
.pt-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.pt-span { grid-column: 1 / -1; }
@media (max-width: 1100px) { .pt-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .pt-grid { grid-template-columns: 1fr; } }
.opp-table { width: 100%; }
.opp-table td { vertical-align: top; }
.opp-desc { font-weight: 600; }
.nowrap { white-space: nowrap; }
.owner-sel { width: 100%; max-width: 200px; min-width: 120px; }

/* Minha agenda: semana em grade (telas largas) e lista por dia (celular). */
.cal-wrap { padding: 0; overflow-x: auto; }
.cal-week { display: grid; grid-template-columns: 56px repeat(7, minmax(110px, 1fr)); min-width: 860px; }
.cal-corner, .cal-dayhead, .cal-alldaylabel, .cal-allday { border-bottom: 1px solid var(--line); }
.cal-dayhead { padding: 8px; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12px; color: var(--muted); border-left: 1px solid var(--line); }
.cal-dayhead strong { font-size: 16px; color: var(--ink); }
.cal-dayhead.today strong { color: var(--accent); }
.cal-alldaylabel { padding: 6px; text-align: right; }
.cal-allday { min-height: 34px; padding: 4px; display: flex; flex-direction: column; gap: 3px; border-left: 1px solid var(--line); cursor: pointer; }
.cal-hours { grid-column: 1; }
.cal-hour { font-size: 11px; color: var(--muted); text-align: right; padding: 0 6px; transform: translateY(-7px); }
.cal-col { position: relative; border-left: 1px solid var(--line); cursor: pointer; }
.cal-col.today, .cal-allday.today { background: var(--accent-soft); }
.cal-slot { border-top: 1px solid var(--line); }
.cal-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--danger); z-index: 2; pointer-events: none; }
.cal-ev { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; text-align: left; border: 0; border-left: 4px solid var(--ev); border-radius: 6px;
  background: var(--ev-soft); color: var(--ink); padding: 3px 6px; font: inherit; font-size: 12px; line-height: 1.25; cursor: pointer; overflow: hidden; }
.cal-col .cal-ev { position: absolute; left: 3px; right: 3px; width: auto; z-index: 1; }
.cal-ev-time { font-size: 11px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.cal-ev-title { font-weight: 600; }
.cal-ev.done { opacity: .5; }
.cal-ev.done .cal-ev-title { text-decoration: line-through; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 10px; }
.cal-key { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
.cal-key::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--ev); }
.cat-atendimento { --ev: #0f766e; --ev-soft: #e6f4f2; }
.cat-gravacao { --ev: #7c3aed; --ev-soft: #f1ebfe; }
.cat-entrevista { --ev: #c2410c; --ev-soft: #fdeee4; }
.cat-reuniao { --ev: #1d4ed8; --ev-soft: #e7eefc; }
.cat-administrativo { --ev: #a16207; --ev-soft: #fbf3dc; }
.cat-pessoal { --ev: #be185d; --ev-soft: #fbe7f1; }
.cat-outro { --ev: #4b5563; --ev-soft: #eef0f3; }
:root[data-theme="dark"] .cal-ev { color: var(--ink); }
:root[data-theme="dark"] [class*="cat-"] { --ev-soft: color-mix(in srgb, var(--ev) 22%, var(--surface)); }
.cal-list { display: none; flex-direction: column; gap: 10px; }
.cal-listday .cal-ev { margin-top: 6px; }
.cal-listday.today { border-color: var(--accent); }
@media (max-width: 760px) { .cal-wrap { display: none; } .cal-list { display: flex; } }

/* Funil de orçamentos no Atendimento */
.funnel { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr; align-items: stretch; gap: 8px; }
.funnel-arrow { align-self: center; color: var(--muted); font-size: 20px; }
.funnel-step.ok .v { color: var(--ok); }
.funnel-step.warn .v { color: var(--warn); }
@media (max-width: 860px) { .funnel { grid-template-columns: 1fr 1fr; } .funnel-arrow { display: none; } }

/* ---------- Caixa da recepção ---------- */
.cx-check { margin-bottom: 14px; }
.cx-task { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.cx-task:first-of-type { border-top: 0; }
.cx-box { flex: none; width: 24px; height: 24px; border-radius: 7px; border: 2px solid var(--line); display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.cx-task.done .cx-box { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.cx-task.warn .cx-box { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }
.cx-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.cx-actions .btn { min-height: 44px; }
.cx-ok { border-color: var(--ok); }
.cx-bad { border-color: var(--warn); background: var(--warn-soft); }
.cx-mini { width: 100%; margin-top: 8px; font-size: 13.5px; }
.cx-mini td { padding: 3px 0; }
.cx-profiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
.cx-profiles .btn { min-height: 52px; justify-content: center; font-size: 15px; }
