:root {
  --bg: #0b1020;
  --panel: #11182b;
  --panel-2: #151f36;
  --text: #eef3ff;
  --muted: #9ca9c6;
  --line: rgba(255,255,255,.11);
  --accent: #87b8ff;
  --danger: #ff8b8b;
  --shadow: 0 24px 80px rgba(0,0,0,.36);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top left, #24324f 0, #0b1020 34%, #080b13 100%);
  color: var(--text);
}

button, input { font: inherit; }
button {
  border: 0;
  border-radius: 14px;
  padding: 10px 14px;
  background: linear-gradient(180deg, #2c7dff, #1f5fc8);
  color: white;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(31, 95, 200, .28);
}
button:hover { filter: brightness(1.08); }
button:active { transform: translateY(1px); }

.login-shell {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 28px;
}

.login-card {
  width: min(440px, 100%);
  background: rgba(17, 24, 43, .86);
  border: 1px solid var(--line);
  border-radius: 30px;
  box-shadow: var(--shadow);
  padding: 34px;
  backdrop-filter: blur(18px);
}

.brand-mark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(135deg, #8ec5ff, #5578ff);
  font-weight: 800;
  letter-spacing: -.04em;
  margin-bottom: 22px;
}

h1 { margin: 0 0 8px; font-size: 32px; letter-spacing: -.04em; }
.muted { color: var(--muted); line-height: 1.5; margin: 0 0 22px; }
.fineprint { color: var(--muted); font-size: 13px; line-height: 1.45; margin: 20px 0 0; }
.alert {
  background: rgba(255, 139, 139, .13);
  border: 1px solid rgba(255, 139, 139, .34);
  color: #ffd2d2;
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 16px;
}

.login-form { display: grid; gap: 16px; }
.login-form label { color: var(--muted); font-size: 14px; display: grid; gap: 7px; }
.login-form input {
  width: 100%;
  padding: 13px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.06);
  color: var(--text);
  outline: none;
}
.login-form input:focus { border-color: rgba(135,184,255,.75); box-shadow: 0 0 0 4px rgba(135,184,255,.14); }
.login-form button { margin-top: 4px; padding: 13px 16px; }

.app-shell {
  height: 100%;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
}

.topbar {
  display: grid;
  grid-template-columns: auto minmax(320px, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  background: rgba(10, 15, 28, .84);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.brand { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.brand-dot { width: 12px; height: 12px; border-radius: 999px; background: var(--accent); box-shadow: 0 0 0 6px rgba(135,184,255,.14); }

.nav-form {
  min-width: 0;
  display: grid;
  grid-template-columns: auto auto auto 1fr auto;
  gap: 8px;
  align-items: center;
}
.nav-form button, .userbox button {
  background: rgba(255,255,255,.08);
  color: var(--text);
  box-shadow: none;
  border: 1px solid var(--line);
}
.nav-form button[type="submit"] {
  background: linear-gradient(180deg, #2c7dff, #1f5fc8);
  border: 0;
}
.nav-form input {
  min-width: 0;
  width: 100%;
  padding: 11px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.07);
  color: var(--text);
  outline: none;
}
.nav-form input:focus { border-color: rgba(135,184,255,.75); box-shadow: 0 0 0 4px rgba(135,184,255,.12); }

.userbox { display: flex; align-items: center; gap: 10px; color: var(--muted); white-space: nowrap; }
.userbox form { margin: 0; }

.statusbar {
  display: flex;
  gap: 18px;
  align-items: center;
  min-height: 38px;
  padding: 8px 14px;
  color: var(--muted);
  background: rgba(255,255,255,.035);
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
#pageTitle { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

.viewport-wrap {
  position: relative;
  min-height: 0;
  overflow: hidden;
  background: #06080d;
  display: grid;
  place-items: stretch;
}

#browserCanvas {
  width: 100%;
  height: 100%;
  display: block;
  background: white;
  outline: none;
  cursor: default;
}
#browserCanvas:focus { box-shadow: inset 0 0 0 2px rgba(135,184,255,.75); }

.overlay {
  position: absolute;
  inset: 18px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 24px;
  color: var(--text);
  border-radius: 24px;
  background: rgba(8, 11, 19, .72);
  border: 1px solid var(--line);
  backdrop-filter: blur(12px);
  font-weight: 650;
}
.overlay.hidden { display: none; }

.helpbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 14px;
  color: var(--muted);
  background: rgba(10, 15, 28, .9);
  border-top: 1px solid var(--line);
  font-size: 12px;
}

@media (max-width: 900px) {
  .topbar { grid-template-columns: 1fr; }
  .brand, .userbox { justify-content: space-between; }
  .helpbar { flex-direction: column; }
}
