/* ══════════════════════════════════════
   TYPACK SINDICATO N°1 — FORUM STYLES
   ══════════════════════════════════════ */

/* — Tokens — */
:root {
  --bg:          #f0f2f5;
  --surface:     #ffffff;
  --surface2:    #f8f9fb;
  --border:      #e2e6ed;
  --text-primary:#1a2130;
  --text-secondary:#5c6778;
  --text-muted:  #8f9aaa;

  --accent-blue: #1b4f8a;
  --accent-green:#1a7a4a;
  --accent-red:  #c0392b;
  --accent-gold: #b8860b;

  --blue-light:  #e8f0fb;
  --green-light: #e6f4ed;
  --red-light:   #fdecea;
  --gold-light:  #fdf6e3;

  --primary:     #1b4f8a;
  --primary-hover:#153d6f;

  --radius-sm:   6px;
  --radius:      12px;
  --radius-lg:   18px;

  --shadow-xs: 0 1px 3px rgba(0,0,0,.07);
  --shadow-sm: 0 2px 8px rgba(0,0,0,.08);
  --shadow-md: 0 4px 20px rgba(0,0,0,.12);
  --shadow-lg: 0 8px 40px rgba(0,0,0,.16);

  --topbar-h: 108px;
  --nav-h:    44px;
}

/* — Reset — */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.55;
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
input, select, textarea { font-family: inherit; }

/* ══════════════ TOP BAR ══════════════ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 32px;
  max-width: 1280px;
  margin: 0 auto;
}

/* Logo */
.logo-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  transition: opacity .2s;
}
.logo-wrap:hover { opacity: .85; }
.logo-img {
  height: 54px;
  width: auto;
  object-fit: contain;
  border-radius: 4px;
}
.logo-text {
  display: flex;
  flex-direction: column;
}
.logo-title {
  font-size: .9rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: .06em;
  line-height: 1.2;
}
.logo-sub {
  font-size: .68rem;
  color: var(--text-secondary);
  letter-spacing: .03em;
}

/* Search */
.search-wrap {
  flex: 1;
  max-width: 480px;
  position: relative;
  display: flex;
  align-items: center;
}
.search-icon {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}
.search-input {
  width: 100%;
  height: 40px;
  padding: 0 16px 0 38px;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  background: var(--surface2);
  font-size: .88rem;
  color: var(--text-primary);
  transition: border-color .2s, box-shadow .2s;
  outline: none;
}
.search-input::placeholder { color: var(--text-muted); }
.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(27,79,138,.12);
  background: var(--surface);
}

/* Right controls */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}

.icon-btn {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: background .2s, color .2s;
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:hover { background: var(--bg); color: var(--primary); }

.badge {
  position: absolute;
  top: 2px; right: 2px;
  width: 16px; height: 16px;
  background: #e53e3e;
  color: #fff;
  font-size: .62rem;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--surface);
}

/* ── Message badge (green, on the mail icon) ── */
@keyframes badge-pop {
  0%   { transform: scale(0.5); opacity: 0; }
  60%  { transform: scale(1.25); }
  100% { transform: scale(1);   opacity: 1; }
}
@keyframes badge-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34,197,94,.55); }
  50%       { box-shadow: 0 0 0 5px rgba(34,197,94,0); }
}

.badge-msg {
  background: #16a34a;
  animation: badge-pop .35s cubic-bezier(.34,1.56,.64,1) both,
             badge-pulse 2s ease-in-out 0.4s infinite;
  min-width: 16px;
  width: auto;
  padding: 0 4px;
  font-size: .6rem;
}

/* Mail button glows blue when there are unread messages */
.btn-has-msgs {
  color: var(--primary) !important;
  animation: mail-glow 2.5s ease-in-out infinite;
}
@keyframes mail-glow {
  0%, 100% { filter: drop-shadow(0 0 0px rgba(27,79,138,0)); }
  50%       { filter: drop-shadow(0 0 6px rgba(27,79,138,.6)); }
}

/* Bell shake */
@keyframes bell-shake {
  0%, 100% { transform: rotate(0deg); }
  10%       { transform: rotate(-12deg); }
  20%       { transform: rotate(12deg); }
  30%       { transform: rotate(-10deg); }
  40%       { transform: rotate(10deg); }
  50%       { transform: rotate(-6deg); }
  60%       { transform: rotate(6deg); }
  70%       { transform: rotate(-3deg); }
  80%       { transform: rotate(3deg); }
  90%       { transform: rotate(0deg); }
}
#btn-notif.has-unread {
  animation: bell-shake 1s ease-in-out;
  color: var(--primary);
}
#btn-notif.has-unread svg {
  transform-origin: 50% 0%;
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px 5px 5px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: background .2s, border-color .2s;
  position: relative;
}
.user-chip:hover { background: var(--surface2); border-color: var(--primary); }

.avatar-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1b4f8a, #2d7dd2);
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-info {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.user-name { font-size: .82rem; font-weight: 600; color: var(--text-primary); }
.user-role { font-size: .68rem; color: var(--text-secondary); }

.online-dot {
  width: 8px; height: 8px;
  background: #22c55e;
  border-radius: 50%;
  border: 2px solid var(--surface);
  position: absolute;
  bottom: 5px; left: 32px;
}

/* Nav */
.main-nav {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 32px;
  max-width: 1280px;
  margin: 0 auto;
  border-top: 1px solid var(--border);
}

.nav-link {
  padding: 11px 20px;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .07em;
  color: var(--text-secondary);
  border-bottom: 2.5px solid transparent;
  transition: color .2s, border-color .2s;
}
.nav-link:hover { color: var(--primary); }
.nav-link.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ══════════════ MAIN ══════════════ */
.main-content {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 32px 64px;
  display: flex;
  flex-direction: column;
  gap: 36px;
}

/* Page header */
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}
.page-title {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -.02em;
}
.page-subtitle {
  font-size: .88rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Primary button */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius);
  font-size: .88rem;
  font-weight: 600;
  transition: background .2s, transform .15s, box-shadow .2s;
  box-shadow: 0 3px 12px rgba(27,79,138,.3);
}
.btn-primary svg { width: 16px; height: 16px; }
.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(27,79,138,.4);
}
.btn-primary:active { transform: translateY(0); }

/* ══════════════ SECTION TITLE ══════════════ */
.section-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
  letter-spacing: -.01em;
}

/* ══════════════ CATEGORY CARDS ══════════════ */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.cat-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: transform .2s, box-shadow .2s, border-color .2s;
  position: relative;
  overflow: hidden;
}
.cat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.cat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.accent-blue { border-top-color: var(--accent-blue); }
.accent-blue::before { background: var(--accent-blue); }
.accent-blue .cat-icon { background: var(--blue-light); color: var(--accent-blue); }

.accent-green { border-top-color: var(--accent-green); }
.accent-green::before { background: var(--accent-green); }
.accent-green .cat-icon { background: var(--green-light); color: var(--accent-green); }

.accent-red { border-top-color: var(--accent-red); }
.accent-red::before { background: var(--accent-red); }
.accent-red .cat-icon { background: var(--red-light); color: var(--accent-red); }

.accent-gold { border-top-color: var(--accent-gold); }
.accent-gold::before { background: var(--accent-gold); }
.accent-gold .cat-icon { background: var(--gold-light); color: var(--accent-gold); }

.cat-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}
.cat-icon svg { width: 22px; height: 22px; }

.cat-name {
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--text-primary);
  line-height: 1.3;
}

.cat-count {
  font-size: .82rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.cat-last {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.mini-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1b4f8a, #2d7dd2);
  color: #fff;
  font-size: .6rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cat-ago {
  display: block;
  font-size: .68rem;
  color: var(--text-muted);
  line-height: 1.2;
}
.cat-author {
  display: block;
  font-size: .76rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

/* ══════════════ THREAD LIST ══════════════ */
.threads-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}

.thread-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .18s;
  outline: none;
}
.thread-row:last-child { border-bottom: none; }
.thread-row:hover { background: var(--surface2); }
.thread-row:focus-visible { box-shadow: inset 0 0 0 2px var(--primary); }

/* Avatar */
.thread-avatar-wrap { flex-shrink: 0; }
.thread-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .78rem;
  font-weight: 700;
  color: #fff;
}
.color-a { background: linear-gradient(135deg,#1b4f8a,#2d7dd2); }
.color-b { background: linear-gradient(135deg,#1a7a4a,#27ae60); }
.color-c { background: linear-gradient(135deg,#c0392b,#e74c3c); }
.color-d { background: linear-gradient(135deg,#b8860b,#f39c12); }

/* Thread info */
.thread-info { flex: 1; min-width: 0; }
.thread-title {
  font-size: .95rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 5px;
  transition: color .15s;
}
.thread-row:hover .thread-title { color: var(--primary); }
.thread-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}
.thread-author {
  font-size: .8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Tags */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: .67rem;
  font-weight: 700;
  letter-spacing: .05em;
}
.tag-blue   { background: var(--blue-light);  color: var(--accent-blue); }
.tag-green  { background: var(--green-light); color: var(--accent-green); }
.tag-red    { background: var(--red-light);   color: var(--accent-red); }
.tag-gold   { background: var(--gold-light);  color: var(--accent-gold); }

/* Thread stats */
.thread-stats {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.participant-stack {
  display: flex;
  align-items: center;
}
.pav {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: .6rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--surface);
  margin-left: -6px;
}
.pav:first-child { margin-left: 0; }

.thread-replies {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}
.thread-time {
  font-size: .78rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Load more */
.btn-load-more {
  display: block;
  width: 100%;
  margin-top: 16px;
  padding: 13px;
  background: var(--surface);
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  font-size: .86rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: background .2s, color .2s, border-color .2s;
}
.btn-load-more:hover {
  background: var(--blue-light);
  color: var(--primary);
  border-color: var(--accent-blue);
}

/* ══════════════ MODAL ══════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
  padding: 24px;
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 540px;
  box-shadow: var(--shadow-lg);
  transform: translateY(16px) scale(.97);
  transition: transform .25s;
  overflow: hidden;
}
.modal-overlay.open .modal-box {
  transform: translateY(0) scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
}
.modal-close {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .9rem;
  color: var(--text-secondary);
  transition: background .2s, color .2s;
}
.modal-close:hover { background: var(--bg); color: var(--accent-red); }

.modal-form {
  padding: 20px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.modal-form label {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: -6px;
}
.modal-form select,
.modal-form input[type="text"],
.modal-form textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface2);
  font-size: .9rem;
  color: var(--text-primary);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  resize: vertical;
}
.modal-form select:focus,
.modal-form input[type="text"]:focus,
.modal-form textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(27,79,138,.12);
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 6px;
}

.btn-secondary {
  padding: 10px 20px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: .88rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  transition: background .2s, border-color .2s;
}
.btn-secondary:hover { background: var(--bg); border-color: var(--text-muted); }

/* ══════════════ TOAST ══════════════ */
.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  background: var(--surface);
  border: 1.5px solid #bbf7d0;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  font-size: .88rem;
  font-weight: 500;
  color: var(--text-primary);
  z-index: 300;
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
  transition: opacity .3s, transform .3s;
}
.toast svg { width: 18px; height: 18px; flex-shrink: 0; }
.toast.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

/* ══════════════ RESPONSIVE ══════════════ */
@media (max-width: 1024px) {
  .categories-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .topbar-inner { padding: 10px 16px; gap: 12px; }
  .main-nav { padding: 0 16px; }
  .main-content { padding: 20px 16px 40px; }
  .logo-sub { display: none; }
  .search-wrap { max-width: none; }
  .user-info { display: none; }
  .categories-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .thread-stats { flex-direction: column; align-items: flex-end; gap: 4px; }
  .participant-stack { display: none; }
}

@media (max-width: 520px) {
  .categories-grid { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; }
}

/* ══════════════════════════════════════════
   NOTIFICATION PANEL
   ══════════════════════════════════════════ */
.notif-panel {
  position: fixed;
  top: 0; right: -400px;
  width: 380px;
  height: 100vh;
  background: var(--surface);
  border-left: 1.5px solid var(--border);
  box-shadow: var(--shadow-lg);
  z-index: 500;
  display: flex;
  flex-direction: column;
  transition: right .3s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
}
.notif-panel.open { right: 0; }
.notif-backdrop {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.35);
  backdrop-filter: blur(2px);
  z-index: 499;
  opacity: 0; pointer-events: none;
  transition: opacity .3s;
}
.notif-backdrop.open { opacity: 1; pointer-events: all; }
.notif-panel-header {
  display: flex; align-items: center; gap: 8px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.notif-panel-title { font-size: 1rem; font-weight: 700; color: var(--text-primary); flex: 1; }
.notif-mark-all {
  font-size: .72rem; font-weight: 600; color: var(--primary);
  padding: 4px 10px; border-radius: var(--radius-sm); transition: background .2s;
}
.notif-mark-all:hover { background: var(--blue-light); }
.notif-panel-close {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem; color: var(--text-secondary); transition: background .2s, color .2s;
}
.notif-panel-close:hover { background: var(--bg); color: var(--accent-red); }
.notif-list { flex: 1; overflow-y: auto; padding: 8px 0; }
.notif-list::-webkit-scrollbar { width: 4px; }
.notif-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.notif-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 20px; cursor: pointer; transition: background .15s;
  position: relative; border-bottom: 1px solid var(--border);
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--surface2); }
.notif-item.unread { background: #f0f5ff; }
.notif-item.unread:hover { background: #e8f0fb; }
.notif-icon {
  width: 36px; height: 36px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.notif-icon svg { width: 18px; height: 18px; }
.notif-type-reply        { background: var(--blue-light);  color: var(--accent-blue); }
.notif-type-mention      { background: var(--gold-light);  color: var(--accent-gold); }
.notif-type-thread       { background: var(--green-light); color: var(--accent-green); }
.notif-type-announcement { background: var(--red-light);   color: var(--accent-red); }
.notif-content { flex: 1; min-width: 0; }
.notif-text { font-size: .83rem; font-weight: 500; color: var(--text-primary); line-height: 1.4; margin-bottom: 3px; }
.notif-item.unread .notif-text { font-weight: 600; }
.notif-time { font-size: .72rem; color: var(--text-muted); }
.notif-dot { width: 8px; height: 8px; background: var(--primary); border-radius: 50%; flex-shrink: 0; margin-top: 4px; }

/* ══════════════════════════════════════════
   MEMBERS PAGE
   ══════════════════════════════════════════ */
.members-filter-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.members-search-wrap { flex: 1; min-width: 240px; position: relative; display: flex; align-items: center; }
.members-search-wrap .search-icon { position: absolute; left: 12px; width: 15px; height: 15px; color: var(--text-muted); }
.members-search {
  width: 100%; height: 40px; padding: 0 14px 0 36px;
  border: 1.5px solid var(--border); border-radius: 999px;
  background: var(--surface); font-size: .88rem; color: var(--text-primary);
  outline: none; transition: border-color .2s, box-shadow .2s;
}
.members-search:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(27,79,138,.1); }
.filter-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
  padding: 6px 14px; border-radius: 999px; font-size: .78rem; font-weight: 600;
  border: 1.5px solid var(--border); color: var(--text-secondary); background: var(--surface);
  cursor: pointer; transition: all .2s;
}
.pill:hover, .pill.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.members-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.member-card {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius-lg); padding: 28px 20px 20px;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 8px; cursor: pointer; transition: transform .22s, box-shadow .22s, border-color .22s;
  position: relative; overflow: hidden;
}
.member-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--primary); }
.member-avatar {
  width: 64px; height: 64px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.15rem; font-weight: 800; color: #fff; position: relative; margin-bottom: 4px;
}
.member-online-badge {
  position: absolute; bottom: 2px; right: 2px;
  width: 14px; height: 14px; border-radius: 50%; background: #22c55e; border: 2.5px solid var(--surface);
}
.member-online-badge.offline { background: var(--text-muted); }
.member-name { font-size: 1rem; font-weight: 700; color: var(--text-primary); letter-spacing: -.01em; }
.member-role { font-size: .78rem; color: var(--text-secondary); font-weight: 500; line-height: 1.3; }
.member-dept { font-size: .73rem; color: var(--text-muted); font-weight: 500; }
.member-company-badge { display: inline-flex; padding: 2px 10px; border-radius: 999px; font-size: .68rem; font-weight: 700; letter-spacing: .04em; margin-top: 2px; }
.badge-typack  { background: var(--blue-light);  color: var(--accent-blue); }
.badge-laminsa { background: var(--green-light); color: var(--accent-green); }
.badge-recipet { background: var(--gold-light);  color: var(--accent-gold); }
.member-stats { display: flex; gap: 20px; margin-top: 10px; padding-top: 14px; border-top: 1px solid var(--border); width: 100%; justify-content: center; }
.member-stat { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.member-stat-val { font-size: .98rem; font-weight: 700; color: var(--text-primary); }
.member-stat-lbl { font-size: .66rem; color: var(--text-muted); font-weight: 500; letter-spacing: .03em; }

/* ══════════════════════════════════════════
   PROFILE PAGE
   ══════════════════════════════════════════ */
.profile-back { display: inline-flex; align-items: center; gap: 6px; font-size: .84rem; font-weight: 600; color: var(--text-secondary); padding: 6px 0; cursor: pointer; transition: color .2s; border: none; background: none; }
.profile-back:hover { color: var(--primary); }
.profile-back svg { width: 16px; height: 16px; }
.profile-hero { background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm); }
.profile-hero-banner { height: 140px; background: linear-gradient(135deg, #1b4f8a 0%, #2d7dd2 50%, #1a7a4a 100%); position: relative; }
.profile-hero-body { padding: 0 32px 28px; display: flex; align-items: flex-end; gap: 24px; position: relative; flex-wrap: wrap; }
.profile-avatar-lg {
  width: 96px; height: 96px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; font-weight: 800; color: #fff;
  border: 4px solid var(--surface); flex-shrink: 0; margin-top: -48px; position: relative; z-index: 1;
}
.profile-online-lg { position: absolute; bottom: 4px; right: 4px; width: 18px; height: 18px; border-radius: 50%; background: #22c55e; border: 3px solid var(--surface); }
.profile-hero-info { flex: 1; padding-top: 16px; min-width: 0; }
.profile-hero-name { font-size: 1.4rem; font-weight: 800; color: var(--text-primary); letter-spacing: -.02em; }
.profile-hero-role { font-size: .9rem; color: var(--text-secondary); font-weight: 500; margin-top: 2px; }
.profile-hero-actions { display: flex; gap: 10px; align-items: center; padding-top: 24px; flex-shrink: 0; }
.btn-outline { display: inline-flex; align-items: center; gap: 7px; padding: 9px 18px; border: 1.5px solid var(--border); border-radius: var(--radius); font-size: .86rem; font-weight: 600; color: var(--text-secondary); background: transparent; transition: all .2s; }
.btn-outline svg { width: 15px; height: 15px; }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--blue-light); }
.profile-stats-bar { display: flex; gap: 0; border-top: 1px solid var(--border); }
.profile-stat-item { flex: 1; padding: 18px 20px; display: flex; flex-direction: column; align-items: center; gap: 2px; border-right: 1px solid var(--border); }
.profile-stat-item:last-child { border-right: none; }
.profile-stat-num { font-size: 1.3rem; font-weight: 800; color: var(--text-primary); }
.profile-stat-lbl { font-size: .72rem; color: var(--text-muted); font-weight: 500; letter-spacing: .03em; }
.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.profile-card { background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius-lg); padding: 22px 24px; box-shadow: var(--shadow-xs); }
.profile-card-title { font-size: .85rem; font-weight: 700; color: var(--text-secondary); letter-spacing: .05em; text-transform: uppercase; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.profile-card-title svg { width: 15px; height: 15px; }
.info-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.info-row:last-child { border-bottom: none; }
.info-row-icon { width: 32px; height: 32px; border-radius: var(--radius-sm); background: var(--bg); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.info-row-icon svg { width: 15px; height: 15px; color: var(--primary); }
.info-row-lbl { font-size: .72rem; color: var(--text-muted); font-weight: 500; margin-bottom: 1px; }
.info-row-val { font-size: .88rem; color: var(--text-primary); font-weight: 500; }
.activity-thread-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); cursor: pointer; transition: opacity .15s; }
.activity-thread-row:last-child { border-bottom: none; }
.activity-thread-row:hover { opacity: .7; }
.activity-thread-title { font-size: .86rem; font-weight: 600; color: var(--text-primary); flex: 1; }
.activity-thread-time  { font-size: .72rem; color: var(--text-muted); white-space: nowrap; }
.profile-bio { font-size: .88rem; color: var(--text-secondary); line-height: 1.6; padding: 4px 0; }

/* ══════════════════════════════════════════
   MESSAGES PAGE
   ══════════════════════════════════════════ */
.messages-layout { display: flex; background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm); height: calc(100vh - 200px); min-height: 520px; }
.conv-sidebar { width: 300px; flex-shrink: 0; border-right: 1.5px solid var(--border); display: flex; flex-direction: column; }
.conv-sidebar-header { padding: 18px 16px 12px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.conv-sidebar-title { font-size: 1rem; font-weight: 700; color: var(--text-primary); margin-bottom: 10px; }
.conv-search-wrap { position: relative; }
.conv-search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; color: var(--text-muted); }
.conv-search { width: 100%; height: 36px; padding: 0 12px 0 32px; border: 1.5px solid var(--border); border-radius: 999px; font-size: .82rem; background: var(--surface2); color: var(--text-primary); outline: none; transition: border-color .2s; }
.conv-search:focus { border-color: var(--primary); }
.conv-list { flex: 1; overflow-y: auto; }
.conv-list::-webkit-scrollbar { width: 4px; }
.conv-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.conv-item { display: flex; align-items: center; gap: 12px; padding: 14px 16px; cursor: pointer; border-bottom: 1px solid var(--border); transition: background .15s; position: relative; }
.conv-item:last-child { border-bottom: none; }
.conv-item:hover { background: var(--surface2); }
.conv-item.active { background: var(--blue-light); }
.conv-avatar { width: 42px; height: 42px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 700; color: #fff; flex-shrink: 0; position: relative; }
.conv-online { position: absolute; bottom: 1px; right: 1px; width: 10px; height: 10px; border-radius: 50%; background: #22c55e; border: 2px solid var(--surface); }
.conv-item-info { flex: 1; min-width: 0; }
.conv-item-name { font-size: .88rem; font-weight: 600; color: var(--text-primary); }
.conv-item-preview { font-size: .78rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.conv-item-time { font-size: .7rem; color: var(--text-muted); flex-shrink: 0; }
.conv-unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); position: absolute; top: 14px; right: 14px; }
.conv-sidebar-footer { padding: 12px 16px; border-top: 1px solid var(--border); flex-shrink: 0; }
.btn-new-conv { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 10px; border-radius: var(--radius); border: 1.5px dashed var(--border); font-size: .84rem; font-weight: 600; color: var(--text-secondary); transition: all .2s; }
.btn-new-conv svg { width: 15px; height: 15px; }
.btn-new-conv:hover { border-color: var(--primary); color: var(--primary); background: var(--blue-light); }
.conv-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.conv-main-header { display: flex; align-items: center; gap: 14px; padding: 16px 24px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.conv-main-avatar { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .78rem; font-weight: 700; color: #fff; flex-shrink: 0; }
.conv-main-name { font-size: .95rem; font-weight: 700; color: var(--text-primary); }
.conv-main-role { font-size: .75rem; color: var(--text-secondary); }
.conv-main-status { display: flex; align-items: center; gap: 5px; font-size: .72rem; color: #22c55e; font-weight: 600; }
.conv-main-status .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.conv-messages { flex: 1; overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.conv-messages::-webkit-scrollbar { width: 4px; }
.conv-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.msg-group { display: flex; gap: 10px; align-items: flex-end; max-width: 70%; }
.msg-group.mine { align-self: flex-end; flex-direction: row-reverse; }
.msg-avatar { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .62rem; font-weight: 700; color: #fff; flex-shrink: 0; }
.msg-bubbles { display: flex; flex-direction: column; gap: 4px; }
.msg-bubble { padding: 10px 14px; border-radius: 18px; font-size: .88rem; line-height: 1.45; max-width: 360px; word-break: break-word; }
.msg-group:not(.mine) .msg-bubble { background: var(--surface2); color: var(--text-primary); border-bottom-left-radius: 4px; }
.msg-group.mine .msg-bubble { background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.msg-time { font-size: .68rem; color: var(--text-muted); padding: 0 4px; }
.msg-group.mine .msg-time { text-align: right; }
.conv-input-area { padding: 16px 24px; border-top: 1px solid var(--border); flex-shrink: 0; display: flex; gap: 10px; align-items: flex-end; }
.conv-input { flex: 1; padding: 11px 16px; border: 1.5px solid var(--border); border-radius: var(--radius-lg); font-size: .9rem; color: var(--text-primary); outline: none; resize: none; line-height: 1.4; max-height: 120px; transition: border-color .2s, box-shadow .2s; background: var(--surface2); font-family: inherit; }
.conv-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(27,79,138,.1); background: var(--surface); }
.conv-send-btn { width: 42px; height: 42px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: background .2s, transform .15s; box-shadow: 0 2px 8px rgba(27,79,138,.3); }
.conv-send-btn svg { width: 18px; height: 18px; }
.conv-send-btn:hover { background: var(--primary-hover); transform: scale(1.05); }
.conv-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--text-muted); }
.conv-empty svg { width: 48px; height: 48px; opacity: .35; }
.conv-empty p { font-size: .9rem; font-weight: 500; }
.new-conv-search { width: 100%; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); background: var(--surface2); font-size: .9rem; outline: none; transition: border-color .2s; margin-bottom: 12px; font-family: inherit; }
.new-conv-search:focus { border-color: var(--primary); }
.member-picker-list { max-height: 280px; overflow-y: auto; }
.member-picker-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm); cursor: pointer; transition: background .15s; }
.member-picker-item:hover { background: var(--blue-light); }
.picker-avatar { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .72rem; font-weight: 700; color: #fff; flex-shrink: 0; }
.picker-name { font-size: .88rem; font-weight: 600; color: var(--text-primary); }
.picker-role { font-size: .74rem; color: var(--text-muted); }

/* ══════════════════════════════════════════
   THREAD DETAIL PAGE
   ══════════════════════════════════════════ */
.thread-detail-header { background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius-lg); padding: 28px 32px; box-shadow: var(--shadow-xs); }
.thread-detail-top { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.thread-back { display: inline-flex; align-items: center; gap: 5px; font-size: .82rem; font-weight: 600; color: var(--text-secondary); cursor: pointer; transition: color .2s; border: none; background: none; margin-right: 4px; }
.thread-back:hover { color: var(--primary); }
.thread-back svg { width: 15px; height: 15px; }
.thread-detail-title { font-size: 1.5rem; font-weight: 800; color: var(--text-primary); letter-spacing: -.02em; line-height: 1.3; margin-bottom: 14px; }
.thread-detail-meta { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.thread-detail-author { display: flex; align-items: center; gap: 8px; }
.thread-detail-author-name { font-size: .88rem; font-weight: 600; color: var(--text-primary); }
.thread-detail-time { font-size: .8rem; color: var(--text-muted); }
.thread-detail-count { font-size: .8rem; color: var(--text-muted); display: flex; align-items: center; gap: 4px; }
.thread-detail-count svg { width: 14px; height: 14px; }
.thread-original-post { background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius-lg); padding: 24px 32px; box-shadow: var(--shadow-xs); }
.thread-op-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.thread-op-avatar { width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .82rem; font-weight: 700; color: #fff; flex-shrink: 0; }
.thread-op-name { font-size: .95rem; font-weight: 700; color: var(--text-primary); }
.thread-op-role { font-size: .75rem; color: var(--text-secondary); }
.thread-op-time { font-size: .75rem; color: var(--text-muted); margin-left: auto; }
.thread-op-content { font-size: .92rem; color: var(--text-primary); line-height: 1.7; white-space: pre-line; }
.responses-section-title { font-size: 1rem; font-weight: 700; color: var(--text-primary); display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.responses-count-badge { background: var(--blue-light); color: var(--accent-blue); font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.response-list { display: flex; flex-direction: column; gap: 0; }
.response-card { background: var(--surface); border: 1.5px solid var(--border); border-bottom: none; padding: 20px 28px; transition: background .15s; }
.response-card:first-child { border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.response-card:last-child { border-bottom: 1.5px solid var(--border); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.response-card:only-child { border-radius: var(--radius-lg); border-bottom: 1.5px solid var(--border); }
.response-card:hover { background: var(--surface2); }
.response-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.response-avatar { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .72rem; font-weight: 700; color: #fff; flex-shrink: 0; }
.response-author { font-size: .88rem; font-weight: 700; color: var(--text-primary); }
.response-role   { font-size: .72rem; color: var(--text-muted); }
.response-time   { font-size: .72rem; color: var(--text-muted); margin-left: auto; }
.response-body   { font-size: .9rem; color: var(--text-primary); line-height: 1.65; padding-left: 46px; }
.response-actions { display: flex; gap: 12px; padding-left: 46px; margin-top: 10px; }
.resp-action-btn { display: flex; align-items: center; gap: 5px; font-size: .75rem; font-weight: 600; color: var(--text-muted); padding: 4px 10px; border-radius: 999px; transition: all .2s; }
.resp-action-btn svg { width: 13px; height: 13px; }
.resp-action-btn:hover { background: var(--blue-light); color: var(--primary); }
.reply-form-card { background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius-lg); padding: 24px 28px; box-shadow: var(--shadow-xs); }
.reply-form-title { font-size: .9rem; font-weight: 700; color: var(--text-primary); margin-bottom: 14px; display: flex; align-items: center; gap: 10px; }
.reply-form-title .reply-avatar { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .65rem; font-weight: 700; color: #fff; }
.reply-textarea { width: 100%; padding: 12px 16px; border: 1.5px solid var(--border); border-radius: var(--radius); font-size: .9rem; line-height: 1.5; color: var(--text-primary); background: var(--surface2); outline: none; resize: vertical; min-height: 110px; transition: border-color .2s, box-shadow .2s; font-family: inherit; }
.reply-textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(27,79,138,.1); background: var(--surface); }
.reply-form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 12px; }

@media (max-width: 900px) {
  .profile-grid { grid-template-columns: 1fr; }
  .profile-hero-body { flex-wrap: wrap; }
  .messages-layout { flex-direction: column; height: auto; }
  .conv-sidebar { width: 100%; border-right: none; border-bottom: 1.5px solid var(--border); max-height: 260px; }
  .conv-main { min-height: 400px; }
  .members-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}

/* ══════════════════════════════════════════
   LOGOUT BUTTON (injected by auth.js)
   ══════════════════════════════════════════ */
.btn-logout-header {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: background .2s, color .2s, border-color .2s;
  flex-shrink: 0;
}
.btn-logout-header svg { width: 16px; height: 16px; }
.btn-logout-header:hover {
  background: var(--red-light);
  color: var(--accent-red);
  border-color: var(--accent-red);
}

/* Admin nav link (hidden by default, shown by auth.js for admins) */
#nav-admin { display: none; }

/* ══════════════════════════════════════════════
   TOGGLE SWITCH (Modal: Permitir respuestas)
   ══════════════════════════════════════════════ */
.modal-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-top: 4px;
}
.modal-toggle-info {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-secondary);
}
.modal-toggle-label {
  display: block;
  font-size: .88rem;
  font-weight: 600;
  color: var(--text-primary);
}
.modal-toggle-hint {
  display: block;
  font-size: .74rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
  cursor: pointer;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-thumb {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 999px;
  transition: background .25s;
}
.toggle-thumb::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .25s;
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
}
.toggle-switch input:checked + .toggle-thumb { background: var(--primary); }
.toggle-switch input:checked + .toggle-thumb::before { transform: translateX(20px); }

/* ══════════════════════════════════════════════
   THREAD LOCK indicators
   ══════════════════════════════════════════════ */
.thread-lock-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 8px;
  color: var(--text-muted);
  opacity: .7;
  vertical-align: middle;
}
.thread-lock-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  background: var(--red-light);
  color: var(--accent-red);
  border-radius: 999px;
  font-size: .74rem;
  font-weight: 700;
}
.replies-locked-msg {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 24px;
  background: var(--surface2);
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-muted);
  font-size: .9rem;
  font-weight: 500;
}
.replies-locked-msg svg { flex-shrink: 0; opacity: .6; }

/* ══════════════════════════════════════════════
   THREAD DETAIL – Edit / Toggle-replies buttons
   ══════════════════════════════════════════════ */
.btn-edit-thread,
.btn-toggle-replies {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: .78rem;
  font-weight: 600;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all .2s;
  font-family: inherit;
}
.btn-edit-thread:hover    { border-color: var(--primary); color: var(--primary); background: var(--surface2); }
.btn-toggle-replies:hover { border-color: var(--accent-red); color: var(--accent-red); background: var(--red-light); }

/* ══════════════════════════════════════════════
   CO-ADMIN role badge color (purple)
   ══════════════════════════════════════════════ */
.role-co-admin-chip { color: #7c3aed; font-weight: 700; }

/* ══════════════════════════════════════════════
   EDIT PROFILE MODAL — Premium Redesign
   ══════════════════════════════════════════════ */

/* The modal card itself */
.edit-profile-modal {
  background: var(--surface);
  border-radius: 24px;
  width: 100%;
  max-width: 480px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,.22), 0 4px 16px rgba(0,0,0,.1);
  animation: ep-slide-in .3s cubic-bezier(.22,.68,0,1.2);
}
@keyframes ep-slide-in {
  from { opacity: 0; transform: translateY(28px) scale(.97); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}

/* ─── Gradient Header ───────────────────────── */
.ep-header {
  position: relative;
  background: linear-gradient(135deg, #1b4f8a 0%, #2d7dd2 55%, #1a9dff 100%);
  padding: 32px 28px 28px;
  display: flex;
  align-items: center;
  gap: 18px;
  overflow: hidden;
}
.ep-header-glow {
  position: absolute;
  top: -40px; right: -40px;
  width: 160px; height: 160px;
  background: radial-gradient(circle, rgba(255,255,255,.18) 0%, transparent 70%);
  pointer-events: none;
}
.ep-close {
  position: absolute;
  top: 14px; right: 14px;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,.15);
  color: rgba(255,255,255,.9);
  display: flex; align-items: center; justify-content: center;
  transition: background .2s, transform .2s;
  flex-shrink: 0;
}
.ep-close:hover { background: rgba(255,255,255,.3); transform: scale(1.1); }

/* Avatar in header */
.ep-avatar-preview {
  position: relative;
  width: 64px; height: 64px;
  border-radius: 50%;
  background: rgba(255,255,255,.2);
  border: 3px solid rgba(255,255,255,.45);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: .02em;
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(0,0,0,.18);
  backdrop-filter: blur(6px);
}
.ep-avatar-online {
  position: absolute;
  bottom: 2px; right: 2px;
  width: 14px; height: 14px;
  background: #22c55e;
  border-radius: 50%;
  border: 2.5px solid #fff;
}

/* Header text */
.ep-header-info { flex: 1; min-width: 0; }
.ep-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
}
.ep-subtitle {
  font-size: .82rem;
  color: rgba(255,255,255,.75);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── Form Body ─────────────────────────────── */
.ep-body {
  padding: 28px 28px 24px;
}

.ep-field-group {
  margin-bottom: 24px;
}
.ep-field-group:last-of-type { margin-bottom: 0; }

/* Label with icon */
.ep-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: .76rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: 8px;
}
.ep-label svg { color: var(--primary); flex-shrink: 0; }

/* Input wrapper with animated underline */
.ep-input-wrap {
  position: relative;
}
.ep-input {
  width: 100%;
  padding: 12px 16px;
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: .95rem;
  font-weight: 500;
  color: var(--text-primary);
  outline: none;
  transition: border-color .25s, background .25s, box-shadow .25s;
}
.ep-input::placeholder { color: var(--text-muted); font-weight: 400; }
.ep-input:focus {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 4px rgba(27,79,138,.1);
}

/* Animated focus bar at bottom */
.ep-input-bar {
  position: absolute;
  bottom: 0; left: 50%;
  width: 0; height: 2px;
  background: linear-gradient(90deg, #1b4f8a, #1a9dff);
  border-radius: 2px;
  transition: width .3s ease, left .3s ease;
  pointer-events: none;
}
.ep-input:focus ~ .ep-input-bar {
  width: 100%;
  left: 0;
}

/* Hint text */
.ep-field-hint {
  display: block;
  margin-top: 6px;
  font-size: .74rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ─── Action Buttons ────────────────────────── */
.ep-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1.5px solid var(--border);
}
.ep-btn-cancel {
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 600;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  transition: all .2s;
}
.ep-btn-cancel:hover {
  background: var(--surface2);
  border-color: var(--text-muted);
  color: var(--text-primary);
}
.ep-btn-save {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 700;
  background: linear-gradient(135deg, #1b4f8a, #2d7dd2);
  color: #fff;
  border: none;
  box-shadow: 0 4px 14px rgba(27,79,138,.35);
  transition: all .25s;
}
.ep-btn-save:hover {
  background: linear-gradient(135deg, #153d6f, #1b4f8a);
  box-shadow: 0 6px 20px rgba(27,79,138,.45);
  transform: translateY(-1px);
}
.ep-btn-save:active { transform: translateY(0); }
.ep-btn-save:disabled {
  opacity: .6;
  cursor: not-allowed;
  transform: none;
}
