/* Allauth auth-shell stylesheet — Mailbot vocabulary overlay.
 *
 * Loaded AFTER deck.css from auth_base.html so the cascade replaces the
 * Havre-flavoured tokens with the Mailbot palette + type + spacing for
 * every /accounts/* server-rendered page (login, signup, password reset,
 * MFA setup, etc.).
 *
 * Why a separate file? deck.css drives the entire /deck/ admin surface
 * (Havre product). Changing its tokens in place would re-skin every
 * platform-admin screen. Scoping the change to this file keeps the
 * blast radius to auth pages only.
 *
 * Variable names mirror frontend_mailbot/src/index.css so auth and
 * Mailbot SPA share one design vocabulary.
 */

/* ===== Mailbot design tokens (light, default) ============================ */
:root {
  /* Neutral palette */
  --color-surface:         #ffffff;
  --color-surface-muted:   #f7f7f5;
  --color-surface-raised:  #ffffff;
  --color-surface-sunken:  #f1f1ee;

  --color-text:         #1a1a18;
  --color-text-muted:   #6c6c67;
  --color-text-subtle:  #9a9a93;

  --color-border:         #e7e7e3;
  --color-border-strong:  #d6d6d1;

  --color-danger:       #9b3d34;
  --color-danger-bg:    #f7ece9;
  --color-danger-line:  #e7c9c3;
  --color-success:      #436a4d;
  --color-success-bg:   #edf1ed;
  --color-success-line: #cadccf;
  --color-warning:      #8a6921;
  --color-warning-bg:   #f6f0e3;
  --color-warning-line: #e6d8b9;
  --color-info:         #3c4b5a;
  --color-info-bg:      #eef0f2;
  --color-info-line:    #d2d8de;

  --color-primary:           #1a1a18;
  --color-primary-contrast:  #ffffff;
  --color-accent:            #1a1a18;

  /* Spacing — 4px base */
  --spacing-1: 4px;
  --spacing-2: 8px;
  --spacing-3: 12px;
  --spacing-4: 16px;
  --spacing-5: 24px;
  --spacing-6: 32px;
  --spacing-7: 48px;

  /* Radii — sharp default, pill for chips */
  --radius-0:    0px;
  --radius-1:    2px;
  --radius-2:    4px;
  --radius-pill: 100px;

  /* Shadows — near-hairline */
  --shadow-raise: 0 1px 2px rgba(20, 18, 12, 0.05);
  --shadow-pop:
    0 2px 4px rgba(20, 18, 12, 0.06),
    0 8px 24px rgba(20, 18, 12, 0.1);

  /* Type */
  --font-sans: "Helvetica Neue", Helvetica, Arial, "Liberation Sans", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, monospace;

  --text-display: 28px;
  --text-display-lh: 1.12;
  --text-heading: 19px;
  --text-heading-lh: 1.2;
  --text-body: 13px;
  --text-body-lh: 1.5;
  --text-caption: 11px;
  --text-caption-lh: 1.45;
  --text-micro: 10px;
  --text-micro-lh: 1.2;

  /* ----- Bridge to deck.css legacy variable names -----
   *
   * deck.css consumes these names everywhere (--fg, --primary, --space-X,
   * --radius-md, etc.). Re-mapping them here means we don't have to rewrite
   * every rule that already references them — the cascade picks up the
   * Mailbot values via the legacy name.
   */
  --canvas:          var(--color-surface-muted);
  --surface:         var(--color-surface);
  --surface-sunken:  var(--color-surface-sunken);
  --surface-raised:  var(--color-surface-raised);
  --overlay:         rgba(20, 18, 12, 0.48);

  --text:        var(--color-text);
  --fg:          var(--color-text);
  --muted:       var(--color-text-muted);
  --fg-muted:    var(--color-text-muted);
  --fg-subtle:   var(--color-text-subtle);
  --fg-on-primary: var(--color-primary-contrast);
  --fg-on-accent:  var(--color-primary-contrast);

  --border:         var(--color-border);
  --border-strong:  var(--color-border-strong);
  --border-subtle:  var(--color-border);

  --primary:        var(--color-primary);
  --primary-hover:  var(--color-text);
  --primary-soft:   var(--color-surface-muted);

  --accent:         var(--color-accent);
  --accent-hover:   var(--color-text);
  --accent-soft:    var(--color-surface-muted);

  --success:        var(--color-success);
  --success-soft:   var(--color-success-bg);
  --warning:        var(--color-warning);
  --warning-soft:   var(--color-warning-bg);
  --danger:         var(--color-danger);
  --danger-soft:    var(--color-danger-bg);
  --info:           var(--color-info);
  --info-soft:      var(--color-info-bg);

  --focus-ring: 0 0 0 2px var(--color-surface), 0 0 0 4px var(--color-text);

  --ff-sans: var(--font-sans);
  --ff-mono: var(--font-mono);

  --text-2xs:  var(--text-micro);
  --text-xs:   var(--text-caption);
  --text-sm:   var(--text-body);
  --text-base: var(--text-body);
  --text-md:   var(--text-heading);
  --text-lg:   var(--text-heading);
  --text-xl:   var(--text-display);
  --text-2xl:  var(--text-display);

  --space-0:  0;
  --space-1:  var(--spacing-1);
  --space-2:  var(--spacing-2);
  --space-3:  var(--spacing-3);
  --space-4:  var(--spacing-4);
  --space-5:  var(--spacing-5);
  --space-6:  var(--spacing-6);
  --space-8:  var(--spacing-6);
  --space-10: var(--spacing-7);
  --space-12: var(--spacing-7);
  --space-16: 64px;

  --radius-xs:   var(--radius-1);
  --radius-sm:   var(--radius-1);
  --radius-md:   var(--radius-1);
  --radius-lg:   var(--radius-1);
  --radius:      var(--radius-1);

  --shadow-xs:    var(--shadow-raise);
  --shadow-sm:    var(--shadow-raise);
  --shadow-md:    var(--shadow-raise);
  --shadow-lg:    var(--shadow-pop);
  --shadow-inset: inset 0 1px 0 rgba(20, 18, 12, 0.04);
}

/* ===== Dark theme — explicit opt-in via [data-theme="dark"] ============== */
[data-theme="dark"] {
  --color-surface:         #161614;
  --color-surface-muted:   #1b1b18;
  --color-surface-raised:  #201f1c;
  --color-surface-sunken:  #121210;

  --color-text:         #ececea;
  --color-text-muted:   #9b9a93;
  --color-text-subtle:  #6a6a63;

  --color-border:         #2a2a26;
  --color-border-strong:  #38382f;

  --color-danger:       #cf8076;
  --color-danger-bg:    #2a1c19;
  --color-danger-line:  #4a2d27;
  --color-success:      #84ac8e;
  --color-success-bg:   #18211a;
  --color-success-line: #2c3b2f;
  --color-warning:      #c6a35e;
  --color-warning-bg:   #241f12;
  --color-warning-line: #3d341d;
  --color-info:         #9fb2c4;
  --color-info-bg:      #181d22;
  --color-info-line:    #2c333b;

  --color-primary:           #ececea;
  --color-primary-contrast:  #161614;
  --color-accent:            #ececea;

  --shadow-raise: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-pop:
    0 2px 4px rgba(0, 0, 0, 0.4),
    0 10px 30px rgba(0, 0, 0, 0.5);
}

/* First-paint dark — applied only when the user hasn't expressed a
 * preference. ``[data-theme="light"]`` on <html> wins over this block. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-surface:         #161614;
    --color-surface-muted:   #1b1b18;
    --color-surface-raised:  #201f1c;
    --color-surface-sunken:  #121210;

    --color-text:         #ececea;
    --color-text-muted:   #9b9a93;
    --color-text-subtle:  #6a6a63;

    --color-border:         #2a2a26;
    --color-border-strong:  #38382f;

    --color-danger:       #cf8076;
    --color-danger-bg:    #2a1c19;
    --color-danger-line:  #4a2d27;
    --color-success:      #84ac8e;
    --color-success-bg:   #18211a;
    --color-success-line: #2c3b2f;
    --color-warning:      #c6a35e;
    --color-warning-bg:   #241f12;
    --color-warning-line: #3d341d;
    --color-info:         #9fb2c4;
    --color-info-bg:      #181d22;
    --color-info-line:    #2c333b;

    --color-primary:           #ececea;
    --color-primary-contrast:  #161614;
    --color-accent:            #ececea;

    --shadow-raise: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-pop:
      0 2px 4px rgba(0, 0, 0, 0.4),
      0 10px 30px rgba(0, 0, 0, 0.5);
  }
}

/* ===== Body baseline — French-first leading, tabular mono ================ */
body.app.is-auth {
  font-family: var(--font-sans);
  font-size: var(--text-body);
  line-height: var(--text-body-lh);
  color: var(--color-text);
  background: var(--color-surface-muted);
}

body.app.is-auth code,
body.app.is-auth kbd,
body.app.is-auth samp,
body.app.is-auth pre,
body.app.is-auth .form-readonly,
body.app.is-auth .mfa-totp-secret,
body.app.is-auth .recovery-codes {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* ===== Auth card — centred, near-hairline, generous padding ============= */
.is-auth .auth-card {
  max-width: 420px;
  margin: 0 auto;
  padding: var(--spacing-6) var(--spacing-6);
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-1);
  box-shadow: var(--shadow-raise);
}
.is-auth .auth-card.is-wide { max-width: 560px; }

.is-auth .auth-card h1 {
  margin: 0 0 var(--spacing-2);
  font-family: var(--font-sans);
  font-size: var(--text-display);
  line-height: var(--text-display-lh);
  font-weight: 700;
  letter-spacing: -0.005em;
  color: var(--color-text);
}

.is-auth .auth-card .form-help {
  margin: 0 0 var(--spacing-4);
  font-size: var(--text-body);
  color: var(--color-text-muted);
}

.is-auth .auth-card-footer {
  margin-top: var(--spacing-5);
  padding-top: var(--spacing-4);
  border-top: 1px solid var(--color-border);
  font-family: var(--font-mono);
  font-size: var(--text-micro);
  color: var(--color-text-subtle);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.is-auth .auth-card-aside {
  margin: var(--spacing-5) 0 0;
  padding-top: var(--spacing-4);
  border-top: 1px solid var(--color-border);
  font-size: var(--text-caption);
  color: var(--color-text-muted);
}
.is-auth .auth-card-aside a {
  color: var(--color-text);
  font-weight: 600;
}

.is-auth .auth-card .info-block {
  padding: var(--spacing-3) var(--spacing-4);
  background: var(--color-info-bg);
  border: 1px solid var(--color-info-line);
  border-radius: var(--radius-1);
  color: var(--color-info);
  font-size: var(--text-body);
}

/* ===== Forms — Frow-style label width pattern ============================ */
.is-auth .form { display: grid; gap: var(--spacing-4); }

.is-auth .form-field { display: grid; gap: var(--spacing-1); }

/* Single-column on narrow widths; two-column "label : input" pattern
 * mirroring the Mailbot Frow once the card is wide enough.            */
@media (min-width: 540px) {
  .is-auth .auth-card.is-wide .form-field {
    grid-template-columns: 180px 1fr;
    align-items: start;
    gap: var(--spacing-2) var(--spacing-4);
  }
  .is-auth .auth-card.is-wide .form-field label { padding-top: 8px; }
  .is-auth .auth-card.is-wide .form-field .form-help,
  .is-auth .auth-card.is-wide .form-field .form-field-errors {
    grid-column: 2;
  }
}

.is-auth .form-field label {
  font-family: var(--font-sans);
  font-size: var(--text-body);
  font-weight: 600;
  color: var(--color-text);
}

.is-auth .form-field input,
.is-auth .form-field select,
.is-auth .form-field textarea {
  height: 36px;
  padding: 0 var(--spacing-3);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-1);
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  font-size: var(--text-body);
  line-height: var(--text-body-lh);
}
.is-auth .form-field textarea {
  height: auto;
  min-height: 80px;
  padding: var(--spacing-2) var(--spacing-3);
}
.is-auth .form-field input::placeholder,
.is-auth .form-field textarea::placeholder {
  color: var(--color-text-subtle);
}
.is-auth .form-field input:focus,
.is-auth .form-field select:focus,
.is-auth .form-field textarea:focus {
  outline: none;
  border-color: var(--color-text);
  box-shadow: 0 0 0 2px var(--color-surface), 0 0 0 3px var(--color-text);
}
.is-auth .form-field input[aria-invalid="true"],
.is-auth .form-field select[aria-invalid="true"],
.is-auth .form-field textarea[aria-invalid="true"] {
  border-color: var(--color-danger);
}

.is-auth .form-help {
  margin: 0;
  font-size: var(--text-caption);
  color: var(--color-text-muted);
}

.is-auth .form-field-errors {
  color: var(--color-danger);
  font-size: var(--text-caption);
}
.is-auth .form-field-errors:empty { display: none; }
.is-auth .form-field-errors ul {
  margin: 0;
  padding-left: var(--spacing-4);
}

.is-auth .form-error-summary {
  padding: var(--spacing-2) var(--spacing-3);
  background: var(--color-danger-bg);
  border: 1px solid var(--color-danger-line);
  border-radius: var(--radius-1);
  color: var(--color-danger);
  font-size: var(--text-caption);
}
.is-auth .form-error-summary:empty { display: none; }

/* Flash / inline messages (allauth ``messages`` framework). */
.is-auth .form-messages {
  display: grid;
  gap: var(--spacing-2);
  margin-bottom: var(--spacing-4);
}
.is-auth .form-message {
  padding: var(--spacing-2) var(--spacing-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-1);
  background: var(--color-surface-muted);
  color: var(--color-text);
  font-size: var(--text-caption);
}
.is-auth .form-message--error,
.is-auth .form-message--danger {
  background: var(--color-danger-bg);
  border-color: var(--color-danger-line);
  color: var(--color-danger);
}
.is-auth .form-message--success {
  background: var(--color-success-bg);
  border-color: var(--color-success-line);
  color: var(--color-success);
}
.is-auth .form-message--warning {
  background: var(--color-warning-bg);
  border-color: var(--color-warning-line);
  color: var(--color-warning);
}
.is-auth .form-message--info {
  background: var(--color-info-bg);
  border-color: var(--color-info-line);
  color: var(--color-info);
}

.is-auth .form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-3);
  margin-top: var(--spacing-4);
  padding: 0;
  background: transparent;
  position: static;
}
.is-auth .form-actions-end {
  margin-left: auto;
  display: inline-flex;
  gap: var(--spacing-2);
}

/* ===== Buttons — neutral, primary, ghost, danger ========================= */
.is-auth .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-2);
  padding: 0 var(--spacing-4);
  height: 36px;
  font-family: var(--font-sans);
  font-size: var(--text-body);
  font-weight: 600;
  border-radius: var(--radius-1);
  border: 1px solid transparent;
  background: transparent;
  color: var(--color-text);
  cursor: pointer;
  text-decoration: none;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
  white-space: nowrap;
}
.is-auth .btn:hover { text-decoration: none; }
.is-auth .btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--color-surface), 0 0 0 3px var(--color-text);
}
.is-auth .btn:disabled,
.is-auth .btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}
.is-auth .btn-primary {
  background: var(--color-primary);
  color: var(--color-primary-contrast);
  border-color: var(--color-primary);
}
.is-auth .btn-primary:hover {
  background: var(--color-primary);
  color: var(--color-primary-contrast);
  opacity: 0.9;
}
.is-auth .btn-secondary {
  background: var(--color-surface);
  border-color: var(--color-border-strong);
  color: var(--color-text);
}
.is-auth .btn-secondary:hover { background: var(--color-surface-muted); }
.is-auth .btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
}
.is-auth .btn-ghost:hover {
  background: var(--color-surface-muted);
  color: var(--color-text);
}
.is-auth .btn-danger {
  background: var(--color-danger-bg);
  color: var(--color-danger);
  border-color: var(--color-danger-line);
}
.is-auth .btn-danger:hover {
  background: var(--color-danger-bg);
  border-color: var(--color-danger);
}

/* ===== SSO buttons — neutral by default, provider dot for colour ========= */
.is-auth .auth-sso-section {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-2);
  margin-bottom: var(--spacing-4);
}
.is-auth .auth-sso-section > form { margin: 0; }

.is-auth .auth-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-2);
  width: 100%;
  height: 40px;
  padding: 0 var(--spacing-4) 0 calc(var(--spacing-4) + var(--spacing-3));
  font-family: var(--font-sans);
  font-size: var(--text-body);
  font-weight: 600;
  border-radius: var(--radius-1);
  border: 1px solid var(--color-border-strong);
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
}
.is-auth .auth-button:hover {
  background: var(--color-surface-muted);
  border-color: var(--color-border-strong);
  color: var(--color-text);
}

/* Provider colour goes on a small dot, never the whole button. Keeps the
 * surface neutral. ::before sits left of the label. */
.is-auth .auth-button::before {
  content: "";
  position: absolute;
  left: var(--spacing-4);
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--color-border-strong);
}
.is-auth .auth-button--sso {
  background: var(--color-primary);
  color: var(--color-primary-contrast);
  border-color: var(--color-primary);
}
.is-auth .auth-button--sso:hover {
  background: var(--color-primary);
  color: var(--color-primary-contrast);
  border-color: var(--color-primary);
  opacity: 0.9;
}
.is-auth .auth-button--sso::before { background: var(--color-primary-contrast); }
.is-auth .auth-button--google {
  background: var(--color-surface);
  color: var(--color-text);
  border-color: var(--color-border-strong);
}
.is-auth .auth-button--google::before { background: #ea4335; }
.is-auth .auth-button--microsoft {
  background: var(--color-surface);
  color: var(--color-text);
  border-color: var(--color-border-strong);
}
.is-auth .auth-button--microsoft:hover {
  background: var(--color-surface-muted);
  color: var(--color-text);
  border-color: var(--color-border-strong);
}
.is-auth .auth-button--microsoft::before { background: #0078d4; }
.is-auth .auth-button--apple {
  background: var(--color-surface);
  color: var(--color-text);
  border-color: var(--color-border-strong);
}
.is-auth .auth-button--apple:hover {
  background: var(--color-surface-muted);
  color: var(--color-text);
  border-color: var(--color-border-strong);
}
.is-auth .auth-button--apple::before { background: var(--color-text); }

.is-auth .auth-divider {
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
  margin: var(--spacing-2) 0;
  font-family: var(--font-mono);
  font-size: var(--text-micro);
  color: var(--color-text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.is-auth .auth-divider::before,
.is-auth .auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

/* ===== Topbar + page header — quiet, hairline ============================ */
.is-auth.app .app-topbar {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
}
.is-auth.app .app-brand {
  color: var(--color-text);
  font-family: var(--font-sans);
  font-weight: 600;
}
.is-auth.app .app-brand-mark {
  background: var(--color-surface-muted);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-1);
  font-family: var(--font-mono);
  font-size: var(--text-micro);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.is-auth.app .app-icon-btn {
  color: var(--color-text-muted);
  border-radius: var(--radius-1);
}
.is-auth.app .app-icon-btn:hover {
  background: var(--color-surface-muted);
  color: var(--color-text);
}
.is-auth.app .app-page-header {
  background: transparent;
  border-bottom: 0;
  padding: 0;
}
.is-auth.app .app-main {
  min-height: calc(100vh - var(--shell-topbar-h));
  align-content: center;
  align-content: safe center;
  background: var(--color-surface-muted);
}
.is-auth.app .app-content {
  width: 100%;
  max-width: none;
}

/* ===== Misc auth bits ==================================================== */
.is-auth .muted        { color: var(--color-text-muted); }
.is-auth .subtle       { color: var(--color-text-subtle); }

.is-auth .empty-state {
  padding: var(--spacing-6) var(--spacing-5);
  text-align: center;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-1);
  color: var(--color-text-muted);
}
.is-auth .empty-state h2 {
  margin: 0 0 var(--spacing-2);
  font-size: var(--text-heading);
  color: var(--color-text);
}
.is-auth .empty-state p {
  margin: 0 0 var(--spacing-3);
  font-size: var(--text-body);
}

.is-auth .tag {
  font-family: var(--font-mono);
  font-size: var(--text-caption);
  padding: 2px var(--spacing-2);
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  color: var(--color-text-muted);
}

.is-auth .email-list {
  list-style: none;
  margin: 0 0 var(--spacing-4);
  padding: 0;
  display: grid;
  gap: var(--spacing-2);
}
.is-auth .email-list li {
  display: grid;
  grid-template-columns: 1fr max-content;
  align-items: center;
  gap: var(--spacing-3);
  padding: var(--spacing-3);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-1);
}
.is-auth .email-list .email-tags {
  display: inline-flex;
  gap: var(--spacing-1);
  margin-left: var(--spacing-2);
}
.is-auth .email-list .email-tags .tag.is-primary {
  background: var(--color-success-bg);
  border-color: var(--color-success-line);
  color: var(--color-success);
}
.is-auth .email-list .email-tags .tag.is-unverified {
  background: var(--color-warning-bg);
  border-color: var(--color-warning-line);
  color: var(--color-warning);
}

.is-auth .mfa-totp-setup {
  display: grid;
  gap: var(--spacing-4);
  margin-bottom: var(--spacing-4);
}
.is-auth .mfa-totp-qr {
  display: flex;
  justify-content: center;
  padding: var(--spacing-4);
  background: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-1);
}
.is-auth .mfa-totp-qr img { max-width: 200px; height: auto; }
.is-auth .mfa-totp-secret {
  display: block;
  padding: var(--spacing-3);
  background: var(--color-surface-sunken);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-1);
  font-family: var(--font-mono);
  font-size: var(--text-body);
  text-align: center;
  word-break: break-all;
}

.is-auth .recovery-codes {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--spacing-2);
  margin: var(--spacing-3) 0 var(--spacing-4);
  padding: var(--spacing-4);
  background: var(--color-surface-sunken);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-1);
  font-family: var(--font-mono);
  font-size: var(--text-body);
  list-style: none;
}
.is-auth .recovery-codes li {
  padding: var(--spacing-1) var(--spacing-2);
  background: var(--color-surface);
  border-radius: var(--radius-1);
  text-align: center;
}

/* Reduced-motion killswitch — strips animation + transitions. */
@media (prefers-reduced-motion: reduce) {
  .is-auth *,
  .is-auth *::before,
  .is-auth *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ===========================================================================
   Theme cycle button — light / dark / system (MAI-229)
   ===========================================================================
   The auth topbar swaps a single icon to reflect the active PREFERENCE
   (mirrored on <html data-theme-pref>): sun = light, moon = dark, monitor =
   following the OS. Only one glyph shows at a time. Applies to every auth
   page (tenant + staff); the resolved [data-theme] still drives all colours.
   ======================================================================== */
.is-auth .app-theme-glyph { display: none; }
[data-theme-pref="light"] .is-auth .app-theme-glyph--light,
[data-theme-pref="dark"] .is-auth .app-theme-glyph--dark,
[data-theme-pref="system"] .is-auth .app-theme-glyph--system {
  display: inline-block;
}
/* No stored/SSR preference yet (pre-paint disabled): fall back to the monitor
   glyph so the control is never blank. */
html:not([data-theme-pref]) .is-auth .app-theme-glyph--system { display: inline-block; }

/* ===========================================================================
   Paraphe (Aurore) tenant overlay — MAI-229
   ===========================================================================

   Brings the tenant-subdomain auth surface (data-shell="tenant") in line with
   the frontend_paraphe SPA's "Aurore thémable" look: indigo Ardoise palette,
   aurora gradient + glow on the brand/primary, frosted glass topbar, radial
   palette wash behind the card, accent focus rings, generous radii.

   Mechanism mirrors frontend_paraphe/src/index.css 1:1 so the colours match
   the SPA pixel-for-pixel: a palette sets only the 5 anchors (--a1..--a3,
   --accent, --accent-2, --tint); the shared light/dark recipes DERIVE every
   --color-* token via color-mix. We pin the DEFAULT Ardoise palette only (no
   data-palette switching pre-login) and keep the existing light/dark toggle.

   Scoped entirely under [data-shell="tenant"] so the staff /deck/ auth surface
   (data-shell="staff") keeps its charcoal Mailbot look untouched. The legacy
   deck.css bridge (--primary, --surface, --accent… → var(--color-*)) re-derives
   automatically, and the white-label tenant <style> override in auth_base.html
   still wins because it loads after this file.
   ======================================================================== */

/* Palette-independent SHAPES, late-bound COLOURS (read the anchors below). */
html[data-shell="tenant"] {
  --grad-aurora: linear-gradient(115deg, var(--a1) 0%, var(--a2) 52%, var(--a3) 100%);
  --grad-aurora-soft: linear-gradient(115deg, var(--a1) 0%, var(--a2) 55%, var(--a3) 100%);
  --glass: color-mix(in srgb, var(--color-surface) 62%, transparent);
  --glass-strong: color-mix(in srgb, var(--color-surface) 80%, transparent);
  --glass-line: color-mix(in srgb, var(--accent) 18%, transparent);

  /* Aurore's generous card radii (auth.css base only ships 0/1/2/pill). */
  --radius-3: 12px;
  --radius-4: 18px;
  --radius-5: 26px;
}

/* ----- Ardoise · LIGHT — anchors + derived recipe (= index.css light block).
   :not([data-theme="dark"]) so the server default (data-theme="light", and the
   bare/no-theme fallback) both resolve to this. --- */
html[data-shell="tenant"]:not([data-theme="dark"]) {
  --a1: #3f57c8;
  --a2: #5566d2;
  --a3: #8a7be6;
  --accent: #4257c4;
  --accent-2: #6878db;
  --tint: #5d6a8a;

  --color-surface: color-mix(in srgb, var(--tint) 2%, #fff);
  --color-surface-muted: color-mix(in srgb, var(--tint) 6%, #f5f6fa);
  --color-surface-raised: #fff;
  --color-surface-sunken: color-mix(in srgb, var(--tint) 6%, #fff);
  --color-text: color-mix(in srgb, var(--tint) 20%, #161826);
  --color-text-muted: color-mix(in srgb, var(--tint) 18%, #565d70);
  --color-text-subtle: color-mix(in srgb, var(--tint) 15%, #8b91a4);
  --color-border: color-mix(in srgb, var(--tint) 15%, #e6e8ee);
  --color-border-strong: color-mix(in srgb, var(--tint) 24%, #d9dce4);
  --color-primary: var(--accent);
  --color-primary-contrast: #fff;
  --color-accent: var(--accent);
  --color-accent-soft: color-mix(in srgb, var(--accent) 11%, var(--color-surface));
  --color-accent-line: color-mix(in srgb, var(--accent) 26%, var(--color-surface));
  --color-accent-ink: color-mix(in srgb, var(--accent) 76%, #1a1c2a);
  --color-danger: #d23667;
  --color-danger-bg: color-mix(in srgb, #f4527e 13%, var(--color-surface));
  --color-danger-line: color-mix(in srgb, #f4527e 30%, var(--color-surface));
  --color-success: #0c8f78;
  --color-success-bg: color-mix(in srgb, #16b598 14%, var(--color-surface));
  --color-success-line: color-mix(in srgb, #16b598 30%, var(--color-surface));
  --color-warning: #c2700a;
  --color-warning-bg: color-mix(in srgb, #f59e3c 16%, var(--color-surface));
  --color-warning-line: color-mix(in srgb, #f59e3c 40%, var(--color-surface));
  --color-info: #2f73d6;
  --color-info-bg: color-mix(in srgb, #2b87d6 13%, var(--color-surface));
  --color-info-line: color-mix(in srgb, #2b87d6 34%, var(--color-surface));

  --shadow-raise: 0 1px 2px rgb(30 25 60 / 6%), 0 2px 8px rgb(30 25 60 / 5%);
  --shadow-pop: 0 2px 4px rgb(40 30 80 / 7%), 0 8px 24px rgb(40 30 80 / 10%);
  --shadow-glow: 0 12px 40px color-mix(in srgb, var(--accent) 30%, transparent);
}

/* ----- Ardoise · DARK — anchors + derived recipe (= index.css dark block). */
html[data-shell="tenant"][data-theme="dark"] {
  --a1: #7b93ff;
  --a2: #93a0ff;
  --a3: #ada8ff;
  --accent: #8ea0ff;
  --accent-2: #aab2ff;
  --tint: #6c7ea3;

  --color-surface: color-mix(in srgb, var(--tint) 12%, #14151d);
  --color-surface-muted: color-mix(in srgb, var(--tint) 10%, #0a0b12);
  --color-surface-raised: color-mix(in srgb, var(--tint) 14%, #191b24);
  --color-surface-sunken: color-mix(in srgb, var(--tint) 9%, #101119);
  --color-text: color-mix(in srgb, var(--tint) 6%, #f1edff);
  --color-text-muted: color-mix(in srgb, var(--tint) 14%, #b2acc8);
  --color-text-subtle: color-mix(in srgb, var(--tint) 16%, #76728e);
  --color-border: color-mix(in srgb, var(--tint) 22%, #2a2c38);
  --color-border-strong: color-mix(in srgb, var(--tint) 30%, #34374a);
  --color-primary: var(--accent);
  --color-primary-contrast: #0c0f15;
  --color-accent: var(--accent);
  --color-accent-soft: color-mix(in srgb, var(--accent) 18%, var(--color-surface));
  --color-accent-line: color-mix(in srgb, var(--accent) 36%, var(--color-surface));
  --color-accent-ink: color-mix(in srgb, var(--accent) 82%, #f1edff);
  --color-danger: #ff7aa0;
  --color-danger-bg: color-mix(in srgb, #ff5a82 16%, var(--color-surface));
  --color-danger-line: color-mix(in srgb, #ff5a82 34%, var(--color-surface));
  --color-success: #4fe0c4;
  --color-success-bg: color-mix(in srgb, #28d2b4 15%, var(--color-surface));
  --color-success-line: color-mix(in srgb, #28d2b4 32%, var(--color-surface));
  --color-warning: #f6b25e;
  --color-warning-bg: color-mix(in srgb, #f59e3c 18%, var(--color-surface));
  --color-warning-line: color-mix(in srgb, #f59e3c 42%, var(--color-surface));
  --color-info: #74b0f5;
  --color-info-bg: color-mix(in srgb, #5096f0 18%, var(--color-surface));
  --color-info-line: color-mix(in srgb, #5096f0 40%, var(--color-surface));

  --shadow-raise: 0 1px 2px rgb(0 0 0 / 50%);
  --shadow-pop: 0 2px 4px rgb(0 0 0 / 40%), 0 10px 30px rgb(0 0 0 / 50%);
  --shadow-glow: 0 14px 50px color-mix(in srgb, var(--accent) 42%, transparent);
}

/* ----- Component restyles (tenant scope). The html[data-shell] prefix keeps
   specificity above the base .is-auth rules so these win without !important. */

/* Radial palette wash behind the card — mirrors MailbotShell's shell bg. */
html[data-shell="tenant"] body.app.is-auth {
  background-color: var(--color-surface-muted);
  background-image:
    radial-gradient(1200px 680px at 92% -10%, color-mix(in srgb, var(--a1) 28%, transparent), transparent 56%),
    radial-gradient(1000px 620px at 2% 108%, color-mix(in srgb, var(--a2) 26%, transparent), transparent 55%);
  background-attachment: fixed;
}
html[data-shell="tenant"] .is-auth.app .app-main { background: transparent; }

/* Frosted-glass topbar. */
html[data-shell="tenant"] .is-auth.app .app-topbar {
  background: var(--glass-strong);
  border-bottom: 1px solid var(--glass-line);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
}

/* Gradient brand tile with accent glow (only when no tenant logo is set). */
html[data-shell="tenant"] .is-auth.app .app-brand-mark {
  background: var(--grad-aurora);
  border: 0;
  border-radius: var(--radius-3);
  color: #fff;
  box-shadow: var(--shadow-glow);
}

/* Card — Aurore elevation + softer corners. */
html[data-shell="tenant"] .is-auth .auth-card {
  border-radius: var(--radius-4);
  box-shadow: var(--shadow-pop);
}

/* Inputs — softer corners + accent focus ring (replaces the charcoal ring). */
html[data-shell="tenant"] .is-auth .form-field input,
html[data-shell="tenant"] .is-auth .form-field select,
html[data-shell="tenant"] .is-auth .form-field textarea {
  border-radius: var(--radius-2);
}
html[data-shell="tenant"] .is-auth .form-field input:focus,
html[data-shell="tenant"] .is-auth .form-field select:focus,
html[data-shell="tenant"] .is-auth .form-field textarea:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px var(--color-accent-soft);
}

/* Buttons — pill family; primary gets the aurora gradient + glow. */
html[data-shell="tenant"] .is-auth .btn {
  border-radius: var(--radius-pill);
}
html[data-shell="tenant"] .is-auth .btn:focus-visible {
  box-shadow: 0 0 0 2px var(--color-surface), 0 0 0 4px var(--color-accent);
}
html[data-shell="tenant"] .is-auth .btn-primary {
  background: var(--grad-aurora);
  border-color: transparent;
  color: #fff;
  box-shadow: var(--shadow-glow);
}
html[data-shell="tenant"] .is-auth .btn-primary:hover {
  background: var(--grad-aurora);
  color: #fff;
  opacity: 1;
  filter: brightness(1.05);
}

/* SSO buttons — soften corners; the custom-SSO variant rides the gradient. */
html[data-shell="tenant"] .is-auth .auth-button {
  border-radius: var(--radius-3);
}
html[data-shell="tenant"] .is-auth .auth-button--sso {
  background: var(--grad-aurora);
  border-color: transparent;
  color: #fff;
}
html[data-shell="tenant"] .is-auth .auth-button--sso:hover {
  background: var(--grad-aurora);
  border-color: transparent;
  color: #fff;
  opacity: 1;
  filter: brightness(1.05);
}
html[data-shell="tenant"] .is-auth .auth-button--sso::before {
  background: #fff;
}
