/* ====== БАЗА / ТЕМЫ ====== */
:root{
  --bg: #0b0f19;
  --card: rgba(255,255,255,0.06);
  --card-border: rgba(255,255,255,0.12);
  --text: #e7eaf3;
  --muted: #aab3c5;
  --primary: #6ea8fe;    /* спокойный синий */
  --primary-hover: #4d90fe;
  --ring: rgba(110,168,254,0.55);
  --error-bg: #2a1114;
  --error-text: #ff7b8a;
  --success-bg: #122415;
  --success-text: #82e29b;
}

@media (prefers-color-scheme: light){
  :root{
  --bg: #f6f8fc;
  --card: rgba(255,255,255,0.9);
  --card-border: rgba(17,24,39,0.08);
  --text: #1e293b;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --ring: rgba(37,99,235,0.35);
  --error-bg: #ffeded;
  --error-text: #c62828;
  --success-bg: #e8f5e9;
  --success-text: #1b5e20;
  }
}

/* Сброс + типографика */
*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height:1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ====== ФОН С БЛЁР-ГРАДИЕНТАМИ ====== */
.auth-page .bg-decor,
.admin-page .bg-decor{
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
  radial-gradient(40rem 40rem at 20% 10%, rgba(99,102,241,0.25), transparent 60%),
  radial-gradient(35rem 35rem at 80% 20%, rgba(16,185,129,0.22), transparent 60%),
  radial-gradient(30rem 30rem at 70% 80%, rgba(59,130,246,0.20), transparent 60%);
  filter: blur(50px) saturate(140%);
}

/* ====== ЦЕНТРОВКА КАРТОЧКИ ====== */
.login-wrapper{
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 24px;
}

/* ====== КАРТОЧКА ЛОГИНА ====== */
.login-card{
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  padding: 28px;
  box-shadow:
  0 20px 60px rgba(0,0,0,0.35),
  inset 0 1px 0 rgba(255,255,255,0.04);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: floatIn .5s ease both;
}

@keyframes floatIn{
  from{ opacity:0; transform: translateY(6px) scale(0.98); }
  to{ opacity:1; transform: translateY(0) scale(1); }
}

/* ====== БРЕНД ====== */
.brand{
  text-align:center;
  margin-bottom: 18px;
}
.logo{
  width: 68px;
  height: 68px;
  display:inline-grid;
  place-items:center;
  border-radius: 50px;
  background: linear-gradient(135deg, rgba(99,102,241,0.8), rgba(16,185,129,0.8));*/
  margin: 0 auto 12px;
  margin-bottom: 10px;
  padding: 10px;
  font-size: 22px;
  opacity: 0.8;
}
.brand-title{
  margin:0;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: .3px;
}
.brand-subtitle{
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

/* ====== ФОРМА ====== */
.form{
  display: grid;
  gap: 12px;
  margin-top: 12px;
}
.input-wrap{
  position: relative;
}
.input-wrap input{
  width: 100%;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  padding: 0 14px;
  outline: none;
  transition: box-shadow .2s, border-color .2s, background .2s;
}
.input-wrap input::placeholder{
  color: var(--muted);
}
.input-wrap input:focus{
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--ring);
  background: rgba(255,255,255,0.06);
}

.password-wrap .icon-btn{
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
}

/* ====== КНОПКИ ====== */
.btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .05s ease, background .2s ease, border-color .2s ease, box-shadow .2s ease;
  text-decoration: none;
  user-select: none;
}
.btn:active{ transform: translateY(1px); }

.btn-primary{
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover{
  background: var(--primary-hover);
}

.btn-ghost{
  background: transparent;
  border-color: var(--card-border);
  color: var(--text);
}
.btn-ghost:hover{
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--ring);
}

.icon-btn{
  width: 36px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--card-border);
  background: rgba(255,255,255,0.04);
  color: var(--muted);
  cursor: pointer;
}
.icon-btn:hover{
  border-color: var(--primary);
  color: var(--text);
}

/* helpers */
.w-full{ width: 100%; }
.sr-only{
  position:absolute!important;
  height:1px;width:1px;
  overflow:hidden;clip:rect(1px,1px,1px,1px);
  white-space:nowrap;border:0;padding:0;margin:-1px;
}

/* ====== РАЗДЕЛИТЕЛЬ ====== */
.divider{
  display:flex; align-items:center; gap:12px;
  margin: 16px 0 10px;
  color: var(--muted);
  font-size: 12px;
}
.divider::before, .divider::after{
  content:"";
  height:1px; flex:1;
  background: var(--card-border);
}
.divider span{ opacity:.9; }

/* ====== TELEGRAM OTP ====== */
.otp-block{
  display:grid;
  gap:10px;
  transition: opacity .25s ease, max-height .25s ease;
}
.hidden{ opacity:0; max-height:0; overflow:hidden; }
.show{ opacity:1; max-height:180px; }
.hint{
  margin:0 0 2px;
  color: var(--muted);
  font-size: 13px;
}

/* ====== СООБЩЕНИЯ ====== */
.message{
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  background: rgba(255,255,255,0.03);
  font-size: 14px;
  display:none; /* твой JS может переключать .show */
}
.message.show{ display:block; }

.message.error{
  background: var(--error-bg);
  color: var(--error-text);
  border-color: rgba(255, 0, 64, 0.25);
}
.message.success{
  background: var(--success-bg);
  color: var(--success-text);
  border-color: rgba(0, 255, 128, 0.18);
}

/* ====== НИЗ КАРТОЧКИ ====== */
.legal{
  margin-top: 14px;
  color: var(--muted);
  text-align:center;
  font-size: 12px;
}

/* ====== ОБОЛОЧКА АДМИНКИ ====== */
.admin-page .topbar{
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  background: linear-gradient(to right, rgba(255,255,255,0.06), rgba(255,255,255,0.03));
  border-bottom: 1px solid var(--card-border);
}
.topbar-left{ display:flex; align-items:center; gap:12px; }
.topbar .logo{
  width: 36px; height: 36px; border-radius: 10px;
  display:grid; place-items:center;
  background: linear-gradient(135deg, rgba(99,102,241,0.8), rgba(16,185,129,0.8));
  font-size: 18px;
}
.brand-col{ display:flex; flex-direction:column; }
.topbar .brand-title{ margin:0; font-size:16px; font-weight:700; }
.topbar .brand-subtitle{ margin:2px 0 0; font-size:12px; color:var(--muted); }

.admin-shell{
  max-width: 1200px;
  margin: 24px auto 40px;
  padding: 0 16px;
}

/* ====== СЕТКА / КАРТОЧКИ ====== */
.grid{
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 980px){
  .grid{
  grid-template-columns: 1fr; /* обе карточки на всю ширину */
  }
}

.card{
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.25);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.card-wide{ grid-column: 1/-1; }
.card-head{
  padding: 16px 16px 10px;
  border-bottom: 1px solid var(--card-border);
}
.card-title{
  margin: 0;
  font-size: 18px;
}
.card-body{ padding: 16px; }
.row-between{ display:flex; align-items:center; justify-content:space-between; gap:12px; }
.table-tools{ display:flex; align-items:center; gap:10px; }

/* ====== ИНПУТЫ/ЛЕЙБЛЫ В КАРТОЧКАХ ====== */
.card .form .input-wrap label{
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
}
.card .actions{ margin-top: 6px; }

/* ====== ТАБЛИЦА + ОБЁРТКА ====== */
.table-wrap{ width:100%; overflow:auto; border-radius: 12px; }
table{ background: transparent; width: 100%; border-collapse: separate; border-spacing: 0; }

thead th{
  position: sticky;
  top: 0;
  z-index: 1;
  background: linear-gradient(0deg, rgba(255,255,255,0.08), rgba(255,255,255,0.06));
  color: var(--muted);
  text-transform: none;
  font-weight: 600;
  font-size: 12.5px;
  letter-spacing: .02em;
  padding: 12px 16px;
  border-bottom: 2px solid var(--card-border); /* полоса-разделитель */
}

tbody td{
  padding: 12px 16px;
  border-bottom: 1px solid var(--card-border); /* разделяем каждого пользователя */
  vertical-align: top;
}

tbody tr{
  transition: background .15s ease;
}
tbody tr:hover{
  background: rgba(255,255,255,0.06); /* лёгкий подсвет при ховере */
}

td .code, .code{
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 12.5px;
  word-break: break-all;
}

/* Блок ключа */
.key-block{
  display: grid;
  gap: 6px;
}
.connection-link{
  width: 100%;
  min-height: 70px;
  background: rgba(255,255,255,0.04);
  border-radius: 12px;
  border: 1px solid var(--card-border);
  color: var(--text);
  padding: 10px 12px;
  resize: vertical;
}

/* Ячейка действий */
.table-actions{
  white-space: nowrap;
  text-align: left;            /* прижали к левой стороне */
}
.table-actions .btn{ margin-right: 6px; }

/* выравнивание последней колонки заголовка тоже влево */
thead th:last-child,
tbody td:last-child{ text-align: left; }

/* Чуть меньше отступы у первой и последней ячеек, чтобы «вписать» в карту */
tbody td:first-child, thead th:first-child{ padding-left: 12px; }
tbody td:last-child,  thead th:last-child{ padding-right: 12px; }

/* ====== ГЛОБАЛЬНЫЙ ФУТЕР ====== */
.global-legal{
  text-align: center;
  padding: 12px;
  color: var(--muted);
}

/* ====== ТОСТ ====== */
.toast{
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(12px);
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(0,0,0,0.75);
  color: #fff;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 50;
  border: 1px solid rgba(255,255,255,0.12);
}
.toast.show{
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast.success{ background: rgba(22,163,74,0.9); }
.toast.error{ background: rgba(220,38,38,0.9); }

/* Глобально убираем «синий» и подчёркивание у ссылок во всех состояниях */
a,
a:link,
a:visited {
  color: inherit !important;
  text-decoration: none !important;
}

a:hover,
a:active {
  color: inherit !important;
  text-decoration: none !important;
}

a:focus,
a:focus-visible {
  outline: none !important;
  box-shadow: none !important;
}

/* На мобилках убираем вспышку при тапе */
* {
  -webkit-tap-highlight-color: transparent;
}
