/* Central de Cotações · Rede Inova Drogarias — UI v2 */
* { box-sizing: border-box; }
[hidden] { display: none !important; }

:root {
  --primary: #c41e3a;
  --primary-dark: #8b0000;
  --primary-light: #fef2f2;
  --text: #111827;
  --text-muted: #6b7280;
  --bg: #f4f6f8;
  --card-bg: #ffffff;
  --border: #e5e7eb;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --sidebar-bg: #1f2937;
  --sidebar-fg: #e5e7eb;
  --sidebar-fg-muted: #9ca3af;
  --sidebar-active: #c41e3a;
}
html[data-theme="dark"] {
  --primary: #ef4444;
  --primary-dark: #b91c1c;
  --primary-light: #3f1d1d;
  --text: #f3f4f6;
  --text-muted: #9ca3af;
  --bg: #0f172a;
  --card-bg: #1e293b;
  --border: #334155;
  --success: #10b981;
  --warning: #fbbf24;
  --danger: #f87171;
  --sidebar-bg: #0a0f1c;
  --sidebar-fg: #e5e7eb;
  --sidebar-fg-muted: #6b7280;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", system-ui, sans-serif;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.content-side > * { animation: fadeIn 0.25s ease-out; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ========== LAYOUT SIDEBAR ========== */
body.has-sidebar {
  display: grid;
  grid-template-columns: 240px 1fr;
  grid-template-rows: 56px 1fr;
  grid-template-areas:
    "sidebar header"
    "sidebar main";
  min-height: 100vh;
}
.sidebar {
  grid-area: sidebar;
  background: var(--sidebar-bg);
  color: var(--sidebar-fg);
  overflow-y: auto;
  padding: 0 0 20px;
  border-right: 1px solid rgba(255,255,255,0.06);
  box-shadow: inset -1px 0 0 rgba(0,0,0,0.2);
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
.sidebar-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  text-decoration: none !important; color: var(--sidebar-fg);
  margin-bottom: 12px;
  transition: background 0.15s;
}
.sidebar-brand:hover { background: rgba(255,255,255,0.04); }
.sidebar-brand img { width: 40px; height: 40px; object-fit: contain; flex-shrink: 0; }
.brand-title { font-weight: 700; font-size: 14px; line-height: 1.1; letter-spacing: -0.2px; }
.brand-sub { color: var(--sidebar-fg-muted); font-size: 11px; line-height: 1.3; margin-top: 2px; }
.sidebar-nav { display: flex; flex-direction: column; padding: 0 10px; }
.sidebar-section {
  padding: 14px 12px 6px;
  color: var(--sidebar-fg-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}
.snav {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px;
  margin: 1px 0;
  color: var(--sidebar-fg);
  text-decoration: none !important;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
  position: relative;
}
.snav:hover { background: rgba(255,255,255,0.06); color: white; }
.snav.active {
  background: linear-gradient(90deg, var(--primary) 0%, #e0364f 100%);
  color: white;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(196,30,58,0.35);
}
.snav.active::before {
  content: ''; position: absolute; left: -10px; top: 4px; bottom: 4px;
  width: 3px; background: white; border-radius: 0 2px 2px 0;
}

/* ========== HEADER quando tem sidebar ========== */
.topbar-side {
  grid-area: header;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px;
  gap: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}
.topbar-side .search-global { flex: 1; max-width: 480px; }
.topbar-side .search-global input {
  width: 100%; padding: 9px 16px; border: 1px solid var(--border);
  border-radius: 24px; font-size: 13px; background: var(--bg); color: var(--text);
  transition: all 0.15s;
}
.topbar-side .search-global input:focus { outline: none; border-color: var(--primary); background: var(--card-bg); box-shadow: 0 0 0 3px rgba(196,30,58,0.08); }
.topbar-side .user-area { display: flex; align-items: center; gap: 12px; }

/* Main content área */
.content-side { grid-area: main; padding: 24px 32px; max-width: 1400px; margin: 0; overflow-y: auto; }

/* ========== HEADER TOP antigo (compat) ========== */
.topbar { background: white; border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 24px; height: 60px; gap: 24px; }
.tabs { display: flex; gap: 2px; flex: 1; align-items: center; height: 100%; flex-wrap: nowrap; overflow-x: auto; }
.tab { padding: 0 12px; height: 100%; display: inline-flex; align-items: center; color: var(--text-muted); font-weight: 500; font-size: 13px; white-space: nowrap; border-bottom: 2px solid transparent; text-decoration: none !important; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab.disabled { color: #c0c0c0; cursor: not-allowed; pointer-events: none; }

.user-area { display: flex; gap: 10px; align-items: center; font-size: 13px; }
.user-name { color: var(--text); }
.user-name .role { color: var(--text-muted); font-size: 12px; }
.btn-logout { background: transparent; color: var(--text-muted); font-size: 13px; padding: 6px 12px; border: 1px solid var(--border); border-radius: 6px; text-decoration: none !important; }
.btn-logout:hover { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }

/* ========== LOGIN GALAXY — pika das galáxias v2 ========== */
.login-galaxy {
  margin: 0; min-height: 100vh;
  background: linear-gradient(135deg, #1a0033 0%, #4a0033 25%, #8b0000 55%, #c41e3a 100%);
  background-size: 200% 200%;
  animation: bgShift 15s ease-in-out infinite;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  overflow: hidden;
  position: relative;
}
@keyframes bgShift {
  0%, 100% { background-position: 0% 0%; }
  50% { background-position: 100% 100%; }
}
.galaxy-bg { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.orb {
  position: absolute; border-radius: 50%;
  filter: blur(100px); opacity: 0.6;
  animation: float 20s infinite ease-in-out;
}
.orb1 { width: 500px; height: 500px; background: #ef4444; top: -150px; left: -150px; }
.orb2 { width: 600px; height: 600px; background: #fbbf24; bottom: -200px; right: -150px; animation-delay: -7s; }
.orb3 { width: 400px; height: 400px; background: #8b5cf6; top: 30%; left: 45%; animation-delay: -14s; }
.orb4 { width: 350px; height: 350px; background: #06b6d4; top: 60%; left: 10%; animation-delay: -10s; opacity: 0.4; }
@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(80px, -50px) scale(1.15); }
  66% { transform: translate(-50px, 40px) scale(0.9); }
}

/* Estrelas brilhantes */
.galaxy-bg::after {
  content: '';
  position: absolute; inset: 0;
  background-image:
    radial-gradient(2px 2px at 20% 30%, white, transparent),
    radial-gradient(1px 1px at 60% 70%, white, transparent),
    radial-gradient(1.5px 1.5px at 80% 20%, rgba(255,255,255,0.8), transparent),
    radial-gradient(1px 1px at 30% 80%, white, transparent),
    radial-gradient(2px 2px at 90% 50%, rgba(255,255,255,0.9), transparent),
    radial-gradient(1px 1px at 10% 50%, white, transparent),
    radial-gradient(1.5px 1.5px at 50% 10%, white, transparent),
    radial-gradient(1px 1px at 70% 40%, rgba(255,255,255,0.7), transparent);
  background-size: 250px 250px;
  animation: twinkle 4s infinite;
}
@keyframes twinkle {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.galaxy-grid {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: 1.1fr 1fr;
  max-width: 1100px; width: 100%;
  background: rgba(255,255,255,0.05);
  backdrop-filter: blur(20px);
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 30px 80px rgba(0,0,0,0.4);
}
@media (max-width: 900px) { .galaxy-grid { grid-template-columns: 1fr; } .galaxy-left { display: none; } }

.galaxy-left {
  padding: 48px 44px;
  color: white;
  display: flex; flex-direction: column; justify-content: center;
}
.g-logo {
  width: 88px; height: 88px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 0 0 4px rgba(255,255,255,0.1), 0 0 60px rgba(196,30,58,0.4);
  margin-bottom: 28px;
  object-fit: contain;
  animation: logoPulse 3s ease-in-out infinite;
}
@keyframes logoPulse {
  0%, 100% { box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 0 0 4px rgba(255,255,255,0.1), 0 0 60px rgba(196,30,58,0.4); }
  50% { box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 0 0 8px rgba(255,255,255,0.15), 0 0 100px rgba(196,30,58,0.6); }
}
.g-title { font-size: 30px; font-weight: 700; margin: 0 0 6px; letter-spacing: -0.5px; }
.g-subtitle { font-size: 16px; opacity: 0.9; margin: 0 0 36px; }
.g-ia { background: linear-gradient(90deg, #fde047, #f97316); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; font-weight: 700; }
.g-features { display: flex; flex-direction: column; gap: 18px; }
.g-feat {
  display: flex; gap: 14px; align-items: flex-start;
  opacity: 0; transform: translateX(-20px);
  animation: slideInLeft 0.5s ease-out forwards;
}
.g-feat:nth-child(1) { animation-delay: 0.1s; }
.g-feat:nth-child(2) { animation-delay: 0.25s; }
.g-feat:nth-child(3) { animation-delay: 0.4s; }
.g-feat:nth-child(4) { animation-delay: 0.55s; }
@keyframes slideInLeft { to { opacity: 1; transform: translateX(0); } }
.g-feat-icon {
  width: 44px; height: 44px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}
.g-feat-title { font-size: 14px; font-weight: 600; }
.g-feat-desc { font-size: 12px; opacity: 0.75; margin-top: 2px; }

.galaxy-right {
  background: rgba(255,255,255,0.97);
  padding: 48px 44px;
  display: flex; flex-direction: column; justify-content: space-between;
}
html[data-theme="dark"] .galaxy-right { background: rgba(15,23,42,0.97); }
.g-card-h { font-size: 26px; font-weight: 700; margin: 0 0 6px; color: var(--text); letter-spacing: -0.3px; }
.g-card-sub { color: var(--text-muted); margin: 0 0 28px; font-size: 14px; }
.g-form label { display: block; margin: 14px 0 6px; font-size: 12px; font-weight: 700; color: #374151; text-transform: uppercase; letter-spacing: 0.5px; }
.g-form input { width: 100%; padding: 13px 14px; border: 1.5px solid #e5e7eb; border-radius: 10px; font-size: 14px; background: white; transition: all 0.15s; }
.g-form input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(196,30,58,0.1); }
.pwd-wrap { position: relative; }
.pwd-wrap input { padding-right: 44px; }
.pwd-eye { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: transparent; border: none; cursor: pointer; font-size: 16px; padding: 8px; color: #6b7280; }
.pwd-eye:hover { color: var(--primary); }
.btn-enter {
  width: 100%; margin-top: 24px;
  background: linear-gradient(135deg, var(--primary) 0%, #e0364f 100%);
  color: white; padding: 14px; border: none; border-radius: 10px;
  font-size: 15px; font-weight: 700; cursor: pointer;
  box-shadow: 0 6px 20px rgba(196,30,58,0.35);
  transition: all 0.2s;
}
.btn-enter:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(196,30,58,0.5); }
.btn-enter:active { transform: translateY(0); }
.g-error { color: var(--primary); font-size: 13px; margin-top: 16px; padding: 12px 14px; background: rgba(196,30,58,0.08); border-radius: 10px; border: 1px solid rgba(196,30,58,0.15); }
.g-help { margin-top: 28px; padding-top: 20px; border-top: 1px solid #f3f4f6; font-size: 13px; color: #6b7280; text-align: center; }
.g-help strong { color: var(--primary); }
.g-footer { margin-top: 24px; text-align: center; color: #9ca3af; font-size: 12px; }
.g-footer p { margin: 4px 0; }
.g-footer strong { color: var(--primary); }

/* ========== LOGIN v2 — estilo InovaExpress (mantido pra compat) ========== */
.login-page-v2 {
  margin: 0; min-height: 100vh;
  background:
    radial-gradient(at 20% 0%, rgba(196,30,58,0.08), transparent 60%),
    radial-gradient(at 80% 100%, rgba(196,30,58,0.10), transparent 60%),
    linear-gradient(135deg, #fafafa 0%, #f3f4f6 100%);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 40px 20px;
}
.login-card {
  background: white;
  border-radius: 20px;
  padding: 44px 40px 36px;
  width: 100%; max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  border: 1px solid #f3f4f6;
  text-align: center;
}
.login-logo { width: 200px; max-width: 80%; height: auto; margin-bottom: 8px; }
.login-tagline { color: #6b7280; font-size: 11px; letter-spacing: 2.5px; margin-bottom: 32px; font-weight: 500; }
.login-tagline strong { color: var(--primary); font-weight: 700; }
.login-h { font-size: 22px; font-weight: 600; color: var(--text); margin: 0 0 24px; letter-spacing: -0.3px; }

.login-form { text-align: left; }
.login-form label { display: block; margin: 12px 0 6px; font-size: 13px; font-weight: 600; color: #374151; }
.login-form input { width: 100%; padding: 12px 14px; border: 1px solid #e5e7eb; border-radius: 10px; font-size: 14px; background: #fafbfc; transition: all 0.15s; }
.login-form input:focus { outline: none; border-color: var(--primary); background: white; box-shadow: 0 0 0 3px rgba(196,30,58,0.1); }
.pwd-wrap { position: relative; }
.pwd-wrap input { padding-right: 44px; }
.pwd-eye { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: transparent; border: none; cursor: pointer; font-size: 16px; padding: 6px; color: #6b7280; }
.pwd-eye:hover { color: var(--primary); }

.btn-enter {
  width: 100%; margin-top: 20px;
  background: linear-gradient(135deg, var(--primary) 0%, #e0364f 100%);
  color: white; padding: 13px; border: none; border-radius: 10px;
  font-size: 15px; font-weight: 600; cursor: pointer;
  box-shadow: 0 4px 14px rgba(196,30,58,0.3);
  transition: all 0.15s;
}
.btn-enter:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(196,30,58,0.4); }
.btn-enter:active { transform: translateY(0); }

.login-error { color: var(--primary); font-size: 13px; margin-top: 14px; padding: 10px 12px; background: rgba(196,30,58,0.08); border-radius: 8px; }

.login-help { margin-top: 28px; font-size: 13px; color: #4b5563; }
.login-help p { margin: 6px 0; }
.login-help strong { color: var(--primary); }

.login-footer { margin-top: 32px; text-align: center; color: #6b7280; }
.login-footer p { margin: 4px 0; font-size: 13px; }
.login-footer strong { color: var(--primary); }

/* ========== LOGIN BONITO (versão antiga split) ========== */
.login-page { margin: 0; min-height: 100vh; background: var(--bg); }
.login-split { display: grid; grid-template-columns: 1.2fr 1fr; min-height: 100vh; }
@media (max-width: 900px) { .login-split { grid-template-columns: 1fr; } .login-brand { display: none; } }
.login-brand {
  background: linear-gradient(135deg, #c41e3a 0%, #8b0000 100%);
  color: white;
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center;
  padding: 60px 60px;
  position: relative;
  overflow: hidden;
}
.login-brand::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at 80% 20%, rgba(255,255,255,0.15), transparent 50%),
              radial-gradient(circle at 20% 80%, rgba(255,255,255,0.08), transparent 50%);
  pointer-events: none;
}
.login-brand > * { position: relative; z-index: 1; }
.brand-logo {
  width: 110px; height: 110px; margin-bottom: 28px;
  border-radius: 50%;
  box-shadow: 0 12px 36px rgba(0,0,0,0.3);
  object-fit: contain;
  background: white;
}
.brand-h1 { font-size: 32px; margin: 0 0 8px; font-weight: 700; }
.brand-tagline { font-size: 16px; opacity: 0.9; margin: 0 0 48px; }
.brand-features { display: flex; flex-direction: column; gap: 14px; }
.brand-feat { display: flex; gap: 12px; align-items: center; font-size: 15px; opacity: 0.95; }
.feat-emoji { font-size: 22px; }

.login-right { display: flex; align-items: center; justify-content: center; padding: 40px; background: var(--card-bg); }
.login-box { width: 100%; max-width: 380px; }
.login-title { font-size: 24px; margin: 0 0 4px; color: var(--text); }
.login-sub { color: var(--text-muted); margin: 0 0 28px; font-size: 14px; }
.login-box label { display: block; margin: 16px 0 6px; font-size: 13px; font-weight: 600; color: var(--text); }
.login-box input { width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; font-size: 15px; background: var(--bg); color: var(--text); transition: border 0.15s; }
.login-box input:focus { outline: none; border-color: var(--primary); background: var(--card-bg); }
.login-box button { width: 100%; background: var(--primary); color: white; padding: 14px; border: none; border-radius: 10px; font-size: 15px; font-weight: 600; margin-top: 24px; cursor: pointer; transition: background 0.15s; }
.login-box button:hover { background: var(--primary-dark); }
.login-box .error { color: var(--primary); font-size: 13px; margin-top: 14px; padding: 10px 12px; background: var(--primary-light); border-radius: 8px; }
.login-foot { margin-top: 32px; text-align: center; }

/* ========== ELEMENTOS COMUNS ========== */
h2 { font-size: 22px; margin: 0 0 16px; color: var(--text); }
h3 { font-size: 16px; margin: 0 0 8px; color: var(--text); }
.muted { color: var(--text-muted); }
.danger { color: var(--danger); font-weight: 600; }
.small { font-size: 11px; }

.page-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; gap: 16px; }
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.flash-area { padding: 12px 32px 0; grid-column: 2; }
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 8px; font-size: 13px; }
.flash.success { background: #ecfdf5; color: var(--success); }
.flash.error { background: var(--primary-light); color: var(--primary); }

/* ========== CARDS ========== */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 24px; }
.card {
  background: var(--card-bg); padding: 22px; border-radius: 14px; border: 1px solid var(--border);
  transition: all 0.15s; box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}
.card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.06); transform: translateY(-1px); }
.card .label { color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px; font-weight: 600; }
.card .value { color: var(--text); font-size: 32px; font-weight: 700; margin-top: 6px; letter-spacing: -0.5px; line-height: 1.1; }
.card .value.muted { color: var(--text-muted); }
.card .hint { color: var(--text-muted); font-size: 11px; margin-top: 6px; }

.kpi-primary { border-left: 3px solid var(--primary); }
.kpi-success { border-left: 3px solid var(--success); }
.kpi-warning { border-left: 3px solid var(--warning); }
.kpi-info { border-left: 3px solid #3b82f6; }

/* ========== DASHBOARD ========== */
.dash-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.dash-status { display: flex; gap: 8px; align-items: center; }
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }
@media (max-width: 1100px) { .dash-grid { grid-template-columns: 1fr; } }
.section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.bar { background: #f3f4f6; height: 8px; border-radius: 4px; overflow: hidden; min-width: 80px; }
html[data-theme="dark"] .bar { background: #334155; }
.bar-fill { background: var(--primary); height: 100%; }
.msg-list { list-style: none; padding: 0; margin: 0; }
.msg-list li { border-bottom: 1px solid var(--border); }
.msg-list li:last-child { border-bottom: none; }
.msg-list a { display: block; padding: 10px 4px; color: inherit; text-decoration: none; }
.msg-list a:hover { background: var(--bg); }
.msg-from { font-weight: 600; font-size: 13px; }
.msg-list .msg-body { color: var(--text-muted); font-size: 12px; margin-top: 2px; }
.msg-list .msg-time { color: var(--text-muted); font-size: 11px; margin-top: 2px; }
.empty { background: var(--card-bg); padding: 48px 32px; text-align: center; border-radius: 12px; border: 2px dashed var(--border); color: var(--text-muted); }
.empty h3 { color: var(--text); margin: 0 0 8px; font-size: 18px; }
.empty-mini { padding: 24px; text-align: center; color: var(--text-muted); font-size: 13px; }

.quick-actions { margin-top: 24px; }
.actions-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.action-card { background: var(--card-bg); padding: 18px; border-radius: 10px; border: 1px solid var(--border); text-align: center; color: var(--text); text-decoration: none !important; transition: all 0.15s; display: block; }
.action-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.06); }
.action-icon { font-size: 28px; margin-bottom: 6px; }
.action-text { font-size: 13px; font-weight: 600; color: var(--text); }

/* ========== BUTTONS ========== */
.btn-primary, .btn-secondary {
  display: inline-block; padding: 10px 18px; border-radius: 8px; font-weight: 600; font-size: 14px;
  text-decoration: none !important; cursor: pointer; border: none; margin-top: 8px;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--card-bg); color: var(--primary); border: 1px solid var(--primary); }
.btn-secondary:hover { background: var(--primary-light); }
.btn-secondary.disabled { opacity: 0.4; cursor: not-allowed; }
.btn-link { color: var(--text-muted); font-size: 13px; padding: 6px 10px; background: transparent; border: none; cursor: pointer; }
.btn-link:hover { color: var(--primary); }

/* ========== FILTROS / FORM ========== */
.filters, .filter-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.filter-bar { background: var(--card-bg); padding: 12px 16px; border-radius: 10px; border: 1px solid var(--border); }
.filter-bar label { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.filters input, .filters select, .filter-bar input, .filter-bar select {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; background: var(--card-bg); color: var(--text);
}
.filters input[type=search] { flex: 1; min-width: 240px; }
.filters button, .filter-bar button { background: var(--primary); color: white; padding: 8px 16px; border: none; border-radius: 8px; cursor: pointer; font-size: 14px; }
.inline-check { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; cursor: pointer; }
.active-filter { background: var(--primary) !important; color: white !important; padding: 4px 10px !important; border-radius: 6px; }

/* ========== TABELAS ========== */
.data-table { width: 100%; background: var(--card-bg); border-radius: 12px; border-collapse: collapse; overflow: hidden; border: 1px solid var(--border); }
.data-table th, .data-table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); }
.data-table th { background: var(--bg); color: var(--text-muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.data-table td.num, .data-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover { background: var(--bg); }
.data-table.compact th, .data-table.compact td { padding: 6px 10px; font-size: 13px; }
.warning { color: var(--warning); font-weight: 600; }

.pagination { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 16px; color: var(--text-muted); font-size: 13px; }
.pagination a { padding: 6px 12px; border: 1px solid var(--border); border-radius: 6px; }

/* ========== ALERT / BOX ========== */
.alert { padding: 14px 18px; border-radius: 10px; margin: 16px 0; font-size: 14px; }
.alert.success { background: #ecfdf5; color: var(--success); border: 1px solid #a7f3d0; }
.alert.error { background: var(--primary-light); color: var(--primary); border: 1px solid #fecaca; }
.alert .actions { margin-top: 10px; }

.info-box { background: var(--card-bg); padding: 20px; border-radius: 12px; border: 1px solid var(--border); margin-top: 16px; }
.cols-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px 16px; list-style: none; padding: 0; margin: 12px 0 0; font-size: 13px; }
.cols-grid li { padding: 4px 0; color: var(--text-muted); }
.cols-grid strong { color: var(--text); }

/* ========== UPLOAD ========== */
.upload-form { display: flex; gap: 12px; align-items: center; margin: 20px 0; flex-wrap: wrap; }
.file-drop { display: inline-flex; align-items: center; padding: 12px 18px; background: var(--card-bg); border: 2px dashed var(--border); border-radius: 10px; cursor: pointer; font-size: 14px; color: var(--text-muted); }
.file-drop:hover { border-color: var(--primary); color: var(--primary); }
.file-drop input { display: none; }

/* ========== BADGE ========== */
.badge { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }
.badge.ok { background: #ecfdf5; color: var(--success); }
.badge.muted { background: var(--bg); color: var(--text-muted); }
.badge.warning { background: #fef3c7; color: var(--warning); }

/* ========== SEMÁFORO ========== */
.sem { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 700; }
.sem.verde     { background: #ecfdf5; color: var(--success); }
.sem.azul      { background: #eff6ff; color: #2563eb; }
.sem.vermelho  { background: #fef2f2; color: var(--danger); }
.sem.cinza     { background: var(--bg); color: var(--text-muted); }

/* ========== CHAT LIST ========== */
.chat-list .msg-preview { color: var(--text-muted); font-size: 13px; }

/* ========== AVATAR ========== */
.avatar { width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: white; font-weight: 700; font-size: 13px; background: var(--primary); flex-shrink: 0; text-transform: uppercase; }
.avatar[data-name^="A"], .avatar[data-name^="I"], .avatar[data-name^="Q"], .avatar[data-name^="Y"] { background: #c41e3a; }
.avatar[data-name^="B"], .avatar[data-name^="J"], .avatar[data-name^="R"], .avatar[data-name^="Z"] { background: #0891b2; }
.avatar[data-name^="C"], .avatar[data-name^="K"], .avatar[data-name^="S"] { background: #059669; }
.avatar[data-name^="D"], .avatar[data-name^="L"], .avatar[data-name^="T"] { background: #d97706; }
.avatar[data-name^="E"], .avatar[data-name^="M"], .avatar[data-name^="U"] { background: #7c3aed; }
.avatar[data-name^="F"], .avatar[data-name^="N"], .avatar[data-name^="V"] { background: #db2777; }
.avatar[data-name^="G"], .avatar[data-name^="O"], .avatar[data-name^="W"] { background: #2563eb; }
.avatar[data-name^="H"], .avatar[data-name^="P"], .avatar[data-name^="X"] { background: #ea580c; }

/* ========== TOAST ========== */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { background: var(--card-bg); border: 1px solid var(--border); border-left: 4px solid var(--success); padding: 14px 18px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,0.15); min-width: 320px; max-width: 380px; pointer-events: auto; animation: slideIn 0.3s ease-out; }
.toast.suspeita { border-left-color: var(--warning); }
.toast.ruptura { border-left-color: var(--danger); }
.toast .title { font-weight: 700; font-size: 14px; }
.toast .desc { color: var(--text-muted); font-size: 13px; margin-top: 4px; }
.toast .close { float: right; cursor: pointer; color: var(--text-muted); border: none; background: transparent; font-size: 16px; }
@keyframes slideIn { from { transform: translateX(400px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ========== BUSCA GLOBAL ========== */
.search-global { position: relative; }
.search-results { position: absolute; top: 100%; left: 0; right: 0; margin-top: 6px; max-height: 480px; overflow-y: auto; background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,0.12); z-index: 999; }
.search-group { padding: 6px 0; border-bottom: 1px solid var(--border); }
.search-group:last-child { border-bottom: none; }
.search-head { padding: 6px 14px; font-size: 11px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.search-item { display: block; padding: 8px 14px; color: var(--text); text-decoration: none !important; font-size: 13px; line-height: 1.3; }
.search-item:hover { background: var(--primary-light); }
.search-empty { padding: 20px; text-align: center; color: var(--text-muted); font-size: 13px; }

/* ========== SINO + DARK MODE TOGGLE ========== */
.bell-btn, .theme-btn { position: relative; background: transparent; border: 1px solid var(--border); border-radius: 8px; width: 36px; height: 32px; cursor: pointer; font-size: 14px; display: flex; align-items: center; justify-content: center; color: var(--text); }
.bell-btn:hover, .theme-btn:hover { background: var(--primary-light); }
.bell-count { position: absolute; top: -4px; right: -4px; background: var(--primary); color: white; font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 8px; min-width: 16px; text-align: center; }
.bell-dropdown { position: absolute; top: 56px; right: 100px; width: 360px; max-height: 480px; background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,0.12); z-index: 1000; display: flex; flex-direction: column; }
.bell-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); gap: 12px; }
#bell-close, .cp-close { background: transparent; border: none; cursor: pointer; color: var(--text-muted); font-size: 16px; padding: 0 4px; }
.bell-list { list-style: none; padding: 0; margin: 0; overflow-y: auto; flex: 1; }
.bell-item { border-bottom: 1px solid var(--border); }
.bell-item a { display: block; padding: 12px 16px; color: var(--text); text-decoration: none !important; }
.bell-item a:hover { background: var(--bg); }
.bell-item.unread { background: #fef9f0; }
html[data-theme="dark"] .bell-item.unread { background: #3f2d1d; }
.bell-title { font-weight: 600; font-size: 13px; }
.bell-desc { color: var(--text-muted); font-size: 12px; margin-top: 2px; }
.bell-time { color: var(--text-muted); font-size: 11px; margin-top: 2px; }
.bell-empty { padding: 30px; text-align: center; color: var(--text-muted); font-size: 13px; }

/* ========== MODAL ========== */
.cp-modal { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 2000; }
.cp-modal[hidden] { display: none !important; }
.cp-box { background: var(--card-bg); border-radius: 12px; padding: 24px; width: 500px; max-width: 90%; box-shadow: 0 20px 40px rgba(0,0,0,0.3); }
.cp-head { display: flex; justify-content: space-between; margin-bottom: 12px; }
.cp-box textarea { width: 100%; padding: 10px; border: 1px solid var(--border); border-radius: 8px; font-family: inherit; font-size: 14px; margin: 8px 0; background: var(--bg); color: var(--text); }

/* === MISC === */
.actions-cell { display: flex; gap: 4px; }
.btn-mini { padding: 4px 10px; border-radius: 6px; border: 1px solid var(--border); background: var(--card-bg); cursor: pointer; font-size: 13px; color: var(--text); }
.btn-mini.ok { color: var(--success); border-color: #a7f3d0; }
.btn-mini.ok:hover { background: #ecfdf5; }
.btn-mini.danger { color: var(--danger); border-color: #fecaca; }
.btn-mini.danger:hover { background: var(--primary-light); }
.btn-mini:hover { background: var(--bg); }

/* dark mode pra inputs */
html[data-theme="dark"] input, html[data-theme="dark"] select, html[data-theme="dark"] textarea {
  background: #0f172a; color: var(--text); border-color: var(--border);
}
html[data-theme="dark"] .data-table { background: var(--card-bg); }
html[data-theme="dark"] .data-table tr:hover { background: #334155; }

/* ========== MODO APRESENTAÇÃO ========== */
body.presentation .card .value,
body.presentation .econ-big,
body.presentation .acao-prices,
body.presentation td.num,
body.presentation .status-detail {
  filter: blur(6px);
  transition: filter 0.2s;
}
body.presentation .card .value:hover,
body.presentation .acao-prices:hover,
body.presentation td.num:hover {
  filter: blur(0);
}

/* ========== RESPONSIVO ========== */
@media (max-width: 900px) {
  body.has-sidebar { grid-template-columns: 60px 1fr; }
  .sidebar-brand div, .sidebar-section, .snav { font-size: 0; }
  .snav { padding: 12px; text-align: center; }
}

/* J/K navegação (Bloco 80) */
.jk-highlight { outline: 2px solid var(--primary) !important; outline-offset: -2px; background: var(--primary-light) !important; }
