/* ============================================================
   portal.css — OneUp Trading Portal
   Dark premium fintech aesthetic. Verde institucional.
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --bg-primary:     #0a0f0d;
  --bg-secondary:   #111714;
  --bg-card:        #141c18;
  --bg-card-hover:  #1a2420;
  --bg-sidebar:     #0d1410;
  --bg-input:       #1a2420;

  --green:          #1db954;
  --green-dark:     #179443;
  --green-light:    #4ade80;
  --green-glow:     rgba(29, 185, 84, 0.15);
  --green-border:   rgba(29, 185, 84, 0.3);

  --text-primary:   #e8f0ec;
  --text-secondary: #8fa89a;
  --text-muted:     #5a7068;

  --border:         rgba(255,255,255,0.06);
  --border-strong:  rgba(255,255,255,0.1);

  --danger:         #ef4444;
  --danger-bg:      rgba(239,68,68,0.1);
  --warning:        #f59e0b;
  --success:        #1db954;
  --success-bg:     rgba(29,185,84,0.1);

  --radius-sm:      6px;
  --radius:         10px;
  --radius-lg:      16px;
  --radius-xl:      20px;

  --shadow:         0 4px 24px rgba(0,0,0,0.4);
  --shadow-card:    0 2px 12px rgba(0,0,0,0.3);

  --sidebar-w:      240px;
  --transition:     0.2s ease;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--green); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--green-light); }

/* ── Loading overlay ───────────────────────────────────────── */
.loading-overlay {
  position: fixed; inset: 0;
  background: var(--bg-primary);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 16px; z-index: 9999;
}
.loading-overlay p { color: var(--text-secondary); font-size: 14px; }

.loading-spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border-strong);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Auth pages ────────────────────────────────────────────── */
.auth-page {
  display: flex; align-items: center;
  justify-content: center; min-height: 100vh;
  padding: 24px;
  background: radial-gradient(ellipse at 50% 0%, rgba(29,185,84,0.08) 0%, transparent 60%), var(--bg-primary);
}

.auth-container { width: 100%; max-width: 420px; }

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  padding: 40px 36px;
  box-shadow: var(--shadow);
}

.auth-logo {
  text-align: center; margin-bottom: 28px;
}
.auth-logo img {
  width: 52px;
  height: 52px;
  display: block;
  margin: 0 auto 10px;
  border-radius: 50%;
  object-fit: cover;
}
.logo-text { font-size: 20px; font-weight: 700; color: var(--text-primary); letter-spacing: -0.5px; }
.logo-accent { color: var(--green); }

.auth-title { font-size: 22px; font-weight: 700; text-align: center; margin-bottom: 6px; }
.auth-subtitle { color: var(--text-secondary); text-align: center; font-size: 14px; margin-bottom: 28px; }

.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-links { text-align: center; margin-top: 20px; font-size: 14px; color: var(--text-muted); }
.auth-links a { margin-left: 6px; }
.auth-alt-form { margin-top: 18px; }
.auth-helper-text {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
  margin: 0 0 2px;
  text-align: center;
}
.auth-link-btn,
.auth-text-btn {
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--green);
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  padding: 0;
}
.auth-link-btn { margin-left: 6px; }
.auth-text-btn {
  align-self: center;
  color: var(--text-secondary);
  margin-top: 2px;
}
.auth-link-btn:hover,
.auth-text-btn:hover { color: var(--green-light); }

/* ── Portal layout ─────────────────────────────────────────── */
.portal-page {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 24px 0;
  position: fixed; top: 0; left: 0; bottom: 0;
  overflow-y: auto; z-index: 100;
}

.sidebar-logo {
  padding: 0 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 4px;
}

.sidebar-brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.sidebar-brand-mark {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.admin-badge {
  font-size: 10px; font-weight: 700; letter-spacing: 1px;
  color: var(--green); background: var(--green-glow);
  border: 1px solid var(--green-border);
  border-radius: 4px; padding: 2px 6px; width: fit-content;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex; flex-direction: column; gap: 2px;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  transition: all var(--transition);
  cursor: pointer;
}
.nav-item:hover, .nav-item.active {
  background: var(--green-glow);
  color: var(--green-light);
  border-left: 2px solid var(--green);
  padding-left: 10px;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  font-size: 13px;
}

.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 0 32px 60px;
  max-width: calc(100vw - var(--sidebar-w));
}

.portal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 24px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}

.user-info { display: flex; align-items: center; gap: 12px; }
.user-avatar {
  width: 40px; height: 40px;
  background: var(--green-glow);
  border: 1.5px solid var(--green-border);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: var(--green); font-size: 16px;
}
.user-name { font-weight: 600; font-size: 15px; }
.user-email { font-size: 12px; }

.admin-title { font-size: 22px; font-weight: 700; }

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: border-color var(--transition);
}
.card:hover { border-color: var(--border-strong); }

.card-title { font-size: 16px; font-weight: 600; margin-bottom: 16px; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-body { display: flex; flex-direction: column; gap: 10px; }
.card-footer { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }

.card-pending {
  text-align: center; padding: 40px 32px;
  border-color: var(--green-border);
  background: linear-gradient(135deg, var(--bg-card) 0%, rgba(29,185,84,0.03) 100%);
}
.card-pending h2 { font-size: 20px; margin: 12px 0 8px; }
.card-icon { font-size: 48px; }

.pending-steps {
  text-align: left; margin: 24px 0;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  padding: 16px 20px;
}
.pending-steps h4 { font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.5px; }
.pending-steps ol { padding-left: 20px; color: var(--text-secondary); font-size: 14px; }
.pending-steps li { margin-bottom: 6px; }

.pending-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 20px; }

/* ── Licenses ──────────────────────────────────────────────── */
.license-card { margin-bottom: 16px; }
.product-name { font-weight: 600; font-size: 16px; }
.field-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.field-row:last-child { border-bottom: none; }
.field-label { color: var(--text-muted); font-size: 12px; min-width: 130px; text-transform: uppercase; letter-spacing: 0.4px; }
.field-value { flex: 1; font-size: 14px; }
.license-key { font-family: 'SF Mono', 'Fira Code', monospace; font-size: 13px; color: var(--green-light); letter-spacing: 0.5px; }
.btn-copy { background: none; border: none; cursor: pointer; font-size: 14px; padding: 2px 4px; opacity: 0.6; transition: opacity var(--transition); color: #ffffff; }
.btn-copy:hover { opacity: 1; }

/* ── Downloads ─────────────────────────────────────────────── */
.download-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
}
.download-info { display: flex; flex-direction: column; gap: 2px; }
.download-name { font-weight: 600; font-size: 14px; }
.download-version { font-size: 12px; color: var(--green); font-weight: 500; }
.download-product { font-size: 12px; }

/* ── Products grid ─────────────────────────────────────────── */
.products-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.product-card { text-align: center; padding: 28px 20px; cursor: default; }
.product-card.locked { opacity: 0.5; }
.lock-icon { font-size: 28px; margin-bottom: 12px; }
.badge-locked { display: inline-block; font-size: 11px; padding: 3px 10px; background: var(--border); border-radius: 20px; color: var(--text-muted); margin-top: 8px; }

/* ── Stats grid ────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-bottom: 8px; }
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.stat-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.6px; margin-bottom: 6px; }
.stat-value { font-size: 18px; font-weight: 700; color: var(--text-primary); }

/* ── Sections ──────────────────────────────────────────────── */
.section { margin-bottom: 40px; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.section-title { font-size: 17px; font-weight: 700; }

/* ── Requests ──────────────────────────────────────────────── */
.request-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.request-item:last-child { border-bottom: none; }
.request-product, .request-label { flex: 1; font-size: 14px; }

/* ── Forms ─────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 13px; font-weight: 500; color: var(--text-secondary); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="number"],
select,
textarea {
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  padding: 11px 14px;
  width: 100%;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-glow);
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }
select option { background: var(--bg-card); }

textarea { resize: vertical; min-height: 80px; }

.input-with-toggle { position: relative; }
.input-with-toggle input { padding-right: 44px; }
.toggle-password {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; font-size: 16px; padding: 4px;
  color: var(--text-muted);
}

.portal-form { display: flex; flex-direction: column; gap: 16px; }
.field-hint { font-size: 12px; color: var(--text-muted); }
.required { color: var(--danger); font-size: 12px; }
.optional { color: var(--text-muted); font-size: 11px; }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600;
  cursor: pointer; border: none;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--green); color: #000; }
.btn-primary:hover:not(:disabled) { background: var(--green-dark); color: #000; }

.btn-outline {
  background: transparent;
  border: 1px solid var(--green-border);
  color: var(--green-light);
}
.btn-outline:hover:not(:disabled) { background: var(--green-glow); }

.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover:not(:disabled) { color: var(--text-primary); background: var(--border); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #dc2626; }

.btn-full { width: 100%; }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-close { background: none; border: none; cursor: pointer; font-size: 18px; color: var(--text-muted); }

/* ── Status badges ─────────────────────────────────────────── */
.status-badge {
  display: inline-flex; align-items: center;
  font-size: 12px; font-weight: 600;
  padding: 3px 10px; border-radius: 20px;
}
.status-active { background: rgba(29,185,84,0.15); color: var(--green-light); border: 1px solid var(--green-border); }
.status-admin { background: rgba(29,185,84,0.15); color: var(--green-light); border: 1px solid var(--green-border); }
.status-pending { background: rgba(245,158,11,0.12); color: #fbbf24; border: 1px solid rgba(245,158,11,0.3); }
.status-suspended { background: rgba(239,68,68,0.1); color: #fca5a5; border: 1px solid rgba(239,68,68,0.3); }
.status-expired { background: rgba(100,116,139,0.15); color: #94a3b8; border: 1px solid rgba(100,116,139,0.3); }
.status-revoked { background: rgba(239,68,68,0.1); color: #f87171; border: 1px solid rgba(239,68,68,0.3); }
.status-canceled { background: rgba(100,116,139,0.15); color: #94a3b8; border: 1px solid rgba(100,116,139,0.3); }
.status-trialing { background: rgba(139,92,246,0.1); color: #c4b5fd; border: 1px solid rgba(139,92,246,0.3); }
.status-past_due { background: rgba(245,158,11,0.12); color: #fbbf24; border: 1px solid rgba(245,158,11,0.3); }
.status-approved { background: rgba(29,185,84,0.15); color: var(--green-light); border: 1px solid var(--green-border); }
.status-rejected { background: rgba(239,68,68,0.1); color: #f87171; border: 1px solid rgba(239,68,68,0.3); }

.role-badge { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 4px; letter-spacing: 0.5px; }
.role-admin { background: var(--green-glow); color: var(--green-light); border: 1px solid var(--green-border); }
.role-customer { background: var(--border); color: var(--text-muted); }
.role-community { background: rgba(139,92,246,0.16); color: #d8b4fe; border: 1px solid rgba(167,139,250,0.38); }
.role-musashi-tickmill { background: rgba(59,130,246,0.16); color: #93c5fd; border: 1px solid rgba(96,165,250,0.38); }
.role-musashi { background: rgba(14,165,233,0.14); color: #7dd3fc; border: 1px solid rgba(56,189,248,0.34); }
.role-subscription { background: rgba(139,92,246,0.12); color: #c4b5fd; border: 1px solid rgba(139,92,246,0.3); }
.role-subscription-past-due { background: rgba(245,158,11,0.12); color: #fbbf24; border: 1px solid rgba(245,158,11,0.3); }
.role-access { background: rgba(20,184,166,0.13); color: #5eead4; border: 1px solid rgba(45,212,191,0.3); }
.role-lifetime { background: rgba(234,179,8,0.14); color: #fde68a; border: 1px solid rgba(234,179,8,0.34); }

/* ── Alerts ────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 1.5;
}
.alert-error { background: var(--danger-bg); border: 1px solid rgba(239,68,68,0.3); color: #fca5a5; }
.alert-success { background: var(--success-bg); border: 1px solid var(--green-border); color: var(--green-light); }
.full-error { margin: 24px; }

/* ── Admin table ───────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }
.admin-table {
  width: 100%; border-collapse: collapse;
  font-size: 13px;
}
.admin-table th {
  text-align: left; padding: 10px 14px;
  color: var(--text-muted); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.6px;
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}
.admin-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.admin-table tr:hover td { background: var(--bg-card-hover); }
.admin-table .actions-cell { display: flex; gap: 8px; }
.license-key-cell { font-family: monospace; font-size: 12px; color: var(--green-light); }

.select-sm {
  padding: 5px 8px; font-size: 12px;
  border-radius: 4px; min-width: 100px;
  width: auto;
}

/* ── Modal ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  padding: 32px;
  width: 100%; max-width: 480px;
  box-shadow: var(--shadow);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.modal-header h3 { font-size: 17px; font-weight: 700; }

/* ── Search dropdown ───────────────────────────────────────── */
.search-dropdown {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 50;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  max-height: 200px; overflow-y: auto;
}
.dropdown-item {
  padding: 10px 14px; cursor: pointer;
  font-size: 13px; transition: background var(--transition);
}
.dropdown-item:hover { background: var(--bg-card-hover); }

.search-input {
  padding: 8px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  width: 260px;
}
.search-input:focus { border-color: var(--green); }

/* ── Empty / Utility ───────────────────────────────────────── */
.empty-state { padding: 24px; text-align: center; color: var(--text-muted); font-size: 14px; line-height: 1.6; }
.loading-text { padding: 24px; color: var(--text-muted); font-size: 14px; }

.text-muted { color: var(--text-muted); }
.text-sm { font-size: 13px; }
.text-center { text-align: center; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { width: 100%; height: auto; position: relative; }
  .main-content { margin-left: 0; padding: 0 16px 40px; max-width: 100%; }
  .portal-page { flex-direction: column; }
  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .auth-card { padding: 28px 24px; }
  .admin-table { font-size: 12px; }
  .sidebar { display: none; }
}

/* ── Modern dashboard restoration ─────────────────────────── */
.portal-page-modern {
  display: block;
  min-height: 100vh;
  background:
    radial-gradient(circle at 50% -10%, rgba(0, 185, 122, 0.15), transparent 34rem),
    linear-gradient(180deg, #071620 0%, #071d1f 18%, #07101a 48%, #061018 100%);
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: #f4f8fb;
}

.modern-dashboard-shell {
  width: min(100%, 860px);
  margin: 0 auto;
  padding: 36px 18px 72px;
}

.modern-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.modern-topbar-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex: 0 0 auto;
}

.modern-user {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.modern-avatar {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: linear-gradient(135deg, #11bf72, #039a64);
  color: #ecfff7;
  font-weight: 800;
  font-size: 14px;
  box-shadow: 0 10px 28px rgba(0, 190, 115, 0.22);
}

.modern-user-name {
  font-size: 16px;
  font-weight: 800;
  line-height: 1.1;
}

.modern-user-status {
  color: #8aa7ba;
  font-size: 13px;
  margin-top: 2px;
}

.modern-site-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid rgba(143, 171, 195, 0.18);
  border-radius: 10px;
  background: #102235;
  color: #f4f8fb;
  font-size: 13px;
  font-weight: 800;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.modern-site-btn:hover {
  color: #fff;
  border-color: rgba(0, 214, 127, 0.36);
}

.modern-admin-btn {
  border-color: rgba(0, 214, 127, 0.34);
  background: linear-gradient(180deg, #0fbf74, #079a61);
  color: #061018;
}

.modern-admin-btn:hover {
  color: #061018;
  border-color: rgba(0, 236, 145, 0.62);
  filter: brightness(1.04);
}

.modern-logout-btn {
  cursor: pointer;
  color: #f8b4b4;
  border-color: rgba(239, 68, 68, 0.24);
  background: rgba(127, 29, 29, 0.18);
}

.modern-logout-btn:hover {
  color: #fecaca;
  border-color: rgba(248, 113, 113, 0.46);
  background: rgba(127, 29, 29, 0.28);
}

.modern-section-picker {
  position: relative;
  margin-bottom: 14px;
}

.modern-select {
  width: 100%;
  height: 52px;
  padding: 0 18px;
  border-radius: 12px;
  border: 1px solid rgba(140, 169, 192, 0.12);
  background: #0c1d30;
  color: #f4f8fb;
  font-size: 16px;
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.modern-status-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 14px;
  margin-bottom: 10px;
}

.modern-status-strip .status-badge {
  display: none;
}

.modern-status-dot {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: #f5f7fb;
}

.modern-intro {
  color: #b4c8d8;
  font-size: 16px;
  margin-bottom: 14px;
}

.modern-pill-warn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 0 14px;
  margin-bottom: 18px;
  border-radius: 999px;
  border: 1px solid rgba(236, 186, 67, 0.68);
  background: rgba(236, 186, 67, 0.09);
  color: #ffd86f;
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.modern-pill-warn::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
}

.is-admin-user .modern-pill-warn {
  border-color: rgba(0, 218, 129, 0.52);
  background: rgba(0, 178, 113, 0.1);
  color: #23e58f;
}

.modern-hero-card,
.modern-card,
.modern-step-card,
.modern-stat-card {
  border: 1px solid rgba(130, 163, 190, 0.16);
  background: #102235;
  border-radius: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03), 0 18px 40px rgba(0, 0, 0, 0.18);
}

.modern-hero-card {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 16px 16px;
  margin-bottom: 16px;
  border-color: rgba(233, 193, 65, 0.38);
  background:
    linear-gradient(135deg, rgba(9, 38, 44, 0.88), rgba(18, 34, 53, 0.96)),
    #102235;
}

.modern-hero-card h1 {
  font-size: clamp(24px, 4vw, 28px);
  line-height: 1.1;
  letter-spacing: 0;
  margin: 0 0 16px;
}

.modern-hero-card p {
  color: #b4c8d8;
  max-width: 690px;
  font-size: 16px;
  line-height: 1.35;
}

.modern-access-badge {
  align-self: flex-start;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(0, 218, 129, 0.26);
  background: rgba(0, 178, 113, 0.12);
  color: #00e684;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.modern-access-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #00e684;
}

.modern-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.modern-actions .btn,
.modern-form .btn {
  min-width: 152px;
  min-height: 42px;
  border-radius: 9px;
  font-weight: 900;
}

.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 16px;
}

.quick-action-tile {
  appearance: none;
  display: flex;
  min-height: 66px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid rgba(130, 163, 190, 0.16);
  border-radius: 12px;
  background: #102235;
  color: #f4f8fb;
  text-align: left;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03), 0 14px 28px rgba(0, 0, 0, 0.14);
}

.quick-action-tile:hover,
.quick-action-tile:focus-visible {
  border-color: rgba(0, 218, 129, 0.42);
  background: #12283d;
  outline: none;
}

.quick-action-tile span {
  color: #9fc5df;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

.quick-action-tile strong {
  color: #f4f8fb;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.15;
}

.portal-page-modern .btn-primary {
  background: linear-gradient(180deg, #08bd73, #079a61);
  color: #fff;
}

.portal-page-modern .btn-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #10ce83, #08a96b);
  color: #fff;
}

.portal-page-modern .btn-outline {
  border-color: rgba(145, 174, 198, 0.18);
  background: #102235;
  color: #f4f8fb;
}

.portal-page-modern .btn-outline:hover:not(:disabled) {
  border-color: rgba(0, 214, 127, 0.42);
  background: rgba(0, 176, 113, 0.12);
}

.modern-steps {
  display: grid;
  gap: 16px;
  margin-bottom: 16px;
}

.modern-step-card {
  padding: 18px 16px;
}

.modern-step-number {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: linear-gradient(135deg, #12c77a, #039d68);
  color: #fff;
  font-weight: 900;
  margin-bottom: 16px;
}

.modern-step-card h2,
.modern-card h2 {
  font-size: 20px;
  line-height: 1.15;
  margin: 0 0 6px;
  letter-spacing: 0;
}

.modern-step-card p,
.modern-card p {
  color: #aac1d2;
  font-size: 16px;
  line-height: 1.35;
}

.modern-card {
  padding: 18px 16px;
  margin-bottom: 16px;
}

.modern-form-card {
  padding: 18px 16px 20px;
}

.modern-form-head {
  display: flex;
  max-width: 720px;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

.modern-form-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  flex: 0 0 44px;
  border-radius: 12px;
  border: 1px solid rgba(0, 218, 129, 0.22);
  color: #1bd47b;
  background: rgba(0, 178, 113, 0.1);
}

.modern-form-icon svg {
  width: 22px;
  height: 22px;
}

.modern-form-title {
  min-width: 0;
}

.modern-form-title h2 {
  margin-bottom: 4px;
}

.modern-form-title p {
  max-width: 540px;
}

.modern-form {
  gap: 14px;
}

.modern-form input,
.modern-form select,
.modern-form textarea,
.portal-page-modern input[type="text"],
.portal-page-modern input[type="email"],
.portal-page-modern input[type="password"],
.portal-page-modern input[type="date"],
.portal-page-modern input[type="number"],
.portal-page-modern select,
.portal-page-modern textarea {
  min-height: 44px;
  border-radius: 10px;
  border-color: rgba(145, 174, 198, 0.18);
  background: #091925;
  color: #f4f8fb;
}

.portal-page-modern input:focus,
.portal-page-modern select:focus,
.portal-page-modern textarea:focus {
  border-color: rgba(0, 218, 129, 0.58);
  box-shadow: 0 0 0 3px rgba(0, 218, 129, 0.12);
}

.portal-page-modern .form-group label {
  color: #9fb9cb;
  font-weight: 800;
}

.modern-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.modern-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.modern-products-section {
  scroll-margin-top: 18px;
}

.product-catalog-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  align-items: stretch;
}

/* Tarjeta */
.product-card {
  display: flex;
  flex-direction: column;
  padding: 22px;
  border: 1px solid rgba(120, 170, 220, 0.16);
  border-radius: 18px;
  background: rgba(6, 24, 39, 0.72);
  min-height: 100%;
}

/* Header: título izquierda, badge derecha */
.product-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.product-title {
  color: #f4f8fb;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
  margin: 0;
  text-align: left;
}

/* Descripción */
.product-description {
  color: rgba(205, 232, 255, 0.9);
  font-size: 14px;
  line-height: 1.5;
  margin: 0 0 18px;
  text-align: left;
  max-width: 100%;
}

/* Highlights */
.product-highlights {
  list-style: none;
  padding: 0;
  margin: 0 0 22px;
  display: grid;
  gap: 8px;
}

.product-highlights li {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #d7ecff;
  font-size: 14px;
  line-height: 1.4;
  text-align: left;
}

.product-check {
  color: #4fc38a;
  font-size: 13px;
  flex-shrink: 0;
}

/* Zona de acciones — empuja al fondo */
.product-actions {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

/* Botón principal */
.product-primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 18px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
}

/* Toggle secundario */
.product-toggle {
  appearance: none;
  border: 0;
  background: transparent;
  color: #8ed4ff;
  font-size: 14px;
  font-weight: 600;
  padding: 0;
  cursor: pointer;
  text-align: left;
  transition: color 0.18s;
}

.product-toggle:hover {
  color: #b8e6ff;
}

/* Caja desplegable */
.product-details {
  margin-top: 14px;
  padding: 16px;
  border: 1px solid rgba(120, 170, 220, 0.16);
  border-radius: 14px;
  background: rgba(4, 18, 30, 0.38);
  width: 100%;
}

.product-details[hidden] {
  display: none;
}

.product-details h4 {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.2;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #dceeff;
  text-align: left;
}

.product-details ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.product-details li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 14px;
  line-height: 1.4;
  color: rgba(215, 236, 255, 0.92);
  text-align: left;
}

.product-note {
  margin: 14px 0 0;
  font-size: 13px;
  line-height: 1.45;
  color: rgba(190, 220, 245, 0.75);
  text-align: left;
}

.product-disclaimer,
.risk-note {
  color: #8fa8bb;
  font-size: 12px;
  line-height: 1.5;
  text-align: left;
}

.community-panel {
  display: grid;
  gap: 16px;
  width: 100%;
  padding-top: 2px;
}

.community-panel h2 {
  margin: 0 0 4px;
}

.community-panel p {
  max-width: 680px;
  margin: 0;
  line-height: 1.5;
}

.community-panel .btn {
  width: 100%;
  min-height: 42px;
  border-radius: 8px;
}

.community-panel .alert {
  margin: 0;
}

.status-available,
.status-soon {
  border-color: rgba(145, 174, 198, 0.24);
  background: rgba(145, 174, 198, 0.1);
  color: #b9d0df;
}

.status-needs_more_info,
.status-payment {
  border-color: rgba(233, 193, 65, 0.34);
  background: rgba(233, 193, 65, 0.12);
  color: #f1d374;
}

.modern-stat-card {
  padding: 16px;
}

.modern-stat-card span {
  display: block;
  color: #8fa8bb;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.modern-stat-card strong {
  display: block;
  font-size: 16px;
  line-height: 1.2;
}

.modern-stat-card .summary-main,
.modern-stat-card .summary-sub {
  display: block;
  text-transform: none;
  letter-spacing: 0;
  margin: 0;
}

.modern-stat-card .summary-main {
  color: #f4f8fb;
  font-size: 18px;
  font-weight: 900;
  line-height: 1.15;
}

.modern-stat-card .summary-main.is-muted {
  color: #b4c8d8;
  font-size: 14px;
}

.modern-stat-card .summary-sub {
  color: #8fa8bb;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
  margin-top: 5px;
}

.modern-inner-form {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(145, 174, 198, 0.14);
}

.modern-profile-card {
  margin-top: 16px;
}

.profile-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0;
}

.profile-summary-item,
.profile-form-panel {
  border: 1px solid rgba(145, 174, 198, 0.14);
  border-radius: 14px;
  background: rgba(9, 25, 37, 0.54);
}

.profile-summary-item {
  padding: 16px;
}

.profile-summary-item span {
  display: block;
  color: #8fa8bb;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.profile-summary-item strong {
  display: block;
  color: #f4f8fb;
  font-size: 15px;
  overflow-wrap: anywhere;
}

.profile-forms-grid {
  align-items: start;
}

.profile-form-panel {
  padding: 18px;
}

.profile-form-panel h3 {
  margin: 0 0 6px;
  color: #f4f8fb;
  font-size: 18px;
  line-height: 1.2;
}

.profile-form-panel p {
  margin: 0;
  color: #91aabd;
  font-size: 14px;
  line-height: 1.4;
}

.dashboard-desktop-sidebar {
  display: none;
}

.portal-page-modern .request-item {
  border-bottom-color: rgba(145, 174, 198, 0.12);
}

.portal-page-modern .empty-state {
  color: #91aabd;
  text-align: left;
  padding: 12px 0 0;
}

@media (max-width: 760px) {
  .modern-dashboard-shell {
    padding: 26px 14px 52px;
  }

  .modern-topbar {
    align-items: flex-start;
  }

  .modern-site-btn {
    flex: 0 0 auto;
  }

  .modern-hero-card {
    flex-direction: column;
  }

  .modern-access-badge {
    order: -1;
  }

  .modern-grid-2,
  .modern-grid-4 {
    grid-template-columns: 1fr;
  }

  .quick-actions-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .modern-actions .btn,
  .modern-form .btn {
    width: 100%;
  }

  .modern-form-head {
    flex-direction: column;
  }
}

/* ── Responsive portal hardening ───────────────────────────── */
html {
  overflow-x: hidden;
  scroll-padding-top: 24px;
}

body {
  overflow-x: hidden;
}

img,
svg,
video {
  max-width: 100%;
}

.portal-page-modern {
  min-width: 320px;
}

.modern-dashboard-shell {
  width: min(100% - 32px, 960px);
  padding-top: clamp(24px, 4vw, 44px);
  padding-bottom: max(56px, env(safe-area-inset-bottom));
}

.modern-card,
.modern-hero-card,
.modern-step-card,
.modern-stat-card,
.auth-card,
.card,
.modal-card {
  max-width: 100%;
}

.modern-hero-card,
.modern-card,
.modern-step-card {
  border-radius: clamp(12px, 1.6vw, 16px);
}

.modern-grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.modern-grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.modern-form .form-row,
.portal-page-modern .form-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.modern-form input,
.modern-form select,
.modern-form textarea {
  min-width: 0;
}

.modern-actions {
  align-items: stretch;
}

.modern-actions .btn {
  flex: 0 1 auto;
}

.request-item,
.download-item,
.field-row {
  min-width: 0;
}

.request-product,
.request-label,
.field-value,
.download-info {
  min-width: 0;
  overflow-wrap: anywhere;
}

.table-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-lg);
}

.admin-table {
  min-width: 760px;
}

.admin-table td,
.admin-table th {
  white-space: nowrap;
}

.admin-table td:nth-child(2),
.admin-table td:nth-child(4) {
  white-space: normal;
  min-width: 150px;
}

@media (min-width: 1280px) {
  .modern-dashboard-shell {
    width: min(100% - 96px, 1280px);
  }

  .modern-hero-card,
  .modern-card {
    padding: 28px 30px;
  }

  .modern-step-card {
    padding: 24px 22px;
  }

  .modern-steps {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch;
  }

  .modern-step-card {
    min-height: 156px;
  }

  .modern-hero-card h1 {
    font-size: 30px;
  }

  .modern-form-card {
    padding: 30px;
  }

  .auth-container {
    max-width: 440px;
  }
}

@media (min-width: 981px) {
  .portal-page-modern {
    --dashboard-sidebar-w: 280px;
  }

  .modern-dashboard-shell {
    width: min(calc(100% - var(--dashboard-sidebar-w) - 64px), 1320px);
    margin-left: calc(var(--dashboard-sidebar-w) + 32px);
    margin-right: 32px;
    padding-top: 34px;
  }

  .dashboard-desktop-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    width: var(--dashboard-sidebar-w);
    display: flex;
    flex-direction: column;
    padding: 24px 18px;
    background:
      linear-gradient(180deg, rgba(10, 32, 42, 0.96), rgba(7, 17, 26, 0.98)),
      #081520;
    border-right: 1px solid rgba(130, 163, 190, 0.16);
    box-shadow: 18px 0 44px rgba(0, 0, 0, 0.18);
    overflow-y: auto;
  }

  .dashboard-sidebar-logo {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 4px 2px 22px;
    border-bottom: 1px solid rgba(145, 174, 198, 0.12);
  }

  .dashboard-sidebar-logo .sidebar-brand-lockup {
    gap: 12px;
  }

  .dashboard-sidebar-logo .sidebar-brand-mark {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
  }

  .dashboard-sidebar-logo .logo-text {
    color: #f4f8fb;
    font-size: 22px;
    font-weight: 900;
    letter-spacing: 0;
  }

  .dashboard-sidebar-logo .logo-accent {
    color: #18d984;
  }

  .dashboard-sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 0;
    border-bottom: 1px solid rgba(145, 174, 198, 0.12);
    min-width: 0;
  }

  .dashboard-sidebar-user > div:last-child {
    min-width: 0;
  }

  .dashboard-sidebar-user .modern-user-name,
  .dashboard-sidebar-user .modern-user-status {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .dashboard-sidebar-nav {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    gap: 8px;
    padding: 22px 0;
  }

  .dashboard-nav-item {
    min-height: 46px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 14px;
    border: 1px solid transparent;
    border-radius: 12px;
    color: #a9c4d6;
    background: transparent;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0;
    transition: transform var(--transition), border-color var(--transition), background var(--transition), color var(--transition);
  }

  .dashboard-nav-item span {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    border: 1px solid rgba(145, 174, 198, 0.16);
    background: rgba(146, 178, 205, 0.08);
    color: #23e58f;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.04em;
  }

  .dashboard-nav-item:hover,
  .dashboard-nav-item.active {
    border-color: rgba(0, 218, 129, 0.26);
    background: rgba(0, 178, 113, 0.12);
    color: #f4fff9;
  }

  .dashboard-nav-item:hover {
    transform: translateX(2px);
  }

  .dashboard-sidebar-footer {
    display: grid;
    gap: 10px;
    padding-top: 18px;
    border-top: 1px solid rgba(145, 174, 198, 0.12);
  }

  .dashboard-sidebar-footer .modern-site-btn {
    width: 100%;
    min-height: 42px;
  }

  .modern-dashboard-shell > .modern-topbar,
  .modern-dashboard-shell > .modern-section-picker,
  .modern-dashboard-shell > .modern-status-strip {
    display: none;
  }
}

@media (max-width: 1180px) {
  :root {
    --sidebar-w: 216px;
  }

  .main-content {
    padding-left: 24px;
    padding-right: 24px;
  }

  .admin-table {
    min-width: 820px;
  }
}

@media (max-width: 980px) {
  .modern-dashboard-shell {
    width: min(100% - 28px, 820px);
    padding-top: 28px;
  }

  .modern-grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .modern-grid-2 {
    grid-template-columns: 1fr;
  }

  .modern-hero-card {
    align-items: flex-start;
  }

  .modern-hero-card h1 {
    font-size: 26px;
  }

  .modern-hero-card p,
  .modern-step-card p,
  .modern-card p {
    font-size: 15px;
  }

  .sidebar {
    width: 210px;
  }

  .main-content {
    margin-left: 210px;
    max-width: calc(100vw - 210px);
    padding: 0 22px 52px;
  }

  .section-header {
    align-items: flex-start;
    gap: 12px;
  }
}

@media (max-width: 820px) {
  .auth-page {
    align-items: flex-start;
    padding: max(22px, env(safe-area-inset-top)) 18px max(28px, env(safe-area-inset-bottom));
  }

  .auth-container {
    max-width: 480px;
  }

  .auth-card {
    padding: 32px 26px;
  }

  #admin-content {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
  }

  .admin-page .sidebar {
    position: static;
    width: 100%;
    display: flex;
    padding: 18px 14px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .admin-page .sidebar-logo {
    padding: 0 4px 14px;
    border-bottom: 0;
  }

  .admin-page .sidebar-nav {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    gap: 8px;
    overflow-x: auto;
    padding: 0 0 10px;
    scrollbar-width: thin;
  }

  .admin-page .nav-item {
    min-height: 40px;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    white-space: nowrap;
  }

  .admin-page .nav-item:hover,
  .admin-page .nav-item.active {
    border-left: 1px solid var(--green-border);
    padding-left: 12px;
  }

  .admin-page .sidebar-footer {
    padding: 12px 4px 0;
    border-top: 1px solid var(--border);
  }

  .admin-page .main-content {
    margin-left: 0;
    max-width: 100%;
    padding: 0 16px 44px;
  }

  .admin-page .portal-header {
    padding: 20px 0;
    margin-bottom: 22px;
  }

  .admin-title {
    font-size: 20px;
  }

  .search-input {
    width: 100%;
  }

  .section-header {
    flex-direction: column;
  }
}

@media (max-width: 680px) {
  .modern-dashboard-shell {
    width: min(100% - 24px, 560px);
    padding-top: 22px;
  }

  .modern-topbar {
    align-items: stretch;
    gap: 12px;
  }

  .modern-topbar-actions {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  .modern-user {
    flex: 1 1 auto;
  }

  .modern-user-name {
    font-size: 15px;
  }

  .modern-user-status {
    font-size: 12px;
  }

  .modern-site-btn {
    min-width: 116px;
    padding: 0 12px;
  }

  .modern-select {
    height: 50px;
    font-size: 15px;
  }

  .modern-intro {
    font-size: 15px;
    line-height: 1.45;
  }

  .modern-hero-card,
  .modern-form-head {
    flex-direction: column;
  }

  .modern-access-badge {
    order: -1;
  }

  .modern-actions .btn,
  .modern-form .btn {
    width: 100%;
    min-width: 0;
  }

  .modern-grid-4,
  .modern-grid-2,
  .quick-actions-grid,
  .product-catalog-grid,
  .profile-summary,
  .modern-form .form-row,
  .portal-page-modern .form-row,
  .form-row,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .product-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .modern-hero-card h1 {
    font-size: 24px;
  }

  .modern-card h2,
  .modern-step-card h2 {
    font-size: 19px;
  }

  .field-row,
  .download-item,
  .request-item {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .field-label {
    min-width: 0;
  }

  .download-item .btn {
    width: 100%;
  }

  .download-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 480px) {
  body {
    font-size: 14px;
  }

  .auth-page {
    padding-left: 12px;
    padding-right: 12px;
  }

  .auth-card {
    padding: 26px 18px;
    border-radius: 16px;
  }

  .auth-title {
    font-size: 20px;
  }

  .auth-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 4px 8px;
  }

  .modern-dashboard-shell {
    width: min(100% - 20px, 420px);
    padding-top: 18px;
  }

  .modern-topbar {
    flex-wrap: wrap;
  }

  .modern-site-btn {
    width: 100%;
    min-height: 42px;
  }

  .modern-topbar-actions {
    width: 100%;
  }

  .modern-avatar {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
    font-size: 13px;
  }

  .modern-hero-card,
  .modern-card,
  .modern-step-card,
  .modern-stat-card {
    padding: 16px;
  }

  .modern-hero-card h1 {
    font-size: 22px;
  }

  .modern-hero-card p,
  .modern-step-card p,
  .modern-card p {
    font-size: 14px;
  }

  .modern-pill-warn,
  .modern-access-badge {
    width: 100%;
    justify-content: center;
  }

  .modern-step-number {
    width: 32px;
    height: 32px;
  }

  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="date"],
  input[type="number"],
  select,
  textarea {
    font-size: 16px;
  }

  .modal-overlay {
    align-items: flex-start;
    padding: 12px;
    overflow-y: auto;
  }

  .modal-card {
    padding: 22px 18px;
    border-radius: 16px;
  }

  .admin-page .main-content {
    padding-left: 12px;
    padding-right: 12px;
  }

  .admin-table {
    min-width: 720px;
  }
}

@media (max-width: 360px) {
  .modern-dashboard-shell {
    width: min(100% - 16px, 344px);
  }

  .modern-hero-card,
  .modern-card,
  .modern-step-card,
  .modern-stat-card,
  .auth-card {
    padding-left: 14px;
    padding-right: 14px;
  }

  .btn {
    padding-left: 14px;
    padding-right: 14px;
  }
}

/* ── Download actions (setfile / guide / instrucciones) ───── */
.download-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.btn-secondary {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--bg-hover);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.btn-outline:hover {
  border-color: var(--text-muted);
}

.instructions-accordion {
  margin-top: 4px;
  margin-bottom: 8px;
  padding: 16px 20px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.instructions-accordion table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 12px;
}

.instructions-accordion th,
.instructions-accordion td {
  text-align: left;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
}

/* ── Modern admin panel ───────────────────────────────────── */
.admin-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% -12%, rgba(0, 185, 122, 0.16), transparent 34rem),
    linear-gradient(180deg, #071620 0%, #071d1f 18%, #07101a 48%, #061018 100%);
  color: #f4f8fb;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.admin-page #admin-content {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

.admin-page .sidebar {
  width: 280px;
  padding: 24px 18px;
  background:
    linear-gradient(180deg, rgba(10, 32, 42, 0.96), rgba(7, 17, 26, 0.98)),
    #081520;
  border-right: 1px solid rgba(130, 163, 190, 0.16);
  box-shadow: 18px 0 44px rgba(0, 0, 0, 0.18);
}

.admin-page .sidebar-logo {
  padding: 4px 2px 26px;
  border-bottom: 1px solid rgba(145, 174, 198, 0.12);
  gap: 10px;
}

.admin-page .logo-text {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0;
}

.admin-page .logo-accent {
  color: #18d984;
}

.admin-page .admin-badge {
  width: fit-content;
  border-radius: 999px;
  border: 1px solid rgba(0, 218, 129, 0.34);
  background: rgba(0, 178, 113, 0.12);
  color: #22e68f;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.admin-page .sidebar-nav {
  padding: 22px 0;
  gap: 8px;
}

.admin-page .nav-item {
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: #a9c4d6;
  background: transparent;
  font-size: 0;
  font-weight: 800;
  letter-spacing: 0;
  transition: transform var(--transition), border-color var(--transition), background var(--transition), color var(--transition);
}

.admin-page .nav-item:hover,
.admin-page .nav-item.active {
  padding-left: 14px;
  border-left: 1px solid rgba(0, 218, 129, 0.36);
  border-color: rgba(0, 218, 129, 0.26);
  background: rgba(0, 178, 113, 0.12);
  color: #f4fff9;
}

.admin-page .nav-item:hover {
  transform: translateX(2px);
}

.admin-page .nav-item::before {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin-right: 2px;
  border-radius: 9px;
  border: 1px solid rgba(145, 174, 198, 0.16);
  background: rgba(146, 178, 205, 0.08);
  color: #23e58f;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.admin-page .nav-item[data-tab="users"]::before { content: "US"; }
.admin-page .nav-item[data-tab="requests"]::before { content: "SL"; }
.admin-page .nav-item[data-tab="licenses"]::before { content: "LC"; }
.admin-page .nav-item[data-tab="mt5"]::before { content: "M5"; }
.admin-page .nav-item[href="../dashboard/"]::before { content: "DB"; }

.admin-page .nav-item::after {
  font-size: 14px;
}

.admin-page .nav-item[data-tab="users"]::after { content: "Usuarios"; }
.admin-page .nav-item[data-tab="requests"]::after { content: "Solicitudes"; }
.admin-page .nav-item[data-tab="licenses"]::after { content: "Licencias"; }
.admin-page .nav-item[data-tab="mt5"]::after { content: "Cambios MT5"; }
.admin-page .nav-item[href="../dashboard/"]::after { content: "Dashboard"; }

.admin-page .sidebar-footer {
  padding: 18px 2px 0;
  border-top: 1px solid rgba(145, 174, 198, 0.12);
  color: #8fa8bb;
}

.admin-page .sidebar-footer strong {
  color: #cfe4f1;
}

.admin-page .sidebar-footer .btn {
  min-height: 42px;
  border-radius: 10px;
}

.admin-page .main-content {
  width: min(100% - 280px, 1320px);
  max-width: none;
  margin-left: 280px;
  padding: 34px 48px 72px;
}

.admin-page .portal-header {
  align-items: flex-start;
  gap: 18px;
  padding: 0 0 28px;
  margin-bottom: 28px;
  border-bottom: 1px solid rgba(145, 174, 198, 0.14);
}

.admin-header-copy {
  min-width: 0;
}

.admin-eyebrow {
  display: block;
  margin-bottom: 8px;
  color: #22e68f;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.admin-page .admin-title {
  margin: 0;
  font-size: clamp(28px, 2.8vw, 38px);
  line-height: 1.05;
  font-weight: 900;
  letter-spacing: 0;
}

.admin-subtitle {
  max-width: 660px;
  margin: 10px 0 0;
  color: #a9c4d6;
  font-size: 15px;
  line-height: 1.45;
}

.admin-page .section {
  padding: 0;
}

.admin-page .section-header {
  display: grid;
  grid-template-columns: minmax(220px, 0.34fr) minmax(320px, 1fr);
  align-items: center;
  gap: 22px;
  margin-bottom: 18px;
}

.admin-page .section-title {
  margin: 0;
  color: #f4f8fb;
  font-size: 21px;
  font-weight: 900;
  line-height: 1.2;
}

.admin-page .search-input {
  width: 100%;
  height: 46px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid rgba(145, 174, 198, 0.18);
  background: #091925;
  color: #f4f8fb;
  font-size: 14px;
}

.admin-page .search-input:focus {
  border-color: rgba(0, 218, 129, 0.58);
  box-shadow: 0 0 0 3px rgba(0, 218, 129, 0.12);
}

.admin-page .table-wrapper,
.admin-page #create-license-form-wrapper {
  border: 1px solid rgba(130, 163, 190, 0.16);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(9, 38, 44, 0.64), rgba(18, 34, 53, 0.94)),
    #102235;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03), 0 18px 40px rgba(0, 0, 0, 0.18);
}

.admin-page .table-wrapper {
  padding: 10px 14px;
}

.admin-page .admin-table {
  min-width: 900px;
  border-collapse: separate;
  border-spacing: 0;
}

.admin-page .admin-table th {
  padding: 14px 14px;
  border-bottom: 1px solid rgba(145, 174, 198, 0.14);
  color: #84a4b9;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.admin-page .admin-table td {
  padding: 16px 14px;
  border-bottom: 1px solid rgba(145, 174, 198, 0.1);
  color: #f4f8fb;
}

.admin-page .admin-table tbody tr:last-child td {
  border-bottom: 0;
}

.admin-page .admin-table tr:hover td {
  background: rgba(146, 178, 205, 0.06);
}

.admin-page .role-badge,
.admin-page .status-badge {
  border-radius: 999px;
  padding: 6px 10px;
  font-weight: 900;
}

.admin-page .select-sm {
  min-height: 36px;
  border-radius: 9px;
  border-color: rgba(145, 174, 198, 0.18);
  background: #091925;
  color: #f4f8fb;
  font-weight: 800;
}

.admin-page #create-license-form-wrapper {
  padding: 24px;
  margin-bottom: 20px;
}

.admin-page .card-title {
  color: #f4f8fb;
  font-size: 20px;
  font-weight: 900;
}

@media (max-width: 1180px) {
  .admin-page .sidebar {
    width: 240px;
  }

  .admin-page .main-content {
    width: calc(100% - 240px);
    margin-left: 240px;
    padding-left: 28px;
    padding-right: 28px;
  }
}

@media (max-width: 820px) {
  .admin-page #admin-content {
    display: flex;
    flex-direction: column;
  }

  .admin-page .sidebar {
    position: static;
    width: 100%;
    padding: 18px 16px 10px;
    border-right: 0;
    border-bottom: 1px solid rgba(130, 163, 190, 0.16);
  }

  .admin-page .sidebar-logo {
    padding-bottom: 14px;
  }

  .admin-page .sidebar-nav {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    gap: 8px;
    overflow-x: auto;
    padding: 12px 0;
  }

  .admin-page .nav-item {
    white-space: nowrap;
  }

  .admin-page .sidebar-footer {
    padding-top: 12px;
  }

  .admin-page .main-content {
    width: 100%;
    margin-left: 0;
    padding: 24px 16px 56px;
  }

  .admin-page .portal-header,
  .admin-page .section-header {
    grid-template-columns: 1fr;
  }

  .admin-page .portal-header {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .admin-page .main-content {
    padding-left: 12px;
    padding-right: 12px;
  }

  .admin-page .table-wrapper {
    padding: 8px;
  }

  .admin-page .admin-table {
    min-width: 780px;
  }
}

/* ── Legacy activation rows (kept for compat) ── */
.activation-list { display: grid; gap: 8px; margin: 10px 0; }
.activation-row {
  display: grid;
  grid-template-columns: minmax(80px, 1fr) minmax(120px, 1.2fr) auto minmax(110px, 1fr);
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255,255,255,0.03);
  font-size: 13px;
}
@media (max-width: 720px) {
  .activation-row { grid-template-columns: 1fr; }
}

/* ── License v2 ── */
.license-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.license-plan-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.plan-lifetime      { background: rgba(255,215,0,.15); color: #f5c842; border: 1px solid rgba(255,215,0,.3); }
.plan-tickmill_free   { background: rgba(100,200,255,.12); color: #5bc8f5; border: 1px solid rgba(100,200,255,.25); }
.plan-tickmill_access { background: rgba(59,130,246,.15);  color: #60a5fa; border: 1px solid rgba(59,130,246,.3);  }
.plan-community     { background: rgba(147,51,234,.16); color: #d8b4fe; border: 1px solid rgba(168,85,247,.55); }
.plan-subscription  { background: rgba(100,255,150,.12); color: #5ef5a0; border: 1px solid rgba(100,255,150,.25); }
.plan-trial         { background: rgba(200,150,255,.12); color: #c89cf5; border: 1px solid rgba(200,150,255,.25); }
.plan-manual        { background: rgba(200,200,200,.1);  color: #aaa;    border: 1px solid rgba(200,200,200,.2);  }

.license-slots { font-weight: 700; font-size: 1.05em; }
.license-slots.at-limit { color: #f5a623; }

.pending-badge {
  font-size: 11px;
  background: rgba(245,166,35,.2);
  color: #f5a623;
  border: 1px solid rgba(245,166,35,.35);
  border-radius: 20px;
  padding: 2px 8px;
  font-weight: 600;
  margin-left: 6px;
}

.plan-desc { margin: 8px 0 12px; line-height: 1.5; }

/* MT5 account rows */
.mt5-section { margin-top: 12px; }
.mt5-section-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  opacity: .55;
  margin-bottom: 6px;
}
.mt5-section-sub {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  opacity: .45;
  margin: 12px 0 4px;
}
.mt5-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.03);
  margin-bottom: 6px;
  font-size: 13px;
}
.mt5-row.mt5-pending { border-color: rgba(245,166,35,.3); background: rgba(245,166,35,.05); }
.mt5-row.mt5-history-row { opacity: .6; }
.mt5-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mt5-info strong { font-size: 14px; }
.mt5-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.mt5-history { margin-top: 12px; border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; }
.mt5-history summary { font-size: 12px; opacity: .6; cursor: pointer; padding: 2px 0; }
.mt5-history summary:hover { opacity: .9; }

/* ── MT5 WebRequest instructions card ─────────────────────── */
.mt5-webrequest-card {
  display: grid;
  gap: 20px;
  margin-top: 24px;
  padding: 24px;
  border: 1px solid rgba(130, 163, 190, 0.16);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(9, 38, 44, 0.88), rgba(18, 34, 53, 0.96)),
              #102235;
}

.mt5-webrequest-content .eyebrow {
  display: block;
  margin-bottom: 8px;
  color: #22e68f;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.mt5-webrequest-content h3 {
  margin: 0 0 12px;
  color: #f4f8fb;
  font-size: 20px;
  font-weight: 900;
  line-height: 1.2;
}

.mt5-webrequest-content > p {
  color: #b4c8d8;
  font-size: 15px;
  line-height: 1.5;
  margin: 0 0 16px;
}

.mt5-webrequest-steps {
  list-style: none;
  counter-reset: mt5-step;
  padding: 0;
  margin: 0 0 20px;
  display: grid;
  gap: 10px;
}

.mt5-webrequest-steps li {
  counter-increment: mt5-step;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  color: #d7ecff;
  font-size: 14px;
  line-height: 1.5;
}

.mt5-webrequest-steps li::before {
  content: counter(mt5-step);
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: linear-gradient(135deg, #12c77a, #039d68);
  color: #fff;
  font-weight: 900;
  font-size: 12px;
}

.mt5-webrequest-url {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid rgba(145, 174, 198, 0.18);
  border-radius: 10px;
  background: #091925;
  margin-bottom: 16px;
}

.mt5-webrequest-url code {
  color: #4fc38a;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 14px;
  letter-spacing: 0.3px;
}

.copy-webrequest-url-btn {
  appearance: none;
  border: 1px solid rgba(0, 218, 129, 0.34);
  border-radius: 8px;
  background: rgba(0, 178, 113, 0.12);
  color: #22e68f;
  font-size: 13px;
  font-weight: 700;
  padding: 5px 12px;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s;
  white-space: nowrap;
}

.copy-webrequest-url-btn:hover {
  background: rgba(0, 178, 113, 0.22);
  border-color: rgba(0, 218, 129, 0.56);
}

.mt5-webrequest-warning {
  color: #f5a623;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
  margin: 0;
}

.mt5-webrequest-image-link {
  display: block;
  text-decoration: none;
}

.mt5-webrequest-image {
  width: 100%;
  max-width: 520px;
  border-radius: 12px;
  border: 1px solid rgba(130, 163, 190, 0.16);
  cursor: zoom-in;
  transition: border-color 0.2s;
}

.mt5-webrequest-image:hover {
  border-color: rgba(0, 218, 129, 0.4);
}

@media (max-width: 679px) {
  .mt5-webrequest-card {
    padding: 18px;
  }

  .mt5-webrequest-url {
    flex-wrap: wrap;
  }
}

/* Small ghost danger button */
.btn-ghost-danger, .btn-xs.btn-ghost-danger {
  background: transparent;
  border: 1px solid rgba(255,80,80,.35);
  color: #f56060;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s;
}
.btn-ghost-danger:hover { background: rgba(255,80,80,.1); }

/* Modal overlay */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.65);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
  padding: 16px;
}
.modal-box {
  background: var(--surface, #1a1d23);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-header h3 { font-size: 1.1rem; font-weight: 700; margin: 0; }
.modal-close { background: none; border: none; color: var(--text-muted, #888); font-size: 18px; cursor: pointer; padding: 2px 6px; border-radius: 4px; }
.modal-close:hover { color: #fff; background: rgba(255,255,255,.1); }
.modal-body { margin-bottom: 16px; line-height: 1.6; }
.modal-form .form-group { margin-bottom: 14px; }
.modal-form label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 5px; opacity: .7; text-transform: uppercase; letter-spacing: .04em; }
.modal-form input, .modal-form select, .modal-form textarea {
  width: 100%; padding: 9px 12px; border-radius: 8px;
  border: 1px solid var(--border); background: rgba(255,255,255,.05);
  color: inherit; font-size: 14px; box-sizing: border-box;
}
.modal-form input:focus, .modal-form select:focus, .modal-form textarea:focus {
  outline: none; border-color: var(--accent, #4caf50);
}
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
.form-error { color: #f56060; font-size: 13px; margin-top: 8px; padding: 8px 12px; background: rgba(255,80,80,.08); border-radius: 6px; border: 1px solid rgba(255,80,80,.2); }
.btn-danger { background: #c0392b; color: #fff; border: none; border-radius: 8px; padding: 9px 18px; font-weight: 600; cursor: pointer; font-size: 14px; }
.btn-danger:hover { background: #e74c3c; }

/* Toast */
.portal-toast {
  position: fixed; bottom: 24px; right: 24px;
  padding: 12px 20px; border-radius: 10px;
  font-size: 14px; font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
  z-index: 10000;
  opacity: 0; transform: translateY(10px);
  transition: opacity .25s, transform .25s;
  max-width: 360px;
}
.portal-toast.toast-show { opacity: 1; transform: translateY(0); }
.portal-toast.toast-success { background: #1a3d28; border: 1px solid #2ecc71; color: #2ecc71; }
.portal-toast.toast-info    { background: #1a2d40; border: 1px solid #3498db; color: #5dade2; }
.portal-toast.toast-warning { background: #3d2e10; border: 1px solid #f39c12; color: #f5a623; }
.portal-toast.toast-error   { background: #3d1010; border: 1px solid #e74c3c; color: #f56060; }

@media (max-width: 480px) {
  .portal-toast { bottom: 16px; right: 16px; left: 16px; }
  .mt5-row { flex-direction: column; align-items: flex-start; }
  .modal-box { padding: 16px; }
}
