:root {
  --bg: #070b11;
  --bg-2: #0b1220;
  --panel: #0e1624;
  --panel-2: #111c2e;
  --line: #1e2c40;
  --text: #e6edf6;
  --muted: #7f92a8;
  --accent: #38bdf8;
  --accent-2: #22d3ee;
  --ok: #34d399;
  --danger: #f87171;
  --radius: 14px;
  --mono: "JetBrains Mono", "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body { overflow: hidden; }

[hidden] { display: none !important; }

.view { height: 100%; }

/* ---------- login ---------- */

.login-view {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow: auto;
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(56, 189, 248, .16), transparent 60%),
    radial-gradient(700px 500px at 110% 110%, rgba(34, 211, 238, .12), transparent 55%),
    var(--bg);
}

.grid-bg {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(56, 189, 248, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(56, 189, 248, .05) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at 50% 40%, black, transparent 78%);
  pointer-events: none;
}

.login-card {
  position: relative;
  width: 100%;
  max-width: 400px;
  padding: 30px 30px 22px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(17, 28, 46, .92), rgba(11, 18, 32, .96));
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .9), inset 0 1px 0 rgba(255, 255, 255, .04);
  backdrop-filter: blur(8px);
}

.brand { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; }

.logo {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 13px;
  color: var(--accent);
  background: rgba(56, 189, 248, .1);
  border: 1px solid rgba(56, 189, 248, .28);
  box-shadow: 0 0 24px -6px rgba(56, 189, 248, .5);
  flex: none;
}

.brand h1 { margin: 0; font-size: 18px; font-weight: 650; letter-spacing: .2px; }
.brand .host { margin: 3px 0 0; font-family: var(--mono); font-size: 12.5px; color: var(--muted); }

label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 7px; }

.field { position: relative; margin-bottom: 14px; }

input[type="password"], input[type="text"] {
  width: 100%;
  height: 46px;
  padding: 0 44px 0 14px;
  font-size: 15px;
  color: var(--text);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

input:focus {
  border-color: rgba(56, 189, 248, .65);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, .14);
}

.eye {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.eye:hover { color: var(--text); background: rgba(255, 255, 255, .05); }

button { font-family: inherit; cursor: pointer; }

.primary {
  width: 100%;
  height: 46px;
  border: 0;
  border-radius: 11px;
  font-size: 15px;
  font-weight: 600;
  color: #04121c;
  background: linear-gradient(180deg, #5ad2ff, #2aaee6);
  box-shadow: 0 10px 26px -12px rgba(56, 189, 248, .9);
  transition: filter .15s, transform .06s, opacity .15s;
}
.primary:hover { filter: brightness(1.07); }
.primary:active { transform: translateY(1px); }
.primary:disabled { opacity: .6; cursor: default; }
.primary.small { width: auto; height: 40px; padding: 0 18px; font-size: 14px; }

.msg { min-height: 18px; margin: 12px 0 0; font-size: 13px; color: var(--danger); text-align: center; }
.msg.ok { color: var(--ok); }

.login-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(30, 44, 64, .7);
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.45;
}

.dot-secure {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 8px rgba(52, 211, 153, .8);
  flex: none;
}

/* ---------- terminal ---------- */

.term-view {
  display: flex;
  flex-direction: column;
  background: #05080d;
  height: 100dvh;
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 50px;
  padding: 0 14px;
  background: linear-gradient(180deg, #0d1523, #0a111c);
  border-bottom: 1px solid var(--line);
  flex: none;
  user-select: none;
}

.bar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.bar-right { display: flex; align-items: center; gap: 8px; }

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #64748b;
  flex: none;
  transition: background .2s, box-shadow .2s;
}
.status-dot.on { background: var(--ok); box-shadow: 0 0 10px rgba(52, 211, 153, .85); }
.status-dot.off { background: var(--danger); box-shadow: 0 0 10px rgba(248, 113, 113, .7); }
.status-dot.wait { background: #fbbf24; box-shadow: 0 0 10px rgba(251, 191, 36, .7); }

.bar-title {
  font-family: var(--mono);
  font-size: 13px;
  color: #cfe0f2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-text { font-size: 12px; color: var(--muted); white-space: nowrap; }

.ghost {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 12px;
  font-size: 12.5px;
  color: #c3d2e3;
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--line);
  border-radius: 9px;
  transition: background .15s, color .15s, border-color .15s;
  white-space: nowrap;
}
.ghost:hover { background: rgba(56, 189, 248, .1); color: #fff; border-color: rgba(56, 189, 248, .4); }
.ghost.danger:hover { background: rgba(248, 113, 113, .12); border-color: rgba(248, 113, 113, .45); color: #fecaca; }

.terminal-wrap { position: relative; flex: 1 1 auto; min-height: 0; padding: 8px 6px 4px 10px; }
#terminal { width: 100%; height: 100%; }
#terminal .xterm { height: 100%; }

.term-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(5, 8, 13, .72);
  backdrop-filter: blur(3px);
  z-index: 5;
}
.overlay-card {
  text-align: center;
  padding: 24px 28px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: 0 24px 60px -20px #000;
}
.overlay-card p { margin: 0 0 16px; font-size: 14px; color: #d4dfeb; }

.keys {
  display: flex;
  gap: 7px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: #0a111c;
  border-top: 1px solid var(--line);
  overflow-x: auto;
  flex: none;
  scrollbar-width: none;
}
.keys::-webkit-scrollbar { display: none; }
.keys button {
  height: 32px;
  padding: 0 12px;
  font-size: 12.5px;
  color: #c3d2e3;
  background: rgba(255, 255, 255, .045);
  border: 1px solid var(--line);
  border-radius: 8px;
  white-space: nowrap;
  flex: none;
}
.keys button:hover { background: rgba(56, 189, 248, .12); border-color: rgba(56, 189, 248, .4); }
.keys button:active { background: rgba(56, 189, 248, .22); }

@media (max-width: 560px) {
  .hide-xs { display: none; }
  .bar { height: 46px; padding: 0 10px; }
  .ghost { padding: 0 9px; }
  .login-card { padding: 24px 22px 18px; }
  .brand h1 { font-size: 17px; }
}
