:root {
  --bg: #03101c;
  --bg2: #06202f;
  --panel: rgba(9, 40, 58, .72);
  --line: rgba(72, 214, 232, .25);
  --cyan: #4ee6d2;
  --blue: #62c4ff;
  --amber: #ffb454;
  --red: #ff6d6d;
  --dim: #6f9aa8;
  --text: #d7f0f4;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(ellipse at 50% -20%, #0a3550 0%, var(--bg) 60%);
  color: var(--text);
  font-family: "Cascadia Mono", "Consolas", "Courier New", monospace;
  font-size: 15px;
}

.scanlines {
  pointer-events: none;
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,.14) 0 1px, transparent 1px 3px);
  opacity: .5;
  z-index: 9;
}

/* ---------- login ---------- */
.login-body { display: flex; align-items: center; justify-content: center; }
.terminal { width: min(520px, 94vw); }
.terminal .logo, .topbar .logo {
  color: var(--cyan);
  letter-spacing: .12em;
  font-weight: bold;
}
.terminal .sub { color: var(--dim); letter-spacing: .08em; margin-top: 4px; }
.terminal header { text-align: center; margin-bottom: 26px; }
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 18px;
  box-shadow: 0 0 24px rgba(78, 230, 210, .06) inset;
}
.hint { color: var(--dim); line-height: 1.5; }
#login-form { display: flex; gap: 10px; margin-top: 14px; }
#code {
  flex: 1;
  background: rgba(0,0,0,.35);
  border: 1px solid var(--line);
  color: var(--cyan);
  font: inherit;
  font-size: 22px;
  letter-spacing: .35em;
  text-align: center;
  padding: 10px;
  border-radius: 4px;
  outline: none;
}
#code:focus { border-color: var(--cyan); box-shadow: 0 0 12px rgba(78,230,210,.25); }
button {
  background: linear-gradient(180deg, rgba(78,230,210,.25), rgba(78,230,210,.08));
  border: 1px solid var(--cyan);
  color: var(--cyan);
  font: inherit;
  letter-spacing: .15em;
  padding: 10px 18px;
  border-radius: 4px;
  cursor: pointer;
}
button:hover { background: rgba(78,230,210,.3); }
.ghost { background: none; border-color: var(--line); color: var(--dim); }
.ghost:hover { color: var(--text); border-color: var(--cyan); }
.msg { min-height: 1.4em; color: var(--amber); margin-top: 12px; }
.terminal footer { margin-top: 18px; color: var(--dim); text-align: center; font-size: 12px; }

/* ---------- station ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--bg2);
  position: sticky;
  top: 0;
  z-index: 5;
}
.topbar .sub { color: var(--dim); }
.crew { display: flex; gap: 8px; flex: 1; flex-wrap: wrap; }
.crew button {
  padding: 5px 12px;
  letter-spacing: .05em;
  border-color: var(--line);
  color: var(--text);
  background: rgba(0,0,0,.25);
}
.crew button.active { border-color: var(--cyan); color: var(--cyan); }

main { max-width: 1100px; margin: 0 auto; padding: 18px; }
.hero-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px; }
.hero-title { font-size: 24px; color: var(--cyan); letter-spacing: .1em; }
.hero-rank { color: var(--dim); margin-top: 4px; }
.link-status { color: var(--dim); }
.link-status.stale { color: var(--red); animation: blink 1.6s infinite; }
@keyframes blink { 50% { opacity: .45; } }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 860px) { .grid { grid-template-columns: 1fr; } }

.panel h3 {
  margin: 0 0 10px;
  color: var(--blue);
  font-size: 13px;
  letter-spacing: .22em;
}
.vitals h3 + h3 { margin-top: 18px; }
.vital { display: flex; align-items: baseline; gap: 10px; padding: 6px 0; }
.vlabel { color: var(--dim); width: 130px; letter-spacing: .08em; }
.vval { color: var(--cyan); font-size: 26px; }
.vval.vsmall { font-size: 14px; color: var(--text); }
.vunit { color: var(--dim); font-size: 12px; }
#chart { width: 100%; height: auto; margin-top: 4px; }

.diary { max-height: 460px; overflow-y: auto; padding-right: 6px; }
.entry { border-left: 2px solid var(--line); padding: 6px 0 6px 12px; margin-bottom: 10px; }
.entry .ets { color: var(--dim); font-size: 12px; }
.entry .etext { margin-top: 3px; line-height: 1.45; white-space: pre-wrap; }
.entry .enum { color: var(--cyan); font-size: 12px; margin-top: 3px; }
.dim { color: var(--dim); }

.foot {
  display: flex;
  justify-content: space-between;
  padding: 14px 4px 30px;
  color: var(--dim);
  font-size: 13px;
}

/* ---- учётки абонентов ---- */
.acc-create { display: flex; gap: 8px; margin: 12px 0; flex-wrap: wrap; }
.acc-create input, .acc-create select {
  background: #0b1420; color: #d7e5ee; border: 1px solid #2a4553;
  border-radius: 8px; padding: 8px 10px; font: inherit;
}
.acc-create button {
  background: #145a76; color: #dff5fb; border: 1px solid #2a4553;
  border-radius: 8px; padding: 8px 14px; font: inherit; cursor: pointer;
}
.acc-table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 13px; }
.acc-table th, .acc-table td { text-align: left; padding: 7px 9px; border-bottom: 1px solid rgba(72,214,232,.14); }
.acc-table th { color: #6f9aa8; font-weight: normal; text-transform: uppercase; font-size: 11px; }
.acc-actions button {
  background: #102a38; color: #bfe3ee; border: 1px solid #2a4553;
  border-radius: 6px; padding: 4px 8px; font-size: 12px; cursor: pointer; margin-right: 4px;
}
.qr-modal {
  position: fixed; inset: 0; background: rgba(2,10,16,.82);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.qr-card {
  background: #0d1a26; border: 1px solid #2a4553; border-radius: 16px;
  padding: 20px 24px; max-width: 92vw; text-align: center;
}
.qr-card .hero-title { font-size: 18px; margin-bottom: 12px; }
.qr-box { display: inline-block; padding: 10px; background: #fff; border-radius: 8px; }
.qr-card textarea {
  width: 100%; box-sizing: border-box; height: 72px; margin-top: 12px;
  background: #0b1420; color: #9fc2d2; border: 1px solid #2a4553;
  border-radius: 8px; font: 11px/1.4 Consolas, monospace; padding: 8px;
}
.qr-card button { margin-top: 10px; }

/* атрибут hidden сильнее авторских display:flex/grid (окно QR, разделы) */
[hidden] { display: none !important; }

/* ---- период и привязка героя ---- */
.hero-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.hero-head-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.periods { display: flex; gap: 4px; }
.periods button {
  background: #102a38; color: #9fc2d2; border: 1px solid #2a4553;
  border-radius: 6px; padding: 3px 10px; font-size: 12px; cursor: pointer;
}
.periods button.active { background: #145a76; color: #dff5fb; }
.acc-table input[data-hero-input] {
  background: #0b1420; color: #d7e5ee; border: 1px solid #2a4553;
  border-radius: 6px; padding: 3px 6px; font: 12px Consolas, monospace;
}
