:root {
  --paris-blue: #005a9c;
  --paris-blue-dark: #003f73;
  --paris-indigo: #4f46e5;
  --paris-teal: #009e5a;
  --paris-bg: #f1f5f9;
  --paris-text: #1e293b;
  --paris-muted: #64748b;
  --paris-white: #ffffff;
  --paris-radius: 16px;
  --paris-shadow: 0 20px 50px rgba(15, 23, 42, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--paris-text);
  background: var(--paris-bg);
}

/* ── Auth shell ───────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  position: relative;
  overflow: hidden;
}

.auth-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  z-index: 0;
  animation: paris-float 12s ease-in-out infinite;
}

.auth-blob-1 {
  top: -12%;
  left: -8%;
  width: 420px;
  height: 420px;
  background: rgba(79, 70, 229, 0.25);
}

.auth-blob-2 {
  bottom: -15%;
  right: -10%;
  width: 480px;
  height: 480px;
  background: rgba(0, 158, 90, 0.2);
  animation-delay: -6s;
}

@keyframes paris-float {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(24px, -20px); }
}

.auth-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 480px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(14px);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: var(--paris-shadow);
  border: 1px solid rgba(255, 255, 255, 0.7);
}

.auth-card-wide {
  max-width: 720px;
}

.auth-card-header {
  background: linear-gradient(120deg, #312e81, var(--paris-blue), var(--paris-teal));
  padding: 28px 32px 24px;
  text-align: center;
  color: #fff;
}

.auth-logo-img {
  width: 52px;
  height: 52px;
  margin: 0 auto 12px;
  display: block;
  object-fit: contain;
  border-radius: 12px;
}

.auth-brand-title {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  margin: 0;
}

.auth-brand-sub {
  margin: 6px 0 0;
  font-size: 0.82rem;
  opacity: 0.82;
}

.auth-card-body {
  padding: 28px 32px 32px;
}

.auth-heading {
  text-align: center;
  margin-bottom: 22px;
}

.auth-heading h2 {
  margin: 0 0 6px;
  font-size: 1.25rem;
}

.auth-heading p {
  margin: 0;
  color: var(--paris-muted);
  font-size: 0.9rem;
}

.auth-icon-circle {
  width: 56px;
  height: 56px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: #eef2ff;
  color: var(--paris-indigo);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.field { margin-bottom: 16px; }

.field label {
  display: block;
  margin-bottom: 7px;
  font-size: 0.86rem;
  font-weight: 600;
  color: #334155;
}

.field input,
.field textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}

.field input:focus {
  outline: none;
  border-color: var(--paris-indigo);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border: none;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  transition: transform .15s, box-shadow .15s;
}

.btn-primary {
  background: linear-gradient(135deg, var(--paris-indigo), var(--paris-blue));
  color: #fff;
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.28);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(79, 70, 229, 0.35);
}

.btn-light {
  background: #f8fafc;
  color: #334155;
  border: 1px solid #cbd5e1;
}

.btn-block { width: 100%; }

.auth-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.auth-actions .btn { flex: 1; }

.otp-input {
  text-align: center;
  letter-spacing: 10px;
  font-size: 1.6rem !important;
  font-weight: 700;
}

.alert {
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 0.88rem;
}

.alert-error {
  background: #fee2e2;
  border: 1px solid #fca5a5;
  color: #991b1b;
}

.alert-success {
  background: #dcfce7;
  border: 1px solid #86efac;
  color: #166534;
}

.alert ul { margin: 0; padding-left: 18px; }

.auth-tip {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  padding: 12px 14px;
  color: #1e40af;
  font-size: 0.86rem;
  margin-bottom: 16px;
}

.auth-tip ol {
  margin: 0;
  padding-left: 18px;
}

.setup-grid {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 18px;
  align-items: start;
  margin-bottom: 18px;
}

.qr-frame {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 12px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
}

.qr-frame img {
  display: block;
  width: 100%;
  height: auto;
}

.setup-meta {
  font-size: 0.86rem;
  color: var(--paris-muted);
  word-break: break-all;
}

.setup-meta strong { color: #334155; }

.auth-footnote {
  display: block;
  margin-top: 14px;
  text-align: center;
  font-size: 0.8rem;
  color: #94a3b8;
}

.auth-back {
  display: block;
  text-align: center;
  margin-top: 16px;
  font-size: 0.86rem;
  color: var(--paris-muted);
  text-decoration: none;
}

.auth-back:hover { color: var(--paris-indigo); }

/* ── Portal shell ─────────────────────────── */
.portal-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 10% 0%, rgba(79, 70, 229, 0.08), transparent 40%),
    radial-gradient(circle at 90% 10%, rgba(0, 158, 90, 0.07), transparent 35%),
    var(--paris-bg);
}

.portal-shell {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 20px 40px;
}

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

.portal-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.portal-brand-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 10px;
  flex-shrink: 0;
}

.portal-brand-text strong {
  display: block;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
}

.portal-brand-text span {
  font-size: 0.78rem;
  color: var(--paris-muted);
}

.portal-user {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  padding: 6px 8px 6px 16px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
}

.portal-user-meta {
  text-align: right;
  line-height: 1.25;
}

.portal-user-name {
  font-size: 0.88rem;
  font-weight: 600;
}

.portal-user-role {
  font-size: 0.72rem;
  color: var(--paris-muted);
  text-transform: uppercase;
}

.portal-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--paris-teal), #14b8a6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.portal-hero {
  background: linear-gradient(120deg, #312e81, var(--paris-blue) 55%, var(--paris-teal));
  color: #fff;
  border-radius: 22px;
  padding: 28px 30px;
  margin-bottom: 24px;
  box-shadow: 0 16px 40px rgba(0, 90, 156, 0.22);
  position: relative;
  overflow: hidden;
}

.portal-hero::after {
  content: '';
  position: absolute;
  top: -30%;
  right: -5%;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
}

.portal-hero-inner {
  position: relative;
  z-index: 1;
}

.portal-hero-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  background: rgba(255,255,255,.16);
  border: 1px solid rgba(255,255,255,.25);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
}

.portal-hero h1 {
  margin: 0 0 8px;
  font-size: 1.75rem;
}

.portal-hero p {
  margin: 0;
  opacity: 0.9;
  max-width: 620px;
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 18px;
}

.app-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: var(--paris-radius);
  padding: 22px;
  transition: transform .2s, box-shadow .2s;
  display: flex;
  flex-direction: column;
}

.app-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.08);
}

.app-card-icon {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  margin-bottom: 14px;
}

.app-card-icon.spin {
  background: transparent;
  padding: 0;
  box-shadow: none;
}
.app-card-icon.monalisa {
  background: linear-gradient(135deg, #005a9c, #009e5a);
  padding: 6px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.app-card-icon.promise {
  background: linear-gradient(135deg, #0d8abc, #0369a1);
  padding: 6px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.app-card-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 10px;
}

.app-card h3 {
  margin: 0 0 6px;
  font-size: 1.15rem;
}

.app-card-tagline {
  margin: 0 0 10px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--paris-indigo);
}

.app-card p {
  margin: 0 0 18px;
  color: var(--paris-muted);
  font-size: 0.88rem;
  flex: 1;
}

.logout-card {
  text-align: center;
  max-width: 480px;
  margin: 80px auto 0;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #e2e8f0;
  border-top-color: var(--paris-indigo);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 720px) {
  .auth-card-body { padding: 22px 20px 24px; }
  .setup-grid { grid-template-columns: 1fr; }
  .qr-frame { max-width: 220px; margin: 0 auto; }
  .portal-user-meta { display: none; }
  .portal-hero h1 { font-size: 1.4rem; }
}
