/* Subtrack V1.3 · account identity and cloud-sync surfaces */

:root {
  --v13-ink: #1c1b17;
  --v13-paper: #faf8f3;
  --v13-cloud: #6f7f63;
  --v13-error: #b05f55;
}

html[data-auth-state="loading"] .hero-actions,
html[data-auth-state="loading"] .library-actions,
html[data-auth-state="loading"] .controls,
html[data-auth-state="loading"] .subscription-grid,
html[data-auth-state="loading"] .empty-state {
  pointer-events: none;
  opacity: .42;
}

.sync-pill {
  gap: 7px;
  min-width: 142px;
  justify-content: center;
  transition: color 180ms ease, border-color 180ms ease, background 180ms ease;
}
.sync-pill i {
  flex: 0 0 auto;
  transition: background 180ms ease, box-shadow 180ms ease;
}
.sync-pill[data-state="loading"] i,
.sync-pill[data-state="syncing"] i {
  background: #b69665;
  box-shadow: 0 0 0 4px rgba(182,150,101,.1);
}
.sync-pill[data-state="synced"] i {
  background: var(--v13-cloud);
  box-shadow: 0 0 0 4px rgba(111,127,99,.1);
}
.sync-pill[data-state="offline"] {
  color: #805d55;
  border-color: rgba(176,95,85,.2);
  background: rgba(176,95,85,.055);
}
.sync-pill[data-state="offline"] i {
  background: var(--v13-error);
  box-shadow: 0 0 0 4px rgba(176,95,85,.09);
}

.account-button {
  min-height: 42px;
  max-width: 150px;
  padding: 0 15px 0 10px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border: 1px solid rgba(63,55,46,.12);
  border-radius: 999px;
  color: #4c4740;
  background: rgba(255,255,255,.5);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.88);
  backdrop-filter: blur(14px) saturate(130%);
  -webkit-backdrop-filter: blur(14px) saturate(130%);
  font-family: var(--font-body);
  font-size: .76rem;
  white-space: nowrap;
  transition: transform 180ms cubic-bezier(.2,.8,.2,1), background 180ms ease, border-color 180ms ease;
}
.account-button:hover {
  transform: translateY(-1px);
  border-color: rgba(63,55,46,.18);
  background: rgba(255,255,255,.78);
}
.account-button:active { transform: scale(.97); }
.account-orb {
  width: 23px;
  height: 23px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 34%, rgba(255,255,255,.62) 0 13%, transparent 14%),
    radial-gradient(circle at 50% 83%, rgba(255,255,255,.54) 0 25%, transparent 26%),
    linear-gradient(145deg, #89987d, #5f7154);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.34), 0 5px 12px -8px #34402f;
}
html[data-auth-state="signed-out"] .account-orb {
  background:
    radial-gradient(circle at 50% 34%, rgba(255,255,255,.64) 0 13%, transparent 14%),
    radial-gradient(circle at 50% 83%, rgba(255,255,255,.56) 0 25%, transparent 26%),
    linear-gradient(145deg, #b6aea2, #8d8478);
}

.auth-dialog,
.account-dialog {
  position: fixed;
  inset: 50% auto auto 50%;
  margin: 0;
  transform: translate(-50%, -50%);
  padding: 0;
  overflow: hidden;
  border: 0;
  color: var(--v13-ink);
  background: var(--v13-paper);
  box-shadow:
    0 46px 120px -34px rgba(35,31,25,.62),
    0 16px 36px -24px rgba(35,31,25,.35);
}
.auth-dialog::backdrop,
.account-dialog::backdrop {
  background: rgba(38,34,29,.4);
  backdrop-filter: blur(15px) saturate(.86);
  -webkit-backdrop-filter: blur(15px) saturate(.86);
}

.auth-dialog {
  width: min(780px, calc(100vw - 32px));
  grid-template-columns: 220px minmax(0, 1fr);
  border-radius: 30px;
}
.auth-dialog[open] {
  display: grid;
  animation: v13-dialog-in .38s cubic-bezier(.16,1,.3,1) both;
}
.auth-dialog .auth-close {
  position: absolute;
  z-index: 8;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
}
.auth-rail {
  position: relative;
  min-height: 590px;
  padding: 30px 28px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: #fffaf2;
  background:
    radial-gradient(15rem 18rem at 120% 6%, rgba(122,142,108,.45), transparent 68%),
    radial-gradient(13rem 16rem at -25% 110%, rgba(185,139,104,.22), transparent 72%),
    linear-gradient(155deg, #292d26 0%, #1f211d 70%, #181a17 100%);
}
.auth-rail::before {
  content: "";
  position: absolute;
  width: 250px;
  height: 250px;
  right: -160px;
  top: 48%;
  border: 1px solid rgba(255,255,255,.11);
  border-radius: 50%;
  box-shadow: 0 0 0 32px rgba(255,255,255,.025), 0 0 0 66px rgba(255,255,255,.018);
  transform: translateY(-50%);
}
.auth-rail > span {
  position: relative;
  z-index: 1;
  align-self: flex-start;
  min-height: 27px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 999px;
  color: rgba(255,250,242,.78);
  background: rgba(255,255,255,.07);
  font-size: .62rem;
  letter-spacing: .11em;
}
.auth-rail > strong {
  position: relative;
  z-index: 1;
  margin: auto 0;
  color: #fffaf2;
  font-family: var(--font-display);
  font-size: 5.1rem;
  font-weight: 500;
  line-height: .82;
  letter-spacing: -.07em;
  text-shadow: 0 18px 34px rgba(0,0,0,.24);
}
.auth-rail > i {
  position: absolute;
  left: 28px;
  bottom: 80px;
  width: 36px;
  height: 2px;
  border-radius: 999px;
  background: #9bac8f;
}
.auth-rail > small {
  position: relative;
  z-index: 1;
  color: rgba(255,250,242,.47);
  font-size: .58rem;
  font-weight: 600;
  line-height: 1.55;
  letter-spacing: .15em;
}

.auth-content {
  min-width: 0;
  padding: 48px 52px 42px;
}
.auth-content h2,
.account-dialog h2 {
  margin: 8px 0 0;
  font-family: var(--font-display);
  font-size: 2.35rem;
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -.035em;
}
.auth-intro {
  max-width: 430px;
  margin: 13px 0 24px;
  color: #686158;
  font-size: .87rem;
  line-height: 1.7;
}
.auth-mode-switch {
  height: 44px;
  padding: 4px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid rgba(64,55,45,.1);
  border-radius: 14px;
  background: rgba(232,227,218,.58);
}
.auth-mode-switch button {
  border: 0;
  border-radius: 10px;
  color: #7b7368;
  background: transparent;
  font-size: .78rem;
  transition: color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}
.auth-mode-switch button.active {
  color: #29261f;
  background: rgba(255,255,255,.86);
  box-shadow: 0 7px 16px -12px rgba(35,30,25,.5), inset 0 1px 0 #fff;
}
#authForm {
  margin-top: 18px;
  display: grid;
  gap: 13px;
}
.auth-field {
  display: grid;
  gap: 7px;
}
.auth-field[hidden] { display: none; }
.auth-field > span {
  color: #776f64;
  font-size: .69rem;
  letter-spacing: .04em;
}
.auth-field input {
  width: 100%;
  height: 49px;
  padding: 0 15px;
  border: 1px solid rgba(63,54,45,.12);
  border-radius: 14px;
  color: #28241f;
  background: rgba(255,255,255,.74);
  box-shadow: inset 0 1px 0 #fff, 0 10px 24px -22px rgba(33,28,23,.5);
  font-family: var(--font-body);
  font-size: .88rem;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}
.auth-field input:focus {
  border-color: color-mix(in oklab, var(--v13-cloud) 58%, #d7d1c8);
  background: #fff;
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--v13-cloud) 10%, transparent);
}
.auth-error {
  min-height: 18px;
  margin: -1px 0 0;
  color: var(--v13-error);
  font-size: .72rem;
  line-height: 1.45;
}
.auth-submit {
  width: 100%;
  min-height: 48px;
  justify-content: center;
}
.auth-divider {
  margin: 20px 0 15px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #9a9185;
  font-size: .64rem;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(65,56,46,.1);
}
.passkey-button {
  min-height: 46px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid rgba(63,54,45,.12);
  border-radius: 14px;
  color: #39352f;
  background: rgba(255,255,255,.62);
  box-shadow: inset 0 1px 0 #fff;
  font-family: var(--font-body);
  font-size: .78rem;
  transition: transform 170ms cubic-bezier(.2,.8,.2,1), background 170ms ease;
}
.auth-content > .passkey-button { width: 100%; }
.passkey-button:hover {
  transform: translateY(-1px);
  background: #fff;
}
.passkey-symbol,
.account-security-mark {
  width: 22px;
  height: 22px;
  border: 1.5px solid #68775e;
  border-radius: 50% 50% 46% 46%;
  background:
    radial-gradient(circle at 50% 38%, #68775e 0 2px, transparent 2.5px),
    linear-gradient(#68775e,#68775e) 50% 72% / 7px 1.5px no-repeat;
}
.auth-privacy {
  margin: 16px 0 0;
  color: #958d82;
  font-size: .65rem;
  line-height: 1.55;
  text-align: center;
}

.account-dialog {
  width: min(470px, calc(100vw - 28px));
  padding: 42px 42px 34px;
  border-radius: 26px;
}
.account-dialog[open] {
  display: block;
  animation: v13-dialog-in .34s cubic-bezier(.16,1,.3,1) both;
}
.account-dialog > .dialog-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
}
.account-email {
  margin: 11px 0 24px;
  color: #71695f;
  font-size: .85rem;
}
.account-security {
  padding: 17px;
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid rgba(66,57,47,.1);
  border-radius: 17px;
  background: rgba(239,235,227,.62);
}
.account-security-mark {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
}
.account-security div {
  display: grid;
  gap: 4px;
}
.account-security strong {
  color: #34302a;
  font-size: .78rem;
  font-weight: 600;
}
.account-security small {
  color: #81786d;
  font-size: .68rem;
  line-height: 1.45;
}
.account-actions {
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.account-actions .passkey-button { min-width: 145px; }
.account-actions .text-button {
  min-height: 46px;
  padding: 0 15px;
  border-radius: 14px;
}

html[data-auth-state="signed-out"] .stat-card strong,
html[data-auth-state="signed-out"] .insight-total strong,
html[data-auth-state="signed-out"] .overview-upcoming b {
  color: #9a9388;
}
html[data-auth-state="signed-out"] .library .controls {
  opacity: .58;
}

@keyframes v13-dialog-in {
  from { opacity: 0; transform: translate(-50%, calc(-50% + 16px)) scale(.985); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@media (max-width: 760px) {
  .topbar-meta .sync-pill { display: none; }
  .account-button {
    width: 42px;
    min-width: 42px;
    padding: 0;
    justify-content: center;
  }
  .account-button > span:last-child { display: none; }
  .auth-dialog {
    width: calc(100vw - 20px);
    max-height: calc(100dvh - 20px);
    grid-template-columns: 1fr;
    overflow-y: auto;
    border-radius: 24px;
  }
  .auth-rail {
    min-height: 132px;
    padding: 22px;
    display: block;
  }
  .auth-rail > span { max-width: calc(100% - 52px); }
  .auth-rail > strong {
    position: absolute;
    left: 22px;
    bottom: 18px;
    margin: 0;
    font-size: 3.2rem;
  }
  .auth-rail > i { display: none; }
  .auth-rail > small {
    position: absolute;
    right: 22px;
    bottom: 18px;
    text-align: right;
  }
  .auth-content { padding: 28px 22px 24px; }
  .auth-content h2 { max-width: calc(100% - 30px); font-size: 2rem; }
  .auth-dialog .auth-close {
    top: 16px;
    right: 16px;
    color: rgba(255,250,242,.84);
    border-color: rgba(255,255,255,.13);
    background: rgba(255,255,255,.08);
  }
  .account-dialog { padding: 38px 22px 24px; }
  .account-actions { flex-direction: column; }
  .account-actions .passkey-button,
  .account-actions .text-button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-dialog[open],
  .account-dialog[open] { animation: none; }
}
