:root {
  color-scheme: dark;
  --bg: #050505;
  --bg-alt: #0a0a0a;
  --accent: #ffffff;
  --accent-soft: rgba(255, 255, 255, 0.12);
  --text: #f4f4f4;
  --text-muted: #9b9b9b;
  --card: rgba(12, 12, 12, 0.92);
  --stroke: rgba(255, 255, 255, 0.08);
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
  --topbar-height: 104px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Manrope", system-ui, sans-serif;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.02), transparent 40%),
    radial-gradient(circle at 15% 20%, rgba(255, 255, 255, 0.04), transparent 55%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: 5rem;
}

.ambient {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.05), transparent 40%),
    radial-gradient(circle at 12% 78%, rgba(255, 255, 255, 0.03), transparent 45%),
    radial-gradient(circle at 70% 65%, rgba(255, 255, 255, 0.04), transparent 52%),
    conic-gradient(from 180deg at 70% 65%, rgba(255, 255, 255, 0.03), transparent 45%);
  pointer-events: none;
  z-index: -1;
}

.ambient::before,
.ambient::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.ambient::before {
  background: repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.02) 0 1px,
      transparent 1px 140px
    ),
    repeating-linear-gradient(
      0deg,
      rgba(255, 255, 255, 0.018) 0 1px,
      transparent 1px 140px
    ),
    linear-gradient(
      to right,
      transparent 49.6%,
      rgba(255, 255, 255, 0.035) 49.6% 50.4%,
      transparent 50.4%
    ),
    linear-gradient(
      to bottom,
      transparent 49.6%,
      rgba(255, 255, 255, 0.035) 49.6% 50.4%,
      transparent 50.4%
    );
  opacity: 0.32;
}

.ambient::after {
  background: radial-gradient(
      circle at 70% 65%,
      transparent 0 54%,
      rgba(255, 255, 255, 0.06) 54% 54.6%,
      transparent 54.6% 100%
    ),
    radial-gradient(
      circle at 70% 65%,
      transparent 0 35%,
      rgba(255, 255, 255, 0.03) 35% 35.4%,
      transparent 35.4% 100%
    );
  opacity: 0.45;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.2rem 6vw;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  min-height: var(--topbar-height);
  background: rgba(5, 5, 5, 0.8);
  backdrop-filter: blur(12px);
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.topbar__actions .logout {
  margin: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-transform: uppercase;
}

.brand__logo {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  padding: 0.3rem;
  background: rgba(255, 255, 255, 0.04);
  object-fit: contain;
  display: block;
  flex-shrink: 0;
}

.brand__badge {
  font-family: "Russo One", sans-serif;
  letter-spacing: 0.18em;
  font-size: 0.85rem;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.02);
  border-radius: 999px;
}

.brand__title {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 2rem;
  padding: 2rem 6vw 4rem;
}

.layout--single {
  grid-template-columns: 1fr;
}

.container {
  padding: 0;
}

.sidebar {
  position: sticky;
  top: calc(var(--topbar-height) + 1rem);
  align-self: start;
  padding: 1.5rem;
  border: 1px solid var(--stroke);
  border-radius: 18px;
  background: rgba(10, 10, 10, 0.75);
  box-shadow: var(--shadow);
}

.nav {
  display: grid;
  gap: 0.7rem;
}

.nav__item {
  text-decoration: none;
  color: var(--text);
  padding: 0.65rem 0.8rem;
  border-radius: 12px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.02);
  font-size: 0.95rem;
  transition: border 0.2s ease, background 0.2s ease;
  position: relative;
}

.nav__item:hover {
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.04);
}

.sidebar__note {
  margin-top: 1.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.hero {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 3rem;
  align-items: center;
}

.hero__text h1 {
  font-family: "Russo One", sans-serif;
  font-size: clamp(2.2rem, 4.5vw, 4rem);
  margin-bottom: 1rem;
}

.hero__text p {
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1.6;
  max-width: 30rem;
}

.hero__actions {
  margin-top: 1.8rem;
}

.panel {
  padding: 2rem;
  background: var(--card);
  border-radius: 22px;
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

section[id] {
  scroll-margin-top: calc(var(--topbar-height) + 1.5rem);
}

.panel::after {
  content: "";
  position: absolute;
  inset: 1.2rem;
  border: 1px dashed rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  pointer-events: none;
}

.panel h3 {
  font-size: 1.2rem;
  margin-bottom: 1rem;
}

.panel ul {
  list-style: none;
  display: grid;
  gap: 0.6rem;
  color: var(--text-muted);
}

.panel li::before {
  content: "◼";
  color: var(--accent);
  margin-right: 0.5rem;
}

.card {
  background: var(--card);
  border-radius: 20px;
  border: 1px solid var(--stroke);
  padding: 2rem;
  box-shadow: var(--shadow);
  position: relative;
}

.card__toggle {
  position: absolute;
  top: 1.4rem;
  right: 1.4rem;
  background: transparent;
  border: 1px solid var(--stroke);
  color: var(--text-muted);
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  font-size: 0.8rem;
  cursor: pointer;
}

.card__body.is-hidden {
  display: none;
}

.card--narrow {
  max-width: 420px;
  margin: 0 auto;
}

.card__header h2 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.card__header--inline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.card__header p {
  color: var(--text-muted);
  line-height: 1.5;
}

.form {
  display: grid;
  gap: 1rem;
  margin-top: 1.5rem;
}

.form__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 0.5rem;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text-muted);
}

.checkbox input {
  width: 18px;
  height: 18px;
}

label {
  display: grid;
  gap: 0.5rem;
  font-size: 0.95rem;
  color: var(--text-muted);
}

input {
  background: var(--bg-alt);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  color: var(--text);
}

select {
  background: var(--bg-alt);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 0.72rem 1rem;
  color: var(--text);
}

select option {
  background: var(--bg);
  color: var(--text);
}

input::placeholder {
  color: rgba(255, 255, 255, 0.35);
}

.form__error {
  color: #ff8b8b;
  background: rgba(255, 80, 80, 0.12);
  padding: 0.6rem 0.9rem;
  border-radius: 10px;
  font-size: 0.9rem;
}

.form__success {
  color: #7dffb3;
  background: rgba(125, 255, 179, 0.12);
  padding: 0.6rem 0.9rem;
  border-radius: 10px;
  font-size: 0.9rem;
}

.primary-button,
.ghost-button {
  border: none;
  cursor: pointer;
  font-weight: 600;
  border-radius: 999px;
  padding: 0.75rem 1.6rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  position: relative;
  z-index: 0;
}

.primary-button {
  background: var(--accent);
  color: #050505;
  box-shadow: 0 12px 30px rgba(255, 255, 255, 0.2);
}

.primary-button:hover {
  transform: translateY(-1px);
}

.primary-button.full {
  width: 100%;
}

.ghost-button {
  background: transparent;
  border: 1px solid var(--stroke);
  color: var(--text);
  padding: 0.55rem 1.2rem;
  text-decoration: none;
  font-size: 0.9rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.primary-button::before,
.ghost-button::before,
.nav__item::before {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: inherit;
  padding: 2px;
  background: conic-gradient(
    from 0deg,
    rgba(125, 255, 179, 0.7),
    rgba(107, 213, 255, 0.7),
    rgba(255, 171, 255, 0.7),
    rgba(255, 215, 125, 0.7),
    rgba(125, 255, 179, 0.7)
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  filter: blur(0.5px);
  animation: qr-glow-shift 10s linear infinite;
  transition: opacity 0.25s ease;
  pointer-events: none;
  z-index: -1;
}

.primary-button:hover::before,
.primary-button:focus-visible::before,
.ghost-button:hover::before,
.ghost-button:focus-visible::before,
.nav__item:hover::before,
.nav__item:focus-visible::before {
  opacity: 0.8;
}

.table {
  margin-top: 1.5rem;
  display: grid;
  gap: 0.6rem;
}

.table__row {
  display: grid;
  grid-template-columns: 1.4fr 1fr 0.7fr 1fr minmax(120px, 140px);
  gap: 1rem;
  align-items: center;
  padding: 0.8rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: rgba(10, 10, 10, 0.7);
}

.table__row--head {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.service-list {
  display: grid;
  gap: 0.9rem;
  margin-top: 1rem;
}

.service-row {
  display: grid;
  gap: 0.8rem;
  align-items: center;
}

.service-row--inputs {
  grid-template-columns: 1fr 1.2fr 0.9fr;
}

.service-row--actions {
  grid-template-columns: 1fr 1.2fr 0.9fr auto;
}

.service-row__actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.service-row__button {
  min-width: 128px;
  height: 40px;
  padding: 0 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.service-row--add {
  margin-top: 1rem;
}

.ghost-button:hover {
  transform: translateY(-1px);
}

.ghost-button--placeholder {
  visibility: hidden;
  pointer-events: none;
}

.dashboard__header {
  margin-bottom: 2rem;
}

.dashboard__header h1 {
  font-size: 2.2rem;
  margin-bottom: 0.4rem;
}

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

.grid {
  display: grid;
  gap: 1.8rem;
}

.subscriptions {
  display: grid;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.subscription {
  display: grid;
  gap: 1.2rem;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  padding: 1rem;
  border-radius: 16px;
  border: 1px solid var(--stroke);
  background: rgba(10, 10, 10, 0.65);
}

.subscription__info h3 {
  font-size: 1.2rem;
  margin-bottom: 0.4rem;
}

.subscription__info a {
  color: var(--accent);
  text-decoration: none;
  word-break: break-all;
  display: inline-block;
  margin-bottom: 0.6rem;
  font-size: 0.95rem;
}

.subscription__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: baseline;
  margin-bottom: 0.6rem;
}

.subscription__label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.subscription__value {
  font-size: 0.95rem;
  color: var(--text);
  word-break: break-all;
}

.subscription__link {
  display: grid;
  gap: 0.4rem;
  margin-top: 0.4rem;
  margin-bottom: 0.4rem;
}

.subscription__link a {
  color: var(--accent);
  text-decoration: none;
  word-break: break-all;
  font-size: 0.92rem;
}

.subscription__status {
  margin-top: 0.6rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.subscription__details {
  display: grid;
  gap: 0.9rem;
}

.subscription__stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.7rem 1rem;
  padding: 0.8rem 0.9rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
}

.subscription__stat {
  display: grid;
  gap: 0.25rem;
}

.subscription__value--active {
  color: #7dffb3;
}

.subscription__value--inactive {
  color: #ff8b8b;
}

.subscription__links {
  display: grid;
  gap: 0.6rem;
}

.subscription__links--with-qr {
  grid-template-columns: auto minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.subscription__links-qr {
  display: flex;
  align-items: flex-start;
}

.subscription__links-list {
  display: grid;
  gap: 0.6rem;
}

.subscription__link-box {
  cursor: pointer;
  border-radius: 12px;
  padding: 0.8rem 0.9rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 0.85rem;
  line-height: 1.5;
  text-align: left;
  word-break: break-all;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.subscription__link-box:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
}


.subscription__qr canvas {
  border-radius: 12px;
  background: #fff;
  padding: 0.4rem;
}

.subscription__qr--copy {
  cursor: pointer;
  border-radius: 14px;
  padding: 0.2rem;
  display: inline-flex;
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.3s ease;
}

.subscription__qr--copy::before {
  content: "";
  position: absolute;
  inset: -7px;
  border-radius: 20px;
  padding: 2px;
  background: conic-gradient(
    from 0deg,
    rgba(125, 255, 179, 0.7),
    rgba(107, 213, 255, 0.7),
    rgba(255, 171, 255, 0.7),
    rgba(255, 215, 125, 0.7),
    rgba(125, 255, 179, 0.7)
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.35;
  filter: blur(0.5px);
  animation: qr-glow-shift 8s linear infinite;
  transition: opacity 0.3s ease;
  will-change: filter;
  pointer-events: none;
}

.subscription__qr--copy::after {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 24px;
  background: radial-gradient(circle, rgba(125, 255, 179, 0.25), transparent 65%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.subscription__qr--copy:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.25);
}

.subscription__qr--copy:hover::before {
  opacity: 0.8;
}

.subscription__qr--copy:hover::after {
  opacity: 0.7;
}

.subscription__qr--copy.is-copied::before {
  opacity: 1;
}

.subscription__qr--copy.is-copied::after {
  opacity: 0.9;
  background: radial-gradient(circle, rgba(125, 255, 179, 0.45), transparent 65%);
}

@keyframes qr-glow-shift {
  from {
    filter: blur(0.5px) hue-rotate(0deg);
  }
  to {
    filter: blur(0.5px) hue-rotate(360deg);
  }
}

.placeholder {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
}

.instruction {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  align-items: center;
  justify-content: space-between;
  margin-top: 1.2rem;
  padding: 1.2rem;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  background: rgba(10, 10, 10, 0.7);
}

.instruction__intro h3 {
  font-size: 1.25rem;
  margin-bottom: 0.4rem;
}

.instruction__intro p {
  color: var(--text-muted);
  max-width: 30rem;
}

.instruction__intro .instruction__list {
  margin: 0.6rem 0 0;
  padding-left: 1.4rem;
  color: var(--text-muted);
  display: grid;
  gap: 0.45rem;
  line-height: 1.5;
  list-style-position: outside;
}

.instruction__intro .instruction__list li::marker {
  color: rgba(255, 255, 255, 0.35);
  font-weight: 600;
}

.instruction__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.instruction__links a {
  position: relative;
  z-index: 0;
  text-decoration: none;
  color: var(--text);
  border: 1px solid var(--stroke);
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
}

.instruction__links a::before {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: inherit;
  padding: 2px;
  background: conic-gradient(
    from 0deg,
    rgba(125, 255, 179, 0.7),
    rgba(107, 213, 255, 0.7),
    rgba(255, 171, 255, 0.7),
    rgba(255, 215, 125, 0.7),
    rgba(125, 255, 179, 0.7)
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  filter: blur(0.5px);
  animation: qr-glow-shift 10s linear infinite;
  transition: opacity 0.25s ease;
  pointer-events: none;
  z-index: -1;
}

.instruction__links a:hover::before,
.instruction__links a:focus-visible::before {
  opacity: 0.8;
}

.instruction-grid {
  margin-top: 1.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.instruction-card {
  padding: 1.2rem;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  background: rgba(10, 10, 10, 0.75);
}

.instruction-card h4 {
  margin-bottom: 0.6rem;
  font-size: 1.1rem;
}

.instruction-card ol {
  padding-left: 1.2rem;
  color: var(--text-muted);
  display: grid;
  gap: 0.5rem;
  line-height: 1.5;
}

.instruction__note {
  margin-top: 1.2rem;
  padding: 1rem 1.2rem;
  border-radius: 12px;
  border: 1px dashed rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.02);
}

@media (max-width: 960px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    top: 0;
  }
}

@media (max-width: 720px) {
  :root {
    --topbar-height: 132px;
  }

  .topbar {
    flex-direction: column;
    gap: 1rem;
  }

  .table__row {
    grid-template-columns: 1fr;
  }

  .service-row--inputs,
  .service-row--actions {
    grid-template-columns: 1fr;
  }

  .subscription {
    grid-template-columns: 1fr;
  }

  .subscription__qr {
    justify-self: start;
  }
}
