/* ── Portal Landing Page ──────────────────────────────────── */
.portal-landing {
  min-height: 100vh;
  background: #0a0e1a;
  color: #e2e8f0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Hero */
.portal-hero {
  padding: 80px 24px 60px;
  text-align: center;
  background: linear-gradient(135deg, #0a0e1a 0%, #1a1f3a 50%, #0a0e1a 100%);
  border-bottom: 1px solid rgba(99, 102, 241, 0.15);
}
.portal-hero-inner { max-width: 680px; margin: 0 auto; }
.portal-hero-logo { width: 80px; height: 80px; margin-bottom: 24px; border-radius: 16px; }
.portal-hero-title {
  font-size: 2.5rem; font-weight: 700; color: #fff;
  margin: 0 0 16px; letter-spacing: -0.02em;
}
.portal-hero-tagline {
  font-size: 1.15rem; color: #94a3b8; line-height: 1.6; margin: 0 0 32px;
}
.portal-hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.portal-hero-actions .btn { min-width: 160px; }

/* Pricing Section */
.portal-pricing {
  padding: 60px 24px 80px;
  max-width: 1000px;
  margin: 0 auto;
}
.portal-section-title {
  font-size: 1.75rem; font-weight: 700; color: #fff;
  text-align: center; margin: 0 0 8px;
}
.portal-section-subtitle {
  font-size: 1rem; color: #94a3b8; text-align: center; margin: 0 0 40px;
}
.portal-tier-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
}
.portal-tier-card {
  background: #111827;
  border: 1px solid #1e293b;
  border-radius: 12px;
  padding: 32px 24px;
  position: relative;
  display: flex;
  flex-direction: column;
}
.portal-tier-featured {
  border-color: #6366f1;
  box-shadow: 0 0 30px rgba(99, 102, 241, 0.15);
}
.portal-tier-badge {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  background: #6366f1; color: #fff; font-size: .75rem; font-weight: 600;
  padding: 4px 16px; border-radius: 100px;
}
.portal-tier-name {
  font-size: 1.25rem; font-weight: 600; color: #fff; margin: 0 0 16px;
}
.portal-tier-features {
  list-style: none; padding: 0; margin: 0 0 24px; flex: 1;
}
.portal-tier-features li {
  padding: 8px 0; border-bottom: 1px solid #1e293b;
  font-size: .9rem; color: #cbd5e1;
}
.portal-tier-features li::before {
  content: '✓ '; color: #22c55e; font-weight: 600;
}
.portal-tier-cta { margin-top: auto; }

/* Footer */
.portal-footer {
  padding: 24px; text-align: center; border-top: 1px solid #1e293b;
  font-size: .8rem; color: #64748b;
  display: flex; gap: 16px; justify-content: center; flex-wrap: wrap;
}
.portal-footer a { color: #64748b; text-decoration: none; }
.portal-footer a:hover { text-decoration: underline; }

/* ── Login Modal ─────────────────────────────────────────── */
.portal-modal {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
}
.portal-modal.hidden { display: none; }
.portal-modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(4px);
}
.portal-modal-content {
  position: relative; z-index: 1;
  background: #111827; border: 1px solid #1e293b; border-radius: 16px;
  padding: 40px 32px; width: 100%; max-width: 400px;
}
.portal-modal-close {
  position: absolute; top: 12px; right: 16px;
  background: none; border: none; color: #64748b; font-size: 1.5rem;
  cursor: pointer; line-height: 1;
}
.portal-modal-close:hover { color: #fff; }
.portal-login-header { text-align: center; margin-bottom: 24px; }
.portal-login-header h2 { font-size: 1.25rem; color: #fff; margin: 12px 0 0; }
.portal-login-logo { width: 48px; height: 48px; border-radius: 8px; }

/* ── Portal Nav Rail ─────────────────────────────────────── */
.portal-nav-rail {
  width: 200px;
  min-width: 200px;
  background: #0f172a;
  border-right: 1px solid #1e293b;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
}
.portal-nav-brand {
  padding: 16px; text-align: center;
  border-bottom: 1px solid #1e293b;
}
.portal-nav-logo { width: 40px; height: 40px; border-radius: 8px; }
.portal-nav-items { flex: 1; padding: 8px 0; }
.portal-nav-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 10px 16px;
  background: none; border: none; color: #94a3b8;
  font-size: .875rem; cursor: pointer; text-align: left;
  transition: background 0.15s, color 0.15s;
}
.portal-nav-item:hover { background: #1e293b; color: #e2e8f0; }
.portal-nav-item.active { background: rgba(99, 102, 241, 0.15); color: #818cf8; }
.portal-nav-icon { font-size: 1rem; width: 24px; text-align: center; }
.portal-nav-footer {
  padding: 12px 16px; border-top: 1px solid #1e293b;
  display: flex; flex-direction: column; gap: 8px; align-items: stretch;
}
.portal-tier-pill {
  display: inline-block; text-align: center;
  padding: 4px 12px; border-radius: 100px;
  font-size: .75rem; font-weight: 600;
  background: #1e293b; color: #94a3b8;
}
.badge-starter { background: #1e293b; color: #94a3b8; }
.badge-pro { background: rgba(99, 102, 241, 0.2); color: #818cf8; }
.badge-enterprise { background: rgba(234, 179, 8, 0.2); color: #eab308; }

/* ── Portal Workspace Override ───────────────────────────── */
body.portal-mode #navRail { display: none !important; }
body.portal-mode #bottomNav { display: none !important; }
body.portal-mode #workspaceShell { flex-direction: row; }

/* ── Infrastructure Manager ──────────────────────────────── */
.infra-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.infra-card table td { padding: 2px 8px 2px 0; vertical-align: top; }

/* ── Responsive: Tablet (<=900px) ────────────────────────── */
@media (max-width: 900px) {
  /* Admin tab bar: horizontal scroll */
  .admin-tab-headers {
    display: flex !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    gap: 2px;
    padding-bottom: 6px;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .admin-tab-headers::-webkit-scrollbar { display: none; }
  .admin-tab-btn {
    flex-shrink: 0;
    font-size: 11px !important;
    padding: 4px 10px !important;
    white-space: nowrap;
  }
}

/* ── Responsive: Mobile (<=768px) ────────────────────────── */
@media (max-width: 768px) {
  .portal-hero-title { font-size: 1.75rem; }
  .portal-tier-grid { grid-template-columns: 1fr; }
  .portal-nav-rail { width: 56px; min-width: 56px; }
  .portal-nav-label { display: none; }
  .portal-nav-item { justify-content: center; padding: 12px 8px; }
  .portal-tier-pill { font-size: .65rem; padding: 3px 8px; }

  /* Infrastructure: single column grid */
  .infra-grid { grid-template-columns: 1fr !important; gap: 12px !important; }

  /* Infrastructure cards */
  .infra-card { padding: 10px !important; border-radius: 8px !important; }
  .infra-card table { font-size: 12px !important; width: 100% !important; }
  .infra-card td { padding: 4px 6px 4px 0 !important; word-break: break-word; }
  .infra-card td:last-child {
    font-size: 10px !important; max-width: 120px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .infra-card .btn-sm { font-size: 11px !important; padding: 4px 8px !important; }
  .infra-card pre { max-height: 120px !important; font-size: .7rem !important; }
  .infra-card h4 { font-size: .85rem !important; flex-wrap: wrap !important; gap: 6px !important; }

  /* #adminInfraSection container */
  #adminInfraSection { padding: 12px !important; }
  #adminInfraContent > div[style*="grid"] { grid-template-columns: 1fr !important; }

  /* Access Manager */
  #adminAccessManagerSection { overflow-x: auto !important; }
  #adminAccessManagerSection table { font-size: 11px !important; }
  #adminAccessManagerSection td,
  #adminAccessManagerSection th { padding: 4px 6px !important; }

  /* Access Manager add-user form: stack */
  #amAddUserForm > div { flex-direction: column !important; }
  #amAddUserForm input,
  #amAddUserForm select { width: 100% !important; font-size: 12px !important; }

  /* Tier defaults: wrap checkboxes */
  #amTierDefaultsContent div[style*="grid"] {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)) !important;
  }

  /* Dashboard cards shared */
  .dashboard-card { padding: 12px !important; }
}

/* ── Responsive: Phone (<=480px) ─────────────────────────── */
@media (max-width: 480px) {
  /* Infrastructure: hide port + detail columns */
  .infra-card td:nth-child(2) { display: none; }
  .infra-card td:last-child { display: none !important; }

  /* Access Manager: hide columns 3+4 */
  #adminAccessManagerSection td:nth-child(3),
  #adminAccessManagerSection th:nth-child(3),
  #adminAccessManagerSection td:nth-child(4),
  #adminAccessManagerSection th:nth-child(4) { display: none; }

  /* Pending section */
  #amPendingSection table td:nth-child(3),
  #amPendingSection table th:nth-child(3) { display: none; }
}
