/* ===== DESIGN TOKENS ===== */
:root,
[data-theme="light"] {
  --bg:    #ffffff;
  --bg1:   #fafafa;
  --bg2:   #f3f3f6;
  --bg3:   #e8e8ee;
  --line:  rgba(0,0,0,0.06);
  --line2: rgba(0,0,0,0.10);

  --accent:  #ff5500;
  --accent2: rgba(255,85,0,0.10);
  --accent3: rgba(255,85,0,0.22);
  --accent-glow: rgba(255,85,0,0.45);

  --text:   #1a1a1f;
  --muted:  #6b6b78;
  --muted2: #4a4a58;
  --on-accent: #ffffff;

  --green: #00a862;
  --red:   #e0342a;
  --amber: #d97706;
  --blue:  #2563eb;
  --purple:#7c3aed;

  --topbar-bg: rgba(255,255,255,0.92);
  --overlay-bg: rgba(0,0,0,0.35);
  --sidebar-shadow: 8px 0 32px rgba(0,0,0,0.08);
  --grain-opacity: 0.018;
  --card-hover-shadow: 0 6px 28px rgba(0,0,0,0.08);
  --surface-hover: rgba(0,0,0,0.04);
  --surface-border: rgba(0,0,0,0.10);

  --r:    12px;
  --r-sm:  8px;
  --r-lg: 16px;

  --display: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --mono:    'DM Mono', ui-monospace, monospace;

  --text-xs:   0.6875rem;
  --text-sm:   0.8125rem;
  --text-base: 0.9375rem;
  --text-lg:   1.0625rem;
  --text-xl:   1.375rem;
  --text-2xl:  1.75rem;
  --leading-tight: 1.25;
  --leading-normal: 1.55;
  --leading-relaxed: 1.65;

  --space-1: 0.375rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-7: 2rem;
  --card-pad: 1.5rem;
  --grid-gap: 1.25rem;

  --sidebar-w: 260px;
  --topbar-h:  60px;
}

[data-theme="dark"] {
  --bg:    #0c0c0e;
  --bg1:   #111114;
  --bg2:   #18181d;
  --bg3:   #202028;
  --line:  rgba(255,255,255,0.06);
  --line2: rgba(255,255,255,0.09);

  --accent:  #ff5500;
  --accent2: rgba(255,85,0,0.12);
  --accent3: rgba(255,85,0,0.24);
  --accent-glow: rgba(255,85,0,0.50);

  --text:   #f0f0f4;
  --muted:  #60606e;
  --muted2: #90909e;
  --on-accent: #ffffff;

  --green: #00e57a;
  --red:   #ff3b30;
  --amber: #f5a623;
  --blue:  #4faaff;
  --purple:#a78bfa;

  --topbar-bg: rgba(17,17,20,0.92);
  --overlay-bg: rgba(0,0,0,0.55);
  --sidebar-shadow: 8px 0 32px rgba(0,0,0,0.35);
  --grain-opacity: 0.04;
  --card-hover-shadow: 0 6px 28px rgba(0,0,0,0.35);
  --surface-hover: rgba(255,255,255,0.04);
  --surface-border: rgba(255,255,255,0.10);
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  background: var(--bg);
  color: var(--text);
  font-family: var(--display);
  font-size: 16px;
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body { min-height: 100vh; overflow-x: hidden; font-size: var(--text-base); }

/* grain */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  opacity: var(--grain-opacity);
  background-size: 200px;
}

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg3); border-radius: 4px; }

::selection { background: var(--accent3); color: var(--text); }

/* ===== TYPOGRAPHY HELPERS ===== */
.sec {
  font-size: var(--text-xs); font-weight: 700; color: var(--muted);
  letter-spacing: .12em; text-transform: uppercase; line-height: var(--leading-tight);
}
.lbl {
  display: block; font-size: var(--text-xs); font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); margin-bottom: var(--space-2);
}
.lbl-link {
  font-size: var(--text-xs); font-weight: 700; letter-spacing: .06em;
  color: var(--accent); text-decoration: none;
}
.lbl-link:hover { opacity: .75; }

/* ===== INPUTS ===== */
.inp {
  width: 100%;
  background: var(--bg2); border: 1px solid var(--line2);
  border-radius: var(--r-sm); color: var(--text);
  font-family: var(--mono); font-size: var(--text-sm);
  padding: 12px 14px; outline: none;
  line-height: var(--leading-normal);
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none;
}
.inp:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent2);
}
.inp::placeholder { color: var(--muted); }
.inp-disabled { color: var(--muted2); cursor: not-allowed; }
select.inp option { background: var(--bg2); }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 20px; border-radius: var(--r-sm);
  font-family: var(--display); font-size: var(--text-sm); font-weight: 700;
  line-height: 1.2;
  cursor: pointer; border: none; transition: opacity .15s, transform .1s, box-shadow .15s;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }

.btn-accent { background: var(--accent); color: var(--on-accent); }
.btn-accent:hover { opacity: .88; }

.btn-ghost { background: var(--bg3); color: var(--text); border: 1px solid var(--line2); }
.btn-ghost:hover { border-color: var(--line2); background: var(--bg2); }

.btn-full { width: 100%; justify-content: center; }

.btn-group { display: flex; gap: 3px; }
.btn-tab {
  padding: 5px 12px; border-radius: 6px; border: none; cursor: pointer;
  font-family: var(--display); font-size: 11px; font-weight: 600;
  background: transparent; color: var(--muted);
  transition: background .15s, color .15s;
}
.btn-tab.active, .btn-tab:hover { background: var(--bg3); color: var(--text); }

/* ===== ICON BUTTON ===== */
.icon-btn {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--bg2); border: 1px solid var(--line2);
  color: var(--muted2); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: color .15s, border-color .15s;
}
.icon-btn:hover { color: var(--text); }

/* ===== CARD ===== */
.card {
  background: var(--bg1); border: 1px solid var(--line2);
  border-radius: var(--r-lg); padding: var(--card-pad);
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.card-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: var(--space-5); gap: var(--space-4);
  flex-wrap: wrap;
}
.card-title {
  font-size: var(--text-lg); font-weight: 700; color: var(--text);
  line-height: var(--leading-tight); letter-spacing: -.01em;
}
.card-sub {
  font-size: var(--text-sm); color: var(--muted2); margin-top: var(--space-1);
  font-family: var(--display); font-weight: 500; line-height: var(--leading-normal);
}
.card-icon  {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.card-icon-accent { background: var(--accent2); color: var(--accent); }

/* ===== CHIP ===== */
.chip {
  font-family: var(--mono); font-size: 11px; color: var(--muted2);
  background: var(--bg2); border: 1px solid var(--line2);
  border-radius: 20px; padding: 3px 10px;
}

/* ===== PAGE ===== */
.page {
  display: flex; flex-direction: column; gap: var(--grid-gap);
  animation: fadeIn .22s ease-out;
}
.page.hidden { display: none; }
.page.active { display: flex; }

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

/* ===== LOGIN ===== */
.login-overlay {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg); overflow: hidden;
}
.login-theme-bar {
  position: absolute; top: 18px; right: 18px; z-index: 5;
}
.login-video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; opacity: .35;
}
.login-veil {
  position: absolute; inset: 0;
  background: linear-gradient(to top, var(--bg) 0%, color-mix(in srgb, var(--bg) 50%, transparent) 60%, transparent 100%);
}
.login-grid {
  position: relative; width: 100%; max-width: 960px;
  padding: 24px; display: grid;
  grid-template-columns: 1fr 1fr; gap: 48px; align-items: center;
}
@media (max-width: 768px) {
  .login-grid { grid-template-columns: 1fr; }
  .login-marketing { display: none; }
}
.login-marketing { color: var(--text); }
.login-badge {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .14em; color: var(--accent);
  border: 1px solid var(--accent3); border-radius: 20px; padding: 5px 13px;
  margin-bottom: 24px;
}
.login-headline { font-size: 48px; font-weight: 800; line-height: 1.1; margin-bottom: 16px; }
.login-headline .accent { color: var(--accent); }
.login-sub { font-size: 16px; color: var(--muted2); max-width: 360px; margin-bottom: 32px; }
.login-stats { display: flex; gap: 0; align-items: center; }
.login-stat { display: flex; flex-direction: column; gap: 4px; padding: 0 24px; }
.login-stat:first-child { padding-left: 0; }
.login-stat-num { font-size: 26px; font-weight: 800; color: var(--text); }
.login-stat-lbl { font-family: var(--mono); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.login-stat-div { width: 1px; height: 40px; background: var(--line2); }

.login-form-wrap { display: flex; flex-direction: column; align-items: center; }
.login-logo-mobile { display: none; align-items: center; gap: 10px; margin-bottom: 24px; }
@media (max-width: 768px) { .login-logo-mobile { display: flex; } }

.login-card {
  width: 100%; max-width: 380px;
  background: var(--bg1); border: 1px solid var(--line2);
  border-radius: var(--r-lg); padding: 32px;
}
.login-card-header { margin-bottom: 24px; }
.login-card-header h2 { font-size: 20px; font-weight: 800; margin-bottom: 4px; }
.login-card-header p  { font-family: var(--mono); font-size: 12px; color: var(--muted2); }

.login-fields { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; }
.field-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.field-row .lbl { margin-bottom: 0; }

.login-error {
  font-family: var(--mono); font-size: 11px; color: var(--red);
  background: rgba(255,59,48,.08); border: 1px solid rgba(255,59,48,.2);
  border-radius: var(--r-sm); padding: 10px 14px;
}
.login-error.hidden { display: none; }

.login-actions { display: flex; flex-direction: column; gap: 8px; padding-top: 4px; }
.login-footer {
  font-family: var(--mono); font-size: 10px; color: var(--muted);
  margin-top: 20px; text-align: center;
}

.login-brand-logo { display: block; width: auto; height: auto; max-width: 100%; }
.login-brand-logo--hero { max-width: 260px; margin-bottom: 28px; }
.login-brand-logo--mobile { max-height: 44px; width: auto; }

.sidebar-brand-logo {
  width: 100%; max-width: 148px; height: auto; flex-shrink: 0;
  align-self: flex-start; display: block;
}

/* ===== SIDEBAR (drawer: oculta até abrir o hambúrguer) ===== */
.sidebar {
  position: fixed; top: 0; left: 0; height: 100%; width: var(--sidebar-w);
  background: var(--bg1); border-right: 1px solid var(--line2);
  z-index: 100; display: flex; flex-direction: column;
  transform: translateX(-100%);
  transition: transform .3s ease;
  box-shadow: var(--sidebar-shadow);
}
.sidebar.open { transform: translateX(0); }

.sidebar-logo {
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
  padding: 20px 18px; border-bottom: 1px solid var(--line);
}
.logo-mark {
  width: 34px; height: 34px; flex-shrink: 0;
  background: var(--accent); border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800; color: var(--on-accent);
  letter-spacing: -.04em;
}
.logo-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.logo-text { font-size: 16px; font-weight: 800; letter-spacing: -.03em; }
.logo-sub  { font-family: var(--mono); font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: .10em; }

/* progress in sidebar */
.progress-container { margin-top: 10px; }
.progress-header { display: flex; justify-content: space-between; margin-bottom: 6px; }
.progress-status { font-family: var(--mono); font-size: 10px; color: var(--accent); }
.progress-pct    { font-family: var(--mono); font-size: 10px; font-weight: 700; color: var(--accent); }
.progress-track  { background: var(--bg3); border-radius: 4px; height: 4px; overflow: hidden; }
.progress-fill   { background: var(--accent); height: 100%; transition: width .5s ease; }
.hidden { display: none !important; }

.sidebar-nav {
  flex: 1; padding: 12px 10px; display: flex; flex-direction: column;
  gap: 2px; overflow-y: auto;
}
.nav-item {
  position: relative; display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--r-sm);
  font-size: 13px; font-weight: 600; color: var(--muted2);
  text-decoration: none; transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--bg2); color: var(--text); }
.nav-item.active { background: var(--accent2); color: var(--text); }
.nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 50%;
  transform: translateY(-50%); width: 3px; height: 55%;
  background: var(--accent); border-radius: 0 3px 3px 0;
}
.nav-icon { width: 16px; height: 16px; flex-shrink: 0; }
.nav-badge {
  margin-left: auto; background: var(--accent); color: var(--on-accent);
  font-size: 9px; font-weight: 800; padding: 2px 6px; border-radius: 5px;
}

.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; border-top: 1px solid var(--line);
}
.user-avatar {
  width: 32px; height: 32px; flex-shrink: 0;
  background: var(--bg3); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: var(--accent);
}
.user-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.user-name { font-size: 13px; font-weight: 600; truncate; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-family: var(--mono); font-size: 10px; color: var(--muted2); }

/* ===== TOPBAR ===== */
.main-wrap {
  margin-left: 0; min-height: 100vh; display: flex; flex-direction: column;
}

.topbar {
  position: sticky; top: 0; z-index: 40;
  background: var(--topbar-bg); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line2);
  min-height: var(--topbar-h); display: flex; align-items: center;
  justify-content: space-between; padding: 0 clamp(12px, 3vw, 24px); gap: var(--space-4);
}
.topbar-left  { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: var(--space-2); flex-shrink: 0; }

/* Botão menu: sempre visível (sidebar em drawer) */
.menu-hamburger { display: flex; }

.breadcrumb {
  display: flex; align-items: center; gap: 7px;
  font-size: var(--text-sm); min-width: 0;
}
.bc-page { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 28vw; }
.bc-root { color: var(--muted); }
.bc-page { font-weight: 700; color: var(--text); }

.topbar-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg2); border: 1px solid var(--line2);
  border-radius: var(--r-sm); padding: 7px 12px; width: 220px;
  color: var(--muted2);
}
.topbar-search input {
  background: transparent; border: none; outline: none;
  font-family: var(--display); font-size: var(--text-sm); color: var(--text);
  width: 100%;
}
.topbar-search input::placeholder { color: var(--muted); }
@media (max-width: 900px) { .topbar-search { width: 160px; } }
@media (max-width: 640px) {
  .topbar-search { display: none; }
  .bc-root, .breadcrumb svg { display: none; }
  .bc-page { max-width: 42vw; }
}

.notif-dot {
  position: absolute; top: 6px; right: 6px;
  width: 7px; height: 7px; background: var(--red); border-radius: 50%;
}

/* ===== CONTENT ===== */
.content {
  flex: 1;
  padding: clamp(16px, 3vw, 28px);
  display: flex; flex-direction: column; gap: var(--space-7);
  max-width: 1240px; margin-left: auto; margin-right: auto; width: 100%;
}
.content.content-embed-open {
  padding: 0;
  gap: 0;
  max-width: none;
  margin-left: 0;
  margin-right: 0;
}
.page.page-embed {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  height: calc(100vh - var(--topbar-h));
  max-height: calc(100vh - var(--topbar-h));
  display: block !important;
}
.page.page-embed iframe {
  display: block;
}
.dash-api-line {
  font-family: var(--mono);
  font-size: 11px;
  padding: 0 2px 12px;
  margin: -4px 0 0;
}
.dash-api-line.ok { color: var(--muted2); }
.dash-api-line.warn { color: var(--amber); }
@media (max-width: 640px) {
  .content { gap: var(--space-5); }
  .card { padding: var(--space-5); border-radius: var(--r); }
  .card-header { margin-bottom: var(--space-4); }
}

/* ===== DASHBOARD ===== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--grid-gap);
}
@media (max-width: 1024px) { .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px)  { .kpi-grid { grid-template-columns: 1fr; } }

.kpi-card { padding: var(--space-5) var(--space-6); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-4); gap: var(--space-3); }
.kpi-icon {
  width: 32px; height: 32px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
}
.kpi-blue   { background: rgba(79,170,255,.12); color: var(--blue); }
.kpi-green  { background: rgba(0,229,122,.12);  color: var(--green); }
.kpi-amber  { background: rgba(245,166,35,.12); color: var(--amber); }
.kpi-purple { background: rgba(167,139,250,.12);color: var(--purple); }

.kpi-num {
  font-size: clamp(1.5rem, 2.4vw, 1.875rem);
  font-weight: 800; letter-spacing: -.03em; line-height: 1;
  margin-bottom: var(--space-2);
}
.kpi-unit { font-size: 1.05rem; }
.kpi-sub {
  font-family: var(--display); font-size: var(--text-xs); font-weight: 500;
  color: var(--muted2); line-height: var(--leading-normal);
}

.chart-grid {
  display: grid; grid-template-columns: 2fr 1fr; gap: var(--grid-gap);
}
@media (max-width: 900px) { .chart-grid { grid-template-columns: 1fr; } }

.chart-main { }
.chart-wrap { height: 220px; position: relative; }
.chart-side {
  max-width: min(360px, 100%);
  justify-self: center;
  width: 100%;
}
.chart-donut-wrap {
  height: 132px;
  max-width: min(200px, 65%);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}
.chart-legend { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted2); }
.legend-item .legend-val { margin-left: auto; font-weight: 700; color: var(--text); }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

.bottom-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: var(--grid-gap);
}
@media (max-width: 900px) { .bottom-grid { grid-template-columns: 1fr; } }

.empty-state {
  padding: var(--space-7); text-align: center;
  font-size: var(--text-sm); color: var(--muted2); line-height: var(--leading-relaxed);
  background: var(--bg2); border-radius: var(--r-sm);
}

/* ===== TABLE ===== */
.table-wrap {
  overflow-x: auto;
  margin: 0 calc(var(--card-pad) * -0.35);
  padding: 0 calc(var(--card-pad) * 0.35);
}
.data-table { width: 100%; border-collapse: collapse; min-width: 520px; }
.data-table th {
  text-align: left; font-size: var(--text-xs); font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); padding: 0 12px 12px 0;
  border-bottom: 1px solid var(--line2);
}
.data-table td {
  padding: 14px 12px 14px 0; font-size: var(--text-sm); color: var(--muted2);
  line-height: var(--leading-normal);
  border-bottom: 1px solid var(--line);
}
.data-table tbody tr:hover td { color: var(--text); background: var(--bg2); }
.table-empty {
  text-align: center; color: var(--muted); font-size: var(--text-sm);
  padding: var(--space-6) 0; line-height: var(--leading-relaxed);
}

/* ===== CHAT ===== */
.chat-wrap { display: flex; flex-direction: column; height: 100%; max-width: 720px; margin: 0 auto; width: 100%; }
.chat-messages { flex: 1; overflow-y: auto; padding: 24px 0; display: flex; flex-direction: column; gap: 16px; }

.chat-welcome {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; flex: 1; text-align: center; padding: 40px 20px;
}
.chat-welcome-icon {
  width: 64px; height: 64px; background: var(--accent2);
  border: 1px solid var(--accent3); border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  color: var(--accent); margin-bottom: 20px;
}
.chat-welcome h2 { font-size: 22px; font-weight: 800; margin-bottom: 8px; }
.chat-welcome p  { font-family: var(--mono); font-size: 13px; color: var(--muted2); max-width: 360px; margin-bottom: 24px; }
.chat-examples { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chat-example-btn {
  padding: 7px 14px; background: var(--bg2); border: 1px solid var(--line2);
  border-radius: 20px; font-family: var(--mono); font-size: 11px; color: var(--muted2);
  cursor: pointer; transition: border-color .15s, color .15s;
}
.chat-example-btn:hover { border-color: var(--accent); color: var(--text); }

.chat-input-area {
  border-top: 1px solid var(--line2); padding: 16px 0;
  background: var(--bg); position: sticky; bottom: 0;
}
.chat-input-row { display: flex; gap: 10px; align-items: flex-end; }
.chat-input-row textarea {
  flex: 1; background: var(--bg2); border: 1px solid var(--line2);
  border-radius: var(--r); color: var(--text); font-family: var(--display);
  font-size: 13px; padding: 12px 14px; outline: none; resize: none;
  transition: border-color .15s;
}
.chat-input-row textarea:focus { border-color: var(--accent); }
.chat-input-row textarea::placeholder { color: var(--muted); }
.chat-send { height: 52px; }
.chat-hint { font-family: var(--mono); font-size: 10px; color: var(--muted); text-align: center; margin-top: 8px; }

/* ===== CONFIG ===== */
.config-wrap { max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.config-card { }
.config-fields { display: flex; flex-direction: column; gap: 16px; margin-top: 4px; }
.config-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 600px) { .config-row-2 { grid-template-columns: 1fr; } }

.field-hint { font-family: var(--mono); font-size: 11px; color: var(--muted2); margin-bottom: 8px; }

.range-row { display: flex; align-items: center; gap: 14px; }
.range-input {
  flex: 1; accent-color: var(--accent); cursor: pointer; height: 4px;
  background: var(--bg3); border-radius: 4px; outline: none;
  -webkit-appearance: none; appearance: none;
}
.range-input::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px;
  border-radius: 50%; background: var(--accent); cursor: pointer;
  border: 2px solid var(--bg);
}
.range-val { font-family: var(--mono); font-size: 14px; font-weight: 700; color: var(--accent); min-width: 36px; text-align: right; }

.config-toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 14px; background: var(--bg2);
  border: 1px solid var(--line); border-radius: var(--r-sm);
}
.toggle-label { font-size: 13px; font-weight: 600; margin-bottom: 3px; }
.toggle-sub   { font-family: var(--mono); font-size: 11px; color: var(--muted2); }

/* toggle switch */
.toggle { position: relative; display: inline-flex; cursor: pointer; flex-shrink: 0; }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-track {
  width: 40px; height: 22px; background: var(--bg3);
  border: 1px solid var(--line2); border-radius: 11px;
  position: relative; transition: background .2s, border-color .2s;
}
.toggle-track::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 14px; height: 14px; background: var(--muted2);
  border-radius: 50%; transition: transform .2s, background .2s;
}
.toggle input:checked + .toggle-track { background: var(--accent2); border-color: var(--accent3); }
.toggle input:checked + .toggle-track::after { transform: translateX(18px); background: var(--accent); }

.config-actions { display: flex; gap: 10px; margin-top: 20px; }

/* ===== SIDEBAR OVERLAY (fecha ao clicar fora) ===== */
.sidebar-overlay {
  position: fixed; inset: 0; background: var(--overlay-bg);
  z-index: 90; display: none;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.open { display: block; }

/* ===== CHAT BUBBLES ===== */
.chat-bubble-user {
  max-width: 70%; margin-left: auto;
  background: var(--accent); color: var(--on-accent);
  padding: 11px 16px; border-radius: 18px 18px 4px 18px;
  font-size: 14px; line-height: 1.6;
}
.chat-bubble-bot {
  max-width: 88%;
  background: var(--bg1); border: 1px solid var(--line2);
  border-radius: 4px 18px 18px 18px;
  padding: 16px 20px;
}
.chat-md { display: flex; flex-direction: column; gap: 2px; }
.chat-line {
  margin: 0; padding: 1px 0;
  font-size: 14px; line-height: 1.7; color: var(--muted2);
}
.chat-line strong { color: var(--text); font-weight: 700; }
.chat-line em { color: var(--muted2); font-style: italic; }
.chat-divider { height: 8px; }
.chat-code {
  font-family: var(--mono); font-size: 12px;
  background: var(--bg3); border: 1px solid var(--line2);
  border-radius: 4px; padding: 1px 6px; color: var(--accent);
}
.chat-cards {
  margin-top: 14px; padding-top: 14px;
  border-top: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 8px;
}
.chat-part-card {
  background: var(--bg2); border: 1px solid var(--line2);
  border-radius: var(--r-sm); padding: 10px 14px;
}
.chat-part-name {
  display: block; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--text); margin-bottom: 5px;
}
.chat-part-code { margin: 0; font-size: 12px; color: var(--muted2); }
.chat-part-sim  { margin: 4px 0 0; font-size: 11px; color: var(--muted); font-family: var(--mono); }

/* loading dots */
.chat-loading { display: flex; align-items: center; gap: 5px; padding: 14px 18px; }
.chat-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); display: inline-block;
  animation: bounce 1s infinite;
}
.chat-dot:nth-child(2) { animation-delay: .15s; }
.chat-dot:nth-child(3) { animation-delay: .30s; }
.chat-loading-lbl { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-left: 4px; }
@keyframes bounce {
  0%,80%,100% { transform: scale(1); opacity:.6; }
  40%          { transform: scale(1.3); opacity:1; }
}

/* ===== DOT INDICATORS ===== */
.dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.dot-ok   { background: var(--green); box-shadow: 0 0 6px var(--green); animation: blink 2s infinite; }
.dot-idle { background: var(--muted); }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.4} }

/* ===== MARKETING (Solução / Recursos / Planos) ===== */
.mkt-hero { max-width: 720px; }
.mkt-kicker {
  display: inline-block; font-size: 10px; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase; color: var(--accent);
  margin-bottom: 10px;
}
.mkt-title {
  font-size: clamp(1.35rem, 2.5vw, 1.85rem);
  font-weight: 700; line-height: 1.2; margin-bottom: 12px;
}
.mkt-title em { font-style: normal; color: var(--accent); }
.mkt-lead {
  font-size: 14px; line-height: 1.65; color: var(--muted2);
}
.mkt-p { font-size: 13px; line-height: 1.6; color: var(--muted2); margin: 0; }
.mkt-pillgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.mkt-pill .card-title { font-size: 14px; margin-bottom: 8px; }
.mkt-list {
  margin: 0; padding-left: 18px;
  font-size: 13px; line-height: 1.75; color: var(--muted2);
}
.mkt-list li { margin-bottom: 6px; }
.mkt-feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}
.mkt-feat { position: relative; padding-top: 28px; }
.mkt-feat-soon { opacity: .92; border-style: dashed; }
.mkt-feat-tag {
  position: absolute; top: 14px; left: 18px;
  font-size: 9px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted);
}
.mkt-feat .card-title { font-size: 15px; }
.price-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px; align-items: stretch;
}
@media (max-width: 960px) {
  .price-grid { grid-template-columns: 1fr; }
}
.price-tier {
  display: flex; flex-direction: column; gap: 10px;
  position: relative; overflow: hidden;
}
.price-tier-featured {
  border-color: var(--accent3);
  box-shadow: 0 0 0 1px var(--accent2);
}
.price-ribbon {
  position: absolute; top: 12px; right: -28px;
  background: var(--accent); color: var(--on-accent);
  font-size: 9px; font-weight: 800; letter-spacing: .12em;
  text-transform: uppercase; padding: 4px 32px;
  transform: rotate(38deg);
}
.price-name { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.price-val { font-size: 2rem; font-weight: 800; font-variant-numeric: tabular-nums; margin: 4px 0; }
.price-cur { font-size: 1rem; font-weight: 600; vertical-align: super; margin-right: 2px; color: var(--muted2); }
.price-mo { font-size: 12px; font-weight: 600; color: var(--muted); }
.price-ul {
  list-style: none; margin: 8px 0 0; padding: 0;
  font-size: 12px; line-height: 1.65; color: var(--muted2);
  flex: 1;
}
.price-ul li {
  padding: 6px 0 6px 18px; position: relative;
  border-bottom: 1px solid var(--line);
}
.price-ul li::before {
  content: '✓'; position: absolute; left: 0; color: var(--green); font-size: 11px;
}
.price-note { font-size: 11px; color: var(--muted); margin-top: auto; padding-top: 8px; }
.mkt-cta-bar {
  background: var(--bg2); border-color: var(--line2);
}
.mkt-cta-bar p { margin: 0; font-size: 13px; line-height: 1.65; color: var(--muted2); }

/* Histórico de buscas */
.hist-toolbar {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px 20px;
  margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line);
}
.hist-field { min-width: 140px; }
.hist-field.hist-check { min-width: 200px; padding-bottom: 8px; }
.hist-field.hist-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.hist-cb {
  display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted2);
  cursor: pointer; user-select: none;
}
.hist-cb input { accent-color: var(--accent); width: 16px; height: 16px; }
.hist-summary { font-size: 12px; color: var(--muted); margin: 12px 0 0; font-family: var(--mono); }
.hist-pagination {
  display: flex; align-items: center; justify-content: center; gap: 16px;
  padding: 16px 0 4px; border-top: 1px solid var(--line); margin-top: 8px;
}
.hist-page-info { font-size: 12px; color: var(--muted2); font-family: var(--mono); min-width: 140px; text-align: center; }
.hist-plate-tag {
  display: inline-block; font-family: var(--mono); font-size: 11px; font-weight: 700;
  padding: 3px 8px; border-radius: 6px; background: var(--accent); color: var(--on-accent);
  letter-spacing: .06em;
}

/* ===== THEME TOGGLE ===== */
.theme-toggle {
  display: inline-flex; align-items: center; gap: 0;
  padding: 3px; border-radius: 999px;
  background: var(--bg2); border: 1px solid var(--line2);
  cursor: pointer; user-select: none;
}
.theme-toggle-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 12px; border: none; border-radius: 999px;
  background: transparent; color: var(--muted);
  font-family: var(--display); font-size: var(--text-xs); font-weight: 700;
  cursor: pointer; transition: background .18s, color .18s, box-shadow .18s;
  white-space: nowrap;
}
.theme-toggle-btn svg { width: 15px; height: 15px; flex-shrink: 0; }
@media (max-width: 640px) {
  .theme-toggle-btn { padding: 7px 9px; }
  .theme-toggle-btn .theme-toggle-label { display: none; }
}
.theme-toggle-btn:hover { color: var(--text); }
.theme-toggle-btn.active {
  background: var(--accent); color: var(--on-accent);
  box-shadow: 0 2px 8px var(--accent-glow);
}
.theme-toggle-btn:focus-visible {
  outline: 2px solid var(--accent3); outline-offset: 2px;
}

.sidebar-brand-logo .logo-oem { fill: var(--accent); }
.sidebar-brand-logo .logo-ia { fill: var(--text); }
.sidebar-brand-logo .logo-tagline { fill: var(--muted2); }
.sidebar-brand-logo .logo-tagline-accent { fill: var(--accent); }
