/* eKAM PWA — Design System */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

:root {
  --bg: #0b1326;
  --surface: #171f33;
  --sidebar: #060e20;
  --border: #434655;
  --primary: #2563eb;
  --accent: #1B4F72;
  --teal: #17A2B8;
  --gold: #f9bd22;
  --gold-dark: #b8860b;
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --purple: #8b5cf6;
  --orange: #f97316;
  --info: #3B82F6;
  --text-primary: #dae2fd;
  --text-secondary: #c3c6d7;
  --text-muted: #8d90a0;
  --radius: 8px;
  --radius-sm: 6px;
  --radius-badge: 4px;
  --radius-pill: 16px;
  --radius-full: 9999px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  height: 100dvh;
  overflow: hidden;
}

/* ===================== LOGIN PAGE ===================== */
.login-page {
  display: flex;
  height: 100dvh;
}

.login-brand {
  flex: 1;
  background: linear-gradient(135deg, #1e3a5f 0%, #0b1326 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 80px;
  position: relative;
  overflow: hidden;
}

.login-brand::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 50%, rgba(37,99,235,0.08) 0%, transparent 60%);
}

.login-brand .logo {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 48px;
  position: relative;
}

.login-brand .logo-mark {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  background: linear-gradient(135deg, #1e3a5f, #0b1326);
  border: 2px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-brand .logo-text h1 {
  font-size: 36px;
  font-weight: 700;
  color: #fff;
}

.login-brand .logo-text span {
  font-size: 14px;
  color: var(--text-secondary);
}

.login-features {
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: relative;
}

.login-feature {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.login-feature .feat-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.login-feature h3 { font-size: 16px; font-weight: 600; color: #fff; }
.login-feature p { font-size: 13px; color: var(--text-secondary); margin-top: 4px; line-height: 1.4; }

.login-form-section {
  width: 520px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 80px 60px;
  background: var(--bg);
}

.login-form-section h2 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
}

.login-form-section .subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 32px;
}

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

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-group input {
  width: 100%;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color .2s;
}

.form-group input:focus { border-color: var(--primary); }
.form-group input::placeholder { color: var(--text-muted); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity .2s, transform .1s;
  width: 100%;
}

.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { opacity: 0.9; }

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

.btn-outline:hover { border-color: var(--text-secondary); }

.login-footer {
  margin-top: 32px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

.login-footer a { color: var(--text-secondary); text-decoration: none; }

/* ===================== SIGNUP WIZARD ===================== */
.signup-page {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow-y: auto;
  display: flex;
  justify-content: center;
  background: var(--bg);
  padding: 24px;
  z-index: 100;
}

.wizard-container {
  width: 720px;
  max-width: 100%;
  padding-bottom: 120px;
  flex-shrink: 0;
}

.wizard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}

.wizard-progress {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 32px;
}

.wizard-step-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}

.wizard-step-indicator.active { color: var(--primary); font-weight: 600; }
.wizard-step-indicator.completed { color: var(--success); }

.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.wizard-step-indicator.active .step-num { border-color: var(--primary); background: var(--primary); color: #fff; }
.wizard-step-indicator.completed .step-num { border-color: var(--success); background: var(--success); color: #fff; }

.wizard-step-connector {
  flex: 1;
  height: 2px;
  background: var(--border);
  margin: 0 12px;
}

.wizard-step h3 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}

.wizard-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 24px;
}

.wizard-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.wizard-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
}

/* Module Cards */
.module-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.module-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: all .2s;
  display: flex;
  flex-direction: column;
}

.module-card:hover {
  border-color: var(--text-muted);
}

.module-card.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

.module-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.module-card-bottom {
  margin-top: auto;
}

.module-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
}

.module-tag {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(37,99,235,0.1);
  color: var(--primary);
  white-space: nowrap;
}

.module-icon-wrap {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(37,99,235,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
}

.module-card h4 { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.module-desc { font-size: 12px; color: var(--text-secondary); line-height: 1.4; margin-bottom: 10px; }
.module-dep { font-size: 11px; color: var(--warning); margin-bottom: 6px; }
.module-price { font-size: 15px; font-weight: 700; color: var(--gold); }
.module-price small { font-size: 11px; font-weight: 400; color: var(--text-muted); margin-left: 2px; }

/* Toggle switch */
.toggle { position: relative; display: inline-block; width: 44px; height: 24px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--border);
  border-radius: 24px;
  transition: .3s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: .3s;
}
.toggle input:checked + .toggle-slider { background: var(--primary); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* Pricing Footer */
.pricing-footer {
  position: sticky;
  bottom: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-top: 20px;
  text-align: center;
}

.pricing-total { display: flex; align-items: center; justify-content: center; gap: 8px; }
.pricing-total span { font-size: 14px; color: var(--text-secondary); }
.pricing-total strong { font-size: 24px; font-weight: 700; color: var(--gold); }
.pricing-total small { font-size: 12px; color: var(--text-muted); }

/* Signup Summary */
.signup-summary { }
.summary-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 16px;
}
.summary-section h4 { font-size: 14px; font-weight: 600; margin-bottom: 12px; color: var(--text-secondary); }
.summary-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 14px;
}
.summary-row span { color: var(--text-secondary); }

/* Demo link on cards */
.demo-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--primary);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 0;
  margin-bottom: 8px;
  transition: color 0.2s;
}
.demo-link:hover { color: #60a5fa; }

/* Agent Demo Modal */
.demo-modal {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 480px;
  max-width: 95vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.demo-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 20px 24px 12px;
  border-bottom: 1px solid var(--border);
}
.demo-header h3 { font-size: 16px; font-weight: 700; }
.demo-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.demo-chat {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 280px;
}
.demo-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 24px;
  border-top: 1px solid var(--border);
}

/* Demo bubbles */
.demo-bubble { display: flex; align-items: flex-start; gap: 10px; }
.demo-user { justify-content: flex-end; }
.demo-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.demo-avatar-user { background: var(--primary); }
.demo-avatar-agent { background: var(--surface); border: 1px solid var(--gold); }
.demo-text {
  font-size: 13px;
  line-height: 1.5;
  padding: 8px 14px;
  border-radius: 12px;
  max-width: 85%;
}
.demo-user .demo-text {
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.demo-agent .demo-text {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-bottom-left-radius: 4px;
}
.demo-result {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  width: 100%;
}
.demo-result-icon {
  width: 32px; height: 32px; border-radius: 8px;
  background: rgba(37,99,235,0.12);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.demo-result-title { font-size: 13px; font-weight: 600; }
.demo-result-detail { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.demo-done {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--success);
  padding: 10px 14px;
  background: rgba(16,185,129,0.08);
  border: 1px solid rgba(16,185,129,0.2);
  border-radius: 10px;
  width: 100%;
}

/* ===================== APPROVAL BANNER (HITL) ===================== */
.approval-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: rgba(249,189,34,0.08);
  border-bottom: 1px solid rgba(249,189,34,0.3);
  gap: 16px;
}
.approval-info {
  display: flex;
  align-items: center;
  gap: 10px;
}
.approval-info strong { font-size: 13px; display: block; }
.approval-info small { font-size: 11px; color: var(--text-muted); }
.approval-buttons { display: flex; gap: 8px; flex-shrink: 0; }

/* ===================== ANALYTICS VIEW ===================== */
.analytics-view {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px;
}
.analytics-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.analytics-header h3 { font-size: 20px; font-weight: 700; }
.analytics-header select {
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
}
.analytics-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}
.stat-card {
  background: rgba(23,31,51,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(67,70,85,0.4);
  border-radius: 14px;
  padding: 20px;
  text-align: center;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  animation: fadeInUp 0.4s ease both;
}
.stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(67,70,85,0.7);
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.stat-card:nth-child(1) { animation-delay: 0s; }
.stat-card:nth-child(2) { animation-delay: 0.05s; }
.stat-card:nth-child(3) { animation-delay: 0.1s; }
.stat-card:nth-child(4) { animation-delay: 0.15s; }
.stat-card:nth-child(5) { animation-delay: 0.2s; }
.stat-card:nth-child(6) { animation-delay: 0.25s; }
.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
}
.stat-icon.blue { background: rgba(37,99,235,0.12); color: var(--primary); }
.stat-icon.purple { background: rgba(139,92,246,0.12); color: var(--purple); }
.stat-icon.teal { background: rgba(6,182,212,0.12); color: #06b6d4; }
.stat-icon.green { background: rgba(16,185,129,0.12); color: var(--success); }
.stat-icon.gold { background: rgba(249,189,34,0.12); color: var(--gold); }
.stat-icon.yellow { background: rgba(245,158,11,0.12); color: var(--warning); }
.stat-icon.red { background: rgba(239,68,68,0.12); color: var(--error); }
.stat-value { font-size: 28px; font-weight: 700; margin-bottom: 4px; }
.stat-label { font-size: 12px; color: var(--text-muted); }

/* Stat card watermark */
.stat-watermark {
  position: absolute;
  bottom: -8px;
  right: -8px;
  opacity: 0.07;
  color: var(--text-primary);
  transition: transform 0.2s;
}
.stat-card:hover .stat-watermark { transform: scale(1.1); }

.analytics-chart-section h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 16px;
}
.analytics-chart {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  min-height: 200px;
  display: flex;
  align-items: flex-end;
  gap: 4px;
}
.chart-bar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.chart-bar {
  width: 100%;
  max-width: 40px;
  background: var(--primary);
  border-radius: 4px 4px 0 0;
  min-height: 4px;
  transition: height 0.3s;
}
.chart-bar-label {
  font-size: 9px;
  color: var(--text-muted);
  transform: rotate(-45deg);
  white-space: nowrap;
}
.chart-bar-value {
  font-size: 10px;
  color: var(--text-secondary);
  font-weight: 600;
}

/* ===================== CATALOG UPLOAD ===================== */
.settings-divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}
.catalog-section h4 { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.catalog-desc { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; }
.catalog-stats { margin-bottom: 12px; }
.catalog-stats span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: rgba(37,99,235,0.1);
  color: var(--primary);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
}
.catalog-upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.catalog-upload-zone:hover {
  border-color: var(--primary);
  background: rgba(37,99,235,0.04);
}
.catalog-upload-zone span { font-size: 13px; color: var(--text-secondary); }
.catalog-upload-zone small { font-size: 11px; color: var(--text-muted); }
.catalog-upload-zone.dragover {
  border-color: var(--primary);
  background: rgba(37,99,235,0.08);
}

/* ===================== TOP PRODUCTOS TABLE ===================== */
#table-top-productos tbody tr {
  transition: background 0.15s;
}
#table-top-productos tbody tr:nth-child(even) {
  background: rgba(255,255,255,0.02);
}
#table-top-productos tbody tr:hover {
  background: rgba(37,99,235,0.08);
}
#table-top-productos td {
  padding: 6px 4px;
  border-bottom: 1px solid rgba(67,70,85,0.3);
}
#table-top-productos th {
  padding: 6px 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ===================== DASHBOARD PERIOD BADGE ===================== */
.dash-period {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: rgba(37,99,235,0.1);
  border: 1px solid rgba(37,99,235,0.2);
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 12px;
}

/* ===================== EMPTY STATE ===================== */
.chart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  font-size: 13px;
  gap: 8px;
  opacity: 0.6;
}

/* ===================== CHAT DRAWER BADGE ===================== */
.agent-toggle .notif-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--error);
  position: absolute;
  top: 6px;
  right: 6px;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ===================== KPI COUNTER ANIMATION ===================== */
.kpi-animate {
  animation: countFade 0.6s ease both;
}
@keyframes countFade {
  from { opacity: 0; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1); }
}

/* ===================== RESPONSIVE GRIDS ===================== */
@media (max-width: 1400px) {
  .analytics-view > div:first-child {
    grid-template-columns: repeat(3, 1fr) !important;
  }
}

@media (max-width: 1024px) {
  .analytics-view > div:first-child {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .analytics-view > div:nth-child(2) {
    grid-template-columns: 1fr !important;
  }
  .analytics-view > div:nth-child(3) {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 768px) {
  .wizard-form-grid { grid-template-columns: 1fr; }
  .module-grid { grid-template-columns: 1fr; }
  .wizard-progress { flex-wrap: wrap; gap: 8px; }
  .wizard-step-connector { display: none; }
  .signup-page { padding: 16px; }
  .demo-modal { width: 100%; }
  .analytics-cards { grid-template-columns: repeat(2, 1fr); }
  .approval-banner { flex-direction: column; align-items: flex-start; }
  .analytics-view > div:first-child {
    grid-template-columns: 1fr 1fr !important;
  }
}

/* ===================== MAIN LAYOUT ===================== */
.app {
  display: flex;
  height: 100dvh;
  overflow: hidden;
}

/* ===================== ICON SIDEBAR (56px) ===================== */
.icon-sidebar {
  width: 56px;
  background: var(--sidebar);
  border-right: 0.5px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 8px 0;
  flex-shrink: 0;
  z-index: 10;
}
.icon-sidebar-top, .icon-sidebar-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.isb-logo {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}
.isb-item {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
  position: relative;
}
.isb-item:hover { background: rgba(255,255,255,0.06); color: var(--text-secondary); }
.isb-item.active {
  background: var(--accent);
  color: #fff;
}
.isb-separator {
  width: 24px;
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* ===================== MAIN AREA (right of sidebar) ===================== */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

/* ===================== TOP BAR ===================== */
.top-bar {
  display: flex;
  align-items: center;
  padding: 0 16px;
  height: 48px;
  border-bottom: 0.5px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
  gap: 12px;
}
.top-bar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.top-bar-left h3 { font-size: 15px; font-weight: 600; white-space: nowrap; }
.top-bar-center {
  flex: 1;
  min-width: 0;
  display: flex;
  justify-content: center;
}
.top-bar-right {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.tenant-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-badge);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.tenant-badge.badge-operator { background: rgba(37,99,235,0.15); color: var(--primary); }
.tenant-badge.badge-client { background: rgba(249,189,34,0.15); color: var(--gold); }

.mobile-menu-btn { display: none; }

/* ===================== CONTENT SPLIT (dashboard + chat) ===================== */
.content-split {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
}

/* ===================== DASHBOARD PANEL ===================== */
.dashboard-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.dash-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

/* ===================== CHAT PANEL ===================== */
.chat-panel {
  display: flex;
  flex-direction: column;
  border-left: 0.5px solid var(--border);
  background: var(--bg);
  min-width: 0;
}

.chat-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 0.5px solid var(--border);
  flex-shrink: 0;
}
.chat-panel-left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
}
.chat-panel-left .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
}
.chat-panel-right { display: flex; gap: 4px; }

/* ===================== OPERATOR LAYOUT (dashboard-first) ===================== */
.layout-operator .dashboard-panel { flex: 7; }
.layout-operator .chat-panel { flex: 3; min-width: 300px; max-width: 420px; }
.layout-operator .chat-panel .quick-actions { flex-wrap: nowrap; overflow-x: auto; }
.layout-operator .mobile-bottom-nav { display: none; }

/* ===================== CLIENT LAYOUT (chat-first, no sidebar) ===================== */
.layout-client .icon-sidebar { display: none; }
.layout-client .content-split { flex-direction: column; }
.layout-client .dashboard-panel {
  flex: 0 0 auto;
  overflow: visible;
  border-bottom: 0.5px solid var(--border);
}
.layout-client .dashboard-panel .dash-content { display: none; }
.layout-client .chat-panel {
  flex: 1;
  border-left: none;
  max-width: none;
  min-width: 0;
}
.layout-client .chat-panel .chat-panel-header .chat-toggle-btn { display: none; }
.layout-client .top-bar-left .mobile-menu-btn { display: none; }

/* Client KPI trend badges */
.kpi-trend {
  font-size: 11px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-top: 2px;
}
.kpi-trend.up { color: var(--success); }
.kpi-trend.down { color: var(--error); }
.kpi-trend.neutral { color: var(--text-muted); }

/* Client alert success level */
.alert-item.success {
  border-left-color: var(--success);
}
.alert-item.success .alert-icon { color: var(--success); }

/* Chat panel minimized state */
.chat-panel.minimized {
  flex: 0 0 48px;
  min-width: 48px;
  max-width: 48px;
  overflow: hidden;
}
.chat-panel.minimized .messages,
.chat-panel.minimized .input-area,
.chat-panel.minimized .ai-disclaimer { display: none; }
.chat-panel.minimized .chat-panel-header {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  padding: 12px 8px;
  justify-content: flex-start;
  gap: 12px;
}

/* Icon sidebar mobile overlay */
.icon-sidebar.mobile-open {
  display: flex !important;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 60px;
  z-index: 120;
  width: 52px;
  box-shadow: 4px 0 12px rgba(0,0,0,0.3);
}

/* ===================== MOBILE BOTTOM NAV ===================== */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--sidebar);
  border-top: 0.5px solid var(--border);
  padding: 6px 0 env(safe-area-inset-bottom, 6px);
  z-index: 100;
  justify-content: space-around;
}
.mob-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 10px;
  cursor: pointer;
  padding: 4px 8px;
  transition: color .15s;
}
.mob-nav-item.active { color: var(--primary); }
.mob-nav-item:hover { color: var(--text-secondary); }

/* KPI Dashboard Strip */
.kpi-strip {
  display: flex;
  gap: 12px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  overflow-x: auto;
}

.kpi-item {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.kpi-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.kpi-icon.green { background: rgba(16,185,129,0.12); color: var(--success); }
.kpi-icon.yellow { background: rgba(245,158,11,0.12); color: var(--warning); }
.kpi-icon.red { background: rgba(239,68,68,0.12); color: var(--error); }
.kpi-icon.blue { background: rgba(37,99,235,0.12); color: var(--primary); }
.kpi-icon.purple { background: rgba(139,92,246,0.12); color: var(--purple); }
.kpi-icon.orange { background: rgba(249,115,22,0.12); color: var(--orange); }
.kpi-icon.gold { background: rgba(249,189,34,0.12); color: var(--gold); }

/* Ads KPI accent */
.kpi-item.ads {
  border-left: 2px solid var(--gold);
  padding-left: 8px;
}

.kpi-label { font-size: 10px; color: var(--text-muted); font-weight: 500; }
.kpi-value { font-size: 13px; font-weight: 700; }
.kpi-trend { font-size: 10px; font-weight: 500; margin-left: 4px; }
.kpi-trend.up { color: var(--success); }
.kpi-trend.down { color: var(--error); }

/* ===================== MARKETPLACE TABS ===================== */
.mkp-tabs {
  display: flex;
  gap: 4px;
  padding: 4px 0;
  background: transparent;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-left: 16px;
}
.mkp-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
  flex-shrink: 0;
  text-decoration: none;
  height: 100%;
}
.mkp-tab:hover { color: var(--text-primary); }
.mkp-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}
.mkp-tab .mkp-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  font-size: 10px;
  font-weight: 700;
  background: var(--error);
  color: #fff;
}
.mkp-tab.active .mkp-badge {
  background: rgba(255,255,255,0.25);
}

/* ===================== ALERTS SECTION ===================== */
.alerts-section {
  padding: 8px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  max-height: 200px;
  overflow-y: auto;
}
.alerts-section.collapsed { display: none; }
.alert-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .15s;
  font-size: 13px;
  line-height: 1.4;
  border-left: 3px solid transparent;
}
.alert-item:hover { background: rgba(255,255,255,0.04); }
.alert-item.urgent { border-left-color: var(--error); }
.alert-item.warning { border-left-color: var(--warning); }
.alert-item.info { border-left-color: var(--info); }
.alert-mkp-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: var(--radius-badge);
  font-size: 10px;
  font-weight: 600;
  background: rgba(255,255,255,0.08);
  color: var(--text-secondary);
  flex-shrink: 0;
  min-width: 32px;
  text-align: center;
}
.alert-text { flex: 1; color: var(--text-primary); }
.alert-text small { color: var(--text-muted); }
.alerts-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  background: none;
  border: none;
  font-family: inherit;
  width: 100%;
}
.alerts-toggle:hover { color: var(--text-secondary); }

/* Alert separator (ops vs system) */
.alert-separator {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0 4px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}
.alert-separator::before,
.alert-separator::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.alert-separator span {
  white-space: nowrap;
}
.alert-item.alert-system {
  opacity: 0.7;
}
.alert-item.alert-system:hover {
  opacity: 1;
}

/* AI Disclaimer Banner */
.ai-disclaimer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 24px;
  background: rgba(249,189,34,0.08);
  border-bottom: 1px solid rgba(249,189,34,0.2);
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}
.ai-disclaimer a {
  color: var(--gold);
  text-decoration: underline;
}
.ai-disclaimer a:hover { color: var(--primary); }

/* Confidence Badges */
.confidence-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 500;
}
.confidence-low {
  background: rgba(239,68,68,0.12);
  color: var(--error);
  border: 1px solid rgba(239,68,68,0.3);
}
.confidence-medium {
  background: rgba(245,158,11,0.12);
  color: var(--warning);
  border: 1px solid rgba(245,158,11,0.3);
}

/* ToS Checkbox in Signup */
.tos-acceptance {
  margin: 16px 0;
  padding: 14px 16px;
  background: rgba(249,189,34,0.06);
  border: 1px solid rgba(249,189,34,0.2);
  border-radius: var(--radius-sm);
}
.tos-checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  line-height: 1.5;
}
.tos-checkbox-label input[type="checkbox"] {
  margin-top: 3px;
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  flex-shrink: 0;
}
.tos-checkbox-label a {
  color: var(--gold);
  text-decoration: underline;
}

/* Messages Area */
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.msg { display: flex; gap: 10px; max-width: 80%; }
.msg.user { align-self: flex-end; flex-direction: row-reverse; }
.msg.agent { align-self: flex-start; }

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

.msg-content { display: flex; flex-direction: column; gap: 8px; }

.msg-bubble {
  padding: 10px 16px;
  font-size: 14px;
  line-height: 1.5;
}

.msg.agent .msg-bubble {
  background: var(--surface);
  border-radius: 16px 16px 16px 2px;
  color: var(--text-primary);
}

.msg.user .msg-bubble {
  background: var(--primary);
  border-radius: 16px 16px 2px 16px;
  color: #fff;
}

.msg-time {
  font-size: 10px;
  color: var(--text-muted);
  padding: 0 4px;
}

.msg.user .msg-time { text-align: right; color: rgba(255,255,255,0.6); }

/* Chat Tables */
.chat-table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0;
  font-size: 13px;
}
.chat-table th {
  background: rgba(255,255,255,0.08);
  padding: 6px 10px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}
.chat-table td {
  padding: 6px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  color: var(--text-primary);
}
.chat-table tr:last-child td { border-bottom: none; }
.chat-table .text-red { color: var(--error); font-weight: 600; }
.chat-table .text-yellow { color: var(--warning); font-weight: 600; }
.chat-table .text-green { color: var(--success); font-weight: 600; }

/* Data Cards */
.data-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.data-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 600;
}

.data-card-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 14px;
  font-size: 12px;
  border-top: 1px solid var(--border);
}

.data-card-row .label { color: var(--text-secondary); }
.data-card-row .value { font-weight: 700; }

/* Stock Table */
.stock-table { width: 100%; border-collapse: collapse; }

.stock-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  padding: 10px 14px;
  background: var(--border);
}

.stock-table th:nth-child(3),
.stock-table th:nth-child(4),
.stock-table td:nth-child(3),
.stock-table td:nth-child(4) { text-align: right; }

.stock-table td {
  font-size: 11px;
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  color: var(--text-primary);
}

.text-red { color: var(--error) !important; font-weight: 700; }
.text-yellow { color: var(--warning) !important; font-weight: 700; }
.text-green { color: var(--success) !important; font-weight: 700; }

/* Input Bar */
.input-area {
  padding: 12px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.quick-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all .15s;
}

.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip i { font-size: 14px; color: var(--primary); }

.chip-add {
  border-style: dashed;
  opacity: 0.5;
}
.chip-add:hover { opacity: 1; border-color: var(--primary); }

.input-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.input-field {
  flex: 1;
  padding: 10px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color .2s;
}

.input-field:focus { border-color: var(--primary); }
.input-field::placeholder { color: var(--text-muted); }

.send-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--primary);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity .2s;
  flex-shrink: 0;
}

.send-btn:hover { opacity: 0.9; }
.send-btn:disabled { opacity: 0.4; cursor: default; }

/* Voice button */
.voice-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
  flex-shrink: 0;
}
.voice-btn:hover { border-color: var(--primary); color: var(--primary); }
.voice-btn.listening {
  background: var(--error);
  border-color: var(--error);
  color: #fff;
  animation: pulse-voice 1.5s ease-in-out infinite;
}
@keyframes pulse-voice {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.4); }
  50% { box-shadow: 0 0 0 8px rgba(239,68,68,0); }
}

/* Loading dots */
.typing-indicator span {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  margin: 0 2px;
  animation: typing 1.2s infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-4px); }
}

/* ===================== MOBILE ===================== */
@media (max-width: 768px) {
  .login-brand { display: none; }
  .login-form-section { width: 100%; padding: 40px 24px; }

  /* Hide icon sidebar on mobile */
  .icon-sidebar { display: none; }

  /* Stack content vertically */
  .content-split { flex-direction: column; }

  /* Dashboard takes full space, chat hidden by default */
  .layout-operator .dashboard-panel {
    flex: 1;
  }
  .layout-operator .chat-panel {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 150;
    max-width: none;
    min-width: 0;
  }
  .layout-operator .chat-panel.mobile-open {
    display: flex;
  }

  /* Show mobile bottom nav */
  .layout-operator .mobile-bottom-nav { display: flex; }
  .layout-client .mobile-bottom-nav { display: flex; }

  /* Adjust for bottom nav */
  .main-area { padding-bottom: 56px; }

  .mobile-menu-btn { display: flex; }

  /* Top bar: wrap so mkp tabs go to second row */
  .top-bar {
    height: auto;
    min-height: 44px;
    padding: 0 12px;
    flex-wrap: wrap;
  }
  .top-bar-left { flex: 1; min-height: 44px; }
  .top-bar-right { min-height: 44px; }
  .top-bar-center {
    flex-basis: 100%;
    order: 3;
    justify-content: flex-start;
    border-top: 0.5px solid var(--border);
  }

  /* Mkp tabs scrollable on mobile */
  .mkp-tabs {
    display: flex !important;
    overflow-x: auto;
    padding: 6px 0;
    width: 100%;
  }

  .kpi-strip { padding: 8px 12px; gap: 6px; }
  .kpi-item {
    flex-direction: column;
    background: var(--surface);
    border-radius: var(--radius-sm);
    padding: 6px 8px;
    gap: 2px;
    flex: 1;
    min-width: 0;
  }
  .kpi-item .kpi-icon { display: none; }
  .kpi-value { font-size: 14px; }
  .kpi-label { font-size: 8px; }

  .messages { padding: 16px; }
  .msg { max-width: 90%; }
  .input-area { padding: 8px 12px; }
  .quick-actions { overflow-x: auto; flex-wrap: nowrap; }

  .dash-content { padding: 12px; }
  .analytics-cards { grid-template-columns: repeat(2, 1fr); }
  .approval-banner { flex-direction: column; align-items: flex-start; }
}

/* Tablet (768-1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
  .layout-operator .chat-panel {
    flex: 2.5;
    min-width: 240px;
  }
  .layout-operator .dashboard-panel {
    flex: 7.5;
  }
  .icon-sidebar { width: 44px; }
  .kpi-strip {
    flex-wrap: wrap;
    gap: 6px;
  }
  .kpi-item {
    min-width: calc(33% - 6px);
  }
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===================== LOGIN TABS ===================== */
.login-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.login-tab {
  flex: 1;
  padding: 10px 16px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s;
}

.login-tab:not(:last-child) {
  border-right: 1px solid var(--border);
}

.login-tab.active {
  background: var(--primary);
  color: #fff;
}

.login-tab:hover:not(.active) {
  background: rgba(255,255,255,0.05);
}

.login-tab-content {
  display: none;
}

.login-tab-content.active {
  display: block;
}

.login-error {
  margin-top: 12px;
  padding: 10px 14px;
  background: rgba(239,68,68,0.12);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: var(--radius-sm);
  color: var(--error);
  font-size: 13px;
}

/* ===================== TOAST NOTIFICATIONS ===================== */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  max-width: 380px;
}
.toast {
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  transform: translateX(120%);
  transition: transform .3s ease, opacity .3s ease;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast.show { transform: translateX(0); }
.toast-info { border-left-color: var(--primary); }
.toast-warning { border-left-color: #f59e0b; }
.toast-success { border-left-color: var(--success); }
.toast-critical { border-left-color: var(--error); }
.toast-body {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.toast-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.toast-action-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  padding: 2px 6px;
}
.toast-action-btn:hover { text-decoration: underline; }
.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  display: flex;
}
.toast-close:hover { color: var(--text-primary); }

/* ===================== BANNERS ===================== */
.banner-stack {
  display: flex;
  flex-direction: column;
}
.banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 16px;
  font-size: 13px;
  transition: opacity .3s, transform .3s;
}
.banner-info { background: rgba(37,99,235,0.12); color: #93c5fd; border-bottom: 1px solid rgba(37,99,235,0.2); }
.banner-warning { background: rgba(245,158,11,0.12); color: #fcd34d; border-bottom: 1px solid rgba(245,158,11,0.2); }
.banner-success { background: rgba(16,185,129,0.12); color: #6ee7b7; border-bottom: 1px solid rgba(16,185,129,0.2); }
.banner-critical { background: rgba(239,68,68,0.12); color: #fca5a5; border-bottom: 1px solid rgba(239,68,68,0.2); }
.banner-content {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.banner-content span { overflow: hidden; text-overflow: ellipsis; }
.banner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.banner-action-btn {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  color: inherit;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
}
.banner-action-btn:hover { background: rgba(255,255,255,0.18); }
.banner-close {
  background: none;
  border: none;
  color: inherit;
  opacity: 0.6;
  cursor: pointer;
  padding: 2px;
  display: flex;
}
.banner-close:hover { opacity: 1; }

/* ===================== CHANGELOG ===================== */
.changelog-btn { position: relative; }
.changelog-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--error);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.changelog-list {}
.changelog-version { margin-bottom: 20px; }
.changelog-version h4 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 10px 0;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.changelog-date {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 6px;
}
.changelog-version ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.changelog-version li {
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.changelog-badge-type {
  font-size: 10px;
  font-weight: 600;
  color: #fff;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  flex-shrink: 0;
}
.changelog-desc {
  color: var(--text-muted);
  font-size: 12px;
}

/* ===================== MODAL ===================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 420px;
  max-width: 90vw;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}
.modal-close:hover { color: var(--text-primary); }
.modal-body { padding: 20px; }
.modal-body textarea,
.modal-body select {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  outline: none;
}
.modal-body textarea:focus,
.modal-body select:focus { border-color: var(--primary); }
.modal-body textarea { resize: vertical; }
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
}
.modal-footer-right { display: flex; gap: 8px; }
.btn-sm { padding: 8px 16px; font-size: 13px; width: auto; }

/* ===================== SETTINGS TABS ===================== */
.settings-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
}
.settings-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
}
.settings-tab:hover { color: var(--text-primary); }
.settings-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.settings-tab-content { display: none; }
.settings-tab-content.active { display: block; }

/* Settings nav list (overflow modules) */
.settings-nav-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
}
.settings-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface);
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: background .15s;
}
.settings-nav-item:hover { background: rgba(255,255,255,0.08); }
.settings-nav-item i { color: var(--text-secondary); }

/* ===================== USERS LIST ===================== */
.users-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.users-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.user-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color .15s;
}
.user-row:hover { border-color: var(--text-muted); }
.user-row.inactive { opacity: 0.5; }
.user-avatar-sm {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}
.user-avatar-sm.owner { background: var(--primary); }
.user-avatar-sm.manager { background: var(--purple); }
.user-avatar-sm.viewer { background: var(--text-muted); }
.user-info-col { flex: 1; min-width: 0; }
.user-info-col .user-name { font-size: 13px; font-weight: 500; }
.user-info-col .user-email { font-size: 11px; color: var(--text-muted); }
.user-role-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-badge);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.user-role-badge.owner { background: rgba(37,99,235,0.15); color: var(--primary); }
.user-role-badge.manager { background: rgba(139,92,246,0.15); color: var(--purple); }
.user-role-badge.viewer { background: rgba(100,116,139,0.15); color: var(--text-muted); }
.user-perms-summary {
  font-size: 10px;
  color: var(--text-muted);
  display: flex;
  gap: 6px;
}
.perm-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.perm-check {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
}
.perm-check input[type="checkbox"] {
  accent-color: var(--primary);
}
.settings-divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}


.header-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .2s;
  flex-shrink: 0;
}
.header-btn:hover {
  background: rgba(255,255,255,0.08);
  color: var(--text-primary);
  border-color: var(--text-muted);
}

/* History Panel */
.history-panel {
  position: fixed;
  top: 0;
  left: -320px;
  width: 320px;
  height: 100vh;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  z-index: 200;
  transition: left .3s ease;
  display: flex;
  flex-direction: column;
}
.history-panel.open {
  left: 0;
}
.history-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 199;
  display: none;
}
.history-backdrop.show {
  display: block;
}
.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.history-header h3 {
  font-size: 16px;
  font-weight: 600;
}
.history-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}
.history-close:hover { color: var(--text-primary); }

.history-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}
.history-item {
  display: flex;
  flex-direction: column;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .15s;
  border: none;
  background: none;
  text-align: left;
  width: 100%;
  color: var(--text-primary);
  font-family: inherit;
}
.history-item:hover { background: rgba(255,255,255,0.06); }
.history-item.active {
  background: rgba(99,102,241,0.12);
  border-left: 3px solid var(--primary);
}
.history-item-title {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-item-date {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.history-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 20px;
  font-size: 13px;
  line-height: 1.8;
}

/* ===================== SPECIALIZED VIEWS ===================== */
.specialized-view {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
}
.sv-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.sv-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}
.sv-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.sv-search {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  color: var(--text-muted);
}
.sv-search-input {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  width: 160px;
}
.sv-search-input::placeholder { color: var(--text-muted); }
.sv-filters {
  display: flex;
  gap: 4px;
}
.sv-filter {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 12px;
  font-family: inherit;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all .2s;
}
.sv-filter:hover { border-color: var(--primary); color: var(--text-primary); }
.sv-filter.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.sv-count {
  background: rgba(255,255,255,0.15);
  padding: 1px 6px;
  border-radius: var(--radius-full);
  font-size: 10px;
  margin-left: 2px;
}
.sv-body { margin-top: 8px; }
.sv-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 0;
  color: var(--text-muted);
  font-size: 13px;
  gap: 12px;
}
.sv-empty {
  text-align: center;
  padding: 32px;
  color: var(--text-muted);
  font-size: 13px;
}

/* Table view */
.sv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.sv-table thead th {
  text-align: left;
  padding: 10px 12px;
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.sv-table tbody tr {
  border-bottom: 1px solid rgba(67,70,85,0.4);
  transition: background .15s;
}
.sv-table tbody tr:hover { background: rgba(37,99,235,0.06); }
.sv-table td {
  padding: 10px 12px;
  color: var(--text-primary);
  vertical-align: middle;
}
.sv-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-badge);
  font-size: 11px;
  font-weight: 500;
}
.sv-badge-ok { background: rgba(16,185,129,0.15); color: #6ee7b7; }
.sv-badge-warn { background: rgba(245,158,11,0.15); color: #fcd34d; }
.sv-badge-error { background: rgba(239,68,68,0.15); color: #fca5a5; }
.sv-badge-info { background: rgba(37,99,235,0.15); color: #93c5fd; }
.sv-badge-muted { background: rgba(141,144,160,0.15); color: var(--text-muted); }
.sv-action-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--primary);
  font-size: 12px;
  font-family: inherit;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
}
.sv-action-btn:hover { background: rgba(37,99,235,0.1); }

/* Card grid (publications) */
.sv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.sv-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  cursor: pointer;
  transition: border-color .2s;
}
.sv-card:hover { border-color: var(--primary); }
.sv-card-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sv-card-sku {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.sv-card-mkps {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.sv-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}
.sv-card-price {
  font-weight: 600;
  color: var(--success);
}
.sv-card-stock {
  color: var(--text-secondary);
}

/* Question-specific */
.sv-question-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 8px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.sv-question-text {
  flex: 1;
  min-width: 0;
}
.sv-question-text p {
  font-size: 13px;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.sv-question-meta {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  gap: 10px;
  align-items: center;
}
.sv-timer {
  font-weight: 600;
}
.sv-timer-warn { color: var(--warning); }
.sv-timer-crit { color: var(--error); }

@media (max-width: 768px) {
  .sv-header { flex-direction: column; align-items: flex-start; }
  .sv-controls { width: 100%; }
  .sv-search { flex: 1; }
  .sv-search-input { width: 100%; }
  .sv-grid { grid-template-columns: 1fr; }
  .sv-table { font-size: 12px; }
  .sv-table td, .sv-table th { padding: 8px 6px; }
}

/* ===================== MONTHLY REPORT (Cierre Mensual) ===================== */

.report-view {
  padding: 24px 32px;
  max-width: 1200px;
}
.report-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.report-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}
.report-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}
.report-select {
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
}
.report-select:focus {
  outline: none;
  border-color: var(--primary);
}
.report-period-label {
  font-size: 16px;
  font-weight: 600;
  color: var(--gold);
  margin-bottom: 16px;
}
.report-actions-bar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 20px;
}
.report-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 0;
  gap: 12px;
  color: var(--text-muted);
}
.report-error {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px;
  color: var(--error);
  font-size: 14px;
}

/* Summary Cards */
.report-summary-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}
.report-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.report-card-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.report-card-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}
.report-card-change {
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.report-card-change.positive { color: var(--success); }
.report-card-change.negative { color: var(--error); }
.report-card-change.neutral { color: var(--text-muted); }

/* Report sections */
.report-section {
  margin-bottom: 32px;
}
.report-section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

/* Horizontal bar chart */
.report-bar-chart {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.report-bar-row {
  display: grid;
  grid-template-columns: 160px 1fr 200px;
  align-items: center;
  gap: 12px;
}
.report-bar-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.report-bar-mkp {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.report-bar-name {
  font-size: 11px;
  color: var(--text-muted);
}
.report-bar-track {
  height: 24px;
  background: rgba(37, 99, 235, 0.08);
  border-radius: 4px;
  overflow: hidden;
}
.report-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), rgba(37, 99, 235, 0.7));
  border-radius: 4px;
  min-width: 4px;
  transition: width 0.6s ease;
}
.report-bar-values {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}
.report-bar-amount {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.report-bar-meta {
  font-size: 11px;
  color: var(--text-muted);
}
.report-bar-change {
  font-size: 11px;
  font-weight: 500;
}
.report-bar-change.positive { color: var(--success); }
.report-bar-change.negative { color: var(--error); }

/* Report Table */
.report-table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  max-height: 600px;
  overflow-y: auto;
}
.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.report-table thead {
  position: sticky;
  top: 0;
  z-index: 1;
}
.report-table thead th {
  text-align: left;
  padding: 12px 14px;
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.report-table tbody tr {
  border-bottom: 1px solid rgba(67, 70, 85, 0.3);
  transition: background 0.15s;
}
.report-table tbody tr:hover {
  background: rgba(37, 99, 235, 0.04);
}
.report-table td {
  padding: 10px 14px;
  color: var(--text-primary);
  vertical-align: middle;
}
.report-rank {
  font-weight: 600;
  color: var(--text-muted);
  width: 36px;
}
.report-sku {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  color: var(--text-secondary);
}
.report-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.margin-high { color: var(--success); font-weight: 600; }
.margin-mid { color: var(--warning); font-weight: 500; }
.margin-low { color: var(--error); font-weight: 500; }

/* Stockout list */
.stockout-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.stockout-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--error);
}
.stockout-icon {
  color: var(--error);
  flex-shrink: 0;
}
.stockout-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stockout-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}
.stockout-meta {
  font-size: 11px;
  color: var(--text-muted);
}

/* Print-only header */
.report-print-header {
  text-align: center;
  margin-bottom: 24px;
}
.report-print-header h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}
.report-print-header p {
  font-size: 13px;
  color: var(--text-muted);
}

/* Responsive - report */
@media (max-width: 1024px) {
  .report-summary-cards { grid-template-columns: repeat(2, 1fr); }
  .report-bar-row { grid-template-columns: 120px 1fr 160px; }
}
@media (max-width: 768px) {
  .report-view { padding: 16px; }
  .report-header { flex-direction: column; align-items: flex-start; }
  .report-summary-cards { grid-template-columns: 1fr 1fr; }
  .report-card-value { font-size: 20px; }
  .report-bar-row { grid-template-columns: 1fr; gap: 6px; }
  .report-bar-label { flex-direction: row; gap: 8px; }
  .report-bar-values { flex-direction: row; gap: 8px; align-items: center; }
  .report-table { font-size: 12px; }
  .report-table td, .report-table th { padding: 8px 8px; }
}

/* ===================== CHAT HEADER (full-width layout) ===================== */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}
.chat-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.chat-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.agent-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e3a5f, #0b1326);
  border: 1.5px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
}
.agent-info h3 { font-size: 15px; font-weight: 600; }
.agent-status {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}
.agent-status .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
}

/* Main full width (no sidebar) */
.main-full {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

/* ===================== PRINT STYLES ===================== */

@media print {
  /* Hide non-printable elements */
  body { background: #fff !important; color: #000 !important; overflow: visible !important; }
  #login-page,
  #signup-page,
  .icon-sidebar,
  .top-bar,
  .chat-panel,
  .chat-drawer,
  .mobile-bottom-nav,
  .history-panel,
  .history-backdrop,
  .modal-overlay,
  .toast-container,
  .kpi-strip,
  .alerts-section,
  .approval-banner,
  .banner-stack,
  .report-header,
  .report-actions-bar,
  .chat-header,
  .agent-toggle,
  .ai-disclaimer,
  .btn { display: none !important; }

  /* Show dashboard for printing */
  #analytics-view { display: block !important; overflow: visible !important; height: auto !important; }
  .main-full { overflow: visible !important; }
  .app { display: block !important; height: auto !important; overflow: visible !important; }

  /* Light theme for dashboard print */
  .stat-card {
    background: #fff !important;
    border: 1px solid #ddd !important;
    backdrop-filter: none !important;
    color: #000 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .stat-value { color: #000 !important; }
  .stat-label { color: #666 !important; }
  .stat-watermark { display: none !important; }
  .dash-period { background: #f0f4ff !important; color: #2563eb !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  #table-top-productos td, #table-top-productos th { color: #000 !important; }
  #table-top-productos tbody tr:nth-child(even) { background: #f8f8f8 !important; }
  canvas { max-height: 200px !important; }

  /* Make dashboard panel full width */
  .app { display: block !important; }
  .main-area { margin: 0 !important; width: 100% !important; }
  .content-split { display: block !important; }
  .dashboard-panel { width: 100% !important; max-width: 100% !important; overflow: visible !important; }
  .dash-content { overflow: visible !important; height: auto !important; }
  .specialized-view { display: block !important; }
  .report-view { padding: 0 !important; }

  /* Show print header */
  .report-print-header { display: block !important; }

  /* Light theme for print */
  .report-summary-cards { gap: 12px; }
  .report-card {
    background: #fff !important;
    border: 1px solid #ddd !important;
    padding: 16px !important;
  }
  .report-card-label { color: #666 !important; }
  .report-card-value { color: #000 !important; font-size: 22px !important; }
  .report-card-change.positive { color: #16a34a !important; }
  .report-card-change.negative { color: #dc2626 !important; }
  .report-card-change.neutral { color: #666 !important; }

  .report-section-title { color: #333 !important; }

  .report-bar-chart {
    background: #fff !important;
    border: 1px solid #ddd !important;
  }
  .report-bar-mkp { color: #000 !important; }
  .report-bar-name { color: #666 !important; }
  .report-bar-track { background: #f0f0f0 !important; }
  .report-bar-fill { background: #3b82f6 !important; }
  .report-bar-amount { color: #000 !important; }
  .report-bar-meta { color: #666 !important; }

  .report-table-wrap {
    background: #fff !important;
    border: 1px solid #ddd !important;
    max-height: none !important;
    overflow: visible !important;
  }
  .report-table thead th {
    background: #f8f8f8 !important;
    color: #333 !important;
    border-bottom: 2px solid #ccc !important;
  }
  .report-table tbody tr { border-bottom: 1px solid #eee !important; }
  .report-table td { color: #000 !important; }
  .report-sku { color: #666 !important; }
  .report-rank { color: #999 !important; }
  .margin-high { color: #16a34a !important; }
  .margin-mid { color: #d97706 !important; }
  .margin-low { color: #dc2626 !important; }

  .stockout-item {
    background: #fff !important;
    border: 1px solid #ddd !important;
    border-left: 3px solid #dc2626 !important;
  }
  .stockout-name { color: #000 !important; }
  .stockout-meta { color: #666 !important; }
  .stockout-icon { color: #dc2626 !important; }

  .report-period-label { color: #b8860b !important; }

  /* Page breaks */
  .report-section { page-break-inside: avoid; }
  .report-table-wrap { page-break-inside: auto; }
  .report-table tbody tr { page-break-inside: avoid; }
}

/* ===================== CHAT DRAWER ===================== */
.chat-drawer {
  position: fixed;
  z-index: 60;
  background: var(--sidebar);
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 24px rgba(0,0,0,0.4);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.25s ease, height 0.25s ease;
}

/* Position variants */
.chat-drawer.pos-right  { right: 0; top: 0; height: 100vh; width: 420px; transform: translateX(100%); }
.chat-drawer.pos-left   { left: 0; top: 0; height: 100vh; width: 420px; transform: translateX(-100%); box-shadow: 4px 0 24px rgba(0,0,0,0.4); }
.chat-drawer.pos-bottom { bottom: 0; left: 0; right: 0; height: 45vh; width: 100%; transform: translateY(100%); box-shadow: 0 -4px 24px rgba(0,0,0,0.4); }
.chat-drawer.pos-top    { top: 0; left: 0; right: 0; height: 45vh; width: 100%; transform: translateY(-100%); box-shadow: 0 4px 24px rgba(0,0,0,0.4); }

/* Open state */
.chat-drawer.open.pos-right  { transform: translateX(0); }
.chat-drawer.open.pos-left   { transform: translateX(0); }
.chat-drawer.open.pos-bottom { transform: translateY(0); }
.chat-drawer.open.pos-top    { transform: translateY(0); }

/* Size variants */
.chat-drawer.size-sm.pos-right, .chat-drawer.size-sm.pos-left { width: 320px; }
.chat-drawer.size-md.pos-right, .chat-drawer.size-md.pos-left { width: 420px; }
.chat-drawer.size-lg.pos-right, .chat-drawer.size-lg.pos-left { width: 600px; }
.chat-drawer.size-xl.pos-right, .chat-drawer.size-xl.pos-left { width: 50vw; }

.chat-drawer.size-sm.pos-bottom, .chat-drawer.size-sm.pos-top { height: 30vh; }
.chat-drawer.size-md.pos-bottom, .chat-drawer.size-md.pos-top { height: 45vh; }
.chat-drawer.size-lg.pos-bottom, .chat-drawer.size-lg.pos-top { height: 60vh; }
.chat-drawer.size-xl.pos-bottom, .chat-drawer.size-xl.pos-top { height: 80vh; }

.chat-drawer .chat-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  flex-shrink: 0;
}
.chat-drawer .messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
}
.chat-drawer .input-area {
  border-top: 1px solid rgba(255,255,255,0.05);
  padding: 12px 16px;
  flex-shrink: 0;
}
.chat-drawer .quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.chat-drawer .quick-actions .quick-btn {
  font-size: 11px;
  padding: 6px 10px;
  white-space: nowrap;
}

/* Drawer controls bar */
.drawer-controls {
  display: flex;
  align-items: center;
  gap: 2px;
}
.drawer-ctrl-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.drawer-ctrl-btn:hover { background: rgba(255,255,255,0.08); color: var(--text-primary); }
.drawer-ctrl-btn.active { color: var(--primary); background: rgba(37,99,235,0.15); }

/* Dynamic margin when drawer is open */
.main-full.drawer-open-right .analytics-view { margin-right: 420px; }
.main-full.drawer-open-left .analytics-view { margin-left: 420px; }
.main-full.drawer-open-bottom .analytics-view { margin-bottom: 45vh; }
.main-full.drawer-open-top .analytics-view { margin-top: 45vh; }

/* Size-aware margins */
.main-full.drawer-open-right.drawer-sm .analytics-view { margin-right: 320px; }
.main-full.drawer-open-right.drawer-lg .analytics-view { margin-right: 600px; }
.main-full.drawer-open-right.drawer-xl .analytics-view { margin-right: 50vw; }
.main-full.drawer-open-left.drawer-sm .analytics-view { margin-left: 320px; }
.main-full.drawer-open-left.drawer-lg .analytics-view { margin-left: 600px; }
.main-full.drawer-open-left.drawer-xl .analytics-view { margin-left: 50vw; }

.analytics-view {
  transition: margin 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
/* AI Agent toggle button */
.agent-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}
.agent-toggle:hover { color: var(--gold); }
.agent-toggle.active { background: var(--surface); color: var(--gold); }

/* Chat drawer responsive */
@media (max-width: 768px) {
  .chat-drawer {
    width: 100vw;
  }
  .main-full.drawer-open .analytics-view {
    margin-right: 0;
  }
}

/* ===================== VOICE INTERFACE ===================== */
.voice-btn { transition: all 0.3s ease; position: relative; }
.voice-btn.voice-listening { background: #2563eb !important; color: white !important; animation: voice-pulse 1.5s ease-in-out infinite; }
.voice-btn.voice-connecting, .voice-btn.voice-processing { background: #1e3a5f !important; color: #60a5fa !important; }
.voice-btn.voice-connecting i, .voice-btn.voice-processing i { animation: voice-spin 1s linear infinite; }
.voice-btn.voice-speaking { background: #2563eb !important; color: white !important; animation: voice-speak 0.8s ease-in-out infinite alternate; }
.voice-btn.voice-error { background: #dc2626 !important; color: white !important; }
@keyframes voice-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(37,99,235,0.4); } 50% { box-shadow: 0 0 0 12px rgba(37,99,235,0); } }
@keyframes voice-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes voice-speak { from { box-shadow: 0 0 0 0 rgba(37,99,235,0.3); } to { box-shadow: 0 0 0 8px rgba(37,99,235,0); } }
.voice-indicator { text-align: center; font-size: 0.75rem; color: #60a5fa; padding: 4px 0; letter-spacing: 0.5px; }
.voice-transcript-panel { position: fixed; right: -340px; top: 0; bottom: 0; width: 320px; background: #0f172a; border-left: 1px solid rgba(255,255,255,0.06); transition: right 0.3s ease; z-index: 1000; display: flex; flex-direction: column; }
.voice-transcript-panel.open { right: 0; }
.voice-transcript-header { display: flex; justify-content: space-between; align-items: center; padding: 16px; border-bottom: 1px solid rgba(255,255,255,0.06); color: #94a3b8; font-size: 0.85rem; font-weight: 500; }
.transcript-close { background: none; border: none; color: #64748b; cursor: pointer; padding: 4px; }
.voice-transcript { flex: 1; overflow-y: auto; padding: 12px 16px; }
.transcript-entry { padding: 8px 12px; margin-bottom: 8px; border-radius: 8px; font-size: 0.8rem; line-height: 1.4; }
.transcript-system { background: rgba(37,99,235,0.1); color: #60a5fa; font-style: italic; }
.transcript-user { background: rgba(255,255,255,0.05); color: #e2e8f0; }
.transcript-agent { background: rgba(249,189,34,0.08); color: #f9bd22; }
