/* ============================================================================
   Integração Banco Cora — réplica PIXEL-IDÊNTICA da página do Portal Mensalidades
   (React+Tailwind+shadcn "new-york", modo claro) reproduzida em CSS puro.
   TUDO escopado sob .cora-root para não colidir com o resto do ERP.
   Paleta/medidas extraídas de mensalidades-soalhe/client/src (index.css + ui/*).
   ========================================================================== */

.cora-root{
  /* ---- tokens shadcn (já em hex, sem HSL) ---- */
  --radius: 0.625rem;
  --background:#f0f0f2; --foreground:#1f2937;
  --card:#ffffff; --card-foreground:#1f2937;
  --popover:#ffffff; --popover-foreground:#1f2937;
  --primary:#C9A227; --primary-foreground:#111111;
  --secondary:#FBF5E0; --secondary-foreground:#8B6914;
  --muted:#f0f0f2; --muted-foreground:#6b7280;
  --accent:#FBF5E0; --accent-foreground:#8B6914;
  --destructive:#dc2626; --destructive-foreground:#ffffff;
  --border:#e5e7eb; --input:#d1d5db; --ring:#C9A227;
  --gold:#C9A227; --black:#1F1F1F;

  max-width:80rem; margin:0 auto; padding:16px;
  display:flex; flex-direction:column; gap:16px;
  font-family:'Inter',ui-sans-serif,system-ui,sans-serif;
  color:var(--foreground); font-size:16px; line-height:1.5;
  text-align:left;
}
.cora-root *{ box-sizing:border-box; }
.cora-root .cr-stack{ display:flex; flex-direction:column; gap:1rem; }

/* ---- spinner ---- */
@keyframes cr-spin{ to{ transform:rotate(360deg); } }
.cora-root .cr-spin{ animation:cr-spin 1s linear infinite; }

/* ---- icons ---- */
.cora-root svg.cr-ic{ display:inline-block; vertical-align:middle; flex-shrink:0; }

/* ───────── HEADER ───────── */
.cora-root .cr-header{
  background:var(--black); border-bottom:3px solid var(--gold);
  border-radius:10px 10px 0 0; padding:18px 24px;
  display:flex; align-items:center; justify-content:space-between; gap:14px; flex-wrap:wrap;
}
.cora-root .cr-header .cr-eyebrow{ font-size:11px; font-weight:600; letter-spacing:.12em; color:var(--gold); text-transform:uppercase; }
.cora-root .cr-header .cr-htitle{ font-size:20px; font-weight:700; color:#fff; }
.cora-root .cr-header .cr-hsub{ font-size:11px; color:#9ca3af; margin-top:2px; }
.cora-root .cr-pill{
  display:inline-flex; align-items:center; gap:6px; padding:6px 10px; border-radius:999px;
  font-size:11px; font-weight:600; border:1px solid transparent;
}

/* ───────── TABS (barra escura principal) ───────── */
.cora-root .cr-tabs{ display:flex; width:100%; justify-content:flex-start; gap:4px;
  background:#111; border-bottom:1px solid var(--gold); border-radius:0; padding:4px; flex-wrap:wrap; }
.cora-root .cr-tab{
  display:inline-flex; align-items:center; gap:8px; height:2.25rem; padding:4px 10px;
  border:1px solid transparent; border-radius:8px; background:none; cursor:pointer;
  font-size:.875rem; font-weight:500; color:#9ca3af; white-space:nowrap;
  font-family:inherit; transition:color .15s,background .15s;
}
.cora-root .cr-tab:hover{ color:#d1d5db; }
.cora-root .cr-tab.is-active{ color:#eab308; background:rgba(0,0,0,.4); }

/* sub-tabs claras (Boletos: Locais/Na Cora) */
.cora-root .cr-subtabs{ display:inline-flex; height:2.25rem; align-items:center; background:var(--muted);
  border-radius:10px; padding:3px; gap:0; margin-bottom:1rem; width:fit-content; }
.cora-root .cr-subtab{ display:inline-flex; align-items:center; gap:6px; height:calc(100% - 1px);
  padding:4px 10px; border:1px solid transparent; border-radius:8px; background:none; cursor:pointer;
  font-size:.875rem; font-weight:500; color:var(--foreground); font-family:inherit; white-space:nowrap; }
.cora-root .cr-subtab.is-active{ background:var(--background); box-shadow:0 1px 3px 0 rgb(0 0 0/.1),0 1px 2px -1px rgb(0 0 0/.1); }

/* ───────── CARD ───────── */
.cora-root .cr-card{ display:flex; flex-direction:column; gap:1.5rem; background:var(--card);
  color:var(--card-foreground); border:1px solid var(--border); border-radius:14px;
  padding:1.5rem 0; box-shadow:0 1px 3px 0 rgb(0 0 0/.1),0 1px 2px -1px rgb(0 0 0/.1); }
.cora-root .cr-card-header{ padding:0 1.5rem; display:flex; flex-direction:column; gap:.5rem; }
.cora-root .cr-card-title{ font-weight:600; line-height:1; font-size:16px; display:flex; align-items:center; gap:.5rem; }
.cora-root .cr-card-title.cr-base{ font-size:16px; }
.cora-root .cr-card-desc{ font-size:.875rem; color:var(--muted-foreground); }
.cora-root .cr-card-content{ padding:0 1.5rem; }
.cora-root .cr-row-between{ display:flex; align-items:flex-start; justify-content:space-between; gap:.75rem; flex-wrap:wrap; }

/* ───────── BUTTONS ───────── */
.cora-root .cr-btn{ display:inline-flex; align-items:center; justify-content:center; gap:.5rem;
  white-space:nowrap; border-radius:8px; font-size:.875rem; font-weight:500; height:2.25rem;
  padding:.5rem 1rem; border:0; cursor:pointer; font-family:inherit; transition:all .15s ease; line-height:1; }
.cora-root .cr-btn:disabled{ pointer-events:none; opacity:.5; }
.cora-root .cr-btn.cr-semibold{ font-weight:600; }
.cora-root .cr-btn--default{ background:var(--primary); color:var(--primary-foreground); }
.cora-root .cr-btn--default:hover{ background:rgba(201,162,39,.9); }
.cora-root .cr-btn--outline{ background:transparent; border:1px solid var(--border); box-shadow:0 1px 2px 0 rgb(0 0 0/.05); color:var(--foreground); }
.cora-root .cr-btn--outline:hover{ background:var(--accent); color:var(--accent-foreground); }
.cora-root .cr-btn--gold-outline{ background:transparent; border:1px solid var(--gold); color:var(--gold); box-shadow:0 1px 2px 0 rgb(0 0 0/.05); font-weight:600; }
.cora-root .cr-btn--gold-outline:hover{ background:rgba(201,162,39,.08); }
.cora-root .cr-btn--gold{ background:var(--gold); color:var(--black); font-weight:600; }
.cora-root .cr-btn--gold:hover{ opacity:.9; }
.cora-root .cr-btn--ghost{ background:transparent; color:var(--foreground); }
.cora-root .cr-btn--ghost:hover{ background:var(--accent); color:var(--accent-foreground); }
.cora-root .cr-btn--destructive{ background:var(--destructive); color:#fff; }
.cora-root .cr-btn--destructive:hover{ background:rgba(220,38,38,.9); }
.cora-root .cr-btn--sm{ height:2rem; padding:0 .75rem; gap:.375rem; }
.cora-root .cr-btn--h6{ height:1.5rem; padding:0 .5rem; gap:.25rem; font-size:10px; }
.cora-root .cr-btn--h7{ height:1.75rem; padding:0 .5rem; }

/* ───────── BADGES ───────── */
.cora-root .cr-badge{ display:inline-flex; align-items:center; justify-content:center; gap:.25rem;
  border:1px solid transparent; border-radius:8px; padding:.125rem .5rem; font-size:.75rem;
  font-weight:500; white-space:nowrap; width:fit-content; line-height:1rem; }
.cora-root .cr-badge.cr-10{ font-size:10px; }
.cora-root .cr-badge.cr-semibold{ font-weight:600; }
.cora-root .cr-badge--outline{ color:var(--foreground); border:1px solid var(--border); background:transparent; }
/* status palettes (Tailwind v3) */
.cora-root .cr-bg-emerald{ background:#d1fae5; color:#047857; border-color:#6ee7b7; }
.cora-root .cr-bg-blue{ background:#dbeafe; color:#1d4ed8; border-color:#93c5fd; }
.cora-root .cr-bg-cyan{ background:#cffafe; color:#0e7490; border-color:#67e8f9; }
.cora-root .cr-bg-red{ background:#fee2e2; color:#b91c1c; border-color:#fca5a5; }
.cora-root .cr-bg-amber{ background:#fef3c7; color:#b45309; border-color:#fcd34d; }
.cora-root .cr-bg-gray1{ background:#f3f4f6; color:#4b5563; border-color:#d1d5db; }
.cora-root .cr-bg-gray2{ background:#e5e7eb; color:#4b5563; border-color:#d1d5db; }
.cora-root .cr-sync-ok{ background:#d1fae5; color:#059669; border:1px solid #6ee7b7; }
.cora-root .cr-sync-warn{ background:#fef3c7; color:#d97706; border:1px solid #fcd34d; }
.cora-root .cr-badge-gold{ background:rgba(201,162,39,.15); color:var(--gold); border:1px solid rgba(201,162,39,.33); font-weight:600; }

/* ───────── INPUT / LABEL / SELECT / CHECKBOX ───────── */
.cora-root .cr-field{ display:flex; flex-direction:column; gap:.25rem; }
.cora-root .cr-label{ font-size:12px; font-weight:500; line-height:1; color:var(--foreground); }
.cora-root .cr-input{ height:2.25rem; width:100%; min-width:0; border:1px solid var(--input);
  border-radius:8px; background:#fff; padding:.25rem .75rem; font-size:.875rem; color:var(--foreground);
  box-shadow:0 1px 2px 0 rgb(0 0 0/.05); outline:none; font-family:inherit; }
.cora-root .cr-input::placeholder{ color:var(--muted-foreground); }
.cora-root .cr-input:focus{ border-color:var(--ring); box-shadow:0 0 0 3px rgba(201,162,39,.5); }
.cora-root select.cr-input{ cursor:pointer; appearance:none;
  background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>");
  background-repeat:no-repeat; background-position:right .5rem center; padding-right:1.75rem; }
.cora-root .cr-check{ width:1rem; height:1rem; flex-shrink:0; border:1px solid var(--input);
  border-radius:4px; background:#fff; box-shadow:0 1px 2px 0 rgb(0 0 0/.05); cursor:pointer;
  appearance:none; position:relative; margin:0; }
.cora-root .cr-check:checked{ background:var(--primary); border-color:var(--primary); }
.cora-root .cr-check:checked::after{ content:""; position:absolute; left:4px; top:1px; width:5px; height:9px;
  border:solid var(--primary-foreground); border-width:0 2px 2px 0; transform:rotate(45deg); }
.cora-root .cr-check:disabled{ opacity:.5; cursor:not-allowed; }
.cora-root .cr-check:focus-visible{ outline:none; box-shadow:0 0 0 3px rgba(201,162,39,.5); }

/* ───────── TABLE ───────── */
.cora-root .cr-tbl-wrap{ border:1px solid var(--border); border-radius:8px; overflow:hidden; }
.cora-root .cr-tbl-scroll{ width:100%; overflow-x:auto; }
.cora-root table.cr-tbl{ width:100%; border-collapse:collapse; font-size:.875rem; }
.cora-root table.cr-tbl thead tr{ border-bottom:1px solid var(--border); }
.cora-root table.cr-tbl th{ height:2.5rem; padding:0 .5rem; text-align:left; vertical-align:middle;
  white-space:nowrap; font-weight:500; color:var(--foreground); }
.cora-root table.cr-tbl td{ padding:.5rem; vertical-align:middle; }
.cora-root table.cr-tbl tbody tr{ border-bottom:1px solid var(--border); transition:background .15s; }
.cora-root table.cr-tbl tbody tr:last-child{ border-bottom:0; }
.cora-root table.cr-tbl tbody tr:hover{ background:rgba(240,240,242,.5); }
.cora-root table.cr-tbl tr.cr-subtotal{ background:rgba(201,162,39,.14); font-weight:700; }
.cora-root table.cr-tbl tr.cr-subtotal:hover{ background:rgba(201,162,39,.14); }
.cora-root table.cr-tbl tr.cr-subtotal td{ padding:.7rem .9rem; border-top:1px solid rgba(201,162,39,.4); border-bottom:1px solid rgba(201,162,39,.4); }
/* Card de fechamento diário — fontes maiores e claras */
.cora-root .cr-fech{ display:flex; align-items:center; justify-content:space-between; gap:.6rem 1.25rem; flex-wrap:wrap; padding:.2rem 0; }
.cora-root .cr-fech-dia{ font-size:15.5px; font-weight:800; color:var(--black); display:flex; align-items:center; gap:.45rem; white-space:nowrap; }
.cora-root .cr-fech-mov{ display:flex; align-items:center; gap:.5rem; flex-wrap:wrap; font-size:14.5px; font-weight:600; }
.cora-root .cr-fech-in{ color:#047857; } .cora-root .cr-fech-out{ color:#b91c1c; } .cora-root .cr-fech-res{ font-weight:800; }
.cora-root .cr-fech-sep{ color:var(--muted-foreground); }
.cora-root .cr-fech-saldo{ display:flex; align-items:center; gap:.6rem; margin-left:auto; background:rgba(201,162,39,.11); border:1px solid rgba(201,162,39,.5); border-radius:.65rem; padding:.4rem .9rem; }
.cora-root .cr-fech-saldo-lbl{ font-size:11px; line-height:1.05; color:#9a7b16; font-weight:800; text-transform:uppercase; letter-spacing:.03em; text-align:right; }
.cora-root .cr-fech-saldo-val{ font-size:26px; font-weight:800; color:var(--black); font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace; letter-spacing:-.01em; white-space:nowrap; }
.cora-root .cr-sortbtn{ display:inline-flex; align-items:center; gap:.25rem; background:none; border:0;
  cursor:pointer; font:inherit; font-weight:500; color:inherit; padding:0; }
.cora-root .cr-sortbtn:hover{ color:var(--foreground); }

/* ───────── KPI CARDS (Extrato / Conciliação) ───────── */
.cora-root .cr-kpis{ display:grid; grid-template-columns:repeat(1,1fr); gap:.75rem; }
@media(min-width:768px){ .cora-root .cr-kpis{ grid-template-columns:repeat(2,1fr); } }
@media(min-width:1024px){ .cora-root .cr-kpis{ grid-template-columns:repeat(4,1fr); } }
.cora-root .cr-kpi{ border:1px solid var(--border); border-radius:8px; padding:.75rem; display:flex; align-items:center; gap:.75rem; }
.cora-root .cr-kpi-label{ font-size:12px; color:var(--muted-foreground); }
.cora-root .cr-kpi-val{ font-size:1.25rem; font-weight:700; }
.cora-root .cr-kpi-sub{ font-size:10px; color:var(--muted-foreground); }
.cora-root .cr-kpigrid{ display:grid; grid-template-columns:repeat(2,1fr); gap:.75rem; margin-bottom:1rem; }
@media(min-width:768px){ .cora-root .cr-kpigrid{ grid-template-columns:repeat(5,1fr); } }
.cora-root .cr-kpibox{ border:1px solid var(--border); border-radius:8px; padding:.75rem; }
.cora-root .cr-kpibox .cr-v{ font-size:1.5rem; font-weight:700; }

/* ───────── ALERT ───────── */
.cora-root .cr-alert{ position:relative; width:100%; display:grid; grid-template-columns:1rem 1fr;
  column-gap:.75rem; row-gap:.125rem; align-items:start; border:1px solid var(--border);
  border-radius:10px; padding:.75rem 1rem; font-size:.875rem; background:var(--card); color:var(--card-foreground); }
.cora-root .cr-alert > .cr-ic{ margin-top:2px; }
.cora-root .cr-alert-title{ grid-column-start:2; font-weight:500; letter-spacing:-.0125em; }
.cora-root .cr-alert-desc{ grid-column-start:2; font-size:.875rem; color:var(--muted-foreground); }
.cora-root .cr-alert-desc.cr-12{ font-size:12px; }
.cora-root .cr-alert--destructive{ color:var(--destructive); }
.cora-root .cr-alert--destructive .cr-alert-desc{ color:rgba(220,38,38,.9); }
.cora-root .cr-alert--gold{ border-color:rgba(201,162,39,.33); background:rgba(201,162,39,.05); }

/* ───────── DIALOG ───────── */
.cora-root--modalhost{ }
.cr-overlay{ position:fixed; inset:0; z-index:9000; background:rgba(0,0,0,.5); display:flex; align-items:center; justify-content:center; }
.cr-dialog{ position:relative; background:#f0f0f2; border:1px solid #e5e7eb; border-radius:10px;
  padding:1.5rem; box-shadow:0 10px 15px -3px rgb(0 0 0/.1),0 4px 6px -4px rgb(0 0 0/.1);
  width:100%; max-width:32rem; margin:1rem; display:flex; flex-direction:column; gap:1rem;
  font-family:'Inter',ui-sans-serif,system-ui,sans-serif; color:#1f2937; max-height:92vh; overflow:auto; }
.cr-dialog.cr-dlg-xl{ max-width:42rem; } .cr-dialog.cr-dlg-lg{ max-width:32rem; }
.cr-dialog.cr-dlg-pdf{ max-width:98vw; width:98vw; height:96vh; padding:0; gap:0; overflow:hidden; }
.cr-dialog-title{ font-size:1.125rem; font-weight:600; line-height:1; display:flex; align-items:center; gap:.5rem; }
.cr-dialog-desc{ font-size:.875rem; color:#6b7280; }
.cr-dialog-footer{ display:flex; justify-content:flex-end; gap:.5rem; flex-wrap:wrap; }
.cr-dialog code{ font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace; font-size:.85em;
  background:rgba(0,0,0,.05); padding:1px 4px; border-radius:4px; }

/* ───────── STATUS/INFO ROWS (Config) ───────── */
.cora-root .cr-statusrow{ display:flex; align-items:flex-start; gap:.5rem; }
.cora-root .cr-statusrow .cr-srlabel{ font-weight:500; font-size:.875rem; }
.cora-root .cr-statusrow .cr-srdetail{ font-size:12px; color:var(--muted-foreground); }
.cora-root .cr-inforow{ display:flex; align-items:flex-start; justify-content:space-between; gap:.5rem;
  padding:.25rem 0; border-bottom:1px solid var(--border); }
.cora-root .cr-inforow:last-child{ border-bottom:0; }
.cora-root .cr-grid2{ display:grid; grid-template-columns:1fr; gap:1rem; }
@media(min-width:768px){ .cora-root .cr-grid2{ grid-template-columns:repeat(2,1fr); } }

/* ───────── utilitários ───────── */
.cora-root .cr-mono{ font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace; }
.cora-root .cr-muted{ color:var(--muted-foreground); }
.cora-root .cr-xs{ font-size:12px; } .cora-root .cr-10{ font-size:10px; } .cora-root .cr-11{ font-size:11px; }
.cora-root .cr-sm{ font-size:.875rem; } .cora-root .cr-medium{ font-weight:500; } .cora-root .cr-semibold{ font-weight:600; } .cora-root .cr-bold{ font-weight:700; }
.cora-root .cr-emerald{ color:#10b981; } .cora-root .cr-emerald7{ color:#047857; } .cora-root .cr-red{ color:#ef4444; } .cora-root .cr-red6{ color:#dc2626; }
.cora-root .cr-gold{ color:var(--gold); } .cora-root .cr-black{ color:var(--black); }
.cora-root .cr-right{ text-align:right; } .cora-root .cr-center{ text-align:center; }
.cora-root .cr-filters{ display:flex; flex-wrap:wrap; align-items:flex-end; gap:.75rem; margin-bottom:1rem; }
.cora-root .cr-actions{ display:flex; gap:.5rem; flex-wrap:wrap; justify-content:flex-end; }
.cora-root .cr-ml-auto{ margin-left:auto; }
.cora-root .cr-truncate{ white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:28rem; }
.cora-root .cr-w-search{ max-width:28rem; }
.cora-root .cr-empty{ text-align:center; color:var(--muted-foreground); padding:2rem 0; }
.cora-root .cr-pdf-bar{ display:flex; align-items:center; justify-content:space-between; gap:.75rem; padding:.75rem 1rem; border-bottom:1px solid #e5e7eb; }
.cora-root .cr-flow-note{ font-size:11px; color:var(--muted-foreground); margin-bottom:.75rem; display:flex; align-items:center; gap:4px; }
