:root {
  --bg: #eef4fb;
  --bg-deep: #dceaf9;
  --ink: #17315f;
  --ink-soft: rgba(23, 49, 95, 0.74);
  --line: rgba(39, 70, 133, 0.12);
  --line-strong: rgba(39, 70, 133, 0.2);
  --surface: rgba(255, 255, 255, 0.74);
  --surface-strong: rgba(255, 255, 255, 0.9);
  --surface-alt: rgba(244, 249, 255, 0.88);
  --primary: #2c6bed;
  --primary-deep: #204fae;
  --success: #167d61;
  --danger: #c65035;
  --shadow: 0 24px 60px rgba(43, 79, 136, 0.15);
  --shadow-soft: 0 12px 30px rgba(43, 79, 136, 0.1);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Inter", "Segoe UI", sans-serif;
  background: radial-gradient(
      circle at 10% 12%,
      rgba(95, 174, 236, 0.22),
      transparent 28rem
    ),
    radial-gradient(
      circle at 86% 10%,
      rgba(122, 212, 168, 0.18),
      transparent 24rem
    ),
    radial-gradient(
      circle at 50% 0%,
      rgba(44, 107, 237, 0.15),
      transparent 30rem
    ),
    linear-gradient(180deg, #f8fbff 0%, var(--bg) 55%, var(--bg-deep) 100%);
  text-rendering: optimizeLegibility;
}

.stage-grid,
.stage-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.stage-grid {
  background-image: linear-gradient(
      rgba(39, 70, 133, 0.06) 1px,
      transparent 1px
    ),
    linear-gradient(90deg, rgba(39, 70, 133, 0.06) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.42), transparent 78%);
}

.stage-glow {
  inset: -12vh -12vw auto;
  height: 40vh;
  background: radial-gradient(
    circle at 50% 0%,
    rgba(44, 107, 237, 0.18),
    transparent 68%
  );
  filter: blur(24px);
}

.shell {
  position: relative;
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 36px 0 64px;
}

.landing-shell {
  position: relative;
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 64px;
}

.landing-topbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
}

.landing-login-link {
  min-height: 54px;
  margin-top: 28px;
  padding: 0 28px;
  font-size: 1.05rem;
}

.brand-mark {
  color: var(--ink);
  font-family: "Outfit", "Inter", sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.landing-hero {
  position: relative;
  display: flex;
  align-items: center;
  min-height: calc(100vh - 140px);
  overflow: visible;
}

.landing-copy {
  position: relative;
  z-index: 2;
}

.landing-kicker {
  margin: 0 0 12px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--primary);
}

.landing-copy h1 {
  margin: 0;
  max-width: 16ch;
  color: var(--ink);
  font-family: "Outfit", "Inter", sans-serif;
  font-size: 4rem;
  line-height: 0.96;
  letter-spacing: 0;
}

.landing-text {
  max-width: 58ch;
  margin: 18px 0 0;
  color: var(--ink-soft);
  font-size: 1rem;
  line-height: 1.75;
}

.landing-background {
  position: fixed;
  top: 50%;
  right: 2vw;
  width: min(1120px, 78vw);
  height: min(1040px, 110vh);
  border-radius: 8px;
  background: url("./assets/vpn-hero.png") right center / contain no-repeat;
  box-shadow: none;
  opacity: 0.6;
  transform: translateY(-50%);
  z-index: 0;
}

.panel,
.metric-card {
  border: 1px solid var(--line);
  background: var(--surface);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.section-kicker,
.metric-label {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--primary);
}

h2 {
  margin: 0;
  color: var(--ink);
  font-family: "Outfit", "Inter", sans-serif;
  letter-spacing: 0;
}

h2 {
  font-size: 1.6rem;
}

.hero-text,
.message,
label span,
.status-pill,
td,
th {
  color: var(--ink-soft);
}

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

.metric-card {
  box-shadow: var(--shadow-soft);
}

.metric-value {
  display: block;
  color: var(--ink);
  font-family: "Outfit", "Inter", sans-serif;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 0;
}

.metric-value-small {
  font-size: 1.1rem;
  letter-spacing: 0;
}

.auth-shell {
  display: grid;
  justify-content: center;
  margin-top: 84px;
}

.auth-layout {
  grid-template-columns: minmax(280px, 0.95fr) minmax(320px, 0.9fr);
  align-items: center;
  gap: 28px;
  justify-content: stretch;
}

.auth-intro {
  max-width: 34rem;
}

.auth-heading {
  margin: 0;
  color: var(--ink);
  font-family: "Outfit", "Inter", sans-serif;
  font-size: 3.2rem;
  line-height: 0.98;
  letter-spacing: 0;
}

.admin-shell {
  margin-top: 18px;
}

.admin-shell-static {
  margin-top: 18px;
}

.panel {
  margin-top: 18px;
  padding: 24px;
  border-radius: var(--radius-xl);
}

.auth-panel {
  width: min(520px, 100%);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 18px;
  padding: 6px;
  border: 1px solid rgba(39, 70, 133, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
}

.auth-tab {
  min-height: 40px;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  border-color: transparent;
  box-shadow: none;
}

.auth-tab:hover {
  transform: none;
  box-shadow: none;
  background: rgba(44, 107, 237, 0.08);
}

.is-active-tab {
  background: #17315f;
  color: #ffffff;
}

.is-active-tab:hover {
  background: #17315f;
  color: #ffffff;
}

.back-link {
  display: inline-block;
  margin-bottom: 18px;
  color: var(--primary-deep);
  text-decoration: none;
  font-weight: 600;
}

.back-link:hover {
  text-decoration: underline;
}

.admin-bar {
  margin-top: 0;
  padding: 14px 18px;
}

.panel-form {
  background: linear-gradient(
    180deg,
    var(--surface-strong),
    var(--surface-alt)
  );
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.stack {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 8px;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  font: inherit;
  transition: border-color 160ms ease, box-shadow 180ms ease,
    transform 160ms ease, background-color 160ms ease;
}

input:focus {
  outline: none;
  border-color: rgba(44, 107, 237, 0.34);
  box-shadow: 0 0 0 4px rgba(44, 107, 237, 0.14);
  background: rgba(255, 255, 255, 0.94);
}

button,
.action-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: linear-gradient(180deg, #3d7bff 0%, var(--primary) 100%);
  color: #f8fbff;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 10px 20px rgba(44, 107, 237, 0.2);
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 180ms ease,
    border-color 160ms ease, background-color 160ms ease;
}

button:hover,
.action-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 28px rgba(44, 107, 237, 0.24);
}

button.secondary {
  background: rgba(255, 255, 255, 0.56);
  color: var(--ink);
  border-color: rgba(39, 70, 133, 0.14);
  box-shadow: none;
}

button.secondary:hover {
  box-shadow: var(--shadow-soft);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.54;
  transform: none;
  box-shadow: none;
}

button.danger {
  background: linear-gradient(180deg, #d8664a 0%, var(--danger) 100%);
  box-shadow: 0 10px 20px rgba(198, 80, 53, 0.2);
}

.message {
  min-height: 1.4em;
  margin: 8px 0 0;
  font-size: 0.95rem;
}

.message:empty {
  display: none;
}

.admin-bar .section-head {
  margin-bottom: 0;
}

.account-panel {
  padding: 18px;
}

.password-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
  align-items: end;
}

.password-form input {
  padding: 10px 12px;
}

.password-form button {
  min-height: 40px;
}

.server-form {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
}

.server-form-section {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(39, 70, 133, 0.1);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.36);
}

.server-form-section h3 {
  margin: 0;
  color: var(--ink);
  font-family: "Outfit", "Inter", sans-serif;
  font-size: 1rem;
}

.server-form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 12px;
  align-items: end;
}

.server-helper {
  margin: -2px 0 2px;
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.45;
}

.server-form input,
.server-form select {
  width: 100%;
  height: 46px;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
  line-height: 1.2;
  letter-spacing: 0;
  text-transform: none;
  vertical-align: middle;
}

.server-form select {
  appearance: auto;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
}

.checkbox-label input {
  width: auto;
}

.server-form-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.server-form-actions button {
  width: 150px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 14px;
  line-height: 1;
}

.forgot-link {
  display: inline-block;
  margin-top: 12px;
  color: var(--primary-deep);
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
}

.forgot-link:hover {
  text-decoration: underline;
}

.forgot-link[hidden] {
  display: none;
}

.auth-footer {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(39, 70, 133, 0.08);
}

.text-button {
  min-height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink-soft);
  box-shadow: none;
  font-weight: 600;
}

.text-button:hover {
  transform: none;
  box-shadow: none;
  color: var(--primary-deep);
}

.is-active-link {
  color: var(--primary-deep);
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 700;
}

.primary-link {
  background: linear-gradient(180deg, #3d7bff 0%, var(--primary) 100%);
  color: #f8fbff;
  box-shadow: 0 10px 20px rgba(44, 107, 237, 0.2);
}

.secondary-link {
  border: 1px solid rgba(39, 70, 133, 0.14);
  background: rgba(255, 255, 255, 0.56);
  color: var(--ink);
}

.table-wrap {
  overflow: auto;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.54);
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  position: sticky;
  top: 0;
  background: rgba(247, 251, 255, 0.92);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sort-button {
  min-height: auto;
  justify-content: flex-start;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  box-shadow: none;
  font-size: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
}

.sort-button:hover {
  transform: none;
  box-shadow: none;
  color: var(--primary-deep);
}

.filter-row th {
  top: 45px;
  background: rgba(247, 251, 255, 0.96);
  padding-top: 8px;
  padding-bottom: 10px;
}

.table-filter {
  width: 100%;
  min-width: 82px;
  border: 1px solid rgba(39, 70, 133, 0.14);
  border-radius: 6px;
  padding: 8px 9px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  font: inherit;
  font-size: 0.84rem;
  text-transform: none;
  letter-spacing: 0;
}

select.table-filter {
  appearance: auto;
}

th,
td {
  text-align: left;
  padding: 11px 14px;
  border-top: 1px solid rgba(39, 70, 133, 0.08);
  vertical-align: middle;
}

tbody tr {
  transition: background-color 160ms ease;
}

tbody tr:hover {
  background: rgba(44, 107, 237, 0.05);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(44, 107, 237, 0.08);
  font-size: 0.84rem;
  font-weight: 700;
  text-transform: capitalize;
}

.status-pill.pending {
  background: rgba(44, 107, 237, 0.08);
  color: var(--primary-deep);
}

.status-pill.approved,
.status-pill.active {
  background: rgba(22, 125, 97, 0.12);
  color: var(--success);
}

.status-pill.revoked,
.status-pill.suspended {
  background: rgba(198, 80, 53, 0.12);
  color: var(--danger);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.empty-state {
  padding: 28px 16px;
  text-align: center;
  color: var(--ink-soft);
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.admin-actions .action-button,
.admin-actions .action-state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 11px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: none;
}

.admin-actions .action-button:hover {
  transform: none;
  box-shadow: none;
}

.admin-actions .action-button.approve {
  border-color: rgba(44, 107, 237, 0.18);
  background: rgba(44, 107, 237, 0.1);
  color: var(--primary-deep);
}

.admin-actions .action-button.revoke,
.admin-actions .action-button.delete {
  border-color: rgba(198, 80, 53, 0.2);
  background: rgba(198, 80, 53, 0.12);
  color: var(--danger);
}

.admin-actions .action-button.delete:hover,
.admin-actions .action-button.revoke:hover {
  background: rgba(198, 80, 53, 0.18);
}

.admin-actions .action-state {
  background: rgba(22, 125, 97, 0.12);
  color: var(--success);
}

.action-menu {
  min-height: 30px;
  min-width: 112px;
  border: 1px solid rgba(39, 70, 133, 0.14);
  border-radius: 999px;
  padding: 0 10px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 700;
}

.profile-shell {
  width: min(860px, 100%);
  margin: 18px auto 0;
}

.profile-hero {
  position: relative;
  overflow: hidden;
  padding: 22px;
  background: radial-gradient(
      circle at 86% 18%,
      rgba(44, 107, 237, 0.16),
      transparent 18rem
    ),
    linear-gradient(180deg, var(--surface-strong), var(--surface-alt));
}

.profile-logout-button {
  position: absolute;
  top: 14px;
  right: 14px;
  min-height: 34px;
  padding: 0 14px;
}

.profile-hero .profile-form {
  margin-top: 16px;
}

.profile-hero .profile-form[hidden] {
  display: none;
}

.profile-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-right: 92px;
}

.profile-avatar {
  display: inline-flex;
  width: 62px;
  height: 62px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(39, 70, 133, 0.12);
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 26%, rgba(255, 255, 255, 0.92), transparent 34%),
    linear-gradient(135deg, rgba(44, 107, 237, 0.18), rgba(22, 125, 97, 0.16));
  color: var(--ink);
  font-family: "Outfit", "Inter", sans-serif;
  font-size: 1.7rem;
  font-weight: 800;
}

.profile-hero h2 {
  font-size: 1.35rem;
}

.profile-note {
  margin: 6px 0 0;
  color: var(--ink-soft);
  line-height: 1.45;
}

.profile-card {
  padding: 28px;
}

.profile-section-head {
  align-items: flex-start;
}

.profile-form {
  display: grid;
  gap: 12px;
}

.profile-form input[readonly] {
  color: rgba(23, 49, 95, 0.62);
  background: rgba(244, 249, 255, 0.86);
}

.profile-details {
  display: grid;
  gap: 6px;
  margin: 0;
}

.profile-details div {
  display: flex;
  gap: 8px;
  align-items: baseline;
}

.profile-details dt {
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

.profile-details dd {
  margin: 0;
  color: var(--ink-soft);
  font-weight: 600;
  text-transform: capitalize;
}

.profile-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 2px;
}

.device-panel {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(39, 70, 133, 0.1);
}

.device-head {
  align-items: flex-start;
}

.device-usage {
  margin: 0;
  color: var(--ink);
  font-family: "Outfit", "Inter", sans-serif;
  font-weight: 800;
}

.device-create-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(170px, 0.42fr) 168px;
  gap: 10px;
  align-items: end;
  margin-top: 12px;
}

.device-create-form label {
  gap: 7px;
}

.device-create-form input,
.device-create-form select {
  height: 48px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 0 15px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
}

.device-create-form select {
  appearance: auto;
}

#device-create-button {
  width: 100%;
  min-height: 46px;
  border-radius: 16px;
  padding: 0 14px;
  background: linear-gradient(180deg, #6aa2ff 0%, #3d7bff 100%);
  box-shadow: 0 10px 20px rgba(61, 123, 255, 0.18);
  white-space: nowrap;
}

.device-list {
  display: grid;
  gap: 9px;
  margin-top: 12px;
}

.device-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 13px;
  border: 1px solid rgba(39, 70, 133, 0.1);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.52);
}

.device-card > div:first-child {
  min-width: 0;
  flex: 1 1 auto;
}

.device-card h3 {
  margin: 0;
  color: var(--ink);
  font-family: "Outfit", "Inter", sans-serif;
  font-size: 1rem;
}

.device-card p {
  margin: 5px 0 0;
  color: var(--ink-soft);
}

.device-card .device-created,
.device-card .device-protocol {
  font-size: 0.9rem;
}

.device-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  flex: 0 1 auto;
  gap: 8px;
  margin-left: auto;
}

.device-actions button {
  flex: 0 0 auto;
  min-height: 44px;
  border-radius: 14px;
  padding: 0 14px;
  font-size: 0.86rem;
  white-space: nowrap;
}

.qr-preview {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid rgba(39, 70, 133, 0.1);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.6);
}

.qr-preview img {
  display: block;
  width: min(260px, 100%);
  height: auto;
  margin: 12px auto 0;
  border-radius: 14px;
  background: #ffffff;
}

.admin-home-link {
  margin-bottom: 0;
}

@media (max-width: 1100px) {
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .landing-hero {
    min-height: auto;
    padding: 56px 0 340px;
  }

  .landing-background {
    top: auto;
    right: 50%;
    bottom: 28px;
    width: min(620px, 92vw);
    height: 320px;
    transform: translateX(50%);
    opacity: 0.58;
  }

  .landing-copy {
    transform: none;
  }

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

  .landing-copy h1,
  .auth-heading {
    font-size: 2.4rem;
  }
}

@media (max-width: 720px) {
  .shell {
    width: min(100% - 18px, 100%);
    padding-top: 18px;
  }

  .landing-shell {
    width: min(100% - 18px, 100%);
    padding-top: 18px;
  }

  .hero-card,
  .panel {
    padding: 18px;
    border-radius: 22px;
  }

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

  .section-head {
    flex-direction: column;
    align-items: stretch;
  }

  .password-form {
    grid-template-columns: 1fr;
  }

  .server-form-grid {
    grid-template-columns: 1fr;
  }

  .server-form-actions {
    display: grid;
  }

  .device-create-form {
    grid-template-columns: 1fr;
  }

  #device-create-button {
    width: min(100%, 220px);
  }

  .device-card {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .device-actions {
    width: 100%;
    justify-content: flex-start;
    margin-left: 0;
  }

  .profile-details {
    grid-template-columns: 1fr;
  }

  button,
  .action-link,
  .button-link {
    width: 100%;
  }

  .auth-footer {
    flex-direction: column;
  }
}
