/* ==========================================================================
   Comuni — Design system
   ========================================================================== */
:root {
  --brand: #6D5EF6;
  --brand-2: #FF7A59;
  --brand-ink: #fff;
  --brand-soft: color-mix(in srgb, var(--brand) 12%, transparent);
  --brand-softer: color-mix(in srgb, var(--brand) 6%, transparent);

  --bg: #F5F5F8;
  --surface: #FFFFFF;
  --surface-2: #FAFAFC;
  --surface-3: #F1F1F6;
  --border: #E9E9F0;
  --border-strong: #DADAE4;
  --text: #13131C;
  --text-2: #3A3A4A;
  --muted: #6E6E82;
  --faint: #A0A0B2;
  --overlay: rgba(12, 12, 20, .45);

  --sidebar-bg: #0E0E16;
  --sidebar-text: #B9B9C8;
  --sidebar-muted: #6F6F82;
  --sidebar-hover: rgba(255,255,255,.06);
  --sidebar-active: rgba(255,255,255,.10);

  --radius-xs: 8px;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --shadow-xs: 0 1px 2px rgba(16,16,30,.05);
  --shadow-sm: 0 1px 2px rgba(16,16,30,.04), 0 2px 8px rgba(16,16,30,.04);
  --shadow: 0 2px 4px rgba(16,16,30,.04), 0 10px 30px rgba(16,16,30,.07);
  --shadow-lg: 0 10px 20px rgba(16,16,30,.06), 0 30px 80px rgba(16,16,30,.16);
  --ease: cubic-bezier(.2,.8,.2,1);
  --font: "Plus Jakarta Sans", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* Tonos de estado */
  --t-neutral: #64748B; --t-neutral-bg: #F1F3F7;
  --t-blue: #2563EB;    --t-blue-bg: #EAF1FF;
  --t-violet: #7C3AED;  --t-violet-bg: #F2EBFF;
  --t-amber: #B45309;   --t-amber-bg: #FFF4DB;
  --t-orange: #C2410C;  --t-orange-bg: #FFEDE3;
  --t-green: #047857;   --t-green-bg: #E3F8EE;
  --t-teal: #0E7490;    --t-teal-bg: #E0F6FA;
  --t-ink: #111827;     --t-ink-bg: #E9EAEE;
  --t-red: #B91C1C;     --t-red-bg: #FDE8E8;
  --t-muted: #8A8A9A;   --t-muted-bg: #F1F1F4;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0B0B12;
  --surface: #14141D;
  --surface-2: #181822;
  --surface-3: #1F1F2B;
  --border: #262634;
  --border-strong: #33334A;
  --text: #F2F2F7;
  --text-2: #D0D0DC;
  --muted: #9A9AAE;
  --faint: #6A6A80;
  --overlay: rgba(0,0,0,.6);
  --sidebar-bg: #08080D;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --shadow-lg: 0 30px 80px rgba(0,0,0,.55);
  --t-neutral-bg: #232633; --t-neutral: #A6B0C3;
  --t-blue-bg: #172340;    --t-blue: #7EA6FF;
  --t-violet-bg: #251A40;  --t-violet: #B79BFF;
  --t-amber-bg: #33260E;   --t-amber: #F5C066;
  --t-orange-bg: #36200F;  --t-orange: #FFA06E;
  --t-green-bg: #0F2C21;   --t-green: #5FD7A5;
  --t-teal-bg: #0D2A31;    --t-teal: #5BCFE6;
  --t-ink-bg: #2A2A36;     --t-ink: #E5E7EB;
  --t-red-bg: #351617;     --t-red: #FF8A8A;
  --t-muted-bg: #22222C;   --t-muted: #8A8A9A;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--text);
  background: var(--bg); -webkit-font-smoothing: antialiased; font-feature-settings: "ss01", "cv11";
}
a { color: inherit; text-decoration: none; }
img, video { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.02em; line-height: 1.2; font-weight: 700; }
h1 { font-size: 26px; } h2 { font-size: 19px; } h3 { font-size: 15px; } h4 { font-size: 13px; }
h2 > svg.lucide:first-child, h3 > svg.lucide:first-child { vertical-align: -3px; margin-right: 7px; }
p { margin: 0; }
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
[hidden] { display: none !important; }
::selection { background: var(--brand-soft); }
svg.lucide { width: 18px; height: 18px; stroke-width: 1.9; flex-shrink: 0; }
.i-sm svg.lucide, svg.lucide.i-sm { width: 15px; height: 15px; }
.i-lg svg.lucide { width: 22px; height: 22px; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }

/* ---------------------------------------------------------------- utilidades */
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 12.5px; } .xs { font-size: 11.5px; }
.strong { font-weight: 700; } .semibold { font-weight: 600; } .nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; }
.row-wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; } .stack-sm { display: flex; flex-direction: column; gap: 6px; }
.stack-lg { display: flex; flex-direction: column; gap: 24px; }
.grow { flex: 1; min-width: 0; } .gap-xs { gap: 4px; } .gap-sm { gap: 6px; } .gap-lg { gap: 20px; }
.mt-sm { margin-top: 8px; } .mt { margin-top: 16px; } .mt-lg { margin-top: 28px; } .mb { margin-bottom: 16px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
/* Las dos tarjetas («Necesitan tu atención» y «Próximos contenidos») miden lo mismo: flex estira ambas
   a la altura de la más alta. En pantallas estrechas se apilan. */
#dash-grid { display: flex; align-items: stretch; }
#dash-grid > * { flex: 1 1 0; min-width: 0; }
@media (max-width: 1100px) { #dash-grid { flex-direction: column; } }
/* Dashboard del cliente: dos columnas que terminan a la misma altura; la última tarjeta de la columna
   más corta se estira para no dejar huecos. */
#co-grid { display: flex; gap: 16px; align-items: stretch; }
#co-grid > :first-child { flex: 1.4 1 0; }
#co-grid > :last-child { flex: 1 1 0; }
#co-grid > * { min-width: 0; display: flex; flex-direction: column; }
#co-grid > * > :last-child { flex: 1 1 auto; }
@media (max-width: 1100px) { #co-grid { flex-direction: column; } }
.center { text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.divider-v { width: 1px; align-self: stretch; background: var(--border); }
.tabular { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- layout app */
.app { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; background: var(--sidebar-bg); color: var(--sidebar-text);
  display: flex; flex-direction: column; padding: 18px 14px; gap: 6px; overflow-y: auto; overflow-x: hidden; z-index: 40;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent;
}
/* El menú de cuenta ocupa el ancho del sidebar: con ancho fijo desbordaba y aparecía scroll horizontal. */
.sidebar .dropdown-menu { left: 0; right: 0; min-width: 0; }
.sidebar .nav-link, .sidebar .nav-client, .sidebar .brand { min-width: 0; }
.brand { display: flex; align-items: center; gap: 11px; padding: 6px 8px 18px; color: #fff; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; font-weight: 800; font-size: 14px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; flex-shrink: 0; overflow: hidden;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--brand) 40%, transparent);
}
.brand-mark img { width: 100%; height: 100%; object-fit: cover; }
.brand-name { font-weight: 700; font-size: 14.5px; line-height: 1.2; letter-spacing: -.01em; }
.brand-sub { font-size: 11.5px; color: var(--sidebar-muted); }
.nav-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: var(--sidebar-muted); padding: 14px 10px 6px; font-weight: 700; }
.nav-link {
  display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 10px; color: var(--sidebar-text);
  font-weight: 550; transition: background .15s, color .15s;
}
.nav-link:hover { background: var(--sidebar-hover); color: #fff; }
.nav-link.active { background: var(--sidebar-active); color: #fff; }
.nav-link.active svg { color: var(--brand); filter: brightness(1.35); }
.nav-link .count { margin-left: auto; font-size: 11px; background: rgba(255,255,255,.1); padding: 1px 7px; border-radius: 99px; color: #fff; }
.nav-client { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 10px; color: var(--sidebar-text); font-size: 13px; }
.nav-client:hover { background: var(--sidebar-hover); color: #fff; }
.nav-client.active { background: var(--sidebar-active); color: #fff; }
.sidebar-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.06); }
.agency-switch { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; width: 100%; background: transparent; border: 0; color: #fff; cursor: pointer; text-align: left; }
.agency-switch:hover { background: var(--sidebar-hover); }
.sidebar-backdrop { display: none; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: 64px; display: flex; align-items: center; gap: 12px; padding: 0 28px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid transparent; transition: border-color .2s;
}
.topbar.scrolled { border-bottom-color: var(--border); }
.search-trigger {
  display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 12px; width: min(420px, 100%);
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; color: var(--faint); cursor: text;
  transition: border-color .15s, box-shadow .15s;
}
.search-trigger:hover { border-color: var(--border-strong); }
.search-trigger kbd { margin-left: auto; }
kbd { font: 600 11px var(--font); background: var(--surface-3); border: 1px solid var(--border); border-bottom-width: 2px; padding: 1px 6px; border-radius: 6px; color: var(--muted); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn.menu-toggle { display: none; }
.page { padding: 22px 28px 64px; width: 100%; max-width: 1480px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .eyebrow { font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 4px; display: flex; gap: 6px; align-items: center; }
.page-head p { color: var(--muted); margin-top: 4px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------------------------------------------------------------- botones */
.btn {
  --b-bg: var(--surface); --b-fg: var(--text); --b-bd: var(--border);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 14px;
  border-radius: 11px; border: 1px solid var(--b-bd); background: var(--b-bg); color: var(--b-fg); font-weight: 600;
  font-size: 13.5px; cursor: pointer; white-space: nowrap; user-select: none; min-width: 0; overflow: hidden;
  transition: transform .12s var(--ease), background .15s, box-shadow .15s, border-color .15s, opacity .15s;
  box-shadow: var(--shadow-xs);
}
.btn:hover { border-color: var(--border-strong); background: var(--surface-2); }
.btn:active { transform: scale(.98); }
.btn[disabled], .btn.is-loading { opacity: .55; pointer-events: none; }
.btn.is-loading::after { content: ""; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.btn-primary { --b-bg: var(--brand); --b-fg: var(--brand-ink); --b-bd: transparent; box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 6px 16px color-mix(in srgb, var(--brand) 28%, transparent); }
.btn-primary:hover { background: color-mix(in srgb, var(--brand) 88%, #000); border-color: transparent; }
.btn-dark { --b-bg: var(--text); --b-fg: var(--surface); --b-bd: transparent; }
.btn-dark:hover { background: color-mix(in srgb, var(--text) 85%, var(--brand)); }
.btn-success { --b-bg: #10B981; --b-fg: #fff; --b-bd: transparent; box-shadow: 0 6px 16px rgba(16,185,129,.28); }
.btn-success:hover { background: #0EA371; }
.btn-warn { --b-bg: var(--t-orange-bg); --b-fg: var(--t-orange); --b-bd: transparent; box-shadow: none; }
.btn-warn:hover { background: color-mix(in srgb, var(--t-orange-bg) 80%, var(--t-orange)); }
.btn-danger-soft { --b-bg: var(--t-red-bg); --b-fg: var(--t-red); --b-bd: transparent; box-shadow: none; }
.btn-danger-soft:hover { background: color-mix(in srgb, var(--t-red-bg) 85%, var(--t-red)); }
.btn-ghost { --b-bg: transparent; --b-bd: transparent; box-shadow: none; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); border-color: transparent; }
.btn-soft { --b-bg: var(--brand-soft); --b-fg: var(--brand); --b-bd: transparent; box-shadow: none; }
.btn-soft:hover { background: color-mix(in srgb, var(--brand) 18%, transparent); }
.btn-sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 9px; gap: 6px; }
.btn-lg { height: 48px; padding: 0 22px; font-size: 15px; border-radius: 14px; }
.btn-icon { width: 38px; padding: 0; }
.btn-icon.btn-sm { width: 32px; }
.btn-block { width: 100%; }
.icon-btn { position: relative; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; border: 1px solid transparent; background: transparent; color: var(--text-2); cursor: pointer; transition: background .15s; }
.icon-btn:hover { background: var(--surface); border-color: var(--border); }
.icon-btn .pip { position: absolute; top: 3px; right: 2px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px; background: #EF4444; color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--bg); }

/* ---------------------------------------------------------------- tarjetas */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 0; }
.card-head h2, .card-head h3 { display: flex; align-items: center; gap: 8px; }
.card-body { padding: 16px 20px 20px; }
.card-link { transition: transform .2s var(--ease), box-shadow .2s, border-color .2s; }
.card-link:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 28px 0 12px; gap: 12px; }
.section-title h2 { font-size: 17px; display: flex; align-items: center; gap: 8px; }

.kpi { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; position: relative; overflow: hidden; }
.kpi-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--tone-bg, var(--surface-3)); color: var(--tone, var(--text)); }
.kpi-value { font-size: 28px; font-weight: 750; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.kpi-label { color: var(--muted); font-size: 12.5px; font-weight: 550; }
a.kpi:hover { border-color: var(--border-strong); }

.tone-neutral { --tone: var(--t-neutral); --tone-bg: var(--t-neutral-bg); }
.tone-blue { --tone: var(--t-blue); --tone-bg: var(--t-blue-bg); }
.tone-violet { --tone: var(--t-violet); --tone-bg: var(--t-violet-bg); }
.tone-amber { --tone: var(--t-amber); --tone-bg: var(--t-amber-bg); }
.tone-orange { --tone: var(--t-orange); --tone-bg: var(--t-orange-bg); }
.tone-green { --tone: var(--t-green); --tone-bg: var(--t-green-bg); }
.tone-teal { --tone: var(--t-teal); --tone-bg: var(--t-teal-bg); }
.tone-ink { --tone: var(--t-ink); --tone-bg: var(--t-ink-bg); }
.tone-red { --tone: var(--t-red); --tone-bg: var(--t-red-bg); }
.tone-muted { --tone: var(--t-muted); --tone-bg: var(--t-muted-bg); }

.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 99px; font-size: 11.5px;
  font-weight: 650; background: var(--tone-bg, var(--surface-3)); color: var(--tone, var(--text-2)); white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.badge.no-dot::before { display: none; }
/* Nunca más ancha que su contenedor; en tarjetas estrechas el texto baja de línea en vez de salirse. */
.badge { max-width: 100%; overflow: hidden; }
.badge::before { flex-shrink: 0; }
.media-card .meta .badge { white-space: normal; height: auto; min-height: 24px; padding-top: 4px; padding-bottom: 4px; line-height: 1.2; align-self: flex-start; }
.badge-lg { height: 30px; padding: 0 12px; font-size: 12.5px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 9px; border-radius: 8px; font-size: 12px; font-weight: 600; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.chip svg.lucide { width: 13px; height: 13px; }
.platform-dot { width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; background: var(--pc, #111); color: #fff; flex-shrink: 0; }
.platform-dot svg.lucide { width: 12px; height: 12px; stroke-width: 2.3; }

.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: linear-gradient(135deg, color-mix(in srgb, var(--av, var(--brand)) 85%, #fff), var(--av, var(--brand))); color: #fff; flex-shrink: 0; overflow: hidden; letter-spacing: 0; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 24px; height: 24px; font-size: 10px; } .avatar-lg { width: 44px; height: 44px; font-size: 15px; } .avatar-xl { width: 64px; height: 64px; font-size: 22px; border-radius: 18px; }
.avatar-square { border-radius: 10px; }
.avatars { display: flex; } .avatars .avatar { border: 2px solid var(--surface); margin-left: -8px; } .avatars .avatar:first-child { margin-left: 0; }

/* ---------------------------------------------------------------- progreso de plan */
.plan-row { display: grid; grid-template-columns: minmax(120px, 190px) 1fr auto; align-items: center; gap: 14px; padding: 10px 0; }
.plan-row + .plan-row { border-top: 1px dashed var(--border); }
.plan-type { display: flex; align-items: center; gap: 10px; font-weight: 650; min-width: 0; }
.plan-type .ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 14%, transparent); color: var(--c); flex-shrink: 0; }
.plan-type .ic svg.lucide { width: 16px; height: 16px; }
.pbar { position: relative; height: 10px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.pbar > span { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 99px; transition: width .8s var(--ease); }
.pbar .p-done { background: color-mix(in srgb, var(--c, var(--brand)) 28%, transparent); }
.pbar .p-approved { background: color-mix(in srgb, var(--c, var(--brand)) 60%, transparent); }
.pbar .p-published { background: var(--c, var(--brand)); }
.pbar-lg { height: 14px; }
.plan-count { font-weight: 750; font-size: 15px; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.plan-count small { color: var(--muted); font-weight: 600; font-size: 12px; }
.plan-sub { display: flex; gap: 12px; font-size: 11.5px; color: var(--muted); margin-top: 5px; flex-wrap: wrap; }
.plan-sub b { color: var(--text-2); font-weight: 700; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--brand); display: inline-block; }
.legend i.l-done { background: color-mix(in srgb, var(--brand) 28%, transparent); }
.legend i.l-approved { background: color-mix(in srgb, var(--brand) 60%, transparent); }
.ring { --p: 0; --size: 64px; width: var(--size); height: var(--size); border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--c, var(--brand)) calc(var(--p) * 1%), var(--surface-3) 0); flex-shrink: 0; }
.ring::before { content: attr(data-label); width: calc(var(--size) - 12px); height: calc(var(--size) - 12px); border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-weight: 750; font-size: calc(var(--size) * .22); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.plan-summary { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; }
.plan-summary > div { background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; }
.plan-summary b { display: block; font-size: 22px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.plan-summary span { font-size: 12px; color: var(--muted); font-weight: 600; }

/* ---------------------------------------------------------------- media / thumbnails */
.thumb { position: relative; background: var(--surface-3); border-radius: var(--radius); overflow: hidden; aspect-ratio: 4/5; }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; }
.thumb.r-916 { aspect-ratio: 9/16; } .thumb.r-11 { aspect-ratio: 1/1; } .thumb.r-169 { aspect-ratio: 16/9; }
.thumb-empty { display: grid; place-items: center; color: var(--faint); height: 100%; background: repeating-linear-gradient(135deg, var(--surface-3) 0 10px, var(--surface-2) 10px 20px); }
.thumb .play { position: absolute; inset: auto auto 8px 8px; width: 26px; height: 26px; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; display: grid; place-items: center; backdrop-filter: blur(6px); }
.thumb .play svg.lucide { width: 12px; height: 12px; fill: currentColor; }
.thumb .count { position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,.55); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 99px; display: flex; align-items: center; gap: 4px; backdrop-filter: blur(6px); }
.thumb .count svg.lucide { width: 11px; height: 11px; }
img[loading="lazy"] { background: var(--surface-3); }
.fade-img { opacity: 0; transition: opacity .35s; } .fade-img.loaded { opacity: 1; }

.media-card { display: flex; flex-direction: column; gap: 10px; padding: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); transition: transform .2s var(--ease), box-shadow .2s; position: relative; cursor: pointer; }
.media-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.media-card .meta { padding: 0 4px 4px; display: flex; flex-direction: column; gap: 6px; }
.media-card .title { font-weight: 650; font-size: 13.5px; line-height: 1.3; }
.media-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.media-grid.lg { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.select-box { position: absolute; top: 18px; left: 18px; z-index: 2; width: 26px; height: 26px; border-radius: 8px; background: rgba(255,255,255,.9); border: 1.5px solid rgba(0,0,0,.15); display: none; place-items: center; color: #fff; }
.selecting .select-box { display: grid; }
.media-card.selected { box-shadow: 0 0 0 2px var(--brand), var(--shadow); }
.media-card.selected .select-box { background: var(--brand); border-color: var(--brand); }
.media-card .select-box svg { opacity: 0; } .media-card.selected .select-box svg { opacity: 1; }

/* ---------------------------------------------------------------- listas de contenido */
.content-row { display: flex; align-items: center; gap: 14px; padding: 10px; border-radius: 14px; transition: background .15s; cursor: pointer; min-width: 0; }
.content-row:hover { background: var(--surface-2); }
.content-row .thumb { width: 52px; flex-shrink: 0; aspect-ratio: 4/5; border-radius: 10px; }
.content-row .title { font-weight: 650; }
.list-divided > * + * { border-top: 1px solid var(--border); border-radius: 0; }

.attention { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 16px; background: var(--tone-bg); color: var(--text); transition: transform .15s var(--ease); }
.attention:hover { transform: translateX(3px); }
.attention .ic { width: 38px; height: 38px; border-radius: 12px; background: var(--surface); color: var(--tone); display: grid; place-items: center; flex-shrink: 0; box-shadow: var(--shadow-xs); }
.attention .num { font-size: 22px; font-weight: 800; color: var(--tone); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

.activity-item { display: flex; gap: 12px; padding: 10px 0; }
.activity-item + .activity-item { border-top: 1px solid var(--border); }
.activity-item .ic { width: 30px; height: 30px; border-radius: 9px; background: var(--surface-3); color: var(--text-2); display: grid; place-items: center; flex-shrink: 0; }
.activity-item .ic svg.lucide { width: 15px; height: 15px; }
.activity-text { font-size: 13px; line-height: 1.45; } .activity-text b { font-weight: 650; }
.timeline-day { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 18px 0 4px; }

/* ---------------------------------------------------------------- formularios */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: 12.5px; font-weight: 650; color: var(--text-2); }
.help { font-size: 12px; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 12px; border-radius: 11px; border: 1px solid var(--border); background: var(--surface);
  transition: border-color .15s, box-shadow .15s; outline: none; font-size: 14px;
}
.textarea { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%238a8a9a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--border-strong); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.input-color { width: 48px; padding: 4px; cursor: pointer; }
.input-group { position: relative; } .input-group svg.lucide { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; } .input-group .input { padding-left: 38px; }
/* Una sola caja: la persona se escribe y «@sufijo» va dentro como texto atenuado (se recorta si no cabe). */
.input-suffix { display: flex; align-items: center; min-width: 0; height: 40px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface); transition: border-color .15s, box-shadow .15s; cursor: text; }
.input-suffix:hover { border-color: var(--border-strong); }
.input-suffix:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.input-suffix .input, .input-suffix .input:hover, .input-suffix .input:focus { flex: 1 1 0; min-width: 5ch; height: 100%; padding-right: 2px; border: 0; border-radius: 11px 0 0 11px; background: transparent; box-shadow: none; }
.input-suffix > span { flex: 0 1 auto; min-width: 0; max-width: 65%; padding-right: 12px; color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }
.switch { position: relative; display: inline-flex; align-items: center; gap: 12px; cursor: pointer; }
.switch input { appearance: none; width: 40px; height: 24px; border-radius: 99px; background: var(--border-strong); position: relative; cursor: pointer; transition: background .2s; flex-shrink: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease); box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked { background: var(--brand); } .switch input:checked::after { transform: translateX(16px); }
.choice-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.choice { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 14px; border: 1.5px solid var(--border); border-radius: 16px; cursor: pointer; background: var(--surface); transition: border-color .15s, box-shadow .15s, transform .15s var(--ease); }
.choice:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice:has(input:checked), .choice.selected { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.choice .ic { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: color-mix(in srgb, var(--pc, var(--brand)) 13%, transparent); color: var(--pc, var(--brand)); }
.choice-title { font-weight: 650; } .choice-sub { font-size: 12px; color: var(--muted); }
.errors { background: var(--t-red-bg); color: var(--t-red); padding: 10px 14px; border-radius: 12px; font-weight: 600; font-size: 13px; }

/* ---------------------------------------------------------------- tabs / segmented */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 22px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
/* Degradado en el borde por el que hay más pestañas ocultas (app.js añade more-left / more-right). */
.tabs, .client-filter { position: relative; }
.tabs.more-right, .client-filter.more-right { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent); }
.tabs.more-left, .client-filter.more-left { -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to left, #000 calc(100% - 36px), transparent); }
.tabs.more-left.more-right, .client-filter.more-left.more-right { -webkit-mask-image: linear-gradient(to right, transparent, #000 36px, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to right, transparent, #000 36px, #000 calc(100% - 36px), transparent); }
.tab { display: inline-flex; align-items: center; gap: 7px; padding: 10px 12px 12px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; transition: color .15s; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--brand); }
.tab svg.lucide { width: 16px; height: 16px; }
.segmented { display: inline-flex; background: var(--surface-3); padding: 3px; border-radius: 12px; gap: 2px; }
.segmented a, .segmented button { padding: 6px 12px; border-radius: 9px; font-weight: 600; font-size: 12.5px; color: var(--muted); border: 0; background: transparent; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.segmented .active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); }
.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface); font-weight: 600; font-size: 12.5px; color: var(--text-2); cursor: pointer; }
.filter-chip:hover { border-color: var(--border-strong); }
.filter-chip.active { background: var(--text); color: var(--surface); border-color: var(--text); }
.filter-chip .n { font-size: 11px; opacity: .7; }

/* ---------------------------------------------------------------- client header */
.client-hero { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.client-logo { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; font-weight: 800; font-size: 19px; color: #fff; background: var(--cc, var(--brand)); overflow: hidden; flex-shrink: 0; box-shadow: 0 8px 20px color-mix(in srgb, var(--cc, var(--brand)) 30%, transparent); }
.client-logo img { width: 100%; height: 100%; object-fit: cover; }
.client-logo.sm { width: 28px; height: 28px; border-radius: 8px; font-size: 11px; box-shadow: none; }
.client-logo.md { width: 42px; height: 42px; border-radius: 12px; font-size: 15px; }
.client-card { padding: 18px; display: flex; flex-direction: column; gap: 16px; min-width: 0; position: relative; }
/* El enlace del nombre cubre toda la tarjeta; los botones de acción quedan por encima y se pueden pulsar. */
.stretched-link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.client-card-actions { position: relative; z-index: 1; display: flex; justify-content: flex-end; gap: 8px; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); }
.plan-request { display: flex; gap: 12px; padding: 14px 18px; border-top: 1px solid var(--border); }
.card > .plan-request:first-child { border-top: 0; }
.card-head + .plan-request { border-top: 1px solid var(--border); }
.plan-request-ic { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; background: var(--brand-soft); color: var(--brand); }
.plan-request-ic svg.lucide { width: 16px; height: 16px; }
.plan-request-notes { white-space: pre-line; color: var(--text-2); }
.plan-request-reply { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); color: var(--text-2); }
.priority-card { border-color: color-mix(in srgb, var(--t-violet) 45%, var(--border)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--t-violet) 12%, transparent), var(--shadow-sm); }
.priority-card .plan-request .client-logo { margin-top: 2px; }
/* Punto de novedades junto a cada cliente de la barra lateral; el tono es el de la novedad más importante. */
.notice-dot { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; display: inline-grid; place-items: center; flex-shrink: 0; font-size: 11px; font-weight: 800; line-height: 1; color: var(--tone-bg, #fff); background: var(--tone, var(--brand)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tone, var(--brand)) 22%, transparent); animation: noticeIn .35s var(--ease); }
.notice-dot.tone-brand { --tone: var(--brand); --tone-bg: #fff; }
@keyframes noticeIn { from { transform: scale(.4); opacity: 0; } }
/* Tarjetas de cumplimiento: 2 por fila; si la última fila queda con una, se centra. */
.plan-cards { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; }
.plan-card { flex: 0 0 calc(50% - 8px); min-width: 0; }
@media (max-width: 900px) { .plan-card { flex-basis: 100%; } }
.plan-row-spacer { visibility: hidden; }
.plan-empty-slot { position: relative; }
.plan-empty-box { position: absolute; inset: 50% 0 auto; transform: translateY(-50%); background: var(--surface-2); border-radius: 12px; padding: 10px 12px; }
/* Filtro por cliente del dashboard: logos clicables; en pantallas estrechas se desliza en horizontal. */
.client-filter { display: flex; gap: 8px; margin: -4px 0 20px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: thin; }
.client-chip { display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; max-width: 220px; height: 40px; padding: 0 14px 0 6px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: 13px; font-weight: 650; transition: border-color .15s, background .15s, color .15s; }
.client-chip > svg.lucide { width: 28px; height: 16px; }
.client-chip:hover { border-color: var(--border-strong); color: var(--text); }
.client-chip.active { border-color: var(--brand); background: var(--brand-soft); color: var(--text); box-shadow: 0 0 0 3px var(--brand-softer); }
.client-chip .client-logo.sm { width: 28px; height: 28px; border-radius: 99px; }
.plan-warning { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; margin-bottom: 16px; border-radius: 14px; background: var(--t-amber-bg); color: var(--t-amber); border: 1px solid color-mix(in srgb, var(--t-amber) 35%, transparent); }
.plan-warning > svg.lucide { flex-shrink: 0; margin-top: 2px; }
.plan-warning b { display: block; }
.plan-warning span { display: block; font-size: 13px; color: var(--text-2); margin-top: 2px; }
/* Editor del plan: cada tipo con su total y, si se reparte, sus redes debajo con sangría. */
.plan-edit-type { padding: 8px 0; border-bottom: 1px dashed var(--border); }
.plan-edit-type > .check { margin: 6px 0 0 38px; }
.plan-split { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 2px 38px; padding-left: 12px; border-left: 2px solid var(--border); }
.format-type-row { padding: 4px 0 4px 30px; gap: 12px; }
.format-type-head { display: flex; justify-content: space-between; font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.format-type-head span:last-child { width: min(220px, 55%); }
/* Configuración → Tipos de entregable y canales. */
.type-channels-row { display: grid; grid-template-columns: minmax(150px, 200px) 1fr; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px dashed var(--border); }
@media (max-width: 760px) { .type-channels-row { grid-template-columns: 1fr; } }
.channel-toggle { position: relative; cursor: pointer; }
.channel-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.channel-toggle span { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 99px; border: 1px solid var(--border); color: var(--muted); font-size: 12.5px; font-weight: 600; transition: background .15s, border-color .15s, color .15s; }
.channel-toggle span svg.lucide { color: var(--pc); }
.channel-toggle input:checked + span { border-color: color-mix(in srgb, var(--pc) 60%, var(--border)); background: color-mix(in srgb, var(--pc) 16%, transparent); color: var(--text); }
.channel-toggle input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.own-channel { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 2px 0 10px; border-radius: 99px; border: 1px solid color-mix(in srgb, var(--pc) 50%, var(--border)); background: color-mix(in srgb, var(--pc) 12%, transparent); font-size: 12.5px; font-weight: 600; }
.own-channel > svg.lucide { color: var(--pc); }
.archived-box { border-top: 1px solid var(--border); padding-top: 12px; }
.archived-box > summary { cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.format-change-note { margin: 0 0 4px 30px; padding: 8px 10px; border-radius: 10px; font-size: 12.5px; background: var(--t-amber-bg); color: var(--t-amber); }
.chip.chip-changed { background: var(--t-amber-bg); color: var(--t-amber); }
.format-summary { background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; }
.format-summary-row { display: grid; grid-template-columns: minmax(140px, 190px) 1fr; gap: 10px; align-items: center; padding: 4px 0; }
@media (max-width: 760px) { .format-summary-row { grid-template-columns: 1fr; gap: 4px; } }
.format-type-row .select { width: min(220px, 55%); }
.preview-banner { display: flex; align-items: center; gap: 12px; padding: 14px 16px; margin-bottom: 18px; border-radius: 16px; background: var(--brand-softer, var(--surface-2)); border: 1px solid color-mix(in srgb, var(--brand) 25%, var(--border)); }
.preview-banner > svg.lucide { color: var(--brand); flex-shrink: 0; }

/* ---------------------------------------------------------------- empty / skeleton */
.empty { text-align: center; padding: 48px 20px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty-art { width: 76px; height: 76px; border-radius: 24px; display: grid; place-items: center; background: linear-gradient(135deg, var(--brand-soft), color-mix(in srgb, var(--brand-2) 14%, transparent)); color: var(--brand); margin-bottom: 6px; position: relative; }
.empty-art svg.lucide { width: 32px; height: 32px; }
.empty-art::after { content: ""; position: absolute; inset: -8px; border-radius: 30px; border: 1px dashed color-mix(in srgb, var(--brand) 30%, transparent); }
.empty h3 { font-size: 16px; } .empty p { color: var(--muted); max-width: 380px; }
.skeleton { background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 37%, var(--surface-3) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: 10px; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.08); } 100% { transform: scale(1); opacity: 1; } }
.animate-in > * { animation: fadeUp .45s var(--ease) both; }
.animate-in > *:nth-child(2) { animation-delay: .04s; } .animate-in > *:nth-child(3) { animation-delay: .08s; } .animate-in > *:nth-child(4) { animation-delay: .12s; } .animate-in > *:nth-child(5) { animation-delay: .16s; } .animate-in > *:nth-child(6) { animation-delay: .2s; }

/* ---------------------------------------------------------------- dropdown / popover */
.dropdown { position: relative; }
.dropdown-menu { position: absolute; top: calc(100% + 8px); right: 0; min-width: 220px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 60; opacity: 0; transform: translateY(-6px) scale(.98); pointer-events: none; transition: opacity .15s, transform .15s var(--ease); transform-origin: top right; }
.dropdown.open .dropdown-menu { opacity: 1; transform: none; pointer-events: auto; }
.dropdown-menu.left { right: auto; left: 0; transform-origin: top left; }
.dropdown-menu.up { top: auto; bottom: calc(100% + 8px); }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 10px; border: 0; background: transparent; cursor: pointer; font-weight: 550; text-align: left; color: var(--text-2); font-size: 13.5px; }
.menu-item:hover { background: var(--surface-3); color: var(--text); }
.menu-item.danger { color: var(--t-red); }
.menu-sep { height: 1px; background: var(--border); margin: 6px 4px; }
.menu-head { padding: 10px 10px 8px; }
.notif-panel { width: min(400px, calc(100vw - 24px)); padding: 0; }
.notif-list { max-height: 440px; overflow-y: auto; padding: 6px; }
.notif { display: flex; gap: 12px; padding: 10px; border-radius: 12px; }
.notif:hover { background: var(--surface-2); }
.notif.unread { background: var(--brand-softer); }
.notif .ic { width: 34px; height: 34px; border-radius: 10px; background: var(--surface-3); display: grid; place-items: center; flex-shrink: 0; color: var(--text-2); }
.notif.unread .ic { background: var(--brand-soft); color: var(--brand); }

/* ---------------------------------------------------------------- dialog / drawer */
dialog { border: 0; padding: 0; background: transparent; color: var(--text); max-width: 100vw; max-height: 100vh; }
dialog::backdrop { background: var(--overlay); backdrop-filter: blur(3px); animation: fadeIn .2s; }
@keyframes fadeIn { from { opacity: 0; } }
.modal { width: min(560px, calc(100vw - 32px)); background: var(--surface); border-radius: 24px; box-shadow: var(--shadow-lg); margin: auto; animation: modalIn .28s var(--ease); overflow: hidden; }
.modal-lg { width: min(820px, calc(100vw - 32px)); }
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 22px 24px 0; }
.modal-head p { color: var(--muted); margin-top: 4px; }
.modal-body { padding: 18px 24px; max-height: calc(100vh - 220px); overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 24px 22px; }
/* El detalle de contenido se abre como una ventana grande centrada, igual que el resto de modales. */
dialog.drawer-dialog { margin: auto; }
.drawer { width: min(1180px, calc(100vw - 48px)); height: calc(100vh - 48px); background: var(--bg); border-radius: 24px; overflow: hidden; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: modalIn .28s var(--ease); }
.drawer-head { display: flex; align-items: center; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--border); background: var(--surface); }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px; }

/* ---------------------------------------------------------------- usuarios por agencia (Super Admin) */
.org { overflow: hidden; }
.org > summary, .org-client > summary { list-style: none; cursor: pointer; }
.org > summary::-webkit-details-marker, .org-client > summary::-webkit-details-marker { display: none; }
.org-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; }
.org-head:hover, .org-client-head:hover { background: var(--surface-2); }
.org-chevron { color: var(--muted); transition: transform .2s var(--ease); flex-shrink: 0; }
details[open] > summary .org-chevron { transform: rotate(180deg); }
.org-section { display: flex; align-items: center; gap: 8px; padding: 14px 20px 6px; border-top: 1px solid var(--border); font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.org-empty { padding: 6px 20px 14px; }
.org-client { margin: 6px 12px; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.org-client:last-child { margin-bottom: 14px; }
.org-client-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; min-width: 0; }
.org-client .urow { padding-left: 14px; padding-right: 12px; }
.urow { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(0, 1.1fr) 120px 110px 120px; align-items: center; gap: 12px; padding: 10px 20px; border-top: 1px solid var(--border); }
.urow-main { min-width: 0; }
.urow-action { text-align: right; }

/* ---------------------------------------------------------------- toasts */
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 1000; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 24px); }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; background: #15151F; color: #fff; padding: 11px 16px 11px 12px; border-radius: 14px; box-shadow: var(--shadow-lg); font-weight: 600; font-size: 13.5px; animation: toastIn .35s var(--ease); }
.toast .ic { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: #10B981; }
.toast.error .ic { background: #EF4444; } .toast.info .ic { background: var(--brand); }
.toast .ic svg.lucide { width: 14px; height: 14px; stroke-width: 3; }
.toast.leaving { animation: toastOut .25s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px) scale(.96); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px) scale(.97); } }

/* ---------------------------------------------------------------- command palette */
.palette { width: min(640px, calc(100vw - 24px)); margin: 12vh auto auto; background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-lg); overflow: hidden; animation: modalIn .22s var(--ease); }
.palette-input { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.palette-input input { border: 0; outline: 0; background: transparent; font-size: 16px; flex: 1; }
.palette-results { max-height: 420px; overflow-y: auto; padding: 8px; }
.palette-group { font-size: 11px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: .08em; padding: 10px 10px 4px; }
.palette-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 12px; }
.palette-item.active, .palette-item:hover { background: var(--surface-3); }
.palette-item .ic { width: 32px; height: 32px; border-radius: 9px; background: var(--surface-3); display: grid; place-items: center; color: var(--text-2); }
.palette-item.active .ic { background: var(--surface); }

/* ---------------------------------------------------------------- kanban */
.board-wrap { overflow-x: auto; margin: 0 -28px; padding: 0 28px 24px; }
/* El encaje por columnas ayuda al deslizar con el dedo; con ratón anularía el arrastre del fondo. */
@media (pointer: coarse) { .board-wrap { scroll-snap-type: x proximity; } }
.board-wrap:has(.board.is-dragging) { scroll-snap-type: none; } /* el snap anula el autoscroll al arrastrar */
/* Arrastrar el fondo desplaza el tablero (board.js): mano abierta / cerrada. */
.board-wrap { cursor: grab; }
.board-wrap.is-panning { cursor: grabbing; scroll-snap-type: none; user-select: none; }
.board-wrap.is-panning * { cursor: grabbing !important; }
.board.is-dragging .column { scroll-snap-align: none; }
.board { display: grid; grid-auto-flow: column; grid-auto-columns: 292px; gap: 14px; align-items: start; min-height: calc(100vh - 260px); }
.column { background: var(--surface-3); border-radius: 18px; padding: 10px; display: flex; flex-direction: column; gap: 8px; max-height: calc(100vh - 220px); scroll-snap-align: start; border: 1px solid transparent; transition: border-color .15s, background .15s; }
.column.drop-allowed { border-color: color-mix(in srgb, var(--brand) 40%, transparent); background: var(--brand-softer); }
.column.drop-denied { opacity: .45; }
.column-head { display: flex; align-items: center; gap: 8px; padding: 4px 6px 6px; font-weight: 700; font-size: 13px; }
.column-head .n { margin-left: auto; font-size: 12px; color: var(--muted); background: var(--surface); border-radius: 99px; padding: 1px 8px; }
.column-body { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 80px; padding: 2px; margin: -2px; flex: 1; }
.kcard { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 8px; display: flex; flex-direction: column; gap: 8px; cursor: grab; transition: box-shadow .15s, transform .15s var(--ease); }
.kcard:hover { box-shadow: var(--shadow); }
.kcard .thumb { aspect-ratio: 16/10; border-radius: 10px; }
.kcard-meta { padding: 0 4px 2px; display: flex; flex-direction: column; gap: 6px; }
.kcard .title { font-weight: 650; font-size: 13px; line-height: 1.3; }
.sortable-ghost { opacity: .35; } .sortable-drag { transform: rotate(2deg); box-shadow: var(--shadow-lg) !important; cursor: grabbing; }
.column-empty { border: 1.5px dashed var(--border-strong); border-radius: 12px; padding: 18px; text-align: center; color: var(--faint); font-size: 12px; }
.column-body:has(.kcard) .column-empty { display: none; }

/* ---------------------------------------------------------------- calendario (FullCalendar) */
.cal-shell { padding: 14px; }
.fc { --fc-border-color: var(--border); --fc-today-bg-color: var(--brand-softer); --fc-page-bg-color: var(--surface); --fc-neutral-bg-color: var(--surface-2); --fc-event-border-color: transparent; font-size: 13px; }
.fc .fc-toolbar { display: none; }
/* overflow: clip redondea igual que hidden pero sin crear un contenedor de scroll, que anularía el sticky. */
.fc .fc-scrollgrid { border-radius: 14px; overflow: clip; }
/* Días de la semana fijos al hacer scroll, justo debajo de la topbar (64px). */
.cal-shell .fc .fc-scrollgrid-section-header.fc-scrollgrid-section-sticky > * { top: 64px; z-index: 5; background: var(--surface); box-shadow: 0 1px 0 var(--border); }
.fc .fc-col-header-cell-cushion { padding: 10px 4px; font-weight: 650; color: var(--muted); text-transform: capitalize; font-size: 12px; }
.fc .fc-daygrid-day-number { font-weight: 650; font-size: 12.5px; padding: 8px 10px; color: var(--text-2); }
.fc .fc-day-today .fc-daygrid-day-number { background: var(--brand); color: #fff; border-radius: 99px; min-width: 26px; text-align: center; margin: 4px; padding: 3px 8px; }
.fc .fc-daygrid-day-frame { min-height: 128px; }
.fc .fc-day-other .fc-daygrid-day-top { opacity: .45; }
.fc .fc-daygrid-event-harness { margin: 0 6px 5px; }
.fc .fc-event { background: transparent; border: 0; box-shadow: none; }
.fc-h-event .fc-event-main { color: inherit; }
.fc .fc-daygrid-more-link { font-weight: 650; color: var(--brand); padding: 2px 6px; }
.fc .fc-timegrid-slot { height: 44px; }
.fc .fc-timegrid-slot-label-cushion { font-size: 11.5px; color: var(--faint); }
.fc .fc-timegrid-event { border-radius: 10px; overflow: hidden; }
.fc .fc-highlight { background: var(--brand-soft); }
.ev { display: flex; align-items: center; gap: 7px; padding: 4px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-xs); width: 100%; overflow: hidden; cursor: pointer; transition: box-shadow .15s, transform .15s var(--ease); color: var(--text); }
.ev:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.ev-thumb { width: 30px; height: 36px; border-radius: 7px; background: var(--surface-3) center/cover no-repeat; flex-shrink: 0; position: relative; }
.ev-thumb .pd { position: absolute; bottom: -3px; right: -3px; width: 16px; height: 16px; border-radius: 5px; background: var(--pc); color: #fff; display: grid; place-items: center; border: 1.5px solid var(--surface); }
.ev-thumb .pd svg.lucide { width: 9px; height: 9px; stroke-width: 2.6; }
.ev-body { min-width: 0; flex: 1; line-height: 1.2; }
.ev-title { font-weight: 650; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev-sub { font-size: 10.5px; color: var(--muted); display: flex; gap: 5px; align-items: center; white-space: nowrap; overflow: hidden; }
.ev-status { width: 6px; align-self: stretch; border-radius: 99px; background: var(--tone); flex-shrink: 0; }
.fc-timegrid .ev { height: 100%; align-items: flex-start; }
.cal-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.cal-title { font-size: 20px; font-weight: 750; min-width: 180px; }
.cal-title::first-letter { text-transform: uppercase; }
.agenda { display: none; }
.agenda-day { margin-bottom: 18px; }
.agenda-day-head { display: flex; align-items: baseline; gap: 8px; margin: 0 4px 8px; }
.agenda-day-head b { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }
.agenda-day-head span { color: var(--muted); font-size: 12.5px; }
.agenda-item { display: flex; gap: 12px; align-items: center; padding: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; margin-bottom: 8px; }
.agenda-time { font-weight: 750; font-size: 15px; width: 50px; font-variant-numeric: tabular-nums; }
.agenda-item .thumb { width: 54px; aspect-ratio: 4/5; border-radius: 10px; flex-shrink: 0; }

/* ---------------------------------------------------------------- wizard */
.wizard { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 28px; align-items: start; }
.steps { position: sticky; top: 88px; display: flex; flex-direction: column; gap: 4px; }
.step { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; color: var(--muted); font-weight: 600; cursor: pointer; border: 0; background: transparent; text-align: left; width: 100%; }
.step .n { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--border-strong); font-size: 12px; font-weight: 700; flex-shrink: 0; transition: all .2s; }
.step.active { color: var(--text); background: var(--surface); box-shadow: var(--shadow-xs); }
.step.active .n { border-color: var(--brand); background: var(--brand); color: #fff; }
.step.done .n { border-color: #10B981; background: #10B981; color: #fff; }
.step[disabled] { cursor: not-allowed; opacity: .6; }
.wizard-panel { display: none; animation: fadeUp .35s var(--ease); }
.wizard-panel.active { display: block; }
.wizard-foot { display: flex; justify-content: space-between; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.dropzone { border: 2px dashed var(--border-strong); border-radius: 22px; padding: 36px 20px; text-align: center; background: var(--surface); transition: border-color .15s, background .15s; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.dropzone:hover, .dropzone.over { border-color: var(--brand); background: var(--brand-softer); }
.dropzone .empty-art { margin-bottom: 4px; }
.uploads { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-top: 14px; }
.upload { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 6px; cursor: grab; }
.upload .thumb { aspect-ratio: 4/5; border-radius: 12px; }
.upload .progress { position: absolute; left: 12px; right: 12px; bottom: 44px; height: 6px; border-radius: 99px; background: rgba(255,255,255,.7); overflow: hidden; }
.upload .progress span { display: block; height: 100%; background: var(--brand); width: 0; transition: width .2s; }
.upload .name { font-size: 11.5px; padding: 6px 4px 2px; font-weight: 600; }
.upload .remove { position: absolute; top: 12px; right: 12px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; display: grid; place-items: center; cursor: pointer; }
.upload .remove svg.lucide { width: 13px; height: 13px; }
.upload .pos { position: absolute; top: 12px; left: 12px; background: rgba(0,0,0,.6); color: #fff; font-size: 11px; font-weight: 700; border-radius: 99px; padding: 1px 8px; }
.upload.error { border-color: var(--t-red); }
.upload.error .thumb { outline: 2px solid var(--t-red); }
.summary-card { position: sticky; top: 88px; }
.char-count { font-size: 11.5px; color: var(--faint); text-align: right; }

/* ---------------------------------------------------------------- detalle de contenido */
.detail { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(360px, .95fr); gap: 22px; align-items: start; }
.viewer { background: #0C0C12; border-radius: var(--radius-xl); overflow: hidden; position: relative; display: flex; align-items: center; justify-content: center; min-height: 420px; max-height: calc(100vh - 140px); }
.viewer-track { display: flex; width: 100%; height: 100%; transition: transform .45s var(--ease); }
.viewer-slide { flex: 0 0 100%; display: flex; align-items: center; justify-content: center; max-height: calc(100vh - 140px); }
.viewer-slide img, .viewer-slide video { max-height: calc(100vh - 140px); width: auto; max-width: 100%; object-fit: contain; }
.viewer-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 42px; height: 42px; border-radius: 50%; border: 0; background: rgba(255,255,255,.92); color: #111; display: grid; place-items: center; cursor: pointer; box-shadow: var(--shadow); transition: transform .15s; z-index: 2; }
.viewer-nav:hover { transform: translateY(-50%) scale(1.06); }
.viewer-nav.prev { left: 14px; } .viewer-nav.next { right: 14px; }
.viewer-counter { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,.6); color: #fff; font-weight: 700; font-size: 12px; padding: 4px 11px; border-radius: 99px; backdrop-filter: blur(8px); z-index: 2; }
.viewer-dots { position: absolute; bottom: 14px; left: 0; right: 0; display: flex; gap: 6px; justify-content: center; z-index: 2; }
.viewer-dots button { width: 7px; height: 7px; padding: 0; border-radius: 99px; background: rgba(255,255,255,.45); border: 0; cursor: pointer; transition: width .2s, background .2s; }
.viewer-dots button.active { width: 20px; background: #fff; }
.viewer-empty { color: rgba(255,255,255,.55); text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 40px; }
.viewer-tools { position: absolute; top: 14px; right: 14px; display: flex; gap: 6px; z-index: 3; }
.viewer-tools .btn { background: rgba(0,0,0,.55); color: #fff; border: 0; backdrop-filter: blur(8px); }
/* Pantalla completa del visor (detail.js). */
.viewer-slide img { cursor: zoom-in; }
.viewer [data-fullscreen-close] { display: none; }
.viewer.is-fullscreen { position: fixed; inset: 0; z-index: 1000; border-radius: 0; min-height: 0; max-height: none; height: 100dvh; background: #000; animation: fadeIn .2s; }
.viewer.is-fullscreen .viewer-track { height: 100%; }
.viewer.is-fullscreen .viewer-slide { max-height: none; height: 100dvh; }
.viewer.is-fullscreen .viewer-slide img, .viewer.is-fullscreen .viewer-slide video { max-height: 100dvh; max-width: 100vw; cursor: default; }
.viewer.is-fullscreen [data-fullscreen] { display: none; }
.viewer.is-fullscreen [data-fullscreen-close] { display: inline-flex; }
.viewer.is-fullscreen .viewer-tools { top: max(14px, env(safe-area-inset-top)); }
html.viewer-open { overflow: hidden; }
.filmstrip { display: flex; gap: 8px; margin-top: 12px; overflow-x: auto; padding: 2px; }
.filmstrip .frame { width: 64px; flex-shrink: 0; position: relative; border-radius: 12px; overflow: hidden; border: 2px solid transparent; cursor: pointer; background: var(--surface-3); }
.filmstrip .frame.active { border-color: var(--brand); }
.filmstrip .frame .thumb { border-radius: 0; }
.filmstrip .frame .n { position: absolute; bottom: 3px; left: 3px; background: rgba(0,0,0,.6); color: #fff; font-size: 10px; font-weight: 700; border-radius: 6px; padding: 0 5px; }
.filmstrip .frame .x { position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: rgba(0,0,0,.65); color: #fff; display: none; place-items: center; cursor: pointer; }
.filmstrip.editable .frame:hover .x { display: grid; }
.filmstrip .frame .x svg.lucide { width: 11px; height: 11px; }
.filmstrip.editable .frame { cursor: grab; }
.info-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px 18px; }
.info-grid .k { font-size: 11.5px; color: var(--muted); font-weight: 600; margin-bottom: 3px; }
.info-grid .v { font-weight: 600; display: flex; align-items: center; gap: 7px; min-width: 0; }
.copy-box { background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; padding: 14px; white-space: pre-wrap; line-height: 1.6; }
.hashtags { display: block; margin-top: 10px; color: var(--brand); font-weight: 600; }
/* Se reparten el ancho disponible y saltan de línea: nunca se desbordan, ni en el panel lateral. */
.decision-bar { display: flex; flex-wrap: wrap; gap: 8px; }
.decision-bar > * { flex: 1 1 148px; min-width: 0; }
.versions { display: flex; flex-direction: column; gap: 0; }
.version { display: flex; gap: 12px; padding: 12px 0; position: relative; }
.version + .version { border-top: 1px dashed var(--border); }
.version .vn { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; background: var(--surface-3); flex-shrink: 0; }
.version.current .vn { background: var(--brand); color: #fff; }
.version .vthumbs { display: flex; gap: 4px; margin-top: 8px; }
.version .vthumbs .thumb { width: 40px; border-radius: 8px; }
.comments { display: flex; flex-direction: column; gap: 14px; }
.comment { display: flex; gap: 10px; animation: fadeUp .3s var(--ease); }
.comment-bubble { background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px 16px 16px 16px; padding: 10px 13px; min-width: 0; }
.comment.kind-change_request .comment-bubble { background: var(--t-orange-bg); border-color: transparent; }
.comment.kind-rejection .comment-bubble { background: var(--t-red-bg); border-color: transparent; }
.comment.kind-approval .comment-bubble { background: var(--t-green-bg); border-color: transparent; }
.comment.internal .comment-bubble { background: repeating-linear-gradient(135deg, var(--t-amber-bg) 0 12px, color-mix(in srgb, var(--t-amber-bg) 70%, var(--surface)) 12px 24px); border-color: transparent; }
.comment-head { display: flex; align-items: center; gap: 8px; font-size: 12px; margin-bottom: 3px; flex-wrap: wrap; }
.comment-body { white-space: pre-wrap; word-break: break-word; }
.replies { margin-left: 42px; display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.comment-form { display: flex; flex-direction: column; gap: 8px; }
.comment-form .textarea { min-height: 70px; }
.history-item { display: flex; gap: 10px; font-size: 12.5px; padding: 6px 0; align-items: center; }

/* ---------------------------------------------------------------- portal cliente */
/* Fondo con un leve velo del color de la agencia arriba: cálido sin distraer. */
.portal-body { background: radial-gradient(1100px 420px at 50% -220px, color-mix(in srgb, var(--brand) 9%, transparent), transparent 70%) no-repeat, var(--bg); }
.portal-top { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: saturate(1.5) blur(16px); border-bottom: 1px solid color-mix(in srgb, var(--border) 80%, transparent); }
.portal-top-inner { max-width: 1180px; margin: 0 auto; padding: 0 20px; height: 66px; display: flex; align-items: center; gap: 16px; }
.portal-nav { display: flex; gap: 4px; margin-left: 18px; }
.portal-nav a { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 13px; border-radius: 11px; font-weight: 600; font-size: 14px; color: var(--muted); position: relative; transition: color .18s, background .18s; }
.portal-nav a svg.lucide { width: 17px; height: 17px; }
.portal-nav a:hover { color: var(--text); background: color-mix(in srgb, var(--surface-3) 70%, transparent); }
.portal-nav a.active { color: var(--brand); background: var(--brand-soft); }
:root[data-theme="dark"] .portal-nav a.active { color: color-mix(in srgb, var(--brand) 55%, #fff); }
.portal-nav .pip, .bottom-nav .pip { background: #EF4444; color: #fff; font-size: 10px; font-weight: 700; border-radius: 99px; padding: 0 6px; min-width: 18px; height: 18px; display: inline-grid; place-items: center; }
.cta-review { display: flex; align-items: center; gap: 18px; padding: 20px 22px; border-radius: 24px; color: #fff; background: radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--brand) 85%, #fff) 0%, var(--brand) 45%, color-mix(in srgb, var(--brand) 60%, #000) 100%); box-shadow: 0 18px 40px color-mix(in srgb, var(--brand) 35%, transparent); position: relative; overflow: hidden; }
.cta-review::after { content: ""; position: absolute; right: -40px; top: -40px; width: 180px; height: 180px; border-radius: 50%; background: color-mix(in srgb, var(--brand-2) 55%, transparent); filter: blur(30px); }
.cta-review .big { font-size: 44px; font-weight: 800; letter-spacing: -.04em; line-height: 1; position: relative; z-index: 1; }
.cta-review > * { position: relative; z-index: 1; }
.portal-main { max-width: 1180px; margin: 0 auto; padding: 30px 20px 110px; }
.hello { font-size: 30px; font-weight: 800; letter-spacing: -.035em; line-height: 1.1; }
.hello-sub { font-size: 15px; color: var(--muted); margin-top: 8px; line-height: 1.55; max-width: 560px; }
/* Bienvenida */
.portal-hero { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 26px 28px; border-radius: 26px; border: 1px solid var(--border); background: radial-gradient(90% 160% at 100% 0%, color-mix(in srgb, var(--brand) 13%, transparent), transparent 60%), radial-gradient(70% 120% at 0% 100%, color-mix(in srgb, var(--brand-2) 7%, transparent), transparent 60%), var(--surface); box-shadow: var(--shadow-sm); }
.portal-hero .eyebrow { margin-bottom: 8px; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--brand); }
:root[data-theme="dark"] .portal-hero .eyebrow { color: color-mix(in srgb, var(--brand) 55%, #fff); }
.portal-hero-cta { display: flex; align-items: center; gap: 14px; flex-shrink: 0; min-width: 290px; padding: 14px 14px 14px 16px; border-radius: 20px; color: var(--brand-ink); background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 92%, #fff), var(--brand)); box-shadow: 0 12px 30px color-mix(in srgb, var(--brand) 30%, transparent), inset 0 1px 0 rgba(255,255,255,.18); transition: transform .25s var(--ease-out), box-shadow .25s; }
.portal-hero-cta:hover { transform: translateY(-2px); box-shadow: 0 18px 38px color-mix(in srgb, var(--brand) 38%, transparent), inset 0 1px 0 rgba(255,255,255,.18); }
.portal-hero-cta .xs { opacity: .82; }
.portal-hero-count { display: grid; place-items: center; min-width: 52px; height: 52px; padding: 0 8px; border-radius: 15px; background: rgba(255,255,255,.16); font-size: 26px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.portal-hero-arrow { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,.16); transition: transform .25s var(--ease-out); }
.portal-hero-cta:hover .portal-hero-arrow { transform: translateX(3px); }
.portal-hero-done { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 99px; background: var(--t-green-bg); color: var(--t-green); font-weight: 700; font-size: 13.5px; flex-shrink: 0; }
/* Encabezado de sección y paneles */
.portal-section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.portal-section-head h2 { font-size: 19px; letter-spacing: -.02em; }
.portal-section-head p, .portal-panel-head p { font-size: 13px; color: var(--muted); margin-top: 3px; }
.portal-columns { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.portal-panel { padding: 20px 22px; border-radius: 22px; }
.portal-panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px 12px; margin-bottom: 16px; flex-wrap: wrap; }
.portal-panel-head > div:first-child { flex: 1 1 220px; min-width: 0; }
.portal-panel-head h2 { font-size: 16px; display: flex; align-items: center; gap: 8px; letter-spacing: -.01em; }
.portal-panel-head h2 svg.lucide { width: 18px; height: 18px; color: var(--brand); }
.portal-list { margin: 0 -10px -6px; }
.portal-list .content-row { align-items: flex-start; }
/* Filtro por red (segmentado, sin recargar) */
.network-filter { display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.network-filter::-webkit-scrollbar { display: none; }
.network-filter button { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font: inherit; font-size: 13px; font-weight: 600; white-space: nowrap; cursor: pointer; transition: background .2s var(--ease-out), color .2s, box-shadow .2s; }
.network-filter button:hover { color: var(--text); }
.network-filter button.active { background: var(--surface-3); color: var(--text); box-shadow: var(--shadow-xs); }
.network-filter button:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.network-filter .n { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 99px; background: color-mix(in srgb, var(--muted) 14%, transparent); }
.network-filter .platform-dot { width: 20px; height: 20px; }
/* Grupos de pendientes (acordeón) */
.pending-groups { display: flex; flex-direction: column; gap: 10px; }
.pending-group { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow-xs); transition: border-color .2s, box-shadow .25s; }
.pending-group[open]:not(.closing) { box-shadow: var(--shadow-sm); border-color: var(--border-strong); }
.pending-group > summary { display: flex; align-items: center; gap: 14px; padding: 14px 16px; cursor: pointer; list-style: none; border-radius: 20px; user-select: none; transition: background .2s; }
.pending-group > summary::-webkit-details-marker { display: none; }
.pending-group > summary:hover { background: var(--surface-2); }
.pending-group > summary:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.pending-group-icon { --gc: var(--brand); display: grid; place-items: center; width: 42px; height: 42px; flex-shrink: 0; border-radius: 13px; background: color-mix(in srgb, var(--gc) 14%, transparent); color: var(--gc); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--gc) 22%, transparent); }
.pending-group-icon svg.lucide { width: 19px; height: 19px; }
.pending-group-chevron { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; color: var(--muted); transition: transform .35s var(--ease-out), background .2s; }
.pending-group > summary:hover .pending-group-chevron { background: var(--surface-3); }
.pending-group[open]:not(.closing) .pending-group-chevron { transform: rotate(180deg); }
.pending-group[open]:not(.closing) > summary { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.pending-group-body { padding: 2px 16px 16px; }
/* Tarjetas: miniatura limpia, «Revisar» aparece al pasar el ratón */
.pending-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.pending-card { display: flex; flex-direction: column; border-radius: 18px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--border); transition: transform .3s var(--ease-out), box-shadow .3s, border-color .2s; }
.pending-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.pending-card:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.pending-card-media { position: relative; }
.pending-card .thumb { border-radius: 0; aspect-ratio: 4/5; }
.pending-card .thumb img { transition: transform .5s var(--ease-out); }
.pending-card:hover .thumb img { transform: scale(1.035); }
.pending-card-hover { position: absolute; left: 50%; bottom: 12px; display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 99px; background: rgba(12,12,20,.62); color: #fff; font-size: 12.5px; font-weight: 700; backdrop-filter: blur(10px); opacity: 0; transform: translate(-50%, 6px); transition: opacity .25s, transform .3s var(--ease-out); pointer-events: none; white-space: nowrap; }
.pending-card-hover svg.lucide { width: 14px; height: 14px; }
.pending-card:hover .pending-card-hover, .pending-card:focus-visible .pending-card-hover { opacity: 1; transform: translate(-50%, 0); }
.pending-card .body { padding: 12px 13px 14px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pending-card-title { font-weight: 650; font-size: 14px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@media (hover: none) { .pending-card-hover { opacity: 1; transform: translate(-50%, 0); } }
@media (max-width: 960px) { .portal-columns { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .portal-hero { flex-direction: column; align-items: stretch; padding: 20px; border-radius: 22px; gap: 18px; }
  .portal-hero-cta { min-width: 0; }
  .portal-section-head { align-items: stretch; flex-direction: column; }
  .pending-group > summary { gap: 10px; padding: 12px; }
  .pending-group > summary .btn { padding: 0 10px; } .pending-group > summary .btn svg.lucide { display: none; }
  .pending-group-body { padding: 0 10px 10px; }
  .portal-panel { padding: 16px; }
}
.bottom-nav { display: none; }
.client-switch { display: flex; align-items: center; gap: 10px; padding: 6px 10px 6px 6px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; }

/* Modo revisión */
.review-shell { max-width: 1120px; margin: 0 auto; }
.review-progress { display: flex; gap: 5px; margin-bottom: 16px; }
.review-progress span { flex: 1; height: 4px; border-radius: 99px; background: var(--border); transition: background .3s; }
.review-progress span.done { background: #10B981; } .review-progress span.current { background: var(--brand); }
.review-card { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(320px, .9fr); gap: 22px; align-items: start; animation: fadeUp .4s var(--ease); }
.review-card.leaving { animation: reviewOut .35s var(--ease) forwards; }
.review-card.leaving.approved { animation-name: reviewOutRight; }
@keyframes reviewOut { to { opacity: 0; transform: translateY(-12px) scale(.98); } }
@keyframes reviewOutRight { to { opacity: 0; transform: translateX(60px) rotate(2deg); } }
.review-card .viewer { min-height: 520px; }
.review-panel { background: var(--surface); border: 1px solid var(--border); border-radius: 24px; padding: 22px; display: flex; flex-direction: column; gap: 16px; position: sticky; top: 88px; }
.review-actions { display: flex; flex-direction: column; gap: 8px; }
.review-actions .btn-lg { width: 100%; }
.review-actions .secondary { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.all-done { text-align: center; padding: 70px 20px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.all-done .check-circle { width: 92px; height: 92px; border-radius: 50%; background: #10B981; color: #fff; display: grid; place-items: center; animation: pop .5s var(--ease); box-shadow: 0 20px 50px rgba(16,185,129,.35); }
.all-done .check-circle svg.lucide { width: 44px; height: 44px; stroke-width: 3; }
.sheet-actions { display: none; }

/* ---------------------------------------------------------------- auth */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
.auth-form { display: flex; flex-direction: column; justify-content: center; padding: 48px clamp(24px, 6vw, 96px); gap: 26px; background: var(--surface); }
.auth-art { position: relative; overflow: hidden; background: radial-gradient(90% 90% at 80% 10%, color-mix(in srgb, var(--brand-2) 70%, transparent), transparent 60%), radial-gradient(90% 90% at 10% 90%, var(--brand), transparent 70%), #0E0E16; display: flex; align-items: flex-end; padding: 48px; color: #fff; }
.auth-art .floating { position: absolute; border-radius: 22px; overflow: hidden; box-shadow: 0 30px 60px rgba(0,0,0,.45); background: rgba(255,255,255,.08); backdrop-filter: blur(20px); border: 1px solid rgba(255,255,255,.14); }
.auth-quote { position: relative; z-index: 2; max-width: 460px; }
.auth-quote h2 { font-size: 34px; letter-spacing: -.035em; line-height: 1.1; }
.auth-card { width: 100%; max-width: 400px; }
.demo-accounts { display: grid; gap: 6px; }
.demo-account { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 12px; cursor: pointer; background: var(--surface); text-align: left; width: 100%; }
.demo-account:hover { border-color: var(--brand); background: var(--brand-softer); }

/* ---------------------------------------------------------------- admin */
.admin-badge { background: linear-gradient(135deg, #F59E0B, #EF4444); color: #fff; font-size: 10px; font-weight: 800; padding: 2px 7px; border-radius: 6px; letter-spacing: .06em; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: var(--surface-2); }
.table-wrap { overflow-x: auto; }

/* ---------------------------------------------------------------- error */
.error-page { min-height: 70vh; display: grid; place-items: center; text-align: center; padding: 40px 20px; }
.error-code { font-size: 90px; font-weight: 800; letter-spacing: -.06em; background: linear-gradient(135deg, var(--brand), var(--brand-2)); -webkit-background-clip: text; background-clip: text; color: transparent; line-height: 1; }

/* ---------------------------------------------------------------- responsive */
.show-mobile { display: none; }
@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail { grid-template-columns: minmax(0, 1fr); }  /* minmax: nada dentro puede ensanchar la columna */
  .viewer, .viewer-slide { max-height: 70vh; } .viewer-slide img, .viewer-slide video { max-height: 70vh; }
}
@media (max-width: 1024px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; height: auto; max-height: 100dvh; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; transform: translateX(-100%); transition: transform .3s var(--ease); box-shadow: var(--shadow-lg); }
  html.sidebar-lock, html.sidebar-lock body { overflow: hidden; overscroll-behavior: none; }
  .sidebar-backdrop { touch-action: none; }
  .sidebar.open { transform: none; }
  .sidebar-backdrop { display: block; position: fixed; inset: 0; background: var(--overlay); z-index: 35; opacity: 0; pointer-events: none; transition: opacity .3s; }
  .sidebar.open + .sidebar-backdrop { opacity: 1; pointer-events: auto; }
  .icon-btn.menu-toggle { display: grid; }
  .topbar { padding: 0 16px; }
  .page { padding: 18px 16px 90px; }
  .board-wrap { margin: 0 -16px; padding: 0 16px 24px; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wizard { grid-template-columns: 1fr; }
  .steps { position: static; flex-direction: row; overflow-x: auto; gap: 4px; }
  .step { width: auto; flex-shrink: 0; } .step .lbl { display: none; } .step.active .lbl { display: inline; }
  .review-card { grid-template-columns: 1fr; }
  .review-panel { position: static; }
  .auth { grid-template-columns: 1fr; } .auth-art { display: none; }
  .portal-nav { display: none; }
  .bottom-nav { display: grid; grid-template-columns: repeat(6, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(16px); border-top: 1px solid var(--border); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); }
  .bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10.5px; font-weight: 650; color: var(--muted); padding: 6px 2px; border-radius: 12px; position: relative; }
  .bottom-nav a.active { color: var(--brand); }
  .bottom-nav .pip { position: absolute; top: 2px; left: 55%; }
  .summary-card { position: static; }
}
@media (max-width: 760px) {
  /* Detalle en móvil: la pieza se ve en tamaño reducido; se toca o se pulsa el botón para verla completa. */
  .detail .viewer, .detail .viewer-slide { min-height: 0; max-height: 44vh; }
  .detail .viewer-slide img, .detail .viewer-slide video { max-height: 44vh; }
  .detail .viewer.is-fullscreen, .detail .viewer.is-fullscreen .viewer-slide { max-height: none; }
  .detail .viewer.is-fullscreen .viewer-slide img, .detail .viewer.is-fullscreen .viewer-slide video { max-height: 100dvh; }
  .urow { grid-template-columns: minmax(0, 1fr) auto; row-gap: 6px; }
  .urow > :nth-child(2), .urow > :nth-child(3) { display: none; }
  .urow-action { grid-column: 1 / -1; text-align: left; }
  body { font-size: 14.5px; }
  h1 { font-size: 22px; }
  .hide-mobile { display: none !important; }
  .show-mobile { display: initial; }
  .grid-2, .grid-3, .form-grid { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 14px; } .kpi-value { font-size: 24px; }
  .search-trigger { width: 40px; padding: 0; justify-content: center; border: 0; background: transparent; }
  .search-trigger span, .search-trigger kbd { display: none; }
  .page-head { align-items: flex-start; }
  .plan-row { grid-template-columns: 1fr auto; gap: 8px 12px; }
  .plan-row .pbar-wrap { grid-column: 1 / -1; order: 3; }
  .plan-summary { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .media-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .media-card { padding: 6px; border-radius: 16px; }
  .fc-shell-desktop { display: none; }
  .agenda { display: block; }
  .info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }  /* minmax: el contenido no ensancha la página */
  .modal { border-radius: 24px 24px 0 0; margin: auto 0 0; width: 100vw; }
  dialog.sheet { margin: auto 0 0; }
  .hello { font-size: 26px; }
  .cta-review { padding: 16px; gap: 12px; } .cta-review .big { font-size: 34px; }
  .pending-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .pending-card { border-radius: 16px; }
  .review-card .viewer { min-height: 56vh; border-radius: 20px; }
  .review-panel { padding: 16px; border-radius: 20px; }
  .sheet-actions { display: grid; position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(16px); border-top: 1px solid var(--border); grid-template-columns: 1fr 1fr 1.4fr; gap: 8px; }
  .review-mode .bottom-nav { display: none; }
  .review-panel .review-actions { display: none; }
  .portal-main { padding: 18px 14px 110px; }
  .table-cards thead { display: none; }
  .table-cards tr { display: grid; grid-template-columns: 1fr auto; padding: 10px 0; border-bottom: 1px solid var(--border); }
  .table-cards td { border: 0; padding: 3px 8px; }
  .drawer-body { padding: 14px; }
}


/* ================================================================ movimiento
   Un solo lenguaje de movimiento para toda la app: el contenido entra fundiéndose y subiendo unos
   píxeles, sale más rápido de lo que entra y nada aparece ni desaparece de golpe. */
:root { --ease-out: cubic-bezier(.16, 1, .3, 1); }

/* ---- cambio de página (View Transitions entre documentos; los navegadores sin soporte lo ignoran).
   Sidebar y barras superiores tienen nombre propio: quedan quietos y sólo el contenido se anima. */
@view-transition { navigation: auto; }
.sidebar { view-transition-name: sidebar; }
.topbar { view-transition-name: topbar; }
.portal-top { view-transition-name: portal-top; }
.bottom-nav { view-transition-name: bottom-nav; }
::view-transition-old(root) { animation: vtOut .16s ease both; }
::view-transition-new(root) { animation: vtIn .38s var(--ease-out) both; }
::view-transition-group(sidebar), ::view-transition-group(topbar), ::view-transition-group(portal-top),
::view-transition-group(bottom-nav) { animation-duration: .28s; }
@keyframes vtOut { to { opacity: 0; transform: translateY(-4px); } }
@keyframes vtIn { from { opacity: 0; transform: translateY(12px); } }
/* Refresco en vivo: fundido cruzado corto; sólo se percibe donde algo cambió. */
html.vt-live::view-transition-old(root) { animation: vtFadeOut .24s ease both; }
html.vt-live::view-transition-new(root) { animation: vtFadeIn .24s ease both; }
@keyframes vtFadeOut { to { opacity: 0; } }
@keyframes vtFadeIn { from { opacity: 0; } }

/* ---- entrada escalonada de cada página (fill backwards: al terminar no deja transform aplicado) */
.page > *, .portal-main > * { animation: fadeUp .5s var(--ease-out) backwards; }
.page > :nth-child(2), .portal-main > :nth-child(2) { animation-delay: .05s; }
.page > :nth-child(3), .portal-main > :nth-child(3) { animation-delay: .1s; }
.page > :nth-child(4), .portal-main > :nth-child(4) { animation-delay: .15s; }
.page > :nth-child(n+5), .portal-main > :nth-child(n+5) { animation-delay: .2s; }
.board .column { animation: fadeUp .5s var(--ease-out) backwards; }
.board .column:nth-child(2) { animation-delay: .04s; } .board .column:nth-child(3) { animation-delay: .08s; }
.board .column:nth-child(4) { animation-delay: .12s; } .board .column:nth-child(n+5) { animation-delay: .16s; }
/* Anillos y barras de progreso se llenan al entrar. */
@property --p { syntax: "<number>"; inherits: false; initial-value: 0; }
.ring { animation: ringFill 1.1s var(--ease-out) .15s backwards; }
@keyframes ringFill { from { --p: 0; } }
.pbar > span { transform-origin: left center; animation: barGrow .9s var(--ease-out) .15s backwards; }
@keyframes barGrow { from { transform: scaleX(0); } }
/* Tras un refresco en vivo no se repiten las entradas: sólo cambia lo que cambió. */
.no-enter > *, .no-enter .animate-in > *, .no-enter .board .column, .no-enter .ring, .no-enter .pbar > span,
.no-enter .comment, .no-enter [data-panel], .no-enter .fc .ev { animation: none !important; }

/* ---- pestañas, segmentados y paneles */
.tab { transition: color .2s, border-color .25s var(--ease-out); }
.segmented a, .segmented button { transition: background .2s, color .2s, box-shadow .2s; }
[data-panel]:not([hidden]) { animation: fadeUp .32s var(--ease-out) backwards; }

/* ---- micro-interacciones */
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 2px 4px rgba(0,0,0,.1), 0 10px 22px color-mix(in srgb, var(--brand) 34%, transparent); }
.btn-primary:active { transform: scale(.98); }
.menu-item { transition: background .15s, color .15s; }
.nav-link svg, .nav-client .client-logo { transition: transform .25s var(--ease-out); }
.nav-link:hover svg { transform: translateX(2px); }
.kcard:hover { transform: translateY(-2px); }
.attention .ic, .kpi-icon { transition: transform .25s var(--ease-out); }
.attention:hover .ic, .kpi:hover .kpi-icon { transform: scale(1.06); }
.pip.bump { animation: pop .45s var(--ease-out); }
.fc .ev { animation: fadeIn .3s ease backwards; }
.upload { animation: scaleIn .32s var(--ease-out) backwards; }
@keyframes scaleIn { from { opacity: 0; transform: scale(.94); } }
.fc .ev:hover { transform: translateY(-1px); box-shadow: var(--shadow); }

/* ---- cierre animado de diálogos (app.js añade .closing y cierra al terminar) */
dialog.closing::backdrop { animation: fadeOutBackdrop .22s ease forwards; }
@keyframes fadeOutBackdrop { to { opacity: 0; } }
dialog.closing .modal, dialog.closing .palette { animation: modalOut .2s ease forwards; }
@keyframes modalOut { to { opacity: 0; transform: translateY(10px) scale(.98); } }
dialog.closing .drawer { animation: modalOut .2s ease forwards; }

/* ---- imágenes: aparecen con fundido al terminar de cargar (el respaldo las muestra a los 3 s) */
html.img-fade :is(.thumb, .viewer, .media-card, .agenda-item) img { transition: opacity .45s ease; }
html.img-fade :is(.thumb, .viewer, .media-card, .agenda-item) img:not(.is-loaded) { opacity: 0; animation: imgFallback 0s 3s forwards; }
@keyframes imgFallback { to { opacity: 1; } }

/* ---- barra de progreso al navegar entre páginas */
.nav-progress { position: fixed; top: 0; left: 0; right: 0; height: 2.5px; z-index: 2000; pointer-events: none; transform-origin: left center; transform: scaleX(0); opacity: 0; background: linear-gradient(90deg, var(--brand), var(--brand-2)); box-shadow: 0 0 10px color-mix(in srgb, var(--brand) 60%, transparent); transition: opacity .3s; }
html.navigating .nav-progress { opacity: 1; animation: navProgress 8s cubic-bezier(.1, .7, .2, 1) forwards; }
@keyframes navProgress { 0% { transform: scaleX(0); } 8% { transform: scaleX(.3); } 100% { transform: scaleX(.94); } }

/* ---- paginación sin recargar */
.partial-loading { opacity: .55; pointer-events: none; transition: opacity .15s; }

/* ---- accesibilidad: quien pide menos movimiento no ve animaciones */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
  @view-transition { navigation: none; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}

/* ------------------------------------------------------------------ mensualidad */
.billing-banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; margin-bottom: 18px; border-radius: 14px; border: 1px solid color-mix(in srgb, var(--tone) 40%, var(--border)); background: var(--tone-bg); font-size: 13.5px; }
.billing-banner strong { color: var(--tone); }
.billing-banner .grow { min-width: 200px; }
.billing-banner-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; color: var(--tone); background: color-mix(in srgb, var(--tone) 16%, transparent); }
.billing-card { max-width: 460px; width: 100%; align-items: center; text-align: center; }
.billing-card .empty-art[class*="tone-"] { background: var(--tone-bg); color: var(--tone); }
.billing-card .empty-art[class*="tone-"]::after { border-color: color-mix(in srgb, var(--tone) 35%, transparent); }
.billing-amount { display: flex; align-items: baseline; gap: 8px; justify-content: center; }
.billing-amount strong { font-size: 30px; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.state-filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.state-filter { flex: 1 1 140px; display: flex; align-items: baseline; gap: 8px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: 13px; font-weight: 600; transition: border-color .15s, background .15s; }
.state-filter .n { font-size: 22px; font-weight: 750; color: var(--tone, var(--text)); font-variant-numeric: tabular-nums; }
.state-filter:hover { border-color: var(--border-strong); }
.state-filter.active { border-color: var(--tone, var(--brand)); background: color-mix(in srgb, var(--tone, var(--brand)) 9%, var(--surface)); color: var(--text); }
@media (max-width: 760px) {
  .agencies-table tr { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .agencies-table td:first-child { grid-column: 1 / -1; }
  .agencies-table td:last-child { grid-column: 1 / -1; text-align: left !important; }
  .agencies-table td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; color: var(--muted); font-weight: 600; }
}
.bill-grid { display: flex; flex-wrap: wrap; gap: 12px; }
.bill-grid > * { flex: 1 1 160px; min-width: 0; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; }
.bill-grid .label { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.bill-grid .value { font-size: 15px; font-weight: 700; margin-top: 2px; }
.bill-forms { display: flex; flex-wrap: wrap; gap: 12px; }
.bill-forms > form { flex: 1 1 260px; min-width: 0; padding: 14px; border: 1px solid var(--border); border-radius: 14px; display: flex; flex-direction: column; gap: 10px; }
.bill-forms h3 { font-size: 13.5px; }
.admin-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.admin-row:last-child { border-bottom: 0; }
.audit-detail { word-break: break-word; }
.detail-cols { display: flex; flex-wrap: wrap; gap: 18px; align-items: stretch; }
.detail-cols > :first-child { flex: 3 1 420px; min-width: 0; }
.detail-cols > :last-child { flex: 2 1 300px; min-width: 0; }
.head-wrap { flex-wrap: wrap; gap: 10px; align-items: flex-start; }
.head-wrap > div:first-child { flex: 1 1 240px; min-width: 0; }
@media (max-width: 760px) { .bill-grid > * { flex-basis: 120px; } }

/* ------------------------------------------------------------------ material del cliente */
.material-limits { display: flex; flex-wrap: wrap; gap: 12px; }
.material-limit { flex: 1 1 240px; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
.material-limit-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; color: var(--tone); background: var(--tone-bg); }
.material-bar { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin-top: 8px; }
.material-bar span { display: block; height: 100%; background: var(--brand); border-radius: inherit; transition: width .3s; }
.material-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.material-card { position: relative; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 6px; min-width: 0; }
.material-card.selectable { cursor: pointer; }
.material-card.selectable:has(.material-check:checked) { border-color: var(--brand); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 35%, transparent); }
.material-card .thumb { border-radius: 12px; }
.material-check { position: absolute; top: 14px; left: 14px; z-index: 2; width: 20px; height: 20px; accent-color: var(--brand); }
.material-meta { padding: 8px 4px 2px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.material-note { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.material-actions { display: flex; justify-content: flex-end; gap: 2px; margin-top: auto; }
.material-pick { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); max-height: 60vh; overflow: auto; }
.material-pick-item { position: relative; display: flex; flex-direction: column; gap: 2px; padding: 6px; border: 1px solid var(--border); border-radius: 14px; cursor: pointer; min-width: 0; }
.material-pick-item:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 35%, transparent); }
.material-pick-item input { position: absolute; top: 12px; left: 12px; z-index: 2; width: 18px; height: 18px; accent-color: var(--brand); }
.material-pick-item .thumb { border-radius: 10px; margin-bottom: 4px; }
.btn.disabled { opacity: .55; }
@media (max-width: 760px) { .material-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.material-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.material-filters .chip { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface); font-size: 13px; font-weight: 600; color: var(--muted); }
.material-filters .chip .n { font-size: 11.5px; font-variant-numeric: tabular-nums; opacity: .8; }
.material-filters .chip:hover { border-color: var(--border-strong); }
.material-filters .chip.active { border-color: var(--brand); color: var(--text); background: color-mix(in srgb, var(--brand) 12%, var(--surface)); }
.material-bar-actions { position: sticky; top: 72px; z-index: 5; display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px; padding: 10px 14px; margin-bottom: 14px; border: 1px solid var(--border); border-radius: 14px; background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(12px); }
.material-bar-actions.has-selection { border-color: color-mix(in srgb, var(--brand) 50%, var(--border)); }
.material-bar-actions .check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.material-bar-actions input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--brand); }
@media (max-width: 760px) { .material-bar-actions { top: auto; bottom: calc(70px + env(safe-area-inset-bottom)); position: sticky; } .material-bar-actions > div { margin-left: 0 !important; width: 100%; } }
.mentions { display: flex; flex-direction: column; gap: 6px; }
.chip.mention { color: var(--brand); font-weight: 650; }

/* ================================================================ vista previa (Instagram / TikTok / Facebook) */
.modal-preview { width: min(820px, calc(100vw - 24px)); }
.modal-preview .modal-body.pv-body { max-height: calc(100vh - 110px); display: flex; flex-direction: column; gap: 12px; }
.pv-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.pv-tabs::-webkit-scrollbar { display: none; }
.pv-tab { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: 12.5px; font-weight: 650; white-space: nowrap; cursor: pointer; }
.pv-tab.active { border-color: var(--brand); color: var(--text); background: color-mix(in srgb, var(--brand) 12%, var(--surface)); }
.pv-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.pv-tools .check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.pv-tools input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--brand); }
.pv-stage { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.pv-note { text-align: center; }

/* Teléfono */
.phone { --pv-bg: #fff; --pv-fg: #0a0a0a; --pv-muted: #737373; --pv-line: #dbdbdb; --pv-link: #00376b; --pv-soft: #efefef;
  width: min(330px, 86vw); aspect-ratio: 9 / 19.5; border-radius: 44px; padding: 10px; background: #0b0b0d;
  box-shadow: 0 0 0 2px #2a2a30, 0 24px 60px rgba(0,0,0,.35); position: relative; flex-shrink: 0; }
.phone.pv-dark { --pv-bg: #000; --pv-fg: #f5f5f5; --pv-muted: #a8a8a8; --pv-line: #262626; --pv-link: #e0f1ff; --pv-soft: #262626; }
.phone::before { content: ""; position: absolute; top: 18px; left: 50%; transform: translateX(-50%); width: 92px; height: 24px; border-radius: 99px; background: #000; z-index: 30; }
.phone-screen { position: relative; width: 100%; height: 100%; border-radius: 34px; overflow: hidden; background: var(--pv-bg); color: var(--pv-fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; font-size: 12.5px; line-height: 1.35; }
.pv-view { position: absolute; inset: 0; display: flex; flex-direction: column; }
.pv-view[hidden] { display: none !important; }
.pv-scroll { overflow-y: auto; scrollbar-width: none; }
.pv-scroll::-webkit-scrollbar { display: none; }
.pv-status { height: 44px; flex-shrink: 0; display: flex; align-items: center; padding: 0 26px; font-size: 13px; }
.pv-icons { display: inline-flex; gap: 14px; align-items: center; }
.phone-screen svg.lucide { width: 22px; height: 22px; stroke-width: 1.8; }
.phone-screen .i-sm { width: 14px !important; height: 14px !important; }
.phone-screen .i-xs { width: 11px !important; height: 11px !important; }
.pv-muted { color: var(--pv-muted); }
.pv-avatar { width: var(--s); height: var(--s); border-radius: 50%; overflow: hidden; display: inline-grid; place-items: center; flex-shrink: 0;
  background: linear-gradient(135deg, var(--brand), #EC4899); color: #fff; font-weight: 700; font-size: calc(var(--s) * .36); }
.pv-avatar { position: relative; }
.pv-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #fff; }
.pv-avatar.ring { box-shadow: 0 0 0 2px var(--pv-bg), 0 0 0 4px #E1306C; margin: 3px; }
.pv-empty { width: 100%; height: 100%; min-height: 160px; display: grid; place-content: center; justify-items: center; gap: 6px; color: #9ca3af; background: repeating-linear-gradient(135deg, #1f2937 0 10px, #111827 10px 20px); font-size: 12px; }
.pv-caption { white-space: pre-line; word-break: break-word; }
.pv-clamp1, .pv-clamp2, .pv-clamp3 { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
.pv-clamp1 { -webkit-line-clamp: 1; } .pv-clamp2 { -webkit-line-clamp: 2; } .pv-clamp3 { -webkit-line-clamp: 3; }
.pv-more { border: 0; background: none; padding: 0; color: var(--pv-muted); font: inherit; cursor: pointer; }
.pv-hash { color: var(--pv-link); }
.pv-dark-view .pv-hash { color: #fff; font-weight: 600; }

/* Instagram feed */
.ig-topbar { display: flex; align-items: center; justify-content: space-between; padding: 4px 14px 8px; flex-shrink: 0; }
.ig-wordmark { font-family: "Brush Script MT", "Segoe Script", cursive; font-size: 25px; line-height: 1; }
.ig-handle { display: inline-flex; align-items: center; gap: 4px; font-size: 17px; }
.ig-head { display: flex; align-items: center; gap: 8px; padding: 6px 10px; }
.ig-head b { display: block; font-size: 12.5px; }
.ig-head small { display: block; font-size: 11px; color: var(--pv-muted); }
.ig-media { position: relative; width: 100%; background: #000; overflow: hidden; flex-shrink: 0; }
.pv-track { display: flex; width: 100%; height: 100%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.pv-track::-webkit-scrollbar { display: none; }
.pv-slide { flex: 0 0 100%; height: 100%; scroll-snap-align: start; }
.pv-slide img, .pv-slide video, .pv-full > img, .pv-full > video, .pv-frame img, .pv-frame video, .fb-media img, .fb-media video { width: 100%; height: 100%; object-fit: cover; display: block; user-select: none; }
.pv-counter { position: absolute; top: 10px; right: 10px; background: rgba(0,0,0,.65); color: #fff; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 99px; }
.pv-tagbtn { position: absolute; left: 10px; bottom: 10px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(0,0,0,.65); color: #fff; display: grid; place-items: center; cursor: pointer; z-index: 2; }
.pv-tagbtn svg.lucide { width: 15px !important; height: 15px !important; }
.pv-tag-bubbles { position: absolute; inset: 0; display: none; flex-wrap: wrap; align-content: center; justify-content: center; gap: 8px; padding: 20px; pointer-events: none; }
.ig-media.show-tags .pv-tag-bubbles { display: flex; }
.pv-tag-bubbles span { background: rgba(0,0,0,.75); color: #fff; font-weight: 600; font-size: 12px; padding: 5px 10px; border-radius: 6px; }
.pv-crop { position: absolute; inset: 0; display: none; pointer-events: none; }
.pv-crop span { position: absolute; top: 0; bottom: 0; width: var(--crop-side); background: rgba(0,0,0,.6); }
.pv-crop span:first-child { left: 0; border-right: 2px dashed #fff; } .pv-crop span:last-child { right: 0; border-left: 2px dashed #fff; }
[data-preview-root].pv-show-crop .pv-crop { display: block; }
.ig-actions { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px 4px; position: relative; }
.pv-dots { position: absolute; left: 50%; transform: translateX(-50%); display: flex; gap: 4px; }
.pv-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--pv-line); }
.pv-dots i.on { background: #0095f6; }
.ig-text { padding: 0 12px 10px; display: flex; flex-direction: column; gap: 3px; }
.ig-date { color: var(--pv-muted); font-size: 11px; }
.ig-tabbar { margin-top: auto; flex-shrink: 0; display: flex; justify-content: space-around; align-items: center; padding: 10px 6px 22px; border-top: 1px solid var(--pv-line); background: var(--pv-bg); position: sticky; bottom: 0; }
.ig-tabbar.dark { background: #000; color: #fff; border-color: #262626; }

/* Vistas verticales (historia, reel, TikTok): siempre oscuras */
.pv-dark-view { background: #000; color: #fff; }
.pv-dark-view .pv-more { color: rgba(255,255,255,.75); }
.pv-full { position: relative; flex: 1; min-height: 0; overflow: hidden; background: #111; }
.pv-full > img, .pv-full > video { position: absolute; inset: 0; }
.pv-full::after { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(rgba(0,0,0,.38), transparent 18%, transparent 55%, rgba(0,0,0,.62)); }
.pv-side svg.lucide, .reel-top svg.lucide, .tt-top svg.lucide { filter: drop-shadow(0 1px 3px rgba(0,0,0,.55)); }
.pv-side { position: absolute; right: 8px; bottom: 26%; display: flex; flex-direction: column; align-items: center; gap: 14px; z-index: 2; text-shadow: 0 1px 4px rgba(0,0,0,.5); }
.pv-side span { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.pv-side small { font-size: 10.5px; font-weight: 600; }
.pv-bottom { position: absolute; left: 12px; right: 64px; bottom: 14px; display: flex; flex-direction: column; gap: 5px; z-index: 2; text-shadow: 0 1px 4px rgba(0,0,0,.6); font-size: 12px; }
.reel-top { position: absolute; top: 46px; left: 14px; right: 14px; display: flex; justify-content: space-between; align-items: center; font-size: 17px; z-index: 2; }
.reel-user { display: flex; align-items: center; gap: 8px; }
.reel-follow { border: 1px solid rgba(255,255,255,.7); border-radius: 8px; padding: 2px 9px; font-size: 11.5px; font-weight: 600; }
.reel-tags, .reel-audio { display: flex; align-items: center; gap: 5px; font-size: 11.5px; }
.pv-story { padding-top: 40px; }
.pv-story-media { position: relative; flex: 1; min-height: 0; border-radius: 10px; overflow: hidden; background: #111; }
.pv-frame { position: absolute; inset: 0; display: none; }
.pv-frame.active { display: block; }
.story-top { position: absolute; top: 0; left: 0; right: 0; padding: 8px 10px; z-index: 3; background: linear-gradient(rgba(0,0,0,.45), transparent); }
.story-bars { display: flex; gap: 3px; margin-bottom: 8px; }
.story-bars span { flex: 1; height: 2.5px; border-radius: 2px; background: rgba(255,255,255,.35); }
.story-bars span.on { background: #fff; }
.story-head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.story-head span { opacity: .75; }
.story-stickers { position: absolute; left: 0; right: 0; top: 46%; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; z-index: 3; }
.story-stickers span { background: #fff; color: #E1306C; font-weight: 800; font-size: 13px; padding: 5px 10px; border-radius: 8px; letter-spacing: .02em; }
.pv-nav { position: absolute; top: 15%; bottom: 20%; width: 35%; border: 0; background: transparent; z-index: 4; cursor: pointer; }
.pv-nav.prev { left: 0; } .pv-nav.next { right: 0; }
.story-bottom { display: flex; align-items: center; gap: 14px; padding: 10px 12px 26px; }
.story-input { flex: 1; border: 1px solid rgba(255,255,255,.55); border-radius: 99px; padding: 8px 14px; font-size: 12.5px; }
.tt-top { position: absolute; top: 46px; left: 0; right: 0; display: flex; justify-content: center; align-items: center; gap: 16px; font-size: 14px; z-index: 2; }
.tt-top span { opacity: .7; } .tt-top svg { position: absolute; right: 14px; }
.tt-top b { border-bottom: 2px solid #fff; padding-bottom: 3px; }
.tt-side { bottom: 18%; }
.tt-av { position: relative; margin-bottom: 6px; }
.tt-av .pv-avatar { box-shadow: 0 0 0 1.5px #fff; }
.tt-av i { position: absolute; bottom: -8px; left: 50%; transform: translateX(-50%); width: 18px; height: 18px; border-radius: 50%; background: #fe2c55; display: grid; place-items: center; }
.tt-av i svg.lucide { width: 12px !important; height: 12px !important; stroke-width: 3; }
.tt-disc svg { animation: ttSpin 4s linear infinite; }
@keyframes ttSpin { to { transform: rotate(360deg); } }
.tt-tabbar { flex-shrink: 0; display: flex; justify-content: space-around; align-items: center; padding: 8px 4px 22px; background: #000; font-size: 9.5px; }
.tt-tabbar span { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.tt-tabbar svg.lucide { width: 20px !important; height: 20px !important; }
.tt-plus { width: 40px; height: 26px; border-radius: 8px; background: #fff; color: #000; display: grid !important; place-items: center; box-shadow: -3px 0 0 #25f4ee, 3px 0 0 #fe2c55; }

/* Zonas seguras */
.pv-safe { position: absolute; left: 0; right: 0; z-index: 5; display: none; pointer-events: none; background: repeating-linear-gradient(135deg, rgba(239,68,68,.42) 0 8px, rgba(239,68,68,.22) 8px 16px); outline: 1px dashed rgba(255,255,255,.8); }
.pv-safe span { position: absolute; left: 8px; background: rgba(0,0,0,.7); color: #fff; font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 4px; }
.pv-safe-top { top: 0; } .pv-safe-top span { bottom: 6px; }
.pv-safe-bottom { bottom: 0; } .pv-safe-bottom span { top: 6px; }
.pv-safe-right { left: auto; right: 0; }
[data-preview-root].pv-show-safe .pv-safe { display: block; }

/* Facebook */
.pv-fb { --pv-link: #1877f2; }
.phone.pv-dark .pv-fb { --pv-link: #4599ff; }
.fb-topbar { display: flex; justify-content: space-between; align-items: center; padding: 2px 12px 8px; border-bottom: 6px solid var(--pv-soft); }
.fb-wordmark { color: #1877f2; font-weight: 800; font-size: 25px; letter-spacing: -.04em; }
.fb-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px 6px; }
.fb-head small { display: flex; align-items: center; gap: 3px; color: var(--pv-muted); font-size: 11px; }
.fb-text { padding: 0 12px 8px; }
.fb-media { display: grid; gap: 2px; background: var(--pv-soft); }
.fb-media > div { position: relative; overflow: hidden; aspect-ratio: 1 / 1; }
.fb-media.n1 > div { aspect-ratio: auto; max-height: 420px; }
.fb-media.n1 img, .fb-media.n1 video { height: auto; max-height: 420px; }
.fb-media.n2 { grid-template-columns: 1fr 1fr; }
.fb-media.n3 { grid-template-columns: 1fr 1fr; } .fb-media.n3 > div:first-child { grid-column: 1 / -1; aspect-ratio: 2 / 1; }
.fb-media.n4 { grid-template-columns: 1fr 1fr; }
.fb-more { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.5); color: #fff; font-size: 24px; font-weight: 700; }
.fb-counts { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; color: var(--pv-muted); font-size: 11.5px; }
.fb-reacts { display: inline-flex; align-items: center; gap: 2px; }
.fb-reacts i { width: 17px; height: 17px; border-radius: 50%; display: grid; place-items: center; color: #fff; }
.fb-reacts i svg.lucide { width: 10px !important; height: 10px !important; fill: currentColor; }
.fb-reacts .like { background: #1877f2; } .fb-reacts .love { background: #f33e58; margin-left: -4px; margin-right: 4px; }
.fb-actions { display: flex; justify-content: space-around; padding: 6px 4px 12px; border-top: 1px solid var(--pv-line); margin: 0 12px; color: var(--pv-muted); font-weight: 600; font-size: 12px; }
.fb-actions span { display: inline-flex; align-items: center; gap: 5px; }
.fb-actions svg.lucide { width: 17px !important; height: 17px !important; }

/* Perfil de Instagram */
.ig-profile { display: flex; align-items: center; gap: 14px; padding: 4px 14px 8px; }
.ig-stats { flex: 1; display: flex; justify-content: space-around; text-align: center; }
.ig-stats b { display: block; font-size: 15px; } .ig-stats span { font-size: 11px; }
.ig-bio { padding: 0 14px 10px; font-size: 12.5px; }
.ig-profile-btns { display: flex; gap: 6px; padding: 0 14px 12px; }
.ig-profile-btns span { flex: 1; text-align: center; background: var(--pv-soft); border-radius: 8px; padding: 6px 0; font-weight: 600; font-size: 12px; }
.ig-grid-tabs { display: flex; border-top: 1px solid var(--pv-line); }
.ig-grid-tabs span { flex: 1; display: grid; place-items: center; padding: 8px 0; color: var(--pv-muted); }
.ig-grid-tabs span.on { color: var(--pv-fg); border-bottom: 1.5px solid var(--pv-fg); }
.ig-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; }
.ig-tile { position: relative; aspect-ratio: 3 / 4; background: var(--pv-soft); overflow: hidden; }
.ig-tile img { width: 100%; height: 100%; object-fit: cover; }
.ig-tile i { position: absolute; top: 6px; right: 6px; color: #fff; filter: drop-shadow(0 1px 2px rgba(0,0,0,.6)); }
.ig-tile i svg.lucide { width: 15px !important; height: 15px !important; }
.ig-tile.current { outline: 3px solid var(--brand); outline-offset: -3px; z-index: 1; }
.ig-tile-badge { position: absolute; left: 4px; bottom: 4px; background: var(--brand); color: #fff; font-size: 9.5px; font-weight: 700; padding: 2px 6px; border-radius: 99px; }
@media (max-width: 760px) { .modal-preview .modal-head { padding: 16px 16px 0; } .modal-preview .modal-body.pv-body { padding: 12px; } }
.story-caption { position: absolute; left: 12px; right: 12px; bottom: 20%; z-index: 4; padding: 8px 10px; border-radius: 10px;
  background: rgba(0,0,0,.55); backdrop-filter: blur(6px); color: #fff; font-size: 12px; text-align: center; }
.story-caption .pv-hash { color: #fff; font-weight: 600; }
.story-caption .pv-more { color: rgba(255,255,255,.75); }

/* ================================================================ marca de la plataforma (Body Mind Studio) */
.brand-mark.platform-mark { background: none; box-shadow: none; border-radius: 0; }
.brand-mark.platform-mark img { object-fit: contain; }
/* El logo viene sobre negro: «screen» hace transparente el negro sobre el fondo oscuro del arte del login. */
.auth-art.auth-art-brand { background: radial-gradient(70% 60% at 85% 0%, rgba(24, 200, 255, .35), transparent 60%),
  radial-gradient(80% 70% at 0% 100%, rgba(227, 28, 201, .45), transparent 65%), #07070c; }
.auth-art.auth-art-brand { flex-direction: column; align-items: stretch; justify-content: space-between; gap: 28px; }
/* El logo ocupa su propio espacio (no flota): se achica con la altura y nunca queda bajo el texto. */
.auth-logo { align-self: center; width: min(340px, 62%); max-height: 40vh; min-height: 0; object-fit: contain; mix-blend-mode: screen; pointer-events: none; flex: 0 1 auto; }
.auth-float { top: 46%; right: 8%; }
@media (max-height: 920px) { .auth-float { display: none; } }

/* ================================================================ retención de archivos */
.viewer-purged { position: relative; width: 100%; height: 100%; display: grid; place-items: center; }
.viewer-purged img { width: 100%; height: 100%; object-fit: contain; filter: blur(.5px) saturate(.7); opacity: .85; }
.viewer-purged span { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 6px;
  max-width: calc(100% - 24px); padding: 6px 12px; border-radius: 99px; background: rgba(0,0,0,.72); color: #fff; font-size: 12px; font-weight: 600; text-align: center; }
.retention-banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; margin-bottom: 16px; border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--t-amber) 40%, var(--border)); background: var(--t-amber-bg); font-size: 13.5px; }
.retention-banner .grow { min-width: 220px; }
.retention-banner strong { color: var(--t-amber); }
.keep-badge { display: inline-flex; align-items: center; gap: 5px; }

/* ==========================================================================
   Portal del cliente: piel visual (sólo estilos). Todo va bajo .portal-body para no tocar el panel de la agencia.
   Usa los colores de la agencia (--brand / --brand-2), así cada portal lleva su marca.
   ========================================================================== */
.portal-body {
  --p-card: color-mix(in srgb, var(--surface) 94%, transparent);
  --p-ring: color-mix(in srgb, var(--brand) 30%, var(--border));
  --p-glow: color-mix(in srgb, var(--brand) 22%, rgba(0, 0, 0, .18));
  background:
    radial-gradient(900px 560px at 6% -12%, color-mix(in srgb, var(--brand) 20%, transparent), transparent 65%),
    radial-gradient(760px 480px at 100% -4%, color-mix(in srgb, var(--brand-2) 13%, transparent), transparent 62%),
    radial-gradient(1100px 620px at 50% 115%, color-mix(in srgb, var(--brand) 9%, transparent), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}
/* Trama de puntos muy suave arriba: da textura sin ruido. */
.portal-body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: radial-gradient(color-mix(in srgb, var(--text) 10%, transparent) 1px, transparent 1.2px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(ellipse 75% 55% at 50% 0%, #000 25%, transparent 75%);
  mask-image: radial-gradient(ellipse 75% 55% at 50% 0%, #000 25%, transparent 75%);
}

/* ---- cabecera: logo del cliente + agencia / cliente */
.portal-brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.portal-brand .client-logo { box-shadow: 0 6px 18px color-mix(in srgb, var(--cc, var(--brand)) 35%, transparent), 0 0 0 2px var(--surface); transition: transform .3s var(--ease-out); }
.portal-brand:hover .client-logo { transform: rotate(-4deg) scale(1.04); }
.portal-brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.portal-brand-agency { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.portal-brand-client { font-size: 15.5px; font-weight: 800; letter-spacing: -.02em; color: var(--text); max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.portal-body .portal-top { background: color-mix(in srgb, var(--surface) 72%, transparent); box-shadow: 0 1px 0 color-mix(in srgb, var(--brand) 10%, transparent), 0 10px 30px -20px var(--p-glow); }
.portal-body .portal-nav a.active {
  color: var(--text);
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 24%, transparent), color-mix(in srgb, var(--brand-2) 14%, transparent));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 28%, transparent);
}
.portal-body .portal-nav a.active svg.lucide { color: var(--brand); }
:root[data-theme="dark"] .portal-body .portal-nav a.active svg.lucide { color: color-mix(in srgb, var(--brand) 60%, #fff); }

/* ---- tarjetas: borde con degradado de marca, superficie translúcida y sombra con color */
.portal-body .card,
.portal-body .pending-group,
.portal-body .review-panel {
  border: 1px solid transparent;
  background:
    linear-gradient(var(--p-card), var(--p-card)) padding-box,
    linear-gradient(150deg, var(--p-ring), var(--border) 32%, var(--border) 68%, color-mix(in srgb, var(--brand-2) 24%, var(--border))) border-box;
  box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 7%, transparent), 0 14px 34px -18px var(--p-glow);
}
.portal-body .card-link:hover, .portal-body .portal-panel:hover { box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 7%, transparent), 0 22px 44px -20px color-mix(in srgb, var(--brand) 34%, rgba(0, 0, 0, .25)); }
.portal-body .portal-panel { transition: box-shadow .35s var(--ease-out); }

/* ---- bienvenida */
.portal-body .portal-hero {
  position: relative; overflow: hidden; border: 1px solid transparent;
  background:
    radial-gradient(70% 140% at 100% 0%, color-mix(in srgb, var(--brand) 26%, transparent), transparent 62%) padding-box,
    radial-gradient(60% 120% at 0% 100%, color-mix(in srgb, var(--brand-2) 14%, transparent), transparent 60%) padding-box,
    linear-gradient(var(--p-card), var(--p-card)) padding-box,
    linear-gradient(135deg, color-mix(in srgb, var(--brand) 55%, var(--border)), var(--border) 45%, color-mix(in srgb, var(--brand-2) 40%, var(--border))) border-box;
  box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 8%, transparent), 0 24px 60px -28px color-mix(in srgb, var(--brand) 45%, rgba(0, 0, 0, .3));
}
.portal-body .portal-hero::before, .portal-body .portal-hero::after { content: ""; position: absolute; border-radius: 50%; pointer-events: none; }
.portal-body .portal-hero::before { width: 320px; height: 320px; right: -90px; top: -150px; background: color-mix(in srgb, var(--brand-2) 30%, transparent); filter: blur(60px); animation: heroFloat 9s ease-in-out infinite alternate; }
.portal-body .portal-hero::after { width: 420px; height: 420px; right: -160px; top: -200px; border: 1px solid color-mix(in srgb, var(--brand) 22%, transparent); box-shadow: 0 0 0 46px color-mix(in srgb, var(--brand) 4%, transparent), 0 0 0 92px color-mix(in srgb, var(--brand) 3%, transparent); }
.portal-body .portal-hero > * { position: relative; z-index: 1; }
@keyframes heroFloat { from { transform: translate(0, 0); } to { transform: translate(-40px, 30px); } }
.portal-body .portal-hero .hello {
  font-size: 34px; display: inline-block; padding-bottom: 2px;
  background: linear-gradient(100deg, var(--text) 35%, color-mix(in srgb, var(--brand) 75%, var(--text)) 75%, color-mix(in srgb, var(--brand-2) 70%, var(--text)));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.portal-body .portal-hero-cta { position: relative; overflow: hidden; background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 80%, #fff), var(--brand) 55%, color-mix(in srgb, var(--brand) 70%, var(--brand-2))); }
.portal-body .portal-hero-cta::after { content: ""; position: absolute; inset: 0; background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, .28) 48%, transparent 66%); transform: translateX(-120%); transition: transform .9s var(--ease-out); }
.portal-body .portal-hero-cta:hover::after { transform: translateX(120%); }
.portal-body .portal-hero-count { position: relative; }
.portal-body .portal-hero-count::after { content: ""; position: absolute; inset: -4px; border-radius: 18px; border: 2px solid rgba(255, 255, 255, .35); animation: countPulse 2.4s ease-out infinite; }
@keyframes countPulse { 0% { opacity: .9; transform: scale(.94); } 70%, 100% { opacity: 0; transform: scale(1.18); } }

/* ---- encabezados de sección */
.portal-body .portal-section-head h2 { display: flex; align-items: center; gap: 10px; font-size: 20px; }
.portal-body .portal-section-head h2::before { content: ""; width: 5px; height: 22px; border-radius: 99px; background: linear-gradient(180deg, var(--brand), var(--brand-2)); box-shadow: 0 4px 12px color-mix(in srgb, var(--brand) 40%, transparent); }
.portal-body .portal-panel-head h2 svg.lucide { width: 32px; height: 32px; padding: 7px; border-radius: 10px; color: #fff; background: linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 60%, var(--brand-2))); box-shadow: 0 6px 16px -4px color-mix(in srgb, var(--brand) 55%, transparent); }

/* ---- resumen del plan: cada cifra con su color */
.portal-body .plan-summary > div { position: relative; overflow: hidden; --tile: var(--brand); background: linear-gradient(160deg, color-mix(in srgb, var(--tile) 12%, var(--surface-2)), var(--surface-2) 70%); border-color: color-mix(in srgb, var(--tile) 22%, var(--border)); transition: transform .3s var(--ease-out), box-shadow .3s; }
.portal-body .plan-summary > div::before { content: ""; position: absolute; left: 0; top: 0; right: 0; height: 3px; background: linear-gradient(90deg, var(--tile), color-mix(in srgb, var(--tile) 30%, transparent)); }
.portal-body .plan-summary > div:hover { transform: translateY(-2px); box-shadow: 0 12px 24px -14px color-mix(in srgb, var(--tile) 60%, transparent); }
.portal-body .plan-summary > div:nth-child(2) { --tile: #10B981; }
.portal-body .plan-summary > div:nth-child(3) { --tile: #0EA5E9; }
.portal-body .plan-summary > div:nth-child(4) { --tile: var(--brand-2); }
.portal-body .plan-summary b { color: color-mix(in srgb, var(--tile) 45%, var(--text)); }
.portal-body .pbar { box-shadow: inset 0 1px 2px rgba(0, 0, 0, .12); }

/* ---- grupos y tarjetas de pendientes */
.portal-body .pending-group-icon { background: linear-gradient(135deg, var(--gc), color-mix(in srgb, var(--gc) 55%, #000)); color: #fff; box-shadow: 0 8px 18px -6px color-mix(in srgb, var(--gc) 65%, transparent); }
.portal-body .pending-group[open]:not(.closing) { box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 7%, transparent), 0 22px 48px -22px color-mix(in srgb, var(--brand) 40%, rgba(0, 0, 0, .3)); }
.portal-body .pending-card { background: var(--surface-2); border-color: color-mix(in srgb, var(--border) 80%, transparent); }
.portal-body .pending-card:hover { border-color: var(--p-ring); box-shadow: 0 0 0 1px var(--p-ring), 0 22px 44px -18px color-mix(in srgb, var(--brand) 45%, rgba(0, 0, 0, .3)); transform: translateY(-4px); }
.portal-body .pending-card-media::after { content: ""; position: absolute; inset: auto 0 0 0; height: 45%; background: linear-gradient(180deg, transparent, rgba(8, 8, 14, .45)); opacity: 0; transition: opacity .3s; pointer-events: none; }
.portal-body .pending-card:hover .pending-card-media::after { opacity: 1; }
.portal-body .pending-card-hover { z-index: 1; background: linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 65%, var(--brand-2))); box-shadow: 0 8px 20px -6px color-mix(in srgb, var(--brand) 70%, transparent); }
.portal-body .network-filter { background: var(--p-card); box-shadow: 0 10px 24px -18px var(--p-glow); }
.portal-body .network-filter button.active { color: #fff; background: linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 65%, var(--brand-2))); box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--brand) 65%, transparent); }
.portal-body .network-filter button.active .n { background: rgba(255, 255, 255, .22); }

/* ---- listas */
.portal-body .content-row { transition: background .2s, transform .25s var(--ease-out); }
.portal-body .content-row:hover { background: linear-gradient(90deg, var(--brand-softer), transparent); transform: translateX(3px); }
.portal-body .activity-item .ic { background: var(--brand-soft); color: var(--brand); }
:root[data-theme="dark"] .portal-body .activity-item .ic { color: color-mix(in srgb, var(--brand) 60%, #fff); }

/* ---- botones con más presencia dentro del portal */
.portal-body .btn-primary { background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 85%, #fff), var(--brand) 60%, color-mix(in srgb, var(--brand) 75%, var(--brand-2))); }
.portal-body .btn-success { background: linear-gradient(135deg, #34D399, #059669); box-shadow: 0 10px 24px -8px rgba(16, 185, 129, .6); }
.portal-body .btn-success:hover { background: linear-gradient(135deg, #2BC48A, #047857); transform: translateY(-1px); }

/* «Ver cómo se verá publicado»: botón destacado con icono, subtítulo y brillo */
.btn-preview {
  position: relative; height: auto; min-height: 64px; padding: 11px 14px; gap: 12px; justify-content: flex-start; text-align: left;
  white-space: normal; border-radius: 16px; border: 1px solid transparent; color: var(--text);
  background:
    linear-gradient(120deg, color-mix(in srgb, var(--brand) 16%, var(--surface)), color-mix(in srgb, var(--brand-2) 10%, var(--surface))) padding-box,
    linear-gradient(120deg, var(--brand), var(--brand-2)) border-box;
  box-shadow: 0 12px 28px -14px color-mix(in srgb, var(--brand) 70%, transparent);
  transition: transform .25s var(--ease-out), box-shadow .25s;
}
.btn-preview::after { content: ""; position: absolute; inset: 0; background: linear-gradient(115deg, transparent 30%, color-mix(in srgb, #fff 22%, transparent) 50%, transparent 70%); transform: translateX(-120%); animation: previewSheen 4.5s ease-in-out 1.2s infinite; pointer-events: none; }
.btn-preview:hover { transform: translateY(-2px); box-shadow: 0 18px 36px -14px color-mix(in srgb, var(--brand) 80%, transparent); background: linear-gradient(120deg, color-mix(in srgb, var(--brand) 24%, var(--surface)), color-mix(in srgb, var(--brand-2) 16%, var(--surface))) padding-box, linear-gradient(120deg, var(--brand), var(--brand-2)) border-box; }
.btn-preview:active { transform: scale(.985); }
.btn-preview-icon { display: grid; place-items: center; width: 42px; height: 42px; flex-shrink: 0; border-radius: 13px; color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-2)); box-shadow: 0 8px 18px -6px color-mix(in srgb, var(--brand) 70%, transparent); }
.btn-preview-icon svg.lucide { width: 20px; height: 20px; }
.btn-preview-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.btn-preview-text > span { font-size: 14.5px; font-weight: 750; letter-spacing: -.01em; }
.btn-preview-text small { font-size: 12px; font-weight: 500; color: var(--muted); }
.btn-preview svg.btn-preview-go { width: 18px; height: 18px; color: var(--brand); flex-shrink: 0; transition: transform .25s var(--ease-out); }
.btn-preview:hover svg.btn-preview-go { transform: translate(2px, -2px); }
:root[data-theme="dark"] .btn-preview svg.btn-preview-go { color: color-mix(in srgb, var(--brand) 60%, #fff); }
@keyframes previewSheen { 0% { transform: translateX(-120%); } 35%, 100% { transform: translateX(120%); } }

/* ---- barra inferior en móvil: flotante */
@media (max-width: 1024px) {
  .portal-body .bottom-nav { left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); padding: 6px; border-radius: 22px; border: 1px solid color-mix(in srgb, var(--brand) 18%, var(--border)); background: color-mix(in srgb, var(--surface) 82%, transparent); box-shadow: 0 18px 40px -16px rgba(0, 0, 0, .35); }
  .portal-body .bottom-nav a.active { background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 20%, transparent), color-mix(in srgb, var(--brand-2) 12%, transparent)); }
}
@media (max-width: 760px) {
  .portal-body .portal-hero .hello { font-size: 28px; }
  .portal-body .portal-hero::after { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .portal-body .portal-hero::before, .portal-body .portal-hero-count::after, .btn-preview::after { animation: none; }
}

/* ==========================================================================
   Panel de la agencia: piel visual (sólo estilos), hermana de la del portal. Todo va bajo .app-body.
   Usa los colores de la agencia (--brand / --brand-2).
   ========================================================================== */
.app-body {
  --a-card: color-mix(in srgb, var(--surface) 94%, transparent);
  --a-ring: color-mix(in srgb, var(--brand) 26%, var(--border));
  --a-glow: color-mix(in srgb, var(--brand) 18%, rgba(0, 0, 0, .16));
  background:
    radial-gradient(900px 520px at 22% -14%, color-mix(in srgb, var(--brand) 15%, transparent), transparent 65%),
    radial-gradient(760px 460px at 100% -6%, color-mix(in srgb, var(--brand-2) 10%, transparent), transparent 62%),
    radial-gradient(1100px 620px at 60% 115%, color-mix(in srgb, var(--brand) 7%, transparent), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}
.app-body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: radial-gradient(color-mix(in srgb, var(--text) 9%, transparent) 1px, transparent 1.2px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(ellipse 70% 50% at 60% 0%, #000 20%, transparent 75%);
  mask-image: radial-gradient(ellipse 70% 50% at 60% 0%, #000 20%, transparent 75%);
}

/* ---- barra lateral: oscura con un velo de marca arriba, y la columna llega hasta abajo */
@media (min-width: 1025px) {
  .app-body .app { background: linear-gradient(90deg, var(--sidebar-bg) 260px, transparent 260px); }
}
.app-body .sidebar {
  background:
    radial-gradient(120% 40% at 0% 0%, color-mix(in srgb, var(--brand) 22%, transparent), transparent 70%),
    radial-gradient(90% 30% at 100% 100%, color-mix(in srgb, var(--brand-2) 10%, transparent), transparent 70%),
    var(--sidebar-bg);
  border-right: 1px solid rgba(255, 255, 255, .05);
}
.app-body .brand { padding-bottom: 20px; margin-bottom: 4px; border-bottom: 1px solid rgba(255, 255, 255, .06); }
.app-body .nav-link { position: relative; transition: background .2s, color .2s, transform .25s var(--ease-out); }
.app-body .nav-link:hover { transform: translateX(2px); }
.app-body .nav-link.active {
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 32%, transparent), color-mix(in srgb, var(--brand-2) 14%, transparent));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 30%, transparent), 0 8px 20px -10px color-mix(in srgb, var(--brand) 70%, transparent);
}
.app-body .nav-link.active::before { content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: linear-gradient(180deg, var(--brand), var(--brand-2)); }
.app-body .nav-link.active svg { color: #fff; filter: none; }
.app-body .nav-client.active { background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 22%, transparent), transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 20%, transparent); }
.app-body .nav-label { color: color-mix(in srgb, var(--sidebar-muted) 80%, var(--brand)); }
.app-body .agency-switch { background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .06); }

/* ---- barra superior */
.app-body .topbar { background: color-mix(in srgb, var(--bg) 70%, transparent); }
.app-body .topbar.scrolled { border-bottom-color: color-mix(in srgb, var(--brand) 14%, var(--border)); box-shadow: 0 10px 30px -22px var(--a-glow); }
.app-body .search-trigger { background: var(--a-card); box-shadow: 0 6px 18px -14px var(--a-glow); }
.app-body .search-trigger:hover { border-color: var(--a-ring); }

/* ---- encabezados de página: título con degradado de marca */
.app-body .page-head { min-height: 56px; }
.app-body .page-head h1, .app-body .client-hero h1 {
  font-size: 28px; letter-spacing: -.035em; display: inline-block; padding-bottom: 2px;
  background: linear-gradient(100deg, var(--text) 40%, color-mix(in srgb, var(--brand) 70%, var(--text)) 80%, color-mix(in srgb, var(--brand-2) 65%, var(--text)));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.app-body .page-head .eyebrow { color: var(--brand); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; font-size: 11.5px; }
:root[data-theme="dark"] .app-body .page-head .eyebrow { color: color-mix(in srgb, var(--brand) 55%, #fff); }

/* ---- tarjetas: borde con degradado de marca y sombra con color (mismo lenguaje que el portal) */
.app-body .card {
  border: 1px solid transparent;
  background:
    linear-gradient(var(--a-card), var(--a-card)) padding-box,
    linear-gradient(150deg, var(--a-ring), var(--border) 32%, var(--border) 68%, color-mix(in srgb, var(--brand-2) 20%, var(--border))) border-box;
  box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 6%, transparent), 0 14px 34px -20px var(--a-glow);
}
.app-body .card-link:hover { border-color: transparent; box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 6%, transparent), 0 22px 44px -20px color-mix(in srgb, var(--brand) 34%, rgba(0, 0, 0, .25)); }
/* Mismo relleno en todas las tarjetas: los bordes interiores quedan alineados entre módulos. */
.app-body .card-pad { padding: 20px 22px; }
.app-body .card-head { padding: 18px 22px 0; }
.app-body .card-body { padding: 16px 22px 22px; }
.app-body .card-head h2, .app-body .card-head h3, .app-body .section-title h2 { letter-spacing: -.015em; }
.app-body .card-head h2 > svg.lucide, .app-body .card-head h3 > svg.lucide, .app-body .section-title h2 > svg.lucide {
  width: 30px; height: 30px; padding: 7px; border-radius: 10px; color: #fff;
  background: linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 60%, var(--brand-2)));
  box-shadow: 0 6px 16px -4px color-mix(in srgb, var(--brand) 55%, transparent);
}

/* ---- KPIs: cada uno con su color en la franja superior y el fondo */
.app-body .kpi { background: linear-gradient(160deg, color-mix(in srgb, var(--tone, var(--brand)) 12%, var(--a-card)), var(--a-card) 65%) padding-box, linear-gradient(150deg, color-mix(in srgb, var(--tone, var(--brand)) 40%, var(--border)), var(--border) 45%) border-box; min-height: 118px; justify-content: space-between; transition: transform .3s var(--ease-out), box-shadow .3s; }
.app-body .kpi::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: linear-gradient(90deg, var(--tone, var(--brand)), color-mix(in srgb, var(--tone, var(--brand)) 25%, transparent)); }
.app-body .kpi-icon { background: linear-gradient(135deg, var(--tone, var(--brand)), color-mix(in srgb, var(--tone, var(--brand)) 55%, #000)); color: #fff; box-shadow: 0 6px 14px -4px color-mix(in srgb, var(--tone, var(--brand)) 60%, transparent); }
.app-body a.kpi:hover { transform: translateY(-3px); box-shadow: 0 18px 34px -18px color-mix(in srgb, var(--tone, var(--brand)) 60%, transparent); }

/* ---- dashboard: tarjetas de planes en cuadrícula (antes la última quedaba sola y centrada) */
.app-body .plan-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.app-body .plan-card { flex: none; }
@media (max-width: 900px) { .app-body .plan-cards { grid-template-columns: 1fr; } }
.app-body .client-chip { background: var(--a-card); }
.app-body .client-chip.active { border-color: transparent; background: linear-gradient(var(--a-card), var(--a-card)) padding-box, linear-gradient(135deg, var(--brand), var(--brand-2)) border-box; box-shadow: 0 8px 20px -10px color-mix(in srgb, var(--brand) 60%, transparent); }
.app-body .attention { border: 1px solid color-mix(in srgb, var(--tone) 22%, transparent); }
.app-body .attention .ic { background: linear-gradient(135deg, var(--tone), color-mix(in srgb, var(--tone) 55%, #000)); color: #fff; }

/* ---- pestañas, segmentados y filtros */
.app-body .tabs { border-bottom-color: color-mix(in srgb, var(--brand) 12%, var(--border)); }
.app-body .tab { border-radius: 10px 10px 0 0; }
.app-body .tab:hover { background: color-mix(in srgb, var(--brand) 6%, transparent); }
.app-body .tab.active { border-bottom: 2px solid transparent; border-image: linear-gradient(90deg, var(--brand), var(--brand-2)) 1; background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--brand) 10%, transparent)); }
.app-body .tab.active svg.lucide { color: var(--brand); }
.app-body .segmented { background: var(--a-card); border: 1px solid var(--border); }
.app-body .segmented .active { color: #fff; background: linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 65%, var(--brand-2))); box-shadow: 0 6px 14px -6px color-mix(in srgb, var(--brand) 65%, transparent); }
.app-body .filter-chip.active { color: #fff; border-color: transparent; background: linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 65%, var(--brand-2))); }

/* ---- board */
.app-body .column { background: color-mix(in srgb, var(--surface-3) 70%, transparent); border: 1px solid color-mix(in srgb, var(--border) 70%, transparent); box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 4%, transparent); }
.app-body .column-head { padding: 6px 8px 8px; }
.app-body .column-head .dot { box-shadow: 0 0 0 4px color-mix(in srgb, var(--tone) 20%, transparent); }
.app-body .kcard { border-color: color-mix(in srgb, var(--border) 85%, transparent); }
.app-body .kcard:hover { border-color: var(--a-ring); box-shadow: 0 0 0 1px var(--a-ring), 0 16px 32px -16px color-mix(in srgb, var(--brand) 45%, rgba(0, 0, 0, .3)); }

/* ---- tablas y listas */
.app-body .table th { background: color-mix(in srgb, var(--surface-2) 80%, transparent); }
.app-body .table tr:hover td { background: linear-gradient(90deg, var(--brand-softer), transparent); }
.app-body .content-row { transition: background .2s, transform .25s var(--ease-out); }
.app-body .content-row:hover { background: linear-gradient(90deg, var(--brand-softer), transparent); transform: translateX(3px); }
.app-body .activity-item .ic { background: var(--brand-soft); color: var(--brand); }
:root[data-theme="dark"] .app-body .activity-item .ic { color: color-mix(in srgb, var(--brand) 60%, #fff); }

/* ---- botones */
.app-body .btn-primary { background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 85%, #fff), var(--brand) 60%, color-mix(in srgb, var(--brand) 75%, var(--brand-2))); }
.app-body .btn-success { background: linear-gradient(135deg, #34D399, #059669); box-shadow: 0 10px 24px -10px rgba(16, 185, 129, .6); }
.app-body .btn-success:hover { background: linear-gradient(135deg, #2BC48A, #047857); }

/* ---- formularios */
.app-body .input, .app-body .select, .app-body .textarea { background-color: var(--a-card); }
.app-body .input:focus, .app-body .select:focus, .app-body .textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft), 0 8px 20px -14px color-mix(in srgb, var(--brand) 60%, transparent); }

/* ---- encabezado de cliente */
.app-body .client-hero .client-logo { box-shadow: 0 10px 26px -6px color-mix(in srgb, var(--cc, var(--brand)) 55%, transparent), 0 0 0 3px var(--surface); }
.app-body .client-hero .eyebrow a { color: var(--brand); }
/* Etiquetas de KPI con dos líneas reservadas: los números quedan a la misma altura aunque una etiqueta sea larga. */
.app-body .kpi-label { line-height: 1.3; min-height: 2.6em; }
/* Todos los títulos de sección con icono, estén o no en .card-head, llevan el mismo cuadro de marca. */
.app-body .card h2:has(> svg.lucide:first-child) { display: flex; align-items: center; gap: 10px; letter-spacing: -.015em; }
.app-body .card h2 > svg.lucide:first-child {
  width: 30px; height: 30px; padding: 7px; border-radius: 10px; color: #fff;
  background: linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 60%, var(--brand-2)));
  box-shadow: 0 6px 16px -4px color-mix(in srgb, var(--brand) 55%, transparent);
}

/* Notificaciones en móvil: el panel ocupa el ancho de la pantalla (con 12px de margen) bajo la cabecera.
   Anclado a la campana se salía por la izquierda, porque a su derecha todavía está el avatar.
   Las cabeceras (.portal-top y .topbar) tienen backdrop-filter, así que «fixed» se mide desde ellas. */
@media (max-width: 760px) {
  .notif-panel { position: fixed; top: calc(100% + 6px); left: 12px; right: 12px; width: auto; transform-origin: top center; }
  .notif-list { max-height: min(440px, 60dvh); }
}
/* Mismo lenguaje visual que las tarjetas del portal y del panel. */
:is(.portal-body, .app-body) .notif-panel {
  border: 1px solid transparent;
  background: linear-gradient(var(--surface), var(--surface)) padding-box,
              linear-gradient(150deg, color-mix(in srgb, var(--brand) 35%, var(--border)), var(--border) 40%, var(--border) 70%, color-mix(in srgb, var(--brand-2) 22%, var(--border))) border-box;
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .45), 0 0 0 1px color-mix(in srgb, #fff 4%, transparent) inset;
}
:is(.portal-body, .app-body) .notif.unread { background: linear-gradient(90deg, var(--brand-soft), var(--brand-softer)); }
:is(.portal-body, .app-body) .notif.unread .ic { background: linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 60%, var(--brand-2))); color: #fff; }
