/* Layout geral — tema escuro discreto */
:root {
  --bg: #0f1419;
  --panel: #1a2332;
  --border: #2d3a4f;
  --text: #e8eef7;
  --muted: #8b9cb3;
  --accent: #3d9cf5;
  --accent-dim: #2563a8;
  --ok: #34c759;
  --danger: #ff5c5c;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
}

.auth-card h1 { margin-top: 0; font-size: 1.35rem; text-align: center; }

.auth-links { margin-top: 0.75rem; text-align: center; }

.auth-guest {
  margin-top: 1.35rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.auth-guest-title {
  margin: 0 0 0.35rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  text-align: center;
}

.auth-guest-hint {
  margin: 0 0 0.75rem;
  font-size: 0.8rem;
  text-align: center;
  line-height: 1.35;
}

.auth-guest-btn {
  width: 100%;
  margin-top: 0.5rem !important;
}

.auth-guest .auth-guest-btn:first-of-type {
  margin-top: 0 !important;
}

.muted { color: var(--muted); font-size: 0.9rem; }

label { display: block; margin: 0.75rem 0 0.35rem; font-size: 0.85rem; color: var(--muted); }

.input {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #121a26;
  color: var(--text);
}

.btn {
  margin-top: 1rem;
  padding: 0.6rem 1rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
}

.btn.primary {
  width: 100%;
  background: linear-gradient(180deg, var(--accent), var(--accent-dim));
  color: #fff;
}

.msg-erro { display: block; color: var(--danger); margin: 0.5rem 0; }
.msg-ok { display: block; color: var(--ok); margin: 0.5rem 0; }

/* Shell app (form master também precisa ser flex — layout fica no form, não só no body) */
.app-shell,
form.app-shell {
  display: flex;
  min-height: 100vh;
  margin: 0;
  width: 100%;
  box-sizing: border-box;
}

.sidebar {
  width: 240px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1rem 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
}

.brand-ic {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #3d9cf5 0%, #7c3aed 55%, #ec4899 100%);
  box-shadow: 0 4px 14px rgba(61, 156, 245, 0.35);
  flex-shrink: 0;
}

.brand-ic svg {
  width: 22px;
  height: 22px;
  color: #fff;
}

.nav .nav-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 1.25rem;
  color: var(--text);
  border-left: 3px solid transparent;
}

.nav .nav-item:hover {
  background: rgba(61, 156, 245, 0.08);
  text-decoration: none;
  border-left-color: var(--accent);
}

.nav-ic {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-ic svg {
  width: 22px;
  height: 22px;
}

.nav-item--dash .nav-ic { color: #5eb3ff; }
.nav-item--new .nav-ic { color: #38bdf8; }
.nav-item--in .nav-ic { color: #34d399; }
.nav-item--out .nav-ic { color: #f87171; }
.nav-item--contas .nav-ic { color: #fbbf24; }
.nav-item--pagar .nav-ic { color: #fb923c; }
.nav-item--receber .nav-ic { color: #4ade80; }
.nav-item--parc .nav-ic { color: #a78bfa; }
.nav-item--tipos .nav-ic { color: #f472b6; }

.nav-item--lista .nav-ic { color: #2dd4bf; }

.row-filtros .btn.primary {
  width: auto;
  margin-top: 0;
  align-self: flex-end;
}

.lista-total-item-preview {
  display: block;
  min-height: 1.5rem;
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--text);
  padding: 0.45rem 0;
}

.lista-compra-total-geral {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: flex-end;
  gap: 0.65rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.lista-compra-total-valor {
  font-size: 1.35rem;
  color: #34d399;
}

.lista-compra-toolbar-inner {
  align-items: flex-end;
}

.lista-compra-select {
  min-width: 220px;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.55rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
}

.btn-ghost:hover {
  background: rgba(61, 156, 245, 0.1);
  border-color: var(--accent);
}

.btn-danger-outline {
  background: transparent;
  border: 1px solid #663333;
  color: var(--danger);
  padding: 0.55rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
}

.btn-danger-outline:hover:not(:disabled) {
  background: rgba(255, 92, 92, 0.12);
}

.btn-danger-outline:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.lista-modal {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  background: var(--panel);
  color: var(--text);
  max-width: 420px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}

.lista-modal::backdrop {
  background: rgba(0, 0, 0, 0.55);
}

.lista-modal-inner {
  padding: 1.25rem 1.5rem;
}

.lista-modal-title {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
}

.lista-modal-label {
  display: block;
  margin: 0.75rem 0 0.35rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.lista-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}

.lista-modal--wide {
  max-width: 560px;
}

.lista-qr-reader-host {
  min-height: 240px;
  background: #0f172a;
  border-radius: 8px;
  margin: 0.75rem 0;
}

.lista-qr-botoes {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.lista-xml-nota {
  width: 100%;
  min-height: 120px;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.8rem;
}

.lista-nota-qr-hint {
  font-size: 0.88rem;
  margin-top: 0.75rem;
}

.lista-modal-qr-actions {
  margin: 0.75rem 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.lista-nota-import-status {
  flex: 1;
  min-width: 8rem;
  font-size: 0.88rem;
}

.lista-toolbar-nota {
  margin-bottom: 0.75rem;
}

.lista-nota-lead {
  margin: 0 0 0.65rem;
  font-size: 0.92rem;
  max-width: 42rem;
}

.h3-lista {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  font-weight: 600;
}

.lista-compra-subpanel {
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.lista-compra-subpanel:last-child {
  margin-bottom: 0;
}

.chk-inline label {
  color: var(--text);
  font-weight: 500;
}

.lista-compra-totais-finais {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.lista-compra-total-linha {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.lista-compra-total-pessoa .lista-compra-total-valor--pessoa {
  color: #a78bfa;
}

.sidebar-foot {
  margin-top: auto;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.link-out {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--muted);
}

.link-out-ic {
  width: 18px;
  height: 18px;
  color: #94a3b8;
}

/* Páginas de login / cadastro */
.auth-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.auth-brand-ic {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #3d9cf5, #7c3aed);
  box-shadow: 0 8px 24px rgba(61, 156, 245, 0.35);
}

.auth-brand-ic svg {
  width: 28px;
  height: 28px;
  color: #fff;
}

.auth-brand-ic--cadastro {
  background: linear-gradient(135deg, #ec4899, #7c3aed);
  box-shadow: 0 8px 24px rgba(236, 72, 153, 0.35);
}

.main {
  flex: 1;
  padding: 1.5rem 2rem;
  overflow-x: auto;
}

.page-title { margin: 0 0 1rem; font-size: 1.5rem; }

.page-lead {
  margin: -0.35rem 0 1.25rem;
  max-width: 58rem;
  line-height: 1.45;
  font-size: 0.95rem;
}

.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

.card--stat {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
}

.card-stat-ic {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.card-stat-ic svg {
  width: 22px;
  height: 22px;
  color: #fff;
}

.card--stat-in .card-stat-ic { background: linear-gradient(135deg, #10b981, #059669); }
.card--stat-out .card-stat-ic { background: linear-gradient(135deg, #f87171, #dc2626); }
.card--stat-saldo .card-stat-ic { background: linear-gradient(135deg, #60a5fa, #2563eb); }
.card--stat-total .card-stat-ic { background: linear-gradient(135deg, #fbbf24, #d97706); }
.card--stat-credito .card-stat-ic { background: linear-gradient(135deg, #a78bfa, #9333ea); }

.card-stat-body { min-width: 0; }

.card .val { font-size: 1.35rem; font-weight: 700; }
.card .lbl { color: var(--muted); font-size: 0.8rem; margin-top: 0.25rem; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1.25rem;
}

.panel h2 { margin: 0 0 0.75rem; font-size: 1.05rem; }

.row-filtros { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: flex-end; margin-bottom: 1rem; }
.row-filtros--wrap { align-items: flex-start; }
.row-filtros .field--grow { flex: 1 1 14rem; min-width: 10rem; }
.row-filtros .field--check { padding-top: 1.1rem; }
.radio-row label { margin-right: 1rem; color: var(--text, #e8eef7); }

.row-filtros .field { display: flex; flex-direction: column; gap: 0.25rem; }

.table-wrap { overflow: auto; }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

table.data th, table.data td {
  border-bottom: 1px solid var(--border);
  padding: 0.5rem 0.6rem;
  text-align: left;
}

table.data th { color: var(--muted); font-weight: 600; }

.btn-sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: #1e2a3d;
  color: var(--text);
  cursor: pointer;
}

.btn-sm.danger { border-color: #663333; color: var(--danger); }

.chart-box {
  position: relative;
  height: 280px;
  max-width: 100%;
}

.chart-pie-tall { height: 300px; }
.chart-line-tall { height: 320px; }

/* Dashboard: calendário + gráficos lado a lado */
.dashboard-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
  align-items: start;
}

@media (max-width: 1100px) {
  .dashboard-split { grid-template-columns: 1fr; }
}

.dashboard-cal-wrap .dashboard-calendar-host {
  min-height: 520px;
}

.cal-legend { font-size: 0.85rem; margin: 0 0 0.75rem; }

.h2-tight { margin-top: 1.25rem; margin-bottom: 0.5rem; font-size: 1.05rem; }

/* FullCalendar 5 — tema escuro */
.dashboard-cal-wrap .fc-theme-standard .fc-scrollgrid,
.dashboard-cal-wrap .fc-theme-standard td,
.dashboard-cal-wrap .fc-theme-standard th {
  border-color: var(--border);
}

.dashboard-cal-wrap .fc .fc-toolbar-title,
.dashboard-cal-wrap .fc .fc-col-header-cell-cushion,
.dashboard-cal-wrap .fc .fc-daygrid-day-number {
  color: var(--text);
}

.dashboard-cal-wrap .fc .fc-daygrid-day.fc-day-today {
  background: rgba(61, 156, 245, 0.12) !important;
}

.dashboard-cal-wrap .fc .fc-daygrid-day-frame {
  background: rgba(18, 26, 38, 0.6);
}

.dashboard-cal-wrap .fc .fc-button-primary {
  background: #2563a8;
  border-color: #3d9cf5;
}

.dashboard-cal-wrap .fc .fc-button-primary:hover {
  background: #3d9cf5;
  border-color: #60a5fa;
}

.dashboard-cal-wrap .fc .fc-list-event:hover td {
  background: rgba(61, 156, 245, 0.08);
}

.dashboard-cal-wrap .fc-theme-standard .fc-list {
  border-color: var(--border);
}

@media (max-width: 768px) {
  .app-shell,
  form.app-shell { flex-direction: column; }
  .sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border); }
  .nav { display: flex; flex-wrap: wrap; gap: 0.25rem; }
  .nav .nav-item { border-left: none; border-radius: 6px; }
}
