/* ==========================================================================
   PORTAL.CSS — Portail Minimaliste Pro-Pilot (@layer components)
   100% jetons sémantiques var(--ds-*), zéro couleur en dur.
   ========================================================================== */

@layer components {
  [hidden] {
    display: none !important;
  }

  body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: var(--ds-space-6) var(--ds-space-4);
  }

  .ds-auth-wrapper {
    width: 100%;
    max-width: 30rem;
    margin-inline: auto;
    display: flex;
    flex-direction: column;
    gap: var(--ds-space-5);
  }

  .ds-auth-wrapper--wide {
    max-width: 42rem;
  }

  .ds-auth-header {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--ds-space-1);
  }

  .ds-auth-title {
    font-size: var(--ds-text-2xl);
    font-weight: 700;
    letter-spacing: -0.02em;
  }

  .ds-auth-subtitle {
    font-size: var(--ds-text-sm);
    color: var(--ds-color-text-muted);
  }

  .ds-google-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--ds-space-3);
    padding-block: var(--ds-space-2);
  }

  .ds-google-mount {
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
  }

  .ds-divider-subtle {
    display: flex;
    align-items: center;
    text-align: center;
    color: var(--ds-color-text-muted);
    font-size: var(--ds-text-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-block: var(--ds-space-2);
  }

  .ds-divider-subtle::before,
  .ds-divider-subtle::after {
    content: "";
    flex: 1;
    border-bottom: 1px solid var(--ds-color-border);
  }

  .ds-divider-subtle:not(:empty)::before {
    margin-right: var(--ds-space-3);
  }

  .ds-divider-subtle:not(:empty)::after {
    margin-left: var(--ds-space-3);
  }

  /* retired */ .ds-secondary-access {
    background-color: var(--ds-color-surface-subtle);
    border: 1px solid var(--ds-color-border);
    border-radius: var(--ds-radius-md);
    padding: var(--ds-space-4);
    display: flex;
    flex-direction: column;
    gap: var(--ds-space-3);
  }

  /* retired */ .ds-secondary-access summary {
    font-size: var(--ds-text-xs);
    font-weight: 600;
    color: var(--ds-color-text-muted);
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  /* retired */ .ds-secondary-access summary::-webkit-details-marker {
    display: none;
  }

  /* retired */ .ds-secondary-access summary:hover {
    color: var(--ds-color-on-surface);
  }

  .ds-code-well {
    background-color: var(--ds-color-surface-subtle);
    color: var(--ds-color-on-surface);
    border: 1px solid var(--ds-color-border-strong);
    border-radius: var(--ds-radius-md);
    padding: var(--ds-space-4);
    font-family: var(--ds-font-mono);
    font-size: var(--ds-text-xs);
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-x: auto;
  }

  .ds-step-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: var(--ds-space-3);
  }

  .ds-step-card {
    padding: var(--ds-space-3) var(--ds-space-4);
    background-color: var(--ds-color-surface-subtle);
    border: 1px solid var(--ds-color-border);
    border-radius: var(--ds-radius-sm);
    display: flex;
    flex-direction: column;
    gap: var(--ds-space-1);
    font-size: var(--ds-text-sm);
  }

  .ds-step-card a,
  .ds-callout a {
    color: var(--ds-color-primary);
    font-weight: 600;
    text-decoration: underline;
  }

  .ds-callout {
    padding: var(--ds-space-3) var(--ds-space-4);
    background-color: var(--ds-color-surface-subtle);
    border: 1px solid var(--ds-color-border);
    border-left: 3px solid var(--ds-color-primary);
    border-radius: var(--ds-radius-sm);
    font-size: var(--ds-text-sm);
    color: var(--ds-color-on-surface);
    display: flex;
    flex-direction: column;
    gap: var(--ds-space-1);
  }

  .ds-actions-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--ds-space-3);
  }

  /* Choice stack & interactive cards */
  .ds-choice-stack {
    display: flex;
    flex-direction: column;
    gap: var(--ds-space-3);
  }

  .ds-choice-card {
    background-color: var(--ds-color-surface-subtle);
    border: 1px solid var(--ds-color-border);
    border-radius: var(--ds-radius-md);
    transition: border-color var(--ds-transition-fast), background-color var(--ds-transition-fast);
    overflow: hidden;
  }

  .ds-choice-card.is-active,
  .ds-choice-card[data-active="true"] {
    border-color: var(--ds-color-primary);
    background-color: var(--ds-color-surface);
  }

  .ds-choice-card__header {
    padding: var(--ds-space-4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--ds-space-3);
    user-select: none;
  }

  .ds-choice-card__header:focus-visible {
    outline: 2px solid var(--ds-color-focus);
    outline-offset: -2px;
  }

  .ds-choice-card__title-group {
    display: flex;
    align-items: center;
    gap: var(--ds-space-3);
    text-align: left;
  }

  .ds-choice-card__indicator {
    width: 20px;
    height: 20px;
    border-radius: var(--ds-radius-full);
    border: 2px solid var(--ds-color-border-strong);
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: var(--ds-color-surface);
  }

  .ds-choice-card.is-active .ds-choice-card__indicator,
  .ds-choice-card[data-active="true"] .ds-choice-card__indicator {
    border-color: var(--ds-color-primary);
  }

  .ds-choice-card.is-active .ds-choice-card__indicator::after,
  .ds-choice-card[data-active="true"] .ds-choice-card__indicator::after {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: var(--ds-radius-full);
    background-color: var(--ds-color-primary);
  }

  .ds-choice-card__title {
    font-size: var(--ds-text-sm);
    font-weight: 600;
    color: var(--ds-color-on-surface);
    display: block;
    margin: 0;
  }

  .ds-choice-card__subtitle {
    font-size: var(--ds-text-xs);
    color: var(--ds-color-text-muted);
    display: block;
    margin: 0;
  }

  .ds-choice-card__body {
    padding: 0 var(--ds-space-4) var(--ds-space-4) var(--ds-space-4);
    display: flex;
    flex-direction: column;
    gap: var(--ds-space-3);
  }

  .ds-choice-card--action {
    padding: var(--ds-space-4);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--ds-space-3);
    width: 100%;
    cursor: pointer;
    font: inherit;
    color: inherit;
    text-align: left;
  }

  .ds-choice-card--action:hover {
    border-color: var(--ds-color-primary);
    background-color: var(--ds-color-surface);
  }

  .ds-choice-card--action:focus-visible {
    outline: 2px solid var(--ds-color-focus);
    outline-offset: -2px;
  }

  .ds-choice-card__arrow {
    font-size: var(--ds-text-lg);
    font-weight: 600;
    color: var(--ds-color-text-muted);
    transition: transform var(--ds-transition-fast), color var(--ds-transition-fast);
  }

  .ds-choice-card--action:hover .ds-choice-card__arrow {
    transform: translateX(4px);
    color: var(--ds-color-primary);
  }

  /* Input with prefix */
  .ds-input-prefix-wrap {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
  }

  .ds-input-prefix {
    position: absolute;
    left: var(--ds-space-3);
    color: var(--ds-color-text-muted);
    font-weight: 600;
    font-family: var(--ds-font-mono);
    pointer-events: none;
    user-select: none;
  }

  .ds-input--with-prefix {
    padding-left: calc(var(--ds-space-3) * 2 + 0.6ch);
  }

  /* Identity live preview */
  .ds-identity-preview {
    padding: var(--ds-space-3);
    background-color: var(--ds-color-surface-subtle);
    border: 1px solid var(--ds-color-border);
    border-radius: var(--ds-radius-sm);
    display: flex;
    align-items: center;
    gap: var(--ds-space-3);
  }

  .ds-identity-preview__avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--ds-radius-full);
    border: 1px solid var(--ds-color-border);
    flex-shrink: 0;
    object-fit: cover;
    background-color: var(--ds-color-surface);
  }

  .ds-identity-preview__meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
  }

  .ds-identity-preview__name {
    font-size: var(--ds-text-sm);
    font-weight: 600;
    color: var(--ds-color-on-surface);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .ds-mono-value {
    font-family: var(--ds-font-mono);
    font-size: var(--ds-text-xs);
    color: var(--ds-color-text-muted);
  }

  .ds-btn-full {
    width: 100%;
    justify-content: center;
  }

  /* ==========================================================================
     AUTH TABS & MODERN ACCESS REQUEST UI
     ========================================================================== */
  .ds-auth-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background-color: var(--ds-color-surface-subtle);
    padding: 4px;
    border-radius: var(--ds-radius-md);
    border: 1px solid var(--ds-color-border);
    gap: 4px;
    margin-bottom: var(--ds-space-4);
  }

  .ds-auth-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--ds-space-2);
    padding: 9px var(--ds-space-3);
    border-radius: var(--ds-radius-sm);
    border: none;
    background: transparent;
    font-size: var(--ds-text-xs);
    font-weight: 500;
    color: var(--ds-color-text-muted);
    cursor: pointer;
    transition: all 0.15s ease-in-out;
  }

  .ds-auth-tab:hover {
    color: var(--ds-color-on-surface);
  }

  .ds-auth-tab.is-active {
    background-color: var(--ds-color-surface);
    color: var(--ds-color-on-surface);
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  }

  .ds-tab-icon {
    flex-shrink: 0;
    pointer-events: none;
  }

  .ds-auth-tab span {
    pointer-events: none;
  }

  .ds-auth-panel {
    display: flex;
    flex-direction: column;
    gap: var(--ds-space-3);
  }

  .ds-auth-panel-intro {
    text-align: center;
    margin-bottom: var(--ds-space-1);
  }

  .ds-auth-panel-title {
    font-size: var(--ds-text-sm);
    font-weight: 700;
    color: var(--ds-color-on-surface);
    margin-bottom: 4px;
  }

  .ds-auth-panel-desc {
    font-size: var(--ds-text-xs);
    color: var(--ds-color-text-muted);
    line-height: 1.4;
  }

  .ds-auth-panel-footer {
    margin-top: var(--ds-space-2);
    padding-top: var(--ds-space-3);
    border-top: 1px solid var(--ds-color-border);
    text-align: center;
  }

  .ds-auth-help-text {
    font-size: var(--ds-text-xs);
    color: var(--ds-color-text-muted);
  }

  .ds-link-btn {
    background: none;
    border: none;
    padding: 0;
    margin-left: 4px;
    color: var(--ds-color-primary, #00004a);
    font-weight: 600;
    font-size: var(--ds-text-xs);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: opacity 0.15s;
  }

  .ds-link-btn:hover {
    opacity: 0.8;
  }

  .ds-field-hint {
    font-size: 11px;
    color: var(--ds-color-text-muted);
    margin-top: 4px;
    line-height: 1.4;
  }

  .ds-required {
    color: var(--ds-color-accent, #d00000);
  }

  .ds-optional {
    font-weight: 400;
    font-size: 11px;
    color: var(--ds-color-text-muted);
  }

  .ds-input-prefix-wrap {
    display: flex;
    align-items: stretch;
    border: 1px solid var(--ds-color-border-strong);
    border-radius: var(--ds-radius-sm);
    background-color: var(--ds-color-surface);
    overflow: hidden;
    transition: border-color 0.15s;
  }

  .ds-input-prefix-wrap:focus-within {
    border-color: var(--ds-color-focus, var(--ds-color-primary));
    box-shadow: 0 0 0 2px rgba(0, 0, 74, 0.1);
  }

  .ds-input-prefix {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    background-color: var(--ds-color-surface-subtle);
    color: var(--ds-color-text-muted);
    font-family: var(--ds-font-mono);
    font-size: var(--ds-text-xs);
    font-weight: 600;
    border-right: 1px solid var(--ds-color-border);
    user-select: none;
  }

  .ds-input-has-prefix {
    border: none !important;
    border-radius: 0 !important;
    flex: 1;
    box-shadow: none !important;
    padding: var(--ds-space-2) var(--ds-space-3);
  }

  .ds-btn-arrow {
    margin-left: 6px;
    transition: transform 0.15s ease;
  }

  .ds-btn:hover .ds-btn-arrow {
    transform: translateX(3px);
  }

  .ds-confirmation-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: var(--ds-space-5) var(--ds-space-4);
    background-color: var(--ds-color-surface-subtle);
    border: 1px solid var(--ds-color-border);
    border-radius: var(--ds-radius-md);
    gap: var(--ds-space-3);
  }

  .ds-confirmation-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: rgba(16, 185, 129, 0.15);
    color: #10b981;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .ds-confirmation-title {
    font-size: var(--ds-text-sm);
    font-weight: 700;
    color: var(--ds-color-on-surface);
  }

  .ds-confirmation-desc {
    font-size: var(--ds-text-xs);
    color: var(--ds-color-text-muted);
    line-height: 1.5;
    max-width: 320px;
  }

}
