:root {
  --bg: #FFD8F9;
  --bg2: #FFFFFF;
  --accent: #ff4fc3;
  --accent-dark: #da2ca1;
  --text: #2b2b2b;
  --muted: #8a8a95;
  --card: #ffffff;
  --soft-card: #FFC6D9;
  --border: #FFB5E6;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg2) 100%);
}

a {
  color: var(--accent-dark);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  background: rgba(255, 255, 255, 0.7);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
}

.brand {
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.03em;
  font-size: 22px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.nav a,
.link-button {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.75);
  color: var(--text);
  padding: 9px 13px;
  border-radius: 999px;
  text-decoration: none;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.nav a:hover,
.link-button:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.inline-form {
  display: inline;
}

.container {
  width: min(920px, calc(100% - 32px));
  margin: 40px auto;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 28px;
  margin-bottom: 20px;
  box-shadow: 0 12px 30px rgba(255, 79, 195, 0.12);
}

.auth-card {
  max-width: 460px;
  margin-left: auto;
  margin-right: auto;
}

h1,
h2 {
  margin-top: 0;
  letter-spacing: -0.04em;
}

h1 {
  font-size: 32px;
  margin-bottom: 8px;
}

h2 {
  font-size: 22px;
  margin-bottom: 16px;
}

.muted {
  color: var(--muted);
  margin-top: 0;
  line-height: 1.5;
}

form {
  display: grid;
  gap: 12px;
}

label {
  font-weight: 650;
  margin-top: 6px;
}

input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font: inherit;
  background: #fff;
}

input:focus {
  outline: 3px solid rgba(255, 79, 195, 0.18);
  border-color: var(--accent);
}

button {
  margin-top: 8px;
  padding: 12px 16px;
  border: 0;
  border-radius: 12px;
  font: inherit;
  font-weight: 750;
  color: #ffffff;
  background: var(--accent);
  cursor: pointer;
}

button:hover {
  filter: brightness(0.96);
}

.error,
.flash {
  padding: 12px 14px;
  border-radius: 12px;
  margin: 16px 0;
  line-height: 1.45;
}

.error {
  color: #8a1f11;
  background: #fff0ec;
  border: 1px solid #ffd2c7;
}

.flash.success {
  color: #0b5b2a;
  background: #eafaf0;
  border: 1px solid #b9eccb;
}

.auth-switch {
  margin-bottom: 0;
  color: var(--muted);
}

.account-grid {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

.info-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #ffe1f4;
}

.info-row:last-child {
  border-bottom: 0;
}

.info-row span {
  color: var(--muted);
}

@media (max-width: 640px) {
  .site-header,
  .nav {
    align-items: flex-start;
    flex-direction: column;
  }

  .container {
    margin: 24px auto;
  }

  .card {
    padding: 22px;
    border-radius: 16px;
  }

  .info-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

.wide-card{
  width:min(1100px, calc(100% - 32px));
}

.top-row{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:16px;
  margin-bottom:16px;
}

.admin-summary{
  display:flex;
  justify-content:space-between;
  gap:16px;
  padding:12px 0 18px;
  color:var(--text);
  flex-wrap:wrap;
}

.table-wrap{
  overflow-x:auto;
  border-radius:14px;
  border:1px solid var(--border);
  background:rgba(255,255,255,.35);
}

.admin-table{
  width:100%;
  border-collapse:collapse;
  min-width:900px;
}

.admin-table th,
.admin-table td{
  padding:12px;
  border-bottom:1px solid var(--border);
  text-align:left;
  vertical-align:top;
  font-size:14px;
}

.admin-table th{
  font-size:12px;
  color:var(--muted);
  text-transform:uppercase;
  letter-spacing:.04em;
  background:rgba(255,255,255,.35);
}

.admin-table tr:last-child td{
  border-bottom:none;
}

.badge{
  display:inline-flex;
  margin-left:6px;
  padding:2px 8px;
  border-radius:999px;
  background:var(--accent);
  color:#fff;
  font-size:11px;
  font-weight:700;
}

.actions-cell{
  min-width:270px;
}

.inline-form{
  display:flex;
  gap:8px;
  align-items:center;
  margin:0 0 8px;
}

.small-input{
  min-height:34px;
  padding:0 10px;
  border-radius:10px;
  border:1px solid var(--border);
  background:rgba(255,255,255,.7);
  color:var(--text);
}

.small-button{
  min-height:34px;
  padding:0 12px;
  border:none;
  border-radius:10px;
  background:var(--accent);
  color:#fff;
  font-weight:700;
  cursor:pointer;
}

.small-button.danger{
  background:#d93636;
}

.small-note{
  font-size:12px;
}

.admin-link-box{
  margin:14px 0 18px;
}

.secondary-button{
  display:inline-flex;
  justify-content:center;
  align-items:center;
  text-decoration:none;
  background:rgba(255,255,255,.65);
  color:var(--text);
  border:1px solid var(--border);
}

.secondary-button:hover{
  border-color:var(--accent);
}

.root-badge{
  background:#333;
}

.password-form{
  align-items:flex-start;
  flex-wrap:wrap;
}

.password-form .small-input{
  width:140px;
}

.profile-header{
  display:flex;
  align-items:center;
  gap:16px;
  margin:18px 0;
}

.avatar-circle{
  width:64px;
  height:64px;
  border-radius:50%;
  overflow:hidden;
  border:2px solid var(--border);
  background:rgba(255,255,255,.6);
  display:flex;
  align-items:center;
  justify-content:center;
  flex:0 0 auto;
  box-shadow:0 8px 20px rgba(0,0,0,.06);
}

.avatar-circle img{
  width:64px;
  height:64px;
  object-fit:cover;
  display:block;
}

.avatar-circle span{
  font-size:26px;
  font-weight:800;
  color:var(--accent);
}

.small-avatar{
  width:42px;
  height:42px;
  border-width:1px;
}

.small-avatar img{
  width:42px;
  height:42px;
}

.small-avatar span{
  font-size:18px;
}

.profile-name{
  font-size:20px;
  font-weight:800;
}

.profile-login{
  color:var(--muted);
  font-size:14px;
}

.avatar-form{
  margin:18px 0;
  padding:16px;
  border-radius:16px;
  border:1px solid var(--border);
  background:rgba(255,255,255,.35);
}

.hint{
  margin:8px 0 12px;
  color:var(--muted);
  font-size:12px;
  line-height:1.4;
}

/* Общая шапка для страниц авторизации */
.site-header{
  width:100%;
  position:sticky;
  top:0;
  z-index:20;
  background:rgba(255,216,249,.78);
  backdrop-filter:blur(14px);
  border-bottom:1px solid rgba(255,181,230,.7);
  box-shadow:0 8px 24px rgba(0,0,0,.04);
}

.site-header-inner{
  width:min(1100px,calc(100% - 40px));
  min-height:68px;
  margin:auto;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:20px;
}

.site-brand{
  display:inline-flex;
  align-items:center;
  gap:10px;
  height:44px;
  text-decoration:none;
  color:var(--text);
  font-size:22px;
  font-weight:800;
  letter-spacing:.2px;
}

.site-brand-dot{
  width:12px;
  height:12px;
  border-radius:50%;
  background:var(--accent);
  box-shadow:0 0 0 6px rgba(255,79,195,.14);
}

.auth-nav{
  display:flex;
  justify-content:flex-end;
  align-items:center;
  gap:12px;
  flex-wrap:wrap;
  margin:0;
  padding:0;
  min-height:44px;
}

.auth-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:40px;
  padding:0 16px;
  border-radius:999px;
  border:1px solid var(--border);
  background:rgba(255,255,255,.55);
  color:var(--text);
  text-decoration:none;
  font-size:14px;
  font-weight:600;
  line-height:1;
  transition:.2s;
  box-shadow:0 8px 20px rgba(0,0,0,.04);
}

.auth-btn:hover{
  transform:translateY(-2px);
  border-color:var(--accent);
  box-shadow:0 12px 24px rgba(0,0,0,.08);
}

.auth-btn.primary{
  background:var(--accent);
  color:#fff;
  border-color:var(--accent);
}

.user-mini{
  display:inline-flex;
  align-items:center;
  gap:10px;
  min-height:46px;
  padding:6px 8px 6px 16px;
  border-radius:999px;
  border:1px solid var(--border);
  background:rgba(255,255,255,.55);
  text-decoration:none;
  color:var(--text);
  font-size:14px;
  font-weight:700;
  line-height:1.25;
  box-shadow:0 8px 20px rgba(0,0,0,.04);
  transition:.2s;
}

.user-mini:hover{
  transform:translateY(-2px);
  border-color:var(--accent);
  box-shadow:0 12px 24px rgba(0,0,0,.08);
}

.user-mini-name{
  display:inline-flex;
  align-items:center;
  min-height:32px;
  max-width:180px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  line-height:1.25;
}

.user-mini-avatar{
  width:34px;
  height:34px;
  border-radius:50%;
  overflow:hidden;
  border:1px solid var(--border);
  background:rgba(255,255,255,.75);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  color:var(--accent);
  font-size:15px;
  font-weight:800;
  flex:0 0 auto;
}

.user-mini-avatar img{
  width:34px;
  height:34px;
  display:block;
  object-fit:cover;
}

.auth-site-header + .auth-card,
.auth-site-header ~ .auth-card{
  margin-top:36px;
}

@media (max-width:520px){
  .site-header-inner{
    width:calc(100% - 24px);
    min-height:64px;
    gap:12px;
  }

  .site-brand{
    font-size:19px;
  }

  .auth-btn{
    min-height:36px;
    padding:0 12px;
    font-size:13px;
  }

  .user-mini-name{
    max-width:110px;
  }
}

/* FIX: одинаковая высота шапки с главной страницей */
.site-header{
  min-height:68px !important;
}

.site-header-inner{
  height:68px !important;
  min-height:68px !important;
  align-items:center !important;
}

.site-brand{
  height:44px !important;
  align-items:center !important;
}

.auth-nav{
  height:44px !important;
  min-height:44px !important;
  align-items:center !important;
}

.auth-nav .auth-btn{
  height:40px !important;
  min-height:40px !important;
}

.auth-nav .user-mini{
  height:46px !important;
  min-height:46px !important;
}

@media (max-width:520px){
  .site-header{
    min-height:64px !important;
  }

  .site-header-inner{
    height:64px !important;
    min-height:64px !important;
  }
}

/* FINAL FIX: точное совпадение шапки auth-страниц с главной */
html,
body{
  margin:0 !important;
}

.auth-site-header{
  height:68px !important;
  min-height:68px !important;
  max-height:68px !important;
  padding:0 !important;
  box-sizing:border-box !important;
}

.auth-site-header .site-header-inner{
  height:68px !important;
  min-height:68px !important;
  max-height:68px !important;
  padding:0 !important;
  box-sizing:border-box !important;
  display:flex !important;
  align-items:center !important;
}

.auth-site-header .site-brand{
  height:44px !important;
  min-height:44px !important;
  max-height:44px !important;
  display:inline-flex !important;
  align-items:center !important;
  line-height:1 !important;
  padding:0 !important;
  margin:0 !important;
}

.auth-site-header .site-brand span{
  line-height:1 !important;
}

.auth-site-header .auth-nav{
  height:44px !important;
  min-height:44px !important;
  max-height:44px !important;
  display:flex !important;
  align-items:center !important;
  justify-content:flex-end !important;
  gap:12px !important;
  padding:0 !important;
  margin:0 !important;
}

.auth-site-header .auth-btn{
  height:40px !important;
  min-height:40px !important;
  max-height:40px !important;
  padding:0 16px !important;
  margin:0 !important;
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  line-height:1 !important;
}

.auth-site-header .user-mini{
  height:46px !important;
  min-height:46px !important;
  max-height:46px !important;
  padding:6px 8px 6px 16px !important;
  margin:0 !important;
  display:inline-flex !important;
  align-items:center !important;
  line-height:1.25 !important;
}

.auth-site-header .user-mini-name{
  line-height:1.25 !important;
  padding:0 !important;
  margin:0 !important;
}

@media (max-width:520px){
  .auth-site-header{
    height:64px !important;
    min-height:64px !important;
    max-height:64px !important;
  }

  .auth-site-header .site-header-inner{
    height:64px !important;
    min-height:64px !important;
    max-height:64px !important;
  }
}

/* FIX: кнопка панели управления в шапке */
.control-btn{
  background:rgba(255,255,255,.65) !important;
  color:var(--text) !important;
  border-color:var(--border) !important;
}

.control-btn:hover{
  border-color:var(--accent) !important;
}

/* FIX: отступ снизу у кнопки выхода в личном кабинете */
.logout-form{
  margin-top:24px !important;
  margin-bottom:22px !important;
  padding-bottom:6px !important;
}

.logout-form .danger-button,
.logout-form button{
  margin-bottom:0 !important;
}

/* FINAL FIX: единая высота всех кнопок в шапке */
.auth-site-header .auth-nav{
  height:46px !important;
  min-height:46px !important;
  max-height:46px !important;
  align-items:center !important;
}

.auth-site-header .auth-btn,
.auth-site-header .control-btn,
.auth-site-header .user-mini{
  height:46px !important;
  min-height:46px !important;
  max-height:46px !important;
  box-sizing:border-box !important;
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  margin:0 !important;
  line-height:1 !important;
  border-radius:999px !important;
}

/* Все обычные кнопки в шапке одной высоты */
.auth-site-header .auth-btn{
  padding:0 18px !important;
}

/* Панель управления — как кнопка Регистрация */
.auth-site-header .control-btn{
  background:var(--accent) !important;
  color:#fff !important;
  border-color:var(--accent) !important;
  font-weight:700 !important;
}

.auth-site-header .control-btn:hover{
  border-color:var(--accent) !important;
  box-shadow:0 12px 24px rgba(0,0,0,.08) !important;
}

/* Ник + аватар той же высоты, что и кнопки */
.auth-site-header .user-mini{
  padding:6px 8px 6px 16px !important;
  gap:10px !important;
}

.auth-site-header .user-mini-name{
  height:34px !important;
  min-height:34px !important;
  max-height:34px !important;
  display:inline-flex !important;
  align-items:center !important;
  line-height:1.25 !important;
  padding:0 !important;
  margin:0 !important;
}

.auth-site-header .user-mini-avatar{
  width:34px !important;
  height:34px !important;
  min-width:34px !important;
  min-height:34px !important;
  max-width:34px !important;
  max-height:34px !important;
}

.auth-site-header .user-mini-avatar img{
  width:34px !important;
  height:34px !important;
}

@media (max-width:520px){
  .auth-site-header .auth-nav{
    height:auto !important;
    min-height:46px !important;
    max-height:none !important;
  }

  .auth-site-header .auth-btn,
  .auth-site-header .control-btn,
  .auth-site-header .user-mini{
    height:42px !important;
    min-height:42px !important;
    max-height:42px !important;
  }

  .auth-site-header .auth-btn{
    padding:0 12px !important;
  }

  .auth-site-header .user-mini-avatar{
    width:32px !important;
    height:32px !important;
    min-width:32px !important;
    min-height:32px !important;
  }

  .auth-site-header .user-mini-avatar img{
    width:32px !important;
    height:32px !important;
  }
}

/* FINAL FIX: идентичный контур ник+аватар на auth-страницах */
.auth-site-header .user-mini{
  border-width:2px !important;
  border-color:var(--border) !important;
}

.auth-site-header .user-mini:hover{
  border-color:var(--accent) !important;
}

.auth-site-header .user-mini-avatar{
  border-width:2px !important;
  border-color:var(--border) !important;
}

.auth-site-header .user-mini:hover .user-mini-avatar{
  border-color:var(--accent) !important;
}

/* ADMIN PAGE LAYOUT */
.admin-page{
  width:calc(100% - 48px) !important;
  max-width:none !important;
  margin:36px auto 48px !important;
  padding:26px !important;
  border-radius:22px !important;
  background:var(--card) !important;
  border:1px solid var(--border) !important;
  box-shadow:0 12px 30px rgba(0,0,0,.05) !important;
  box-sizing:border-box !important;
}

.admin-page .top-row{
  display:flex !important;
  justify-content:space-between !important;
  align-items:flex-start !important;
  gap:16px !important;
  margin-bottom:18px !important;
}

.admin-page h1{
  margin:0 0 6px !important;
}

.admin-page .table-wrap{
  width:100% !important;
  overflow-x:auto !important;
  border-radius:16px !important;
  border:1px solid var(--border) !important;
  background:rgba(255,255,255,.35) !important;
}

.admin-page .admin-table{
  width:100% !important;
  min-width:1100px !important;
  border-collapse:collapse !important;
}

.admin-page .admin-table th,
.admin-page .admin-table td{
  padding:13px 14px !important;
}

.admin-page .actions-cell{
  min-width:360px !important;
}

.admin-page .admin-summary{
  margin-bottom:12px !important;
}

@media (max-width:760px){
  .admin-page{
    width:calc(100% - 24px) !important;
    margin:24px auto 36px !important;
    padding:18px !important;
  }

  .admin-page .admin-table{
    min-width:1000px !important;
  }
}

/* FINAL FIX: ровные кнопки и формы в таблице управления */
.admin-page .admin-table{
  table-layout:auto !important;
}

.admin-page .admin-table td{
  vertical-align:middle !important;
}

.admin-page .actions-cell{
  min-width:420px !important;
}

.admin-page .actions-cell form{
  display:flex !important;
  align-items:center !important;
  gap:8px !important;
  margin:0 0 8px !important;
}

.admin-page .actions-cell form:last-child{
  margin-bottom:0 !important;
}

.admin-page .actions-cell input{
  height:38px !important;
  min-height:38px !important;
  box-sizing:border-box !important;
  margin:0 !important;
}

.admin-page .actions-cell button,
.admin-page .actions-cell .small-button,
.admin-page .admin-table button{
  height:38px !important;
  min-height:38px !important;
  box-sizing:border-box !important;
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  padding:0 12px !important;
  margin:0 !important;
  line-height:1 !important;
  white-space:nowrap !important;
  border-radius:12px !important;
}

.admin-page .actions-cell .inline-form{
  display:flex !important;
  align-items:center !important;
  gap:8px !important;
}

.admin-page .admin-table .danger-button,
.admin-page .admin-table .secondary-button,
.admin-page .admin-table .small-button{
  min-width:118px !important;
}

.admin-page .admin-table .nickname-form input,
.admin-page .admin-table .password-form input{
  width:170px !important;
}

.admin-page .admin-table .role-badge,
.admin-page .admin-table .admin-badge,
.admin-page .admin-table .badge{
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  min-height:30px !important;
  padding:0 10px !important;
  line-height:1 !important;
  border-radius:999px !important;
  white-space:nowrap !important;
}

@media (max-width:760px){
  .admin-page .actions-cell{
    min-width:390px !important;
  }

  .admin-page .admin-table .nickname-form input,
  .admin-page .admin-table .password-form input{
    width:150px !important;
  }
}

/* FINAL ADMIN LAYOUT: отступы со всех сторон */
.admin-page{
  width:calc(100vw - 64px) !important;
  max-width:none !important;
  margin:28px auto 56px auto !important;
  padding:24px !important;
  box-sizing:border-box !important;
  border-radius:22px !important;
  overflow:hidden !important;
}

/* Если таблица лежит не внутри admin-page, всё равно даём ей внешний отступ */
body > .table-wrap,
body > .admin-table,
body > .wide-card{
  width:calc(100vw - 64px) !important;
  margin:28px auto 56px auto !important;
}

/* Внутренний контейнер таблицы */
.admin-page .table-wrap{
  width:100% !important;
  max-width:100% !important;
  overflow-x:auto !important;
  border-radius:18px !important;
  box-sizing:border-box !important;
}

/* Таблица */
.admin-page .admin-table{
  width:100% !important;
  min-width:1180px !important;
  table-layout:fixed !important;
  border-collapse:collapse !important;
}

/* Фиксированная высота строк пользователей */
.admin-page .admin-table tbody tr{
  height:132px !important;
  min-height:132px !important;
  max-height:132px !important;
}

/* Ячейки внутри строк */
.admin-page .admin-table th,
.admin-page .admin-table td{
  box-sizing:border-box !important;
  vertical-align:middle !important;
  padding:12px 12px !important;
}

/* Ширины колонок */
.admin-page .admin-table th:nth-child(1),
.admin-page .admin-table td:nth-child(1){
  width:52px !important;
}

.admin-page .admin-table th:nth-child(2),
.admin-page .admin-table td:nth-child(2){
  width:90px !important;
}

.admin-page .admin-table th:nth-child(3),
.admin-page .admin-table td:nth-child(3){
  width:220px !important;
}

.admin-page .admin-table th:nth-child(4),
.admin-page .admin-table td:nth-child(4){
  width:290px !important;
}

.admin-page .admin-table th:nth-child(5),
.admin-page .admin-table td:nth-child(5){
  width:180px !important;
}

.admin-page .admin-table th:nth-child(6),
.admin-page .admin-table td:nth-child(6){
  width:210px !important;
}

.admin-page .admin-table th:nth-child(7),
.admin-page .admin-table td:nth-child(7){
  width:170px !important;
}

.admin-page .admin-table th:nth-child(8),
.admin-page .admin-table td:nth-child(8){
  width:520px !important;
}

/* Действия внутри таблицы */
.admin-page .actions-cell{
  width:520px !important;
  min-width:520px !important;
  max-width:520px !important;
  height:132px !important;
  padding-top:10px !important;
  padding-bottom:10px !important;
}

.admin-page .actions-cell form{
  display:flex !important;
  align-items:center !important;
  gap:8px !important;
  width:100% !important;
  margin:0 0 8px 0 !important;
}

.admin-page .actions-cell form:last-child{
  margin-bottom:0 !important;
}

/* Поле ника + кнопка */
.admin-page .actions-cell .nickname-form input,
.admin-page .actions-cell form:first-child input{
  flex:1 1 auto !important;
  min-width:0 !important;
  height:38px !important;
}

/* Поля пароля */
.admin-page .actions-cell .password-form input,
.admin-page .actions-cell input[type="password"]{
  width:140px !important;
  height:38px !important;
}

/* Все кнопки в действиях */
.admin-page .actions-cell button,
.admin-page .admin-table button{
  height:38px !important;
  min-height:38px !important;
  max-height:38px !important;
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  box-sizing:border-box !important;
  padding:0 12px !important;
  margin:0 !important;
  line-height:1 !important;
  border-radius:12px !important;
  white-space:nowrap !important;
}

/* Кнопка сохранения ника */
.admin-page .actions-cell form:first-child button{
  width:112px !important;
  min-width:112px !important;
}

/* Кнопка пароля */
.admin-page .actions-cell input[type="password"] + button,
.admin-page .actions-cell .password-form button{
  width:86px !important;
  min-width:86px !important;
}

/* Удаление / недоступно */
.admin-page .actions-cell .danger-button,
.admin-page .actions-cell .muted,
.admin-page .actions-cell small{
  margin-top:6px !important;
}

/* Текст "удаление недоступно" ровнее */
.admin-page .actions-cell small,
.admin-page .actions-cell .muted{
  display:block !important;
  line-height:1.2 !important;
}

/* Кнопки прав */
.admin-page .admin-table td:nth-child(7) form{
  margin:0 !important;
}

.admin-page .admin-table td:nth-child(7) button{
  min-width:128px !important;
}

/* Мобильная версия */
@media (max-width:760px){
  .admin-page{
    width:calc(100vw - 24px) !important;
    margin:20px auto 36px auto !important;
    padding:14px !important;
  }

  body > .table-wrap,
  body > .admin-table,
  body > .wide-card{
    width:calc(100vw - 24px) !important;
    margin:20px auto 36px auto !important;
  }

  .admin-page .admin-table{
    min-width:1180px !important;
  }
}

/* FINAL ADMIN TABLE FIX: одинаковые кнопки и строки действий */

/* Снять/выдать админку — одинаковая ширина */
.admin-page .admin-table td:nth-child(7) form{
  display:flex !important;
  align-items:center !important;
  margin:0 !important;
}

.admin-page .admin-table td:nth-child(7) button{
  width:142px !important;
  min-width:142px !important;
  max-width:142px !important;
  height:38px !important;
  min-height:38px !important;
  max-height:38px !important;
  padding:0 10px !important;
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  line-height:1 !important;
  white-space:nowrap !important;
  box-sizing:border-box !important;
}

/* Блок действий делаем как 3 ровные линии */
.admin-page .actions-cell{
  height:132px !important;
  min-height:132px !important;
  max-height:132px !important;
  vertical-align:middle !important;
  box-sizing:border-box !important;
}

.admin-page .actions-cell form{
  height:38px !important;
  min-height:38px !important;
  max-height:38px !important;
  display:flex !important;
  align-items:center !important;
  gap:8px !important;
  margin:0 0 8px 0 !important;
  box-sizing:border-box !important;
}

.admin-page .actions-cell form:last-child{
  margin-bottom:0 !important;
}

/* Поля и кнопки внутри действий одной высоты */
.admin-page .actions-cell input,
.admin-page .actions-cell button{
  height:38px !important;
  min-height:38px !important;
  max-height:38px !important;
  box-sizing:border-box !important;
  display:inline-flex !important;
  align-items:center !important;
  line-height:1 !important;
  margin:0 !important;
}

/* Строка ника */
.admin-page .actions-cell form:first-of-type input{
  flex:1 1 auto !important;
  min-width:0 !important;
}

.admin-page .actions-cell form:first-of-type button{
  width:104px !important;
  min-width:104px !important;
  max-width:104px !important;
}

/* Строка пароля: Новый пароль / Повтор / Пароль на одной высоте */
.admin-page .actions-cell form:has(input[type="password"]){
  align-items:center !important;
}

.admin-page .actions-cell form:has(input[type="password"]) input{
  width:140px !important;
  min-width:140px !important;
  max-width:140px !important;
  height:38px !important;
  min-height:38px !important;
  max-height:38px !important;
}

.admin-page .actions-cell form:has(input[type="password"]) button{
  width:86px !important;
  min-width:86px !important;
  max-width:86px !important;
  height:38px !important;
  min-height:38px !important;
  max-height:38px !important;
}

/* Удалить и Удаление недоступно занимают одинаковую высоту */
.admin-page .actions-cell .danger-button{
  width:104px !important;
  min-width:104px !important;
  max-width:104px !important;
  height:38px !important;
  min-height:38px !important;
  max-height:38px !important;
}

.admin-page .actions-cell small,
.admin-page .actions-cell .muted,
.admin-page .actions-cell .delete-placeholder{
  height:38px !important;
  min-height:38px !important;
  max-height:38px !important;
  display:inline-flex !important;
  align-items:center !important;
  justify-content:flex-start !important;
  margin:0 !important;
  padding:0 !important;
  line-height:1 !important;
  box-sizing:border-box !important;
  white-space:nowrap !important;
}

/* Чтобы текст недоступности не раздувал строку */
.admin-page .actions-cell small .delete-placeholder,
.admin-page .actions-cell .delete-placeholder{
  color:var(--muted) !important;
  font-size:13px !important;
}

/* Фиксируем высоту всей строки пользователя */
.admin-page .admin-table tbody tr{
  height:132px !important;
}

.admin-page .admin-table tbody td{
  height:132px !important;
  max-height:132px !important;
  vertical-align:middle !important;
}

/* FINAL HEADER POSITION: шапка auth-страниц по краям страницы */
.auth-site-header .site-header-inner{
  width:100% !important;
  max-width:none !important;
  margin:0 !important;
  padding-left:32px !important;
  padding-right:32px !important;
  box-sizing:border-box !important;
  display:flex !important;
  align-items:center !important;
  justify-content:space-between !important;
}

.auth-site-header .site-brand{
  margin-left:0 !important;
}

.auth-site-header .auth-nav{
  margin-left:auto !important;
  margin-right:0 !important;
  justify-content:flex-end !important;
}

@media (max-width:520px){
  .auth-site-header .site-header-inner{
    padding-left:16px !important;
    padding-right:16px !important;
  }
}

/* =========================================================
   FINAL UNIFIED HEADER + ADMIN FIX
   Единая шапка для /login /signup /account /admin
   ========================================================= */

html,
body{
  margin:0 !important;
}

.page-main{
  width:100%;
  box-sizing:border-box;
}

.site-header.auth-site-header{
  width:100% !important;
  height:68px !important;
  min-height:68px !important;
  max-height:68px !important;
  padding:0 !important;
  margin:0 !important;
  box-sizing:border-box !important;
  display:block !important;
  background:rgba(255,216,249,.78) !important;
  backdrop-filter:blur(14px) !important;
  border-bottom:1px solid rgba(255,181,230,.7) !important;
  box-shadow:0 8px 24px rgba(0,0,0,.04) !important;
}

.site-header.auth-site-header .site-header-inner{
  width:100% !important;
  max-width:none !important;
  height:68px !important;
  min-height:68px !important;
  max-height:68px !important;
  margin:0 !important;
  padding:0 32px !important;
  box-sizing:border-box !important;
  display:flex !important;
  align-items:center !important;
  justify-content:space-between !important;
  gap:20px !important;
}

.site-header.auth-site-header .site-brand{
  height:46px !important;
  min-height:46px !important;
  display:inline-flex !important;
  align-items:center !important;
  gap:10px !important;
  margin:0 !important;
  padding:0 !important;
  color:var(--text) !important;
  text-decoration:none !important;
  font-size:22px !important;
  font-weight:800 !important;
  line-height:1 !important;
}

.site-header.auth-site-header .site-brand:hover{
  text-decoration:none !important;
}

.site-header.auth-site-header .site-brand-dot{
  width:12px !important;
  height:12px !important;
  min-width:12px !important;
  min-height:12px !important;
  border-radius:50% !important;
  background:var(--accent) !important;
  box-shadow:0 0 0 6px rgba(255,79,195,.14) !important;
}

.site-header.auth-site-header .auth-nav{
  height:46px !important;
  min-height:46px !important;
  max-height:46px !important;
  display:flex !important;
  align-items:center !important;
  justify-content:flex-end !important;
  gap:12px !important;
  flex-wrap:nowrap !important;
  margin:0 0 0 auto !important;
  padding:0 !important;
}

.site-header.auth-site-header .auth-btn,
.site-header.auth-site-header .user-mini{
  height:46px !important;
  min-height:46px !important;
  max-height:46px !important;
  box-sizing:border-box !important;
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  margin:0 !important;
  border-radius:999px !important;
  border:2px solid var(--border) !important;
  background:rgba(255,255,255,.55) !important;
  color:var(--text) !important;
  text-decoration:none !important;
  font-size:14px !important;
  font-weight:700 !important;
  line-height:1 !important;
  white-space:nowrap !important;
  box-shadow:0 8px 20px rgba(0,0,0,.04) !important;
  transition:.2s !important;
}

.site-header.auth-site-header .auth-btn{
  padding:0 18px !important;
}

.site-header.auth-site-header .auth-btn.primary,
.site-header.auth-site-header .control-btn{
  background:var(--accent) !important;
  border-color:var(--accent) !important;
  color:#fff !important;
}

.site-header.auth-site-header .auth-btn:hover,
.site-header.auth-site-header .user-mini:hover{
  transform:translateY(-2px) !important;
  border-color:var(--accent) !important;
  box-shadow:0 12px 24px rgba(0,0,0,.08) !important;
  text-decoration:none !important;
}

.site-header.auth-site-header a,
.site-header.auth-site-header a:hover,
.site-header.auth-site-header a:focus,
.site-header.auth-site-header a:active{
  text-decoration:none !important;
}

.site-header.auth-site-header .user-mini{
  gap:10px !important;
  padding:6px 8px 6px 16px !important;
}

.site-header.auth-site-header .user-mini-name{
  height:34px !important;
  min-height:34px !important;
  max-height:34px !important;
  max-width:180px !important;
  display:inline-flex !important;
  align-items:center !important;
  overflow:hidden !important;
  text-overflow:ellipsis !important;
  white-space:nowrap !important;
  line-height:1.25 !important;
  padding:0 !important;
  margin:0 !important;
}

.site-header.auth-site-header .user-mini-avatar{
  width:34px !important;
  height:34px !important;
  min-width:34px !important;
  min-height:34px !important;
  max-width:34px !important;
  max-height:34px !important;
  border-radius:50% !important;
  overflow:hidden !important;
  border:2px solid var(--border) !important;
  background:rgba(255,255,255,.75) !important;
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  color:var(--accent) !important;
  font-size:15px !important;
  font-weight:800 !important;
  flex:0 0 auto !important;
}

.site-header.auth-site-header .user-mini-avatar img{
  width:34px !important;
  height:34px !important;
  display:block !important;
  object-fit:cover !important;
}

.site-header.auth-site-header .user-mini:hover .user-mini-avatar{
  border-color:var(--accent) !important;
}

/* Карточки auth-страниц после новой шапки */
.page-main > .auth-card,
.page-main > .card.auth-card{
  margin-top:36px !important;
}

/* Финальный /admin layout */
.admin-page{
  width:calc(100vw - 64px) !important;
  max-width:none !important;
  margin:28px auto 56px auto !important;
  padding:24px !important;
  box-sizing:border-box !important;
  border-radius:22px !important;
  background:var(--card) !important;
  border:1px solid var(--border) !important;
  box-shadow:0 12px 30px rgba(0,0,0,.05) !important;
  overflow:hidden !important;
}

.admin-page-head{
  display:flex !important;
  align-items:center !important;
  justify-content:space-between !important;
  gap:16px !important;
  margin-bottom:18px !important;
}

.admin-page-head h1{
  margin:0 !important;
}

.admin-page .table-wrap{
  width:100% !important;
  max-width:100% !important;
  overflow-x:auto !important;
  border-radius:18px !important;
  border:1px solid var(--border) !important;
  background:rgba(255,255,255,.35) !important;
  box-sizing:border-box !important;
}

.admin-page .admin-table{
  width:100% !important;
  min-width:1180px !important;
  table-layout:fixed !important;
  border-collapse:collapse !important;
}

.admin-page .admin-table tbody tr,
.admin-page .admin-table tbody td{
  height:132px !important;
  max-height:132px !important;
  vertical-align:middle !important;
}

.admin-page .admin-table th,
.admin-page .admin-table td{
  box-sizing:border-box !important;
  padding:12px !important;
  vertical-align:middle !important;
}

.admin-page .role-button{
  width:142px !important;
  min-width:142px !important;
  max-width:142px !important;
  height:38px !important;
}

.admin-page .actions-cell{
  width:520px !important;
  min-width:520px !important;
  max-width:520px !important;
  height:132px !important;
  box-sizing:border-box !important;
}

.admin-page .actions-cell form{
  height:38px !important;
  min-height:38px !important;
  max-height:38px !important;
  display:flex !important;
  align-items:center !important;
  gap:8px !important;
  margin:0 0 8px 0 !important;
  box-sizing:border-box !important;
}

.admin-page .actions-cell input,
.admin-page .actions-cell button,
.admin-page .delete-placeholder{
  height:38px !important;
  min-height:38px !important;
  max-height:38px !important;
  box-sizing:border-box !important;
  display:inline-flex !important;
  align-items:center !important;
  margin:0 !important;
  line-height:1 !important;
}

.admin-page .nickname-form input{
  flex:1 1 auto !important;
  min-width:0 !important;
}

.admin-page .save-button{
  width:104px !important;
  min-width:104px !important;
  max-width:104px !important;
}

.admin-page .password-form input{
  width:140px !important;
  min-width:140px !important;
  max-width:140px !important;
}

.admin-page .password-button{
  width:86px !important;
  min-width:86px !important;
  max-width:86px !important;
}

.admin-page .delete-button{
  width:104px !important;
  min-width:104px !important;
  max-width:104px !important;
}

.admin-page .delete-placeholder{
  color:var(--muted) !important;
  font-size:13px !important;
  white-space:nowrap !important;
  padding:0 !important;
}

@media (max-width:520px){
  .site-header.auth-site-header{
    height:64px !important;
    min-height:64px !important;
    max-height:64px !important;
  }

  .site-header.auth-site-header .site-header-inner{
    height:64px !important;
    min-height:64px !important;
    max-height:64px !important;
    padding:0 16px !important;
  }

  .site-header.auth-site-header .site-brand{
    font-size:19px !important;
  }

  .site-header.auth-site-header .auth-nav{
    gap:8px !important;
  }

  .site-header.auth-site-header .auth-btn,
  .site-header.auth-site-header .user-mini{
    height:42px !important;
    min-height:42px !important;
    max-height:42px !important;
  }

  .site-header.auth-site-header .auth-btn{
    padding:0 12px !important;
  }

  .site-header.auth-site-header .user-mini-name{
    max-width:110px !important;
  }

  .site-header.auth-site-header .user-mini-avatar,
  .site-header.auth-site-header .user-mini-avatar img{
    width:32px !important;
    height:32px !important;
    min-width:32px !important;
    min-height:32px !important;
  }

  .admin-page{
    width:calc(100vw - 24px) !important;
    margin:20px auto 36px auto !important;
    padding:14px !important;
  }
}

/* FINAL FIX: красная кнопка выхода в /account */
.logout-form .danger-button{
  background:#e5484d !important;
  color:#fff !important;
  border:0 !important;
  box-shadow:0 10px 22px rgba(229,72,77,.22) !important;
}

.logout-form .danger-button:hover{
  background:#d63b40 !important;
  filter:none !important;
  transform:translateY(-1px);
  box-shadow:0 12px 26px rgba(229,72,77,.28) !important;
}

.logout-form .danger-button:active{
  transform:translateY(0);
}

/* FIX: больше расстояние между сохранением ника и старым паролем */
.account-nickname-form{
  margin-bottom:28px !important;
}

.account-password-form{
  margin-top:0 !important;
}

/* FINAL FIX: анимация кнопки Выйти как у обычных кнопок */
.logout-form .danger-button{
  transition:.2s !important;
  transform:none !important;
}

.logout-form .danger-button:hover{
  transform:translateY(-2px) !important;
  box-shadow:0 12px 24px rgba(229,72,77,.28) !important;
}

.logout-form .danger-button:active{
  transform:translateY(0) !important;
}

/* FINAL FIX: кнопка Выйти без подъёма, как Сохранить ник и Изменить пароль */
.logout-form .danger-button,
.logout-form .danger-button:hover,
.logout-form .danger-button:focus,
.logout-form .danger-button:active{
  transform:none !important;
}

.logout-form .danger-button{
  background:#e5484d !important;
  color:#fff !important;
  border:0 !important;
  transition:.2s !important;
  box-shadow:0 10px 22px rgba(229,72,77,.22) !important;
}

.logout-form .danger-button:hover{
  background:#d63b40 !important;
  box-shadow:0 10px 22px rgba(229,72,77,.28) !important;
}

/* FINAL FIX: рамки для блоков ника и пароля как у аватара */
.account-section{
  margin:18px 0 !important;
  padding:16px !important;
  border-radius:16px !important;
  border:1px solid var(--border) !important;
  background:rgba(255,255,255,.35) !important;
  box-sizing:border-box !important;
}

.account-section form{
  margin:0 !important;
}

.account-section label:first-of-type{
  margin-top:0 !important;
}

.account-nickname-section{
  margin-top:20px !important;
  margin-bottom:20px !important;
}

.account-password-section{
  margin-top:0 !important;
  margin-bottom:22px !important;
}

.account-password-form button,
.account-nickname-form button{
  margin-bottom:0 !important;
}

/* FINAL FIX: запрет смены пароля root в панели управления */
.admin-page .password-placeholder{
  height:38px !important;
  min-height:38px !important;
  max-height:38px !important;
  display:inline-flex !important;
  align-items:center !important;
  color:var(--muted) !important;
  font-size:13px !important;
  line-height:1 !important;
  white-space:nowrap !important;
  margin:0 0 8px 0 !important;
  padding:0 !important;
  box-sizing:border-box !important;
}

/* FINAL FIX: смена почты в панели управления */
.admin-page .email-cell{
  width:340px !important;
  min-width:340px !important;
  max-width:340px !important;
}

.admin-page .email-form{
  height:38px !important;
  min-height:38px !important;
  max-height:38px !important;
  display:flex !important;
  align-items:center !important;
  gap:8px !important;
  margin:0 !important;
  box-sizing:border-box !important;
}

.admin-page .email-form input{
  height:38px !important;
  min-height:38px !important;
  max-height:38px !important;
  flex:1 1 auto !important;
  min-width:0 !important;
  box-sizing:border-box !important;
  margin:0 !important;
}

.admin-page .email-save-button{
  width:104px !important;
  min-width:104px !important;
  max-width:104px !important;
  height:38px !important;
  min-height:38px !important;
  max-height:38px !important;
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  margin:0 !important;
  line-height:1 !important;
}

/* Чуть расширяем таблицу под поле Email */
.admin-page .admin-table{
  min-width:1280px !important;
}

.admin-page .admin-table th:nth-child(4),
.admin-page .admin-table td:nth-child(4){
  width:340px !important;
}

/* FINAL FIX: меньше ширина поля изменения ника в /admin */
.admin-page .nickname-form{
  width:auto !important;
  justify-content:flex-start !important;
}

.admin-page .nickname-form input{
  flex:0 0 190px !important;
  width:190px !important;
  min-width:190px !important;
  max-width:190px !important;
}

.admin-page .nickname-form .save-button,
.admin-page .nickname-form button{
  width:104px !important;
  min-width:104px !important;
  max-width:104px !important;
}

@media (max-width:760px){
  .admin-page .nickname-form input{
    flex:0 0 160px !important;
    width:160px !important;
    min-width:160px !important;
    max-width:160px !important;
  }
}

/* FINAL FIX: строка изменения ника ровно по ширине строки пароля */
.admin-page .nickname-form{
  width:382px !important;
  min-width:382px !important;
  max-width:382px !important;
  display:flex !important;
  align-items:center !important;
  gap:8px !important;
}

.admin-page .nickname-form input{
  flex:0 0 270px !important;
  width:270px !important;
  min-width:270px !important;
  max-width:270px !important;
}

.admin-page .nickname-form .save-button,
.admin-page .nickname-form button{
  flex:0 0 104px !important;
  width:104px !important;
  min-width:104px !important;
  max-width:104px !important;
}

.admin-page .password-form{
  width:382px !important;
  min-width:382px !important;
  max-width:382px !important;
}

/* FINAL FIX: уведомления поверх страницы, без сдвига контента */
.message{
  position:fixed !important;
  top:84px !important;
  right:32px !important;
  z-index:9999 !important;

  width:auto !important;
  max-width:min(420px, calc(100vw - 64px)) !important;
  min-height:46px !important;

  display:flex !important;
  align-items:center !important;

  margin:0 !important;
  padding:12px 18px !important;
  box-sizing:border-box !important;

  border-radius:16px !important;
  box-shadow:0 14px 32px rgba(0,0,0,.12) !important;

  font-size:14px !important;
  font-weight:700 !important;
  line-height:1.25 !important;

  pointer-events:none !important;

  animation:
    toastIn .18s ease-out,
    toastOut .35s ease-in 4.5s forwards !important;
}

.message.success{
  background:rgba(237,255,244,.96) !important;
  border:1px solid rgba(53,178,104,.35) !important;
  color:#247a45 !important;
}

.message.error{
  background:rgba(255,239,239,.96) !important;
  border:1px solid rgba(229,72,77,.35) !important;
  color:#b4232a !important;
}

@keyframes toastIn{
  from{
    opacity:0;
    transform:translateY(-8px);
  }
  to{
    opacity:1;
    transform:translateY(0);
  }
}

@keyframes toastOut{
  from{
    opacity:1;
    transform:translateY(0);
  }
  to{
    opacity:0;
    transform:translateY(-8px);
    visibility:hidden;
  }
}

@media (max-width:520px){
  .message{
    top:76px !important;
    left:16px !important;
    right:16px !important;
    max-width:none !important;
    justify-content:center !important;
    text-align:center !important;
  }
}

/* FINAL FIX: логин и admin/root на одном уровне */
.admin-page .admin-table td:nth-child(3){
  vertical-align:middle !important;
  white-space:nowrap !important;
}

.admin-page .admin-table td:nth-child(3) strong{
  display:inline-flex !important;
  align-items:center !important;
  height:26px !important;
  min-height:26px !important;
  max-height:26px !important;
  line-height:1 !important;
  vertical-align:middle !important;
  margin:0 8px 0 0 !important;
}

.admin-page .admin-table td:nth-child(3) .badge,
.admin-page .admin-table td:nth-child(3) .root-badge{
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  height:22px !important;
  min-height:22px !important;
  max-height:22px !important;
  padding:0 8px !important;
  margin:0 4px 0 0 !important;
  line-height:1 !important;
  vertical-align:middle !important;
  box-sizing:border-box !important;
  transform:none !important;
}

/* STATISTICS PAGE */
.statistics-page{
  width:calc(100vw - 64px) !important;
  max-width:none !important;
  margin:28px auto 56px auto !important;
  padding:24px !important;
  box-sizing:border-box !important;
  border-radius:22px !important;
  background:var(--card) !important;
  border:1px solid var(--border) !important;
  box-shadow:0 12px 30px rgba(0,0,0,.05) !important;
}

.statistics-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
  margin-bottom:20px;
}

.statistics-head h1{
  margin:0 0 6px;
}

.statistics-head p{
  margin:0;
  color:var(--muted);
}

.statistics-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(220px,1fr));
  gap:16px;
  margin-bottom:22px;
}

.statistics-card{
  padding:18px;
  border-radius:18px;
  border:1px solid var(--border);
  background:rgba(255,255,255,.35);
  box-shadow:0 8px 20px rgba(0,0,0,.04);
}

.statistics-card-title{
  font-size:14px;
  color:var(--muted);
  font-weight:700;
}

.statistics-card-value{
  margin-top:8px;
  font-size:34px;
  line-height:1;
  font-weight:900;
  color:var(--accent);
}

.statistics-card-desc{
  margin-top:6px;
  font-size:13px;
  color:var(--muted);
}

.statistics-lists{
  display:grid;
  grid-template-columns:1fr;
  gap:22px;
}

.statistics-list-card{
  padding:18px;
  border-radius:18px;
  border:1px solid var(--border);
  background:rgba(255,255,255,.35);
  box-sizing:border-box;
}

.statistics-list-card h2{
  margin:0 0 14px;
}

.statistics-table-wrap{
  width:100%;
  overflow-x:auto;
  border-radius:16px;
  border:1px solid var(--border);
}

.statistics-table{
  width:100%;
  min-width:780px;
  border-collapse:collapse;
}

.statistics-table th,
.statistics-table td{
  padding:13px 14px;
  text-align:left;
  vertical-align:middle;
  border-bottom:1px solid rgba(255,181,230,.55);
}

.statistics-table tbody tr:last-child td{
  border-bottom:0;
}

.statistics-user{
  display:inline-flex;
  align-items:center;
  gap:10px;
  min-height:34px;
}

.statistics-avatar{
  width:34px;
  height:34px;
  border-radius:50%;
  overflow:hidden;
  border:2px solid var(--border);
  background:rgba(255,255,255,.75);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  color:var(--accent);
  font-size:15px;
  font-weight:800;
  flex:0 0 auto;
}

.statistics-avatar img{
  width:34px;
  height:34px;
  object-fit:cover;
  display:block;
}

@media (max-width:760px){
  .statistics-page{
    width:calc(100vw - 24px) !important;
    margin:20px auto 36px auto !important;
    padding:14px !important;
  }
}

/* FINAL FIX: statistics layout */
.statistics-page{
  width:min(1180px, calc(100% - 40px)) !important;
  max-width:1180px !important;
  margin:28px auto 56px auto !important;
  padding:24px !important;
  box-sizing:border-box !important;
}

.statistics-grid,
.statistics-lists,
.statistics-list-card,
.statistics-table-wrap{
  width:100% !important;
  max-width:100% !important;
  box-sizing:border-box !important;
}

.statistics-lists{
  display:grid !important;
  grid-template-columns:1fr !important;
  gap:22px !important;
}

.statistics-table{
  width:100% !important;
  min-width:0 !important;
  table-layout:auto !important;
}

.statistics-table-wrap{
  overflow-x:auto !important;
}

.statistics-table th,
.statistics-table td{
  box-sizing:border-box !important;
}

/* Чтобы длинные ники/логины не ломали таблицу */
.statistics-table td{
  word-break:break-word !important;
}

@media (max-width:760px){
  .statistics-page{
    width:calc(100% - 24px) !important;
    margin:20px auto 36px auto !important;
    padding:14px !important;
  }

  .statistics-table{
    min-width:720px !important;
  }
}

/* FINAL FIX: /statistics parent width */
.page-main:has(.statistics-page){
  width:100% !important;
  max-width:none !important;
  min-width:0 !important;
  margin:0 !important;
  padding:0 !important;
  display:block !important;
  box-sizing:border-box !important;
}

/* Сама страница статистики */
.page-main:has(.statistics-page) .statistics-page{
  width:min(1180px, calc(100vw - 40px)) !important;
  max-width:1180px !important;
  min-width:0 !important;
  margin:28px auto 56px auto !important;
  padding:24px !important;
  box-sizing:border-box !important;
  overflow:hidden !important;
}

/* Карточки внутри */
.page-main:has(.statistics-page) .statistics-grid,
.page-main:has(.statistics-page) .statistics-lists,
.page-main:has(.statistics-page) .statistics-list-card,
.page-main:has(.statistics-page) .statistics-table-wrap{
  width:100% !important;
  max-width:100% !important;
  min-width:0 !important;
  box-sizing:border-box !important;
}

/* Таблица */
.page-main:has(.statistics-page) .statistics-table{
  width:100% !important;
  min-width:760px !important;
  max-width:none !important;
  table-layout:auto !important;
}

.page-main:has(.statistics-page) .statistics-table-wrap{
  overflow-x:auto !important;
}

/* Чтобы рамка списка не вылезала за основную карточку */
.page-main:has(.statistics-page) .statistics-list-card{
  overflow:hidden !important;
}

@media (max-width:760px){
  .page-main:has(.statistics-page) .statistics-page{
    width:calc(100vw - 24px) !important;
    margin:20px auto 36px auto !important;
    padding:14px !important;
  }
}

/* ANIME PAGE */
.page-main:has(.anime-page){
  width:100% !important;
  max-width:none !important;
  min-width:0 !important;
  margin:0 !important;
  padding:0 !important;
  display:block !important;
  box-sizing:border-box !important;
}

.anime-page{
  width:min(1180px, calc(100vw - 40px)) !important;
  max-width:1180px !important;
  margin:28px auto 56px auto !important;
  padding:24px !important;
  box-sizing:border-box !important;
  border-radius:22px !important;
  background:rgba(255,198,217,.72) !important;
  border:1px solid var(--border) !important;
  box-shadow:0 12px 30px rgba(0,0,0,.05) !important;
  backdrop-filter:blur(8px) !important;
}

.anime-head{
  display:flex;
  justify-content:space-between;
  gap:16px;
  margin-bottom:20px;
}

.anime-head h1{
  margin:0 0 6px;
}

.anime-head p,
.anime-muted{
  margin:0;
  color:var(--muted);
  line-height:1.45;
}

.anime-layout{
  display:grid;
  grid-template-columns:1fr;
  gap:18px;
}

.anime-panel{
  padding:18px;
  border-radius:18px;
  border:1px solid var(--border);
  background:rgba(255,255,255,.35);
  box-sizing:border-box;
}

.anime-panel h2{
  margin:0 0 12px;
}

.anime-section-title{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:12px;
}

.anime-section-title h2{
  margin:0;
}

.anime-section-title span{
  color:var(--accent);
  font-weight:900;
}

.anime-search-row{
  margin-top:14px;
  display:flex;
  gap:10px;
}

.anime-search-row input{
  flex:1;
  min-width:0;
  height:44px;
  border-radius:999px;
  border:2px solid var(--border);
  background:rgba(255,255,255,.7);
  padding:0 16px;
  font:inherit;
  outline:none;
}

.anime-search-row input:focus{
  border-color:var(--accent);
}

.anime-search-row button,
.anime-small-button,
.anime-login-actions a,
.anime-small-link{
  min-height:40px;
  border-radius:999px;
  border:2px solid var(--accent);
  background:var(--accent);
  color:#fff;
  padding:0 16px;
  font:inherit;
  font-size:14px;
  font-weight:800;
  cursor:pointer;
  text-decoration:none;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  white-space:nowrap;
}

.anime-small-button.danger{
  background:#ff5b7d;
  border-color:#ff5b7d;
}

.anime-small-link{
  background:rgba(255,255,255,.55);
  border-color:var(--border);
  color:var(--text);
}

.anime-status{
  margin-top:12px;
  color:var(--muted);
  font-weight:700;
}

.anime-results,
.anime-list{
  display:grid;
  gap:10px;
  margin-top:12px;
}

.anime-item{
  min-width:0;
  display:grid;
  grid-template-columns:58px 1fr auto;
  align-items:center;
  gap:12px;
  padding:10px;
  border-radius:16px;
  border:1px solid var(--border);
  background:rgba(255,255,255,.55);
  box-sizing:border-box;
}

.anime-cover{
  width:58px;
  height:78px;
  border-radius:12px;
  object-fit:cover;
  background:rgba(255,255,255,.7);
  border:1px solid rgba(255,181,230,.8);
  display:flex;
  align-items:center;
  justify-content:center;
  color:var(--accent);
  font-weight:900;
}

.anime-info{
  min-width:0;
}

.anime-info h3{
  margin:0 0 5px;
  font-size:16px;
  line-height:1.25;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.anime-meta,
.anime-users{
  color:var(--muted);
  font-size:13px;
  line-height:1.35;
}

.anime-users{
  margin-top:4px;
  word-break:break-word;
}

.anime-actions{
  display:flex;
  justify-content:flex-end;
}

.anime-empty,
.anime-login-note{
  padding:14px;
  border-radius:16px;
  border:1px dashed var(--border);
  background:rgba(255,255,255,.35);
  color:var(--muted);
  font-weight:700;
}

.anime-login-note{
  margin-top:14px;
}

.anime-login-actions{
  display:flex;
  gap:10px;
  margin-top:10px;
  flex-wrap:wrap;
}

@media (max-width:760px){
  .anime-page{
    width:calc(100vw - 24px) !important;
    margin:20px auto 36px auto !important;
    padding:14px !important;
  }

  .anime-search-row{
    flex-direction:column;
  }

  .anime-search-row button{
    width:100%;
  }

  .anime-item{
    grid-template-columns:50px 1fr;
    align-items:start;
  }

  .anime-cover{
    width:50px;
    height:68px;
  }

  .anime-actions{
    grid-column:1 / -1;
    justify-content:stretch;
  }

  .anime-small-button,
  .anime-small-link{
    width:100%;
  }
}

/* FINAL FIX: /anime search button and clear list button */
.anime-search-row{
  align-items:center !important;
}

.anime-search-row button{
  height:44px !important;
  min-height:44px !important;
  max-height:44px !important;
  padding:0 22px !important;
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  line-height:1 !important;
  align-self:center !important;
}

.anime-title-actions{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:10px;
  flex-wrap:wrap;
}

.anime-clear-button{
  height:34px;
  min-height:34px;
  border-radius:999px;
  border:2px solid #ff5b7d;
  background:#ff5b7d;
  color:#fff;
  padding:0 14px;
  font:inherit;
  font-size:13px;
  font-weight:800;
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  line-height:1;
  white-space:nowrap;
}

.anime-clear-button:hover{
  filter:brightness(.96);
}

@media (max-width:760px){
  .anime-title-actions{
    justify-content:flex-start;
  }

  .anime-clear-button{
    width:auto;
  }
}

/* FINAL FIX: ровный ряд поиска на /anime */
.anime-search-row{
  display:grid !important;
  grid-template-columns:minmax(0, 1fr) auto auto !important;
  align-items:center !important;
  gap:10px !important;
}

.anime-search-row input,
.anime-search-row button,
.anime-search-row .anime-clear-search-button{
  height:44px !important;
  min-height:44px !important;
  max-height:44px !important;
  box-sizing:border-box !important;
  margin:0 !important;
  transform:none !important;
  line-height:1 !important;
  align-self:center !important;
}

.anime-search-row input{
  width:100% !important;
  padding:0 16px !important;
  display:block !important;
}

.anime-search-row button,
.anime-search-row .anime-clear-search-button{
  padding:0 22px !important;
  border-radius:999px !important;
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  vertical-align:top !important;
  white-space:nowrap !important;
}

.anime-clear-search-button{
  border:2px solid var(--border) !important;
  background:rgba(255,255,255,.55) !important;
  color:var(--text) !important;
}

@media (max-width:760px){
  .anime-search-row{
    grid-template-columns:1fr !important;
  }

  .anime-search-row button,
  .anime-search-row .anime-clear-search-button{
    width:100% !important;
  }
}

/* FINAL FIX: admin clear all anime button */
.anime-clear-all-button{
  min-height:34px;
  border-radius:999px;
  border:2px solid #ff5b7d;
  background:#ff5b7d;
  color:#fff;
  padding:0 14px;
  font:inherit;
  font-size:13px;
  font-weight:800;
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  line-height:1;
  white-space:nowrap;
}

.anime-clear-all-button:hover{
  filter:brightness(.96);
}

@media (max-width:760px){
  .anime-clear-all-button{
    width:100%;
  }

  .anime-global-panel .anime-section-title{
    align-items:stretch;
  }
}
