/* ═══════════════════════════════════════════════════════════════
   El Chamma — Customer Portal (v2)
   ═══════════════════════════════════════════════════════════════ */

.portal-root {
  --p-navy: #0c1829;
  --p-navy-mid: #12233f;
  --p-navy-soft: #1a3354;
  --p-gold: #d4a03a;
  --p-gold-light: #f0c96b;
  --p-gold-glow: rgba(212, 160, 58, 0.35);
  --p-cream: #faf7f2;
  --p-sand: #f0ebe3;
  --p-card: #ffffff;
  --p-text: #1a2234;
  --p-ink: #1a2234;
  --p-muted: #6b7289;
  --p-border: rgba(18, 35, 63, 0.08);
  --p-shadow: 0 20px 50px -12px rgba(12, 24, 41, 0.18);
  --p-shadow-sm: 0 8px 24px -8px rgba(12, 24, 41, 0.12);
  --p-radius: 20px;
  --p-radius-sm: 14px;
  --p-font: 'Almarai', 'Segoe UI', Tahoma, sans-serif;
  --p-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --p-wa: #128c7e;
  --p-wa-soft: #e8f6f3;
}

.portal-root * { box-sizing: border-box; }

.portal-root {
  margin: 0;
  min-height: 100vh;
  font-family: var(--p-font);
  color: var(--p-text);
  background: var(--p-cream);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* ─── Login ─── */
.portal-auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

@media (max-width: 900px) {
  .portal-auth-page { grid-template-columns: 1fr; }
}

.portal-auth-brand {
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, var(--p-navy) 0%, #0a1220 45%, var(--p-navy-soft) 100%);
  color: #fff;
  padding: clamp(2rem, 5vw, 4rem);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 280px;
}

@media (max-width: 900px) {
  .portal-auth-brand { min-height: auto; padding-bottom: 3rem; }
}

.portal-auth-brand::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 100%, var(--p-gold-glow), transparent 55%),
    radial-gradient(ellipse 50% 40% at 90% 10%, rgba(255,255,255,0.06), transparent 50%);
  pointer-events: none;
}

.portal-auth-brand::after {
  content: '';
  position: absolute;
  bottom: -20%;
  left: -10%;
  width: 70%;
  height: 50%;
  background: linear-gradient(180deg, transparent, rgba(212, 160, 58, 0.08));
  border-radius: 50%;
  filter: blur(40px);
}

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

.portal-logo-mark {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 2.5rem;
}

.portal-logo-mark img {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  object-fit: cover;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}

.portal-logo-mark span {
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.portal-auth-tagline {
  font-size: clamp(1.75rem, 4vw, 2.35rem);
  font-weight: 800;
  line-height: 1.35;
  margin: 0 0 1rem;
  max-width: 18ch;
}

.portal-auth-sub {
  font-size: 1.05rem;
  opacity: 0.82;
  max-width: 32ch;
  margin: 0;
}

.portal-auth-features {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
}

.portal-auth-chip {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  backdrop-filter: blur(8px);
}

.portal-auth-form-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1.5rem, 4vw, 3rem);
  background: var(--p-cream);
}

.portal-card {
  width: 100%;
  max-width: 400px;
  background: var(--p-card);
  border-radius: var(--p-radius);
  padding: 2rem 2rem 2.25rem;
  box-shadow: var(--p-shadow);
  border: 1px solid var(--p-border);
  animation: portal-rise 0.7s var(--p-ease) both;
}

@keyframes portal-rise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.portal-card h1 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--p-navy);
  margin: 0 0 0.35rem;
}

.portal-note {
  font-size: 0.95rem;
  color: var(--p-muted);
  margin: 0 0 1.5rem;
}

.portal-back {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--p-muted);
  margin-bottom: 1.25rem;
  transition: color 0.2s;
}

.portal-back:hover { color: var(--p-gold); }

.portal-field { margin-bottom: 1.15rem; }

.portal-field label {
  display: block;
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--p-navy-mid);
  margin-bottom: 0.4rem;
}

.portal-field input {
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: var(--p-radius-sm);
  border: 1.5px solid #e2e8f0;
  font-family: inherit;
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #fafbfc;
}

.portal-field input:focus {
  outline: none;
  border-color: var(--p-gold);
  box-shadow: 0 0 0 3px var(--p-gold-glow);
  background: #fff;
}

/* Country dial-code picker (assets/js/country-phone-picker.js) — matches the
   generic .portal-field input styling above but as a two-part flush row. */
.portal-field .ecc-phone-group {
  display: flex;
  flex-direction: row-reverse; /* RTL: select reads first, on the right */
}

.portal-field .ecc-phone-group .ecc-country-select,
.portal-field .ecc-phone-group input {
  padding: 0.85rem 0.9rem;
  border-radius: 0;
  border: 1.5px solid #e2e8f0;
  font-family: inherit;
  font-size: 1rem;
  background: #fafbfc;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.portal-field .ecc-phone-group .ecc-country-select {
  flex: 0 0 auto;
  width: auto;
  max-width: 148px;
  font-size: 0.9rem;
  border-left: none;
  border-radius: var(--p-radius-sm) 0 0 var(--p-radius-sm);
}

.portal-field .ecc-phone-group input {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  border-radius: 0 var(--p-radius-sm) var(--p-radius-sm) 0;
}

.portal-field .ecc-phone-group .ecc-country-select:focus,
.portal-field .ecc-phone-group input:focus {
  outline: none;
  border-color: var(--p-gold);
  box-shadow: 0 0 0 3px var(--p-gold-glow);
  background: #fff;
  position: relative;
  z-index: 1;
}

.portal-btn-primary {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.95rem 1.25rem;
  border: none;
  border-radius: var(--p-radius-sm);
  font-family: inherit;
  font-weight: 800;
  font-size: 1rem;
  cursor: pointer;
  color: var(--p-navy);
  background: linear-gradient(135deg, var(--p-gold-light), var(--p-gold));
  box-shadow: 0 8px 20px var(--p-gold-glow);
  transition: transform 0.2s, box-shadow 0.2s;
}

.portal-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px var(--p-gold-glow);
}

.portal-forgot-link-wrap {
  margin: -0.35rem 0 1rem;
  text-align: left;
}

.portal-forgot-link {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--p-muted);
  text-decoration: none;
  transition: color 0.15s;
}

.portal-forgot-link:hover {
  color: var(--p-gold);
}

.portal-btn-secondary {
  flex: 1;
  min-width: 8rem;
  padding: 0.7rem 1rem;
  border: 1.5px solid rgba(18, 35, 63, 0.12);
  border-radius: 2px 14px 14px 14px;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  color: var(--p-navy);
  background: #fff;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}

.portal-btn-secondary:hover:not(:disabled) {
  border-color: var(--p-gold);
  background: var(--p-cream);
  transform: translateY(-1px);
}

.portal-btn-secondary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.portal-demo-hint {
  font-size: 0.82rem;
  color: var(--p-muted);
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px dashed var(--p-border);
  line-height: 1.7;
}

.portal-alert {
  padding: 0.85rem 1rem;
  border-radius: var(--p-radius-sm);
  margin-bottom: 1rem;
  font-weight: 700;
  font-size: 0.9rem;
  border: 1px solid transparent;
}

.portal-alert-error {
  background: #fef2f2;
  color: #991b1b;
  border-color: #fecaca;
}

.portal-alert-success {
  background: #eef7ee;
  color: #2c6b2f;
  border-color: #bfe3bf;
}

.portal-alert-info {
  background: #eef4fb;
  color: #1e4a73;
  border-color: #b7d0ea;
}

.portal-alert-warn {
  background: #fff8e8;
  color: #7a5a10;
  border-color: #f0d48a;
}

.portal-alert strong[dir="ltr"] {
  letter-spacing: 0.12em;
  font-variant-numeric: tabular-nums;
}

/* Auth / OTP polish */
.portal-steps {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 1.35rem;
}

.portal-step {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--p-muted);
}

.portal-step-num {
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  border: 1.5px solid var(--p-border);
  background: var(--p-cream);
  color: var(--p-muted);
}

.portal-step.is-active { color: var(--p-navy); }
.portal-step.is-active .portal-step-num {
  background: linear-gradient(135deg, var(--p-gold-light), var(--p-gold));
  border-color: transparent;
  color: var(--p-navy);
}

.portal-step.is-done { color: var(--p-wa); }
.portal-step.is-done .portal-step-num {
  background: var(--p-wa-soft);
  border-color: rgba(18, 140, 126, 0.35);
  color: var(--p-wa);
}

.portal-step-line {
  flex: 1;
  height: 2px;
  background: var(--p-border);
  border-radius: 999px;
  min-width: 1.5rem;
}

.portal-step-line.is-done {
  background: linear-gradient(90deg, var(--p-wa), var(--p-gold-light));
}

.portal-field-otp input {
  text-align: center;
  letter-spacing: 0.45em;
  font-size: 1.45rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  padding-inline-start: 0.85rem;
  background: #fff;
  border-color: rgba(18, 140, 126, 0.35);
}

.portal-field-otp input:focus {
  border-color: var(--p-wa);
  box-shadow: 0 0 0 3px rgba(18, 140, 126, 0.18);
}

.portal-otp-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.portal-wa-hint {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.85rem 1rem;
  margin: 0 0 1.25rem;
  border-radius: var(--p-radius-sm);
  background: var(--p-wa-soft);
  border: 1px solid rgba(18, 140, 126, 0.22);
  color: #0f5c52;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.55;
}

.portal-wa-hint-icon {
  flex: 0 0 auto;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 999px;
  background: #fff;
  color: var(--p-wa);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  box-shadow: 0 4px 12px rgba(18, 140, 126, 0.15);
}

.portal-btn-link {
  display: inline-block;
  width: 100%;
  text-align: center;
  text-decoration: none;
}

.portal-topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.portal-topbar-link {
  font-size: 0.82rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.88);
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.05);
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.portal-topbar-link:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(240, 201, 107, 0.45);
  color: #fff;
}

.portal-topbar-link.is-muted {
  opacity: 0.9;
}

.portal-spacer-sm { margin-top: 0.75rem; }
.portal-spacer-md { margin-top: 1.15rem; }
.portal-spacer-lg { margin-top: 1.5rem; }

.portal-empty.is-flush { margin-top: 1rem; }

.portal-meta-line {
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
  color: var(--p-muted);
  font-weight: 600;
}

.portal-meta-line.is-soft {
  font-size: 0.75rem;
  opacity: 0.8;
}

.portal-change-type {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--p-muted);
  margin-bottom: 0.35rem;
}

.portal-change-you {
  color: var(--p-gold);
  font-weight: 800;
}

.portal-hero-contract {
  margin-top: 0.65rem;
  margin-bottom: 0;
  font-size: 0.88rem;
  opacity: 0.8;
  font-weight: 600;
}

.portal-timeline-block {
  margin-bottom: 2rem;
}

/* ─── Dashboard shell ─── */
.portal-app {
  min-height: 100vh;
  padding-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0));
}

@media (min-width: 960px) {
  .portal-app { padding-bottom: 3rem; }
}

.portal-hero {
  position: relative;
  background: linear-gradient(160deg, var(--p-navy) 0%, #0a1528 50%, var(--p-navy-soft) 100%);
  color: #fff;
  padding: 1.25rem clamp(1rem, 4vw, 2rem) 2.5rem;
  overflow: hidden;
}

.portal-hero::before {
  content: '';
  position: absolute;
  top: -40%;
  right: -20%;
  width: 60%;
  height: 120%;
  background: radial-gradient(circle, var(--p-gold-glow), transparent 65%);
  opacity: 0.5;
  pointer-events: none;
}

.portal-hero-grid {
  position: relative;
  z-index: 1;
  max-width: 960px;
  margin: 0 auto;
}

.portal-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.portal-topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.portal-topbar-brand img {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
}

.portal-topbar-brand span {
  font-weight: 800;
  font-size: 1rem;
}

.portal-logout {
  font-size: 0.88rem;
  font-weight: 700;
  color: rgba(255,255,255,0.9);
  padding: 0.5rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.06);
  transition: background 0.2s, border-color 0.2s;
}

.portal-logout:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.35);
  color: #fff;
}

.portal-greeting {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 800;
  margin: 0 0 0.35rem;
  line-height: 1.3;
}

.portal-greeting em {
  font-style: normal;
  color: var(--p-gold-light);
}

.portal-hero-meta {
  font-size: 0.95rem;
  opacity: 0.85;
  margin: 0 0 1.5rem;
}

.portal-hero-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

@media (max-width: 520px) {
  .portal-hero-cards { grid-template-columns: 1fr; }
}

.portal-hero-stat {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--p-radius-sm);
  padding: 1rem 1.1rem;
  backdrop-filter: blur(12px);
}

.portal-hero-stat-label {
  font-size: 0.78rem;
  font-weight: 700;
  opacity: 0.75;
  margin-bottom: 0.5rem;
}

.portal-hero-stat-value {
  font-size: 1.35rem;
  font-weight: 800;
}

.portal-ring-wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
  grid-column: 1 / -1;
  background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0.04));
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: var(--p-radius);
  padding: 1.15rem 1.25rem;
}

.portal-ring {
  --pct: 0;
  width: 88px;
  height: 88px;
  flex-shrink: 0;
  border-radius: 50%;
  background: conic-gradient(
    var(--p-gold-light) calc(var(--pct) * 1%),
    rgba(255,255,255,0.12) 0
  );
  display: grid;
  place-items: center;
  position: relative;
}

.portal-ring::after {
  content: '';
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: var(--p-navy-mid);
}

.portal-ring span {
  position: relative;
  z-index: 1;
  font-weight: 800;
  font-size: 1.15rem;
}

.portal-ring-copy h3 {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
  font-weight: 800;
}

.portal-ring-copy p {
  margin: 0;
  font-size: 0.88rem;
  opacity: 0.8;
  line-height: 1.5;
}

/* ─── Main content ─── */
.portal-main {
  max-width: 960px;
  margin: -1.25rem auto 0;
  padding: 0 clamp(1rem, 4vw, 2rem) 2rem;
  position: relative;
  z-index: 2;
}

.portal-install {
  width: 100%;
  margin-bottom: 1rem;
  padding: 0.85rem;
  border-radius: var(--p-radius-sm);
  border: 1.5px dashed var(--p-gold);
  background: rgba(212, 160, 58, 0.08);
  color: var(--p-navy);
  font-family: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.2s;
}

.portal-install:hover { background: rgba(212, 160, 58, 0.14); }

.portal-section {
  background: var(--p-card);
  border-radius: var(--p-radius);
  padding: 1.35rem 1.4rem 1.5rem;
  margin-bottom: 1rem;
  box-shadow: var(--p-shadow-sm);
  border: 1px solid var(--p-border);
  animation: portal-rise 0.6s var(--p-ease) both;
}

.portal-section:nth-child(2) { animation-delay: 0.05s; }
.portal-section:nth-child(3) { animation-delay: 0.1s; }
.portal-section:nth-child(4) { animation-delay: 0.15s; }

.portal-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.15rem;
}

.portal-section-head h2 {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 800;
  color: var(--p-navy);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.portal-section-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  background: var(--p-sand);
}

.portal-finance-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.65rem;
}

@media (max-width: 480px) {
  .portal-finance-grid { grid-template-columns: 1fr; }
}

.portal-finance-tile {
  text-align: center;
  padding: 1rem 0.75rem;
  border-radius: var(--p-radius-sm);
  background: linear-gradient(180deg, var(--p-cream), #fff);
  border: 1px solid var(--p-border);
}

.portal-finance-tile strong {
  display: block;
  font-size: clamp(1.1rem, 3vw, 1.35rem);
  font-weight: 800;
  color: var(--p-navy);
  margin-bottom: 0.2rem;
}

.portal-finance-tile span {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--p-muted);
}

.portal-finance-tile.is-accent {
  background: linear-gradient(145deg, var(--p-navy-mid), var(--p-navy-soft));
  border-color: transparent;
}

.portal-finance-tile.is-accent strong,
.portal-finance-tile.is-accent span { color: #fff; }
.portal-finance-tile.is-accent span { opacity: 0.8; }

.portal-pay-bar {
  height: 8px;
  border-radius: 999px;
  background: var(--p-sand);
  margin: 1.15rem 0 0.5rem;
  overflow: hidden;
}

.portal-pay-bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--p-gold), var(--p-gold-light));
  width: 0;
  transition: width 1.2s var(--p-ease);
}

.portal-pay-bar-label {
  font-size: 0.82rem;
  color: var(--p-muted);
  font-weight: 600;
}

.portal-installment-list { margin-top: 1.25rem; }

.portal-installment {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid #f0f2f6;
}

.portal-installment:last-child { border-bottom: none; }

.portal-installment-date {
  font-weight: 600;
  color: var(--p-muted);
  font-size: 0.8rem;
}

.portal-installment-amt {
  font-size: 0.95rem;
  color: var(--p-navy);
  font-weight: 800;
}

.portal-pill {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  white-space: nowrap;
}

.portal-pill--paid { background: #dcfce7; color: #166534; }
.portal-pill--pending { background: #e0e7ff; color: #3730a3; }
.portal-pill--partial { background: #fef3c7; color: #92400e; }
.portal-pill--overdue { background: #fee2e2; color: #991b1b; }
.portal-pill--done { background: #dcfce7; color: #166534; }
.portal-pill--active { background: #fef3c7; color: #92400e; }
.portal-pill--idle { background: #f1f5f9; color: #64748b; }

/* Timeline */
.portal-timeline {
  position: relative;
  padding-right: 0.25rem;
}

.portal-timeline-item {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 0.75rem 1rem;
  align-items: start;
  padding-bottom: 1.15rem;
  position: relative;
}

.portal-timeline-item:not(:last-child)::before {
  content: '';
  position: absolute;
  right: 13px;
  top: 28px;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, #e2e8f0, transparent);
}

.portal-timeline-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid #e2e8f0;
  background: #fff;
  display: grid;
  place-items: center;
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--p-muted);
  z-index: 1;
}

.portal-timeline-item.is-done .portal-timeline-dot {
  border-color: #22c55e;
  background: #dcfce7;
  color: #166534;
}

.portal-timeline-item.is-active .portal-timeline-dot {
  border-color: var(--p-gold);
  background: #fffbeb;
  color: #92400e;
  box-shadow: 0 0 0 4px var(--p-gold-glow);
  animation: portal-pulse 2s ease-in-out infinite;
}

@keyframes portal-pulse {
  0%, 100% { box-shadow: 0 0 0 4px var(--p-gold-glow); }
  50% { box-shadow: 0 0 0 8px rgba(212, 160, 58, 0.15); }
}

.portal-timeline-title {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--p-navy);
}

.portal-timeline-item.is-idle .portal-timeline-title { color: var(--p-muted); }

.portal-timeline-content { min-width: 0; }

/* Engineer's visual journal — image + upload date only */
.portal-stage-update {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin-top: 0.75rem;
  padding: 0;
  background: transparent;
  border: none;
  overflow: visible;
}

.portal-stage-update::after {
  display: none;
}

.portal-stage-photo {
  width: 88px;
  height: 88px;
  flex-shrink: 0;
  padding: 0;
  border: 0;
  border-radius: 12px;
  overflow: hidden;
  background: var(--p-sand);
  cursor: zoom-in;
  position: relative;
  z-index: 1;
  box-shadow: 0 6px 18px -8px rgba(12, 24, 41, 0.25);
}

.portal-stage-photo + .portal-stage-photo {
  display: none;
}

.portal-stage-photo img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform 0.35s var(--p-ease);
}

.portal-stage-photo:hover img {
  transform: scale(1.06);
}

.portal-stage-date {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--p-muted);
  line-height: 1.4;
}

.portal-dashboard .portal-stage-update {
  background: transparent;
  border: none;
  padding: 0;
  grid-template-columns: none;
  grid-template-rows: none;
}

.portal-photo-cell {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.portal-photo-date {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--p-muted);
  text-align: center;
  line-height: 1.3;
}

.portal-stage-note,
.portal-stage-author {
  display: none !important;
}

/* Photos */
.portal-photos {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

@media (min-width: 600px) {
  .portal-photos { grid-template-columns: repeat(3, 1fr); gap: 0.65rem; }
}

.portal-photo {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 1;
  cursor: pointer;
  border: none;
  padding: 0;
  background: var(--p-sand);
}

.portal-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s var(--p-ease);
}

.portal-photo:hover img { transform: scale(1.06); }

.portal-photo::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 50%, rgba(12,24,41,0.35));
  opacity: 0;
  transition: opacity 0.3s;
}

.portal-photo:hover::after { opacity: 1; }

/* Change cards */
.portal-change-card {
  padding: 1rem 1.1rem;
  border-radius: var(--p-radius-sm);
  background: var(--p-cream);
  border: 1px solid var(--p-border);
  margin-bottom: 0.75rem;
}

.portal-change-card:last-child { margin-bottom: 0; }

.portal-change-meta {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--p-muted);
  margin-bottom: 0.4rem;
}

.portal-change-request-card {
  padding: 1.1rem 1.2rem;
  border-radius: var(--p-radius-sm);
  background: #fff;
  border: 1px dashed var(--p-gold);
  margin-bottom: 1.25rem;
}

.portal-hero-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 1.15rem;
  padding: 0.7rem 1.35rem;
  border-radius: 999px;
  background: var(--p-gold);
  color: #1b1c29;
  font-weight: 800;
  font-size: 0.95rem;
  text-decoration: none;
  box-shadow: 0 8px 20px rgba(200, 149, 44, 0.28);
}
.portal-hero-cta:hover { color: #1b1c29; filter: brightness(1.05); }

.portal-change-form-title {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--p-ink);
}
.portal-change-form-lead {
  margin: 0 0 1rem;
  font-size: 0.88rem;
  color: var(--p-muted);
  line-height: 1.55;
}
.portal-change-msg.is-error { color: #b42318; }
.portal-change-msg.is-ok { color: #0a7d77; }

.portal-change-form .portal-field select,
.portal-change-form .portal-field textarea,
.portal-change-form .portal-field input[type="text"] {
  width: 100%;
  display: block;
  padding: 0.85rem 1rem;
  border: 1.5px solid #e2e8f0;
  border-radius: var(--p-radius-sm);
  background: #fafbfc;
  color: var(--p-text);
  font: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.portal-change-form .portal-field select:focus,
.portal-change-form .portal-field textarea:focus,
.portal-change-form .portal-field input[type="text"]:focus {
  outline: none;
  border-color: var(--p-gold);
  box-shadow: 0 0 0 3px var(--p-gold-glow);
  background: #fff;
}

.portal-change-form .portal-field textarea {
  min-height: 6rem;
  resize: vertical;
}

.portal-change-form .portal-req {
  color: #b42318;
}

.portal-change-form .portal-btn-primary {
  width: 100%;
  margin-top: 0.25rem;
}

.portal-change-msg {
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--p-muted);
}

.portal-installment-label,
.portal-next-due-title {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--p-text);
  margin-bottom: 0.15rem;
}

.portal-change-body {
  margin: 0 0 0.5rem;
  font-size: 0.92rem;
  line-height: 1.6;
}

.portal-change-price {
  font-weight: 800;
  color: var(--p-gold);
  font-size: 1.05rem;
}

.portal-empty {
  text-align: center;
  padding: 1.5rem 1rem;
  color: var(--p-muted);
  font-weight: 600;
  font-size: 0.92rem;
}

.portal-empty-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  opacity: 0.5;
}

/* Bottom nav */
.portal-dock {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 0.5rem clamp(0.75rem, 3vw, 1.5rem) calc(0.65rem + env(safe-area-inset-bottom, 0));
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--p-border);
  box-shadow: 0 -8px 32px rgba(12,24,41,0.08);
}

@media (min-width: 960px) {
  .portal-dock { display: none; }
}

.portal-dock-inner {
  max-width: 420px;
  margin: 0 auto;
  display: flex;
  justify-content: space-around;
  gap: 0.25rem;
}

.portal-dock a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.4rem 0.25rem;
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--p-muted);
  border-radius: 12px;
  transition: color 0.2s, background 0.2s;
  text-decoration: none;
}

.portal-dock a .portal-dock-ico { font-size: 1.25rem; }

.portal-dock a.is-active,
.portal-dock a:hover {
  color: var(--p-navy);
  background: var(--p-sand);
}

/* Lightbox */
.portal-lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(12, 24, 41, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.portal-lightbox.is-open {
  opacity: 1;
  visibility: visible;
}

.portal-lightbox img {
  max-width: 100%;
  max-height: 85vh;
  border-radius: 12px;
  box-shadow: var(--p-shadow);
}

.portal-lightbox-close {
  position: absolute;
  top: 1rem;
  left: 1rem;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.portal-adjust-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid #f0f2f6;
  font-size: 0.92rem;
}

.portal-adjust-row:last-child { border-bottom: none; }

.portal-adjust-row strong {
  color: var(--p-navy);
  white-space: nowrap;
}

/* ─── Signature editorial finish ─── */
.portal-app {
  background:
    linear-gradient(90deg, rgba(12,24,41,.025) 1px, transparent 1px),
    linear-gradient(rgba(12,24,41,.025) 1px, transparent 1px),
    #f7f4ee;
  background-size: 32px 32px;
}

.portal-hero {
  min-height: 465px;
  padding-top: 1.5rem;
  padding-bottom: 5.5rem;
  background:
    linear-gradient(115deg, rgba(5,13,25,.98) 0%, rgba(12,31,54,.98) 52%, rgba(18,49,76,.95) 100%);
}

.portal-hero::after {
  content: '';
  position: absolute;
  inset: auto -10% -1px auto;
  width: min(840px, 90vw);
  height: 76%;
  opacity: .32;
  background:
    linear-gradient(90deg, transparent 0 8%, rgba(240,201,107,.55) 8.2% 8.6%, transparent 8.8% 25%, rgba(240,201,107,.45) 25.2% 25.5%, transparent 25.7% 42%, rgba(240,201,107,.5) 42.2% 42.5%, transparent 42.7%),
    repeating-linear-gradient(0deg, rgba(240,201,107,.35) 0 1px, transparent 1px 54px);
  clip-path: polygon(15% 100%,15% 36%,28% 36%,28% 14%,44% 14%,44% 47%,56% 47%,56% 0,73% 0,73% 27%,89% 27%,89% 100%);
  pointer-events: none;
}

.portal-hero-grid { max-width: 1080px; }

.portal-topbar {
  margin-bottom: clamp(2.5rem, 7vw, 5rem);
}

.portal-topbar-brand img {
  box-shadow: 0 8px 24px rgba(0,0,0,.32);
  border: 1px solid rgba(240,201,107,.5);
}

.portal-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  margin-bottom: .7rem;
  color: var(--p-gold-light);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .11em;
}

.portal-eyebrow i {
  display: block;
  width: 28px;
  height: 1px;
  background: currentColor;
}

.portal-greeting {
  font-size: clamp(2rem, 5vw, 3.2rem);
  letter-spacing: -.04em;
  margin-bottom: .6rem;
}

.portal-hero-meta {
  max-width: 62ch;
  line-height: 1.85;
  margin-bottom: 1.85rem;
}

.portal-hero-cards {
  width: min(100%, 720px);
  grid-template-columns: 1fr 1fr;
}

.portal-hero-stat {
  border-radius: 2px 18px 18px 18px;
  padding: 1.05rem 1.2rem;
  background: linear-gradient(145deg, rgba(255,255,255,.14), rgba(255,255,255,.045));
}

.portal-hero-stat-value { letter-spacing: -.04em; }

.portal-ring-wrap {
  border-radius: 2px 22px 22px 22px;
  padding: 1.2rem 1.35rem;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.14);
}

.portal-ring {
  width: 96px;
  height: 96px;
  box-shadow: 0 0 26px rgba(240,201,107,.14);
}

.portal-ring::after { background: #112a47; }
.portal-overline {
  display: block;
  color: var(--p-gold-light);
  font-size: .67rem;
  font-weight: 800;
  letter-spacing: .1em;
  margin-bottom: .12rem;
}

.portal-main {
  max-width: 1080px;
  margin-top: -3.65rem;
}

.portal-section {
  border-radius: 2px 24px 24px 24px;
  padding: 1.55rem;
  box-shadow: 0 22px 44px -28px rgba(12,24,41,.34);
  transition: transform .3s var(--p-ease), box-shadow .3s var(--p-ease);
}

@media (hover: hover) {
  .portal-section:hover {
    transform: translateY(-2px);
    box-shadow: 0 26px 52px -27px rgba(12,24,41,.38);
  }
}

.portal-section-head { margin-bottom: 1.4rem; }

.portal-section-head h2 {
  font-size: 1.17rem;
  letter-spacing: -.02em;
}

.portal-section-icon {
  width: 40px;
  height: 40px;
  border-radius: 2px 12px 12px 12px;
  color: var(--p-navy);
  background: linear-gradient(135deg, #f9edd2, #ead19a);
}

.portal-section-icon svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.portal-section-label {
  color: var(--p-muted);
  font-size: .72rem;
  font-weight: 800;
  padding: .38rem .7rem;
  border-radius: 999px;
  background: #f7f4ee;
  border: 1px solid var(--p-border);
}

.portal-finance-grid { gap: .85rem; }

.portal-finance-tile {
  position: relative;
  overflow: hidden;
  text-align: right;
  padding: 1.15rem;
  border-radius: 2px 16px 16px 16px;
}

.portal-finance-tile::before {
  content: '';
  position: absolute;
  width: 75px;
  height: 75px;
  left: -34px;
  bottom: -42px;
  border: 1px solid rgba(12,24,41,.08);
  border-radius: 50%;
}

.portal-finance-tile strong { font-size: clamp(1.18rem, 3vw, 1.5rem); }
.portal-finance-tile.is-accent { background: linear-gradient(135deg, #132e4d, #0a1728); }

.portal-pay-bar {
  height: 10px;
  background: #eee8dc;
  border: 1px solid rgba(12,24,41,.05);
}

.portal-pay-bar-fill {
  background: linear-gradient(90deg, #bd7f1c, var(--p-gold-light));
  box-shadow: 0 0 14px rgba(212,160,58,.45);
}

.portal-installment {
  position: relative;
  padding: 1rem .15rem 1rem 0;
  transition: padding-right .2s;
}

.portal-installment:hover { padding-right: .35rem; }
.portal-installment::before {
  content: '';
  position: absolute;
  right: 0;
  top: 50%;
  width: 3px;
  height: 0;
  border-radius: 2px;
  background: var(--p-gold);
  transition: height .2s, transform .2s;
  transform: translateY(-50%);
}
.portal-installment:hover::before { height: 45%; }

.portal-timeline { padding-right: .45rem; }
.portal-timeline-item { grid-template-columns: 34px 1fr auto; gap: .8rem 1rem; }
.portal-timeline-item:not(:last-child)::before { right: 16px; top: 34px; width: 1px; }
.portal-timeline-dot {
  width: 34px;
  height: 34px;
  border-width: 1px;
  font-size: .68rem;
}

.portal-photos { gap: .7rem; }
.portal-photo { border-radius: 2px 14px 14px 14px; }
.portal-photo:first-child { grid-column: span 2; grid-row: span 2; }
.portal-photo:first-child::before {
  content: 'أحدث صورة من الموقع';
  position: absolute;
  z-index: 2;
  bottom: .65rem;
  right: .65rem;
  padding: .3rem .55rem;
  border-radius: 999px;
  background: rgba(10,23,40,.72);
  color: #fff;
  font-size: .65rem;
  font-weight: 800;
  opacity: 0;
  transition: opacity .25s;
}
.portal-photo:first-child:hover::before { opacity: 1; }

.portal-change-card {
  border-radius: 2px 16px 16px 16px;
  background: linear-gradient(120deg, #faf7f1, #fff);
  padding: 1.2rem;
}

.portal-dock {
  margin: 0 .6rem .6rem;
  left: 0;
  right: 0;
  border: 1px solid rgba(12,24,41,.09);
  border-radius: 19px;
  box-shadow: 0 15px 40px rgba(12,24,41,.16);
}

.portal-dock a { border-radius: 12px; }
.portal-dock a .portal-dock-ico {
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
}
.portal-dock-ico svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (max-width: 600px) {
  .portal-hero { min-height: 430px; padding-bottom: 5rem; }
  .portal-hero::after { width: 110vw; opacity: .22; }
  .portal-main { margin-top: -3rem; padding-left: .8rem; padding-right: .8rem; }
  .portal-section { padding: 1.2rem; border-radius: 2px 20px 20px 20px; }
  .portal-finance-grid { gap: .55rem; }
  .portal-finance-tile { padding: .9rem .75rem; }
  .portal-photos { gap: .45rem; }
  .portal-stage-photo { width: 76px; height: 76px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Login page — same architectural language, intentionally quieter */
.portal-auth-brand {
  background:
    linear-gradient(115deg, rgba(5,13,25,.98), rgba(14,42,69,.96)),
    var(--p-navy);
}

.portal-auth-brand::before {
  background:
    radial-gradient(ellipse 70% 55% at 8% 110%, rgba(212,160,58,.42), transparent 60%),
    linear-gradient(90deg, transparent 0 18%, rgba(240,201,107,.22) 18.2% 18.5%, transparent 18.7% 47%, rgba(240,201,107,.2) 47.2% 47.5%, transparent 47.7%),
    repeating-linear-gradient(0deg, transparent 0 67px, rgba(240,201,107,.16) 68px 69px);
  opacity: .8;
}

.portal-auth-brand::after {
  width: 88%;
  height: 65%;
  bottom: -23%;
  left: -15%;
  filter: none;
  opacity: .55;
  clip-path: polygon(0 100%,0 44%,19% 44%,19% 22%,39% 22%,39% 50%,57% 50%,57% 0,75% 0,75% 31%,100% 31%,100% 100%);
  border: 1px solid rgba(240,201,107,.3);
  background: transparent;
  border-radius: 0;
}

.portal-auth-kicker,
.portal-form-kicker {
  display: block;
  color: var(--p-gold-light);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .15em;
  margin-bottom: .8rem;
}

.portal-auth-tagline {
  font-size: clamp(2rem, 4vw, 3rem);
  letter-spacing: -.04em;
  max-width: 15ch;
}

.portal-auth-features { gap: .55rem; }
.portal-auth-chip {
  padding: .52rem .75rem;
  border-radius: 2px 999px 999px 2px;
}
.portal-auth-chip b {
  color: var(--p-gold-light);
  font-size: .65rem;
  margin-left: .25rem;
}

.portal-auth-form-wrap {
  background:
    radial-gradient(circle at 70% 15%, rgba(212,160,58,.13), transparent 28%),
    var(--p-cream);
}

.portal-card {
  border-radius: 2px 25px 25px 25px;
  border-top: 3px solid var(--p-gold);
  padding-top: 2.3rem;
}

.portal-form-kicker { color: var(--p-gold); margin-bottom: .45rem; }
.portal-card h1 { letter-spacing: -.03em; font-size: 1.7rem; }
.portal-btn-primary { border-radius: 2px 14px 14px 14px; }
