    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

    :root {
      --bg: #050508;
      --card: rgba(20, 20, 28, 0.7);
      --card-border: rgba(255, 255, 255, 0.06);
      --text: #ffffff;
      --text-dim: #8b8b96;
      --text-muted: #5e5e6a;
      --input-bg: rgba(15, 15, 22, 0.6);
      --input-border: rgba(255, 255, 255, 0.08);
      --input-border-focus: rgba(139, 92, 246, 0.4);
      --accent-purple: #8b5cf6;
      --accent-blue: #3b82f6;
      --accent-cyan: #06b6d4;
      --error: #ef4444;
      --success: #10b981;
    }

    html, body { height: 100%; }
    body {
      font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
      background: var(--bg);
      color: var(--text);
      overflow: hidden;
      position: relative;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 24px;
    }

    /* Dot grid (allineato all'Ecosystem) */
    body::before {
      content: '';
      position: fixed;
      inset: 0;
      background-image: radial-gradient(rgba(255,255,255,0.018) 1px, transparent 1px);
      background-size: 22px 22px;
      pointer-events: none;
      z-index: 0;
    }

    /* Ambient glow Lead Lift (allineato all'Ecosystem, opacità contenute) */
    .ambient {
      position: fixed;
      pointer-events: none;
      z-index: 0;
      border-radius: 50%;
      filter: blur(120px);
      opacity: 0.18;
    }
    .ambient.a1 { width: 800px; height: 800px; top: -200px; left: -200px; background: #8b3bff; }
    .ambient.a2 { width: 900px; height: 900px; bottom: -300px; right: -200px; background: #67edd1; }
    .ambient.a3 { width: 600px; height: 600px; top: 30%; left: 40%; background: #ec4899; opacity: 0.08; }

    /* Login container */
    .login-wrapper {
      position: relative;
      z-index: 1;
      width: 100%;
      max-width: 440px;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 32px;
    }

    .brand {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 16px;
    }

    .brand img {
      width: 72px;
      height: 72px;
      border-radius: 16px;
      object-fit: cover;
      box-shadow: 0 8px 32px rgba(139, 92, 246, 0.15);
    }

    .brand-text {
      text-align: center;
    }

    .brand-title {
      font-size: 22px;
      font-weight: 700;
      letter-spacing: -0.02em;
      margin-bottom: 4px;
      text-wrap: balance;
    }

    .brand-subtitle {
      font-size: 15px;
      color: var(--text-dim);
      font-weight: 400;
    }

    /* Card */
    .card {
      width: 100%;
      background: var(--card);
      border: 1px solid var(--card-border);
      backdrop-filter: blur(24px);
      -webkit-backdrop-filter: blur(24px);
      border-radius: 20px;
      padding: 32px;
      box-shadow: 0 16px 64px rgba(0, 0, 0, 0.4);
    }

    /* Form */
    .form-group {
      margin-bottom: 20px;
    }

    .form-group:last-of-type {
      margin-bottom: 24px;
    }

    label {
      display: block;
      font-size: 13.5px;
      font-weight: 600;
      color: var(--text);
      margin-bottom: 10px;
    }

    .input-wrapper {
      position: relative;
    }

    .input-icon {
      position: absolute;
      left: 16px;
      top: 50%;
      transform: translateY(-50%);
      width: 18px;
      height: 18px;
      color: var(--text-muted);
      pointer-events: none;
    }

    .input-toggle {
      position: absolute;
      right: 2px;
      top: 50%;
      transform: translateY(-50%);
      width: 44px;
      height: 44px;
      display: flex;
      align-items: center;
      justify-content: center;
      background: transparent;
      border: none;
      color: var(--text-muted);
      cursor: pointer;
      border-radius: 8px;
      transition: color 0.15s, background 0.15s;
    }

    .input-toggle:hover {
      color: var(--text-dim);
      background: rgba(255, 255, 255, 0.04);
    }

    input[type="email"],
    input[type="password"],
    input[type="text"] {
      width: 100%;
      height: 48px;
      padding: 0 16px 0 48px;
      font-family: inherit;
      font-size: 16px;
      color: var(--text);
      background: var(--input-bg);
      border: 1px solid var(--input-border);
      border-radius: 12px;
      outline: none;
      transition: border-color 0.15s, background 0.15s;
    }

    input[type="password"] {
      padding-right: 52px;
    }

    input::placeholder {
      color: var(--text-muted);
    }

    input:focus {
      border-color: var(--input-border-focus);
      background: rgba(15, 15, 22, 0.85);
    }

    input:-webkit-autofill,
    input:-webkit-autofill:hover,
    input:-webkit-autofill:focus {
      -webkit-box-shadow: 0 0 0 1000px var(--input-bg) inset !important;
      -webkit-text-fill-color: var(--text) !important;
      caret-color: var(--text) !important;
      transition: background-color 9999s ease-in-out 0s;
    }

    /* Submit button */
    .btn-submit {
      width: 100%;
      height: 52px;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 10px;
      font-family: inherit;
      font-size: 15px;
      font-weight: 600;
      color: white;
      background: linear-gradient(90deg, #8b5cf6 0%, #6366f1 50%, #3b82f6 100%);
      border: none;
      border-radius: 12px;
      cursor: pointer;
      transition: transform 0.1s, box-shadow 0.2s, opacity 0.2s;
      box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
    }

    .btn-submit:hover {
      box-shadow: 0 6px 24px rgba(99, 102, 241, 0.45);
    }

    .btn-submit:active {
      transform: translateY(1px);
    }

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

    .btn-submit .arrow {
      width: 18px;
      height: 18px;
      transition: transform 0.15s;
    }

    .btn-submit:hover:not(:disabled) .arrow {
      transform: translateX(3px);
    }

    /* Forgot password link */
    .forgot-link {
      display: block;
      text-align: center;
      margin-top: 6px;
      padding: 15px 0;
      font-size: 13.5px;
      color: var(--text-dim);
      text-decoration: none;
      transition: color 0.15s;
    }

    .forgot-link:hover {
      color: var(--text);
    }

    /* Message banner */
    .message {
      margin-bottom: 20px;
      padding: 12px 16px;
      border-radius: 10px;
      font-size: 13.5px;
      display: none;
    }

    .message.error {
      background: rgba(239, 68, 68, 0.1);
      border: 1px solid rgba(239, 68, 68, 0.3);
      color: #fca5a5;
      display: block;
    }

    .message.success {
      background: rgba(16, 185, 129, 0.1);
      border: 1px solid rgba(16, 185, 129, 0.3);
      color: #6ee7b7;
      display: block;
    }

    /* Loading spinner */
    .spinner {
      width: 18px;
      height: 18px;
      border: 2px solid rgba(255, 255, 255, 0.3);
      border-top-color: white;
      border-radius: 50%;
      animation: spin 0.6s linear infinite;
      display: none;
    }

    .btn-submit.loading .arrow { display: none; }
    .btn-submit.loading .spinner { display: block; }
    .btn-submit.loading .label { opacity: 0.7; }

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

    @media (max-width: 480px) {
      .card { padding: 24px; }
      .brand-title { font-size: 22px; }
      .brand img { width: 64px; height: 64px; }
    }

    /* Tastiera: l'anello di focus e' viola come nell'app (#a25bff), mai il blu del browser. Compare solo col Tab. */
    .input-toggle:focus-visible, .btn-submit:focus-visible, .forgot-link:focus-visible {
      outline: 2px solid #a25bff;
      outline-offset: 2px;
    }
    /* Testo selezionato nei campi: viola del tool. */
    input::selection { background: rgba(139, 59, 255, 0.45); color: #fff; }

    /* Anche i campi di testo hanno lo stesso anello viola da 2px dei tasti quando si arriva col Tab. */
    input:focus-visible {
      outline: 2px solid #a25bff !important;
      outline-offset: 2px;
    }
