/* Excalibur Cobrança — tokens da paleta Excalibur (erp-odonto-excalibur/src/app.css):
   fundo cinza neutro, detalhes em dourado e verde. Os nomes das classes são os
   que o app.js, o admin.js e o admin-producao.js montam: mudar nome aqui quebra tela. */
:root {
  --bg-base: #0d0f12;
  --bg-surface: #14181c;
  --bg-elevated: #1b2025;
  --bg-hover: #222830;
  --bg-card: #15191d;
  --bg-glass: rgba(20, 24, 28, 0.72);

  --border: #353c44;
  --border-subtle: #262c33;
  --border-strong: #4a535c;

  --text: #f2f5f0;
  --text-muted: #a3b2a6;
  --text-subtle: #6c7a71;

  --accent: #c49858;
  --accent-rgb: 196, 152, 88;
  --gold-300: #d9b479;
  --gold-400: #c49858;
  --gold-500: #a87f48;
  --gold-900: #352716;

  --success: #22c55e;
  --success-muted: rgba(34, 197, 94, 0.13);
  --danger: #ef4444;
  --danger-muted: rgba(239, 68, 68, 0.14);
  --warning: #f59e0b;
  --warning-muted: rgba(245, 158, 11, 0.14);
  --info: #60a5fa;
  --info-muted: rgba(96, 165, 250, 0.14);
  --emerald-400: #34d399;
  --emerald-900: rgba(52, 211, 153, 0.13);

  --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-serif: 'Fraunces', ui-serif, Georgia, serif;
  --font-mono: ui-monospace, 'SF Mono', 'Cascadia Code', Menlo, monospace;

  --shadow-premium: 0 1px 0 rgba(255,255,255,0.03) inset, 0 8px 28px -12px rgba(0,0,0,0.65);
  --shadow-hover: 0 1px 0 rgba(255,255,255,0.04) inset, 0 16px 36px -14px rgba(0,0,0,0.75), 0 0 0 1px rgba(var(--accent-rgb), 0.18);
  --shadow-pop: 0 24px 64px -16px rgba(0,0,0,0.75);
  --radius-card: 14px;
  --radius-ctl: 9px;
  --ring: 0 0 0 3px rgba(var(--accent-rgb), 0.32);

  --ease: cubic-bezier(.22, .9, .32, 1);
  --t-rapida: 140ms;
  --t-media: 240ms;
  --sidebar: 248px;

  color-scheme: dark;
}

html[data-theme="light"] {
  --bg-base: #f4f3ef;
  --bg-surface: #ffffff;
  --bg-elevated: #f3f1ec;
  --bg-hover: #ebe8e1;
  --bg-card: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.78);
  --border: #d8d4cb;
  --border-subtle: #e7e3db;
  --border-strong: #b7b0a3;
  --text: #1a1c1a;
  --text-muted: #4f5650;
  --text-subtle: #7a807a;
  --accent: #a87f48;
  --accent-rgb: 168, 127, 72;
  --gold-300: #8a6638;
  --gold-400: #a87f48;
  --success-muted: rgba(22, 163, 74, 0.12);
  --danger-muted: rgba(220, 38, 38, 0.10);
  --warning-muted: rgba(217, 119, 6, 0.12);
  --info: #2563eb;
  --info-muted: rgba(37, 99, 235, 0.10);
  --emerald-400: #059669;
  --emerald-900: rgba(5, 150, 105, 0.12);
  --shadow-premium: 0 1px 2px rgba(30, 25, 15, 0.05), 0 8px 24px -14px rgba(30, 25, 15, 0.18);
  --shadow-hover: 0 2px 4px rgba(30, 25, 15, 0.06), 0 18px 36px -16px rgba(30, 25, 15, 0.28), 0 0 0 1px rgba(var(--accent-rgb), 0.22);
  --shadow-pop: 0 24px 60px -18px rgba(30, 25, 15, 0.35);
  color-scheme: light;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background:
    radial-gradient(1100px 520px at 78% -12%, rgba(var(--accent-rgb), 0.07), transparent 60%),
    radial-gradient(800px 420px at -10% 110%, rgba(52, 211, 153, 0.035), transparent 60%),
    var(--bg-base);
  background-attachment: fixed;
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'cv11', 'ss01';
}

::selection { background: rgba(var(--accent-rgb), 0.35); color: var(--text); }
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); background-clip: padding-box; border: 3px solid transparent; }

:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 6px; }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  background: linear-gradient(180deg, var(--bg-surface), var(--bg-base));
  border-right: 1px solid var(--border-subtle);
  padding: 18px 0 0;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column;
  z-index: 40;
}
.marca { padding: 2px 20px 18px; border-bottom: 1px solid var(--border-subtle); margin-bottom: 8px; display: flex; align-items: center; gap: 11px; }
.marca .selo-marca {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--gold-300), var(--gold-500));
  color: #14110b; font-family: var(--font-serif); font-weight: 700; font-size: 18px;
  box-shadow: 0 6px 18px -6px rgba(var(--accent-rgb), 0.6);
}
.marca h1 {
  font-family: var(--font-serif);
  font-size: 19px; font-weight: 600; letter-spacing: 0.01em; color: var(--text); line-height: 1.1;
}
.marca span {
  font-size: 10px; color: var(--accent); letter-spacing: 0.18em;
  text-transform: uppercase; font-weight: 600;
}

.nav { padding: 0 10px; flex: 1; }
.nav a {
  position: relative;
  display: flex; align-items: center; gap: 11px;
  padding: 8px 12px; margin: 1px 0; color: var(--text-muted);
  text-decoration: none; font-size: 13px; font-weight: 500;
  border-radius: 9px; cursor: pointer;
  transition: color var(--t-rapida) ease, background-color var(--t-rapida) ease, transform var(--t-rapida) ease;
}
.nav a svg { width: 17px; height: 17px; flex-shrink: 0; opacity: .78; transition: opacity var(--t-rapida), transform var(--t-media) var(--ease); }
.nav a:hover { color: var(--text); background: var(--bg-hover); }
.nav a:hover svg { opacity: 1; transform: translateX(1px); }
.nav a:active { transform: scale(.985); }
.nav a.ativo {
  color: var(--text);
  background: linear-gradient(90deg, rgba(var(--accent-rgb), 0.16), rgba(var(--accent-rgb), 0.04));
  box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.16);
}
.nav a.ativo svg { color: var(--gold-300); opacity: 1; }
.nav a.ativo::before {
  content: ''; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--accent);
  animation: entrar-barra var(--t-media) var(--ease);
}
@keyframes entrar-barra { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.nav .grupo {
  padding: 16px 12px 6px; font-size: 10px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--text-subtle); font-weight: 600;
}

.main { padding: 26px 30px 72px; max-width: 1600px; width: 100%; min-width: 0; }

/* ---------- Topo de cada tela ---------- */
.topo { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 22px; gap: 20px; flex-wrap: wrap; }
.topo h2 { font-family: var(--font-serif); font-size: 27px; font-weight: 600; color: var(--text); letter-spacing: -0.015em; line-height: 1.15; }
.topo p { color: var(--text-muted); font-size: 13px; margin-top: 6px; max-width: 780px; }

.relogio {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-glass); backdrop-filter: blur(10px);
  border: 1px solid var(--border-subtle);
  border-radius: 12px; padding: 7px 10px 7px 13px; font-size: 12px;
  color: var(--text-muted);
}
.relogio b { color: var(--gold-300); font-weight: 600; font-variant-numeric: tabular-nums; }

button.acao, a.acao {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--bg-elevated); color: var(--text-muted); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-ctl); padding: 6px 11px; font-size: 12px; cursor: pointer; line-height: 1.35;
  font-family: inherit; font-weight: 500; text-decoration: none;
  transition: background-color var(--t-rapida) ease, color var(--t-rapida) ease, border-color var(--t-rapida) ease, transform 90ms ease, box-shadow var(--t-rapida) ease;
}
button.acao:hover, a.acao:hover { background: var(--bg-hover); color: var(--text); border-color: var(--border); }
button.acao:active, a.acao:active { transform: scale(.96); }
button.acao.primaria {
  background: linear-gradient(180deg, var(--gold-300), var(--accent)); color: #17120a; border-color: transparent; font-weight: 600;
  box-shadow: 0 6px 16px -8px rgba(var(--accent-rgb), 0.75);
}
button.acao.primaria:hover { filter: brightness(1.06); color: #17120a; box-shadow: 0 8px 22px -8px rgba(var(--accent-rgb), 0.85); }
button.acao.perigo { color: var(--danger); border-color: rgba(239, 68, 68, 0.28); }
button.acao.perigo:hover { background: var(--danger-muted); color: var(--danger); }
button.acao:disabled { opacity: .45; cursor: not-allowed; transform: none; }
button.acao.ocupado { position: relative; color: transparent !important; pointer-events: none; }
button.acao.ocupado::after {
  content: ''; position: absolute; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor; border-color: var(--text-muted) transparent var(--text-muted) transparent;
  animation: girar .7s linear infinite;
}
@keyframes girar { to { transform: rotate(360deg); } }

/* ---------- Cards ---------- */
.grid { display: grid; gap: 14px; }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1180px) { .g4, .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 680px) { .g4, .g3, .g2 { grid-template-columns: minmax(0, 1fr); } }

.card {
  position: relative;
  background: linear-gradient(180deg, rgba(255,255,255,0.018), transparent 42%), var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card); padding: 17px 18px;
  box-shadow: var(--shadow-premium);
  transition: border-color var(--t-media) ease, box-shadow var(--t-media) ease, transform var(--t-media) var(--ease);
  min-width: 0;
}
.grid > .card:hover { border-color: var(--border); box-shadow: var(--shadow-hover); }
.grid.g4 > .card:hover { transform: translateY(-2px); }
.card h3 {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--text-subtle); font-weight: 600; margin-bottom: 9px;
}
.card > table, .card > div > table { margin: 0 -2px; }
.kpi { font-size: 28px; font-weight: 650; color: var(--text); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.kpi.dourado { color: var(--gold-300); }
.kpi.alerta { color: var(--danger); }
.kpi.bom { color: var(--emerald-400); }
.kpi.atencao { color: var(--warning); }
.kpi.mudou { animation: mudou 1.4s var(--ease); border-radius: 6px; }
@keyframes mudou {
  0% { background: rgba(var(--accent-rgb), 0.28); box-shadow: 0 0 0 6px rgba(var(--accent-rgb), 0.28); }
  100% { background: transparent; box-shadow: 0 0 0 6px transparent; }
}
.legenda { font-size: 11.5px; color: var(--text-subtle); margin-top: 6px; line-height: 1.5; }

.secao { margin-top: 26px; }
.secao > h3 {
  display: flex; align-items: center; gap: 10px;
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--text-subtle); font-weight: 600; margin-bottom: 12px;
}
.secao > h3::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, var(--border-subtle), transparent); }

/* ---------- Tabela ---------- */
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
th {
  text-align: left; padding: 10px 10px; font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.09em; color: var(--text-subtle); border-bottom: 1px solid var(--border-subtle);
  font-weight: 600; white-space: nowrap; background: var(--bg-card);
  position: sticky; top: 0; z-index: 2;
}
.modal th, .col-corpo th { position: static; }
td { padding: 10px 10px; border-bottom: 1px solid var(--border-subtle); vertical-align: top; transition: background-color var(--t-rapida) ease; }
tbody tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-hover); }
tbody tr:hover td:first-child { box-shadow: inset 2px 0 0 var(--accent); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.link { color: var(--gold-300); cursor: pointer; text-decoration: none; font-weight: 500; transition: color var(--t-rapida); }
.link:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.rolagem-x { overflow-x: auto; }

/* ---------- Tags ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px;
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.02em; white-space: nowrap; line-height: 1.6;
  border: 1px solid transparent;
}
.tag.em_dia { background: var(--success-muted); color: var(--success); border-color: rgba(34, 197, 94, 0.22); }
.tag.d1_30 { background: var(--warning-muted); color: var(--warning); border-color: rgba(245, 158, 11, 0.22); }
.tag.d31_60 { background: var(--warning-muted); color: #fbbf24; border-color: rgba(251, 191, 36, 0.22); }
.tag.d61_90 { background: var(--danger-muted); color: #f87171; border-color: rgba(248, 113, 113, 0.22); }
.tag.d91_180 { background: var(--danger-muted); color: var(--danger); border-color: rgba(239, 68, 68, 0.25); }
.tag.d180 { background: rgba(127, 29, 29, 0.45); color: #fca5a5; border-color: rgba(252, 165, 165, 0.22); }
.tag.neutra { background: var(--bg-elevated); color: var(--text-muted); border-color: var(--border-subtle); }
.tag.risco { background: var(--danger-muted); color: var(--danger); border-color: rgba(239, 68, 68, 0.25); }
.tag.info { background: var(--info-muted); color: var(--info); border-color: rgba(96, 165, 250, 0.24); }
html[data-theme="light"] .tag.d31_60 { color: #b45309; }
html[data-theme="light"] .tag.d61_90 { color: #dc2626; }
html[data-theme="light"] .tag.d180 { background: rgba(220, 38, 38, 0.16); color: #991b1b; }

/* ---------- Barras ---------- */
.barra { height: 6px; background: var(--bg-elevated); border-radius: 3px; overflow: hidden; }
.barra > i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold-500), var(--gold-300)); border-radius: 3px; transform-origin: left; animation: crescer .8s var(--ease) both; }
@keyframes crescer { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.linha-barra { display: grid; grid-template-columns: 112px 1fr 76px; gap: 10px; align-items: center; margin-bottom: 8px; font-size: 12px; }
.linha-barra span:last-child { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-muted); }

/* ---------- Timeline da régua ---------- */
.timeline { position: relative; padding-left: 22px; }
.timeline::before {
  content: ''; position: absolute; left: 6px; top: 6px; bottom: 6px;
  width: 1px; background: linear-gradient(180deg, var(--border-subtle), var(--border), var(--border-subtle));
}
.tl-item { position: relative; padding: 7px 0 7px 4px; }
.tl-item::before {
  content: ''; position: absolute; left: -20px; top: 13px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--bg-base); border: 2px solid var(--border-strong);
}
.tl-item.executado::before { background: var(--text-subtle); border-color: var(--text-subtle); }
.tl-item.hoje::before { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.18); animation: pulso-anel 2.4s ease-out infinite; }
@keyframes pulso-anel { 0% { box-shadow: 0 0 0 0 rgba(var(--accent-rgb), 0.45); } 70% { box-shadow: 0 0 0 9px rgba(var(--accent-rgb), 0); } 100% { box-shadow: 0 0 0 0 rgba(var(--accent-rgb), 0); } }
.tl-item.futuro::before { background: transparent; }
.tl-item.cancelado { opacity: 0.32; }
.tl-item.critico::before { border-color: var(--danger); }
.tl-cab { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tl-dia { font-size: 11px; font-weight: 600; color: var(--gold-300); min-width: 42px; font-variant-numeric: tabular-nums; }
.tl-titulo { font-size: 12.5px; font-weight: 500; }
.tl-item.futuro .tl-titulo { color: var(--text-muted); }
.tl-data { font-size: 11px; color: var(--text-subtle); }
.tl-msg {
  margin-top: 6px; background: var(--bg-base); border: 1px solid var(--border-subtle);
  padding: 9px 11px; border-radius: 9px; font-size: 11.5px;
  color: var(--text-muted); white-space: pre-wrap;
  font-family: var(--font-mono); line-height: 1.55;
}
.tl-nota { font-size: 11px; color: var(--warning); margin-top: 3px; }

/* ---------- Filtros e formulários ---------- */
.filtros { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
select, input[type=text], input[type=number], input[type=date], input[type=password], input[type=email], input[type=search], textarea {
  background: var(--bg-surface); border: 1px solid var(--border-subtle); color: var(--text);
  border-radius: var(--radius-ctl); padding: 7px 10px; font-size: 12.5px; font-family: inherit;
  transition: border-color var(--t-rapida) ease, box-shadow var(--t-rapida) ease, background-color var(--t-rapida) ease;
}
select { padding-right: 28px; appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239aab9e' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; }
select:hover, input:hover, textarea:hover { border-color: var(--border); }
select:focus, input:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
textarea { width: 100%; min-height: 70px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--text-subtle); }

.aut {
  font-size: 9px; font-weight: 700; padding: 2px 6px; border-radius: 999px; letter-spacing: .05em;
  background: var(--emerald-900); color: var(--emerald-400);
}
.aut.alcada { background: var(--warning-muted); color: var(--warning); }
.aut.humano { background: var(--danger-muted); color: var(--danger); }

.canal-chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 11px;
  padding: 2px 9px; border-radius: 999px; background: var(--bg-elevated); color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}
.canal-chip i { width: 6px; height: 6px; border-radius: 50%; display: block; }

/* ---------- Gráficos ---------- */
.gr-donut { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.gr-donut svg path { transition: opacity var(--t-rapida), transform var(--t-media) var(--ease); transform-origin: 70px 70px; }
.gr-donut svg path:hover { opacity: 1 !important; transform: scale(1.04); }
.gr-leg { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 110px; }
.gr-leg-item { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--text-muted); }
.gr-leg-item i { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }
.gr-leg-item span { flex: 1; }
.gr-leg-item b { color: var(--text); font-variant-numeric: tabular-nums; }
.gr-linha { width: 100%; height: auto; display: block; }
.gr-linha polyline { stroke-dasharray: 2400; stroke-dashoffset: 0; animation: desenhar 1.1s var(--ease); }
@keyframes desenhar { from { stroke-dashoffset: 2400; } to { stroke-dashoffset: 0; } }

.gr-cmp {
  display: grid; grid-template-columns: 96px 1fr 52px 56px;
  gap: 8px; align-items: center; margin-bottom: 8px; font-size: 11.5px;
}
.gr-cmp-rot { color: var(--text-muted); }
.gr-cmp-barra { position: relative; height: 8px; background: var(--bg-elevated); border-radius: 4px; }
.gr-cmp-barra i { display: block; height: 100%; border-radius: 4px; transform-origin: left; animation: crescer .8s var(--ease) both; }
.gr-cmp-barra u {
  position: absolute; top: -3px; width: 2px; height: 14px;
  background: var(--text-subtle); border-radius: 1px;
}
.gr-cmp-val { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.gr-cmp-ref { font-size: 10px; color: var(--text-subtle); text-align: right; }

.filtros-globais {
  background: var(--bg-glass); backdrop-filter: blur(10px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card); padding: 10px 12px; margin-bottom: 18px;
}
.f-rot { font-size: 10px; text-transform: uppercase; letter-spacing: .12em; color: var(--text-subtle); font-weight: 600; }

/* ---------- Kanban ---------- */
.kanban {
  display: grid; grid-template-columns: repeat(6, minmax(232px, 1fr));
  gap: 12px; align-items: start; overflow-x: auto; padding-bottom: 10px;
  scroll-snap-type: x proximity;
}
.kanban .col {
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card); overflow: hidden; scroll-snap-align: start;
  border-top: 3px solid var(--border);
}
.kanban .col:nth-child(1) { border-top-color: var(--info); }
.kanban .col:nth-child(2) { border-top-color: var(--warning); }
.kanban .col:nth-child(3) { border-top-color: #fb923c; }
.kanban .col:nth-child(4) { border-top-color: #f87171; }
.kanban .col:nth-child(5) { border-top-color: var(--danger); }
.kanban .col:nth-child(6) { border-top-color: #a78bfa; }
.col-cab {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 8px;
  padding: 12px 12px 10px; border-bottom: 1px solid var(--border-subtle);
}
.col-cab b { font-size: 13px; }
.col-acao {
  padding: 8px 12px; font-size: 11px; color: var(--text-subtle);
  background: var(--bg-base); border-bottom: 1px solid var(--border-subtle); line-height: 1.45;
}
.col-corpo { padding: 8px; display: flex; flex-direction: column; gap: 8px; max-height: 70vh; overflow-y: auto; }
.kcard {
  background: var(--bg-elevated); border: 1px solid var(--border-subtle);
  border-radius: 11px; padding: 11px; cursor: pointer;
  transition: border-color var(--t-rapida) ease, transform var(--t-media) var(--ease), box-shadow var(--t-media) ease;
}
.kcard:hover { border-color: rgba(var(--accent-rgb), 0.6); transform: translateY(-2px); box-shadow: 0 10px 24px -14px rgba(0,0,0,0.7); }
.kcard-topo { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-bottom: 3px; }
.kcard-topo b { font-size: 12.5px; font-weight: 600; }
.kcard-val {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-top: 8px; font-size: 11.5px; color: var(--text-muted);
}
.kcard-val b { color: var(--text); font-size: 13px; }
.kcard-pe { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 7px; }
.kcard-prox {
  margin-top: 8px; padding-top: 7px; border-top: 1px dashed var(--border-subtle);
  display: flex; flex-direction: column; gap: 3px;
}

/* ---------- Indicador ao vivo ---------- */
.live {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 22px; margin-top: 10px;
  border-top: 1px solid var(--border-subtle);
  font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-subtle); position: sticky; bottom: 0;
  background: linear-gradient(180deg, transparent, var(--bg-base) 30%);
}
.live i {
  position: relative; width: 7px; height: 7px; border-radius: 50%; background: var(--text-subtle);
}
.live.conectado i { background: var(--emerald-400); }
.live.conectado i::after {
  content: ''; position: absolute; inset: -4px; border-radius: 50%;
  border: 2px solid var(--emerald-400); animation: radar 2.2s ease-out infinite;
}
.live.reconectando i { background: var(--warning); animation: pulso 1s ease-in-out infinite; }
.live.offline i { background: var(--danger); }
.live.recebendo i { background: var(--gold-300); }
@keyframes radar { 0% { transform: scale(.4); opacity: .9; } 100% { transform: scale(1.6); opacity: 0; } }
@keyframes pulso { 0%,100% { opacity: 1; } 50% { opacity: 0.25; } }

.vazio { color: var(--text-subtle); padding: 40px 34px; text-align: center; font-size: 13px; }
.aviso {
  background: linear-gradient(90deg, rgba(var(--accent-rgb), 0.08), transparent 60%), var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-card); padding: 12px 15px; font-size: 12.5px;
  margin-bottom: 16px; color: var(--text-muted);
}
.aviso b { color: var(--gold-300); font-weight: 600; }

/* ---------- Cascata do dinheiro ---------- */
.cascata { display: flex; flex-direction: column; gap: 9px; }
.casc-linha { display: grid; grid-template-columns: 210px 1fr 130px; gap: 12px; align-items: center; font-size: 12.5px; }
.casc-rot { color: var(--text-muted); }
.casc-barra { height: 10px; background: var(--bg-elevated); border-radius: 5px; overflow: hidden; }
.casc-barra i { display: block; height: 100%; border-radius: 5px; transform-origin: left; animation: crescer .9s var(--ease) both; }
.casc-barra i.entra { background: var(--emerald-400); }
.casc-barra i.sai { background: var(--danger); }
.casc-barra i.total { background: linear-gradient(90deg, var(--gold-500), var(--gold-300)); }
.casc-val { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.casc-val.entra { color: var(--emerald-400); }
.casc-val.sai { color: var(--danger); }
.casc-val.total { color: var(--gold-300); font-size: 15px; }
.casc-total { padding-top: 9px; border-top: 1px solid var(--border); }
.casc-total .casc-rot { color: var(--text); font-weight: 600; }
@media (max-width: 680px) { .casc-linha { grid-template-columns: 1fr 96px; } .casc-barra { display: none; } }

/* ---------- Botão de parada ---------- */
#sel-parada {
  display: flex; align-items: center; gap: 8px; font-size: 11px;
  padding: 7px 11px; border-radius: 12px;
  border: 1px solid var(--border-subtle); background: var(--bg-glass); backdrop-filter: blur(10px);
  color: var(--text-subtle); letter-spacing: .04em;
  transition: background-color var(--t-media), border-color var(--t-media), color var(--t-media);
}
#sel-parada:empty { display: none; }
#sel-parada.parada-ativa {
  background: var(--danger-muted); border-color: var(--danger); color: var(--danger);
  animation: alerta-borda 2s ease-in-out infinite;
}
#sel-parada.parada-ativa b { color: var(--danger); letter-spacing: .1em; }
@keyframes alerta-borda { 0%,100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); } 50% { box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.16); } }

/* ---------- Variáveis que o app.js usa em estilos inline ---------- */
:root {
  --dourado: var(--accent);
  --dourado-claro: var(--gold-300);
  --vermelho: var(--danger);
  --laranja: #e8945f;
  --turquesa: #4ecdc4;
  --texto-fraco: var(--text-subtle);
  --borda: var(--border-subtle);
}

.campo { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.campo label { font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--text-subtle); font-weight: 600; }
.linha-acoes { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.mono { font-family: var(--font-mono); font-size: 11px; word-break: break-all; }
.ok-txt { color: var(--emerald-400); }
.erro-txt { color: var(--danger); }

/* ---------- Diálogo ---------- */
.modal-fundo {
  position: fixed; inset: 0; background: rgba(5, 6, 8, .58); z-index: 80;
  backdrop-filter: blur(5px);
  display: flex; align-items: flex-start; justify-content: center; padding: 64px 16px; overflow-y: auto;
  animation: aparecer var(--t-media) ease both;
}
.modal {
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow-pop); width: min(640px, 100%); padding: 22px;
  animation: subir-modal 300ms var(--ease) both;
}
.modal h3 { font-family: var(--font-serif); font-size: 19px; margin-bottom: 4px; }
.modal .sub { color: var(--text-muted); font-size: 12.5px; margin-bottom: 14px; }
.modal .campo input, .modal .campo select { width: 100%; }
.modal-pe { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
@keyframes aparecer { from { opacity: 0; } to { opacity: 1; } }
@keyframes subir-modal { from { opacity: 0; transform: translateY(14px) scale(.975); } to { opacity: 1; transform: none; } }

/* ---------- Pré-visualização de e-mail ---------- */
.previa-email { width: 100%; height: 520px; border: 1px solid var(--border-subtle); border-radius: 10px; background: #fff; }

/* ---------- Abas ---------- */
.abas { display: flex; gap: 2px; margin-bottom: 16px; border-bottom: 1px solid var(--border-subtle); flex-wrap: wrap; }
.abas a {
  padding: 9px 13px; font-size: 12.5px; color: var(--text-muted); cursor: pointer; text-decoration: none; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500;
  border-radius: 8px 8px 0 0; transition: color var(--t-rapida), background-color var(--t-rapida), border-color var(--t-media);
}
.abas a:hover { color: var(--text); background: var(--bg-hover); }
.abas a.ativa { color: var(--text); border-bottom-color: var(--accent); }

/* ---------- Tela de login ---------- */
.login-fundo { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-caixa {
  width: min(400px, 100%); background: var(--bg-glass); backdrop-filter: blur(14px);
  border: 1px solid var(--border-subtle); border-radius: 20px; padding: 30px 28px 24px;
  box-shadow: var(--shadow-pop); animation: subir-modal 420ms var(--ease) both;
}
.login-caixa .marca { border: none; padding: 0 0 22px; margin: 0; flex-direction: column; text-align: center; gap: 12px; }
.login-caixa .marca .selo-marca { width: 48px; height: 48px; font-size: 25px; border-radius: 14px; }
.login-caixa .marca h1 { font-size: 28px; }
.login-caixa input { width: 100%; padding: 11px 13px; font-size: 13.5px; }
.login-caixa button { width: 100%; padding: 11px; font-size: 13.5px; margin-top: 8px; }
.login-erro { color: var(--danger); font-size: 12px; min-height: 18px; margin-top: 10px; text-align: center; }
.login-erro:not(:empty) { animation: tremer .38s ease; }
@keyframes tremer { 0%,100% { transform: none; } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

.nav a.sair { color: var(--text-subtle); }
.nav a.sair:hover { color: var(--danger); background: var(--danger-muted); }
.usuario-logado {
  margin: 0 10px 10px; padding: 9px 12px; font-size: 11.5px; color: var(--text-subtle);
  display: flex; align-items: center; gap: 9px; border-radius: 10px; background: var(--bg-elevated); border: 1px solid var(--border-subtle);
}
.usuario-logado .avatar {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center;
  background: rgba(var(--accent-rgb), 0.18); color: var(--gold-300); font-weight: 700; font-size: 11px;
}
.usuario-logado b { color: var(--text); font-weight: 600; display: block; font-size: 12px; }

/* ---------- Administração ---------- */
.admin-item { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--border-subtle); align-items: start; }
.admin-item:last-child { border-bottom: none; }
.admin-item label { font-weight: 600; font-size: 13px; color: var(--text); }
.admin-item select, .admin-item input, .admin-item textarea { width: 100%; }
.barra-salvar { position: sticky; bottom: 0; display: flex; gap: 12px; align-items: center; padding: 12px 0; margin-top: 16px; background: linear-gradient(180deg, transparent, var(--bg-base) 35%); border-top: 1px solid var(--border-subtle); z-index: 5; }
.item-lista { display: block; padding: 8px 11px; border-radius: 9px; color: var(--text-muted); text-decoration: none; border-left: 2px solid transparent; transition: background-color var(--t-rapida), color var(--t-rapida); }
.item-lista:hover { background: var(--bg-hover); color: var(--text); }
.item-lista.ativo { background: rgba(var(--accent-rgb), 0.1); color: var(--text); border-left-color: var(--accent); }
a.botao-link { display: inline-flex; margin-top: 10px; text-decoration: none; }
@media (max-width: 900px) { .admin-item { grid-template-columns: 1fr; gap: 6px; } }

/* selo de contagem no menu (alertas abertos, tarefas) */
.selo-alerta {
  display: inline-block; min-width: 19px; margin-left: auto; padding: 0 6px; border-radius: 999px;
  font-size: 10.5px; line-height: 19px; text-align: center; background: var(--warning-muted); color: #fbbf24; font-weight: 700;
  animation: surgir 320ms var(--ease) both;
}
.selo-alerta.critico { background: var(--danger); color: #fff; box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6); animation: surgir 320ms var(--ease) both, pulso-selo 2.2s ease-out 400ms infinite; }
@keyframes surgir { from { transform: scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pulso-selo { 0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.55); } 70% { box-shadow: 0 0 0 7px rgba(239, 68, 68, 0); } 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); } }

.chip-filtro {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  margin: -8px 0 16px; padding: 8px 10px 8px 14px; border-radius: 12px; font-size: 12.5px; color: var(--text-muted);
  background: var(--info-muted); border: 1px solid rgba(96, 165, 250, 0.25);
  animation: entrar-tela 300ms var(--ease) both;
}
.chip-filtro b { color: var(--text); }

/* ---------- Entrada de tela e carregamento ---------- */
.main.entrada > * { animation: entrar-tela 360ms var(--ease) both; }
.main.entrada > *:nth-child(2) { animation-delay: 40ms; }
.main.entrada > *:nth-child(3) { animation-delay: 80ms; }
.main.entrada > *:nth-child(4) { animation-delay: 120ms; }
.main.entrada > *:nth-child(n+5) { animation-delay: 160ms; }
.main.entrada .grid.g4 > .card { animation: entrar-tela 420ms var(--ease) both; }
.main.entrada .grid.g4 > .card:nth-child(2) { animation-delay: 50ms; }
.main.entrada .grid.g4 > .card:nth-child(3) { animation-delay: 100ms; }
.main.entrada .grid.g4 > .card:nth-child(4) { animation-delay: 150ms; }
.main.entrada .grid.g4 > .card:nth-child(n+5) { animation-delay: 200ms; }
@keyframes entrar-tela { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.main.carregando { opacity: .55; transition: opacity var(--t-media) ease; pointer-events: none; }

#progresso-topo {
  position: fixed; top: 0; left: 0; height: 2px; width: 0; z-index: 100;
  background: linear-gradient(90deg, var(--gold-500), var(--gold-300), var(--emerald-400));
  box-shadow: 0 0 10px rgba(var(--accent-rgb), 0.7);
  opacity: 0; transition: width 380ms var(--ease), opacity 300ms ease;
}
#progresso-topo.ativo { opacity: 1; width: 72%; transition: width 6s cubic-bezier(.1, .7, .2, 1), opacity 120ms ease; }
#progresso-topo.fim { opacity: 0; width: 100%; transition: width 220ms ease, opacity 420ms ease 160ms; }

.esqueleto { display: grid; gap: 14px; }
.esqueleto i {
  display: block; height: 96px; border-radius: var(--radius-card);
  background: linear-gradient(100deg, var(--bg-card) 30%, var(--bg-hover) 50%, var(--bg-card) 70%);
  background-size: 300% 100%; animation: brilho 1.3s linear infinite; border: 1px solid var(--border-subtle);
}
.esqueleto i.titulo { height: 30px; width: 34%; }
.esqueleto i.linha { height: 14px; width: 58%; }
.esqueleto .g4 i { height: 104px; }
.esqueleto i.tabela { height: 260px; }
@keyframes brilho { from { background-position: 100% 0; } to { background-position: -50% 0; } }

/* ---------- Notificações (toasts) ---------- */
#toasts {
  position: fixed; right: 18px; bottom: 18px; z-index: 120;
  display: flex; flex-direction: column; gap: 10px; align-items: flex-end;
  pointer-events: none; max-width: calc(100vw - 36px);
}
.toast {
  pointer-events: auto; position: relative; overflow: hidden;
  display: flex; align-items: flex-start; gap: 11px; width: 360px; max-width: 100%;
  padding: 12px 14px 13px; border-radius: 13px;
  background: var(--bg-glass); backdrop-filter: blur(16px);
  border: 1px solid var(--border); box-shadow: var(--shadow-pop);
  color: var(--text); font-size: 12.5px; line-height: 1.45;
  animation: toast-entra 420ms var(--ease) both;
}
.toast.sai { animation: toast-sai 260ms ease both; }
.toast .ico {
  width: 28px; height: 28px; border-radius: 9px; flex-shrink: 0; display: grid; place-items: center;
  background: var(--info-muted); color: var(--info);
}
.toast .ico svg { width: 16px; height: 16px; }
.toast.sucesso .ico { background: var(--success-muted); color: var(--success); }
.toast.erro .ico { background: var(--danger-muted); color: var(--danger); }
.toast.alerta .ico { background: var(--warning-muted); color: var(--warning); }
.toast.dinheiro .ico { background: rgba(var(--accent-rgb), 0.16); color: var(--gold-300); }
.toast b { display: block; font-size: 13px; font-weight: 600; margin-bottom: 1px; }
.toast .txt { flex: 1; min-width: 0; color: var(--text-muted); overflow-wrap: anywhere; }
.toast .txt a { color: var(--gold-300); cursor: pointer; font-weight: 600; }
.toast .fechar { background: none; border: none; color: var(--text-subtle); cursor: pointer; font-size: 16px; line-height: 1; padding: 2px 4px; border-radius: 6px; }
.toast .fechar:hover { color: var(--text); background: var(--bg-hover); }
.toast .tempo { position: absolute; left: 0; bottom: 0; height: 2px; background: currentColor; opacity: .35; width: 100%; transform-origin: left; animation: tempo linear both; }
.toast.sucesso .tempo { color: var(--success); }
.toast.erro .tempo { color: var(--danger); }
.toast.dinheiro .tempo { color: var(--gold-300); }
.toast:hover .tempo { animation-play-state: paused; }
@keyframes toast-entra { from { opacity: 0; transform: translateY(16px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toast-sai { to { opacity: 0; transform: translateX(24px); } }
@keyframes tempo { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* ---------- Topo do celular e menu recolhível ---------- */
.topo-movel { display: none; }
.sobreposicao { display: none; }
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: min(290px, 86vw); height: 100%;
    transform: translateX(-102%); transition: transform 320ms var(--ease);
    box-shadow: var(--shadow-pop);
  }
  body.menu-aberto .sidebar { transform: none; }
  .sobreposicao {
    display: block; position: fixed; inset: 0; z-index: 35; background: rgba(0,0,0,.5); backdrop-filter: blur(2px);
    opacity: 0; pointer-events: none; transition: opacity 280ms ease;
  }
  body.menu-aberto .sobreposicao { opacity: 1; pointer-events: auto; }
  .topo-movel {
    display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 30;
    padding: 10px 14px; background: var(--bg-glass); backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border-subtle);
  }
  .topo-movel .marca { border: none; padding: 0; margin: 0; }
  .topo-movel .marca h1 { font-size: 17px; }
  .topo-movel .marca .selo-marca { width: 28px; height: 28px; font-size: 15px; border-radius: 8px; }
  .topo-movel .live { margin: 0 0 0 auto; padding: 0; border: none; background: none; position: static; }
  .botao-menu {
    width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; cursor: pointer;
    background: var(--bg-elevated); border: 1px solid var(--border-subtle); color: var(--text);
  }
  .botao-menu svg { width: 19px; height: 19px; }
  .main { padding: 18px 14px 64px; }
  .topo h2 { font-size: 23px; }
  th { top: 59px; }
  /* tabela larga rola dentro do cartão, sem empurrar a página para o lado */
  .card:has(table) { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .card:has(table) th { position: static; }
  .relogio { flex-wrap: wrap; row-gap: 6px; }
  .abas { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-right: -14px; padding-right: 14px; }
  .abas::-webkit-scrollbar { display: none; }
  .topo > div:last-child { width: 100%; }
  .filtros-globais select { flex: 1 1 140px; min-width: 0; }
  .kanban { grid-template-columns: repeat(6, minmax(250px, 82vw)); }
  #toasts { left: 12px; right: 12px; bottom: 12px; align-items: stretch; }
  .toast { width: auto; }
  td, th { padding: 9px 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
}
