:root {
  color-scheme: dark;
  font-family: var(--lf-font-body);
  background: var(--lf-charcoal-950);
  color: var(--lf-text);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body.manage-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  margin: 0;
  background:
    radial-gradient(circle at 50% 12%, rgba(34, 191, 118, 0.09), transparent 28rem),
    linear-gradient(180deg, #050606 0%, #070808 56%, #050506 100%);
  color: var(--lf-text);
}

body.manage-page #navbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
}

.manage-main {
  flex: 1 0 auto;
  display: grid;
  place-items: center;
  min-height: calc(100vh - 96px);
  padding: 118px var(--lf-page-x) 72px;
}

.manage-shell {
  position: relative;
  isolation: isolate;
  width: min(100%, 680px);
  text-align: left;
}

.manage-glow {
  position: absolute;
  top: 40px;
  left: 50%;
  z-index: -1;
  width: min(580px, 92vw);
  height: 380px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: rgba(34, 191, 118, 0.08);
  filter: blur(80px);
  pointer-events: none;
}

.manage-eyebrow,
.summary-label {
  display: block;
  margin-bottom: 10px;
  color: var(--lf-accent-strong);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.page-header-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 15px;
}

.page-header-brand {
  color: var(--lf-text);
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.4;
}

.page-header-meta .eyebrow {
  margin: 0;
}

.manage-shell h1 {
  margin: 0 0 12px;
  font-size: clamp(38px, 6.5vw, 54px);
  line-height: 0.98;
  letter-spacing: -0.05em;
  color: var(--lf-text);
}

.manage-lede {
  margin: 0 0 32px;
  color: var(--lf-text-soft);
  font-size: 16px;
  line-height: 1.6;
}

.status {
  margin: 0 0 20px;
  padding: 12px 18px;
  border: 1px solid rgba(102, 217, 154, 0.2);
  border-radius: 12px;
  background: rgba(34, 191, 118, 0.065);
  color: #d4f2e0;
  font-size: 13px;
  font-weight: 550;
  line-height: 1.5;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.04);
}

.status:empty {
  display: none !important;
}

.auth-card {
  padding: clamp(24px, 5vw, 36px);
  border: 1px solid var(--lf-border-strong);
  border-radius: var(--lf-radius-lg);
  background: rgba(14, 17, 15, 0.92);
  box-shadow: var(--lf-shadow-card), inset 0 1px rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
}

.auth-copy {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 26px;
}

.auth-icon {
  display: grid;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  place-items: center;
  margin: 0;
  border: 1px solid rgba(102, 217, 154, 0.28);
  border-radius: 12px;
  background: rgba(34, 191, 118, 0.09);
  color: var(--lf-accent-strong);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.08);
}

.auth-icon svg {
  width: 22px;
  height: 22px;
}

.auth-copy h2 {
  margin: 0 0 4px;
  font-size: 20px;
  line-height: 1.25;
  letter-spacing: -0.03em;
  color: var(--lf-text);
}

.auth-copy p {
  margin: 0;
  color: var(--lf-text-soft);
  font-size: 14px;
  line-height: 1.55;
}

.auth-card label {
  display: block;
  margin-bottom: 8px;
  color: var(--lf-text);
  font-size: 13px;
  font-weight: 650;
}

.form-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
}

.auth-card input {
  min-width: 0;
  width: 100%;
  height: 48px;
  padding: 0 16px;
  border: 1px solid var(--lf-border-strong);
  border-radius: 12px;
  outline: none;
  background: rgba(9, 11, 10, 0.95);
  color: var(--lf-text);
  font: 500 15px/1 var(--lf-font-body);
  transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.auth-card input::placeholder {
  color: var(--lf-text-faint);
}

.auth-card input:focus {
  border-color: rgba(102, 217, 154, 0.65);
  box-shadow: 0 0 0 3px rgba(34, 191, 118, 0.12);
  background: rgba(12, 16, 14, 1);
}

.code-input {
  letter-spacing: 0.24em;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 18px !important;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.primary-button,
.danger-button,
.secondary-button {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
  border-radius: 11px;
  font-size: 14px;
  font-weight: 700;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.primary-button {
  background: #F3F4F1;
  color: #0B0D0C;
  border: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

.primary-button:hover {
  transform: translateY(-1px);
  background: #E7E9E5;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.3);
}

.primary-button:disabled {
  transform: none;
  background: #d8dad6;
  color: rgba(11, 13, 12, 0.45);
  box-shadow: none;
  cursor: wait;
}

.text-button {
  margin-top: 14px;
  padding: 4px 8px;
  background: transparent;
  color: var(--lf-text-soft);
  font-size: 13px;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 4px;
  transition: color 180ms ease, text-decoration-color 180ms ease;
}

.text-button:hover {
  color: var(--lf-text);
  text-decoration-color: currentColor;
}

.license-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
  padding: 0 2px;
}

.summary-label {
  margin-bottom: 3px;
}

.device-count {
  margin: 0;
  color: var(--lf-text);
  font-size: 15px;
  font-weight: 600;
}

.refresh-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border: 1px solid var(--lf-border-strong);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--lf-text-soft);
  font-size: 13px;
  font-weight: 600;
  transition: border-color 180ms ease, background 180ms ease, color 180ms ease;
}

.refresh-button:hover {
  border-color: rgba(102, 217, 154, 0.35);
  background: rgba(34, 191, 118, 0.08);
  color: var(--lf-accent-strong);
}

.refresh-icon {
  width: 14px;
  height: 14px;
}

.device-list {
  display: grid;
  gap: 12px;
}

.device {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  min-height: 92px;
  padding: 20px 22px;
  border: 1px solid var(--lf-border-strong);
  border-radius: 16px;
  background: rgba(15, 18, 16, 0.88);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.035), 0 8px 24px rgba(0, 0, 0, 0.2);
  transition: border-color 180ms ease, background 180ms ease;
}

.device:hover {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(18, 22, 19, 0.95);
}

.device-glyph {
  position: relative;
  display: block;
  width: 44px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: #0e1210;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.08);
}

.device-glyph::before {
  content: "";
  position: absolute;
  inset: 5px 5px 8px;
  border-radius: 3px;
  background: linear-gradient(145deg, rgba(102, 217, 154, 0.25), rgba(34, 191, 118, 0.05));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.12);
}

.device-glyph::after {
  content: "";
  position: absolute;
  left: 13px;
  right: 13px;
  bottom: -4px;
  height: 3px;
  border-radius: 2px;
  background: #505854;
}

.device-details {
  min-width: 0;
}

.device-secondary,
.device-activity {
  margin: 5px 0 0;
  color: var(--lf-text-faint);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.device-activity {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 12px;
}

.device h2 {
  margin: 0;
  overflow: hidden;
  color: var(--lf-text);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-overflow: ellipsis;
  white-space: normal;
  overflow-wrap: anywhere;
}

.device-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-top: 6px;
  color: var(--lf-text-faint);
  font-size: 12px;
}

.active-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--lf-accent-strong);
  font-weight: 650;
}

.active-state::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--lf-accent);
  box-shadow: 0 0 10px var(--lf-accent), 0 0 0 3px rgba(34, 191, 118, 0.12);
}

.current-device {
  padding: 2px 8px;
  border: 1px solid rgba(102, 217, 154, 0.3);
  border-radius: 999px;
  background: rgba(34, 191, 118, 0.12);
  color: var(--lf-accent-strong);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.remove-button {
  padding: 8px 14px;
  border: 1px solid var(--lf-border-strong);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.02);
  color: #c2c7c4;
  font-size: 13px;
  font-weight: 650;
  transition: border-color 180ms ease, background 180ms ease, color 180ms ease;
}

.remove-button:hover {
  border-color: rgba(248, 113, 113, 0.38);
  background: rgba(248, 113, 113, 0.08);
  color: #fca5a5;
}

.empty-state {
  padding: 44px 24px;
  border: 1px solid var(--lf-border);
  border-radius: 16px;
  background: rgba(15, 17, 16, 0.65);
  text-align: center;
}

.empty-state .device-glyph {
  margin: 0 auto 18px;
}

.empty-state h2 {
  margin: 0 0 6px;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.empty-state p {
  margin: 0;
  color: var(--lf-text-soft);
  font-size: 14px;
}

.manage-footer {
  margin-top: 36px;
  text-align: center;
}

.manage-support-link {
  color: var(--lf-text-faint);
  font-size: 13px;
  font-weight: 600;
  transition: color 180ms ease;
}

.manage-support-link:hover {
  color: var(--lf-accent-strong);
}

dialog#confirmation {
  width: min(calc(100% - 32px), 440px);
  padding: 28px;
  border: 1px solid var(--lf-border-strong);
  border-radius: 22px;
  outline: none;
  background: #0e110f;
  color: var(--lf-text);
  box-shadow: 0 32px 90px rgba(0, 0, 0, 0.75), inset 0 1px rgba(255, 255, 255, 0.05);
}

dialog#confirmation::backdrop {
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.dialog-head {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.dialog-icon {
  display: grid;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  place-items: center;
  margin: 0;
  border: 1px solid rgba(248, 113, 113, 0.28);
  border-radius: 12px;
  background: rgba(248, 113, 113, 0.09);
  color: #f87171;
}

.dialog-icon svg {
  width: 22px;
  height: 22px;
}

dialog#confirmation h2 {
  margin: 0 0 4px;
  font-size: 20px;
  line-height: 1.25;
  letter-spacing: -0.03em;
}

dialog#confirmation p {
  margin: 0;
  color: var(--lf-text-soft);
  font-size: 14px;
  line-height: 1.55;
}

.modal-status {
  margin: 12px 0 16px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.2);
  color: #fca5a5;
  font-size: 13px;
  line-height: 1.45;
}

.modal-status:empty {
  display: none !important;
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.danger-button {
  background: #ef4444;
  color: #ffffff;
  box-shadow: 0 8px 24px rgba(239, 68, 68, 0.25);
}

.danger-button:hover {
  transform: translateY(-1px);
  background: #f87171;
  box-shadow: 0 12px 28px rgba(239, 68, 68, 0.32);
}

.secondary-button {
  border: 1px solid var(--lf-border-strong);
  background: rgba(255, 255, 255, 0.04);
  color: var(--lf-text-soft);
}

.secondary-button:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--lf-text);
}

#removal-otp-form {
  margin-top: 16px;
}

.otp-group {
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
  margin: 18px 0 20px;
}

.otp-box {
  width: 44px;
  height: 50px;
  padding: 0;
  border: 1px solid var(--lf-border-strong);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--lf-text);
  font-family: inherit;
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  line-height: 50px;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
  caret-color: var(--lf-accent-strong);
}

.otp-box:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.06);
}

.otp-box:focus {
  outline: none;
  border-color: var(--lf-accent-strong);
  box-shadow: 0 0 0 1px var(--lf-accent-strong), 0 0 12px rgba(72, 215, 134, 0.2);
  background: rgba(255, 255, 255, 0.08);
}

.otp-hidden-input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.removal-actions {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 4px;
}

.removal-submit-btn {
  width: 100%;
  min-height: 44px;
}

.danger-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.removal-secondary-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--lf-text-soft);
}

.resend-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--lf-text-soft);
}

.text-link-button {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--lf-text);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 150ms ease;
}

.text-link-button:hover {
  color: var(--lf-accent-strong);
}

.text-link-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  text-decoration: none;
}

.cancel-secondary {
  color: var(--lf-text-soft);
  text-decoration: none;
  font-weight: 500;
  padding: 2px 8px;
}

.cancel-secondary:hover {
  color: var(--lf-text);
  text-decoration: underline;
}

@media (max-width: 400px) {
  .otp-group {
    gap: 6px;
  }
  .otp-box {
    width: 38px;
    height: 44px;
    font-size: 19px;
  }
}

:focus-visible {
  outline: 2px solid var(--lf-accent-strong);
  outline-offset: 3px;
}

@media (max-width: 560px) {
  .manage-main {
    padding: 104px 18px 56px;
  }

  .manage-shell {
    text-align: left;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .primary-button {
    width: 100%;
  }

  .device {
    grid-template-columns: 38px minmax(0, 1fr);
    padding: 16px 18px;
  }

  .device-glyph {
    width: 38px;
    height: 32px;
  }

  .remove-button {
    grid-column: 2;
    justify-self: start;
    margin-top: 4px;
  }

  .dialog-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .dialog-actions button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .primary-button,
  .danger-button,
  .secondary-button,
  .refresh-button,
  .remove-button,
  .auth-card input {
    transition: none;
  }
}

/* Present before JavaScript or the authenticated device request completes. */
.device-loading { margin: 24px 0; color: var(--lf-text-soft); }
.device-skeleton {
  display: flex; align-items: center; gap: 18px; min-height: 108px;
  margin: 16px 0; padding: 24px; border: 1px solid var(--lf-border-strong);
  border-radius: 16px; background: #101311;
}
.device-skeleton > span { width: 40px; height: 40px; border-radius: 10px; background: #202723; }
.device-skeleton > div { flex: 1; }
.device-skeleton i { display: block; height: 12px; width: 60%; margin: 10px 0; border-radius: 5px; background: #202723; }
.device-skeleton i + i { width: 85%; opacity: 0.6; }
