  @font-face {
    font-family: 'MiFuente';
    src: url('/assets/mont.ttf') format('truetype');
    font-weight: normal;
    font-style:  normal;
  }

  :root {
    --black: #0a0a0a;
    --white: #ffffff;
    --gray-50: #f8f9fa;
    --gray-100: #f1f3f5;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-400: #ced4da;
    --gray-500: #adb5bd;
    --gray-600: #6c757d;
    --gray-700: #495057;
    --gray-800: #343a40;
    --gray-900: #212529;
    --accent: #1a1aff;
    --accent-light: #e8e8ff;
    --green: #00c853;
    --red: #ff3b30;
    --orange: #ff9500;
    --blue: #1a1aff;
    --sidebar-width: 240px;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 4px 24px rgba(0,0,0,0.08);
    --shadow-lg: 0 12px 48px rgba(0,0,0,0.14);
  }

  * { box-sizing: border-box; margin: 0; padding: 0; }
  
  body {
    font-family: 'MiFuente', 'DM Sans', sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    min-height: 100vh;
  }

  /* ===== VIEWS ===== */
  .view { display: none; }
  .view.active { display: flex; }

  /* ===== PROFILE VIEW ===== */
  #profile-view {
    min-height: 100vh;
    flex-direction: column;
    align-items: center;
    background: var(--white);
  }

  .profile-hero {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    padding: 0 0 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .profile-cover {
    width: 100%;
    height: 180px;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1aff 60%, #6b6bff 100%);
    position: relative;
    overflow: hidden;
  }

  .profile-cover::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Ccircle cx='30' cy='30' r='20'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  }

  .profile-logo {
    position: absolute;
    top: 20px;
    left: 20px;
    font-family: 'DM Serif Display', serif;
    font-size: 22px;
    color: white;
    letter-spacing: -0.5px;
  }

  .profile-logo span { font-style: italic; }

  .profile-qr {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.15);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(10px);
  }

  .profile-avatar-wrap {
    margin-top: -52px;
    position: relative;
    z-index: 10;
  }

  .profile-avatar {
    width: 104px;
    height: 104px;
    border-radius: 50%;
    border: 4px solid var(--white);
    object-fit: cover;
    background: var(--gray-200);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    color: var(--gray-500);
    overflow: hidden;
  }

  .profile-avatar img { width: 100%; height: 100%; object-fit: cover; }

  .profile-name {
    font-family: 'DM Serif Display', serif;
    font-size: 28px;
    color: var(--black);
    margin-top: 14px;
    text-align: center;
    letter-spacing: -0.5px;
  }

  .profile-title {
    font-size: 15px;
    color: var(--gray-600);
    margin-top: 4px;
    text-align: center;
  }

  .profile-bio {
    font-size: 14px;
    color: var(--gray-700);
    text-align: center;
    margin-top: 10px;
    max-width: 300px;
    line-height: 1.6;
  }

  .profile-connect-btn {
    margin-top: 20px;
    padding: 14px 40px;
    background: var(--black);
    color: var(--white);
    border: none;
    border-radius: 100px;
    font-family: 'DM Sans', sans-serif;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    letter-spacing: 0.3px;
    transition: all 0.2s;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  }

  .profile-connect-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  }

  .profile-section-title {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--gray-400);
    margin: 32px 0 14px;
    align-self: flex-start;
    padding: 0 24px;
    width: 100%;
  }

  .social-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    width: 100%;
    padding: 0 24px;
  }

  .social-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 8px;
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    color: inherit;
    border: 1px solid var(--gray-100);
  }

  .social-item:hover {
    background: var(--white);
    box-shadow: var(--shadow);
    transform: translateY(-2px);
  }

  .social-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
  }

  .social-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--gray-700);
    text-align: center;
  }

  .links-list {
    width: 100%;
    padding: 0 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .link-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    color: inherit;
    border: 1px solid var(--gray-100);
  }

  .link-item:hover {
    background: var(--white);
    box-shadow: var(--shadow);
    transform: translateX(3px);
  }

  .link-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--black);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
  }

  .link-info { flex: 1; }
  .link-title { font-size: 14px; font-weight: 600; color: var(--gray-900); }
  .link-url { font-size: 12px; color: var(--gray-500); margin-top: 2px; }

  .link-arrow {
    color: var(--gray-400);
    font-size: 18px;
  }

  .profile-footer {
    width: 100%;
    max-width: 480px;
    text-align: center;
    padding: 30px 24px;
    font-size: 12px;
    color: var(--gray-400);
  }

  .profile-footer a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
  }

  /* ===== ADMIN VIEW ===== */
  #admin-view {
    flex-direction: row;
    min-height: 100vh;
  }

  /* Sidebar */
  .sidebar {
    width: var(--sidebar-width);
    background: var(--white);
    border-right: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    padding: 0;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    overflow-y: auto;
  }

  .sidebar-logo {
    padding: 24px 20px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--gray-100);
  }

  .sidebar-logo-icon {
    width: 32px;
    height: 32px;
    background: var(--black);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-family: 'DM Serif Display', serif;
    font-size: 16px;
    font-style: italic;
  }

  .sidebar-logo-text {
    font-family: 'DM Serif Display', serif;
    font-size: 20px;
    color: var(--black);
    letter-spacing: -0.5px;
  }

  .sidebar-section {
    padding: 16px 12px 8px;
  }

  .sidebar-section-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--gray-400);
    padding: 0 8px;
    margin-bottom: 6px;
  }

  .sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-600);
    text-decoration: none;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
  }

  .sidebar-item:hover {
    background: var(--gray-50);
    color: var(--gray-900);
  }

  .sidebar-item.active {
    background: var(--black);
    color: var(--white);
  }

  .sidebar-item-icon { font-size: 16px; width: 20px; text-align: center; }

  .sidebar-footer {
    margin-top: auto;
    padding: 16px 12px;
    border-top: 1px solid var(--gray-100);
  }

  /* Main Content */
  .admin-main {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 32px 40px;
    min-height: 100vh;
  }

  .admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
  }

  .admin-title {
    font-family: 'DM Serif Display', serif;
    font-size: 28px;
    color: var(--black);
    letter-spacing: -0.5px;
  }

  .admin-subtitle {
    font-size: 14px;
    color: var(--gray-500);
    margin-top: 2px;
  }

  .btn {
    padding: 10px 20px;
    border-radius: 10px;
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }

  .btn-primary {
    background: var(--black);
    color: var(--white);
  }

  .btn-primary:hover {
    background: var(--gray-800);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  }

  .btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
  }

  .btn-secondary:hover { background: var(--gray-200); }

  .btn-danger { background: #fff0f0; color: var(--red); }
  .btn-danger:hover { background: #ffe0e0; }

  .btn-sm { padding: 7px 14px; font-size: 13px; }

  /* Stats */
  .stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 32px;
  }

  .stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--gray-200);
    transition: box-shadow 0.2s;
  }

  .stat-card:hover { box-shadow: var(--shadow); }

  .stat-label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--gray-500);
    text-transform: uppercase;
  }

  .stat-value {
    font-family: 'DM Serif Display', serif;
    font-size: 36px;
    color: var(--black);
    margin-top: 6px;
    letter-spacing: -1px;
  }

  .stat-change {
    font-size: 12px;
    font-weight: 600;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
  }

  .stat-change.up { color: var(--green); }
  .stat-change.down { color: var(--red); }

  /* Users Table */
  .section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
  }

  .section-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--gray-900);
  }

  .table-wrap {
    background: var(--white);
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    overflow: hidden;
  }

  .search-bar {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .search-input {
    flex: 1;
    border: none;
    outline: none;
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    color: var(--gray-900);
    background: transparent;
  }

  .search-input::placeholder { color: var(--gray-400); }

  table {
    width: 100%;
    border-collapse: collapse;
  }

  thead th {
    padding: 12px 20px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--gray-400);
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-100);
  }

  tbody tr {
    border-bottom: 1px solid var(--gray-100);
    transition: background 0.15s;
    cursor: pointer;
  }

  tbody tr:last-child { border-bottom: none; }
  tbody tr:hover { background: var(--gray-50); }

  td {
    padding: 14px 20px;
    font-size: 14px;
    color: var(--gray-700);
  }

  .user-cell {
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-600);
    flex-shrink: 0;
    overflow: hidden;
  }

  .user-name { font-weight: 600; color: var(--gray-900); }
  .user-email { font-size: 12px; color: var(--gray-500); margin-top: 1px; }

  .badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
  }

  .badge-green  { background: #e6faf0; color: #00a844; }
  .badge-blue   { background: #e8e8ff; color: var(--blue); }
  .badge-orange { background: #fff4e0; color: var(--orange); }
  .badge-blue { background: var(--accent-light); color: var(--accent); }
  .badge-gray { background: var(--gray-100); color: var(--gray-600); }

  .action-btns { display: flex; gap: 8px; }

  /* Modal */
  .modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
  }

  .modal-overlay.open { display: flex; }

  .modal {
    background: var(--white);
    border-radius: 20px;
    padding: 0;
    width: 560px;
    max-width: 95vw;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.25s ease;
  }

  @keyframes modalIn {
    from { transform: scale(0.95) translateY(10px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
  }

  .modal-header {
    padding: 24px 28px 0;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 20px;
  }

  .modal-title {
    font-family: 'DM Serif Display', serif;
    font-size: 22px;
    color: var(--black);
    letter-spacing: -0.5px;
  }

  .modal-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: var(--gray-100);
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-600);
    transition: all 0.15s;
  }

  .modal-close:hover { background: var(--gray-200); color: var(--black); }

  .modal-body { padding: 0 28px 28px; }

  .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

  .form-group { display: flex; flex-direction: column; gap: 6px; }
  .form-group.full { grid-column: 1 / -1; }

  .form-label {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--gray-500);
  }

  .form-input {
    padding: 11px 14px;
    border: 1.5px solid var(--gray-200);
    border-radius: 10px;
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    color: var(--gray-900);
    outline: none;
    transition: border-color 0.15s;
    background: var(--white);
  }

  .form-input:focus { border-color: var(--black); }

  .form-input::placeholder { color: var(--gray-400); }

  .social-inputs { display: flex; flex-direction: column; gap: 10px; }

  .social-input-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 1.5px solid var(--gray-200);
    border-radius: 10px;
    transition: border-color 0.15s;
  }

  .social-input-row:focus-within { border-color: var(--black); }

  .social-input-icon { font-size: 18px; width: 24px; text-align: center; }

  .social-input-field {
    flex: 1;
    border: none;
    outline: none;
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    color: var(--gray-900);
    background: transparent;
  }

  .social-input-field::placeholder { color: var(--gray-400); }

  .modal-footer {
    padding: 16px 28px;
    border-top: 1px solid var(--gray-100);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
  }

  .divider {
    height: 1px;
    background: var(--gray-100);
    margin: 20px 0;
  }

  .subsection-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--gray-700);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
  }

  /* Profile selector */
  .profile-selector {
    display: flex;
    gap: 10px;
    padding: 16px 20px;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    overflow-x: auto;
  }

  .profile-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--white);
    border: 1.5px solid var(--gray-200);
    border-radius: 100px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-700);
    white-space: nowrap;
    transition: all 0.15s;
  }

  .profile-chip.active {
    background: var(--black);
    color: var(--white);
    border-color: var(--black);
  }

  .profile-chip-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--gray-300);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    overflow: hidden;
  }

  /* Nav bar for switching modes */
  .topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 200;
  }

  .topbar-logo {
    font-family: 'DM Serif Display', serif;
    font-size: 22px;
    color: var(--black);
    letter-spacing: -0.5px;
  }

  .topbar-logo span { font-style: italic; color: var(--accent); }

  .topbar-nav { display: flex; gap: 8px; align-items: center; }

  .topbar-btn {
    padding: 7px 16px;
    border-radius: 8px;
    border: 1.5px solid var(--gray-200);
    background: var(--white);
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    cursor: pointer;
    transition: all 0.15s;
  }

  .topbar-btn:hover { border-color: var(--black); color: var(--black); }
  .topbar-btn.active { background: var(--black); color: var(--white); border-color: var(--black); }

  /* Landing / Home */
  #home-view {
    flex-direction: column;
    align-items: center;
    padding-top: 56px;
    min-height: 100vh;
    background: var(--white);
  }

  .hero {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
    padding: 80px 24px 60px;
  }

  .hero-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: var(--accent-light);
    border-radius: 100px;
    font-size: 12px;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-bottom: 20px;
  }

  .hero-title {
    font-family: 'DM Serif Display', serif;
    font-size: 52px;
    line-height: 1.1;
    color: var(--black);
    letter-spacing: -2px;
    margin-bottom: 16px;
  }

  .hero-title em { font-style: italic; color: var(--accent); }

  .hero-desc {
    font-size: 17px;
    color: var(--gray-600);
    line-height: 1.6;
    margin-bottom: 36px;
  }

  .hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

  .users-preview {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    max-width: 900px;
    margin: 0 auto 80px;
    padding: 0 24px;
  }

  .user-preview-card {
    background: var(--white);
    border: 1.5px solid var(--gray-200);
    border-radius: 20px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.25s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  }

  .user-preview-card:hover {
    border-color: var(--black);
    box-shadow: 0 12px 40px rgba(0,0,0,0.12);
    transform: translateY(-4px);
  }

  .card-cover {
    height: 80px;
    position: relative;
  }

  .card-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 3px solid var(--white);
    position: absolute;
    bottom: -28px;
    left: 20px;
    background: var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  }

  .card-body {
    padding: 36px 20px 20px;
  }

  .card-name {
    font-family: 'DM Serif Display', serif;
    font-size: 18px;
    color: var(--black);
    letter-spacing: -0.3px;
  }

  .card-role {
    font-size: 13px;
    color: var(--gray-500);
    margin-top: 2px;
  }

  .card-socials {
    display: flex;
    gap: 8px;
    margin-top: 14px;
    flex-wrap: wrap;
  }

  .card-social-badge {
    padding: 4px 10px;
    background: var(--gray-100);
    border-radius: 100px;
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-600);
  }

  .card-cta {
    display: block;
    text-align: center;
    padding: 10px;
    background: var(--gray-50);
    border-top: 1px solid var(--gray-100);
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    transition: all 0.15s;
  }

  .user-preview-card:hover .card-cta {
    background: var(--black);
    color: var(--white);
  }

  /* Toast */
  .toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--black);
    color: var(--white);
    padding: 12px 24px;
    border-radius: 100px;
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    transition: all 0.3s;
    z-index: 9999;
    white-space: nowrap;
  }

  .toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }

  @media (max-width: 768px) {
    .users-preview { grid-template-columns: 1fr; max-width: 400px; }
    .hero-title { font-size: 36px; }
    .stats-row { grid-template-columns: 1fr 1fr; }
    .admin-main { padding: 20px; }
    .form-grid { grid-template-columns: 1fr; }
  }

  /* ── Slug / URL styles ── */
  .slug-field-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    padding: 8px 12px;
    margin-top: 4px;
  }
  .slug-prefix {
    font-size: 12px;
    color: var(--gray-400);
    white-space: nowrap;
    flex-shrink: 0;
  }
  .slug-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-family: 'MiFuente', 'DM Sans', monospace;
    font-size: 13px;
    color: var(--gray-900);
    min-width: 0;
  }
  .slug-auto-btn {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 6px;
    border: 1px solid var(--gray-300);
    background: var(--white);
    color: var(--gray-600);
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .slug-auto-btn:hover { background: var(--gray-100); }

  .btn-copy {
    background: var(--gray-100);
    color: var(--gray-700);
    border: 1px solid var(--gray-200);
  }
  .btn-copy:hover { background: var(--gray-200); }
  .btn-qr {
    background: var(--accent-light);
    color: var(--accent);
    border: 1px solid #c5c5ff;
  }
  .btn-qr:hover { background: #d4d4ff; }

  /* ── QR Modal ── */
  .qr-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
  }
  .qr-modal-overlay.open { display: flex; }
  .qr-modal {
    background: var(--white);
    border-radius: var(--radius);
    padding: 32px;
    width: 320px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-lg);
  }
  .qr-modal-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--gray-900);
    text-align: center;
  }
  .qr-modal-name {
    font-size: 13px;
    color: var(--gray-500);
    text-align: center;
    margin-top: -8px;
  }
  #qr-canvas {
    border-radius: 12px;
    border: 1px solid var(--gray-200);
  }
  .qr-url-box {
    width: 100%;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 11px;
    color: var(--gray-600);
    word-break: break-all;
    text-align: center;
    font-family: monospace;
  }
  .qr-modal-actions {
    display: flex;
    gap: 10px;
    width: 100%;
  }
  .qr-modal-actions .btn { flex: 1; justify-content: center; }

  /* ===== AUTH / LOGIN ===== */
  #login-view {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  }

  .auth-card {
    width: 420px;
    max-width: 95vw;
    background: var(--white);
    border: 1.5px solid var(--gray-200);
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.1);
    overflow: hidden;
  }

  .auth-header {
    background: var(--black);
    padding: 32px 36px 28px;
    text-align: center;
  }

  .auth-logo {
    font-family: 'DM Serif Display', serif;
    font-size: 36px;
    color: var(--white);
    letter-spacing: -1px;
  }

  .auth-logo span { font-style: italic; color: #6b6bff; }

  .auth-tagline {
    font-size: 13px;
    color: rgba(255,255,255,0.5);
    margin-top: 4px;
  }

  .auth-body { padding: 32px 36px; }

  .auth-tabs {
    display: flex;
    background: var(--gray-100);
    border-radius: 10px;
    padding: 3px;
    margin-bottom: 24px;
  }

  .auth-tab {
    flex: 1;
    padding: 8px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-500);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    background: none;
    font-family: 'DM Sans', sans-serif;
  }

  .auth-tab.active {
    background: var(--white);
    color: var(--gray-900);
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
  }

  .auth-panel { display: none; }
  .auth-panel.active { display: block; }

  .auth-field {
    margin-bottom: 16px;
  }

  .auth-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: var(--gray-500);
    margin-bottom: 6px;
  }

  .auth-input {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--gray-200);
    border-radius: 10px;
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    color: var(--gray-900);
    outline: none;
    transition: border-color 0.15s;
    background: var(--white);
  }

  .auth-input:focus { border-color: var(--black); }
  .auth-input::placeholder { color: var(--gray-400); }
  .auth-input.error { border-color: var(--red); }

  .auth-error {
    display: none;
    background: #fff0f0;
    border: 1px solid #ffc5c5;
    color: var(--red);
    font-size: 13px;
    padding: 10px 14px;
    border-radius: 10px;
    margin-bottom: 16px;
    line-height: 1.4;
  }

  .auth-error.show { display: block; }

  .auth-success {
    display: none;
    background: #f0fff4;
    border: 1px solid #c5f5d5;
    color: #00a844;
    font-size: 13px;
    padding: 10px 14px;
    border-radius: 10px;
    margin-bottom: 16px;
    line-height: 1.4;
  }

  .auth-success.show { display: block; }

  .auth-btn {
    width: 100%;
    padding: 13px;
    background: var(--black);
    color: var(--white);
    border: none;
    border-radius: 10px;
    font-family: 'DM Sans', sans-serif;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
  }

  .auth-btn:hover { background: var(--gray-800); transform: translateY(-1px); }
  .auth-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

  .auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
    font-size: 12px;
    color: var(--gray-400);
  }

  .auth-divider::before, .auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--gray-200);
  }

  .auth-role-select {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 16px;
  }

  .auth-role-opt {
    padding: 10px 6px;
    border: 1.5px solid var(--gray-200);
    border-radius: 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-600);
  }

  .auth-role-opt:hover { border-color: var(--gray-400); }
  .auth-role-opt.selected { border-color: var(--accent); background: var(--accent-light); color: var(--accent); }

  .auth-role-opt .role-emoji { font-size: 18px; display: block; margin-bottom: 4px; }

  .auth-footer {
    padding: 16px 36px 24px;
    text-align: center;
    font-size: 12px;
    color: var(--gray-400);
    border-top: 1px solid var(--gray-100);
  }

  /* ── Auth Users Manager (admin panel tab) ── */
  .auth-users-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 16px;
  }

  .auth-user-card {
    background: var(--white);
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: box-shadow 0.2s;
  }

  .auth-user-card:hover { box-shadow: var(--shadow); }

  .auth-user-card.inactive { opacity: 0.5; }

  .auth-user-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
  }

  .auth-user-info { flex: 1; min-width: 0; }
  .auth-user-name { font-size: 14px; font-weight: 700; color: var(--gray-900); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .auth-user-email { font-size: 12px; color: var(--gray-500); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .auth-user-actions { display: flex; gap: 6px; flex-shrink: 0; }

  /* Permission badge in topbar */
  .role-badge-topbar {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
  }

  .role-badge-admin { background: var(--accent-light); color: var(--accent); }
  .role-badge-staff { background: #fff4e0; color: var(--orange); }
  .role-badge-user  { background: var(--gray-100); color: var(--gray-600); }

  /* ── IMAGE EDITOR MODAL ── */
  #img-editor-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 3000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
  }
  #img-editor-overlay.open { display: flex; }

  .img-editor-modal {
    background: var(--white);
    border-radius: 24px;
    width: 520px;
    max-width: 95vw;
    max-height: 92vh;
    overflow-y: auto;
    box-shadow: 0 24px 80px rgba(0,0,0,0.25);
    animation: modalIn 0.25s ease;
  }

  .img-editor-header {
    padding: 24px 28px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
  }

  .img-editor-title {
    font-family: 'DM Serif Display', serif;
    font-size: 22px;
    color: var(--black);
    letter-spacing: -0.5px;
  }

  .img-editor-subtitle {
    font-size: 13px;
    color: var(--gray-500);
    padding: 0 28px;
    margin-bottom: 24px;
  }

  .img-editor-body { padding: 0 28px 24px; }

  /* Preview de portada + avatar superpuesto */
  .img-preview-container {
    border-radius: 16px;
    overflow: hidden;
    border: 1.5px solid var(--gray-200);
    margin-bottom: 24px;
    position: relative;
  }

  .img-cover-preview {
    width: 100%;
    height: 140px;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1aff 60%, #6b6bff 100%);
    position: relative;
    cursor: pointer;
    transition: filter 0.2s;
    background-size: cover;
    background-position: center;
  }

  .img-cover-preview:hover { filter: brightness(0.85); }

  .img-cover-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0);
    transition: background 0.2s;
    flex-direction: column;
    gap: 6px;
    color: white;
    font-size: 13px;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.2s;
  }

  .img-cover-preview:hover .img-cover-overlay { opacity: 1; background: rgba(0,0,0,0.35); }

  .img-avatar-preview {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 4px solid var(--white);
    position: absolute;
    bottom: -40px;
    left: 24px;
    background: var(--gray-200);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0,0,0,0.18);
    transition: filter 0.2s;
    background-size: cover;
    background-position: center;
  }

  .img-avatar-preview:hover { filter: brightness(0.8); }

  .img-avatar-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0);
    border-radius: 50%;
    color: white;
    font-size: 20px;
    opacity: 0;
    transition: opacity 0.2s;
  }

  .img-avatar-preview:hover .img-avatar-overlay { opacity: 1; background: rgba(0,0,0,0.4); }

  .img-preview-spacer { height: 48px; }

  /* Secciones de upload */
  .img-section {
    margin-bottom: 20px;
  }

  .img-section-label {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--gray-500);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .img-upload-zone {
    border: 2px dashed var(--gray-300);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--gray-50);
    position: relative;
  }

  .img-upload-zone:hover, .img-upload-zone.drag-over {
    border-color: var(--accent);
    background: var(--accent-light);
  }

  .img-upload-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
  }

  .img-upload-icon { font-size: 28px; margin-bottom: 6px; }
  .img-upload-text { font-size: 13px; font-weight: 600; color: var(--gray-700); }
  .img-upload-hint { font-size: 11px; color: var(--gray-400); margin-top: 3px; }

  .img-upload-progress {
    margin-top: 10px;
    display: none;
  }

  .img-progress-bar {
    height: 4px;
    background: var(--gray-200);
    border-radius: 100px;
    overflow: hidden;
  }

  .img-progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 100px;
    width: 0%;
    transition: width 0.3s;
  }

  .img-progress-text {
    font-size: 11px;
    color: var(--gray-500);
    margin-top: 5px;
    text-align: center;
  }

  .img-current-url {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    font-size: 11px;
    color: var(--gray-600);
    word-break: break-all;
  }

  .img-current-thumb {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--gray-200);
  }

  .img-remove-btn {
    margin-left: auto;
    flex-shrink: 0;
    background: #fff0f0;
    color: var(--red);
    border: none;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
  }

  .img-remove-btn:hover { background: #ffe0e0; }

  .img-editor-footer {
    padding: 16px 28px 24px;
    border-top: 1px solid var(--gray-100);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
  }

  /* Botón flotante en la tabla de usuarios */
  .btn-img { background: #f0f0ff; color: var(--accent); border: 1px solid #d0d0ff; }
  .btn-img:hover { background: #e0e0ff; }


  a.link-item {
  -webkit-touch-callout: default !important;
  touch-action: manipulation;
  cursor: pointer;
}

@media (hover: none) {
  .link-item {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
  .link-item:hover {
    transform: none;
    box-shadow: none;
    background: var(--gray-50);
  }
}