:root {
  --bg: #080a0f;
  --surface: #0f131c;
  --surface-2: #151b28;
  --surface-3: #1b2232;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-glow: rgba(59, 130, 246, 0.25);

  --c-fila: #64748b;
  --c-roteiro: #38bdf8;
  --c-gravado: #f59e0b;
  --c-edicao: #a855f7;
  --c-pronto: #14b8a6;
  --c-lancado: #6366f1;

  --v-nao: #64748b;
  --v-teste: #f59e0b;
  --v-validado: #10b981;
  --v-escala: #22c55e;
  --v-pausado: #fb923c;
  --v-reprovado: #f43f5e;

  --radius: 12px;
  --radius-sm: 8px;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 13.5px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font-family: inherit;
  color: inherit;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.hidden {
  display: none !important;
}

.mono {
  font-family: var(--font-mono);
}

.text-danger {
  color: #fb7185 !important;
}

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  background: rgba(8, 10, 15, 0.86);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.25), rgba(16, 185, 129, 0.15));
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: #60a5fa;
  display: grid;
  place-items: center;
}

.brand-title {
  font-weight: 700;
  font-size: 14.5px;
  letter-spacing: -0.02em;
}

.brand-sub {
  font-weight: 500;
  color: var(--text-muted);
}

.brand-meta {
  font-size: 11px;
  color: var(--text-dim);
}

.offer-select {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  outline: none;
}

.offer-select:focus {
  border-color: var(--accent);
}

/* UTMify live pill */
.utmify-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 6px 4px 12px;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.8);
}

.live-dot.loading {
  background: #f59e0b;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.8);
}

.live-dot.error {
  background: #f43f5e;
  box-shadow: 0 0 8px rgba(244, 63, 94, 0.8);
}

.utmify-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  margin-right: 2px;
}

.preset-group {
  display: inline-flex;
  gap: 2px;
}

.preset-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 500;
  padding: 5px 9px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.preset-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.preset-btn.active {
  background: var(--accent);
  color: #fff;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: var(--radius-sm);
  padding: 7px 13px;
  font-size: 12.5px;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

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

.btn-xs {
  padding: 3px 8px;
  font-size: 11.5px;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 12px var(--accent-glow);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--surface-2);
  border-color: var(--border-strong);
  color: var(--text);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--surface-3);
}

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

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-2);
  color: var(--text);
}

.icon-btn,
.icon-btn-lg {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.icon-btn-lg {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border-color: var(--border);
  background: var(--surface);
}

.icon-btn:hover,
.icon-btn-lg:hover {
  background: var(--surface-2);
  color: var(--text);
}

.spin {
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Main container */
.main-container {
  max-width: 1580px;
  margin: 0 auto;
  padding: 20px 24px 56px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.section-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}

.period-badge,
.cache-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.14);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.25);
  font-weight: 500;
}

.cache-badge {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-dim);
  border-color: var(--border);
}

.perf-banner {
  font-size: 11.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.perf-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.28);
  color: #6ee7b7;
  font-size: 11.5px;
}

.perf-chip.empty {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.25);
  color: #fcd34d;
  cursor: pointer;
}

.error-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.35);
  color: #fda4af;
  margin-bottom: 12px;
}

/* KPI Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 1320px) {
  .kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.15s ease;
}

.kpi-card:hover {
  border-color: var(--border-strong);
}

.kpi-card.highlight-profit {
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.08), var(--surface));
  border-color: rgba(16, 185, 129, 0.25);
}

.kpi-label {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kpi-value {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
}

.kpi-value.positive {
  color: #34d399;
}

.kpi-value.negative {
  color: #fb7185;
}

.kpi-sub {
  font-size: 11.5px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.kpi-sub strong {
  color: var(--text-muted);
  font-weight: 600;
}

.skeleton-card {
  min-height: 98px;
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Pipeline Strip */
.pipeline-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.page-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.page-subtitle {
  margin: 3px 0 0;
  font-size: 12.5px;
  color: var(--text-muted);
}

.view-tabs {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 3px;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tab-btn:hover {
  color: var(--text);
}

.tab-btn.active {
  background: var(--surface-3);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.pipeline-bar-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pipeline-progress {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
  display: flex;
  gap: 2px;
}

.progress-seg {
  height: 100%;
  transition: width 0.25s ease;
}

.filter-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-row-label {
  width: 72px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  flex-shrink: 0;
}

.pill-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-pill:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.filter-pill.active {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.16);
  color: #bfdbfe;
}

.pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.pill-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  background: rgba(0, 0, 0, 0.25);
  padding: 0 5px;
  border-radius: 999px;
}

/* Toolbar */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.search-box {
  flex: 1;
  min-width: 260px;
  max-width: 520px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  color: var(--text-dim);
}

.search-box:focus-within {
  border-color: var(--accent);
  color: var(--text);
}

.search-box input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 13px;
  color: var(--text);
}

.clear-btn {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
}

.clear-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.14);
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.result-count {
  font-size: 12px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.sort-select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 12.5px;
  color: var(--text);
  outline: none;
}

/* Table */
.table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.table-scroll {
  overflow-x: auto;
}

.creatives-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.creatives-table thead th {
  padding: 11px 14px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.creatives-table th.num,
.creatives-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.creatives-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.12s ease;
}

.creatives-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.025);
}

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

.creatives-table td {
  padding: 10px 14px;
  vertical-align: middle;
}

.creative-cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
  cursor: pointer;
}

.creative-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ad-code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.25);
  padding: 2px 6px;
  border-radius: 5px;
}

.creative-title {
  font-weight: 600;
  color: var(--text);
  font-size: 13px;
}

.creative-cell:hover .creative-title {
  color: #60a5fa;
}

.creative-subbadges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.mini-badge {
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.mini-badge.demand-pending {
  background: rgba(168, 85, 247, 0.14);
  border-color: rgba(168, 85, 247, 0.35);
  color: #d8b4fe;
}

.mini-badge.demand-done {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.28);
  color: #6ee7b7;
}

.mini-badge.priority-alta,
.mini-badge.priority-urgente {
  background: rgba(244, 63, 94, 0.12);
  border-color: rgba(244, 63, 94, 0.3);
  color: #fda4af;
}

/* Status Selects */
.status-select {
  appearance: none;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  outline: none;
  width: 100%;
  max-width: 148px;
  text-align: left;
  transition: filter 0.12s ease;
}

.status-select:hover {
  filter: brightness(1.12);
}

.status-select option {
  background: #0f131c;
  color: #f1f5f9;
}

/* Creation status colors */
.st-fila { background: rgba(100, 116, 139, 0.18); color: #cbd5e1; border-color: rgba(100, 116, 139, 0.35); }
.st-roteiro { background: rgba(56, 189, 248, 0.15); color: #7dd3fc; border-color: rgba(56, 189, 248, 0.35); }
.st-gravado { background: rgba(245, 158, 11, 0.15); color: #fcd34d; border-color: rgba(245, 158, 11, 0.35); }
.st-em_edicao { background: rgba(168, 85, 247, 0.16); color: #d8b4fe; border-color: rgba(168, 85, 247, 0.38); }
.st-pronto { background: rgba(20, 184, 166, 0.16); color: #5eead4; border-color: rgba(20, 184, 166, 0.38); }
.st-lancado { background: rgba(99, 102, 241, 0.18); color: #a5b4fc; border-color: rgba(99, 102, 241, 0.4); }

/* Validation status colors */
.val-nao_lancado { background: rgba(100, 116, 139, 0.14); color: #94a3b8; border-color: rgba(100, 116, 139, 0.28); }
.val-em_teste { background: rgba(245, 158, 11, 0.16); color: #fcd34d; border-color: rgba(245, 158, 11, 0.38); }
.val-validado { background: rgba(16, 185, 129, 0.16); color: #6ee7b7; border-color: rgba(16, 185, 129, 0.4); }
.val-escala { background: rgba(34, 197, 94, 0.22); color: #86efac; border-color: rgba(34, 197, 94, 0.55); box-shadow: 0 0 10px rgba(34, 197, 94, 0.2); }
.val-pausado { background: rgba(251, 146, 60, 0.16); color: #fdba74; border-color: rgba(251, 146, 60, 0.38); }
.val-reprovado { background: rgba(244, 63, 94, 0.16); color: #fda4af; border-color: rgba(244, 63, 94, 0.38); }

/* Drive link buttons */
.links-group {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.creatives-table .links-group {
  flex-wrap: nowrap;
  white-space: nowrap;
}

.drive-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 500;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.12s ease;
}

.drive-btn:hover {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.14);
}

.drive-btn.video {
  border-color: rgba(20, 184, 166, 0.35);
  background: rgba(20, 184, 166, 0.1);
  color: #5eead4;
}

.drive-btn.video:hover {
  background: rgba(20, 184, 166, 0.22);
}

.drive-btn.copy {
  border-color: rgba(56, 189, 248, 0.35);
  background: rgba(56, 189, 248, 0.1);
  color: #7dd3fc;
}

.drive-btn.copy:hover {
  background: rgba(56, 189, 248, 0.22);
}

.drive-btn.raws {
  border-color: rgba(245, 158, 11, 0.3);
  background: rgba(245, 158, 11, 0.08);
  color: #fcd34d;
}

.drive-btn.muted {
  opacity: 0.42;
  cursor: default;
  border-style: dashed;
}

.drive-btn.folder {
  padding: 4px 7px;
  color: var(--text-muted);
}

.roas-pill {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 5px;
}

.roas-great { background: rgba(34, 197, 94, 0.18); color: #86efac; }
.roas-good { background: rgba(16, 185, 129, 0.14); color: #6ee7b7; }
.roas-warn { background: rgba(245, 158, 11, 0.15); color: #fcd34d; }
.roas-bad { background: rgba(244, 63, 94, 0.15); color: #fda4af; }

.muted-dash {
  color: var(--text-dim);
}

/* Popover */
.popover {
  position: fixed;
  z-index: 80;
  min-width: 240px;
  max-width: 320px;
  background: #131926;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 8px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.65);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.popover-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  padding: 4px 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.popover-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 9px;
  border-radius: 6px;
  font-size: 12px;
  color: var(--text);
  transition: background 0.12s ease;
}

.popover-item:hover {
  background: rgba(59, 130, 246, 0.15);
}

.popover-size {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
}

/* Kanban */
.kanban-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.segmented-control {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
}

.seg-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.seg-btn.active {
  background: var(--accent);
  color: #fff;
}

.kanban-hint {
  font-size: 12px;
  color: var(--text-dim);
}

.kanban-board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(220px, 1fr);
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 12px;
}

.kanban-col {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  max-height: 70vh;
}

.kanban-col.drag-over {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.06);
}

.kanban-col-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  font-size: 12.5px;
}

.kanban-col-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.kanban-cards {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}

.kanban-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: grab;
  transition: border-color 0.12s ease, transform 0.12s ease;
}

.kanban-card:hover {
  border-color: var(--border-strong);
}

.kanban-card.dragging {
  opacity: 0.45;
}

.kanban-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.kanban-card-title {
  font-weight: 600;
  font-size: 12.5px;
  cursor: pointer;
}

.kanban-card-title:hover {
  color: #60a5fa;
}

.kanban-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
}

/* Analytics */
.analytics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

@media (max-width: 960px) {
  .analytics-grid {
    grid-template-columns: 1fr;
  }
}

.panel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.panel-card.full {
  grid-column: 1 / -1;
}

.panel-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.bottleneck-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 960px) {
  .bottleneck-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.bottleneck-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  cursor: pointer;
  transition: border-color 0.12s ease;
}

.bottleneck-card:hover {
  border-color: var(--accent);
}

.bottleneck-num {
  font-size: 24px;
  font-weight: 700;
  font-family: var(--font-mono);
}

.bottleneck-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.bar-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bar-row {
  display: grid;
  grid-template-columns: 140px 1fr 82px;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}

.bar-track {
  height: 9px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
}

/* Drawer */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(3px);
  z-index: 60;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(540px, 100vw);
  height: 100vh;
  background: #0d111a;
  border-left: 1px solid var(--border-strong);
  z-index: 70;
  display: flex;
  flex-direction: column;
  box-shadow: -20px 0 60px rgba(0, 0, 0, 0.65);
}

.drawer-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.drawer-code {
  font-family: var(--font-mono);
  font-size: 12px;
  color: #60a5fa;
  margin-bottom: 4px;
}

.drawer-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.drawer-body {
  padding: 20px 22px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.drawer-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.drawer-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}

.resource-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.resource-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 12.5px;
}

.resource-item:hover {
  border-color: var(--accent);
}

.metrics-mini-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.metric-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
}

.metric-box-label {
  font-size: 10.5px;
  color: var(--text-dim);
}

.metric-box-val {
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font-mono);
  margin-top: 2px;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-card {
  width: min(560px, 100%);
  background: #0f131c;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.75);
  overflow: hidden;
}

.modal-sm {
  width: min(440px, 100%);
}

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

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

.modal-header p {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

.modal-body {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.modal-actions-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dropzone {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  cursor: pointer;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.015);
  transition: all 0.15s ease;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.08);
  color: var(--text);
}

.dropzone span {
  font-size: 11.5px;
  color: var(--text-dim);
}

.form-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-row-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-field label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

.form-field input,
.form-field select,
.form-field textarea {
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  padding: 8px 10px;
  font-size: 13px;
  outline: none;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  border-color: var(--accent);
}

.checkbox-field {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-muted);
  cursor: pointer;
}

.import-result {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.32);
  color: #a7f3d0;
  font-size: 12.5px;
}

.empty-state {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

/* Toasts */
.toast-stack {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: #141a26;
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 12.5px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
}

.toast.success {
  border-color: rgba(16, 185, 129, 0.5);
}

.toast.error {
  border-color: rgba(244, 63, 94, 0.5);
}


/* ---------------- v2 Upgrades: Auth, Hierarchy, 10 Validation Statuses, ClickUp Demands ---------------- */

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: radial-gradient(circle at top, rgba(59, 130, 246, 0.14), transparent 55%), var(--bg);
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-card {
  width: min(400px, 100%);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.75);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-btn {
  width: 100%;
  justify-content: center;
  padding: 10px 16px;
  font-size: 13.5px;
  margin-top: 4px;
}

.login-error {
  padding: 9px 12px;
  border-radius: 8px;
  background: rgba(244, 63, 94, 0.14);
  border: 1px solid rgba(244, 63, 94, 0.38);
  color: #fda4af;
  font-size: 12.5px;
}

/* User Menu */
.user-menu-wrap {
  position: relative;
}

.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 3px 10px 3px 4px;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.user-pill:hover {
  border-color: var(--accent);
}

.user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 12px;
  color: #fff;
  background: var(--accent);
}

.user-pill-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.1;
}

.user-pill-info strong {
  font-size: 12px;
}

.user-pill-info small {
  font-size: 10px;
  color: var(--text-dim);
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 210px;
  background: #131926;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 6px;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.65);
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dropdown-item {
  text-align: left;
  background: transparent;
  border: none;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 12.5px;
  cursor: pointer;
}

.dropdown-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.dropdown-sep {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* Tab badge */
.tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  font-size: 10.5px;
  font-family: var(--font-mono);
  background: rgba(59, 130, 246, 0.22);
  color: #93c5fd;
  margin-left: 4px;
}

/* 10 Validation Statuses */
.status-select.val-em_escala { background: rgba(34, 197, 94, 0.22); color: #86efac; border-color: rgba(34, 197, 94, 0.55); box-shadow: 0 0 10px rgba(34, 197, 94, 0.16); }
.status-select.val-em_ascensao { background: rgba(56, 189, 248, 0.2); color: #7dd3fc; border-color: rgba(56, 189, 248, 0.45); }
.status-select.val-validado { background: rgba(16, 185, 129, 0.17); color: #6ee7b7; border-color: rgba(16, 185, 129, 0.42); }
.status-select.val-validado_direcional { background: rgba(20, 184, 166, 0.16); color: #5eead4; border-color: rgba(20, 184, 166, 0.38); }
.status-select.val-zona_cinzenta { background: rgba(234, 179, 8, 0.17); color: #fde047; border-color: rgba(234, 179, 8, 0.42); }
.status-select.val-perdendo_tracao { background: rgba(249, 115, 22, 0.18); color: #fdba74; border-color: rgba(249, 115, 22, 0.45); }
.status-select.val-escalou_perdeu_tracao { background: rgba(251, 146, 60, 0.14); color: #fed7aa; border-color: rgba(251, 146, 60, 0.35); }
.status-select.val-em_teste { background: rgba(168, 85, 247, 0.16); color: #d8b4fe; border-color: rgba(168, 85, 247, 0.38); }
.status-select.val-nao_validado { background: rgba(244, 63, 94, 0.16); color: #fda4af; border-color: rgba(244, 63, 94, 0.38); }
.status-select.val-nao_lancado { background: rgba(100, 116, 139, 0.14); color: #94a3b8; border-color: rgba(100, 116, 139, 0.28); }
.status-select { max-width: 185px; }

/* Hierarchical Family -> Versions Table */
.creative-row-flex {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.expand-btn {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text-muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 11px;
  margin-top: 1px;
  transition: all 0.12s ease;
}

.expand-btn:hover {
  border-color: var(--accent);
  color: var(--text);
  background: rgba(59, 130, 246, 0.15);
}

.expand-placeholder {
  width: 22px;
  flex-shrink: 0;
}

.version-row {
  background: rgba(15, 23, 42, 0.58);
}

.version-row:hover {
  background: rgba(30, 41, 59, 0.55) !important;
}

.version-row td {
  padding-top: 7px;
  padding-bottom: 7px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.045);
}

.version-indent {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 24px;
}

.version-branch {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 12px;
}

.ad-code.version-code {
  background: rgba(148, 163, 184, 0.1);
  border-color: rgba(148, 163, 184, 0.22);
  color: #cbd5e1;
  font-size: 11px;
}

.motor-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(234, 179, 8, 0.18);
  border: 1px solid rgba(234, 179, 8, 0.45);
  color: #fde047;
  letter-spacing: 0.03em;
}

.live7d-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.38);
  color: #86efac;
}

.versions-count-badge {
  font-size: 10.5px;
  font-family: var(--font-mono);
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.26);
  color: #93c5fd;
}

.ci-sub {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 2px;
}

/* Statistical CI Bar in Drawer */
.ci-bar-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ci-track {
  position: relative;
  height: 12px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  overflow: visible;
  margin: 6px 0;
}

.ci-range-fill {
  position: absolute;
  top: 2px;
  bottom: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, #38bdf8, #22c55e);
}

.ci-breakeven-mark {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 2px;
  background: #f43f5e;
}

.mini-monthly-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
}

.mini-monthly-table th,
.mini-monthly-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  text-align: right;
}

.mini-monthly-table th:first-child,
.mini-monthly-table td:first-child {
  text-align: left;
}

/* ClickUp Demands Manager */
.demands-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.demands-filters-left,
.demands-filters-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.demand-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 11px;
  color: var(--text-dim);
}

.assignee-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  padding: 2px 7px 2px 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
}

.assignee-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 9.5px;
  font-weight: 700;
  color: #fff;
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 12.5px;
}

.checklist-item.done span {
  text-decoration: line-through;
  color: var(--text-dim);
}

.comment-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 11px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.comment-head {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-dim);
}

.comment-head strong {
  color: var(--text);
}

.team-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
