:root {
  --primary: #ff6b00; /* Laranja Supera */
  --primary-hover: #e05d00;
  --primary-light: #fff2e6;
  --dark-navy: #0f172a;
  --slate-dark: #1e293b;
  --slate-border: #e2e8f0;
  --slate-bg: #f8fafc;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --success: #10b981;
  --success-bg: #ecfdf5;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --info: #0284c7;
  --info-bg: #f0f9ff;
  --whatsapp: #25d366;
  --whatsapp-dark: #128c7e;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
}

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

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background-color: var(--slate-bg);
  color: var(--text-main);
  line-height: 1.5;
}

/* App Layout */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 270px;
  background-color: var(--dark-navy);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  padding-left: 8px;
}

.brand-logo {
  width: 44px;
  height: 44px;
  background: var(--primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: #fff;
  box-shadow: 0 4px 12px rgba(255, 107, 0, 0.4);
}

.brand h2 {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.brand span {
  font-size: 11px;
  color: #94a3b8;
  display: block;
}

.franchise-badge {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge-dot {
  width: 10px;
  height: 10px;
  background: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--success);
}

.franchise-badge strong {
  font-size: 13px;
  display: block;
}

.franchise-badge small {
  font-size: 11px;
  color: #94a3b8;
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 14px;
  font-weight: 600;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  position: relative;
}

.nav-item i {
  font-size: 16px;
  width: 20px;
}

.nav-item:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(255, 107, 0, 0.3);
}

.pill-live {
  margin-left: auto;
  font-size: 10px;
  background: var(--success);
  color: #fff;
  padding: 2px 6px;
  border-radius: 12px;
  font-weight: 700;
}

.sidebar-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 16px;
}

.stone-status {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.04);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
}

.stone-status p {
  font-size: 11px;
  font-weight: 600;
}

.status-online {
  font-size: 10px;
  color: var(--success);
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 32px 40px;
  max-width: 1400px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
}

.topbar-title h1 {
  font-size: 24px;
  font-weight: 800;
  color: var(--slate-dark);
}

.topbar-title p {
  font-size: 13px;
  color: var(--text-muted);
}

.topbar-actions {
  display: flex;
  gap: 12px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: #fff;
  color: var(--slate-dark);
  border: 1px solid var(--slate-border);
}
.btn-secondary:hover {
  background: var(--slate-bg);
}

.btn-success {
  background: var(--success);
  color: #fff;
}
.btn-success:hover {
  background: #059669;
}

.btn-whatsapp {
  background: var(--whatsapp);
  color: #fff;
}
.btn-whatsapp:hover {
  background: var(--whatsapp-dark);
}

.btn-ghost {
  background: transparent;
  color: var(--primary);
  border: none;
  padding: 4px 8px;
}
.btn-ghost:hover {
  text-decoration: underline;
}

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

.btn-block {
  width: 100%;
}

/* KPI Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.kpi-card {
  background: #fff;
  border-radius: var(--radius-md);
  padding: 20px;
  border: 1px solid var(--slate-border);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
}

.kpi-icon {
  width: 50px;
  height: 50px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #fff;
}

.bg-stone { background: #00a868; }
.bg-success { background: var(--success); }
.bg-warning { background: var(--warning); }
.bg-danger { background: var(--danger); }
.bg-info { background: var(--info); }

.kpi-info span {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.kpi-info h3 {
  font-size: 20px;
  font-weight: 800;
  color: var(--slate-dark);
  margin: 2px 0;
}

.kpi-info small {
  font-size: 11px;
}

/* Cards & Grids */
.card {
  background: #fff;
  border-radius: var(--radius-md);
  border: 1px solid var(--slate-border);
  box-shadow: var(--shadow);
  padding: 24px;
}

.mb-4 { margin-bottom: 24px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--slate-border);
}

.card-header h3 {
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--slate-dark);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.8fr 1.2fr;
  gap: 24px;
}

/* Data Tables */
.table-responsive {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.data-table th {
  background: var(--slate-bg);
  padding: 10px 14px;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 1px solid var(--slate-border);
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--slate-border);
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background-color: #f1f5f9;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 700;
}

.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: #b45309; }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }

/* DRE Layout */
.dre-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px dashed var(--slate-border);
  font-size: 13px;
}

.dre-row.total {
  font-weight: 800;
  font-size: 15px;
  border-top: 2px solid var(--slate-border);
  border-bottom: none;
  padding-top: 14px;
  color: var(--success);
}

.dre-row.sub-row {
  padding-left: 16px;
  font-size: 12px;
  color: var(--text-muted);
}

/* Bot & Simulator */
.bot-layout {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 24px;
}

.rules-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rule-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--slate-bg);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--slate-border);
}

.rule-badge {
  font-weight: 800;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
}

.d-minus { background: #e0e7ff; color: #3730a3; }
.d-day { background: #fef3c7; color: #92400e; }
.d-plus { background: #fee2e2; color: #991b1b; }
.d-critical { background: #fdf2f8; color: #831843; }

.rule-info {
  flex: 1;
}

.rule-info strong {
  font-size: 13px;
  display: block;
}

.rule-info p {
  font-size: 11px;
  color: var(--text-muted);
}

/* Phone Mockup */
.phone-mockup {
  border: 12px solid #334155;
  border-radius: 36px;
  background: #efeae2;
  overflow: hidden;
  height: 540px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.phone-header {
  background: #075e54;
  color: #fff;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.phone-avatar {
  width: 36px;
  height: 36px;
  background: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.phone-contact strong {
  font-size: 13px;
  display: block;
}

.phone-contact small {
  font-size: 10px;
  color: #d1fae5;
}

.phone-body {
  flex: 1;
  padding: 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 12px;
}

.chat-bubble {
  max-width: 85%;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
  word-break: break-word;
}

.bot-bubble {
  background: #ffffff;
  align-self: flex-start;
  border-top-left-radius: 0;
}

.user-bubble {
  background: #dcf8c6;
  align-self: flex-end;
  border-top-right-radius: 0;
}

.quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.quick-btn {
  background: #e2e8f0;
  border: 1px solid #cbd5e1;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 11px;
  cursor: pointer;
}
.quick-btn:hover {
  background: #cbd5e1;
}

.phone-footer {
  background: #f0f2f5;
  padding: 8px 12px;
  display: flex;
  gap: 8px;
}

.phone-footer input {
  flex: 1;
  padding: 8px 12px;
  border-radius: 20px;
  border: 1px solid #cbd5e1;
  font-size: 12px;
  outline: none;
}

.phone-footer button {
  background: #075e54;
  color: #fff;
  border: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
}

/* Modals */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: #fff;
  width: 90%;
  max-width: 520px;
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--slate-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
}

.close-modal {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--text-muted);
}

.modal-body {
  padding: 20px;
}

.qr-container {
  margin: 16px auto;
  width: 200px;
  height: 200px;
  background: #fff;
  border: 1px solid var(--slate-border);
  border-radius: var(--radius-md);
  padding: 8px;
}

.qr-container img {
  width: 100%;
  height: 100%;
}

.pix-copy-box label, .boleto-line-box label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  display: block;
  text-align: left;
  margin-bottom: 4px;
}

.input-group {
  display: flex;
  gap: 6px;
}

.input-group input {
  flex: 1;
  padding: 8px 10px;
  font-size: 11px;
  border: 1px solid var(--slate-border);
  border-radius: var(--radius-sm);
  background: var(--slate-bg);
}

.text-mono {
  font-family: monospace;
  font-size: 11px;
  background: var(--slate-bg);
  padding: 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--slate-border);
  word-break: break-all;
}

.modal-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Forms */
.form-group label {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
  display: block;
}

.form-control {
  width: 100%;
  padding: 10px 12px;
  font-size: 13px;
  border: 1px solid var(--slate-border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  outline: none;
}

.form-control:focus {
  border-color: var(--primary);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Utilities */
.tab-content {
  display: none;
}

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

.text-center { text-align: center; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--text-muted); }

.logs-container {
  max-height: 350px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.log-entry {
  background: var(--slate-bg);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--whatsapp);
  font-size: 12px;
}

.log-entry small {
  color: var(--text-muted);
  display: block;
  margin-top: 4px;
}
