/* ═══════════════════════════════════════════════════════════════════
   DBEX v2 — Design System
   Referência: Linear + Stripe
   ═══════════════════════════════════════════════════════════════════ */

/* ─── Reset ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #FFFFFF;
  --surface:     #F7F8F9;
  --surface-2:   #F0F1F3;
  --border:      #E2E4E9;
  --border-2:    #ECEEF2;

  --text-1:      #111318;
  --text-2:      #5C6070;
  --text-3:      #9BA3B4;

  --blue:        #2563EB;
  --blue-h:      #1D4ED8;
  --blue-l:      #EFF6FF;
  --blue-b:      #BFDBFE;

  --green:       #059669;
  --green-l:     #ECFDF5;
  --amber:       #D97706;
  --amber-l:     #FFFBEB;
  --red:         #DC2626;
  --red-l:       #FEF2F2;
  --orange:      #EA580C;
  --orange-l:    #FFF7ED;
  --purple:      #7C3AED;
  --purple-l:    #F5F3FF;
  --indigo:      #4338CA;
  --indigo-l:    #EEF2FF;

  --font:        'DM Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --text-xs:     11px;
  --text-sm:     12px;
  --text-base:   13px;
  --text-md:     14px;
  --text-lg:     16px;
  --text-xl:     20px;
  --text-2xl:    26px;
  --text-3xl:    32px;

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

  --r-sm:   4px;
  --r-md:   6px;
  --r-lg:   10px;
  --r-full: 9999px;

  --shadow-xs:  0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg:  0 20px 48px rgba(0,0,0,0.12);

  --sidebar-w: 232px;
  --header-h:  52px;
}

html { font-size: 14px; }
body {
  font-family: var(--font);
  font-size: var(--text-base);
  color: var(--text-1);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
button { font-family: var(--font); cursor: pointer; border: none; outline: none; background: none; }
input, textarea, select { font-family: var(--font); }
* { outline: none; }
*:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ─── App Layout ─────────────────────────────────────────────────────── */
#app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.content {
  flex: 1;
  overflow-y: auto;
  background: var(--surface);
  padding: var(--sp-6) var(--sp-6);
}

/* ─── Sidebar ────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border-2);
}

.logo {
  display: flex;
  align-items: center;
  gap: 7px;
}

.logo-icon {
  font-size: 14px;
  color: var(--blue);
  line-height: 1;
}

.logo-text {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: -0.3px;
}

.btn-new-global {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  background: var(--blue);
  color: white;
  border-radius: var(--r-sm);
  font-size: var(--text-xs);
  font-weight: 600;
  transition: background 0.15s;
  white-space: nowrap;
}
.btn-new-global:hover { background: var(--blue-h); }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-2) var(--sp-2);
}

.sidebar-section {
  margin-bottom: var(--sp-1);
}

.sidebar-section + .sidebar-section {
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border-2);
}

.sidebar-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 4px 10px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 6px 10px;
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-size: var(--text-base);
  font-weight: 500;
  transition: all 0.12s ease;
  margin-bottom: 1px;
  cursor: pointer;
}
.nav-item:hover {
  background: var(--surface);
  color: var(--text-1);
}
.nav-item.active {
  background: var(--blue-l);
  color: var(--blue);
}
.nav-item.active .nav-icon {
  stroke: var(--blue);
}

.nav-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  stroke-width: 1.75;
}

.nav-count {
  margin-left: auto;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--r-full);
  min-width: 18px;
  text-align: center;
}
.nav-count--alert  { background: var(--amber-l); color: #92400E; }
.nav-count--danger { background: var(--red-l);   color: #B91C1C; }

.sidebar-footer {
  padding: var(--sp-3);
  border-top: 1px solid var(--border-2);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 6px 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background 0.12s;
}
.user-profile:hover { background: var(--surface); }
.user-info { display: flex; flex-direction: column; }
.user-name { font-size: var(--text-sm); font-weight: 600; color: var(--text-1); }
.user-role { font-size: var(--text-xs); color: var(--text-3); }

/* ─── Header ─────────────────────────────────────────────────────────── */
.header {
  height: var(--header-h);
  min-height: var(--header-h);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 var(--sp-6);
  gap: var(--sp-4);
}

.header-left { flex-shrink: 0; }
.header-center { flex: 1; display: flex; justify-content: center; }
.header-right  { flex-shrink: 0; display: flex; align-items: center; gap: var(--sp-2); }

.breadcrumb { display: flex; align-items: center; gap: var(--sp-2); }
.breadcrumb-item {
  font-size: var(--text-base);
  color: var(--text-2);
  cursor: pointer;
}
.breadcrumb-item:hover { color: var(--text-1); }
.breadcrumb-sep { color: var(--text-3); font-size: 12px; }
.breadcrumb-item--active {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-1);
  cursor: default;
}

.header-search {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 6px 12px;
  width: 320px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.header-search:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.08);
  background: var(--bg);
}
.header-search svg { color: var(--text-3); flex-shrink: 0; }
.header-search input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: var(--text-base);
  color: var(--text-1);
}
.header-search input::placeholder { color: var(--text-3); }

/* ─── Filter Bar ─────────────────────────────────────────────────────── */
.filter-bar-area {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 8px var(--sp-6);
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

.filter-group { position: relative; }

.filter-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: var(--r-md);
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-2);
  transition: all 0.12s;
  white-space: nowrap;
}
.filter-trigger:hover {
  background: var(--surface);
  color: var(--text-1);
  border-color: #C5C8D2;
}
.filter-trigger.active {
  color: var(--blue);
  border-color: var(--blue);
  background: var(--blue-l);
}

.filter-title { text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-3); }
.filter-value { color: var(--text-1); }
.filter-caret { width: 12px; height: 12px; }

.filter-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 220px;
  max-height: 260px;
  overflow: auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  padding: 6px;
  display: none;
  z-index: 20;
}
.filter-menu.open { display: block; }

.filter-option {
  width: 100%;
  text-align: left;
  padding: 6px 8px;
  border-radius: var(--r-sm);
  font-size: var(--text-sm);
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.1s;
}
.filter-option:hover { background: var(--surface); color: var(--text-1); }
.filter-option.active { background: var(--blue-l); color: var(--blue); }

.filter-date-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg);
}
.filter-date-label {
  font-size: var(--text-xs);
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.filter-date-input {
  font-size: var(--text-xs);
  padding: 3px 6px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text-1);
}

.filter-clear {
  font-size: var(--text-xs);
  color: var(--text-3);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--r-sm);
  transition: all 0.12s;
}
.filter-clear:hover { color: var(--red); background: var(--red-l); }

/* ─── Buttons ────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 7px 14px;
  border-radius: var(--r-md);
  font-size: var(--text-base);
  font-weight: 600;
  transition: all 0.14s;
  white-space: nowrap;
  line-height: 1.4;
  cursor: pointer;
}

.btn--primary { background: var(--blue); color: white; }
.btn--primary:hover { background: var(--blue-h); }

.btn--secondary {
  background: var(--bg);
  color: var(--text-1);
  border: 1px solid var(--border);
}
.btn--secondary:hover { background: var(--surface); border-color: #C5C8D2; }

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

.btn--success { background: #059669; color: white; }
.btn--success:hover { background: #047857; }

.btn--warning { background: var(--amber); color: white; }
.btn--warning:hover { background: #B45309; }

.btn--danger { background: var(--red); color: white; }
.btn--danger:hover { background: #B91C1C; }

.btn--sm { padding: 5px 10px; font-size: var(--text-xs); }
.btn--lg { padding: 10px 20px; font-size: var(--text-md); }
.btn--full { width: 100%; justify-content: center; }

.btn-icon {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-2);
  transition: all 0.12s;
  cursor: pointer;
}
.btn-icon:hover { background: var(--surface); color: var(--text-1); }
.btn-icon svg { width: 14px; height: 14px; stroke-width: 2; }

/* ─── Badges ─────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: var(--r-full);
  font-size: var(--text-xs);
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.6;
}

/* ─── Avatar ─────────────────────────────────────────────────────────── */
.avatar {
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}
.avatar--sm  { width: 22px; height: 22px; font-size: 8px; }
.avatar--md  { width: 28px; height: 28px; font-size: 10px; }
.avatar--lg  { width: 36px; height: 36px; font-size: 13px; }

/* ─── Status Dot ─────────────────────────────────────────────────────── */
.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

/* ─── Page Header ────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--sp-5);
  gap: var(--sp-4);
}

.page-title {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: -0.3px;
  line-height: 1.2;
}

.page-sub {
  font-size: var(--text-base);
  color: var(--text-2);
  margin-top: 3px;
}

.page-actions { display: flex; gap: var(--sp-2); align-items: center; }

/* ─── Section ────────────────────────────────────────────────────────── */
.section { margin-bottom: var(--sp-8); }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-3);
}

.section-title {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--text-1);
}

.section-count {
  font-size: var(--text-base);
  color: var(--text-3);
  font-weight: 400;
  margin-left: 6px;
}

/* ─── Table ──────────────────────────────────────────────────────────── */
.table-wrap {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

.table-wrap table {
  width: 100%;
  min-width: 1120px;
  border-collapse: collapse;
}

.table-wrap--compact table {
  min-width: 820px;
}

.table-wrap::-webkit-scrollbar {
  height: 8px;
}

.table-wrap::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 999px;
}

thead th {
  background: var(--surface);
  padding: 9px 16px;
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--border-2);
  cursor: pointer;
  transition: background 0.1s;
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface); }

tbody td {
  padding: 11px 16px;
  font-size: var(--text-base);
  color: var(--text-1);
  vertical-align: middle;
}

.td-title { font-weight: 600; font-size: var(--text-md); }
.td-sub { font-size: var(--text-xs); color: var(--text-2); margin-top: 1px; }
.td-muted { color: var(--text-2); }

.prazo-atrasado { color: var(--red) !important; font-weight: 700; }
.prazo-urgente  { color: var(--orange) !important; font-weight: 600; }

.inline-date {
  width: 130px;
  padding: 4px 6px;
  font-size: var(--text-xs);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg);
  color: var(--text-1);
}
.inline-date--danger {
  border-color: #FCA5A5;
  background: #FEF2F2;
}
.inline-date--warn {
  border-color: #FCD34D;
  background: #FFFBEB;
}

/* ─── Dashboard ──────────────────────────────────────────────────────── */
.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-5);
}

.dash-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.dash-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-2);
}

.dash-block-title {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--text-1);
}

.dash-block-badge {
  font-size: var(--text-xs);
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--r-full);
}

.dash-block-body { padding: 0; }

.dash-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-2);
  cursor: pointer;
  transition: background 0.1s;
}
.dash-item:last-child { border-bottom: none; }
.dash-item:hover { background: var(--surface); }

.dash-item-info { flex: 1; min-width: 0; }
.dash-item-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-item-sub {
  font-size: var(--text-xs);
  color: var(--text-2);
  margin-top: 1px;
}

.dash-empty {
  padding: 32px 18px;
  text-align: center;
  color: var(--text-3);
  font-size: var(--text-base);
}

/* Bottleneck etapa */
.stage-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 10px 18px;
  border-bottom: 1px solid var(--border-2);
}
.stage-bar:last-child { border-bottom: none; }
.stage-name {
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--text-2);
  width: 90px;
  flex-shrink: 0;
}
.stage-track {
  flex: 1;
  height: 6px;
  background: var(--surface-2);
  border-radius: 3px;
  overflow: hidden;
}
.stage-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s;
}
.stage-count {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-1);
  width: 28px;
  text-align: right;
  flex-shrink: 0;
}

/* Summary chips */
.summary-chips {
  display: flex;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
  flex-wrap: wrap;
}

.summary-chip {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 10px 16px;
  border-radius: var(--r-lg);
  font-size: var(--text-base);
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.12s;
}
.summary-chip svg { width: 14px; height: 14px; }
.summary-chip--red    { background: var(--red-l);    color: #B91C1C; border-color: #FECACA; }
.summary-chip--amber  { background: var(--amber-l);  color: #92400E; border-color: #FCD34D; }
.summary-chip--blue   { background: var(--blue-l);   color: #1D4ED8; border-color: var(--blue-b); }
.summary-chip--green  { background: var(--green-l);  color: #065F46; border-color: #A7F3D0; }
.summary-chip--purple { background: var(--purple-l); color: #5B21B6; border-color: #DDD6FE; }
.summary-chip--red:hover    { background: #FEE2E2; }
.summary-chip--amber:hover  { background: #FEF3C7; }
.summary-chip--blue:hover   { background: #DBEAFE; }
.summary-chip--green:hover  { background: #D1FAE5; }
.summary-chip--purple:hover { background: #EDE9FE; }

/* ─── Project Cards ──────────────────────────────────────────────────── */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-4);
}

.project-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  cursor: pointer;
  transition: all 0.14s;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}
.project-card:hover {
  border-color: #C5C8D2;
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.project-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-2);
}

.project-name { font-size: 14px; font-weight: 700; color: var(--text-1); line-height: 1.3; }
.project-client { font-size: var(--text-xs); color: var(--text-2); margin-top: 3px; }

.progress-wrap { display: flex; flex-direction: column; gap: 4px; }
.progress-bar-bg {
  height: 3px;
  background: var(--surface-2);
  border-radius: 2px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--blue);
  transition: width 0.4s;
}

.project-stats-row {
  display: flex;
  gap: var(--sp-4);
}
.project-stat { font-size: var(--text-xs); color: var(--text-2); }
.project-stat strong { color: var(--text-1); font-weight: 700; }

.project-alerts {
  display: flex;
  gap: var(--sp-2);
}

.project-alert-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: var(--r-full);
  font-size: var(--text-xs);
  font-weight: 600;
}

.project-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ─── Kanban ─────────────────────────────────────────────────────────── */
.board-wrap {
  display: flex;
  gap: var(--sp-3);
  overflow-x: auto;
  padding-bottom: var(--sp-4);
  min-height: 500px;
}

.kanban-col {
  min-width: 240px;
  width: 240px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 200px);
}

.kanban-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 4px 8px;
  flex-shrink: 0;
}

.kanban-col-title {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-2);
}

.kanban-count {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-3);
  background: var(--surface-2);
  border-radius: var(--r-full);
  padding: 1px 6px;
}

.kanban-cards {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: 2px 0;
}
.kanban-cards.drag-over { background: var(--blue-l); border-radius: var(--r-md); }

.kanban-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 12px;
  cursor: pointer;
  transition: all 0.12s;
}
.kanban-card:hover { border-color: #B0B7C6; box-shadow: var(--shadow-sm); }
.kanban-card.dragging { opacity: 0.35; }

.kanban-card-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 8px;
  line-height: 1.35;
}

.kanban-card-meta {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

.kanban-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

/* ─── Criativo Detail ────────────────────────────────────────────────── */
.criativo-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: var(--sp-5);
  align-items: flex-start;
}

.criativo-main {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

/* Workflow progress bar */
.workflow-bar {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-4) var(--sp-5);
}

.workflow-steps {
  display: flex;
  align-items: center;
  gap: 0;
  overflow-x: auto;
}

.workflow-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 70px;
  position: relative;
}

.workflow-step::after {
  content: '';
  position: absolute;
  top: 10px;
  left: 50%;
  right: -50%;
  height: 2px;
  background: var(--border);
  z-index: 0;
}
.workflow-step:last-child::after { display: none; }
.workflow-step.done::after { background: var(--blue); }

.workflow-dot {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg);
  z-index: 1;
  transition: all 0.2s;
  display: flex; align-items: center; justify-content: center;
}
.workflow-step.done .workflow-dot {
  background: var(--blue);
  border-color: var(--blue);
}
.workflow-step.done .workflow-dot::after {
  content: '';
  width: 6px; height: 4px;
  border-left: 2px solid white;
  border-bottom: 2px solid white;
  transform: rotate(-45deg) translateY(-1px);
}
.workflow-step.current .workflow-dot {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}

.workflow-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-3);
  text-align: center;
  white-space: nowrap;
}
.workflow-step.current .workflow-label { color: var(--blue); }
.workflow-step.done .workflow-label  { color: var(--text-2); }

/* Main content card */
.criativo-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}

.criativo-card-header {
  padding: var(--sp-5);
  border-bottom: 1px solid var(--border-2);
}

.criativo-title-row {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}

.criativo-title {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text-1);
  flex: 1;
  border: none;
  background: transparent;
  padding: 2px 4px;
  margin: -2px -4px;
  border-radius: var(--r-sm);
  letter-spacing: -0.3px;
  line-height: 1.25;
  resize: none;
  cursor: text;
}
.criativo-title:hover { background: var(--surface); }
.criativo-title:focus { background: var(--surface); outline: 2px solid var(--blue); }

.criativo-meta-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
}

/* Tabs */
.criativo-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-2);
  padding: 0 var(--sp-5);
}

.criativo-tab {
  padding: 12px 0;
  margin-right: var(--sp-5);
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--text-2);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.12s;
  margin-bottom: -1px;
}
.criativo-tab:hover { color: var(--text-1); }
.criativo-tab.active { color: var(--blue); border-bottom-color: var(--blue); font-weight: 600; }

.tab-pane { display: none; padding: var(--sp-5); }
.tab-pane.active { display: block; }

/* ─── Action Block (sidebar right) ──────────────────────────────────── */
.criativo-sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.action-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.action-block-header {
  background: var(--surface);
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-2);
}

.action-block-label {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
}

.action-block-body {
  padding: var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.action-status-text {
  font-size: var(--text-base);
  color: var(--text-2);
  margin-bottom: var(--sp-2);
}
.action-status-text strong { color: var(--text-1); }

.action-inline-form { display: flex; flex-direction: column; gap: var(--sp-2); }

/* Metadata block */
.meta-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.meta-block-header {
  background: var(--surface);
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-2);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
}

.meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 16px;
  border-bottom: 1px solid var(--border-2);
  gap: var(--sp-3);
}
.meta-row:last-child { border-bottom: none; }
.meta-key {
  font-size: var(--text-xs);
  color: var(--text-2);
  font-weight: 500;
  flex-shrink: 0;
}
.meta-val {
  font-size: var(--text-base);
  color: var(--text-1);
  font-weight: 500;
  text-align: right;
}

/* ─── Forms ──────────────────────────────────────────────────────────── */
.form-group { margin-bottom: var(--sp-4); }
.form-group:last-child { margin-bottom: 0; }

.form-label {
  display: block;
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: var(--text-base);
  color: var(--text-1);
  background: var(--bg);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.08);
  outline: none;
}
.form-textarea {
  resize: vertical;
  min-height: 90px;
  line-height: 1.6;
}
.form-select { cursor: pointer; }
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-3); }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
}

/* ─── Checklist ──────────────────────────────────────────────────────── */
.checklist-item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 7px 0;
  border-bottom: 1px solid var(--border-2);
}
.checklist-item:last-child { border-bottom: none; }

.checkbox {
  width: 16px; height: 16px;
  border: 1.5px solid var(--border);
  border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  transition: all 0.12s;
}
.checkbox.checked {
  background: var(--blue);
  border-color: var(--blue);
}
.checkbox.checked::after {
  content: '';
  width: 8px; height: 5px;
  border-left: 2px solid white;
  border-bottom: 2px solid white;
  transform: rotate(-45deg) translateY(-1px);
}

.checklist-text {
  flex: 1;
  font-size: var(--text-base);
  line-height: 1.4;
}
.checklist-text.done {
  text-decoration: line-through;
  color: var(--text-3);
}

/* ─── Revision ───────────────────────────────────────────────────────── */
.revision-round {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  margin-bottom: var(--sp-3);
}

.revision-round-header {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-2);
}

.revision-round-body { padding: 12px 14px; }

.review-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-4);
}
.review-form textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  font-size: var(--text-base);
  resize: vertical;
  min-height: 80px;
  background: var(--bg);
}

/* ─── Comment list ───────────────────────────────────────────────────── */
.comment-item {
  display: flex;
  gap: var(--sp-3);
  padding: 10px 0;
  border-bottom: 1px solid var(--border-2);
}
.comment-item:last-child { border-bottom: none; }
.comment-body { flex: 1; min-width: 0; }
.comment-meta { font-size: var(--text-xs); color: var(--text-3); margin-bottom: 3px; }
.comment-text { font-size: var(--text-base); line-height: 1.5; }

/* ─── History ────────────────────────────────────────────────────────── */
.history-item {
  display: flex;
  gap: var(--sp-3);
  align-items: flex-start;
  padding: 9px 0;
  border-bottom: 1px solid var(--border-2);
}
.history-item:last-child { border-bottom: none; }
.history-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--border);
  margin-top: 5px;
  flex-shrink: 0;
}
.history-dot.status   { background: var(--blue); }
.history-dot.aprovacao { background: var(--green); }
.history-dot.ajuste   { background: var(--orange); }
.history-dot.criacao  { background: var(--purple); }
.history-text { font-size: var(--text-base); line-height: 1.4; color: var(--text-1); }
.history-time { font-size: var(--text-xs); color: var(--text-3); margin-top: 2px; }

/* ─── Assets ─────────────────────────────────────────────────────────── */
.asset-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 10px 0;
  border-bottom: 1px solid var(--border-2);
}
.asset-item:last-child { border-bottom: none; }
.asset-icon {
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.asset-name { font-size: var(--text-base); font-weight: 500; color: var(--text-1); }
.asset-url  { font-size: var(--text-xs); color: var(--blue); word-break: break-all; }

/* ─── Calendar ───────────────────────────────────────────────────────── */
.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
}

.cal-nav { display: flex; align-items: center; gap: var(--sp-2); }
.cal-month { font-size: var(--text-xl); font-weight: 700; color: var(--text-1); }

.cal-mode-toggle {
  display: flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 2px;
  gap: 2px;
}
.cal-view-toggle {
  display: flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 2px;
  gap: 2px;
}
.cal-mode-btn {
  padding: 5px 12px;
  border-radius: 3px;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-2);
  background: transparent;
  transition: all 0.12s;
}
.cal-mode-btn.active { background: var(--bg); color: var(--text-1); box-shadow: var(--shadow-xs); }
.cal-mode-btn:hover:not(.active) { color: var(--text-1); }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.cal-grid-wrap {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

.cal-grid-wrap::-webkit-scrollbar {
  height: 8px;
}

.cal-grid-wrap::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 999px;
}

.cal-grid {
  min-width: 860px;
}

.cal-day-header {
  background: var(--surface);
  padding: 8px;
  text-align: center;
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.cal-cell {
  background: var(--bg);
  padding: 6px;
  min-height: 110px;
  vertical-align: top;
  transition: background 0.12s ease, box-shadow 0.12s ease;
}
.cal-cell.other-month { background: var(--surface); }
.cal-cell.today { background: #F0F7FF; }
.cal-cell.drag-over {
  background: var(--blue-l);
  box-shadow: inset 0 0 0 2px var(--blue-b);
}

.cal-date {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-2);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
}
.cal-cell.today .cal-date {
  background: var(--blue);
  color: white;
}

.cal-item {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  padding: 2px 5px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  cursor: grab;
  margin-bottom: 2px;
  transition: opacity 0.1s, transform 0.12s ease, box-shadow 0.12s ease;
  overflow: hidden;
  line-height: 1.3;
}
.cal-item:hover { opacity: 0.75; }
.cal-item.dragging {
  opacity: 0.35;
  cursor: grabbing;
  transform: scale(0.98);
  box-shadow: var(--shadow-sm);
}

/* ─── Empty State ────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 64px var(--sp-8);
  color: var(--text-2);
}
.empty-state-icon { font-size: 36px; margin-bottom: var(--sp-3); }
.empty-state-title { font-size: var(--text-lg); font-weight: 600; color: var(--text-1); margin-bottom: var(--sp-2); }
.empty-state-desc { font-size: var(--text-base); color: var(--text-2); margin-bottom: var(--sp-5); max-width: 360px; margin-left: auto; margin-right: auto; }

/* ─── Modal ──────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(9,10,15,0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(2px);
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--bg);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  width: 560px;
  max-width: 95vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
}
.modal--wide { width: 860px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--border-2);
  flex-shrink: 0;
}

.modal-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-1);
}

.modal-body {
  padding: var(--sp-6);
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  gap: var(--sp-2);
  justify-content: flex-end;
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--border-2);
  flex-shrink: 0;
}

.calendar-day-summary {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: var(--sp-4);
}

.calendar-day-summary-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-1);
}

.calendar-day-summary-sub {
  font-size: var(--text-sm);
  color: var(--text-3);
}

.calendar-day-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.calendar-day-card {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  background: var(--surface);
}

.calendar-day-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}

.calendar-day-card-title {
  font-size: var(--text-md);
  font-weight: 700;
  color: var(--text-1);
}

.calendar-day-card-sub {
  margin-top: 3px;
  font-size: var(--text-sm);
  color: var(--text-3);
}

.calendar-day-card-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.calendar-day-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}

.calendar-day-detail,
.calendar-day-text-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.calendar-day-detail span,
.calendar-day-text-block span {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-3);
}

.calendar-day-detail strong {
  font-size: var(--text-sm);
  color: var(--text-1);
}

.calendar-day-text-block {
  margin-bottom: var(--sp-3);
}

.calendar-day-text-block p {
  font-size: var(--text-sm);
  color: var(--text-2);
  line-height: 1.55;
}

.calendar-day-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-2);
}
@media (max-width: 720px) {
  .modal--wide { width: 95vw; }
  .calendar-day-card-top,
  .calendar-day-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .calendar-day-card-badges {
    justify-content: flex-start;
  }
  .calendar-day-grid {
    grid-template-columns: 1fr;
  }
}

/* ─── Toast ──────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column;
  gap: var(--sp-2); z-index: 9999;
}

.toast {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: 10px 16px;
  background: var(--text-1);
  color: white;
  border-radius: var(--r-md);
  font-size: var(--text-base);
  font-weight: 500;
  box-shadow: var(--shadow-md);
  animation: slideIn 0.25s ease;
  max-width: 360px;
}
.toast--success { background: #065F46; }
.toast--error   { background: #B91C1C; }
.toast--warning { background: #92400E; }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);   opacity: 1; }
}

/* ─── Utility ────────────────────────────────────────────────────────── */
.mt-1 { margin-top: var(--sp-1); }
.mt-2 { margin-top: var(--sp-2); }
.mt-3 { margin-top: var(--sp-3); }
.mt-4 { margin-top: var(--sp-4); }
.text-muted { color: var(--text-3); }
.text-sm { font-size: var(--text-sm); }
.font-bold { font-weight: 700; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.flex-1 { flex: 1; }
.w-full { width: 100%; }

/* ─── Skeleton Screens ───────────────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position: 600px 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--border-2) 50%, var(--surface-2) 75%);
  background-size: 600px 100%;
  animation: shimmer 1.4s infinite ease-in-out;
  border-radius: var(--r-sm);
}
.skeleton-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.skeleton-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.skeleton-line { height: 12px; border-radius: 4px; }
.skeleton-avatar { width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; }
.skeleton-stat {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ─── Nav count fade-in ──────────────────────────────────────────────── */
.nav-count { transition: opacity 0.25s ease, transform 0.25s ease; }
.nav-count.is-loading { opacity: 0; transform: scale(0.6); }

/* ─── Realtime pulse indicator ───────────────────────────────────────── */
@keyframes realtimePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(0.85); }
}
.realtime-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--green);
  animation: realtimePulse 2.5s ease-in-out infinite;
  flex-shrink: 0;
}
.realtime-dot.disconnected { background: var(--text-3); animation: none; }

/* ─── Loading screen error state ─────────────────────────────────────── */
.loading-error-btn {
  margin-top: 12px; padding: 8px 20px;
  background: var(--blue); color: white;
  border-radius: 6px; font-size: 13px; font-weight: 600;
  cursor: pointer; border: none; font-family: var(--font);
  transition: background 0.15s;
}
.loading-error-btn:hover { background: var(--blue-h); }

/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVO MOBILE — DBEX
   Breakpoints: 640px (mobile), 768px (tablet), 1024px (desktop)
   ═══════════════════════════════════════════════════════════════════ */

/* ─── Calendário melhorado ───────────────────────────────────────── */
.cal-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.cal-legend {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-3);
  margin-bottom: 12px;
  padding: 6px 10px;
  background: var(--surface);
  border-radius: var(--r-md);
  border: 1px solid var(--border-2);
}

.cal-legend-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--blue);
  flex-shrink: 0;
}

.cal-cell.has-items {
  cursor: pointer;
}
.cal-cell.has-items:hover {
  background: var(--surface);
}

.cal-more {
  font-size: 9px;
  font-weight: 700;
  color: var(--text-3);
  padding: 1px 4px;
  background: var(--surface-2);
  border-radius: 3px;
  margin-top: 2px;
  display: inline-block;
}

/* Semana view — células maiores */
.cal-grid--week .cal-cell {
  min-height: 160px;
}

/* ─── Sidebar mobile overlay ─────────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(9,10,15,0.4);
  z-index: 199;
  backdrop-filter: blur(1px);
}
.sidebar-overlay.open { display: block; }

/* Botão hamburguer no header (mobile only) */
.btn-menu-mobile {
  display: none;
  width: 32px; height: 32px;
  align-items: center; justify-content: center;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.12s;
}
.btn-menu-mobile:hover { background: var(--surface); }
.btn-menu-mobile svg { width: 16px; height: 16px; }

/* ─── Tablet (≤ 1024px) ──────────────────────────────────────────── */
@media (max-width: 1024px) {
  .header-search { width: 240px; }

  .projects-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .cal-header {
    gap: 8px;
  }

  .summary-chips {
    flex-wrap: wrap;
  }
}

/* ─── Mobile (≤ 768px) ───────────────────────────────────────────── */
@media (max-width: 768px) {

  /* Layout principal */
  :root {
    --header-h: 48px;
  }

  .content {
    padding: var(--sp-4);
  }

  /* Sidebar vira overlay deslizante */
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open {
    transform: translateX(0);
  }

  /* Hamburguer visível */
  .btn-menu-mobile {
    display: inline-flex;
  }

  /* Header search menor */
  .header-search {
    width: 100%;
    max-width: 200px;
  }

  /* Header compacto */
  .header {
    padding: 0 var(--sp-3);
    gap: var(--sp-2);
  }

  .breadcrumb-item--active {
    font-size: 13px;
  }

  /* Page header */
  .page-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 10px !important;
  }
  .page-header .header-right,
  .page-header > div:last-child {
    width: 100%;
  }

  /* Page title menor */
  .page-title { font-size: 18px !important; }
  .page-sub { font-size: 12px !important; }

  /* Summary chips wrap */
  .summary-chips {
    flex-wrap: wrap;
    gap: 6px !important;
  }
  .summary-chip {
    flex: 1;
    min-width: 120px;
    font-size: 11px !important;
    padding: 8px 10px !important;
  }

  /* Stats grid — 2 colunas */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Projects grid — 1 coluna */
  .projects-grid {
    grid-template-columns: 1fr !important;
  }

  /* Table — oculta colunas menos importantes */
  .table-col--hide-mobile { display: none !important; }

  /* Criativo table cards */
  .criativo-row {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
  }

  /* Calendário mobile */
  .cal-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .cal-controls {
    width: 100%;
    justify-content: space-between;
  }

  .cal-month { font-size: 16px !important; }

  .cal-cell {
    min-height: 64px !important;
    padding: 4px !important;
  }

  .cal-day-header {
    padding: 6px 4px !important;
    font-size: 9px !important;
  }

  .cal-item {
    padding: 2px 3px !important;
    font-size: 9px !important;
  }

  /* Filter bar scroll horizontal */
  .filter-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }
  .filter-bar::-webkit-scrollbar { height: 0; }

  /* Modal full screen em mobile */
  .modal {
    width: 100vw !important;
    max-width: 100vw !important;
    max-height: 92vh !important;
    border-radius: var(--r-lg) var(--r-lg) 0 0 !important;
    margin-top: auto;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
  }

  .modal-overlay {
    align-items: flex-end !important;
  }

  /* Toast menor */
  .toast-container {
    bottom: 16px;
    right: 12px;
    left: 12px;
  }
  .toast {
    max-width: 100%;
    font-size: 12px;
  }

  /* Sidebar footer io */
  .sidebar-io { display: none !important; }

  /* Criativo detail — duas colunas vira uma */
  .criativo-grid-2col {
    grid-template-columns: 1fr !important;
  }
}

/* ─── Pequenos (≤ 480px) ─────────────────────────────────────────── */
@media (max-width: 480px) {
  .content {
    padding: 12px;
  }

  .page-title { font-size: 16px !important; }

  .summary-chip {
    min-width: 100%;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr !important;
  }

  .cal-cell {
    min-height: 52px !important;
  }

  .header-search {
    display: none;
  }

  .btn-new-global span { display: none; }
}


/* UX upgrades */
.quick-filter-row { display:flex; align-items:center; gap:6px; flex-wrap:wrap; }
.quick-filter {
  display:inline-flex; align-items:center; justify-content:center;
  height:28px; padding:0 10px; border-radius:999px;
  border:1px solid var(--border); background:var(--bg); color:var(--text-2);
  font-size:11px; font-weight:700; transition:all .14s ease;
}
.quick-filter:hover { background:var(--surface); color:var(--text-1); }
.quick-filter.active { background:var(--blue-l); border-color:var(--blue); color:var(--blue); }

tbody tr.row--danger td { background:linear-gradient(0deg, rgba(220,38,38,0.045), rgba(220,38,38,0.045)); }
tbody tr.row--warning td { background:linear-gradient(0deg, rgba(234,88,12,0.045), rgba(234,88,12,0.045)); }

.just-updated { animation:flashUpdated 1.2s ease; }
@keyframes flashUpdated {
  0% { box-shadow: inset 0 0 0 9999px rgba(37,99,235,0.10); }
  100% { box-shadow: inset 0 0 0 9999px rgba(37,99,235,0); }
}

.btn-menu-mobile {
  width:34px; height:34px; display:none; align-items:center; justify-content:center;
  border:1px solid var(--border); border-radius:8px; color:var(--text-2); background:var(--bg);
}
.btn-menu-mobile svg { width:16px; height:16px; }
.sidebar-overlay {
  position:fixed; inset:0; background:rgba(17,19,24,0.42); opacity:0; visibility:hidden; transition:.18s ease;
  z-index:50;
}
.sidebar-overlay.open { opacity:1; visibility:visible; }
.realtime-dot { width:8px; height:8px; border-radius:999px; background:#d1d5db; }
.realtime-dot.connected { background:#10b981; box-shadow:0 0 0 4px rgba(16,185,129,.14); }
.realtime-dot.disconnected { background:#f59e0b; box-shadow:0 0 0 4px rgba(245,158,11,.14); }

@media (max-width: 768px) {
  .btn-menu-mobile { display:inline-flex; }
  .sidebar { position:fixed; left:0; top:0; bottom:0; z-index:60; transform:translateX(-100%); transition:transform .18s ease; }
  .sidebar.open { transform:translateX(0); }
  .header-center { justify-content:flex-start; }
  .header-search { width:100%; max-width:none; }
  .dash-grid { grid-template-columns:1fr; }
  .content { padding:16px; }
  .header { padding:0 16px; }
  .filter-bar-area { padding:8px 16px; }
}


/* ──────────────────────────────────────────────────────────────────────────
   DBEX Assets Upgrade Styles
   ────────────────────────────────────────────────────────────────────────── */
.asset-layout { display:grid; grid-template-columns: minmax(0,1.35fr) minmax(320px,.9fr); gap:var(--sp-5); }
.asset-main-panel, .asset-side-panel {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.asset-panel-head { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; padding:16px 18px; border-bottom:1px solid var(--border-2); }
.asset-panel-head.compact { padding-bottom:14px; }
.asset-panel-title { font-size:14px; font-weight:700; color:var(--text-1); }
.asset-panel-sub { font-size:12px; color:var(--text-2); margin-top:2px; }
.asset-preview-shell { padding:18px; background:linear-gradient(180deg,#FCFCFD 0%, #F7F8F9 100%); min-height:340px; display:flex; align-items:center; justify-content:center; }
.asset-preview-video, .asset-preview-image { width:100%; max-height:460px; border-radius:12px; background:#000; object-fit:contain; box-shadow: var(--shadow-sm); }
.asset-preview-image { background:#fff; }
.asset-preview-empty, .asset-preview-fallback { width:100%; min-height:260px; border:1px dashed var(--border); border-radius:12px; background:#fff; color:var(--text-2); display:flex; align-items:center; justify-content:center; text-align:center; padding:24px; }
.asset-preview-fallback { gap:14px; text-align:left; justify-content:flex-start; }
.asset-preview-fallback-icon { width:48px; height:48px; border-radius:12px; background:var(--surface); display:flex; align-items:center; justify-content:center; font-size:22px; }
.asset-main-actions { padding:0 18px 18px; display:flex; gap:8px; flex-wrap:wrap; }
.asset-upload-box { padding:16px 18px; border-bottom:1px solid var(--border-2); }
.asset-upload-box input[type="file"] { width:100%; border:1px dashed var(--blue-b); background:var(--blue-l); border-radius:10px; padding:10px; font-size:12px; color:var(--text-2); }
.asset-upload-hint { font-size:12px; color:var(--text-2); margin:8px 0 10px; }
.asset-upload-row { display:flex; gap:8px; align-items:center; }
.asset-list { padding:12px; display:flex; flex-direction:column; gap:10px; max-height:560px; overflow:auto; }
.asset-empty-list { padding:18px; color:var(--text-3); font-size:13px; text-align:center; }
.asset-card { display:flex; gap:12px; border:1px solid var(--border); border-radius:12px; padding:10px; background:#fff; transition:all .14s ease; }
.asset-card:hover { border-color:#CBD5E1; box-shadow:var(--shadow-xs); }
.asset-card.is-primary { border-color:var(--blue-b); background:var(--blue-l); }
.asset-thumb { width:72px; height:72px; border-radius:10px; overflow:hidden; background:var(--surface); flex-shrink:0; display:flex; align-items:center; justify-content:center; }
.asset-thumb img { width:100%; height:100%; object-fit:cover; }
.asset-thumb-icon { font-size:24px; }
.asset-card-body { flex:1; min-width:0; display:flex; flex-direction:column; gap:8px; }
.asset-card-top { display:flex; align-items:flex-start; justify-content:space-between; gap:10px; }
.asset-card-name { font-size:13px; font-weight:700; color:var(--text-1); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:220px; }
.asset-card-sub { font-size:11px; color:var(--text-2); margin-top:2px; }
.asset-card-actions { display:flex; gap:6px; flex-wrap:wrap; }
.asset-mini-btn { padding:4px 8px; border:1px solid var(--border); border-radius:999px; font-size:11px; font-weight:600; background:#fff; color:var(--text-2); }
.asset-mini-btn:hover { background:var(--surface); color:var(--text-1); }
.asset-mini-btn--danger:hover { background:var(--red-l); color:var(--red); border-color:#FECACA; }
.asset-pill { display:inline-flex; align-items:center; padding:4px 8px; border-radius:999px; background:var(--blue); color:#fff; font-size:11px; font-weight:700; }
.row-is-overdue td { background: #FFF7F7; }
.row-is-urgent td { background: #FFFDF2; }
.row-just-updated td { animation: rowPulse 1.1s ease; }
@keyframes rowPulse { 0% { background:#DBEAFE; } 100% { background:transparent; } }
@media (max-width: 1100px) { .asset-layout { grid-template-columns: 1fr; } }


/* ─── Assets upload / preview ─────────────────────────────────────── */
.assets-layout { display:grid; grid-template-columns:minmax(0,1.35fr) minmax(280px,0.65fr); gap:16px; align-items:start; }
.assets-main, .assets-side { min-width:0; }
.asset-upload-card { background:var(--bg); border:1px solid var(--border); border-radius:12px; padding:14px; box-shadow:var(--shadow-xs); }
.asset-help-text { font-size:12px; color:var(--text-2); margin-top:8px; line-height:1.45; }
.asset-list { background:var(--bg); border:1px solid var(--border); border-radius:12px; overflow:hidden; }
.asset-actions-inline { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.asset-item { gap:12px; }
.asset-url { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.asset-preview-shell { border:1px solid var(--border); border-radius:12px; overflow:hidden; }

@media (max-width: 980px) {
  .assets-layout { grid-template-columns:1fr; }
}

/* ─── User Switcher ───────────────────────────────────────────────────── */
.user-switcher { position: relative; }
.user-profile {
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
}
.user-switcher.open .user-profile,
.user-profile:hover {
  background: var(--surface);
  border-color: var(--border);
}
.user-switcher-menu {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 8px);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  padding: 6px;
  display: none;
  z-index: 40;
}
.user-switcher.open .user-switcher-menu { display: block; }
.user-switcher-option {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: var(--r-md);
  color: var(--text-1);
}
.user-switcher-option:hover { background: var(--surface); }
.user-switcher-option.active {
  background: var(--blue-l);
  color: var(--blue);
}
.user-switcher-option-name {
  flex: 1;
  font-size: var(--text-sm);
  font-weight: 600;
}
.user-switcher-check {
  font-size: var(--text-xs);
  font-weight: 700;
}


@media (max-width: 768px) {
  .table-wrap table {
    min-width: 980px;
  }

  .cal-grid {
    min-width: 720px;
  }
}

/* ─── Visibility helpers ───────────────────────────────────────────── */
.mobile-only { display:none; }
.desktop-only { display:block; }

/* ─── Sidebar footer / user switcher mobile fix ───────────────────── */
.sidebar-footer {
  position: sticky;
  bottom: 0;
  background: var(--bg);
  z-index: 6;
  padding-bottom: calc(var(--sp-3) + env(safe-area-inset-bottom, 12px));
}
.user-switcher-menu {
  max-height: min(320px, 50vh);
  overflow-y: auto;
}

/* ─── Mobile creative cards ───────────────────────────────────────── */
.mobile-criativos-list {
  display: grid;
  gap: 12px;
}
.mobile-cr-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  display: grid;
  gap: 12px;
}
.mobile-cr-card:active {
  transform: scale(0.998);
}
.mobile-cr-card-top {
  display: grid;
  gap: 8px;
}
.mobile-cr-title {
  font-size: 18px;
  line-height: 1.25;
  font-weight: 700;
  color: var(--text-1);
}
.mobile-cr-sub {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-2);
}
.mobile-cr-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.mobile-cr-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.mobile-meta-item {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--border-2);
  border-radius: 10px;
  background: var(--surface);
}
.mobile-meta-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-3);
}
.mobile-meta-value {
  font-size: 12px;
  color: var(--text-2);
}
.mobile-meta-value--danger {
  color: var(--red);
  font-weight: 700;
}
.mobile-meta-value--warn {
  color: var(--orange);
  font-weight: 700;
}
.inline-select--mobile,
.inline-date--mobile {
  width: 100%;
}
.mobile-cr-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.mobile-cr-user {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--text-2);
  font-size: 12px;
}
.mobile-cr-user span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 768px) {
  .desktop-only { display:none !important; }
  .mobile-only { display:block !important; }

  .content {
    padding: 18px 14px 24px;
  }

  .page-header {
    margin-bottom: 16px;
  }

  .sidebar-footer {
    box-shadow: 0 -8px 24px rgba(17, 19, 24, 0.06);
  }

  .user-profile {
    min-height: 50px;
  }

  .user-switcher-menu {
    left: 0;
    right: 0;
    bottom: calc(100% + 10px);
  }
}

@media (max-width: 560px) {
  .mobile-cr-meta-grid {
    grid-template-columns: 1fr;
  }
}


.logo { min-height: 28px; }
.logo-img { display:block; height:28px; width:auto; max-width:120px; object-fit:contain; }
.project-inline-actions { display:flex; gap:8px; margin-top:12px; }
.project-inline-actions .btn { flex:1; justify-content:center; }

/* Theme + user modal patch */
html[data-theme="dark"], body[data-theme="dark"] { color-scheme: dark; }
html[data-theme="dark"] {
  --bg:#0F172A; --surface:#111827; --surface-2:#1F2937; --border:#243041; --border-2:#1E293B;
  --text-1:#E5EEF8; --text-2:#B8C4D4; --text-3:#7F8EA3; --blue:#60A5FA; --blue-h:#3B82F6; --blue-l:rgba(96,165,250,.14); --blue-b:rgba(96,165,250,.25);
  --green:#34D399; --green-l:rgba(52,211,153,.14); --amber:#F59E0B; --amber-l:rgba(245,158,11,.14); --red:#F87171; --red-l:rgba(248,113,113,.14);
  --orange:#FB923C; --orange-l:rgba(251,146,60,.14); --purple:#A78BFA; --purple-l:rgba(167,139,250,.14); --indigo:#818CF8; --indigo-l:rgba(129,140,248,.14);
  --shadow-xs:0 1px 2px rgba(0,0,0,.35); --shadow-sm:0 1px 3px rgba(0,0,0,.35),0 1px 2px rgba(0,0,0,.25); --shadow-md:0 10px 28px rgba(0,0,0,.35); --shadow-lg:0 28px 64px rgba(0,0,0,.45);
}
html[data-theme="dark"] .btn-icon--chrome, .btn-icon--chrome { border:1px solid var(--border); background:var(--bg); }
.header-right { margin-left:auto; }
.header-right .btn-icon--chrome + .btn-icon--chrome { margin-left:6px; }
.btn-icon--chrome .theme-toggle-icon { font-size:14px; line-height:1; }
.sidebar-utility-row { display:flex; gap:8px; padding:0 10px 10px; }
.sidebar-utility-btn { flex:1; display:inline-flex; align-items:center; justify-content:center; gap:8px; min-height:38px; padding:0 10px; border:1px solid var(--border); border-radius:10px; background:var(--surface); color:var(--text-1); font-size:12px; font-weight:700; }
.sidebar-utility-btn:hover { background:var(--surface-2); }
.mobile-only-flex { display:none; }
.user-modal-list { display:grid; gap:10px; }
.user-modal-option { width:100%; display:flex; align-items:center; gap:12px; padding:12px; border-radius:12px; border:1px solid var(--border); background:var(--bg); color:var(--text-1); }
.user-modal-option:hover { background:var(--surface); }
.user-modal-option.active { border-color:var(--blue); background:var(--blue-l); }
.user-modal-copy { flex:1; min-width:0; text-align:left; }
.user-modal-name { font-size:14px; font-weight:700; color:var(--text-1); }
.user-modal-role { font-size:12px; color:var(--text-2); margin-top:2px; }
input[type="date"], input[type="datetime-local"], select, .form-input, .form-select, .inline-date, .inline-select, .filter-date-input { color:var(--text-1); background:var(--bg); border-color:var(--border); }
html[data-theme="dark"] input[type="date"], html[data-theme="dark"] input[type="datetime-local"], html[data-theme="dark"] select, html[data-theme="dark"] .form-input, html[data-theme="dark"] .form-select, html[data-theme="dark"] .inline-date, html[data-theme="dark"] .inline-select, html[data-theme="dark"] .filter-date-input { background:#0B1220; color:var(--text-1); border-color:var(--border); }
html[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator, html[data-theme="dark"] input[type="datetime-local"]::-webkit-calendar-picker-indicator { filter:invert(1) brightness(1.2); opacity:.9; }
html[data-theme="dark"] .inline-date--danger, html[data-theme="dark"] .mobile-meta-item .inline-date--danger { background:rgba(248,113,113,.12); border-color:rgba(248,113,113,.45); }
html[data-theme="dark"] .inline-date--warn, html[data-theme="dark"] .mobile-meta-item .inline-date--warn { background:rgba(251,146,60,.12); border-color:rgba(251,146,60,.45); }
html[data-theme="dark"] .mobile-meta-item { background:rgba(255,255,255,.02); border-color:var(--border); }
html[data-theme="dark"] .loading-error-btn { background:var(--surface-2); color:var(--text-1); border-color:var(--border); }
@media (max-width:768px) { .mobile-only-flex { display:inline-flex; } .sidebar-utility-row { position:sticky; bottom:0; z-index:8; background:var(--bg); } }


/* ─── Universal filters fix ────────────────────────────────────────── */
.mobile-filter-row,
.mobile-filter-row--universal {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  flex-wrap: nowrap;
  padding-bottom: 2px;
  -webkit-overflow-scrolling: touch;
}
.mobile-filter-row::-webkit-scrollbar,
.mobile-filter-row--universal::-webkit-scrollbar { height: 0; }
.mobile-filter-item {
  display: grid;
  gap: 6px;
  min-width: 170px;
  flex: 0 0 170px;
}
.mobile-filter-item--date {
  min-width: 155px;
  flex-basis: 155px;
}
.mobile-filter-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-3);
}
.mobile-filter-select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-1);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  appearance: none;
}
.mobile-filter-clear {
  flex: 0 0 auto;
  align-self: center;
  margin-left: 2px;
  white-space: nowrap;
}
[data-theme='dark'] .mobile-filter-select,
[data-theme='dark'] .inline-date,
[data-theme='dark'] .inline-select,
[data-theme='dark'] .form-input,
[data-theme='dark'] .form-select,
[data-theme='dark'] .form-textarea,
[data-theme='dark'] input[type='date'] {
  background: var(--surface);
  color: var(--text-1);
  border-color: var(--border);
  color-scheme: dark;
}
[data-theme='dark'] input[type='date']::-webkit-calendar-picker-indicator {
  filter: invert(1) opacity(.8);
}
