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

:root {
  --portal-orange:     #f57c00;
  --portal-orange-glow:#ff9800;
  --portal-blue:       #0288d1;
  --portal-blue-glow:  #29b6f6;
  --portal-dark:       #1a1a1e;
  --portal-surface:    #23232a;
  --portal-panel:      #2c2c35;
  --portal-border:     #3a3a48;
  --portal-text:       #e8e8ec;
  --portal-muted:      #888899;
  --portal-white:      #ffffff;
  --radius:            6px;
  --nav-height:        56px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--portal-dark);
  color: var(--portal-text);
  min-height: 100vh;
}

/* ── SCANLINE texture overlay ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.04) 2px,
    rgba(0,0,0,0.04) 4px
  );
  pointer-events: none;
  z-index: 0;
}

/* ── NAV ── */
nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-height);
  background: var(--portal-surface);
  border-bottom: 2px solid var(--portal-orange);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 100;
  box-shadow: 0 0 16px rgba(245,124,0,0.25);
}

nav .brand {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--portal-orange-glow);
  text-shadow: 0 0 8px rgba(255,152,0,0.5);
}

.hamburger {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--portal-text);
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}

.nav-menu {
  position: fixed;
  top: var(--nav-height);
  right: -240px;
  width: 240px;
  height: calc(100vh - var(--nav-height));
  background: var(--portal-surface);
  border-left: 1px solid var(--portal-border);
  display: flex;
  flex-direction: column;
  padding: 16px 0;
  transition: right 0.25s ease;
  z-index: 99;
  box-shadow: -4px 0 20px rgba(0,0,0,0.4);
}
.nav-menu.open { right: 0; }

.nav-menu a {
  padding: 14px 24px;
  text-decoration: none;
  color: var(--portal-muted);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-left: 3px solid transparent;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.nav-menu a:hover {
  background: var(--portal-panel);
  border-left-color: var(--portal-blue);
  color: var(--portal-blue-glow);
}
.nav-menu a.active {
  background: var(--portal-panel);
  border-left-color: var(--portal-orange);
  color: var(--portal-orange-glow);
}

.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 98;
}
.nav-overlay.open { display: block; }

/* ── MAIN ── */
main {
  margin-top: var(--nav-height);
  padding: 24px 16px;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
  position: relative;
  z-index: 1;
}

.page { display: none; }
.page.active { display: block; }

/* ── LOGIN OVERLAY ── */
#login-overlay {
  display: none;
  position: fixed;
  inset: 0;
  /* Aperture-style dark gradient with a subtle radial glow */
  background:
    radial-gradient(ellipse at 30% 60%, rgba(2,136,209,0.12) 0%, transparent 55%),
    radial-gradient(ellipse at 70% 40%, rgba(245,124,0,0.12) 0%, transparent 55%),
    #121216;
  z-index: 200;
  align-items: center;
  justify-content: center;
}
#login-overlay.visible {
  display: flex;
}

.login-card {
  background: var(--portal-white);
  border-radius: var(--radius);
  padding: 32px 28px 28px;
  width: 100%;
  max-width: 360px;
  box-shadow:
    0 0 0 1px rgba(245,124,0,0.3),
    0 0 32px rgba(245,124,0,0.15),
    0 8px 40px rgba(0,0,0,0.6);
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}
.login-logo img {
  width: 120px;
  height: auto;
  display: inline-block;
}

.form-group {
  margin-bottom: 14px;
}
.form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 5px;
  color: #555566;
}
.form-group input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d0d0de;
  border-radius: var(--radius);
  font-size: 0.95rem;
  color: #1a1a1e;
  outline: none;
  background: #f7f7fa;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-group input:focus {
  border-color: var(--portal-orange);
  box-shadow: 0 0 0 3px rgba(245,124,0,0.15);
  background: #fff;
}

.btn {
  display: block;
  width: 100%;
  padding: 11px;
  border: none;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.98); }

.btn-primary {
  background: linear-gradient(135deg, var(--portal-orange), #e65100);
  color: #fff;
  box-shadow: 0 2px 10px rgba(245,124,0,0.35);
  margin-top: 6px;
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--portal-orange-glow), var(--portal-orange));
  box-shadow: 0 4px 16px rgba(245,124,0,0.5);
}

.error-msg {
  background: #fff3f3;
  color: #c0392b;
  border: 1px solid #f5c6c6;
  border-radius: var(--radius);
  padding: 9px 12px;
  font-size: 0.83rem;
  margin-bottom: 14px;
  display: none;
}
.error-msg.visible { display: block; }

/* ── MFA OVERLAY ── */
#mfa-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 30% 60%, rgba(2,136,209,0.12) 0%, transparent 55%),
    radial-gradient(ellipse at 70% 40%, rgba(245,124,0,0.12) 0%, transparent 55%),
    #121216;
  z-index: 200;
  align-items: center;
  justify-content: center;
}
#mfa-overlay.visible { display: flex; }

#mfa-code {
  font-size: 1.4rem;
  letter-spacing: 0.3em;
  text-align: center;
}

.btn-back {
  background: none;
  border: 1px solid #d0d0de;
  color: #555566;
  border-radius: var(--radius);
  width: 100%;
  padding: 9px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
  transition: background 0.15s;
}
.btn-back:hover { background: #f0f0f5; }

/* ── CARDS (app pages) ── */
.user-card,
.token-card,
.placeholder {
  background: var(--portal-surface);
  border-radius: var(--radius);
  border: 1px solid var(--portal-border);
  padding: 22px 24px;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}

/* orange left-accent stripe */
.user-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--portal-orange), var(--portal-blue));
}

.user-card .greeting {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--portal-text);
}
.user-card .login-type-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--portal-orange);
  color: #fff;
  margin-bottom: 18px;
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 480px) {
  .info-grid { grid-template-columns: 1fr; }
}

.info-item label {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--portal-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 3px;
}
.info-item span {
  font-size: 0.88rem;
  color: var(--portal-text);
  word-break: break-word;
}

.token-card h3 {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--portal-blue-glow);
  margin-bottom: 12px;
}
.token-times {
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
}
.token-times .time-item label {
  display: block;
  font-size: 0.7rem;
  color: var(--portal-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}
.token-times .time-item span {
  font-size: 0.88rem;
  color: var(--portal-text);
}

.groups-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.group-tag {
  background: rgba(2,136,209,0.15);
  color: var(--portal-blue-glow);
  border: 1px solid rgba(41,182,246,0.25);
  border-radius: 10px;
  padding: 2px 10px;
  font-size: 0.75rem;
  font-weight: 500;
}
.group-tag.primary {
  background: rgba(245,124,0,0.2);
  color: var(--portal-orange-glow);
  border-color: rgba(245,124,0,0.35);
}

.logout-row {
  margin-top: 4px;
  display: flex;
  justify-content: flex-end;
}
.btn-logout {
  background: none;
  border: 1px solid rgba(245,124,0,0.4);
  color: var(--portal-orange-glow);
  border-radius: var(--radius);
  padding: 8px 18px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn-logout:hover {
  background: rgba(245,124,0,0.1);
  border-color: var(--portal-orange);
}

/* ── PLACEHOLDER PAGES ── */
.placeholder {
  text-align: center;
  padding: 48px 24px;
}
.placeholder h2 {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--portal-orange-glow);
  margin-bottom: 12px;
}
.placeholder p {
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--portal-muted);
}
.placeholder code {
  font-family: monospace;
  background: rgba(255,255,255,0.06);
  border-radius: 3px;
  padding: 1px 5px;
  color: var(--portal-blue-glow);
}

#agentforce-container { margin-top: 20px; }
