:root {
  --auth-accent: var(--glow);
  --auth-panel: var(--raised);
  --auth-soft: rgba(255, 255, 255, 0.06);
  --auth-border: rgba(255, 255, 255, 0.07);
}

.app-titlebar {
  position: relative;
}

.account-menu {
  position: absolute;
  top: 6px;
  right: 12px;
  z-index: 80;
  -webkit-app-region: no-drag;
}

html[data-platform="win32"] .account-menu {
  right: auto;
  left: 12px;
}

.account-menu[hidden] {
  display: none !important;
}

.app-update-shortcut {
  position: absolute;
  top: 8px;
  right: 48px;
  z-index: 79;
  height: 24px;
  padding: 0 9px 0 8px;
  border: 0;
  border-radius: 40px;
  background: var(--glow);
  color: var(--on-glow);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  text-transform: lowercase;
  white-space: nowrap;
  cursor: pointer;
  outline: none;
  -webkit-app-region: no-drag;
  transition: background 100ms ease, transform 100ms ease;
}

html[data-platform="win32"] .app-update-shortcut {
  right: auto;
  left: 48px;
}

.app-update-shortcut[hidden] {
  display: none !important;
}

.app-update-shortcut:hover,
.app-update-shortcut:focus-visible {
  background: var(--glow);
}

.app-update-shortcut:active {
  transform: scale(0.97);
}

.app-update-shortcut-icon {
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
}

.account-avatar-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(var(--glow-rgb), 0.26);
  background: rgba(var(--glow-rgb), 0.13);
  color: rgba(255, 255, 255, 0.86);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  transition: background 100ms ease, border-color 100ms ease, transform 100ms ease;
}

.account-avatar-btn:hover,
.account-avatar-btn:focus-visible,
.account-avatar-btn.is-open {
  background: rgba(var(--glow-rgb), 0.2);
  border-color: rgba(var(--glow-rgb), 0.48);
}

.account-avatar-btn:active {
  transform: scale(0.96);
}

.account-popover {
  position: absolute;
  top: 34px;
  right: 0;
  width: 210px;
  padding: 7px;
  border-radius: 2px;
  background: var(--raised);
  border: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.48);
  opacity: 0;
  transform: translateY(-5px) scale(0.98);
  transform-origin: top right;
  pointer-events: none;
  transition: opacity 120ms ease, transform 120ms ease;
}

html[data-platform="win32"] .account-popover {
  right: auto;
  left: 0;
  transform-origin: top left;
}

.account-popover.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.account-popover-header {
  padding: 7px 8px 9px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.account-popover-name {
  font-size: 12px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.82);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-popover-email {
  font-size: 11px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.32);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-popover-item {
  width: 100%;
  height: 30px;
  margin-top: 3px;
  padding: 0 8px;
  border: none;
  border-radius: 2px;
  background: transparent;
  color: rgba(255, 255, 255, 0.62);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 400;
  text-align: left;
  cursor: pointer;
  outline: none;
  transition: background 80ms ease, color 80ms ease;
}

.account-popover-item:hover,
.account-popover-item:focus-visible {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.84);
}

.account-popover-item--danger {
  color: rgba(220, 100, 90, 0.88);
}

.account-popover-item--danger:hover,
.account-popover-item--danger:focus-visible {
  background: rgba(220, 90, 80, 0.13);
  color: rgba(240, 120, 108, 1);
}

.account-popover-shortcut {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.44);
  background: rgba(255, 255, 255, 0.07);
  border-radius: 2px;
  padding: 2px 6px;
  font-family: var(--font-mono);
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 500;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.018), rgba(0, 0, 0, 0.06)),
    var(--app-background);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 1;
  pointer-events: auto;
  transition: opacity 180ms ease;
}

.auth-gate.is-unlocked {
  opacity: 0;
  pointer-events: none;
}

.auth-shell {
  width: min(360px, calc(100vw - 48px));
  display: flex;
  justify-content: center;
}

.auth-loading,
.auth-card {
  width: 100%;
  background: transparent;
  border: none;
  box-shadow: none;
  animation: auth-in 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

.auth-loading {
  min-height: 190px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 13px;
}

.auth-card {
  padding: 0;
}

.auth-card[hidden],
.auth-loading[hidden] {
  display: none !important;
}

@keyframes auth-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.auth-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.86);
  letter-spacing: 0.02em;
  text-align: center;
}

.auth-brand::before {
  content: "";
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  border-radius: 4px;
  background: url("../SonusIcon.png") center / cover no-repeat;
}

.auth-muted {
  font-size: 12px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.36);
  line-height: 1.45;
  text-align: center;
}

.auth-loader {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(var(--glow-rgb), 0.18);
  border-top-color: var(--auth-accent);
  animation: auth-spin 700ms linear infinite;
}

@keyframes auth-spin {
  to { transform: rotate(360deg); }
}

.auth-tabs {
  margin: 18px auto 0;
  display: flex;
  justify-content: center;
  gap: 24px;
}

.auth-tab {
  position: relative;
  height: 28px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.35);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  cursor: pointer;
  outline: none;
  padding: 0;
  transition: color 110ms ease;
}

.auth-tab:hover,
.auth-tab:focus-visible {
  color: rgba(255, 255, 255, 0.72);
}

.auth-tab::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--auth-accent);
  opacity: 0;
  transform: scaleX(0.45);
  transition: opacity 120ms ease, transform 120ms ease;
}

.auth-tab.is-active {
  color: rgba(255, 255, 255, 0.86);
}

.auth-tab.is-active::after {
  opacity: 1;
  transform: scaleX(1);
}

.auth-form {
  display: none;
  flex-direction: column;
  gap: 10px;
  margin-top: 18px;
}

.auth-form.is-active {
  display: flex;
}

.auth-social-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.auth-social-btn {
  height: 34px;
  border: 1px solid transparent;
  border-radius: 2px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 90ms ease, border-color 90ms ease, color 90ms ease, transform 90ms ease;
}

.auth-social-btn--google {
  background: rgba(255, 255, 255, 0.94);
  color: rgba(20, 20, 20, 0.88);
  border-color: rgba(255, 255, 255, 0.18);
}

.auth-social-btn--google:hover,
.auth-social-btn--google:focus-visible {
  background: #ffffff;
  color: var(--ink);
}

.auth-social-btn--discord {
  background: #5865f2;
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.08);
}

.auth-social-btn--discord:hover,
.auth-social-btn--discord:focus-visible {
  background: #6672f6;
  color: #ffffff;
}

.auth-social-btn:active {
  transform: scale(0.985);
}

.auth-social-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.auth-social-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 9px;
  color: rgba(255, 255, 255, 0.22);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  height: 1px;
  flex: 1 1 auto;
  background: rgba(255, 255, 255, 0.06);
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.auth-field span {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.28);
}

.auth-field input {
  width: 100%;
  height: 34px;
  border-radius: 2px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.045);
  color: rgba(255, 255, 255, 0.82);
  font-family: inherit;
  font-size: 13px;
  font-weight: 400;
  padding: 0 9px;
  outline: none;
  transition: border-color 90ms ease, background 90ms ease;
}

.auth-field input::placeholder {
  color: rgba(255, 255, 255, 0.22);
}

.auth-field input:focus {
  border-color: rgba(var(--glow-rgb), 0.34);
  background: rgba(255, 255, 255, 0.08);
}

.auth-password-field {
  position: relative;
  display: block;
}

.auth-password-field input {
  padding-right: 40px;
}

.auth-password-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: rgba(255, 255, 255, 0.36);
  transform: translateY(-50%);
}

.auth-password-toggle:hover,
.auth-password-toggle:focus-visible {
  color: rgba(255, 255, 255, 0.82);
  background: rgba(255, 255, 255, 0.07);
  outline: 0;
}

.auth-password-toggle svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.auth-status {
  min-height: 17px;
  font-size: 12px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.36);
  line-height: 1.45;
}

.auth-status.is-error {
  color: rgba(210, 85, 75, 0.9);
}

.auth-status.is-success {
  color: rgba(154, 230, 180, 0.92);
}

.auth-primary-btn,
.auth-secondary-btn {
  width: 100%;
  height: 34px;
  border: none;
  border-radius: 2px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  transition: background 90ms ease, color 90ms ease, opacity 90ms ease;
}

.auth-primary-btn {
  background: var(--auth-accent);
  color: var(--on-glow);
}

.auth-primary-btn:hover,
.auth-primary-btn:focus-visible {
  background: var(--glow);
}

.auth-secondary-btn {
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.58);
}

.auth-secondary-btn:hover,
.auth-secondary-btn:focus-visible {
  background: rgba(255, 255, 255, 0.11);
  color: rgba(255, 255, 255, 0.76);
}

.auth-primary-btn:disabled,
.auth-secondary-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.auth-card--entitlement {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-card--machine-limit {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-card--username {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-username-title {
  margin-top: 6px;
  font-size: 16px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.82);
  text-align: center;
  line-height: 1.35;
}

.auth-username-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 5px;
}

.auth-password-setup-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-entitlement-title {
  margin-top: 6px;
  font-size: 16px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.82);
  text-align: center;
  line-height: 1.35;
}

.auth-entitlement-actions {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 3px;
}

.auth-machine-list,
.settings-machine-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-machine-row,
.settings-machine-row {
  min-height: 48px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.055);
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 8px 10px;
}

.settings-machine-row {
  background: rgba(255, 255, 255, 0.035);
}

.auth-machine-info,
.settings-machine-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.auth-machine-name,
.settings-machine-name {
  font-size: 12px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.78);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-machine-meta,
.settings-machine-meta {
  font-size: 11px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.28);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-machine-current,
.settings-machine-current {
  color: rgba(var(--glow-rgb), 0.85);
}

.auth-machine-remove,
.settings-machine-remove {
  width: 24px;
  height: 24px;
  border-radius: 2px;
  border: none;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.45);
  font-family: inherit;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  outline: none;
  transition: background 90ms ease, color 90ms ease;
}

.auth-machine-remove:hover,
.auth-machine-remove:focus-visible,
.settings-machine-remove:hover,
.settings-machine-remove:focus-visible {
  background: rgba(220, 90, 80, 0.16);
  color: rgba(240, 120, 108, 1);
}

.auth-machine-remove[data-confirm-pending],
.settings-machine-remove[data-confirm-pending] {
  background: rgba(220, 90, 80, 0.22);
  color: rgba(240, 130, 118, 1);
  font-size: 12px;
}

.auth-confirm-modal {
  width: 330px;
  background: var(--raised);
  border-radius: 2px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.65);
  overflow: hidden;
  transform: translateY(-8px) scale(0.97);
  transition: transform 160ms cubic-bezier(0.22, 1, 0.36, 1);
}

.modal-shell.is-open .auth-confirm-modal {
  transform: translateY(0) scale(1);
}

.auth-confirm-title {
  font-size: 11px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.32);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 14px 16px 8px;
}

.auth-confirm-body {
  padding: 0 16px 14px;
  font-size: 12px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.56);
  line-height: 1.45;
}

.auth-confirm-actions {
  display: flex;
  gap: 6px;
  padding: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.auth-logout-confirm-btn {
  background: rgba(210, 85, 75, 0.88);
  color: var(--on-glow);
}

.auth-logout-confirm-btn:hover,
.auth-logout-confirm-btn:focus-visible {
  background: rgba(230, 105, 95, 1);
}

.update-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(0, 0, 0, 0.36);
  opacity: 0;
  pointer-events: none;
  transition: opacity 150ms ease;
}

.update-modal-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.app-update-modal {
  position: relative;
  width: min(390px, calc(100vw - 44px));
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 5px;
  background: var(--raised);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.38);
  transform: translateY(8px) scale(0.98);
  transition: transform 150ms ease;
}

.update-modal-backdrop.is-open .app-update-modal {
  transform: translateY(0) scale(1);
}

.app-update-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.44);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

.app-update-close:hover,
.app-update-close:focus-visible {
  color: rgba(255, 255, 255, 0.86);
  outline: 0;
}

.app-update-kicker {
  margin-bottom: 10px;
  color: var(--auth-accent);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app-update-title {
  max-width: 300px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 18px;
  font-weight: 500;
  line-height: 1.15;
}

.app-update-copy {
  margin: 12px 0 18px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 13px;
  line-height: 1.45;
}

.app-update-download {
  width: 100%;
  height: 38px;
  border: 0;
  border-radius: 2px;
  background: var(--auth-accent);
  color: var(--ink);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
}

.app-update-download:disabled {
  cursor: default;
  opacity: 0.62;
}
