/* ===========================
   TOKENS & BASE
=========================== */
:root {
  /* Surfaces — deep navy, layered: the page is darkest, cards and panels
     step up one tone each, never flat black. */
  --bg-primary: #020B22;
  --bg-secondary: #06132E;
  --bg-card: #081735;
  --bg-card-hover: #0A1C40;
  --bg-elevated: #0A1C40;
  --bg-input: #061331;
  --bg-sidebar: #030E27;
  --bg-subtle: rgba(184, 196, 218, 0.06);
  --border: #13284D;
  --border-strong: #1B3766;
  --border-focus: #2F7DD7;

  /* Text — light, blue-tinted greys for everything secondary. */
  --text-primary: #F3F7FF;
  --text-secondary: #B8C4DA;
  --text-muted: #7D8CA8;

  /* Brand blue = primary action + selection; a lighter blue for links and
     icons on dark; green/amber/red = status only. */
  /* T-235: #2A72C8 keeps white text at 4.8:1 (AA); #2F7DD7 gave 4.17:1. */
  --blue: #2A72C8;
  --blue-hover: #256BC0;
  --blue-light: #5A9BEA;
  --blue-soft-color: #5A9BEA;
  --blue-glow: rgba(47, 125, 215, 0.28);
  --blue-soft: rgba(47, 125, 215, 0.16);
  --cta: #2A72C8;
  --cta-hover: #256BC0;
  --cta-text: #ffffff;
  --cta-glow: rgba(47, 125, 215, 0.35);
  --green: #12B981;
  --green-glow: rgba(18, 185, 129, 0.14);
  --purple: #8B7CF6;
  --purple-glow: rgba(139, 124, 246, 0.16);
  --orange: #F59E0B;
  --orange-glow: rgba(245, 158, 11, 0.16);
  --red: #EF4444;
  --red-glow: rgba(239, 68, 68, 0.16);
  --yellow: #FBBF24;
  /* T-268: light versions of the status colors, for text on dark (they were
     fixed values inside Cowork). */
  --red-light: #FF9A96;
  --green-light: #6FE0B3;
  --orange-light: #F2B06B;

  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 22px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.2), 0 8px 24px -14px rgba(0, 0, 0, 0.5);
  --shadow-hover: 0 2px 4px rgba(0, 0, 0, 0.25), 0 16px 36px -16px rgba(0, 0, 0, 0.6);
  --shadow-pop: 0 24px 64px -16px rgba(0, 0, 0, 0.7), 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 0 0 transparent;
  --focus-ring: 0 0 0 3px rgba(47, 125, 215, 0.28);

  /* Type */
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Manrope', 'Inter', -apple-system, sans-serif;

  /* Rhythm */
  --control-h: 38px;
  --space-section: 26px;
  --card-pad: 22px;

  --sidebar-w: 240px;
  --topbar-h: 72px;
  --transition: 0.2s ease;
  /* T-272: strong ease-out for things entering the screen (no overshoot). */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  /* T-273: motion tokens. --transition-ui lists only what the states
     change (instead of "all", which also animated padding, width, outline…). */
  --dur-fast: 0.15s;
  /* T-275: iOS-like drawer curve for panels that slide in. */
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --dur-base: 0.2s;
  --transition-ui: background-color var(--transition), border-color var(--transition), color var(--transition), box-shadow var(--transition), transform var(--transition), opacity var(--transition);

  /* T-270: fixed colors that were used across the file, now named here
     (same values: nothing on screen changes). */
  --white: #FFFFFF;
  --blue-bright: #2F7DD7;
  --red-soft: #F87171;
  --red-strong: #DC2626;
  --red-deep: #B91C1C;
  --bg-raised: #0C2048;
  --purple-light: #B4A6F5;
  --gray-100: #F0F2F5;
  --border-hover: #24467F;
  --blue-pale: #8AB9F2;
  --green-bright: #34D399;
  --blue-mist: #BFD7F6;
  --bg-card-active: #112445;
  --bg-deep-blue: #061545;
  --bg-card-alt: #0A1A44;
}

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

html { scroll-behavior: smooth; }

html, body {
  /* Safety net: no element below should ever be able to scroll the whole
     page sideways, regardless of viewport width. Inner containers that
     need their own horizontal scroll (e.g. .table-wrap) are unaffected —
     overflow is per-element, not inherited by children. */
  overflow-x: hidden;
  width: 100%;
}

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

a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; }
.hidden { display: none !important; }

/* ===========================
   SCROLLBAR
=========================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(184, 196, 218, 0.18); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(184, 196, 218, 0.3); }

/* ===========================
   SETUP SCREEN
=========================== */
.setup-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 24px;
}

.setup-bg-orbs {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.5;
  animation: orbFloat 8s ease-in-out infinite;
}

.orb-1 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(47, 125, 215,0.3) 0%, transparent 70%);
  top: -100px; left: -100px;
}
.orb-2 {
  width: 350px; height: 350px;
  background: radial-gradient(circle, rgba(139, 124, 246,0.2) 0%, transparent 70%);
  bottom: -80px; right: -80px;
  animation-delay: -3s;
}
.orb-3 {
  width: 250px; height: 250px;
  background: radial-gradient(circle, rgba(18, 185, 129,0.15) 0%, transparent 70%);
  top: 50%; left: 60%;
  animation-delay: -6s;
}

@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(20px, -20px) scale(1.05); }
  66% { transform: translate(-15px, 15px) scale(0.95); }
}

.setup-card {
  position: relative;
  z-index: 1;
  background: rgba(184, 196, 218, 0.86);
  backdrop-filter: blur(24px);
  border: 1px solid rgba(184, 196, 218, 0.08);
  border-radius: var(--radius-xl);
  padding: 40px;
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow-card), var(--shadow-glow);
  animation: cardIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(40px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.setup-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

.logo-icon {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px;
  overflow: hidden;
  background: var(--white);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
  flex-shrink: 0;
}
.logo-icon img {
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
}

.setup-title {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--blue-bright) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.setup-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
  display: block;
}

.setup-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(184, 196, 218, 0.08), transparent);
  margin-bottom: 24px;
}

.setup-description {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 28px;
}

.form-group {
  margin-bottom: 22px;
}

.form-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 10px;
  letter-spacing: 0.02em;
}

.form-label svg { color: var(--blue-light); }

.input-wrapper {
  position: relative;
}

.form-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  padding: 12px 16px;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  -webkit-appearance: none;
}

.form-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(47, 125, 215,0.12);
}

.form-input::placeholder { color: var(--text-muted); }

.input-wrapper .form-input { padding-right: 48px; }

.input-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  transition: color var(--transition);
  padding: 4px;
}
.input-toggle:hover { color: var(--text-secondary); }

.form-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
  line-height: 1.5;
}

.form-link {
  color: var(--blue-light);
  text-decoration: underline;
  transition: opacity var(--transition);
}
.form-link:hover { opacity: 0.8; }

code {
  background: rgba(47, 125, 215,0.15);
  color: var(--blue-light);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-family: 'SF Mono', 'Fira Code', monospace;
}

.radio-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-ui);
}
.radio-option:hover { border-color: rgba(47, 125, 215,0.4); color: var(--text-primary); }
.radio-option input[type="radio"] { accent-color: var(--blue); }

.setup-error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 13px;
  color: var(--red);
  margin-bottom: 20px;
  line-height: 1.5;
}

/* Hidden from view but still reachable (the photo <input type=file> of
   "Criar acesso" is opened by its <label>). */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.user-photo {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 72px;
  padding: 10px 14px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color var(--transition);
}

.user-photo:hover { border-color: var(--blue-light); }

.user-photo-preview {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.user-photo-hint {
  font-size: 13px;
  color: var(--text-secondary);
}

.connect-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 15px 28px;
  background: linear-gradient(135deg, var(--blue-bright) 0%, var(--blue-hover) 100%);
  color: white;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: var(--transition-ui);
  box-shadow: 0 4px 20px rgba(47, 125, 215,0.35);
  position: relative;
  overflow: hidden;
}
.connect-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgb(255 255 255 / 0.1) 0%, transparent 50%);
  opacity: 0;
  transition: opacity var(--transition);
}
.connect-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(47, 125, 215,0.45); }
.connect-btn:hover::before { opacity: 1; }
.connect-btn:active { transform: translateY(0); }
.connect-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn-arrow { transition: transform var(--transition); }
.connect-btn:hover .btn-arrow { transform: translateX(4px); }

.btn-spinner {
  width: 18px; height: 18px;
  border: 2px solid rgb(255 255 255 / 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* ===========================
   DASHBOARD LAYOUT
=========================== */
.dashboard {
  display: flex;
  min-height: 100vh;
}

/* ===========================
   SIDEBAR
=========================== */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
  transition: width var(--transition), transform var(--transition);
}

.sidebar.collapsed { width: 68px; }

/* Menu groups (T-027): a small title above each group's items. Collapsed,
   the title gives way to a thin divider so the groups stay apart. */
.nav-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-group + .nav-group { margin-top: 12px; }

.nav-group-title {
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}

.sidebar.collapsed .nav-group-title {
  height: 1px;
  margin: 6px 10px;
  padding: 0;
  overflow: hidden;
  color: transparent;
  background: var(--border);
}
.sidebar.collapsed .nav-label,
.sidebar.collapsed .sidebar-brand,
.sidebar.collapsed .logout-label { display: none; }

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

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.logo-icon-sm {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 9px;
  overflow: hidden;
  background: var(--white);
  flex-shrink: 0;
}
.logo-icon-sm img {
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
}

.sidebar-brand {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.15;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--blue-bright) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: normal;
}

.sidebar-toggle {
  color: var(--text-muted);
  padding: 6px;
  border-radius: 6px;
  transition: var(--transition-ui);
  flex-shrink: 0;
}
.sidebar-toggle:hover { color: var(--text-primary); background: rgba(184, 196, 218, 0.05); }
.sidebar.collapsed .sidebar-toggle svg { transform: rotate(180deg); }
.sidebar.collapsed .sidebar-header { justify-content: center; }

.sidebar-scroll {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.sidebar-nav {
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition-ui);
  white-space: nowrap;
  position: relative;
}

.nav-item svg { flex-shrink: 0; }

.nav-item:hover {
  color: var(--text-primary);
  background: rgba(184, 196, 218, 0.05);
}

.nav-item.active {
  color: var(--blue-light);
  background: rgba(47, 125, 215,0.12);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 25%; bottom: 25%;
  width: 3px;
  background: var(--blue);
  border-radius: 0 3px 3px 0;
}

.entity-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  color: var(--purple-light);
  background: rgba(139, 124, 246,0.15);
  border: 1px solid rgba(139, 124, 246,0.3);
  border-radius: 20px;
  padding: 1px 8px;
  margin-left: 6px;
  vertical-align: middle;
}

.accounts-add-input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 12px;
  padding: 8px 10px;
  outline: none;
  transition: var(--transition-ui);
}
.accounts-add-input:focus { border-color: var(--border-focus); }
.accounts-add-input::placeholder { color: var(--text-muted); }

.accounts-add-confirm-btn,
.accounts-add-cancel-btn {
  flex: 1;
  padding: 7px 0;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  transition: var(--transition-ui);
}

.accounts-add-confirm-btn { background: var(--blue); color: white; }
.accounts-add-confirm-btn:hover { background: var(--blue-hover); }
.accounts-add-confirm-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.accounts-add-cancel-btn { background: rgba(184, 196, 218, 0.05); color: var(--text-secondary); }
.accounts-add-cancel-btn:hover { background: rgba(184, 196, 218, 0.09); }

.project-create-accounts {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 140px;
  overflow-y: auto;
  padding: 2px;
}

.project-account-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition);
}
.project-account-check:hover { background: rgba(184, 196, 218, 0.05); }
.project-account-check input { accent-color: var(--purple); }

.project-create-empty {
  font-size: 11px;
  color: var(--text-muted);
  padding: 6px 8px;
}

.share-settings-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 6px 4px 2px;
}

.share-settings-hint {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.5;
  padding: 0 2px;
}
.share-settings-hint code {
  background: rgba(184, 196, 218, 0.06);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 10px;
}

/* Small "generate share link" trigger, reused on project rows and cards */
.share-link-btn {
  color: var(--text-muted);
  padding: 4px;
  border-radius: 6px;
  flex-shrink: 0;
  transition: var(--transition-ui);
}
.share-link-btn:hover { color: var(--purple); background: var(--purple-glow); }

.share-link-modal-inner { max-width: 480px; }

.share-link-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 13px;
  padding: 20px 0;
  text-align: center;
}

.share-link-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 20px 0;
  text-align: center;
}
.share-link-empty .share-settings-hint { padding: 0; }
.share-link-empty .accounts-add-confirm-btn { flex: none; padding: 9px 24px; }

.share-link-result {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.share-link-actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.share-link-row {
  display: flex;
  gap: 8px;
}
.share-link-row .accounts-add-input {
  flex: 1;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 12px;
}
.share-link-row .accounts-add-confirm-btn {
  flex-shrink: 0;
  padding: 0 18px;
}

.share-link-name-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.share-link-name-field .form-label { margin-bottom: 0; }
/* Person/company name, not a URL — plain font, unlike the monospace link
   input above that this same .share-link-row layout is shared with. */
.share-link-row .share-link-name-input {
  font-family: inherit;
  font-size: 13px;
}
.share-link-row .share-link-name-input[readonly] { color: var(--text-secondary); }

.share-link-revoke-btn {
  align-self: flex-start;
  padding: 8px 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  transition: color var(--transition);
}
.share-link-revoke-btn:hover { color: var(--red); }

.sidebar-footer {
  padding: 14px 10px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.logout-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 8px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  transition: var(--transition-ui);
}
.logout-btn:hover { color: var(--red); background: rgba(239, 68, 68,0.1); }

/* ===========================
   MAIN CONTENT
=========================== */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition);
}

.sidebar.collapsed ~ .main-content { margin-left: 68px; }

/* T-242: while the team-mode notice (#team-mode-banner, fixed at the top) is
   shown, the page starts below it instead of under it. */
.main-content { padding-top: var(--team-banner-h, 0px); }
.sidebar { top: var(--team-banner-h, 0px); }

/* ===========================
   TOPBAR
=========================== */
.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(2, 11, 34, 0.78);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 50;
  gap: 16px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.mobile-menu-btn {
  display: none;
  color: var(--text-secondary);
  padding: 6px;
  border-radius: 8px;
}

.page-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.page-subtitle {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 1px;
}

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

.period-selector {
  display: flex;
  background: rgba(184, 196, 218, 0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.period-btn {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  transition: var(--transition-ui);
  white-space: nowrap;
}

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

.period-btn.active {
  background: var(--blue);
  color: white;
}

.refresh-btn {
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  background: rgba(184, 196, 218, 0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: var(--transition-ui);
}
.refresh-btn:hover { color: var(--text-primary); border-color: rgba(184, 196, 218, 0.15); }
.refresh-btn.spinning svg { animation: spin 0.7s linear infinite; }

/* ===========================
   VIEWS
=========================== */
.view {
  flex: 1;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.view.active { display: flex; }

/* ===========================
   KPI GRID
=========================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 22px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: var(--transition-ui);
  animation: fadeInUp 0.5s ease both;
}

.kpi-card:hover {
  border-color: rgba(184, 196, 218, 0.12);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}

.kpi-card:nth-child(1) { animation-delay: 0.05s; }
.kpi-card:nth-child(2) { animation-delay: 0.1s; }
.kpi-card:nth-child(3) { animation-delay: 0.15s; }
.kpi-card:nth-child(4) { animation-delay: 0.2s; }

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

.kpi-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.kpi-icon-blue { background: rgba(47, 125, 215,0.15); color: var(--blue-light); }
.kpi-icon-green { background: var(--green-glow); color: var(--green); }
.kpi-icon-purple { background: var(--purple-glow); color: var(--purple); }
.kpi-icon-orange { background: var(--orange-glow); color: var(--orange); }
.kpi-icon-red { background: var(--red-glow); color: var(--red); }

.kpi-body {
  flex: 1;
  min-width: 0;
}

.kpi-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.kpi-value {
  display: block;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 6px;
}

.kpi-change {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
}

/* ===========================
   SECTION CARDS
=========================== */
.section-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  /* T-271: no entrance here. Cards are redrawn by innerHTML (Tarefas search,
     status, polling; Contas, Prontuário, Referências), and a fade with a
     0.2s delay made them blink to invisible on every redraw. */
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  flex-wrap: wrap;
}

.section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.see-all-btn {
  font-size: 13px;
  font-weight: 500;
  color: var(--blue-light);
  transition: opacity var(--transition);
}
.see-all-btn:hover { opacity: 0.8; }

/* ===========================
   PER-ACCOUNT OVERVIEW GRID
=========================== */
.accounts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  padding: 20px 24px;
}

.account-overview-card {
  background: rgba(184, 196, 218, 0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: var(--transition-ui);
}
.account-overview-card:hover { border-color: rgba(184, 196, 218, 0.14); }

.account-overview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.account-overview-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-overview-error {
  font-size: 10px;
  font-weight: 600;
  color: var(--red);
  background: rgba(239, 68, 68,0.12);
  border-radius: 20px;
  padding: 2px 8px;
  white-space: nowrap;
  flex-shrink: 0;
}

.account-overview-id {
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'SF Mono', 'Fira Code', monospace;
  margin-top: -8px;
}

.account-overview-kpis {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
}

.aok-label {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 3px;
}

.aok-value {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

/* T-266: color, weight, transition and hover come from the shared
   .see-all-btn, .account-overview-btn rules further down (they always won). */
.account-overview-btn {
  align-self: flex-start;
  font-size: 12px;
}
/* T-239: "Ver detalhes" is the card's only control — 32px tall on desktop
   (WCAG 2.5.8 asks 24px), 44px on touch screens and phones. */
.home-account-details-btn, .accounts-panel-details-btn { display: inline-flex; align-items: center; min-height: 32px; }
@media (pointer: coarse), (max-width: 640px) {
  .home-account-details-btn, .accounts-panel-details-btn { min-height: 44px; }
}

/* ===========================
   HOME (VISÃO GERAL) — REDESIGN
=========================== */
.home-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.home-period-selector .home-period-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.home-period-selector .home-period-btn:disabled:hover { color: var(--text-muted); }

.home-sync-line {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Home KPIs: a single card (Total Investido) while "Contas em Atenção" is
   hidden — one full-width column, so nothing leaves a gap. The compound
   selector outranks the responsive `.kpi-grid` rules further down, which
   would otherwise put this back into 2 columns on tablet. */
.kpi-grid.home-kpi-grid { grid-template-columns: minmax(0, 1fr); }

.home-accounts-count {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Área superior da Visão Geral: o card "Total Investido" e a busca das
   contas na mesma linha — o cabeçalho "Contas ativas" (título, contador e
   divisória) foi removido e o input subiu para cá. No mobile a linha vira
   pilha: card em cima, busca embaixo, ambos em 100%. */
.home-top-row {
  display: flex;
  align-items: center;
  gap: 16px;
}
.home-top-row .home-kpi-grid { flex: 1 1 auto; min-width: 0; }
.home-search-wrap { flex: 0 0 320px; min-width: 0; }
.home-search-wrap { position: relative; }
.home-search-wrap .home-search-input { padding-right: 38px; }
.home-search-clear { position: absolute; right: 3px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); font-size: 13px; color: var(--text-muted); background: none; border: 0; cursor: pointer; }
.home-search-clear:hover { color: var(--text-primary); background: rgba(184, 196, 218, 0.06); }
.home-search-clear:focus-visible { outline: 2px solid var(--blue-light); outline-offset: -2px; }
/* O input já é width:100% com max-width 320px; dentro do wrapper quem
   define a largura é o wrapper, então o teto sai. */
.home-search-wrap .home-search-input { max-width: none; }
@media (max-width: 767px) {
  .home-top-row { flex-direction: column; align-items: stretch; }
  .home-search-wrap { flex: 1 1 auto; width: 100%; }
}

.home-search-input {
  width: 100%;
  max-width: 320px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  padding: 9px 12px;
  outline: none;
  transition: var(--transition-ui);
}
.home-search-input:focus { border-color: var(--border-focus); }
.home-search-input::placeholder { color: var(--text-muted); }

.home-account-card { position: relative; }

/* Visão Geral "Contas ativas" only — scoped to the id because the Contas
   screen's #accounts-panel-grid shares .home-accounts-grid and stays as-is.
   Fixed 3/2/1 columns: wider cards, same content and height. */
#home-accounts-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  /* Sem o .section-card em volta, o padding herdado de .accounts-grid
     deslocaria os cards para dentro em relação ao card do Total Investido. */
  padding: 0;
}
#home-accounts-grid .home-account-card { padding: 18px 20px; }
#home-accounts-grid .home-account-kpis { gap: 10px 24px; }
/* Card de CLIENTE (grupo de contas): uma célula por frente além do
   investimento. Mantém as 2 colunas do card comum e só abre a terceira em
   telas largas, onde o card tem largura para isso — a 1024px, com 3 cards por
   linha, três colunas de métrica cortariam os rótulos (medido). */
#home-accounts-grid .home-account-kpis-wide { gap: 10px 16px; }
@media (min-width: 1200px) {
  #home-accounts-grid .home-account-kpis-wide { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
/* The 96px badge clearance is only needed when a badge is actually shown. */
#home-accounts-grid .home-account-card:not(:has(.home-account-badges)) .home-account-name-wrap { padding-right: 0; }
@media (max-width: 1023px) {
  #home-accounts-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 639px) {
  #home-accounts-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
}

/* One stack, top-right, for both the pace badge and (when present) the
   ads-load error note — never inside the header's flex row, which would
   otherwise compete with the account name for space. */
.home-account-badges {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  max-width: 140px;
}
.home-account-badges .home-account-badge,
.home-account-badges .account-overview-error {
  margin-top: 0;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.home-account-avatar { width: 40px; height: 40px; border-radius: 50%; }

.home-account-name-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-right: 96px; /* keep clear of the top-right badge stack */
}

/* Nome + lápis de editar (Admin) na mesma linha do card da Visão Geral. O
   wrap só contém o nome, então passar a row não muda nada para o Team, que
   não recebe o botão. */
.home-account-card .home-account-name-wrap {
  flex-direction: row;
  align-items: center;
  gap: 6px;
}

/* Discreto: sem moldura, cor suave, e só ganha destaque no hover do card ou
   no foco por teclado. */
.home-account-name-edit {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted, var(--text-muted));
  opacity: 0.55;
  cursor: pointer;
  transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.home-account-card:hover .home-account-name-edit { opacity: 1; }

.home-account-name-edit:hover,
.home-account-name-edit:focus-visible {
  opacity: 1;
  background: rgba(184, 196, 218, 0.08);
  color: var(--text-primary, var(--text-primary));
}

.home-account-kpis { margin-top: 2px; }

.home-account-meta { font-size: 13px; }

.home-accounts-empty {
  padding: 32px 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  grid-column: 1 / -1;
}

/* ===========================
   DASHBOARD DE CLIENTES
=========================== */
.clients-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.clients-count { font-size: 13px; color: var(--text-muted); }
.clients-search-wrap { flex: 0 1 320px; min-width: 0; }
@media (max-width: 640px) { .clients-header { flex-wrap: wrap; } .clients-search-wrap { flex-basis: 100%; } }
.clients-note { font-size: 12px; color: var(--text-muted); margin: 0 0 12px; }
.clients-retry { display: flex; justify-content: center; padding: 0 20px 24px; }
.clients-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.clients-grid { align-items: stretch; }
/* Horizontal, compact client card: avatar | name, channels, counts, last
   report. Same height across a row (grid stretch). */
.client-card {
  display: flex; flex-direction: row; align-items: flex-start; gap: 14px; min-width: 0; height: 100%;
  padding: 16px 18px; text-align: left; font: inherit; color: inherit; cursor: pointer;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  transition: var(--transition-ui);
}
.client-card:hover { border-color: rgba(184, 196, 218, 0.16); background: var(--bg-card-hover); }
.client-card:focus-visible { outline: 2px solid var(--blue-light); outline-offset: 2px; }
.client-card-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1; }
.client-avatar { width: 48px; height: 48px; font-size: 15px; flex: none; }
.client-avatar-lg { width: 56px; height: 56px; font-size: 18px; }
.client-card-name { font-size: 15px; font-weight: 700; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.client-card-sub { font-size: 12px; color: var(--text-muted); }
/* CLIENTE DEMONSTRAÇÃO (temporário): the demo card and its DEMO badge
   (app.js DEMO_DASHBOARD) — remove together with it. */
.client-card-demo { text-decoration: none; border-style: dashed; }
body.demo-dashboard .accounts-panel-detail-name::after { content: 'DEMO'; }
body.demo-dashboard .accounts-panel-detail-name::after,
.demo-badge {
  display: inline-block; margin-left: 6px; padding: 2px 7px; border-radius: 6px; vertical-align: middle;
  font-size: 10px; font-weight: 800; letter-spacing: 0.06em; line-height: 1.4;
  color: #92400e; background: #fde68a; border: 1px solid var(--orange);
}
.client-card-channels { display: flex; flex-wrap: wrap; gap: 6px; }
.client-channel {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 600; color: var(--text-secondary);
  border: 1px solid var(--border); background: rgba(184, 196, 218, 0.03);
}
.client-channel::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--text-muted); }
.client-channel-meta::before { background: var(--blue-light); }
.client-channel-google::before { background: var(--green); }
.client-card-stats { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 2px; font-size: 12px; color: var(--text-secondary); }
.client-card-stats strong { color: var(--text-primary); font-size: 14px; margin-right: 3px; }
.client-card-foot { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.clients-back { margin-bottom: 14px; }
.client-hero { display: flex; align-items: center; gap: 14px; min-width: 0; }
.client-hero-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.client-hero-name { font-size: 20px; font-weight: 700; color: var(--text-primary); overflow-wrap: anywhere; }
.client-hero-sub { font-size: 12px; color: var(--text-muted); overflow-wrap: anywhere; }
.client-blocks { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-top: 20px; align-items: start; }
.client-blocks.client-blocks-single { grid-template-columns: minmax(0, 1fr); max-width: 720px; }
/* Últimos ajustes — todas as contas (T-102, Admin): its own screen, Últimos Ajustes (T-107). */
.client-adjustments-all { min-width: 0; }
.client-adjustment-row { display: flex; flex-direction: column; gap: 4px; }
.client-adjustment-account { font-size: 12px; font-weight: 600; color: var(--text-secondary); overflow-wrap: anywhere; }
/* T-104: filters of the general block. */
.client-adjustments-filters { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.client-adjustments-filters .activity-filter { flex: 1 1 200px; }
/* T-109: Contas sem ajustes recentes, below the list. */
.client-adjustments-stale { margin-top: 16px; }
.client-stale-row { padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: rgba(184, 196, 218, 0.02); }
.client-stale-row.is-clickable:hover { background: rgba(184, 196, 218, 0.05); }
/* T-105: a row opens its client. */
.client-adjustment-row.is-clickable { cursor: pointer; border-radius: var(--radius-sm); }
.client-adjustment-row.is-clickable:hover .activity-event { background: rgba(184, 196, 218, 0.05); }
.client-adjustment-row.is-clickable:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }
.client-block { margin-bottom: 0; display: flex; flex-direction: column; min-width: 0; }
.client-block-head .section-title { display: inline-flex; align-items: center; gap: 8px; }
.client-block-icon { display: inline-flex; color: var(--text-secondary); }
/* Items as a list with separators (channel, name, period/date). */
.client-block-body { display: flex; flex-direction: column; padding: 4px 16px 8px; flex: 1; }
.client-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.client-block-body > .client-item:last-child { border-bottom: 0; }
.client-item-channel { align-self: flex-start; margin-bottom: 2px; }
.client-item-btn {
  flex: none; padding: 6px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  font-size: 12px; font-weight: 600; color: var(--text-secondary); text-decoration: none;
}
.client-item-btn:hover { color: var(--text-primary); border-color: rgba(184, 196, 218, 0.2); }
/* Compact empty/loading state — never a tall empty box. */
.client-block-empty { padding: 16px 0; text-align: center; font-size: 13px; color: var(--text-muted); }
.client-block-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 16px 14px; border-top: 1px solid var(--border); }
.client-block-foot-end { margin-left: auto; }
.client-create-btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.client-blocks.client-blocks-single { margin-top: 16px; }
.client-item-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.client-item-name { font-size: 14px; font-weight: 600; color: var(--text-primary); overflow-wrap: anywhere; }
.client-item-meta { font-size: 11px; color: var(--text-muted); overflow-wrap: anywhere; }
.client-item-btn-primary { flex: none; padding: 8px 14px; }

.client-dash-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px; margin-bottom: 18px; }
.client-period { flex-wrap: nowrap; }
.kpi-grid.client-kpis { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.client-kpis .kpi-value, .client-kpis-more .kpi-value { font-size: 20px; white-space: nowrap; }
.kpi-grid.client-kpis-more { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 12px 16px 16px; }
.client-kpi-note { font-size: 10px; color: var(--text-muted); margin-top: 4px; }
.client-best-body { padding: 4px 16px 16px; }
.client-best-criteria { font-size: 12px; color: var(--text-muted); margin-bottom: 10px; }
/* Best ads: compact named items (thumbnail + name + result); click opens the ad modal. */
.client-ads { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.client-ad {
  position: relative; display: flex; align-items: center; gap: 10px; min-width: 0; width: 100%;
  padding: 8px; text-align: left; cursor: pointer; font: inherit; color: inherit;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: rgba(184, 196, 218, 0.02);
  transition: var(--transition-ui);
}
.client-ad:hover { border-color: rgba(47, 125, 215,0.45); background: var(--bg-card-hover); }
.client-ad:focus-visible { outline: 2px solid var(--blue-light); outline-offset: 2px; }
.client-ad-rank {
  position: absolute; top: 4px; left: 4px; z-index: 1; min-width: 18px; height: 18px; padding: 0 5px;
  display: inline-flex; align-items: center; justify-content: center; border-radius: 9px;
  font-size: 10px; font-weight: 700; color: var(--white); background: var(--blue);
}
.client-ad-thumb { flex-shrink: 0; width: 56px; height: 56px; border-radius: 6px; overflow: hidden; background: rgba(184, 196, 218, 0.05); display: flex; align-items: center; justify-content: center; }
.client-ad-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.client-ad-thumb-empty { font-size: 9px; color: var(--text-muted); text-align: center; padding: 2px; }
.client-ad-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.client-ad-name { font-size: 13px; font-weight: 600; color: var(--text-primary); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.client-ad-metric { font-size: 11px; color: var(--text-secondary); overflow-wrap: anywhere; }
.client-ad-spend { font-size: 11px; color: var(--text-muted); }
.client-ads-empty { font-size: 12px; color: var(--text-muted); }

/* Campaigns: one card per campaign with its figures and its 3 best ads. */
.client-campaigns { display: flex; flex-direction: column; gap: 12px; padding: 4px 16px 16px; }
.client-campaign { display: flex; flex-direction: column; gap: 10px; min-width: 0; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: rgba(184, 196, 218, 0.015); }
.client-campaign-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; min-width: 0; }
.client-campaign-name { font-size: 14px; font-weight: 600; color: var(--text-primary); overflow-wrap: anywhere; min-width: 0; }
.client-campaign-tags { display: flex; align-items: center; gap: 8px; flex-shrink: 0; font-size: 12px; }
.client-campaign-type { color: var(--text-muted); }
.client-campaign-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.client-campaign-metrics > span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.client-metric-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.client-metric-value { font-size: 14px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.client-ads-title { font-size: 11px; font-weight: 600; color: var(--text-secondary); padding-top: 10px; border-top: 1px solid var(--border); }

@media (max-width: 1100px) {
  .clients-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .client-ads { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
  .client-blocks { grid-template-columns: minmax(0, 1fr); }
  .client-ads { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .clients-grid { grid-template-columns: minmax(0, 1fr); }
  .kpi-grid.client-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi-grid.client-kpis-more { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .client-campaign-head { flex-direction: column; gap: 6px; }
  .client-campaign-metrics { gap: 6px; }
  .client-metric-value { font-size: 13px; }
  .client-item { flex-direction: column; align-items: flex-start; }
  .client-dash-head .client-period { flex: 1 1 100%; width: 100%; }
  .client-dash-head .client-period .period-btn { flex: 1; padding: 8px 4px; font-size: 12px; }
  .client-kpis .kpi-value, .client-kpis-more .kpi-value { font-size: 17px; }
}

/* ===========================
   DEMANDA POR CONTA (log de operação, admin)
=========================== */
.activity-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.activity-head-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.activity-note { font-size: 12px; color: var(--text-muted); }
.kpi-grid.activity-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.activity-body { padding: 4px 16px 16px; min-width: 0; }
#view-activity-log .table-wrap { width: 0; min-width: 100%; overflow-x: auto; }
.activity-filters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; padding: 4px 16px 16px; }
.activity-filter { display: flex; flex-direction: column; gap: 4px; min-width: 0; font-size: 11px; color: var(--text-muted); }
.activity-filter select {
  padding: 8px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: rgba(184, 196, 218, 0.03); color: var(--text-primary); font-size: 13px; width: 100%;
}
.activity-filter select:focus { outline: none; border-color: var(--border-focus); }

/* Alterações por dia — plain CSS bars, no chart library. */
.activity-chart { display: flex; align-items: flex-end; gap: 4px; height: 160px; min-width: 0; overflow-x: auto; padding-top: 8px; }
/* Bars shrink with the screen (never force the page wider than the
   viewport); the container scrolls only when they'd get unreadable. */
.activity-bar-wrap { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; flex: 1 1 8px; height: 100%; min-width: 8px; }
.activity-bar { width: 100%; border-radius: 4px 4px 0 0; background: linear-gradient(180deg, var(--blue-light), var(--blue)); }
.activity-bar.is-empty { background: rgba(184, 196, 218, 0.08); }
.activity-bar-day { font-size: 9px; color: var(--text-muted); }

.activity-row { cursor: pointer; }
.activity-row:hover td { background: rgba(184, 196, 218, 0.03); }
.activity-row.is-selected td { background: rgba(47, 125, 215,0.10); }

.activity-account-summary { display: flex; flex-wrap: wrap; gap: 16px; padding-bottom: 12px; font-size: 12px; color: var(--text-secondary); }
.activity-account-summary strong { color: var(--text-primary); font-size: 15px; margin-right: 4px; }

.activity-events { display: flex; flex-direction: column; gap: 8px; }
.activity-event {
  display: flex; align-items: flex-start; gap: 12px; min-width: 0;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: rgba(184, 196, 218, 0.02);
}
.activity-event-when { flex: 0 0 82px; font-size: 12px; color: var(--text-muted); }
.activity-event-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.activity-event-type { font-size: 13px; font-weight: 600; color: var(--text-primary); overflow-wrap: anywhere; }
.activity-event-object { font-size: 12px; color: var(--text-secondary); overflow-wrap: anywhere; }
.activity-event-meta { font-size: 11px; color: var(--text-muted); }
.activity-event-tags { display: flex; flex-wrap: wrap; gap: 6px; flex-shrink: 0; }

@media (max-width: 1099px) {
  .kpi-grid.activity-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .activity-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .activity-filters { grid-template-columns: minmax(0, 1fr); }
  .activity-event { flex-direction: column; gap: 6px; }
  .activity-event-when { flex: none; }
  .activity-head { flex-direction: column; align-items: stretch; }
  .activity-head-actions { justify-content: flex-end; }
  .activity-chart { height: 130px; }
}

/* ===========================
   ACCOUNT ANALYTICS (Visão Geral → "Ver detalhes")
=========================== */
.kpi-grid.account-analytics-kpis {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.account-kpi { padding: 16px 18px; min-width: 0; }
.account-kpi .kpi-body { min-width: 0; }
.account-kpi .kpi-value { font-size: 22px; overflow-wrap: anywhere; }
.account-kpi .kpi-value.is-unavailable { color: var(--text-muted); }
.account-kpi-note { display: block; margin-top: 4px; font-size: 11.5px; line-height: 1.35; color: var(--text-muted); overflow-wrap: anywhere; }

.account-analytics-channels { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.account-analytics-eyebrow { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.account-analytics-channel-list { display: flex; flex-wrap: wrap; gap: 8px; }
.account-channel-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 20px; font-size: 12px; font-weight: 600;
  border: 1px solid var(--border); background: rgba(184, 196, 218, 0.03); color: var(--text-primary);
}
.account-channel-badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--text-muted); }
.account-channel-meta::before { background: var(--blue-light); }
.account-channel-google::before { background: var(--green); }
.account-analytics-empty-inline { font-size: 12px; color: var(--text-muted); }

/* Perfil por sexo | Faixas etárias que mais convertem — side by side on
   desktop (same row, same height), stacked at <= 900px (rule below). */
.account-analytics-charts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}
.account-analytics-charts > .section-card { margin-bottom: 0; min-width: 0; }
/* Same height while both have data; when one of them is empty/loading it
   keeps its own compact height instead of stretching into a tall empty
   box next to the other. */
.account-analytics-charts:has(.account-analytics-gender > .account-analytics-empty) { align-items: start; }
.account-analytics-gender > .account-analytics-empty { padding: 20px; min-height: 64px; display: flex; align-items: center; justify-content: center; margin: 0; }
.account-analytics-card-meta { font-size: 12px; color: var(--text-muted); }
.account-analytics-empty { padding: 32px 20px; text-align: center; font-size: 13px; color: var(--text-muted); }

/* Problemas da conta — compact rows, colour by severity. */
.account-issues { padding: 8px 16px 16px; }
.account-issues-summary { font-size: 12px; font-weight: 600; }
.account-issues-summary.is-ok { color: var(--green); }
.account-issues-summary.is-critical { color: var(--red); }
.account-issues-summary.is-attention { color: var(--orange); }
.account-issues-ok { padding: 18px 4px; font-size: 13px; color: var(--green); }
.account-issues-partial { margin-top: 10px; font-size: 12px; color: var(--text-muted); }
.account-issues-list { display: flex; flex-direction: column; gap: 8px; max-height: 360px; overflow-y: auto; }
.account-issue {
  display: flex; flex-direction: column; gap: 3px; width: 100%; min-width: 0;
  padding: 10px 12px; text-align: left; font: inherit; color: inherit;
  border: 1px solid var(--border); border-left: 3px solid var(--text-muted);
  border-radius: var(--radius-sm); background: rgba(184, 196, 218, 0.02);
}
button.account-issue { cursor: pointer; transition: background var(--transition); }
button.account-issue:hover { background: rgba(184, 196, 218, 0.05); }
.account-issue-critical { border-left-color: var(--red); }
.account-issue-attention { border-left-color: var(--orange); }
.account-issue-review { border-left-color: var(--yellow); }
.account-issue-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 11px; }
.account-issue-severity { font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.account-issue-critical .account-issue-severity { color: var(--red); }
.account-issue-attention .account-issue-severity { color: var(--orange); }
.account-issue-review .account-issue-severity { color: var(--yellow); }
.account-issue-type { font-weight: 600; color: var(--text-primary); }
.account-issue-level { color: var(--text-muted); }
.account-issue-name { font-size: 13px; font-weight: 600; color: var(--text-primary); overflow-wrap: anywhere; }
.account-issue-reason { font-size: 12px; color: var(--text-secondary); overflow-wrap: anywhere; }
.account-issue-detail { font-size: 11px; color: var(--text-muted); overflow-wrap: anywhere; }
.account-issue-meta { font-size: 10px; color: var(--text-muted); overflow-wrap: anywhere; }
.account-issue-affected { color: var(--text-secondary); }

.account-analytics-gender { display: flex; flex-direction: column; gap: 14px; padding: 12px 20px 20px; }
.gender-row-head { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; }
.gender-pct { color: var(--text-primary); font-weight: 600; font-variant-numeric: tabular-nums; }
.gender-bar { height: 8px; border-radius: 20px; background: rgba(184, 196, 218, 0.06); overflow: hidden; }
.gender-bar-fill { height: 100%; border-radius: 20px; background: var(--purple); }
.gender-male .gender-bar-fill { background: var(--blue-light); }
.gender-unknown .gender-bar-fill { background: var(--text-muted); }
.age-row .gender-bar-fill { background: var(--green); }
.age-count { color: var(--text-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
/* Palavras-chave que mais convertem no Google: full-width card below the
   gender/age pair, same rows/bars (bar = share of the top keyword). */
.account-google-keywords > .section-card { margin-bottom: 16px; }
.google-keyword-row .gender-bar-fill { background: var(--blue-light); }
.google-keyword-row .gender-row-head { gap: 12px; }
.google-keyword-text { display: flex; gap: 8px; min-width: 0; overflow-wrap: anywhere; color: var(--text-primary); }
.google-keyword-rank { flex: none; color: var(--text-muted); font-weight: 700; font-variant-numeric: tabular-nums; }
.google-keyword-row .gender-pct { flex: none; white-space: nowrap; }

.account-campaign-name { max-width: 320px; overflow-wrap: anywhere; }
/* The 7-column campaigns table must never widen the page (main-content is
   a flex item without min-width:0): its wrapper contributes no intrinsic
   width and scrolls horizontally inside itself when space is short. */
.accounts-panel-detail .table-wrap,
#view-clients .table-wrap { width: 0; min-width: 100%; overflow-x: auto; }


@media (max-width: 900px) {
  .account-analytics-charts { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .kpi-grid.account-analytics-kpis { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .account-kpi { padding: 14px; }
  .account-kpi .kpi-value { font-size: 18px; }
  /* Campaigns: the table collapses into one card per campaign. */
  .account-campaigns-table thead { display: none; }
  .account-campaigns-table, .account-campaigns-table tbody, .account-campaigns-table tr, .account-campaigns-table td { display: block; width: 100%; }
  .account-campaigns-table tr { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 10px 14px; margin: 0 0 10px; }
  .account-campaigns-table td { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border: none; text-align: right; }
  .account-campaigns-table td::before { content: attr(data-label); color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; text-align: left; flex-shrink: 0; }
  .account-campaigns-table td.account-campaign-name { display: block; max-width: none; text-align: left; font-weight: 600; padding-bottom: 8px; }
  .account-campaigns-table td.account-campaign-name::before { content: none; }
}
/* T-257: on a phone the campaign cards sat flush against the section card
   (double border) and the table's general cell rules — padding and divider
   lines, later in this file — beat the card rules above (~350px per
   campaign). With the table's own class the card rules win: inset cards,
   compact label/value lines, no dividers. */
@media (max-width: 640px) {
  .section-card > .table-wrap:has(> .account-campaigns-table) { padding: 0 12px 12px; }
  .ads-table.account-campaigns-table tr { background: var(--bg-subtle); border-color: var(--border); }
  .ads-table.account-campaigns-table td { padding: 4px 0; border: none; align-items: baseline; }
  .ads-table.account-campaigns-table td.account-campaign-name { padding: 2px 0 8px; }
  .ads-table.account-campaigns-table tbody tr:hover td { background: none; }
}

/* ===========================
   "CONTAS" (ACCOUNTS PANEL) — new, isolated internal module
=========================== */
.accounts-panel-name-wrap { padding-right: 0; }

.accounts-panel-period-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(184, 196, 218, 0.06);
  border-radius: 20px;
  padding: 3px 10px;
  white-space: nowrap;
  flex-shrink: 0;
}

.accounts-panel-card-kpis { grid-template-columns: repeat(3, 1fr); }

.accounts-panel-detail {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.accounts-panel-detail-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
/* Every block of the detail keeps its own height: none stretches to fill
   the column and none is shrunk (and clipped) to make room for another. */
.accounts-panel-detail-body > * { flex: 0 0 auto; min-width: 0; }

.accounts-panel-back-btn { align-self: flex-start; }

.campaign-status-unknown { color: var(--text-muted); }

.accounts-panel-period-wrap { padding: 4px 24px 16px; }

.accounts-panel-detail-name-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.accounts-panel-edit-name-btn {
  color: var(--text-muted);
  padding: 4px;
  border-radius: 6px;
  transition: var(--transition-ui);
}
.accounts-panel-edit-name-btn:hover { color: var(--blue-light); background: rgba(47, 125, 215,0.12); }

.account-display-name-meta-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: -8px;
}

.accounts-panel-detail-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.accounts-panel-detail-subtitle {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.accounts-panel-kpi-grid { grid-template-columns: repeat(3, 1fr); }

/* Fix spend tracking overview overflow: a fixed repeat(5, 1fr) let the
   5th card's intrinsic content width push the whole grid past the
   container (grid items default to min-width:auto, not 0) — the card
   was clipped by the page's own overflow-x:hidden. auto-fit/minmax lets
   the row wrap on its own (e.g. 3+2) whenever 5 columns wouldn't fit
   comfortably, instead of forcing a fixed column count; min-width:0 +
   box-sizing let each card actually shrink to its track instead of
   forcing the track wider. Scoped to this screen only — the shared
   .kpi-grid/.kpi-card rules (Home, Contas) are untouched. Tablet (2
   columns) / mobile (1 column) still come from the existing .kpi-grid
   media queries below, which already cascade over this at those widths.

   "Refine spend tracking overview cards": the minmax floor above was
   raised from 180px to 260px — narrower than that, a full-size 26px
   currency value ("R$ 118.432,00") genuinely doesn't fit next to the
   icon, and the old overflow-wrap:break-word let it break mid-number
   ("R$ 98.17" / "1,55") instead. Numbers must never break — white-space:
   nowrap below — so the card is now sized wide enough to hold one at
   1920/1440/1366 (typically 5-in-a-row, or 3+2 when it doesn't fit),
   with clamp() only as a floor-safety net on genuinely narrow viewports.
   The label's reserved 2-line height keeps every card's value sitting at
   the SAME vertical offset regardless of whether its own title actually
   wraps to 1 or 2 lines — this is what keeps all 5 cards' values
   visually aligned with each other. */
.spend-tracking-kpi-grid {
  /* Two KPIs (Investido no Mês / Mensal Programado) sharing the full
     width — no empty column left behind by the removed cards. */
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 100%;
  max-width: 100%;
}
@media (max-width: 640px) {
  .spend-tracking-kpi-grid { grid-template-columns: minmax(0, 1fr); }
}
.spend-tracking-kpi-grid .kpi-card {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.spend-tracking-kpi-grid .kpi-body { min-width: 0; }
.spend-tracking-kpi-grid .kpi-label {
  /* Reserves space for up to 2 lines (spec: "títulos podem quebrar em
     até 2 linhas") — fixed regardless of whether THIS card's title
     actually needs one line or two, so the value below always starts at
     the same height across all 5 cards. Anchored to the bottom of that
     reserved space so a one-line title still sits right above its
     value, with no visible gap. */
  min-height: 2.6em;
  line-height: 1.3;
  display: flex;
  align-items: flex-end;
}
.spend-tracking-kpi-grid .kpi-value {
  white-space: nowrap;
  font-size: clamp(20px, 2vw, 26px);
}

.campaign-row-sublabel {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
}

/* ===========================
   TABLE CONTROLS
=========================== */
.table-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.search-wrap svg {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  background: rgba(184, 196, 218, 0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  padding: 9px 12px 9px 36px;
  width: 200px;
  outline: none;
  transition: var(--transition-ui), width var(--transition);
}
.search-input:focus { border-color: var(--border-focus); width: 240px; box-shadow: 0 0 0 3px rgba(47, 125, 215,0.1); }
.search-input::placeholder { color: var(--text-muted); }

.filter-select {
  background: rgba(184, 196, 218, 0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  padding: 9px 12px;
  outline: none;
  transition: var(--transition-ui);
  -webkit-appearance: none;
  cursor: pointer;
}
.filter-select:focus { border-color: var(--border-focus); }
.filter-select option { background: var(--bg-card); color: var(--text-primary); }

/* ===========================
   TABLE
=========================== */
.table-wrap {
  overflow-x: auto;
}

.ads-table {
  width: 100%;
  border-collapse: collapse;
}

.ads-table thead th {
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  background: rgba(184, 196, 218, 0.02);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.ads-table thead th.sortable {
  cursor: pointer;
  user-select: none;
  transition: color var(--transition);
}
.ads-table thead th.sortable:hover { color: var(--text-primary); }
.ads-table thead th.sorted { color: var(--blue-light); }

.sort-icon { opacity: 0.5; margin-left: 4px; font-style: normal; }

.text-right { text-align: right !important; }
.text-center { text-align: center !important; }

.ads-table tbody tr {
  border-bottom: 1px solid rgba(184, 196, 218, 0.04);
  transition: background var(--transition);
}
.ads-table tbody tr:hover { background: rgba(184, 196, 218, 0.03); }
.ads-table tbody tr:last-child { border-bottom: none; }

.ads-table td {
  padding: 14px 16px;
  font-size: 13px;
  color: var(--text-secondary);
  vertical-align: middle;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.status-badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-ACTIVE { background: rgba(18, 185, 129,0.12); color: var(--green); }
.status-ACTIVE::before { background: var(--green); animation: pulse 2s ease infinite; }
.status-PAUSED { background: rgba(245, 158, 11,0.12); color: var(--orange); }
.status-PAUSED::before { background: var(--orange); }
.status-DISAPPROVED { background: rgba(239, 68, 68,0.12); color: var(--red); }
.status-DISAPPROVED::before { background: var(--red); }
.status-ARCHIVED { background: rgba(184, 196, 218, 0.1); color: var(--text-muted); }
.status-ARCHIVED::before { background: var(--text-muted); }
.status-REMOVED { background: rgba(184, 196, 218, 0.1); color: var(--text-muted); }
.status-REMOVED::before { background: var(--text-muted); }
.status-WITH_ISSUES { background: rgba(239, 68, 68,0.12); color: var(--red); }
.status-WITH_ISSUES::before { background: var(--red); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ===========================
   LOADING / EMPTY STATES
=========================== */
.loading-state {
  padding: 24px;
}

.skeleton-rows {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.skeleton-row {
  height: 48px;
  background: linear-gradient(90deg, rgba(184, 196, 218, 0.03) 25%, rgba(184, 196, 218, 0.06) 50%, rgba(184, 196, 218, 0.03) 75%);
  background-size: 200% 100%;
  border-radius: var(--radius-sm);
  animation: shimmer 1.5s infinite;
}
.skeleton-row:nth-child(2) { width: 90%; }
.skeleton-row:nth-child(3) { width: 75%; }
.skeleton-row:nth-child(4) { width: 85%; }

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

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 60px 24px;
  color: var(--text-muted);
}
.empty-state p { font-size: 14px; }

/* ===========================
   MODAL
=========================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: overlayIn 0.2s ease;
}

@keyframes overlayIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: var(--bg-card);
  border: 1px solid rgba(184, 196, 218, 0.1);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.48);
  /* T-272: 200ms from 96% with a strong ease-out — no bounce. */
  animation: modalIn 0.2s var(--ease-out);
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: none; }
}

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

.modal-title {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
  max-width: 480px;
}

.modal-ad-id {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
  font-family: 'SF Mono', 'Fira Code', monospace;
}

.modal-close {
  color: var(--text-muted);
  padding: 4px;
  border-radius: 6px;
  transition: var(--transition-ui);
  flex-shrink: 0;
}
.modal-close:hover { color: var(--text-primary); background: rgba(184, 196, 218, 0.06); }

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.preview-frame-wrap {
  background: var(--gray-100);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  position: relative;
  min-height: 360px;
}

.preview-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  color: var(--text-muted);
  font-size: 13px;
  position: absolute;
  inset: 0;
  background: var(--gray-100);
  justify-content: center;
  z-index: 2;
}

.preview-spinner {
  width: 32px; height: 32px;
  border: 2px solid rgba(47, 125, 215,0.2);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.preview-scale-box {
  position: relative;
  overflow: hidden;
}

.preview-iframe {
  border: none;
  display: block;
  transform-origin: top left;
  /* native width/height + transform: scale() set dynamically to preserve aspect ratio */
}

.preview-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  padding: 40px;
  text-align: center;
}
.preview-error p { font-size: 13px; }

.preview-link-btn {
  background: rgba(47, 125, 215,0.15);
  border: 1px solid rgba(47, 125, 215,0.3);
  color: var(--blue-light);
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition-ui);
}
.preview-link-btn:hover { background: rgba(47, 125, 215,0.25); }

/* ===========================
   AD DETAIL (preview modal — see renderAdDetail in app.js)
=========================== */
.ad-detail-modal { max-width: 980px; }

.ad-detail-head {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
}
.ad-detail-badge {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(47, 125, 215,0.14);
  border: 1px solid rgba(47, 125, 215,0.3);
  color: var(--blue-light);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.ad-detail-title {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}
.ad-detail-highlight {
  font-size: 15px;
  font-weight: 600;
  color: var(--green);
  margin-top: 4px;
}
.ad-detail-highlight-text {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
  max-width: 720px;
}

.ad-detail-body {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  grid-template-areas:
    "creative info"
    "metrics metrics";
  /* max-content: the body is a fixed-height scroll container, so plain
     auto rows would clamp the creative to its min-height and overlap. */
  grid-template-rows: max-content max-content;
  align-content: start;
  align-items: start;
  gap: 20px 24px;
}
.ad-creative { grid-area: creative; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.ad-creative .preview-frame-wrap { min-height: 320px; }

/* Real thumbnail (Meta thumbnail_url) — shown instantly, no iframe/video. */
.ad-thumb {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 240px;
  max-height: 520px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  overflow: hidden;
}
.ad-thumb img { display: block; width: 100%; max-height: 520px; object-fit: contain; }
.ad-thumb-empty { padding: 40px 20px; text-align: center; font-size: 13px; color: var(--text-muted); }

.ad-placement-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ad-placement-btn {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(47, 125, 215,0.35);
  background: rgba(47, 125, 215,0.12);
  color: var(--blue-light);
  font-size: 13px;
  font-weight: 600;
  transition: var(--transition-ui);
}
.ad-placement-btn:hover:not(:disabled) { background: rgba(47, 125, 215,0.22); }
.ad-placement-btn.is-active { background: var(--blue); border-color: var(--blue); color: var(--white); }
.ad-placement-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.ad-placement-back { align-self: flex-start; background: none; color: var(--blue-light); font-size: 12px; padding: 0; }

.ad-primary-text {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  white-space: pre-wrap; /* keeps the copy's own line breaks */
  overflow-wrap: anywhere;
  max-height: 520px;
  overflow-y: auto;
}
.ad-primary-text.is-empty { color: var(--text-muted); }

.ad-detail-info {
  grid-area: info;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding: 18px 20px;
  background: rgba(184, 196, 218, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.ad-detail-field { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
.ad-detail-field-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.ad-detail-field-value {
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}
.ad-detail-mono { font-family: 'SF Mono', 'Fira Code', monospace; font-size: 12px; color: var(--text-secondary); }

.ad-detail-metrics {
  grid-area: metrics;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}
.ad-detail-metric {
  background: rgba(184, 196, 218, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  /* title + value only: centred vertically, aligned left */
  justify-content: center;
  align-items: flex-start;
  gap: 4px;
  min-width: 0;
  min-height: 76px;
}
.ad-detail-metric-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.ad-detail-metric-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.ad-detail-metric-value.zero { color: var(--text-muted); }
.ad-detail-metrics .ad-detail-metric-value { overflow-wrap: normal; white-space: nowrap; }

@media (max-width: 768px) {
  .ad-detail-body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "creative" "info" "metrics";
    grid-template-rows: max-content max-content max-content;
  }
  /* Small screens: header scrolls away with the content instead of
     permanently eating a third of the viewport. */
  .ad-detail-modal { overflow-y: auto; }
  .ad-detail-body { flex: none; overflow: visible; }
  .ad-detail-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 360px) {
  .ad-detail-metrics { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 480px) {
  .ad-detail-title { font-size: 17px; }
  .ad-detail-info { padding: 16px; }
  .ad-detail-metric-value { font-size: 18px; }
  .ad-thumb { min-height: 180px; }
}

/* ===========================
   ADS CONTROLS BAR
=========================== */
.account-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 0 2px;
}

.account-tab {
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  background: rgba(184, 196, 218, 0.04);
  border: 1px solid var(--border);
  transition: var(--transition-ui);
  white-space: nowrap;
}
.account-tab:hover { color: var(--text-primary); }
.account-tab.active { background: var(--blue); color: white; border-color: var(--blue); }

.account-tab-error { color: var(--red); font-weight: 700; margin-left: 3px; }

.project-account-filter {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 0 2px;
  margin-top: -8px;
}

.project-account-filter-btn {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  transition: var(--transition-ui);
  white-space: nowrap;
}
.project-account-filter-btn:hover { color: var(--text-primary); border-color: rgba(184, 196, 218, 0.2); }
.project-account-filter-btn.active {
  background: var(--purple-glow);
  color: var(--purple-light);
  border-color: rgba(139, 124, 246,0.4);
}

.ads-controls-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 0 2px 4px;
}

.ads-total-badge {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ===========================
   CAMPAIGNS CONTAINER
=========================== */
.campaigns-container {
  display: flex;
  flex-direction: column;
  gap: 36px;
}

/* ===========================
   CAMPAIGN SECTION
=========================== */
.campaign-section {
  animation: fadeInUp 0.4s ease both;
}

.campaign-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.campaign-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.2px;
  flex: 1;
  min-width: 0;
}

.campaign-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 10px;
  background: rgba(47, 125, 215,0.12);
  border: 1px solid rgba(47, 125, 215,0.25);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: var(--blue-light);
  white-space: nowrap;
  flex-shrink: 0;
}

.campaign-spend {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ===========================
   ADS CARDS GRID
=========================== */
.ads-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

/* INSIGHTS DE PERFORMANCE (account detail) — three equally sized cards. */
.account-insights-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 4px 16px 16px;
}
/* Shared dashboard: only the Top 3 criativos card, full width. */
.account-insights-grid.account-insights-grid-single { grid-template-columns: minmax(0, 1fr); }
/* T-201: a client without "Melhor conjunto" — the two cards share the row
   (one per row on a phone). */
.account-insights-grid.account-insights-grid-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 640px) { .account-insights-grid.account-insights-grid-two { grid-template-columns: minmax(0, 1fr); } }
.account-insight-card {
  display: flex; flex-direction: column; gap: 4px; min-width: 0;
  padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: rgba(184, 196, 218, 0.02);
}
.account-insight-title { font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
/* The winning creative: real thumbnail + the same card body, clickable. */
.account-insight-ad, .account-insight-plain {
  display: flex; align-items: flex-start; gap: 10px; min-width: 0; width: 100%;
  padding: 0; text-align: left; background: none; border: 0; color: inherit; font: inherit;
}
.account-insight-ad { cursor: pointer; }
.account-insight-ad:hover .account-insight-value { color: var(--blue-light); }
/* "Material que mais converte": thumbnail + name, name centred on the thumb. */
.account-insight-best { align-items: center; gap: 12px; }
.account-insight-best .account-insight-info { justify-content: center; }
.account-insight-ad:focus-visible { outline: 2px solid var(--blue-light); outline-offset: 2px; border-radius: var(--radius-sm); }
.account-insight-thumb {
  flex-shrink: 0; width: 56px; height: 56px; border-radius: 6px; overflow: hidden;
  background: rgba(184, 196, 218, 0.05);
}
.account-insight-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.account-insight-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.account-insight-tag {
  align-self: flex-start; padding: 2px 8px; border-radius: 20px;
  font-size: 10px; font-weight: 600; color: var(--text-secondary); background: rgba(184, 196, 218, 0.06);
}
.account-insight-info { flex: 1 1 auto; }
/* Long names (e.g. 00_FEEDeSTORIES_F_30a50_M_Envolvimento15D): at most 2
   lines at the same size, full name in the title attribute. */
.account-insight-value {
  font-size: 18px; font-weight: 700; color: var(--text-primary); line-height: 1.3;
  overflow-wrap: anywhere;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
}
.account-insight-sub { font-size: 13px; color: var(--text-secondary); }
.account-insight-metric { font-size: 12px; color: var(--text-secondary); }
.account-insight-basis { margin-top: 6px; font-size: 11px; color: var(--text-muted); }
.account-insight-empty { font-size: 13px; color: var(--text-muted); }
.account-insight-basis { margin: 8px 0 0; font-size: 12px; color: var(--text-muted); }
.account-insight-top-cards + .account-insight-basis { text-align: center; }
.shared-insights-split .account-insight-top-cards + .account-insight-basis { text-align: left; }
.account-insight-skeleton { display: flex; flex-direction: column; gap: 8px; padding-top: 4px; }
.account-insight-skeleton span {
  height: 12px; border-radius: 6px; background: rgba(184, 196, 218, 0.06);
  animation: insightPulse 1.4s ease-in-out infinite;
}
.account-insight-skeleton span:first-child { height: 18px; width: 70%; }
.account-insight-skeleton span:last-child { width: 45%; }
@keyframes insightPulse { 0%, 100% { opacity: 0.45; } 50% { opacity: 0.9; } }
@media (max-width: 1099px) { .account-insights-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .account-insights-grid { grid-template-columns: minmax(0, 1fr); } }

/* Account detail (Contas panel) ads grid only (the general .ads-cards-grid
   above stays as it is for the Ads view). As many columns as FIT, each at
   least 240px wide: a card that does not fit wraps to the next row — the
   grid never squeezes every card to add one more column (the old fixed
   5/4/3 columns by viewport width ignored the sidebar and ended up with
   titles breaking word by word). min(…, 100%) keeps one column on the
   narrowest phones without horizontal overflow. The double class keeps
   this winning over the generic .ads-cards-grid breakpoints further down,
   whatever the source order. */
.ads-cards-grid.accounts-panel-ads-grid { grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); gap: 12px; }
@media (max-width: 768px) { .ads-cards-grid.accounts-panel-ads-grid { grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); } }
@media (max-width: 480px) { .ads-cards-grid.accounts-panel-ads-grid { grid-template-columns: minmax(0, 1fr); } }

/* Compact, still legible: same card, smaller paddings/type. */
.accounts-panel-ads-grid .ad-card { min-width: 0; }
.accounts-panel-ads-grid .ad-card-body { padding: 10px; gap: 7px; min-width: 0; }
/* Title and status never fight for the same space: the title keeps at
   least ~130px; a status that does not fit next to it ("CAMPANHA
   PAUSADA") moves to its own line instead of squeezing the title. */
.accounts-panel-ads-grid .ad-card-name-row { flex-wrap: wrap; row-gap: 6px; min-width: 0; }
.accounts-panel-ads-grid .ad-card-name-row > span:last-child { flex-shrink: 0; white-space: nowrap; }
/* At most 3 lines, then ellipsis; words wrap whole (a single very long
   token may still break, never the whole title letter by letter). */
.accounts-panel-ads-grid .ad-card-name {
  flex: 1 1 130px; min-width: 0;
  font-size: 12px; line-height: 1.35;
  word-break: normal; overflow-wrap: break-word;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden;
}
/* Two stable metric columns: a long value never pushes the other one. */
.accounts-panel-ads-grid .ad-card-metrics { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.accounts-panel-ads-grid .ad-card-metric { min-width: 0; }
.accounts-panel-ads-grid .ad-card-metric-label,
.accounts-panel-ads-grid .ad-card-metric-value { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.accounts-panel-ads-grid .ad-card-id { font-size: 9px; }
.accounts-panel-ads-grid .ad-card-metrics { gap: 6px; }
.accounts-panel-ads-grid .ad-card-metric-value { font-size: 13px; }
.accounts-panel-ads-grid .ad-card-metric-label { font-size: 9px; }
.accounts-panel-ads-grid .ad-card-open-btn { padding: 4px 10px; font-size: 11px; }

/* ===========================
   AD CARD
=========================== */
.ad-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: var(--transition-ui);
  cursor: pointer;
  animation: fadeInUp 0.35s ease both;
}

.ad-card:hover {
  border-color: rgba(47, 125, 215,0.35);
  transform: translateY(-3px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(47, 125, 215,0.12);
}

/* THUMBNAIL */
.ad-card-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 5;
  background: linear-gradient(135deg, rgba(47, 125, 215,0.08), rgba(139, 124, 246,0.08));
  overflow: hidden;
  flex-shrink: 0;
}

.ad-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.ad-card:hover .ad-card-thumb img {
  transform: scale(1.04);
}

.ad-card-thumb-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(184, 196, 218, 0.18);
}

/* OPEN OVERLAY */
.ad-card-open-overlay {
  position: absolute;
  inset: 0;
  background: rgba(4, 10, 28, 0.55);
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 10px;
  opacity: 0;
  transition: opacity var(--transition);
}

.ad-card:hover .ad-card-open-overlay {
  opacity: 1;
}

.ad-card-open-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 13px;
  background: rgb(255 255 255 / 0.95);
  color: var(--text-primary);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
  transition: transform 0.15s ease;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.32);
  pointer-events: none;
}

/* CARD BODY */
.ad-card-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.ad-card-name-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.ad-card-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
  word-break: break-word;
}

.ad-card-id {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ad-card-divider {
  height: 1px;
  background: var(--border);
}

/* METRICS GRID ON CARD */
.ad-card-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
}

.ad-card-metric {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ad-card-metric-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.ad-card-metric-hint,
.ad-detail-metric-hint {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
}

.ad-card-metric-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.ad-card-metric-value.zero {
  color: var(--text-muted);
  font-weight: 400;
}

/* ===========================
   SKELETON — CARDS
=========================== */
.skeleton-campaigns {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 4px 0;
}

.skeleton-campaign-header {
  height: 28px;
  width: 320px;
  max-width: 60%;
  background: linear-gradient(90deg, rgba(184, 196, 218, 0.04) 25%, rgba(184, 196, 218, 0.08) 50%, rgba(184, 196, 218, 0.04) 75%);
  background-size: 200% 100%;
  border-radius: var(--radius-sm);
  animation: shimmer 1.5s infinite;
}

.skeleton-cards-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.skeleton-card {
  height: 320px;
  background: linear-gradient(90deg, rgba(184, 196, 218, 0.03) 25%, rgba(184, 196, 218, 0.06) 50%, rgba(184, 196, 218, 0.03) 75%);
  background-size: 200% 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  animation: shimmer 1.5s infinite;
}

.skeleton-card:nth-child(2) { animation-delay: 0.1s; }
.skeleton-card:nth-child(3) { animation-delay: 0.2s; }
.skeleton-card:nth-child(4) { animation-delay: 0.3s; }

/* ===========================
   RESPONSIVE
=========================== */
@media (max-width: 1024px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .ads-cards-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-w) !important;
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-content { margin-left: 0 !important; }
  .mobile-menu-btn { display: flex; }
  .sidebar-toggle { display: none; }
  .sidebar .nav-label,
  .sidebar .sidebar-brand,
  .sidebar .logout-label { display: block !important; }
  .logo-icon-sm { width: 32px; height: 32px; }

  .topbar { padding: 0 16px; }
  .view { padding: 16px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .period-selector .period-btn { padding: 8px 10px; font-size: 12px; }
  .ads-cards-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}

@media (max-width: 640px) {
  /* Home: one card per row, and a taller "Ver detalhes" tap target. */
  .home-header-row { flex-direction: column; align-items: flex-start; }
  /* T-244: in a column, wrap sent "Sincronizado em…" to a second column off
     the right edge (the picker's 100% basis fills the first one). */
  .home-header-row { flex-wrap: nowrap; }
  .home-header-row > .home-sync-line { white-space: normal; max-width: 100%; }
  .home-accounts-grid { grid-template-columns: 1fr; }
  .home-account-card .account-overview-btn { padding: 12px 0; font-size: 13px; }
}

@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .accounts-panel-card-kpis { grid-template-columns: 1fr; }
  .kpi-card { padding: 18px; }
  .kpi-value { font-size: 22px; } /* still large/legible, just leaves headroom for big currency values */
  .setup-card { padding: 28px 20px; }
  .logo-icon { width: 34px; height: 34px; border-radius: 9px; }
  .setup-title { font-size: 18px; }
  .search-input { width: 160px; }
  .search-input:focus { width: 180px; }
  .ads-cards-grid { grid-template-columns: 1fr 1fr; }

  /* Header: let it wrap to a second row instead of compressing everything
     into one — title/menu on top, period filters + refresh below, each
     filling the available width so nothing gets cut off sideways. */
  .topbar {
    flex-wrap: wrap;
    height: auto;
    min-height: var(--topbar-h);
    padding: 12px 14px;
    row-gap: 10px;
  }
  .topbar-left { width: 100%; }
  .topbar-right { width: 100%; justify-content: space-between; }
  .page-title { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .page-subtitle { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .page-title-wrap { min-width: 0; flex: 1; }
  .period-selector { flex: 1; min-width: 0; }
  .period-btn { flex: 1; padding: 9px 4px; font-size: 12px; }
  /* T-240: the flex: 1 above is for the topbar ROW. Pago/Orgânico (Contas)
     and Meta/Google (Controle de Gastos) sit in a COLUMN, where it made the
     two buttons as tall as the free space (~220px). */
  #clients-tabs,
  #spend-platform-tabs { flex: none; }
  /* T-244: same for the owner filter (Todos, each gestor), which wraps
     onto as many rows as it needs instead of stretching or being cut. */
  .home-owner-filter { flex: none; }
  /* T-244: where the topbar has no period buttons (Contas and most views),
     the refresh button stays on the title row instead of a row of its own. */
  .topbar:not(:has(#period-selector:not(.hidden))) .topbar-left { width: auto; flex: 1 1 0; }
  .topbar:not(:has(#period-selector:not(.hidden))) .topbar-right { width: auto; }
  .refresh-btn { flex-shrink: 0; }

  /* Contas Conectadas: guarantee one full-width card per row — auto-fill's
     240px minimum can get squeezed right at this range depending on how
     much padding is around it. */
  .accounts-grid {
    grid-template-columns: 1fr;
    padding: 14px;
    gap: 12px;
  }
  .account-overview-btn { padding: 4px 0; }

  /* Preview modal: reclaim width from the overlay/card padding so the
     iframe gets as much usable space as possible, and let it use nearly
     the full viewport height too. */
  .modal-overlay { padding: 10px; }
  .modal { max-height: 96vh; }
  .modal-header { padding: 16px 16px 12px; }
  .modal-body { padding: 14px 16px; gap: 14px; }
  .preview-frame-wrap { min-height: 200px; }
}

/* ===========================
   SPEND TRACKING (internal Team/Admin module)
=========================== */
.spend-tracking-period {
  font-size: 12px;
  color: var(--text-muted);
}

.spend-tracking-budget-cell {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.spend-tracking-edit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  border: none;
  background: rgba(184, 196, 218, 0.05);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition-ui);
  flex-shrink: 0;
}
.spend-tracking-edit-btn:hover { background: rgba(47, 125, 215,0.12); color: var(--blue-light); }

.spend-tracking-not-configured { color: var(--text-muted); }

.spend-tracking-progress-wrap {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 140px;
}

.spend-tracking-progress-bar {
  position: relative;
  width: 100%;
  height: 6px;
  border-radius: 20px;
  background: rgba(184, 196, 218, 0.06);
  overflow: hidden;
}
.spend-tracking-progress-fill {
  height: 100%;
  border-radius: 20px;
  background: var(--blue-light);
  transition: width var(--transition);
}
.spend-tracking-progress-fill.is-over-budget { background: var(--orange); }

.spend-tracking-progress-text {
  font-size: 12px;
  color: var(--text-secondary);
}
.spend-tracking-progress-text.is-over-budget { color: var(--orange); }

.spend-tracking-remaining-amount { font-size: 13px; color: var(--text-secondary); }
.spend-tracking-remaining-amount.is-over-budget { color: var(--orange); }

.spend-tracking-incomplete-mark {
  color: var(--orange);
  cursor: help;
  margin-left: 1px;
}

.spend-pace-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.spend-pace-label { font-size: 13px; font-weight: 600; }
.spend-pace-detail { display: block; font-size: 11px; color: var(--text-secondary); }
.spend-pace-note { display: block; font-size: 10px; color: var(--text-muted); margin-top: 2px; }

.spend-pace-on-track .spend-pace-label { color: var(--green); }
.spend-pace-reached .spend-pace-label { color: var(--green); }
.spend-pace-below .spend-pace-label { color: var(--orange); }
.spend-pace-above .spend-pace-label { color: var(--blue-light); }
.spend-pace-alert .spend-pace-label { color: var(--red); }
.spend-pace-over .spend-pace-label { color: var(--red); }
.spend-pace-neutral .spend-pace-label { color: var(--text-muted); font-weight: 500; }

.spend-tracking-error {
  padding: 32px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--red);
}

.spend-tracking-body { padding: 4px 0 20px; }

/* T-251: the error boxes of Contas and Controle de Gastos — the same look
   (red-tinted box, the message, "Tentar novamente"). */
.setup-error.ui-error, .spend-tracking-error.ui-error {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px;
  margin: 16px 24px; padding: 12px 16px; text-align: left; font-size: 13px;
  color: var(--red); background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.3); border-radius: var(--radius-sm);
}
.setup-error.ui-error.hidden, .spend-tracking-error.ui-error.hidden { display: none; }
.ui-retry-btn {
  flex: none; min-height: 34px; padding: 0 14px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600;
  color: var(--text-primary); background: var(--bg-subtle); border: 1px solid var(--border-strong); cursor: pointer;
}
.ui-retry-btn:hover { border-color: var(--border-focus); }

/* ── FILTER TABS (Todos / Grupos / Contas) + "+ Novo Grupo" ───────────── */
.spend-tracking-tabs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 0 24px;
}
.spend-tracking-tabs-group { display: flex; gap: 6px; }
.spend-tracking-tab {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-ui);
}
.spend-tracking-tab:hover { border-color: rgba(184, 196, 218, 0.2); color: var(--text-primary); }
.spend-tracking-tab.active { background: var(--blue); border-color: var(--blue); color: white; }

/* ── ACCOUNT ROWS ──────────────────────────────────────────────────────
   One row per account (spec: "linha/tabela", not a card grid) — name,
   daily/monthly figures, pace badge and prepaid balance all on one line.
   Mobile: the row wraps, so .stac-metrics drops to its own line below the
   name while keeping the same left-to-right order of its 4 values (see
   the max-width: 640px override below). */
.spend-tracking-cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 4px 24px 20px;
}

.spend-tracking-account-card {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(184, 196, 218, 0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  transition: var(--transition-ui);
}
.spend-tracking-account-card:hover { border-color: rgba(184, 196, 218, 0.16); background: rgba(184, 196, 218, 0.04); }
.spend-tracking-account-card:focus-visible { outline: 2px solid var(--blue-light); outline-offset: 2px; }
.spend-tracking-account-card.selected {
  border-color: var(--blue-light);
  background: rgba(47, 125, 215,0.08);
  box-shadow: 0 0 0 1px var(--blue-light);
}
.spend-tracking-account-card.has-error { border-color: rgba(239, 68, 68,0.3); }

.stac-avatar {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: white;
}

.stac-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1 1 180px;
}
.stac-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stac-id {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Daily/monthly/pace/balance — the row's main-line metrics (spec:
   "Valor investido por dia", "Mensal programado", "Se está dentro do
   programado", "Saldo da conta"). Reuses .std-stat-label/.std-stat-value
   (already styled for the detail panel) for each value's own label. */
.stac-metrics {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
  flex: 2 1 420px;
}
.stac-metric { min-width: 76px; gap: 3px; }
.stac-metric-status { min-width: 100px; }

/* Small secondary line under a value (projection verdict, "Disponível" /
   "Pendente"). Projection tone: green within goal, red above, muted without. */
.stac-sub { font-size: 10px; color: var(--text-muted); line-height: 1.2; }
.stac-projection-within { color: var(--green); }
.stac-projection-over { color: var(--red); }
.std-stat-value.stac-projection-neutral { color: var(--text-primary); }
.stac-metric .spend-tracking-not-configured { font-size: 13px; }
.google-billing-na { font-size: 11px; overflow-wrap: anywhere; }

/* Fixed metric columns (Diário · Gasto · Meta · Projeção · Ritmo · Saldo)
   so every card lines up like a table and never wraps into ragged rows. */
.spend-tracking-account-card .stac-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) minmax(0, 1.05fr) minmax(0, 1.4fr);
  align-items: start;
  gap: 10px 16px;
  flex: 4 1 600px;
}
.spend-tracking-account-card .stac-body { flex: 1 1 160px; }
.spend-tracking-account-card .stac-metric,
.spend-tracking-account-card .stac-metric-status { min-width: 0; }
.spend-tracking-account-card .std-stat-label,
.spend-tracking-account-card .stac-metric .pace-chip,
.spend-tracking-account-card .stac-metric .pay-chip {
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* The longest label of the row: let it use two lines instead of being
   cut off ("FORMA DE PAGA..."). */
.spend-tracking-account-card .stac-metric-pay .std-stat-label {
  white-space: normal;
  overflow-wrap: anywhere;
}
@media (max-width: 1100px) {
  .spend-tracking-account-card .stac-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .spend-tracking-account-card .stac-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* "+ Novo Grupo" (admin only) — collapses entirely when the button is hidden. */
/* Controle de Gastos: "Pesquisar conta…" (local filter) */
.spend-tracking-search-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 16px 24px 0; }
.spend-tracking-search-row > .spend-tracking-toolbar { padding: 0; flex: 1 1 auto; }
.spend-tracking-search { width: 100%; max-width: 380px; }
/* T-255: the search may shrink (down to 240px) so "Ajustar orçamentos" and
   "+ Novo Grupo" stay on its line instead of wrapping to one of their own,
   and the two buttons take the search's height. */
@media (min-width: 768px) {
  .spend-tracking-search { flex: 1 1 240px; width: auto; }
  .spend-tracking-search-row > .spend-tracking-toolbar { flex: 0 1 auto; }
}
.spend-tracking-toolbar > .accounts-add-confirm-btn,
.spend-tracking-toolbar > .accounts-add-cancel-btn { min-height: 40px; }
.spend-tracking-search .spend-tracking-search-input,
.spend-tracking-search .spend-tracking-search-input:focus { width: 100%; padding-right: 40px; min-height: 40px; }
.spend-tracking-search-input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
/* T-311: Controle de Gastos → filtro por gestor, ao lado da pesquisa. */
/* T-315: the Contas component (.period-selector.home-owner-filter); only
   the spacing inside this card, below the search row. */
.home-owner-filter.spend-tracking-owner-filter { margin: 12px 24px 0; max-width: calc(100% - 48px); }
.spend-tracking-search-clear { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); font-size: 13px; color: var(--text-muted); background: none; border: 0; cursor: pointer; }
.spend-tracking-search-clear:hover { color: var(--text-primary); background: rgba(184, 196, 218, 0.06); }
.spend-tracking-search-clear:focus-visible { outline: 2px solid var(--blue-light); outline-offset: -2px; }
#spend-tracking-search-empty { padding: 32px 24px; }
@media (max-width: 767px) {
  .spend-tracking-search-row { padding: 14px 16px 0; flex-direction: column; align-items: stretch; }
  .spend-tracking-search { max-width: none; }
  .home-owner-filter.spend-tracking-owner-filter { margin: 12px 16px 0; max-width: calc(100% - 32px); }
  .spend-tracking-search .spend-tracking-search-input { min-height: 44px; font-size: 16px; }
  .spend-tracking-search-clear { width: 40px; height: 40px; }
}
.spend-tracking-toolbar { display: flex; justify-content: flex-end; align-items: center; flex-wrap: wrap; gap: 8px; padding: 16px 24px 0; }
.spend-tracking-toolbar > .accounts-add-confirm-btn,
.spend-tracking-toolbar > .accounts-add-cancel-btn { flex: none; padding: 7px 14px; }
.spend-tracking-toolbar:not(:has(> button:not(.hidden))) { display: none; }
.spend-tracking-toolbar-feedback { margin-right: auto; font-size: 12px; color: var(--green); }

/* "Ajustar orçamentos" — compact list, scrolls when there are many accounts. */
.budget-bulk-modal-inner { max-width: 560px; }
.budget-bulk-body { gap: 12px; }
.budget-bulk-list {
  display: flex;
  flex-direction: column;
  max-height: min(56vh, 480px);
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.budget-bulk-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 170px;
  align-items: center;
  gap: 4px 12px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}
.budget-bulk-row:last-child { border-bottom: none; }
.budget-bulk-name {
  min-width: 0;
  font-size: 13px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.budget-bulk-id { display: block; font-size: 10px; color: var(--text-muted); }
.budget-bulk-field { position: relative; display: block; }
.budget-bulk-prefix { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-size: 12px; color: var(--text-muted); pointer-events: none; }
.budget-bulk-input { padding: 7px 10px 7px 32px; font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; }
.budget-bulk-row.has-error .budget-bulk-input { border-color: var(--red); }
.budget-bulk-row-error { grid-column: 1 / -1; font-size: 11px; color: var(--red); }
.budget-bulk-status { margin-right: auto; font-size: 12px; color: var(--text-muted); }
@media (max-width: 480px) {
  .budget-bulk-row { grid-template-columns: minmax(0, 1fr); }
}
.spend-group-system-note { font-size: 12px; color: var(--text-muted); margin: -4px 0 12px; }
.stac-id .group-edit-btn { width: 20px; height: 20px; margin-left: 4px; vertical-align: middle; }

.stac-mini-progress {
  width: 100%;
  height: 4px;
  border-radius: 20px;
  background: rgba(184, 196, 218, 0.06);
  overflow: hidden;
  margin-top: 2px;
}
.stac-mini-progress-fill { height: 100%; border-radius: 20px; background: var(--blue-light); }
.stac-mini-progress-fill.is-over-budget { background: var(--orange); }

.stac-error-badge {
  display: inline-block;
  margin-top: 2px;
  font-size: 10px;
  font-weight: 600;
  color: var(--red);
  background: rgba(239, 68, 68,0.12);
  border-radius: 20px;
  padding: 2px 8px;
  width: fit-content;
}

.pace-chip {
  display: inline-block;
  margin-top: 2px;
  font-size: 10px;
  font-weight: 600;
  border-radius: 20px;
  padding: 2px 8px;
  width: fit-content;
}
.pace-chip.spend-pace-on-track, .pace-chip.spend-pace-reached { color: var(--green); background: rgba(18, 185, 129,0.12); }
.pace-chip.spend-pace-below { color: var(--orange); background: rgba(245, 158, 11,0.12); }
.pace-chip.spend-pace-above { color: var(--blue-light); background: rgba(47, 125, 215,0.12); }
.pace-chip.spend-pace-alert, .pace-chip.spend-pace-over { color: var(--red); background: rgba(239, 68, 68,0.12); }
.pace-chip.spend-pace-neutral { color: var(--text-muted); background: rgba(184, 196, 218, 0.06); }

/* "Forma de pagamento": information, not status — always neutral, never
   an alert color. Same chip shape as .pace-chip. */
.pay-chip {
  display: inline-flex; align-items: center; max-width: 100%;
  padding: 3px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
  color: var(--text-secondary); background: rgba(184, 196, 218, 0.06);
}

/* ── GROUP CARDS — same shell as an account card (spec: "não criar visual
   completamente diferente"), a subtle left accent + "GRUPO" badge is the
   only discreet differentiator. ─────────────────────────────────────── */
.spend-tracking-group-card { border-left: 2px solid var(--purple); }
.stac-avatar-group, .std-avatar-group {
  background: linear-gradient(135deg, var(--purple), #7c5cfc);
  color: white;
}
.group-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--purple);
  background: var(--purple-glow);
  border-radius: 20px;
  padding: 1px 6px;
  margin-right: 4px;
  vertical-align: middle;
}

.group-detail-actions { margin-left: auto; display: flex; gap: 6px; }

.group-incomplete-notes { display: flex; flex-direction: column; gap: 2px; }
.group-incomplete-note {
  margin: 0;
  font-size: 11px;
  color: var(--orange);
  background: rgba(245, 158, 11,0.08);
  border-radius: 8px;
  padding: 6px 10px;
}

.group-members-list { display: flex; flex-direction: column; gap: 6px; }
.group-member-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(184, 196, 218, 0.02);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: var(--transition-ui);
}
.group-member-row:hover { border-color: rgba(184, 196, 218, 0.16); background: rgba(184, 196, 218, 0.04); }
.group-member-row.has-error { border-color: rgba(239, 68, 68,0.3); }
.group-member-name { font-size: 12px; color: var(--text-secondary); }
.group-member-value { font-size: 12px; font-weight: 600; color: var(--text-primary); }

/* ── DETAIL PANEL ──────────────────────────────────────────────────────
   Shown below the grid for whichever card is currently selected. */
.spend-tracking-detail { padding: 4px 24px 20px; }

.spend-tracking-detail-inner {
  background: rgba(184, 196, 218, 0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.std-header { display: flex; align-items: center; gap: 14px; }
.std-avatar {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: white;
}
.std-header-text { min-width: 0; }
.std-name { font-size: 17px; font-weight: 700; color: var(--text-primary); margin: 0 0 2px; }
.std-id { font-size: 12px; color: var(--text-muted); }

.std-error {
  font-size: 13px;
  color: var(--red);
  background: rgba(239, 68, 68,0.08);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.std-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px 20px;
}
.std-stat { display: flex; flex-direction: column; gap: 6px; }
.std-stat-wide { grid-column: span 2; }
.std-stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.std-stat-value { font-size: 14px; color: var(--text-primary); }

/* ── CAMPAIGN MIX (Remarketing / Distribuição / Campanhas Frias) ──────
   Read-only for every role — calculated from real spend, never edited. */
.std-mix-section {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.std-mix-title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.std-mix-unavailable { margin: 0; font-size: 12px; color: var(--text-muted); }

.mix-bar {
  display: flex;
  width: 100%;
  height: 8px;
  border-radius: 20px;
  overflow: hidden;
  background: rgba(184, 196, 218, 0.06);
}
.mix-bar-segment { height: 100%; transition: width var(--transition); }
.mix-remarketing { background: var(--blue-light); }
.mix-distribution { background: var(--purple); }
.mix-cold { background: var(--green); }

.mix-legend-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.mix-legend-dot.mix-remarketing { background: var(--blue-light); }
.mix-legend-dot.mix-distribution { background: var(--purple); }
.mix-legend-dot.mix-cold { background: var(--green); }

.mix-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}
.mix-legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-secondary); }
.mix-legend-label { color: var(--text-muted); }
.mix-legend-value { font-weight: 600; color: var(--text-primary); }

.mix-unclassified-note {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 11px;
  color: var(--text-muted);
}

@media (max-width: 900px) {
  /* Keeps the name row and the metrics row from fighting for width before
     there's truly no room — same 2-line breakpoint as max-width: 640px. */
  .stac-metrics { flex-basis: 100%; padding-left: 52px; }
}

@media (max-width: 640px) {
  .spend-tracking-tabs { padding: 0 12px; }
  .spend-tracking-tabs-group { flex: 1; }
  .spend-tracking-tab { flex: 1; text-align: center; padding: 7px 8px; }
  .spend-tracking-cards-grid { padding: 4px 12px 16px; }
  .stac-metrics { padding-left: 0; gap: 14px; }
  .spend-tracking-detail { padding: 4px 12px 16px; }
  .spend-tracking-detail-inner { padding: 16px; gap: 16px; }
  .std-stats-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 14px; }
  .std-stat-wide { grid-column: 1 / -1; }
  .std-header { flex-wrap: wrap; }
  .group-detail-actions { margin-left: 0; }
}

.budget-edit-actions { justify-content: flex-end; }

.budget-edit-clear-override {
  display: block;
  background: none;
  border: none;
  padding: 0;
  margin: -6px 0 4px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.group-budget-source-note {
  margin: 4px 0 0;
  font-size: 11px;
  color: var(--text-muted);
}

/* ── PUBLICAR EM MASSA (bulk video ad publisher) ──────────────────────
   Each ad is a card (.bulk-publish-row) with two flex "lines" — spec:
   "Não obrigar todos os campos a caberem em uma única linha". A single
   wide row (the previous <table> layout) is exactly what was overflowing
   the screen; every field now wraps naturally instead. Reuses
   .form-input/.filter-select (compacted here) and the existing
   .pace-chip/.spend-pace-* badges for per-row Sucesso/Erro/Publicando —
   no new badge system. .table-wrap (index.html, shared/unmodified) still
   provides overflow-x:auto as a last-resort safety net — it should
   rarely if ever be needed now, since fields wrap instead of forcing
   width. ──────────────────────────────────────────────────────────── */
.bulk-publish-table {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.bulk-publish-tbody {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.bulk-publish-row {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
}
.bulk-publish-row.is-publishing { background: rgba(47, 125, 215,0.06); }

.bulk-publish-row-line {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.bulk-publish-row-line-2 {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

/* Every field is free to wrap onto its own line — width:100% inside a
   flexible, min-width:0 track (never a fixed px width) is what lets a
   field shrink instead of forcing the whole row wider than the screen. */
.bulk-publish-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 150px;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.bulk-publish-field-grow { flex: 2 1 220px; }
.bulk-publish-field-video { flex: 1 1 170px; }
.bulk-publish-field-result { flex: 1 1 170px; }
.bulk-publish-field-actions {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  flex: 0 0 auto;
}

.bulk-publish-field-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}

.bulk-publish-input.form-input,
.bulk-publish-input.filter-select {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  font-size: 12px;
}
.bulk-publish-static-note {
  padding: 8px 10px;
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}
.bulk-publish-static-note-warning {
  color: var(--red);
  font-weight: 600;
  font-style: normal;
}
.bulk-publish-textarea {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  min-height: 60px;
  max-height: 140px;
  resize: vertical;
  font-family: inherit;
}

.bulk-publish-file-input { display: block; width: 100%; max-width: 100%; box-sizing: border-box; font-size: 11px; color: var(--text-secondary); }
.bulk-publish-file-name {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-muted);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bulk-publish-result-cell { min-width: 0; max-width: 100%; }
.bulk-publish-result-detail {
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-muted);
  word-break: break-word;
}
.bulk-publish-idle { color: var(--text-muted); }

.bulk-publish-retry-btn {
  display: block;
  margin-top: 6px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--blue-light);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  cursor: pointer;
  transition: var(--transition-ui);
}
.bulk-publish-retry-btn:hover { border-color: var(--blue-light); background: rgba(47, 125, 215,0.08); }

.bulk-publish-action-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  cursor: pointer;
  transition: var(--transition-ui);
}
.bulk-publish-action-btn:hover { border-color: rgba(184, 196, 218, 0.2); color: var(--text-primary); }
.bulk-publish-action-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.bulk-publish-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 24px 4px;
  flex-wrap: wrap;
}
.bulk-publish-summary { font-size: 12px; color: var(--text-muted); }

/* Tablet: fields still wrap freely (flex-basis already shrinks them),
   just a little tighter so more fit per visual sub-row. */
@media (max-width: 900px) {
  .bulk-publish-field { flex-basis: 130px; }
  .bulk-publish-field-grow { flex-basis: 200px; }
}

/* Mobile: fully stacked — one field per line, each full width. */
@media (max-width: 640px) {
  .bulk-publish-row-line { flex-direction: column; align-items: stretch; }
  .bulk-publish-field,
  .bulk-publish-field-grow,
  .bulk-publish-field-video,
  .bulk-publish-field-result { flex-basis: auto; width: 100%; }
  .bulk-publish-field-actions { justify-content: flex-end; }
}


/* Google Ads — contas vinculadas ao cliente (Dashboard de Clientes) */
.google-ads-admin { flex-wrap: wrap; gap: 8px; }
.google-ads-link-select {
  flex: 1; min-width: 0; max-width: 100%; padding: 8px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: rgba(184, 196, 218, 0.03); color: var(--text-primary); font-size: 13px;
}
.google-ads-link-select:focus { outline: none; border-color: var(--border-focus); }
.google-ads-sync-message { white-space: pre-line; }

/* Visão Geral — identificação discreta do canal (só quando a grade mistura
   Meta e Google). Cards Google usam exatamente o desenho dos cards Meta. */
.home-channel-badge {
  align-self: flex-start; font-size: 10px; font-weight: 600; letter-spacing: .02em;
  padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-muted);
  margin-top: -4px;
}
.home-channel-google { color: var(--blue-bright); border-color: rgba(47, 125, 215,.35); }
.home-channel-meta { color: var(--text-muted); }
.google-account-kpis { margin-top: 16px; }

/* Vínculo Google ↔ cliente Meta (Admin, Visão Geral). */
.home-channel-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: -4px; }
.home-channel-badges .home-channel-badge { margin-top: 0; }
.home-google-link {
  display: flex; flex-direction: column; gap: 8px; padding: 10px 12px;
  border: 1px dashed var(--border); border-radius: var(--radius-sm); font-size: 12px; color: var(--text-muted);
}
.home-google-link-title { font-weight: 600; color: var(--text-primary); }
.home-google-link-suggestion strong { color: var(--text-primary); }
.home-google-link-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.home-google-link-actions .accounts-add-confirm-btn { padding: 6px 12px; font-size: 12px; width: auto; flex: 0 0 auto; }
.home-google-link-error { color: var(--red); }

/* Detalhe do cliente combinado — "Cada canal em separado" (só investimento):
   um container, título + subtítulo, Meta | Google com divisória vertical no
   desktop, empilhados no mobile. */
.combined-channel-spend { padding: 24px 28px; margin: 0; }
.combined-channel-head { display: flex; flex-direction: column; gap: 4px; margin-bottom: 20px; }
.combined-channel-title { margin: 0; font-size: 16px; font-weight: 700; color: var(--text-primary); }
.combined-channel-subtitle { margin: 0; font-size: 13px; color: var(--text-muted); }
.combined-channel-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.combined-channel-col { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 4px 0; }
.combined-channel-col + .combined-channel-col { border-left: 1px solid var(--border); padding-left: 28px; margin-left: 28px; }
.combined-channel-label { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); }
.combined-channel-value { font-size: 28px; font-weight: 700; line-height: 1.15; color: var(--text-primary); overflow-wrap: anywhere; }
.combined-channel-value.is-unavailable { color: var(--text-muted); }
.combined-channel-note { font-size: 12px; color: var(--text-muted); }
@media (max-width: 639px) {
  .combined-channel-spend { padding: 20px; }
  .combined-channel-grid { grid-template-columns: minmax(0, 1fr); }
  .combined-channel-col + .combined-channel-col { border-left: 0; margin-left: 0; padding-left: 0; border-top: 1px solid var(--border); margin-top: 16px; padding-top: 16px; }
}

/* Foto da Página sobre o círculo de iniciais (Visão Geral). Sem foto, ou se
   ela falhar, o círculo de sempre fica visível. */
.home-account-avatar { position: relative; overflow: hidden; flex: none; }
.home-account-avatar-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

/* Acompanhamento de Gastos — cliente Meta + Google: bloco de canais abaixo
   da linha Meta (que permanece igual), e o botão de meta Google. */
.spend-tracking-account-card.has-channels { flex-wrap: wrap; }
.stac-channels { flex: 1 0 100%; grid-column: 1 / -1; display: flex; flex-direction: column; gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); min-width: 0; }
.stac-channel { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; min-width: 0; }
.stac-channel-name { flex: 0 0 180px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.google-budget-edit-btn { background: none; border: 0; padding: 0 0 0 6px; color: var(--text-muted); cursor: pointer; vertical-align: middle; }
.google-budget-edit-btn:hover { color: var(--text-primary); }
.google-financial-edit-btn { background: none; border: 0; padding: 0; margin-left: 8px; color: var(--text-muted); cursor: pointer; font-size: 10px; font-weight: 500; letter-spacing: 0; text-transform: none; display: inline-flex; align-items: center; gap: 3px; }
.google-financial-edit-btn:hover { color: var(--text-primary); }
.google-balance-details-btn { background: none; border: 0; padding: 0; margin-top: 2px; color: var(--text-muted); font-size: 10px; text-decoration: underline; cursor: pointer; align-self: flex-start; }
.google-balance-details-btn:hover { color: var(--text-primary); }
/* Fundos disponíveis (Google pré-pago): value + discreet origin lines. */
.google-funds-line { overflow-wrap: anywhere; }
.google-funds-actions { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 4px; }
.google-funds-btn { background: none; border: 0; padding: 0; color: var(--purple); font-size: 11px; font-weight: 600; cursor: pointer; text-align: left; }
.google-funds-btn:hover { text-decoration: underline; }
.google-financial-modal-inner { max-width: 560px; }
.gfin-composition { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.gfin-row { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.gfin-label { color: var(--text-muted); }
.gfin-value { color: var(--text-primary); text-align: right; }
.gfin-note { font-size: 11px; color: var(--text-muted); margin: 6px 0; }
.gfin-inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.gfin-inline .form-input { flex: 1 1 140px; min-width: 0; }
.gfin-inline .accounts-add-confirm-btn { width: auto; flex: 0 0 auto; }
.gfin-action { margin: 8px 0; }
.gfin-action summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text-primary); }
.gfin-history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.gfin-history-item { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 2px 10px; font-size: 12px; }
.gfin-history-date { color: var(--text-muted); }
.gfin-history-amount { text-align: right; }
.gfin-history-note { grid-column: 2 / -1; color: var(--text-muted); overflow-wrap: anywhere; }
/* Google metrics use the Meta row's own grid (no override): same columns,
   widths and breakpoints; the prepaid balance fills the 6th column. */
@media (max-width: 639px) {
  .stac-channel-name { flex-basis: 100%; }
}

/* "Visualizar no Instagram" is a real link (original post/reel, new tab). */
.ad-placement-link { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.ad-placement-link.is-disabled { opacity: 0.45; cursor: not-allowed; }

/* Ad details modal — the ad's own media is the focus (no Facebook iframe):
   natural proportions (contain, never cropped: vertical reels, square and
   horizontal alike) on the modal's dark background; actions below — two
   equal columns (Instagram | Facebook), wrapping only when they don't fit. */
.ad-media {
  display: flex; align-items: center; justify-content: center;
  width: 100%; min-height: 220px; max-height: 70vh;
  background: var(--bg-elevated); border-radius: 12px; overflow: hidden;
}
.ad-media-img {
  display: block; max-width: 100%; max-height: 70vh; width: auto; height: auto;
  object-fit: contain; background: transparent;
}
.ad-media-empty { padding: 32px 16px; font-size: 13px; color: var(--text-muted); text-align: center; }
/* Account detail "Anúncios": saved catalog shown while it refreshes. */
.ads-saved-note { margin: 0 0 10px; font-size: 12px; color: var(--text-muted); }
.ad-media-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.ad-media-actions:empty { display: none; }
.ad-media-action {
  flex: 1 1 140px; display: inline-flex; align-items: center; justify-content: center;
  padding: 9px 14px; border-radius: 8px; border: 1px solid var(--border);
  background: rgba(184, 196, 218, 0.04); color: var(--text-primary);
  font-size: 13px; font-weight: 600; text-decoration: none; cursor: pointer;
}
.ad-media-action:hover { background: rgba(184, 196, 218, 0.08); }
@media (max-width: 640px) {
  .ad-media { max-height: 60vh; }
  .ad-media-img { max-height: 60vh; }
}

/* Visão Geral — conversões Google classificadas como Mensagens. */
.home-google-messages-btn { background: none; border: 0; padding: 0; margin: 4px 0 0; color: var(--text-muted); font-size: 11px; text-decoration: underline; cursor: pointer; text-align: left; }
.home-google-messages-btn:hover { color: var(--text-primary); }
.gmsg-actions { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.gmsg-action { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 10px; align-items: start; font-size: 13px; cursor: pointer; }
.gmsg-action input { margin-top: 3px; }
.gmsg-action-name { color: var(--text-primary); overflow-wrap: anywhere; }
.gmsg-action-meta { grid-column: 2; font-size: 11px; color: var(--text-muted); }
.gmsg-suggested { display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 10px; background: rgba(18, 185, 129,0.15); color: var(--green); font-size: 10px; font-weight: 600; vertical-align: middle; }
.gmsg-warning { font-size: 12px; color: var(--orange, var(--orange)); margin: 8px 0; }
.home-google-admin { margin-top: 6px; }

/* Bloco "Campanhas Google Ads" abaixo de "Campanhas Meta Ads". */
.google-campaigns-section { margin-top: 16px; }

/* =====================================================================
   REFINED UI LAYER — one visual language for every screen.
   Built on the tokens above; only presentation (no layout logic, no
   behaviour). Kept last so it wins over the older per-screen rules.
   ===================================================================== */

/* ── Page structure ─────────────────────────────────────────────────── */
body {
  background:
    radial-gradient(1100px 520px at 80% -8%, rgba(47, 125, 215, 0.09), transparent 62%),
    var(--bg-primary);
  background-attachment: fixed;
  font-feature-settings: 'cv11', 'ss01';
  line-height: 1.45;
}
/* A flex item without min-width:0 grows to its widest child: wide tables
   used to push the whole page sideways (clipped by body overflow-x)
   instead of scrolling inside their own .table-wrap. */
.main-content, .view { min-width: 0; }
.view { padding: 28px 32px 40px; gap: var(--space-section); }
.topbar {
  background: rgba(2, 11, 34, 0.8);
  border-bottom-color: var(--border);
  padding: 0 32px;
}
.page-title { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; color: var(--text-primary); }
.page-subtitle { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }

/* Navigation */
.sidebar { border-right: 1px solid var(--border); }
.nav-item { border-radius: var(--radius-sm); color: var(--text-secondary); font-weight: 500; }
.nav-item:hover { color: var(--text-primary); background: var(--bg-subtle); }
.nav-item.active { color: var(--blue); background: var(--white); box-shadow: var(--shadow-sm); }
.nav-item.active svg { color: var(--blue-light); }

/* ── Cards ──────────────────────────────────────────────────────────── */
.section-card,
.kpi-card,
.account-overview-card,
.client-card,
.ad-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
}
.section-card { border-radius: var(--radius-lg); }
.section-header { padding: 18px var(--card-pad); border-bottom-color: var(--border); }
.section-title { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.kpi-card { border-radius: var(--radius-lg); padding: 20px var(--card-pad); }
.kpi-card:hover,
.account-overview-card:hover,
.client-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-hover); background-color: var(--bg-card-hover); }
.kpi-label { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; color: var(--text-muted); }
.kpi-value { font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.account-overview-card { border-radius: var(--radius-lg); }
.ad-card { border-radius: var(--radius-md); }
.ad-card:hover { border-color: rgba(47, 125, 215, 0.4); box-shadow: var(--shadow-hover); }
/* The ads of the account detail had no inner padding (campaign headers
   touched the card edge). */
#accounts-panel-ads-container { padding: 18px var(--card-pad) var(--card-pad); }
.campaign-header { border-bottom-color: var(--border); }
.campaign-name { font-size: 16px; letter-spacing: -0.01em; }

/* ── Buttons ────────────────────────────────────────────────────────── */
/* Primary CTA (confirm/save/open): warm orange, dark text for contrast. */
.accounts-add-confirm-btn,
.connect-btn {
  background: var(--cta);
  color: var(--cta-text);
  font-weight: 700;
  border-radius: var(--radius-sm);
  min-height: 34px;
  box-shadow: 0 1px 0 rgb(255 255 255 / 0.25) inset, 0 6px 18px -8px var(--cta-glow);
  transition: background var(--transition), box-shadow var(--transition), transform var(--transition);
}
.accounts-add-confirm-btn:hover:not(:disabled),
.connect-btn:hover:not(:disabled) { background: var(--cta-hover); box-shadow: 0 1px 0 rgb(255 255 255 / 0.3) inset, 0 10px 24px -8px var(--cta-glow); transform: translateY(-1px); }
.accounts-add-confirm-btn:active:not(:disabled),
.connect-btn:active:not(:disabled) { transform: scale(0.97); } /* T-275: sinks on press */
.accounts-add-confirm-btn:disabled,
.connect-btn:disabled { opacity: 0.55; box-shadow: none; }
.connect-btn .btn-spinner { border-color: rgb(255 255 255 / 0.35); border-top-color: var(--white); }
/* Secondary: quiet, bordered. */
.accounts-add-cancel-btn {
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-height: 34px;
}
.accounts-add-cancel-btn:hover { background: rgba(184, 196, 218, 0.1); color: var(--text-primary); border-color: var(--border-strong); }
/* Text actions */
.see-all-btn, .account-overview-btn { color: var(--blue-light); font-weight: 600; transition: color var(--transition), opacity var(--transition); }
.see-all-btn:hover:not(:disabled), .account-overview-btn:hover { opacity: 1; color: var(--blue-hover); }
.see-all-btn:disabled { color: var(--text-muted); cursor: not-allowed; }
.refresh-btn { border-radius: var(--radius-sm); height: var(--control-h); width: var(--control-h); background: var(--bg-subtle); }
.refresh-btn:hover { background: rgba(184, 196, 218, 0.1); border-color: var(--border-strong); }

/* Period selectors: one segmented control everywhere. */
.period-selector {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius-sm) + 2px);
  padding: 3px;
  gap: 2px;
}
.period-btn { border-radius: 8px; padding: 7px 14px; color: var(--text-secondary); font-weight: 600; }
.period-btn:hover { color: var(--text-primary); background: var(--bg-subtle); }
.period-btn.active { background: var(--blue); color: var(--white); box-shadow: 0 4px 14px -6px var(--blue-glow); }

/* Keyboard focus: always visible, never on mouse click. */
:where(button, a, select, input, textarea, [tabindex]):focus-visible { outline: 2px solid var(--blue-light); outline-offset: 2px; }

/* ── Inputs, selects, search ────────────────────────────────────────── */
.form-input,
.accounts-add-input,
.search-input,
.filter-select,
.google-ads-link-select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}
.search-input, .filter-select, .google-ads-link-select { min-height: var(--control-h); }
.form-input:hover, .accounts-add-input:hover, .search-input:hover, .filter-select:hover, .google-ads-link-select:hover { border-color: var(--border-strong); }
.form-input:focus, .accounts-add-input:focus, .search-input:focus, .filter-select:focus, .google-ads-link-select:focus {
  border-color: var(--border-focus);
  box-shadow: var(--focus-ring);
  outline: none;
}
.form-input::placeholder, .accounts-add-input::placeholder, .search-input::placeholder { color: var(--text-muted); }
.filter-select { color: var(--text-primary); }

/* ── Tables ─────────────────────────────────────────────────────────── */
.ads-table thead th {
  text-align: left;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  background: rgba(184, 196, 218, 0.04);
  border-bottom: 1px solid var(--border);
  padding: 12px 18px;
}
.ads-table td { padding: 14px 18px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.ads-table tbody tr { border-bottom-color: rgba(184, 196, 218, 0.07); }
.ads-table tbody tr:hover { background: rgba(184, 196, 218, 0.045); }

/* ── Badges / status ────────────────────────────────────────────────── */
.status-badge {
  padding: 3px 10px 3px 8px;
  border-radius: var(--radius-pill);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 22%, transparent);
}
.status-CAMPAIGN_PAUSED { background: rgba(245, 158, 11, 0.12); color: var(--orange); }
.status-CAMPAIGN_PAUSED::before { background: var(--orange); }
.client-channel, .home-channel-badge, .account-channel-badge { border-radius: var(--radius-pill); }

/* ── Modals ─────────────────────────────────────────────────────────── */
.modal-overlay { background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(6px); }
.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-pop);
}
.modal-header { padding: 22px 26px 18px; border-bottom-color: var(--border); }
.modal-title { font-size: 17px; font-weight: 800; letter-spacing: -0.015em; }
.modal-close { border-radius: 8px; }

/* ── Empty / loading / feedback ─────────────────────────────────────── */
.empty-state { color: var(--text-muted); gap: 10px; }
.empty-state p { font-size: 13.5px; color: var(--text-secondary); }
.account-analytics-empty, .client-block-empty { color: var(--text-muted); font-size: 13px; }
.setup-error { border-radius: var(--radius-sm); background: rgba(239, 68, 68, 0.09); border-color: rgba(239, 68, 68, 0.28); }
.skeleton-row, .skeleton-card, .skeleton-campaign-header {
  background: linear-gradient(90deg, rgba(184, 196, 218, 0.05) 25%, rgba(184, 196, 218, 0.1) 50%, rgba(184, 196, 218, 0.05) 75%);
  background-size: 200% 100%;
  border-radius: var(--radius-sm);
}
.skeleton-card { border-radius: var(--radius-md); border-color: var(--border); }

/* ── Responsive rhythm ──────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .view { padding: 24px 22px 32px; }
  .topbar { padding: 0 22px; }
}
@media (max-width: 768px) {
  .view { padding: 18px 16px 28px; gap: 18px; }
  .topbar { padding: 0 16px; }
  .section-header { padding: 16px 16px; }
  #accounts-panel-ads-container { padding: 14px 16px 16px; }
  .ads-table thead th, .ads-table td { padding-left: 12px; padding-right: 12px; }
}
@media (max-width: 480px) {
  .page-title { font-size: 17px; }
  .kpi-card { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  /* T-263: besides cutting the duration, endless animations (pulse, spin)
     stop after one round and scrolling jumps instead of gliding. */
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* ── Detalhe da conta: Leads por dia ─────────────────────────────────────── */
.daily-leads { overflow: visible; }
.daily-leads-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.section-subtitle { font-size: 12.5px; color: var(--text-muted); }
.daily-leads-note { font-size: 12px; color: var(--orange); }
.daily-leads-body { position: relative; padding: 12px 12px 8px; min-height: 236px; color: var(--blue-light); }
.daily-chart-svg { display: block; overflow: visible; }
.daily-chart-grid { stroke: var(--border); stroke-width: 1; }
.daily-chart-ylabel, .daily-chart-xlabel { fill: var(--text-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.daily-chart-line { stroke: var(--blue-light); stroke-width: 2.25; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.daily-chart-dot { fill: var(--bg-card); stroke: var(--blue-light); stroke-width: 2; vector-effect: non-scaling-stroke; }
.daily-chart-cursor { stroke: var(--border-strong); stroke-width: 1; stroke-dasharray: 3 3; }
.daily-chart-tip {
  position: absolute; top: 8px; transform: translateX(-50%); pointer-events: none; z-index: 2;
  display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; min-width: 120px;
  background: var(--bg-elevated); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-hover); font-size: 12px; color: var(--text-secondary); white-space: nowrap;
}
.daily-chart-tip-date { font-size: 11px; color: var(--text-muted); }
.daily-chart-tip-total strong { font-size: 15px; color: var(--text-primary); margin-right: 3px; }
.daily-chart-tip-split { font-size: 11px; color: var(--text-muted); }
.daily-chart-skeleton {
  height: 220px; border-radius: var(--radius-sm);
  background: linear-gradient(90deg, rgba(184, 196, 218, 0.05) 25%, rgba(184, 196, 218, 0.1) 50%, rgba(184, 196, 218, 0.05) 75%);
  background-size: 200% 100%; animation: shimmer 1.5s infinite;
}
.daily-chart-empty { height: 220px; display: flex; align-items: center; justify-content: center; text-align: center; font-size: 13px; color: var(--text-muted); padding: 0 16px; }
@media (max-width: 768px) {
  .daily-leads-body { padding: 8px 4px 4px; }
  .daily-chart-ylabel, .daily-chart-xlabel { font-size: 10px; }
}

/* ── Referências (Admin) ────────────────────────────────────────────── */
.references-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 18px; }
.references-toolbar .references-search { flex: 1 1 280px; width: auto; padding-left: 14px; }
.references-toolbar .references-search:focus { width: auto; }
.references-toolbar .filter-select { flex: 0 1 auto; max-width: 220px; }
.references-add-btn { flex: none; padding: 9px 18px; margin-left: auto; }
.references-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
@media (max-width: 900px) { .references-grid { grid-template-columns: minmax(0, 1fr); } }
.reference-card {
  display: flex; flex-direction: column; gap: 12px; min-width: 0; min-height: 250px;
  padding: 22px 24px; cursor: pointer; border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border); box-shadow: var(--shadow-card);
  transition: border-color var(--transition), box-shadow var(--transition), background-color var(--transition);
}
.reference-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-hover); background-color: var(--bg-card-hover); }
.reference-card:focus-visible { outline: 2px solid var(--blue-light); outline-offset: 2px; }
.reference-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; min-width: 0; }
.reference-top-left { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; min-width: 0; }
.reference-badge {
  display: inline-flex; padding: 3px 10px; border-radius: var(--radius-pill);
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--blue-light); background: var(--blue-soft); box-shadow: inset 0 0 0 1px rgba(47, 125, 215, 0.25);
}
.reference-meta { font-size: 12.5px; color: var(--text-muted); }
.reference-perf { display: flex; flex-direction: column; align-items: flex-end; flex: none; text-align: right; }
.reference-perf strong { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; color: var(--text-primary); font-variant-numeric: tabular-nums; line-height: 1.1; }
.reference-perf span { font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }
.reference-metric { font-size: 12.5px; font-weight: 600; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.reference-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; min-width: 0; }
.reference-title-wrap { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.reference-title { font-size: 18px; font-weight: 800; letter-spacing: -0.015em; line-height: 1.3; color: var(--text-primary); overflow-wrap: break-word; }
.reference-title-lg { font-size: 22px; }
.reference-profile { align-self: flex-start; font-size: 13px; font-weight: 600; color: var(--blue-light); text-decoration: none; overflow-wrap: anywhere; }
.reference-profile:hover { color: var(--blue-hover); text-decoration: underline; }
.reference-thumb { flex: none; width: 56px; height: 56px; border-radius: 10px; overflow: hidden; background: var(--bg-subtle); border: 1px solid var(--border); }
.reference-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.reference-hook {
  margin: 0; padding: 2px 0 2px 14px; border-left: 3px solid var(--blue); font-style: italic;
  font-size: 14px; line-height: 1.55; color: var(--text-secondary);
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden;
}
.reference-hook-full { display: block; -webkit-line-clamp: unset; line-clamp: unset; }
.reference-cta { margin-top: auto; font-size: 13px; font-weight: 600; color: var(--blue-light); }
.reference-skeleton { cursor: default; gap: 14px; }
.reference-skeleton span {
  height: 14px; border-radius: 6px; animation: shimmer 1.5s infinite;
  background: linear-gradient(90deg, rgba(184, 196, 218, 0.05) 25%, rgba(184, 196, 218, 0.1) 50%, rgba(184, 196, 218, 0.05) 75%); background-size: 200% 100%;
}
.reference-skeleton span:nth-child(1) { width: 40%; }
.reference-skeleton span:nth-child(2) { width: 80%; height: 20px; }
.reference-skeleton span:nth-child(3) { width: 65%; }
.references-state { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 40px 24px; text-align: center; color: var(--text-secondary); font-size: 14px; }
.references-state .accounts-add-confirm-btn { flex: none; padding: 9px 20px; }
.references-state-detail { font-size: 12px; color: var(--text-muted); }
.references-more { display: flex; justify-content: center; margin-top: 18px; }
.references-more .accounts-add-cancel-btn { flex: none; padding: 9px 20px; }

/* Detail / form modal */
.modal.references-modal { max-width: 860px; }
.reference-detail-head { flex: 1; min-width: 0; }
.reference-detail, .reference-form { display: flex; flex-direction: column; gap: 16px; padding: 20px 26px 26px; overflow-y: auto; }
.reference-links { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; }
.reference-original { font-size: 13px; color: var(--text-secondary); text-decoration: none; }
.reference-original:hover { color: var(--text-primary); text-decoration: underline; }
.reference-section { display: flex; flex-direction: column; gap: 8px; padding-top: 14px; border-top: 1px solid var(--border); }
.reference-section-title { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }
.reference-section-body { font-size: 14px; line-height: 1.65; color: var(--text-secondary); white-space: pre-wrap; overflow-wrap: break-word; }
.reference-replicability { padding: 14px 16px; border-radius: var(--radius-sm); font-size: 13.5px; line-height: 1.55; color: var(--text-secondary); background: var(--bg-subtle); border: 1px solid var(--border); }
.reference-replicability strong { color: var(--text-primary); }
.reference-replicability-alta { background: rgba(18, 185, 129, 0.07); border-color: rgba(18, 185, 129, 0.25); }
.reference-replicability-alta strong { color: var(--green); }
.reference-replicability-media { background: rgba(251, 191, 36, 0.06); border-color: rgba(251, 191, 36, 0.22); }
.reference-replicability-media strong { color: var(--yellow); }
.reference-replicability-baixa strong { color: var(--orange); }
.reference-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.reference-tag { padding: 3px 10px; border-radius: var(--radius-pill); font-size: 11.5px; color: var(--text-secondary); background: var(--bg-subtle); border: 1px solid var(--border); }
.reference-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 10px; padding-top: 6px; }
.reference-actions .accounts-add-confirm-btn, .reference-actions .accounts-add-cancel-btn { flex: none; padding: 9px 18px; }
.reference-confirm-text { font-size: 13px; color: var(--text-secondary); margin-right: auto; }
.reference-danger-btn { padding: 9px 18px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 700; color: var(--white); background: var(--red-strong); }
.reference-danger-btn:hover:not(:disabled) { background: var(--red-soft); }
.reference-danger-btn:disabled { opacity: 0.6; }
.reference-form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 14px; }
@media (max-width: 760px) { .reference-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.reference-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.reference-field-label { font-size: 11.5px; font-weight: 600; color: var(--text-secondary); }
.reference-field .form-input, .reference-field .filter-select { width: 100%; padding: 10px 12px; font-size: 13.5px; }
.reference-field textarea.form-input { resize: vertical; line-height: 1.5; font-family: inherit; }
.reference-import-row { display: flex; align-items: flex-end; gap: 10px; }
.reference-import-row .reference-field { flex: 1; }
.reference-import-btn { flex: none; padding: 10px 14px; white-space: nowrap; }
.reference-import-note { margin: -6px 0 0; font-size: 12.5px; color: var(--text-muted); }
/* Buscar referências (discovery panel) */
.references-toolbar-actions { display: flex; gap: 10px; margin-left: auto; flex-wrap: wrap; }
.references-toolbar-actions .references-add-btn { margin-left: 0; }
.references-discover-btn { flex: none; padding: 9px 18px; }
.discover-panel { display: flex; flex-direction: column; gap: 18px; padding: 22px 24px; margin-bottom: 22px; }
.discover-panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.discover-form { display: flex; flex-direction: column; gap: 14px; }
.discover-panel > *, .discover-results > *, .discover-form > * { min-width: 0; }
.discover-form-grid .filter-select { min-width: 0; text-overflow: ellipsis; }
.discover-form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 14px; }
.discover-form-grid .form-input, .discover-form-grid .filter-select { width: 100%; padding: 10px 12px; font-size: 13.5px; max-width: none; }
.discover-hashtags { display: flex; flex-direction: column; gap: 8px; }
.discover-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.discover-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: var(--radius-pill); font-size: 12.5px; color: var(--text-secondary); background: var(--bg-subtle); border: 1px solid var(--border); cursor: pointer; user-select: none; }
.discover-chip input { position: absolute; opacity: 0; pointer-events: none; }
.discover-chip small { font-size: 10.5px; color: var(--text-muted); }
.discover-chip.is-on { color: var(--text-primary); border-color: var(--blue-light); background: rgba(47, 125, 215, 0.12); }
.discover-chip.is-suggested { border-style: dashed; }
.discover-chip:has(input:disabled) { opacity: 0.5; cursor: not-allowed; }
.discover-chip:has(input:focus-visible) { outline: 2px solid var(--blue-light); outline-offset: 2px; }
.discover-results { display: flex; flex-direction: column; gap: 14px; }
.discover-results:empty { display: none; }
.discover-results-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; padding-top: 16px; border-top: 1px solid var(--border); }
.discover-title { font-size: 16px; font-weight: 800; color: var(--text-primary); display: flex; align-items: center; gap: 8px; }
.discover-count { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: var(--radius-pill); background: var(--bg-subtle); border: 1px solid var(--border); color: var(--text-secondary); }
.discover-results-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.discover-results-tools .accounts-add-confirm-btn { flex: none; padding: 9px 16px; }
.discover-pills { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--radius-pill); background: var(--bg-subtle); border: 1px solid var(--border); }
.discover-pill { padding: 5px 12px; border-radius: var(--radius-pill); font-size: 12.5px; font-weight: 600; color: var(--text-secondary); }
.discover-pill.is-active { color: var(--text-primary); background: var(--bg-card-hover); box-shadow: 0 0 0 1px var(--border-strong); }
.discover-warning, .discover-notice { margin: 0; font-size: 12.5px; color: var(--text-muted); }
.discover-warning { color: var(--yellow); }
.discover-card { cursor: default; gap: 12px; }
.discover-card.is-selected { border-color: var(--blue-light); }
.discover-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.discover-check { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; min-width: 0; cursor: pointer; }
.discover-check input { width: 16px; height: 16px; accent-color: var(--blue-light); flex: none; }
.discover-score { display: flex; flex-direction: column; align-items: flex-end; flex: none; text-align: right; }
.discover-score span { font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }
.discover-score strong { font-size: 22px; font-weight: 800; color: var(--text-primary); font-variant-numeric: tabular-nums; line-height: 1.1; }
.discover-score small { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.discover-card-body { display: flex; gap: 14px; align-items: flex-start; min-width: 0; }
.discover-card-text { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.discover-author { font-size: 12.5px; font-weight: 600; color: var(--text-secondary); }
.discover-caption { margin: 0; font-size: 13.5px; line-height: 1.55; color: var(--text-secondary); overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; line-clamp: 4; overflow: hidden; white-space: pre-line; }
.discover-caption-empty { font-style: italic; color: var(--text-muted); }
.discover-card-actions { margin-top: auto; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.discover-card-actions .accounts-add-cancel-btn { flex: none; padding: 7px 14px; }
.discover-saved { font-size: 12.5px; font-weight: 600; color: var(--green); }
@media (max-width: 900px) { .discover-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* Perfis de referência */
.references-tabs { display: inline-flex; padding: 3px; gap: 2px; margin-bottom: 18px; border-radius: var(--radius-pill); background: var(--bg-subtle); border: 1px solid var(--border); }
.references-tabs .discover-pill { padding: 7px 16px; font-size: 13px; }
/* T-264: on a phone the three tabs share the width and each label stays on
   one line ("Perfis de referência" broke in two). */
@media (max-width: 640px) {
  .references-tabs { display: flex; width: 100%; overflow-x: auto; }
  .references-tabs .discover-pill { flex: 1 0 auto; white-space: nowrap; padding: 7px 10px; }
}
.seeds-toolbar .references-state-detail { flex: 1 1 200px; }
.seeds-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1200px) { .seeds-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .seeds-grid { grid-template-columns: minmax(0, 1fr); } }
.seed-card { cursor: default; gap: 10px; }
.seed-card-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.seed-card-id { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.seed-username { font-size: 14.5px; font-weight: 700; color: var(--text-primary); overflow-wrap: anywhere; }
.seed-name { font-size: 12.5px; font-weight: 500; color: var(--text-secondary); overflow-wrap: anywhere; }
.seed-avatar { position: relative; flex: none; width: 44px; height: 44px; border-radius: 50%; overflow: hidden; background: var(--bg-subtle); border: 1px solid var(--border); display: inline-flex; align-items: center; justify-content: center; }
.seed-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; }
.seed-avatar-fallback { font-size: 15px; font-weight: 800; color: var(--text-muted); }
.seed-status { flex: none; padding: 3px 10px; border-radius: var(--radius-pill); font-size: 11px; font-weight: 700; color: var(--text-secondary); background: var(--bg-subtle); border: 1px solid var(--border); white-space: nowrap; }
.seed-status-available { color: var(--green); border-color: rgba(18, 185, 129, 0.3); background: rgba(18, 185, 129, 0.08); }
.seed-status-not_found, .seed-status-personal_or_unsupported, .seed-status-unavailable, .seed-status-api_error { color: var(--yellow); border-color: rgba(251, 191, 36, 0.28); background: rgba(251, 191, 36, 0.06); }
.seeds-candidates { display: flex; flex-direction: column; gap: 12px; padding: 20px 22px; margin-top: 22px; }
.seed-candidate { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.seed-candidate-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1 1 260px; }
.seed-candidate-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.seed-candidate-actions .accounts-add-confirm-btn, .seed-candidate-actions .accounts-add-cancel-btn { flex: none; padding: 7px 12px; }
.seed-media-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 760px) { .seed-media-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .seed-media-grid { grid-template-columns: minmax(0, 1fr); } }
.seed-media-tile { display: flex; flex-direction: column; gap: 8px; min-width: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--bg-subtle); }
.seed-media-preview { position: relative; display: block; width: 100%; aspect-ratio: 4 / 5; background: var(--bg-card-hover); overflow: hidden; }
.seed-media-preview img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; }
.seed-media-placeholder { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; letter-spacing: 0.1em; color: var(--text-muted); }
.seed-media-badge { position: absolute; top: 8px; left: 8px; z-index: 2; }
.seed-media-body { display: flex; flex-direction: column; gap: 6px; padding: 0 12px 12px; min-width: 0; }
.seed-media-body .discover-caption { -webkit-line-clamp: 3; line-clamp: 3; font-size: 12.5px; }
.seed-media-body .accounts-add-cancel-btn { flex: none; padding: 6px 10px; font-size: 12px; }
.discover-multiplier { font-size: 12.5px; color: var(--text-secondary); }
.discover-multiplier strong { font-size: 15px; font-weight: 800; color: var(--green); font-variant-numeric: tabular-nums; }
.seed-edit-row { display: flex; gap: 8px; align-items: center; }
.seed-edit-row .form-input { flex: 1; min-width: 0; padding: 8px 10px; font-size: 13px; }
.seed-edit-row .accounts-add-confirm-btn, .seed-edit-row .accounts-add-cancel-btn { flex: none; padding: 7px 12px; }
.seed-type { display: inline-block; margin-left: 4px; padding: 1px 8px; border-radius: var(--radius-pill); font-size: 10.5px; font-weight: 700; letter-spacing: 0.04em; color: var(--text-secondary); background: var(--bg-subtle); border: 1px solid var(--border); vertical-align: middle; }
.seed-type-professional { color: var(--green); border-color: rgba(18, 185, 129, 0.3); }
/* Conteúdos — visual library of the seed profiles' contents */
.contents-toolbar { gap: 10px; }
.contents-toolbar .filter-select { max-width: 260px; }
.contents-summary { margin: -6px 0 14px; }
.contents-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
@media (min-width: 1440px) { .contents-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 1024px) { .contents-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .contents-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; } }
.content-card { display: flex; flex-direction: column; min-width: 0; border-radius: var(--radius-lg); overflow: hidden; background: var(--bg-card); border: 1px solid var(--border); transition: border-color 0.15s ease, box-shadow 0.15s ease; }
.content-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-hover); }
.content-card.is-rejected { opacity: 0.72; }
.content-media { position: relative; display: block; width: 100%; aspect-ratio: 4 / 5; overflow: hidden; background: var(--bg-subtle); cursor: pointer; border: 0; padding: 0; }
.content-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; }
.content-media-fallback { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; letter-spacing: 0.12em; color: var(--text-muted); }
/* Only without a cover (none stored, expired, or the image failed) — never
   behind an image that is still loading. */
.content-media:not(.is-broken) .content-media-fallback { display: none; }
.content-media.is-broken .content-media-fallback { font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: none; }
/* Below the centre, clear of a Reel's play button. */
.content-media.is-broken .content-media-fallback { align-items: flex-end; padding-bottom: 28%; }
.content-media-badge { position: absolute; top: 10px; left: 10px; z-index: 2; background: rgba(10, 16, 30, 0.72); backdrop-filter: blur(4px); }
.content-media-icon { position: absolute; z-index: 2; display: inline-flex; align-items: center; justify-content: center; color: var(--white); }
.content-media-play { top: 50%; left: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%; background: rgba(10, 16, 30, 0.45); backdrop-filter: blur(3px); opacity: 0.9; }
.content-media-multi { top: 10px; right: 10px; width: 30px; height: 30px; border-radius: 8px; background: rgba(10, 16, 30, 0.55); }
.content-media:hover .content-media-play { opacity: 1; background: rgba(10, 16, 30, 0.62); }
.content-media:focus-visible { outline: 2px solid var(--blue-light); outline-offset: -2px; }
.content-body { display: flex; flex-direction: column; gap: 7px; padding: 14px 16px 16px; min-width: 0; flex: 1; }
.content-origin { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.content-origin-label { font-size: 10px; font-weight: 700; letter-spacing: 0.1em; color: var(--text-muted); }
.content-username { font-size: 14px; font-weight: 700; color: var(--text-primary); overflow-wrap: anywhere; }
.content-perf { font-size: 12.5px; color: var(--text-secondary); }
.content-perf strong { font-size: 20px; font-weight: 800; letter-spacing: -0.01em; color: var(--text-primary); font-variant-numeric: tabular-nums; margin-right: 2px; }
.content-perf-none { font-size: 12px; color: var(--text-muted); }
.content-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 11.5px; font-weight: 600; letter-spacing: 0.02em; color: var(--text-muted); }
.content-score { font-weight: 600; color: var(--text-muted); }
.content-stats { font-size: 12px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.content-caption { margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--text-secondary); overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; }
.content-rejected { font-size: 11.5px; color: var(--yellow); }
.content-actions { margin-top: auto; padding-top: 6px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.content-actions .accounts-add-confirm-btn, .content-actions .accounts-add-cancel-btn { flex: none; padding: 8px 12px; min-height: 36px; }
.content-link-btn { font-size: 12px; font-weight: 600; color: var(--text-muted); text-decoration: underline; text-underline-offset: 2px; padding: 6px 2px; background: none; border: 0; cursor: pointer; }
.content-link-btn:hover { color: var(--text-primary); }
.content-saved { font-size: 12.5px; }
.content-skeleton { min-height: 420px; }
.content-skeleton > span:not(.content-media) { display: block; height: 12px; margin: 12px 16px 0; border-radius: 6px; background: var(--bg-subtle); }
.seeds-related { margin-top: 22px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-card); }
.seeds-related > summary { cursor: pointer; padding: 14px 18px; font-size: 13px; font-weight: 700; color: var(--text-secondary); list-style: revert; }
.seeds-related-body { display: flex; flex-direction: column; gap: 0; padding: 0 16px 16px; }
.seeds-related-body > .accounts-add-cancel-btn { align-self: flex-start; flex: none; padding: 8px 14px; }
.reference-embed-fallback { gap: 14px; padding: 8px 0; }
.reference-embed-preview { width: 100%; max-width: 420px; max-height: 70vh; object-fit: contain; border-radius: var(--radius-sm); background: var(--bg-subtle); }
.reference-embed-caption { max-width: 560px; margin: 0; font-size: 13.5px; line-height: 1.6; color: var(--text-secondary); white-space: pre-wrap; text-align: left; overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .contents-toolbar .filter-select { flex: 1 1 45%; max-width: none; }
  .content-actions .accounts-add-confirm-btn { flex: 1 1 auto; }
}
.reference-embed { display: flex; justify-content: center; }
.reference-embed-frame { width: 100%; max-width: 480px; height: min(78vh, 760px); border: 0; border-radius: var(--radius-sm); background: var(--white); }
.reference-embed-head-actions { display: flex; align-items: center; gap: 8px; }
.reference-embed-head-actions .accounts-add-cancel-btn { flex: none; padding: 7px 12px; }
@media (max-width: 640px) {
  .references-toolbar-actions { width: 100%; margin-left: 0; }
  .references-toolbar-actions > button { flex: 1 1 auto; }
  .discover-panel { padding: 16px; }
  .discover-form-grid { grid-template-columns: minmax(0, 1fr); }
  .discover-results-tools { width: 100%; }
}
@media (max-width: 640px) {
  .reference-card { padding: 18px; min-height: 0; }
  .reference-title { font-size: 16.5px; }
  .reference-perf strong { font-size: 20px; }
  .references-add-btn { margin-left: 0; width: 100%; }
  .references-toolbar .filter-select { flex: 1 1 45%; max-width: none; }
  #references-modal.modal-overlay { padding: 8px; }
  .modal.references-modal { max-height: 96vh; }
  .reference-detail, .reference-form { padding: 16px; }
  .reference-form-grid { grid-template-columns: minmax(0, 1fr); }
  .reference-import-row { flex-direction: column; align-items: stretch; }
}

/* Converter em relatório (dashboard opened from Dashboard de Clientes) */
.client-report-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 4px 0 14px; }
.client-report-controls.hidden { display: none; }
.client-report-btn { flex: none; padding: 9px 16px; min-height: 40px; }
.client-report-status { font-size: 12.5px; color: var(--text-secondary); overflow-wrap: anywhere; }
.client-report-status.is-ok { color: var(--green); font-weight: 600; }
.client-report-status.is-error { color: var(--yellow); }
.generated-report { flex-wrap: wrap; }
.generated-report .client-item-main { min-width: 0; flex: 1 1 240px; }
.generated-report-actions { display: flex; gap: 8px; flex: none; }
.generated-report-actions .client-item-btn { min-height: 34px; }
@media (max-width: 640px) {
  .client-report-controls > * { flex: 1 1 auto; }
  .generated-report-actions { width: 100%; }
  .generated-report-actions .client-item-btn { flex: 1 1 0; text-align: center; }
}

button.client-item-btn { background: none; font-family: inherit; cursor: pointer; }

/* ── Área do cliente (Relatórios | Dashboards) + compartilhamento ───── */
.client-space { min-width: 0; }
.client-space-head { display: flex; flex-direction: column; gap: 14px; margin-bottom: 4px; }
.client-space-back { align-self: flex-start; }
.client-space-title { display: flex; align-items: center; gap: 14px; min-width: 0; }
.client-space-name-wrap { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.client-space-name { font-size: 20px; font-weight: 700; color: var(--text-primary); overflow-wrap: anywhere; line-height: 1.25; }
.client-card-reports { color: var(--text-secondary); font-weight: 600; font-size: 12px; }
button.client-item-btn { background: none; font-family: inherit; cursor: pointer; }
button.client-item-btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.client-item-btn-primary { background: var(--blue) !important; border-color: var(--blue) !important; color: var(--white) !important; }
.client-item-btn-primary:hover { background: var(--blue-hover) !important; }
.client-item-btn-danger { color: var(--red) !important; border-color: rgba(239, 68, 68, 0.45) !important; }
.client-block-count { font-size: 12px; color: var(--text-muted); margin-left: auto; }
.client-report-list { display: flex; flex-direction: column; }
a.client-report-item { color: inherit; text-decoration: none; border-radius: var(--radius-sm); transition: background var(--transition); }
a.client-report-item:hover { background: rgba(184, 196, 218, 0.03); }
a.client-report-item:focus-visible { outline: 2px solid var(--blue-light); outline-offset: 2px; }
.client-report-list > .client-item:last-child { border-bottom: 0; }
/* T-210: Admin row — the report link + "Excluir" (inline confirmation below). */
.client-report-row { flex-wrap: wrap; }
.client-report-link { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex: 1 1 auto; min-width: 0; align-self: stretch; }
.client-report-confirm { flex: 1 1 100%; }
.client-report-confirm .client-share-error { flex: 1 1 100%; margin: 0; }
.client-item-channels { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.client-item-open { flex: none; color: var(--text-muted); font-size: 14px; }
.client-dash-item { flex-direction: column; align-items: stretch; gap: 10px; border-bottom: 0 !important; }
button.client-dash-open { background: none; border: 0; padding: 0; text-align: left; font: inherit; color: inherit; cursor: pointer; }
button.client-dash-open:hover .client-item-name { color: var(--blue-light); }
.client-dash-period { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--text-muted); }
.client-dash-period select {
  background: var(--bg-elevated, var(--bg-elevated)); color: var(--text-primary); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 6px 8px; font: inherit; font-size: 12px;
}
.client-dash-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.client-share { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-md); background: rgba(184, 196, 218, 0.02); min-width: 0; }
.client-share-label { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
.client-share-url {
  width: 100%; min-width: 0; padding: 8px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--bg-secondary); color: var(--text-primary); font-family: 'SF Mono', 'Fira Code', monospace; font-size: 12px;
}
.client-share-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.client-share-note { font-size: 12px; color: var(--text-secondary); }
.client-share-confirm { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12px; color: var(--orange); }
.client-share-error { font-size: 12px; color: var(--red); }
@media (max-width: 1024px) { .client-space-blocks { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) {
  .client-space-name { font-size: 18px; }
  .client-dash-actions > *, .client-share-actions > * { flex: 1 1 auto; text-align: center; }
}

/* ── Dashboard compartilhado (/d/:id): the client detail, read-only ─── */
body.public-dashboard .sidebar,
body.public-dashboard .mobile-menu-btn,
body.public-dashboard #logout-btn,
body.public-dashboard .accounts-panel-back-btn,
body.public-dashboard .google-account-back,
body.public-dashboard [data-google-action="back"],
body.public-dashboard .client-report-controls,
body.public-dashboard .accounts-panel-name-edit,
body.public-dashboard .topbar-right { display: none !important; }
body.public-dashboard .main-content { margin-left: 0 !important; width: 100%; }
.public-dashboard-error { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; background: var(--bg-primary, var(--bg-primary)); }
.public-dashboard-error-card { max-width: 420px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--text-secondary); }
.public-dashboard-error-card img { border-radius: 12px; }
.public-dashboard-error-card h1 { font-size: 20px; color: var(--text-primary); }

/* ── "LINK DE COMPARTILHAMENTO" — inside the client's dashboard only ─── */
.client-share-block { margin: 4px 0 12px; max-width: 560px; }
.client-share-block.hidden { display: none; }
.dash-share {
  display: flex; align-items: center; gap: 12px; min-width: 0;
  padding: 10px 12px; border-radius: var(--radius-md);
  background: rgba(184, 196, 218, 0.045); border: 1px solid var(--border-strong);
}
.dash-share-icon {
  flex: none; width: 36px; height: 36px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(47, 125, 215, 0.14); color: var(--blue-light);
}
.dash-share-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.dash-share-label {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted);
}
.dash-share-feedback { text-transform: none; letter-spacing: 0; font-size: 11px; font-weight: 600; color: var(--green); }
.dash-share-feedback.is-error { color: var(--orange); }
.dash-share-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.dash-share-url {
  flex: 1; min-width: 0; padding: 6px 8px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-secondary); color: var(--text-primary);
  font-family: 'SF Mono', 'Fira Code', monospace; font-size: 12px; text-overflow: ellipsis;
}
.dash-share-placeholder { flex: 1; min-width: 0; font-size: 12px; color: var(--text-secondary); padding: 6px 0; overflow-wrap: anywhere; }
.dash-share-placeholder.is-error { color: var(--orange); }
.dash-share-copy, .dash-share-retry {
  flex: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; min-width: 32px; padding: 0 8px; border-radius: var(--radius-sm); cursor: pointer;
  border: 1px solid var(--border); background: rgba(184, 196, 218, 0.04); color: var(--text-secondary); font: inherit; font-size: 12px;
  transition: var(--transition-ui);
}
.dash-share-copy:hover, .dash-share-retry:hover { color: var(--text-primary); border-color: rgba(184, 196, 218, 0.22); }
.dash-share-copy:focus-visible, .dash-share-retry:focus-visible { outline: 2px solid var(--blue-light); outline-offset: 2px; }
.dash-share-copy.is-copied { color: var(--green); border-color: rgba(18, 185, 129, 0.45); background: rgba(18, 185, 129, 0.1); }
body.public-dashboard .client-share-block { display: none !important; }
@media (max-width: 640px) { .client-share-block { max-width: none; } }

/* ── Shared dashboard (/d/:id) header: ONE header, with the client's logo ── */
.detail-title-group { display: flex; align-items: center; gap: 12px; min-width: 0; }
.detail-title-group > div { min-width: 0; }
.public-client-logo-slot.hidden { display: none; }
.public-client-logo-slot { flex: none; display: inline-flex; }
.client-avatar.public-client-logo { width: 46px; height: 46px; font-size: 15px; border-radius: 50%; overflow: hidden; position: relative; }
.client-avatar.public-client-logo .home-account-avatar-img { width: 100%; height: 100%; object-fit: cover; }
/* The topbar repeated the client's name ("Dashboard compartilhado"): gone. */
/* T-260: hidden on screen but kept for screen readers — its title is the
   page's H1 (the client's name). */
body.public-dashboard .topbar {
  position: absolute !important; width: 1px; height: 1px; min-height: 0; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
body.public-dashboard .accounts-panel-detail-name { overflow-wrap: anywhere; }

/* ── "Top 3 criativos que mais convertem" (Insights de performance) ──── */
.account-insight-top { list-style: none; margin: 2px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.account-insight-top li { min-width: 0; }
.account-insight-top-item { display: flex; align-items: center; gap: 10px; width: 100%; min-width: 0; text-align: left; background: none; border: 0; padding: 0; font: inherit; color: inherit; }
.account-insight-rank { flex: none; width: 22px; font-size: 11px; font-weight: 700; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.account-insight-thumb.account-insight-top-thumb { width: 36px; height: 36px; flex: none; }
.account-insight-top-name { font-size: 13px; min-width: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-insight-top-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.account-insight-top-stats { font-size: 12px; color: var(--text-secondary); }
.ad-detail-top-sum { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 6px; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.ad-detail-top-parts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--text-secondary); }
.ad-detail-top-parts li { display: flex; justify-content: space-between; gap: 12px; }
.ad-detail-top-part-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Shared dashboard: the same Top 3 as side-by-side cards (the shared
   report's layout) — thumb 4:5 on top, rank badge on it, name below. One
   column per creative, up to 230px each (thumb ≤ ~208x260, well within
   Meta's ~512x640 preview), centred as one group with a clear 32px gap
   between the pieces; 1 or 2 creatives keep the same size.
   Phones: one per row, thumb beside the name. */
.account-insight-card.account-insight-card-bare { border: 0; padding: 0; background: none; }
.account-insight-top.account-insight-top-cards { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 230px); justify-content: center; gap: 32px; margin: 0; }
/* /d/: Melhores criativos at the start of the block (the same ≤230px cards)
   and the 3 best Google keywords filling the rest of the row, as tall as the
   creatives. Stacked (creatives on top) on narrow screens. */
.shared-insights-split { display: flex; align-items: stretch; gap: 32px; }
.shared-insights-split > .account-insight-card-bare { flex: 0 1 auto; min-width: 0; }
.shared-insights-split .account-insight-top.account-insight-top-cards { justify-content: start; }
.shared-keywords-card { flex: 1 1 320px; min-width: 300px; gap: 14px; padding: 20px; }
.shared-keywords-card .account-insight-title { font-size: 12px; }
.shared-keywords-loading { margin: 0; font-size: 14px; color: var(--text-muted); }
.shared-keywords-list { flex: 1; justify-content: space-evenly; padding: 0; }
.shared-keyword-sub { margin: -2px 0 8px; font-size: 12px; color: var(--text-muted); }
@media (max-width: 1400px) {
  .shared-keywords-card { padding: 16px; gap: 10px; }
  .shared-keywords-card .account-insight-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
@media (max-width: 1000px) {
  .shared-insights-split { flex-direction: column; gap: 20px; }
  .shared-keywords-card { flex: none; min-width: 0; }
  .shared-keywords-card .account-insight-title { white-space: normal; }
}
.account-insight-top-cards .account-insight-top-item {
  position: relative; flex-direction: column; align-items: stretch; gap: 10px; height: 100%; padding: 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: rgba(184, 196, 218, 0.02);
}
.account-insight-top-cards .account-insight-ad:hover { border-color: var(--blue-light); }
.account-insight-top-cards .account-insight-rank {
  position: absolute; top: 16px; left: 16px; z-index: 1; width: auto; padding: 3px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 800; color: var(--text-primary); background: rgba(10, 16, 30, 0.78);
}
.account-insight-top-cards .account-insight-thumb.account-insight-top-thumb { width: 100%; height: auto; aspect-ratio: 4 / 5; border-radius: 6px; }
.account-insight-top-cards .account-insight-top-text { flex: none; }
.account-insight-top-cards .account-insight-top-name {
  flex: none; font-size: 14px; font-weight: 600; line-height: 1.35; white-space: normal; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
@media (max-width: 640px) {
  .account-insight-top.account-insight-top-cards { grid-auto-flow: row; grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .account-insight-top-cards .account-insight-top-item { flex-direction: row; align-items: center; gap: 12px; }
  .account-insight-top-cards .account-insight-thumb.account-insight-top-thumb { width: 88px; flex: none; }
  .account-insight-top-cards .account-insight-top-text { flex: 1; min-width: 0; }
  .account-insight-top-cards .account-insight-rank { top: 14px; left: 14px; }
}
.public-dashboard-error-link {
  margin-top: 6px; display: inline-flex; align-items: center; justify-content: center; padding: 10px 16px;
  border-radius: var(--radius-sm); background: var(--blue); color: var(--white); font-weight: 600; font-size: 13px; text-decoration: none;
}
.public-dashboard-error-link:hover { background: var(--blue-hover); }

/* ── Referências: niche, "Perfis semelhantes", read-only for the team ── */
.refs-readonly .ref-admin-only { display: none !important; }
.references-niche-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.references-niche-label { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
.references-niche-select { min-width: 220px; }
.similar-head { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.similar-title { font-size: 15px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-primary); overflow-wrap: anywhere; }
.similar-seed { display: flex; align-items: center; gap: 10px; min-width: 0; }
.similar-note { color: var(--text-secondary); }
.similar-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-bottom: 12px; }
.similar-toolbar .form-input { max-width: 260px; }
.similar-grid { margin-bottom: 14px; }
.similar-card { gap: 8px; }
.similar-card-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.similar-card-head .seed-card-id { flex: 1; min-width: 0; }
.similar-name { font-weight: 700; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.similar-bio { font-size: 12px; color: var(--text-secondary); line-height: 1.45; overflow-wrap: anywhere; }
.similar-themes { display: flex; flex-wrap: wrap; gap: 4px; }
.similar-theme { font-size: 11px; padding: 2px 8px; border-radius: var(--radius-pill); border: 1px solid var(--border); color: var(--text-secondary); background: rgba(184, 196, 218, 0.03); }
.similar-identify { display: flex; flex-direction: column; gap: 10px; padding: 16px; }
.similar-identify-item { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 0; border-top: 1px solid var(--border); }
.similar-identify-item .seed-card-id { flex: 1; min-width: 200px; }
.similar-signature { display: flex; flex-direction: column; gap: 6px; }
.similar-signature-label { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
.similar-bulk { flex: 1 1 320px; min-height: 44px; max-width: 640px; resize: vertical; font-family: inherit; }
.similar-reference strong { color: var(--text-primary); }
/* "Adicionar perfis para análise" (Admin, Perfis de referência) */
.assisted-panel { display: flex; flex-direction: column; gap: 10px; padding: 16px; margin-top: 22px; }
.assisted-input { width: 100%; max-width: 640px; min-height: 96px; resize: vertical; font-family: inherit; }
.assisted-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.assisted-actions .accounts-add-confirm-btn { flex: none; padding: 8px 16px; }
.assisted-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 8px; margin: 0; }
.assisted-summary > div { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; }
.assisted-summary dt { font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted); }
.assisted-summary dd { margin: 0; font-size: 18px; font-weight: 800; color: var(--text-primary); }
.assisted-notes { display: flex; flex-direction: column; gap: 4px; margin: 0; padding-left: 18px; font-size: 12.5px; color: var(--text-secondary); overflow-wrap: anywhere; }
.assisted-notes strong { color: var(--text-primary); }

/* ─── Publicar Anúncio (Admin) ─────────────────────────────────────────── */
.qp-root { display: flex; flex-direction: column; gap: 16px; }
.qp-root > .section-card { margin-bottom: 0; }
.qp-template-body, .qp-review-body { display: flex; gap: 16px; padding: 4px 20px 12px; align-items: flex-start; }
.qp-rows { display: flex; flex-direction: column; gap: 8px; flex: 1 1 auto; min-width: 0; padding: 0 20px 12px; }
.qp-template-body .qp-rows, .qp-review-body .qp-rows { padding: 0; }
.qp-row { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 12px; font-size: 13px; }
.qp-label { color: var(--text-muted); font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; padding-top: 2px; }
.qp-value { color: var(--text-primary); overflow-wrap: anywhere; }
.qp-thumb { width: 72px; height: 72px; border-radius: var(--radius-sm); object-fit: cover; flex: none; background: rgba(184, 196, 218, 0.05); }
.qp-thumb-empty { display: inline-block; }
.qp-chooser .form-group, .qp-form .form-group { padding: 0 20px; }
.qp-chooser > .gfin-note, .qp-template > .gfin-note { padding: 0 20px 14px; }
.qp-ads { display: flex; flex-direction: column; gap: 8px; padding: 0 20px 20px; max-height: 480px; overflow-y: auto; }
.qp-ad { display: flex; align-items: center; gap: 12px; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.qp-ad-info { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; min-width: 0; font-size: 12px; color: var(--text-muted); overflow-wrap: anywhere; }
.qp-ad-info strong { color: var(--text-primary); font-size: 13px; }
.qp-ad .accounts-add-confirm-btn { width: auto; flex: none; padding: 8px 14px; font-size: 12px; }
.qp-static { font-size: 14px; color: var(--text-primary); }
.qp-hint { font-size: 11px; color: var(--text-muted); font-weight: 400; }
.qp-drop { display: flex; align-items: center; justify-content: center; min-height: 84px; padding: 16px; border: 1px dashed var(--border); border-radius: var(--radius-sm); color: var(--text-muted); font-size: 13px; text-align: center; cursor: pointer; overflow-wrap: anywhere; }
.qp-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.qp-caption { min-height: 140px; resize: vertical; font-family: inherit; white-space: pre-wrap; }
.qp-caption-view { white-space: pre-wrap; }
.qp-primary { margin: 4px 20px 20px; width: auto; align-self: flex-start; padding: 10px 20px; }
.qp-error { color: var(--red); font-size: 13px; padding: 0 20px 12px; margin: 0; }
.qp-media-wrap { flex: 0 0 260px; }
.qp-media { width: 100%; max-height: 360px; border-radius: var(--radius-sm); background: #000; object-fit: contain; }
.qp-actions { display: flex; flex-wrap: wrap; gap: 10px; padding: 0 20px 20px; }
.qp-actions .accounts-add-confirm-btn { width: auto; text-decoration: none; }
@media (max-width: 760px) {
  .qp-template-body, .qp-review-body { flex-direction: column; }
  .qp-media-wrap { flex-basis: auto; width: 100%; }
  .qp-row { grid-template-columns: minmax(0, 1fr); gap: 2px; }
}
.qp-header-actions { display: inline-flex; gap: 14px; flex-wrap: wrap; }
.qp-publish-in { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 18px; margin: 0 20px 12px; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: rgba(184, 196, 218, 0.02); font-size: 13px; color: var(--text-primary); }
.qp-publish-in > .qp-label { flex-basis: 100%; }
.qp-selects { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 12px; padding: 0 20px; }
.qp-selects .form-group { padding: 0; }
.qp-chooser > .qp-hint { display: block; padding: 0 20px 12px; }
.qp-link { background: none; border: 0; padding: 0; color: var(--purple); font: inherit; cursor: pointer; text-decoration: underline; }
.qp-structure { margin: 4px 20px 12px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); display: flex; flex-direction: column; gap: 8px; }
.qp-subtitle { margin: 0 0 4px; font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-secondary); }
.qp-variations { font-size: 12px; color: var(--text-secondary); display: flex; flex-direction: column; gap: 4px; }
.qp-variations ul { margin: 0 0 4px 18px; padding: 0; }
.qp-ok { color: var(--green); font-size: 13px; margin: 0; }
.qp-structure .qp-error, .qp-structure .qp-hint { padding: 0; }
.qp-discreet { font-size: 12px; }
.qp-form .form-group > .qp-hint { display: block; margin-top: 4px; }
@media (max-width: 760px) {
  .qp-selects { grid-template-columns: minmax(0, 1fr); }
}
.qp-subtitle-gap { margin-top: 10px; }
.qp-ready { padding: 0 20px 10px; margin: 0; }
.qp-inline { padding: 0; display: inline; }
.qp-account-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 18px; padding: 16px 20px; }
.qp-account-bar .form-group { padding: 0; margin: 0; flex: 1 1 260px; max-width: 420px; }
.qp-account-bar .see-all-btn { margin-bottom: 10px; }

/* Campanhas por IA → botão + pop-up (T-166; engine T-165): bottom-left of
   the content area (beside the sidebar, open or closed), Admin only. */
.aic-fab { position: fixed; left: calc(var(--sidebar-w) + 20px); bottom: 20px; z-index: 900; display: grid; place-items: center; width: 52px; height: 52px; border: 1px solid var(--blue); border-radius: 50%; background: var(--blue); color: var(--white); box-shadow: 0 8px 24px -8px var(--cta-glow); cursor: pointer; transition: transform .15s ease, background-color .15s, left var(--transition); }
.aic-fab:hover { background: var(--blue-hover); transform: scale(1.05); }
.aic-fab:active { transform: scale(.95); }
.aic-fab:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 3px; }
.aic-fab[aria-expanded="true"] { background: var(--bg-elevated); border-color: var(--border-strong); color: var(--text-primary); }
.sidebar.collapsed ~ .aic-fab { left: calc(68px + 20px); }
.aic-popup-wrap { position: fixed; left: calc(var(--sidebar-w) + 20px); bottom: 84px; z-index: 901; width: min(560px, calc(100vw - var(--sidebar-w) - 40px)); transition: left var(--transition); }
.sidebar.collapsed ~ .aic-popup-wrap { left: calc(68px + 20px); width: min(560px, calc(100vw - 108px)); }
.aic-popup { display: flex; flex-direction: column; max-height: calc(100vh - 110px); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); background: var(--bg-card); box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.7); overflow: hidden; }
.aic-popup-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px 12px 20px; border-bottom: 1px solid var(--border); }
.aic-popup-title { margin: 0; font-size: 16px; font-weight: 700; color: var(--text-primary); }
.aic-popup-body { display: flex; flex-direction: column; gap: 10px; padding: 14px 20px 18px; overflow-y: auto; }
.aic-popup-body .form-label { margin: 4px 0 0; }
.aic-popup-tabs { display: flex; gap: 4px; margin-bottom: 4px; border-bottom: 1px solid var(--border); }
.aic-popup-tab { margin-bottom: -1px; padding: 6px 4px 10px; margin-right: 14px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--text-muted); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.aic-popup-tab:hover { color: var(--text-primary); }
.aic-popup-tab.is-on { color: var(--text-primary); border-bottom-color: var(--blue); }
.aic-popup-tab:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }
.aic-types { display: flex; flex-wrap: wrap; gap: 8px; }
.aic-type { position: relative; display: inline-flex; align-items: center; padding: 8px 16px; border: 1px solid var(--border-strong); border-radius: var(--radius-pill); color: var(--text-secondary); font-size: 13px; font-weight: 600; cursor: pointer; transition: border-color .15s, background-color .15s, color .15s; }
.aic-type input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.aic-type:hover { border-color: var(--text-muted); color: var(--text-primary); }
.aic-type.is-on { background: var(--blue-soft); border-color: var(--blue); color: var(--text-primary); }
.aic-type:focus-within { outline: 2px solid var(--border-focus); outline-offset: 2px; }
.aic-popup-text { min-height: 120px; resize: vertical; }
.aic-popup-text.is-short { min-height: 72px; }
/* T-174: "Nova campanha | Adicionar a campanha existente" as a segmented switch */
.aic-modes { display: flex; flex-wrap: wrap; padding: 3px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--bg-input); }
.aic-mode { position: relative; flex: 1; display: flex; align-items: center; justify-content: center; padding: 7px 10px; border-radius: 7px; color: var(--text-secondary); font-size: 13px; font-weight: 600; text-align: center; cursor: pointer; transition: background-color .15s, color .15s; }
.aic-mode input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.aic-mode:hover { color: var(--text-primary); }
.aic-mode.is-on { background: var(--blue-soft); color: var(--text-primary); box-shadow: inset 0 0 0 1px var(--blue); }
.aic-mode:focus-within { outline: 2px solid var(--border-focus); outline-offset: 2px; }
/* the campaign / ad set to choose in "Falta informação" */
.aic-picks { display: flex; flex-direction: column; gap: 6px; }
.aic-pick { position: relative; display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; transition: border-color .15s, background-color .15s; }
.aic-pick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.aic-pick::before { content: ''; flex: none; width: 14px; height: 14px; border: 1.5px solid var(--border-strong); border-radius: 50%; }
.aic-pick:hover { border-color: var(--border-strong); background: var(--bg-subtle); }
.aic-pick.is-on { border-color: var(--blue); background: var(--blue-soft); }
.aic-pick.is-on::before { border-color: var(--blue); background: var(--blue); box-shadow: inset 0 0 0 3px var(--bg-card); }
.aic-pick.is-multi::before { border-radius: 4px; }
.aic-pick-all { align-self: flex-start; }
.aic-reuse { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.aic-reuse .qp-error { flex-basis: 100%; }
.aic-reuse.is-on { flex-direction: column; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--blue); border-radius: var(--radius-sm); background: var(--blue-soft); }
.aic-reuse-title { margin: 0; font-size: 13px; color: var(--text-primary); overflow-wrap: anywhere; }
/* T-191: the list of recent requests to reuse */
.aic-reuse-list { list-style: none; margin: 4px 0; padding: 0; display: flex; flex-direction: column; gap: 6px; width: 100%; max-height: 260px; overflow-y: auto; }
.aic-reuse-item { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; width: 100%; padding: 8px 10px; text-align: left; font: inherit; font-size: 13px; color: var(--text-primary); background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; }
.aic-reuse-item:hover:not(:disabled), .aic-reuse-item:focus-visible { border-color: var(--blue); }
.aic-reuse-item:disabled { cursor: default; opacity: .6; }
.aic-reuse-when { font-weight: 600; white-space: nowrap; }
.aic-reuse-campaign { overflow-wrap: anywhere; }
/* T-193: existing Instagram posts as ads */
.aic-ig { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border: 1px solid var(--blue); border-radius: var(--radius-sm); background: var(--blue-soft); }
.aic-ig-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 10px; }
.aic-ig-head-actions { display: flex; gap: 10px; }
.aic-ig-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow-y: auto; }
.aic-ig-post { display: flex; align-items: flex-start; gap: 8px; padding: 8px 10px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.aic-ig-post.is-on { border-color: var(--blue); }
.aic-ig-post.is-off { opacity: .65; }
.aic-ig-post-label { display: flex; align-items: flex-start; gap: 10px; flex: 1; min-width: 0; cursor: pointer; }
.aic-ig-post.is-off .aic-ig-post-label { cursor: default; }
.aic-ig-post-label input { margin-top: 4px; flex: none; }
.aic-ig-thumb { position: relative; flex: none; width: 56px; height: 56px; border-radius: 6px; overflow: hidden; background: var(--bg-subtle); border: 1px solid var(--border); }
.aic-ig-thumb-ph { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 10px; color: var(--text-muted); text-align: center; }
.aic-ig-thumb-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.aic-ig-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 13px; color: var(--text-primary); }
.aic-ig-caption { color: var(--text-secondary); font-size: 12px; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.aic-ig-elig { font-size: 12px; }
.aic-ig-elig.is-ok { color: var(--green); }
.aic-ig-elig.is-unknown { color: var(--orange); }
.aic-ig-elig.is-no, .aic-ig-elig.is-used { color: var(--text-muted); }
.aic-ig-open { flex: none; font-size: 12px; color: var(--blue-light); }
.aic-ig-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; }
.aic-fill-ig { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left; }
.aic-fill-ig > .aic-ig { align-self: stretch; }
.aic-fill-title.aic-fill-ig-add { display: grid; text-align: left; grid-template-columns: 1fr auto; align-items: center; gap: 4px 10px; align-self: stretch; }
.aic-fill-title.aic-fill-ig-add > .qp-hint { grid-column: 1 / -1; }
.aic-texts-where { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; }
.aic-pick.is-drop .aic-pick-main strong { font-weight: 600; color: var(--text-secondary); }
.aic-pick:focus-within { outline: 2px solid var(--border-focus); outline-offset: 2px; }
.aic-pick-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 13px; color: var(--text-primary); overflow-wrap: anywhere; }
/* the result of adding: the new ads by ad set */
.aic-add-adset { display: flex; flex-direction: column; gap: 6px; }
.aic-add-adset-head { margin: 0; font-size: 13px; color: var(--text-primary); overflow-wrap: anywhere; }
.aic-skipped .form-label { margin: 0 0 4px; }
/* T-176: "Adicionar Textos e Títulos" — the confirmation and the result */
.aic-pick.is-multi::before { border-radius: 4px; }
.aic-pick.is-multi.is-on::before { box-shadow: inset 0 0 0 3px var(--bg-card); }
.aic-confirm { display: flex; flex-direction: column; gap: 10px; }
.aic-confirm-item { display: flex; flex-direction: column; gap: 6px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-subtle); }
.aic-confirm-item .qp-rows { padding: 0; }
.aic-confirm-item .form-label { margin: 4px 0 0; }
.aic-num-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.aic-num-list li { display: flex; align-items: baseline; gap: 8px; font-size: 13px; color: var(--text-primary); overflow-wrap: anywhere; }
.aic-num { flex: none; min-width: 18px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.aic-num-text { flex: 1; min-width: 0; white-space: pre-wrap; }
.aic-new-tag { flex: none; padding: 1px 8px; border-radius: var(--radius-pill); background: var(--blue-soft); color: var(--blue-light); font-size: 11px; font-weight: 700; }
.aic-confirm-out { display: flex; flex-direction: column; gap: 2px; }
.aic-plain-list { margin: 0 0 0 18px; padding: 0; color: var(--text-secondary); font-size: 12px; overflow-wrap: anywhere; }
.aic-notice { margin: 0; padding: 8px 12px 8px 30px; border: 1px solid rgba(245, 158, 11, 0.45); border-radius: var(--radius-sm); background: var(--orange-glow); color: var(--text-primary); font-size: 12px; }
.aic-confirm-actions { justify-content: flex-end; }
.aic-confirm-actions .accounts-add-confirm-btn { flex: none; width: auto; padding: 10px 22px; }
.aic-meta-error { list-style: none; margin: 8px 0 0; padding: 8px 0 0; border-top: 1px solid rgba(239, 68, 68, 0.35); display: flex; flex-direction: column; gap: 2px; font-size: 12px; }
.aic-history-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.aic-skipped + .aic-warnings { margin-top: 4px; color: var(--text-secondary); }
.aic-popup-attach { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.aic-popup-clip { position: relative; cursor: pointer; }
.aic-popup-clip input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.aic-popup-clip:focus-within { outline: 2px solid var(--border-focus); outline-offset: 2px; }
.aic-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.aic-chip { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 6px 6px 6px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; color: var(--text-primary); }
.aic-chip.has-error { border-color: rgba(239, 68, 68, 0.45); }
.aic-chip-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.aic-chip .aic-creative-error { flex-basis: 100%; }
.aic-chip-note { flex-basis: 100%; font-size: 12px; overflow-wrap: anywhere; }
.aic-chip-warn { color: var(--orange); }
.aic-creative-error { color: var(--red); font-size: 12px; }
.aic-chip-x { display: grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 6px; background: transparent; color: var(--text-muted); font-size: 18px; cursor: pointer; }
.aic-chip-x:hover:not(:disabled) { color: var(--text-primary); background: var(--bg-subtle); }
.aic-popup-error { padding: 10px 12px; border: 1px solid rgba(239, 68, 68, 0.5); border-radius: var(--radius-sm); background: var(--red-glow); color: var(--text-primary); font-size: 13px; overflow-wrap: anywhere; }
.aic-popup-error ul { margin: 4px 0 6px 18px; padding: 0; }
.aic-popup-error .qp-hint { display: block; margin-top: 6px; }
.aic-popup-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 2px; }
.aic-result { display: flex; flex-direction: column; gap: 10px; }
.aic-result-title { margin: 4px 0 0; font-size: 15px; font-weight: 700; color: var(--text-primary); }
.aic-result .qp-rows { padding: 0; }
.aic-result .table-wrap { margin: 0; }
.aic-popup-filled { margin: 0; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-subtle); }
.aic-pad { display: block; margin: 0; }
.aic-paused { color: var(--green); font-weight: 700; font-size: 12px; letter-spacing: 0.04em; }
.aic-not-paused { color: var(--red); font-weight: 700; font-size: 12px; letter-spacing: 0.04em; }
.aic-alert { padding: 12px 14px; border: 1px solid rgba(239, 68, 68, 0.5); border-radius: var(--radius-sm); background: var(--red-glow); color: var(--text-primary); font-size: 13px; }
.aic-alert ul { margin: 6px 0 0 18px; padding: 0; }
.aic-warnings { margin: 0 0 0 18px; padding: 0; color: var(--orange); font-size: 12px; }
.aic-popup-actions-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.aic-popup-actions-row .accounts-add-confirm-btn { flex: none; width: auto; display: inline-flex; align-items: center; justify-content: center; padding: 10px 18px; text-decoration: none; }
.aic-history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.aic-history-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.aic-history-main { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; font-size: 13px; color: var(--text-primary); overflow-wrap: anywhere; }
.aic-history-status { font-size: 12px; color: var(--text-secondary); }
.aic-history-status.is-ok { color: var(--green); }
.aic-history-status.is-failed { color: var(--red); }
/* T-172: the parts going up, the Meta processing, the operation followed and the missing fields */
.aic-chip-kind { flex: none; padding: 2px 8px; border-radius: var(--radius-pill); background: var(--bg-subtle); color: var(--text-secondary); font-size: 11px; font-weight: 700; letter-spacing: 0.02em; }
.aic-chip-state { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.aic-chip-state.is-ready { color: var(--green); }
.aic-chip-state.is-failed { color: var(--red); }
.aic-chip-state.is-sending_to_meta, .aic-chip-state.is-meta_processing { color: var(--blue-light); }
.aic-chip.is-ready { border-color: rgba(18, 185, 129, 0.35); }
.aic-chip-title { flex-basis: 100%; margin-right: 6px; padding: 8px 10px; font-size: 13px; }
.aic-chip-retry { flex: none; padding: 4px 10px; font-size: 12px; }
.aic-progress { position: relative; display: block; flex-basis: 100%; height: 6px; margin-right: 6px; border-radius: var(--radius-pill); background: var(--bg-subtle); overflow: hidden; }
.aic-progress-bar { display: block; height: 100%; border-radius: inherit; background: var(--blue); transition: width .3s ease; }
.aic-progress.is-indeterminate .aic-progress-bar { width: 35%; animation: aic-progress-slide 1.4s ease-in-out infinite; }
@keyframes aic-progress-slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(290%); } }
@media (prefers-reduced-motion: reduce) { .aic-progress.is-indeterminate .aic-progress-bar { animation: none; width: 100%; opacity: .5; } }
.aic-op { display: flex; flex-direction: column; gap: 10px; }
/* T-182: "Alterar verbas" — preview and result item by item */
.aic-budgets { display: flex; flex-direction: column; gap: 10px; }
.aic-budget-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.aic-budget-item { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; color: var(--text-primary); overflow-wrap: anywhere; }
.aic-budget-item.is-big { border-color: rgba(245, 158, 11, 0.7); background: rgba(245, 158, 11, 0.06); }
.aic-budget-bigconfirm { padding: 12px; border: 1px solid rgba(245, 158, 11, 0.5); border-radius: var(--radius-sm); }
.aic-budget-item.is-failed { border-color: rgba(239, 68, 68, 0.5); }
.aic-budget-where { flex-basis: 100%; font-size: 12px; }
.aic-budget-rule { padding: 2px 8px; border-radius: var(--radius-pill); background: var(--blue-soft); color: var(--blue-light); font-size: 11px; font-weight: 700; }
.aic-budget-notes { flex-basis: 100%; margin: 0; }
.aic-budget-group { display: flex; flex-direction: column; gap: 6px; padding: 10px; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); }
.aic-budget-group-head { margin: 0; font-size: 12px; font-weight: 700; color: var(--text-secondary); overflow-wrap: anywhere; }
.aic-budget-level { flex: none; padding: 2px 8px; border-radius: var(--radius-pill); background: var(--bg-subtle); color: var(--text-secondary); font-size: 11px; font-weight: 700; }
.aic-budget-name { flex: 1; min-width: 0; font-weight: 600; }
.aic-budget-change { flex-basis: 100%; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.aic-budget-pct { font-size: 12px; font-weight: 700; color: var(--text-secondary); }
.aic-budget-warn { padding: 2px 8px; border-radius: var(--radius-pill); background: var(--orange-glow); color: var(--orange); font-size: 11px; font-weight: 700; }
.aic-budget-state { font-size: 12px; font-weight: 700; }
.aic-budget-item.is-applied .aic-budget-state { color: var(--green); }
.aic-budget-item.is-failed .aic-budget-state { color: var(--red); }
.aic-budget-item.is-pending .aic-budget-state, .aic-budget-item.is-skipped .aic-budget-state { color: var(--text-secondary); }
.aic-op-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; font-size: 14px; color: var(--text-primary); overflow-wrap: anywhere; }
.aic-op-phase { padding: 3px 10px; border-radius: var(--radius-pill); background: var(--bg-subtle); color: var(--text-secondary); font-size: 12px; font-weight: 700; }
.aic-op-phase.is-failed { background: var(--red-glow); color: var(--red); }
.aic-op-phase.is-needs_input { background: var(--orange-glow); color: var(--orange); }
.aic-op-phase.is-queued, .aic-op-phase.is-running { background: var(--blue-soft); color: var(--blue-light); }
.aic-op-wait { display: flex; flex-direction: column; gap: 8px; margin: 0; }
.aic-op-wait .aic-progress { margin: 0; }
.aic-meta-calls { margin: 0; font-size: 11px; }
.aic-fill { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); }
.aic-fill-intro { margin: 0; font-size: 13px; color: var(--text-primary); }
.aic-fill .form-label { margin: 4px 0 0; }
.aic-fill-money { max-width: 200px; }
.aic-fill-title { display: flex; flex-direction: column; gap: 4px; }
.aic-fill-adset { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.aic-fill-adset legend { padding: 0 4px; font-size: 12px; font-weight: 700; color: var(--text-secondary); }
.aic-fill-adset .see-all-btn { align-self: flex-start; }
.aic-fill-audiences { display: flex; flex-direction: column; gap: 4px; max-height: 180px; overflow-y: auto; }
.aic-fill-aud { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-primary); cursor: pointer; }
.aic-fill-aud.is-off { color: var(--text-muted); cursor: default; }
.aic-fill-aud input { appearance: none; -webkit-appearance: none; flex: none; display: grid; place-items: center; width: 16px; height: 16px; margin: 0; border: 1.5px solid var(--border-strong); border-radius: 4px; background: transparent; cursor: pointer; }
.aic-fill-aud input:checked { background: var(--blue); border-color: var(--blue); }
.aic-fill-aud input:checked::after { content: ''; width: 4px; height: 8px; margin-top: -2px; border: solid var(--white); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.aic-fill-aud input:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }
.aic-fill-aud input:disabled { opacity: .4; cursor: default; }
.aic-fill > .see-all-btn { align-self: flex-start; }
@media (min-width: 769px) {
  .sidebar.collapsed ~ .aic-fab, .sidebar.collapsed ~ .aic-popup-wrap { left: calc(var(--rail-w) + 20px); }
}
@media (max-width: 768px) {
  .aic-fab, .sidebar.collapsed ~ .aic-fab { left: 16px; bottom: 16px; }
  .aic-popup-wrap, .sidebar.collapsed ~ .aic-popup-wrap { left: 16px; right: 16px; bottom: 80px; width: auto; }
  .aic-popup { max-height: calc(100vh - 100px); }
  /* T-245: while the ✦ button shows, each screen ends with room for it
     (16px + 52px + 16px), so the last thing on it (a status, the online
     list in Cowork) can scroll out from under the button. */
  .aic-fab:not(.hidden) ~ .main-content .view,
  .aic-fab:not(.hidden) ~ .main-content .cw-lobby,
  .aic-fab:not(.hidden) ~ .main-content .cw-room { padding-bottom: 84px; }
}

/* ===========================
   DETALHE DO CLIENTE — seletor de período (dropdown/popover)
   Trigger and popover follow the panel's light theme, from the system's
   own tokens (--cp-* only alias them for this component).
=========================== */
.client-period-picker { position: relative; max-width: 100%; }
.client-period-trigger {
  display: inline-flex; align-items: center; gap: 10px; max-width: 100%; padding: 9px 14px;
  font: inherit; font-size: 13px; color: var(--text-primary); cursor: pointer;
  background: rgba(184, 196, 218, 0.04); border: 1px solid var(--border); border-radius: var(--radius-sm);
  transition: var(--transition-ui);
}
.client-period-trigger:hover, .client-period-picker.is-open .client-period-trigger { border-color: rgba(47, 125, 215,0.45); background: var(--bg-card-hover); }
.client-period-trigger:focus-visible { outline: 2px solid var(--blue-light); outline-offset: 2px; }
.client-period-icon { flex-shrink: 0; color: var(--blue-light); }
.client-period-name { font-weight: 600; white-space: nowrap; }
.client-period-dates { font-size: 12px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.client-period-vs { font-size: 12px; color: var(--text-secondary); white-space: nowrap; padding-left: 10px; border-left: 1px solid var(--border); }
.client-period-chevron { flex-shrink: 0; color: var(--text-muted); transition: transform var(--transition); }
.client-period-picker.is-open .client-period-chevron { transform: rotate(180deg); }

.client-period-popover {
  --cp-bg: var(--bg-elevated); --cp-border: var(--border); --cp-text: var(--text-primary); --cp-muted: var(--text-secondary); --cp-faint: var(--text-muted);
  --cp-blue: var(--blue); --cp-blue-dark: #BFD7F6; --cp-blue-soft: rgba(47, 125, 215, 0.22); --cp-hover: rgba(47, 125, 215, 0.12); --cp-green: #16a34a;
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 60; width: 620px; max-width: calc(100vw - 32px);
  color: var(--cp-text); background: var(--cp-bg); border: 1px solid var(--border-strong); border-radius: var(--radius-md);
  box-shadow: var(--shadow-pop); overflow: hidden;
}
.client-period-body { display: grid; grid-template-columns: 40% minmax(0, 1fr); }
.client-period-presets { display: flex; flex-direction: column; gap: 1px; padding: 16px 10px 12px; border-right: 1px solid var(--cp-border); }
.client-period-heading { padding: 0 10px 8px; font-size: 13px; font-weight: 600; color: var(--blue-light); }
.client-period-preset {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px; text-align: left; font: inherit; font-size: 13px;
  color: var(--cp-text); cursor: pointer; background: none; border: 0; border-radius: 6px; transition: background 0.15s ease;
}
.client-period-preset:hover { background: var(--cp-hover); }
.client-period-preset.active, .client-period-preset.active:hover { background: var(--cp-blue); color: var(--white); font-weight: 600; }
.client-period-preset.is-custom { color: var(--blue-light); }
.client-period-preset.is-custom.active { color: var(--white); }
.client-period-preset.is-custom svg { flex-shrink: 0; }
.client-period-range { display: flex; flex-direction: column; gap: 14px; padding: 16px; min-width: 0; }
.client-period-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.client-period-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; font-size: 11px; font-weight: 600; color: var(--cp-muted); }
.client-period-field input {
  width: 100%; min-width: 0; padding: 8px 10px; font: inherit; font-size: 13px; font-weight: 500; color: var(--cp-text);
  background: var(--bg-input); border: 1px solid var(--cp-border); border-radius: 8px; outline: none;
}
.client-period-field input:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--blue-soft); }
.client-period-field input::placeholder { color: var(--cp-faint); }

.client-cal { display: flex; flex-direction: column; gap: 8px; }
.client-cal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.client-cal-title { font-size: 14px; font-weight: 600; color: var(--cp-text); text-transform: capitalize; }
.client-cal-nav {
  width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  color: var(--cp-muted); background: none; border: 0; border-radius: 50%; transition: background 0.15s ease;
}
.client-cal-nav:hover:not(:disabled) { color: var(--cp-text); background: var(--cp-hover); }
.client-cal-nav:disabled { opacity: 0.3; cursor: not-allowed; }
.client-cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); row-gap: 2px; }
.client-cal-weekdays span { padding: 4px 0; text-align: center; font-size: 11px; font-weight: 600; color: var(--cp-muted); }
/* A day = a full-width cell (the continuous light band of the range) with
   the number in a centered circle (strong blue on the first and last day). */
.client-cal-day {
  height: 36px; display: flex; align-items: center; justify-content: center; padding: 0; font: inherit; font-size: 13px;
  color: var(--cp-text); background: none; border: 0; cursor: pointer;
}
.client-cal-num { width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; border-radius: 50%; }
.client-cal-day.is-outside { color: var(--cp-faint); opacity: 0.7; }
.client-cal-day:disabled { color: var(--cp-faint); opacity: 0.55; cursor: not-allowed; }
.client-cal-day:hover:not(:disabled):not(.is-start):not(.is-end) .client-cal-num { background: var(--cp-hover); }
.client-cal-day.is-today .client-cal-num { box-shadow: inset 0 0 0 1px var(--border-strong); }
.client-cal-day.in-range { background: var(--cp-blue-soft); color: var(--cp-blue-dark); font-weight: 500; }
.client-cal-day.in-range.is-outside { color: var(--blue-light); opacity: 1; }
.client-cal-day.in-range.is-start { background: linear-gradient(to right, transparent 50%, var(--cp-blue-soft) 50%); }
.client-cal-day.in-range.is-end { background: linear-gradient(to right, var(--cp-blue-soft) 50%, transparent 50%); }
.client-cal-day.in-range.is-start.is-end { background: none; }
.client-cal-day.is-start .client-cal-num, .client-cal-day.is-end .client-cal-num { background: var(--cp-blue); color: var(--white); font-weight: 600; box-shadow: none; }

.client-period-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--cp-border); }
.client-period-compare-wrap { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; min-width: 0; }
.client-period-compare { display: inline-flex; align-items: center; gap: 10px; font: inherit; font-size: 13px; color: var(--cp-text); cursor: pointer; background: none; border: 0; padding: 0; }
.client-period-switch { position: relative; width: 34px; height: 20px; flex-shrink: 0; border-radius: 10px; background: var(--border-strong); transition: background 0.2s ease; }
.client-period-switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--white); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); transition: transform 0.2s ease; }
.client-period-compare:disabled { opacity: 0.5; cursor: not-allowed; }
.client-period-compare[aria-checked="true"] .client-period-switch { background: var(--cp-blue); }
.client-period-compare[aria-checked="true"] .client-period-switch::after { transform: translateX(14px); }
.client-period-compare-range { font-size: 12px; color: var(--cp-muted); white-space: nowrap; }
.client-period-apply {
  flex-shrink: 0; margin-left: auto; padding: 10px 20px; font: inherit; font-size: 13px; font-weight: 700; color: var(--white); cursor: pointer;
  background: var(--cp-green); border: 0; border-radius: 10px; transition: background 0.15s ease;
}
.client-period-apply:hover:not(:disabled) { background: #15803d; }
.client-period-apply:disabled { opacity: 0.5; cursor: not-allowed; }
.client-period-error { margin: 0; font-size: 12px; color: var(--red, var(--red-soft)); }

.account-kpi-compare { display: block; margin-top: 6px; font-size: 11.5px; line-height: 1.35; color: var(--text-muted); overflow-wrap: anywhere; }
.account-kpi-delta { font-weight: 700; color: var(--text-secondary); }
.account-kpi-compare.is-good .account-kpi-delta { color: var(--green); }
.account-kpi-compare.is-bad .account-kpi-delta { color: var(--red); }

@media (max-width: 640px) {
  /* Full width on a phone. The flex-basis belongs ONLY to pickers that sit
     in a ROW (.home-header-row: Visão Geral, Métricas): the client detail's
     picker is a child of a COLUMN flex (.accounts-panel-detail-body), where
     `flex: 1 1 100%` meant "as tall as the whole detail" — a blank gap of
     thousands of pixels between the period and the KPIs, and the sections
     below squeezed and clipped. */
  .client-period-picker { width: 100%; }
  .home-header-row > .client-period-picker { flex: 1 1 100%; }
  .client-period-trigger { width: 100%; flex-wrap: wrap; row-gap: 4px; }
  .client-period-dates { flex: 1; text-align: right; }
  .client-period-vs { flex: 1 1 100%; padding-left: 26px; border-left: 0; text-align: left; }
  /* Bottom sheet: presets, De/Até, calendar, footer — one column. */
  .client-period-popover {
    position: fixed; top: auto; left: 0; right: 0; bottom: 0; width: auto; max-width: none; max-height: 90vh;
    display: flex; flex-direction: column; border-radius: 16px 16px 0 0; border-width: 1px 0 0;
    box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.7);
  }
  .client-period-body { grid-template-columns: minmax(0, 1fr); overflow-y: auto; }
  .client-period-presets { flex-direction: row; flex-wrap: wrap; gap: 6px; padding: 14px 16px 12px; border-right: 0; border-bottom: 1px solid var(--cp-border); }
  .client-period-heading { flex: 1 1 100%; padding: 0 0 4px; }
  .client-period-preset { padding: 8px 10px; font-size: 12px; border: 1px solid var(--cp-border); }
  .client-period-preset.active { border-color: var(--cp-blue); }
  .client-cal-day { height: 42px; }
  .client-cal-num { width: 38px; height: 38px; }
  .client-period-field input { padding: 10px; font-size: 16px; }
  .client-period-footer { flex-wrap: wrap; }
  .client-period-apply { margin-left: auto; padding: 12px 20px; }
}

/* ===========================
   PRONTUÁRIO — client records (list, record, form)
=========================== */
.prontuario-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.prontuario-search { flex: 1 1 260px; max-width: 360px; padding: 10px 14px; }
.prontuario-select { flex: 0 0 auto; width: auto; min-width: 170px; padding: 10px 14px; color-scheme: dark; }
.prontuario-count { margin: -4px 0 12px; font-size: 12px; color: var(--text-muted); }
.prontuario-sync-btn {
  flex: none; margin-left: auto; padding: 9px 14px; font: inherit; font-size: 12px; font-weight: 600; color: var(--text-secondary); cursor: pointer;
  background: var(--bg-subtle); border: 1px solid var(--border); border-radius: var(--radius-sm); transition: var(--transition-ui);
}
.prontuario-sync-btn:hover:not(:disabled) { color: var(--text-primary); border-color: var(--border-strong); }
.prontuario-sync-btn:disabled { opacity: 0.6; cursor: progress; }
.prontuario-new-btn { flex: none; margin-left: auto; padding: 10px 18px; }
.prontuario-list { padding: 6px; overflow: hidden; }
.prontuario-row {
  display: grid; grid-template-columns: minmax(0, 1.35fr) 96px minmax(0, 1fr) minmax(0, 1.25fr) minmax(0, 0.95fr) minmax(0, 1fr) minmax(0, 0.7fr);
  align-items: center; gap: 12px; width: 100%; padding: 10px 14px; text-align: left; font: inherit; font-size: 13px;
  color: var(--text-secondary); background: none; border: 0; border-radius: var(--radius-sm);
  transition: background var(--transition);
}
.prontuario-row + .prontuario-row { border-top: 1px solid var(--border); border-top-left-radius: 0; border-top-right-radius: 0; }
.prontuario-row:hover:not(.prontuario-row-head) { background: var(--bg-card-hover); }
.prontuario-row-head { padding-top: 8px; padding-bottom: 8px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.prontuario-cell { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prontuario-cell-name { padding: 4px 0; text-align: left; font: inherit; font-size: 14px; font-weight: 600; color: var(--text-primary); background: none; border: 0; cursor: pointer; }
.prontuario-cell-name:hover { color: var(--blue-light); }
.prontuario-cell-name:focus-visible { outline: 2px solid var(--blue-light); outline-offset: 2px; border-radius: 4px; }
.prontuario-cell-links { display: flex; flex-wrap: wrap; gap: 6px; overflow: visible; white-space: normal; }
.prontuario-link-btn {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 6px 9px; font-size: 12px; font-weight: 600; text-decoration: none; white-space: nowrap;
  color: var(--text-secondary); background: var(--bg-subtle); border: 1px solid var(--border); border-radius: var(--radius-sm);
  transition: var(--transition-ui);
}
.prontuario-link-btn svg { flex-shrink: 0; color: var(--blue-light); }
.prontuario-link-btn.is-instagram svg { color: #F472B6; }
.prontuario-link-btn.is-google svg { color: var(--yellow); }
.prontuario-link-btn.is-site svg { color: var(--text-muted); }
.prontuario-link-btn span { overflow: hidden; text-overflow: ellipsis; }
.prontuario-link-btn:hover { color: var(--text-primary); background: var(--bg-card-hover); border-color: var(--border-strong); }
.prontuario-link-btn:focus-visible { outline: 2px solid var(--blue-light); outline-offset: 2px; }
.prontuario-missing { font-size: 12px; color: var(--text-muted); }
.prontuario-add-link { padding: 4px 0; font: inherit; font-size: 12px; color: var(--text-muted); background: none; border: 0; border-bottom: 1px dashed var(--border-strong); cursor: pointer; transition: color var(--transition); }
.prontuario-add-link:hover { color: var(--blue-light); }
.prontuario-edit-link { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; padding: 0; color: var(--text-muted); background: none; border: 0; border-radius: 6px; cursor: pointer; opacity: 0; transition: var(--transition-ui); }
.prontuario-row:hover .prontuario-edit-link, .prontuario-edit-link:focus-visible { opacity: 1; }
.prontuario-edit-link:hover { color: var(--text-primary); background: var(--bg-subtle); }
.prontuario-add-link:focus-visible, .prontuario-edit-link:focus-visible { outline: 2px solid var(--blue-light); outline-offset: 2px; }
.prontuario-cell-links { align-items: center; }
.prontuario-modal { max-width: 460px; }
.prontuario-modal-body { display: flex; flex-direction: column; gap: 10px; padding: 18px 24px 6px; }
.prontuario-modal-actions { padding: 14px 24px 22px; }
@media (hover: none) { .prontuario-edit-link { opacity: 1; } }
.prontuario-empty { color: var(--text-muted); }
.prontuario-status { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap; color: var(--text-secondary); background: var(--bg-subtle); border: 1px solid var(--border); }
.prontuario-status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.prontuario-status.is-active { color: var(--green); border-color: rgba(18, 185, 129, 0.3); background: rgba(18, 185, 129, 0.08); }
.prontuario-status.is-paused { color: var(--yellow); border-color: rgba(251, 191, 36, 0.3); background: rgba(251, 191, 36, 0.08); }
.prontuario-status.is-closed { color: var(--text-muted); }

/* Saúde do Site (T-126) */
.site-health-badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap; color: var(--text-muted); background: var(--bg-subtle); border: 1px solid var(--border); cursor: default; }
.site-health-badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.site-health-badge.is-green { color: var(--green); border-color: rgba(18, 185, 129, 0.3); background: rgba(18, 185, 129, 0.08); }
.site-health-badge.is-yellow { color: var(--yellow); border-color: rgba(251, 191, 36, 0.35); background: rgba(251, 191, 36, 0.1); }
.site-health-badge.is-red { color: var(--red); border-color: rgba(239, 68, 68, 0.35); background: rgba(239, 68, 68, 0.1); }
.site-health-card .section-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.site-health-url { font-size: 12px; color: var(--text-muted); overflow-wrap: anywhere; }
.site-health-url:hover { color: var(--blue-light); }
.site-health-body { display: flex; flex-direction: column; gap: 10px; padding: 6px 20px 18px; }
.site-health-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; }
.site-health-facts { font-size: 12px; color: var(--text-muted); }
.site-health-problems { display: flex; flex-direction: column; gap: 6px; margin: 0; padding-left: 18px; font-size: 13px; color: var(--text-secondary); }
.site-health-problems li.is-red::marker { color: var(--red); }
.site-health-problems li.is-yellow::marker { color: var(--yellow); }
.site-health-note { margin: 0; font-size: 12px; color: var(--text-muted); }
.site-health-stale { margin: 0; font-size: 12px; color: var(--yellow); }

.prontuario-back { align-self: flex-start; margin-bottom: 14px; }
.prontuario-head { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 14px; margin-bottom: 18px; }
.prontuario-head-text { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.prontuario-name { font-size: 22px; font-weight: 800; letter-spacing: -0.015em; color: var(--text-primary); overflow-wrap: anywhere; }
.prontuario-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--text-muted); }
.prontuario-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.prontuario-actions .accounts-add-confirm-btn, .prontuario-form-actions .accounts-add-confirm-btn, .prontuario-form-actions .accounts-add-cancel-btn, .prontuario-confirm .accounts-add-cancel-btn { flex: none; padding: 10px 18px; }
.prontuario-confirm { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 10px; font-size: 12px; color: var(--text-secondary); }
.prontuario-danger-btn { padding: 10px 16px; font: inherit; font-size: 13px; font-weight: 600; color: var(--white); background: var(--red-strong); border: 1px solid transparent; border-radius: var(--radius-sm); cursor: pointer; transition: var(--transition-ui); }
.prontuario-danger-btn:hover:not(:disabled) { background: var(--red-deep); }
.prontuario-danger-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.prontuario-danger-btn.is-ghost { color: var(--red); background: none; border-color: rgba(239, 68, 68, 0.35); }
.prontuario-danger-btn.is-ghost:hover { background: rgba(239, 68, 68, 0.1); }
.prontuario-section { margin-bottom: 16px; }
/* T-324: the Ficha do cliente — avatar head, "Dados do cliente" on the left,
   "Acessos" and "Histórico" on the right; one column on a phone. */
.ficha-head { display: flex; align-items: center; gap: 16px; min-width: 0; }
.ficha-avatar { flex: none; width: 56px; height: 56px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 19px; font-weight: 800; letter-spacing: 0.02em; color: #fff; background: linear-gradient(135deg, #d98a3a, #b8682a); }
.ficha-sub { color: var(--text-muted); }
.ficha-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; margin-bottom: 16px; }
.ficha-grid .prontuario-section { margin-bottom: 0; }
.ficha-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.ficha-rows { margin: 0; padding: 4px 20px 12px; }
.ficha-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.ficha-row:last-child { border-bottom: 0; }
.ficha-row dt { color: var(--text-secondary); font-size: 13px; }
.ficha-row dd { margin: 0; text-align: right; font-size: 13.5px; font-weight: 600; color: var(--text-primary); overflow-wrap: anywhere; }
.ficha-chip { display: inline-block; padding: 3px 10px; border-radius: 8px; font-size: 12px; font-weight: 600; color: var(--text-primary); background: var(--bg-subtle); border: 1px solid var(--border); }
.ficha-access { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 20px 20px; }
@media (max-width: 768px) {
  .ficha-grid { grid-template-columns: minmax(0, 1fr); }
  .ficha-avatar { width: 46px; height: 46px; font-size: 16px; }
  .ficha-rows { padding: 2px 16px 10px; }
  .ficha-access { padding: 4px 16px 16px; }
}
.prontuario-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; padding: 6px 20px 20px; margin: 0; }
/* T-319: Nome, Status and the link at the top of the form — a card with no title. */
.prontuario-form-top .prontuario-fields { padding-top: 20px; }
.prontuario-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.prontuario-field.is-wide { grid-column: 1 / -1; }
.prontuario-field dt, .prontuario-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.prontuario-field dd { margin: 0; font-size: 14px; line-height: 1.5; color: var(--text-primary); white-space: pre-wrap; overflow-wrap: anywhere; }
.prontuario-field dd a { color: var(--blue-light); }
.prontuario-field .form-input { padding: 10px 14px; }
.prontuario-field select.form-input { color-scheme: dark; }
.prontuario-textarea { min-height: 84px; resize: vertical; font-family: inherit; line-height: 1.5; }
.prontuario-textarea.is-notes { min-height: 220px; }
.prontuario-hint { font-size: 11px; color: var(--text-muted); }
.prontuario-form-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 4px; }

@media (max-width: 900px) {
  /* Each client becomes a small card: name on top, the rest labelled. */
  .prontuario-row-head { display: none; }
  .prontuario-row { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 10px 14px; padding: 14px; }
  .prontuario-row + .prontuario-row { border-top: 1px solid var(--border); }
  .prontuario-cell-name { grid-column: 1 / -1; }
  .prontuario-cell[data-label] { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; white-space: normal; overflow-wrap: anywhere; }
  .prontuario-cell-links[data-label] { flex-direction: row; flex-wrap: wrap; }
  .prontuario-cell-links[data-label]::before { flex: 1 1 100%; }
  .prontuario-link-btn { padding: 8px 12px; }
  .prontuario-cell[data-label]::before { content: attr(data-label); font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
  .prontuario-cell .prontuario-status { align-self: flex-start; }
}
@media (max-width: 640px) {
  .prontuario-search { flex: 1 1 100%; max-width: none; }
  .prontuario-select { flex: 1 1 auto; }
  .prontuario-new-btn { flex: 1 1 100%; margin-left: 0; }
  .prontuario-sync-btn { flex: 1 1 100%; margin-left: 0; padding: 11px 14px; }
  .prontuario-fields { grid-template-columns: minmax(0, 1fr); padding: 6px 16px 16px; }
  .prontuario-name { font-size: 19px; }
  .prontuario-actions, .prontuario-form-actions { width: 100%; }
  .prontuario-actions > button, .prontuario-form-actions > button { flex: 1 1 auto; }
  .prontuario-field .form-input { font-size: 16px; }
}

/* =====================================================================
   DARK PREMIUM THEME — the system's identity: a deep navy page, cards one
   tone lighter so the layers read, one elegant blue for action and
   selection, light text. Only presentation: no layout logic, no
   behaviour. Kept last so it wins over everything above.
   ===================================================================== */

/* ── Typography ─────────────────────────────────────────────────────── */
body { font-feature-settings: 'cv11', 'ss01', 'cv02'; color: var(--text-primary); }
.page-title, .setup-title, .sidebar-brand, .section-title, .modal-title,
.kpi-value, .aok-value, .ad-detail-metric-value, .combined-channel-value,
.prontuario-name, .client-hero-name, .accounts-panel-detail-name, .client-space-name,
.campaign-name, .reference-title, .ad-detail-title, .std-name, .client-card-name,
.account-insight-value, .reference-perf strong, .discover-score strong, .content-perf strong,
.discover-title, .combined-channel-title, .public-dashboard-error-card h1, .similar-title {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}
.page-title { font-size: 22px; font-weight: 800; letter-spacing: -0.025em; line-height: 1.15; color: var(--text-primary); }
.page-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 3px; font-weight: 450; }
.section-title { font-size: 15.5px; font-weight: 700; }
.section-subtitle, .account-analytics-card-meta, .client-best-criteria { color: var(--text-muted); }
.setup-title { font-size: 22px; font-weight: 800; }

/* ── Page / shell ───────────────────────────────────────────────────── */
body {
  background:
    radial-gradient(1100px 520px at 80% -8%, rgba(47, 125, 215, 0.10), transparent 62%),
    var(--bg-primary);
  background-attachment: scroll;
}
.view { padding: 30px 36px 48px; gap: var(--space-section); }
.topbar {
  background: rgba(2, 11, 34, 0.78);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--border);
  padding: 0 36px;
}

/* Sidebar: part of the page; the current area is a lifted navy "card"
   with a blue mark and blue text. */
.sidebar { background: var(--bg-sidebar); border-right: 1px solid var(--border); }
.sidebar-header { padding: 22px 16px 18px; border-bottom: 1px solid var(--border); }
.sidebar-brand {
  font-size: 14px; font-weight: 800; letter-spacing: -0.01em;
  background: none; -webkit-text-fill-color: var(--text-primary); color: var(--text-primary);
}
.logo-icon-sm { border: 1px solid var(--border-strong); box-shadow: var(--shadow-sm); }
.sidebar-nav { padding: 14px 12px; gap: 3px; }
.nav-item { padding: 10px 12px; font-size: 13.5px; font-weight: 500; color: var(--text-secondary); border-radius: 11px; }
.nav-item svg { color: var(--text-muted); transition: color var(--transition); }
.nav-item:hover { color: var(--text-primary); background: rgba(184, 196, 218, 0.06); }
.nav-item:hover svg { color: var(--text-secondary); }
.nav-item.active { color: var(--white); background: var(--blue-soft); font-weight: 600; box-shadow: inset 0 0 0 1px rgba(47, 125, 215, 0.35); }
.nav-item.active svg { color: var(--blue-light); }
.nav-item.active::before { left: -12px; width: 3px; top: 22%; bottom: 22%; background: var(--blue); border-radius: 0 3px 3px 0; }
.sidebar-toggle:hover { background: rgba(184, 196, 218, 0.08); }
.sidebar-footer { border-top: 1px solid var(--border); }
.logout-btn { color: var(--text-muted); }
.logout-btn:hover { color: var(--red); background: rgba(239, 68, 68, 0.1); }
.entity-badge { color: var(--purple-light); background: rgba(139, 124, 246, 0.14); border-color: rgba(139, 124, 246, 0.3); }

/* ── Cards ──────────────────────────────────────────────────────────── */
.section-card, .kpi-card, .account-overview-card, .client-card, .ad-card, .reference-card,
.content-card, .seeds-related, .discover-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
}
.section-card { border-radius: 16px; }
.section-header { padding: 18px 24px; border-bottom: 1px solid var(--border); }
.kpi-card { border-radius: 16px; padding: 22px 24px; gap: 18px; }
.kpi-card:hover, .account-overview-card:hover, .client-card:hover, .reference-card:hover {
  border-color: var(--border-strong); box-shadow: var(--shadow-hover); background-color: var(--bg-card-hover);
}
.kpi-icon { width: 42px; height: 42px; border-radius: 12px; }
.kpi-icon-blue { background: rgba(47, 125, 215, 0.16); color: var(--blue-light); }
.kpi-label { font-size: 11px; font-weight: 600; letter-spacing: 0.07em; color: var(--text-muted); margin-bottom: 8px; }
.kpi-value { font-size: 28px; font-weight: 800; color: var(--text-primary); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.kpi-change { font-size: 12.5px; color: var(--text-secondary); }
.aok-label, .std-stat-label, .client-metric-label, .ad-detail-metric-label, .ad-detail-field-label, .ad-card-metric-label, .combined-channel-label { color: var(--text-muted); }
.aok-value { font-size: 16px; font-weight: 700; }
.account-overview-card, .home-account-card { background: var(--bg-card); border-radius: 16px; }
.client-card { border-radius: 16px; padding: 18px 20px; }
.ad-card { border-radius: 14px; }
.ad-card:hover { border-color: rgba(47, 125, 215, 0.5); box-shadow: var(--shadow-hover); }
.ad-card-thumb { background: linear-gradient(135deg, var(--bg-elevated), var(--bg-raised)); }
.ad-card-open-btn { background: rgb(255 255 255 / 0.95); color: var(--bg-elevated); box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4); }

/* Inner panels inside cards: one tone up, not a second box. */
.account-insight-card, .client-ad, .client-campaign, .activity-event, .account-issue,
.spend-tracking-account-card, .group-member-row, .spend-tracking-detail-inner, .ad-detail-info,
.ad-detail-metric, .client-share, .dash-share, .qp-publish-in, .qp-structure, .qp-ad, .budget-bulk-list {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}
.spend-tracking-account-card:hover, .group-member-row:hover { background: var(--bg-raised); border-color: var(--border-strong); }
.spend-tracking-account-card.selected { background: rgba(47, 125, 215, 0.12); border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue); }
.client-ad:hover { background: var(--bg-raised); border-color: rgba(47, 125, 215, 0.5); }
.dash-share { background: var(--bg-elevated); border-color: var(--border-strong); }
.dash-share-icon { background: rgba(47, 125, 215, 0.16); color: var(--blue-light); }

/* ── Buttons ────────────────────────────────────────────────────────── */
.accounts-add-confirm-btn, .connect-btn, .client-item-btn-primary, .public-dashboard-error-link, .account-tab.active, .spend-tracking-tab.active {
  background: var(--blue);
  color: var(--white);
}
.accounts-add-confirm-btn, .connect-btn {
  font-weight: 600;
  border-radius: 10px;
  min-height: 36px;
  letter-spacing: 0.005em;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25), 0 6px 16px -8px rgba(47, 125, 215, 0.5);
}
.connect-btn { background: var(--blue); padding: 14px 28px; font-size: 14.5px; }
.accounts-add-confirm-btn:hover:not(:disabled), .connect-btn:hover:not(:disabled) {
  background: var(--blue-hover);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 22px -8px rgba(47, 125, 215, 0.55);
  transform: translateY(-1px);
}
.accounts-add-confirm-btn:disabled, .connect-btn:disabled { opacity: 0.5; box-shadow: none; transform: none; }
.client-item-btn-primary:hover { background: var(--blue-hover) !important; }
/* Secondary: dark surface, subtle border. */
.accounts-add-cancel-btn, .refresh-btn, .prontuario-sync-btn, .client-item-btn, .bulk-publish-action-btn, .dash-share-copy, .dash-share-retry, .ad-media-action, .prontuario-link-btn {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: none;
}
.accounts-add-cancel-btn { min-height: 36px; font-weight: 600; }
.accounts-add-cancel-btn:hover, .refresh-btn:hover, .prontuario-sync-btn:hover:not(:disabled), .client-item-btn:hover, .bulk-publish-action-btn:hover, .dash-share-copy:hover, .dash-share-retry:hover, .ad-media-action:hover, .prontuario-link-btn:hover {
  color: var(--text-primary); background: var(--bg-raised); border-color: var(--border-hover);
}
.see-all-btn, .account-overview-btn, .form-link, .reference-profile, .reference-cta { color: var(--blue-light); font-weight: 600; }
.see-all-btn:hover:not(:disabled), .account-overview-btn:hover, .reference-profile:hover { color: var(--blue-pale); }
.client-item-btn-danger { color: var(--red) !important; border-color: rgba(239, 68, 68, 0.4) !important; }
.prontuario-danger-btn { background: var(--red-strong); }
.prontuario-danger-btn:hover:not(:disabled) { background: var(--red-deep); }
.prontuario-danger-btn.is-ghost { background: none; border-color: rgba(239, 68, 68, 0.35); box-shadow: none; }
.prontuario-danger-btn.is-ghost:hover { background: rgba(239, 68, 68, 0.1); }
.reference-danger-btn { background: var(--red-strong); }
.reference-danger-btn:hover:not(:disabled) { background: var(--red-deep); }

/* Pills / tabs / segmented controls */
.period-selector, .discover-pills, .references-tabs { background: var(--bg-input); border: 1px solid var(--border); border-radius: 12px; padding: 3px; }
.period-btn { border-radius: 9px; padding: 7px 14px; font-size: 13px; font-weight: 500; color: var(--text-secondary); }
.period-btn:hover { color: var(--text-primary); background: rgba(184, 196, 218, 0.07); }
.period-btn.active { background: var(--blue); color: var(--white); font-weight: 600; box-shadow: 0 2px 8px -4px rgba(47, 125, 215, 0.6); }
.discover-pill.is-active { background: var(--blue-soft); color: var(--text-primary); box-shadow: inset 0 0 0 1px rgba(47, 125, 215, 0.35); }
.account-tab, .spend-tracking-tab, .project-account-filter-btn { background: var(--bg-elevated); border-color: var(--border-strong); color: var(--text-secondary); }
.account-tab:hover, .spend-tracking-tab:hover, .project-account-filter-btn:hover { border-color: var(--border-hover); color: var(--text-primary); }
.account-tab.active, .spend-tracking-tab.active { background: var(--blue); border-color: var(--blue); color: var(--white); }
.project-account-filter-btn.active { background: rgba(139, 124, 246, 0.14); color: var(--purple-light); border-color: rgba(139, 124, 246, 0.35); }

/* ── Inputs ─────────────────────────────────────────────────────────── */
.form-input, .accounts-add-input, .search-input, .filter-select, .google-ads-link-select, .home-search-input,
.activity-filter select, .client-dash-period select, .client-period-field input, .prontuario-search, .prontuario-select {
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  border-radius: 10px;
  box-shadow: none;
}
.form-input:hover, .accounts-add-input:hover, .search-input:hover, .filter-select:hover, .google-ads-link-select:hover, .home-search-input:hover { border-color: var(--border-hover); }
.form-input:focus, .accounts-add-input:focus, .search-input:focus, .filter-select:focus, .google-ads-link-select:focus, .home-search-input:focus, .activity-filter select:focus, .client-period-field input:focus {
  border-color: var(--blue); box-shadow: var(--focus-ring); outline: none;
}
.filter-select, .activity-filter select, .client-dash-period select, .prontuario-select, .prontuario-field select.form-input { color-scheme: dark; }
.filter-select option, .prontuario-select option { background: var(--bg-elevated); color: var(--text-primary); }
/* T-253: the other selects (Diário / Últimos Ajustes, Dashboard de Clientes,
   Métricas, Prontuário) were 19–21px tall next to 38px fields: with the
   native look the browser ignores their height. Same height as the fields,
   with a drawn arrow (the native one goes with the native look). */
.activity-filter select, .client-dash-period select, .prontuario-select {
  -webkit-appearance: none; appearance: none;
  min-height: var(--control-h);
  padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23B8C4DA' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  cursor: pointer;
}
.form-label { color: var(--text-primary); font-weight: 600; }
.form-label svg { color: var(--blue-light); }
.form-hint, .prontuario-hint, .share-settings-hint { color: var(--text-muted); }
code, .share-settings-hint code { background: rgba(47, 125, 215, 0.16); color: var(--blue-pale); }
.search-wrap svg { color: var(--text-muted); }

/* ── Tables ─────────────────────────────────────────────────────────── */
.ads-table thead th {
  background: var(--bg-secondary);
  color: var(--text-muted);
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.07em;
  border-bottom: 1px solid var(--border);
  padding: 11px 18px;
}
.ads-table thead th.sorted { color: var(--blue-light); }
.ads-table td { padding: 13px 18px; color: var(--text-secondary); border-bottom: 1px solid var(--bg-card-active); }
.ads-table tbody tr { border-bottom: 0; }
.ads-table tbody tr:hover { background: rgba(184, 196, 218, 0.04); }
.ads-table tbody tr:last-child td { border-bottom: 0; }
.ads-table td strong, .ads-table td .ad-card-name { color: var(--text-primary); }
.activity-row.is-selected td { background: rgba(47, 125, 215, 0.12); }

/* ── Badges ─────────────────────────────────────────────────────────── */
.status-badge {
  padding: 2px 8px 2px 7px;
  font-size: 10px; font-weight: 600; letter-spacing: 0.05em;
  box-shadow: none;
  border: 1px solid color-mix(in srgb, currentColor 22%, transparent);
}
.status-badge::before { width: 5px; height: 5px; }
.status-ACTIVE { background: rgba(18, 185, 129, 0.12); color: var(--green-bright); }
.status-PAUSED, .status-CAMPAIGN_PAUSED { background: rgba(245, 158, 11, 0.14); color: var(--yellow); }
.status-DISAPPROVED, .status-WITH_ISSUES { background: rgba(239, 68, 68, 0.12); color: var(--red-soft); }
.status-ARCHIVED, .status-REMOVED { background: rgba(184, 196, 218, 0.08); color: var(--text-muted); }
.prontuario-status { padding: 2px 9px; font-size: 10.5px; font-weight: 600; border: 0; background: rgba(184, 196, 218, 0.09); color: var(--text-secondary); }
.prontuario-status.is-active { color: var(--green-bright); background: rgba(18, 185, 129, 0.13); }
.prontuario-status.is-paused { color: var(--yellow); background: rgba(245, 158, 11, 0.15); }
.prontuario-status.is-closed { color: var(--text-muted); background: rgba(184, 196, 218, 0.09); }
/* Desativar cliente (T-111) */
.prontuario-status.is-deactivated { color: var(--red); background: rgba(239, 68, 68, 0.12); }
.prontuario-deactivated { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.prontuario-reactivate-btn { padding: 3px 10px; font: inherit; font-size: 11px; font-weight: 600; color: var(--blue-light); background: transparent; border: 1px solid rgba(47, 125, 215, 0.45); border-radius: 20px; cursor: pointer; }
.prontuario-reactivate-btn:hover { background: rgba(47, 125, 215, 0.12); }
.pace-chip, .pay-chip, .account-insight-tag, .accounts-panel-period-badge, .group-badge, .home-channel-badge, .client-channel, .account-channel-badge, .reference-badge, .seed-status, .seed-type, .discover-count, .reference-tag { font-weight: 600; }
.client-channel, .account-channel-badge, .home-channel-badge, .similar-theme, .reference-tag, .seed-status, .seed-type, .discover-count { background: var(--bg-elevated); border-color: var(--border-strong); }
.pay-chip, .pace-chip.spend-pace-neutral, .account-insight-tag, .accounts-panel-period-badge { background: rgba(184, 196, 218, 0.09); color: var(--text-secondary); }
.campaign-count, .ad-detail-badge, .reference-badge { background: rgba(47, 125, 215, 0.16); color: var(--blue-pale); border-color: rgba(47, 125, 215, 0.35); box-shadow: none; }
.home-channel-google { color: var(--blue-light); border-color: rgba(47, 125, 215, 0.4); }
.account-overview-error, .stac-error-badge { background: rgba(239, 68, 68, 0.12); color: var(--red-soft); }

/* ── Modals & popovers ──────────────────────────────────────────────── */
.modal-overlay { background: rgba(2, 8, 24, 0.72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.modal { background: var(--bg-card); border: 1px solid var(--border-strong); border-radius: 18px; box-shadow: var(--shadow-pop); }
.modal-header { padding: 22px 26px 16px; border-bottom: 1px solid var(--border); }
.modal-title { font-size: 18px; font-weight: 800; color: var(--text-primary); }
.modal-close:hover { color: var(--text-primary); background: rgba(184, 196, 218, 0.08); }
.ad-thumb, .ad-media { background: #04102B; }
.preview-frame-wrap, .preview-loading { background: var(--gray-100); }
.daily-chart-tip { background: var(--bg-elevated); border-color: var(--border-strong); box-shadow: var(--shadow-pop); }

/* Client detail — period picker (dropdown + calendar) */
.client-period-trigger { background: var(--bg-elevated); border: 1px solid var(--border-strong); box-shadow: none; border-radius: 10px; }
.client-period-trigger:hover, .client-period-picker.is-open .client-period-trigger { background: var(--bg-raised); border-color: var(--blue); }
.client-period-icon { color: var(--blue-light); }
.client-period-popover {
  --cp-bg: var(--bg-card); --cp-border: var(--border); --cp-text: var(--text-primary); --cp-muted: var(--text-secondary); --cp-faint: var(--text-muted);
  --cp-blue: var(--blue); --cp-blue-dark: #BFD7F6; --cp-blue-soft: rgba(47, 125, 215, 0.22); --cp-hover: rgba(47, 125, 215, 0.14); --cp-green: var(--green);
  border: 1px solid var(--border-strong); border-radius: 14px; box-shadow: var(--shadow-pop);
}
.client-period-heading { color: var(--blue-light); }
.client-period-preset.is-custom { color: var(--blue-light); }
.client-cal-day.in-range.is-outside { color: var(--blue-light); }
.client-period-switch { background: var(--border-strong); }
.client-period-apply { background: var(--blue); border-radius: 10px; }
.client-period-apply:hover:not(:disabled) { background: var(--blue-hover); }

/* ── Prontuário ─────────────────────────────────────────────────────── */
.prontuario-list { padding: 4px 6px 6px; }
.prontuario-row-head { color: var(--text-muted); font-weight: 600; letter-spacing: 0.06em; border-bottom: 1px solid var(--border); border-radius: 0; }
.prontuario-row + .prontuario-row { border-top: 1px solid var(--bg-card-active); }
.prontuario-row:hover:not(.prontuario-row-head) { background: rgba(184, 196, 218, 0.04); }
.prontuario-cell-name:hover { color: var(--blue-light); }
.prontuario-link-btn { padding: 5px 9px; font-weight: 600; border-radius: 8px; }
.prontuario-link-btn svg { color: var(--blue-light); }
.prontuario-link-btn.is-site svg { color: var(--text-muted); }
.prontuario-add-link { border-bottom-color: var(--border-strong); }
.prontuario-add-link:hover { color: var(--blue-light); }
.prontuario-edit-link:hover { background: rgba(184, 196, 218, 0.08); }
.prontuario-field dd a { color: var(--blue-light); }
.prontuario-field dt, .prontuario-label { color: var(--text-muted); }
.prontuario-section .section-header { padding: 16px 20px; }
/* Link de compartilhamento: "Abrir dashboard" + "Copiar link", URL below. */
.dash-share { align-items: flex-start; }
.dash-share-row { flex-wrap: wrap; gap: 8px; }
.dash-share-open, .dash-share-copy {
  flex: none; display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px;
  font: inherit; font-size: 12px; font-weight: 600; text-decoration: none; border-radius: 9px; cursor: pointer; transition: var(--transition-ui);
}
.dash-share-open { color: var(--white); background: var(--blue); border: 1px solid var(--blue); }
.dash-share-open:hover { background: var(--blue-hover); border-color: var(--blue-hover); }
.dash-share-open svg, .dash-share-copy svg { width: 14px; height: 14px; flex-shrink: 0; }
.dash-share-copy.is-copied { color: var(--green-bright); border-color: rgba(18, 185, 129, 0.45); background: rgba(18, 185, 129, 0.12); }
.dash-share-body > .dash-share-url {
  flex: none; width: 100%; padding: 0; margin-top: 2px; font-size: 11px; color: var(--text-muted);
  background: none; border: 0; box-shadow: none; outline: none; text-overflow: ellipsis;
}
.prontuario-modal .modal-ad-id { font-family: inherit; font-size: 12.5px; color: var(--text-secondary); margin-top: 4px; }

/* ── Visão Geral / Dashboard do cliente ─────────────────────────────── */
.home-account-card .account-overview-name, .client-card-name { color: var(--text-primary); }
.home-account-name-edit:hover, .home-account-name-edit:focus-visible { background: rgba(184, 196, 218, 0.08); color: var(--text-primary); }
.activity-bar { background: linear-gradient(180deg, var(--blue-light), var(--blue)); }
.activity-bar.is-empty { background: rgba(184, 196, 218, 0.1); }
.gender-bar, .spend-tracking-progress-bar, .stac-mini-progress, .mix-bar { background: rgba(184, 196, 218, 0.1); }
.gender-male .gender-bar-fill, .google-keyword-row .gender-bar-fill, .spend-tracking-progress-fill, .stac-mini-progress-fill, .mix-remarketing, .mix-legend-dot.mix-remarketing { background: var(--blue-light); }
.daily-leads-body { color: var(--blue-light); }
.daily-chart-line { stroke: var(--blue-light); }
.daily-chart-dot { stroke: var(--blue-light); }
.client-channel-meta::before, .account-channel-meta::before { background: var(--blue-light); }
.combined-channel-value { font-weight: 800; }
.client-hero-name, .accounts-panel-detail-name, .client-space-name { font-size: 22px; font-weight: 800; }
.client-kpis .kpi-value, .client-kpis-more .kpi-value { font-size: 21px; }
.account-kpi .kpi-value { font-size: 24px; }

/* ── Login ──────────────────────────────────────────────────────────── */
.setup-screen { background: var(--bg-primary); }
.orb { opacity: 0.5; }
.orb-1 { background: radial-gradient(circle, rgba(47, 125, 215, 0.35) 0%, transparent 70%); }
.orb-2 { background: radial-gradient(circle, rgba(90, 155, 234, 0.22) 0%, transparent 70%); }
.orb-3 { background: radial-gradient(circle, rgba(139, 124, 246, 0.14) 0%, transparent 70%); }
.setup-card { background: rgba(8, 23, 53, 0.9); border: 1px solid var(--border-strong); box-shadow: var(--shadow-pop); }
.setup-title { background: none; -webkit-text-fill-color: var(--text-primary); color: var(--text-primary); }
.setup-divider { background: linear-gradient(90deg, transparent, var(--border-strong), transparent); }
.logo-icon { box-shadow: var(--shadow-sm); border: 1px solid var(--border-strong); }

/* ── Feedback ───────────────────────────────────────────────────────── */
.setup-error { background: rgba(239, 68, 68, 0.1); border-color: rgba(239, 68, 68, 0.3); color: var(--red-soft); }
.std-error { background: rgba(239, 68, 68, 0.1); }
.skeleton-row, .skeleton-card, .skeleton-campaign-header, .daily-chart-skeleton, .reference-skeleton span {
  background: linear-gradient(90deg, rgba(184, 196, 218, 0.05) 25%, rgba(184, 196, 218, 0.1) 50%, rgba(184, 196, 218, 0.05) 75%);
  background-size: 200% 100%;
}
::selection { background: rgba(47, 125, 215, 0.35); }

/* ── Responsive rhythm ──────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .view { padding: 24px 24px 36px; }
  .topbar { padding: 0 24px; }
}
@media (max-width: 768px) {
  .view { padding: 18px 16px 32px; gap: 18px; }
  .topbar { padding: 0 16px; }
  .page-title { font-size: 19px; }
  .kpi-value { font-size: 24px; }
  .nav-item.active::before { left: -12px; }
}

/* ── "Em construção" (Chat da Equipe, Tarefas) ──────────────────────── */
.nav-soon {
  margin-left: auto; padding: 1px 7px; border-radius: var(--radius-pill); font-size: 9.5px; font-weight: 600; letter-spacing: 0.04em;
  color: var(--text-muted); background: rgba(184, 196, 218, 0.08); white-space: nowrap;
}
.sidebar.collapsed .nav-soon { display: none; }
/* T-261: within each group, the "Em breve" items go after the ones that
   work and read as not yet available (muted label); the HTML order and the
   items themselves stay as they are. */
.nav-item:has(> .nav-soon:not(.hidden)) { order: 1; color: var(--text-muted); }
.nav-item:has(> .nav-soon:not(.hidden)) svg { opacity: .6; }

/* ── Sidebar layout after the groups (T-029) ─────────────────────────────
   With five groups the item list got taller than the window. The scroll
   area had flex:1 + min-height:0 but no overflow, so it spilled over the
   footer ("Desconectar tudo"), and a long label pushed its "Em breve" out
   of the sidebar. Now the sidebar is exactly the viewport tall, the item
   area is the ONLY thing that scrolls (between the header and the fixed
   footer, never sideways), long labels wrap instead of pushing, badges keep
   their size, and items/titles are a little tighter so more fits. */
.sidebar {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

.sidebar-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(184, 196, 218, 0.18) transparent;
}

.sidebar-scroll::-webkit-scrollbar { width: 6px; }
.sidebar-scroll::-webkit-scrollbar-track { background: transparent; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: rgba(184, 196, 218, 0.18); border-radius: 3px; }

.sidebar-footer { flex-shrink: 0; }

.sidebar-nav { padding: 10px 12px 12px; gap: 2px; }
.nav-group { gap: 2px; }
.nav-group + .nav-group { margin-top: 8px; }
.nav-group-title { padding: 6px 12px 3px; font-size: 10.5px; }
.nav-item { padding: 8px 12px; gap: 10px; min-width: 0; }

/* A long label breaks onto a second line instead of pushing the badge out
   (or being cut with "…"): the full name always shows. */
.nav-label {
  min-width: 0;
  white-space: normal;
  overflow-wrap: break-word;
  line-height: 1.25;
}

.nav-soon { flex-shrink: 0; padding: 1px 6px; font-size: 9px; }
.coming-soon {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  min-height: min(520px, calc(100vh - var(--topbar-h) - 120px)); padding: 56px 28px; text-align: center; overflow: hidden;
  background: radial-gradient(520px 260px at 50% 0%, rgba(47, 125, 215, 0.10), transparent 70%), var(--bg-card);
}
.coming-soon-icon {
  display: inline-flex; align-items: center; justify-content: center; width: 84px; height: 84px; margin-bottom: 6px;
  color: var(--blue-light); background: var(--blue-soft); border: 1px solid rgba(47, 125, 215, 0.3); border-radius: 24px;
}
.coming-soon-icon svg { width: 40px; height: 40px; }
.coming-soon-title { font-family: var(--font-display); font-size: 24px; font-weight: 800; letter-spacing: -0.02em; color: var(--text-primary); }
.coming-soon-badge {
  display: inline-flex; align-items: center; gap: 7px; padding: 4px 12px; border-radius: var(--radius-pill);
  font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--yellow); background: rgba(245, 158, 11, 0.13); border: 1px solid rgba(245, 158, 11, 0.25);
}
.coming-soon-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.coming-soon-text { max-width: 460px; margin-top: 2px; font-size: 14px; line-height: 1.6; color: var(--text-secondary); }
@media (max-width: 640px) {
  .coming-soon { min-height: 380px; padding: 40px 20px; }
  .coming-soon-icon { width: 68px; height: 68px; border-radius: 20px; }
  .coming-soon-icon svg { width: 32px; height: 32px; }
  .coming-soon-title { font-size: 20px; }
}

/* Meta temporariamente indisponível: uma espera, não um erro — tom neutro. */
.meta-temporary,
.setup-error.meta-temporary,
.spend-tracking-error.meta-temporary {
  color: var(--text-secondary);
  background: transparent;
  border-color: var(--border);
}

/* ── MÉTRICAS ───────────────────────────────────────────────────────────
   All clients on one screen: compact summary, toolbar, a clean table
   (tabular figures, discreet hover) and, per client, the weekly history.
   On a phone each client becomes a compact card — no sideways scrolling. */
.metrics-summary { margin-bottom: 18px; }
.metrics-toolbar { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 12px; margin-bottom: 10px; }
.metrics-search { flex: 1 1 240px; max-width: 340px; }
.metrics-filter { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.metrics-filter select { min-width: 150px; text-transform: none; letter-spacing: 0; }
.metrics-refresh { margin-left: auto; }
/* T-254: "Atualizar" was a loose link below the line of the fields; now a
   button of the same height, aligned with them, and the search too. */
.metrics-toolbar .metrics-search { min-height: var(--control-h); }
.metrics-toolbar .metrics-refresh {
  display: inline-flex; align-items: center; gap: 6px; min-height: var(--control-h); padding: 0 16px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--bg-subtle); text-decoration: none;
}
.metrics-toolbar .metrics-refresh:hover { border-color: var(--border-focus); }
@media (min-width: 641px) and (max-width: 1199px) {
  /* T-254: search on its own row, the three filters and Atualizar together
     on the next one (no filter left alone on a line). */
  .metrics-toolbar .metrics-search { flex: 1 1 100%; max-width: none; }
}
.metrics-count { margin: 0 0 12px; font-size: 12px; color: var(--text-muted); }
.metrics-card { padding: 0; overflow: hidden; }
.metrics-card > .account-analytics-empty { padding: 28px 16px; }
.metrics-table-wrap { width: 100%; overflow-x: auto; }
.metrics-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.metrics-table th {
  padding: 12px 16px; text-align: left; font-size: 11px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--text-muted); border-bottom: 1px solid var(--border); white-space: nowrap;
}
.metrics-table td { padding: 13px 16px; border-bottom: 1px solid var(--border); color: var(--text-primary); vertical-align: middle; }
.metrics-table tbody tr:last-child td { border-bottom: 0; }
.metrics-row { transition: background 0.15s ease; }
.metrics-row:hover, .metrics-row.is-expanded { background: rgba(47, 125, 215, 0.06); }
.metrics-table .metrics-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.metrics-sub { display: block; margin-top: 2px; font-size: 11px; font-weight: 400; color: var(--text-muted); }
.metrics-muted { color: var(--text-muted); font-size: 12.5px; }
.metrics-cell-wide { text-align: center; }
.metrics-cell-client { min-width: 200px; }
.metrics-client-name {
  display: block; padding: 0; border: 0; background: none; font: inherit; font-weight: 600; color: var(--text-primary);
  text-align: left; cursor: pointer;
}
.metrics-client-name:hover { color: var(--blue-light, var(--blue-light)); }
.metrics-channels { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.metrics-channels .home-channel-badge { margin-top: 0; }
.metrics-stale-note { display: block; margin-top: 6px; font-size: 11px; color: var(--text-muted); }
.metrics-status {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  color: var(--text-secondary); background: rgba(184, 196, 218, 0.08); white-space: nowrap;
}
.metrics-status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.metrics-status.is-active { color: var(--green); background: rgba(18, 185, 129, 0.1); }
.metrics-status.is-paused { color: var(--orange); background: rgba(245, 158, 11, 0.1); }
.metrics-change { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text-secondary); }
.metrics-change.is-good { color: var(--green); }
.metrics-change.is-bad { color: var(--red); }
.metrics-change.is-none { color: var(--text-muted); font-weight: 400; }
.metrics-sub .metrics-change { font-size: 11px; font-weight: 500; }
/* T-310: Métricas — discreet red mark on a client whose cost per result rose
   more than 20% against the previous period; the top cards' change line. */
.metrics-cost-alert { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--red); margin-right: 6px; vertical-align: middle; }
.metrics-kpi-change .metrics-change { font-size: 12px; }
.metrics-cell-actions { text-align: right; white-space: nowrap; }
.metrics-link {
  padding: 5px 9px; border: 1px solid transparent; border-radius: var(--radius-sm); background: none; font: inherit; font-size: 12px;
  color: var(--text-secondary); cursor: pointer; transition: color 0.15s ease, border-color 0.15s ease;
}
.metrics-link:hover { color: var(--text-primary); border-color: var(--border); }
.metrics-weeks-row > td { padding: 0; background: rgba(2, 11, 34, 0.35); }
.metrics-weeks { padding: 16px 16px 18px; }
.metrics-weeks-title { margin: 0 0 10px; font-size: 13px; font-weight: 600; color: var(--text-primary); }
.metrics-weeks-table th, .metrics-weeks-table td { padding: 9px 12px; }
.metrics-weeks .see-all-btn { margin-top: 12px; }
.metrics-week-current { font-weight: 600; }

@media (max-width: 860px) {
  .metrics-search { flex: 1 1 100%; max-width: none; }
  .metrics-filter { flex: 1 1 140px; }
  .metrics-filter select { min-width: 0; width: 100%; }
  .metrics-refresh { margin-left: 0; }
  .metrics-table-wrap { overflow-x: visible; }
  .metrics-table thead { display: none; }
  .metrics-table, .metrics-table tbody, .metrics-table tr, .metrics-table td { display: block; width: 100%; }
  .metrics-table tr { padding: 12px 14px; border-bottom: 1px solid var(--border); }
  .metrics-table tbody tr:last-child { border-bottom: 0; }
  .metrics-table td { padding: 4px 0; border: 0; }
  .metrics-table td[data-label] { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; text-align: right; }
  .metrics-table td[data-label]::before {
    content: attr(data-label); flex: 0 0 auto; font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted); text-align: left;
  }
  .metrics-table td.metrics-cell-client { display: block; text-align: left; padding-bottom: 8px; }
  .metrics-table td.metrics-cell-client::before { content: none; }
  .metrics-table .metrics-sub { display: inline; margin: 0 0 0 6px; }
  .metrics-cell-wide { text-align: left; }
  .metrics-cell-actions { display: flex; gap: 8px; padding-top: 8px; text-align: left; }
  .metrics-link { border-color: var(--border); }
  .metrics-table tr.metrics-weeks-row { padding: 0; }
  .metrics-weeks { padding: 12px 14px 14px; }
  .metrics-weeks-table tr { padding: 10px 0; }
}

/* ─── REPORTS (alertas automáticos das contas) ─────────────────────────── */
/* Sidebar counter: the number of open reports. Quiet on purpose — no
   animation; red only when one of them is critical. */
.nav-badge {
  margin-left: auto; min-width: 20px; padding: 1px 6px; border-radius: var(--radius-pill);
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; font-variant-numeric: tabular-nums;
  color: #1B1405; background: var(--orange);
}
.nav-badge.is-critical { color: var(--white); background: var(--red); }
.sidebar.collapsed .nav-badge {
  position: absolute; top: 4px; right: 6px; min-width: 16px; padding: 0 4px; font-size: 9.5px; line-height: 15px;
}

/* ── Barra lateral no estilo do IconSideNav (T-155) ──────────────────────
   On a computer every item is a rounded square button, in the style the
   user sent (IconSideNav): it grows a little on hover and sinks on click,
   and the current one gets a blue fill that grows from the centre behind
   its icon (and shrinks when it leaves). Two states, switched by the
   sidebar's own button (#sidebar-toggle, class .collapsed as before):
     - open (as it starts): the buttons are rows with the name beside the
       icon, the group titles, the brand and "Em breve" as a pill;
     - closed: a narrow rail of icons only, a thin line between groups,
       "Em breve" a dot, the name in a tooltip (app.js, setupNavTooltip)
       and kept in the item for screen readers.
   Same items, groups, roles and counters in both. On a phone the menu is
   still the drawer with names. */
:root { --rail-w: 76px; }
@media (min-width: 769px) {
  .sidebar-scroll { scrollbar-width: none; }
  .sidebar-scroll::-webkit-scrollbar { display: none; }
  .logo-icon-sm { width: 40px; height: 40px; border-radius: 10px; }
  .sidebar-toggle { width: 30px; height: 30px; display: inline-grid; place-items: center; padding: 0; border-radius: 8px; }
  .sidebar-toggle svg { transition: transform var(--transition); }
  .sidebar-toggle:focus-visible { outline: none; box-shadow: var(--focus-ring); }
  .sidebar-nav { padding: 14px 12px 16px; gap: 8px; }
  .nav-group { gap: 6px; }
  .nav-group + .nav-group { margin-top: 8px; }

  /* The button, in both states. */
  .sidebar .nav-item {
    width: 100%; min-height: 44px; padding: 8px 12px; gap: 12px;
    justify-content: flex-start; flex: none;
    border-radius: 10px; background: rgba(184, 196, 218, 0.07); color: var(--text-secondary);
    isolation: isolate;
    transition: transform 0.15s ease, background-color var(--transition), color var(--transition);
  }
  .sidebar .nav-item svg { position: relative; z-index: 1; width: 20px; height: 20px; color: inherit; }
  .sidebar .nav-label, .sidebar .nav-soon, .sidebar .nav-badge { position: relative; z-index: 1; }
  /* T-274: the menu is used all day — no zoom on hover, only the colour. */
  .sidebar .nav-item:hover { background: rgba(184, 196, 218, 0.14); color: var(--text-primary); }
  .sidebar .nav-item:hover svg { color: inherit; }
  .sidebar .nav-item:active { transform: scale(0.95); }
  .sidebar .nav-item:focus-visible { outline: none; box-shadow: var(--focus-ring); }
  /* The fill behind the icon (and the name, when open). T-274: it fades in
     over 150ms instead of growing from nothing at the centre. */
  .sidebar .nav-item::before {
    content: ''; position: absolute; inset: 0; left: 0; top: 0; bottom: 0; width: auto; z-index: 0;
    border-radius: inherit; background: var(--blue);
    opacity: 0; transition: opacity var(--dur-fast) ease;
  }
  .sidebar .nav-item.active { color: var(--white); background: rgba(184, 196, 218, 0.07); box-shadow: none; font-weight: 600; }
  .sidebar .nav-item.active svg { color: var(--white); }
  .sidebar .nav-item.active::before { opacity: 1; }
  .sidebar .nav-item.active .nav-soon { color: var(--white); background: rgba(255, 255, 255, 0.18); }
  .sidebar-footer { padding: 12px; }
  .logout-btn { height: 44px; border-radius: 10px; transition: transform 0.15s ease, background-color var(--transition), color var(--transition); }
  .logout-btn:active { transform: scale(0.95); }

  /* Closed: the narrow rail of icons. */
  .sidebar.collapsed { width: var(--rail-w); }
  .sidebar.collapsed ~ .main-content { margin-left: var(--rail-w); }
  .sidebar.collapsed .sidebar-header { flex-direction: column; justify-content: center; padding: 16px 0 12px; gap: 10px; }
  .sidebar.collapsed .sidebar-logo { gap: 0; }
  .sidebar.collapsed .sidebar-nav { align-items: center; padding: 14px 0 16px; }
  .sidebar.collapsed .nav-group { align-items: center; gap: 8px; }
  .sidebar.collapsed .nav-group-title {
    width: 32px; height: 1px; margin: 2px 0; padding: 0;
    overflow: hidden; color: transparent; background: var(--border);
  }
  .sidebar.collapsed .nav-item { width: 44px; height: 44px; padding: 0; gap: 0; justify-content: center; }
  /* The name stays for screen readers; the tooltip shows it on screen. */
  .sidebar.collapsed .nav-label, .sidebar.collapsed .logout-label {
    display: block; position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
  }
  /* "Em breve": a small dot on the corner (the tooltip says it). */
  .sidebar.collapsed .nav-soon {
    display: block; position: absolute; top: 5px; right: 5px; z-index: 2;
    width: 7px; height: 7px; padding: 0; border-radius: 50%;
    font-size: 0; color: transparent; background: var(--text-muted);
  }
  .sidebar.collapsed .nav-badge {
    position: absolute; top: -5px; right: -6px; z-index: 2;
    min-width: 18px; padding: 0 4px; font-size: 10px; line-height: 16px;
    box-shadow: 0 0 0 2px var(--bg-sidebar);
  }
  .sidebar.collapsed .sidebar-footer { display: flex; justify-content: center; padding: 14px 0; }
  .sidebar.collapsed .logout-btn { width: 44px; padding: 0; }
}
@media (min-width: 769px) and (prefers-reduced-motion: reduce) {
  .sidebar .nav-item, .sidebar .nav-item::before, .logout-btn, .sidebar-toggle svg { transition: none; }
  .sidebar .nav-item:hover, .sidebar .nav-item:active, .logout-btn:hover, .logout-btn:active { transform: none; }
}
.nav-tooltip {
  position: fixed; z-index: 1000; pointer-events: none;
  padding: 6px 10px; border-radius: 8px;
  font-size: 13px; font-weight: 600; line-height: 1.3; white-space: nowrap;
  color: var(--text-primary); background: var(--bg-card); border: 1px solid var(--border-strong);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  transform: translateY(-50%);
}
.nav-tooltip-note { margin-left: 6px; font-weight: 500; color: var(--text-muted); }

.reports-summary { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.reports-toolbar { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 12px; margin-bottom: 10px; }
.reports-status-tabs { display: flex; gap: 6px; }
.reports-list { display: flex; flex-direction: column; gap: 10px; }
.reports-error { margin: 0 0 4px; font-size: 13px; color: var(--red); }

.report-card {
  background: var(--bg-card); border: 1px solid var(--border); border-left: 3px solid var(--border-strong);
  border-radius: var(--radius-md); overflow: hidden; transition: border-color var(--transition), background var(--transition);
}
.report-card.is-critical { border-left-color: var(--red); }
.report-card.is-warning { border-left-color: var(--orange); }
.report-card.is-info { border-left-color: var(--blue-light); }
.report-card.is-resolved { border-left-color: var(--border-strong); }
.report-card.is-resolved .report-card-main { opacity: 0.72; }
.report-card:hover, .report-card.is-expanded { background: var(--bg-card-hover); }
.report-card-main {
  display: flex; align-items: flex-start; gap: 14px; width: 100%; padding: 14px 16px;
  background: none; border: 0; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.report-card-body { display: flex; flex-direction: column; gap: 4px; flex: 1 1 auto; min-width: 0; }
.report-card-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; }
.report-client { font-size: 14.5px; font-weight: 700; color: var(--text-primary); }
.report-account { font-size: 12.5px; color: var(--text-secondary); }
.report-type { font-size: 11px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-secondary); }
.report-summary { font-size: 13.5px; line-height: 1.45; color: var(--text-primary); overflow-wrap: anywhere; }
.report-meta { font-size: 11.5px; color: var(--text-muted); }

.report-severity, .report-status, .report-platform {
  flex: 0 0 auto; padding: 3px 10px; border-radius: var(--radius-pill); font-size: 11px; font-weight: 700; white-space: nowrap;
  border: 1px solid var(--border); color: var(--text-secondary); background: var(--bg-subtle);
}
.report-severity { min-width: 68px; text-align: center; letter-spacing: 0.04em; text-transform: uppercase; }
.report-severity.is-critical { color: var(--red); border-color: rgba(239, 68, 68, 0.35); background: rgba(239, 68, 68, 0.1); }
.report-severity.is-warning { color: var(--orange); border-color: rgba(245, 158, 11, 0.35); background: rgba(245, 158, 11, 0.1); }
.report-severity.is-info { color: var(--blue-light); border-color: rgba(47, 125, 215, 0.35); background: rgba(47, 125, 215, 0.1); }
.report-status.is-open { color: var(--text-primary); border-color: var(--border-strong); }
.report-status.is-acknowledged { color: var(--blue-light); border-color: rgba(47, 125, 215, 0.35); }
.report-status.is-resolved { color: var(--green); border-color: rgba(18, 185, 129, 0.3); background: rgba(18, 185, 129, 0.08); }
.report-platform { padding: 1px 8px; font-size: 10px; font-weight: 600; background: none; color: var(--text-muted); }
.report-platform.is-google { color: var(--blue-light); border-color: rgba(47, 125, 215, 0.35); }

.report-detail { padding: 4px 16px 16px; border-top: 1px solid var(--border); }
.report-evidence { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 24px; margin: 0; }
.report-evidence-row { padding: 10px 0; border-bottom: 1px solid var(--border); min-width: 0; }
.report-evidence-row dt { font-size: 11px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-muted); }
.report-evidence-row dd { margin: 3px 0 0; font-size: 14px; font-weight: 600; color: var(--text-primary); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.report-detail-title { display: block; margin: 14px 0 6px; font-size: 11px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-muted); }
.report-campaign, .report-history-row {
  display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: 12.5px; color: var(--text-secondary);
}
.report-campaign span:first-child, .report-history-row span:first-child { color: var(--text-primary); min-width: 0; overflow-wrap: anywhere; }
.report-campaign span:last-child, .report-history-row span:last-child { flex: 0 0 auto; text-align: right; font-variant-numeric: tabular-nums; }
.report-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 14px; margin-top: 16px; }
.report-actions .report-action { flex: 0 0 auto; width: auto; }
.reports-toolbar .metrics-search { flex: 1 1 200px; }
.reports-toolbar .metrics-filter select { min-width: 130px; }

@media (max-width: 900px) {
  .reports-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .reports-toolbar { align-items: stretch; }
  .reports-toolbar .metrics-search { flex: 1 1 100%; max-width: none; }
  .reports-toolbar .metrics-filter { flex: 1 1 calc(50% - 6px); min-width: 0; }
  .reports-toolbar .metrics-filter select { width: 100%; min-width: 0; }
  .reports-toolbar .metrics-refresh { margin-left: 0; }
  .reports-status-tabs { flex: 1 1 100%; }
  .reports-status-tabs .spend-tracking-tab { flex: 1 1 0; text-align: center; }
  .report-card-main { flex-wrap: wrap; gap: 8px 10px; padding: 12px 14px; }
  .report-card-body { order: 3; flex: 1 1 100%; }
  .report-status { margin-left: auto; }
  .report-detail { padding: 2px 14px 14px; }
  .report-evidence { grid-template-columns: minmax(0, 1fr); }
  .report-campaign, .report-history-row { flex-direction: column; gap: 2px; }
  .report-campaign span:last-child, .report-history-row span:last-child { text-align: left; }
  .report-actions { justify-content: stretch; }
  .report-actions .report-action { flex: 1 1 auto; }
}

/* Detalhe do cliente: período sem veiculação — um aviso só, discreto. */
.accounts-panel-empty-period {
  margin: 0 0 16px; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-subtle); color: var(--text-secondary); font-size: 13px; line-height: 1.5;
}


/* ===========================
   DASHBOARD — [ VISÃO COMPLETA ] [ ANÚNCIOS ]
   Em Anúncios o mesmo detalhe fica só com cabeçalho, seletor, período e a
   seção de anúncios; nada é re-renderizado (app.js, applyDashboardView).
=========================== */
.dashboard-view-slot:empty,
.dashboard-ads-empty { display: none; }
.dashboard-ads-only .accounts-panel-detail-body > :not(.home-header-row):not(.dashboard-view-slot):not(.client-period-picker):not(.dashboard-ads-section),
.dashboard-ads-only > #accounts-panel-channel-spend-fallback,
#google-account-root.dashboard-ads-only > :not(.accounts-panel-back-btn):not(.home-header-row):not(.dashboard-view-slot):not(.client-period-picker):not(.home-sync-line):not(.dashboard-ads-empty) { display: none !important; }
#google-account-root.dashboard-ads-only > .dashboard-ads-empty { display: block; }
/* [ AJUSTES ] (T-106): only the header, the tabs, the period picker (T-110) and the changes. */
.dashboard-adjustments-section { display: none; }
.dashboard-adjustments-only .dashboard-adjustments-section { display: block; }
.dashboard-adjustments-only .accounts-panel-detail-body > :not(.home-header-row):not(.dashboard-view-slot):not(.client-period-picker):not(.dashboard-adjustments-section),
.dashboard-adjustments-only > #accounts-panel-channel-spend-fallback { display: none !important; }

/* ===========================
   CLIENTES — [ PAGO ] [ ORGÂNICO ]
   Pago é a tela de sempre; em Orgânico só o painel abaixo aparece. Os
   cards reusam .account-overview-card/.home-account-card (mesma borda,
   fundo, raio e tipografia) e a grade repete as 3/2/1 colunas de Pago.
=========================== */
.clients-tabs { align-self: flex-start; display: inline-flex; }
.clients-tabs .clients-tab { min-width: 96px; }
/* Dashboard de Clientes — [ Ativos ] [ Desativados ] (T-112). */
.clients-status-tabs { margin-bottom: 12px; }
#view-overview.is-organic > .home-header-row,
#view-overview.is-organic > .home-top-row,
#view-overview.is-organic > #home-accounts-grid,
#view-overview.is-organic > .home-owner-filter { display: none; }
/* T-222: Contas → filtro por gestor (abaixo do Total Investido). */
.home-owner-filter { align-self: flex-start; display: inline-flex; flex-wrap: wrap; max-width: 100%; }
.home-owner-filter.hidden { display: none; }
/* Own class (not .period-btn): the period code toggles every .period-btn. */
.home-owner-btn { border: 0; background: transparent; cursor: pointer; border-radius: 9px; padding: 7px 14px; font-size: 13px; font-weight: 500; color: var(--text-secondary); font-family: inherit; }
.home-owner-btn:hover { color: var(--text-primary); background: rgba(184, 196, 218, 0.07); }
.home-owner-btn.is-on { background: var(--blue); color: var(--white); font-weight: 600; box-shadow: 0 2px 8px -4px rgba(47, 125, 215, 0.6); }

/* Controle de Gastos: [ Meta Ads ] [ Google Ads ] — as mesmas abas, com o
   contador discreto ao lado do nome (vazio enquanto os dados não chegaram). */
.spend-platform-count { margin-left: 8px; font-size: 11px; font-weight: 500; opacity: 0.75; }
.spend-platform-count:empty { display: none; }
.spend-google-account-name { display: block; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.clients-organic-pane { display: flex; flex-direction: column; gap: var(--space-section); min-width: 0; }
.organic-top-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.organic-top-row .home-sync-line { min-width: 0; white-space: normal; }
.organic-clients-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; padding: 0; }
.organic-client-card { padding: 18px 20px; min-width: 0; }
.organic-client-card .home-account-name-wrap { padding-right: 0; }
.organic-ig-label { font-size: 10px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-muted); }
.organic-ig-list { display: flex; flex-direction: column; gap: 10px; }
.organic-ig-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-subtle); min-width: 0; }
.organic-ig-avatar { width: 36px; height: 36px; font-size: 12px; }
.organic-ig-text { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.organic-ig-handle { font-size: 13px; font-weight: 700; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.organic-ig-name { font-size: 12px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.organic-ig-meta { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.organic-media-stats .organic-ig-meta { white-space: normal; }
.organic-ig-open { align-self: center; flex: none; white-space: nowrap; padding: 6px 0; }
.organic-ig-empty { display: flex; flex-direction: column; gap: 4px; padding: 12px; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); }
.organic-ig-empty-title { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.organic-ig-empty-reason { font-size: 11.5px; color: var(--text-muted); overflow-wrap: anywhere; }

/* Página de uma conta do Instagram */
.organic-sync-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.organic-sync-row .home-sync-line { white-space: normal; }
.organic-media-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; padding: 20px 24px 24px; }
.organic-media-card { display: flex; flex-direction: column; min-width: 0; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-subtle); overflow: hidden; color: inherit; text-decoration: none; transition: border-color var(--transition); }
a.organic-media-card:hover { border-color: var(--border-strong); }
a.organic-media-card:focus-visible { outline: 2px solid var(--blue-light); outline-offset: 2px; }
.organic-media-thumb { position: relative; aspect-ratio: 4 / 5; background: var(--bg-input); display: flex; align-items: center; justify-content: center; }
/* Sem miniatura (a API não devolveu, ou a imagem expirou): o texto abaixo fica à mostra. */
.organic-media-thumb::before { content: 'Sem prévia'; font-size: 11px; color: var(--text-muted); }
.organic-media-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.organic-media-type { position: absolute; left: 8px; top: 8px; padding: 3px 8px; border-radius: var(--radius-pill); background: rgba(2, 11, 34, 0.78); color: var(--text-primary); font-size: 10px; font-weight: 700; letter-spacing: 0.04em; }
.organic-media-body { display: flex; flex-direction: column; gap: 8px; padding: 12px; min-width: 0; }
.organic-media-date { font-size: 11px; color: var(--text-muted); }
.organic-media-caption { margin: 0; font-size: 12px; line-height: 1.45; color: var(--text-secondary); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.organic-media-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; }
.organic-media-stat { min-width: 0; }
.organic-media-stat .aok-value { font-size: 14px; }

@media (max-width: 1199px) {
  .organic-media-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
/* Cards estreitos (3 colunas até 1199px, 2 colunas no tablet): o
   "Visualizar" desce para a linha de baixo e o perfil fica com a largura
   toda — medido: ao lado, o @ e o ID eram cortados. */
@media (min-width: 640px) and (max-width: 1199px) {
  .organic-ig-row { flex-wrap: wrap; }
  .organic-ig-open { flex: 1 1 100%; text-align: left; padding: 2px 0 0; }
}
@media (max-width: 1023px) {
  .organic-clients-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 767px) {
  .clients-tabs { align-self: stretch; display: flex; }
  .clients-tabs .clients-tab { flex: 1 1 0; }
  .organic-top-row { flex-direction: column-reverse; align-items: stretch; }
  .organic-media-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 16px; }
}
@media (max-width: 639px) {
  .organic-clients-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
}

/* ─── Visão Geral (T-025) ─────────────────────────────────────────────── */
.go-head {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 18px;
}

.go-greeting {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 18px;
  overflow-wrap: anywhere;
}

.go-kpi-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 18px;
}

.go-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.go-empty {
  padding: 18px 24px;
  font-size: 14px;
  color: var(--text-secondary);
}

/* "Contas em atenção": 7 / 10 (T-055) */
.go-kpi-total {
  font-size: 0.6em;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0;
}

/* "Contas que pedem atenção" (T-054, visual T-055): avatar, name, the
   reason in a red pill and an outlined "Revisar", thin dividers. */
.go-attention-list {
  list-style: none;
  margin: 0;
  padding: 0 24px 8px;
}

.go-attention-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}
.go-attention-item:first-child { border-top: none; }

.go-attention-avatar {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--white);
}

.go-attention-name {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.go-attention-tag {
  flex-shrink: 0;
  max-width: 45%;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.go-retry {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* Vermelho só para Crítico; Atenção em laranja (T-070). */
.go-attention-tag.is-critical { color: var(--red); background: var(--red-glow); }
.go-attention-tag.is-attention { color: var(--orange); background: var(--orange-glow); }

.go-review-btn {
  flex-shrink: 0;
  padding: 5px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: transparent;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: border-color var(--transition), color var(--transition);
}
.go-review-btn:hover { border-color: var(--blue); color: var(--text-primary); }

@media (max-width: 640px) {
  .go-attention-list { padding: 0 16px 8px; }
  .go-attention-item { flex-wrap: wrap; row-gap: 8px; }
  .go-attention-name { flex-basis: calc(100% - 42px); }
  .go-attention-tag { max-width: none; margin-left: 42px; }
  .go-attention-tag + .go-review-btn { margin-left: auto; }
}

@media (max-width: 900px) {
  .go-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 640px) {
  .go-kpi-grid { grid-template-columns: minmax(0, 1fr); }
  .go-greeting { font-size: 19px; }
}

/* ─── Meu dia (T-026, estrutura) ──────────────────────────────────────── */
/* "Você ainda não fechou o dia de hoje" (T-095) */
.md-reminder {
  margin-bottom: 16px;
  padding: 12px 18px;
  border: 1px solid rgba(251, 191, 36, 0.45);
  border-radius: var(--radius-md);
  background: rgba(251, 191, 36, 0.12);
  color: var(--yellow);
  font-size: 14px;
  font-weight: 600;
}
/* T-312: on top of every screen, aligned with the views' side padding. */
.main-content > .md-reminder { margin: 24px 36px 0; }
@media (max-width: 1024px) { .main-content > .md-reminder { margin: 20px 24px 0; } }
@media (max-width: 768px) { .main-content > .md-reminder { margin: 16px 16px 0; } }

.md-progress { padding: 20px 24px; margin-bottom: 16px; }

.md-progress-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.md-progress-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.md-progress-track {
  display: block;
  height: 8px;
  border-radius: 999px;
  background: rgba(184, 196, 218, 0.1);
  overflow: hidden;
}

.md-progress-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
  transition: width 0.6s var(--ease-out); /* T-302: the bar slides to the new value */
}

.md-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  margin-bottom: 16px;
}

.md-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.md-empty {
  padding: 18px 24px;
  font-size: 14px;
  color: var(--text-secondary);
}

.md-close-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding-bottom: 20px;
}

.md-close-body .md-empty { padding-bottom: 4px; }
.md-close-btn { margin: 0 24px; }

/* Fechar o dia: formulário, aviso e "Dia fechado" (T-092) */
.md-close-form {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px 24px 0;
}

.md-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.md-field-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.md-effort {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.md-effort-btn,
.md-choice-btn {
  padding: 8px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  transition: var(--transition-ui);
}

.md-effort-btn:hover,
.md-choice-btn:hover { border-color: var(--border-strong); color: var(--text-primary); }

.md-effort-btn.is-selected,
.md-choice-btn.is-selected { background: var(--blue); border-color: var(--blue); color: white; }

.md-effort-scale {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
}

.md-choice {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 96px));
  gap: 8px;
}

.md-textarea {
  width: 100%;
  min-height: 72px;
  resize: vertical;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font: inherit;
  font-size: 13px;
  padding: 8px 10px;
  outline: none;
}

.md-textarea:focus { border-color: var(--border-focus); }

.md-close-warning {
  font-size: 12px;
  font-weight: 600;
  color: var(--orange);
}

.md-close-form .md-close-btn {
  align-self: flex-start;
  margin: 0;
  padding: 9px 18px;
  flex: none;
}

.md-closed {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 18px 24px 0;
}

.md-closed-badge {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(47, 125, 215, 0.15);
  color: var(--blue-light);
  font-size: 12px;
  font-weight: 700;
}

.md-closed-time {
  font-size: 14px;
  color: var(--text-secondary);
}

/* Editar até 23h (T-094) */
.md-closed-note {
  font-size: 12px;
  color: var(--text-muted);
}

.md-close-actions {
  display: flex;
  gap: 8px;
}

.md-closed .md-edit-btn,
.md-close-actions .md-close-btn {
  flex: none;
  margin: 0;
  padding: 9px 18px;
}

/* Diário da Equipe: lista simples dos fechamentos (T-092) */
.tj-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 16px;
}

.tj-filter {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

.tj-filter .accounts-add-input { min-width: 180px; font-size: 13px; }
/* T-262: date fields (Diário, Meu dia, Tarefas, Cowork) follow the dark
   theme: light digits, a visible calendar icon and a dark calendar popup,
   instead of the browser's light-theme native look. */
input[type="date"] { color-scheme: dark; font-variant-numeric: tabular-nums; }
input[type="date"]::-webkit-calendar-picker-indicator { opacity: .75; cursor: pointer; }
input[type="date"]::-webkit-calendar-picker-indicator:hover { opacity: 1; }

.tj-clear { flex: none; padding: 8px 14px; }

.tj-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tj-item { padding: 18px 24px; }

.tj-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.tj-who {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.tj-new {
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--green-glow);
  color: var(--green);
  font-size: 11px;
  font-weight: 700;
  vertical-align: 2px;
}

.tj-when {
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.tj-fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
}

.tj-row {
  display: grid;
  grid-template-columns: minmax(0, 200px) minmax(0, 1fr);
  gap: 12px;
  font-size: 13px;
}

.tj-row dt { color: var(--text-muted); }

.tj-row dd {
  margin: 0;
  color: var(--text-secondary);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.tj-none { color: var(--text-muted); }

@media (max-width: 640px) {
  .tj-row { grid-template-columns: minmax(0, 1fr); gap: 2px; }
}

/* Agenda de hoje / de amanhã — Google Agenda de cada usuário (T-084) */
.md-agenda-date {
  font-size: 12px;
  color: var(--text-secondary);
}

/* The three cards of the row (agendas and Avisos) are as tall as their
   own content, aligned at the top (T-132; before, T-091 stretched the
   agendas to the row's height). */
.md-agenda-today,
.md-agenda-tomorrow {
  align-self: start;
  display: flex;
  flex-direction: column;
}

.md-agenda-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.md-agenda-list {
  list-style: none;
  margin: 0;
  padding: 18px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.md-agenda-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.md-agenda-item.is-past { opacity: 1; }
/* T-267: a past appointment reads as past by its muted text (5.2:1), not by
   fading the whole row to ~3:1. */
.md-agenda-item.is-past .md-agenda-time,
.md-agenda-item.is-past .md-agenda-title { color: var(--text-muted); }

.md-agenda-time {
  flex: none;
  min-width: 52px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.md-agenda-time small {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}

.md-agenda-title {
  min-width: 0;
  font-size: 14px;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

.md-agenda-join {
  flex: none;
  margin-left: auto;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: var(--blue);
  color: white;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.md-agenda-join:hover { background: var(--blue-hover); }

.md-agenda-connect {
  display: inline-block;
  flex: none;
  align-self: flex-start;
  margin: 0 24px 20px;
  padding: 9px 18px;
  text-decoration: none;
}

/* Avisos (T-122; layout T-133): one plain line per notice with a thin
   divider — a rounded square icon tinted by the kind, one sentence with
   the account name in bold, and "Ver →" on the right (opens the account). */
.md-notices-header { justify-content: flex-start; gap: 8px; }
.md-notices-title-icon { display: inline-flex; color: var(--yellow); }

.md-notice-list {
  list-style: none;
  margin: 0;
  padding: 4px 24px 8px;
  display: flex;
  flex-direction: column;
}

.md-notice {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.md-notice:last-child { border-bottom: 0; }

.md-notice-icon {
  flex: none;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
}
.md-notice.is-critical .md-notice-icon { color: var(--red); background: var(--red-glow); }
.md-notice.is-balance .md-notice-icon { color: var(--yellow); background: rgba(251, 191, 36, 0.14); }
.md-notice.is-unverified .md-notice-icon { color: var(--text-secondary); background: rgba(184, 196, 218, 0.1); }

.md-notice-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.md-notice-sentence {
  font-size: 14px;
  line-height: 1.4;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}
.md-notice-sentence strong { font-weight: 700; }
.md-notice.is-unverified .md-notice-sentence { color: var(--text-secondary); }
.md-notice-owner { font-size: 12px; color: var(--text-secondary); }

.md-notice-open {
  flex: none;
  padding: 6px 2px;
  border: 0;
  background: transparent;
  color: var(--blue-light);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.md-notice-open:hover { color: var(--text-primary); }
.md-notice-open:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; border-radius: 4px; }

/* Tarefas do dia (T-127): "Nova tarefa" in one line (client · text ·
   button), then the list — a round check, the text with the client under
   it, and ✕ to delete. */
.md-task-new { padding: 14px 16px; margin-bottom: 16px; }

.md-task-form {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.md-task-client,
.md-task-text {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font: inherit;
  font-size: 13px;
  padding: 8px 10px;
  outline: none;
  min-width: 0;
}

.md-task-client { flex: 0 1 240px; }
.md-task-client:disabled { color: var(--text-muted); }
.md-task-text { flex: 1 1 auto; }
.md-task-text::placeholder { color: var(--text-muted); }
.md-task-client:focus,
.md-task-text:focus { border-color: var(--border-focus); }
/* T-267: these fields set outline: none; the focus also shows as the ring. */
.md-textarea:focus-visible, .md-task-client:focus-visible, .md-task-text:focus-visible { box-shadow: var(--focus-ring); }
.md-task-form .md-task-add { flex: none; padding: 8px 18px; }
.md-task-warning { margin-top: 8px; }

/* Criar no Tarefas pelo Meu dia (T-159): "Rápida | No Tarefas" over the
   form; in "No Tarefas" the form gains the due date and, with more than one
   list for the client, the list; under it where the task goes, or — for a
   client without a folder — the notice and the quick task instead. */
.md-create-modes {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  margin-bottom: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
}
.md-create-mode {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color .15s, color .15s;
}
.md-create-mode:hover { color: var(--text-primary); }
.md-create-mode.is-active { background: var(--blue-soft); color: var(--blue-soft-color); }
.md-create-mode:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }
.md-create-form { flex-wrap: wrap; }
.md-create-form .md-task-client { flex: 0 1 200px; }
.md-create-form .md-task-text { flex: 1 1 200px; }
.md-create-form .md-create-due { flex: 0 0 150px; color-scheme: dark; }
.md-create-form .md-create-list { flex: 0 1 240px; }
.md-create-hint { margin: 8px 0 0; font-size: 12px; color: var(--text-muted); }
.md-create-notice { color: var(--text-secondary); }
.md-create-quick {
  padding: 0;
  border: 0;
  background: none;
  color: var(--blue-soft-color);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.md-create-quick:hover { text-decoration: underline; }
.md-create-quick:disabled { opacity: .6; cursor: default; }

.md-task-list {
  list-style: none;
  margin: 0;
  padding: 10px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.md-task {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: var(--radius-sm);
}

.md-task:hover { background: rgba(184, 196, 218, 0.05); }

.md-task-check {
  flex: none;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-strong);
  border-radius: 50%;
  background: transparent;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: var(--transition-ui);
}

.md-task-check:hover { border-color: var(--green); }
.md-task.is-done .md-task-check { border-color: var(--green); background: var(--green); }
.md-task.is-done .md-task-check::after { content: '✓'; color: white; font-size: 12px; font-weight: 700; line-height: 1; }

.md-task-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.md-task-label {
  font-size: 14px;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}

.md-task.is-done .md-task-label { color: var(--text-muted); text-decoration: line-through; }
.md-task-client-name { font-size: 12px; color: var(--text-secondary); overflow-wrap: anywhere; }

.md-task-delete {
  flex: none;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  opacity: 0;
  transition: var(--transition-ui);
}

.md-task:hover .md-task-delete,
.md-task-delete:focus-visible { opacity: 1; }
.md-task-delete:hover { color: var(--red); background: var(--red-glow); }
.md-task-check:disabled,
.md-task-delete:disabled { cursor: progress; }

.md-close-pending { font-size: 12px; color: var(--text-secondary); }

@media (hover: none) {
  .md-task-delete { opacity: 1; }
}

@media (max-width: 900px) {
  .md-grid,
  .md-row { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 600px) {
  .md-task-form { flex-wrap: wrap; }
  .md-task-client,
  .md-task-text,
  .md-create-form .md-create-due,
  .md-create-form .md-create-list { flex: 1 1 100%; }
}

/* ─── Usuários (Admin only, T-016) ─────────────────────────────────────── */
.users-table-wrap { overflow-x: auto; }

.users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.users-table th {
  padding: 12px 24px;
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.users-table td {
  padding: 14px 24px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

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

.users-identity {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.users-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: rgba(184, 196, 218, 0.08);
}

.users-avatar-empty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--text-secondary);
}

.users-names {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.users-name {
  color: var(--text-primary);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.users-name + .users-email {
  color: var(--text-secondary);
  font-size: 13px;
}

.users-email {
  color: var(--text-primary);
  overflow-wrap: anywhere;
}

.users-optional {
  font-weight: 400;
  color: var(--text-muted);
}

.users-link-btn {
  margin-top: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--red);
}

.users-link-btn:hover { text-decoration: underline; }

.users-role {
  font-size: 11px;
  font-weight: 600;
  color: var(--blue-light);
}

.users-status {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.users-status-pending { background: rgba(245, 158, 11, 0.14); color: var(--orange); }
.users-status-approved { background: rgba(34, 197, 94, 0.14); color: #22C55E; }

.users-actions {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.users-remove-btn {
  min-height: 36px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, 0.45);
  border-radius: var(--radius-sm);
  transition: var(--transition-ui);
}

.users-remove-btn:hover:not(:disabled) { background: rgba(239, 68, 68, 0.1); }
.users-remove-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.users-remove-btn-solid { color: var(--white); background: var(--red-strong); border-color: transparent; }
.users-remove-btn-solid:hover:not(:disabled) { background: var(--red-soft); }

.users-error { margin: 16px 24px 0; }
/* T-256: "Criar acesso" in the card header keeps its own width (the shared
   .accounts-add-confirm-btn has flex: 1 and no side padding, made for the
   two-button rows). */
#users-root .section-header .accounts-add-confirm-btn { flex: none; padding: 9px 18px; font-size: 13px; }

.users-modal { max-width: 440px; }

.users-modal-text {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 18px;
}

.users-empty {
  padding: 24px;
  font-size: 14px;
  color: var(--text-secondary);
}

@media (max-width: 640px) {
  .users-table thead { display: none; }
  .users-table, .users-table tbody, .users-table tr, .users-table td { display: block; width: 100%; }
  .users-table tr { padding: 12px 16px; border-bottom: 1px solid var(--border); }
  .users-table tr:last-child { border-bottom: none; }
  .users-table td { padding: 4px 0; border-bottom: none; }
  .users-table td.text-right { text-align: left !important; padding-top: 8px; }
  .users-actions { justify-content: flex-start; }
  /* T-258: each line of the card says what it is (Cargo, Status, Cadastro,
     Aprovação), from the cell's own data-label. */
  .users-table td[data-label]:not([data-label=""]):not([data-label="Usuário"])::before {
    content: attr(data-label) ": "; color: var(--text-muted); font-size: 12px; font-weight: 600;
  }
}

/* T-241: from 641 to 1199px (narrow desktop) the six columns did not fit:
   the e-mail shrank to one letter per line and the actions were cut. The
   user column keeps 180px, cargo/status/dates stay on one line and the
   actions stack in a column. */
@media (min-width: 641px) and (max-width: 1199px) {
  .users-table th, .users-table td { padding-left: 12px; padding-right: 12px; }
  .users-table td:first-child { min-width: 180px; }
  .users-table td:nth-child(n+2):nth-child(-n+5) { white-space: nowrap; }
  .users-actions { flex-direction: column; align-items: stretch; }
  .users-actions > * { white-space: nowrap; }
}

/* ─── TAREFAS (T-146) — módulo Tarefas V1, fase 1. Visual do design T-135
   (design-previews/tarefas.css, e773838), só as peças da fase 1. Prefixo .tk-* ─── */
.tk-sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
/* ─── Shell: tree on the left, the list on the right ────────────────── */
.tk-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.tk-tree {
  position: sticky;
  top: 16px;
  padding: 14px 10px;
  max-height: calc(100vh - var(--topbar-h) - 32px);
  overflow-y: auto;
}

.tk-tree-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 6px 10px;
}
.tk-tree-title {
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--text-muted);
}

.tk-tree-nav { display: flex; flex-direction: column; gap: 2px; }
.tk-tree-space { margin-top: 2px; }

/* Tree rows: a 26px colored tile + the name (spaces, "Todas as tarefas",
   "Compartilhado comigo"); the chevron only shows on hover/focus. */
.tk-tree-item {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  min-height: 40px; padding: 6px 8px;
  border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--text-primary);
  font: inherit; font-size: 14.5px; font-weight: 500; text-align: left; text-decoration: none;
  cursor: pointer;
}
.tk-tree-item:hover { background: var(--bg-subtle); }
.tk-tree-item.is-active { background: var(--blue-soft); font-weight: 600; }
.tk-tree-item-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-tree-item-sub { color: var(--text-muted); font-weight: 400; font-size: 13px; }
.tk-tree-item .tk-chev { opacity: 0; }
.tk-tree-item:hover .tk-chev, .tk-tree-item:focus-visible .tk-chev, .tk-tree-item[aria-expanded="false"] .tk-chev { opacity: 1; }
@media (hover: none) { .tk-tree-item .tk-chev { opacity: 1; } }
.tk-tree-space + .tk-tree-space, .tk-tree-item + .tk-tree-space { margin-top: 2px; }
/* Admin (T-149): space menu (Excluir espaço) and its confirmation. */
.tk-tree-space-row { display: flex; align-items: center; gap: 2px; }
.tk-tree-space-row .tk-tree-item { flex: 1; min-width: 0; }
.tk-space-menu-btn { opacity: 0; }
.tk-tree-space-row:hover .tk-space-menu-btn, .tk-space-menu-btn:focus-visible, .tk-space-menu-btn.is-on { opacity: 1; }
@media (hover: none) { .tk-space-menu-btn { opacity: 1; } }
.tk-space-menu {
  margin: 4px 0 6px 8px; padding: 4px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-card);
}
.tk-space-menu-item {
  width: 100%; display: flex; align-items: center; gap: 8px;
  min-height: 36px; padding: 6px 8px; border: 0; border-radius: 6px;
  background: transparent; color: var(--text-primary); font: inherit; font-size: 14px; text-align: left; cursor: pointer;
}
.tk-space-menu-item:hover, .tk-space-menu-item:focus-visible { background: var(--bg-subtle); }
.tk-space-menu-item svg { flex: none; }
.tk-space-menu-item.is-danger { color: var(--red-soft); }
.tk-btn-danger { background: var(--red-strong); border-color: var(--red-strong); }
.tk-btn-danger:hover:not(:disabled) { background: var(--red-deep); border-color: var(--red-deep); }
.tk-btn-danger:disabled { opacity: 0.45; cursor: not-allowed; }
.tk-delete-form { display: flex; flex-direction: column; gap: 12px; }
.tk-delete-lead, .tk-delete-label { margin: 0; font-size: 14px; line-height: 1.5; color: var(--text-secondary); }
.tk-delete-lead strong, .tk-delete-label strong { color: var(--text-primary); overflow-wrap: anywhere; }
.tk-delete-counts {
  list-style: none; margin: 0; padding: 10px 12px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-subtle);
  font-size: 13.5px; color: var(--text-secondary);
}
.tk-delete-counts strong { color: var(--text-primary); font-variant-numeric: tabular-nums; }
.tk-delete-warning {
  margin: 0; padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1px solid rgba(239, 68, 68, 0.45); background: rgba(239, 68, 68, 0.1);
  font-size: 13.5px; line-height: 1.5; color: var(--text-primary);
}
.tk-delete-warning strong { color: var(--red-soft); }

/* Clientes das pastas (Admin, T-152): one row per folder — name and counts,
   the client picker and its own Salvar. */
.tk-tree-head [data-tk-folder-clients] { margin-left: auto; }
.tk-modal.tk-fc-modal { max-width: 720px; }
.tk-fc-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; max-height: 60vh; overflow-y: auto; }
.tk-fc-row {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(160px, 220px) auto; align-items: center; gap: 8px 12px;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-subtle);
}
.tk-fc-folder { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tk-fc-name { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--text-primary); overflow-wrap: anywhere; }
.tk-fc-meta { font-size: 12px; color: var(--text-muted); }
.tk-fc-note { align-self: flex-start; font-size: 11.5px; font-weight: 600; }
.tk-fc-note.is-suggested { color: var(--blue-light); }
.tk-fc-note.is-mixed { color: var(--orange); }
.tk-fc-note.is-done { color: var(--text-secondary); font-weight: 500; }
.tk-fc-pick { width: 100%; }
.tk-fc-save { padding: 9px 18px; white-space: nowrap; }
@media (max-width: 640px) {
  .tk-fc-row { grid-template-columns: minmax(0, 1fr) auto; }
  .tk-fc-folder { grid-column: 1 / -1; }
  .tk-fc-pick, .tk-fc-save { min-height: 44px; }
}

.tk-tile {
  flex: none; width: 26px; height: 26px; border-radius: 7px;
  display: grid; place-items: center;
  background: var(--c); color: var(--white);
}
.tk-tile.is-all { background: var(--text-primary); color: var(--purple); }
.tk-tile.is-outline { background: transparent; color: var(--text-secondary); box-shadow: inset 0 0 0 1px var(--border-strong); }

.tk-row-list { font-size: 12px; color: var(--text-muted); white-space: nowrap; }

.tk-tree-children { padding: 2px 0 6px 14px; display: flex; flex-direction: column; gap: 2px; }
.tk-tree-folder { display: flex; flex-direction: column; gap: 2px; }
.tk-tree-folder-name {
  width: 100%; display: flex; align-items: center; gap: 8px;
  min-height: 34px; padding: 6px 8px; margin-top: 2px;
  border: 0; border-radius: var(--radius-sm); background: transparent; cursor: pointer;
  font: inherit; font-size: 13.5px; font-weight: 600; color: var(--text-secondary); text-align: left;
}
.tk-tree-folder-name:hover { background: var(--bg-subtle); color: var(--text-primary); }
.tk-tree-folder-name svg { flex: none; color: var(--text-muted); }
.tk-tree-folder-name .tk-folder-teal { display: inline-flex; flex: none; }
.tk-tree-folder-name .tk-folder-teal svg { color: #14B8A6; fill: rgba(20, 184, 166, 0.25); }
.tk-tree-folder-name .tk-chev { opacity: 0; margin-left: auto; }
.tk-tree-folder-name:hover .tk-chev, .tk-tree-folder-name:focus-visible .tk-chev, .tk-tree-folder-name[aria-expanded="false"] .tk-chev { opacity: 1; }
@media (hover: none) { .tk-tree-folder-name .tk-chev { opacity: 1; } }
.tk-tree-folder-lists { display: flex; flex-direction: column; gap: 1px; margin-left: 15px; padding-left: 8px; border-left: 1px solid var(--border); }
.tk-list-icon { flex: none; display: grid; color: var(--c); }
.tk-tree-list { justify-content: flex-start; gap: 10px; }
.tk-tree-list .tk-tree-list-name { flex: 1; }


.tk-tree-list {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-height: 34px; padding: 6px 8px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary); text-decoration: none; font-size: 13.5px;
}
.tk-tree-list:hover { background: var(--bg-subtle); color: var(--text-primary); }
.tk-tree-list.is-active { background: var(--blue-soft); color: var(--text-primary); font-weight: 600; }
.tk-tree-list-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-tree-count { flex: none; font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

.tk-tree-overlay { display: none; }
.tk-head .tk-tree-open { display: none; }

/* ─── Header of the list ────────────────────────────────────────────── */
.tk-main { min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.tk-content { min-width: 0; display: flex; flex-direction: column; gap: 14px; }

.tk-head { display: flex; flex-direction: column; gap: 10px; border-bottom: 1px solid var(--border); }
.tk-head-title { min-width: 0; display: flex; align-items: center; gap: 8px; }
.tk-crumbs {
  display: flex; align-items: center; gap: 8px; min-width: 0; flex: none;
  font-size: 14px; color: var(--text-muted);
}
.tk-list-title {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: var(--font-display);
  font-size: 20px; font-weight: 800; letter-spacing: -0.015em;
  color: var(--text-primary); line-height: 1.2;
}

/* View tabs (underlined like the agency's ClickUp) */
.tk-tabs { display: flex; align-items: stretch; gap: 4px; overflow-x: auto; scrollbar-width: none; margin-bottom: -1px; }
.tk-tabs::-webkit-scrollbar { display: none; }
.tk-tab {
  flex: none; display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 10px 10px; min-height: 40px;
  background: transparent; border: 0; border-bottom: 2px solid transparent;
  color: var(--text-secondary); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
.tk-tab:hover { color: var(--text-primary); }
.tk-tab.is-on { color: var(--text-primary); border-bottom-color: var(--blue); }
.tk-tab.is-on svg { color: var(--blue-light); }
.tk-tab:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: 6px; }
.tk-tab-add { color: var(--text-muted); margin-left: 8px; }
/* Filtros salvos fixados (T-153): tabs after Lista / Kanban. */
.tk-tabs-sep { flex: none; width: 1px; margin: 8px 6px 10px; background: var(--border); }
.tk-saved-tab svg { color: var(--text-muted); }
.tk-saved-tab.is-changed::after { content: '•'; color: var(--orange); margin-left: -2px; }

.tk-icon-btn {
  flex: none; width: 30px; height: 30px; border-radius: 8px;
  display: inline-grid; place-items: center;
  background: transparent; color: var(--text-muted);
  border: 0; font: inherit; font-size: 18px; line-height: 1; cursor: pointer;
}
.tk-icon-btn:hover { background: var(--bg-subtle); color: var(--text-primary); }
.tk-icon-btn:disabled { opacity: 0.35; cursor: not-allowed; background: transparent; }
.tk-modal .tk-add-row { padding: 8px 10px; margin: 0; }

.tk-link-btn {
  background: transparent; border: 0; padding: 0;
  color: var(--blue-light); font: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; text-decoration: none;
}
.tk-link-btn:hover { text-decoration: underline; }

/* ─── Toolbar: grouping · filters · closed · me · search · settings ─── */
.tk-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; }
.tk-tb-left, .tk-tb-right { display: flex; align-items: center; gap: 6px; min-width: 0; }
.tk-tb-right { margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }
.tk-chip {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px;
  border-radius: 999px; border: 1px solid var(--border); background: transparent;
  color: var(--text-secondary); font: inherit; font-size: 13.5px; font-weight: 600; white-space: nowrap;
}
button.tk-chip { cursor: pointer; }
button.tk-chip:hover { border-color: var(--border-focus); color: var(--text-primary); }
.tk-chip.is-on { background: var(--blue-soft); border-color: rgba(47, 125, 215, 0.45); color: var(--blue-light); }
.tk-tb-icon {
  flex: none; width: 34px; height: 34px; border-radius: 8px; border: 1px solid transparent;
  display: inline-grid; place-items: center; background: transparent; color: var(--text-muted); cursor: pointer;
}
.tk-tb-icon:hover { background: var(--bg-subtle); color: var(--text-primary); }
.tk-tb-icon.is-on { color: var(--green); background: rgba(18, 185, 129, 0.12); }
.tk-tb-icon.is-boxed { border-color: var(--border); }
.tk-tb-me .tk-avatar { width: 26px; height: 26px; font-size: 10px; margin: 0; }
.tk-tb-me.is-on { background: var(--blue-soft); box-shadow: inset 0 0 0 2px var(--blue); border-radius: 999px; }
.tk-chip:focus-visible, .tk-tb-icon:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.tk-tb-sep { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }
.tk-new-btn.tk-btn { display: inline-flex; flex-direction: row; align-items: center; min-height: 34px; height: 34px; padding: 0 14px; line-height: 1; gap: 6px; }
.tk-new-btn svg { flex: none; display: block; }
.tk-tb-search { position: relative; display: inline-flex; align-items: center; }
.tk-tb-search > svg { position: absolute; left: 11px; color: var(--text-muted); pointer-events: none; }
.tk-search, .tk-search:focus { width: 260px; height: 34px; min-height: 34px; padding-left: 34px; }

.tk-filter-panel {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-md, 12px); background: var(--bg-card, transparent);
}
.tk-filter-panel .filter-select { max-width: 200px; }
.tk-filter-panel .filter-select.is-set { border-color: var(--border-focus); color: var(--text-primary); background: var(--blue-soft); }
.tk-chip-count { display: none; }

/* Construtor de filtro (T-153): groups joined by E, rows Campo / Operador /
   Valor with the trash; the 2nd row of a group picks OU / E. */
.tk-fb {
  display: flex; flex-direction: column; gap: 10px;
  padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-md, 12px); background: var(--bg-card, transparent);
}
.tk-fb-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tk-fb-title { font-size: 15px; font-weight: 700; color: var(--text-primary); }
.tk-fb-applied { font-weight: 500; color: var(--text-secondary); }
.tk-fb-saved { position: relative; }
.tk-fb-saved .tk-chip svg { margin-left: 2px; }
.tk-fb-group-wrap { display: grid; grid-template-columns: 56px minmax(0, 1fr); align-items: center; gap: 8px; }
.tk-fb-join { font-size: 13px; font-weight: 600; color: var(--text-secondary); text-align: center; }
.tk-fb-group {
  display: flex; flex-direction: column; gap: 6px;
  padding: 10px; border-radius: var(--radius-sm); background: var(--bg-subtle);
}
.tk-fb-row { display: grid; grid-template-columns: 72px minmax(120px, 1.1fr) minmax(90px, 0.7fr) minmax(140px, 1.6fr) 30px; align-items: center; gap: 6px; }
.tk-fb-row .filter-select { width: 100%; min-width: 0; max-width: none; }
.tk-fb-conn { font-size: 13px; color: var(--text-secondary); text-align: right; }
.tk-fb-conn.is-muted { color: var(--text-muted); }
.tk-fb-conn .tk-fb-op { width: 100%; }
.tk-fb-del:hover { color: var(--red-soft); }
.tk-fb-add {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 6px; border: 0; border-radius: 6px; background: transparent;
  color: var(--text-secondary); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.tk-fb-add:hover { color: var(--text-primary); background: var(--bg-subtle); }
.tk-fb-add:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.tk-fb-foot { display: flex; align-items: center; gap: 8px; }
.tk-saved-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; width: min(340px, 86vw);
  display: flex; flex-direction: column; gap: 10px; padding: 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-card);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}
.tk-saved-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; max-height: 260px; overflow-y: auto; }
.tk-saved-item { display: flex; align-items: center; gap: 2px; border-radius: 6px; }
.tk-saved-item.is-on, .tk-saved-item:hover { background: var(--bg-subtle); }
.tk-saved-open {
  flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start;
  padding: 6px 8px; border: 0; background: transparent; color: var(--text-primary); font: inherit; font-size: 14px; text-align: left; cursor: pointer;
}
.tk-saved-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.tk-saved-owner { font-size: 12px; color: var(--text-muted); }
.tk-saved-pin.is-on { color: var(--blue-light); }
.tk-saved-empty { margin: 0; font-size: 13px; color: var(--text-muted); }
.tk-saved-form { display: flex; flex-direction: column; gap: 8px; padding-top: 10px; border-top: 1px solid var(--border); }
.tk-saved-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-secondary); }
@media (max-width: 760px) {
  .tk-fb-group-wrap { grid-template-columns: minmax(0, 1fr); }
  .tk-fb-join { text-align: left; }
  .tk-fb-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 44px; }
  .tk-fb-conn { grid-column: 1 / -1; text-align: left; }
  .tk-fb-conn .tk-fb-op { width: 96px; }
  .tk-fb-row .tk-fb-value { grid-column: 1 / 3; }
  .tk-fb-row .filter-select, .tk-fb-del { min-height: 44px; }
  .tk-fb-del { width: 44px; height: 44px; }
}
#tk-toolbar-wrap { display: flex; flex-direction: column; gap: 10px; }

.tk-summary {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-size: 13px; color: var(--text-muted);
}

/* ─── Status / priority / people / dates ───────────────────────────── */
.tk-status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 700; letter-spacing: 0.02em;
  color: var(--text-primary); white-space: nowrap;
  background: color-mix(in srgb, var(--c) 18%, transparent);
  border: 1px solid color-mix(in srgb, var(--c) 50%, transparent);
}
.tk-status-pill::before,
.tk-status-dot {
  content: ''; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--c);
}
.tk-status-dot { display: inline-block; width: 10px; height: 10px; }

.tk-prio {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 14px; color: var(--text-primary); white-space: nowrap;
}
.tk-prio svg { flex: none; }
.tk-prio.is-urgent svg { color: var(--red); }
.tk-prio.is-high svg { color: var(--yellow); }
.tk-prio.is-normal svg { color: var(--blue-light); }
.tk-prio.is-low svg { color: var(--text-muted); }
.tk-prio.is-none { color: var(--text-muted); }
.tk-prio.is-none svg { color: var(--border-strong); }
.tk-due { font-size: 14px; }

.tk-due { font-size: 13px; color: var(--text-secondary); white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
.tk-due.is-late { color: var(--red); font-weight: 600; }
.tk-due.is-today { color: var(--orange); font-weight: 600; }
.tk-due.is-none { color: var(--text-muted); }

.tk-people { display: inline-flex; align-items: center; }
.tk-avatar {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  display: inline-grid; place-items: center;
  font-size: 10.5px; font-weight: 700; color: var(--text-primary);
  background: color-mix(in srgb, var(--c) 38%, var(--bg-card));
  box-shadow: 0 0 0 2px var(--bg-card), inset 0 0 0 1px var(--c);
}
.tk-people .tk-avatar + .tk-avatar { margin-left: -6px; }
.tk-avatar.is-empty { background: transparent; box-shadow: inset 0 0 0 1px var(--border-strong); color: var(--text-muted); border: 1px dashed var(--border-strong); box-shadow: none; }

.tk-client { font-size: 13px; color: var(--text-secondary); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-client.is-none { color: var(--text-muted); }

.tk-badges { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tk-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.tk-badge.is-complete { color: var(--green); }

/* ─── Lista ─────────────────────────────────────────────────────────── */
.tk-list-card { padding: 6px 0 10px; }

.tk-cols,
.tk-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 108px 150px 120px 32px;
  align-items: center;
  column-gap: 12px;
  padding: 0 16px;
}
.tk-cols {
  min-height: 36px; margin: 0 8px; padding: 0 8px;
  font-size: 13px; font-weight: 500; color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.tk-cols > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-add-col {
  width: 24px; height: 24px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; justify-self: center;
  background: var(--purple); color: var(--white);
}
.tk-add-col:hover { filter: brightness(1.12); }

.tk-caret { width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 6px solid var(--text-muted); transition: transform var(--transition); }
[aria-expanded="false"] > .tk-caret { transform: rotate(-90deg); }
.tk-status-pill.is-upper { text-transform: uppercase; letter-spacing: 0.04em; font-size: 13px; padding: 4px 12px 4px 6px; gap: 8px; border-radius: 8px; background: var(--bg-subtle); border-color: transparent; }
.tk-status-pill.is-upper::before { display: none; }
.tk-status-pill.is-upper .tk-st-icon { width: 16px; height: 16px; }

.tk-tags { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.tk-tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 9px; border-radius: var(--radius-pill);
  background: var(--c); color: var(--bg-secondary);
  font-size: 12.5px; font-weight: 600; line-height: 1.5; white-space: nowrap;
}
.tk-tag-x { border: 0; background: transparent; color: inherit; cursor: pointer; font-size: 10px; padding: 0 0 0 2px; opacity: 0.7; }
.tk-tag-x:hover { opacity: 1; }
.tk-badge.is-faint { color: var(--text-muted); opacity: 0.7; }
.tk-due-recur { display: inline-grid; color: var(--text-muted); margin-right: 10px; }
.tk-cell-due { gap: 0; }
.tk-card .tk-tags { margin-top: -2px; }

.tk-group { padding: 6px 0; }
.tk-group + .tk-group { border-top: 1px solid var(--border); }
.tk-group-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 6px 12px 6px 16px;
}
.tk-group-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  background: transparent; border: 0; padding: 4px 4px 4px 0; cursor: pointer; font: inherit;
  color: var(--text-primary);
}
.tk-group-count { font-size: 12.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

.tk-rows { list-style: none; margin: 0; padding: 0; }
.tk-row {
  min-height: 48px;
  border-radius: var(--radius-sm);
  margin: 0 8px; padding: 4px 8px;
}
.tk-row:hover { background: var(--bg-subtle); }
.tk-row.is-closed .tk-row-title { color: var(--text-muted); text-decoration: line-through; text-decoration-color: var(--border-strong); }

.tk-row-main { min-width: 0; display: flex; align-items: flex-start; gap: 10px; }
.tk-row-main > .tk-st-trigger { margin: 0 -2px; }
.tk-row-text { min-width: 0; flex: 1; display: flex; align-items: center; flex-wrap: wrap; gap: 2px 10px; }
.tk-row-title {
  min-width: 0; max-width: 100%;
  background: transparent; border: 0; padding: 4px 0; cursor: pointer;
  font: inherit; font-size: 15px; font-weight: 500; color: var(--text-primary); text-align: left;
  overflow-wrap: anywhere;
}
.tk-row-title:hover { color: var(--blue-light); }
.tk-row-meta { display: contents; }
.tk-cell { min-width: 0; display: flex; align-items: center; }

.tk-add-row {
  display: flex; align-items: center; gap: 6px;
  margin: 2px 8px 0; padding: 8px 52px; min-height: 36px;
  background: transparent; border: 0; border-radius: var(--radius-sm);
  color: var(--text-muted); font: inherit; font-size: 13px; cursor: pointer; text-align: left;
}
.tk-add-row:hover { color: var(--text-primary); background: var(--bg-subtle); }
.tk-group-empty { padding: 6px 60px; font-size: 13px; color: var(--text-muted); }

/* Quick create */
.tk-quick {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 4px 8px 6px; padding: 10px 12px;
  border: 1px solid var(--border-focus); border-radius: var(--radius-sm);
  background: var(--bg-input);
}
.tk-quick-title {
  flex: 1 1 240px; min-width: 0;
  background: transparent; border: 0; outline: none;
  color: var(--text-primary); font: inherit; font-size: 14px; padding: 6px 2px;
}
.tk-quick-title::placeholder { color: var(--text-muted); }
/* T-263: the title field has no border of its own (outline: none); the box
   around it shows the focus ring instead. */
.tk-quick:has(.tk-quick-title:focus-visible) { box-shadow: var(--focus-ring); }
.tk-quick .filter-select { min-height: 34px; max-width: 170px; font-size: 13px; }
.tk-quick-actions { display: flex; gap: 6px; margin-left: auto; }
.tk-quick-actions button { flex: none; padding: 7px 14px; }
.tk-quick.is-compact { margin: 0; flex-direction: column; align-items: stretch; }
.tk-quick.is-compact .tk-quick-title { flex: none; }
.tk-quick.is-compact .tk-quick-actions { margin-left: 0; justify-content: flex-end; }


/* ─── Kanban ────────────────────────────────────────────────────────── */
.tk-board {
  display: grid; grid-auto-flow: column; grid-auto-columns: 284px;
  gap: 12px; align-items: start;
  overflow-x: auto; padding-bottom: 12px;
  scroll-snap-type: x proximity;
}
.tk-col {
  scroll-snap-align: start;
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-top: 3px solid var(--c);
}
.tk-col-head { display: flex; align-items: center; gap: 8px; padding: 2px 2px 4px; }
.tk-col-head .tk-icon-btn { margin-left: auto; }
.tk-col-body {
  display: flex; flex-direction: column; gap: 8px;
  min-height: 72px; padding: 2px; border-radius: var(--radius-sm);
  transition: background var(--transition), box-shadow var(--transition);
}
.tk-col-body.is-over { background: var(--blue-soft); box-shadow: inset 0 0 0 1px var(--border-focus); }
.tk-col-empty {
  display: grid; place-items: center; min-height: 64px;
  border: 1px dashed var(--border-strong); border-radius: var(--radius-sm);
  font-size: 12.5px; color: var(--text-muted); text-align: center; padding: 8px;
}
.tk-col .tk-add-row { margin: 0; padding: 8px 6px; }

.tk-card {
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-card); border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  cursor: grab; user-select: none; -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.tk-card:hover { border-color: var(--border-strong); background: var(--bg-card-hover); }
.tk-card:focus-visible { outline: none; box-shadow: var(--focus-ring); border-color: var(--border-focus); }
.tk-card.is-dragging { opacity: 0.35; }
.tk-card.is-closed .tk-card-title { color: var(--text-muted); }
.tk-card-client { font-size: 11.5px; font-weight: 600; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-card-title { font-size: 14px; font-weight: 600; line-height: 1.35; color: var(--text-primary); overflow-wrap: anywhere; }
.tk-card-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tk-card-meta .tk-people { margin-left: auto; }

.tk-ghost {
  position: fixed; left: 0; top: 0; z-index: 3000; pointer-events: none;
  transform-origin: 20px 20px; rotate: 2deg;
  box-shadow: var(--shadow-pop); border-color: var(--border-focus); opacity: 0.95;
}
.tk-drop-line { height: 3px; border-radius: 2px; background: var(--blue); margin: -2px 2px; }
body.tk-dragging, body.tk-dragging * { cursor: grabbing !important; }

/* ─── Empty / loading ───────────────────────────────────────────────── */
.tk-empty {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px;
  padding: 48px 24px;
}
.tk-empty h2 { font-size: 17px; font-weight: 700; color: var(--text-primary); }
.tk-empty p { font-size: 14px; color: var(--text-secondary); max-width: 420px; }
.tk-empty .accounts-add-confirm-btn { flex: none; padding: 9px 18px; margin-top: 6px; }
.tk-skel-row { height: 40px; margin: 8px 16px; border-radius: var(--radius-sm); }
.tk-skel-line { height: 14px; margin: 10px 6px; border-radius: 6px; }

/* ─── Detalhe (painel lateral) ──────────────────────────────────────── */
.tk-drawer-overlay {
  position: fixed; inset: 0; z-index: 1100;
  background: rgba(2, 8, 24, 0.6);
}
.tk-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 1101;
  width: min(600px, 100vw);
  display: flex; flex-direction: column;
  background: var(--bg-elevated);
  border-left: 1px solid var(--border-strong);
  box-shadow: var(--shadow-pop);
}
.tk-d-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.tk-d-head-actions { display: flex; align-items: center; gap: 4px; }
.tk-d-body { flex: 1; overflow-y: auto; padding: 18px 22px 28px; display: flex; flex-direction: column; gap: 22px; }

.tk-d-title {
  width: 100%; resize: none; overflow: hidden;
  background: transparent; border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 4px 6px; margin: -4px -6px 0;
  font-family: var(--font-display); font-size: 21px; font-weight: 800; line-height: 1.3; letter-spacing: -0.01em;
  color: var(--text-primary); outline: none; field-sizing: content;
}
.tk-d-title:hover { border-color: var(--border); }
.tk-d-title:focus { border-color: var(--border-focus); background: var(--bg-input); }

.tk-props { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 6px 12px; align-items: center; margin: 0; }
.tk-props dt { font-size: 13px; color: var(--text-muted); display: flex; align-items: center; gap: 8px; min-height: 36px; }
.tk-props dd { margin: 0; min-width: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tk-prop-input {
  min-height: 36px; max-width: 100%;
  background: transparent; color: var(--text-primary);
  border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 6px 8px; font: inherit; font-size: 13.5px; color-scheme: dark; cursor: pointer;
}
.tk-prop-input:hover { border-color: var(--border); background: var(--bg-input); }
.tk-prop-input:focus { outline: none; border-color: var(--border-focus); background: var(--bg-input); }
.tk-prop-input option { background: var(--bg-elevated); color: var(--text-primary); }
.tk-prop-input.is-status {
  font-weight: 700; padding-left: 10px;
  background: color-mix(in srgb, var(--c) 18%, transparent);
  border: 1px solid color-mix(in srgb, var(--c) 50%, transparent);
  border-radius: var(--radius-pill);
}
.tk-prop-hint { font-size: 12px; color: var(--text-muted); }
.tk-chip-person {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 4px 3px 3px; border-radius: var(--radius-pill);
  background: var(--bg-subtle); font-size: 13px; color: var(--text-primary);
}
.tk-chip-person .tk-avatar { width: 22px; height: 22px; font-size: 9.5px; box-shadow: inset 0 0 0 1px var(--c); }
.tk-chip-x {
  width: 22px; height: 22px; border-radius: 50%; border: 0; background: transparent;
  color: var(--text-muted); cursor: pointer; font-size: 12px;
}
.tk-chip-x:hover { color: var(--text-primary); background: var(--bg-subtle); }

.tk-d-sec { display: flex; flex-direction: column; gap: 10px; }
.tk-d-sec-head { display: flex; align-items: center; gap: 10px; }
.tk-d-sec-title { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.tk-d-count { font-size: 12.5px; color: var(--text-muted); font-weight: 500; }
.tk-d-desc { min-height: 92px; resize: vertical; font-size: 14px; line-height: 1.5; }

.tk-progress { height: 6px; border-radius: var(--radius-pill); background: var(--bg-subtle); overflow: hidden; flex: 1; max-width: 160px; }
.tk-progress > span { display: block; height: 100%; background: var(--green); border-radius: inherit; }

.tk-sub-list, .tk-checklist, .tk-files, .tk-feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.tk-sub, .tk-check-item {
  display: flex; align-items: center; gap: 10px;
  min-height: 40px; padding: 4px 8px; border-radius: var(--radius-sm);
}
.tk-sub:hover, .tk-check-item:hover { background: var(--bg-subtle); }
.tk-sub-title, .tk-check-text { flex: 1; min-width: 0; font-size: 14px; color: var(--text-primary); overflow-wrap: anywhere; }
.tk-sub.is-done .tk-sub-title, .tk-check-item.is-done .tk-check-text { color: var(--text-muted); text-decoration: line-through; }
.tk-sub .md-task-check { width: 18px; height: 18px; }
.tk-sub.is-done .md-task-check { border-color: var(--green); background: var(--green); }
.tk-sub.is-done .md-task-check::after { content: '✓'; color: white; font-size: 11px; font-weight: 700; line-height: 1; }
.tk-check-item input { width: 16px; height: 16px; accent-color: var(--green); flex: none; cursor: pointer; }
.tk-check-item label { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; cursor: pointer; }

.tk-inline-add { display: flex; gap: 8px; }
.tk-inline-add .form-input { flex: 1; min-width: 0; min-height: 36px; padding: 7px 10px; font-size: 13.5px; }
.tk-inline-add button { flex: none; padding: 7px 14px; }

.tk-files { gap: 6px; margin-bottom: 8px; }
.tk-file {
  display: flex; align-items: center; gap: 10px; min-width: 0;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-card);
}
.tk-file-ext {
  flex: none; width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center;
  font-size: 10px; font-weight: 800; letter-spacing: 0.04em; color: var(--text-primary);
  background: color-mix(in srgb, var(--c) 28%, var(--bg-card));
}
.tk-file-info { min-width: 0; display: flex; flex-direction: column; }
.tk-file-name { font-size: 13px; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-file-size { font-size: 11.5px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* T-157: the attachments in the task detail — open by the name, download and delete on the right. */
.tk-file-info { flex: 1; }
a.tk-file-name { text-decoration: none; }
a.tk-file-name:hover, a.tk-file-name:focus-visible { color: var(--blue-light); text-decoration: underline; }
.tk-file-actions { flex: none; display: flex; align-items: center; gap: 4px; }
.tk-file-act {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px;
  color: var(--text-secondary); text-decoration: none;
}
.tk-file-act:hover, .tk-file-act:focus-visible { background: var(--bg-subtle); color: var(--text-primary); }
.tk-file-actions .tk-danger-link { padding: 6px 8px; border-radius: 8px; }
.tk-file-actions .tk-danger-link.is-confirm { background: var(--red-glow); font-weight: 700; }
.tk-dropzone.is-busy { cursor: progress; border-style: solid; color: var(--text-secondary); }
.tk-attach-error { margin: 8px 0 0; font-size: 13px; color: var(--red); overflow-wrap: anywhere; }
@media (max-width: 768px) { .tk-file-act { width: 44px; height: 44px; } }
.tk-dropzone {
  display: flex; align-items: center; justify-content: center; gap: 8px; text-align: center;
  min-height: 52px; padding: 10px; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm);
  font-size: 13px; color: var(--text-muted); cursor: pointer;
}
.tk-dropzone:hover, .tk-dropzone:focus-within { border-color: var(--border-focus); color: var(--text-secondary); }
.tk-dropzone u { color: var(--blue-light); text-decoration: none; font-weight: 600; }

.tk-feed { gap: 14px; }
.tk-comment { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 10px; }
.tk-comment-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.tk-comment-who { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.tk-comment-when { font-size: 12px; color: var(--text-muted); }
.tk-comment-text { font-size: 14px; color: var(--text-secondary); line-height: 1.5; margin-top: 2px; overflow-wrap: anywhere; }
.tk-mention { color: var(--blue-light); font-weight: 600; }
.tk-activity { font-size: 12.5px; color: var(--text-muted); padding-left: 36px; position: relative; }
.tk-activity::before { content: ''; position: absolute; left: 11px; top: 6px; width: 5px; height: 5px; border-radius: 50%; background: var(--border-strong); }

.tk-d-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--text-muted); border-top: 1px solid var(--border); padding-top: 14px; }
.tk-danger-link { background: transparent; border: 0; color: var(--red-soft); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; padding: 6px 0; }
.tk-danger-link:hover { text-decoration: underline; }

.tk-d-foot { padding: 12px 18px 14px; border-top: 1px solid var(--border); background: var(--bg-elevated); }
.tk-comment-form { display: flex; gap: 8px; align-items: flex-end; }
.tk-comment-form .form-input { flex: 1; min-width: 0; resize: none; min-height: 44px; font-size: 14px; }
.tk-comment-form button { flex: none; padding: 10px 16px; }

/* ─── Status da lista (modal) ───────────────────────────────────────── */
.tk-modal { max-width: 560px; }
.tk-structure-form { display: flex; flex-direction: column; gap: 12px; }
.tk-structure-form .tk-modal-hint { display: flex; flex-direction: column; gap: 6px; }
.tk-status-edit-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.tk-status-edit {
  display: grid; grid-template-columns: 110px minmax(0, 1fr) auto 32px;
  align-items: center; gap: 8px;
  padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-card);
}
.tk-status-edit .filter-select, .tk-status-edit .form-input { min-height: 34px; padding: 6px 8px; font-size: 13px; }
.tk-status-edit .filter-select { border-left: 4px solid var(--c); }
.tk-status-closed { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-secondary); white-space: nowrap; }
.tk-status-closed input { accent-color: var(--green); }
.tk-modal-hint { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.tk-modal .share-link-actions-row button { flex: 1; padding: 9px 16px; }

/* ─── Seletor de status (Meu dia) ───────────────────────────────────── */
.tk-st-trigger {
  flex: none; width: 32px; height: 32px; margin: -6px;
  display: grid; place-items: center;
  border: 0; border-radius: 50%; background: transparent; cursor: pointer;
}
.tk-st-trigger:hover { background: var(--bg-subtle); }
.tk-st-trigger:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.tk-st-trigger[aria-expanded="true"] { background: var(--blue-soft); }

.tk-st-icon {
  flex: none; width: 18px; height: 18px; border-radius: 50%;
  display: inline-grid; place-items: center;
  border: 2px solid var(--c);
  background: radial-gradient(circle, var(--c) 0 3.5px, transparent 4px);
}
.tk-st-icon.is-first { border-style: dashed; border-color: var(--text-muted); background: none; }
.tk-st-icon.is-closed { background: var(--c); }
.tk-st-icon.is-closed::after { content: '✓'; color: var(--white); font-size: 11px; font-weight: 800; line-height: 1; }

  font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--text-primary);
  padding: 1px 8px; border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--c) 18%, transparent);
}

.tk-pop-scrim { position: fixed; inset: 0; z-index: 1190; background: rgba(2, 8, 24, 0.6); }
.tk-pop-scrim[hidden], .tk-pop[hidden] { display: none; }
.tk-pop {
  position: fixed; z-index: 1200; left: 0; top: 0;
  width: 296px; max-height: min(460px, calc(100vh - 16px));
  display: flex; flex-direction: column;
  background: var(--bg-elevated); border: 1px solid var(--border-strong);
  border-radius: var(--radius-md); box-shadow: var(--shadow-pop);
  overflow: hidden;
}
.tk-pop-tabs { display: grid; grid-template-columns: 1fr 1fr; margin: 10px 10px 0; }
.tk-pop-tabs .period-btn { text-align: center; white-space: nowrap; }
.tk-pop-search, .tk-pop-search:focus { width: auto; margin: 8px 10px 6px; padding-left: 12px; }
.tk-pop-list { overflow-y: auto; padding: 2px 6px 8px; border-top: 1px solid var(--border); }
.tk-pop-group-title { padding: 10px 10px 4px; font-size: 12px; font-weight: 600; color: var(--text-muted); }
.tk-pop-sep { height: 1px; background: var(--border); margin: 6px -6px 0; }
.tk-pop-opt {
  display: flex; align-items: center; gap: 12px;
  min-height: 38px; padding: 6px 10px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--text-secondary); cursor: pointer;
}
.tk-pop-opt:hover, .tk-pop-opt.is-active { background: var(--bg-subtle); color: var(--text-primary); }
.tk-pop-opt.is-active { box-shadow: inset 0 0 0 1px var(--border-strong); }
.tk-pop-opt[aria-selected="true"] { color: var(--text-primary); font-weight: 800; }
.tk-pop-opt.is-type { text-transform: none; letter-spacing: 0; font-size: 14px; font-weight: 500; }
.tk-pop-opt.is-type[aria-selected="true"] { font-weight: 700; }
.tk-pop-type-icon { display: grid; place-items: center; width: 18px; color: var(--text-muted); }
.tk-pop-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-pop-check { margin-left: auto; color: var(--text-primary); display: grid; }
.tk-pop-empty { padding: 14px 10px; font-size: 13px; color: var(--text-muted); }
.tk-pop-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 12px 0 16px; }
.tk-pop-sheet-title { font-size: 14px; font-weight: 700; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 640px) {
  .tk-st-trigger { width: 44px; height: 44px; margin: -12px -10px; }
  .tk-pop {
    left: 0; right: 0; top: auto; bottom: 0; width: auto;
    max-height: 78vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border-bottom: 0; padding-bottom: env(safe-area-inset-bottom);
  }
  .tk-pop-opt { min-height: 48px; }
  .tk-pop-tabs .period-btn { min-height: 40px; }
}

/* ─── Datas e recorrência ───────────────────────────────────────────── */
.tk-due-btn {
  display: inline-flex; align-items: center; min-height: 32px; padding: 2px 6px; margin-left: -6px;
  border: 0; border-radius: var(--radius-sm); background: transparent; cursor: pointer; font: inherit; color: inherit;
}
.tk-due-btn:hover { background: var(--bg-subtle); }
.tk-due-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.tk-date-trigger { display: inline-flex; align-items: center; gap: 8px; text-align: left; }
.tk-date-trigger svg { color: var(--text-muted); flex: none; }

.tk-date {
  position: fixed; z-index: 1200; left: 0; top: 0;
  width: 640px; max-width: calc(100vw - 16px); max-height: calc(100vh - 16px); overflow-y: auto;
  background: var(--bg-elevated); border: 1px solid var(--border-strong);
  border-radius: var(--radius-md); box-shadow: var(--shadow-pop);
}
.tk-date[hidden] { display: none; }
.tk-dp-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 10px; border-bottom: 1px solid var(--border); }
.tk-dp-field { position: relative; display: flex; align-items: center; border-radius: var(--radius-sm); background: var(--bg-subtle); box-shadow: inset 0 0 0 1px transparent; }
.tk-dp-field.is-on { box-shadow: inset 0 0 0 1px var(--border-focus); background: var(--blue-soft); }
.tk-dp-field-btn {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 8px 12px; border: 0; background: transparent; cursor: pointer;
  font: inherit; font-size: 14px; color: var(--text-muted); text-align: left;
}
.tk-dp-field.is-on .tk-dp-field-btn, .tk-dp-field-btn:has(+ .tk-dp-clear) { color: var(--text-primary); }
.tk-dp-clear { border: 0; background: transparent; color: var(--text-muted); cursor: pointer; padding: 6px 10px; font-size: 12px; }
.tk-dp-clear:hover { color: var(--text-primary); }

.tk-dp-body { display: grid; grid-template-columns: 284px minmax(0, 1fr); }
.tk-dp-rec { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px 16px; border-right: 1px solid var(--border); }
.tk-dp-rec-head { display: flex; align-items: center; justify-content: space-between; }
.tk-dp-title { font-size: 15px; font-weight: 700; color: var(--text-primary); }
.tk-dp-select { width: 100%; min-height: 40px; font-size: 13.5px; }
.tk-dp-check-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tk-dp-check { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; color: var(--text-primary); cursor: pointer; line-height: 1.35; }
.tk-dp-check input { flex: none; width: 17px; height: 17px; margin-top: 1px; accent-color: var(--blue); cursor: pointer; }
.tk-dp-link { border: 0; background: transparent; color: var(--text-secondary); font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; padding: 4px; }
.tk-dp-link:hover, .tk-dp-link[aria-expanded="true"] { color: var(--blue-light); }
.tk-dp-opts { display: flex; flex-direction: column; gap: 8px; margin: 0 0 2px 27px; padding: 0; border: 0; }
.tk-dp-opts legend { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.tk-dp-opts .tk-dp-check { font-size: 13px; color: var(--text-secondary); }
.tk-dp-times { display: flex; align-items: center; gap: 8px; margin-left: 27px; font-size: 13px; color: var(--text-secondary); }
.tk-dp-times .form-input { width: 64px; min-height: 34px; padding: 6px 8px; }
.tk-dp-hint { font-size: 12.5px; color: var(--text-muted); line-height: 1.45; }
.tk-dp-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: auto; padding-top: 6px; flex-wrap: wrap; }
.tk-dp-actions .tk-danger-link { margin-right: auto; }
.tk-dp-actions .accounts-add-confirm-btn, .tk-dp-actions .accounts-add-cancel-btn { flex: none; padding: 8px 14px; }

.tk-dp-cal { padding: 14px 14px 16px; }
.tk-dp-cal-head { display: flex; align-items: center; gap: 4px; margin-bottom: 8px; }
.tk-dp-month { flex: 1; font-size: 15px; font-weight: 700; color: var(--text-primary); text-transform: lowercase; }
.tk-dp-today { border: 0; background: transparent; color: var(--text-secondary); font: inherit; font-size: 13.5px; cursor: pointer; padding: 6px 8px; border-radius: 8px; }
.tk-dp-today:hover { background: var(--bg-subtle); color: var(--text-primary); }
.tk-dp-arrow { width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-2px) rotate(45deg); }
.tk-dp-arrow.is-up { transform: translateY(2px) rotate(-135deg); }
.tk-dp-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px 2px; }
.tk-dp-wd { text-align: center; font-size: 12.5px; color: var(--text-muted); padding: 4px 0; }
.tk-dp-day {
  aspect-ratio: 1; max-height: 40px; width: 100%;
  display: grid; place-items: center;
  border: 0; border-radius: 8px; background: transparent; cursor: pointer;
  font: inherit; font-size: 14px; color: var(--text-primary); font-variant-numeric: tabular-nums;
}
.tk-dp-day:hover { background: var(--bg-subtle); }
.tk-dp-day:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.tk-dp-day.is-past, .tk-dp-day.is-out { color: var(--text-muted); }
.tk-dp-day.is-range { background: var(--bg-subtle); border-radius: 0; }
.tk-dp-day.is-next { background: color-mix(in srgb, var(--purple) 22%, transparent); color: var(--text-primary); }
.tk-dp-day.is-other { box-shadow: inset 0 0 0 1px var(--border-focus); }
.tk-dp-day.is-today { color: var(--white); font-weight: 700; background: radial-gradient(circle, var(--red) 0 15px, transparent 15.5px); }
.tk-dp-day.is-selected { background: var(--blue); color: var(--white); font-weight: 700; }
.tk-dp-day.is-selected.is-today { box-shadow: inset 0 0 0 2px var(--red); }

@media (max-width: 640px) {
  .tk-date {
    left: 0; right: 0; top: auto; bottom: 0; width: auto; max-width: none;
    max-height: 88vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; border-bottom: 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tk-dp-body { grid-template-columns: minmax(0, 1fr); }
  .tk-dp-cal { order: -1; border-bottom: 1px solid var(--border); }
  .tk-dp-rec { border-right: 0; }
  .tk-dp-day { max-height: 44px; }
  .tk-dp-check { min-height: 32px; align-items: center; }
  .tk-dp-actions { position: sticky; bottom: 0; margin: 0 -16px -16px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: var(--bg-elevated); border-top: 1px solid var(--border); }
  .tk-dp-actions button { min-height: 44px; }
}

/* Live region for drag & drop / bulk feedback */
.tk-toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 3100;
  padding: 10px 16px; border-radius: var(--radius-pill);
  background: var(--bg-elevated); border: 1px solid var(--border-strong); box-shadow: var(--shadow-pop);
  font-size: 13.5px; color: var(--text-primary); max-width: calc(100vw - 32px);
}
.tk-toast:empty { display: none; }

/* ─── Responsivo ────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .tk-cols, .tk-row { grid-template-columns: minmax(0, 1fr) 84px 118px 104px 28px; }
}

/* In the app the menu takes ~240px on the left: the tree becomes a drawer
   from 1180px down so the task name keeps its room. */
@media (max-width: 1180px) {
  .tk-shell { grid-template-columns: minmax(0, 1fr); }
  .tk-tree {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 1050;
    width: min(300px, 86vw); max-height: none; border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
    transform: translateX(-105%); transition: transform var(--transition);
    /* .section-card's fadeInUp (fill both) would pin the transform. */
    animation: none;
    padding-top: 18px;
  }
  .tk-shell.is-tree-open .tk-tree { transform: translateX(0); }
  .tk-shell.is-tree-open .tk-tree-overlay { display: block; position: fixed; inset: 0; z-index: 1040; background: rgba(2, 8, 24, 0.6); }
  .tk-head .tk-tree-open { display: inline-grid; margin-left: -6px; width: 44px; height: 44px; }
  .tk-tree-list { min-height: 44px; }
  .tk-tree-item, .tk-tree-folder-name { min-height: 44px; }
}

@media (max-width: 640px) {
  .tk-main { gap: 12px; }
  .tk-list-title { font-size: 18px; }
  .tk-crumbs { display: none; }
  .tk-tab { min-height: 44px; }
  .tk-toolbar { gap: 6px 2px; justify-content: flex-start; }
  .tk-tb-right { display: contents; }
  .tk-new-btn.tk-btn { margin-left: auto; }
  .tk-chip { padding: 0 12px; }
  .tk-chip-label { display: none; }
  .tk-chip-count { display: inline; font-variant-numeric: tabular-nums; }
  .tk-tb-icon, .tk-chip, .tk-new-btn.tk-btn { height: 44px; min-height: 44px; }
  .tk-tb-icon { width: 40px; }
  .tk-tb-sep { display: none; }
  .tk-tb-search { order: 10; flex: 1 0 100%; margin-top: 6px; }
  .tk-search, .tk-search:focus { width: 100%; height: 44px; }
  .tk-filter-panel { display: grid; grid-template-columns: 1fr 1fr; }
  .tk-filter-panel .filter-select { max-width: none; width: 100%; min-width: 0; }

  .tk-cols { display: none; }
  .tk-list-card { padding: 4px 0 8px; }
  .tk-row {
    grid-template-columns: minmax(0, 1fr);
    align-items: start; row-gap: 4px;
    margin: 0 6px; padding: 8px 8px 10px;
  }
  .tk-row + .tk-row { border-top: 1px solid var(--border); border-radius: 0; }
  .tk-row-meta { display: flex; grid-column: 1; padding-left: 32px; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
  .tk-cell-client { flex-basis: 100%; order: -1; }
  .tk-cell .tk-prio.is-none, .tk-cell .tk-due.is-none, .tk-cell .tk-client.is-none { display: none; }
  .tk-add-row { padding: 10px 14px; min-height: 44px; }
  .tk-group-empty { padding: 6px 16px; }
  .tk-group-head { padding-left: 12px; }
  .tk-group-head .tk-icon-btn, .tk-col-head .tk-icon-btn { width: 44px; height: 44px; }

  .tk-quick { flex-direction: column; align-items: stretch; margin: 4px 6px 6px; }
  .tk-quick-title { flex: none; }
  .tk-quick .filter-select { max-width: none; width: 100%; min-height: 40px; }
  .tk-quick-actions { margin-left: 0; }
  .tk-quick-actions button { flex: 1; min-height: 44px; }


  .tk-board { grid-auto-columns: 84vw; margin: 0 -16px; padding: 0 16px 12px; scroll-padding: 0 16px; }
  .tk-col .tk-add-row { min-height: 44px; }

  .tk-drawer { width: 100vw; border-left: 0; }
  .tk-d-body { padding: 16px 16px 24px; }
  .tk-props { grid-template-columns: 104px minmax(0, 1fr); }
  .tk-prop-input { min-height: 44px; }
  .tk-sub, .tk-check-item { min-height: 44px; }
  .tk-d-foot { padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); }

  .tk-status-edit { grid-template-columns: 96px minmax(0, 1fr) 36px; }
  .tk-status-closed { grid-column: 1 / -1; grid-row: 2; }
}

/* Meu dia → Tarefas do dia: the Tarefas-module items (T-151, design T-135). */
.tk-md-open {
  background: transparent; border: 0; padding: 0; text-align: left; cursor: pointer;
  font: inherit; font-size: 14px;
}
.tk-md-open:hover, .tk-md-open:focus-visible { color: var(--blue-light); }
.tk-md-sub { display: flex; align-items: center; gap: 4px 10px; flex-wrap: wrap; font-size: 12px; color: var(--text-muted); }
.tk-md-list-name { color: var(--text-muted); }
.tk-md-tag {
  flex: none; display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: var(--radius-pill);
  font-size: 11px; font-weight: 600; color: var(--blue-light); background: var(--blue-soft);
}
@media (max-width: 640px) { .tk-md-tag { display: none; } }
/* T-152: a late module task still pending; under the list, what passed the
   limit and the way to all of the person's tasks in Tarefas. */
.tk-md-late {
  align-self: flex-start; display: inline-flex; align-items: center;
  padding: 1px 8px; border-radius: var(--radius-pill);
  font-size: 11px; font-weight: 600; color: var(--red); background: var(--red-glow);
}
.tk-md-more {
  display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 4px 12px;
  margin: -8px 0 0; padding: 0 16px 14px; font-size: 13px; color: var(--text-muted);
}
.tk-md-all {
  background: transparent; border: 0; padding: 6px 0; cursor: pointer;
  font: inherit; font-weight: 600; color: var(--blue-light);
}
.tk-md-all:hover { text-decoration: underline; }
.tk-md-all:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: 4px; }

/* ── Tela de login (T-161) ────────────────────────────────────────────────
   One large rounded card in deep blue on the system's dark background: on the
   left the brand panel (CSS gradient with a light beam, logo on top, the
   phrase at the bottom); on the
   right the same e-mail + password form on the panel's dark blue, with
   labels above light-on-dark fields and a full-width button. Only
   #team-login-screen — the other setup screen keeps its look. On a phone the
   brand panel becomes a short band on top and the form takes the whole
   width. */
#team-login-screen {
  --login-navy: #061545;
  --login-text: #F2F5FC;
  --login-muted: #A9B7D6;
  --login-line: rgb(169 183 214 / 0.28);
  background: var(--bg-primary);
  padding: 32px 24px;
}
#team-login-screen .login-card {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  width: 100%; max-width: 1080px; min-height: min(620px, calc(100vh - 64px));
  background: var(--login-navy); border-radius: 24px; overflow: hidden;
  border: 1px solid rgb(169 183 214 / 0.12);
  box-shadow: 0 28px 70px -28px rgb(0 0 0 / 0.7), 0 0 0 1px rgb(0 0 0 / 0.2);
  animation: cardIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}
#team-login-screen .login-hero {
  position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 24px;
  padding: 36px 40px 40px; color: var(--white); isolation: isolate;
  background:
    radial-gradient(120% 70% at 18% 108%, rgb(0 0 0 / 0.55) 0%, transparent 55%),
    linear-gradient(118deg, transparent 38%, rgb(46 120 230 / 0.55) 50%, rgb(150 215 255 / 0.85) 58%, rgb(40 110 220 / 0.5) 63%, transparent 74%),
    radial-gradient(90% 60% at 30% 30%, #1E56C8 0%, transparent 70%),
    linear-gradient(160deg, #04103A 0%, #0A2A7A 45%, var(--bg-deep-blue) 75%, #030B26 100%);
}
#team-login-screen .login-hero::after {
  /* the soft glow of the beam */
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(118deg, transparent 47%, rgb(190 230 255 / 0.35) 56%, transparent 62%);
  filter: blur(18px);
}
#team-login-screen .login-hero-brand { display: flex; align-items: center; gap: 12px; }
/* T-163: the official logo, white on transparent (made from the file the
   user sent, not redrawn), with no tile around it. */
#team-login-screen .login-hero-logo { display: block; width: 140px; height: auto; }
#team-login-screen .login-hero-phrase {
  font-size: 30px; line-height: 1.2; font-weight: 700; letter-spacing: -0.02em; margin: 0; max-width: 420px;
  text-wrap: balance;
}
#team-login-screen .login-main {
  display: flex; flex-direction: column; justify-content: center;
  width: 100%; max-width: 440px; margin: 0 auto; padding: 48px 32px;
}
#team-login-screen .login-head { text-align: center; margin-bottom: 28px; }
#team-login-screen .login-title { text-wrap: balance; font-size: 30px; line-height: 1.15; font-weight: 800; letter-spacing: -0.025em; color: var(--login-text); margin: 0 0 10px; }
#team-login-screen .login-subtitle { font-size: 15px; color: var(--login-muted); margin: 0; }
#team-login-screen .setup-description { display: none; }
#team-login-screen .form-group { margin-bottom: 18px; }
#team-login-screen .form-label { font-size: 14px; font-weight: 600; color: var(--login-text); letter-spacing: 0; margin-bottom: 8px; }
#team-login-screen .form-input {
  background: rgb(255 255 255 / 0.06); color: var(--login-text); border: 1px solid var(--login-line); border-radius: 10px;
  font-size: 15px; padding: 13px 14px; min-height: 48px;
}
#team-login-screen .input-wrapper .form-input { padding-right: 14px; }
#team-login-screen .form-input::placeholder { color: #8293B8; }
#team-login-screen .form-input:focus { background: rgb(255 255 255 / 0.09); border-color: #6FA8FF; box-shadow: 0 0 0 3px rgb(111 168 255 / 0.25); }
#team-login-screen .form-input:-webkit-autofill { -webkit-text-fill-color: var(--login-text); -webkit-box-shadow: 0 0 0 1000px #0E2257 inset; caret-color: var(--login-text); }
#team-login-screen .setup-error { background: rgb(240 68 56 / 0.14); border-color: rgb(253 162 155 / 0.45); color: #FECDCA; margin: 4px 0 16px; }
#team-login-screen .connect-btn {
  margin-top: 10px; min-height: 52px; padding: 14px 24px; border-radius: 10px;
  background: var(--white); color: var(--bg-card-alt); font-size: 15px; font-weight: 700;
  box-shadow: 0 10px 24px -12px rgb(0 0 0 / 0.6);
}
#team-login-screen .connect-btn::before { display: none; }
#team-login-screen .connect-btn:hover:not(:disabled) { background: #E4ECFB; box-shadow: 0 12px 28px -12px rgb(0 0 0 / 0.65); }
#team-login-screen .connect-btn:focus-visible { outline: 3px solid rgb(111 168 255 / 0.6); outline-offset: 2px; }
#team-login-screen .connect-btn .btn-spinner { border-color: rgb(10 26 68 / 0.25); border-top-color: var(--bg-card-alt); }
#team-login-screen .connect-btn .btn-arrow { display: none; }

@media (max-width: 860px) {
  #team-login-screen { padding: 0; align-items: stretch; }
  #team-login-screen .login-card { grid-template-columns: 1fr; grid-template-rows: auto 1fr; min-height: 100vh; min-height: 100dvh; max-width: none; border: 0; border-radius: 0; box-shadow: none; }
  #team-login-screen .login-hero { padding: 20px 20px 22px; gap: 20px; }
  #team-login-screen .login-hero-phrase { font-size: 20px; }
  #team-login-screen .login-hero-logo { width: 110px; }
  #team-login-screen .login-main { max-width: none; justify-content: flex-start; padding: 32px 20px 40px; }
  #team-login-screen .login-title { font-size: 27px; }
  #team-login-screen .login-subtitle { font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  #team-login-screen .login-card { animation: none; }
}

/* T-160: Rolling Number nos valores em dinheiro — while a value rolls
   (app.js rnRollIn) the real text stays in place, transparent (layout,
   baseline and screen readers), with columns of digits drawn by CSS on
   top; each column clips only vertically so a wider digit passing by is
   not cut at the sides. */
.rn { position: relative; display: inline-block; }
.rn-final { color: transparent; }
.rn-roll { position: absolute; inset: 0; display: flex; pointer-events: none; white-space: pre; }
.rn-roll > span { position: relative; display: block; flex: none; }
.rn-roll > span::before { content: attr(data-c); }
.rn-col { overflow: visible clip; }
.rn-col::before { visibility: hidden; }
.rn-strip {
  position: absolute; left: 50%; top: 0; text-align: center;
  transform: translate(-50%, calc(var(--rn-d, 0) * -10%));
  transition: transform 600ms cubic-bezier(.22, .8, .24, 1);
}
.rn-strip::before { content: "0\A 1\A 2\A 3\A 4\A 5\A 6\A 7\A 8\A 9"; display: block; white-space: pre; }
@media (prefers-reduced-motion: reduce) { .rn-strip { transition: none; } }


/* ─── Tarefas: espelho do ClickUp (T-223) ─────────────────────────────── */
#view-tasks.cu-mode #tk-root,
#view-tasks.cu-mode #tasks-coming-soon { display: none !important; }
.cu-card { display: flex; flex-direction: column; gap: 12px; padding: 20px 22px; overflow: visible; }
.cu-head-actions .accounts-add-confirm-btn { padding: 9px 16px; white-space: nowrap; }
.cu-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.cu-head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cu-title { font-size: 17px; font-weight: 700; color: var(--text-primary); margin: 0; }
.cu-sub-title { font-size: 13px; color: var(--text-muted); margin: 2px 0 0; }
.cu-old-bar { display: flex; justify-content: flex-end; margin-bottom: 12px; }
.cu-toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.cu-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-muted); min-width: 170px; }
.cu-field-view { min-width: 220px; flex: 0 1 340px; } /* T-228 */
.cu-field-view select { text-overflow: ellipsis; }
.cu-field-grow { flex: 1 1 220px; }
.cu-count { font-size: 12px; color: var(--text-muted); margin: 0; }
/* Tarefas: recortes (T-232) */
.cu-cuts { display: flex; flex-wrap: wrap; gap: 6px; }
.cu-cut { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--border); background: transparent; color: var(--text-secondary); font-size: 12px; font-weight: 600; cursor: pointer; }
.cu-cut:hover { color: var(--text-primary); }
.cu-cut.is-active { background: var(--blue); border-color: var(--blue); color: var(--white); }
.cu-cut-n { font-weight: 700; opacity: .8; }
.cu-group { margin-top: 10px; }
.cu-more { display: flex; justify-content: center; margin: 10px 0 0; } /* T-233 */
.cu-empty, .cu-note { font-size: 13px; color: var(--text-secondary); margin: 0; }
.cu-error { font-size: 13px; color: var(--red, var(--red)); margin: 0; }
.cu-ok { font-size: 13px; color: var(--green); margin: 0; }
.cu-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; border-top: 1px solid var(--border); }
.cu-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 4px; border-bottom: 1px solid var(--border); }
.cu-row.is-done .cu-name { text-decoration: line-through; color: var(--text-muted); }
.cu-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 280px; }
.cu-name { font-size: 14px; color: var(--text-primary); overflow-wrap: anywhere; }
.cu-sub { color: var(--text-muted); }
.cu-path { font-size: 12px; color: var(--text-muted); overflow-wrap: anywhere; }
.cu-status { --cu-status: var(--text-muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .02em; padding: 3px 8px; border-radius: 999px; color: var(--text-primary); background: color-mix(in srgb, var(--cu-status) 22%, transparent); border: 1px solid color-mix(in srgb, var(--cu-status) 55%, transparent); white-space: nowrap; }
.cu-people { display: flex; gap: 2px; }
.cu-avatar { width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; color: var(--white); background: var(--blue); }
.cu-nobody { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.cu-due { font-size: 13px; color: var(--text-secondary); white-space: nowrap; min-width: 64px; }
.cu-due.is-late { color: var(--red, var(--red)); font-weight: 600; }
.cu-due.is-none { color: var(--text-muted); }
.cu-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; margin-left: auto; }
.cu-confirm { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-secondary); }
.cu-btn-sm { padding: 5px 10px !important; font-size: 12px !important; }
.cu-open { font-size: 12px; color: var(--blue-light); white-space: nowrap; }
.cu-done-badge { font-size: 12px; color: var(--green); font-weight: 600; }
/* Meu dia → Tarefas do dia: the ClickUp tasks of today (T-229, inside the block since T-231) */
.cu-late-badge { font-size: 11px; font-weight: 700; color: var(--red); background: var(--red-glow); border-radius: 4px; padding: 1px 6px; margin-right: 4px; }
.md-tasks.has-cu { overflow: visible; position: relative; z-index: 2; } /* the status menu is not cut nor covered */
.md-cu-body { display: flex; flex-direction: column; gap: 8px; padding: 12px var(--card-pad) 16px; }
.md-cu-group { margin: 6px 0 0; font-size: 12px; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .03em; }
.md-cu-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; }
/* Tarefas: mudar status (T-227) */
.cu-st-wrap { position: relative; display: inline-flex; }
.cu-status-btn { cursor: pointer; font-family: inherit; }
.cu-status-btn:hover:not(:disabled), .cu-status-btn:focus-visible { filter: brightness(1.2); }
.cu-st-menu { position: absolute; top: calc(100% + 6px); left: 0; z-index: 950; list-style: none; margin: 0; padding: 6px; min-width: 248px; max-height: 360px; overflow-y: auto; background: var(--bg-elevated); border: 1px solid var(--border-strong); border-radius: var(--radius-md); box-shadow: var(--shadow-pop); }
.cu-st-group { padding: 8px 10px 4px; font-size: 12px; font-weight: 600; color: var(--text-muted); }
.cu-st-sep { height: 1px; margin: 6px 4px; background: var(--border); }
.cu-st-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 36px; padding: 6px 10px; background: none; border: 0; border-radius: var(--radius-sm); color: var(--text-primary); font: inherit; font-size: 13px; font-weight: 500; text-align: left; cursor: pointer; text-transform: uppercase; letter-spacing: .03em; transition: background-color var(--dur-fast) ease; }
.cu-st-item:hover:not(:disabled), .cu-st-item:focus-visible { background: var(--bg-subtle); }
.cu-st-item.is-current { cursor: default; background: color-mix(in srgb, var(--text-secondary) 12%, transparent); font-weight: 700; }
.cu-st-item:disabled:not(.is-current) { opacity: .5; cursor: wait; }
.cu-st-name { flex: 1 1 auto; min-width: 0; }
.cu-st-check { display: inline-flex; color: var(--text-primary); flex: none; }
/* The status icon, like ClickUp: a ring in the status color; the first open
   status a dashed grey ring; a finished one a filled circle with a check. */
.cu-st-dot { --cu-dot: var(--text-muted); position: relative; width: 16px; height: 16px; border-radius: 50%; flex: none; box-sizing: border-box; border: 2px solid var(--cu-dot); background: color-mix(in srgb, var(--cu-dot) 22%, transparent); }
.cu-st-dot.is-open { border-style: dashed; border-color: var(--text-muted); background: none; }
.cu-st-dot.is-closed { border: 0; background: var(--cu-dot); }
.cu-st-dot.is-closed::after { content: ''; position: absolute; left: 5px; top: 3px; width: 4px; height: 7px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
/* List like ClickUp: status icon at the left of the name, groups headed by
   a pill with the status' icon, name and color, plus the count. */
.cu-st-wrap-icon { align-self: flex-start; margin-top: 1px; }
.cu-st-icon { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; margin: -4px 0 0 -4px; padding: 0; background: none; border: 0; border-radius: 50%; cursor: pointer; transition: background-color var(--dur-fast) ease, transform 0.16s var(--ease-out); }
.cu-st-icon:hover:not(:disabled), .cu-st-icon:focus-visible, .cu-st-icon[aria-expanded="true"] { background: var(--bg-subtle); }
.cu-st-icon.is-busy { cursor: wait; }
/* T-302: motion of the ClickUp list (Tarefas and Meu dia). Only what
   changed animates (classes put by cuMarkMotion after each redraw; rows and
   group heads that changed place slide there by FLIP in app.js); short, no
   bounce; the global prefers-reduced-motion rule cuts it. */
@media (hover: hover) and (pointer: fine) {
  .cu-st-icon:hover:not(:disabled) .cu-st-dot { transform: scale(1.12); }
}
.cu-st-icon .cu-st-dot { transition: transform 0.16s var(--ease-out); }
.cu-st-icon:active:not(:disabled) { transform: scale(0.86); }
.cu-st-icon.is-busy .cu-st-dot { animation: cuDotBusy 0.9s ease-in-out infinite; }
.cu-st-menu.is-entering { transform-origin: top left; animation: cuMenuIn 0.18s var(--ease-out); }
.cu-st-menu.is-leaving { transform-origin: top left; opacity: 0; transform: translateY(-4px) scale(0.97); transition: opacity 0.11s ease, transform 0.11s ease; pointer-events: none; }
.cu-row.is-new { animation: cuRowIn 0.26s var(--ease-out); }
.cu-st-head.is-new, .md-cu-group.is-new { animation: cuRowIn 0.26s var(--ease-out); }
.cu-list.is-switching { animation: cuListIn 0.22s var(--ease-out); }
.cu-row.is-changed { animation: cuRowLit 0.9s ease-out; }
.cu-row.is-changed .cu-st-dot, .cu-row.is-concluding .cu-st-dot { animation: cuDotPop 0.28s var(--ease-out); }
.cu-row.is-concluding { background-color: color-mix(in srgb, var(--green) 10%, transparent); transition: background-color 0.2s ease; }
.cu-row.is-concluding .cu-name { color: var(--text-muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--text-muted) 70%, transparent); }
.cu-row.is-leaving { overflow: hidden; height: 0 !important; padding-top: 0; padding-bottom: 0; opacity: 0; transform: translateX(18px); border-bottom-color: transparent; transition: height 0.24s var(--ease-out), padding 0.24s var(--ease-out), opacity 0.16s ease, transform 0.2s var(--ease-out), border-color 0.24s ease; }
.cu-d-count.is-bumped { display: inline-block; animation: cuCountBump 0.26s var(--ease-out); }
.cu-cut { transition: color var(--dur-fast) ease, transform 0.16s var(--ease-out); }
.cu-cut:active { transform: scale(0.95); }
@keyframes cuMenuIn { from { opacity: 0; transform: translateY(-6px) scale(0.95); } to { opacity: 1; transform: none; } }
@keyframes cuRowIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes cuListIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes cuRowLit { from { background-color: color-mix(in srgb, var(--blue) 24%, transparent); } to { background-color: transparent; } }
@keyframes cuDotPop { 0% { transform: scale(0.4); } 100% { transform: none; } }
@keyframes cuCountBump { from { transform: scale(1.35); color: var(--text-primary); } to { transform: none; } }
@keyframes cuDotBusy { 50% { opacity: 0.35; } }
.cu-st-head { display: flex; align-items: center; gap: 10px; margin: 14px 0 6px; }
.cu-st-pill { --cu-dot: var(--text-muted); display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 6px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--text-primary); background: color-mix(in srgb, var(--cu-dot) 18%, transparent); border: 1px solid color-mix(in srgb, var(--cu-dot) 40%, transparent); }
.cu-st-head .cu-d-count { font-size: 13px; color: var(--text-muted); }
.cu-st-note { padding: 8px 10px; font-size: 12px; color: var(--text-muted); }
@media (max-width: 760px) {
  .cu-main { flex-basis: calc(100% - 40px); }
  .cu-actions { margin-left: 0; justify-content: flex-start; }
  .cu-field { min-width: 0; flex: 1 1 140px; }
}

/* Tarefas: detalhe da tarefa (T-226) */
.cu-name-btn { background: none; border: 0; padding: 0; text-align: left; cursor: pointer; font: inherit; }
.cu-name-btn:hover, .cu-name-btn:focus-visible { color: var(--blue-light); text-decoration: underline; }
.cu-d-backdrop { position: fixed; inset: 0; background: rgba(2, 11, 34, 0.6); z-index: 900; }
.cu-d-panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(640px, 100vw); background: var(--bg-card); border-left: 1px solid var(--border-strong); z-index: 901; display: flex; flex-direction: column; box-shadow: -12px 0 32px rgba(0, 0, 0, 0.35); }
.cu-d-head { padding: 14px 20px 10px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.cu-d-head-top { display: flex; align-items: center; gap: 10px; }
.cu-d-spacer { flex: 1; }
.cu-d-close { background: none; border: 0; color: var(--text-secondary); font-size: 24px; line-height: 1; cursor: pointer; padding: 2px 6px; border-radius: 6px; }
.cu-d-close:hover { color: var(--text-primary); background: var(--bg-subtle); }
.cu-d-title { margin: 0; font-size: 18px; font-weight: 700; color: var(--text-primary); overflow-wrap: anywhere; }
.cu-d-body { padding: 14px 20px 28px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.cu-d-meta { display: flex; flex-direction: column; gap: 8px; }
.cu-d-meta-row { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 10px; align-items: center; font-size: 13px; }
.cu-d-key { color: var(--text-muted); }
.cu-d-val { color: var(--text-primary); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; overflow-wrap: anywhere; }
.cu-d-val a, .cu-d-list a { color: var(--blue-light); }
.cu-people-list { display: flex; flex-wrap: wrap; gap: 8px; }
.cu-person { display: inline-flex; align-items: center; gap: 6px; }
.cu-priority { --cu-prio: var(--text-muted); display: inline-flex; align-items: center; gap: 6px; }
.cu-priority::before { content: ""; width: 9px; height: 9px; border-radius: 2px; background: var(--cu-prio); }
.cu-tag { --cu-tag: var(--blue); font-size: 11px; padding: 2px 8px; border-radius: 4px; color: var(--text-primary); background: color-mix(in srgb, var(--cu-tag) 35%, transparent); }
.cu-d-section h4 { margin: 0 0 8px; font-size: 13px; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .03em; }
.cu-d-count { font-weight: 600; color: var(--text-muted); }
.cu-d-text { font-size: 14px; color: var(--text-primary); white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; line-height: 1.5; }
.cu-d-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cu-d-list li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--text-primary); }
.cu-d-link { background: none; border: 0; padding: 0; color: var(--blue-light); cursor: pointer; font: inherit; text-align: left; }
.cu-d-small { font-size: 12px; color: var(--text-muted); }
.cu-d-sub { margin: 0 0 4px; font-size: 13px; font-weight: 600; color: var(--text-primary); }
.cu-d-checklist ul { list-style: none; margin: 0 0 10px; padding: 0; }
.cu-d-checklist li { font-size: 13px; color: var(--text-primary); padding: 2px 0 2px calc(var(--cu-depth, 0) * 18px); }
.cu-d-checklist li.is-done { color: var(--text-muted); text-decoration: line-through; }
.cu-d-list li.cu-d-comment { display: block; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-subtle); }
.cu-d-comment .cu-d-small { margin: 0 0 4px; }
@media (max-width: 760px) { .cu-d-meta-row { grid-template-columns: 110px minmax(0, 1fr); } }
/* T-301 — detalhe da tarefa no formato do ClickUp (só leitura). Sem animação nem transição aqui. */
.cu-dx-path { margin: 0; }
.cu-dx-props { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 18px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-subtle); }
.cu-dx-prop { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 8px; align-items: center; font-size: 13px; min-width: 0; }
.cu-dx-prop-wide { grid-column: 1 / -1; }
.cu-dx-dates { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.cu-dx-date-k { font-size: 11px; color: var(--text-muted); }
.cu-dx-arrow { color: var(--text-muted); }
.cu-dx-md { font-size: 14px; line-height: 1.55; color: var(--text-primary); overflow-wrap: anywhere; }
.cu-dx-md p { margin: 0 0 8px; }
.cu-dx-md .cu-dx-md-h { font-weight: 700; margin: 12px 0 6px; }
.cu-dx-md .cu-dx-md-h1 { font-size: 18px; }
.cu-dx-md .cu-dx-md-h2 { font-size: 16px; }
.cu-dx-md .cu-dx-md-h3 { font-size: 14px; }
.cu-dx-md a { color: var(--blue-light); }
.cu-dx-md code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; padding: 1px 5px; border-radius: 4px; background: var(--bg-subtle); border: 1px solid var(--border); }
.cu-dx-md pre { margin: 0 0 8px; padding: 10px 12px; border-radius: 8px; background: var(--bg-subtle); border: 1px solid var(--border); overflow-x: auto; }
.cu-dx-md pre code { padding: 0; border: 0; background: none; white-space: pre; }
.cu-dx-md blockquote { margin: 0 0 8px; padding: 2px 0 2px 12px; border-left: 3px solid var(--border-strong); color: var(--text-secondary); }
.cu-dx-md hr { border: 0; border-top: 1px solid var(--border); margin: 12px 0; }
.cu-dx-md-list { list-style: none; margin: 0 0 8px; padding: 0; }
.cu-dx-md-list li { display: flex; gap: 8px; padding: 1px 0 1px calc(var(--cu-depth, 0) * 18px); }
.cu-dx-md-list li.is-done > span:last-child { color: var(--text-muted); text-decoration: line-through; }
.cu-dx-md-mark { color: var(--text-muted); min-width: 14px; }
.cu-dx-md-table { overflow-x: auto; margin: 0 0 8px; }
.cu-dx-md-table table { border-collapse: collapse; font-size: 13px; }
.cu-dx-md-table th, .cu-dx-md-table td { border: 1px solid var(--border); padding: 5px 8px; text-align: left; vertical-align: top; }
.cu-dx-md-table th { background: var(--bg-subtle); font-weight: 600; }
.cu-dx-subs li.cu-dx-sub { flex-wrap: nowrap; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; }
.cu-dx-sub .cu-d-link { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cu-dx-avatars { display: inline-flex; gap: 2px; }
.cu-dx-bar { display: block; height: 4px; border-radius: 4px; background: var(--border); margin: 0 0 6px; overflow: hidden; }
.cu-dx-bar > span { display: block; height: 100%; background: var(--green); }
.cu-dx-files { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.cu-dx-file { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 8px; align-items: center; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; color: var(--text-primary); text-decoration: none; }
.cu-dx-file:hover { border-color: var(--border-strong); }
.cu-dx-ext { grid-row: 1 / 3; font-size: 10px; font-weight: 700; padding: 6px 4px; min-width: 34px; text-align: center; border-radius: 6px; background: var(--bg-subtle); color: var(--text-secondary); }
.cu-dx-file-name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cu-dx-comments { border-top: 1px solid var(--border); padding-top: 14px; }
.cu-dx-comments-slot:empty { display: none; }
/* T-300: write a comment (sent to ClickUp) */
.cu-dx-comments-slot { margin-top: 12px; }
.cu-comment-form { display: flex; flex-direction: column; gap: 8px; }
.cu-comment-text { width: 100%; min-height: 64px; max-height: 240px; resize: vertical; font: inherit; }
.cu-comment-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.cu-d-list li.cu-d-comment.is-panel { border-left: 3px solid var(--blue, var(--border-strong)); }
.cu-dx-stamps { margin: 0; }
@media (max-width: 760px) { .cu-dx-props { grid-template-columns: minmax(0, 1fr); } }

/* ── COWORK (T-224) ─────────────────────────────────────────────────────
   The Chat da Equipe screen: lobby (desks on a dotted canvas, who is
   online, the team's meetings) and the room of a desk (text, shared focus,
   voice/camera). Everything under .cw / #team-cowork-root, with the
   panel's own tokens. */
#team-cowork-root { flex: 1; min-width: 0; min-height: 0; display: flex; }
#team-cowork-root > .cw { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.cw { color: var(--text-primary); font-family: var(--font-body); }
.cw-loading { margin: auto; color: var(--text-muted); padding: 40px; }
.cw-btn { border: 1px solid var(--border-strong); background: var(--bg-card); color: var(--text-primary); border-radius: var(--radius-md); padding: 8px 14px; font: inherit; font-weight: 600; cursor: pointer; transition: background var(--transition), border-color var(--transition); white-space: nowrap; }
.cw-btn:hover { background: var(--bg-card-hover); }
.cw-btn:focus-visible, .cw-desk:focus-visible, .cw-empty-btn:focus-visible, .cw-link:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.cw-btn:disabled { opacity: .6; cursor: default; }
.cw-btn--primary { background: var(--blue); border-color: var(--blue); color: var(--white); }
.cw-btn--primary:hover { background: var(--blue-hover); }
.cw-btn--small { padding: 6px 11px; font-size: 13px; }
.cw-btn--block { width: 100%; margin-top: 8px; }
.cw-btn--danger { border-color: rgba(217, 83, 79, .5); color: var(--red-light); }
.cw-btn--on { background: rgba(18, 165, 114, .16); border-color: var(--green); color: var(--green-light); }
.cw-link { background: none; border: 0; color: var(--blue-light); font: inherit; font-size: 12px; cursor: pointer; padding: 2px 4px; border-radius: 6px; }
.cw-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.cw-muted { color: var(--text-muted); margin: 4px 0; }
.cw-small { font-size: 12px; }
.cw-notice { margin: 0; padding: 8px 12px; border-radius: var(--radius-md); background: rgba(217, 130, 43, .12); border: 1px solid rgba(217, 130, 43, .35); color: var(--orange-light); font-size: 13px; }
.cw-tag { border-radius: var(--radius-pill); padding: 2px 9px; font-size: 12px; font-weight: 600; background: var(--blue-soft); color: var(--blue-light); white-space: nowrap; max-width: 140px; overflow: hidden; text-overflow: ellipsis; }
.cw-av { display: inline-grid; place-items: center; flex: none; position: relative; width: 26px; height: 26px; border-radius: 50%; font-size: 10px; font-weight: 700; color: var(--white); }
.cw-av--sm { width: 26px; height: 26px; }
.cw-av--md { width: 30px; height: 30px; font-size: 11px; }
.cw-av--lg { width: 34px; height: 34px; font-size: 12px; }
.cw-av--xl { width: 60px; height: 60px; font-size: 20px; }
.cw-av--meeting { background: var(--purple); font-size: 16px; }
.cw-av-dot { position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--bg-primary); background: var(--border-strong); }
.cw-av-dot.is-on { background: var(--green); }
.cw-av-dot.is-desk { background: var(--blue); }
/* lobby */
.cw-lobby { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 280px; }
.cw-stage { display: flex; flex-direction: column; gap: 14px; min-height: 0; padding: 20px 24px; }
.cw-top { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; }
.cw-top-text { flex: 1 1 380px; min-width: 0; }
.cw-hello { margin: 0 0 2px; color: var(--text-secondary); }
.cw-title { margin: 0; font-family: var(--font-display); font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.cw-sub { margin: 4px 0 0; color: var(--text-secondary); }
.cw-top-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.cw-meeting-chip { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; background: var(--bg-card); border: 1px solid var(--border-strong); border-radius: var(--radius-pill); padding: 6px 8px 6px 14px; font-size: 13px; }
.cw-meeting-chip.is-live { border-color: var(--purple); background: rgba(139, 124, 246, .12); }
/* T-281: a meeting that is on (or about to start) shows a live dot that
   breathes slowly — opacity only; still for whoever asked for less motion. */
.cw-meeting-chip.is-live::before { content: ''; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--purple); box-shadow: 0 0 0 4px rgba(139, 124, 246, .22); animation: cwLive 2s ease-in-out infinite; }
@keyframes cwLive { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .cw-meeting-chip.is-live::before { animation: none; } }
.cw-meeting-in { color: var(--blue-light); font-weight: 600; }
.cw-here { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 14px; border-radius: var(--radius-lg); background: var(--blue-soft); border: 1px solid var(--border-strong); }
.cw-here > span { flex: 1; min-width: 200px; }
.cw-canvas { position: relative; flex: 1; min-height: 320px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 26px; background-color: var(--bg-secondary); background-image: radial-gradient(rgba(184, 196, 218, .14) 1px, transparent 1px); background-size: 22px 22px; }
.cw-desks { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 20px; align-content: start; }
.cw-desk { display: flex; flex-direction: column; gap: 10px; text-align: left; font: inherit; color: inherit; cursor: pointer; background: var(--bg-card); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); padding: 14px; box-shadow: var(--shadow-card); transition: transform var(--transition), border-color var(--transition); }
.cw-desk:hover { transform: translateY(-2px); border-color: var(--blue); }
.cw-desk.is-mine { border-color: var(--green); }
.cw-desk.is-meeting { border-color: var(--purple); }
.cw-desk > span { display: flex; align-items: center; gap: 10px; }
.cw-desk-owner { font-weight: 600; flex: 1; min-width: 0; overflow-wrap: anywhere; } /* T-276: the whole name, never "Mesa de …" */
.cw-desk-topic { color: var(--text-secondary); min-height: 40px; display: block !important; }
.cw-desk-topic .cw-tag { display: block; width: fit-content; max-width: 100%; margin-top: 8px; } /* T-276: the client goes with the topic */
.cw-desk-seats { gap: 0 !important; }
.cw-desk-seats .cw-av { margin-right: -6px; border: 2px solid var(--bg-card); }
.cw-more { margin-left: 12px; font-size: 12px; color: var(--text-muted); }
.cw-desk-foot { font-size: 12px; color: var(--text-muted); flex-wrap: wrap; }
.cw-voice-count { color: var(--green-light); }
.cw-desk-cta { align-self: flex-start; padding: 7px 14px; border: 1px solid var(--border-strong); border-radius: var(--radius-md); background: var(--blue-soft); color: var(--blue-light); font-weight: 600; font-size: 13px; transition: var(--transition-ui); } /* T-276: reads as a button */
.cw-desk:hover .cw-desk-cta { border-color: var(--blue); color: var(--text-primary); }
.cw-focus-chip { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; font-variant-numeric: tabular-nums; color: var(--text-secondary); }
.cw-focus-chip.is-idle { color: var(--text-muted); }
.cw-ring { --p: 0; display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: conic-gradient(var(--blue) calc(var(--p) * 1%), var(--border-strong) 0); }
.cw-focus-chip.is-pausa .cw-ring, .cw-ring.is-pausa { background: conic-gradient(var(--green) calc(var(--p) * 1%), var(--border-strong) 0); }
.cw-ring--big { width: 60px; height: 60px; flex: none; }
.cw-ring--big > span { width: 48px; height: 48px; border-radius: 50%; background: var(--bg-card); display: grid; place-items: center; font-weight: 700; font-size: 12px; font-variant-numeric: tabular-nums; }
.cw-empty { position: absolute; inset: 0; display: grid; place-items: center; }
.cw-empty-btn { width: 210px; height: 210px; border-radius: 50%; border: 2px dashed var(--border-strong); background: rgba(8, 23, 53, .6); color: var(--text-secondary); font: inherit; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.cw-empty-btn:hover { border-color: var(--blue); color: var(--text-primary); }
/* T-279: every Cowork button sinks a little on press (feedback that the
   tap landed); 160ms with the strong ease-out, kept with the hover lift. */
.cw-btn { transition: background var(--transition), border-color var(--transition), transform 0.16s var(--ease-out); }
.cw-desk { transition: transform 0.16s var(--ease-out), border-color var(--transition); }
.cw-empty-btn { transition: border-color var(--transition), color var(--transition), transform 0.16s var(--ease-out); }
.cw-btn:active:not(:disabled), .cw-desk:active, .cw-empty-btn:active { transform: scale(0.97); }
/* T-280: a desk that just opened, and a message that just arrived from
   someone else, enter once (only those: the lists are rewritten whole). */
.cw-desk.is-new, .cw-msg.is-new { animation: cwItemIn 0.2s var(--ease-out); }
@keyframes cwItemIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.cw-empty-btn b { color: var(--text-primary); }
.cw-empty-plus { font-size: 28px; line-height: 1; }
.cw-rail { border-left: 1px solid var(--border); padding: 20px 16px; overflow: auto; display: flex; flex-direction: column; gap: 22px; }
.cw-rail-title { margin: 0 0 8px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); font-weight: 600; }
.cw-people, .cw-agenda { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cw-person { display: flex; align-items: center; gap: 10px; }
.cw-person > span:last-child { min-width: 0; }
.cw-person-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cw-person small, .cw-event small { display: block; color: var(--text-muted); font-size: 12px; line-height: 1.25; }
.cw-person.is-off .cw-person-name { color: var(--text-muted); }
.cw-event { display: flex; align-items: flex-start; gap: 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-card); }
.cw-event > span { flex: 1; min-width: 0; }
.cw-event b { font-size: 13px; }
.cw-event.is-live { border-color: var(--purple); }
/* room */
.cw-room { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 330px; }
.cw-room-chat { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--border); }
.cw-room-chat > #cw-notice:not(:empty) { padding: 8px 20px 0; }
.cw-room-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.cw-room-title { margin: 0; font-family: var(--font-display); font-size: 18px; }
.cw-room-topic { flex: 1; min-width: 140px; color: var(--text-secondary); }
/* T-277: the topic moved to the bar (T-230), so its empty slot no longer
   pushes "Sair"/"Fechar" to a second line: the actions sit right of the title. */
.cw-room-topic:empty { display: none; }
.cw-room-head .cw-room-title { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.cw-room-head > .cw-row { margin-left: auto; }
.cw-msgs { flex: 1; min-height: 0; overflow: auto; padding: 14px 20px; display: flex; flex-direction: column; gap: 12px; }
.cw-msg { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 10px; }
.cw-msg-who { font-weight: 600; }
.cw-msg-when { color: var(--text-muted); font-size: 12px; margin-left: 6px; }
.cw-msg-text { color: var(--text-secondary); white-space: pre-wrap; overflow-wrap: anywhere; }
.cw-sys { margin: 0; text-align: center; color: var(--text-muted); font-size: 12px; }
.cw-send { display: flex; gap: 10px; padding: 12px 20px 12px 88px; border-top: 1px solid var(--border); } /* the left gap clears the floating "Campanha por IA" button */
.cw-send textarea { flex: 1; resize: none; min-height: 42px; max-height: 140px; background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 10px 12px; color: var(--text-primary); font: inherit; }
.cw-send textarea:focus { outline: none; border-color: var(--border-focus); box-shadow: var(--focus-ring); }
.cw-panel { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 12px; }
.cw-focus { display: flex; gap: 14px; align-items: center; }
.cw-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }
.cw-tile { position: relative; aspect-ratio: 4 / 3; border-radius: var(--radius-md); background: var(--bg-primary); border: 1px solid var(--border); display: grid; place-items: center; overflow: hidden; }
.cw-tile-media { position: absolute; inset: 0; }
.cw-tile:not(.has-video) .cw-tile-media { opacity: 0; pointer-events: none; }
.cw-tile-media .cw-video { width: 100%; height: 100%; object-fit: cover; display: block; }
.cw-tile-name { position: absolute; left: 6px; bottom: 5px; font-size: 11px; background: rgba(0, 0, 0, .5); padding: 1px 6px; border-radius: 6px; }
.cw-tile-mic { position: absolute; right: 6px; bottom: 5px; font-size: 11px; }
/* T-268: muted is also shown by a red chip, not only by the emoji. */
.cw-tile-mic.is-muted { padding: 0 5px; border-radius: 6px; background: rgba(239, 68, 68, .55); }
.cw-tile-state { position: absolute; top: 5px; left: 6px; font-size: 11px; color: var(--orange-light); background: rgba(0, 0, 0, .5); padding: 1px 6px; border-radius: 6px; }
/* T-230: shared screen + per-participant volume */
/* T-234: the open room — a darker top bar with the pomodoro pill and "tô …",
   then the shared screen in a large rounded panel (system tokens only). */
.cw-room-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; padding: 14px 20px; background: var(--bg-sidebar); border-bottom: 1px solid var(--border); } /* T-277: wraps */
.cw-room-bar > #cw-focus { flex: none; }
.cw-room-bar > #cw-doing { flex: 1 1 260px; min-width: 0; } /* T-277: below the pomodoro when it would not show the topic */
.cw-pomo { display: flex; align-items: center; gap: 14px; padding: 8px 16px 8px 8px; border: 1px solid var(--border-strong); border-radius: var(--radius-pill); background: var(--bg-card); }
.cw-pomo-ring { width: 56px; height: 56px; }
.cw-pomo-ring > .cw-pomo-icon { width: 46px; height: 46px; font-size: 22px; font-weight: 400; color: var(--orange-light); background: var(--bg-sidebar); }
.cw-pomo-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.cw-pomo-label { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.cw-pomo-state { font-family: var(--font-display); font-size: 24px; font-weight: 700; color: var(--text-primary); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cw-pomo.is-idle .cw-pomo-state { color: var(--text-secondary); }
.cw-pomo-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.cw-doing { margin: 0; display: flex; align-items: baseline; gap: 10px; min-width: 0; padding: 14px 22px; border: 1px solid var(--border); border-radius: var(--radius-pill); background: var(--bg-input); font-size: 17px; }
.cw-doing-lead { color: var(--text-secondary); flex: none; }
.cw-doing-text { color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.cw-doing-client { color: var(--text-muted); opacity: .8; }
.cw-room-chat > #cw-screen:not(:empty) { padding: 14px 20px 0; }
.cw-room-chat { overflow-y: auto; } /* a short window scrolls the column instead of squeezing the conversation away */
.cw-room-chat > .cw-msgs { min-height: 140px; }
.cw-screen { position: relative; border: 1px solid var(--border-strong); border-radius: var(--radius-xl); background: var(--bg-sidebar); overflow: hidden; display: flex; flex-direction: column; }
.cw-screen.is-empty, .cw-screen.is-off { flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 16px; background: var(--bg-card); }
.cw-screen.is-off { padding-top: 52px; }
.cw-screen-empty { margin: 0; font-size: 13px; color: var(--text-muted); }
.cw-screen-tag { position: absolute; top: 12px; left: 14px; z-index: 1; padding: 6px 16px; border-radius: var(--radius-pill); background: #FFFFFF; color: #04102A; font-weight: 600; font-size: 15px; box-shadow: 0 2px 10px rgba(0, 0, 0, .35); }
.cw-screen-media { position: relative; height: min(52vh, 560px); height: min(52dvh, 560px); display: grid; place-items: center; }
.cw-screen-media .cw-video { width: 100%; height: 100%; object-fit: contain; display: block; }
.cw-screen.is-mine .cw-screen-media { height: min(30vh, 300px); height: min(30dvh, 300px); }
.cw-screen-wait { color: var(--text-muted); font-size: 13px; }
.cw-screen-tools { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.cw-screen:not(.is-empty):not(.is-off) .cw-screen-tools { padding: 8px 12px; border-top: 1px solid var(--border); justify-content: space-between; }
.cw-screen:not(.is-empty):not(.is-off) .cw-screen-tools:empty { display: none; }
.cw-tile-wrap { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cw-tile-screen { position: absolute; top: 5px; right: 6px; font-size: 12px; background: rgba(18, 165, 114, .75); padding: 0 5px; border-radius: 6px; }
.cw-volume { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text-muted); min-width: 0; }
.cw-volume input[type="range"] { flex: 1; min-width: 0; accent-color: var(--green); }
.cw-volume-value { width: 34px; text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 760px) { .cw-room-chat > #cw-screen:not(:empty) { padding: 10px 14px 0; } .cw-screen-media { height: 34vh; height: 34dvh; } .cw-room-bar { flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 10px; padding: 12px 14px; } .cw-room-bar > #cw-doing { flex: none; } .cw-doing { border-radius: var(--radius-lg); } .cw-doing-text { white-space: normal; overflow-wrap: anywhere; } .cw-pomo { flex-wrap: wrap; border-radius: var(--radius-xl); } .cw-pomo-state { font-size: 20px; } .cw-doing { padding: 11px 16px; font-size: 15px; } .cw-screen-tag { font-size: 13px; padding: 4px 12px; } }
.cw-audio-dock { position: fixed; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; left: -10px; top: -10px; }
/* modal */
.cw-modal-bg { position: fixed; inset: 0; z-index: 200; background: rgba(1, 6, 20, .72); display: flex; align-items: center; justify-content: center; padding: 16px; animation: overlayIn 0.2s ease; }
.cw-modal { width: min(520px, 100%); max-height: calc(100dvh - 32px); overflow: auto; background: var(--bg-card); border: 1px solid var(--border-strong); border-radius: var(--radius-xl); padding: 20px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow-pop); animation: modalIn 0.2s var(--ease-out); /* T-272: same entry as .modal */ }
.cw-modal h3 { margin: 0; font-family: var(--font-display); }
.cw-modal label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--text-muted); }
.cw-modal input[type="text"], .cw-modal input:not([type]), .cw-modal input[type="date"], .cw-modal input[type="time"] { background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 9px 12px; color: var(--text-primary); font: inherit; font-size: 14px; }
.cw-modal input:focus { outline: none; border-color: var(--border-focus); box-shadow: var(--focus-ring); }
.cw-fieldset { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; margin: 0; }
.cw-fieldset legend { font-size: 12px; color: var(--text-muted); padding: 0 4px; }
.cw-modal .cw-inline { flex-direction: row; align-items: center; gap: 6px; font-size: 14px; color: var(--text-primary); }
.cw-days { display: flex; gap: 6px; flex-wrap: wrap; }
.cw-modal .cw-day { flex-direction: row; gap: 0; }
.cw-day input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.cw-day span { border: 1px solid var(--border-strong); border-radius: var(--radius-pill); padding: 4px 10px; color: var(--text-secondary); font-size: 13px; cursor: pointer; }
.cw-day input:checked + span { background: var(--text-primary); color: var(--bg-primary); border-color: var(--text-primary); font-weight: 600; }
.cw-day input:focus-visible + span { box-shadow: var(--focus-ring); }
.cw-form-error { margin: 0; color: var(--red-light); font-size: 13px; }
.cw-modal-end { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
/* T-278: on phones the Cowork dialogs are a sheet that rises from the
   bottom (handle, rounded top, safe area), with 44px fields. */
@media (max-width: 640px) {
  .cw-modal-bg { align-items: flex-end; padding: 0; }
  .cw-modal { width: 100%; max-height: 92dvh; border-radius: var(--radius-xl) var(--radius-xl) 0 0; border-bottom: 0; padding: 12px 18px calc(18px + env(safe-area-inset-bottom)); animation: sheetIn 0.22s var(--ease-drawer); }
  .cw-modal::before { content: ''; flex: none; align-self: center; width: 40px; height: 4px; border-radius: var(--radius-pill); background: var(--border-strong); margin-bottom: 4px; }
  .cw-modal input[type="text"], .cw-modal input:not([type]), .cw-modal input[type="date"], .cw-modal input[type="time"] { min-height: 44px; font-size: 16px; }
}
@media (max-width: 1000px) {
  /* One column that scrolls as a whole: nothing is squeezed under the rail. */
  .cw-lobby, .cw-room { display: flex; flex-direction: column; overflow-y: auto; overflow-x: hidden; }
  .cw-stage, .cw-rail { flex: none; }
  .cw-canvas { flex: none; overflow: visible; }
  .cw-rail { border-left: 0; border-top: 1px solid var(--border); }
  .cw-room-chat { flex: none; border-right: 0; }
  .cw-room-chat > .cw-msgs { flex: none; height: 46vh; height: 46dvh; min-height: 240px; } /* T-234: the bar and the screen sit above the conversation */
}
@media (max-width: 600px) {
  .cw-stage { padding: 16px; }
  .cw-canvas { padding: 16px; }
  .cw-desks { grid-template-columns: minmax(0, 1fr); }
  .cw-room-head, .cw-msgs { padding-left: 14px; padding-right: 14px; }
  .cw-send { padding-right: 14px; }
}

/* T-321 (UX-053): the call's floating bar (mic, camera, settings,
   reaction, screen, hand, leave), drawn icons in place of the emojis, the
   conversation grouped by person and day, the lobby without the empty
   frame. On phones the call is a strip at the top and the bar stays at hand. */
.cw-foot { position: sticky; bottom: 0; z-index: 4; display: flex; flex-direction: column; border-top: 1px solid var(--border); background: var(--bg-primary); } /* stays at hand when the column scrolls (a shared screen) */
.cw-foot > .cw-send { border-top: 0; }
#cw-bar { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 20px 0; }
#cw-bar:empty { display: none; }
.cw-bar-wrap { position: relative; display: flex; justify-content: center; max-width: 100%; }
.cw-bar { --cw-bar-red: #D9614F; display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius-pill); background: #121417; border: 1px solid rgba(255, 255, 255, .09); box-shadow: 0 10px 30px rgba(0, 0, 0, .45); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.cw-bar-btn { flex: none; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; border: 0; background: #2A2D31; color: #F4F5F7; cursor: pointer; transition: background var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out); }
.cw-bar-btn:hover:not(:disabled) { background: #383C41; }
.cw-bar-btn:active:not(:disabled) { transform: scale(.92); }
.cw-bar-btn:focus-visible, .cw-bar-join:focus-visible, .cw-react-btn:focus-visible { outline: none; box-shadow: 0 0 0 2px #121417, 0 0 0 4px var(--blue-light, #7FB0EE); }
.cw-bar-btn:disabled { opacity: .45; cursor: default; }
.cw-bar-btn.is-off, .cw-bar-btn.is-danger { background: var(--cw-bar-red); color: #FFFFFF; }
.cw-bar-btn.is-off:hover:not(:disabled), .cw-bar-btn.is-danger:hover:not(:disabled) { background: #C9513F; }
.cw-bar-btn.is-active { background: #E8EEF8; color: #0B1730; }
.cw-bar-btn.is-active:hover:not(:disabled) { background: #FFFFFF; }
.cw-bar-btn.is-open { background: #45494F; }
.cw-bar-btn.is-danger { margin-left: 4px; }
.cw-bar.is-idle { padding: 6px; }
.cw-bar-join { display: inline-flex; align-items: center; gap: 8px; height: 46px; padding: 0 22px; border: 0; border-radius: var(--radius-pill); background: var(--green); color: #04201A; font: inherit; font-weight: 700; cursor: pointer; transition: transform var(--dur-fast) var(--ease-out), filter var(--dur-fast) var(--ease-out); }
.cw-bar-join:hover:not(:disabled) { filter: brightness(1.08); }
.cw-bar-join:active:not(:disabled) { transform: scale(.96); }
.cw-bar-join:disabled { opacity: .6; cursor: default; }
.cw-bar-note { margin: 0; font-size: 12px; color: var(--text-muted); text-align: center; }
.cw-bar-note.is-error { color: var(--red-light); }
.cw-bar-pop { position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translateX(-50%); z-index: 5; background: #17191D; border: 1px solid rgba(255, 255, 255, .1); border-radius: var(--radius-lg); box-shadow: 0 14px 40px rgba(0, 0, 0, .5); color: #F4F5F7; }
.cw-bar-pop.is-entering { animation: cwPopUp var(--dur-fast) var(--ease-out); }
@keyframes cwPopUp { from { opacity: 0; transform: translate(-50%, 6px); } to { opacity: 1; transform: translateX(-50%); } }
.cw-bar-pop--react { display: flex; gap: 4px; padding: 6px; border-radius: var(--radius-pill); }
.cw-react-btn { width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; font-size: 22px; cursor: pointer; transition: transform var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out); }
.cw-react-btn:hover { background: #2A2D31; transform: scale(1.12); }
.cw-react-btn:active { transform: scale(.94); }
.cw-bar-pop--settings { width: min(340px, calc(100vw - 32px)); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; max-height: 60vh; max-height: 60dvh; overflow: auto; }
.cw-bar-pop-title { margin: 4px 0 0; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: #A3A9B3; font-weight: 600; }
.cw-bar-pop-title small { text-transform: none; letter-spacing: 0; font-weight: 400; margin-left: 4px; }
.cw-bar-pop .cw-volume { display: grid; grid-template-columns: 24px 64px minmax(0, 1fr) 40px; align-items: center; gap: 8px; font-size: 13px; color: #E4E7EB; }
.cw-volume-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cw-device { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: #A3A9B3; }
.cw-device select { background: #2A2D31; color: #F4F5F7; border: 1px solid rgba(255, 255, 255, .1); border-radius: var(--radius-md); padding: 7px 10px; font: inherit; font-size: 13px; }
.cw-bar-pop .cw-muted { color: #A3A9B3; }

/* the tiles: who talks lights up, a raised hand, a reaction floats up */
.cw-tile-name { max-width: calc(100% - 40px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cw-tile { transition: box-shadow 0.12s var(--ease-out), border-color 0.12s var(--ease-out); }
.cw-tile.is-speaking { border-color: var(--green); box-shadow: 0 0 0 2px var(--green); }
.cw-tile.has-hand { border-color: var(--yellow); }
.cw-tile-mic, .cw-tile-screen, .cw-tile-hand { display: grid; place-items: center; width: 22px; height: 22px; padding: 0; border-radius: 50%; }
.cw-tile-mic.is-muted { padding: 0; background: #D9614F; color: #FFFFFF; }
.cw-tile-screen { background: rgba(18, 165, 114, .85); color: #FFFFFF; }
.cw-tile-hand { position: absolute; top: 5px; left: 6px; background: var(--yellow); color: #2A1A00; animation: cwHandUp 0.24s var(--ease-out); }
@keyframes cwHandUp { from { transform: translateY(6px); opacity: 0; } to { transform: none; opacity: 1; } }
.cw-tile.has-hand .cw-tile-state { left: 34px; }
.cw-tile-react { position: absolute; left: 50%; bottom: 18%; font-size: 30px; pointer-events: none; animation: cwReactUp 2.2s var(--ease-out) forwards; }
@keyframes cwReactUp { 0% { opacity: 0; transform: translate(-50%, 10px) scale(.8); } 12% { opacity: 1; transform: translate(-50%, 0) scale(1); } 75% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -70px); } }
.cw-call-hint { margin: 8px 0 0; }

/* drawn icons in the lobby and the pomodoro */
.cw-av--meeting svg, .cw-pomo-icon svg { display: block; }
.cw-voice-count, .cw-meeting-chip > span { display: inline-flex; align-items: center; gap: 5px; }
.cw-btn--icon { display: inline-flex; align-items: center; gap: 6px; }

/* the conversation: day lines, grouped messages, links */
.cw-day-sep { display: flex; align-items: center; gap: 10px; margin: 6px 0 0; color: var(--text-muted); font-size: 12px; font-weight: 600; }
.cw-day-sep::before, .cw-day-sep::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.cw-msg.is-cont { margin-top: -9px; }
.cw-msg-gutter { font-size: 10px; color: transparent; text-align: center; padding-top: 3px; font-variant-numeric: tabular-nums; }
.cw-msg.is-cont:hover .cw-msg-gutter { color: var(--text-muted); }
.cw-link-out { color: var(--blue-light, #7FB0EE); text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere; }
.cw-link-out:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: 3px; }

/* the lobby: the desks without the empty dotted frame; offline folded */
.cw-canvas { border: 0; background: none; padding: 4px 0 0; overflow: visible; min-height: 0; }
.cw-offline { margin-top: 12px; }
.cw-offline-sum { cursor: pointer; font-size: 12px; color: var(--text-muted); font-weight: 600; list-style: none; display: inline-flex; align-items: center; gap: 6px; padding: 4px 0; }
.cw-offline-sum::-webkit-details-marker { display: none; }
.cw-offline-sum::before { content: ''; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform var(--dur-fast) var(--ease-out); }
.cw-offline[open] > .cw-offline-sum::before { transform: rotate(45deg); }
.cw-offline > .cw-people { margin-top: 6px; }

/* the call as large tiles above the conversation (no side column) */
.cw-room { grid-template-columns: minmax(0, 1fr); }
.cw-room-chat { border-right: 0; }
.cw-room-chat > #cw-call:not(:empty) { padding: 14px 20px 0; }
.cw-call { background: none; border: 0; padding: 0; }
.cw-call .cw-tiles { display: grid; grid-template-columns: repeat(var(--cw-cols, 2), minmax(0, 1fr)); gap: 14px; margin: 0 auto; max-width: calc(var(--cw-cols, 2) * 400px); }
.cw-call--1 { --cw-cols: 1; } .cw-call--2 { --cw-cols: 2; } .cw-call--3, .cw-call--5, .cw-call--6 { --cw-cols: 3; } .cw-call--4 { --cw-cols: 4; }
.cw-call .cw-tile { aspect-ratio: 16 / 10; max-height: 30vh; max-height: 30dvh; width: 100%; border-radius: 22px; border: 1px solid rgba(255, 255, 255, .08); background: color-mix(in srgb, var(--cw-tile, #2A72C8) 26%, #15181C); }
.cw-call--5 .cw-tile, .cw-call--6 .cw-tile { max-height: 20vh; max-height: 20dvh; }
.cw-room-chat > .cw-msgs { min-height: 220px; } /* the conversation stays in view under the tiles */
.cw-call .cw-tile .cw-av--xl { width: 84px; height: 84px; font-size: 28px; box-shadow: 0 0 0 10px color-mix(in srgb, var(--cw-tile, #2A72C8) 18%, transparent); }
.cw-tile-foot { position: absolute; left: 16px; right: 16px; bottom: 14px; display: flex; align-items: center; gap: 10px; min-width: 0; }
.cw-call .cw-tile-name { position: static; max-width: none; min-width: 0; background: none; padding: 0; font-size: 16px; font-weight: 500; color: #FFFFFF; text-shadow: 0 1px 6px rgba(0, 0, 0, .45); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cw-call .cw-tile-mic.is-muted { position: static; flex: none; width: 34px; height: 34px; border-radius: 50%; padding: 0; background: #D9614F; }
.cw-call .cw-tile-hand { top: 14px; left: 16px; width: 32px; height: 32px; }
.cw-call .cw-tile-screen { top: 14px; right: 16px; width: 30px; height: 30px; }
.cw-call .cw-tile-state { top: 16px; left: 16px; }
.cw-call .cw-tile.has-hand .cw-tile-state { left: 56px; }
.cw-call .cw-tile.is-speaking { border-color: var(--green); box-shadow: 0 0 0 3px var(--green); }
.cw-call .cw-tile-react { font-size: 40px; }
/* T-326: no text chat in the room; the call fills the space above the bar */
.cw-room-chat > #cw-call { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: center; min-height: 0; }
.cw-room-chat > #cw-call:not(:empty) { padding-bottom: 14px; }
.cw-room-chat > #cw-call:has(.is-strip) { flex: none; padding-bottom: 0; } /* a shared screen takes the space */
.cw-call--1, .cw-call--2 { --cw-tile-h: 52vh; } .cw-call--3, .cw-call--4 { --cw-tile-h: 40vh; }
.cw-call .cw-tile { max-height: var(--cw-tile-h, 30vh); }
.cw-call--1 .cw-tiles { max-width: 720px; } .cw-call--2 .cw-tiles { max-width: 1100px; }
.cw-call.is-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; padding: 40px 16px; }
.cw-call-empty-title { margin: 0; font-family: var(--font-display); font-size: 18px; font-weight: 600; color: var(--text-primary); }
.cw-call.is-empty .cw-muted { margin: 0; }
.cw-call-seated { margin: 12px 0 0; display: flex; align-items: center; gap: 10px; }
.cw-foot > #cw-bar { padding-bottom: 16px; }
.cw-room-chat > .cw-foot { border-top: 0; }
@media (max-width: 1000px) { .cw-room-chat { flex: 1 0 auto; } }
@media (max-width: 600px) { .cw-call--3 { --cw-cols: 2; } .cw-call .cw-tile { max-height: none; } }
/* a screen is shared: the tiles become a strip of small ones */
.cw-call.is-strip .cw-tiles { display: flex; gap: 10px; max-width: none; overflow-x: auto; scrollbar-width: none; }
.cw-call.is-strip .cw-tile { flex: none; width: 168px; aspect-ratio: 16 / 10; max-height: none; border-radius: 16px; }
.cw-call.is-strip .cw-tile .cw-av--xl { width: 44px; height: 44px; font-size: 16px; box-shadow: none; }
.cw-call.is-strip .cw-tile-foot { left: 10px; right: 10px; bottom: 8px; gap: 6px; }
.cw-call.is-strip .cw-tile-name { font-size: 13px; }
.cw-call.is-strip .cw-tile-mic.is-muted { width: 24px; height: 24px; }
@media (max-width: 1000px) {
  .cw-room-chat > *:not(.cw-msgs) { flex: none; }
  .cw-room { position: relative; }
}
@media (max-width: 600px) {
  .cw-room-chat > #cw-call:not(:empty) { padding: 10px 14px 0; }
  .cw-call--4 { --cw-cols: 2; }
  .cw-call .cw-tiles { gap: 8px; }
  .cw-call .cw-tile { aspect-ratio: 1; max-height: none; border-radius: 16px; }
  .cw-call--1 .cw-tile { aspect-ratio: 16 / 9; }
  .cw-call--2 .cw-tile, .cw-call--4 .cw-tile { aspect-ratio: 4 / 3; }
  .cw-call .cw-tile .cw-av--xl { width: 48px; height: 48px; font-size: 17px; box-shadow: none; }
  .cw-tile-foot { left: 8px; right: 8px; bottom: 8px; gap: 5px; }
  .cw-call .cw-tile-name { font-size: 13px; }
  .cw-call .cw-tile-mic.is-muted { width: 24px; height: 24px; }
  .cw-call .cw-tile-hand { top: 8px; left: 8px; width: 26px; height: 26px; }
  .cw-call .cw-tile-screen { top: 8px; right: 8px; width: 24px; height: 24px; }
}
@media (max-width: 600px) {
  #cw-bar { padding: 10px 10px 0; }
  .cw-bar { gap: 6px; padding: 6px; }
  .cw-bar-btn { width: 44px; height: 44px; }
  .cw-bar-btn svg { width: 20px; height: 20px; }
}
@media (max-width: 380px) {
  .cw-bar { gap: 4px; }
  .cw-bar-btn { width: 40px; height: 40px; }
}

/* T-246: 44px touch targets on touch screens and phones for the small
   controls of Meu dia, Tarefas (ClickUp mirror) and Cowork. The check keeps
   its 20px circle; only its tappable area grows. */
@media (pointer: coarse), (max-width: 640px) {
  .cw-desk-cta { min-height: 44px; padding: 0 16px; } /* T-276 */
  .md-task-check { position: relative; }
  .md-task-check::before { content: ''; position: absolute; inset: -12px; }
  .cu-st-icon { position: relative; }
  .cu-st-icon::before { content: ''; position: absolute; inset: -8px; }
  .md-task-delete,
  .md-agenda-join,
  .cu-btn-sm,
  .cu-d-close,
  .cw-link { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px; }
}
/* T-259: same 44px on touch screens and phones for the tabs and period
   buttons (client dashboard, Contas, Controle de Gastos…), the period
   picker and the menu items. */
@media (pointer: coarse), (max-width: 640px) {
  .period-btn,
  .client-period-trigger,
  .nav-item { min-height: 44px; }
}

/* T-275: entrances that explain where things come from (only on open;
   the global prefers-reduced-motion rule cuts them). */
.cu-d-panel.is-entering { animation: cuPanelIn 0.22s var(--ease-drawer); }
.cu-d-backdrop.is-entering { animation: overlayIn 0.2s ease; }
@keyframes cuPanelIn { from { transform: translateX(100%); } to { transform: none; } }
.client-period-popover.is-entering { transform-origin: top left; animation: popIn var(--dur-fast) var(--ease-out); }
@keyframes popIn { from { opacity: 0; transform: scale(0.97); } to { opacity: 1; transform: none; } }
@media (max-width: 640px) {
  .client-period-popover.is-entering { animation: sheetIn 0.22s var(--ease-drawer); }
}
@keyframes sheetIn { from { transform: translateY(100%); } to { transform: none; } }
.tk-toast:not(:empty) { animation: toastIn 0.2s var(--ease-out); }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translateX(-50%); } }

/* T-273: the hover "lift" only with a mouse. On touch a tap leaves :hover
   stuck, so the card/button stayed raised. :not(:active) keeps the press. */
@media (hover: none), (pointer: coarse) {
  .connect-btn:hover:not(:active), .connect-btn:hover:not(:active) .btn-arrow,
  .kpi-card:hover:not(:active), .ad-card:hover:not(:active), .ad-card:hover:not(:active) .ad-card-thumb img,
  .accounts-add-confirm-btn:hover:not(:disabled):not(:active), .connect-btn:hover:not(:disabled):not(:active),
  .aic-fab:hover:not(:active), .cw-desk:hover:not(:active) { transform: none; }
}

/* ── Auditoria Meta (T-283, Admin) ───────────────────────────────────── */
#meta-audit-root .section-card + .section-card { margin-top: 16px; }
.ma-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ma-select { background: transparent; color: inherit; border: 1px solid var(--border); border-radius: 8px; padding: 4px 8px; font: inherit; }
.ma-meta, .ma-muted { color: var(--text-muted); font-size: 13px; }
.ma-muted { display: block; }
.ma-summary { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 12px 0; }
.ma-findings { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 6px; }
.ma-finding { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; }
.ma-finding-body { display: grid; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.ma-expected, .ma-where { color: var(--text-muted); font-size: 12px; }
.ma-badge { flex: none; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border); }
.ma-badge-erro { color: var(--red-light); border-color: var(--red); background: var(--red-glow); }
.ma-badge-aviso { color: #FBBF24; border-color: rgba(251, 191, 36, .6); background: rgba(251, 191, 36, .12); }
/* T-288: manual audit block */
.ma-badge-atencao { color: #93C5FD; border-color: rgba(147, 197, 253, .6); background: rgba(147, 197, 253, .12); }
.ma-badge-ok { color: #4ADE80; border-color: rgba(74, 222, 128, .6); background: rgba(74, 222, 128, .12); }
.ep-manual-channel { margin: 10px 0 4px; font-size: 13px; font-weight: 600; }
/* T-294: detail in the Leilão / Farol message format */
.ep-msg { margin: 12px 0; padding: 12px 14px; border: 1px solid var(--border, rgba(127,127,127,.25)); border-radius: 10px; font-size: 13px; line-height: 1.5; }
.ep-msg-head { margin-bottom: 6px; font-size: 14px; }
.ep-msg-line { margin: 4px 0; }
.ep-msg-item { padding-left: 12px; }
.ma-badge-info { color: var(--text-muted); }
.ma-new { flex: none; font-size: 11px; color: var(--border-focus); }
.ma-subtitle { margin: 20px 0 8px; font-size: 14px; }
.ma-node { border-left: 2px solid var(--border); padding-left: 10px; margin: 6px 0; }
.ma-node > summary { cursor: pointer; padding: 4px 0; overflow-wrap: anywhere; }
.ma-node-name { font-weight: 600; }
.ma-node-body { display: grid; gap: 6px; padding: 4px 0 8px; font-size: 13px; }
.ma-count { display: inline-block; min-width: 18px; padding: 0 6px; border-radius: 999px; background: var(--red-glow); color: var(--red-light); font-size: 11px; text-align: center; }
.ma-texts ol { margin: 4px 0 0 18px; padding: 0; }
.ma-label { color: var(--text-muted); font-size: 12px; }
.ma-notice { margin: 8px 0; color: var(--text-muted); }
.ma-newkey { display: grid; gap: 6px; margin: 12px 0; padding: 12px; border: 1px solid var(--border-focus); border-radius: 8px; }
.ma-key-value { display: block; padding: 8px; border-radius: 6px; background: rgba(0, 0, 0, .25); overflow-wrap: anywhere; user-select: all; }
.ma-log ul { margin: 6px 0 0 18px; padding: 0; font-size: 12px; color: var(--text-muted); }
.ma-week-list { margin: 4px 0 10px 18px; padding: 0; font-size: 13px; line-height: 1.5; }
.ma-week-list li { margin: 2px 0; overflow-wrap: anywhere; }
.ep-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.ep-toolbar .home-search-wrap { flex: 1 1 220px; min-width: 0; }
.ep-card { cursor: pointer; }
.ep-owner { display: block; font-size: 12px; color: var(--text-muted); }
.ep-counts { margin: 8px 0 4px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ep-line { font-size: 12px; margin: 2px 0; overflow-wrap: anywhere; }
.ep-status { font-size: 13px; font-weight: 600; }
.ep-status-ok { color: var(--success, #16a34a); }
.ep-status-none { color: var(--text-muted); font-weight: 500; }
.ep-account { margin-top: 12px; }

/* ── CHAT DA EQUIPE ─────────────────────────────────────────────────────
   Channels | conversation | members, in the dense dark layout of a team
   chat app. Everything lives under .tc with its own palette (--tc-*), so
   nothing here reaches another screen; the accent stays the panel's blue.
   While this screen is open the page itself does not scroll: the chat
   fills what is left under the top bar and scrolls inside. */
.main-content.chat-active { height: 100vh; height: 100dvh; min-height: 0; }
.main-content.chat-active .topbar { flex: none; }
.main-content.chat-active .topbar-right { display: none; }
#view-team-chat { padding: 0; gap: 0; min-height: 0; overflow: hidden; }
#team-chat-root { flex: 1; min-width: 0; min-height: 0; display: flex; }

.tc {
  --tc-bg: #2f323a; --tc-side: #282b32; --tc-deep: #1d1f25; --tc-input: #393d47; --tc-float: #22242a;
  --tc-hover: rgba(255, 255, 255, 0.05); --tc-active: rgba(255, 255, 255, 0.1); --tc-msg-hover: rgba(0, 0, 0, 0.13);
  --tc-line: rgba(255, 255, 255, 0.07);
  --tc-text: #dcdee3; --tc-strong: #f4f5f7; --tc-muted: #9ba1ac; --tc-faint: #7d838e;
  --tc-accent: var(--blue); --tc-accent-hover: var(--blue-hover); --tc-link: #6fabf3; --tc-danger: #f0494c; --tc-green: #2bb673;
  position: relative; flex: 1; min-width: 0; min-height: 0; display: flex; overflow: hidden; overflow: clip;
  background: var(--tc-bg); color: var(--tc-text); font-family: var(--font-body); font-size: 15px; line-height: 1.375;
}
.tc--blank { align-items: center; justify-content: center; }
.tc button { color: inherit; font-size: inherit; }
.tc svg { display: block; flex: none; }
.tc ::-webkit-scrollbar { width: 8px; }
.tc ::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.35); border-radius: 4px; }
.tc ::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.5); }

/* Columns */
.tc-channels, .tc-members { flex: none; width: 240px; display: flex; flex-direction: column; min-height: 0; background: var(--tc-side); }
.tc.is-members-hidden .tc-members { display: none; }
.tc-main { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.tc-side-head {
  flex: none; display: flex; align-items: center; height: 48px; padding: 0 16px; font-size: 15px; font-weight: 600; color: var(--tc-strong);
  border-bottom: 1px solid var(--tc-line); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.18);
}
.tc-side-scroll { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 0 8px 16px; }
.tc-members .tc-side-scroll { padding-top: 8px; }
.tc-category { padding: 18px 8px 6px; font-size: 11.5px; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; color: var(--tc-muted); }

/* Channel list */
.tc-channel {
  position: relative; display: flex; align-items: center; gap: 6px; width: 100%; height: 34px; margin: 1px 0; padding: 0 8px;
  border-radius: 6px; text-align: left; font-size: 15.5px; font-weight: 500; color: var(--tc-muted);
}
.tc .tc-channel { color: var(--tc-muted); }
.tc-channel-hash svg { width: 18px; height: 18px; opacity: 0.75; }
.tc-channel-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tc .tc-channel:hover { background: var(--tc-hover); color: var(--tc-text); }
.tc .tc-channel.is-unread { color: var(--tc-strong); font-weight: 600; }
.tc-channel.is-unread::before { content: ''; position: absolute; left: -8px; top: 50%; width: 4px; height: 8px; margin-top: -4px; border-radius: 0 4px 4px 0; background: var(--tc-strong); }
.tc .tc-channel.is-active { background: var(--tc-active); color: var(--tc-strong); }
.tc-channel:focus-visible, .tc-icon-btn:focus-visible, .tc-btn:focus-visible, .tc-menu-item:focus-visible, .tc-profile-option:focus-visible { outline: 2px solid var(--tc-link); outline-offset: 1px; }

/* Who I am (bottom of the channel column) */
.tc-user { flex: none; display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 0 8px; background: var(--tc-deep); --tc-ring: var(--tc-deep); }
.tc-user-text, .tc-member-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.tc-user-name, .tc-member-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 600; color: var(--tc-strong); }
.tc-user-role, .tc-member-role { font-size: 12px; color: var(--tc-muted); }
.tc .tc-user-pick { width: 100%; padding: 8px; border-radius: 6px; font-size: 13.5px; font-weight: 600; color: var(--tc-link); text-align: left; }
.tc-user-pick:hover { background: var(--tc-hover); }

/* Avatars: initials on a colour picked from the profile, no image service */
.tc-avatar {
  position: relative; flex: none; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%;
  color: var(--white); font-weight: 600; letter-spacing: 0.01em; user-select: none;
}
.tc-avatar--md { width: 40px; height: 40px; font-size: 15px; }
.tc-avatar--sm { width: 32px; height: 32px; font-size: 12.5px; }
.tc-avatar--xs { width: 16px; height: 16px; font-size: 8px; }
.tc-presence { position: absolute; right: -2px; bottom: -2px; width: 10px; height: 10px; border-radius: 50%; box-shadow: 0 0 0 3px var(--tc-ring, var(--tc-side)); }
.tc-presence.is-online { background: var(--tc-green); }
.tc-presence.is-offline { background: var(--tc-side); border: 2.5px solid var(--tc-faint); }

/* Members */
.tc-member { display: flex; align-items: center; gap: 10px; padding: 5px 8px; border-radius: 6px; }
.tc-member:hover { background: var(--tc-hover); }
.tc-member.is-offline { opacity: 0.45; }
.tc-member.is-offline:hover { opacity: 1; }
.tc-member-name { font-weight: 500; }
.tc-members-empty { padding: 4px 8px; font-size: 13.5px; color: var(--tc-muted); }

/* Channel header */
.tc-header {
  flex: none; display: flex; align-items: center; gap: 8px; height: 48px; padding: 0 12px 0 16px;
  border-bottom: 1px solid var(--tc-line); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.18);
}
.tc-header-hash { color: var(--tc-faint); }
.tc-header-hash svg { width: 22px; height: 22px; }
.tc-header-name { flex: none; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; font-weight: 600; color: var(--tc-strong); }
.tc-header-sep { flex: none; width: 1px; height: 24px; margin: 0 8px; background: var(--tc-line); }
.tc-header-topic { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; color: var(--tc-muted); }
.tc-header-spacer { flex: 1; }
.tc-icon-btn { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 6px; }
.tc .tc-icon-btn { color: var(--tc-muted); }
.tc .tc-icon-btn:hover { color: var(--tc-strong); background: var(--tc-hover); }
.tc-icon-btn svg { width: 20px; height: 20px; }
.tc-narrow-only { display: none; }

/* Conversation */
.tc-body { position: relative; flex: 1; min-height: 0; }
.tc-scroll { position: absolute; inset: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; }
.tc-messages { min-height: 100%; display: flex; flex-direction: column; justify-content: flex-end; padding: 16px 0 26px; }
.tc-empty { margin: auto; padding: 24px; text-align: center; color: var(--tc-muted); }
.tc-empty p { margin-bottom: 12px; }
.tc-older { padding: 8px 16px 4px; text-align: center; font-size: 13px; color: var(--tc-muted); }
.tc-welcome { padding: 16px 16px 4px; }
.tc-welcome-icon { display: inline-flex; align-items: center; justify-content: center; width: 68px; height: 68px; border-radius: 50%; background: var(--tc-input); color: var(--tc-strong); }
.tc-welcome-icon svg { width: 40px; height: 40px; }
.tc-welcome h3 { margin: 12px 0 6px; font-family: var(--font-display); font-size: 28px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; color: var(--tc-strong); overflow-wrap: anywhere; }
.tc-welcome p { font-size: 15px; color: var(--tc-muted); }

.tc-day { display: flex; align-items: center; margin: 22px 16px 0; font-size: 12px; font-weight: 600; color: var(--tc-muted); }
.tc-day::before, .tc-day::after { content: ''; flex: 1; height: 1px; background: var(--tc-line); }
.tc-day span { padding: 0 8px; }

.tc-msg { position: relative; display: grid; grid-template-columns: 56px minmax(0, 1fr); padding: 2px 48px 2px 16px; }
.tc-msg.is-head { margin-top: 17px; }
.tc-day + .tc-msg.is-head { margin-top: 10px; }
.tc-msg:hover, .tc-msg.is-menu-open { background: var(--tc-msg-hover); }
.tc-msg.is-reply-target { background: rgba(47, 125, 215, 0.12); box-shadow: inset 2px 0 0 var(--tc-accent); }
.tc-msg.is-flash { animation: tc-flash 1.4s ease-out; }
@keyframes tc-flash { 0%, 40% { background: rgba(47, 125, 215, 0.22); } 100% { background: transparent; } }
.tc-msg-gutter { grid-column: 1; display: flex; justify-content: flex-start; padding-top: 2px; }
.tc-msg-gutter-time { width: 40px; text-align: center; font-size: 11px; line-height: 20px; color: var(--tc-faint); opacity: 0; font-variant-numeric: tabular-nums; }
.tc-msg:hover .tc-msg-gutter-time { opacity: 1; }
.tc-msg.is-cont .tc-msg-gutter { padding-top: 0; }
.tc-msg-main { grid-column: 2; min-width: 0; }
.tc-msg-meta { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.tc-msg-author { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15.5px; font-weight: 600; color: var(--tc-strong); }
.tc-msg-time { flex: none; font-size: 12px; color: var(--tc-faint); }
.tc-msg-text { font-size: 15.5px; line-height: 1.4; color: var(--tc-text); white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }
.tc-msg-text a { color: var(--tc-link); }
.tc-msg-text a:hover { text-decoration: underline; }
.tc-msg-edited { font-size: 11px; color: var(--tc-faint); user-select: none; }
.tc-msg.is-sending .tc-msg-text { opacity: 0.5; }
.tc-msg.is-failed .tc-msg-text { color: var(--tc-danger); }
.tc-msg-error { margin-top: 2px; font-size: 13px; color: var(--tc-danger); }
.tc .tc-msg-error button, .tc .tc-edit-hint button { color: var(--tc-link); font-size: inherit; padding: 0; }
.tc-msg-error button:hover, .tc-edit-hint button:hover { text-decoration: underline; }

/* Reply reference above a message */
.tc-reply-ref {
  grid-column: 1 / -1; position: relative; display: flex; align-items: center; gap: 5px; min-width: 0; margin-bottom: 2px; padding-left: 56px;
  font-size: 13.5px; color: var(--tc-muted); cursor: pointer;
}
.tc-reply-ref.is-deleted { cursor: default; font-style: italic; }
.tc-reply-spine { position: absolute; left: 19px; top: 50%; width: 31px; height: 11px; border-left: 2px solid var(--tc-faint); border-top: 2px solid var(--tc-faint); border-top-left-radius: 6px; opacity: 0.6; }
.tc-reply-author { flex: none; max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: var(--tc-text); }
.tc-reply-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tc-reply-ref:not(.is-deleted):hover .tc-reply-text { color: var(--tc-strong); }

/* Hover actions */
.tc-msg-actions {
  position: absolute; right: 16px; top: -16px; z-index: 2; display: none; padding: 2px; border-radius: 8px;
  background: var(--tc-bg); border: 1px solid var(--tc-line); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.tc-msg:hover .tc-msg-actions, .tc-msg.is-menu-open .tc-msg-actions, .tc-msg-actions:focus-within { display: flex; }
.tc-msg-actions button { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 6px; }
.tc .tc-msg-actions button { color: var(--tc-muted); }
.tc .tc-msg-actions button:hover { color: var(--tc-strong); background: var(--tc-hover); }
.tc .tc-msg-actions button.is-danger, .tc .tc-msg-actions button.is-danger:hover { color: var(--tc-danger); }
.tc-msg-actions svg { width: 18px; height: 18px; }

/* Editing in place */
.tc-edit { padding: 4px 0 6px; }
.tc-edit-input, .tc-input {
  display: block; width: 100%; min-width: 0; resize: none; border: 0; outline: 0; box-shadow: none; background: none;
  color: var(--tc-text); font-size: 15.5px; line-height: 22px; overflow-y: auto;
}
.tc-edit-input { max-height: 40vh; padding: 10px 14px; border-radius: 8px; background: var(--tc-input); }
.tc-edit-hint { margin-top: 4px; font-size: 12px; color: var(--tc-muted); }

/* New messages while reading older ones */
.tc-newbar {
  position: absolute; left: 50%; bottom: 12px; z-index: 3; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 6px;
  max-width: calc(100% - 32px); padding: 7px 14px; border-radius: 999px; background: var(--tc-accent); font-size: 13px; font-weight: 600; white-space: nowrap;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}
.tc .tc-newbar { color: var(--white); }
.tc-newbar:hover { background: var(--tc-accent-hover); }
.tc-newbar svg { width: 14px; height: 14px; }
.tc-status { flex: none; margin: 0 16px 6px; padding: 6px 12px; border-radius: 8px; font-size: 13px; color: #ffc2c3; background: rgba(240, 73, 76, 0.16); }

/* Composer */
.tc-compose { position: relative; flex: none; padding: 0 16px 22px; }
.tc-reply-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 6px 4px 16px; border-radius: 8px 8px 0 0; background: var(--tc-side); font-size: 13.5px; color: var(--tc-muted); }
.tc-reply-bar-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tc-reply-bar strong { color: var(--tc-strong); font-weight: 600; }
.tc-composer { display: flex; align-items: flex-end; gap: 2px; min-height: 46px; padding: 0 8px 0 16px; border-radius: 8px; background: var(--tc-input); }
.tc-compose.is-replying .tc-composer { border-radius: 0 0 8px 8px; }
.tc-input { flex: 1; max-height: 40vh; padding: 12px 0; }
.tc-input::placeholder { color: var(--tc-faint); }
.tc-composer .tc-icon-btn { margin-bottom: 7px; }
.tc-counter { flex: none; align-self: flex-end; margin: 0 4px 14px; font-size: 12px; font-variant-numeric: tabular-nums; color: var(--tc-muted); }
.tc-counter.is-over { color: var(--tc-danger); font-weight: 600; }
.tc-send { flex: none; display: none; align-items: center; justify-content: center; width: 34px; height: 34px; margin: 0 0 6px 2px; border-radius: 8px; background: var(--tc-accent); }
.tc .tc-send { color: var(--white); }
.tc-send svg { width: 18px; height: 18px; }
.tc .tc-composer--locked { width: 100%; padding: 0 16px; text-align: left; font-size: 15px; color: var(--tc-muted); align-items: center; }
.tc .tc-composer--locked:hover { color: var(--tc-strong); }
.tc-emoji {
  position: absolute; right: 16px; bottom: calc(100% + 8px); z-index: 6; display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px;
  width: min(328px, calc(100% - 32px)); max-height: 232px; overflow-y: auto; padding: 8px; border-radius: 10px;
  background: var(--tc-float); border: 1px solid var(--tc-line); box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}
.tc-emoji button { aspect-ratio: 1; border-radius: 6px; font-size: 20px; line-height: 1; }
.tc-emoji button:hover { background: var(--tc-active); }

/* Buttons and fields */
.tc-btn { display: inline-flex; align-items: center; justify-content: center; height: 38px; padding: 0 16px; border-radius: 8px; background: var(--tc-accent); font-size: 14px; font-weight: 600; white-space: nowrap; }
.tc .tc-btn { color: var(--white); }
.tc-btn:hover { background: var(--tc-accent-hover); }
.tc-btn:disabled { opacity: 0.6; cursor: default; }
.tc-btn--ghost, .tc-btn--ghost:hover { background: transparent; }
.tc .tc-btn--ghost { color: var(--tc-text); }
.tc-btn--ghost:hover { text-decoration: underline; }
.tc-btn--danger { background: var(--tc-danger); }
.tc-btn--danger:hover { background: #d93b3e; }
.tc-field { flex: 1; min-width: 0; height: 40px; padding: 0 12px; border-radius: 8px; border: 1px solid transparent; outline: 0; background: var(--tc-deep); color: var(--tc-text); font-size: 15px; }
.tc-field:focus { border-color: var(--tc-accent); }
.tc-field::placeholder { color: var(--tc-faint); }

/* Drawers (narrow screens), dialogs, menu, toast */
.tc-backdrop { display: none; position: absolute; inset: 0; z-index: 20; background: rgba(0, 0, 0, 0.55); }
.tc-modal-wrap { position: absolute; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(0, 0, 0, 0.62); }
.tc-modal { position: relative; width: min(440px, 100%); max-height: 100%; overflow-y: auto; padding: 24px; border-radius: 12px; background: var(--tc-bg); box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6); }
.tc-modal h3 { padding-right: 32px; font-family: var(--font-display); font-size: 20px; font-weight: 800; letter-spacing: -0.01em; color: var(--tc-strong); }
.tc-modal > p { margin: 8px 0 16px; font-size: 14.5px; color: var(--tc-muted); }
.tc-modal-close { position: absolute; top: 14px; right: 14px; }
.tc-profile-list { display: flex; flex-direction: column; gap: 4px; max-height: 232px; overflow-y: auto; }
.tc-profile-option { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 8px; background: var(--tc-side); text-align: left; }
.tc-profile-option:hover { background: var(--tc-active); }
.tc-profile-option.is-current { box-shadow: inset 0 0 0 2px var(--tc-accent); }
.tc-profile-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; font-weight: 500; color: var(--tc-strong); }
.tc-profile-role { flex: none; font-size: 12px; color: var(--tc-muted); }
.tc-modal-or { margin: 16px 0 8px; font-size: 11.5px; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; color: var(--tc-muted); }
.tc-profile-form { display: flex; flex-wrap: wrap; gap: 8px; }
.tc-profile-form .tc-field { flex: 1 1 200px; }
.tc-modal-error { margin-top: 12px; font-size: 13.5px; color: var(--tc-danger); }
.tc-modal-preview { display: grid; grid-template-columns: 56px minmax(0, 1fr); max-height: 168px; overflow: hidden; margin-bottom: 16px; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--tc-line); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25); }
.tc-modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.tc-menu-scrim { position: absolute; inset: 0; z-index: 30; }
.tc-menu { position: absolute; z-index: 31; width: 196px; padding: 6px; border-radius: 8px; background: var(--tc-float); border: 1px solid var(--tc-line); box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5); }
.tc-menu-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 8px 10px; border-radius: 4px; font-size: 14px; text-align: left; }
.tc .tc-menu-item { color: var(--tc-text); }
.tc .tc-menu-item:hover { background: var(--tc-accent); color: var(--white); }
.tc .tc-menu-item.is-danger { color: var(--tc-danger); }
.tc .tc-menu-item.is-danger:hover { background: var(--tc-danger); color: var(--white); }
.tc-menu-item svg { width: 16px; height: 16px; }
.tc-toast { position: absolute; left: 50%; bottom: 92px; z-index: 50; transform: translateX(-50%); max-width: calc(100% - 32px); padding: 8px 14px; border-radius: 8px; background: var(--tc-deep); color: var(--tc-strong); font-size: 13.5px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45); pointer-events: none; }

/* Tablet: channels | conversation; members slide in from the right. */
@media (max-width: 1100px) {
  .tc-members, .tc.is-members-hidden .tc-members {
    display: flex; position: absolute; top: 0; right: 0; bottom: 0; z-index: 25; width: min(260px, 84%);
    transform: translateX(100%); visibility: hidden; transition: transform 0.2s ease, visibility 0.2s; box-shadow: -12px 0 32px rgba(0, 0, 0, 0.4);
  }
  .tc[data-drawer="members"] .tc-members { transform: none; visibility: visible; }
  .tc[data-drawer="members"] .tc-backdrop { display: block; }
}

/* Phone: the conversation alone; channels and members are drawers. */
@media (max-width: 700px) {
  .tc-channels {
    position: absolute; top: 0; left: 0; bottom: 0; z-index: 25; width: min(280px, 84%);
    transform: translateX(-100%); visibility: hidden; transition: transform 0.2s ease, visibility 0.2s; box-shadow: 12px 0 32px rgba(0, 0, 0, 0.4);
  }
  .tc[data-drawer="channels"] .tc-channels { transform: none; visibility: visible; }
  .tc[data-drawer="channels"] .tc-backdrop { display: block; }
  .tc-narrow-only { display: inline-flex; }
  .tc-header { padding: 0 8px; gap: 6px; }
  .tc-header-hash svg { width: 20px; height: 20px; }
  .tc-msg { padding-right: 16px; padding-left: 12px; grid-template-columns: 50px minmax(0, 1fr); }
  .tc-reply-ref { padding-left: 50px; }
  .tc-reply-spine { left: 19px; width: 25px; }
  .tc-day { margin-left: 12px; margin-right: 12px; }
  .tc-welcome { padding-left: 12px; padding-right: 12px; }
  .tc-welcome h3 { font-size: 22px; }
  .tc-compose { padding: 0 8px calc(8px + env(safe-area-inset-bottom, 0px)); }
  .tc-status { margin: 0 8px 6px; }
  .tc-emoji { right: 8px; width: min(328px, calc(100% - 16px)); }
  .tc-send { display: inline-flex; }
  /* 16px keeps iOS from zooming the page when the field is focused. */
  .tc-input, .tc-edit-input, .tc-field { font-size: 16px; }
  .tc-modal { padding: 20px 16px; }
  /* The message menu becomes a sheet at the bottom of the chat. */
  .tc-menu-scrim { background: rgba(0, 0, 0, 0.5); }
  .tc-menu { left: 8px !important; right: 8px; top: auto !important; bottom: calc(8px + env(safe-area-inset-bottom, 0px)); width: auto; padding: 8px; border-radius: 12px; }
  .tc-menu-item { padding: 13px 12px; font-size: 15.5px; border-radius: 8px; }
  .tc-menu-item svg { width: 18px; height: 18px; }
}
@media (max-width: 480px) {
  .tc-header-sep, .tc-header-topic { display: none; }
}
/* No hover (touch): actions open by tapping the message, and there is
   always a send button since Enter breaks the line there. */
@media (hover: none) {
  .tc-msg-actions { display: none !important; }
  .tc-msg:hover { background: none; }
  .tc-msg.is-menu-open { background: var(--tc-msg-hover); }
  .tc-send { display: inline-flex; }
}

