/* Pluryface: auth pages + form components shared with the dashboard (builds on styles.css tokens) */

.auth-body { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }

.auth-top { display: flex; align-items: center; justify-content: space-between; height: 72px; }
.auth-top__link { color: var(--muted); text-decoration: none; font-size: .94rem; transition: color .15s; }
.auth-top__link:hover { color: var(--text); }

.auth { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); border-top: 1px solid var(--line); }
@media (max-width: 920px) { .auth { grid-template-columns: 1fr; } .auth__art { display: none; } }

/* ---------- Left: what protects this account ---------- */
.auth__art {
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; flex-direction: column; justify-content: space-between; gap: 40px;
  padding: clamp(36px, 5vw, 64px); background: var(--ink); color: var(--ink-text);
}
.auth__art::before {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: .55;
  background-image: linear-gradient(var(--ink-line) 1px, transparent 1px), linear-gradient(90deg, var(--ink-line) 1px, transparent 1px);
  background-size: 36px 36px;
  -webkit-mask-image: radial-gradient(ellipse at 30% 20%, #000, transparent 75%); mask-image: radial-gradient(ellipse at 30% 20%, #000, transparent 75%);
}
.auth__quote h2 { font-size: clamp(1.7rem, 2.8vw, 2.5rem); letter-spacing: -0.035em; max-width: 16ch; }
.auth__quote h2 em { font-style: normal; color: #8d9cff; }
.auth__quote p { color: var(--ink-muted); max-width: 44ch; margin: 0; }

.receipt { margin: 0; padding: 0; list-style: none; border: 1px solid var(--ink-line); border-radius: 14px; background: color-mix(in srgb, var(--ink-2) 85%, transparent); font-family: var(--mono); font-size: .78rem; }
.receipt li { display: flex; justify-content: space-between; gap: 16px; padding: 13px 18px; border-bottom: 1px solid var(--ink-line); animation: rise .6s var(--ease-out) both; }
.receipt li:nth-child(2) { animation-delay: .08s; }
.receipt li:nth-child(3) { animation-delay: .16s; }
.receipt li:nth-child(4) { animation-delay: .24s; }
.receipt li:last-child { border-bottom: 0; }
.receipt span { color: var(--ink-muted); }
.receipt b { color: var(--ink-text); font-weight: 500; text-align: right; }
.receipt b::before { content: "✓ "; color: #5fe3a1; }

/* ---------- Right: form ---------- */
.auth__main { display: flex; align-items: center; justify-content: center; padding: 56px 20px; }
.auth-card { width: min(410px, 100%); animation: rise .7s var(--ease-out) both; }
.auth-card h1 { font-size: clamp(1.8rem, 3vw, 2.3rem); letter-spacing: -0.035em; margin-bottom: .3em; }
.auth-card__sub { color: var(--muted); margin-bottom: 30px; }
.auth-card__sub a, .auth-switch a { color: var(--accent); text-decoration: none; font-weight: 600; }
.auth-card__sub a:hover, .auth-switch a:hover { text-decoration: underline; text-underline-offset: 3px; }

.form { display: grid; gap: 16px; }

.field { position: relative; }
.field__input {
  width: 100%; height: 56px; padding: 22px 15px 7px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font: inherit; font-size: 1rem; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field__input:hover { border-color: color-mix(in srgb, var(--text) 30%, var(--line)); }
.field__input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.field__input[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 12%, transparent); }
.field__label {
  position: absolute; left: 16px; top: 17px; max-width: calc(100% - 32px); color: var(--muted); pointer-events: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transform-origin: left top; transition: transform .18s var(--ease-out), color .18s;
}
.field__input:focus + .field__label,
.field__input:not(:placeholder-shown) + .field__label { transform: translateY(-10px) scale(.76); }
.field__input:focus + .field__label { color: var(--accent); }
.field--pw .field__input { padding-right: 54px; }

.field__toggle {
  position: absolute; right: 7px; top: 8px; width: 40px; height: 40px;
  display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent;
  color: var(--muted); cursor: pointer; transition: color .15s, background .15s;
}
.field__toggle:hover { color: var(--text); background: var(--bg-2); }
.field__toggle svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.field__toggle .icon-hide { display: none; }
.field__toggle[aria-pressed="true"] .icon-show { display: none; }
.field__toggle[aria-pressed="true"] .icon-hide { display: block; }

.field__error { color: var(--danger); font-size: .86rem; margin: 6px 2px 0; }
.field__error:empty { display: none; }
.field__hint { color: var(--muted); font-size: .82rem; margin: 6px 2px 0; }
.field__hint--warn { color: var(--degraded); }

/* Strength meter */
.meter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin-top: 10px; }
.meter span { height: 3px; border-radius: 3px; background: var(--line); transition: background .3s; }
.meter[data-score="1"] span:nth-child(-n+1) { background: var(--danger); }
.meter[data-score="2"] span:nth-child(-n+2) { background: var(--degraded); }
.meter[data-score="3"] span:nth-child(-n+3) { background: color-mix(in srgb, var(--up) 70%, var(--degraded)); }
.meter[data-score="4"] span { background: var(--up); }
.meter__label { font-family: var(--mono); font-size: .74rem; color: var(--muted); margin: 6px 0 0; }

.check { display: flex; gap: 10px; align-items: flex-start; color: var(--muted); font-size: .9rem; cursor: pointer; }
.check input { margin-top: 4px; accent-color: var(--accent); width: 16px; height: 16px; flex: none; }

/* Submit button with spinner */
.btn--block { width: 100%; height: 54px; margin-top: 6px; }
.btn[disabled] { opacity: .7; cursor: progress; transform: none; }
.btn .spinner { display: none; width: 17px; height: 17px; border-radius: 50%; border: 2px solid color-mix(in srgb, currentColor 30%, transparent); border-top-color: currentColor; animation: spin .7s linear infinite; }
.btn.is-loading .spinner { display: inline-block; }
.btn.is-loading .btn__label { opacity: .8; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Alerts */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 13px 15px; border: 1px solid; border-radius: 10px; font-size: .92rem; }
.alert:empty { display: none; }
.alert--error { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); background: color-mix(in srgb, var(--danger) 7%, transparent); }
.alert--ok { color: var(--up); border-color: color-mix(in srgb, var(--up) 40%, transparent); background: color-mix(in srgb, var(--up) 7%, transparent); }
.alert.is-shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }

.auth-switch { text-align: center; color: var(--muted); margin: 24px 0 0; font-size: .95rem; }
.auth-secure { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 26px 0 0; color: var(--muted); font-family: var(--mono); font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; }
.auth-secure svg { width: 13px; height: 13px; fill: var(--accent); }

/* ---------- Confirm e-mail ---------- */
.auth--single { grid-template-columns: 1fr; }
.auth-top__btn { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }
.verify-icon { width: 52px; height: 52px; display: grid; place-items: center; margin-bottom: 22px; border-radius: 14px; background: var(--accent-soft); }
.verify-icon svg { width: 26px; height: 26px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.auth-card__sub b { color: var(--text); font-weight: 600; overflow-wrap: anywhere; }
.code-input { height: 72px; padding: 0 16px; text-align: center; font-family: var(--mono); font-size: 2rem; font-weight: 600; letter-spacing: .45em; text-indent: .45em; }
.code-input::placeholder { color: var(--line); letter-spacing: .45em; }
.verify-resend { margin: 22px 0 0; text-align: center; color: var(--muted); font-size: .92rem; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.link-btn[disabled] { color: var(--muted); cursor: default; text-decoration: none; }

/* ============================ Shared (dashboard + auth) ============================ */
.btn--tiny { padding: .45em .85em; font-size: .84rem; border-radius: 8px; }
.btn--danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.btn--danger:hover { background: color-mix(in srgb, var(--danger) 8%, transparent); box-shadow: none; border-color: var(--danger); }
.btn--danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn--danger-solid:hover { box-shadow: 0 8px 24px -10px color-mix(in srgb, var(--danger) 70%, transparent); }

/* Tooltips: any element with data-tip (text set via setAttribute => no HTML injection) */
[data-tip] { position: relative; cursor: help; }
[data-tip]::after {
  content: attr(data-tip);
  position: absolute; left: 50%; bottom: calc(100% + 10px); z-index: 30;
  width: max-content; max-width: min(300px, 80vw); padding: 9px 11px; border-radius: 8px;
  background: var(--ink); color: var(--ink-text); border: 1px solid var(--ink-line);
  font: 500 .8rem/1.45 var(--font); text-align: left; white-space: pre-line; letter-spacing: 0; text-transform: none;
  box-shadow: var(--shadow-lg);
  opacity: 0; transform: translate(-50%, 4px); pointer-events: none;
  transition: opacity .15s ease, transform .2s var(--ease-out);
}
[data-tip]:hover::after, [data-tip]:focus-visible::after { opacity: 1; transform: translate(-50%, 0); }
.tip-right[data-tip]::after { left: calc(100% + 12px); bottom: auto; top: 50%; transform: translate(4px, -50%); }
.tip-right[data-tip]:hover::after, .tip-right[data-tip]:focus-visible::after { transform: translate(0, -50%); }

/* Lamps + traffic light */
.lamp { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--pending); flex: none; }
.lamp--up { background: var(--up); }
.lamp--degraded { background: var(--degraded); }
.lamp--down { background: var(--down); }

.lights { display: inline-flex; flex-direction: column; gap: 3px; padding: 5px 4px; border-radius: 999px; background: var(--bg-2); border: 1px solid var(--line); }
.lights i { display: block; width: 8px; height: 8px; border-radius: 50%; opacity: .2; transition: opacity .3s; }
.lights i:nth-child(1) { background: var(--down); }
.lights i:nth-child(2) { background: var(--degraded); }
.lights i:nth-child(3) { background: var(--up); }
.lights[data-status="down"] i:nth-child(1),
.lights[data-status="degraded"] i:nth-child(2),
.lights[data-status="up"] i:nth-child(3) { opacity: 1; }
.lights[data-status="pending"] i { animation: blink 1.2s infinite; }
.lights[data-status="pending"] i:nth-child(2) { animation-delay: .2s; }
.lights[data-status="pending"] i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 50% { opacity: .6; } }

.domain__main { display: grid; gap: 3px; min-width: 0; }
.domain__host { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.domain__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); font-size: .84rem; font-family: var(--mono); }

.badge { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; padding: .25em .65em; border-radius: 6px; }
.badge--up { color: var(--up); background: color-mix(in srgb, var(--up) 11%, transparent); }
.badge--degraded { color: var(--degraded); background: color-mix(in srgb, var(--degraded) 12%, transparent); }
.badge--down { color: var(--down); background: color-mix(in srgb, var(--down) 11%, transparent); }
.badge--pending { color: var(--muted); background: color-mix(in srgb, var(--pending) 12%, transparent); }
