/* Aplunio login. Light by default, follows the system, manual override via data-theme. */
:root {
  color-scheme: light;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --page: #ffffff;
  --page-alt: #f3f7ff;
  --ink: #0b1220;
  --muted: #5b6678;
  --soft: #8a94a6;
  --line: #dbe2ee;
  --field: #ffffff;
  --field-line: #cfd8e6;
  --focus: #1d6bff;
  --link: #0a5cff;
  --card: #ffffffee;
  --card-line: #e3e9f4;
  --card-shadow: 0 24px 60px #0b2a6b1f;
  --tab-bg: #eef3fb;
  --tab-active: #ffffff;
  --social-bg: #ffffff;
  --social-ink: #111827;
  --social-line: #d5dce8;
  --error: #c62828;
  --success: #0f7b46;
  --wave-opacity: .9;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #05070d; --page-alt: #071232; --ink: #f4f7ff; --muted: #9aa6bf; --soft: #6f7a92;
    --line: #1f2738; --field: #0c111c; --field-line: #273148; --focus: #3aa8ff; --link: #5cc8ff;
    --card: #0b1730e6; --card-line: #22406f; --card-shadow: 0 24px 60px #000a;
    --tab-bg: #0a1222; --tab-active: #17305a; --social-bg: #ffffff; --social-ink: #111111; --social-line: transparent;
    --error: #ff9f94; --success: #6ee7a8; --wave-opacity: 1;
  }
}
:root[data-theme="navy"], :root[data-theme="dark"] {
  color-scheme: dark;
  --page: #05070d; --page-alt: #071232; --ink: #f4f7ff; --muted: #9aa6bf; --soft: #6f7a92;
  --line: #1f2738; --field: #0c111c; --field-line: #273148; --focus: #3aa8ff; --link: #5cc8ff;
  --card: #0b1730e6; --card-line: #22406f; --card-shadow: 0 24px 60px #000a;
  --tab-bg: #0a1222; --tab-active: #17305a; --social-bg: #ffffff; --social-ink: #111111; --social-line: transparent;
  --error: #ff9f94; --success: #6ee7a8; --wave-opacity: 1;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 0; color: var(--ink); background: var(--page); line-height: 1.45; -webkit-font-smoothing: antialiased; }
:where(button, input) { font: inherit; }
button { cursor: pointer; color: inherit; }
button:disabled { cursor: not-allowed; opacity: .6; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.login-symbols { position: absolute; pointer-events: none; }

/* Mobile first: variant B, centered card over Aplunio waves. */
.login-layout {
  position: relative; isolation: isolate; overflow: clip;
  min-height: 100vh; min-height: 100svh;
  padding: max(24px, env(safe-area-inset-top)) 16px max(120px, 18vh);
  background: radial-gradient(ellipse at 80% 10%, var(--page-alt) 0%, transparent 60%), var(--page);
}
.login-backdrop { position: absolute; inset: auto 0 0 0; z-index: -1; pointer-events: none; }
.login-waves { display: block; width: 100%; height: clamp(90px, 22vh, 220px); opacity: var(--wave-opacity); filter: drop-shadow(0 -8px 30px #11adff40); }
.login-shell { width: min(100%, 420px); margin: 0 auto; }
.login-identity { position: relative; text-align: center; margin-bottom: 22px; }
.login-brand { display: inline-flex; align-items: center; gap: 8px; font-size: 2.2rem; font-weight: 770; letter-spacing: -.055em; line-height: 1; }
.login-mark { width: 210px; height: 45px; color: currentColor; }
.login-slogan { margin: 6px 0 0; color: var(--muted); font-size: .9rem; }
.theme-toggle {
  position: absolute; top: 0; right: 0; display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--field);
}
.theme-toggle svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .theme-sun { display: none; }
.theme-toggle[data-dark="true"] .theme-sun { display: block; }
.theme-toggle[data-dark="true"] .theme-moon { display: none; }

.login-card {
  width: 100%; padding: 22px 20px; border-radius: 20px;
  border: 1px solid var(--card-line); background: var(--card); box-shadow: var(--card-shadow);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.login-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin-bottom: 18px; border-radius: 13px; background: var(--tab-bg); border: 1px solid var(--line); }
.login-tab { min-height: 40px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-weight: 650; font-size: .95rem; }
.login-tab[aria-selected="true"] { background: var(--tab-active); color: var(--ink); box-shadow: 0 2px 8px #0b2a6b1a; }
.login-heading { margin-bottom: 18px; }
.login-heading h1 { margin: 0 0 4px; font-size: 1.55rem; letter-spacing: -.035em; line-height: 1.15; }
.login-lede { margin: 0; color: var(--muted); font-size: .94rem; }
.login-lede strong { color: var(--ink); overflow-wrap: anywhere; }
#login-stage .login-heading { display: none; }

.social-button, .primary-button {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 48px; border-radius: 12px; font-size: 1rem; font-weight: 650;
  transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
}
.social-button { border: 1px solid var(--social-line); background: var(--social-bg); color: var(--social-ink); box-shadow: 0 1px 2px #0b12200f; }
.social-button svg { width: 20px; height: 20px; }
.social-button:not(:disabled):hover { box-shadow: 0 4px 14px #0b122020; }
.primary-button { border: 0; color: #fff; background: linear-gradient(90deg, #0a6cff, #06b8ff); box-shadow: 0 10px 24px #0a6cff38; margin-top: 4px; }
.primary-button:not(:disabled):hover { filter: brightness(1.06); }
.primary-button:not(:disabled):active, .social-button:not(:disabled):active { transform: translateY(1px); }
.login-form-busy, form[aria-busy="true"] .primary-button { cursor: progress; }
.login-divider { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--soft); font-size: .82rem; }
.login-divider::before, .login-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.login-card form { display: grid; gap: 14px; min-width: 0; }
.login-row { display: grid; gap: 6px; min-width: 0; }
.login-row label { font-size: .85rem; font-weight: 600; color: var(--ink); }
.login-label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.login-field { position: relative; display: flex; align-items: center; min-height: 48px; border: 1px solid var(--field-line); border-radius: 12px; background: var(--field); transition: border-color .12s ease, box-shadow .12s ease; }
.login-field:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 22%, transparent); }
.login-field input { flex: 1; width: 100%; min-width: 0; min-height: 46px; padding: 0 14px; border: 0; border-radius: 12px; outline: 0; color: var(--ink); background: transparent; font-size: 1rem; }
.login-field input::placeholder { color: var(--soft); }
.login-field input[readonly] { color: var(--muted); }
.otp-input { letter-spacing: .4em; font-variant-numeric: tabular-nums; font-size: 1.15rem !important; }
.password-field input { padding-right: 52px; }
.password-toggle { position: absolute; right: 4px; display: grid; place-items: center; width: 42px; height: 40px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); }
.password-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.password-toggle .eye-closed, .password-toggle[data-visible="true"] .eye-open { display: none; }
.password-toggle[data-visible="true"] .eye-closed { display: block; }

.text-button { padding: 0; border: 0; background: none; color: var(--link); font-size: .86rem; font-weight: 600; }
.text-button:hover { text-decoration: underline; }
#login-message, #verify-message, #activation-message { min-height: 1.3em; margin: 12px 0 0; color: var(--muted); font-size: .88rem; text-align: center; }
#login-message:empty, #verify-message:empty, #activation-message:empty { margin: 0; min-height: 0; }
[data-error="true"] { color: var(--error) !important; }
[data-success="true"] { color: var(--success) !important; }
#login-retry { display: block; margin: 8px auto 0; }
.login-alternative { margin: 16px 0 0; text-align: center; color: var(--muted); font-size: .9rem; }
.login-alternative .text-button { font-size: .9rem; }
#login-stage .login-alternative { display: none; }
.login-security { display: flex; justify-content: center; align-items: center; gap: 6px; margin: 16px 0 0; color: var(--soft); font-size: .8rem; text-align: center; }
.login-security svg { flex: 0 0 auto; width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.login-legal, .login-note { margin: 18px auto 0; max-width: 340px; color: var(--soft); font-size: .78rem; text-align: center; }
.login-workspace-choices { display: grid; gap: 8px; margin: 0 0 14px; padding: 0; border: 0; }
.login-workspace-choices legend { margin-bottom: 8px; font-weight: 650; }
.login-workspace-choices button { min-height: 46px; border: 1px solid var(--field-line); border-radius: 12px; background: var(--field); font-weight: 600; text-align: left; padding: 0 14px; }
.login-workspace-choices button:hover { border-color: var(--focus); }
.login-artwork { display: none; }

/* Desktop: variant A, Lovable-style split with the form left and the brand panel right. */
@media (min-width: 840px) {
  .login-layout { display: grid; grid-template-columns: minmax(400px, 520px) 1fr; padding: 0; background: var(--page); }
  .login-backdrop { display: none; }
  .login-shell { display: flex; flex-direction: column; width: 100%; min-height: 100vh; padding: 28px 48px; }
  .login-identity { display: flex; align-items: center; gap: 12px; text-align: left; margin: 0; }
  .login-brand { font-size: 1.45rem; letter-spacing: -.04em; }
  .login-mark { width: 150px; height: 32px; }
  .login-slogan { display: none; }
  .theme-toggle { position: static; margin-left: auto; width: 36px; height: 36px; }
  .login-content { width: 100%; max-width: 380px; margin: auto 0; padding: 32px 0; }
  .login-card { padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .login-tabs { display: none; }
  #login-stage .login-heading { display: block; }
  .login-heading { margin-bottom: 26px; }
  .login-heading h1 { font-size: 2rem; }
  #login-stage .login-alternative { display: block; }
  .login-legal { margin-left: 0; text-align: left; max-width: none; }
  .login-artwork {
    position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden;
    margin: 12px; border-radius: 24px;
    background:
      radial-gradient(circle at 75% 20%, #16e4fc 0, transparent 38%),
      radial-gradient(circle at 20% 85%, #1258ff 0, transparent 45%),
      linear-gradient(150deg, #06205e, #0a3dc4 55%, #06b8ff);
  }
  .login-artwork-tag { position: absolute; top: 28px; left: 32px; margin: 0; color: #e6f6ff; font-weight: 650; font-size: .95rem; }
  .login-artwork-example { width: min(560px, 80%); padding: 18px 18px 14px; border: 1px solid #ffffff22; border-radius: 20px; background: #0b1020e6; color: #f4f7ff; box-shadow: 0 30px 80px #0008; }
  .login-artwork-prompt { margin: 0 0 18px; font-size: 1.12rem; line-height: 1.45; }
  .login-artwork-bar { display: flex; justify-content: space-between; align-items: center; color: #8f9bb5; font-size: .82rem; }
  .login-artwork-send { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: #fff; color: #000; font-weight: 700; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
