:root{
  --bg:#07111f;
  --surface:#0f1b2d;
  --surface-2:#14233a;
  --border:#263a55;
  --text:#eef6ff;
  --muted:#91a4bd;
  --primary:#7c3aed;
  --primary-2:#22b8f0;
  --danger:#ef4444;
  --radius:18px;
  --shadow:0 20px 50px rgba(0,0,0,.25);
}
*{box-sizing:border-box}
html{color-scheme:dark}
body{
  margin:0;
  min-height:100vh;
  background:
    radial-gradient(circle at 80% 0%,rgba(124,58,237,.18),transparent 28%),
    radial-gradient(circle at 10% 90%,rgba(34,184,240,.12),transparent 30%),
    var(--bg);
  color:var(--text);
  font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
}
button,input,textarea,select{font:inherit}
button,a{ -webkit-tap-highlight-color:transparent }
button{cursor:pointer}
a{color:inherit;text-decoration:none}
#appShell{
  display:grid;
  grid-template-columns:230px minmax(0,680px) 310px;
  gap:22px;
  width:min(1440px,100%);
  margin:auto;
  padding:20px;
}
.sidebar,.rightbar{position:sticky;top:20px;align-self:start}
.sidebar{
  min-height:calc(100vh - 40px);
  padding:18px;
  border:1px solid var(--border);
  border-radius:var(--radius);
  background:rgba(12,24,41,.88);
  backdrop-filter:blur(16px);
}
.brand{display:flex;gap:10px;align-items:center;font-size:22px;font-weight:800;margin-bottom:24px}
.brand-mark{
  display:grid;place-items:center;width:36px;height:36px;border-radius:12px;
  background:linear-gradient(135deg,var(--primary),var(--primary-2));
}
.side-nav{display:grid;gap:7px}
.side-nav a{
  display:flex;gap:12px;align-items:center;padding:12px 14px;border-radius:12px;color:var(--muted)
}
.side-nav a:hover,.side-nav a.active{color:white;background:linear-gradient(90deg,var(--primary),var(--primary-2))}
.primary{
  border:0;border-radius:12px;background:linear-gradient(90deg,var(--primary),var(--primary-2));
  color:white;padding:12px 18px;font-weight:800
}
.secondary{border:1px solid var(--border);background:transparent;color:var(--text);padding:12px 18px;border-radius:12px}
.wide{width:100%;margin-top:20px}
.sidebar-footer{display:grid;gap:10px;margin-top:26px;color:var(--muted);font-size:14px}
.main{min-width:0}
.topbar{
  display:flex;justify-content:space-between;align-items:center;padding:8px 4px 18px;
}
.topbar h1{margin:0;font-size:28px}
.topbar p{margin:3px 0 0;color:var(--muted)}
.top-actions{display:flex;align-items:center;gap:9px}
.icon-button{
  border:0;background:transparent;color:var(--text);padding:9px;border-radius:10px
}
.icon-button:hover{background:var(--surface-2)}
.avatar-link,.avatar{
  display:grid;place-items:center;width:42px;height:42px;border-radius:50%;
  background:linear-gradient(135deg,#f59e0b,#ef4444);font-weight:800;color:white
}
.stories{
  display:flex;gap:14px;overflow:auto;padding:8px 2px 18px;scrollbar-width:none
}
.story{border:0;background:transparent;color:var(--text);min-width:64px}
.story span{
  display:grid;place-items:center;width:58px;height:58px;margin:auto;border-radius:50%;
  background:var(--surface-2);border:3px solid var(--primary-2)
}
.story small{display:block;margin-top:6px;color:var(--muted);max-width:70px;overflow:hidden;text-overflow:ellipsis}
.composer,.post,.panel{
  border:1px solid var(--border);background:rgba(15,27,45,.92);border-radius:var(--radius);box-shadow:var(--shadow)
}
.composer{
  display:grid;grid-template-columns:auto 1fr;gap:12px;padding:16px;margin-bottom:18px
}
.composer>button{border:1px solid var(--border);background:var(--surface-2);color:var(--muted);border-radius:999px;text-align:left;padding:0 18px}
.composer-actions{grid-column:1/-1;display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
.composer-actions button{border:0;background:transparent;color:var(--muted);padding:10px;border-radius:10px}
.composer-actions button:hover{background:var(--surface-2);color:white}
.feed{display:grid;gap:18px;padding-bottom:100px}
.post{padding:16px}
.post-header{display:grid;grid-template-columns:auto 1fr auto;gap:10px;align-items:center}
.post-header strong,.post-header small{display:block}
.post-header small{color:var(--muted);margin-top:3px}
.post p{line-height:1.55}
.post-media{
  position:relative;min-height:340px;border-radius:15px;overflow:hidden;display:grid;place-items:center;
  font-weight:900;letter-spacing:.08em;color:rgba(255,255,255,.82)
}
.media-one{background:linear-gradient(135deg,#166534,#0f766e 45%,#111827)}
.media-two{background:linear-gradient(135deg,#f97316,#7c3aed 55%,#0f172a)}
.play{
  position:absolute;width:64px;height:64px;border-radius:50%;border:1px solid rgba(255,255,255,.45);
  background:rgba(0,0,0,.45);color:white;font-size:25px
}
.post-actions{display:grid;grid-template-columns:repeat(4,1fr);margin-top:12px;border-top:1px solid var(--border)}
.post-actions button{border:0;background:transparent;color:var(--muted);padding:12px;border-radius:10px}
.post-actions button:hover,.post-actions button.active{color:white;background:var(--surface-2)}
.rightbar{display:grid;gap:16px}
.panel{padding:16px}
.panel h2{font-size:16px;margin:0 0 15px}
.quick-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:8px}
.quick-grid button{display:grid;gap:5px;place-items:center;padding:14px 8px;border:1px solid var(--border);background:var(--surface-2);color:white;border-radius:12px}
.quick-grid span{font-size:12px;color:var(--muted)}
.stats-list{list-style:none;padding:0;margin:0;display:grid;gap:12px}
.stats-list li{display:flex;justify-content:space-between;color:var(--muted)}
.stats-list strong{color:white}
.suggestion{display:grid;grid-template-columns:auto 1fr auto;gap:9px;align-items:center;margin:12px 0}
.suggestion>span{display:grid;place-items:center;width:38px;height:38px;border-radius:50%;background:var(--surface-2)}
.suggestion small{display:block;color:var(--muted)}
.suggestion button{border:0;border-radius:9px;padding:8px 10px;color:white;background:var(--primary)}
.mobile-nav{display:none}
dialog{
  width:min(560px,calc(100% - 24px));border:1px solid var(--border);border-radius:20px;
  background:var(--surface);color:var(--text);padding:0;box-shadow:var(--shadow)
}
dialog::backdrop{background:rgba(0,0,0,.72);backdrop-filter:blur(5px)}
.modal-card{padding:18px}
.modal-card header{display:flex;justify-content:space-between;align-items:center}
.modal-card header button{border:0;background:transparent;color:white}
.modal-card textarea{
  width:100%;min-height:150px;resize:vertical;border:1px solid var(--border);border-radius:14px;
  background:var(--surface-2);color:white;padding:14px;margin:12px 0
}
.field{display:grid;gap:7px;margin:12px 0;color:var(--muted)}
.field select{background:var(--surface-2);border:1px solid var(--border);border-radius:10px;color:white;padding:10px}
.toggle-row{display:flex;justify-content:space-between;align-items:center;padding:11px 0;border-bottom:1px solid var(--border)}
.modal-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:18px}
.auth-page{display:grid;place-items:center;min-height:100vh;padding:24px}
.auth-card{
  width:min(460px,100%);padding:28px;border:1px solid var(--border);border-radius:22px;
  background:rgba(15,27,45,.95);box-shadow:var(--shadow)
}
.auth-card h1{margin-top:0}
.auth-card label{display:grid;gap:7px;margin:14px 0;color:var(--muted)}
.auth-card input,.auth-card select{
  width:100%;padding:12px;border:1px solid var(--border);border-radius:11px;background:var(--surface-2);color:white
}
.notice{padding:12px;border:1px solid var(--border);border-radius:12px;background:var(--surface-2);color:var(--muted);font-size:14px}
.page-shell{width:min(1100px,100%);margin:auto;padding:20px}
.page-card{border:1px solid var(--border);border-radius:18px;background:var(--surface);padding:20px}
.admin-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:14px}
.admin-card{padding:18px;border:1px solid var(--border);border-radius:15px;background:var(--surface-2)}
.admin-card strong{display:block;font-size:24px;margin-top:8px}
@media(max-width:1100px){
  #appShell{grid-template-columns:210px minmax(0,1fr)}
  .rightbar{display:none}
}
@media(max-width:760px){
  body{padding-bottom:78px}
  #appShell{display:block;padding:10px}
  .sidebar{display:none}
  .topbar{padding:8px 4px 12px}
  .topbar h1{font-size:22px}
  .topbar p{display:none}
  .stories{padding-bottom:12px}
  .composer{border-radius:16px}
  .post{border-radius:16px;padding:13px}
  .post-media{min-height:55vh}
  .mobile-nav{
    position:fixed;display:grid;grid-template-columns:repeat(5,1fr);left:0;right:0;bottom:0;z-index:30;
    padding:8px 8px calc(8px + env(safe-area-inset-bottom));background:rgba(7,17,31,.95);
    border-top:1px solid var(--border);backdrop-filter:blur(15px)
  }
  .mobile-nav a{display:grid;place-items:center;gap:2px;color:var(--muted)}
  .mobile-nav a.active{color:var(--primary-2)}
  .mobile-nav small{font-size:10px}
  .mobile-nav button{
    width:48px;height:48px;margin:auto;border-radius:50%;border:0;background:linear-gradient(135deg,var(--primary),var(--primary-2));color:white;font-size:25px
  }
  .admin-grid{grid-template-columns:1fr 1fr}
}


/* ===== FASE 4 ===== */
.hidden{display:none!important}
.file-picker{
  display:flex;align-items:center;justify-content:center;gap:8px;
  padding:11px;border:1px dashed var(--border);border-radius:12px;
  color:var(--muted);cursor:pointer;background:var(--surface-2)
}
.file-picker:hover{color:white;border-color:var(--primary-2)}
.file-picker input{display:none}
.image-preview{
  position:relative;overflow:hidden;border-radius:14px;border:1px solid var(--border);
  background:var(--surface-2);margin:12px 0
}
.image-preview img{display:block;width:100%;max-height:430px;object-fit:contain}
.image-preview button{
  position:absolute;top:9px;right:9px;width:38px;height:38px;border-radius:50%;
  border:0;background:rgba(0,0,0,.7);color:white
}
.post-image{
  width:100%;max-height:650px;display:block;object-fit:contain;
  border-radius:15px;background:#050a12;margin-top:12px
}
.comments-list{display:grid;gap:12px;max-height:52vh;overflow:auto;padding:4px}
.comment{
  display:grid;grid-template-columns:auto 1fr auto;gap:10px;
  padding:11px;border:1px solid var(--border);border-radius:13px;background:var(--surface-2)
}
.comment small{display:block;color:var(--muted);margin-top:3px}
.comment p{margin:7px 0 0;line-height:1.4}
.comment-form{display:grid;grid-template-columns:1fr auto;gap:9px;margin-top:14px}
.comment-form input{
  min-width:0;padding:12px;border:1px solid var(--border);border-radius:12px;
  background:var(--surface-2);color:white
}
.profile-cover{
  position:relative;height:230px;border-radius:18px;overflow:hidden;
  background:linear-gradient(135deg,var(--primary),var(--primary-2));margin-bottom:64px
}
.profile-cover img{width:100%;height:100%;object-fit:cover}
.profile-cover .cover-action{
  position:absolute;right:14px;bottom:14px;border:0;border-radius:11px;
  padding:10px 13px;background:rgba(0,0,0,.64);color:white
}
.profile-avatar-large{
  position:absolute;left:24px;bottom:-52px;width:112px;height:112px;border-radius:50%;
  border:5px solid var(--surface);overflow:hidden;background:var(--surface-2);
  display:grid;place-items:center;font-size:30px;font-weight:900
}
.profile-avatar-large img{width:100%;height:100%;object-fit:cover}
.avatar-action{
  position:absolute;left:112px;bottom:-46px;border:0;border-radius:50%;
  width:38px;height:38px;background:var(--primary);color:white
}
.profile-tabs{
  display:flex;gap:8px;overflow:auto;margin:18px 0;padding-bottom:5px
}
.profile-tabs button{
  white-space:nowrap;border:1px solid var(--border);background:var(--surface-2);
  color:var(--muted);padding:10px 14px;border-radius:999px
}
.profile-tabs button.active{background:linear-gradient(90deg,var(--primary),var(--primary-2));color:white}
.activity-grid{display:grid;gap:14px}
.mini-post{
  border:1px solid var(--border);border-radius:14px;padding:14px;background:var(--surface-2)
}
.menu-popup{
  position:absolute;z-index:20;right:12px;top:52px;min-width:180px;
  border:1px solid var(--border);border-radius:13px;background:var(--surface);
  box-shadow:var(--shadow);padding:7px
}
.menu-popup button{display:block;width:100%;text-align:left;border:0;background:transparent;color:white;padding:10px;border-radius:8px}
.menu-popup button:hover{background:var(--surface-2)}
.post-header{position:relative}
.status-badge{
  display:inline-flex;align-items:center;gap:5px;padding:5px 9px;border-radius:999px;
  font-size:12px;background:var(--surface-2);color:var(--muted)
}
@media(max-width:760px){
  .profile-cover{height:180px;margin-bottom:58px}
  .profile-avatar-large{width:96px;height:96px;bottom:-45px}
  .avatar-action{left:100px;bottom:-40px}
  .comment-form{grid-template-columns:1fr}
}

.toast{position:fixed;z-index:1000;right:20px;bottom:20px;max-width:min(420px,calc(100% - 40px));padding:14px 18px;border:1px solid var(--border);border-radius:14px;background:#10233b;color:white;box-shadow:var(--shadow);font-weight:700;animation:toastIn .25s ease-out}
.toast.success{border-color:#22c55e}.toast.error{border-color:#ef4444}
@keyframes toastIn{from{transform:translateY(18px);opacity:0}to{transform:none;opacity:1}}
.admin-table-wrap{overflow:auto}.admin-table{width:100%;border-collapse:collapse;min-width:720px}
.admin-table th,.admin-table td{padding:11px;border-bottom:1px solid var(--border);text-align:left;vertical-align:top}
.admin-table th{color:var(--muted);font-size:13px}
.admin-table select,.admin-table button{padding:8px 10px;border:1px solid var(--border);border-radius:9px;background:var(--surface-2);color:white}


/* ===== FASE 5: CLIPS ===== */
.clips-page{
  min-height:100vh;
  background:#030712;
}
.clips-header{
  position:fixed;
  z-index:50;
  top:0;
  left:0;
  right:0;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:12px 16px;
  background:linear-gradient(to bottom,rgba(0,0,0,.88),transparent);
  pointer-events:none;
}
.clips-header > *{pointer-events:auto}
.clips-header .brand{margin:0}
.clips-feed{
  height:100vh;
  overflow-y:auto;
  scroll-snap-type:y mandatory;
  scrollbar-width:none;
}
.clips-feed::-webkit-scrollbar{display:none}
.clip-card{
  position:relative;
  width:min(520px,100%);
  height:100vh;
  min-height:620px;
  margin:0 auto;
  scroll-snap-align:start;
  background:#000;
  overflow:hidden;
}
.clip-card video{
  width:100%;
  height:100%;
  object-fit:cover;
  background:#000;
}
.clip-gradient{
  position:absolute;
  inset:0;
  background:
    linear-gradient(to top,rgba(0,0,0,.82) 0%,transparent 46%),
    linear-gradient(to bottom,rgba(0,0,0,.42),transparent 20%);
  pointer-events:none;
}
.clip-info{
  position:absolute;
  z-index:3;
  left:16px;
  right:88px;
  bottom:28px;
}
.clip-info strong{display:block;font-size:17px}
.clip-info p{margin:8px 0;line-height:1.45}
.clip-info small{color:#d1d5db}
.clip-actions{
  position:absolute;
  z-index:4;
  right:12px;
  bottom:26px;
  display:grid;
  gap:14px;
}
.clip-actions button,
.clip-actions a{
  display:grid;
  place-items:center;
  gap:3px;
  width:58px;
  min-height:54px;
  border:0;
  border-radius:16px;
  color:white;
  background:rgba(15,23,42,.66);
  backdrop-filter:blur(10px);
}
.clip-actions button.active{background:rgba(124,58,237,.82)}
.clip-actions small{font-size:11px}
.clip-play-overlay{
  position:absolute;
  z-index:2;
  inset:0;
  display:grid;
  place-items:center;
  pointer-events:none;
  opacity:0;
  transition:opacity .18s;
}
.clip-play-overlay span{
  display:grid;
  place-items:center;
  width:74px;
  height:74px;
  border-radius:50%;
  background:rgba(0,0,0,.55);
  font-size:32px;
}
.clip-card.paused .clip-play-overlay{opacity:1}
.clip-empty{
  min-height:100vh;
  display:grid;
  place-items:center;
  padding:24px;
}
.clip-upload-card{
  width:min(620px,calc(100% - 24px));
}
.video-preview{
  margin:14px 0;
  border:1px solid var(--border);
  border-radius:16px;
  overflow:hidden;
  background:#000;
}
.video-preview video{
  display:block;
  width:100%;
  max-height:58vh;
  object-fit:contain;
}
.clip-create-button{
  position:fixed;
  z-index:55;
  right:18px;
  top:70px;
  width:52px;
  height:52px;
  border:0;
  border-radius:50%;
  background:linear-gradient(135deg,var(--primary),var(--primary-2));
  color:white;
  font-size:26px;
  box-shadow:var(--shadow);
}
.clip-status{
  position:fixed;
  z-index:100;
  left:50%;
  top:82px;
  transform:translateX(-50%);
  width:min(440px,calc(100% - 30px));
}
@media(min-width:760px){
  .clip-card{border-left:1px solid #1f2937;border-right:1px solid #1f2937}
}


/* ===== FASE 6: ENCUESTAS Y NOTIFICACIONES ===== */
.poll-card{
  border:1px solid var(--border);
  border-radius:16px;
  padding:14px;
  background:var(--surface-2);
  margin-top:12px
}
.poll-options{display:grid;gap:10px;margin-top:12px}
.poll-option{
  position:relative;
  overflow:hidden;
  display:grid;
  grid-template-columns:1fr auto;
  gap:10px;
  align-items:center;
  width:100%;
  padding:12px;
  border:1px solid var(--border);
  border-radius:12px;
  background:var(--surface);
  color:white;
  text-align:left
}
.poll-option:hover{border-color:var(--primary-2)}
.poll-option.selected{border-color:#22c55e}
.poll-progress{
  position:absolute;
  inset:0 auto 0 0;
  background:rgba(124,58,237,.23);
  pointer-events:none
}
.poll-option > span,.poll-option > strong{position:relative;z-index:1}
.poll-meta{
  display:flex;
  justify-content:space-between;
  gap:10px;
  flex-wrap:wrap;
  margin-top:10px;
  color:var(--muted);
  font-size:13px
}
.poll-builder{display:grid;gap:9px}
.poll-builder-row{display:grid;grid-template-columns:1fr auto;gap:8px}
.poll-builder-row input{
  min-width:0;
  padding:11px;
  border:1px solid var(--border);
  border-radius:10px;
  background:var(--surface-2);
  color:white
}
.notifications-button{
  position:relative
}
.notification-badge{
  position:absolute;
  top:-6px;
  right:-7px;
  min-width:20px;
  height:20px;
  padding:0 5px;
  display:grid;
  place-items:center;
  border-radius:999px;
  background:#ef4444;
  color:white;
  font-size:11px;
  font-weight:800
}
.notifications-list{display:grid;gap:10px}
.notification-item{
  display:grid;
  grid-template-columns:auto 1fr auto;
  gap:10px;
  align-items:start;
  padding:13px;
  border:1px solid var(--border);
  border-radius:13px;
  background:var(--surface-2)
}
.notification-item.unread{border-color:var(--primary-2);background:rgba(124,58,237,.12)}
.notification-item small{display:block;color:var(--muted);margin-top:4px}
.notification-item button{
  border:0;
  background:transparent;
  color:white;
  cursor:pointer
}
@media(max-width:700px){
  .poll-builder-row{grid-template-columns:1fr}
}


/* ===== FASE 7: SOCIAL Y MENSAJERÍA ===== */
.people-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(250px,1fr));
  gap:14px
}
.person-card{
  display:grid;
  grid-template-columns:auto 1fr;
  gap:12px;
  padding:14px;
  border:1px solid var(--border);
  border-radius:15px;
  background:var(--surface-2)
}
.person-card .avatar{
  width:54px;
  height:54px
}
.person-card-actions{
  grid-column:1/-1;
  display:flex;
  gap:8px;
  flex-wrap:wrap
}
.public-profile-header{
  display:grid;
  grid-template-columns:auto 1fr;
  gap:18px;
  align-items:center
}
.public-profile-avatar{
  width:110px;
  height:110px;
  border-radius:50%;
  overflow:hidden;
  display:grid;
  place-items:center;
  border:4px solid var(--border);
  background:var(--surface-2);
  font-size:30px;
  font-weight:900
}
.public-profile-avatar img{
  width:100%;
  height:100%;
  object-fit:cover
}
.profile-stats{
  display:flex;
  gap:18px;
  flex-wrap:wrap;
  color:var(--muted)
}
.chat-layout{
  display:grid;
  grid-template-columns:320px 1fr;
  min-height:70vh;
  border:1px solid var(--border);
  border-radius:16px;
  overflow:hidden
}
.conversations-list{
  border-right:1px solid var(--border);
  background:var(--surface-2);
  overflow:auto
}
.conversation-item{
  display:grid;
  grid-template-columns:auto 1fr;
  gap:10px;
  padding:13px;
  border-bottom:1px solid var(--border);
  cursor:pointer
}
.conversation-item:hover,
.conversation-item.active{
  background:rgba(124,58,237,.15)
}
.chat-panel{
  display:grid;
  grid-template-rows:auto 1fr auto;
  min-width:0
}
.chat-header{
  padding:14px;
  border-bottom:1px solid var(--border);
  background:var(--surface-2)
}
.messages-list{
  padding:16px;
  overflow:auto;
  display:flex;
  flex-direction:column;
  gap:10px
}
.message-row{
  display:flex
}
.message-row.mine{justify-content:flex-end}
.message-bubble{
  max-width:min(75%,560px);
  padding:10px 13px;
  border-radius:15px;
  background:var(--surface-2);
  border:1px solid var(--border)
}
.message-row.mine .message-bubble{
  background:linear-gradient(135deg,var(--primary),var(--primary-2));
  border-color:transparent
}
.message-bubble small{
  display:block;
  opacity:.75;
  margin-top:5px
}
.message-form{
  display:grid;
  grid-template-columns:1fr auto;
  gap:10px;
  padding:13px;
  border-top:1px solid var(--border)
}
.message-form input{
  min-width:0;
  padding:12px;
  border:1px solid var(--border);
  border-radius:12px;
  background:var(--surface-2);
  color:white
}
@media(max-width:760px){
  .chat-layout{grid-template-columns:1fr}
  .conversations-list{max-height:260px;border-right:0;border-bottom:1px solid var(--border)}
  .public-profile-header{grid-template-columns:1fr;text-align:center}
  .public-profile-avatar{margin:auto}
}

/* ===== FASE 8 ===== */
.friend-tabs{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:16px}
.friend-tabs button{padding:10px 14px;border:1px solid var(--border);border-radius:999px;background:var(--surface-2);color:var(--muted)}
.friend-tabs button.active{color:white;background:linear-gradient(90deg,var(--primary),var(--primary-2))}
.friend-request-card{display:grid;grid-template-columns:auto 1fr;gap:12px;padding:14px;border:1px solid var(--border);border-radius:15px;background:var(--surface-2)}
.friend-request-actions{grid-column:1/-1;display:flex;gap:8px;flex-wrap:wrap}
.online-dot{display:inline-block;width:9px;height:9px;border-radius:50%;background:#22c55e;box-shadow:0 0 0 3px rgba(34,197,94,.15)}
.last-seen{display:inline-flex;align-items:center;gap:6px;color:var(--muted);font-size:12px}
.unread-count{min-width:22px;height:22px;padding:0 6px;border-radius:999px;display:inline-grid;place-items:center;background:#ef4444;color:white;font-size:11px;font-weight:800}
.message-status{font-size:11px;opacity:.7;margin-left:6px}


/* ============================================================
   SOCIALGO FASE 8.1 — REDISEÑO VISUAL CONCEPTO B
   ============================================================ */
:root{
  --bg:#050914;
  --surface:#0b1220;
  --surface-2:#101a2b;
  --surface-3:#151f32;
  --border:#202c42;
  --text:#f7f8fc;
  --muted:#8e9bb0;
  --primary:#7c3aed;
  --primary-2:#2cb7f6;
  --accent:#d946ef;
  --success:#22c55e;
  --radius:16px;
  --shadow:0 18px 50px rgba(0,0,0,.30);
}
html{background:var(--bg)}
body{
  background:
    radial-gradient(circle at 72% -10%,rgba(124,58,237,.15),transparent 28%),
    radial-gradient(circle at 0% 55%,rgba(44,183,246,.07),transparent 22%),
    var(--bg);
}
#appShell{
  grid-template-columns:220px minmax(520px,670px) 300px;
  gap:16px;
  width:min(1260px,100%);
  padding:14px;
}
.sidebar{
  top:14px;
  min-height:calc(100vh - 28px);
  border-radius:20px;
  background:rgba(8,14,25,.94);
  padding:18px 14px;
}
.brand{
  font-size:23px;
  padding:0 8px;
  margin-bottom:22px;
}
.brand-mark{
  width:38px;
  height:38px;
  border-radius:13px;
  box-shadow:0 8px 25px rgba(124,58,237,.28);
}
.side-nav{gap:5px}
.side-nav a{
  padding:11px 12px;
  border-radius:11px;
  color:#c6cede;
}
.side-nav a:hover{
  color:white;
  background:rgba(255,255,255,.045);
}
.side-nav a.active{
  color:white;
  background:linear-gradient(90deg,rgba(124,58,237,.92),rgba(53,110,230,.78));
  box-shadow:0 10px 24px rgba(79,70,229,.20);
}
.primary.wide{
  margin-top:18px;
  border:0;
  border-radius:11px;
  background:linear-gradient(100deg,#2563eb,#7c3aed 58%,#a855f7);
  box-shadow:0 10px 25px rgba(124,58,237,.24);
}
.sidebar-account{
  margin-top:26px;
  padding-top:16px;
  border-top:1px solid var(--border);
}
.sidebar-profile{
  display:grid;
  grid-template-columns:auto 1fr auto;
  align-items:center;
  gap:10px;
  padding:9px;
  border-radius:12px;
  background:rgba(255,255,255,.025);
}
.sidebar-profile small{display:block;color:var(--muted);margin-top:2px}
.sidebar-profile b{font-size:24px;color:var(--muted)}
.premium-card{
  display:grid;
  gap:7px;
  margin-top:12px;
  padding:13px;
  border:1px solid #3a3151;
  border-radius:13px;
  background:linear-gradient(145deg,rgba(124,58,237,.16),rgba(44,183,246,.06));
}
.premium-card strong{color:#f4cc62;font-size:13px}
.premium-card small{color:var(--muted);line-height:1.4}
.sidebar-footer{margin-top:14px}
.main{padding-top:0}
.topbar{
  position:sticky;
  z-index:25;
  top:0;
  display:grid;
  grid-template-columns:1fr auto;
  gap:14px;
  padding:8px 0 12px;
  background:linear-gradient(to bottom,var(--bg) 72%,transparent);
}
.mobile-brand{display:none}
.global-search{
  display:flex;
  align-items:center;
  gap:8px;
  width:min(430px,100%);
  padding:0 14px;
  border:1px solid var(--border);
  border-radius:999px;
  background:rgba(16,26,43,.88);
  color:var(--muted);
}
.global-search input{
  width:100%;
  border:0;
  outline:0;
  background:transparent;
  color:white;
  padding:11px 0;
}
.top-actions{gap:5px}
.top-actions .icon-button{
  position:relative;
  display:grid;
  place-items:center;
  width:40px;
  height:40px;
  padding:0;
  border-radius:50%;
  background:transparent;
}
.top-actions #topCreate{
  background:linear-gradient(135deg,var(--primary),var(--primary-2));
  font-size:22px;
}
.avatar-link{
  width:40px;
  height:40px;
  border:2px solid #5e4ac7;
}
.stories-wrap{
  margin-bottom:14px;
  border:1px solid var(--border);
  border-radius:17px;
  background:rgba(11,18,32,.86);
  overflow:hidden;
}
.section-title{
  display:flex;
  justify-content:space-between;
  padding:12px 14px 0;
}
.section-title a,.panel-heading a{color:#8b7cf6;font-size:12px}
.stories{padding:12px 12px 14px}
.story span{
  width:62px;
  height:62px;
  border:3px solid transparent;
  background:
    linear-gradient(var(--surface-2),var(--surface-2)) padding-box,
    linear-gradient(135deg,#38bdf8,#7c3aed,#ec4899,#f59e0b) border-box;
}
.story.add span{
  background:
    linear-gradient(var(--surface-2),var(--surface-2)) padding-box,
    linear-gradient(135deg,#38bdf8,#7c3aed) border-box;
}
.composer,.post,.panel{
  border-color:var(--border);
  background:rgba(11,18,32,.95);
  box-shadow:none;
}
.composer{
  border-radius:16px;
  padding:14px;
}
.composer>button{
  background:#101929;
  border-color:#202d43;
  min-height:43px;
}
.composer-actions{
  border-top:1px solid var(--border);
  padding-top:8px;
}
.composer-actions button{font-size:13px}
.post{
  padding:14px;
  border-radius:16px;
}
.post-header .avatar{width:43px;height:43px}
.post p{margin:12px 0;color:#edf1f8}
.post-image{
  max-height:620px;
  border-radius:12px;
  margin-top:10px;
}
.post-actions{
  margin-top:10px;
}
.post-actions button{font-size:13px}
.rightbar{
  top:14px;
  gap:12px;
}
.panel{
  padding:14px;
  border-radius:16px;
}
.panel-heading{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom:12px;
}
.panel-heading h2{margin:0}
.right-list,.online-list{display:grid;gap:9px}
.right-person{
  display:grid;
  grid-template-columns:auto 1fr auto;
  gap:8px;
  align-items:center;
}
.right-person .avatar,.online-list .avatar{width:36px;height:36px;font-size:12px}
.right-person small,.online-list small{display:block;color:var(--muted);margin-top:2px}
.right-person>a{
  padding:7px 8px;
  border-radius:8px;
  background:#5b36d6;
  font-size:11px;
}
.online-list>a{
  display:grid;
  grid-template-columns:auto 1fr;
  gap:9px;
  align-items:center;
}
.online-list i{
  display:inline-block;
  width:7px;
  height:7px;
  margin-right:4px;
  border-radius:50%;
  background:var(--success);
}
.trends-list{
  margin:0;
  padding-left:22px;
  display:grid;
  gap:12px;
}
.trends-list small{display:block;color:var(--muted);margin-top:2px}
dialog{
  background:#0b1220;
  border-color:#29364d;
}
.page-shell{width:min(1180px,100%)}
.page-card{
  background:rgba(11,18,32,.94);
  border-color:var(--border);
}
.auth-card{
  background:rgba(11,18,32,.97);
  border-color:var(--border);
}
.mobile-nav{
  box-shadow:0 -10px 35px rgba(0,0,0,.32);
}

@media(max-width:1100px){
  #appShell{grid-template-columns:205px minmax(0,1fr);max-width:960px}
}
@media(max-width:760px){
  body{padding-bottom:76px}
  #appShell{padding:0 9px 12px}
  .topbar{
    grid-template-columns:1fr auto;
    align-items:center;
    padding:8px 3px 8px;
  }
  .mobile-brand{
    display:flex;
    align-items:center;
    gap:8px;
    font-size:18px;
  }
  .mobile-brand .brand-mark{width:31px;height:31px;border-radius:10px}
  .global-search{display:none}
  .top-actions #topCreate{width:38px;height:38px}
  .top-actions .icon-button{width:36px;height:36px}
  .top-actions>a:nth-of-type(1){display:none}
  .avatar-link{display:none}
  .stories-wrap{
    margin:0 -9px 12px;
    border-left:0;
    border-right:0;
    border-radius:0;
  }
  .section-title{padding-left:13px;padding-right:13px}
  .stories{gap:9px;padding-left:12px}
  .story{min-width:61px}
  .story span{width:57px;height:57px}
  .composer{
    margin:0 0 12px;
    padding:12px;
  }
  .composer .avatar{width:38px;height:38px}
  .composer-actions button{padding:8px 3px;font-size:12px}
  .feed{gap:12px}
  .post{
    margin:0 -1px;
    padding:12px;
    border-radius:14px;
  }
  .post-image{max-height:72vh}
  .post-actions button{padding:11px 4px;font-size:12px}
  .mobile-nav{
    background:rgba(5,9,20,.95);
    border-top-color:#202c42;
  }
  .mobile-nav a.active{color:#8b5cf6}
  .mobile-nav button{
    background:linear-gradient(135deg,#2563eb,#7c3aed,#d946ef);
    box-shadow:0 8px 22px rgba(124,58,237,.34);
  }
  .page-shell{padding:12px}
  .page-card{border-radius:15px;padding:15px}
}


/* SOCIALGO FASE 8.2 — CLIPS CONCEPTO D */
.clips-page{background:#02050c;overflow:hidden}
.clips-header{
  z-index:80;height:62px;padding:8px 16px;
  background:linear-gradient(to bottom,rgba(2,5,12,.94),rgba(2,5,12,.45),transparent)
}
.clips-logo{display:flex;align-items:center;gap:8px;color:white}
.clips-logo .brand-mark{width:34px;height:34px;border-radius:10px}
.clips-tabs{
  position:absolute;left:50%;transform:translateX(-50%);
  display:flex;gap:18px;align-items:center
}
.clips-tabs button{
  position:relative;border:0;padding:10px 2px;background:transparent;
  color:#a7b0c0;font-weight:700
}
.clips-tabs button.active{color:white}
.clips-tabs button.active::after{
  content:"";position:absolute;left:10%;right:10%;bottom:2px;height:3px;
  border-radius:999px;background:linear-gradient(90deg,#ec4899,#7c3aed,#38bdf8)
}
.clips-search{
  display:grid;place-items:center;width:40px;height:40px;
  border-radius:50%;color:white;font-size:25px
}
.clips-feed{height:100dvh;background:#000}
.clip-card{width:min(560px,100%);height:100dvh;min-height:560px}
.clip-card video{object-fit:cover;background:#000}
.clip-gradient{
  background:
    linear-gradient(to top,rgba(0,0,0,.92) 0%,rgba(0,0,0,.38) 36%,transparent 63%),
    linear-gradient(to bottom,rgba(0,0,0,.58),transparent 22%)
}
.clip-info{left:16px;right:86px;bottom:88px}
.clip-info strong{font-size:16px}
.clip-info p{margin:10px 0 5px;font-size:14px}
.clip-actions{right:10px;bottom:88px;gap:12px}
.clip-actions button,.clip-actions a{
  width:58px;min-height:58px;border-radius:50%;
  background:rgba(7,12,22,.68);
  border:1px solid rgba(255,255,255,.10)
}
.clip-actions button.active{background:linear-gradient(145deg,#ec4899,#7c3aed)}
.clip-create-button{display:none}
.clips-bottom-nav{
  position:fixed;z-index:90;left:50%;bottom:0;transform:translateX(-50%);
  width:min(560px,100%);height:70px;padding:7px 12px calc(7px + env(safe-area-inset-bottom));
  display:grid;grid-template-columns:repeat(5,1fr);gap:4px;
  border-top:1px solid rgba(255,255,255,.10);
  background:rgba(3,7,14,.92);backdrop-filter:blur(18px)
}
.clips-bottom-nav a,.clips-bottom-nav button{
  display:grid;place-items:center;gap:1px;border:0;background:transparent;
  color:#c3cada;font-size:22px
}
.clips-bottom-nav small{font-size:10px}
.clips-bottom-nav .active{color:#d946ef}
.clips-bottom-nav button{
  width:50px;height:50px;margin:-10px auto 0;border-radius:50%;color:white;
  background:linear-gradient(135deg,#2563eb,#7c3aed,#ec4899);
  box-shadow:0 10px 28px rgba(124,58,237,.45)
}
.clips-bottom-nav button small{
  position:absolute;margin-top:65px;color:#c3cada
}
@media(max-width:600px){
  .clips-logo strong{display:none}
  .clips-header{padding-left:12px;padding-right:12px}
  .clips-tabs{gap:14px}
  .clip-info{bottom:92px}
  .clip-actions{bottom:96px}
}
\n\n/* ============================================================\n   SOCIALGO FASE 8.3 — RECONSTRUCCIÓN MÓVIL REAL\n   ============================================================ */\n.post-image-fallback{\n  display:grid;place-items:center;gap:5px;min-height:210px;margin-top:10px;\n  border-radius:14px;border:1px dashed #31415b;background:#080e19;color:#d7deea;text-align:center\n}\n.post-image-fallback span{font-size:34px}.post-image-fallback small{color:var(--muted)}\n.story span img{width:100%;height:100%;object-fit:cover;border-radius:50%}.story span b{font-size:17px}\n@media(max-width:760px){\n  html,body{width:100%;overflow-x:hidden}\n  body{background:#050914;padding-bottom:76px}\n  #appShell{display:block;width:100%;padding:0}\n  .main{width:100%;max-width:none;padding:0}\n  .topbar{\n    position:sticky;top:0;z-index:60;height:64px;padding:10px 14px;\n    display:flex;align-items:center;justify-content:space-between;\n    border-bottom:1px solid #18253a;background:rgba(5,9,20,.96);backdrop-filter:blur(18px)\n  }\n  .mobile-brand{display:flex;align-items:center;gap:9px;font-size:22px}.mobile-brand .brand-mark{width:39px;height:39px}\n  .top-actions{display:flex;align-items:center}.top-actions #topCreate{width:44px;height:44px;font-size:26px}\n  .top-actions .icon-button{width:40px;height:40px;font-size:20px}\n  .top-actions>a:nth-of-type(1){display:none}.avatar-link{display:none}.global-search{display:none}\n  .stories-wrap{margin:0;border:0;border-bottom:1px solid #18253a;border-radius:0;background:#07101f}\n  .section-title{padding:18px 20px 8px;font-size:19px}.section-title a{font-size:13px}\n  .stories{display:flex;gap:15px;padding:12px 18px 20px;overflow-x:auto}.story{min-width:66px}\n  .story span{width:66px;height:66px}.story small{max-width:70px;font-size:12px;margin-top:7px}\n  .composer{\n    margin:16px 14px 20px;padding:14px 14px 8px;border-radius:20px;\n    grid-template-columns:48px 1fr;background:#0a1424\n  }\n  .composer .avatar{width:48px;height:48px;font-size:17px}.composer>button{min-height:48px;border-radius:999px;font-size:16px}\n  .composer-actions{grid-column:1/-1;display:grid;grid-template-columns:repeat(3,1fr);margin-top:12px;padding:12px 0 2px}\n  .composer-actions button{font-size:14px;padding:10px 4px}\n  .feed{display:grid;gap:16px;padding:0 12px 18px}\n  .post{margin:0;padding:0;border-radius:20px;overflow:hidden;background:#091220;border-color:#1c2a40}\n  .post-header{padding:15px 15px 4px}.post>p{padding:0 15px;margin:12px 0 10px;font-size:16px;line-height:1.45}\n  .post-image{width:100%;max-height:none;height:auto;margin:8px 0 0;border-radius:0;object-fit:cover;background:#05080d}\n  .post-image-fallback{margin:8px 0 0;border-radius:0;border-left:0;border-right:0}\n  .poll-card{margin:10px 14px 14px}\n  .post-actions{display:grid;grid-template-columns:repeat(4,1fr);margin:0;padding:8px 8px 10px;border-top:1px solid #18253a}\n  .post-actions button{min-height:44px;padding:7px 2px;font-size:13px}.post-actions button span{font-size:12px}\n  .menu-popup{right:12px;top:58px}\n  .mobile-nav{height:72px;padding:8px 8px calc(8px + env(safe-area-inset-bottom));background:rgba(4,8,17,.98)}\n  .mobile-nav a{font-size:21px}.mobile-nav small{font-size:11px}.mobile-nav button{width:58px;height:58px;margin-top:-18px;font-size:32px}\n}\n

/* ============================================================
   SOCIALGO FASE 8.4 — CORRECCIÓN INTEGRAL
   ============================================================ */
[hidden]{display:none!important}

.compact-page{
  width:min(1080px,100%);
  margin:0 auto;
  padding:18px;
}
.compact-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:18px;
}
.profile-edit-card{
  width:min(820px,100%);
  margin:0 auto;
}
.profile-form-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:14px;
}
.profile-form-grid .full{grid-column:1/-1}
.profile-form-grid textarea{min-height:120px;max-height:220px}
.profile-privacy{
  margin-top:12px;
  border:1px solid var(--border);
  border-radius:14px;
  overflow:hidden;
}
.profile-actions{
  position:sticky;
  bottom:10px;
  z-index:12;
  display:flex;
  justify-content:flex-end;
  gap:10px;
  flex-wrap:wrap;
  margin-top:16px;
  padding:12px;
  border:1px solid var(--border);
  border-radius:14px;
  background:rgba(8,14,25,.94);
  backdrop-filter:blur(14px);
}
.admin-toolbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:18px;
}
.media-unavailable{
  display:grid;
  place-items:center;
  min-height:180px;
  padding:22px;
  border:1px dashed var(--border);
  border-radius:14px;
  background:var(--surface-2);
  color:var(--muted);
  text-align:center;
}
.post-video{
  display:block;
  width:100%;
  max-height:650px;
  margin-top:12px;
  border-radius:14px;
  background:#000;
  object-fit:contain;
}
.chat-error{
  padding:12px;
  border:1px solid #ef4444;
  border-radius:12px;
  background:rgba(239,68,68,.08);
  color:#fecaca;
}
@media(max-width:760px){
  .compact-page{padding:10px}
  .profile-form-grid{grid-template-columns:1fr}
  .profile-form-grid .full{grid-column:auto}
  .profile-actions{
    position:static;
    display:grid;
    grid-template-columns:1fr;
  }
  .profile-actions>*{width:100%;text-align:center}
}


/* ============================================================
   SOCIALGO FASE 8.5A — EDITOR DE CLIPS
   ============================================================ */
.clip-editor-dialog{
  width:100vw;
  max-width:none;
  height:100dvh;
  max-height:none;
  margin:0;
  padding:0;
  border:0;
  border-radius:0;
  background:#05070d;
}
.clip-editor-shell{
  height:100%;
  display:grid;
  grid-template-rows:auto 1fr;
}
.clip-editor-header{
  display:grid;
  grid-template-columns:auto 1fr auto;
  align-items:center;
  gap:12px;
  padding:12px 18px;
  border-bottom:1px solid #20293a;
  background:#080d16;
}
.clip-editor-header h2{margin:0;font-size:20px}
.clip-editor-header small{color:var(--muted)}
.clip-editor-body{
  min-height:0;
  display:grid;
  grid-template-columns:minmax(320px,520px) minmax(360px,620px);
  justify-content:center;
  gap:22px;
  padding:20px;
  overflow:auto;
}
.clip-editor-preview{
  display:grid;
  grid-template-columns:1fr auto;
  gap:12px;
  align-items:center;
  min-height:0;
}
.phone-preview{
  position:relative;
  width:min(100%,390px);
  aspect-ratio:9/16;
  margin:auto;
  overflow:hidden;
  border:1px solid #29354a;
  border-radius:24px;
  background:#000;
  box-shadow:0 25px 70px rgba(0,0,0,.45);
}
.phone-preview video{
  width:100%;
  height:100%;
  object-fit:contain;
  background:#000;
}
.clip-text-overlay{
  position:absolute;
  left:10%;
  right:10%;
  top:48%;
  padding:8px 12px;
  border-radius:8px;
  background:rgba(0,0,0,.55);
  color:white;
  text-align:center;
  font-size:22px;
  font-weight:800;
  text-shadow:0 2px 7px rgba(0,0,0,.8);
  pointer-events:none;
}
.editor-quick-tools{
  display:grid;
  gap:9px;
}
.editor-quick-tools button{
  display:grid;
  place-items:center;
  gap:3px;
  width:70px;
  min-height:62px;
  border:1px solid #263249;
  border-radius:14px;
  background:#101827;
  color:white;
  font-size:21px;
}
.editor-quick-tools small{
  font-size:10px;
  color:#bdc7d8;
}
.clip-editor-controls{
  min-width:0;
  display:grid;
  align-content:start;
  gap:14px;
}
.clip-source-picker{
  min-height:54px;
  border-color:#5f4ad3;
  background:linear-gradient(135deg,rgba(37,99,235,.16),rgba(124,58,237,.18));
}
.clip-file-info,.trim-heading,.processing-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}
.trim-editor,.cover-picker-panel,.clip-text-panel{
  padding:14px;
  border:1px solid #263249;
  border-radius:16px;
  background:#0b1220;
}
.thumbnail-timeline{
  height:96px;
  display:grid;
  grid-template-columns:repeat(10,1fr);
  overflow:hidden;
  margin:12px 0;
  border:3px solid #7c3aed;
  border-radius:12px;
  background:#000;
}
.thumbnail-timeline img{
  width:100%;
  height:100%;
  object-fit:cover;
}
.range-stack{
  position:relative;
  height:34px;
}
.range-stack input{
  position:absolute;
  inset:0;
  width:100%;
  pointer-events:none;
  appearance:none;
  background:transparent;
}
.range-stack input::-webkit-slider-thumb{
  width:22px;
  height:34px;
  appearance:none;
  border:2px solid white;
  border-radius:7px;
  background:#7c3aed;
  cursor:ew-resize;
  pointer-events:auto;
}
.range-stack input::-moz-range-thumb{
  width:22px;
  height:34px;
  border:2px solid white;
  border-radius:7px;
  background:#7c3aed;
  cursor:ew-resize;
  pointer-events:auto;
}
.trim-times{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
}
.trim-times label{
  display:grid;
  gap:5px;
  color:var(--muted);
  font-size:12px;
}
.trim-times input{
  padding:10px;
  border:1px solid #263249;
  border-radius:10px;
  background:#111a29;
  color:white;
  text-align:center;
}
.trim-invalid{color:#ef4444}
.cover-picker-panel input{width:100%;margin:12px 0}
.cover-picker-panel canvas{
  display:block;
  width:min(190px,100%);
  aspect-ratio:9/16;
  margin:auto;
  border-radius:12px;
  background:#000;
}
.processing-box{
  padding:14px;
  border:1px solid #33415b;
  border-radius:14px;
  background:#0e1726;
}
.processing-box progress{
  width:100%;
  height:12px;
  margin:10px 0;
}
@media(max-width:900px){
  .clip-editor-body{
    grid-template-columns:1fr;
    padding:12px;
  }
  .clip-editor-preview{
    grid-template-columns:1fr;
  }
  .phone-preview{
    width:min(100%,320px);
    max-height:55dvh;
  }
  .editor-quick-tools{
    grid-template-columns:repeat(4,1fr);
  }
  .editor-quick-tools button{
    width:100%;
    min-height:54px;
  }
}
@media(max-width:520px){
  .clip-editor-header{padding:9px 10px}
  .clip-editor-header h2{font-size:17px}
  .clip-editor-body{gap:14px}
  .phone-preview{
    width:min(100%,260px);
    max-height:47dvh;
  }
  .thumbnail-timeline{height:76px}
  .trim-times{grid-template-columns:1fr 1fr}
}


/* ============================================================
   SOCIALGO FASE 8.5B — TEXTO EDITABLE Y CARGA SEGURA
   ============================================================ */
.text-style-grid{
  display:grid;
  grid-template-columns:1fr 1fr 2fr;
  gap:10px;
  margin-top:10px;
}
.text-style-grid label{
  display:grid;
  gap:6px;
  color:var(--muted);
  font-size:12px;
}
.text-style-grid input,
.text-style-grid select{
  width:100%;
  min-height:40px;
  padding:7px;
  border:1px solid var(--border);
  border-radius:9px;
  background:var(--surface-2);
  color:white;
}
.clip-text-overlay{
  left:50%;
  top:48%;
  right:auto;
  width:max-content;
  max-width:82%;
  transform:translate(-50%,-50%);
  touch-action:none;
  pointer-events:auto;
  cursor:move;
  user-select:none;
}
.clip-text-overlay.bg-dark,
.published-clip-text.bg-dark{
  background:rgba(0,0,0,.68)
}
.clip-text-overlay.bg-light,
.published-clip-text.bg-light{
  background:rgba(255,255,255,.88);
  color:#111!important
}
.clip-text-overlay.bg-transparent,
.published-clip-text.bg-transparent{
  background:transparent;
  text-shadow:0 2px 8px #000,0 0 3px #000
}
.clip-text-overlay.bg-purple,
.published-clip-text.bg-purple{
  background:rgba(124,58,237,.82)
}
.clip-text-overlay.bg-pink,
.published-clip-text.bg-pink{
  background:rgba(236,72,153,.82)
}
.published-clip-text{
  position:absolute;
  z-index:5;
  max-width:82%;
  padding:8px 12px;
  border-radius:9px;
  transform:translate(-50%,-50%);
  text-align:center;
  font-weight:800;
  line-height:1.15;
  text-shadow:0 2px 7px rgba(0,0,0,.7);
  pointer-events:none
}
@media(max-width:600px){
  .text-style-grid{grid-template-columns:1fr 1fr}
  .text-style-grid label:last-child{grid-column:1/-1}
}


/* FASE 8.5C — imágenes de perfil y portada en burbujas */
.avatar img,
.avatar-link img,
.sidebar-profile .avatar img,
.story span img{
  width:100%;
  height:100%;
  display:block;
  object-fit:cover;
  border-radius:50%;
}


/* FASE 8.5D — botón visible para foto de perfil */
.avatar-action-visible{
  position:absolute;
  left:22px;
  bottom:-58px;
  width:auto;
  min-width:190px;
  height:44px;
  padding:0 16px;
  border:1px solid var(--border);
  border-radius:12px;
  background:linear-gradient(135deg,#2563eb,#7c3aed);
  color:white;
  font-weight:800;
  box-shadow:0 10px 28px rgba(37,99,235,.28);
  white-space:nowrap;
}
.profile-image-help{
  margin:72px 0 18px;
  padding:12px 14px;
  border:1px solid var(--border);
  border-radius:12px;
  background:var(--surface-2);
  color:var(--muted);
}
@media(max-width:600px){
  .avatar-action-visible{
    left:12px;
    bottom:-56px;
    min-width:170px;
    font-size:13px;
  }
  .profile-image-help{
    margin-top:68px;
  }
}


/* ============================================================
   SOCIALGO FASE 8.5E — PERFIL Y TRES PANELES INDEPENDIENTES
   ============================================================ */

/* Perfil */
.profile-media-block{
  position:relative;
  margin-bottom:22px;
}
.profile-media-block .profile-cover{
  height:230px;
  margin-bottom:0;
  overflow:hidden;
  border-radius:18px;
}
.profile-avatar-row{
  display:grid;
  grid-template-columns:auto 1fr;
  gap:18px;
  align-items:center;
  padding:0 24px;
  margin-top:-48px;
  position:relative;
  z-index:4;
}
.profile-avatar-row .profile-avatar-large{
  position:static;
  width:112px;
  height:112px;
  flex:none;
  border:5px solid var(--surface);
  box-shadow:0 12px 34px rgba(0,0,0,.35);
}
.profile-avatar-controls{
  display:flex;
  align-items:center;
  gap:14px;
  flex-wrap:wrap;
  padding-top:48px;
}
.profile-avatar-controls small{
  color:var(--muted);
  line-height:1.4;
}
.avatar-upload-button{
  min-width:210px;
  white-space:nowrap;
}
.profile-image-help{
  display:none!important;
}
.avatar-action-visible{
  display:none!important;
}

/* Tres columnas independientes */
@media(min-width:1101px){
  html,body{
    height:100%;
    overflow:hidden;
  }

  #appShell{
    height:100dvh;
    max-width:none;
    width:100%;
    margin:0;
    padding:14px;
    display:grid;
    grid-template-columns:240px minmax(520px,1fr) 320px;
    gap:16px;
    transition:grid-template-columns .25s ease;
  }

  #appShell.left-collapsed{
    grid-template-columns:72px minmax(520px,1fr) 320px;
  }

  #appShell.right-collapsed{
    grid-template-columns:240px minmax(520px,1fr) 64px;
  }

  #appShell.left-collapsed.right-collapsed{
    grid-template-columns:72px minmax(520px,1fr) 64px;
  }

  .sidebar,
  .main,
  .rightbar{
    height:calc(100dvh - 28px);
    min-height:0;
    overflow-y:auto;
    overflow-x:hidden;
    scrollbar-width:thin;
    scrollbar-color:#394964 transparent;
  }

  .sidebar,
  .rightbar{
    position:relative;
    top:auto;
    align-self:stretch;
    overscroll-behavior:contain;
  }

  .main{
    padding:0 4px 100px;
    overscroll-behavior:contain;
  }

  .topbar{
    top:0;
    z-index:30;
  }

  .sidebar-collapse-button{
    position:sticky;
    top:0;
    z-index:60;
    display:grid;
    place-items:center;
    width:36px;
    height:36px;
    margin-bottom:10px;
    border:1px solid var(--border);
    border-radius:10px;
    background:rgba(15,27,45,.96);
    color:white;
    font-size:22px;
    box-shadow:0 8px 20px rgba(0,0,0,.22);
  }

  .sidebar-collapse-left{
    margin-left:auto;
  }

  .sidebar-collapse-right{
    margin-right:auto;
  }

  #appShell.left-collapsed .sidebar{
    padding:14px 10px;
  }

  #appShell.left-collapsed .sidebar .brand span:last-child,
  #appShell.left-collapsed .sidebar .side-nav span,
  #appShell.left-collapsed .sidebar .primary.wide,
  #appShell.left-collapsed .sidebar .sidebar-account span:not(.avatar),
  #appShell.left-collapsed .sidebar .sidebar-account b,
  #appShell.left-collapsed .sidebar .premium-card,
  #appShell.left-collapsed .sidebar .sidebar-footer{
    display:none!important;
  }

  #appShell.left-collapsed .sidebar .brand{
    justify-content:center;
    padding:0;
  }

  #appShell.left-collapsed .sidebar .side-nav a{
    justify-content:center;
    padding:12px 8px;
    font-size:20px;
  }

  #appShell.left-collapsed .sidebar .sidebar-profile{
    display:flex;
    justify-content:center;
    padding:6px;
  }

  #appShell.right-collapsed .rightbar{
    padding:12px 8px;
  }

  #appShell.right-collapsed .rightbar .panel{
    display:none;
  }

  #appShell.right-collapsed .sidebar-collapse-right{
    margin:auto;
  }

  .sidebar::-webkit-scrollbar,
  .main::-webkit-scrollbar,
  .rightbar::-webkit-scrollbar{
    width:8px;
  }

  .sidebar::-webkit-scrollbar-thumb,
  .main::-webkit-scrollbar-thumb,
  .rightbar::-webkit-scrollbar-thumb{
    background:#394964;
    border-radius:999px;
  }
}

@media(max-width:1100px){
  .sidebar-collapse-button{
    display:none;
  }
}

@media(max-width:760px){
  .profile-media-block .profile-cover{
    height:180px;
  }

  .profile-avatar-row{
    grid-template-columns:1fr;
    padding:0 12px;
    margin-top:-42px;
    gap:8px;
  }

  .profile-avatar-row .profile-avatar-large{
    width:96px;
    height:96px;
  }

  .profile-avatar-controls{
    padding-top:0;
    display:grid;
    gap:8px;
  }

  .avatar-upload-button{
    width:100%;
    min-width:0;
  }
}
