/**
 * PeepConnect / Abel Odorico — Design system: 4 temas premium
 * 2026-05-18 — obsidian-core · aurora-light · neon-grid · crimson-opera
 * Grid 4px · Inter + Rajdhani (display)
 */

/* -------------------------------------------------------------------------- */
/* Tipografia & escala global                                                  */
/* -------------------------------------------------------------------------- */

html {
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Rajdhani", "Inter", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "SF Mono", "Roboto Mono", ui-monospace, monospace;

  --radius-sm: 10px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --space-1: 4px;  --space-2: 8px;   --space-3: 12px;
  --space-4: 16px; --space-5: 20px;  --space-6: 24px;
  --space-8: 32px; --space-10: 40px; --space-12: 48px;

  --ease-out: cubic-bezier(0.25, 1, 0.5, 1);
  --duration-fast: 160ms;
  --duration-ui: 180ms;

  font-family: var(--font-sans);
}

/* -------------------------------------------------------------------------- */
/* TEMA 1 — OBSIDIAN CORE (dark premium, Enterprise)                          */
/* -------------------------------------------------------------------------- */

html[data-theme="obsidian-core"],
html[data-theme="dark"] {
  color-scheme: dark;

  /* tokens novos */
  --bg-primary:      #050816;
  --bg-secondary:    #0C192C;
  --surface:         #0F172A;
  --surface-elevated:#111827;
  --surface-modal:   #111827;
  --surface-popover: #0F172A;
  --text-primary:    #FFFFFF;
  --text-secondary:  rgba(255,255,255,.76);
  --text-muted:      rgba(255,255,255,.56);
  --text-inverse:    #050816;
  --border-primary:  rgba(255,255,255,.08);
  --border-secondary:rgba(255,255,255,.14);
  --brand-primary:   #1F74FF;
  --brand-accent:    #E51E2A;
  --brand-premium:   #FFD700;
  --button-bg:       #1F74FF;
  --button-text:     #FFFFFF;
  --button-hover:    #3B82F6;
  --input-bg:        #0B1220;
  --input-text:      #FFFFFF;
  --input-border:    rgba(255,255,255,.12);
  --input-placeholder: rgba(255,255,255,.42);
  --modal-bg:        #111827;
  --modal-text:      #FFFFFF;
  --dropdown-bg:     #0F172A;
  --dropdown-text:   #FFFFFF;
  --tooltip-bg:      #FFFFFF;
  --tooltip-text:    #050816;
  --table-bg:        #0F172A;
  --table-text:      #FFFFFF;
  --table-border:    rgba(255,255,255,.08);
  --shadow-soft:     0 16px 40px rgba(0,0,0,.28);
  --shadow-elevated: 0 28px 80px rgba(0,0,0,.42);
  --focus-ring:      0 0 0 3px rgba(31,116,255,.35);
  --chart-grid:      rgba(255,255,255,.06);

  /* aliases legado (sidebar, nav, etc.) */
  --bg-base:                var(--bg-primary);
  --bg-elevated:            var(--bg-secondary);
  --bg-surface:             var(--surface-elevated);
  --bg-surface-glass:       rgba(17,24,39,.75);
  --border-default:         var(--border-primary);
  --border-strong:          var(--border-secondary);
  --accent-primary:         var(--brand-primary);
  --accent-primary-hover:   var(--button-hover);
  --accent-primary-muted:   rgba(31,116,255,.18);
  --accent-danger:          var(--brand-accent);
  --accent-danger-muted:    rgba(229,30,42,.15);
  --accent-premium:         var(--brand-premium);
  --shell-sidebar-bg:       var(--bg-surface);
  --shell-sidebar-border:   var(--border-default);
  --shell-header-bg:        rgba(17,24,39,.85);
  --shell-header-border:    var(--border-default);
  --shell-overlay:          rgba(5,8,22,.60);
  --nav-item-hover:         rgba(255,255,255,.06);
  --nav-item-active-bg:     rgba(31,116,255,.16);
  --nav-item-active-text:   #93c5fd;
  --shadow-card:            0 0 0 1px var(--border-default), 0 12px 40px rgba(0,0,0,.35);
  --shadow-popover:         var(--shadow-elevated);
  --color-text-primary:     var(--text-primary);
  --color-text-secondary:   var(--text-secondary);
  --color-text-tertiary:    var(--text-muted);
  --color-bg-primary:       var(--bg-surface);
  --color-bg-secondary:     var(--bg-elevated);
  --color-bg-tertiary:      var(--bg-base);
  --color-border:           var(--border-default);
  --color-primary:          var(--accent-primary);
  --color-primary-hover:    var(--accent-primary-hover);
  --color-primary-light:    var(--accent-primary-muted);
  --status-success:         #34d399;
  --status-warning:         #fbbf24;
  --status-error:           #f87171;
  --text-tertiary:          var(--text-muted);
}

/* -------------------------------------------------------------------------- */
/* TEMA 2 — AURORA LIGHT (Apple/Stripe/Notion clean)                          */
/* -------------------------------------------------------------------------- */

html[data-theme="aurora-light"],
html[data-theme="light"] {
  color-scheme: light;

  --bg-primary:      #F8FAFC;
  --bg-secondary:    #EEF2FF;
  --surface:         #FFFFFF;
  --surface-elevated:#FFFFFF;
  --surface-modal:   #FFFFFF;
  --surface-popover: #FFFFFF;
  --text-primary:    #0F172A;
  --text-secondary:  #475569;
  --text-muted:      #64748B;
  --text-inverse:    #FFFFFF;
  --border-primary:  rgba(15,23,42,.08);
  --border-secondary:rgba(15,23,42,.14);
  --brand-primary:   #2563EB;
  --brand-accent:    #FF5A36;
  --brand-premium:   #B7791F;
  --button-bg:       #2563EB;
  --button-text:     #FFFFFF;
  --button-hover:    #1D4ED8;
  --input-bg:        #FFFFFF;
  --input-text:      #0F172A;
  --input-border:    rgba(15,23,42,.14);
  --input-placeholder: #94A3B8;
  --modal-bg:        #FFFFFF;
  --modal-text:      #0F172A;
  --dropdown-bg:     #FFFFFF;
  --dropdown-text:   #0F172A;
  --tooltip-bg:      #0F172A;
  --tooltip-text:    #FFFFFF;
  --table-bg:        #FFFFFF;
  --table-text:      #0F172A;
  --table-border:    rgba(15,23,42,.08);
  --shadow-soft:     0 12px 32px rgba(15,23,42,.08);
  --shadow-elevated: 0 24px 70px rgba(15,23,42,.14);
  --focus-ring:      0 0 0 3px rgba(37,99,235,.25);
  --chart-grid:      #f1f5f9;

  /* aliases legado */
  --bg-base:              var(--bg-primary);
  --bg-elevated:          var(--bg-secondary);
  --bg-surface:           var(--surface);
  --bg-surface-glass:     rgba(255,255,255,.72);
  --border-default:       var(--border-primary);
  --border-strong:        var(--border-secondary);
  --accent-primary:       var(--brand-primary);
  --accent-primary-hover: var(--button-hover);
  --accent-primary-muted: rgba(37,99,235,.12);
  --accent-danger:        var(--brand-accent);
  --accent-danger-muted:  rgba(255,90,54,.1);
  --accent-premium:       var(--brand-premium);
  --shell-sidebar-bg:     var(--bg-surface);
  --shell-sidebar-border: var(--border-default);
  --shell-header-bg:      rgba(255,255,255,.82);
  --shell-header-border:  var(--border-default);
  --shell-overlay:        rgba(15,23,42,.45);
  --nav-item-hover:       rgba(37,99,235,.06);
  --nav-item-active-bg:   rgba(37,99,235,.12);
  --nav-item-active-text: #1D4ED8;
  --shadow-card:          var(--shadow-soft), 0 0 0 1px var(--border-default);
  --shadow-popover:       var(--shadow-elevated);
  --color-text-primary:   var(--text-primary);
  --color-text-secondary: var(--text-secondary);
  --color-text-tertiary:  var(--text-muted);
  --color-bg-primary:     var(--bg-surface);
  --color-bg-secondary:   var(--bg-elevated);
  --color-bg-tertiary:    var(--bg-base);
  --color-border:         var(--border-default);
  --color-primary:        var(--accent-primary);
  --color-primary-hover:  var(--accent-primary-hover);
  --color-primary-light:  var(--accent-primary-muted);
  --status-success:       #0d9488;
  --status-warning:       #d97706;
  --status-error:         var(--accent-danger);
  --text-tertiary:        var(--text-muted);
}

/* -------------------------------------------------------------------------- */
/* TEMA 3 — NEON GRID (Arc/Raycast, futurista premium)                        */
/* -------------------------------------------------------------------------- */

html[data-theme="neon-grid"] {
  color-scheme: dark;

  --bg-primary:      #020617;
  --bg-secondary:    #03111F;
  --surface:         #071226;
  --surface-elevated:rgba(8,22,42,.92);
  --surface-modal:   #071226;
  --surface-popover: #081A2F;
  --text-primary:    #E2F8FF;
  --text-secondary:  #A8D8E8;
  --text-muted:      #6EA9BD;
  --text-inverse:    #020617;
  --border-primary:  rgba(0,224,255,.16);
  --border-secondary:rgba(0,255,179,.18);
  --brand-primary:   #00E0FF;
  --brand-accent:    #00FFB3;
  --brand-premium:   #7CFFCB;
  --button-bg:       #00E0FF;
  --button-text:     #020617;
  --button-hover:    #00FFB3;
  --input-bg:        rgba(3,17,31,.86);
  --input-text:      #E2F8FF;
  --input-border:    rgba(0,224,255,.22);
  --input-placeholder: rgba(168,216,232,.52);
  --modal-bg:        #071226;
  --modal-text:      #E2F8FF;
  --dropdown-bg:     #081A2F;
  --dropdown-text:   #E2F8FF;
  --tooltip-bg:      #00E0FF;
  --tooltip-text:    #020617;
  --table-bg:        #071226;
  --table-text:      #E2F8FF;
  --table-border:    rgba(0,224,255,.14);
  --shadow-soft:     0 0 28px rgba(0,224,255,.10);
  --shadow-elevated: 0 0 60px rgba(0,224,255,.18);
  --focus-ring:      0 0 0 3px rgba(0,224,255,.30);
  --chart-grid:      rgba(0,224,255,.07);

  /* aliases legado */
  --bg-base:              var(--bg-primary);
  --bg-elevated:          var(--bg-secondary);
  --bg-surface:           var(--surface);
  --bg-surface-glass:     rgba(7,18,38,.80);
  --border-default:       var(--border-primary);
  --border-strong:        var(--border-secondary);
  --accent-primary:       var(--brand-primary);
  --accent-primary-hover: var(--button-hover);
  --accent-primary-muted: rgba(0,224,255,.15);
  --accent-danger:        #FF4D6D;
  --accent-danger-muted:  rgba(255,77,109,.12);
  --accent-premium:       var(--brand-premium);
  --shell-sidebar-bg:     rgba(7,18,38,.95);
  --shell-sidebar-border: var(--border-default);
  --shell-header-bg:      rgba(2,6,23,.88);
  --shell-header-border:  var(--border-default);
  --shell-overlay:        rgba(2,6,23,.65);
  --nav-item-hover:       rgba(0,224,255,.08);
  --nav-item-active-bg:   rgba(0,224,255,.14);
  --nav-item-active-text: #00E0FF;
  --shadow-card:          0 0 0 1px var(--border-default), var(--shadow-soft);
  --shadow-popover:       var(--shadow-elevated);
  --color-text-primary:   var(--text-primary);
  --color-text-secondary: var(--text-secondary);
  --color-text-tertiary:  var(--text-muted);
  --color-bg-primary:     var(--bg-surface);
  --color-bg-secondary:   var(--bg-elevated);
  --color-bg-tertiary:    var(--bg-base);
  --color-border:         var(--border-default);
  --color-primary:        var(--accent-primary);
  --color-primary-hover:  var(--accent-primary-hover);
  --color-primary-light:  var(--accent-primary-muted);
  --status-success:       #00FFB3;
  --status-warning:       #FFE566;
  --status-error:         #FF4D6D;
  --text-tertiary:        var(--text-muted);
}

/* Grid background para neon-grid */
html[data-theme="neon-grid"] body {
  background:
    linear-gradient(rgba(0,224,255,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,224,255,.035) 1px, transparent 1px),
    var(--bg-primary);
  background-size: 32px 32px, 32px 32px, 100% 100%;
}

/* -------------------------------------------------------------------------- */
/* TEMA 4 — CRIMSON OPERA (luxo tech, fintech premium)                        */
/* -------------------------------------------------------------------------- */

html[data-theme="crimson-opera"] {
  color-scheme: dark;

  --bg-primary:      #09090B;
  --bg-secondary:    #13080B;
  --surface:         #18181B;
  --surface-elevated:rgba(30,18,20,.92);
  --surface-modal:   #18181B;
  --surface-popover: #201014;
  --text-primary:    #FAFAFA;
  --text-secondary:  #D4D4D8;
  --text-muted:      #A1A1AA;
  --text-inverse:    #09090B;
  --border-primary:  rgba(229,30,42,.18);
  --border-secondary:rgba(255,215,0,.16);
  --brand-primary:   #E51E2A;
  --brand-accent:    #FF4D6D;
  --brand-premium:   #FFD700;
  --button-bg:       #E51E2A;
  --button-text:     #FFFFFF;
  --button-hover:    #FF4D6D;
  --input-bg:        rgba(24,24,27,.92);
  --input-text:      #FAFAFA;
  --input-border:    rgba(229,30,42,.24);
  --input-placeholder: rgba(250,250,250,.44);
  --modal-bg:        #18181B;
  --modal-text:      #FAFAFA;
  --dropdown-bg:     #201014;
  --dropdown-text:   #FAFAFA;
  --tooltip-bg:      #FFD700;
  --tooltip-text:    #09090B;
  --table-bg:        #18181B;
  --table-text:      #FAFAFA;
  --table-border:    rgba(229,30,42,.16);
  --shadow-soft:     0 18px 45px rgba(229,30,42,.10);
  --shadow-elevated: 0 32px 90px rgba(229,30,42,.18);
  --focus-ring:      0 0 0 3px rgba(229,30,42,.32);
  --chart-grid:      rgba(229,30,42,.07);

  /* aliases legado */
  --bg-base:              var(--bg-primary);
  --bg-elevated:          var(--bg-secondary);
  --bg-surface:           var(--surface);
  --bg-surface-glass:     rgba(24,24,27,.80);
  --border-default:       var(--border-primary);
  --border-strong:        var(--border-secondary);
  --accent-primary:       var(--brand-primary);
  --accent-primary-hover: var(--button-hover);
  --accent-primary-muted: rgba(229,30,42,.15);
  --accent-danger:        var(--brand-accent);
  --accent-danger-muted:  rgba(229,30,42,.12);
  --accent-premium:       var(--brand-premium);
  --shell-sidebar-bg:     rgba(9,9,11,.96);
  --shell-sidebar-border: var(--border-default);
  --shell-header-bg:      rgba(9,9,11,.90);
  --shell-header-border:  var(--border-default);
  --shell-overlay:        rgba(9,9,11,.65);
  --nav-item-hover:       rgba(229,30,42,.08);
  --nav-item-active-bg:   rgba(229,30,42,.14);
  --nav-item-active-text: #FF4D6D;
  --shadow-card:          0 0 0 1px var(--border-default), var(--shadow-soft);
  --shadow-popover:       var(--shadow-elevated);
  --color-text-primary:   var(--text-primary);
  --color-text-secondary: var(--text-secondary);
  --color-text-tertiary:  var(--text-muted);
  --color-bg-primary:     var(--bg-surface);
  --color-bg-secondary:   var(--bg-elevated);
  --color-bg-tertiary:    var(--bg-base);
  --color-border:         var(--border-default);
  --color-primary:        var(--accent-primary);
  --color-primary-hover:  var(--accent-primary-hover);
  --color-primary-light:  var(--accent-primary-muted);
  --status-success:       #4ADE80;
  --status-warning:       #FFD700;
  --status-error:         #FF4D6D;
  --text-tertiary:        var(--text-muted);
}

/* Overlay dramático crimson-opera */
html[data-theme="crimson-opera"] body {
  background:
    radial-gradient(circle at top right, rgba(229,30,42,.14), transparent 34%),
    radial-gradient(circle at bottom left, rgba(255,215,0,.08), transparent 28%),
    var(--bg-primary);
}

/* Fallback antes do JS */
html:not([data-theme]) {
  color-scheme: dark;
  --bg-base: #050816;
  --bg-elevated: #0c192c;
  --bg-surface: #111827;
  --border-default: rgba(255,255,255,.06);
  --border-strong: rgba(255,255,255,.10);
  --text-primary: #ffffff;
  --text-secondary: rgba(255,255,255,.72);
  --text-tertiary: rgba(255,255,255,.50);
  --accent-primary: #1f74ff;
  --shell-sidebar-bg: #111827;
  --shell-sidebar-border: rgba(255,255,255,.06);
  --shell-header-bg: rgba(17,24,39,.82);
  --shell-header-border: rgba(255,255,255,.06);
  --nav-item-hover: rgba(255,255,255,.06);
  --nav-item-active-bg: rgba(31,116,255,.18);
  --nav-item-active-text: #93c5fd;
  --bg-primary: #050816;
  --bg-secondary: #0c192c;
  --surface: #0F172A;
  --surface-elevated: #111827;
  --surface-modal: #111827;
  --modal-bg: #111827;
  --modal-text: #ffffff;
  --dropdown-bg: #0F172A;
  --dropdown-text: #ffffff;
  --table-bg: #0F172A;
  --table-text: #ffffff;
  --brand-primary: #1f74ff;
  --input-bg: #0B1220;
  --input-text: #ffffff;
  --input-border: rgba(255,255,255,.12);
  --input-placeholder: rgba(255,255,255,.42);
  --shadow-soft: 0 16px 40px rgba(0,0,0,.28);
  --shadow-elevated: 0 28px 80px rgba(0,0,0,.42);
  --chart-grid: rgba(255,255,255,.06);
}

/* -------------------------------------------------------------------------- */
/* Base                                                                        */
/* -------------------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
  transition:
    background-color .18s ease,
    color .18s ease,
    border-color .18s ease,
    box-shadow .18s ease;
}

/* Excluir transições onde causam glitch */
*::before, *::after {
  transition: none;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background-color: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.peep-headline {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
}

::selection {
  background: var(--accent-primary-muted, rgba(31,116,255,.18));
  color: var(--text-primary);
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* Scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong, rgba(255,255,255,.1)) transparent;
}
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; }

/* -------------------------------------------------------------------------- */
/* Utilitários de tema                                                         */
/* -------------------------------------------------------------------------- */

.peep-glass {
  background: var(--bg-surface-glass);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-default);
}

.peep-card {
  background: var(--color-bg-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
.peep-card:hover { border-color: var(--border-strong); }

.peep-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-5);
  min-height: 40px;
  font-weight: 600;
  font-size: 14px;
  color: var(--button-text);
  background: var(--button-bg);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,.2);
  transition: background .16s ease, box-shadow .16s ease, transform .16s ease;
}
.peep-btn-primary:hover { background: var(--button-hover); }
.peep-btn-primary:active { transform: scale(0.98); }

/* Skeleton */
@keyframes peep-shimmer { 100% { transform: translateX(100%); } }
.peep-skeleton {
  position: relative;
  overflow: hidden;
  background: var(--color-bg-secondary);
  border-radius: var(--radius-sm);
}
.peep-skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.06), transparent);
  animation: peep-shimmer 1.2s infinite;
}
html[data-theme="aurora-light"] .peep-skeleton::after,
html[data-theme="light"] .peep-skeleton::after {
  background: linear-gradient(90deg, transparent, rgba(37,99,235,.07), transparent);
}

/* -------------------------------------------------------------------------- */
/* Componentes base por tokens                                                 */
/* -------------------------------------------------------------------------- */

.modal, .dialog, .popup {
  background: var(--modal-bg);
  color: var(--modal-text);
  border: 1px solid var(--border-primary);
  box-shadow: var(--shadow-elevated);
}

.dropdown, .popover, .menu {
  background: var(--dropdown-bg);
  color: var(--dropdown-text);
  border: 1px solid var(--border-primary);
}

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

/* -------------------------------------------------------------------------- */
/* Overrides Tailwind — dark themes (obsidian-core + neon-grid + crimson-opera)*/
/* -------------------------------------------------------------------------- */

html[data-theme="dark"] .bg-white,
html[data-theme="dark"] .bg-slate-50,
html[data-theme="obsidian-core"] .bg-white,
html[data-theme="obsidian-core"] .bg-slate-50,
html[data-theme="neon-grid"] .bg-white,
html[data-theme="neon-grid"] .bg-slate-50,
html[data-theme="crimson-opera"] .bg-white,
html[data-theme="crimson-opera"] .bg-slate-50 {
  background-color: var(--surface-elevated) !important;
}

html[data-theme="dark"] .bg-slate-100,
html[data-theme="obsidian-core"] .bg-slate-100,
html[data-theme="neon-grid"] .bg-slate-100,
html[data-theme="crimson-opera"] .bg-slate-100 {
  background-color: var(--bg-secondary) !important;
}

html[data-theme="dark"] .border-slate-100,
html[data-theme="dark"] .border-slate-200,
html[data-theme="obsidian-core"] .border-slate-100,
html[data-theme="obsidian-core"] .border-slate-200,
html[data-theme="neon-grid"] .border-slate-100,
html[data-theme="neon-grid"] .border-slate-200,
html[data-theme="crimson-opera"] .border-slate-100,
html[data-theme="crimson-opera"] .border-slate-200 {
  border-color: var(--border-primary) !important;
}

html[data-theme="dark"] .text-slate-900,
html[data-theme="dark"] .text-slate-800,
html[data-theme="obsidian-core"] .text-slate-900,
html[data-theme="obsidian-core"] .text-slate-800,
html[data-theme="neon-grid"] .text-slate-900,
html[data-theme="neon-grid"] .text-slate-800,
html[data-theme="crimson-opera"] .text-slate-900,
html[data-theme="crimson-opera"] .text-slate-800 {
  color: var(--text-primary) !important;
}

html[data-theme="dark"] .text-slate-700,
html[data-theme="obsidian-core"] .text-slate-700,
html[data-theme="neon-grid"] .text-slate-700,
html[data-theme="crimson-opera"] .text-slate-700 {
  color: var(--text-secondary) !important;
}

html[data-theme="dark"] .text-slate-600,
html[data-theme="obsidian-core"] .text-slate-600,
html[data-theme="neon-grid"] .text-slate-600,
html[data-theme="crimson-opera"] .text-slate-600 {
  color: var(--text-secondary) !important;
}

html[data-theme="dark"] .text-slate-500,
html[data-theme="obsidian-core"] .text-slate-500,
html[data-theme="neon-grid"] .text-slate-500,
html[data-theme="crimson-opera"] .text-slate-500 {
  color: var(--text-secondary) !important;
}

html[data-theme="dark"] .text-slate-400,
html[data-theme="obsidian-core"] .text-slate-400,
html[data-theme="neon-grid"] .text-slate-400,
html[data-theme="crimson-opera"] .text-slate-400 {
  color: var(--text-muted) !important;
}

html[data-theme="dark"] .text-blue-600,
html[data-theme="obsidian-core"] .text-blue-600 {
  color: var(--brand-primary) !important;
}
html[data-theme="neon-grid"] .text-blue-600 {
  color: var(--brand-primary) !important;
}
html[data-theme="crimson-opera"] .text-blue-600 {
  color: #f87171 !important;
}

html[data-theme="dark"] .bg-blue-50,
html[data-theme="obsidian-core"] .bg-blue-50 {
  background-color: var(--accent-primary-muted) !important;
}
html[data-theme="neon-grid"] .bg-blue-50 {
  background-color: rgba(0,224,255,.12) !important;
}
html[data-theme="crimson-opera"] .bg-blue-50 {
  background-color: rgba(229,30,42,.10) !important;
}

html[data-theme="dark"] .bg-blue-600,
html[data-theme="obsidian-core"] .bg-blue-600,
html[data-theme="neon-grid"] .bg-blue-600,
html[data-theme="crimson-opera"] .bg-blue-600 {
  background-color: var(--accent-primary) !important;
}

html[data-theme="dark"] .hover\:bg-slate-50:hover,
html[data-theme="dark"] .hover\:bg-white:hover,
html[data-theme="obsidian-core"] .hover\:bg-slate-50:hover,
html[data-theme="obsidian-core"] .hover\:bg-white:hover,
html[data-theme="neon-grid"] .hover\:bg-slate-50:hover,
html[data-theme="neon-grid"] .hover\:bg-white:hover,
html[data-theme="crimson-opera"] .hover\:bg-slate-50:hover,
html[data-theme="crimson-opera"] .hover\:bg-white:hover {
  background-color: var(--nav-item-hover) !important;
}

html[data-theme="dark"] .shadow-sm,
html[data-theme="obsidian-core"] .shadow-sm,
html[data-theme="neon-grid"] .shadow-sm,
html[data-theme="crimson-opera"] .shadow-sm {
  box-shadow: var(--shadow-card) !important;
}

html[data-theme="dark"] thead.bg-slate-50,
html[data-theme="obsidian-core"] thead.bg-slate-50,
html[data-theme="neon-grid"] thead.bg-slate-50,
html[data-theme="crimson-opera"] thead.bg-slate-50 {
  background-color: var(--bg-secondary) !important;
}

html[data-theme="dark"] thead th,
html[data-theme="obsidian-core"] thead th,
html[data-theme="neon-grid"] thead th,
html[data-theme="crimson-opera"] thead th {
  color: var(--text-primary) !important;
}

html[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]),
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="obsidian-core"] input:not([type="checkbox"]):not([type="radio"]),
html[data-theme="obsidian-core"] select,
html[data-theme="obsidian-core"] textarea,
html[data-theme="neon-grid"] input:not([type="checkbox"]):not([type="radio"]),
html[data-theme="neon-grid"] select,
html[data-theme="neon-grid"] textarea,
html[data-theme="crimson-opera"] input:not([type="checkbox"]):not([type="radio"]),
html[data-theme="crimson-opera"] select,
html[data-theme="crimson-opera"] textarea {
  background-color: var(--input-bg) !important;
  color: var(--input-text) !important;
  border-color: var(--input-border) !important;
}

html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder,
html[data-theme="obsidian-core"] input::placeholder,
html[data-theme="obsidian-core"] textarea::placeholder,
html[data-theme="neon-grid"] input::placeholder,
html[data-theme="neon-grid"] textarea::placeholder,
html[data-theme="crimson-opera"] input::placeholder,
html[data-theme="crimson-opera"] textarea::placeholder {
  color: var(--input-placeholder) !important;
}

html[data-theme="dark"] .bg-slate-900\/60,
html[data-theme="obsidian-core"] .bg-slate-900\/60,
html[data-theme="neon-grid"] .bg-slate-900\/60,
html[data-theme="crimson-opera"] .bg-slate-900\/60 {
  background-color: var(--shell-overlay) !important;
}

html[data-theme="dark"] .glass-monitor,
html[data-theme="dark"] .glass-card,
html[data-theme="obsidian-core"] .glass-monitor,
html[data-theme="obsidian-core"] .glass-card,
html[data-theme="neon-grid"] .glass-monitor,
html[data-theme="neon-grid"] .glass-card,
html[data-theme="crimson-opera"] .glass-monitor,
html[data-theme="crimson-opera"] .glass-card {
  background: var(--bg-surface-glass) !important;
  border-color: var(--border-default) !important;
}

html[data-theme="dark"] .text-green-600,
html[data-theme="obsidian-core"] .text-green-600,
html[data-theme="neon-grid"] .text-green-600,
html[data-theme="crimson-opera"] .text-green-600 {
  color: var(--status-success) !important;
}

html[data-theme="dark"] .text-red-600,
html[data-theme="obsidian-core"] .text-red-600,
html[data-theme="neon-grid"] .text-red-600,
html[data-theme="crimson-opera"] .text-red-600 {
  color: var(--status-error) !important;
}

html[data-theme="dark"] .bg-red-50,
html[data-theme="obsidian-core"] .bg-red-50,
html[data-theme="neon-grid"] .bg-red-50,
html[data-theme="crimson-opera"] .bg-red-50 {
  background: var(--accent-danger-muted) !important;
  color: var(--status-error) !important;
}

html[data-theme="dark"] .border-red-100,
html[data-theme="obsidian-core"] .border-red-100,
html[data-theme="neon-grid"] .border-red-100,
html[data-theme="crimson-opera"] .border-red-100 {
  border-color: var(--accent-danger-muted) !important;
}

/* Emerald/green badges no dark */
html[data-theme="dark"] .bg-emerald-50,
html[data-theme="obsidian-core"] .bg-emerald-50,
html[data-theme="neon-grid"] .bg-emerald-50,
html[data-theme="crimson-opera"] .bg-emerald-50 {
  background-color: rgba(52,211,153,.12) !important;
}
html[data-theme="dark"] .text-emerald-600,
html[data-theme="dark"] .text-emerald-700,
html[data-theme="obsidian-core"] .text-emerald-600,
html[data-theme="obsidian-core"] .text-emerald-700,
html[data-theme="neon-grid"] .text-emerald-600,
html[data-theme="neon-grid"] .text-emerald-700,
html[data-theme="crimson-opera"] .text-emerald-600,
html[data-theme="crimson-opera"] .text-emerald-700 {
  color: var(--status-success) !important;
}

/* Amber badges */
html[data-theme="dark"] .bg-amber-50,
html[data-theme="obsidian-core"] .bg-amber-50,
html[data-theme="neon-grid"] .bg-amber-50,
html[data-theme="crimson-opera"] .bg-amber-50 {
  background-color: rgba(251,191,36,.12) !important;
}
html[data-theme="dark"] .text-amber-600,
html[data-theme="dark"] .text-amber-700,
html[data-theme="obsidian-core"] .text-amber-600,
html[data-theme="obsidian-core"] .text-amber-700,
html[data-theme="neon-grid"] .text-amber-600,
html[data-theme="neon-grid"] .text-amber-700,
html[data-theme="crimson-opera"] .text-amber-600,
html[data-theme="crimson-opera"] .text-amber-700 {
  color: var(--status-warning) !important;
}

/* Purple badges */
html[data-theme="dark"] .bg-purple-50,
html[data-theme="obsidian-core"] .bg-purple-50,
html[data-theme="neon-grid"] .bg-purple-50,
html[data-theme="crimson-opera"] .bg-purple-50 {
  background-color: rgba(139,92,246,.12) !important;
}

html[data-theme="dark"] .divide-slate-100 > *,
html[data-theme="obsidian-core"] .divide-slate-100 > *,
html[data-theme="neon-grid"] .divide-slate-100 > *,
html[data-theme="crimson-opera"] .divide-slate-100 > * {
  border-color: var(--border-primary) !important;
}

/* map-container override */
html[data-theme="dark"] .map-container,
html[data-theme="obsidian-core"] .map-container,
html[data-theme="neon-grid"] .map-container,
html[data-theme="crimson-opera"] .map-container {
  background: var(--surface) !important;
}

/* Overrides light themes */
html[data-theme="aurora-light"] .text-slate-500,
html[data-theme="light"] .text-slate-500 {
  color: var(--text-secondary) !important;
}
html[data-theme="aurora-light"] .text-slate-400,
html[data-theme="light"] .text-slate-400 {
  color: var(--text-muted) !important;
}
html[data-theme="aurora-light"] input:not([type="checkbox"]):not([type="radio"]),
html[data-theme="aurora-light"] select,
html[data-theme="aurora-light"] textarea,
html[data-theme="light"] input:not([type="checkbox"]):not([type="radio"]),
html[data-theme="light"] select,
html[data-theme="light"] textarea {
  color: var(--input-text) !important;
}
html[data-theme="aurora-light"] input::placeholder,
html[data-theme="aurora-light"] textarea::placeholder,
html[data-theme="light"] input::placeholder,
html[data-theme="light"] textarea::placeholder {
  color: var(--input-placeholder) !important;
}

/* -------------------------------------------------------------------------- */
/* Sidebar & header overrides globais                                          */
/* -------------------------------------------------------------------------- */

:root {
  --sidebar-width: 260px;
  --sidebar-width-collapsed: 72px;
  --header-height: 64px;
}

/* -------------------------------------------------------------------------- */
/* Theme Picker UI                                                             */
/* -------------------------------------------------------------------------- */

.peep-theme-picker-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-primary);
  border-radius: 10px;
  background: var(--surface, var(--bg-surface));
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 14px;
  flex-shrink: 0;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.peep-theme-picker-btn:hover {
  background: var(--nav-item-hover);
  color: var(--brand-primary, var(--accent-primary));
  border-color: var(--border-secondary);
}

.peep-theme-panel {
  position: fixed;
  top: calc(var(--header-height) + 8px);
  right: 16px;
  width: 228px;
  background: var(--modal-bg, var(--bg-surface));
  border: 1px solid var(--border-secondary, var(--border-strong));
  border-radius: 16px;
  box-shadow: var(--shadow-elevated, var(--shadow-popover));
  padding: 8px;
  z-index: 9990;
  transform-origin: top right;
  transform: scale(0.9) translateY(-8px);
  opacity: 0;
  pointer-events: none;
  transition: transform .2s var(--ease-out,.25s), opacity .2s ease;
}
.peep-theme-panel.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

.peep-tp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px 8px;
  border-bottom: 1px solid var(--border-primary);
  margin-bottom: 6px;
}
.peep-tp-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
}
.peep-tp-close {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 6px;
  font-size: 11px;
  transition: background .14s, color .14s;
}
.peep-tp-close:hover {
  background: var(--nav-item-hover);
  color: var(--text-primary);
}

.peep-theme-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 9px;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .14s ease, border-color .14s ease;
  user-select: none;
}
.peep-theme-option:hover {
  background: var(--nav-item-hover);
}
.peep-theme-option.active {
  border-color: var(--border-secondary);
  background: var(--nav-item-active-bg);
}

.peep-theme-dots {
  display: flex;
  gap: 3px;
  flex-shrink: 0;
}
.peep-theme-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0,0,0,.15);
}

.peep-theme-info {
  flex: 1;
  min-width: 0;
}
.peep-theme-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.peep-theme-desc {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
}

.peep-theme-check {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 10px;
  color: var(--brand-primary, var(--accent-primary));
  opacity: 0;
  transition: opacity .14s;
}
.peep-theme-option.active .peep-theme-check {
  opacity: 1;
}

.peep-theme-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9989;
  display: none;
}
.peep-theme-backdrop.open {
  display: block;
}

/* -------------------------------------------------------------------------- */
/* Toggle de tema legado (mantido p/ compat visual)                           */
/* -------------------------------------------------------------------------- */

.peep-theme-toggle {
  position: relative;
  width: 52px;
  height: 28px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 999px;
  flex-shrink: 0;
}

.peep-theme-toggle__track {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: var(--color-bg-secondary);
  border: 1px solid var(--border-default);
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.peep-theme-toggle:hover .peep-theme-toggle__track {
  border-color: var(--border-strong);
}
.peep-theme-toggle__thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--duration-ui) var(--ease-out);
}
html[data-theme="aurora-light"] .peep-theme-toggle__thumb,
html[data-theme="light"] .peep-theme-toggle__thumb {
  transform: translateX(24px);
}
.peep-theme-toggle__icon {
  position: absolute;
  font-size: 11px;
  transition: opacity var(--duration-fast) var(--ease-out);
}
.peep-theme-toggle__icon--dark { color: var(--accent-primary); opacity: 1; }
.peep-theme-toggle__icon--light { color: #f59e0b; opacity: 0; }
html[data-theme="aurora-light"] .peep-theme-toggle__icon--dark,
html[data-theme="light"] .peep-theme-toggle__icon--dark { opacity: 0; }
html[data-theme="aurora-light"] .peep-theme-toggle__icon--light,
html[data-theme="light"] .peep-theme-toggle__icon--light { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
