/* ============================================================
   CLIPAGEM DESIGN SYSTEM — Colors & Typography Tokens
   gestao/css/app.css | Premium Gestão Dashboard
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=JetBrains+Mono:wght@400;500&display=swap');

/* --- Light Mode (Padrão) --- */
:root {
  /* Fundo de Canvas e Elementos */
  --color-bg-primary:    #F8F9FA;   /* Cinza suave ultra limpo */
  --color-bg-surface:    #FFFFFF;   /* Cards e painéis brancos */
  --color-bg-elevated:   #FFFFFF;   /* Modais e popups */
  --color-bg-overlay:    #F1F3F5;   /* Hover overlays */

  /* Bordas */
  --color-border-subtle: #E9ECEF;   /* Divisores sutis */
  --color-border-default:#DEE2E6;   /* Bordas de cards */
  --color-border-strong: #CED4DA;   /* Bordas focadas/ativas */

  /* Textos / Conteúdo */
  --color-fg-primary:    #1A1A1A;   /* Texto principal (quase preto) */
  --color-fg-secondary:  #6C757D;   /* Texto de apoio */
  --color-fg-tertiary:   #ADB5BD;   /* Disabled / placeholders */
  --color-fg-inverse:    #F2F2F2;   /* Texto sobre fundos escuros/gradientes */

  /* Cores de Acento */
  --color-accent-violet:  #7B6FFF;
  --color-accent-lavender:#6E56CF;   /* Roxo escurecido para contraste */
  --color-accent-lilac:   #8F4DEC;
  --color-accent-magenta: #D6409F;
  --color-accent-pink:    #E52E91;

  /* Status */
  --color-success:        #2BB475;
  --color-warning:        #D97706;
  --color-error:          #E11D48;
  --color-info:           #6E56CF;
  --color-blue:           #2563EB;

  /* Gradients adaptados */
  --gradient-brand:       linear-gradient(135deg, #7B6FFF 0%, #6E56CF 30%, #D6409F 70%, #E52E91 100%);
  --gradient-brand-h:     linear-gradient(90deg,  #7B6FFF 0%, #6E56CF 40%, #D6409F 75%, #E52E91 100%);
  --gradient-badge-cla:   linear-gradient(135deg, #7B6FFF 0%, #E52E91 100%);
  --gradient-glow:        radial-gradient(ellipse at 50% 0%, rgba(110,86,207,0.08) 0%, transparent 70%);
  --gradient-fade-up:     linear-gradient(to top, #F8F9FA 0%, transparent 100%);
  --gradient-surface:     linear-gradient(135deg, #FFFFFF 0%, #F8F9FA 100%);

  /* Sombras adequadas para Light-Mode */
  --shadow-sm:       0 1px 3px rgba(0,0,0,0.05);
  --shadow-md:       0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg:       0 8px 24px rgba(0,0,0,0.08);
  --shadow-xl:       0 16px 40px rgba(0,0,0,0.1);
  --shadow-glow-accent: 0 0 16px rgba(110,86,207,0.08);
  --shadow-glow-cta:    0 0 20px rgba(229,46,145,0.15);

  /* --- Spacing & Borders --- */
  --font-display:  'Space Grotesk', sans-serif;
  --font-body:     'DM Sans', sans-serif;
  --font-mono:     'JetBrains Mono', monospace;

  --fw-regular:   400;
  --fw-medium:    500;
  --fw-semibold:  600;
  --fw-bold:      700;

  --text-display-xl:  72px;
  --text-display-lg:  48px;
  --text-display-md:  36px;
  --text-h1:          36px;
  --text-h2:          28px;
  --text-h3:          22px;
  --text-h4:          18px;
  --text-body-lg:     18px;
  --text-body-md:     16px;
  --text-body-sm:     14px;
  --text-caption:     12px;
  --text-overline:    11px;

  --lh-tight:     1.05;
  --lh-snug:      1.15;
  --lh-normal:    1.35;
  --lh-relaxed:   1.6;
  --lh-loose:     1.75;

  --ls-tight:     -0.03em;
  --ls-normal:    -0.01em;
  --ls-wide:       0.05em;
  --ls-wider:      0.1em;

  --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;
  --space-16:  64px;
  --space-20:  80px;
  --space-24:  96px;

  --radius-xs:    4px;
  --radius-sm:    6px;
  --radius-md:   10px;
  --radius-lg:   16px;
  --radius-xl:   24px;
  --radius-2xl:  32px;
  --radius-full: 9999px;

  --ease-out-expo:  cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out:    cubic-bezier(0.4, 0, 0.2, 1);
  --duration-fast:  150ms;
  --duration-base:  250ms;
  --duration-slow:  400ms;

  --max-width:       1200px;
  --header-height:    64px;
  --sidebar-width:   260px;
  --gutter:           24px;
  --page-px-sm:       20px;
  --page-px-md:       40px;
  --page-px-lg:       80px;

  --glass-bg:     rgba(255, 255, 255, 0.75);
  --glass-blur:   blur(12px);
}

/* --- Dark Mode (Ativado via [data-theme="dark"]) --- */
[data-theme="dark"] {
  --color-bg-primary:    #050505;
  --color-bg-surface:    #0E0E0E;
  --color-bg-elevated:   #161616;
  --color-bg-overlay:    #1E1E1E;

  --color-border-subtle: #1C1C1C;
  --color-border-default:#252525;
  --color-border-strong: #383838;

  --color-fg-primary:    #F2F2F2;
  --color-fg-secondary:  #999999;
  --color-fg-tertiary:   #888888;
  --color-fg-inverse:    #050505;

  --color-accent-violet:  #7B6FFF;
  --color-accent-lavender:#B8A8FF;
  --color-accent-lilac:   #C38CFF;
  --color-accent-magenta: #E56BC4;
  --color-accent-pink:    #F05BB7;

  --color-success:        #3DD68C;
  --color-warning:        #F5A623;
  --color-error:          #FF4D4F;
  --color-info:           #B8A8FF;
  --color-blue:           #7FB0FF;

  --gradient-brand:       linear-gradient(135deg, #7B6FFF 0%, #6E56CF 30%, #D6409F 70%, #E52E91 100%);
  --gradient-brand-h:     linear-gradient(90deg,  #7B6FFF 0%, #6E56CF 40%, #D6409F 75%, #E52E91 100%);
  --gradient-badge-cla:   linear-gradient(135deg, #7B6FFF 0%, #E52E91 100%);
  --gradient-glow:        radial-gradient(ellipse at 50% 0%, rgba(183,144,255,0.18) 0%, transparent 70%);
  --gradient-fade-up:     linear-gradient(to top, #050505 0%, transparent 100%);
  --gradient-surface:     linear-gradient(135deg, #0E0E0E 0%, #111111 100%);

  --shadow-sm:       0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:       0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg:       0 8px 32px rgba(0,0,0,0.6);
  --shadow-xl:       0 16px 48px rgba(0,0,0,0.7);
  --shadow-glow-accent: 0 0 24px rgba(183,144,255,0.22);
  --shadow-glow-cta:    0 0 32px rgba(240,91,183,0.32);

  --glass-bg:     rgba(5, 5, 5, 0.72);
}

/* ============================================================
   SEMANTIC ELEMENT STYLES & GLOBALS
   ============================================================ */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family:      var(--font-body);
  font-size:        var(--text-body-md);
  font-weight:      var(--fw-regular);
  line-height:      var(--lh-relaxed);
  color:            var(--color-fg-primary);
  background-color: var(--color-bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition:       background-color var(--duration-base) var(--ease-out-expo), color var(--duration-base) var(--ease-out-expo);
  overflow-x:       hidden;
  padding-bottom:   24px; /* Evita sobreposição da barra DEV */
}

h1, .h1 {
  font-family:    var(--font-display);
  font-size:      var(--text-h1);
  font-weight:    var(--fw-bold);
  line-height:    var(--lh-snug);
  letter-spacing: var(--ls-tight);
  color:          var(--color-fg-primary);
}

h2, .h2 {
  font-family:    var(--font-display);
  font-size:      var(--text-h2);
  font-weight:    var(--fw-semibold);
  line-height:    var(--lh-snug);
  letter-spacing: var(--ls-tight);
  color:          var(--color-fg-primary);
}

h3, .h3 {
  font-family:    var(--font-display);
  font-size:      var(--text-h3);
  font-weight:    var(--fw-semibold);
  line-height:    var(--lh-normal);
  letter-spacing: var(--ls-normal);
  color:          var(--color-fg-primary);
}

h4, .h4 {
  font-family:    var(--font-display);
  font-size:      var(--text-h4);
  font-weight:    var(--fw-medium);
  line-height:    var(--lh-normal);
  color:          var(--color-fg-primary);
}

p, .body-md {
  font-family: var(--font-body);
  font-size:   var(--text-body-md);
  line-height: var(--lh-relaxed);
  color:       var(--color-fg-primary);
}

.body-lg {
  font-family: var(--font-body);
  font-size:   var(--text-body-lg);
  line-height: var(--lh-relaxed);
}

.body-sm {
  font-family: var(--font-body);
  font-size:   var(--text-body-sm);
  line-height: var(--lh-relaxed);
  color:       var(--color-fg-secondary);
}

.caption {
  font-family:    var(--font-body);
  font-size:      var(--text-caption);
  line-height:    var(--lh-normal);
  color:          var(--color-fg-secondary);
}

.overline {
  font-family:    var(--font-body);
  font-size:      var(--text-overline);
  font-weight:    var(--fw-semibold);
  letter-spacing: var(--ls-wider);
  text-transform: uppercase;
  color:          var(--color-accent-lavender);
}

code, .mono {
  font-family:    var(--font-mono);
  font-size:      0.875em;
  color:          var(--color-accent-lavender);
  background:     rgba(110,86,207,0.1);
  padding:        2px 6px;
  border-radius:  var(--radius-sm);
}

[data-theme="dark"] code, [data-theme="dark"] .mono {
  background:     rgba(183,144,255,0.1);
}

.text-gradient {
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: inline-block;
}

a {
  color:           var(--color-accent-lavender);
  text-decoration: none;
  transition:      color var(--duration-fast) var(--ease-out-expo);
}
a:hover {
  color: var(--color-accent-pink);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display:          inline-flex;
  align-items:      center;
  justify-content:  center;
  gap:              var(--space-2);
  font-family:      var(--font-body);
  font-weight:      var(--fw-medium);
  border-radius:    var(--radius-md);
  border:           none;
  cursor:           pointer;
  transition:       all var(--duration-base) var(--ease-out-expo);
  white-space:      nowrap;
  text-decoration:  none;
  line-height:      1;
}

.btn i,
.btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.btn-sm i,
.btn-sm svg {
  width: 14px;
  height: 14px;
}

.btn-lg i,
.btn-lg svg {
  width: 18px;
  height: 18px;
}

.btn-sm  { font-size: var(--text-body-sm); padding: 8px 14px; }
.btn-md  { font-size: var(--text-body-md); padding: 12px 20px; }
.btn-lg  { font-size: var(--text-body-lg); padding: 14px 28px; }


.btn-primary {
  background:  var(--gradient-brand-h);
  color:       #fff !important;
  box-shadow:  var(--shadow-glow-cta);
}
.btn-primary:hover {
  color:       #fff !important;
  transform:   translateY(-2px);
  box-shadow:  var(--shadow-glow-cta), 0 8px 24px rgba(0,0,0,0.15);
}
.btn-primary:active { transform: scale(0.97); }

.btn-secondary {
  background:  var(--color-bg-surface);
  color:       var(--color-fg-primary);
  border:      1px solid var(--color-border-default);
  box-shadow:  var(--shadow-sm);
}
.btn-secondary:hover {
  border-color: var(--color-accent-lavender);
  color:        var(--color-accent-lavender);
  transform:    translateY(-2px);
  box-shadow:  var(--shadow-md);
}
.btn-secondary:active { transform: scale(0.97); }

.btn-ghost {
  background:  transparent;
  color:       var(--color-fg-secondary);
  border:      none;
}
.btn-ghost:hover {
  background:  var(--color-bg-overlay);
  color:       var(--color-fg-primary);
}

.btn-danger {
  background:  var(--color-error);
  color:       #fff;
}
.btn-danger:hover {
  opacity: 0.9;
  transform: translateY(-2px);
}

.btn-success {
  background:  var(--color-success);
  color:       #fff;
}
.btn-success:hover {
  opacity: 0.9;
  transform: translateY(-2px);
  color: #fff;
}


.btn-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ============================================================
   CARDS & CONTAINERS
   ============================================================ */
.card {
  background:    var(--color-bg-surface);
  border:        1px solid var(--color-border-default);
  border-radius: var(--radius-lg);
  padding:       var(--space-6);
  transition:    all var(--duration-base) var(--ease-out-expo);
  box-shadow:    var(--shadow-sm);
}
.card:hover {
  border-color:  var(--color-border-strong);
  box-shadow:    var(--shadow-glow-accent);
}

.card-header-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-border-subtle);
  padding-bottom: var(--space-3);
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display:        inline-flex;
  align-items:    center;
  gap:            var(--space-1);
  font-family:    var(--font-body);
  font-size:      var(--text-caption);
  font-weight:    var(--fw-semibold);
  letter-spacing: var(--ls-wide);
  padding:        4px 10px;
  border-radius:  var(--radius-full);
}
.badge-accent {
  background: rgba(110,86,207,0.1);
  color:      var(--color-accent-lavender);
  border:     1px solid rgba(110,86,207,0.2);
}
.badge-pink {
  background: rgba(229,46,145,0.1);
  color:      var(--color-accent-pink);
  border:     1px solid rgba(229,46,145,0.2);
}
.badge-success {
  background: rgba(43,180,117,0.1);
  color:      var(--color-success);
  border:     1px solid rgba(43,180,117,0.2);
}
.badge-warning {
  background: rgba(217,119,6,0.1);
  color:      var(--color-warning);
  border:     1px solid rgba(217,119,6,0.2);
}
.badge-error {
  background: rgba(225,29,72,0.1);
  color:      var(--color-error);
  border:     1px solid rgba(225,29,72,0.2);
}
.badge-blue {
  background: rgba(37,99,235,0.1);
  color:      var(--color-blue);
  border:     1px solid rgba(37,99,235,0.25);
}

/* ============================================================
   FORMS & INPUTS
   ============================================================ */
.form-group {
  margin-bottom: var(--space-4);
}

.form-label {
  display: block;
  font-family: var(--font-body);
  font-weight: var(--fw-medium);
  font-size: var(--text-body-sm);
  color: var(--color-fg-primary);
  margin-bottom: var(--space-2);
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  font-family: var(--font-body);
  font-size: var(--text-body-md);
  color: var(--color-fg-primary);
  background-color: var(--color-bg-primary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-md);
  transition: all var(--duration-fast) var(--ease-out-expo);
}
.form-control:focus {
  outline: none;
  border-color: var(--color-accent-lavender);
  background-color: var(--color-bg-surface);
  box-shadow: 0 0 0 3px rgba(110,86,207,0.15);
}
[data-theme="dark"] .form-control:focus {
  box-shadow: 0 0 0 3px rgba(183,144,255,0.15);
}

textarea.form-control {
  min-height: 100px;
  resize: vertical;
}

.form-error {
  color: var(--color-error);
  font-size: var(--text-caption);
  margin-top: var(--space-1);
}

/* ============================================================
   TABLES
   ============================================================ */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-default);
}

.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  background-color: var(--color-bg-surface);
}

.table th {
  background-color: var(--color-bg-primary);
  font-family: var(--font-body);
  font-weight: var(--fw-semibold);
  font-size: var(--text-body-sm);
  color: var(--color-fg-secondary);
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border-default);
  text-transform: uppercase;
  letter-spacing: var(--ls-wide);
}

.table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border-subtle);
  color: var(--color-fg-primary);
  font-size: var(--text-body-md);
  vertical-align: middle;
}

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

.table tr:hover td {
  background-color: var(--color-bg-overlay);
}

/* ============================================================
   CÉLULA DE MÉTRICAS DO POST — Views em destaque + demais em subtexto
   ============================================================ */
.stat-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.stat-hero .stat-hero-value {
  font-family: var(--font-mono);
  font-weight: var(--fw-bold);
  font-size: 16px;
}
.stat-hero .stat-hero-sub {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--color-fg-secondary);
  white-space: nowrap;
  margin-top: 2px;
}
.stat-hero .stat-hero-sub .stat-item {
  display: flex;
  align-items: center;
  gap: 3px;
}
.stat-hero .stat-hero-sub .stat-item svg {
  flex-shrink: 0;
  color: var(--color-fg-secondary);
}
.stat-hero .stat-hero-sub .stat-item.is-engaj {
  color: var(--color-accent-lavender);
  font-weight: var(--fw-semibold);
}
.stat-hero .stat-hero-sub .stat-item.is-engaj svg {
  color: var(--color-accent-violet);
}

/* ============================================================
   LAYOUT & TEMPLATE ARCHITECTURE
   ============================================================ */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* --- Sidebar --- */
.app-sidebar {
  width: var(--sidebar-width);
  background-color: var(--color-bg-surface);
  border-right: 1px solid var(--color-border-default);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: all var(--duration-base) var(--ease-out-expo);
}

.sidebar-header {
  height: var(--header-height);
  padding: 0 var(--space-6);
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--color-border-subtle);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  font-size: var(--text-h3);
}

.sidebar-logo img {
  height: 32px;
}

[data-theme="light"] .logo-theme-light,
:root:not([data-theme="dark"]) .logo-theme-light { display: block !important; }
[data-theme="light"] .logo-theme-dark,
:root:not([data-theme="dark"]) .logo-theme-dark { display: none !important; }

[data-theme="dark"] .logo-theme-dark { display: block !important; }
[data-theme="dark"] .logo-theme-light { display: none !important; }

.sidebar-menu {
  list-style: none;
  padding: var(--space-4) var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  flex: 1;
  overflow-y: auto;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px var(--space-4);
  color: var(--color-fg-secondary);
  border-radius: var(--radius-md);
  font-weight: var(--fw-medium);
  transition: all var(--duration-fast) var(--ease-out-expo);
}
.sidebar-link:hover {
  background-color: var(--color-bg-overlay);
  color: var(--color-fg-primary);
}
.sidebar-link.active {
  background: var(--gradient-brand);
  color: #fff;
  box-shadow: var(--shadow-glow-accent);
}

/* --- Grupo colapsável da sidebar --- */
.sidebar-group-toggle {
  width: 100%;
  background: none;
  border: 0;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}

.sidebar-group-chevron {
  margin-left: auto;
  width: 16px;
  height: 16px;
  transition: transform var(--duration-fast) var(--ease-out-expo);
}
.sidebar-group.open .sidebar-group-chevron {
  transform: rotate(180deg);
}

/* Animação de altura sem valor fixo: 0fr → 1fr */
.sidebar-group-panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows var(--duration-base) var(--ease-out-expo);
}
.sidebar-group.open .sidebar-group-panel {
  grid-template-rows: 1fr;
}

.sidebar-submenu {
  list-style: none;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding-left: var(--space-5);
  margin-left: var(--space-4);
  border-left: 1px solid var(--color-border-subtle);
}
.sidebar-group.open .sidebar-submenu {
  padding-top: var(--space-1);
}
.sidebar-submenu .sidebar-link {
  padding: 8px var(--space-3);
}
.sidebar-submenu .sidebar-link svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: var(--space-4);
  border-top: 1px solid var(--color-border-subtle);
}

/* --- Main Content Area --- */
.app-main {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: all var(--duration-base) var(--ease-out-expo);
}

/* --- Header --- */
.app-header {
  height: var(--header-height);
  background-color: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--color-border-default);
  padding: 0 var(--space-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 99;
}

.header-search {
  display: flex;
  align-items: center;
  position: relative;
  max-width: 320px;
  width: 100%;
}
.header-search .form-control {
  padding-left: var(--space-8);
}
.header-search svg {
  position: absolute;
  left: 12px;
  color: var(--color-fg-tertiary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-full);
  transition: background var(--duration-fast) var(--ease-out-expo);
}
.user-profile:hover {
  background-color: var(--color-bg-overlay);
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 2px solid var(--color-accent-lavender);
}

/* --- Content Panel --- */
.app-content {
  flex: 1;
  min-width: 0;
  padding: var(--space-6);
  max-width: 100%;
  width: 100%;
  margin: 0 auto;
  animation: fadeIn var(--duration-slow) var(--ease-out-expo);
}

/* --- Animations --- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   RESPONSIVIDADE (Mobile-First)
   ============================================================ */
@media (max-width: 992px) {
  .app-sidebar {
    transform: translateX(-100%);
  }
  .app-sidebar.open {
    transform: translateX(0);
  }
  .app-main {
    margin-left: 0;
  }
  .app-content {
    padding: var(--space-4);
  }
}

/* ============================================================
   UTILITIES
   ============================================================ */
.d-flex { display: flex; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.flex-column { flex-direction: column; }
.gap-2 { gap: var(--space-2); }
.gap-4 { gap: var(--space-4); }
.flex-1 { flex: 1; }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mt-4 { margin-top: var(--space-4); }
.w-100 { width: 100%; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.fw-bold { font-weight: var(--fw-bold); }
.fw-semibold { font-weight: var(--fw-semibold); }
.text-danger { color: var(--color-error); }
.text-success { color: var(--color-success); }

/* --- Responsive Double Column Grids --- */
.ranking-layout-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6);
}

.participantes-layout-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6);
}

@media (min-width: 992px) {
  .ranking-layout-grid {
    grid-template-columns: 1fr 340px;
  }
  .participantes-layout-grid {
    grid-template-columns: 280px 1fr;
  }
}

/* --- Premium Navigation Tabs --- */
.tabs-container {
  border-radius: var(--radius-lg);
  background-color: var(--color-bg-surface);
  border: 1px solid var(--color-border-default);
  overflow: hidden;
}

.tabs-header {
  display: flex;
  background-color: var(--color-bg-primary);
  border-bottom: 1px solid var(--color-border-default);
}

.tab-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 14px 20px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--color-fg-secondary);
  font-family: var(--font-body);
  font-weight: var(--fw-semibold);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out-expo);
}
.tab-btn:hover {
  background-color: var(--color-bg-overlay);
  color: var(--color-fg-primary);
}
.tab-btn.active {
  border-bottom-color: var(--color-accent-lavender);
  color: var(--color-accent-lavender);
  background-color: var(--color-bg-surface);
}

.tabs-content {
  padding: var(--space-6);
}

.tab-pane {
  display: none;
  animation: tabFadeIn 0.3s ease;
}
.tab-pane.active {
  display: block;
}

.grid-form-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-4);
}

@keyframes tabFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   ALERT NOTIFICATIONS
   ============================================================ */
.alert {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-body-sm);
  font-weight: var(--fw-medium);
  margin-bottom: var(--space-4);
  border: 1px solid transparent;
}
.alert-success {
  background: rgba(43, 180, 117, 0.08);
  color: var(--color-success);
  border-color: rgba(43, 180, 117, 0.22);
}
.alert-error {
  background: rgba(225, 29, 72, 0.08);
  color: var(--color-error);
  border-color: rgba(225, 29, 72, 0.22);
}
.alert-warning {
  background: rgba(217, 119, 6, 0.08);
  color: var(--color-warning);
  border-color: rgba(217, 119, 6, 0.22);
}

/* ============================================================
   METRICS GRID & STAT CARDS (Dashboard)
   ============================================================ */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.metric-card {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  box-shadow: var(--shadow-sm);
  transition: all var(--duration-base) var(--ease-out-expo);
}
.metric-card:hover {
  border-color: var(--color-border-strong);
  box-shadow: var(--shadow-glow-accent);
  transform: translateY(-2px);
}

.metric-icon {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.metric-label {
  font-size: 11px;
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: var(--ls-wide);
  color: var(--color-fg-secondary);
  display: block;
}

.metric-value {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: var(--fw-bold);
  color: var(--color-fg-primary);
  line-height: 1;
  margin-top: 4px;
  display: block;
}

/* ============================================================
   PAGE HEADER (Topo das views)
   ============================================================ */
.page-header {
  margin-bottom: var(--space-6);
}
.page-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}
.page-header-label {
  font-size: 11px;
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: var(--ls-wide);
  color: var(--color-accent-lavender);
  display: block;
}
.page-header-title {
  font-family: var(--font-display);
  font-size: var(--text-h2);
  font-weight: var(--fw-semibold);
  color: var(--color-fg-primary);
  margin-top: var(--space-1);
  line-height: 1.2;
}
.page-header-desc {
  font-size: var(--text-body-sm);
  color: var(--color-fg-secondary);
  margin-top: var(--space-1);
}

/* ============================================================
   EMPTY STATE (Tabelas sem dados)
   ============================================================ */
.empty-state {
  text-align: center;
  padding: var(--space-12) var(--space-6);
}
.empty-state-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  background: var(--color-bg-overlay);
  color: var(--color-fg-tertiary);
  margin-bottom: var(--space-3);
}
.empty-state-text {
  font-size: var(--text-body-sm);
  color: var(--color-fg-tertiary);
}

/* ============================================================
   TEMPLATE — PAGE TITLE (Breadcrumb no header)
   ============================================================ */
.page-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.page-title .overline {
  font-size: 10px;
  color: var(--color-accent-lavender);
}
.page-title h4 {
  font-size: 15px;
  font-weight: var(--fw-semibold);
  color: var(--color-fg-primary);
  text-transform: capitalize;
}

/* Divisor vertical (header) */
.vr {
  display: inline-block;
  width: 1px;
  height: 24px;
  background-color: var(--color-border-subtle);
  align-self: center;
}

/* Sidebar link tamanho mais compacto */
.sidebar-link {
  font-size: var(--text-body-sm);
}

/* ============================================================
   UTILITY ADDITIONS
   ============================================================ */
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-8 { margin-bottom: var(--space-8); }
.mt-2 { margin-top: var(--space-2); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.fw-medium { font-weight: var(--fw-medium); }
.text-muted      { color: var(--color-fg-secondary); }
.text-secondary  { color: var(--color-fg-secondary); }
.font-mono       { font-family: var(--font-mono); }
.flex-wrap       { flex-wrap: wrap; }
.justify-content-end    { justify-content: flex-end; }
.justify-content-center { justify-content: center; }
.align-items-start      { align-items: flex-start; }
.d-none { display: none !important; }

@media (min-width: 768px) {
  .d-md-flex { display: flex !important; }
}

@media (min-width: 992px) {
  .d-lg-none { display: none !important; }
}

/* ============================================================
   MODAL
   ============================================================ */
@keyframes modalSlideUp {
  from { transform: translateY(16px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.modal-overlay.open {
  display: flex;
  animation: fadeIn var(--duration-fast) var(--ease-out-expo);
}
.modal {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-xl);
  width: 90%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
  animation: modalSlideUp var(--duration-base) var(--ease-out-expo);
  overflow: hidden;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--color-border-subtle);
}
/* Quando um <form> envolve body+footer, ele vira o filho flex do .modal e quebra a
   cadeia de altura — sem isto o .modal-body nunca calcula o overflow e o conteúdo
   é cortado pelo overflow:hidden do .modal em vez de rolar. */
.modal > form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.modal-body {
  padding: var(--space-6);
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--color-border-subtle);
}

/* ============================================================
   FILE UPLOAD
   ============================================================ */
/* Preview de banner na MESMA proporção em que ele é exibido na plataforma/agência
   (cards e heroes estão travados em 16/9), para o admin ver o enquadramento real
   antes de salvar. Usado em competicoes/nova e competicoes/editar. */
.banner-preview-16x9 {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--color-border-default);
  background: var(--color-bg-elevated);
}
.banner-preview-16x9 img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.file-upload-zone {
  border: 2px dashed var(--color-border-default);
  border-radius: var(--radius-md);
  padding: var(--space-6);
  text-align: center;
  cursor: pointer;
  position: relative;
  transition: all var(--duration-fast);
}
.file-upload-zone:hover {
  border-color: var(--color-accent-lavender);
  background: rgba(110, 86, 207, 0.03);
}
.file-upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.upload-icon {
  color: var(--color-accent-lavender);
}
.file-upload-label {
  display: block;
  color: var(--color-fg-primary);
  font-weight: var(--fw-medium);
}
.file-upload-hint {
  display: block;
  color: var(--color-fg-tertiary);
}
.file-name-preview {
  display: none;
  margin-top: var(--space-2);
  font-size: var(--text-body-sm);
  color: var(--color-accent-lavender);
  font-weight: var(--fw-medium);
}

/* ============================================================
   TOGGLE SWITCH (campanha secreta + redes sociais)
   ============================================================ */
.network-toggle-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-3);
  cursor: pointer;
  transition: border-color var(--duration-fast);
}
.network-toggle-card:has(input:checked) {
  border-color: var(--color-accent-lavender);
  background: rgba(110, 86, 207, 0.03);
}
.network-toggle-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-weight: var(--fw-medium);
  font-size: 14px;
  color: var(--color-fg-primary);
}
.toggle-switch {
  position: relative;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--color-border-default);
  border-radius: var(--radius-full);
  transition: background var(--duration-fast);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--duration-fast);
}
.toggle-switch input:checked + .toggle-slider { background: var(--color-accent-lavender); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ============================================================
   USER HERO CARD (Detalhes do Clipador)
   ============================================================ */
.user-hero-card {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-6);
  display: flex;
  align-items: center;
  gap: var(--space-5);
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
  margin-bottom: var(--space-6);
}
.user-hero-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}
.user-hero-avatar-wrap .avatar { width: 64px; height: 64px; }
.user-status-dot {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2.5px solid var(--color-bg-surface);
}
.user-status-dot.online  { background: var(--color-success); }
.user-status-dot.offline { background: var(--color-error); }
.user-hero-info { flex: 1; min-width: 140px; }
.user-hero-info h3 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: var(--fw-semibold);
  color: var(--color-fg-primary);
  margin-bottom: 2px;
}
.user-hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-5);
  border-left: 1px solid var(--color-border-subtle);
  padding-left: var(--space-5);
  margin-left: auto;
}
.user-hero-meta-item { display: flex; flex-direction: column; }
.user-hero-meta-item .label {
  font-size: 10px;
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: var(--ls-wide);
  color: var(--color-fg-tertiary);
}
.user-hero-meta-item .value {
  font-size: 14px;
  color: var(--color-fg-primary);
  font-weight: var(--fw-medium);
  margin-top: 2px;
}
.saldo-value {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: var(--fw-bold);
  color: var(--color-success) !important;
  line-height: 1;
  margin-top: 2px;
}

/* ============================================================
   QUILL EDITOR OVERRIDES
   ============================================================ */
.ql-toolbar.ql-snow {
  background: var(--color-bg-primary);
  border-color: var(--color-border-default) !important;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}
.ql-container.ql-snow {
  background: var(--color-bg-primary);
  border-color: var(--color-border-default) !important;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  font-family: var(--font-body);
  font-size: var(--text-body-sm);
  min-height: 140px;
}
.ql-editor { min-height: 140px; color: var(--color-fg-primary); }
[data-theme="dark"] .ql-toolbar.ql-snow,
[data-theme="dark"] .ql-container.ql-snow { background: var(--color-bg-overlay); }
[data-theme="dark"] .ql-snow .ql-stroke { stroke: var(--color-fg-secondary); }
[data-theme="dark"] .ql-snow .ql-fill { fill: var(--color-fg-secondary); }
[data-theme="dark"] .ql-snow .ql-picker { color: var(--color-fg-secondary); }

/* ============================================================
   RANKING PAYMENT MODAL
   ============================================================ */
.premio-row {
  display: grid;
  grid-template-columns: 36px 1fr 140px;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-border-subtle);
}
.premio-row:last-child { border-bottom: none; }
.premio-pos {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: var(--fw-bold);
  color: var(--color-fg-tertiary);
  text-align: center;
}
.premio-pos.top-3 { font-size: 20px; }
.premio-nome {
  font-size: 13px;
  font-weight: var(--fw-medium);
  color: var(--color-fg-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================================================
   SWEETALERT2 CUSTOM PREMIUM STYLES & FOCUS OVERRIDES
   ============================================================ */
.swal2-popup {
  font-family: var(--font-body) !important;
  border-radius: var(--radius-lg) !important;
}
.swal2-popup .swal2-styled:focus {
  box-shadow: none !important;
}
.swal2-popup .swal2-styled.swal2-confirm:focus {
  box-shadow: 0 0 0 3px rgba(110, 86, 207, 0.25) !important;
}
.swal2-popup .swal2-styled.swal2-cancel:focus {
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1) !important;
}
.swal2-popup .swal2-actions button:focus-visible {
  outline: none !important;
  box-shadow: none !important;
}

/* ============================================================
   AVATAR AND FALLBACK STYLES
   ============================================================ */
.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  display: block;
}

.avatar-letter {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-brand);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  flex-shrink: 0;
}

.avatar-wrapper {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-wrapper.has-border {
  border: 2px solid var(--color-accent-lavender);
}

.avatar.lg {
  width: 64px;
  height: 64px;
}

.avatar-letter.lg {
  width: 64px;
  height: 64px;
  font-size: 24px;
}

.avatar-wrapper.lg {
  width: 64px;
  height: 64px;
}

.avatar.sm {
  width: 24px;
  height: 24px;
}

.avatar-letter.sm {
  width: 24px;
  height: 24px;
  font-size: 10px;
}

.avatar-wrapper.sm {
  width: 24px;
  height: 24px;
}

.avatar.md {
  width: 28px;
  height: 28px;
}

.avatar-letter.md {
  width: 28px;
  height: 28px;
  font-size: 11px;
}

.avatar-wrapper.md {
  width: 28px;
  height: 28px;
}

/* ============================================================
   CLIPADOR CELL (avatar + nome + email + nickname padronizados)
   ============================================================ */
.avatar-slot { position: relative; display: inline-block; flex-shrink: 0; width: 38px; height: 38px; }
.avatar-slot.sm { width: 24px; height: 24px; }

.avatar-badge-cla {
  position: absolute; top: -4px; right: -4px;
  font-size: 8px; font-weight: 800;
  background: var(--gradient-badge-cla); color: #fff !important;
  padding: 2px 4px; border-radius: 4px;
  border: 1px solid var(--color-bg-primary);
  z-index: 1; cursor: pointer; text-transform: uppercase;
  line-height: 1; box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.clipador-nome { display: block; font-size: 14px; color: var(--color-fg-primary); text-decoration: none; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.clipador-meta { display: flex; align-items: center; gap: var(--space-1); margin-top: 2px; flex-wrap: wrap; font-size: 11px; }
.clipador-meta-sep { color: var(--color-fg-tertiary); font-size: 11px; line-height: 1; }

/* ============================================================
   LAYOUT & UTILITY CLASSES (D-Flex, Gaps, Margins)
   ============================================================ */
.d-flex { display: flex; }
.d-inline-flex { display: inline-flex; }
.align-items-center { align-items: center; }
.align-items-start { align-items: flex-start; }
.justify-content-between { justify-content: space-between; }
.justify-content-center { justify-content: center; }
.justify-content-end { justify-content: flex-end; }
.flex-column { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-5 { gap: var(--space-5); }
.gap-6 { gap: var(--space-6); }
.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); }
.mb-6 { margin-bottom: var(--space-6); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.mt-6 { margin-top: var(--space-6); }
.mr-2 { margin-right: var(--space-2); }
.ml-2 { margin-left: var(--space-2); }
.p-4 { padding: var(--space-4); }
.p-5 { padding: var(--space-5); }
.p-6 { padding: var(--space-6); }
.w-100 { width: 100%; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.fw-bold { font-weight: var(--fw-bold); }
.fw-semibold { font-weight: var(--fw-semibold); }
.fw-medium { font-weight: var(--fw-medium); }
.text-danger { color: var(--color-error) !important; }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.text-muted { color: var(--color-fg-secondary); }
.text-accent { color: var(--color-accent-lavender); }


