:root {
  --portal-bg:
    radial-gradient(circle at top left, rgba(55, 201, 255, 0.12), transparent 28%),
    radial-gradient(circle at top right, rgba(212, 175, 55, 0.14), transparent 24%),
    linear-gradient(180deg, rgba(9, 24, 38, 0.98) 0%, rgba(7, 18, 28, 1) 100%);
  --portal-surface: rgba(13, 31, 47, 0.92);
  --portal-surface-soft: rgba(19, 44, 71, 0.72);
  --portal-surface-muted: rgba(255, 255, 255, 0.04);
  --portal-border: rgba(199, 224, 255, 0.14);
  --portal-border-strong: rgba(55, 201, 255, 0.2);
  --portal-text: var(--text-light, #e8f2ff);
  --portal-text-muted: rgba(199, 224, 255, 0.72);
  --portal-text-soft: rgba(199, 224, 255, 0.54);
  --portal-shadow: 0 18px 42px rgba(4, 9, 16, 0.34);
  --portal-shadow-soft: 0 10px 28px rgba(4, 9, 16, 0.2);
}

body.account-portal-page {
  min-height: 100vh;
  background: var(--portal-bg);
  color: var(--portal-text);
}

.account-top-spacer {
  height: 72px;
}

.account-portal {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto 48px;
  display: grid;
  grid-template-columns: 312px minmax(0, 1fr);
  gap: 24px;
}

.account-rail {
  position: sticky;
  top: 92px;
  align-self: start;
  display: grid;
  gap: 18px;
}

.portal-main {
  min-width: 0;
  display: grid;
  gap: 24px;
}

.portal-surface,
.portal-card,
.portal-rail-card,
.portal-identity-card,
.portal-brand {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--portal-border);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(13, 31, 47, 0.96), rgba(9, 22, 34, 0.96));
  box-shadow: var(--portal-shadow);
}

.portal-card,
.portal-rail-card,
.portal-identity-card,
.portal-brand {
  padding: 24px;
}

.portal-card::before,
.portal-rail-card::before,
.portal-identity-card::before,
.portal-brand::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.04), transparent 42%);
}

.portal-brand {
  display: grid;
  gap: 12px;
  background: linear-gradient(160deg, rgba(14, 35, 54, 0.98), rgba(18, 42, 68, 0.92));
  border-color: rgba(55, 201, 255, 0.18);
}

.portal-brand__eyebrow,
.portal-chip,
.portal-card__eyebrow,
.portal-rail-label,
.portal-mini-label {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(212, 175, 55, 0.12);
  border: 1px solid rgba(212, 175, 55, 0.22);
  color: var(--gold-light, #ffd66b);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.portal-brand h2,
.portal-header h1,
.portal-card h3,
.portal-card__title,
.plan-card__title {
  font-family: var(--font-accent, "Space Grotesk", sans-serif);
}

.portal-brand h2 {
  font-size: 1.4rem;
  line-height: 1.1;
}

.portal-brand p,
.portal-header p,
.portal-card__copy,
.portal-empty,
.portal-muted,
.portal-field__help,
.portal-list__meta,
.plan-card__note {
  color: var(--portal-text-muted);
}

.portal-identity-card {
  display: grid;
  gap: 14px;
}

.portal-avatar-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.portal-avatar {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(55, 201, 255, 0.16), rgba(212, 175, 55, 0.1));
  border: 1px solid rgba(55, 201, 255, 0.2);
  color: var(--text-white, #ffffff);
  font-size: 1.15rem;
  font-weight: 700;
}

.portal-identity-copy {
  min-width: 0;
}

.portal-identity-copy strong,
.portal-header h1 {
  color: var(--text-white, #ffffff);
}

.portal-identity-copy strong {
  display: block;
  font-size: 1.05rem;
  line-height: 1.15;
}

.portal-identity-copy span {
  display: block;
  color: var(--portal-text-muted);
  font-size: 0.92rem;
  word-break: break-word;
}

.portal-chip-row,
.portal-nav,
.portal-quick-links,
.portal-stack,
.portal-form,
.portal-form-grid,
.portal-list,
.portal-stat-grid,
.portal-grid,
.portal-card__actions,
.portal-inline-group {
  display: grid;
  gap: 14px;
}

.portal-chip-row {
  gap: 10px;
}

.portal-chip {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(199, 224, 255, 0.16);
  color: var(--portal-text);
  letter-spacing: normal;
  text-transform: none;
}

.portal-chip.is-success {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.3);
  color: #9ff0c6;
}

.portal-chip.is-warning {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.3);
  color: #ffd57d;
}

.portal-chip.is-danger {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.3);
  color: #ffb2b2;
}

.portal-nav-item,
.portal-tab-item,
.portal-quick-link,
.portal-action-link,
.portal-btn {
  border: 1px solid transparent;
  border-radius: 14px;
  transition: all var(--transition, 0.3s ease);
  font: inherit;
}

.portal-nav-item,
.portal-tab-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--portal-text-muted);
  cursor: pointer;
}

.portal-nav-item:hover,
.portal-nav-item.is-active,
.portal-tab-item:hover,
.portal-tab-item.is-active {
  color: var(--text-white, #ffffff);
  border-color: rgba(55, 201, 255, 0.28);
  background: linear-gradient(135deg, rgba(55, 201, 255, 0.12), rgba(31, 78, 121, 0.12));
  transform: translateY(-1px);
}

.portal-nav-index {
  color: var(--gold-light, #ffd66b);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.portal-nav-label {
  flex: 1;
  text-align: left;
  font-weight: 600;
}

.portal-tabbar {
  display: none;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.portal-quick-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 46px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--portal-text);
  text-decoration: none;
  border-color: rgba(199, 224, 255, 0.12);
}

.portal-quick-link:hover,
.portal-action-link:hover {
  border-color: rgba(212, 175, 55, 0.24);
  transform: translateY(-1px);
}

.portal-main {
  display: grid;
  gap: 24px;
}

.portal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.portal-header__copy {
  display: grid;
  gap: 12px;
}

.portal-header h1 {
  font-size: clamp(2rem, 4vw, 2.8rem);
  line-height: 1.03;
}

.portal-header__chips {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.portal-message {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--portal-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--portal-text);
}

.portal-message.is-success {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.28);
}

.portal-message.is-error {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.28);
}

.portal-message.is-warning {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.28);
}

.portal-panel[hidden] {
  display: none !important;
}

.portal-panel {
  display: grid;
  gap: 20px;
}

.portal-card {
  display: grid;
  gap: 16px;
}

.portal-card__head,
.portal-inline-group {
  align-items: center;
  justify-content: space-between;
}

.portal-card__head {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.portal-card__title {
  font-size: 1.2rem;
  color: var(--text-white, #ffffff);
}

.portal-card__copy {
  font-size: 0.95rem;
}

.portal-stat-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.portal-stat {
  padding: 18px;
  border-radius: 16px;
  border: 1px solid rgba(199, 224, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  display: grid;
  gap: 6px;
}

.portal-stat__label {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--portal-text-soft);
}

.portal-stat__value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-white, #ffffff);
}

.portal-stat__note {
  font-size: 0.88rem;
  color: var(--portal-text-muted);
}

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

.portal-col-12 {
  grid-column: span 12;
}

.portal-col-8 {
  grid-column: span 8;
}

.portal-col-7 {
  grid-column: span 7;
}

.portal-col-6 {
  grid-column: span 6;
}

.portal-col-5 {
  grid-column: span 5;
}

.portal-col-4 {
  grid-column: span 4;
}

.portal-inline-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.portal-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  cursor: pointer;
  text-decoration: none;
}

.portal-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.portal-btn.is-primary {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.94), rgba(184, 148, 31, 0.98));
  border-color: rgba(212, 175, 55, 0.26);
  color: #0b1825;
  box-shadow: var(--shadow-gold);
  font-weight: 700;
}

.portal-btn.is-secondary {
  background: linear-gradient(135deg, rgba(55, 201, 255, 0.14), rgba(31, 78, 121, 0.16));
  border-color: rgba(55, 201, 255, 0.22);
  color: var(--portal-text);
}

.portal-btn.is-ghost {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(199, 224, 255, 0.12);
  color: var(--portal-text);
}

.portal-btn.is-danger {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.26);
  color: #ffb2b2;
}

.portal-btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.portal-form {
  gap: 18px;
}

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

.portal-field {
  display: grid;
  gap: 8px;
}

.portal-field.is-span-2 {
  grid-column: span 2;
}

.portal-field label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--portal-text);
}

.portal-input,
.portal-select,
.portal-textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(199, 224, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-white, #ffffff);
  font: inherit;
}

.portal-textarea {
  min-height: 140px;
  resize: vertical;
}

.portal-input:focus,
.portal-select:focus,
.portal-textarea:focus {
  outline: none;
  border-color: rgba(212, 175, 55, 0.38);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.08);
}

.portal-input[readonly] {
  opacity: 0.8;
  cursor: default;
}

.portal-field__help {
  font-size: 0.84rem;
}

.portal-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(199, 224, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
}

.portal-toggle-row__copy strong {
  display: block;
  color: var(--text-white, #ffffff);
  font-size: 0.95rem;
}

.portal-toggle-row__copy span {
  display: block;
  color: var(--portal-text-muted);
  font-size: 0.84rem;
}

.portal-toggle {
  width: 46px;
  height: 26px;
  position: relative;
  display: inline-block;
}

.portal-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.portal-toggle__slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.3);
  border: 1px solid rgba(148, 163, 184, 0.25);
  transition: all var(--transition, 0.3s ease);
}

.portal-toggle__slider::before {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  left: 2px;
  top: 2px;
  border-radius: 50%;
  background: var(--text-white, #ffffff);
  transition: all var(--transition, 0.3s ease);
}

.portal-toggle input:checked + .portal-toggle__slider {
  background: rgba(212, 175, 55, 0.34);
  border-color: rgba(212, 175, 55, 0.32);
}

.portal-toggle input:checked + .portal-toggle__slider::before {
  transform: translateX(20px);
  background: #fef3c7;
}

.portal-list {
  list-style: none;
}

.portal-list__item {
  display: grid;
  gap: 4px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(199, 224, 255, 0.08);
}

.portal-list__item:last-child {
  border-bottom: 0;
}

.portal-list__title {
  color: var(--text-white, #ffffff);
  font-weight: 600;
}

.portal-list__meta {
  font-size: 0.86rem;
}

.portal-list__empty {
  padding: 12px 0;
  color: var(--portal-text-muted);
}

.portal-key-grid {
  display: grid;
  gap: 12px;
}

.portal-key-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(199, 224, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
}

.portal-key-copy strong {
  display: block;
  color: var(--text-white, #ffffff);
}

.portal-key-copy span {
  display: block;
  color: var(--portal-text-muted);
  font-size: 0.84rem;
}

.portal-session-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(199, 224, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
}

.portal-session-copy strong {
  display: block;
  color: var(--text-white, #ffffff);
}

.portal-session-copy span {
  display: block;
  color: var(--portal-text-muted);
  font-size: 0.84rem;
}

.portal-danger {
  border-color: rgba(239, 68, 68, 0.24);
  background: linear-gradient(180deg, rgba(45, 14, 18, 0.9), rgba(21, 8, 12, 0.94));
}

.portal-danger .portal-card__eyebrow {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.24);
  color: #ffb2b2;
}

.portal-billing-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.portal-billing-toggle button {
  min-height: 42px;
}

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

.plan-card {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 16px;
  padding: 22px;
  border-radius: 20px;
  border: 1px solid rgba(199, 224, 255, 0.12);
  background: linear-gradient(180deg, rgba(13, 31, 47, 0.96), rgba(9, 22, 34, 0.92));
}

.plan-card.is-featured {
  border-color: rgba(212, 175, 55, 0.28);
  box-shadow: var(--shadow-gold);
}

.plan-card.is-current {
  border-color: rgba(55, 201, 255, 0.28);
}

.plan-card__price {
  display: grid;
  gap: 4px;
}

.plan-card__amount {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-white, #ffffff);
}

.plan-card__period {
  color: var(--portal-text-muted);
}

.plan-card__features {
  list-style: none;
  display: grid;
  gap: 10px;
  color: var(--portal-text);
}

.plan-card__features li {
  position: relative;
  padding-left: 18px;
}

.plan-card__features li::before {
  content: "";
  position: absolute;
  width: 8px;
  height: 8px;
  left: 0;
  top: 0.58rem;
  border-radius: 50%;
  background: var(--gold-primary, #d4af37);
}

.portal-note {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(212, 175, 55, 0.22);
  background: rgba(212, 175, 55, 0.08);
  color: rgba(255, 214, 107, 0.95);
}

.portal-data-grid {
  display: grid;
  gap: 12px;
}

.portal-data-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(199, 224, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
}

.portal-data-item strong {
  color: var(--text-white, #ffffff);
}

.portal-link-list {
  display: grid;
  gap: 12px;
}

.portal-action-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(199, 224, 255, 0.1);
  color: var(--portal-text);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.03);
}

.portal-action-link span:last-child,
.portal-quick-link span:last-child {
  color: var(--gold-light, #ffd66b);
}

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

  .account-rail {
    position: static;
  }

  .portal-tabbar {
    display: flex;
  }
}

@media (max-width: 860px) {
  .account-portal {
    width: min(100%, calc(100% - 20px));
    margin-bottom: 36px;
  }

  .portal-form-grid,
  .portal-plan-grid,
  .portal-grid,
  .portal-stat-grid {
    grid-template-columns: 1fr;
  }

  .portal-col-8,
  .portal-col-7,
  .portal-col-6,
  .portal-col-5,
  .portal-col-4,
  .portal-col-12,
  .portal-field.is-span-2 {
    grid-column: span 1;
  }

  .portal-header {
    gap: 16px;
  }

  .portal-header__chips {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .account-portal {
    width: min(100%, calc(100% - 16px));
  }

  .portal-surface,
  .portal-card {
    padding: 18px;
  }

  /* Boutons d'action du portail → pleine largeur sur mobile */
  .portal-action-row {
    flex-direction: column;
    gap: 10px;
  }

  .portal-action-row .btn {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .account-portal {
    width: min(100%, calc(100% - 12px));
    margin-top: 0;
  }

  .account-top-spacer {
    height: 60px;
  }

  .portal-surface,
  .portal-card {
    padding: 16px 14px;
    border-radius: 16px;
  }

  /* Tabbar du portail : scroll horizontal */
  .portal-tabbar {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    gap: 6px;
    padding-bottom: 4px;
  }

  .portal-tab {
    flex: 0 0 auto;
    white-space: nowrap;
    min-height: 44px;
  }
}

@media (max-width: 360px) {
  .account-portal {
    width: 100%;
    margin-left: 0;
    margin-right: 0;
  }

  .portal-surface,
  .portal-card {
    padding: 14px 12px;
    border-radius: 14px;
  }
}
