/* =====================================================================================================
   t50u — Grafic Suite
   1. Orb avatars (one shared avatar for everyone without photo, ElevenLabs-style gradient orbs)
   2. Quiet background repaints (no flash, no re-animation) + persisting modals
   3. Toast action button (new version)
   4. Profile: avatar generator
   5. Seguimiento «Cracks de la quincena» cards
   6. ElevenLabs-style person rows (Usuarios, chat «Personas», equipo)
   7. Dark «Grafito» contrast audit fixes (chips, toggles, platform cards, inputs, secondary buttons, footers)
   ===================================================================================================== */

:root {
  --t50-text: var(--v4-text, #1a1c26);
  --t50-muted: var(--v4-muted, #555b6c);
  --t50-line: rgba(20, 22, 40, .10);
  --t50-row-hover: rgba(20, 22, 40, .045);
  --t50-chip-bg: rgba(255, 255, 255, .78);
  --t50-chip-line: rgba(20, 22, 40, .14);
  --t50-chip-text: #2a2d3a;
  --t50-accent: #7440ba;
  --t50-accent-soft: rgba(116, 64, 186, .12);
}
body[data-theme="dark"] {
  --t50-text: #eceaf4;
  --t50-muted: #b4b0c6;
  --t50-line: rgba(255, 255, 255, .10);
  --t50-row-hover: rgba(255, 255, 255, .05);
  --t50-chip-bg: rgba(255, 255, 255, .055);
  --t50-chip-line: rgba(255, 255, 255, .16);
  --t50-chip-text: #e7e4f2;
  --t50-accent: #b48cff;
  --t50-accent-soft: rgba(180, 140, 255, .16);
}

/* ---------- 1. Orb avatars ---------- */
html body .gs-orb {
  position: relative; isolation: isolate; overflow: visible;
  display: inline-block; flex: none; vertical-align: middle;
  border-radius: 50% !important; color: transparent !important; font-size: 0 !important; line-height: 0 !important; text-indent: -999px;
  background-color: var(--o1) !important;
  background-image:
    radial-gradient(circle at var(--ox) var(--oy), color-mix(in srgb, var(--o2) 92%, #fff) 0%, transparent 58%),
    radial-gradient(circle at var(--ox2) var(--oy2), var(--o3) 0%, transparent 62%),
    linear-gradient(var(--oa), var(--o1), color-mix(in srgb, var(--o3) 70%, var(--o1))) !important;
  background-size: 100% 100% !important; background-repeat: no-repeat !important;
}
html body .gs-orb .gs-orb-swirl,
html body .gs-orb .gs-orb-gloss { position: absolute; inset: 0; border-radius: 50%; pointer-events: none; display: block; text-indent: 0; }
html body .gs-orb .gs-orb-swirl {
  background: conic-gradient(from var(--os) at 58% 46%, transparent 0 18%, color-mix(in srgb, var(--o2) 75%, transparent) 30%, transparent 46%, color-mix(in srgb, var(--o3) 70%, transparent) 64%, transparent 82%);
  filter: blur(calc(var(--av, 40px) * .09)); clip-path: circle(50% at 50% 50%); opacity: .9; mix-blend-mode: soft-light;
}
html body .gs-orb .gs-orb-gloss {
  background: radial-gradient(circle at 32% 26%, rgba(255, 255, 255, .62), rgba(255, 255, 255, 0) 32%),
              radial-gradient(circle at 70% 88%, rgba(0, 0, 0, .16), rgba(0, 0, 0, 0) 46%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22);
}
html body .gs-orb.gs-orb--mesh .gs-orb-swirl { mix-blend-mode: normal; opacity: .75; filter: blur(calc(var(--av, 40px) * .14)); }
html body .gs-orb > img { display: none; }
/* sizes for the classes that previously relied on their text/img to size themselves */
html body .gs-orb.gs-av { width: var(--av); height: var(--av); }
html body .gs-orb.user-avatar { width: 34px; height: 34px; }
html body .topbar-profile .gs-orb.user-avatar { width: 30px; height: 30px; }
html body .gs-orb.profile-photo { width: 56px; height: 56px; }
html body .users-roster .gs-orb.profile-photo, html body .users-person-line .gs-orb.profile-photo, html body .leader-row .gs-orb.profile-photo { width: 40px; height: 40px; }
html body .gs-orb.search-avatar { width: 32px; height: 32px; }
html body .gs-orb.timeline-avatar { width: 28px; height: 28px; }
html body .gs-orb.campaign-responsible-avatar { width: 30px; height: 30px; }
html body .gs-orb.team-card-avatar { width: 40px; height: 40px; }
html body .gs-orb.rh-person-avatar { width: 30px; height: 30px; }
html body .gs-orb.access-avatar { width: 34px; height: 34px; }
html body .gs-orb.create-user-result-avatar { width: 48px; height: 48px; }
html body .gs-orb.podium-avatar { width: 64px; height: 64px; }
html body .gs-orb.profile-avatar { width: 96px; height: 96px; }
html body .gs-orb.gs-chat-avatar { --av: 44px; }
html body .gs-orb.gs-kanban-avatar, html body .gs-kanban-avatar { --av: 18px; width: 18px; height: 18px; border-radius: 50%; display: inline-block; vertical-align: -4px; margin-right: 5px; overflow: hidden; }
html body .gs-kanban-avatar img { width: 100%; height: 100%; object-fit: cover; }
html body .gs-av-group .gs-orb { box-shadow: 0 0 0 2px var(--v4-surface-solid, #fff) !important; }
body[data-theme="dark"] .gs-av-group .gs-orb { box-shadow: 0 0 0 2px #17171f !important; }

/* ---------- 2. Quiet background repaints ---------- */
html.gs-quiet-render .content *, html.gs-quiet-render .content *::before, html.gs-quiet-render .content *::after,
html.gs-quiet-render .topbar *, html.gs-quiet-render .nav *,
html.gs-quiet-render [data-viewport-layer], html.gs-quiet-render [data-viewport-layer] * {
  animation-duration: 0s !important; animation-delay: 0s !important; transition-duration: 0s !important; transition-delay: 0s !important;
}
html body [data-viewport-layer].is-persisting, html body [data-viewport-layer].is-persisting .modal { animation: none !important; }

/* ---------- 3. Toast action ---------- */
.gt-toast.gt-has-action { grid-template-columns: auto minmax(0, 1fr) auto auto; }
.gt-action { align-self: center; border: 0; border-radius: 999px; padding: 6px 12px !important; min-height: 0 !important; font: 700 12px/1.1 inherit; cursor: pointer;
  background: linear-gradient(135deg, #7440ba, #9a5ee0); color: #fff; box-shadow: 0 6px 14px rgba(116, 64, 186, .28); white-space: nowrap; }
.gt-action:hover { filter: brightness(1.08); }
.gt-persistent .gt-progress { display: none; }

/* ---------- 4. Profile: avatar generator ---------- */
.profile-avatar-generator { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; margin-top: 12px; padding: 10px 12px;
  border: 1px solid var(--t50-line); border-radius: 14px; background: color-mix(in srgb, var(--t50-accent-soft) 45%, transparent); }
.profile-avatar-generator-preview .gs-orb { --av: 44px; width: 44px; height: 44px; }
.profile-avatar-generator-copy { display: grid; gap: 2px; min-width: 0; }
.profile-avatar-generator-copy strong { color: var(--t50-text); font-size: 13px; }
.profile-avatar-generator-copy small { color: var(--t50-muted); font-size: 12px; line-height: 1.35; }
.profile-avatar-generator-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.profile-avatar-generator-actions button { display: inline-flex; align-items: center; gap: 6px; }
[data-profile-photo-preview-placeholder] { display: grid; place-items: center; width: 100%; height: 100%; }
[data-profile-photo-preview-placeholder] .gs-orb { --av: 120px; width: 100%; height: 100%; }

/* ---------- 5. Seguimiento: Cracks de la quincena ---------- */
html body .rh-cracks-grid { align-items: stretch; }
html body .rh-crack-card { display: grid !important; justify-items: center; align-content: start; gap: 6px; text-align: center; overflow: hidden; padding: 22px 16px 16px !important; min-width: 0; }
html body .rh-crack-card .rh-medal { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 2; display: grid; place-items: center;
  width: 26px; height: 26px; border-radius: 50%; font-size: 12px; font-weight: 800; box-shadow: 0 4px 10px rgba(0, 0, 0, .18), 0 0 0 2px var(--v4-surface-solid, #fff); }
body[data-theme="dark"] .rh-crack-card .rh-medal { box-shadow: 0 4px 10px rgba(0, 0, 0, .4), 0 0 0 2px #1b1b24; }
html body .rh-suite .rh-crack-avatar, html body .rh-crack-avatar { --av: 64px; display: block !important; width: 64px !important; height: 64px !important; margin: 22px auto 6px !important; border-radius: 50% !important; object-fit: cover;
  border: 0 !important; box-shadow: 0 0 0 3px color-mix(in srgb, var(--rh-area-color, #7440ba) 55%, transparent), 0 10px 22px color-mix(in srgb, var(--rh-area-color, #7440ba) 26%, transparent) !important; }
html body .rh-crack-card h3 { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 4px 0 0 !important; }
html body .rh-crack-card p { margin: 0 0 6px !important; letter-spacing: .06em; }
html body .rh-crack-card > div { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; width: 100%; max-width: 200px; }
html body .rh-crack-card > div strong { min-width: 0; }

/* ---------- 6. ElevenLabs-style person rows ---------- */
html body .users-roster { display: grid; gap: 0 !important; border: 1px solid var(--t50-line); border-radius: 16px; overflow: hidden; background: color-mix(in srgb, var(--v4-surface-solid, #fff) 70%, transparent); }
body[data-theme="dark"] .users-roster { background: rgba(255, 255, 255, .02); }
html body .users-roster .users-roster-row { display: grid !important; grid-template-columns: minmax(0, 1fr) auto auto auto; align-items: center; gap: 12px; padding: 10px 14px !important; margin: 0 !important;
  border: 0 !important; border-bottom: 1px solid var(--t50-line) !important; border-radius: 0 !important; background: transparent !important; box-shadow: none !important; transition: background .15s ease; }
html body .users-roster .users-roster-row:last-child { border-bottom: 0 !important; }
html body .users-roster .users-roster-row:hover { background: var(--t50-row-hover) !important; }
html body .users-roster-person { display: flex; align-items: center; gap: 12px; min-width: 0; }
html body .users-roster-person .profile-photo { width: 40px !important; height: 40px !important; flex: 0 0 40px; border-radius: 50% !important; }
html body .users-roster-name { display: grid; gap: 1px; min-width: 0; }
html body .users-roster-name h4 { margin: 0; font-size: 14px; font-weight: 700; color: var(--t50-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html body .users-roster-name span { color: var(--t50-muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html body .users-roster-row .badge { border-radius: 999px; font-size: 11.5px; font-weight: 650; padding: 4px 10px; }
html body .users-person-line { display: flex; align-items: center; gap: 12px; }
/* chat «Personas» + conversation rows */
html body .gs-chat-panel .gs-chat-row { border-radius: 12px; padding: 9px 10px; gap: 12px; }
html body .gs-chat-panel .gs-chat-row .gs-chat-row-copy strong { font-weight: 700; }
html body .gs-chat-panel .gs-chat-row .gs-chat-meta { color: var(--t50-muted); }
/* equipo responsable */
html body .team-card { align-items: center; }

/* ---------- 7. Dark «Grafito» contrast ---------- */
/* 7a. Selectable cards & chips (organic channels, launch platforms, assignees, team, formation/tool choices):
       one legible treatment for unselected / hover / selected / disabled, in both themes. */
html body[data-theme] :is(.platform-choice, .campaign-platform-option) {
  background: var(--t50-chip-bg) !important; border: 1px solid var(--t50-chip-line) !important; color: var(--t50-chip-text) !important; box-shadow: none !important; opacity: 1 !important;
}
html body[data-theme] .platform-choice > span { color: var(--t50-chip-text) !important; background: transparent !important; }
html body[data-theme] :is(.platform-choice b, .platform-choice > span b, .campaign-platform-option small, .campaign-platform-option span) { color: var(--t50-chip-text) !important; opacity: 1 !important; font-weight: 700 !important; }
html body[data-theme] :is(.platform-choice img, .campaign-platform-option img) { opacity: 1 !important; filter: none !important; }
html body[data-theme] :is(.platform-choice, .campaign-platform-option):hover { border-color: color-mix(in srgb, var(--t50-accent) 55%, transparent) !important; background: color-mix(in srgb, var(--t50-accent-soft) 55%, var(--t50-chip-bg)) !important; }
html body[data-theme] :is(.platform-choice, .campaign-platform-option):has(input:checked) {
  background: var(--t50-accent-soft) !important; border-color: color-mix(in srgb, var(--t50-accent) 78%, transparent) !important;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--t50-accent) 40%, transparent), 0 8px 18px color-mix(in srgb, var(--t50-accent) 18%, transparent) !important;
}
html body[data-theme] :is(.platform-choice:has(input:checked) b, .platform-choice:has(input:checked) > span, .campaign-platform-option:has(input:checked) small, .campaign-platform-option:has(input:checked) span) { color: var(--t50-selected-text, #4a2390) !important; }
body[data-theme="dark"] { --t50-selected-text: #f1e8ff; }
html body[data-theme] .platform-choice:has(input:checked)::after { background: var(--t50-accent) !important; color: #fff !important; }
body[data-theme="dark"] .platform-choice:has(input:checked)::after { color: #1a1030 !important; }
html body[data-theme] :is(.platform-choice, .campaign-platform-option):has(input:focus-visible) { outline: 2px solid var(--t50-accent); outline-offset: 2px; }
html body[data-theme] :is(.platform-choice, .campaign-platform-option):has(input:disabled) { cursor: not-allowed; opacity: .62 !important; }
html body[data-theme] :is(.platform-choice, .campaign-platform-option):has(input:disabled) :is(b, small, span) { color: var(--t50-muted) !important; }
/* the «Canales de publicación» fieldset + optional <details> wrapper */
body[data-theme="dark"] .optional-publication-channels { background: rgba(255, 255, 255, .025) !important; border-color: var(--t50-line) !important; }
body[data-theme="dark"] .optional-publication-channels > summary { color: var(--t50-text) !important; }
body[data-theme="dark"] .optional-publication-channels > summary small { color: var(--t50-muted) !important; }
body[data-theme="dark"] :is(.content-platforms, .platform-picker) { border-color: var(--t50-line) !important; background: transparent !important; }
body[data-theme="dark"] :is(.content-platforms, .platform-picker) legend { color: var(--t50-text) !important; }
/* assignees / team picker chips */
html body[data-theme] .assignee-chip { background: var(--t50-chip-bg) !important; border-color: var(--t50-chip-line) !important; color: var(--t50-chip-text) !important; }
html body[data-theme] .assignee-chip:has(input:checked) { background: var(--t50-accent-soft) !important; border-color: color-mix(in srgb, var(--t50-accent) 75%, transparent) !important; color: var(--t50-selected-text, #4a2390) !important; }
html body[data-theme] .assignee-chip:has(input:disabled) { opacity: .62; }
body[data-theme="dark"] .team-card { background: rgba(255, 255, 255, .04) !important; border-color: var(--t50-chip-line) !important; }
body[data-theme="dark"] .team-card strong { color: var(--t50-text) !important; }
body[data-theme="dark"] .team-card small { color: var(--t50-muted) !important; }
body[data-theme="dark"] .team-card:has(input:checked) { background: var(--t50-accent-soft) !important; border-color: color-mix(in srgb, var(--t50-accent) 75%, transparent) !important; }

/* 7b. Small fixed widgets and counters flagged by the audit */
body[data-theme="dark"] .gs-sound-control { color: #d9c6ff !important; background: rgba(30, 28, 44, .86) !important; border-color: rgba(255, 255, 255, .14) !important; box-shadow: 0 12px 30px rgba(0, 0, 0, .4), inset 0 1px rgba(255, 255, 255, .06) !important; }
body[data-theme="dark"] .gs-sound-control.muted { color: #c2bdd4 !important; }
body[data-theme="dark"] .permission-group > header > span { color: #e4d3ff !important; background: rgba(180, 140, 255, .18) !important; }
body[data-theme="dark"] .heat.warm { color: #ffe1b0 !important; }
body[data-theme="dark"] .view-tools .tabs button { color: #c9c4da; }
body[data-theme="dark"] .view-tools .tabs button:disabled { color: #9d98b2; }
/* 7c. Primary buttons in dark: keep white text ≥ 4.5:1 on the whole gradient */
html body[data-theme="dark"] :is(.primary, .auth-login-submit) { background: linear-gradient(180deg, #7a52cc, #6640b4) !important; }
/* 7d. accent-on-dark labels (brand initials, leadership labels) */
body[data-theme="dark"] .brand-picker-logo:not(img) { color: #cdb2ff !important; }
body[data-theme="dark"] .users-lead-card > span { color: #cdb2ff !important; }
body[data-theme="dark"] .campaign-progress-ring b { color: #fff !important; text-shadow: 0 1px 2px rgba(0, 0, 0, .35); }
body[data-theme="dark"] .marketing-brand-logo:not(img) { color: #cdb2ff !important; }
body[data-theme="dark"] .team-count { color: #d9c6ff !important; }
body[data-theme="dark"] .calendar .day-name { color: #b9b5cc !important; }
body[data-theme="dark"] .calendar .day.out > button { color: #a7a4b6 !important; }
/* 7e. Disabled buttons: clearly disabled, still readable (no low-opacity ghost text) */
html body[data-theme] :is(button, .primary, .secondary, .ghost, .mini-action):disabled { opacity: 1 !important; cursor: not-allowed; filter: none !important; }
html body[data-theme="light"] .primary:disabled { background: #e6e1ef !important; color: #5d5670 !important; border-color: #d6cfe4 !important; box-shadow: none !important; }
html body[data-theme="dark"] .primary:disabled { background: #34304a !important; color: #c3bdd6 !important; border-color: #4a4562 !important; box-shadow: none !important; }
html body[data-theme="light"] :is(.secondary, .ghost):disabled { color: #6a6478 !important; }
html body[data-theme="dark"] :is(.secondary, .ghost):disabled { color: #b3aec4 !important; background: rgba(255, 255, 255, .04) !important; }
/* 7f. Chat «Personas» side label + notification menu links/tabs */
body[data-theme="dark"] .gs-chat-panel .gs-chat-row-side em { color: #d9c6ff !important; background: rgba(180, 140, 255, .14) !important; border-color: rgba(180, 140, 255, .28) !important; }
.gs-chat-panel .gs-chat-row-side em { font-style: normal; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
body[data-theme="dark"] .gs-notification-menu .gs-menu-link { color: #d9c6ff !important; }
body[data-theme="dark"] .gs-notification-tabs button { color: #c9c4da !important; }
body[data-theme="dark"] .gs-notification-tabs button.active { color: #fff !important; background: rgba(180, 140, 255, .22) !important; }
/* 7g. Inputs, secondary buttons and sticky footers in dark (legible placeholders, visible borders) */
html body[data-theme="dark"] :is(input:not([type=checkbox]):not([type=radio]):not([type=range]), select, textarea)::placeholder { color: #9792ab !important; opacity: 1; }
html body[data-theme="dark"] :is(input:not([type=checkbox]):not([type=radio]):not([type=range]), select, textarea):disabled { color: #bdb8cf !important; -webkit-text-fill-color: #bdb8cf; background: rgba(255, 255, 255, .03) !important; }
html body[data-theme="dark"] .secondary { color: #ece8f6 !important; border-color: rgba(255, 255, 255, .2) !important; }
html body[data-theme="dark"] .modal-sticky-footer { border-top-color: rgba(255, 255, 255, .1) !important; }

/* t50u: the encuadre slider only makes sense with a chosen photo ([hidden] was overridden by display:grid). */
.profile-photo-adjustments[hidden] { display: none !important; }

/* t50u light-mode audit: unread count and status badges reach WCAG AA (4.5:1) on their tinted backgrounds. */
html body .gs-notification-island .notification-count,
html body .gs-message-island .notification-count { color: #ffffff; }
html body:not([data-theme="dark"]) .req-brand-metric em { color: #5d6272; }
html body:not([data-theme="dark"]) { --v4-ok: #0a6b4a; --v4-warn: #7a4500; --v4-bad: #981a31; --v4-info: #184c92; }

/* t50u audit follow-ups: «Analisis/Finalizado» pill in light (4.07 → 5.3) and accent names in the dark activity timeline (2.9 → 6+). */
.campaign-board-card.tone-done .campaign-board-card-head > span { color: #1f6f3a; }
body[data-theme="dark"] .timeline-body em { color: #c4adf5; }
