:root {
  --brand: #0f6fde;
  --brand-dark: #0a4fa3;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f5f7fb;
  --card: #ffffff;
  --danger-bg: #fef2f2;
  --danger: #b91c1c;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.shell { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100%; }

/* Brand side */
.brand {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 48px 56px;
  color: #fff;
  background:
    radial-gradient(900px 500px at 110% -10%, rgba(56, 189, 248, .45), transparent 60%),
    radial-gradient(700px 500px at -20% 120%, rgba(99, 102, 241, .5), transparent 60%),
    linear-gradient(150deg, #0b3b8c, #0f6fde);
}
.brand::after {
  content: "";
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.06) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: linear-gradient(180deg, transparent, #000 40%, transparent);
  pointer-events: none;
}
.brand > * { position: relative; z-index: 1; }
.logo { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 20px; letter-spacing: .2px; }
.logo svg { width: 36px; height: 36px; fill: rgba(255,255,255,.18); stroke: #fff; stroke-width: 1.6; }
.logo .dot { fill: #5eead4; stroke: none; }
.brand-copy h1 { font-size: 34px; line-height: 1.25; font-weight: 700; max-width: 460px; margin: 0 0 24px; }
.brand-copy ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.brand-copy li { display: flex; align-items: center; gap: 10px; color: rgba(255,255,255,.88); }
.brand-copy li::before {
  content: ""; width: 20px; height: 20px; flex: none; border-radius: 50%;
  background: rgba(255,255,255,.18) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5L20 7'/%3E%3C/svg%3E") center / 12px no-repeat;
}
.brand-foot { margin: 0; font-size: 13px; color: rgba(255,255,255,.65); }

/* Form side */
.panel { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.card { width: 100%; max-width: 400px; }
.card h2 { font-size: 28px; margin: 0 0 6px; }
.sub { margin: 0 0 28px; color: var(--muted); }

label { display: block; font-size: 14px; font-weight: 500; margin: 18px 0 8px; }
input[type=text], input[type=password] {
  width: 100%; height: 48px; padding: 0 14px;
  font: inherit; font-size: 15px; color: var(--ink);
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  transition: border-color .15s, box-shadow .15s;
}
input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(15,111,222,.15); }

.pw { position: relative; }
.pw input { padding-right: 48px; }
.eye {
  position: absolute; right: 6px; top: 6px; width: 36px; height: 36px;
  display: grid; place-items: center; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); cursor: pointer;
}
.eye:hover { background: var(--bg); color: var(--ink); }
.eye svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.eye[aria-pressed="true"] svg { stroke: var(--brand); }

.submit {
  margin-top: 28px; width: 100%; height: 50px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; font-size: 16px; color: #fff;
  background: var(--brand); border: 0; border-radius: 10px; cursor: pointer;
  box-shadow: 0 8px 20px -8px rgba(15,111,222,.7);
  transition: background .15s, transform .05s;
}
.submit:hover { background: var(--brand-dark); }
.submit:active { transform: translateY(1px); }
.submit:disabled { opacity: .7; cursor: progress; }
.submit svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

.alert {
  padding: 12px 14px; margin-bottom: 4px; border-radius: 10px;
  background: var(--danger-bg); color: var(--danger); font-size: 14px;
  border: 1px solid #fecaca;
}

.links { display: flex; justify-content: space-between; margin-top: 22px; font-size: 14px; }
.links a { color: var(--brand); text-decoration: none; font-weight: 500; }
.links a:hover { text-decoration: underline; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .brand { padding: 28px 24px; }
  .brand-copy, .brand-foot { display: none; }
  .panel { align-items: flex-start; padding: 32px 16px; }
}

/* Server chooser */
.sub strong { color: var(--ink); }
.servers { display: grid; gap: 12px; margin-top: 8px; }
.server {
  display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 14px 16px; text-align: left; font: inherit; color: var(--ink);
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.server:hover, .server:focus-visible { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(15,111,222,.12); }
.server > svg { width: 32px; height: 32px; flex: none; fill: rgba(15,111,222,.1); stroke: var(--brand); stroke-width: 1.6; }
.server span { flex: 1; display: grid; gap: 2px; min-width: 0; }
.server small { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.server .go { width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.server:disabled { opacity: .6; cursor: progress; }

button.busy { opacity: .75; cursor: progress; }
button.busy .go, .submit.busy svg { animation: nudge .8s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateX(4px); } }
