/* ============================================================
   Criativos Hub — Global Design System
   Versão: 1.0.0 | Tema: Dark Premium
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ============================================================
   1. Variáveis CSS (Design Tokens)
   ============================================================ */
:root {
  /* Cores primárias */
  --color-primary:        #6366f1;
  --color-primary-hover:  #818cf8;
  --color-primary-light:  rgba(99,102,241,.15);

  /* Superfícies */
  --color-bg:             #0b0c10;
  --color-surface:        #111318;
  --color-surface-2:      #181b22;
  --color-surface-3:      #1f232e;
  --color-border:         rgba(255,255,255,.08);
  --color-border-hover:   rgba(255,255,255,.16);

  /* Texto */
  --color-text:           #e8eaf0;
  --color-text-muted:     #7c8394;
  --color-text-faint:     #3d4259;

  /* Status */
  --color-pending:        #f59e0b;
  --color-pending-bg:     rgba(245,158,11,.12);
  --color-approved:       #10b981;
  --color-approved-bg:    rgba(16,185,129,.12);
  --color-rejected:       #ef4444;
  --color-rejected-bg:    rgba(239,68,68,.12);
  --color-review:         #6366f1;
  --color-review-bg:      rgba(99,102,241,.12);

  /* Tipografia */
  --font-base:   'Inter', system-ui, sans-serif;
  --text-xs:     .75rem;
  --text-sm:     .875rem;
  --text-base:   1rem;
  --text-lg:     1.125rem;
  --text-xl:     1.25rem;
  --text-2xl:    1.5rem;
  --text-3xl:    1.875rem;

  /* Espaçamento */
  --space-1:  .25rem;
  --space-2:  .5rem;
  --space-3:  .75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* Bordas */
  --radius-sm: .375rem;
  --radius:    .625rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
  --radius-full: 9999px;

  /* Sombras */
  --shadow-sm:  0 1px 3px rgba(0,0,0,.4);
  --shadow:     0 4px 16px rgba(0,0,0,.5);
  --shadow-lg:  0 8px 32px rgba(0,0,0,.6);
  --shadow-glow: 0 0 24px rgba(99,102,241,.25);

  /* Transições */
  --ease:     cubic-bezier(.4,0,.2,1);
  --duration: 200ms;

  /* Sidebar */
  --sidebar-w: 260px;
  --topbar-h:  64px;
}

/* ============================================================
   2. Reset & Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: var(--font-base);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--color-primary); text-decoration: none; transition: color var(--duration) var(--ease); }
a:hover { color: var(--color-primary-hover); }

img, video { max-width: 100%; display: block; }
input, textarea, select, button { font-family: inherit; }

/* ============================================================
   3. Layout Principal (Sidebar + Conteúdo)
   ============================================================ */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  z-index: 100;
  transition: transform var(--duration) var(--ease);
}

.sidebar-logo {
  padding: var(--space-6) var(--space-6) var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  border-bottom: 1px solid var(--color-border);
}
.sidebar-logo .logo-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--color-primary), #a855f7);
  display: grid; place-items: center;
  font-size: var(--text-lg); font-weight: 800; color: #fff;
}
.sidebar-logo .logo-text {
  font-size: var(--text-base);
  font-weight: 700;
  background: linear-gradient(90deg, #fff, var(--color-primary-hover));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sidebar-nav { flex: 1; padding: var(--space-4) var(--space-3); overflow-y: auto; }

.nav-section-title {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--color-text-faint);
  padding: var(--space-3) var(--space-3) var(--space-2);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-3);
  border-radius: var(--radius);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: all var(--duration) var(--ease);
  margin-bottom: var(--space-1);
  position: relative;
}
.nav-link:hover {
  background: var(--color-surface-2);
  color: var(--color-text);
}
.nav-link.active {
  background: var(--color-primary-light);
  color: var(--color-primary-hover);
}
.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  border-radius: 0 2px 2px 0;
  background: var(--color-primary);
}
.nav-link .nav-icon { font-size: 1.1rem; flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  background: var(--color-rejected);
  color: #fff;
  font-size: var(--text-xs);
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
}

.sidebar-footer {
  padding: var(--space-4);
  border-top: 1px solid var(--color-border);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius);
  transition: background var(--duration) var(--ease);
}
.sidebar-user:hover { background: var(--color-surface-2); }
.sidebar-user .user-avatar {
  width: 34px; height: 34px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--color-primary), #a855f7);
  display: grid; place-items: center;
  font-size: var(--text-sm); font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.sidebar-user .user-info { flex: 1; min-width: 0; }
.sidebar-user .user-name { font-size: var(--text-sm); font-weight: 600; truncate: ellipsis; }
.sidebar-user .user-role { font-size: var(--text-xs); color: var(--color-text-muted); }

/* --- Topbar --- */
.topbar {
  height: var(--topbar-h);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  padding: 0 var(--space-6);
  gap: var(--space-4);
  position: fixed;
  top: 0;
  right: 0;
  left: var(--sidebar-w);
  z-index: 90;
  backdrop-filter: blur(8px);
}
.topbar-title { font-size: var(--text-lg); font-weight: 700; flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: var(--space-3); }

.icon-btn {
  width: 38px; height: 38px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface-2);
  display: grid; place-items: center;
  cursor: pointer;
  color: var(--color-text-muted);
  font-size: 1rem;
  transition: all var(--duration) var(--ease);
  position: relative;
}
.icon-btn:hover {
  border-color: var(--color-border-hover);
  color: var(--color-text);
  background: var(--color-surface-3);
}
.icon-btn .badge-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 7px; height: 7px;
  background: var(--color-rejected);
  border-radius: var(--radius-full);
  border: 2px solid var(--color-surface);
}

/* --- Área de Conteúdo --- */
.main-content {
  margin-left: var(--sidebar-w);
  padding-top: var(--topbar-h);
  flex: 1;
  min-height: 100vh;
}
.page-content {
  padding: var(--space-8) var(--space-8);
}

/* ============================================================
   4. Cards
   ============================================================ */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--duration) var(--ease),
              box-shadow var(--duration) var(--ease);
}
.card:hover {
  border-color: var(--color-border-hover);
  box-shadow: var(--shadow);
}
.card-body { padding: var(--space-6); }
.card-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}
.card-title { font-size: var(--text-base); font-weight: 600; }

/* Card de Criativo (Grid) */
.criativo-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--duration) var(--ease);
  cursor: pointer;
  position: relative;
}
.criativo-card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow), 0 0 0 1px var(--color-primary-light);
  transform: translateY(-2px);
}
.criativo-card .thumb-wrapper {
  aspect-ratio: 1/1;
  background: var(--color-surface-2);
  overflow: hidden;
  position: relative;
}
.criativo-card .thumb-wrapper img,
.criativo-card .thumb-wrapper video {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 400ms var(--ease);
}
.criativo-card:hover .thumb-wrapper img { transform: scale(1.05); }
.criativo-card .tipo-badge {
  position: absolute;
  top: var(--space-3); left: var(--space-3);
}
.criativo-card .play-icon {
  position: absolute;
  inset: 0;
  display: grid; place-items: center;
  background: rgba(0,0,0,.4);
  font-size: 2rem;
  color: rgba(255,255,255,.9);
  opacity: 0;
  transition: opacity var(--duration) var(--ease);
}
.criativo-card:hover .play-icon { opacity: 1; }
.criativo-card .card-info { padding: var(--space-4); }
.criativo-card .card-info .titulo {
  font-weight: 600;
  font-size: var(--text-sm);
  margin-bottom: var(--space-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.criativo-card .card-info .meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* Carrossel de slides */
.carousel-container { position: relative; overflow: hidden; border-radius: var(--radius-lg); }
.carousel-track { display: flex; transition: transform 350ms var(--ease); }
.carousel-slide { min-width: 100%; }
.carousel-slide img, .carousel-slide video { width: 100%; max-height: 70vh; object-fit: contain; }
.carousel-controls {
  display: flex; align-items: center; justify-content: center;
  gap: var(--space-3); margin-top: var(--space-4);
}
.carousel-btn {
  width: 36px; height: 36px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-surface-2);
  display: grid; place-items: center;
  cursor: pointer;
  color: var(--color-text);
  transition: all var(--duration) var(--ease);
}
.carousel-btn:hover { background: var(--color-primary); border-color: var(--color-primary); }
.carousel-dots { display: flex; gap: 6px; }
.carousel-dot {
  width: 8px; height: 8px;
  border-radius: var(--radius-full);
  background: var(--color-border);
  transition: background var(--duration) var(--ease), width var(--duration) var(--ease);
  cursor: pointer;
}
.carousel-dot.active { background: var(--color-primary); width: 20px; }

/* ============================================================
   5. Badges de Status e Tipo
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: .02em;
  white-space: nowrap;
}
.badge-pendente  { background: var(--color-pending-bg);  color: var(--color-pending);  }
.badge-aprovado  { background: var(--color-approved-bg); color: var(--color-approved); }
.badge-recusado  { background: var(--color-rejected-bg); color: var(--color-rejected); }
.badge-revisao   { background: var(--color-review-bg);   color: var(--color-review);   }
.badge-feed      { background: rgba(59,130,246,.12);  color: #60a5fa; }
.badge-stories   { background: rgba(236,72,153,.12);  color: #f472b6; }
.badge-reels     { background: rgba(168,85,247,.12);  color: #c084fc; }
.badge-carrossel { background: rgba(20,184,166,.12);  color: #2dd4bf; }

/* ============================================================
   6. Botões
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius);
  font-size: var(--text-sm);
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  white-space: nowrap;
  user-select: none;
  line-height: 1;
}
.btn:disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn:active { transform: scale(.97); }

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

.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
  border-color: var(--color-border);
}
.btn-ghost:hover { background: var(--color-surface-2); color: var(--color-text); border-color: var(--color-border-hover); }

.btn-success {
  background: var(--color-approved);
  color: #fff;
}
.btn-success:hover { background: #059669; box-shadow: 0 0 20px rgba(16,185,129,.3); }

.btn-danger {
  background: var(--color-rejected);
  color: #fff;
}
.btn-danger:hover { background: #dc2626; box-shadow: 0 0 20px rgba(239,68,68,.3); }

.btn-warning {
  background: var(--color-pending);
  color: #000;
}
.btn-warning:hover { background: #d97706; }

.btn-sm { padding: var(--space-2) var(--space-4); font-size: var(--text-xs); }
.btn-lg { padding: var(--space-4) var(--space-8); font-size: var(--text-base); }
.btn-block { width: 100%; }
.btn-icon { width: 38px; height: 38px; padding: 0; }

/* ============================================================
   7. Formulários
   ============================================================ */
.form-group { margin-bottom: var(--space-5); }
.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  margin-bottom: var(--space-2);
  color: var(--color-text);
}
.form-label .required { color: var(--color-rejected); }
.form-control {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-text);
  font-size: var(--text-sm);
  transition: border-color var(--duration) var(--ease),
              box-shadow var(--duration) var(--ease);
  outline: none;
}
.form-control:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}
.form-control::placeholder { color: var(--color-text-faint); }
textarea.form-control { resize: vertical; min-height: 100px; }
.form-hint { font-size: var(--text-xs); color: var(--color-text-muted); margin-top: var(--space-2); }
.form-error { font-size: var(--text-xs); color: var(--color-rejected); margin-top: var(--space-2); }

/* Upload zone */
.upload-zone {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-10);
  text-align: center;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
}
.upload-zone:hover, .upload-zone.dragging {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}
.upload-zone .upload-icon { font-size: 2.5rem; margin-bottom: var(--space-3); }
.upload-zone p { font-size: var(--text-sm); color: var(--color-text-muted); }
.upload-zone input[type=file] { display: none; }

/* ============================================================
   8. Seção de Comentários
   ============================================================ */
.comments-section { display: flex; flex-direction: column; gap: var(--space-4); }
.comment-thread { display: flex; flex-direction: column; gap: var(--space-3); }
.comment-item {
  display: flex;
  gap: var(--space-3);
}
.comment-avatar {
  width: 32px; height: 32px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
  display: grid; place-items: center;
  font-size: var(--text-xs); font-weight: 700; color: #fff;
  margin-top: 2px;
}
.comment-avatar.admin-av  { background: linear-gradient(135deg, var(--color-primary), #a855f7); }
.comment-avatar.client-av { background: linear-gradient(135deg, #0ea5e9, #10b981); }

.comment-bubble {
  flex: 1;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: 0 var(--radius-lg) var(--radius-lg) var(--radius-lg);
  padding: var(--space-3) var(--space-4);
}
.comment-item.is-admin .comment-bubble {
  border-left: 2px solid var(--color-primary);
}
.comment-item.is-client .comment-bubble {
  border-left: 2px solid #0ea5e9;
}
.comment-bubble .comment-header {
  display: flex; align-items: center; gap: var(--space-3);
  margin-bottom: var(--space-2);
}
.comment-bubble .author { font-size: var(--text-sm); font-weight: 600; }
.comment-bubble .time   { font-size: var(--text-xs); color: var(--color-text-muted); margin-left: auto; }
.comment-bubble .text   { font-size: var(--text-sm); line-height: 1.7; }
.comment-actions {
  display: flex; gap: var(--space-3);
  margin-top: var(--space-2);
}
.comment-action-btn {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  background: none;
  border: none;
  cursor: pointer;
  transition: color var(--duration) var(--ease);
  padding: 0;
}
.comment-action-btn:hover { color: var(--color-primary-hover); }

.comment-replies { margin-left: var(--space-10); margin-top: var(--space-3); display: flex; flex-direction: column; gap: var(--space-3); }

.comment-composer {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  display: flex; gap: var(--space-3);
  align-items: flex-end;
}
.comment-composer textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--color-text);
  font-size: var(--text-sm);
  resize: none;
  min-height: 44px;
  max-height: 200px;
  padding-top: var(--space-2);
}
.comment-composer textarea::placeholder { color: var(--color-text-faint); }

/* ============================================================
   9. Stats Cards (Dashboard)
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-5);
  margin-bottom: var(--space-8);
}
.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  transition: all var(--duration) var(--ease);
}
.stat-card:hover { border-color: var(--color-border-hover); box-shadow: var(--shadow); }
.stat-card .stat-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius);
  display: grid; place-items: center;
  font-size: 1.3rem;
}
.stat-card .stat-value {
  font-size: var(--text-3xl);
  font-weight: 800;
  line-height: 1;
}
.stat-card .stat-label {
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

/* ============================================================
   10. Tabela
   ============================================================ */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
thead th {
  text-align: left;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}
tbody td {
  padding: var(--space-4);
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}
tbody tr { transition: background var(--duration) var(--ease); }
tbody tr:hover { background: var(--color-surface-2); }
tbody tr:last-child td { border-bottom: none; }

/* ============================================================
   11. Página de Login
   ============================================================ */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--color-bg);
  position: relative;
  overflow: hidden;
}
.login-page::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  top: -200px; left: -200px;
  background: radial-gradient(circle, rgba(99,102,241,.15), transparent 70%);
  pointer-events: none;
}
.login-page::after {
  content: '';
  position: absolute;
  width: 500px; height: 500px;
  bottom: -200px; right: -100px;
  background: radial-gradient(circle, rgba(168,85,247,.1), transparent 70%);
  pointer-events: none;
}
.login-box {
  width: 100%;
  max-width: 420px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-10);
  position: relative;
  z-index: 1;
  box-shadow: var(--shadow-lg);
}
.login-header { text-align: center; margin-bottom: var(--space-8); }
.login-logo {
  width: 56px; height: 56px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--color-primary), #a855f7);
  display: grid; place-items: center;
  font-size: 1.6rem; font-weight: 900; color: #fff;
  margin: 0 auto var(--space-4);
  box-shadow: var(--shadow-glow);
}
.login-title { font-size: var(--text-2xl); font-weight: 800; }
.login-subtitle { font-size: var(--text-sm); color: var(--color-text-muted); margin-top: var(--space-2); }

/* ============================================================
   12. Alertas e Toasts
   ============================================================ */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius);
  font-size: var(--text-sm);
  margin-bottom: var(--space-4);
  border: 1px solid transparent;
}
.alert-success { background: var(--color-approved-bg); border-color: rgba(16,185,129,.25); color: var(--color-approved); }
.alert-danger  { background: var(--color-rejected-bg); border-color: rgba(239,68,68,.25); color: var(--color-rejected); }
.alert-warning { background: var(--color-pending-bg);  border-color: rgba(245,158,11,.25); color: var(--color-pending); }

#toast-container {
  position: fixed;
  bottom: var(--space-6); right: var(--space-6);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-width: 340px;
}
.toast {
  background: var(--color-surface-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  font-size: var(--text-sm);
  box-shadow: var(--shadow-lg);
  animation: toastIn 300ms var(--ease) both;
  display: flex; align-items: center; gap: var(--space-3);
}
.toast.success { border-left: 3px solid var(--color-approved); }
.toast.error   { border-left: 3px solid var(--color-rejected); }
.toast.info    { border-left: 3px solid var(--color-primary);  }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0);    }
}

/* ============================================================
   13. Modal
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: grid; place-items: center;
  padding: var(--space-4);
  opacity: 0; pointer-events: none;
  transition: opacity var(--duration) var(--ease);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(.95);
  transition: transform var(--duration) var(--ease);
}
.modal-overlay.open .modal { transform: scale(1); }
.modal-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--color-border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: var(--text-base); font-weight: 700; }
.modal-body  { padding: var(--space-6); }
.modal-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--color-border);
  display: flex; justify-content: flex-end; gap: var(--space-3);
}

/* ============================================================
   14. Utilities
   ============================================================ */
.flex          { display: flex; }
.flex-col      { flex-direction: column; }
.items-center  { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-end   { justify-content: flex-end; }
.gap-2         { gap: var(--space-2); }
.gap-3         { gap: var(--space-3); }
.gap-4         { gap: var(--space-4); }
.gap-6         { gap: var(--space-6); }
.grid          { display: grid; }
.grid-cols-2   { grid-template-columns: repeat(2,1fr); }
.grid-cols-3   { grid-template-columns: repeat(3,1fr); }
.grid-cols-4   { grid-template-columns: repeat(4,1fr); }
.criativo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px,1fr)); gap: var(--space-5); }
.mb-4          { margin-bottom: var(--space-4); }
.mb-6          { margin-bottom: var(--space-6); }
.mb-8          { margin-bottom: var(--space-8); }
.mt-auto       { margin-top: auto; }
.text-muted    { color: var(--color-text-muted); }
.text-sm       { font-size: var(--text-sm); }
.text-xs       { font-size: var(--text-xs); }
.text-right    { text-align: right; }
.font-bold     { font-weight: 700; }
.truncate      { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.divider       { height: 1px; background: var(--color-border); margin: var(--space-6) 0; }

/* Skeleton loader */
.skeleton {
  background: linear-gradient(90deg,
    var(--color-surface-2) 25%,
    var(--color-surface-3) 50%,
    var(--color-surface-2) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius);
}
@keyframes shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* Spinner */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: var(--radius-full);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Scrollbar */
::-webkit-scrollbar        { width: 6px; height: 6px; }
::-webkit-scrollbar-track  { background: var(--color-bg); }
::-webkit-scrollbar-thumb  { background: var(--color-surface-3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--color-border-hover); }

/* ============================================================
   15. Responsivo
   ============================================================ */
@media (max-width: 1024px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-260px); }
  .sidebar.open { transform: translateX(0); width: 260px; }
  .topbar { left: 0; }
  .page-content { padding: var(--space-5); }
}
@media (max-width: 640px) {
  .page-content { padding: var(--space-4); }
  .criativo-grid { grid-template-columns: repeat(2,1fr); gap: var(--space-3); }
  .stats-grid { grid-template-columns: repeat(2,1fr); }
  .grid-cols-2, .grid-cols-3, .grid-cols-4 { grid-template-columns: 1fr; }
}
