:root {
  color-scheme: dark;
  --bg: #07111f;
  --surface: rgba(15, 29, 47, 0.82);
  --surface-strong: #10233a;
  --surface-soft: rgba(255, 255, 255, 0.045);
  --text: #f3f7fb;
  --muted: #91a4b8;
  --line: rgba(255, 255, 255, 0.1);
  --cyan: #37d7c5;
  --cyan-dark: #143d41;
  --blue: #4f8cff;
  --danger: #ff6f76;
  --warning: #ffcb6b;
  --radius: 22px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 30% -10%, rgba(39, 121, 190, 0.24), transparent 38rem),
    linear-gradient(160deg, #081421 0%, var(--bg) 58%, #050b13 100%);
  overflow-x: hidden;
}

button, input { font: inherit; }
button { cursor: pointer; }

.background-glow {
  position: fixed;
  width: 24rem;
  height: 24rem;
  border-radius: 50%;
  filter: blur(100px);
  pointer-events: none;
  opacity: 0.13;
}
.glow-one { top: 28%; right: -13rem; background: var(--cyan); }
.glow-two { bottom: -14rem; left: -7rem; background: var(--blue); }

.topbar {
  width: min(1180px, calc(100% - 40px));
  height: 88px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 2;
}

.brand {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: #04191a;
  background: var(--cyan);
  border-radius: 12px;
  font-size: 18px;
  font-weight: 900;
  box-shadow: 0 0 32px rgba(55, 215, 197, 0.25);
}
.brand strong, .brand small { display: block; }
.brand strong { letter-spacing: -0.02em; }
.brand small { color: var(--muted); font-size: 11px; margin-top: 2px; }

.topbar-actions, .heading-actions, .trust-row { display: flex; align-items: center; gap: 12px; }
.secure-label { color: var(--muted); font-size: 12px; }
.secure-label i {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 12px var(--cyan);
}

main { width: min(1180px, calc(100% - 40px)); margin: 0 auto; position: relative; z-index: 1; }
.login-layout {
  min-height: calc(100vh - 89px);
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(330px, 0.7fr);
  gap: clamp(40px, 8vw, 110px);
  align-items: center;
  padding: 64px 0 90px;
}
.login-copy { max-width: 660px; }
.eyebrow { color: var(--cyan); font-size: 11px; font-weight: 800; letter-spacing: 0.17em; margin: 0 0 16px; }
h1 { font-size: clamp(38px, 6vw, 70px); line-height: 0.99; letter-spacing: -0.055em; margin: 0; }
h2 { font-size: 26px; letter-spacing: -0.035em; margin: 0 0 10px; }
.lead { color: #b0c1d2; font-size: clamp(17px, 2vw, 21px); line-height: 1.6; max-width: 650px; margin: 26px 0; }
.lead.compact { font-size: 15px; margin: 12px 0 0; }
.trust-row { flex-wrap: wrap; color: var(--muted); font-size: 12px; }
.trust-row span { padding: 9px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-soft); }

.login-card, .dialog-shell {
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(20, 40, 64, 0.93), rgba(10, 22, 38, 0.94));
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(20px);
}
.login-card p, .dialog-shell p { color: var(--muted); line-height: 1.55; }
.card-icon { color: var(--cyan); font-size: 34px; margin-bottom: 18px; }
label { display: block; color: #cbd7e2; font-size: 12px; font-weight: 700; margin: 20px 0 8px; }
input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  color: var(--text);
  background: rgba(4, 13, 24, 0.72);
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
}
input:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(55, 215, 197, 0.11); }
.form-error { min-height: 20px; color: var(--danger) !important; font-size: 12px; margin: 8px 0 !important; }
.privacy-note { display: block; text-align: center; color: #71869b; font-size: 10px; margin-top: 16px; }

.button {
  min-height: 42px;
  padding: 0 16px;
  color: var(--text);
  border: 1px solid transparent;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 750;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease, opacity 120ms ease;
}
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { opacity: 0.42; cursor: not-allowed; }
.button-primary { color: #042220; background: var(--cyan); box-shadow: 0 10px 28px rgba(55, 215, 197, 0.17); }
.button-primary:hover:not(:disabled) { background: #5be5d4; }
.button-secondary { background: var(--surface-soft); border-color: var(--line); }
.button-secondary:hover:not(:disabled), .button-quiet:hover:not(:disabled) { background: rgba(255, 255, 255, 0.09); }
.button-quiet { background: transparent; border-color: transparent; color: var(--muted); }
.button-danger { color: #ffb3b7; background: rgba(255, 111, 118, 0.08); border-color: rgba(255, 111, 118, 0.22); }
.button-wide { width: 100%; margin-top: 6px; }

.dashboard { padding: 70px 0 90px; }
.dashboard-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; margin-bottom: 34px; }
.dashboard h1 { font-size: clamp(38px, 5vw, 58px); }
.device-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.device-card {
  position: relative;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(18, 37, 60, 0.86), rgba(10, 21, 36, 0.86));
  overflow: hidden;
}
.device-card::after {
  content: "";
  position: absolute;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  top: -95px;
  right: -60px;
  background: var(--cyan);
  filter: blur(55px);
  opacity: 0.11;
  pointer-events: none;
}
.device-card.offline::after { background: var(--danger); opacity: 0.08; }
.device-head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.device-title { display: flex; align-items: center; gap: 13px; }
.computer-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  color: var(--cyan);
  background: var(--cyan-dark);
  border-radius: 13px;
  font-size: 19px;
}
.offline .computer-icon { color: #a4b0bd; background: rgba(255, 255, 255, 0.06); }
.device-title h2 { font-size: 20px; margin: 0; }
.device-title p { color: var(--muted); font-size: 11px; margin: 4px 0 0; }
.status-pill { padding: 7px 10px; border-radius: 999px; font-size: 10px; font-weight: 800; letter-spacing: 0.08em; }
.status-pill.online { color: var(--cyan); background: rgba(55, 215, 197, 0.1); }
.status-pill.offline { color: #9daab8; background: rgba(255, 255, 255, 0.055); }
.device-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 24px 0 18px; }
.metric { padding: 12px; border: 1px solid rgba(255, 255, 255, 0.07); border-radius: 13px; background: rgba(0, 0, 0, 0.1); }
.metric span { display: block; color: #6f8499; font-size: 9px; font-weight: 800; letter-spacing: 0.1em; margin-bottom: 6px; }
.metric strong { font-size: 12px; font-weight: 700; overflow-wrap: anywhere; }
.metric .healthy { color: var(--cyan); }
.device-address { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 11px; padding: 11px 0; border-top: 1px solid var(--line); }
.device-address code { color: #c8d5e1; }
.device-actions { display: flex; gap: 9px; margin-top: 13px; }
.device-actions .button:first-child { flex: 1; }
.device-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 17px; color: #6f8499; font-size: 10px; }
.revoke-link { border: 0; background: none; color: #6f8499; font-size: 10px; padding: 0; }
.revoke-link:hover { color: var(--danger); }
.foot-actions { display: inline-flex; gap: 12px; }
.foot-actions .revoke-link:first-child:hover { color: var(--cyan); }

.notice { display: flex; align-items: center; gap: 17px; padding: 22px; border: 1px dashed rgba(55, 215, 197, 0.3); border-radius: var(--radius); background: rgba(55, 215, 197, 0.04); }
.notice-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; color: var(--cyan); background: var(--cyan-dark); font-weight: 900; }
.notice p { color: var(--muted); margin: 5px 0 0; font-size: 13px; }

.security-strip {
  margin-top: 24px;
  padding: 18px 22px;
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(4, 12, 21, 0.36);
}
.security-strip > div { display: flex; align-items: center; gap: 12px; }
.security-strip p { color: var(--muted); font-size: 11px; line-height: 1.45; margin: 0; }
.security-strip strong { color: #dbe5ee; }
.strip-number { color: var(--cyan); font-size: 10px; font-weight: 900; }
.strip-arrow { color: #4b6074; }

dialog { width: min(520px, calc(100% - 28px)); padding: 0; color: var(--text); background: transparent; border: 0; }
dialog::backdrop { background: rgba(1, 6, 12, 0.76); backdrop-filter: blur(8px); }
.dialog-shell { position: relative; }
.dialog-small { max-width: 440px; }
.dialog-close { position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); color: var(--muted); background: var(--surface-soft); font-size: 20px; }
.secret-box { display: flex; align-items: center; gap: 8px; padding: 9px; border: 1px solid var(--line); border-radius: 13px; background: rgba(0, 0, 0, 0.19); }
.secret-box code { flex: 1; min-width: 0; color: var(--cyan); overflow-wrap: anywhere; font-size: 11px; }
.expiry { font-size: 11px; }
.safe-note { padding: 13px; border-left: 2px solid var(--warning); color: #b8c5d2; background: rgba(255, 203, 107, 0.05); font-size: 11px; line-height: 1.55; }
.address-box { margin: 20px 0; padding: 16px; color: var(--cyan); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; text-align: center; user-select: all; border: 1px solid rgba(55, 215, 197, 0.22); border-radius: 13px; background: rgba(55, 215, 197, 0.06); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); padding: 12px 16px; color: #061818; background: var(--cyan); border-radius: 11px; font-size: 12px; font-weight: 750; opacity: 0; pointer-events: none; transition: 180ms ease; z-index: 10; box-shadow: 0 14px 44px rgba(0, 0, 0, 0.35); }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

[hidden] { display: none !important; }

@media (max-width: 800px) {
  .topbar { width: min(100% - 28px, 1180px); height: 76px; }
  main { width: min(100% - 28px, 1180px); }
  .secure-label { display: none; }
  .login-layout { grid-template-columns: 1fr; gap: 42px; padding: 52px 0 64px; }
  .login-copy { text-align: center; margin: 0 auto; }
  .trust-row { justify-content: center; }
  .login-card { width: 100%; max-width: 460px; margin: 0 auto; }
  .dashboard { padding-top: 46px; }
  .dashboard-heading { align-items: flex-start; flex-direction: column; }
  .device-grid { grid-template-columns: 1fr; }
  .security-strip { grid-template-columns: 1fr; }
  .strip-arrow { transform: rotate(90deg); justify-self: center; }
}

@media (max-width: 480px) {
  .brand small { display: none; }
  .login-card, .dialog-shell { padding: 24px; }
  .heading-actions { width: 100%; }
  .heading-actions .button { flex: 1; }
  .device-card { padding: 18px; }
  .device-metrics { grid-template-columns: 1fr 1fr; }
  .metric:last-child { grid-column: span 2; }
  .device-actions { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
