/* ===========================================================
   Страница сервера: экран входа + архив камер
   =========================================================== */

.stage {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 30px 22px 60px;
}

/* ---------- Экран входа ---------- */
.login {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 26px;
  align-items: stretch;
  min-height: calc(100vh - 160px);
}

/* левая «брендовая» панель с фото усадьбы */
.brand {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 48px 46px;
  isolation: isolate;
}
.brand__bg {
  position: absolute;
  inset: 0;
  z-index: -2;
  background: url("../img/manor-night.png") center/cover no-repeat;
  filter: saturate(.92) contrast(1.02);
  transform: scale(1.04);
}
.brand::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(8,10,7,.55) 0%, rgba(8,10,7,.35) 40%, rgba(8,10,7,.82) 100%),
    linear-gradient(90deg, rgba(8,10,7,.65) 0%, rgba(8,10,7,.12) 60%);
}
/* scanline-эффект «камеры» */
.brand::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,.18) 0 2px, transparent 2px 4px);
  mix-blend-mode: overlay;
  opacity: .5;
}

.brand__emblem {
  width: clamp(104px, 14vw, 126px);
  height: auto;
  margin: 0 auto -6px;
  filter: drop-shadow(0 6px 22px rgba(0,0,0,.6));
}
.brand__title {
  font-family: var(--font-head);
  font-weight: 700;
  text-transform: uppercase;
  line-height: .92;
  letter-spacing: .04em;
  font-size: clamp(34px, 5vw, 62px);
  color: #ece3cd;
  margin: 0;
  text-shadow: 0 3px 18px rgba(0,0,0,.6);
}
.brand__sub {
  font-family: var(--font-head);
  text-transform: uppercase;
  letter-spacing: .42em;
  font-size: 14px;
  color: #c8bd9f;
  margin: 9px 0 0;
  padding-left: .42em;
}
.brand__rule {
  height: 1px;
  width: min(320px, 72%);
  background: linear-gradient(90deg, transparent, #c8bd9f99, transparent);
  margin: 28px auto 22px;
}
.brand__server {
  font-family: var(--font-head);
  text-transform: uppercase;
  letter-spacing: .26em;
  font-size: clamp(15px, 2vw, 19px);
  color: #d7ccae;
  margin: 0;
  padding-left: .26em;
}
.brand__host {
  font-family: var(--font-mono);
  font-size: 15px;
  letter-spacing: .06em;
  color: var(--green);
  margin: 8px auto 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
}
.brand__host::before {
  content: "";
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--green-2); box-shadow: 0 0 8px var(--green-glow);
}

/* правая карта авторизации */
.auth {
  background: linear-gradient(180deg, #15190f 0%, #10130b 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 38px 40px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 30px 60px -30px rgba(0,0,0,.8);
}

.auth__lock {
  width: 62px; height: 62px;
  margin: 4px auto 18px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: var(--green-2);
  border: 1.5px solid #34421f;
  background: radial-gradient(circle at 50% 35%, #1e2714 0%, #141a0d 70%);
  box-shadow: 0 0 0 6px #ffffff05, inset 0 0 18px #0006;
}

.auth__title {
  font-family: var(--font-head);
  text-transform: uppercase;
  text-align: center;
  letter-spacing: .14em;
  font-weight: 700;
  font-size: clamp(24px, 3.4vw, 32px);
  margin: 0 0 8px;
  color: #ecefe2;
}
.auth__lead {
  text-align: center;
  color: var(--text-dim);
  font-size: 15px;
  margin: 0 auto;
  max-width: 30ch;
}

.auth__divider {
  height: 1px;
  background: var(--line-soft);
  margin: 26px 0 22px;
}

.session {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.session__icon {
  color: var(--green-2);
  margin-top: 2px;
  flex: none;
}
.session__head {
  font-family: var(--font-head);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-weight: 600;
  font-size: 16px;
  color: var(--green-2);
  margin: 0 0 4px;
}
.session__text {
  color: var(--text-dim);
  font-size: 14px;
  margin: 0;
}

/* таймер */
.timer {
  margin: 20px 0 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, #12160d 0%, #0e120a 100%);
  padding: 18px 20px 20px;
  text-align: center;
}
.timer__label {
  font-family: var(--font-head);
  text-transform: uppercase;
  letter-spacing: .26em;
  font-size: 12px;
  color: var(--text-faint);
  margin: 0 0 6px;
}
.timer__value {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: clamp(46px, 8vw, 64px);
  line-height: 1;
  letter-spacing: .06em;
  color: var(--green);
  text-shadow: 0 0 18px var(--green-glow);
}
.timer.is-warning .timer__value { color: var(--amber); text-shadow: 0 0 18px #d9a44155; }
.timer.is-danger  .timer__value { color: var(--red);   text-shadow: 0 0 18px #cf6a4455; animation: blink 1s steps(2,start) infinite; }
@keyframes blink { 50% { opacity: .35 } }

/* поле пароля */
.field { margin-bottom: 14px; }
.field__label {
  display: block;
  font-family: var(--font-head);
  text-transform: uppercase;
  letter-spacing: .16em;
  font-size: 12.5px;
  color: var(--text-dim);
  margin: 0 0 9px 2px;
}
.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.input-wrap input {
  width: 100%;
  background: #0d110a;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  letter-spacing: .04em;
  padding: 15px 50px 15px 16px;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.input-wrap input::placeholder { color: var(--text-faint); }
.input-wrap input:focus {
  outline: none;
  border-color: var(--green-3);
  box-shadow: 0 0 0 3px #93b06322;
}
.input-wrap.is-error input {
  border-color: var(--red);
  box-shadow: 0 0 0 3px #cf6a4422;
  animation: shake .4s;
}
@keyframes shake {
  10%,90% { transform: translateX(-1px) }
  20%,80% { transform: translateX(2px) }
  30%,50%,70% { transform: translateX(-4px) }
  40%,60% { transform: translateX(4px) }
}
.input-wrap__eye {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  padding: 8px;
  display: grid; place-items: center;
  border-radius: 7px;
}
.input-wrap__eye:hover { color: var(--green-2); background: #ffffff08; }

.auth__error {
  color: var(--red);
  font-size: 13.5px;
  margin: 0 0 14px;
  min-height: 18px;
  display: flex; align-items: center; gap: 7px;
  font-family: var(--font-mono);
}

.auth__notes {
  margin-top: 24px;
  display: grid;
  gap: 11px;
}
.auth__note {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  color: var(--text-faint);
  font-size: 13px;
}
.auth__note svg { flex: none; margin-top: 1px; color: var(--green-3); }

/* ---------- Оверлей «сессия истекла» ---------- */
.expired {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  background: rgba(6,8,5,.86);
  backdrop-filter: blur(4px);
  text-align: center;
  padding: 24px;
}
.expired__box {
  max-width: 420px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius);
  padding: 36px 32px;
}
.expired h2 {
  font-family: var(--font-head);
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--red);
  margin: 14px 0 8px;
}
.expired p { color: var(--text-dim); margin: 0 0 22px; }

/* ===========================================================
   Архив камер (после входа)
   =========================================================== */
.archive { animation: fadeUp .6s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px) } to { opacity: 1; transform: none } }

.archive__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #14180f 0%, #10130b 100%);
  margin-bottom: 22px;
}
.archive__status {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--font-head);
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--green);
  font-size: 17px;
}
.archive__status .status-dot { box-shadow: 0 0 10px var(--green-glow); }
.archive__meta {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-dim);
  display: flex; gap: 18px; flex-wrap: wrap;
}
.archive__meta b { color: var(--green-2); font-weight: 600; }

.archive__section-title {
  font-family: var(--font-head);
  text-transform: uppercase;
  letter-spacing: .2em;
  font-size: 14px;
  color: var(--text-dim);
  margin: 30px 0 14px;
  display: flex; align-items: center; gap: 12px;
}
.archive__section-title::after {
  content: ""; flex: 1; height: 1px; background: var(--line-soft);
}

.cams {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}
.cam {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: #0c0f08;
}
.cam__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 15px;
  border-bottom: 1px solid var(--line-soft);
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: .04em;
  color: var(--text-dim);
  background: #11150d;
}
.cam__head .rec {
  display: flex; align-items: center; gap: 7px;
  color: var(--red); font-weight: 600;
}
.cam__head .rec::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%;
  background: var(--red); animation: pulse 1.6s infinite;
}
.cam video { width: 100%; display: block; background: #000; aspect-ratio: 16/9; }
.cam__foot {
  padding: 10px 15px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-faint);
  border-top: 1px solid var(--line-soft);
  display: flex; justify-content: space-between; gap: 12px;
}

/* ---------- Дешифровка ---------- */
.decrypt {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: var(--bg);
  display: grid;
  place-items: center;
  padding: 24px;
}
.decrypt__box {
  width: min(560px, 100%);
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--green-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0c0f08;
  padding: 26px 28px;
  box-shadow: 0 0 60px -20px var(--green-glow);
}
.decrypt__line { white-space: pre-wrap; margin: 0; min-height: 1.5em; }
.decrypt__bar {
  height: 8px; border-radius: 5px; margin-top: 16px;
  background: #1a2014; overflow: hidden; border: 1px solid var(--line);
}
.decrypt__bar > i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--green-3), var(--green));
  box-shadow: 0 0 12px var(--green-glow);
  transition: width .15s linear;
}

/* ---------- Адаптив ---------- */
@media (max-width: 940px) {
  .login { grid-template-columns: 1fr; min-height: 0; }
  .brand { min-height: 300px; padding: 38px 32px; }
  .cams { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .stage { padding: 20px 14px 44px; }
  .auth { padding: 28px 22px; }
  .brand { padding: 30px 24px; }
}
