:root {
  --bg: #05070f;
  --text: #eef2ff;
  --muted: #94a3b8;
  --subtle: #64748b;
  --border: rgba(148, 163, 184, 0.14);
  --border-strong: rgba(148, 163, 184, 0.28);
  --panel: rgba(8, 12, 24, 0.55);
  --accent: #6366f1;
  --accent-soft: #a5b4fc;
  --cyan: #22d3ee;
  --danger: #f87171;
  --radius-xl: 28px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --ring: 0 0 0 4px rgba(99, 102, 241, 0.18);
  --font-sans: "Inter", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

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

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

body {
  margin: 0;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(1100px 720px at 8% -12%, #1b2452 0%, transparent 55%),
    radial-gradient(900px 640px at 112% 8%, #0c3a49 0%, transparent 52%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection {
  background: rgba(99, 102, 241, 0.35);
  color: #fff;
}

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

svg {
  display: block;
}

/* ---------- Ambient background ---------- */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
  will-change: transform;
}

.orb-a {
  width: 540px;
  height: 540px;
  top: -190px;
  left: -130px;
  background: #4f46e5;
  animation: drift 20s ease-in-out infinite alternate;
}

.orb-b {
  width: 440px;
  height: 440px;
  right: -120px;
  bottom: -170px;
  background: #0891b2;
  opacity: 0.4;
  animation: drift 26s ease-in-out infinite alternate-reverse;
}

.orb-c {
  width: 320px;
  height: 320px;
  top: 38%;
  left: 56%;
  background: #7c3aed;
  opacity: 0.24;
  animation: drift 32s ease-in-out infinite alternate;
}

.grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, #000 30%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, #000 30%, transparent 100%);
}

/* ---------- Shell ---------- */

.shell {
  position: relative;
  z-index: 1;
  width: min(1120px, calc(100% - 40px));
  min-height: min(760px, calc(100dvh - 64px));
  margin: 32px auto;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.015));
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow:
    0 40px 90px -30px rgba(0, 0, 0, 0.85),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(26px);
  -webkit-backdrop-filter: blur(26px);
  animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

/* ---------- Brand panel ---------- */

.brand {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 40px;
  padding: 56px;
  border-right: 1px solid var(--border);
  background:
    radial-gradient(720px 420px at 0% 0%, rgba(99, 102, 241, 0.3), transparent 62%),
    radial-gradient(560px 420px at 100% 100%, rgba(34, 211, 238, 0.14), transparent 60%),
    linear-gradient(160deg, rgba(11, 16, 32, 0.55), rgba(5, 8, 16, 0.2));
  overflow: hidden;
}

.brand::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 90% 70% at 20% 10%, #000 20%, transparent 90%);
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 20% 10%, #000 20%, transparent 90%);
  opacity: 0.7;
  pointer-events: none;
}

.brand > * {
  position: relative;
  z-index: 1;
}

.lockup {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  width: fit-content;
}

.lockup.center {
  margin: 0 auto;
}

.mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(140deg, #6366f1, #4f46e5 55%, #0891b2);
  box-shadow:
    0 10px 24px -8px rgba(79, 70, 229, 0.8),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.mark svg {
  width: 24px;
  height: 24px;
}

.lockup-name {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.brand-copy {
  margin-top: 6px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--muted);
  text-transform: uppercase;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.14);
}

.brand-copy h1 {
  margin: 20px 0 16px;
  font-size: clamp(32px, 3.2vw, 44px);
  font-weight: 600;
  line-height: 1.14;
  letter-spacing: -0.03em;
}

.grad {
  background: linear-gradient(100deg, #c7d2fe, #818cf8 40%, #22d3ee);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand-copy p {
  max-width: 38ch;
  margin: 0;
  font-size: 15px;
  line-height: 1.75;
  color: var(--muted);
}

.features {
  display: grid;
  gap: 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.features li {
  display: flex;
  align-items: center;
  gap: 14px;
}

.feature-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  color: var(--accent-soft);
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.22);
}

.feature-icon svg {
  width: 20px;
  height: 20px;
}

.feature-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.feature-text strong {
  font-size: 14px;
  font-weight: 600;
}

.feature-text small {
  font-size: 12.5px;
  color: var(--subtle);
}

.brand-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: auto;
  font-size: 11.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--subtle);
}

.brand-meta .sep {
  width: 1px;
  height: 12px;
  background: var(--border-strong);
}

/* ---------- Form panel ---------- */

.panel {
  display: grid;
  place-items: center;
  padding: 48px;
  background: rgba(5, 8, 16, 0.32);
}

.card {
  width: 100%;
  max-width: 400px;
  min-width: 0;
  animation: rise 0.7s 0.08s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.card-head .pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: #c7d2fe;
  background: rgba(99, 102, 241, 0.14);
  border: 1px solid rgba(99, 102, 241, 0.24);
}

.card-head h2,
.card-head h1 {
  margin: 18px 0 8px;
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.card-head p {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 22px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(248, 113, 113, 0.32);
  background: rgba(248, 113, 113, 0.1);
  color: #fca5a5;
  font-size: 13.5px;
  line-height: 1.55;
  animation: rise 0.35s ease both;
}

.alert svg {
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 1px;
}

.form {
  display: grid;
  gap: 18px;
  margin-top: 28px;
}

.field label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #cbd5e1;
}

.control {
  position: relative;
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.035);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.control:focus-within {
  border-color: rgba(129, 140, 248, 0.85);
  background: rgba(255, 255, 255, 0.055);
  box-shadow: var(--ring);
}

.control .icon {
  flex: none;
  width: 20px;
  height: 20px;
  margin-left: 16px;
  color: #818cf8;
}

.control input {
  flex: 1;
  min-width: 0;
  height: 54px;
  padding: 0 16px;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
}

.control input::placeholder {
  color: #64748b;
}

.control input:-webkit-autofill,
.control input:-webkit-autofill:hover,
.control input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  transition: background-color 9999s ease-out 0s;
  box-shadow: 0 0 0 1000px #0b1220 inset;
}

.reveal {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  margin-right: 6px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--subtle);
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
}

.reveal:hover {
  color: var(--accent-soft);
  background: rgba(255, 255, 255, 0.05);
}

.reveal svg {
  width: 20px;
  height: 20px;
}

.reveal .eye-closed,
.reveal[aria-pressed="true"] .eye-open {
  display: none;
}

.reveal[aria-pressed="true"] .eye-closed {
  display: block;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 54px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease,
    border-color 0.2s ease;
}

.btn.primary {
  width: 100%;
  margin-top: 8px;
  color: #fff;
  background: linear-gradient(135deg, #6366f1, #4f46e5 48%, #0891b2);
  box-shadow:
    0 14px 32px -12px rgba(79, 70, 229, 0.8),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.btn.primary:hover {
  transform: translateY(-1px);
  box-shadow:
    0 20px 40px -14px rgba(79, 70, 229, 0.9),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.btn.primary:active {
  transform: translateY(0);
}

.btn.ghost {
  width: 100%;
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border);
}

.btn.ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-strong);
}

.btn:disabled {
  opacity: 0.75;
  cursor: progress;
  transform: none;
}

.btn[aria-disabled="true"] {
  opacity: 0.75;
  cursor: progress;
  pointer-events: none;
  transform: none;
}

.spinner {
  display: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}

.btn.is-active .spinner {
  display: inline-block;
}

.btn.is-active .label {
  opacity: 0.85;
}

.fineprint {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 22px 0 0;
  font-size: 12px;
  line-height: 1.65;
  color: var(--subtle);
}

.fineprint svg {
  flex: none;
  width: 15px;
  height: 15px;
  margin-top: 1px;
}

/* ---------- Consent ---------- */

.app-card {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  margin-top: 26px;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.035);
}

.app-avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  color: #e0e7ff;
  background: linear-gradient(140deg, rgba(99, 102, 241, 0.35), rgba(8, 145, 178, 0.28));
  border: 1px solid rgba(129, 140, 248, 0.3);
}

.app-avatar svg {
  width: 24px;
  height: 24px;
}

.app-info {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.app-name {
  overflow: hidden;
  font-size: 15px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-host {
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--subtle);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  flex: none;
  margin-left: auto;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--muted);
  white-space: nowrap;
}

.user-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  padding: 12px 15px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.user-label {
  font-size: 12.5px;
  color: var(--subtle);
}

.user-name {
  overflow: hidden;
  min-width: 0;
  font-size: 13.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.permission {
  margin-top: 22px;
}

.permission-title {
  display: block;
  margin-bottom: 12px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--subtle);
  text-transform: uppercase;
}

.perm-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.perm-list li {
  display: flex;
  align-items: flex-start;
  gap: 11px;
}

.check {
  display: grid;
  place-items: center;
  flex: none;
  width: 22px;
  height: 22px;
  margin-top: 1px;
  border-radius: 50%;
  color: #4ade80;
  background: rgba(74, 222, 128, 0.12);
  border: 1px solid rgba(74, 222, 128, 0.28);
}

.check svg {
  width: 13px;
  height: 13px;
}

.perm-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13.5px;
}

.perm-text small {
  font-size: 12px;
  color: var(--subtle);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.chip {
  max-width: 100%;
  overflow: hidden;
  min-width: 0;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(99, 102, 241, 0.3);
  background: rgba(99, 102, 241, 0.12);
  font-family: var(--font-mono);
  font-size: 11px;
  color: #c7d2fe;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meta {
  display: grid;
  gap: 9px;
  margin: 20px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.meta > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
}

.meta dt {
  flex: none;
  font-size: 11.5px;
  color: var(--subtle);
}

.meta dd {
  flex: 1 1 auto;
  overflow: hidden;
  min-width: 0;
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.45fr);
  gap: 12px;
  margin-top: 24px;
}

.actions .btn {
  min-width: 0;
  margin-top: 0;
}

/* ---------- Error page ---------- */

.error-body {
  padding: 24px 0;
}

.error-shell {
  position: relative;
  z-index: 1;
  width: min(520px, calc(100% - 40px));
  margin: 24px auto;
  animation: rise 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.error-card {
  padding: 48px;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.015));
  box-shadow:
    0 40px 90px -30px rgba(0, 0, 0, 0.85),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(26px);
  -webkit-backdrop-filter: blur(26px);
}

.error-badge {
  display: inline-flex;
  margin-top: 30px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(99, 102, 241, 0.28);
  background: rgba(99, 102, 241, 0.14);
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: #c7d2fe;
}

.error-card h1 {
  margin: 18px 0 10px;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.error-card p {
  margin: 0 auto;
  max-width: 36ch;
  font-size: 14px;
  line-height: 1.75;
  color: var(--muted);
}

.error-card .btn {
  margin-top: 30px;
}

/* ---------- Admin ---------- */

.admin-body {
  display: block;
  padding-bottom: 48px;
}

.admin-auth-shell {
  position: relative;
  z-index: 1;
  width: min(460px, calc(100% - 32px));
  margin: 32px auto;
  animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.admin-auth-card {
  padding: 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.015));
  box-shadow:
    0 40px 90px -30px rgba(0, 0, 0, 0.85),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(26px);
  -webkit-backdrop-filter: blur(26px);
}

.admin-auth-head {
  margin-top: 30px;
}

.admin-back {
  margin: 22px 0 0;
  text-align: center;
  font-size: 12.5px;
}

.admin-back a {
  color: var(--muted);
  transition: color 0.2s ease;
}

.admin-back a:hover {
  color: var(--accent-soft);
}

.callout {
  margin-top: 24px;
  padding: 18px;
  border: 1px solid rgba(250, 204, 21, 0.28);
  border-radius: 14px;
  background: rgba(250, 204, 21, 0.07);
}

.callout strong {
  display: block;
  font-size: 14px;
  color: #fde68a;
}

.callout p {
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.65;
  color: var(--muted);
}

.callout code {
  font-family: var(--font-mono);
  font-size: 12px;
  color: #fde68a;
}

.code-block {
  overflow-x: auto;
  margin: 12px 0 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.35);
  color: #e2e8f0;
  font-family: var(--font-mono);
  font-size: 12px;
}

.callout + .btn {
  margin-top: 20px;
}

.admin-nav {
  position: relative;
  z-index: 2;
  border-bottom: 1px solid var(--border);
  background: rgba(5, 8, 16, 0.55);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.admin-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: min(1160px, calc(100% - 40px));
  min-height: 72px;
  margin: 0 auto;
}

.admin-tag {
  margin-left: 2px;
  padding: 4px 9px;
  border: 1px solid rgba(99, 102, 241, 0.28);
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.12);
  color: #c7d2fe;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.admin-nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-nav-actions form {
  display: flex;
}

.admin-nav-actions .btn {
  width: auto;
}

.admin-main {
  position: relative;
  z-index: 1;
  width: min(1160px, calc(100% - 40px));
  margin: 0 auto;
  padding: 44px 0 0;
}

.admin-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 28px;
}

.admin-hero-copy h1 {
  margin: 14px 0 8px;
  font-size: clamp(28px, 3vw, 38px);
  font-weight: 600;
  letter-spacing: -0.03em;
}

.admin-hero-copy p {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.admin-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.stat {
  min-width: 104px;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.035);
}

.stat span {
  display: block;
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: var(--subtle);
}

.stat strong {
  display: block;
  margin-top: 4px;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13.5px;
  animation: rise 0.35s ease both;
}

.banner svg {
  flex: none;
  width: 17px;
  height: 17px;
}

.banner.ok {
  color: #86efac;
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.28);
}

.banner.error {
  color: #fca5a5;
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.3);
}

.admin-grid {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.admin-card {
  min-width: 0;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.015));
  box-shadow:
    0 24px 60px -30px rgba(0, 0, 0, 0.8),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.admin-card-head h2 {
  margin: 0 0 6px;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.admin-card-head p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--subtle);
}

.add-card .form {
  margin-top: 22px;
}

.list-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.count {
  flex: none;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.client-list {
  display: grid;
  gap: 14px;
}

.client-item {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.025);
  transition: border-color 0.2s ease, background 0.2s ease;
}

.client-item:hover {
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.035);
}

.client-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.client-main {
  display: flex;
  flex: 1 1 240px;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.app-avatar.small {
  width: 40px;
  height: 40px;
  border-radius: 12px;
}

.app-avatar.small svg {
  width: 20px;
  height: 20px;
}

.client-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.client-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.client-title strong {
  overflow: hidden;
  font-size: 14.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.client-host {
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--subtle);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status {
  flex: none;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.status.ok {
  color: #86efac;
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.25);
}

.status.off {
  color: #94a3b8;
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid rgba(148, 163, 184, 0.22);
}

.client-actions {
  display: flex;
  flex: none;
  align-items: center;
  gap: 8px;
}

.client-actions form {
  display: flex;
}

.client-actions .btn {
  width: auto;
}

.btn.small {
  height: 36px;
  padding: 0 13px;
  border-radius: 10px;
  font-size: 12.5px;
}

.btn.danger {
  color: #fca5a5;
  background: rgba(248, 113, 113, 0.09);
  border-color: rgba(248, 113, 113, 0.24);
}

.btn.danger:hover {
  color: #fecaca;
  background: rgba(248, 113, 113, 0.16);
  border-color: rgba(248, 113, 113, 0.4);
}

.client-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  margin: 14px 0 0;
  padding: 12px 0 0;
  border-top: 1px solid var(--border);
}

.client-meta > div {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}

.client-meta dt {
  flex: none;
  font-size: 11px;
  color: var(--subtle);
}

.client-meta dd {
  overflow: hidden;
  max-width: min(100%, 420px);
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.client-details {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.client-details summary {
  display: flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  color: var(--subtle);
  font-size: 12px;
  list-style: none;
  cursor: pointer;
  transition: color 0.2s ease;
}

.client-details summary::-webkit-details-marker {
  display: none;
}

.client-details summary::before {
  content: "▸";
  font-size: 10px;
  transition: transform 0.2s ease;
}

.client-details[open] summary::before {
  transform: rotate(90deg);
}

.client-details summary:hover {
  color: var(--accent-soft);
}

.secret-row {
  margin-top: 10px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.28);
}

.secret-row code {
  display: block;
  overflow-wrap: anywhere;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: #c7d2fe;
}

.inline-form {
  margin-top: 12px;
  gap: 12px;
}

.inline-form .field label {
  font-size: 12px;
}

.inline-form .control input {
  height: 44px;
  font-size: 13.5px;
}

.inline-form .btn.small {
  justify-self: start;
  width: auto;
  padding: 0 16px;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 48px 20px;
  text-align: center;
  color: var(--subtle);
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: 6px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
}

.empty-icon svg {
  width: 26px;
  height: 26px;
}

.empty-state strong {
  color: var(--text);
  font-size: 14px;
}

.empty-state p {
  margin: 0;
  font-size: 12.5px;
}

/* ---------- Animations ---------- */

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.995);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes drift {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }
  to {
    transform: translate3d(40px, -30px, 0) scale(1.08);
  }
}

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

/* ---------- Responsive ---------- */

@media (max-width: 980px) {
  .shell {
    grid-template-columns: 1fr;
    width: min(560px, calc(100% - 32px));
    min-height: auto;
  }

  .brand {
    gap: 26px;
    padding: 36px 32px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .brand-copy h1 {
    margin: 16px 0 12px;
    font-size: 32px;
  }

  .features,
  .brand-meta {
    display: none;
  }

  .panel {
    padding: 34px 32px 40px;
  }

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

  .admin-main {
    padding-top: 32px;
  }

  .admin-hero {
    align-items: flex-start;
  }
}

@media (max-width: 560px) {
  body {
    display: block;
  }

  .shell {
    width: 100%;
    min-height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
  }

  .brand {
    gap: 20px;
    padding: 24px 22px;
  }

  .brand-copy h1 {
    margin: 12px 0 0;
    font-size: 24px;
  }

  .brand-copy p {
    display: none;
  }

  .panel {
    padding: 24px 20px 38px;
  }

  .card-head h2 {
    font-size: 24px;
  }

  .app-card {
    gap: 12px;
    padding: 12px;
  }

  .actions {
    gap: 10px;
  }

  .error-shell {
    width: calc(100% - 32px);
    margin: 16px auto;
  }

  .error-card {
    padding: 34px 24px;
  }

  .admin-auth-shell {
    width: calc(100% - 24px);
    margin: 16px auto;
  }

  .admin-auth-card {
    padding: 30px 22px;
  }

  .admin-nav-inner {
    flex-wrap: wrap;
    width: calc(100% - 24px);
    min-height: 64px;
    padding: 10px 0;
  }

  .admin-tag {
    display: none;
  }

  .admin-nav-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .admin-main {
    width: calc(100% - 24px);
    padding-top: 26px;
  }

  .admin-hero {
    gap: 18px;
  }

  .admin-stats {
    width: 100%;
  }

  .stat {
    flex: 1;
    min-width: 0;
    padding: 12px 14px;
  }

  .admin-card {
    padding: 18px;
    border-radius: 18px;
  }

  .client-item {
    padding: 15px;
  }

  .client-actions {
    width: 100%;
  }

  .client-actions form {
    flex: 1;
  }

  .client-actions .btn {
    width: 100%;
  }

  .client-meta {
    gap: 8px 16px;
  }

  .client-meta > div {
    flex-direction: column;
    gap: 2px;
  }

  .client-meta dd {
    max-width: 100%;
  }

  .list-head {
    flex-wrap: wrap;
  }
}

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