* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg-main: #0d0d0d; --bg-card: #1a1a1a; --bg-input: #111; --bg-tabs: #111;
  --border: #2a2a2a; --border-light: #222; --border-input: #333;
  --text: #e0e0e0; --text-muted: #888; --text-dim: #666; --text-dimmer: #555; --text-dimmest: #444;
  --accent: #800f0f; --accent-hover: #a01515; --accent-bg: #2a1010; --accent-shadow: #800f0f22; --accent-border: #800f0f44;
  --stat-color: #fff; --header-text: #fff;
  --green: #4caf50; --red: #ef5350; --orange: #ff9800; --blue: #42a5f5;
  --overlay-bg: #000a; --modal-bg: #1a1a1a;
  --toast-bg: #1a1a1a; --table-hover: #151515;
}
[data-theme="light"] {
  --bg-main: #f5f5f5; --bg-card: #fff; --bg-input: #f9f9f9; --bg-tabs: #fff;
  --border: #e0e0e0; --border-light: #eee; --border-input: #ccc;
  --text: #222; --text-muted: #666; --text-dim: #888; --text-dimmer: #aaa; --text-dimmest: #bbb;
  --accent: #800f0f; --accent-hover: #a01515; --accent-bg: #fbe9e9; --accent-shadow: #800f0f15; --accent-border: #800f0f30;
  --stat-color: #111; --header-text: #fff;
  --green: #2e7d32; --red: #c62828; --orange: #e65100; --blue: #1565c0;
  --overlay-bg: #0005; --modal-bg: #fff;
  --toast-bg: #fff; --table-hover: #f0f0f0;
}
body { font-family: 'Segoe UI', system-ui, sans-serif; background: var(--bg-main); color: var(--text); min-height: 100vh; transition: background 0.3s, color 0.3s; }
.header { background: linear-gradient(135deg, #800f0f, #4a0909); padding: 16px 24px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 50; }
.header h1 { font-size: 18px; font-weight: 600; color: var(--header-text); }
.badge { background: var(--bg-card); padding: 5px 12px; border-radius: 16px; font-size: 12px; color: var(--text-muted); }
.badge.online { color: var(--green); }

.tabs { display: flex; gap: 0; background: var(--bg-tabs); border-bottom: 1px solid var(--border-light); padding: 0 24px; }
.tab { padding: 12px 20px; cursor: pointer; font-size: 13px; color: var(--text-muted); border-bottom: 2px solid transparent; transition: all .2s; position: relative; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--stat-color); border-bottom-color: var(--accent); }
.tab .tab-badge { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; background: var(--red); border-radius: 50%; display: none; }
.tab .tab-badge.visible { display: block; animation: pulseDot 1.5s ease-in-out infinite; }

.page { display: none; padding: 20px 24px; opacity: 0; transition: opacity 0.2s ease; }
.page.active { display: block; opacity: 1; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.card { background: var(--bg-card); border-radius: 10px; padding: 18px; border: 1px solid var(--border); transition: border-color 0.2s, box-shadow 0.2s; }
.card:hover { border-color: var(--accent-border); box-shadow: 0 0 12px var(--accent-shadow); }
.card h2 { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--accent); margin-bottom: 8px; }
.stat { font-size: 36px; font-weight: 700; color: var(--stat-color); }
.stat-sm { font-size: 24px; }
.stat-label { font-size: 12px; color: var(--text-dim); margin-top: 2px; }

.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--accent); margin: 16px 0 12px; font-weight: 600; }

.ring-mode { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.ring-btn { background: var(--bg-card); border: 2px solid var(--border); border-radius: 8px; padding: 12px 16px; cursor: pointer; transition: all .2s; flex: 1; min-width: 120px; text-align: center; }
.ring-btn:hover { border-color: var(--accent); }
.ring-btn.active { border-color: var(--accent); background: var(--accent-bg); }
.ring-btn .icon { font-size: 20px; }
.ring-btn .label { font-size: 13px; font-weight: 600; color: var(--stat-color); margin-top: 4px; }
.ring-btn .desc { font-size: 10px; color: var(--text-muted); margin-top: 2px; }

.ext-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; }
.ext-card { background: var(--bg-card); border-radius: 8px; padding: 12px; border: 1px solid var(--border); display: flex; align-items: center; gap: 10px; position: relative; transition: border-color 0.2s; flex-wrap: wrap; }
.ext-card:hover { border-color: var(--accent-border); }
.dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.dot.online { background: var(--green); box-shadow: 0 0 6px #4caf5060; }
.dot.offline { background: var(--text-dimmer); }
.dot.busy { background: var(--orange); box-shadow: 0 0 6px #ff980060; animation: pulseDot 1.5s ease-in-out infinite; }
.dot.whatsapp { background: #25d366; box-shadow: 0 0 6px #25d36660; }
.ext-card .info { flex: 1; }
.ext-card .name { font-size: 14px; font-weight: 600; color: var(--text); }
.ext-card .meta { font-size: 11px; color: var(--text-dim); }
.ext-card .actions { display: flex; gap: 4px; }
.ext-card .actions button { background: none; border: 1px solid var(--border-input); border-radius: 5px; color: var(--text-muted); padding: 3px 7px; cursor: pointer; font-size: 11px; transition: all .2s; }
.ext-card .actions button:hover { border-color: var(--accent); color: var(--stat-color); }
.single-badge { position: absolute; top: 6px; right: 6px; background: var(--accent); color: #fff; font-size: 9px; padding: 2px 6px; border-radius: 8px; }

.form-row { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
input, select { background: var(--bg-input); border: 1px solid var(--border-input); border-radius: 6px; padding: 8px 12px; color: var(--text); font-size: 13px; }
input::placeholder { color: var(--text-dimmer); }
.btn { border: none; border-radius: 6px; padding: 8px 16px; color: #fff; font-size: 13px; cursor: pointer; font-weight: 600; transition: all .2s; }
.btn-primary { background: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-green { background: #1b5e20; }
.btn-green:hover { background: #2e7d32; }
.btn-red { background: #b71c1c; }
.btn-red:hover { background: #d32f2f; }
.btn-sm { padding: 6px 12px; font-size: 12px; }

.call-table { width: 100%; border-collapse: collapse; }
.call-table th { text-align: left; padding: 10px 12px; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--accent); border-bottom: 1px solid var(--border-light); }
.call-table td { padding: 10px 12px; font-size: 13px; border-bottom: 1px solid var(--border); }
.call-table tr:hover { background: var(--table-hover); cursor: pointer; }

.sentiment { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.sentiment.positivo { background: #1b5e2033; color: #4caf50; }
.sentiment.neutro { background: #37474f33; color: #90a4ae; }
.sentiment.negativo { background: #b71c1c33; color: #ef5350; }
.sentiment.irritado { background: #e6510033; color: #ff9800; }

.status-badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; }
.status-badge.ended { background: #33333380; color: #888; }
.status-badge.active { background: #1b5e2033; color: #4caf50; }
.status-badge.transferred { background: #0d47a133; color: #42a5f5; }

.modal { display: none; position: fixed; inset: 0; background: var(--overlay-bg); z-index: 200; align-items: center; justify-content: center; }
.modal.show { display: flex; }
.modal-content { background: var(--modal-bg); border-radius: 12px; padding: 24px; max-width: 600px; width: 90%; max-height: 80vh; overflow-y: auto; border: 1px solid var(--border-input); }
.modal-content h3 { font-size: 16px; margin-bottom: 16px; }
.modal-close { float: right; background: none; border: none; color: var(--text-muted); font-size: 20px; cursor: pointer; }
.transcript { background: var(--bg-input); border-radius: 8px; padding: 12px; margin: 8px 0; font-size: 13px; line-height: 1.6; max-height: 400px; overflow-y: auto; }
.transcript .caller { color: var(--blue); }
.transcript .ai { color: var(--green); }

.toast { position: fixed; bottom: 20px; right: 20px; background: var(--toast-bg); border: 1px solid var(--accent); border-radius: 8px; padding: 12px 16px; color: var(--text); font-size: 13px; z-index: 999; transform: translateX(120%); transition: transform .3s ease; pointer-events: none; }
.toast.show { transform: translateX(0); }
.refresh-bar { height: 2px; background: var(--accent); transition: width 10s linear; position: fixed; top: 0; left: 0; z-index: 100; }
.version { padding: 12px 24px; font-size: 11px; color: var(--text-dimmest); border-top: 1px solid var(--border); }

.dialpad-btn { background: var(--bg-card); border: 1px solid var(--border-input); border-radius: 10px; color: var(--stat-color); font-size: 22px; font-weight: 600; padding: 14px; cursor: pointer; transition: all .15s; line-height: 1.1; }
.dialpad-btn:hover { background: var(--border); }
.dialpad-btn:active { background: var(--accent); transform: scale(0.95); }
.dialpad-btn span { display: block; font-size: 9px; color: var(--text-dim); font-weight: 400; letter-spacing: 2px; }

/* Central tab split layout */
.central-layout { max-width: 500px; margin: 0 auto; }
.central-left { display: none; }
.central-right { display: none; }

/* Sistema tab collapsible sections */
.sistema-section { margin-bottom: 12px; }
.sistema-section summary { padding: 14px 16px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--text); list-style: none; display: flex; align-items: center; gap: 10px; transition: border-color 0.2s; }
.sistema-section summary:hover { border-color: var(--accent-border); }
.sistema-section summary::before { content: '▶'; font-size: 10px; color: var(--accent); transition: transform 0.2s; }
.sistema-section[open] summary::before { transform: rotate(90deg); }
.sistema-section[open] summary { border-radius: 10px 10px 0 0; border-bottom: none; }
.sistema-section .section-body { padding: 16px; background: var(--bg-input); border: 1px solid var(--border); border-top: none; border-radius: 0 0 10px 10px; }

/* Incoming call overlay */
.incoming-overlay { position: fixed; bottom: 24px; right: 24px; z-index: 1000; background: var(--bg-card); border: 1px solid var(--green); border-radius: 16px; padding: 20px; min-width: 280px; box-shadow: 0 8px 32px rgba(0,0,0,0.6), 0 0 20px #4caf5033; animation: slideUpIn 0.3s ease-out; display: none; }
.incoming-overlay.active { display: block; }
.incoming-overlay .caller-info { text-align: center; margin-bottom: 16px; }
.incoming-overlay .caller-number { font-size: 20px; font-weight: 700; color: var(--stat-color); margin-top: 8px; }
.incoming-overlay .caller-label { font-size: 12px; color: var(--text-muted); }
.incoming-overlay .call-actions { display: flex; gap: 12px; justify-content: center; }
.incoming-overlay .call-actions button { width: 56px; height: 56px; border-radius: 50%; border: none; font-size: 24px; cursor: pointer; transition: transform 0.15s; }
.incoming-overlay .call-actions button:hover { transform: scale(1.1); }
.incoming-overlay .btn-accept { background: #1b5e20; }
.incoming-overlay .btn-reject { background: #b71c1c; }

/* Mini bar chart for confirmations */
.mini-bar-chart { display: flex; align-items: flex-end; gap: 4px; height: 60px; }
.mini-bar-chart .bar-group { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.mini-bar-chart .bar-stack { display: flex; flex-direction: column-reverse; width: 100%; gap: 1px; }
.mini-bar-chart .bar { border-radius: 2px 2px 0 0; min-height: 2px; transition: height 0.3s; }
.mini-bar-chart .bar.confirmed { background: var(--green); }
.mini-bar-chart .bar.pending { background: var(--orange); }
.mini-bar-chart .bar-label { font-size: 9px; color: var(--text-dim); }

/* Sistema status indicators */
.sistema-status { float: right; font-size: 11px; font-weight: 600; margin-left: auto; }
.sistema-status.on { color: var(--green); }
.sistema-status.off { color: var(--red); }

/* Sparkline mini charts */
.sparkline { display: flex; align-items: flex-end; gap: 2px; height: 24px; margin: 6px 0 4px; }
.sparkline .spark-bar { flex: 1; background: var(--accent); border-radius: 1px 1px 0 0; min-height: 2px; transition: height 0.3s; opacity: 0.7; }
.sparkline .spark-bar:last-child { opacity: 1; }

/* Confirmation cards grid */
.conf-cards-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.conf-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 14px; transition: border-color 0.2s; }
.conf-card:hover { border-color: var(--accent-border); }
.conf-card .conf-card-name { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.conf-card .conf-card-event { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.conf-card .conf-card-status { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.conf-card .conf-card-dots { display: flex; gap: 4px; margin: 8px 0; font-size: 14px; }
.conf-card .conf-card-result { font-size: 11px; color: var(--text-muted); margin-bottom: 8px; }
.conf-card .conf-card-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.conf-card .conf-card-expand { font-size: 11px; color: var(--text-dim); cursor: pointer; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border-light); }
.conf-card .conf-card-expand:hover { color: var(--text-muted); }
.conf-card .conf-card-expandable { display: none; margin-top: 6px; font-size: 11px; color: var(--text-muted); white-space: pre-line; }

/* Table scroll wrapper for mobile */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Animations */
@keyframes slideUpIn { from { transform: translateY(40px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes pulseDot { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
@keyframes pulseCall { 0%,100% { opacity:1; } 50% { opacity:0.3; } }
.pulse-call { animation: pulseCall 1.5s ease-in-out infinite; }

.duallist-item:hover { background: var(--bg-card); }
.duallist-item.selected { background: var(--accent-bg); border-left: 2px solid var(--green); }

/* Theme toggle button */
.theme-toggle { background: none; border: 1px solid var(--border-input); border-radius: 8px; padding: 5px 10px; cursor: pointer; font-size: 16px; color: var(--text-muted); transition: all .2s; }
.theme-toggle:hover { border-color: var(--accent); color: var(--stat-color); }

/* Bottom nav for mobile */
.bottom-nav { display: none; position: fixed; bottom: 0; left: 0; right: 0; background: var(--bg-tabs); border-top: 1px solid var(--border-light); z-index: 90; padding: 4px 0; padding-bottom: env(safe-area-inset-bottom, 4px); }
.bottom-nav .nav-items { display: flex; justify-content: space-around; }
.bottom-nav .nav-item { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 8px; cursor: pointer; color: var(--text-dim); font-size: 10px; position: relative; transition: color 0.2s; }
.bottom-nav .nav-item.active { color: var(--stat-color); }
.bottom-nav .nav-item .nav-icon { font-size: 20px; }
.bottom-nav .nav-item .nav-badge { position: absolute; top: 2px; right: 2px; width: 8px; height: 8px; background: var(--red); border-radius: 50%; display: none; }
.bottom-nav .nav-item .nav-badge.visible { display: block; }

/* AutoScale collapsed by default */
.autoscale-details summary { padding: 10px 14px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; cursor: pointer; font-size: 12px; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: 1px; list-style: none; display: flex; align-items: center; gap: 6px; }
.autoscale-details summary::before { content: '▶'; font-size: 9px; transition: transform 0.2s; }
.autoscale-details[open] summary::before { transform: rotate(90deg); }
.autoscale-details[open] summary { border-radius: 8px 8px 0 0; }

@media (max-width: 768px) {
  .conf-cards-grid { grid-template-columns: 1fr; }
  .tabs { display: none; }
  .bottom-nav { display: block; }
  body { padding-bottom: 72px; }
  .header { padding: 12px 14px; }
  .header h1 { font-size: 16px; }
  .page { padding: 14px; }
  .stat { font-size: 28px; }
  .grid { grid-template-columns: 1fr 1fr; }
  .central-layout { max-width: 100%; }
  .central-left { display: none; }
  .central-right { display: none; }
  .ext-grid { grid-template-columns: 1fr 1fr; }
  .call-table { font-size: 11px; }
  .call-table th, .call-table td { padding: 8px 6px; }
  .incoming-overlay { left: 12px; right: 12px; bottom: 80px; }
  #callsStats { grid-template-columns: repeat(3, 1fr) !important; }
}

@media (max-width: 480px) {
  .grid { grid-template-columns: 1fr; }
  .ext-grid { grid-template-columns: 1fr; }
  #callsStats { grid-template-columns: 1fr 1fr !important; }
}
@media (max-width: 500px) {
  .central-auth-grid {
    grid-template-columns: 1fr !important;
  }
}

/* Light theme overrides for inline styles */
[data-theme="light"] .header { background: linear-gradient(135deg, #800f0f, #5a1212); }
[data-theme="light"] input, [data-theme="light"] select { background: var(--bg-input); border-color: var(--border-input); color: var(--text); }
[data-theme="light"] .btn { color: #fff; }
[data-theme="light"] [style*="background:#111"], [data-theme="light"] [style*="background: #111"],
[data-theme="light"] [style*="background:#0a0a0a"], [data-theme="light"] [style*="background: #0a0a0a"],
[data-theme="light"] [style*="background:#0d0d0d"], [data-theme="light"] [style*="background: #0d0d0d"] {
  background: var(--bg-input) !important;
}
[data-theme="light"] [style*="background:#1a1a1a"], [data-theme="light"] [style*="background: #1a1a1a"] {
  background: var(--bg-card) !important;
}
[data-theme="light"] [style*="background:#222"], [data-theme="light"] [style*="background: #222"],
[data-theme="light"] [style*="background:#333"], [data-theme="light"] [style*="background: #333"] {
  background: var(--border) !important;
}
[data-theme="light"] [style*="color:#fff"], [data-theme="light"] [style*="color: #fff"],
[data-theme="light"] [style*="color:#e0e0e0"], [data-theme="light"] [style*="color: #e0e0e0"] {
  color: var(--text) !important;
}
[data-theme="light"] [style*="color:#ccc"], [data-theme="light"] [style*="color: #ccc"],
[data-theme="light"] [style*="color:#aaa"], [data-theme="light"] [style*="color: #aaa"] {
  color: var(--text) !important;
}
[data-theme="light"] [style*="color:#888"], [data-theme="light"] [style*="color: #888"],
[data-theme="light"] [style*="color:#666"], [data-theme="light"] [style*="color: #666"] {
  color: var(--text-muted) !important;
}
[data-theme="light"] [style*="color:#555"], [data-theme="light"] [style*="color: #555"],
[data-theme="light"] [style*="color:#444"], [data-theme="light"] [style*="color: #444"] {
  color: var(--text-dimmer) !important;
}
[data-theme="light"] [style*="border-color:#222"], [data-theme="light"] [style*="border-color: #222"],
[data-theme="light"] [style*="border-color:#333"], [data-theme="light"] [style*="border-color: #333"] {
  border-color: var(--border) !important;
}
[data-theme="light"] [style*="border:1px solid #222"], [data-theme="light"] [style*="border: 1px solid #222"],
[data-theme="light"] [style*="border:1px solid #333"], [data-theme="light"] [style*="border: 1px solid #333"],
[data-theme="light"] [style*="border:1px solid #1a1a1a"], [data-theme="light"] [style*="border: 1px solid #1a1a1a"],
[data-theme="light"] [style*="border:1px solid #2a2a2a"] {
  border-color: var(--border) !important;
}
[data-theme="light"] [style*="box-shadow:0 4px 12px rgba(0,0,0"] {
  box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
}

/* Light theme for dynamically created elements */
[data-theme="light"] td, [data-theme="light"] th { color: var(--text); }
[data-theme="light"] hr { border-color: var(--border) !important; }
[data-theme="light"] ::placeholder { color: var(--text-dimmer) !important; }

/* Login page in light mode */
[data-theme="light"] #loginPage { background: var(--bg-main) !important; }
[data-theme="light"] #loginPage input { background: var(--bg-input) !important; border-color: var(--border-input) !important; color: var(--text) !important; }

/* Sentiment badges keep their colors in both themes */
.sentiment.positivo { background: #1b5e2033; color: #4caf50; }
.sentiment.neutro { background: #37474f33; color: #90a4ae; }
.sentiment.negativo { background: #b71c1c33; color: #ef5350; }
.sentiment.irritado { background: #e6510033; color: #ff9800; }
[data-theme="light"] .sentiment.positivo { background: #e8f5e9; color: #2e7d32; }
[data-theme="light"] .sentiment.neutro { background: #eceff1; color: #546e7a; }
[data-theme="light"] .sentiment.negativo { background: #ffebee; color: #c62828; }
[data-theme="light"] .sentiment.irritado { background: #fff3e0; color: #e65100; }

/* Status badges */
[data-theme="light"] .status-badge.ended { background: #e0e0e0; color: #666; }
[data-theme="light"] .status-badge.active { background: #e8f5e9; color: #2e7d32; }
[data-theme="light"] .status-badge.transferred { background: #e3f2fd; color: #1565c0; }

/* Light theme - Priority panel & WA Auth panel */
[data-theme="light"] [style*="background:#0a0a1a"] { background: #e8eaf6 !important; }
[data-theme="light"] [style*="border:1px solid #1a1a3a"], [data-theme="light"] [style*="border: 1px solid #1a1a3a"] { border-color: #9fa8da !important; }
[data-theme="light"] [style*="color:#a0a0e0"] { color: #3949ab !important; }
[data-theme="light"] [style*="background:#0a1a0a"] { background: #e8f5e9 !important; }
[data-theme="light"] [style*="border:1px solid #1a3a1a"], [data-theme="light"] [style*="border: 1px solid #1a3a1a"] { border-color: #81c784 !important; }
[data-theme="light"] [style*="background:#0a2a0a"] { background: #e8f5e9 !important; }
[data-theme="light"] [style*="border:1px solid #1a4a1a"], [data-theme="light"] [style*="border: 1px solid #1a4a1a"] { border-color: #81c784 !important; }
[data-theme="light"] [style*="background:#1a1a2a"] { background: #e8eaf6 !important; }
[data-theme="light"] [style*="color:#a0a0e0"] { color: #3949ab !important; }
[data-theme="light"] [style*="color:#ddd"] { color: #333 !important; }
[data-theme="light"] [style*="color: #ddd"] { color: #333 !important; }
[data-theme="light"] [style*="border-bottom:1px solid #111"] { border-bottom-color: #e0e0e0 !important; }
[data-theme="light"] [style*="color:#25d366"] { color: #1b8a3d !important; }

/* Priority panel */
.priority-panel { background: #0a0a1a; border: 1px solid #1a1a3a; border-radius: 8px; padding: 10px; margin-bottom: 12px; }
[data-theme="light"] .priority-panel { background: #e8eaf6; border-color: #9fa8da; }

/* WA Auth panel */
.wa-auth-panel { background: #0a1a0a; border: 1px solid #1a3a1a; border-radius: 8px; padding: 10px; margin-bottom: 12px; }
[data-theme="light"] .wa-auth-panel { background: #e8f5e9; border-color: #81c784; }

/* Panel text classes */
.priority-title { color: #a0a0e0; }
[data-theme="light"] .priority-title { color: #3949ab; }
.wa-auth-title { color: #25d366; }
[data-theme="light"] .wa-auth-title { color: #1b8a3d; }
.text-dim { color: #666; }
[data-theme="light"] .text-dim { color: #888; }
.text-dimmer { color: #555; }
[data-theme="light"] .text-dimmer { color: #999; }
.text-muted-t { color: #888; }
[data-theme="light"] .text-muted-t { color: #666; }

/* Panel row items (generated by JS) */
.panel-row { border-bottom: 1px solid #1a1a1a; }
[data-theme="light"] .panel-row { border-bottom-color: #e0e0e0; }
.panel-row-phone { color: #ddd; }
[data-theme="light"] .panel-row-phone { color: #333; }
.panel-row-inactive { color: #666; }
[data-theme="light"] .panel-row-inactive { color: #999; }

/* Stat cards (calls page) */
.stat-card { border-radius: 8px; padding: 10px; text-align: center; }
.stat-card-value { font-size: 20px; font-weight: 700; }
.stat-card-label { font-size: 10px; color: var(--text-muted); }
.stat-card-default { background: var(--bg-input); }
.stat-card-green { background: #0a1a0a; }
.stat-card-red { background: #1a0a0a; }
.stat-card-blue { background: #0a0a1a; }
.stat-card-orange { background: #1a1a0a; }
[data-theme="light"] .stat-card-default { background: #f5f5f5; }
[data-theme="light"] .stat-card-green { background: #e8f5e9; }
[data-theme="light"] .stat-card-red { background: #ffebee; }
[data-theme="light"] .stat-card-blue { background: #e3f2fd; }
[data-theme="light"] .stat-card-orange { background: #fff3e0; }
.stat-green { color: var(--green); }
.stat-red { color: var(--red); }
.stat-blue { color: var(--blue); }
.stat-orange { color: var(--orange); }

/* Tempo Real page */
.tr-title { color: var(--stat-color); }
.tr-section-title { color: var(--text); }
.tr-empty-state { color: var(--text-dimmer); text-align: center; padding: 16px; background: var(--bg-input); border: 1px solid var(--border); border-radius: 8px; }
.spy-panel { background: #0a0a14; border: 1px solid var(--border-light); border-radius: 8px; padding: 12px; margin-bottom: 14px; }
[data-theme="light"] .spy-panel { background: #eee8f5; border-color: #b39ddb; }
.text-dimmest { color: var(--text-dimmest); }

/* Subtle buttons for both themes */
.btn-subtle-blue { background: #1a1a2a; color: #a0a0e0; }
.btn-subtle-green { background: #1a2a1a; color: #4caf50; }
.btn-subtle-red { background: #2a1a1a; color: #ef5350; }
[data-theme="light"] .btn-subtle-blue { background: #e8eaf6; color: #3949ab; }
[data-theme="light"] .btn-subtle-green { background: #e8f5e9; color: #2e7d32; }
[data-theme="light"] .btn-subtle-red { background: #ffebee; color: #c62828; }

/* ===== GLOBAL LIGHT THEME OVERRIDES FOR ALL PAGES ===== */

/* All elements inside page containers */
[data-theme="light"] .page [style*="background:#0a0a0a"],
[data-theme="light"] .page [style*="background: #0a0a0a"],
[data-theme="light"] .page [style*="background:#0a0a14"] { background: #f0f0f5 !important; }

[data-theme="light"] .page [style*="background:#111"],
[data-theme="light"] .page [style*="background: #111"] { background: #f5f5f5 !important; }

[data-theme="light"] .page [style*="background:#1a1a1a"],
[data-theme="light"] .page [style*="background: #1a1a1a"] { background: #fff !important; }

[data-theme="light"] .page [style*="background:#222"],
[data-theme="light"] .page [style*="background: #222"],
[data-theme="light"] .page [style*="background:#333"],
[data-theme="light"] .page [style*="background: #333"] { background: #e0e0e0 !important; }

[data-theme="light"] .page [style*="background:#0a0a1a"] { background: #e8eaf6 !important; }
[data-theme="light"] .page [style*="background:#0a1a0a"] { background: #e8f5e9 !important; }
[data-theme="light"] .page [style*="background:#1a0a0a"] { background: #ffebee !important; }
[data-theme="light"] .page [style*="background:#1a1a0a"] { background: #fff3e0 !important; }
[data-theme="light"] .page [style*="background:#4a1a1a"] { background: #ffcdd2 !important; }
[data-theme="light"] .page [style*="background:#1a4a1a"] { background: #c8e6c9 !important; }
[data-theme="light"] .page [style*="background:#1a1a2a"] { background: #e8eaf6 !important; }
[data-theme="light"] .page [style*="background:#0a2a0a"] { background: #e8f5e9 !important; }

[data-theme="light"] .page [style*="background:transparent"] { background: transparent !important; }

/* Text colors */
[data-theme="light"] .page [style*="color:#fff"],
[data-theme="light"] .page [style*="color: #fff"],
[data-theme="light"] .page [style*="color:#e0e0e0"],
[data-theme="light"] .page [style*="color: #e0e0e0"] { color: var(--text) !important; }

[data-theme="light"] .page [style*="color:#ccc"],
[data-theme="light"] .page [style*="color: #ccc"] { color: #444 !important; }

[data-theme="light"] .page [style*="color:#aaa"],
[data-theme="light"] .page [style*="color: #aaa"] { color: #555 !important; }

[data-theme="light"] .page [style*="color:#888"],
[data-theme="light"] .page [style*="color: #888"] { color: #666 !important; }

[data-theme="light"] .page [style*="color:#666"],
[data-theme="light"] .page [style*="color: #666"] { color: #777 !important; }

[data-theme="light"] .page [style*="color:#555"],
[data-theme="light"] .page [style*="color: #555"] { color: #888 !important; }

[data-theme="light"] .page [style*="color:#444"],
[data-theme="light"] .page [style*="color: #444"] { color: #999 !important; }

[data-theme="light"] .page [style*="color:#333"],
[data-theme="light"] .page [style*="color: #333"] { color: #bbb !important; }

[data-theme="light"] .page [style*="color:#ddd"],
[data-theme="light"] .page [style*="color: #ddd"] { color: #333 !important; }

[data-theme="light"] .page [style*="color:#a0a0e0"] { color: #3949ab !important; }
[data-theme="light"] .page [style*="color:#e05050"] { color: #c62828 !important; }

/* Borders */
[data-theme="light"] .page [style*="border:1px solid #222"],
[data-theme="light"] .page [style*="border: 1px solid #222"],
[data-theme="light"] .page [style*="border:1px solid #333"],
[data-theme="light"] .page [style*="border: 1px solid #333"],
[data-theme="light"] .page [style*="border:1px solid #1a1a1a"],
[data-theme="light"] .page [style*="border: 1px solid #1a1a1a"],
[data-theme="light"] .page [style*="border:1px solid #2a2a2a"],
[data-theme="light"] .page [style*="border: 1px solid #2a2a2a"] { border-color: var(--border) !important; }

/* Selects & inputs inside pages */
[data-theme="light"] .page select,
[data-theme="light"] .page input[type="text"],
[data-theme="light"] .page input[type="tel"],
[data-theme="light"] .page input[type="password"] {
  background: var(--bg-input) !important;
  color: var(--text) !important;
  border-color: var(--border-input) !important;
}

/* Buttons */
[data-theme="light"] .page button[style*="background:#333"],
[data-theme="light"] .page button[style*="background: #333"] { background: #e0e0e0 !important; color: #333 !important; }

[data-theme="light"] .page button[style*="background:transparent"] { background: transparent !important; color: #888 !important; }

/* Confirmation page specific */
[data-theme="light"] .page [style*="height:10px;background:#333"] { background: #ddd !important; }
[data-theme="light"] .page [style*="height:4px;background:#222"] { background: #ddd !important; }

/* Table inside pages */
[data-theme="light"] .page td { color: var(--text); border-bottom-color: var(--border); }
[data-theme="light"] .page th { color: var(--accent); border-bottom-color: var(--border); }
