@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@500;600;700&display=swap');

/* =========================================================
   DESIGN TOKENS
   ========================================================= */
:root {
  /* surfaces */
  --bg: #090b10;
  --bg-aurora-1: rgba(79, 124, 255, .10);
  --bg-aurora-2: rgba(34, 211, 166, .07);
  --surface: #12141b;
  --surface-2: #171a23;
  --surface-3: #1d212c;
  --border: rgba(148, 163, 184, .10);
  --border-strong: rgba(148, 163, 184, .20);

  /* text */
  --ink: #edf1f7;
  --ink-dim: #8b93a7;
  --ink-faint: #5b6478;

  /* brand */
  --brand: #5b7cfa;
  --brand-2: #7c5cfa;
  --brand-soft: rgba(91, 124, 250, .12);
  --brand-ring: rgba(91, 124, 250, .35);

  --mint: #22d3a6;
  --mint-soft: rgba(34, 211, 166, .12);

  --violet: #a78bfa;
  --violet-soft: rgba(167, 139, 250, .12);

  --rose: #fb5573;
  --rose-soft: rgba(251, 85, 115, .12);

  --amber: #f5b94d;
  --amber-soft: rgba(245, 185, 77, .12);

  --whatsapp: #23c369;

  /* system */
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, .22);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, .35);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, .5);
  --ease: cubic-bezier(.4, 0, .2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html { color-scheme: dark; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

/* smooth momentum scroll on touch devices */
.content, .table-wrap, .op-detail-parcelas, .report-result, .modal {
  -webkit-overflow-scrolling: touch;
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ambient aurora wash behind the whole app */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(720px 420px at 14% -6%, var(--bg-aurora-1), transparent 60%),
    radial-gradient(640px 420px at 100% 10%, var(--bg-aurora-2), transparent 55%);
}

::selection { background: var(--brand-ring); color: #fff; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 20px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

.icon { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.icon-sm { width: 14px; height: 14px; }
.icon-lg { width: 22px; height: 22px; }

/* =========================================================
   LAYOUT SHELL
   ========================================================= */
.app { display: flex; min-height: 100vh; position: relative; z-index: 1; }

.sidebar {
  width: 252px;
  background: linear-gradient(180deg, rgba(18, 20, 27, .92), rgba(15, 17, 23, .96));
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-right: 1px solid var(--border);
  padding: 22px 14px;
  padding-top: max(22px, env(safe-area-inset-top));
  padding-bottom: max(22px, env(safe-area-inset-bottom));
  padding-left: max(14px, env(safe-area-inset-left));
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 26px;
  transition: transform .32s var(--ease);
  z-index: 100;
  will-change: transform;
  isolation: isolate;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 14px;
  border-bottom: 1px solid var(--border);
}

.brand-mark {
  width: 34px; height: 34px;
  border-radius: 10px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 4px 16px var(--brand-ring);
  color: #fff;
  flex-shrink: 0;
}
.brand-mark .icon { width: 19px; height: 19px; stroke-width: 2.1; }

.brand-name {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -.01em;
  line-height: 1.1;
}
.brand-sub {
  display: block;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: .7rem;
  color: var(--ink-faint);
  margin-top: 1px;
  letter-spacing: .02em;
}

nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }

.nav-item {
  background: none;
  border: none;
  color: var(--ink-dim);
  display: flex;
  align-items: center;
  gap: 11px;
  text-align: left;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: .88rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  position: relative;
  transition: background .18s var(--ease), color .18s var(--ease);
}

.nav-item .nav-icon { color: var(--ink-faint); transition: color .18s var(--ease); }

.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item:hover .nav-icon { color: var(--ink-dim); }

.nav-item.active {
  background: var(--brand-soft);
  color: #cdd8ff;
  font-weight: 600;
}
.nav-item.active .nav-icon { color: var(--brand); }
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -14px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px;
  border-radius: 0 4px 4px 0;
  background: linear-gradient(180deg, var(--brand), var(--brand-2));
  box-shadow: 0 0 12px var(--brand-ring);
}

.sidebar-foot {
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

.status-pod {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .78rem;
  color: var(--ink-dim);
}
.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 0 0 rgba(34, 211, 166, .55);
  animation: pulseDot 2.2s ease-out infinite;
  flex-shrink: 0;
}
@keyframes pulseDot {
  0% { box-shadow: 0 0 0 0 rgba(34, 211, 166, .5); }
  70% { box-shadow: 0 0 0 7px rgba(34, 211, 166, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 211, 166, 0); }
}

/* =========================================================
   MAIN CONTENT / TOPBAR
   ========================================================= */
.content { flex: 1; margin-left: 252px; padding: 22px 32px 64px; position: relative; }

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 26px;
  padding: max(10px, env(safe-area-inset-top)) 4px 18px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(9, 11, 16, .78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  margin-left: -4px;
  margin-right: -4px;
  padding-left: 4px;
  padding-right: 4px;
}

.topbar-titles { flex: 1; min-width: 0; }

.topbar h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: -.015em;
}
.topbar-eyebrow {
  display: block;
  font-size: .78rem;
  color: var(--ink-faint);
  font-weight: 500;
  margin-bottom: 2px;
}

.menu-toggle {
  display: none;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--ink);
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: background .15s var(--ease), border-color .15s var(--ease), transform .15s var(--ease);
}
.menu-toggle:hover { background: var(--surface-3); border-color: var(--border-strong); }
.menu-toggle:active { transform: scale(.92); }

.sidebar-backdrop {
  position: fixed; inset: 0;
  background: rgba(5, 7, 12, .55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 90;
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s var(--ease), visibility 0s linear .3s;
  cursor: pointer;
}
.sidebar-backdrop.open {
  opacity: 1;
  visibility: visible;
  transition: opacity .3s var(--ease), visibility 0s linear 0s;
}

/* =========================================================
   BUTTONS
   ========================================================= */
.btn {
  border: none;
  border-radius: 10px;
  padding: 10px 18px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  font-size: .87rem;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: transform .15s var(--ease), box-shadow .2s var(--ease), background .18s var(--ease), opacity .15s var(--ease), border-color .15s var(--ease);
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  box-shadow: 0 2px 14px var(--brand-ring);
}
.btn-primary:hover { box-shadow: 0 4px 22px var(--brand-ring); transform: translateY(-1px); }

.btn-secondary {
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--surface-3); border-color: var(--border-strong); }

.btn-danger { background: var(--rose-soft); color: var(--rose); border: 1px solid rgba(251, 85, 115, .25); }
.btn-danger:hover { background: rgba(251, 85, 115, .2); }

.btn-sm { padding: 6px 12px; font-size: .78rem; }

.btn-whatsapp {
  background: rgba(35, 195, 105, .14);
  color: var(--whatsapp);
  border: 1px solid rgba(35, 195, 105, .28);
  text-decoration: none;
}
.btn-whatsapp:hover { background: rgba(35, 195, 105, .24); }

/* =========================================================
   PAGES
   ========================================================= */
.page { display: none; animation: pageIn .4s var(--ease); }
.page.active { display: block; }
@keyframes pageIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.section-label {
  font-family: 'Space Grotesk', sans-serif;
  font-size: .78rem;
  font-weight: 600;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin: 30px 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-label:first-child { margin-top: 0; }
.section-label .icon { color: var(--ink-faint); }

/* =========================================================
   KPI CARDS
   ========================================================= */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
}

.card {
  background: linear-gradient(160deg, var(--surface), var(--surface-2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  overflow: hidden;
  opacity: 0;
  animation: cardIn .5s var(--ease) forwards;
  animation-delay: calc(var(--i) * .05s);
  box-shadow: var(--shadow-sm);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s var(--ease);
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }

@keyframes cardIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

.card-top { display: flex; align-items: center; justify-content: space-between; }

.kpi-icon {
  width: 32px; height: 32px;
  border-radius: 9px;
  display: grid; place-items: center;
  background: var(--brand-soft);
  color: var(--brand);
}
.kpi-icon.mint { background: var(--mint-soft); color: var(--mint); }
.kpi-icon.rose { background: var(--rose-soft); color: var(--rose); }
.kpi-icon.amber { background: var(--amber-soft); color: var(--amber); }
.kpi-icon.violet { background: var(--violet-soft); color: var(--violet); }
.kpi-icon .icon { width: 16px; height: 16px; }

.card-label { color: var(--ink-dim); font-size: .78rem; font-weight: 500; }

.card-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.44rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}
.card-value.pos { color: var(--mint); }
.card-value.neg { color: var(--rose); }

/* hero variant for the first KPI */
.card-hero {
  grid-column: span 2;
  background: linear-gradient(160deg, rgba(91, 124, 250, .14), var(--surface) 65%);
  border-color: rgba(91, 124, 250, .28);
}
.card-hero::after {
  content: '';
  position: absolute; inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: conic-gradient(from var(--a, 0deg), transparent 0 60%, var(--brand-ring), transparent 78%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: spinBorder 7s linear infinite;
  opacity: .8;
  pointer-events: none;
}
@keyframes spinBorder { to { --a: 360deg; } }
@property --a { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
.card-hero .card-value { font-size: 1.85rem; }

/* =========================================================
   PANELS (chart boxes / table containers, unified look)
   ========================================================= */
.panels-grid {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 14px;
  margin-top: 14px;
}
.dash-panels-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 14px;
}

.chart-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}
.chart-box h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: .92rem;
  margin-bottom: 14px;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}
.chart-box h3 .icon { color: var(--ink-faint); width: 16px; height: 16px; }
.chart-box canvas { max-height: 240px; }

/* =========================================================
   TOOLBAR / INPUTS / SELECTS
   ========================================================= */
.toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }

.field-shell {
  position: relative;
  display: flex;
  align-items: center;
}
.field-shell .icon { position: absolute; left: 13px; color: var(--ink-faint); pointer-events: none; }
.field-shell input { padding-left: 38px; }

.toolbar input,
.toolbar select,
.modal input,
.modal select,
.modal textarea {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--ink);
  padding: 10px 14px;
  border-radius: 9px;
  font-size: .87rem;
  font-family: inherit;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.toolbar input:focus,
.toolbar select:focus,
.modal input:focus,
.modal select:focus,
.modal textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.modal textarea { min-height: 72px; resize: vertical; }

/* =========================================================
   TABLES
   ========================================================= */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
}

table { width: 100%; border-collapse: collapse; min-width: 600px; }
th, td { padding: 13px 16px; text-align: left; font-size: .86rem; border-bottom: 1px solid var(--border); }
th {
  color: var(--ink-faint);
  text-transform: uppercase;
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .05em;
  background: rgba(255, 255, 255, .015);
}
tbody tr { transition: background .15s var(--ease); }
tbody tr:hover td { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: none; }
td.mono { font-family: 'JetBrains Mono', monospace; font-variant-numeric: tabular-nums; }
td.neg { color: var(--rose); }
td.pos { color: var(--mint); font-weight: 600; }
.dias-atraso { color: var(--rose); font-size: .74rem; }

/* empty state row */
td[colspan] { text-align: center; color: var(--ink-faint); padding: 30px 16px; font-size: .85rem; }

/* =========================================================
   BADGES
   ========================================================= */
.badge {
  padding: 4px 11px;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  letter-spacing: .01em;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.badge-pendente, .badge-ativo { background: var(--amber-soft); color: var(--amber); }
.badge-pago, .badge-quitado { background: var(--mint-soft); color: var(--mint); }
.badge-atrasado { background: var(--rose-soft); color: var(--rose); }
.badge-cancelado { background: rgba(148, 163, 184, .12); color: var(--ink-dim); }

/* =========================================================
   MODALS
   ========================================================= */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(5, 7, 12, .68);
  backdrop-filter: blur(6px);
  align-items: center; justify-content: center;
  z-index: 200;
  padding: 20px;
}
.modal-overlay.open { display: flex; }

.modal {
  display: none;
  background: linear-gradient(165deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 26px;
  width: 100%; max-width: 460px;
  max-height: 88vh; overflow-y: auto;
  animation: modalIn .28s var(--ease);
  box-shadow: var(--shadow-lg);
}
.modal.open { display: block; }

@keyframes modalIn { from { opacity: 0; transform: scale(.95) translateY(6px); } to { opacity: 1; transform: scale(1) translateY(0); } }

.modal h2 { font-family: 'Space Grotesk', sans-serif; font-weight: 700; margin-bottom: 18px; font-size: 1.15rem; letter-spacing: -.01em; }
.modal label { display: block; font-size: .78rem; font-weight: 500; color: var(--ink-dim); margin: 13px 0 5px; }
.modal input, .modal select, .modal textarea { width: 100%; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

.preview {
  margin-top: 16px;
  background: var(--brand-soft);
  border: 1px dashed rgba(91, 124, 250, .4);
  border-radius: 10px;
  padding: 13px 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: .82rem;
  color: #cdd8ff;
  white-space: pre-line;
  line-height: 1.5;
}

.modal-lg { max-width: 660px; }
.modal-header-flex { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; gap: 12px; }

/* =========================================================
   AGENDA
   ========================================================= */
.agenda-grid { display: grid; gap: 12px; }
.agenda-day {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--brand);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
}
.agenda-day.atrasado { border-left-color: var(--rose); }
.agenda-day h4 { font-family: 'Space Grotesk', sans-serif; font-weight: 600; margin-bottom: 10px; font-size: .95rem; }
.agenda-item {
  font-size: .86rem; color: var(--ink-dim);
  padding: 8px 0; border-top: 1px solid var(--border);
}
.agenda-item:first-of-type { border-top: none; }

/* =========================================================
   RELATÓRIOS
   ========================================================= */
.report-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 20px; }
.report-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  cursor: pointer;
  transition: transform .2s var(--ease), border-color .2s var(--ease), box-shadow .2s var(--ease);
  display: flex; flex-direction: column; gap: 10px;
}
.report-card:hover { transform: translateY(-3px); border-color: var(--brand-ring); box-shadow: var(--shadow-md); }
.report-card .kpi-icon { margin-bottom: 2px; }
.report-card h3 { font-family: 'Space Grotesk', sans-serif; font-weight: 600; font-size: 1rem; }
.report-card p { color: var(--ink-dim); font-size: .82rem; }
.report-result {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; font-family: 'JetBrains Mono', monospace; font-size: .82rem; white-space: pre-wrap;
  color: var(--ink-dim); max-height: 420px; overflow-y: auto;
}

/* =========================================================
   TOAST
   ========================================================= */
.toast {
  position: fixed;
  bottom: 28px; left: 50%;
  transform: translateX(-50%) translateY(90px);
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  color: var(--ink);
  padding: 13px 22px;
  border-radius: 12px;
  font-size: .86rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(8px);
  transition: transform .35s var(--ease);
  z-index: 300;
  display: flex; align-items: center; gap: 8px;
}
.toast::before {
  content: '';
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--mint); flex-shrink: 0;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* =========================================================
   OPERAÇÕES / PARCELAS — view toggle + cards
   ========================================================= */
.view-toggle {
  display: flex; gap: 3px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 3px;
  border-radius: 10px;
}
.view-btn {
  background: none; border: none; color: var(--ink-dim);
  padding: 7px 14px; border-radius: 7px; cursor: pointer;
  font-size: .82rem; font-weight: 600; font-family: inherit;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.view-btn.active { background: var(--surface-3); color: var(--ink); box-shadow: var(--shadow-sm); }

.op-cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(266px, 1fr)); gap: 14px; }

.op-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  cursor: pointer;
  transition: transform .2s var(--ease), border-color .2s var(--ease), box-shadow .2s var(--ease);
  display: flex; flex-direction: column; gap: 4px;
}
.op-card:hover { transform: translateY(-3px); border-color: var(--brand-ring); box-shadow: var(--shadow-md); }
.op-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; gap: 8px; }
.op-card-cliente { font-family: 'Space Grotesk', sans-serif; font-weight: 600; font-size: .98rem; }
.op-card-tipo { color: var(--ink-faint); font-size: .78rem; margin-bottom: 10px; }
.op-card-valores {
  display: flex; justify-content: space-between; align-items: baseline;
  font-family: 'JetBrains Mono', monospace; font-size: .95rem;
  padding-top: 10px; border-top: 1px solid var(--border);
}
.op-card-valores span:last-child { color: var(--mint); font-weight: 600; }
.op-card-parcelas { color: var(--ink-faint); font-size: .76rem; margin-top: 9px; }
.op-parcelas-resumo { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

.panel-empty {
  grid-column: 1/-1;
  text-align: center; color: var(--ink-faint);
  padding: 48px 20px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  font-size: .88rem;
}

/* =========================================================
   OPERATION DETAIL
   ========================================================= */
.op-detail-view { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 22px; margin-bottom: 20px; }
.op-detail-item { font-size: .9rem; }
.op-detail-item strong { display: block; color: var(--ink-faint); font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; margin-bottom: 4px; }

.op-detail-subtitle { font-family: 'Space Grotesk', sans-serif; font-weight: 600; font-size: .95rem; margin: 20px 0 12px; color: var(--ink-dim); }
.op-detail-parcelas { display: flex; flex-direction: column; gap: 8px; max-height: 280px; overflow-y: auto; }
.op-parcela-row {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
  padding: 11px 15px; font-size: .85rem; gap: 10px;
}
.op-parcela-info { display: flex; flex-direction: column; gap: 3px; }
.op-parcela-actions { display: flex; align-items: center; gap: 10px; }
.op-detail-footer { justify-content: space-between; }

/* =========================================================
   MICRO-INTERACTIONS (rows, ripple, scroll reveal)
   ========================================================= */
.row-reveal {
  animation: rowIn .45s var(--ease) both;
  animation-delay: calc(var(--ri, 0) * 28ms);
}
@keyframes rowIn {
  from { opacity: 0; transform: translateY(7px); }
  to   { opacity: 1; transform: translateY(0); }
}

.ripple-wrap { position: relative; overflow: hidden; }
.ripple-el {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, .28);
  transform: scale(0);
  pointer-events: none;
  animation: rippleAnim .6s ease-out forwards;
}
@keyframes rippleAnim {
  to { transform: scale(2.4); opacity: 0; }
}

.scroll-reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .55s var(--ease), transform .55s var(--ease);
}
.scroll-reveal.in-view { opacity: 1; transform: translateY(0); }

/* subtle active/tap feedback everywhere on touch */
.card:active, .op-card:active, .report-card:active, .agenda-day:active { transform: scale(.985); }

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 980px) {
  .panels-grid { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); box-shadow: none; }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .content { margin-left: 0; padding: 18px; }
  .content { padding-left: max(18px, env(safe-area-inset-left)); padding-right: max(18px, env(safe-area-inset-right)); }
  .menu-toggle { display: flex; }
  .nav-item { padding: 13px 12px; font-size: .92rem; }
  .nav-item .nav-icon { width: 20px; height: 20px; }
  .dash-panels-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .op-detail-view { grid-template-columns: 1fr; }
  table { min-width: 480px; }
  th, td { padding: 10px 12px; font-size: .8rem; }
  .card-value { font-size: 1.25rem; }
  .cards-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .card-hero { grid-column: span 2; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar input, .toolbar select { width: 100%; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .btn { width: 100%; }
}

@media (max-width: 480px) {
  .content { padding: 14px; }
  .topbar h1 { font-size: 1.2rem; }
  .cards-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .card-hero { grid-column: span 2; }
  .card { padding: 14px 14px; }
  .card-label { font-size: .7rem; }
  .card-value { font-size: 1.05rem; }
  .card-hero .card-value { font-size: 1.3rem; }
  .chart-box { padding: 14px; }
  .op-cards-grid { grid-template-columns: 1fr; }
  table { min-width: 420px; }
  th, td { padding: 8px 10px; font-size: .75rem; }
  .btn { padding: 8px 14px; font-size: .82rem; }
  .btn-whatsapp { font-size: .75rem; padding: 6px 10px; }
  .modal, .modal-lg { max-width: 100%; padding: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
/* =========================================================
   SAAS — AUTENTICAÇÃO, SELEÇÃO DE MÓDULO, PLANOS E PERFIL
   (bloco aditivo — não altera nenhuma regra acima)
   ========================================================= */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  z-index: 1;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 36px 32px;
  animation: authIn .5s var(--ease);
}

@keyframes authIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}

.auth-brand .brand-mark {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  box-shadow: 0 6px 20px var(--brand-ring);
}
.auth-brand .brand-mark svg { width: 22px; height: 22px; }
.auth-brand-name { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 1.15rem; }
.auth-brand-sub { display: block; font-size: .78rem; color: var(--ink-dim); }

.auth-card h1 { font-family: 'Space Grotesk', sans-serif; font-size: 1.45rem; margin-bottom: 6px; }
.auth-card .auth-subtitle { color: var(--ink-dim); font-size: .88rem; margin-bottom: 26px; }

.auth-form label { display: block; font-size: .8rem; color: var(--ink-dim); margin: 14px 0 6px; }
.auth-form label:first-child { margin-top: 0; }
.auth-form input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  color: var(--ink);
  font-size: .92rem;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.auth-form input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.auth-error {
  display: none;
  background: var(--rose-soft);
  color: var(--rose);
  border: 1px solid rgba(251, 85, 115, .25);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: .82rem;
  margin-top: 16px;
}
.auth-error.show { display: block; }

.auth-success {
  display: none;
  background: var(--mint-soft);
  color: var(--mint);
  border: 1px solid rgba(34, 211, 166, .25);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: .82rem;
  margin-top: 16px;
}
.auth-success.show { display: block; }

.auth-form .btn { width: 100%; justify-content: center; margin-top: 22px; }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0;
  color: var(--ink-faint);
  font-size: .78rem;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.btn-google {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-weight: 600;
  font-size: .88rem;
  cursor: pointer;
  transition: background .2s var(--ease), transform .15s var(--ease);
}
.btn-google:hover { background: var(--surface-3); }
.btn-google:active { transform: scale(.98); }
.btn-google svg { width: 18px; height: 18px; }

.auth-footer { text-align: center; margin-top: 22px; font-size: .85rem; color: var(--ink-dim); }
.auth-footer a { color: var(--brand); text-decoration: none; font-weight: 600; }
.auth-footer a:hover { text-decoration: underline; }

.auth-link-row { display: flex; justify-content: flex-end; margin-top: -4px; }
.auth-link-row a { font-size: .78rem; color: var(--brand); text-decoration: none; }
.auth-link-row a:hover { text-decoration: underline; }

/* ---- seleção de módulo ---- */
.modulo-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
  position: relative;
  z-index: 1;
  text-align: center;
}
.modulo-shell h1 { font-family: 'Space Grotesk', sans-serif; font-size: 1.8rem; margin-bottom: 8px; }
.modulo-shell p.subtitle { color: var(--ink-dim); margin-bottom: 40px; }

.modulo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 280px));
  gap: 22px;
}
.modulo-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 30px 24px;
  cursor: pointer;
  transition: transform .2s var(--ease), border-color .2s var(--ease), box-shadow .2s var(--ease);
  text-align: left;
}
.modulo-card:hover { transform: translateY(-4px); border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.modulo-card .kpi-icon { width: 46px; height: 46px; margin-bottom: 16px; }
.modulo-card h3 { font-family: 'Space Grotesk', sans-serif; font-size: 1.1rem; margin-bottom: 6px; }
.modulo-card p { color: var(--ink-dim); font-size: .85rem; }
.modulo-card.disabled { opacity: .45; cursor: not-allowed; }
.modulo-card.disabled:hover { transform: none; box-shadow: none; }
.modulo-badge {
  display: inline-block;
  margin-top: 12px;
  font-size: .68rem;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--amber-soft);
  color: var(--amber);
  font-weight: 700;
  letter-spacing: .03em;
}

.modulo-topbar {
  position: fixed;
  top: 20px; right: 24px;
  display: flex; gap: 10px;
  z-index: 2;
}

/* ---- planos ---- */
.planos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-top: 24px;
}
.plano-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 22px;
  display: flex;
  flex-direction: column;
  transition: border-color .2s var(--ease), transform .2s var(--ease);
}
.plano-card:hover { border-color: var(--border-strong); transform: translateY(-3px); }
.plano-card.atual { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.plano-card h3 { font-family: 'Space Grotesk', sans-serif; font-size: 1.1rem; }
.plano-card .plano-preco { font-size: 1.7rem; font-weight: 700; margin: 10px 0; font-family: 'Space Grotesk', sans-serif; }
.plano-card .plano-preco span { font-size: .78rem; color: var(--ink-dim); font-weight: 500; }
.plano-card p.desc { color: var(--ink-dim); font-size: .82rem; margin-bottom: 18px; flex: 1; }
.plano-card .btn { width: 100%; justify-content: center; }
.plano-tag-atual {
  display: inline-block;
  font-size: .68rem;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--mint-soft);
  color: var(--mint);
  font-weight: 700;
  margin-bottom: 10px;
  width: fit-content;
}

.assinatura-resumo {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
}
.assinatura-resumo .item { display: flex; flex-direction: column; gap: 4px; }
.assinatura-resumo .item .label { font-size: .74rem; color: var(--ink-dim); }
.assinatura-resumo .item .value { font-weight: 700; font-family: 'Space Grotesk', sans-serif; }
.assinatura-resumo .value.expirado { color: var(--rose); }
.assinatura-resumo .value.ativo { color: var(--mint); }

/* ---- perfil ---- */
.perfil-shell { max-width: 560px; margin: 0 auto; }
.perfil-avatar-row { display: flex; align-items: center; gap: 18px; margin-bottom: 24px; }
.perfil-avatar {
  width: 72px; height: 72px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.perfil-avatar-placeholder {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 1.4rem;
  font-family: 'Space Grotesk', sans-serif;
}

.limite-alerta {
  background: var(--amber-soft);
  border: 1px solid rgba(245, 185, 77, .3);
  color: var(--amber);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.limite-alerta strong { color: var(--ink); }

@media (max-width: 560px) {
  .modulo-grid { grid-template-columns: 1fr; width: 100%; max-width: 300px; }
  .modulo-topbar { top: 12px; right: 12px; }
  .auth-card { padding: 28px 22px; }
}
