/* Home Server — sign in / register. Flat, left-aligned, same tokens as the apps. */

:root {
  --accent: #5E6AD2;
  --accent-2: #7A84E4;
  --accent-strong: #6E79DB;
  --accent-soft: rgba(94, 106, 210, 0.16);
  --text-primary: rgba(255, 255, 255, 0.95);
  --text-secondary: rgba(255, 255, 255, 0.64);
  --text-tertiary: rgba(255, 255, 255, 0.44);
  --border-subtle: rgba(255, 255, 255, 0.07);
  --border-default: rgba(255, 255, 255, 0.11);
  --border-strong: rgba(255, 255, 255, 0.18);
  --success: #46C08B;
  --warning: #F2994A;
  --danger: #F0605D;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
[hidden] { display: none !important; }

body {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: max(32px, env(safe-area-inset-top)) 24px max(32px, env(safe-area-inset-bottom));
  color: var(--text-primary);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  background: #060708;
}

/* Fixed, darkened server-room backdrop, matching the apps. */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -2;
  background: url("/dashboard/assets/serverroom.jpg") center/cover no-repeat;
  transform: scale(1.04);
}
body::after {
  content: "";
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(120% 90% at 78% 8%, rgba(94, 106, 210, 0.10), transparent 55%),
    linear-gradient(180deg, rgba(6, 7, 8, 0.82) 0%, rgba(6, 7, 8, 0.92) 60%, rgba(6, 7, 8, 0.97) 100%);
}

.card {
  width: min(460px, 100%);
  padding: 10px;
  border-radius: 26px;
  border: 1px solid var(--border-subtle);
  background: rgba(18, 20, 24, 0.55);
  -webkit-backdrop-filter: blur(22px); backdrop-filter: blur(22px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  animation: rise 0.5s var(--ease) both;
}
.card--split {
  width: min(900px, 100%);
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 400px); gap: 10px;
}
.card__form { padding: 38px 36px 32px; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

.qrpanel {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 40px 32px;
  border-radius: 18px;
  border: 1px solid rgba(122, 132, 228, 0.16);
  text-align: center;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 22px),
    linear-gradient(180deg, rgba(94, 106, 210, 0.16), rgba(94, 106, 210, 0.05));
}
.qr {
  position: relative;
  width: 204px; height: 204px; padding: 14px;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.45), 0 0 0 6px rgba(94, 106, 210, 0.14);
}
.qr__img { display: block; width: 100%; height: 100%; transition: filter 0.2s var(--ease), opacity 0.2s var(--ease); }
.qr__veil {
  position: absolute; inset: 0; border-radius: inherit;
  display: none; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.82);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
.qr__msg { margin: 0; font-size: 13px; font-weight: 600; color: #15171c; }
.qr__msg:empty { display: none; }
.qr__refresh {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 14px; border: 0; border-radius: 999px;
  font: inherit; font-size: 13px; font-weight: 600; color: #fff;
  background: var(--accent); cursor: pointer;
}
.qr__refresh:hover { background: var(--accent-strong); }
.qr__refresh svg { width: 14px; height: 14px; }
.qr[data-state="loading"] .qr__img { opacity: 0; }
.qr[data-state="loading"]::after {
  content: ""; position: absolute; inset: 0; margin: auto;
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid rgba(6, 7, 8, 0.15); border-top-color: var(--accent);
  animation: spin 0.7s linear infinite;
}
.qr[data-state="expired"] .qr__img, .qr[data-state="done"] .qr__img { filter: blur(3px); opacity: 0.35; }
.qr[data-state="expired"] .qr__veil, .qr[data-state="done"] .qr__veil { display: flex; }
.qr[data-state="done"] .qr__refresh { display: none; }
.qrpanel__eyebrow { margin: 26px 0 0; font-size: 12px; font-weight: 500; color: var(--text-tertiary); }
.qrpanel__title { margin: 4px 0 0; font-size: 20px; font-weight: 600; letter-spacing: -0.3px; }
.qrpanel__sub { margin: 8px 0 0; max-width: 280px; font-size: 13px; color: var(--text-secondary); }

.seg {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  width: min(300px, 100%); padding: 4px; margin-bottom: 4px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.04);
}
.seg__btn {
  height: 34px; border: 0; border-radius: 999px;
  font: inherit; font-size: 13px; font-weight: 500; color: var(--text-tertiary);
  background: transparent; cursor: pointer;
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease);
}
.seg__btn:hover { color: var(--text-primary); }
.seg__btn[aria-pressed="true"] {
  color: var(--text-primary); font-weight: 600;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 2px 8px rgba(0, 0, 0, 0.3);
}
.seg__btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(94, 106, 210, 0.4); }

.device {
  display: flex; align-items: center; gap: 14px;
  padding: 14px; margin-bottom: 20px;
  border-radius: 14px;
  border: 1px solid var(--border-default);
  background: rgba(255, 255, 255, 0.03);
}
.device__icon {
  width: 42px; height: 42px; flex: none; border-radius: 12px;
  display: grid; place-items: center;
  color: var(--accent-2); background: var(--accent-soft);
  border: 1px solid rgba(122, 132, 228, 0.28);
}
.device__icon svg { width: 20px; height: 20px; }
.device__body { min-width: 0; line-height: 1.35; }
.device__name { display: block; font-size: 14px; font-weight: 600; }
.device__meta { display: block; font-size: 12px; color: var(--text-tertiary); font-variant-numeric: tabular-nums; }

[data-show] { display: none; }
[data-state="ask"] [data-show~="ask"],
[data-state="done"] [data-show~="done"],
[data-state="denied"] [data-show~="denied"],
[data-state="gone"] [data-show~="gone"] { display: block; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.logo {
  display: block; width: 44px; height: 44px; margin-bottom: 22px;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(94, 106, 210, 0.3);
}

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 10px; margin-bottom: 14px;
  border-radius: 999px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
  color: var(--accent-2);
  background: var(--accent-soft);
  border: 1px solid rgba(122, 132, 228, 0.28);
}
.pill__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }

.title { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -0.4px; line-height: 1.25; }
.sub { margin: 8px 0 28px; color: var(--text-secondary); font-size: 15px; line-height: 1.45; }

.form { display: grid; gap: 12px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.field { display: grid; gap: 6px; min-width: 0; }
.field__label {
  display: flex; align-items: baseline; gap: 6px;
  font-size: 12px; font-weight: 600; color: var(--text-secondary);
}
.field__opt { font-size: 11px; font-weight: 500; color: var(--text-tertiary); }
.field__wrap { position: relative; }
.input {
  width: 100%; height: 48px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid var(--border-default);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
  font: inherit; font-size: 15px;
  outline: none;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease), background-color 0.15s var(--ease);
}
.input::placeholder { color: var(--text-tertiary); }
.input:hover { border-color: var(--border-strong); }
.input:focus {
  border-color: var(--accent-strong);
  background: rgba(94, 106, 210, 0.05);
  box-shadow: 0 0 0 4px rgba(94, 106, 210, 0.18);
}
.input--pw { padding-right: 48px; }
.field.has-error .input { border-color: rgba(240, 96, 93, 0.7); box-shadow: 0 0 0 4px rgba(240, 96, 93, 0.14); }
.field__err { margin: 0; font-size: 12px; color: var(--danger); }
.field__err:empty { display: none; }

.reveal {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; border: 0; border-radius: 9px;
  display: grid; place-items: center;
  background: transparent; color: var(--text-tertiary); cursor: pointer;
}
.reveal:hover { color: var(--text-primary); background: rgba(255, 255, 255, 0.06); }
.reveal svg { width: 18px; height: 18px; }
.reveal .eye-off { display: none; }
.reveal[aria-pressed="true"] .eye { display: none; }
.reveal[aria-pressed="true"] .eye-off { display: block; }

.strength { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 2px; }
.strength span { height: 3px; border-radius: 3px; background: rgba(255, 255, 255, 0.08); transition: background-color 0.2s var(--ease); }
.strength[data-score="1"] span:nth-child(-n+1) { background: var(--danger); }
.strength[data-score="2"] span:nth-child(-n+2) { background: var(--warning); }
.strength[data-score="3"] span:nth-child(-n+3) { background: #C9C24A; }
.strength[data-score="4"] span { background: var(--success); }
.strength__hint { margin: -2px 0 0; font-size: 12px; color: var(--text-tertiary); }

.check {
  display: flex; align-items: center; gap: 10px; margin: 4px 0 2px;
  font-size: 13px; color: var(--text-secondary);
  cursor: pointer; user-select: none;
}
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check__box {
  width: 18px; height: 18px; flex: none; border-radius: 6px;
  display: grid; place-items: center;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.04);
  transition: background-color 0.15s var(--ease), border-color 0.15s var(--ease);
}
.check__box svg { width: 12px; height: 12px; color: #fff; opacity: 0; transform: scale(0.6); transition: 0.15s var(--ease); }
.check input:checked + .check__box { background: var(--accent); border-color: var(--accent-2); }
.check input:checked + .check__box svg { opacity: 1; transform: none; }
.check input:focus-visible + .check__box { box-shadow: 0 0 0 4px rgba(94, 106, 210, 0.3); }

.alert {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 11px 13px; border-radius: 12px;
  font-size: 13px;
  color: #FFD9D8;
  background: rgba(240, 96, 93, 0.1);
  border: 1px solid rgba(240, 96, 93, 0.3);
}
.alert svg { width: 16px; height: 16px; flex: none; margin-top: 2px; color: var(--danger); }
.alert--info { margin-bottom: 16px; color: var(--text-secondary); background: var(--accent-soft); border-color: rgba(122, 132, 228, 0.28); }
.alert--info svg { color: var(--accent-2); }
.alert a { color: #fff; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; height: 48px; margin-top: 4px;
  border: 0;
  border-radius: 999px;
  font: inherit; font-size: 15px; font-weight: 600; color: #fff;
  background: var(--accent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
  cursor: pointer;
  transition: background-color 0.15s var(--ease), transform 0.15s var(--ease);
}
.btn:hover { background: var(--accent-strong); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 4px rgba(94, 106, 210, 0.35); }
.btn:disabled { cursor: default; filter: saturate(0.6) brightness(0.9); }
.btn--ghost { margin-top: 0; color: var(--text-secondary); background: transparent; box-shadow: none; border: 1px solid var(--border-default); }
.btn--ghost:hover { color: var(--text-primary); background: rgba(255, 255, 255, 0.05); }
.btn__spin {
  display: none; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35); border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}
.btn.is-busy .btn__spin { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

.switch { margin: 28px 0 0; font-size: 14px; color: var(--text-tertiary); }
.switch a { color: var(--text-primary); font-weight: 500; text-decoration: none; }
.switch a:hover { color: var(--accent-2); }

.foot { margin: 12px 0 0; font-size: 12px; color: var(--text-tertiary); }

@media (max-width: 759px) {
  .card--split { width: min(460px, 100%); grid-template-columns: 1fr; }
  .qrpanel { display: none; }
}
@media (max-width: 480px) {
  body { padding-left: 14px; padding-right: 14px; }
  .card__form { padding: 28px 20px 24px; }
  .row { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .card { animation: none; }
}

/* Quick cross-fade between apps / pages (browsers with cross-document view transitions). */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  ::view-transition-group(*) { animation-duration: 140ms; animation-timing-function: ease-out; }
}
