:root {
  --bg: #0f172a;
  --panel: #1e293b;
  --line: #334155;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --ok: #34d399;
  --bad: #f87171;
  --accent: #38bdf8;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 22px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
}
.brand { font-size: 20px; font-weight: 700; }
.topbar nav { display: flex; gap: 6px; flex-wrap: wrap; }
.topbar nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 8px;
}
.topbar nav a:hover { background: #273449; color: var(--text); }
.topbar nav a.on { background: #0ea5e9; color: #06283d; font-weight: 600; }
.mode { margin-left: auto; font-weight: 700; padding: 6px 14px; border-radius: 8px; font-size: 13px; }
.mode.dry { background: #064e3b; color: #6ee7b7; }
.mode.live { background: #7f1d1d; color: #fca5a5; }

main { max-width: 1100px; margin: 0 auto; padding: 22px; }

.flash { max-width: 1100px; margin: 14px auto 0; padding: 12px 18px; border-radius: 10px; font-weight: 600; }
.flash.ok { background: #064e3b; color: #6ee7b7; }
.flash.err { background: #7f1d1d; color: #fecaca; }

.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 18px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.card .k { color: var(--muted); font-size: 14px; }
.card .v { font-size: 30px; font-weight: 700; margin-top: 6px; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 20px; margin-top: 18px; }
.panel h2 { margin: 0 0 14px; font-size: 19px; }

.buttons { display: flex; gap: 12px; flex-wrap: wrap; }

.btn {
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: #06283d;
  font-weight: 700;
  font-size: 16px;
  padding: 14px 22px;
  cursor: pointer;
}
.btn:hover { filter: brightness(1.1); }
.btn.small { font-size: 14px; padding: 8px 14px; }
.btn.danger { background: #ef4444; color: #fff; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.presets { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }

form label { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--line); }
form label.check { justify-content: flex-start; }
form input[type="text"], form input[type="number"], form input[type="search"], form input[type="file"],
form input[type="email"], form input[type="password"] {
  background: #0f172a;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 15px;
  min-width: 200px;
}
form input.num { min-width: 110px; width: 110px; }
form label.stack { flex-direction: column; align-items: stretch; gap: 8px; }
form textarea {
  background: #0f172a;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
}
.panel h3 { margin-top: 22px; margin-bottom: 4px; }

.inline { display: inline-flex; gap: 8px; align-items: center; margin: 0; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }

table { width: 100%; border-collapse: collapse; margin-top: 12px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: 14px; }

.hint { color: var(--muted); font-size: 14px; margin-top: 12px; }
.muted { color: var(--muted); }
.ok { color: var(--ok); }
.bad { color: var(--bad); }
code { background: #0f172a; padding: 1px 6px; border-radius: 6px; }

.user { display: flex; align-items: center; gap: 10px; margin-left: 12px; color: var(--muted); font-size: 14px; }
.user .link { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 14px; padding: 4px 6px; }
.user .link:hover { text-decoration: underline; }

.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card {
  width: 100%; max-width: 400px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; padding: 28px;
}
.auth-card h1 { margin: 18px 0 18px; font-size: 22px; }
.auth-card form label { flex-direction: column; align-items: stretch; gap: 6px; border-bottom: none; }
.auth-card form input { width: 100%; min-width: 0; }
.auth-card .btn { width: 100%; margin-top: 14px; }
.auth-alt { color: var(--muted); font-size: 14px; margin: 16px 0 0; text-align: center; }
.auth-alt a { color: var(--accent); }
.auth-card .flash { margin: 0 0 12px; }

/* --- Billing --- */
.sub-status { display: flex; flex-wrap: wrap; gap: 24px; margin-top: 12px; }
.sub-status > div { display: flex; flex-direction: column; gap: 4px; }
.sub-status strong { font-size: 16px; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-top: 16px; }
.plan-card { border: 1px solid var(--line); border-radius: 14px; padding: 18px; background: var(--panel); }
.plan-card.current { border-color: var(--accent); }
.plan-card h3 { margin: 0 0 8px; }
.plan-card .price { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.plan-card form { margin-top: 12px; }
.link { color: var(--accent); }
.ok-text { color: var(--ok); }
.err-text { color: var(--bad); }

/* --- noVNC modal (удалённый вход в кабинет) --- */
.modal {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(2, 6, 23, 0.78);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal-box {
  width: min(1100px, 96vw); height: min(780px, 92vh);
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px 16px; border-bottom: 1px solid var(--line); font-weight: 600;
}
#vnc-frame { flex: 1; width: 100%; border: 0; background: #000; }

