:root {
  color-scheme: dark;
  --ink: #e0f4eb;
  --muted: #91aaa0;
  --line: rgba(103, 225, 172, .18);
  --paper: rgba(8, 19, 18, .94);
  --wash: #050b0a;
  --blue: #08c8e8;
  --blue-dark: #00a8c4;
  --green: #4df0a1;
  --green-dark: #1dcc7d;
  --red: #ff718a;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(ellipse at 12% 0%, rgba(0, 207, 157, .14), transparent 34rem),
    radial-gradient(ellipse at 94% 20%, rgba(0, 174, 224, .10), transparent 34rem),
    linear-gradient(135deg, #07100f 0%, #050b0a 55%, #07110e 100%);
  color: var(--ink);
}
body::before {
  position: fixed;
  z-index: 0;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(83, 230, 167, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(83, 230, 167, .035) 1px, transparent 1px);
  background-size: 36px 36px;
  content: "";
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, .8), transparent 82%);
}
.shell { position: relative; z-index: 1; width: min(100% - 32px, 980px); margin: 0 auto; padding: 34px 0 64px; }
.brand { display: flex; align-items: center; gap: 13px; margin: 0 0 28px 4px; }
.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(77, 240, 161, .48);
  border-radius: 13px;
  background: linear-gradient(145deg, rgba(21, 73, 55, .92), rgba(7, 24, 21, .96));
  color: var(--green);
  font-family: var(--mono);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -.08em;
  text-shadow: 0 0 14px rgba(77, 240, 161, .52);
  box-shadow: 0 0 24px rgba(17, 214, 133, .10), inset 0 0 18px rgba(77, 240, 161, .05);
}
.brand strong, .brand span { display: block; }
.brand strong { color: #e8fff4; font-family: var(--mono); font-size: 15px; letter-spacing: .015em; }
.brand span { color: var(--muted); font-family: var(--mono); font-size: 11px; margin-top: 4px; }
.card {
  width: min(100%, 560px);
  margin: 0 auto;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(11, 27, 24, .96), var(--paper));
  box-shadow: 0 24px 80px rgba(0, 0, 0, .42), 0 0 34px rgba(13, 192, 126, .045), inset 0 1px rgba(203, 255, 226, .035);
  backdrop-filter: blur(14px);
}
.card.wide { width: 100%; }
.eyebrow { margin: 0 0 10px; color: var(--green); font-family: var(--mono); font-weight: 700; font-size: 10px; letter-spacing: .16em; }
h1 { margin: 0; color: #f0fff7; font-family: var(--mono); font-size: clamp(25px, 4vw, 33px); line-height: 1.2; letter-spacing: -.06em; }
h2 { margin: 0; color: #e4fff0; font-family: var(--mono); font-size: 16px; letter-spacing: -.025em; }
.muted { color: var(--muted); line-height: 1.6; margin: 10px 0 0; font-size: 14px; }
.login-card { max-width: 440px; padding: 38px; }
.login-form, .create-form { display: grid; gap: 17px; margin-top: 26px; }
label { display: grid; gap: 8px; color: #bad1c6; font-family: var(--mono); font-size: 12px; font-weight: 600; }
input {
  width: 100%;
  min-height: 45px;
  padding: 10px 12px;
  border: 1px solid rgba(113, 174, 147, .25);
  border-radius: 8px;
  outline: none;
  background: rgba(3, 11, 10, .82);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
input::placeholder { color: #60786d; }
input:focus { border-color: rgba(77, 240, 161, .72); background: #071411; box-shadow: 0 0 0 3px rgba(77, 240, 161, .10), 0 0 18px rgba(77, 240, 161, .08); }
.button {
  min-height: 42px;
  padding: 10px 15px;
  border: 1px solid transparent;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  font-size: 12px;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
  transition: transform .14s, background .14s, border-color .14s, box-shadow .14s;
}
.button:hover { transform: translateY(-1px); }
.button:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }
.button.primary { border-color: rgba(78, 255, 167, .42); background: linear-gradient(135deg, #37e997, #16c77b); color: #03130c; box-shadow: 0 0 20px rgba(31, 224, 135, .12), inset 0 1px rgba(255, 255, 255, .2); }
.button.primary:hover { background: linear-gradient(135deg, #66ffb2, #24dc8b); box-shadow: 0 0 26px rgba(31, 224, 135, .23); }
.button.secondary { border-color: rgba(8, 200, 232, .42); background: rgba(7, 65, 71, .36); color: #91edfa; }
.button.secondary:hover { border-color: rgba(8, 200, 232, .72); background: rgba(7, 90, 98, .48); }
.button.ghost { border-color: var(--line); background: rgba(8, 19, 18, .56); color: #b0c6bb; }
.button.ghost:hover { border-color: rgba(77, 240, 161, .4); color: var(--green); }
.button.danger { border-color: rgba(255, 113, 138, .34); background: rgba(76, 22, 34, .3); color: #ff9aaa; }
.button.danger:hover { border-color: rgba(255, 113, 138, .72); background: rgba(109, 28, 46, .46); }
.button.full { width: 100%; min-height: 47px; margin-top: 3px; }
.notice { margin: 18px 0 0; padding: 12px 14px; border-radius: 8px; font-size: 13px; line-height: 1.5; }
.notice.success { border: 1px solid rgba(77, 240, 161, .26); background: rgba(19, 91, 61, .2); color: #9af4c3; }
.notice.error { border: 1px solid rgba(255, 113, 138, .28); background: rgba(94, 24, 39, .25); color: #ffabb8; }
.section-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.admin-header-actions { display: flex; align-items: center; gap: 8px; }
.ip-refresh-form { margin: 0; }
.logout-form { flex: 0 0 auto; }
.create-form { padding: 20px; border: 1px solid var(--line); border-radius: 12px; background: rgba(3, 12, 11, .54); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; align-items: end; }
.help { color: var(--muted); font-family: var(--mono); font-size: 11px; margin: -4px 0 0; }
.table-heading { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 28px 0 12px; }
.count { display: inline-grid; min-width: 25px; height: 25px; place-items: center; border: 1px solid rgba(77, 240, 161, .24); border-radius: 7px; background: rgba(25, 95, 65, .22); color: var(--green); font-family: var(--mono); font-size: 11px; font-weight: 750; }
.connection-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 7px 14px; margin-left: auto; }
.connection-legend > span { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-family: var(--mono); font-size: 9px; }
.users-list { display: grid; gap: 10px; }
.user-row {
  display: grid;
  grid-template-columns: minmax(130px, .7fr) minmax(330px, 1.6fr);
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(103, 225, 172, .14);
  border-radius: 11px;
  background: rgba(5, 15, 13, .76);
  transition: border-color .15s, background .15s;
}
.user-row:hover { border-color: rgba(77, 240, 161, .31); background: rgba(8, 23, 19, .92); }
.user-meta { min-width: 0; display: grid; gap: 5px; }
.user-meta strong { overflow-wrap: anywhere; color: #d9f9e9; font-family: var(--mono); font-size: 13px; }
.user-name { display: flex; align-items: center; gap: 9px; min-width: 0; }
.connection-indicator { display: inline-block; width: 9px; height: 9px; flex: 0 0 9px; border-radius: 50%; }
.connection-indicator.is-connected { background: #4df0a1; box-shadow: 0 0 8px rgba(77, 240, 161, .7); }
.connection-indicator.was-connected { background: #ffc65c; box-shadow: 0 0 8px rgba(255, 198, 92, .6); }
.connection-indicator.never-connected { background: #ff718a; box-shadow: 0 0 8px rgba(255, 113, 138, .55); }
.connection-indicator.status-unknown { background: #91aaa0; }
.user-meta span { color: var(--muted); font-family: var(--mono); font-size: 10px; line-height: 1.5; }
.edit-user { display: grid; grid-template-columns: minmax(95px, .8fr) minmax(130px, 1.4fr) auto; gap: 7px; align-items: center; }
.edit-user input { min-height: 38px; padding: 8px 9px; font-size: 11px; }
.edit-user .button, .delete-form .button { min-height: 38px; padding: 8px 10px; white-space: nowrap; font-size: 11px; }
.user-admin-actions { grid-column: 1 / -1; display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px; min-width: 0; padding-top: 8px; border-top: 1px solid rgba(103, 225, 172, .10); }
.user-action-group { display: flex; align-items: center; gap: 7px; }
.user-downloads, .user-qr-actions { display: flex; gap: 5px; }
.admin-action-label { color: #749286; font-family: var(--mono); font-size: 8px; letter-spacing: .12em; }
.admin-download-form, .admin-qr-form { margin: 0; }
.admin-download-button, .admin-qr-button { min-height: 32px; padding: 6px 9px; white-space: nowrap; font-size: 10px; }
.button:disabled { opacity: .42; cursor: not-allowed; transform: none; box-shadow: none; }
.delete-form { order: 1; margin: 0 0 0 auto; }
.empty { padding: 25px; border: 1px dashed rgba(103, 225, 172, .26); border-radius: 11px; color: var(--muted); text-align: center; font-family: var(--mono); font-size: 13px; }
.profile-ready { display: flex; align-items: flex-start; gap: 16px; margin-top: 24px; padding: 20px; border: 1px solid rgba(77, 240, 161, .22); border-radius: 12px; background: linear-gradient(135deg, rgba(15, 66, 46, .25), rgba(5, 18, 14, .36)); }
.profile-ready-content { width: 100%; min-width: 0; }
.profile-ready h2 { margin: 1px 0 7px; }
.profile-ready p { color: var(--muted); margin: 0 0 15px; font-size: 12px; }
.profile-platforms { display: grid; gap: 12px; margin-top: 18px; }
.profile-platform { min-width: 0; padding: 15px; border: 1px solid rgba(103, 225, 172, .14); border-radius: 10px; background: rgba(3, 12, 11, .42); }
.profile-platform-heading { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; }
.profile-platform-heading img { display: block; width: 25px; height: 25px; flex: 0 0 25px; }
.profile-platform-heading h2 { margin: 0; }
.profile-app-name { color: #bcebd2 !important; font-size: 13px !important; font-weight: 700; }
.profile-platform-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.profile-platform-actions > a, .profile-platform-actions > form { flex: 1 1 190px; min-width: 0; }
.profile-platform-qr { margin: 0; }
.profile-platform-qr .button { width: 100%; min-height: 52px; }
.profile-platform .download-link { display: flex; align-items: center; justify-content: flex-start; gap: 10px; min-height: 52px; padding: 9px 12px; text-align: left; }
.profile-platform .download-link > img { display: block; width: 20px; height: 20px; flex: 0 0 20px; }
.profile-platform .download-link > span { display: grid; gap: 2px; }
.profile-platform .download-link small { display: block; font-family: var(--mono); font-size: 10px; font-weight: 550; opacity: .82; }
.profile-store-link { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 8px 12px; border: 1px solid rgba(103, 225, 172, .2); border-radius: 8px; background: rgba(8, 19, 18, .68); color: #e0f4eb; text-decoration: none; transition: border-color .15s, background .15s; }
.profile-store-link:hover { border-color: rgba(77, 240, 161, .52); background: rgba(14, 35, 29, .85); }
.profile-store-link > img { display: block; width: 26px; height: 26px; flex: 0 0 26px; }
.profile-store-link > span { display: grid; gap: 2px; }
.profile-store-link small { color: var(--muted); font-size: 9px; }
.profile-store-link strong { font-family: var(--mono); font-size: 11px; }
.checkmark { flex: 0 0 auto; width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid rgba(77, 240, 161, .25); border-radius: 50%; background: rgba(37, 127, 81, .24); color: var(--green); font-size: 20px; font-weight: 800; }
.checkmark.pending { border-color: rgba(255, 190, 91, .25); background: rgba(115, 76, 24, .24); color: #ffc56c; }
.download-link { display: inline-flex; }
.profile-downloads { display: grid; gap: 13px; }
.profile-downloads .download-link { justify-content: space-between; gap: 18px; }
.profile-downloads small { font-family: var(--mono); font-size: 10px; font-weight: 550; opacity: .82; }
.profile-qr-form { display: flex; justify-content: center; margin: 22px 0 0; }
.profile-note { display: flex; justify-content: space-between; gap: 12px; margin-top: 18px; padding-top: 17px; border-top: 1px solid var(--line); color: var(--muted); font-family: var(--mono); font-size: 10px; line-height: 1.55; }
.profile-note strong { color: #bcebd2; }
.profile-note.device-limit { margin-top: 10px; padding-top: 10px; }
.profile-note.device-limit strong { color: #ffc56c; }
.qr-card { width: min(100%, 860px); text-align: center; }
.qr-card .muted { margin-bottom: 18px; }
.qr-box { display: grid; place-items: center; width: fit-content; max-width: 100%; margin: 0 auto 18px; padding: 15px; border-radius: 10px; background: #fff; box-shadow: 0 0 28px rgba(77, 240, 161, .12); }
.qr-box img { display: block; width: min(100%, 380px); height: auto; image-rendering: pixelated; }
.qr-box-vpn img { width: min(100%, 380px); }
.qr-back { margin-top: 2px; }
@media (max-width: 760px) {
  .shell { width: min(100% - 22px, 600px); padding-top: 22px; }
  .card, .login-card { padding: 23px 19px; border-radius: 15px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .button { width: 100%; }
  .user-row { grid-template-columns: minmax(0, 1fr); }
  .edit-user { grid-column: 1; grid-row: auto; grid-template-columns: 1fr 1.3fr; }
  .edit-user .button { grid-column: 1 / -1; }
  .user-admin-actions { grid-column: 1; grid-row: auto; }
  .section-heading { gap: 12px; }
}
@media (max-width: 430px) {
  .section-heading { flex-direction: column; }
  .admin-header-actions { flex-wrap: wrap; }
  .profile-note { flex-direction: column; }
  .profile-ready { padding: 17px 14px; }
  .profile-downloads .download-link { align-items: flex-start; flex-direction: column; gap: 5px; }
  .edit-user { grid-template-columns: 1fr; }
  .edit-user .button { grid-column: auto; }
  .user-row { grid-template-columns: minmax(0, 1fr); }
  .user-action-group { flex-wrap: wrap; }
}
