  :root {
    --bg-primary: #faf9f6; --bg-secondary: #ffffff; --bg-tertiary: #f5f3ef;
    --border: #e8e4de; --text-primary: #0f172a; --text-secondary: #334155; --text-muted: #64748b;
    --accent: #059669; --green: #047857; --green-hover: #059669; --red: #e11d48;
    --shadow: rgba(0,0,0,0.08);
    --logo-filter: none; --logo-blend: multiply;
  }
  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
  @media (max-width: 768px) { input, textarea, select { font-size: 16px !important; } }
  body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary); color: var(--text-secondary);
    min-height: 100vh;
  }

  /* ── Two-column split layout ── */
  .login-layout {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  }

  /* Left side — branding panel */
  .login-side {
    background: var(--bg-tertiary);
    border-right: 1px solid var(--border);
    padding: 56px 64px;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
  }
  .login-side-inner {
    max-width: 520px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 36px;
  }
  .login-side-mark {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-primary);
    margin-bottom: -28px;
  }
  .login-side-logo {
    height: 140px; width: auto;
    filter: var(--logo-filter); mix-blend-mode: var(--logo-blend);
  }
  .login-side-quote {
    font-size: 32px;
    font-weight: 500;
    line-height: 1.22;
    color: var(--text-primary);
    letter-spacing: -0.015em;
    max-width: 460px;
    quotes: "\201C" "\201D";
  }
  .login-side-attr {
    font-size: 14px;
    color: var(--text-muted);
    font-style: italic;
  }
  .login-side-grid {
    margin-top: auto;
    width: 100%;
    max-width: 320px;
    opacity: 0.75;
  }
  .login-side-grid svg {
    width: 100%;
    height: auto;
    display: block;
  }

  /* Right side — form column */
  .login-main {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 56px;
  }
  .login-container {
    width: 100%; max-width: 380px;
  }
  .login-logo {
    height: 64px; width: auto;
    filter: var(--logo-filter); mix-blend-mode: var(--logo-blend);
    margin-bottom: 24px;
    display: none; /* shown only on mobile via media query */
  }

  /* Forms sit directly on the beige — no card chrome */
  .login-card {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
  }
  .login-card h2 {
    font-size: 24px; color: var(--text-primary); margin-bottom: 28px; font-weight: 700;
    letter-spacing: -0.018em; line-height: 1.15;
  }
  .form-group { margin-bottom: 18px; text-align: left; }
  .form-group label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
  .form-group input {
    width: 100%; padding: 11px 14px; background: var(--bg-secondary); border: 1px solid var(--border);
    border-radius: 4px; color: var(--text-primary); font-size: 15px; font-family: inherit; outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
  }
  .form-group input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(5, 150, 105, 0.12); }
  .login-btn {
    width: 100%; padding: 12px; background: var(--green); color: #fff; border: none; border-radius: 4px;
    font-size: 15px; font-weight: 600; font-family: inherit; cursor: pointer; transition: background 0.15s;
  }
  .login-btn:hover { background: var(--green-hover); }
  .login-btn:disabled { opacity: 0.6; cursor: not-allowed; }

  /* ── Social sign-in ── */
  .social-divider {
    display: flex; align-items: center; gap: 12px;
    margin: 16px 0; color: var(--text-muted); font-size: 13px; font-weight: 500;
  }
  .social-divider::before, .social-divider::after {
    content: ''; flex: 1; height: 1px; background: var(--border);
  }
  .google-signin-btn {
    width: 100%; padding: 11px 16px; background: var(--bg-secondary);
    border: 1px solid var(--border); border-radius: 4px;
    font-size: 15px; font-weight: 500; font-family: inherit;
    color: var(--text-primary); cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 10px;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  }
  .google-signin-btn:hover {
    border-color: var(--text-muted); background: var(--bg-tertiary);
    box-shadow: 0 1px 3px var(--shadow);
  }
  .google-signin-btn:active { transform: scale(0.99); }
  .google-icon { flex-shrink: 0; }

  .error-msg {
    color: var(--red); font-size: 13px; margin-top: 14px; display: none;
  }
  .error-msg.visible { display: block; }
  #totp-section { display: none; }
  #totp-section.active { display: block; }
  .totp-label {
    font-size: 14px; color: var(--text-secondary); margin-bottom: 16px;
  }
  .totp-input {
    width: 100%; padding: 14px; background: var(--bg-secondary); border: 1px solid var(--border);
    border-radius: 4px; color: var(--text-primary); font-size: 24px; font-family: 'DM Sans', monospace;
    text-align: center; letter-spacing: 8px; outline: none; transition: border-color 0.15s, box-shadow 0.15s;
    font-variant-numeric: tabular-nums;
  }
  .totp-input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(5, 150, 105, 0.12); }
  .totp-back {
    display: inline-block; margin-top: 12px; font-size: 13px; color: var(--text-muted);
    cursor: pointer; text-decoration: underline; background: none; border: none; font-family: inherit;
  }
  .totp-back:hover { color: var(--text-secondary); }
  .remember-row {
    display: flex; align-items: center; gap: 10px; margin-bottom: 18px; text-align: left;
  }
  .remember-row input {
    width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; flex-shrink: 0;
  }
  .remember-row label {
    font-size: 14px; color: var(--text-secondary); cursor: pointer; margin-bottom: 0;
  }
  .toggle-link {
    text-align: center; margin-top: 16px; font-size: 13px;
  }
  .toggle-link a {
    color: var(--accent); text-decoration: none;
  }
  .toggle-link a:hover { text-decoration: underline; }
  .success-msg {
    color: var(--green); font-size: 13px; margin-top: 14px; text-align: center;
  }
  .forgot-link {
    text-align: center; margin-top: 12px; font-size: 13px;
  }
  .forgot-link a {
    color: var(--text-muted); text-decoration: none;
  }
  .forgot-link a:hover { color: var(--accent); text-decoration: underline; }
  .forgot-desc {
    color: var(--text-secondary); font-size: 14px; line-height: 1.5; margin-bottom: 18px; text-align: left;
  }
  .info-msg {
    color: var(--accent); font-size: 13px; margin-top: 14px; text-align: center;
    background: rgba(5, 150, 105, 0.08); padding: 10px; border-radius: 4px;
  }

  /* Habit grid cell levels — match landing */
  .gc-0 { fill: #dcd7cc; }
  .gc-1 { fill: #c7e6d5; }
  .gc-2 { fill: #7fc8a0; }
  .gc-3 { fill: #3ea876; }
  .gc-4 { fill: #047857; }

  /* ── Responsive — collapse to single column on mobile ── */
  @media (max-width: 900px) {
    .login-layout { grid-template-columns: 1fr; }
    .login-side { display: none; }
    .login-main { padding: 32px 24px; min-height: 100vh; }
    .login-logo { display: block; margin: 0 auto 20px; }
    .login-container { text-align: center; }
    .login-card h2 { text-align: center; font-size: 26px; }
  }
