/* ============================================================
   CrRsys Design System (Purified from index.html)
   ============================================================ */

:root {
  --page-bg: #dedede;
  --sidebar-bg: #f2f2f2;
  --panel-bg: #ffffff;
  --border: #e7e7e7;
  --border-soft: #ececec;
  --text-1: #111111;
  --text-2: #6b6b6b;
  --text-3: #9a9a9a;
  --accent: #7c5cf4;
  --accent-soft: #f4f0ff;
  --pill-bg: #f3f3f3;
  --pill-bg-hover: #eaeaea;
  --success: #22c55e;
  --badge-purple-bg: #fbf1ff;
  --badge-purple-text: #a855f7;
  --badge-gray-bg: #f2f2f2;
  --badge-gray-text: #8a8a8a;
  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-float: 0 30px 80px -20px rgba(0, 0, 0, 0.28), 0 10px 30px -10px rgba(0, 0, 0, 0.12);

  /* Fallback definitions for form fields and status badges */
  --bg-primary: var(--page-bg);
  --bg-secondary: var(--panel-bg);
  --bg-sidebar: var(--sidebar-bg);
  --bg-card: var(--panel-bg);
  --bg-input: #f3f3f3;
  --bg-hover: #eaeaea;
  --border-color: var(--border);
  --border-light: var(--border-soft);
  --text-primary: var(--text-1);
  --text-secondary: var(--text-2);
  --text-heading: var(--text-1);
  --text-white: #ffffff;
  --accent-hover: #6b4fc7;
  --accent-light: var(--accent-soft);
  --status-indexed: #22C55E;
  --status-indexed-bg: rgba(34, 197, 94, 0.1);
  --status-processing: #F59E0B;
  --status-processing-bg: rgba(245, 158, 11, 0.1);
  --status-error: #EF4444;
  --status-error-bg: rgba(239, 68, 68, 0.1);
  --transition: 0.2s ease;
  --font-heading: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ===== Minimalist Custom Scrollbars ===== */
* {
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.18) transparent;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 99px;
  margin: 4px 0;
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.18);
  border-radius: 99px;
  transition: background 0.2s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.35);
}

::-webkit-scrollbar-button {
  display: none !important;
  width: 0;
  height: 0;
}

::-webkit-scrollbar-corner {
  background: transparent;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text-1);
  background: url('/panel/static/Captura_de_tela_20261009_095728.png') no-repeat center center fixed;
  background-size: cover;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

[hidden] {
  display: none !important;
}

/* ---------- Background decoration (transparent, crisp banner) ---------- */
.bg-decor {
  display: none;
}

button {
  font-family: inherit;
  cursor: pointer;
}

input,
textarea {
  font-family: inherit;
}

.icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: block;
  flex-shrink: 0;
}

/* ================= APP SHELL ================= */
.app {
  position: relative;
  z-index: 1;
  max-width: 1650px;
  width: 95%;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

@media (min-width:1024px) {
  .app {
    padding: 24px 20px;
    min-height: 100vh;
    justify-content: center;
  }
}

.frame {
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

@media (min-width:1024px) {
  .frame {
    flex-direction: row;
    min-height: auto;
    height: min(920px, 92vh);
    border-radius: var(--radius-lg);
    box-shadow: 0 30px 80px -15px rgba(0, 0, 0, 0.35), 0 10px 25px -5px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.60);
  }
}

/* ================= SIDEBAR ================= */
.sidebar {
  background: rgba(246, 247, 249, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: none;
  flex-direction: column;
  width: 264px;
  flex-shrink: 0;
  padding: 18px 14px;
  border-right: 1px solid rgba(255, 255, 255, 0.35);
  transition: width 0.28s cubic-bezier(0.4, 0, 0.2, 1), padding 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  white-space: nowrap;
}

@media (min-width:1024px) {
  .sidebar {
    display: flex;
  }
}

/* Sidebar Recolhida (Collapsed State) */
.frame.sidebar-collapsed .sidebar {
  width: 68px;
  padding: 18px 10px;
}

.frame.sidebar-collapsed .brand-name,
.frame.sidebar-collapsed .nav-item span,
.frame.sidebar-collapsed .profile-select-left span,
.frame.sidebar-collapsed .profile-select .chev,
.frame.sidebar-collapsed .nav-group-label,
.frame.sidebar-collapsed .usage-card {
  opacity: 0;
  visibility: hidden;
  width: 0;
  display: none;
  transition: opacity 0.15s ease;
}

.frame.sidebar-collapsed .brand {
  justify-content: center;
  padding: 6px 0 16px 0;
}

.frame.sidebar-collapsed .brand-left {
  display: none;
}

.frame.sidebar-collapsed .nav-item {
  justify-content: center;
  padding: 10px 0;
}

.frame.sidebar-collapsed .profile-select {
  justify-content: center;
  padding: 8px 0;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #c5c5c5;
  border-radius: 12px;
  margin-bottom: 12px;
}

.brand-left {
  display: flex;
  align-items: center;
  gap: 9px;
}

.brand-mark {
  width: 26px;
  height: 26px;
  background: #111;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-mark svg {
  width: 14px;
  height: 14px;
  stroke: #fff;
}

.brand-name {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
  transition: opacity 0.2s ease;
}

.collapse-btn {
  width: 26px;
  height: 26px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.25s ease;
}

.collapse-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-1);
}

.frame.sidebar-collapsed .collapse-btn {
  transform: rotate(180deg);
}

.collapse-btn svg {
  width: 13px;
  height: 13px;
}

.hr-line {
  height: 1px;
  background: var(--border);
  margin: 8px 0 12px;
  border: none;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-1);
  text-decoration: none;
  margin-bottom: 4px;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.nav-item .icon {
  width: 17px;
  height: 17px;
  color: var(--text-2);
}

.nav-item:hover {
  background: rgba(0, 0, 0, 0.035);
}

.nav-item.active {
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  font-weight: 600;
}

.nav-item.active .icon {
  color: var(--text-1);
}

.profile-select {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin-bottom: 16px;
  font-size: 13.5px;
  font-weight: 500;
}

.profile-select-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.profile-select .icon {
  width: 16px;
  height: 16px;
  color: var(--text-2);
}

.profile-select .chev {
  color: var(--text-3);
}

.nav-group-label {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-3);
  letter-spacing: 0.06em;
  margin: 14px 6px 6px;
}

.sidebar-spacer {
  flex: 1;
}

.sidebar-bottom {
  margin-top: 8px;
}

.usage-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-top: 10px;
}

.usage-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 10px;
}

.usage-top-left {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text-1);
}

.usage-top-left .icon {
  width: 15px;
  height: 15px;
  color: var(--text-2);
}

.usage-bar-track {
  height: 5px;
  background: #eee;
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 6px;
}

.usage-bar-fill {
  height: 100%;
  width: 40%;
  background: #111;
  border-radius: 99px;
}

.usage-scale {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-3);
  margin-bottom: 12px;
}

.upgrade-btn {
  width: 100%;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
}

.upgrade-btn:hover {
  background: #fafafa;
}

/* ================= MAIN AREA ================= */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  position: relative;
  overflow-y: auto;
}

/* mobile top bar */
.mobile-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 8px;
}

@media (min-width:1024px) {
  .mobile-topbar {
    display: none;
  }
}

.round-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-1);
  position: relative;
}

.round-btn .icon {
  width: 18px;
  height: 18px;
}

.notif-dot {
  position: absolute;
  top: 8px;
  right: 9px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  border: 1.5px solid #fff;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
}

.avatar-fallback {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #d9d4ff, #ffd9ec);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #6b4fc7;
}

/* Responsive Content Header */
.content-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.40);
  background: rgba(255, 255, 255, 0.40);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  min-height: 56px;
  box-sizing: border-box;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mobile-menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-2, #f9fafb);
  color: var(--text-1);
  cursor: pointer;
}

.mobile-menu-btn:hover {
  background: var(--bg-3, #f3f4f6);
}

.desktop-only {
  display: flex;
}

.mobile-only {
  display: none;
}

@media (min-width: 1024px) {
  .content-header {
    padding: 18px 28px;
  }
  .mobile-menu-btn {
    display: none !important;
  }
  .desktop-only {
    display: flex !important;
  }
  .mobile-only {
    display: none !important;
  }
}

@media (max-width: 1023px) {
  .desktop-only {
    display: none !important;
  }
  .mobile-only {
    display: flex !important;
  }
}

.content-title {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
}

.icon-btn .icon {
  width: 16px;
  height: 16px;
}

.icon-btn:hover {
  background: #fafafa;
}

/* ---- Views ---- */
.view {
  display: none !important;
  flex: 1;
  min-height: 0;
}

.view.active:not([hidden]) {
  display: flex !important;
  flex-direction: column;
}

.view[hidden],
.view:not(.active) {
  display: none !important;
}

/* ===== Dashboard (empty chat state) view ===== */
.dash-wrap {
  flex: 1;
  width: 100%;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-direction: column;
  padding: 20px 20px 24px;
  position: relative;
  box-sizing: border-box;
}

.orb {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  margin-bottom: 14px;
  background:
    radial-gradient(circle at 30% 30%, #ffffff 0%, #d9d4ff 35%, #b9d8ff 60%, #e8d9ff 100%);
  box-shadow: inset 0 -6px 10px rgba(120, 110, 200, 0.25), inset 0 4px 8px rgba(255, 255, 255, 0.9), 0 4px 14px rgba(140, 120, 220, 0.25);
}

.dash-heading {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.015em;
  margin: 0 0 8px;
  text-align: center;
  color: #0f172a;
  text-shadow: 0 2px 10px rgba(255, 255, 255, 0.95), 0 1px 2px rgba(255, 255, 255, 1);
}

.dash-sub {
  font-size: 14px;
  color: #1e293b;
  font-weight: 600;
  margin: 0 0 22px;
  text-align: center;
  text-shadow: 0 2px 10px rgba(255, 255, 255, 0.95), 0 1px 2px rgba(255, 255, 255, 1);
}

.dash-wrap.chat-active .orb,
.dash-wrap.chat-active .dash-heading,
.dash-wrap.chat-active .dash-sub {
  display: none !important;
}

.composer {
  width: 100%;
  max-width: 98%;
  border: 1.5px solid rgba(255, 255, 255, 0.95);
  border-radius: 18px;
  padding: 14px 18px 12px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 14px 40px -6px rgba(0, 0, 0, 0.14), 0 4px 12px rgba(0, 0, 0, 0.04);
  box-sizing: border-box;
}

.composer-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 34px;
}

.composer-row .icon {
  color: var(--accent);
  width: 17px;
  height: 17px;
  margin-top: 2px;
}

.composer-input {
  border: none;
  outline: none;
  resize: none;
  width: 100%;
  font-size: 14.5px;
  font-weight: 500;
  color: #0f172a;
  background: transparent;
  height: 20px;
}

.composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.composer-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tool-btn {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
}

.tool-btn.plain {
  border: none;
  background: transparent;
  color: var(--text-1);
}

.tool-btn .icon {
  width: 15px;
  height: 15px;
}

.composer-send {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mic-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-1);
}

.send-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: #111;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.send-btn .icon {
  width: 15px;
  height: 15px;
  stroke: #fff;
}

.quick-pills {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 560px;
  margin-top: 16px;
}

@media (min-width:640px) {
  .quick-pills {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
  }
}

.pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--pill-bg);
  border: none;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-1);
  white-space: nowrap;
  cursor: pointer;
}

.pill:hover {
  background: var(--pill-bg-hover);
}

.pill .icon {
  width: 15px;
  height: 15px;
  color: var(--text-2);
}

/* ===== Chat Messages Timeline Styles ===== */
.chat-messages-container {
  width: 100%;
  max-width: 98%;
  margin: 0 auto 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 600px;
  overflow-y: auto;
  padding: 8px 10px;
  box-sizing: border-box;
}

.message {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
}

.message.user {
  flex-direction: row-reverse;
}

.message.assistant {
  width: 100%;
}

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--sidebar-bg);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.message.user .message-avatar {
  background: #111;
  color: #fff;
  border-color: #111;
}

.message.user .message-avatar svg {
  stroke: #fff;
}

.message-content {
  max-width: 90%;
  padding: 14px 18px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-1);
  word-break: break-word;
  overflow-wrap: break-word;
}

.table-responsive,
.chart-responsive {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 14px 0 10px 0;
  border-radius: 10px;
  border: 1px solid var(--border, #e5e7eb);
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  box-sizing: border-box;
}

.chart-card {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.message-content table,
.history-msg-body table,
.chat-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  background: #ffffff;
}

.message-content thead,
.history-msg-body thead {
  background: var(--bg-2, #f8fafc);
}

.message-content th, 
.history-msg-body th {
  padding: 10px 14px;
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-2, #475569);
  border-bottom: 1px solid var(--border, #e2e8f0);
  border-right: 1px solid var(--border-soft, #f1f5f9);
  text-align: left;
  white-space: nowrap;
}

.message-content th:last-child,
.history-msg-body th:last-child {
  border-right: none;
}

.message-content td,
.history-msg-body td {
  padding: 10px 14px;
  color: var(--text-1, #0f172a);
  border-bottom: 1px solid var(--border-soft, #f1f5f9);
  border-right: 1px solid var(--border-soft, #f8fafc);
  vertical-align: middle;
}

.message-content td:last-child,
.history-msg-body td:last-child {
  border-right: none;
}

.message-content tbody tr:last-child td,
.history-msg-body tbody tr:last-child td {
  border-bottom: none;
}

.message-content tbody tr:hover,
.history-msg-body tbody tr:hover {
  background: rgba(0, 0, 0, 0.015);
}

.message-content a,
.history-msg-body a {
  color: #2563eb;
  text-decoration: underline;
  font-weight: 600;
}

.message.user .message-content {
  background: #111827;
  color: #ffffff;
  border-top-right-radius: 4px;
  box-shadow: 0 4px 14px rgba(17, 24, 39, 0.18);
  max-width: 85%;
}

.message.assistant .message-content {
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.9);
  color: #0f172a;
  border-top-left-radius: 4px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
  width: 100%;
  max-width: 100%;
}

.message-time {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 4px;
  align-self: flex-end;
}

.message-sources {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
  font-size: 12px;
  color: var(--text-2);
}

.message-sources span {
  display: block;
  margin-top: 2px;
}

/* ===== Typing Indicator (Dots Animados) ===== */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 2px;
}

.typing-indicator span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-3);
  animation: typingPulse 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) {
  animation-delay: 0s;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingPulse {

  0%,
  80%,
  100% {
    transform: scale(0.6);
    opacity: 0.4;
  }

  40% {
    transform: scale(1.1);
    opacity: 1;
    background: var(--accent);
  }
}

/* ===== Call History view ===== */
.ch-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  gap: 10px;
  flex-wrap: wrap;
}

.ask-vocalyn {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13px;
  color: var(--text-2);
  flex: 1;
  min-width: 200px;
}

.ask-vocalyn .icon {
  width: 15px;
  height: 15px;
  color: var(--accent);
}

.kbd {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-3);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 6px;
}

.events-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 500;
  background: #fff;
  color: var(--text-1);
}

.events-btn .icon {
  width: 14px;
  height: 14px;
}

.stats-row {
  display: flex;
  gap: 12px;
  padding: 4px 20px 16px;
  overflow-x: auto;
}

.stat-card {
  flex: 1;
  min-width: 150px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 14px;
}

.stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.stat-label {
  font-size: 12.5px;
  color: var(--text-2);
  font-weight: 500;
}

.stat-top .icon {
  width: 15px;
  height: 15px;
  color: var(--text-3);
}

.stat-value-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 5px;
}

.stat-value {
  font-size: 20px;
  font-weight: 700;
}

.stat-delta {
  font-size: 11.5px;
  color: #16a34a;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 2px;
}

.stat-delta.down {
  color: #ef4444;
}

.stat-delta .icon {
  width: 11px;
  height: 11px;
}

.stat-note {
  font-size: 11.5px;
  color: var(--text-3);
}

.ch-body {
  flex: 1;
  overflow: auto;
  padding: 0 20px 20px;
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.search-input {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 12px;
  flex: 1;
  min-width: 180px;
  max-width: 280px;
}

.search-input .icon {
  width: 15px;
  height: 15px;
  color: var(--text-3);
}

.search-input input {
  border: none;
  outline: none;
  font-size: 13px;
  width: 100%;
  color: var(--text-1);
}

.table-actions {
  display: flex;
  gap: 8px;
}

.ghost-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 13px;
  font-size: 13px;
  font-weight: 500;
  background: #fff;
  color: var(--text-1);
}

.ghost-btn .icon {
  width: 14px;
  height: 14px;
}

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
}

.table-scroll table {
  width: 100%;
  border-collapse: collapse;
  min-width: 820px;
}

thead th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-3);
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 14px;
  font-size: 13px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}

tbody tr:last-child td {
  border-bottom: none;
}

.type-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.type-cell .icon {
  width: 15px;
  height: 15px;
  color: var(--text-2);
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.badge.purple {
  background: var(--badge-purple-bg);
  color: var(--badge-purple-text);
}

.badge.gray {
  background: var(--badge-gray-bg);
  color: var(--badge-gray-text);
}

.cf-cell {
  font-weight: 500;
}

.time-cell {
  line-height: 1.4;
}

.time-cell .date {
  color: var(--text-3);
  font-size: 12px;
}

.summary-cell {
  color: var(--text-2);
  max-width: 230px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.actions-cell {
  display: flex;
  gap: 6px;
}

.mini-btn {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
}

.mini-btn .icon {
  width: 13px;
  height: 13px;
}

.checkbox {
  width: 15px;
  height: 15px;
  border: 1.5px solid #d8d8d8;
  border-radius: 4px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  flex-wrap: wrap;
  gap: 10px;
}

.pagination-info {
  font-size: 12.5px;
  color: var(--text-2);
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.page-btn {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 12.5px;
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-btn.active {
  background: #111;
  color: #fff;
  border-color: #111;
  font-weight: 600;
}

.page-btn .icon {
  width: 13px;
  height: 13px;
}

/* ===== Placeholder view ===== */
.placeholder-view {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  color: var(--text-3);
}

.placeholder-view .icon {
  width: 34px;
  height: 34px;
  color: #d8d8d8;
}

.placeholder-view span {
  font-size: 13.5px;
}

/* ===== Mobile drawer ===== */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 20;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}

.drawer-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 82%;
  max-width: 290px;
  background: var(--sidebar-bg);
  z-index: 21;
  transform: translateX(-100%);
  transition: transform .25s ease;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
}

.drawer.open {
  transform: translateX(0);
}

@media (min-width:1024px) {

  .drawer,
  .drawer-overlay {
    display: none;
  }
}

.footer-hint-mobile {
  display: block;
}

@media (min-width:1024px) {
  .footer-hint-mobile {
    display: none;
  }
}

/* Login screen overlay styling inside new theme */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--page-bg);
  padding: 20px;
  position: relative;
  z-index: 10;
}

.login-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-float);
  border: 1px solid var(--border);
  text-align: center;
}

.login-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.login-subtitle {
  color: var(--text-2);
  margin-bottom: 24px;
  font-size: 0.9rem;
}

.form-group {
  margin-bottom: 16px;
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-1);
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  outline: none;
  background: #fff;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--accent);
}

.password-wrapper {
  position: relative;
}

.password-wrapper input {
  padding-right: 40px;
}

.toggle-password {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-3);
  cursor: pointer;
}

.login-error {
  background: #fee2e2;
  color: #ef4444;
  padding: 10px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 16px;
  text-align: left;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
}

.btn-primary {
  background: #111;
  color: #fff;
}

.btn-primary:hover {
  background: #333;
}

.btn-secondary {
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text-1);
}

.btn-secondary:hover {
  background: #fafafa;
}

.btn-danger {
  background: #ef4444;
  color: #fff;
}

.btn-block {
  width: 100%;
}

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

/* ===== HISTORY DETAIL CHAT BUBBLES & STYLING ===== */
.history-msg {
  display: flex;
  flex-direction: column;
  margin-bottom: 14px;
  max-width: 88%;
  font-size: 12px;
  line-height: 1.5;
}

.history-msg-user {
  margin-left: auto;
  align-items: flex-end;
}

.history-msg-user .history-msg-body {
  background: var(--primary, #111);
  color: #fff;
  border-radius: 14px 14px 2px 14px;
  padding: 10px 14px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.history-msg-user .history-msg-header {
  color: var(--text-3);
  font-size: 11px;
  margin-bottom: 4px;
  display: flex;
  gap: 8px;
}

.history-msg-ai {
  margin-right: auto;
  align-items: flex-start;
  width: 95%;
  max-width: 95%;
}

.history-msg-ai .history-msg-body {
  background: #f8fafc;
  color: var(--text-1);
  border: 1px solid var(--border);
  border-radius: 14px 14px 14px 2px;
  padding: 12px 16px;
  width: 100%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.history-msg-ai .history-msg-header {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 4px;
  width: 100%;
}

.history-msg-author {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.history-sources {
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-2);
}

.history-source-badge {
  display: inline-block;
  background: #e2e8f0;
  color: #334155;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 10.5px;
  margin-right: 4px;
  margin-top: 4px;
}

.history-metadata {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.history-meta-tag {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #475569;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
}

/* Tabelas e Markdown dentro do Histórico */
.history-msg-body table {
  width: 100%;
  font-size: 11px;
  border-collapse: collapse;
  margin-top: 8px;
  margin-bottom: 8px;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.history-msg-body table th {
  background: #f1f5f9;
  padding: 6px 10px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  border-bottom: 1px solid var(--border);
}

.history-msg-body table td {
  padding: 6px 10px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 11px;
}

/* ==========================================================================
   ANALYTICS & LIEFLAT CHARTS (PALETA PORCELAIN)
   ========================================================================== */
.analytics-view {
  max-width: 1360px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.analytics-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.analytics-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-1, #0f172a);
  margin: 0;
  letter-spacing: -0.02em;
}

.analytics-subtitle {
  font-size: 13px;
  color: var(--text-2, #64748b);
  margin: 4px 0 0 0;
}

.analytics-badge-status {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
}

/* Filtros */
.analytics-filter-card {
  background: #ffffff;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  padding: 14px 20px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.filter-group-presets {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-3, #94a3b8);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-right: 4px;
}

.btn-preset {
  background: var(--bg-2, #f8fafc);
  border: 1px solid var(--border, #cbd5e1);
  color: var(--text-1, #334155);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-preset:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.btn-preset.active {
  background: #081f5c;
  color: #ffffff;
  border-color: #081f5c;
  box-shadow: 0 2px 4px rgba(8, 31, 92, 0.15);
}

.filter-group-dates {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.date-field {
  display: flex;
  align-items: center;
  gap: 6px;
}

.date-field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2, #475569);
}

.analytics-input-date {
  border: 1px solid var(--border, #cbd5e1);
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 12.5px;
  color: var(--text-1, #0f172a);
  background: #ffffff;
  font-family: inherit;
}

.btn-filter-action {
  background: #081f5c;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 7px 16px;
  font-weight: 600;
  font-size: 12.5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  transition: background 0.15s;
}

.btn-filter-action:hover {
  background: #1e40af;
}

.btn-refresh-action {
  background: var(--bg-2, #f8fafc);
  border: 1px solid var(--border, #cbd5e1);
  border-radius: 8px;
  padding: 7px 10px;
  cursor: pointer;
  color: var(--text-2, #475569);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-refresh-action:hover {
  background: #f1f5f9;
  color: var(--text-1, #0f172a);
}

/* KPIs Executivos Glance */
.analytics-kpis-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.kpi-card {
  background: #ffffff;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  padding: 16px 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
  display: flex;
  flex-direction: column;
}

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

.kpi-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-3, #64748b);
}

.kpi-icon-badge {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
}

.kpi-primary { background: #eff6ff; color: #1d4ed8; }
.kpi-secondary { background: #f0fdf4; color: #15803d; }
.kpi-accent { background: #faf5ff; color: #7e22ce; }
.kpi-neutral { background: #f8fafc; color: #475569; }

.kpi-value {
  font-size: 24px;
  font-weight: 800;
  color: #0f172a;
  margin: 8px 0 4px;
  letter-spacing: -0.02em;
}

.kpi-sub {
  font-size: 11.5px;
  color: var(--text-2, #64748b);
}

/* Grid de Gráficos Analíticos */
.analytics-charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.editorial-chart-card {
  background: #ffffff;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
  display: flex;
  flex-direction: column;
  min-height: 360px;
}

.editorial-chart-card.full-width {
  grid-column: span 2;
}

.editorial-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
  gap: 12px;
}

.editorial-card-h3 {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
  letter-spacing: -0.01em;
}

.editorial-card-sub {
  font-size: 12px;
  color: var(--text-2, #64748b);
  margin: 3px 0 0 0;
}

.chart-toggle-group {
  display: flex;
  background: var(--bg-2, #f1f5f9);
  border: 1px solid var(--border, #cbd5e1);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}

.chart-toggle-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 6px;
  color: var(--text-2, #64748b);
  cursor: pointer;
  transition: all 0.15s ease;
}

.chart-toggle-btn.active {
  background: #ffffff;
  color: #081f5c;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.editorial-chart-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Gráfico de Barras Horizontais Editorial */
.editorial-bars-list {
  max-height: 380px;
  overflow-y: auto;
  padding-right: 6px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.editorial-bar-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.editorial-bar-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.editorial-bar-rank {
  font-weight: 700;
  font-size: 11px;
  color: #64748b;
  width: 18px;
  flex-shrink: 0;
}

.editorial-bar-label {
  font-weight: 600;
  color: #1e293b;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.editorial-bar-details {
  font-size: 11px;
  color: #64748b;
  flex-shrink: 0;
}

.editorial-bar-share {
  font-size: 11px;
  font-weight: 700;
  color: #2563eb;
  min-width: 44px;
  text-align: right;
  flex-shrink: 0;
}

.editorial-bar-value {
  font-weight: 700;
  color: #0f172a;
  min-width: 92px;
  text-align: right;
  flex-shrink: 0;
}

.editorial-bar-track {
  height: 8px;
  background: #f1f5f9;
  border-radius: 4px;
  overflow: hidden;
}

.editorial-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}

/* Donut Chart SVG Editorial */
.editorial-donut-wrap {
  display: flex;
  align-items: center;
  justify-content: space-around;
  flex-wrap: wrap;
  gap: 20px;
  padding: 10px 0;
}

.editorial-donut-svg-box {
  position: relative;
  width: 170px;
  height: 170px;
  flex-shrink: 0;
}

.editorial-donut-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.editorial-donut-center-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
}

.donut-center-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: #64748b;
}

.donut-center-value {
  font-size: 12px;
  font-weight: 800;
  color: #0f172a;
  margin-top: 2px;
}

.editorial-donut-legend {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 200px;
  max-height: 280px;
  overflow-y: auto;
}

.donut-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.donut-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.donut-legend-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #334155;
  font-weight: 500;
}

.donut-legend-share {
  font-weight: 700;
  color: #2563eb;
  min-width: 40px;
  text-align: right;
  flex-shrink: 0;
}

.donut-legend-val {
  font-weight: 600;
  color: #0f172a;
  min-width: 85px;
  text-align: right;
  flex-shrink: 0;
}

.editorial-card-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border-soft, #f1f5f9);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #94a3b8;
}

.chart-skeleton, .chart-empty {
  padding: 30px;
  text-align: center;
  font-size: 13px;
  color: var(--text-2, #64748b);
  font-style: italic;
}