:root {
  color-scheme: dark;
  font-family:
    Inter,
    "Segoe UI",
    system-ui,
    -apple-system,
    sans-serif;

  --bg: #07101d;
  --bg2: #0b1425;
  --panel: rgba(13, 24, 43, 0.92);
  --panel2: rgba(17, 29, 51, 0.96);
  --line: rgba(132, 158, 215, 0.15);
  --text: #f4f7ff;
  --muted: #8692ab;
  --blue: #5572ff;
  --violet: #7659ff;
  --green: #5bdf9b;
  --red: #ff6b74;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 84% 12%, rgba(74, 91, 202, 0.24), transparent 29%),
    radial-gradient(circle at 10% 100%, rgba(74, 86, 166, 0.17), transparent 36%),
    linear-gradient(145deg, #091323 0%, #050b14 60%, #091221 100%);
}

button,
a {
  font: inherit;
}

button {
  color: inherit;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
}

.sidebar {
  min-height: 100vh;
  padding: 34px 24px 28px;
  border-right: 1px solid var(--line);
  background: rgba(4, 12, 23, 0.67);
  backdrop-filter: blur(18px);
  display: flex;
  flex-direction: column;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 19px;
  letter-spacing: 0.02em;
}

.brand-shield {
  width: 30px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: 11px 11px 15px 15px;
  color: white;
  background:
    linear-gradient(145deg, #70b6ff, #4e64ff 56%, #7557ef);
  box-shadow:
    0 0 28px rgba(85, 114, 255, 0.38),
    inset 0 1px 0 rgba(255,255,255,0.35);
}

.side-nav {
  display: grid;
  gap: 10px;
  margin-top: 54px;
}

.side-nav a {
  display: flex;
  align-items: center;
  gap: 15px;
  min-height: 54px;
  padding: 0 17px;
  color: #98a5be;
  text-decoration: none;
  border-radius: 8px;
  border: 1px solid transparent;
}

.side-nav a span {
  width: 24px;
  text-align: center;
  color: #8495ba;
  font-size: 22px;
}

.side-nav a:hover,
.side-nav a.active {
  color: white;
  border-color: rgba(88, 116, 255, 0.08);
  background:
    linear-gradient(
      90deg,
      rgba(76, 102, 238, 0.25),
      rgba(38, 58, 102, 0.14)
    );
  box-shadow: inset 2px 0 0 #5572ff;
}

.side-nav a.active span {
  color: #6682ff;
}

.sidebar-profile {
  margin-top: auto;
  display: flex;
  gap: 12px;
  align-items: center;
  color: #cad2e3;
}

.sidebar-profile div:last-child {
  min-width: 0;
}

.sidebar-profile strong,
.sidebar-profile span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-profile strong {
  font-size: 13px;
}

.sidebar-profile span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.profile-avatar {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #18243a;
  color: #93a1bf;
}

.dashboard {
  position: relative;
  width: min(1120px, calc(100vw - 300px));
  margin: 0 auto;
  padding: 50px 44px 56px;
}

.mobile-header {
  display: none;
}

.welcome {
  min-height: 92px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.welcome h1 {
  margin: 0;
  font-size: clamp(25px, 2.2vw, 34px);
  font-weight: 650;
}

.welcome p {
  color: #9aa6bc;
  margin: 10px 0 0;
  font-size: 14px;
}

.secure-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin: 0 6px 1px 4px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 13px rgba(91, 223, 155, 0.65);
}

.welcome-shield {
  width: 65px;
  height: 74px;
  display: grid;
  place-items: center;
  color: #aab9ff;
  font-size: 28px;
  border: 1px solid rgba(111, 130, 255, 0.7);
  border-radius: 22px 22px 30px 30px;
  background:
    linear-gradient(
      145deg,
      rgba(84, 107, 255, 0.2),
      rgba(75, 55, 176, 0.19)
    );
  box-shadow: 0 0 36px rgba(69, 83, 212, 0.12);
}

.subscription-layout {
  margin-top: 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 20px;
}

.subscription-card,
.subscription-actions,
.device-card,
.security-strip {
  border: 1px solid var(--line);
  background:
    linear-gradient(
      145deg,
      rgba(20, 33, 58, 0.96),
      rgba(8, 17, 31, 0.96)
    );
  box-shadow:
    0 18px 50px rgba(0, 0, 0, 0.18),
    inset 0 1px 0 rgba(255,255,255,0.02);
}

.subscription-card {
  min-height: 185px;
  position: relative;
  padding: 38px 210px 36px 34px;
  border-radius: 12px;
  overflow: hidden;
  border-color: rgba(96, 108, 255, 0.5);
}

.subscription-card::after {
  content: "";
  position: absolute;
  right: -50px;
  bottom: -100px;
  width: 310px;
  height: 230px;
  background:
    radial-gradient(
      circle,
      rgba(105, 74, 255, 0.24),
      transparent 68%
    );
  pointer-events: none;
}

.subscription-card h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 620;
}

.subscription-card p {
  color: #a5aec0;
  margin: 11px 0 0;
}

.subscription-expiry {
  position: absolute;
  right: 112px;
  top: 47px;
  display: grid;
  gap: 7px;
}

.subscription-expiry span,
.subscription-expiry small {
  color: #8994aa;
  font-size: 12px;
}

.subscription-expiry strong {
  font-size: 22px;
  font-weight: 600;
}

.subscription-crown {
  position: absolute;
  right: 30px;
  bottom: 31px;
  z-index: 1;
  color: #f2ca86;
  font-size: 45px;
  text-shadow: 0 0 24px rgba(239, 192, 121, 0.32);
}

.subscription-actions {
  border-radius: 10px;
  padding: 18px;
  display: grid;
  gap: 10px;
}

.actions-title {
  color: #9aa6bc;
  font-size: 12px;
  margin-bottom: 2px;
}

.action-button {
  min-height: 47px;
  padding: 0 16px;
  border-radius: 7px;
  border: 1px solid rgba(104, 126, 190, 0.19);
  background:
    linear-gradient(
      180deg,
      rgba(28, 43, 73, 0.95),
      rgba(15, 26, 45, 0.95)
    );
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
}

.action-button:first-of-type {
  background:
    linear-gradient(135deg, #596cff, #5847e7);
  border-color: #6d7dff;
  box-shadow: 0 8px 26px rgba(76, 88, 255, 0.24);
}

.action-button.is-disabled {
  opacity: 0.82;
}

.action-icon {
  font-size: 19px;
}

.mobile-actions {
  display: none;
}

.devices-section {
  margin-top: 31px;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.section-title > div {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.section-title h2 {
  margin: 0;
  font-size: 21px;
  font-weight: 610;
}

.section-title span {
  color: var(--muted);
  font-size: 12px;
}

.device-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.device-card,
.add-device-card {
  min-height: 190px;
  border-radius: 10px;
}

.device-card {
  position: relative;
  padding: 27px 25px 24px;
}

.device-card.is-revoked {
  opacity: 0.58;
}

.device-status-dot {
  position: absolute;
  top: 17px;
  right: 17px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #66e780;
  box-shadow: 0 0 12px rgba(87, 231, 128, 0.55);
}

.device-status-dot.off {
  background: #697286;
  box-shadow: none;
}

.device-icon,
.mobile-device-icon {
  color: #6382ff;
  text-shadow: 0 0 18px rgba(77, 105, 255, 0.35);
}

.device-icon {
  height: 55px;
  font-size: 43px;
}

.device-icon.tv {
  color: #985cff;
}

.device-icon.android,
.mobile-device-icon.android {
  color: #58d68a;
}

.device-name {
  font-size: 16px;
  font-weight: 600;
  margin-top: 10px;
}

.device-state {
  color: var(--green);
  font-size: 12px;
  margin-top: 7px;
}

.device-state.revoked,
.mobile-device-copy span.revoked {
  color: var(--muted);
}

.device-seen {
  color: #8d98ad;
  font-size: 12px;
  margin-top: 6px;
}

.add-device-card {
  border: 1px dashed rgba(122, 145, 198, 0.25);
  color: #9ca8be;
  background: rgba(14, 24, 42, 0.45);
  cursor: pointer;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 13px;
}

.add-device-card > span {
  width: 51px;
  height: 51px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 31px;
  color: #e6ecfa;
  border: 1px solid rgba(125, 145, 195, 0.26);
  background: rgba(5, 13, 25, 0.64);
}

.mobile-device-list {
  display: none;
}

.security-strip {
  min-height: 82px;
  margin-top: 32px;
  padding: 17px 22px;
  border-radius: 9px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 17px;
}

.security-icon {
  width: 38px;
  height: 44px;
  border: 1px solid #4f6dff;
  border-radius: 12px 12px 16px 16px;
  display: grid;
  place-items: center;
  color: #7b93ff;
  background: rgba(67, 91, 224, 0.14);
}

.security-strip strong,
.security-strip span {
  display: block;
}

.security-strip strong {
  font-size: 13px;
}

.security-strip span {
  margin-top: 5px;
  color: #838fa7;
  font-size: 11px;
}

.security-strip button {
  min-width: 130px;
  min-height: 39px;
  border-radius: 6px;
  border: 1px solid rgba(116, 136, 184, 0.2);
  background: #172338;
  cursor: pointer;
}

.logout-button {
  margin-top: 24px;
  border: 0;
  background: transparent;
  color: #76839c;
  cursor: pointer;
}

.mobile-bottom-nav {
  display: none;
}

.gate {
  min-height: 100vh;
  padding: 48px 24px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 40px;
}

.gate-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 750;
  font-size: 21px;
}

.gate-card {
  width: min(460px, 100%);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 43px 36px;
  text-align: center;
  background: rgba(11, 22, 39, 0.9);
  box-shadow: 0 30px 90px rgba(0,0,0,0.3);
}

.gate-card h1 {
  margin: 20px 0 8px;
}

.gate-card p,
.gate-hint {
  color: var(--muted);
  line-height: 1.6;
}

.gate-hint {
  margin-top: 27px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.gate-shield,
.gate-error {
  margin: auto;
  width: 62px;
  height: 70px;
  display: grid;
  place-items: center;
  border-radius: 20px 20px 28px 28px;
  border: 1px solid #5c73ff;
  color: #8fa2ff;
  font-size: 28px;
  background: rgba(67, 83, 201, 0.13);
}

.gate-error {
  border-radius: 50%;
  color: var(--red);
  border-color: rgba(255, 107, 116, 0.46);
}

.spinner {
  width: 44px;
  height: 44px;
  margin: 0 auto;
  border-radius: 50%;
  border: 3px solid rgba(108, 128, 189, 0.18);
  border-top-color: #667cff;
  animation: spin 0.8s linear infinite;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  padding: 12px 18px;
  border-radius: 8px;
  color: #dfe6f7;
  background: rgba(12, 23, 41, 0.97);
  border: 1px solid var(--line);
  transition: 0.2s ease;
  z-index: 100;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

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

@media (max-width: 980px) {
  body {
    background:
      radial-gradient(circle at 80% 4%, rgba(79, 93, 207, 0.24), transparent 28%),
      #07101c;
  }

  .shell {
    display: block;
  }

  .sidebar {
    display: none;
  }

  .dashboard {
    width: 100%;
    max-width: 620px;
    padding:
      max(18px, env(safe-area-inset-top))
      17px
      calc(94px + env(safe-area-inset-bottom));
  }

  .mobile-header {
    min-height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .mobile-header .brand {
    font-size: 16px;
  }

  .mobile-header .brand-shield {
    width: 25px;
    height: 29px;
    border-radius: 9px 9px 12px 12px;
  }

  .mobile-menu {
    border: 0;
    background: transparent;
    color: white;
    font-size: 22px;
  }

  .welcome {
    min-height: 120px;
  }

  .welcome h1 {
    font-size: 23px;
  }

  .welcome-shield {
    width: 47px;
    height: 54px;
    font-size: 20px;
    border-radius: 15px 15px 20px 20px;
  }

  .subscription-layout {
    display: block;
    margin-top: 5px;
  }

  .subscription-card {
    min-height: 155px;
    padding: 25px 87px 24px 18px;
  }

  .subscription-card h2 {
    font-size: 18px;
  }

  .subscription-card p {
    font-size: 12px;
  }

  .subscription-expiry {
    position: static;
    margin-top: 23px;
  }

  .subscription-expiry strong {
    font-size: 18px;
  }

  .subscription-crown {
    right: 22px;
    top: 27px;
    bottom: auto;
    font-size: 31px;
  }

  .subscription-actions {
    display: none;
  }

  .mobile-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 9px;
    margin-top: 11px;
  }

  .mobile-actions .action-button {
    min-width: 0;
    min-height: 70px;
    padding: 7px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 6px;
    font-size: 11px;
  }

  .mobile-actions .action-button:first-of-type {
    background:
      linear-gradient(
        145deg,
        rgba(41, 59, 112, 0.95),
        rgba(19, 30, 55, 0.95)
      );
  }

  .devices-section {
    margin-top: 25px;
  }

  .section-title h2 {
    font-size: 16px;
  }

  .device-grid {
    display: none;
  }

  .mobile-device-list {
    display: block;
    margin-top: 12px;
    border: 1px solid var(--line);
    border-radius: 9px;
    overflow: hidden;
    background: rgba(12, 22, 39, 0.76);
  }

  .mobile-device-row {
    min-height: 61px;
    padding: 10px 12px;
    display: grid;
    grid-template-columns: 30px 1fr auto;
    align-items: center;
    gap: 9px;
    border-bottom: 1px solid var(--line);
  }

  .mobile-device-icon {
    font-size: 22px;
  }

  .mobile-device-copy strong,
  .mobile-device-copy span {
    display: block;
  }

  .mobile-device-copy strong {
    font-size: 12px;
  }

  .mobile-device-copy span {
    margin-top: 3px;
    color: var(--green);
    font-size: 10px;
  }

  .mobile-device-seen {
    color: #8f9aaf;
    font-size: 10px;
  }

  .mobile-add-device {
    width: 100%;
    min-height: 50px;
    color: #aab4c8;
    border: 0;
    background: rgba(11, 20, 36, 0.7);
  }

  .security-strip {
    display: none;
  }

  .logout-button {
    display: none;
  }

  .mobile-bottom-nav {
    position: fixed;
    z-index: 30;
    left: 0;
    right: 0;
    bottom: 0;
    min-height: calc(68px + env(safe-area-inset-bottom));
    padding:
      8px
      12px
      calc(8px + env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    background: rgba(6, 14, 25, 0.96);
    border-top: 1px solid var(--line);
    backdrop-filter: blur(18px);
  }

  .mobile-bottom-nav a {
    color: #77849d;
    text-decoration: none;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 4px;
    font-size: 9px;
  }

  .mobile-bottom-nav a span {
    font-size: 19px;
  }

  .mobile-bottom-nav a.active {
    color: #607dff;
  }
}