:root {
  --red: #e63946;
  --red-dark: #c92d38;
  --red-soft: #fff1f2;
  --ink: #151524;
  --ink-2: #242437;
  --muted: #6f7482;
  --line: #e4e7ec;
  --line-dark: rgba(255, 255, 255, 0.14);
  --surface: #ffffff;
  --surface-2: #f6f7f9;
  --dark: #161623;
  --green: #168a63;
  --amber: #b7791f;
  --shadow: 0 14px 40px rgba(21, 21, 36, 0.08);
  --shadow-strong: 0 20px 60px rgba(21, 21, 36, 0.16);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-spring: cubic-bezier(0.2, 0.9, 0.24, 1.12);
  --motion-fast: 160ms;
  --motion: 240ms;
  --motion-slow: 520ms;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: var(--ink);
  background: #f4f5f7;
  line-height: 1.5;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.hidden {
  display: none !important;
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 2000;
  padding: 0.65rem 0.9rem;
  color: #fff;
  background: var(--red-dark);
  border-radius: 8px;
  transform: translateY(-160%);
  transition: transform var(--motion-fast) var(--ease-out);
}

.skip-link:focus {
  transform: translateY(0);
}

.portal-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 68px;
  padding: 0.85rem 2rem;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--ink);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0;
}

.brand span {
  color: var(--red);
}

.brand img {
  display: block;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.lang-toggle {
  display: inline-flex;
  padding: 0.2rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.lang-btn {
  min-width: 40px;
  padding: 0.42rem 0.6rem;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 800;
}

.lang-btn.active {
  color: #fff;
  background: var(--red);
}

.portal-shell {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.25rem 0 3rem;
}

.auth-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(330px, 430px);
  min-height: calc(100vh - 112px);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 560px;
  padding: 3.5rem;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(230, 57, 70, 0.16), transparent 42%),
    linear-gradient(160deg, #161623 0%, #222236 100%);
}

.auth-copy::after {
  content: "";
  display: block;
  width: 100%;
  max-width: 420px;
  height: 1px;
  margin-top: 2rem;
  background: linear-gradient(90deg, var(--red), transparent);
}

.auth-copy h1,
.dashboard-head h1 {
  max-width: 760px;
  margin: 0;
  font-size: 3.35rem;
  line-height: 1.04;
  letter-spacing: 0;
}

.auth-copy p:not(.eyebrow) {
  max-width: 590px;
  margin: 1.1rem 0 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 1rem;
}

.eyebrow {
  margin: 0 0 0.7rem;
  color: var(--red);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.auth-form {
  align-self: center;
  display: grid;
  gap: 1.05rem;
  width: min(100% - 2rem, 380px);
  margin: 0 auto;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: none;
}

label {
  display: grid;
  gap: 0.56rem;
  color: var(--ink-2);
  font-size: 0.9rem;
  font-weight: 800;
}

input,
select {
  width: 100%;
  min-height: 48px;
  padding: 0.78rem 0.85rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

select {
  appearance: none;
  padding-right: 2rem;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 22px,
    calc(100% - 12px) 22px;
  background-size:
    6px 6px,
    6px 6px;
  background-repeat: no-repeat;
  font-weight: 800;
}

input:focus,
select:focus {
  border-color: rgba(230, 57, 70, 0.65);
  box-shadow: 0 0 0 4px rgba(230, 57, 70, 0.12);
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.text-btn,
.support-link,
.config-action,
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 42px;
  border-radius: 8px;
  font-weight: 800;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease,
    background 0.2s ease;
}

.primary-btn {
  min-height: 50px;
  padding: 0 1rem;
  color: #fff;
  background: linear-gradient(135deg, var(--red), var(--red-dark));
  border: 0;
  box-shadow: 0 10px 24px rgba(230, 57, 70, 0.24);
}

.primary-btn:hover,
.secondary-btn:hover,
.support-link:hover,
.config-action:hover,
.icon-btn:hover {
  transform: translateY(-1px);
}

.secondary-btn,
.config-action {
  color: var(--red);
  background: #fff;
  border: 1px solid rgba(230, 57, 70, 0.28);
}

.ghost-btn,
.text-btn {
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
}

.text-btn {
  min-height: 36px;
  color: var(--muted);
  background: transparent;
  border-color: transparent;
}

.icon-btn {
  width: 42px;
  height: 42px;
  padding: 0;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
}

.icon-btn svg,
.support-link svg,
.config-action svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.form-message {
  min-height: 1.35rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.form-message.error {
  color: var(--red-dark);
}

.form-message.success {
  color: var(--green);
}

.totp-setup {
  display: grid;
  justify-items: center;
  gap: 0.85rem;
  padding: 1rem;
  text-align: center;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.totp-setup p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

#totpQr,
#configQr {
  display: grid;
  place-items: center;
  padding: 0.7rem;
  background: #fff;
  border-radius: 8px;
}

.dashboard {
  display: grid;
  gap: 1rem;
}

.dashboard-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  min-height: 150px;
  padding: 1.5rem;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(230, 57, 70, 0.18), transparent 50%),
    linear-gradient(160deg, #151524 0%, #222236 100%);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.dashboard-head h1 {
  max-width: 760px;
  overflow-wrap: anywhere;
  font-size: 2.35rem;
}

.dashboard-head .eyebrow {
  color: #ff7a85;
}

.support-link {
  min-height: 44px;
  padding: 0.68rem 0.95rem;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line-dark);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.summary-item,
.billing-panel,
.email-panel,
.instructions-panel,
.settings-panel,
.admin-panel,
.empty-state,
.config-card,
.billing-detail,
.admin-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.summary-item {
  display: grid;
  gap: 0.35rem;
  min-height: 104px;
  padding: 1rem;
}

.summary-item span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.summary-item strong {
  overflow-wrap: anywhere;
  font-size: 1.65rem;
  line-height: 1.1;
}

.section-head {
  display: grid;
  gap: 0.3rem;
  margin-top: 0.4rem;
}

.section-head.compact {
  margin-top: 0;
}

.section-head h2 {
  margin: 0;
  color: var(--ink);
  font-size: 1.35rem;
  letter-spacing: 0;
}

.section-head p,
.empty-state p,
.muted {
  max-width: 680px;
  margin: 0;
  color: var(--muted);
  font-size: 0.96rem;
}

.billing-panel,
.email-panel,
.instructions-panel,
.settings-panel,
.admin-panel {
  display: grid;
  gap: 0.9rem;
  padding: 1rem;
}

.billing-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.65rem;
}

.billing-detail {
  display: grid;
  gap: 0.22rem;
  padding: 0.85rem;
  background: var(--surface-2);
  box-shadow: none;
}

.billing-period {
  grid-column: span 2;
  align-content: start;
}

.renewal-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 0.45rem;
}

.renewal-option {
  display: grid;
  align-content: center;
  gap: 0.24rem;
  min-height: 68px;
  padding: 0.55rem 0.6rem;
  color: var(--ink);
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease,
    transform 0.2s ease;
}

.renewal-option:hover {
  transform: translateY(-1px);
  border-color: rgba(230, 57, 70, 0.32);
}

.renewal-option.active {
  color: #fff;
  background: linear-gradient(135deg, var(--red), var(--red-dark));
  border-color: transparent;
  box-shadow: 0 10px 24px rgba(230, 57, 70, 0.2);
}

.renewal-option strong {
  font-size: 0.95rem;
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.renewal-option span {
  color: inherit;
  opacity: 0.78;
  font-size: 0.76rem;
}

.billing-detail span,
.admin-meta span,
.meta-item span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
}

.billing-detail strong {
  overflow-wrap: anywhere;
  font-size: 1rem;
}

.billing-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.7rem;
  align-items: center;
}

.email-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.7rem;
  align-items: end;
}

.recovery-choice {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.65rem;
  align-items: end;
  padding-top: 0.2rem;
}

.recovery-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.5;
}

.billing-pay {
  width: auto;
}

.config-list {
  display: grid;
  gap: 0.75rem;
}

.config-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 0.9rem;
  padding: 1rem;
}

.config-main {
  display: grid;
  gap: 0.8rem;
  min-width: 0;
}

.config-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem;
}

.config-title-row h3 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 1.08rem;
  letter-spacing: 0;
}

.status-pill {
  flex: 0 0 auto;
  padding: 0.3rem 0.55rem;
  color: var(--amber);
  background: #fff8e6;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 800;
}

.status-pill.active {
  color: var(--green);
  background: #e8f7f1;
}

.config-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.55rem;
}

.meta-item {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
  padding: 0.7rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.meta-item strong {
  overflow-wrap: anywhere;
  font-size: 0.88rem;
}

.config-actions {
  display: grid;
  align-content: start;
  gap: 0.55rem;
}

.config-action {
  width: 100%;
  min-height: 42px;
  padding: 0.58rem 0.75rem;
}

.instructions-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
}

.instructions-grid a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.7rem;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 800;
}

.empty-state {
  padding: 1rem;
}

.empty-state h3 {
  margin: 0 0 0.35rem;
}

.password-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 0.75rem;
  align-items: end;
}

.admin-list {
  display: grid;
  gap: 0.65rem;
}

.admin-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.8rem;
  padding: 0.85rem;
  box-shadow: none;
}

.admin-meta {
  display: grid;
  gap: 0.18rem;
  min-width: 0;
}

.admin-meta strong,
.admin-meta small {
  overflow-wrap: anywhere;
}

.admin-meta small {
  color: var(--muted);
}

.admin-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.admin-actions .config-action {
  width: auto;
  min-height: 38px;
  padding-inline: 0.7rem;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(21, 21, 36, 0.58);
  backdrop-filter: blur(8px);
}

.modal-dialog {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  padding: 1.2rem;
  background: #fff;
  border-radius: 8px;
  box-shadow: var(--shadow-strong);
}

.modal-dialog h2 {
  margin: 0 2.6rem 1rem 0;
  font-size: 1.2rem;
}

.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
}

.qr-box {
  min-height: 280px;
}

.qr-box img,
.qr-box canvas,
.totp-setup img,
.totp-setup canvas {
  width: min(260px, 100%) !important;
  height: auto !important;
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 60;
  max-width: min(380px, calc(100% - 2rem));
  padding: 0.85rem 1rem;
  color: #fff;
  background: var(--dark);
  border-radius: 8px;
  box-shadow: var(--shadow-strong);
  font-size: 0.92rem;
  font-weight: 800;
}

@media (max-width: 980px) {
  .auth-panel {
    grid-template-columns: 1fr;
  }

  .auth-copy {
    min-height: auto;
    padding: 2rem;
  }

  .auth-copy h1 {
    font-size: 2.45rem;
  }

  .auth-form {
    width: min(100% - 2rem, 460px);
    margin: 1.25rem auto;
  }

  .summary-grid,
  .billing-grid,
  .instructions-grid,
  .config-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .billing-period {
    grid-column: 1 / -1;
  }

  .renewal-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .config-card,
  .password-form,
  .admin-item {
    grid-template-columns: 1fr;
  }

  .dashboard-head {
    grid-template-columns: 1fr;
  }

  .support-link {
    width: 100%;
  }

  .admin-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .portal-header {
    min-height: 64px;
    padding: 0.75rem 0.75rem;
  }

  .brand {
    font-size: 1rem;
  }

  .portal-shell {
    width: min(100% - 0.75rem, 1180px);
    padding-top: 0.75rem;
  }

  .header-actions {
    gap: 0.35rem;
  }

  .lang-btn {
    min-width: 34px;
    padding-inline: 0.5rem;
  }

  .ghost-btn {
    padding-inline: 0.65rem;
  }

  .auth-copy {
    padding: 1.35rem;
  }

  .auth-copy h1,
  .dashboard-head h1 {
    font-size: 2rem;
  }

  .dashboard-head {
    min-height: 150px;
    padding: 1rem;
  }

  .summary-grid,
  .billing-grid,
  .instructions-grid,
  .config-meta,
  .email-form,
  .recovery-choice,
  .billing-actions,
  .admin-actions {
    grid-template-columns: 1fr;
  }

  .billing-period {
    grid-column: auto;
  }

  .config-title-row {
    flex-direction: column;
  }
}

/* ===== Dark-first Product Polish ===== */

:root {
  color-scheme: dark;
  --red: #d92d3a;
  --red-dark: #b91f2b;
  --red-soft: rgba(217, 45, 58, 0.14);
  --ink: #f8fafc;
  --ink-2: #e6e9f0;
  --muted: #aab3c2;
  --line: rgba(255, 255, 255, 0.12);
  --line-dark: rgba(255, 255, 255, 0.16);
  --surface: #151a24;
  --surface-2: #1d2430;
  --surface-3: #252e3c;
  --dark: #0f1117;
  --green: #40c997;
  --amber: #f0b74f;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
  --shadow-strong: 0 28px 72px rgba(0, 0, 0, 0.42);
  --focus: #ff8a93;
  --color-bg: var(--dark);
  --color-surface: var(--surface);
  --color-surface-raised: var(--surface-2);
  --color-text: var(--ink);
  --color-text-muted: var(--muted);
  --color-primary: var(--red);
  --color-primary-hover: var(--red-dark);
  --color-border: var(--line);
}

:root[data-theme="light"] {
  color-scheme: light;
  --red: #d92d3a;
  --red-dark: #b91f2b;
  --red-soft: #fff1f2;
  --ink: #151524;
  --ink-2: #242437;
  --muted: #667085;
  --line: #e4e7ec;
  --line-dark: rgba(255, 255, 255, 0.14);
  --surface: #ffffff;
  --surface-2: #f6f7f9;
  --surface-3: #eef1f5;
  --dark: #161623;
  --green: #168a63;
  --amber: #b7791f;
  --shadow: 0 14px 40px rgba(21, 21, 36, 0.08);
  --shadow-strong: 0 20px 60px rgba(21, 21, 36, 0.16);
  --focus: #b91f2b;
}

body {
  color: var(--ink);
  background:
    radial-gradient(
      circle at 8% 0%,
      rgba(217, 45, 58, 0.12),
      transparent 28rem
    ),
    var(--dark);
}

:root[data-theme="light"] body {
  background: #f4f5f7;
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.portal-header {
  background: color-mix(in srgb, var(--dark) 84%, transparent);
  border-bottom-color: var(--line);
}

:root[data-theme="light"] .portal-header {
  background: rgba(255, 255, 255, 0.94);
}

.lang-toggle,
.theme-toggle,
.icon-btn,
.ghost-btn {
  background: var(--surface-2);
  border-color: var(--line);
}

.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  transition:
    transform 0.2s ease,
    border-color 0.2s ease,
    background 0.2s ease;
}

.theme-toggle:hover {
  transform: translateY(-1px);
  border-color: rgba(217, 45, 58, 0.38);
}

.theme-icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

:root[data-theme="dark"] .theme-icon-sun,
:root[data-theme="light"] .theme-icon-moon {
  display: none;
}

.auth-panel,
.summary-item,
.billing-panel,
.email-panel,
.instructions-panel,
.settings-panel,
.admin-panel,
.empty-state,
.config-card,
.billing-detail,
.admin-item,
.auth-form,
.modal-dialog {
  background: var(--surface);
  border-color: var(--line);
}

.auth-panel {
  box-shadow: var(--shadow);
}

.auth-copy,
.dashboard-head {
  background:
    radial-gradient(
      circle at 82% 8%,
      rgba(217, 45, 58, 0.22),
      transparent 18rem
    ),
    linear-gradient(145deg, #10141f 0%, #171d28 58%, #11141c 100%);
}

.auth-copy {
  min-height: 520px;
}

.auth-copy h1 {
  font-size: clamp(2.25rem, 4vw, 3.05rem);
}

.auth-copy p:not(.eyebrow) {
  color: rgba(255, 255, 255, 0.76);
}

.eyebrow {
  color: #ff7780;
}

label {
  color: var(--ink-2);
  font-weight: 700;
}

input,
select {
  color: var(--ink);
  background: var(--surface-2);
  border-color: var(--line);
}

:root[data-theme="light"] input,
:root[data-theme="light"] select {
  background: #fff;
}

input:focus,
select:focus {
  border-color: rgba(217, 45, 58, 0.72);
  box-shadow: 0 0 0 4px var(--focus);
}

.primary-btn,
.lang-btn.active {
  color: #fff;
  background: linear-gradient(135deg, var(--red), var(--red-dark));
}

.secondary-btn,
.config-action {
  color: #ff7780;
  background: var(--surface-2);
  border-color: rgba(217, 45, 58, 0.32);
}

:root[data-theme="light"] .secondary-btn,
:root[data-theme="light"] .config-action {
  color: var(--red-dark);
  background: #fff;
}

.ghost-btn,
.text-btn,
.icon-btn {
  color: var(--ink);
}

.text-btn {
  color: var(--muted);
}

.form-message.error {
  color: #ff8a93;
}

:root[data-theme="light"] .form-message.error {
  color: var(--red-dark);
}

.form-message.success {
  color: var(--green);
}

.summary-item,
.billing-detail,
.meta-item,
.instructions-grid a {
  background: var(--surface-2);
  border-color: var(--line);
}

.renewal-option {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line);
}

.renewal-option.active {
  color: #fff;
  background: linear-gradient(135deg, var(--red), var(--red-dark));
}

.status-pill {
  color: var(--amber);
  background: rgba(240, 183, 79, 0.16);
}

.status-pill.active {
  color: var(--green);
  background: rgba(64, 201, 151, 0.16);
}

.modal-backdrop {
  background: rgba(5, 7, 12, 0.72);
}

#totpQr,
#configQr {
  background: #fff;
}

@media (max-width: 620px) {
  .portal-header {
    gap: 0.5rem;
  }

  .header-actions {
    gap: 0.35rem;
  }

  .theme-toggle,
  .icon-btn {
    width: 38px;
    height: 38px;
  }

  .auth-copy h1,
  .dashboard-head h1 {
    font-size: 1.85rem;
  }
}

@media (max-width: 980px) {
  .auth-panel {
    min-height: auto;
  }

  .auth-copy {
    min-height: 300px;
    padding: 2rem;
  }

  .auth-copy::after {
    margin-top: 1.35rem;
  }
}

@media (max-width: 620px) {
  .auth-copy {
    min-height: 240px;
    padding: 1.25rem;
  }

  .auth-form {
    width: min(100% - 1rem, 460px);
  }
}

/* ===== 2026 Motion, Loading & A11y Polish ===== */

::selection {
  color: #fff;
  background: rgba(217, 45, 58, 0.72);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 4px;
  box-shadow:
    0 0 0 1px var(--dark),
    0 0 0 6px rgba(255, 138, 147, 0.18);
}

:root[data-theme="light"] a:focus-visible,
:root[data-theme="light"] button:focus-visible,
:root[data-theme="light"] input:focus-visible,
:root[data-theme="light"] select:focus-visible {
  box-shadow:
    0 0 0 1px #fff,
    0 0 0 6px rgba(185, 31, 43, 0.14);
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.text-btn,
.support-link,
.config-action,
.icon-btn,
.theme-toggle,
.lang-btn,
.renewal-option,
.instructions-grid a,
.config-card,
.summary-item,
.billing-detail,
.modal-dialog,
.toast {
  transition:
    color var(--motion-fast) var(--ease-out),
    background var(--motion-fast) var(--ease-out),
    border-color var(--motion-fast) var(--ease-out),
    box-shadow var(--motion) var(--ease-out),
    opacity var(--motion-fast) var(--ease-out),
    transform var(--motion) var(--ease-spring);
}

.primary-btn:active,
.secondary-btn:active,
.ghost-btn:active,
.text-btn:active,
.support-link:active,
.config-action:active,
.icon-btn:active,
.theme-toggle:active,
.lang-btn:active,
.renewal-option:active {
  transform: translateY(0) scale(0.98);
}

button:disabled,
.primary-btn[aria-disabled="true"],
.secondary-btn[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.56;
  transform: none;
}

.portal-header {
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.22);
}

.auth-panel,
.dashboard-head,
.summary-item,
.billing-panel,
.email-panel,
.instructions-panel,
.settings-panel,
.admin-panel,
.empty-state,
.config-card,
.modal-dialog {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0)),
    var(--surface);
}

:root[data-theme="light"] .auth-panel,
:root[data-theme="light"] .summary-item,
:root[data-theme="light"] .billing-panel,
:root[data-theme="light"] .email-panel,
:root[data-theme="light"] .instructions-panel,
:root[data-theme="light"] .settings-panel,
:root[data-theme="light"] .admin-panel,
:root[data-theme="light"] .empty-state,
:root[data-theme="light"] .config-card,
:root[data-theme="light"] .modal-dialog {
  background: var(--surface);
}

:root[data-theme="light"] .dashboard-head {
  color: #fff;
  background:
    radial-gradient(
      circle at 82% 8%,
      rgba(217, 45, 58, 0.22),
      transparent 18rem
    ),
    linear-gradient(145deg, #10141f 0%, #171d28 58%, #11141c 100%);
}

:root[data-theme="light"] .dashboard-head .eyebrow {
  color: #ff7a85;
}

:root[data-theme="light"] .dashboard-head .support-link {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
}

.config-card:hover,
.summary-item:hover,
.instructions-grid a:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 119, 128, 0.28);
  box-shadow: var(--shadow-strong);
}

.dashboard.is-loading {
  cursor: progress;
}

.dashboard.is-loading .summary-item strong,
.dashboard.is-loading .billing-detail strong {
  position: relative;
  overflow: hidden;
  color: transparent;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.08),
    rgba(255, 255, 255, 0.2),
    rgba(255, 255, 255, 0.08)
  );
  background-size: 220% 100%;
  border-radius: 6px;
  animation: tunly-shimmer 1.1s var(--ease-in-out) infinite;
}

:root[data-theme="light"] .dashboard.is-loading .summary-item strong,
:root[data-theme="light"] .dashboard.is-loading .billing-detail strong {
  background: linear-gradient(90deg, #eef1f5, #f8fafc, #eef1f5);
  background-size: 220% 100%;
}

@keyframes tunly-shimmer {
  0% {
    background-position: 120% 0;
  }

  100% {
    background-position: -120% 0;
  }
}

.modal:not(.hidden) .modal-backdrop {
  animation: fade-surface var(--motion) var(--ease-out);
}

.modal:not(.hidden) .modal-dialog {
  animation: modal-rise var(--motion-slow) var(--ease-spring);
}

.toast:not(.hidden) {
  animation: toast-in var(--motion-slow) var(--ease-spring);
}

@keyframes fade-surface {
  from {
    opacity: 0;
  }
}

@keyframes modal-rise {
  from {
    opacity: 0;
    transform: translate3d(0, 14px, 0) scale(0.97);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate3d(0, 12px, 0) scale(0.98);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
