/* ============================================================
   СМП ЕНЦ ПК — стиль веб-интерфейса
   Система прямой связи (в разработке)
   ============================================================ */

:root {
  --bg: #0a0f1a;
  --bg-2: #101827;
  --panel: #182136;
  --panel-2: #1f2a44;
  --border: #2a3654;
  --border-2: #38466b;
  --red: #b91c1c;
  --red-2: #dc2626;
  --red-3: #7f1d1d;
  --gold: #f0b429;
  --gold-2: #fbbf24;
  --text: #e8edf7;
  --muted: #8fa0be;
  --muted-2: #64748b;
  --green: #4ade80;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.35);
  --shadow: 0 4px 16px rgba(0,0,0,.30);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.50);
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

[data-theme="light"] {
  --bg: #eef1f6;
  --bg-2: #e3e7ee;
  --panel: #f7f8fb;
  --panel-2: #eceff4;
  --border: #d4dae3;
  --border-2: #b8c0cc;
  --text: #1f2937;
  --muted: #6b7280;
  --muted-2: #9ca3af;
  --gold: #4b5563;
  --gold-2: #374151;
  --red: #4b5563;
  --red-2: #6b7280;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  min-height: 100vh;
  min-height: 100dvh;
}

html { background: var(--bg); }

body {
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

a { color: var(--gold-2); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Шапка ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  height: 60px;
  background: rgba(16, 24, 39, 0.92);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.topbar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.topbar .brand .logo-wrap {
  width: 42px; height: 42px;
  border-radius: 10px;
  background: #050810;
  border: 1.5px solid var(--gold);
  padding: 3px;
  display: flex; align-items: center; justify-content: center;
  flex: 0 0 auto;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(240,180,41,.15), inset 0 0 8px rgba(240,180,41,.1);
}

.topbar .brand .logo-wrap .logo-img {
  width: 100%; height: 100%;
  object-fit: contain; display: block;
}

.topbar .brand .title {
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .2px;
  line-height: 1.15;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar .brand .title small {
  display: block;
  color: var(--muted);
  font-weight: 400;
  font-size: 10.5px;
  letter-spacing: 0;
  margin-top: 2px;
}

.topbar .icon-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex: 0 0 auto;
}

.topbar .icon-btn {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  padding: 0;
  font-family: inherit;
  transition: background .15s, border-color .15s, color .15s, transform .1s;
}
.topbar .icon-btn:hover {
  border-color: var(--gold);
  color: var(--gold-2);
  background: var(--panel);
}
.topbar .icon-btn:active { transform: scale(.95); }
.topbar .icon-btn svg {
  width: 20px; height: 20px;
  stroke: currentColor; stroke-width: 1.8;
  fill: none; stroke-linecap: round; stroke-linejoin: round;
}

/* Кнопка вызова — красно-бордовая */
.topbar .icon-btn.call-btn {
  background: linear-gradient(180deg, #b91c1c, #7f1d1d);
  border: 1px solid #dc2626;
  color: #fff;
  box-shadow: 0 2px 10px rgba(185, 28, 28, 0.45);
}
.topbar .icon-btn.call-btn:hover {
  background: linear-gradient(180deg, #dc2626, #991b1b);
  border-color: var(--gold);
  color: #fff;
  filter: brightness(1.1);
  box-shadow: 0 4px 22px rgba(185, 28, 28, 0.7);
}
.topbar .icon-btn.call-btn svg {
  stroke: #fff;
}

/* Индикатор связи */
.net-status {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px rgba(74,222,128,.6);
  flex: 0 0 auto;
  transition: background .2s, box-shadow .2s;
}
.net-status.offline {
  background: #f87171;
  box-shadow: 0 0 8px rgba(248,113,113,.6);
}
.net-status.reconnecting {
  background: #fbbf24;
  box-shadow: 0 0 8px rgba(251,191,36,.6);
  animation: pulseDot 1.2s infinite;
}
@keyframes pulseDot {
  0%,100% { opacity: 1; }
  50%     { opacity: .35; }
}

/* Плашка "в разработке" */
.dev-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: linear-gradient(90deg, rgba(240,180,41,.12), rgba(220,38,38,.08));
  border-bottom: 1px solid rgba(240,180,41,.25);
  color: var(--gold-2);
  font-size: 12px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-weight: 600;
}
.dev-banner .dev-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--gold-2);
  box-shadow: 0 0 10px var(--gold-2);
  animation: pulseDot 1.5s infinite;
  flex-shrink: 0;
}
.dev-banner .dev-meta {
  margin-left: auto;
  color: var(--muted);
  font-size: 10.5px;
  text-transform: none;
  letter-spacing: .5px;
  font-weight: 400;
}

/* ---------- Контейнер ---------- */
main {
  flex: 1 1 auto;
  padding: 20px;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

/* ---------- Заголовок программы ---------- */
.app-title {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.app-title .app-top {
  font-size: 11px;
  color: var(--gold-2);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 6px;
  font-weight: 600;
}
.app-title h1 {
  font-size: 22px;
  margin: 0 0 4px;
  color: var(--text);
  font-weight: 700;
  letter-spacing: .5px;
}
.app-title .app-sub {
  font-size: 12.5px;
  color: var(--muted);
  letter-spacing: 1px;
}
.app-title .app-sub strong {
  color: var(--gold-2);
  font-weight: 600;
}

/* ---------- Статус Asterisk ---------- */
.ast-status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 13px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
  background: var(--panel);
  transition: all .3s;
}
.ast-status.alive { border-color: rgba(74,222,128,.4); background: rgba(20,50,40,.35); }
.ast-status.dead  { border-color: rgba(248,113,113,.4); background: rgba(60,20,30,.35); }
.ast-status .ast-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: #f87171;
  box-shadow: 0 0 10px #f87171;
  flex-shrink: 0;
}
.ast-status.alive .ast-dot {
  background: var(--green);
  box-shadow: 0 0 10px var(--green);
  animation: pulseDot 2s infinite;
}
.ast-status.dead .ast-dot {
  background: #f87171;
  box-shadow: 0 0 10px #f87171;
  animation: pulseDot 1s infinite;
}
.ast-status .ast-text { color: var(--text); }
.ast-status .ast-text strong { color: var(--text); font-weight: 600; }
.ast-status .ast-text small { color: var(--muted); display: block; font-size: 11px; margin-top: 2px; }

/* ---------- Статистика ---------- */
.stats { display: flex; gap: 12px; margin-bottom: 24px; flex-wrap: wrap; }
.stat-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 22px;
  min-width: 130px;
}
.stat-box .label {
  color: var(--muted); font-size: 11px;
  text-transform: uppercase; letter-spacing: 1px;
}
.stat-box .value {
  color: var(--text); font-size: 24px;
  font-weight: 700; margin-top: 4px;
}
.stat-box.online .value  { color: var(--green); }
.stat-box.inuse  .value  { color: #f87171; }
.stat-box.offline .value { color: var(--muted); }

/* ---------- Сетка плиток ---------- */
.section-title {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin: 22px 0 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}
.section-title:first-child { margin-top: 4px; }
.section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border), transparent);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.phone-card {
  padding: 16px;
  border-radius: 14px;
  background: linear-gradient(145deg, var(--panel), var(--bg-2));
  border: 1px solid var(--border);
  transition: all .3s;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  min-height: 118px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.phone-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
}
.phone-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--border-2);
}
.phone-card .pc-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  line-height: 1.25;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.phone-card .pc-ext {
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: .5px;
}
.phone-card .pc-status {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}
.phone-card .pc-status .dot-s {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.phone-card .pc-offline-time {
  font-size: 11px;
  color: var(--muted-2);
  margin-top: 4px;
}

/* Статусы */
.phone-card.NOT_INUSE::before  { background: var(--green); box-shadow: 0 0 15px var(--green); }
.phone-card.NOT_INUSE          { background: linear-gradient(145deg, rgba(20,50,40,.85), rgba(10,25,20,.85)); }
.phone-card.NOT_INUSE .pc-status .dot-s { background: var(--green); }

.phone-card.BUSY::before,
.phone-card.INUSE::before      { background: #f87171; box-shadow: 0 0 20px #f87171; }
.phone-card.BUSY,
.phone-card.INUSE              { background: linear-gradient(145deg, rgba(60,20,30,.85), rgba(30,10,15,.85)); }
.phone-card.BUSY .pc-status .dot-s,
.phone-card.INUSE .pc-status .dot-s { background: #f87171; }

.phone-card.RINGING::before    { background: #fbbf24; }
.phone-card.RINGING            { background: linear-gradient(145deg, rgba(60,50,20,.85), rgba(30,25,10,.85)); }
.phone-card.RINGING .pc-status .dot-s { background: #fbbf24; }

.phone-card.RINGINUSE::before  { background: #fb923c; }
.phone-card.RINGINUSE          { background: linear-gradient(145deg, rgba(60,35,15,.85), rgba(30,18,8,.85)); }
.phone-card.RINGINUSE .pc-status .dot-s { background: #fb923c; }

.phone-card.ONHOLD::before,
.phone-card.HOLD::before       { background: #a78bfa; }
.phone-card.ONHOLD,
.phone-card.HOLD               { background: linear-gradient(145deg, rgba(40,25,60,.85), rgba(20,12,30,.85)); }
.phone-card.ONHOLD .pc-status .dot-s,
.phone-card.HOLD .pc-status .dot-s { background: #a78bfa; }

.phone-card.UNAVAILABLE::before { background: #475569; }
.phone-card.UNAVAILABLE         { opacity: .6; }
.phone-card.UNAVAILABLE .pc-status .dot-s { background: #475569; }

.phone-card.UNKNOWN::before { background: #607d8b; }

/* ---------- Модальные окна ---------- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}
.modal-overlay.active { display: flex; }

.modal {
  background: linear-gradient(145deg, var(--panel), var(--bg-2));
  border: 2px solid var(--gold);
  border-radius: 18px;
  padding: 28px 26px 24px;
  max-width: 520px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  position: relative;
  animation: modalIn .25s ease;
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
}
@keyframes modalIn {
  from { transform: scale(.94); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
.modal-wide { max-width: 680px; }

.modal-close {
  position: absolute;
  top: 12px; right: 16px;
  background: transparent;
  border: none;
  color: var(--gold-2);
  font-size: 26px;
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
  transition: color .2s;
}
.modal-close:hover { color: var(--text); }

.modal-title {
  color: var(--gold-2);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 8px;
  font-weight: 600;
}
.modal-h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 6px;
  letter-spacing: .5px;
}
.modal-sub {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 20px;
}
.modal-status {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 18px;
}

.modal-info-row {
  display: flex;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}
.modal-info-row:last-child { border-bottom: none; }
.modal-info-row .info-label {
  color: var(--muted);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .8px;
  min-width: 120px;
  flex-shrink: 0;
  padding-top: 2px;
}
.modal-info-row .info-value {
  color: var(--text);
  font-size: 14px;
  flex: 1;
  word-break: break-word;
}

/* Кнопки в модале */
.modal-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  border: none;
  letter-spacing: .3px;
  transition: filter .15s, transform .1s;
  margin-top: 10px;
}
.modal-btn:active { transform: scale(.98); }
.modal-btn.primary {
  background: linear-gradient(180deg, var(--red-2), var(--red));
  color: #fff;
  box-shadow: 0 2px 8px rgba(185,28,28,.3);
}
.modal-btn.primary:hover { filter: brightness(1.08); }
.modal-btn.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.modal-btn.ghost:hover { border-color: var(--gold); color: var(--gold-2); }
.modal-btn svg {
  width: 18px; height: 18px;
  stroke: currentColor; stroke-width: 1.8; fill: none;
  stroke-linecap: round; stroke-linejoin: round;
}

/* ---------- Вкладки телефона ---------- */
.phone-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 18px;
  overflow-x: auto;
}
.phone-tab {
  flex: 1;
  padding: 10px 8px;
  border-radius: 9px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  letter-spacing: .2px;
}
.phone-tab:hover { color: var(--text); }
.phone-tab.active {
  background: var(--panel-2);
  color: var(--gold-2);
  box-shadow: var(--shadow-sm);
}

.phone-tab-content { display: none; }
.phone-tab-content.active { display: block; }

/* ---------- Ввод номера ---------- */
.dial-input {
  width: 100%;
  padding: 16px 18px;
  border-radius: 14px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: inherit;
  font-size: 22px;
  font-weight: 600;
  text-align: center;
  letter-spacing: 3px;
  outline: none;
  transition: border-color .15s;
  margin-bottom: 14px;
}
.dial-input:focus { border-color: var(--gold); }

.dial-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.dial-key {
  aspect-ratio: 1.4 / 1;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: inherit;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  transition: all .1s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.dial-key:hover { border-color: var(--gold); color: var(--gold-2); background: var(--panel-2); }
.dial-key:active { transform: scale(.95); }
.dial-key small {
  font-size: 9px;
  color: var(--muted);
  font-weight: 400;
  letter-spacing: 1px;
  margin-top: 2px;
}

/* ---------- Запись голоса ---------- */
.recorder-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 20px 0;
}
.rec-btn {
  width: 90px; height: 90px;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--red-2), var(--red));
  border: 3px solid rgba(240,180,41,.4);
  color: #fff;
  font-size: 32px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all .2s;
  box-shadow: 0 6px 20px rgba(185,28,28,.4);
}
.rec-btn:hover { filter: brightness(1.1); }
.rec-btn.recording {
  background: linear-gradient(180deg, #4ade80, #16a34a);
  animation: redPulse 1.2s infinite;
}
@keyframes redPulse {
  0%,100% { box-shadow: 0 6px 20px rgba(185,28,28,.4); }
  50%     { box-shadow: 0 6px 40px rgba(185,28,28,.8); }
}
.rec-timer {
  font-size: 32px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: 2px;
}
.rec-hint {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  letter-spacing: .3px;
}
.rec-audio { width: 100%; margin-top: 8px; }
.rec-audio audio { width: 100%; }

/* ---------- Телефонная книга ---------- */
.book-search {
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  margin-bottom: 14px;
  transition: border-color .15s;
}
.book-search:focus { border-color: var(--gold); }

.book-list {
  max-height: 420px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 4px;
}
.book-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.book-item:hover {
  border-color: var(--gold);
  background: var(--panel-2);
}
.book-item .book-ext {
  font-weight: 700;
  font-size: 14px;
  color: var(--gold-2);
  min-width: 56px;
  flex-shrink: 0;
}
.book-item .book-info { flex: 1; min-width: 0; }
.book-item .book-name {
  font-size: 13px;
  color: var(--text);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.book-item .book-addr {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.book-item .book-call {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(180deg, #4ade80, #16a34a);
  border: none;
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform .1s;
}
.book-item .book-call:hover { transform: scale(1.08); }
.book-item .book-call svg {
  width: 16px; height: 16px;
  stroke: currentColor; stroke-width: 2;
  fill: none; stroke-linecap: round; stroke-linejoin: round;
}
.book-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

/* ---------- История ---------- */
.history-list {
  max-height: 420px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 4px;
}
.history-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--panel);
  border: 1px solid var(--border);
}
.history-item .hi-icon {
  width: 34px; height: 34px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: rgba(74,222,128,.12);
  color: var(--green);
}
.history-item.missed .hi-icon { background: rgba(248,113,113,.12); color: #f87171; }
.history-item.outgoing .hi-icon { background: rgba(96,165,250,.12); color: #93c5fd; }
.history-item .hi-icon svg {
  width: 16px; height: 16px;
  stroke: currentColor; stroke-width: 1.8;
  fill: none; stroke-linecap: round; stroke-linejoin: round;
}
.history-item .hi-info { flex: 1; min-width: 0; }
.history-item .hi-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.history-item .hi-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }
.history-item .hi-time { font-size: 11px; color: var(--muted-2); flex-shrink: 0; }

/* ---------- Коды ---------- */
.codes-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 4px;
}
.code-item {
  padding: 14px 16px;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--panel), var(--bg-2));
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all .2s;
  position: relative;
}
.code-item:hover {
  border-color: var(--gold);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.code-item .code-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.code-item .code-value {
  font-family: 'Courier New', monospace;
  font-size: 18px;
  font-weight: 700;
  color: var(--gold-2);
  background: rgba(240,180,41,.1);
  padding: 4px 12px;
  border-radius: 8px;
  border: 1px solid rgba(240,180,41,.3);
  letter-spacing: 1px;
}
.code-item .code-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
  padding-right: 90px;
}
.code-item .code-desc {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.4;
  margin-top: 4px;
  padding-right: 90px;
}
.code-item .code-type {
  display: inline-block;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 2px 8px;
  border-radius: 6px;
  margin-top: 8px;
  font-weight: 600;
}
.code-item .code-type.group {
  background: rgba(96,165,250,.15);
  color: #93c5fd;
  border: 1px solid rgba(96,165,250,.3);
}
.code-item .code-type.playback {
  background: rgba(251,191,36,.15);
  color: var(--gold-2);
  border: 1px solid rgba(251,191,36,.3);
}
.code-item .code-type.record {
  background: rgba(220,38,38,.15);
  color: #fca5a5;
  border: 1px solid rgba(220,38,38,.3);
}
.code-item .code-activate {
  position: absolute;
  top: 14px; right: 14px;
  padding: 6px 14px;
  border-radius: 8px;
  background: linear-gradient(180deg, var(--red-2), var(--red));
  color: #fff;
  border: none;
  font-size: 12px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  letter-spacing: .5px;
  transition: filter .15s, transform .1s;
}
.code-item .code-activate:hover { filter: brightness(1.1); }
.code-item .code-activate:active { transform: scale(.96); }

/* ---------- Подвал ---------- */
footer {
  margin-top: 40px;
  padding: 20px;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--muted-2);
  font-size: 11.5px;
  letter-spacing: 1px;
}
footer .footer-title {
  color: var(--gold-2);
  font-weight: 600;
  letter-spacing: 2px;
  margin-bottom: 4px;
}
footer .footer-sub {
  color: var(--muted);
  font-size: 10.5px;
  letter-spacing: .8px;
}

/* ---------- Адаптив ---------- */
@media (max-width: 520px) {
  .topbar { padding: 0 10px; gap: 8px; height: 56px; }
  .topbar .brand .title { font-size: 13px; }
  .topbar .brand .title small { font-size: 9.5px; }
  .topbar .brand .logo-wrap { width: 36px; height: 36px; }
  .topbar .icon-btn { width: 36px; height: 36px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
  .phone-card { padding: 12px; min-height: 104px; }
  .phone-card .pc-name { font-size: 13px; }
  .modal { padding: 22px 18px; }
  .modal-info-row .info-label { min-width: 90px; font-size: 10.5px; }
  .app-title h1 { font-size: 17px; }
  .dev-banner { font-size: 10px; letter-spacing: 1px; padding: 6px 10px; }
  .dev-banner .dev-meta { display: none; }
}

/* ---------- Доступ и вспомогательные классы ---------- */
[hidden] { display: none !important; }
footer .footer-tech { margin-top: 6px; }
.topbar .logout-form { margin: 0; display: contents; }
.topbar .brand .logo-wrap.logo-fallback {
  background: radial-gradient(circle at 30% 30%, #f0b429, #b91c1c);
}
.logo-fallback-text { color: #fff; font-weight: 900; font-size: 11px; }

.login-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
}
.login-card { animation: none; }
.login-label {
  display: block;
  color: var(--muted);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .8px;
  margin: 12px 0 6px;
}
.login-input {
  font-size: 16px;
  letter-spacing: 0;
  text-align: left;
  padding: 12px 14px;
  margin-bottom: 4px;
}
.login-error {
  color: #fecaca;
  background: rgba(185,28,28,.25);
  border: 1px solid var(--red-2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
  margin: 8px 0;
}
