/* ─────────────────────────────────────────────────────────────────────────
   FanBot admin console — design tokens
   Тёмная "операторская" панель: числа и id — моноширинным, роли — цветными
   точками (та же палитра, что и эмодзи ролей самого бота), один акцентный
   цвет для действий, не пересекающийся ни с одной ролью.
   ───────────────────────────────────────────────────────────────────────── */
:root{
  --bg:            #10121A;
  --bg-elevated:   #171A24;
  --panel:         #1B1F2B;
  --panel-2:       #20242F;
  --border:        #2A2F3D;
  --text:          #EDEEF2;
  --text-dim:      #9AA0B2;
  --text-faint:    #656C80;
  --accent:        #23D8C4;
  --accent-dim:    #16B6A4;
  --accent-ink:    #08211D;
  --danger:        #F0526B;
  --danger-dim:    #3A1620;
  --warn:          #F2A94A;
  --ok:            #37D67A;

  --role-developer: #B8BEC9;
  --role-owner:     #E5484D;
  --role-admin:     #F2994A;
  --role-curator:   #A66CF7;
  --role-senior_mod:#4A9DF6;
  --role-moderator: #F0C33C;
  --role-junior_mod:#3FCB6F;
  --role-user:      #6B7280;

  --font-display: 'Space Grotesk', 'Inter', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  --radius: 10px;
  --radius-lg: 16px;
}

*{ box-sizing: border-box; }
html{
  height:100%; overflow-x:hidden;
  background: var(--bg);
  overscroll-behavior-y: none; /* убирает белый "отскок" при прокрутке до конца на Android/iOS */
}
body{
  margin:0; min-height:100%; max-width:100vw; overflow-x:hidden;
  background: radial-gradient(1200px 800px at 15% -10%, #191D2C 0%, var(--bg) 55%);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}
.hidden{ display:none !important; }
button{ font-family: inherit; cursor:pointer; }
input{ font-family: inherit; }
a{ color: inherit; text-decoration:none; }

/* ── Бренд ── */
.brand{ display:flex; align-items:center; gap:10px; }
.brand-dot{
  width:12px; height:12px; border-radius:50%;
  background: conic-gradient(from 210deg, var(--accent), var(--role-owner), var(--role-admin), var(--role-curator), var(--role-senior_mod), var(--role-moderator), var(--role-junior_mod), var(--accent));
  box-shadow: 0 0 14px rgba(35,216,196,.55);
}
.brand-name{ font-family: var(--font-display); font-weight:700; font-size:18px; letter-spacing:.2px; }

/* ── Экран входа ── */
.view-login{
  min-height:100vh; display:flex; align-items:center; justify-content:center; padding:24px;
}
.login-card{
  width:100%; max-width:420px; background: var(--panel);
  border:1px solid var(--border); border-radius: var(--radius-lg);
  padding:40px 32px; text-align:center;
  box-shadow: 0 30px 80px -30px rgba(0,0,0,.6);
}
.login-card .brand{ justify-content:center; margin-bottom:28px; }
.login-card h1{
  font-family: var(--font-display); font-size:22px; line-height:1.3; margin:0 0 10px;
}
.muted{ color: var(--text-dim); font-size:14px; line-height:1.6; margin:0 0 28px; }
.fineprint{ color: var(--text-faint); font-size:12px; margin:18px 0 0; line-height:1.5; }

.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  padding:12px 20px; border-radius: 999px; border:none; font-weight:600; font-size:14px;
  transition: transform .12s ease, filter .12s ease;
}
.btn:hover{ filter:brightness(1.08); }
.btn:active{ transform: scale(.98); }
.btn-vk{ width:100%; background:#2787F5; color:#fff; }
.btn-accent{ background: var(--accent); color: var(--accent-ink); }
.btn-danger{ background: var(--danger); color:#2A0810; }
.btn-ghost{
  background:transparent; border:1px solid var(--border); color: var(--text-dim);
  padding:10px 16px; border-radius:999px; font-size:13px; font-weight:500;
}
.btn-ghost:hover{ color:var(--text); border-color:#3A4155; }
.btn-sm{ padding:7px 13px; font-size:12.5px; border-radius:8px; }
.btn:disabled{ opacity:.35; cursor:not-allowed; filter:none; }

/* ── Каркас приложения ── */
.shell{ min-height:100vh; }
.topbar{
  position:sticky; top:0; z-index:20;
  display:flex; align-items:center; justify-content:space-between;
  padding:16px 24px; background: var(--bg-elevated); border-bottom:1px solid var(--border);
}
.topbar-left{ display:flex; align-items:center; gap:14px; }
.topbar-right{ position:relative; display:flex; align-items:center; }
.avatar-btn{
  background:none; border:none; padding:0; border-radius:50%; line-height:0;
  outline-offset:2px;
}
.avatar-btn .avatar{ transition: box-shadow .15s ease; cursor:pointer; }
.avatar-btn:hover .avatar{ box-shadow: 0 0 0 2px var(--accent); }
.avatar-menu{
  position:absolute; top:calc(100% + 10px); right:0; z-index:25;
  background: var(--panel); border:1px solid var(--border); border-radius: var(--radius);
  min-width:180px; padding:6px; box-shadow: 0 20px 50px -15px rgba(0,0,0,.6);
}
.avatar-menu.hidden{ display:none; }
.avatar-menu-item{
  display:block; width:100%; text-align:left; background:none; border:none;
  color:var(--text); font-size:14px; padding:10px 12px; border-radius:8px;
}
.avatar-menu-item:hover{ background: var(--panel-2); }
.avatar-menu-item.danger:hover{ color: var(--danger); }
.menu-toggle{
  background: var(--panel-2); border:1px solid var(--border); color:var(--text);
  width:40px; height:40px; border-radius:10px;
  display:flex; align-items:center; justify-content:center;
}
.menu-toggle:hover{ border-color: var(--accent); color: var(--accent); }

.main{ padding:32px 48px; max-width:1180px; margin:0 auto; }
.tab{ display:none; }
.tab.active{ display:block; }
/* На широких экранах даём карточкам профиля растянуться в две колонки,
   чтобы справа не оставалось пустой полосы. */
@media (min-width: 1040px){
  #dashboard-root, #search-root{
    display:grid; grid-template-columns: 1fr 1fr; gap:18px; align-items:start;
  }
  #dashboard-root .card:first-child, #search-root .card:first-child{ grid-column: 1 / -1; }
}

/* ── Выдвижное меню (справа) ── */
.drawer-backdrop{
  position:fixed; inset:0; background:rgba(6,7,11,.55); backdrop-filter: blur(2px);
  z-index:30; opacity:0; transition:opacity .2s ease;
}
.drawer-backdrop.hidden{ display:none; }
.drawer{
  position:fixed; top:0; left:0; height:100%; width:300px; max-width:86vw;
  background: var(--bg-elevated); border-right:1px solid var(--border);
  z-index:40; display:flex; flex-direction:column; padding:20px;
  transform: translateX(-100%); transition: transform .22s ease;
}
.drawer.open{ transform: translateX(0); }
.drawer-head{ display:flex; align-items:center; justify-content:space-between; margin-bottom:22px; }
.drawer .nav{ display:flex; flex-direction:column; gap:2px; flex:1; }
.nav-item{
  text-align:left; background:none; border:none; color:var(--text-dim);
  padding:12px 14px; border-radius:8px; font-size:14.5px; font-weight:500;
}
.nav-item:hover{ background: var(--panel); color:var(--text); }
.nav-item.active{ background: var(--panel-2); color:var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.drawer-footer{ padding-top:16px; border-top:1px solid var(--border); display:flex; flex-direction:column; gap:12px; }

/* ── Чип роли ── */
.role-chip{
  display:inline-flex; align-items:center; gap:7px; padding:5px 12px 5px 8px;
  border-radius:999px; background: var(--panel-2); border:1px solid var(--border);
  font-size:13px; font-weight:500;
}
.role-dot{ width:9px; height:9px; border-radius:50%; flex-shrink:0; }
.me-chip .role-chip{ width:100%; }

/* ── Карточки ── */
.card{
  background: var(--panel); border:1px solid var(--border); border-radius: var(--radius-lg);
  padding:22px 24px; margin-bottom:18px;
  max-width:100%; overflow-x:hidden;
}
.card h2{ font-family:var(--font-display); font-size:15px; margin:0 0 16px; color:var(--text-dim); font-weight:600; letter-spacing:.3px; text-transform:uppercase; font-size:12px; }
.profile-head{ display:flex; align-items:center; justify-content:space-between; gap:16px; flex-wrap:wrap; margin-bottom:24px; }
.profile-name{ font-family:var(--font-display); font-size:26px; font-weight:600; margin:0 0 4px; }
.profile-sub{ color:var(--text-dim); font-size:14px; font-family: var(--font-mono); }

.stat-grid{ display:grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap:14px; margin-bottom:18px; }
.stat{
  background: var(--panel-2); border:1px solid var(--border); border-radius: var(--radius);
  padding:16px 16px;
}
.stat-value{ font-family: var(--font-mono); font-size:24px; font-weight:500; }
.stat-label{ color: var(--text-dim); font-size:12.5px; margin-top:4px; }

.punish-grid{ display:grid; grid-template-columns: repeat(auto-fit, minmax(110px,1fr)); gap:12px; }
.punish{
  background: var(--panel-2); border:1px solid var(--border); border-radius:var(--radius);
  padding:14px; text-align:center;
}
.punish-num{ font-family:var(--font-mono); font-size:20px; }
.punish-label{ color:var(--text-dim); font-size:11.5px; margin-top:4px; }

.badge{ display:inline-block; padding:3px 9px; border-radius:6px; font-size:12px; font-weight:600; }
.badge-active{ background: var(--danger-dim); color: var(--danger); }
.badge-ok{ background:#0C2A1C; color:var(--ok); }

.list-row{
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  padding:12px 0; border-bottom:1px solid var(--border); font-size:13.5px;
}
.list-row:last-child{ border-bottom:none; }
.list-row .reason{ color:var(--text-dim); flex:1; }
.list-row .when{ color:var(--text-faint); font-family:var(--font-mono); font-size:11.5px; }

/* ── Действия ── */
.actions-grid{ display:flex; flex-wrap:wrap; gap:8px; }
.actions-group{ margin-bottom:16px; }
.actions-group:last-child{ margin-bottom:0; }
.actions-group-label{
  font-size:11.5px; text-transform:uppercase; letter-spacing:.4px;
  color: var(--text-faint); font-weight:600; margin-bottom:8px;
}
.action-btn{
  padding:9px 15px; border-radius:8px; font-size:13px; font-weight:600;
  border:1px solid var(--border); background: var(--panel-2); color:var(--text);
}
.action-btn:hover:not(:disabled){ border-color: var(--accent); color: var(--accent); }
.action-btn.danger:hover:not(:disabled){ border-color: var(--danger); color: var(--danger); }

/* ── Поиск ── */
.search-bar{ display:flex; gap:10px; margin-bottom:24px; }
.search-bar input{
  flex:1; background: var(--panel); border:1px solid var(--border); border-radius:999px;
  padding:12px 18px; color:var(--text); font-size:14px; font-family:var(--font-mono);
}
.search-bar input:focus{ outline:none; border-color:var(--accent); }

/* ── Таблица персонала ── */
.staff-table-wrap{
  width:100%; overflow-x:auto; -webkit-overflow-scrolling:touch;
  border-radius:8px;
}
.staff-table{ width:100%; min-width:560px; border-collapse:collapse; }
.staff-table th{
  text-align:left; font-size:11.5px; text-transform:uppercase; letter-spacing:.4px;
  color:var(--text-faint); padding:8px 10px; border-bottom:1px solid var(--border); font-weight:600;
}
.staff-table td{ padding:12px 10px; border-bottom:1px solid var(--border); font-size:13.5px; }
.staff-table tr:last-child td{ border-bottom:none; }
.staff-table td.mono{ font-family:var(--font-mono); color:var(--text-dim); }
.link-btn{ color:var(--accent); font-size:12.5px; font-weight:600; background:none; border:none; }

/* ── Модалка ── */
.modal-backdrop{
  position:fixed; inset:0; background:rgba(6,7,11,.6); backdrop-filter: blur(3px);
  display:flex; align-items:center; justify-content:center; z-index:50; padding:20px;
}
.modal{
  width:100%; max-width:400px; background: var(--panel); border:1px solid var(--border);
  border-radius: var(--radius-lg); padding:24px; box-shadow: 0 30px 80px -20px rgba(0,0,0,.7);
}
.modal h3{ font-family:var(--font-display); margin:0 0 16px; font-size:17px; }
.field{ margin-bottom:14px; }
.field label{ display:block; font-size:12.5px; color:var(--text-dim); margin-bottom:6px; }
.field input, .field select{
  width:100%; background: var(--panel-2); border:1px solid var(--border); border-radius:8px;
  padding:10px 12px; color:var(--text); font-size:14px; font-family: var(--font-body);
}
.field input:focus, .field select:focus{ outline:none; border-color:var(--accent); }
.modal-actions{ display:flex; justify-content:flex-end; gap:10px; margin-top:20px; }

/* ── Тосты ── */
.toast-root{ position:fixed; bottom:20px; right:20px; display:flex; flex-direction:column; gap:8px; z-index:100; }
.toast{
  background: var(--panel); border:1px solid var(--border); border-left:3px solid var(--accent);
  padding:12px 16px; border-radius:8px; font-size:13.5px; max-width:340px;
  box-shadow: 0 10px 30px -10px rgba(0,0,0,.5); animation: toast-in .18s ease;
}
.toast.error{ border-left-color: var(--danger); }
@keyframes toast-in{ from{ transform: translateY(8px); opacity:0; } to{ transform:none; opacity:1; } }

.empty{ color: var(--text-faint); font-size:13.5px; padding:20px 0; text-align:center; }
.loading{ color: var(--text-faint); font-size:13.5px; }

/* ── Аватарка ── */
.avatar{
  width:56px; height:56px; border-radius:50%; object-fit:cover; flex-shrink:0;
  border:1px solid var(--border); background: var(--panel-2);
}
.avatar-sm{ width:32px; height:32px; }
.profile-title{ display:flex; align-items:center; gap:14px; }
.staff-user-cell{ display:flex; align-items:center; gap:10px; }

/* ── Переключатель /invis ── */
.invis-toggle{
  display:inline-flex; align-items:center; gap:9px;
  background: var(--panel-2); border:1px solid var(--border); border-radius:999px;
  padding:8px 14px 8px 8px; font-size:13px; font-weight:500; color:var(--text);
}
.switch{
  position:relative; width:36px; height:20px; border-radius:999px; background:#3A4155;
  flex-shrink:0; transition: background .15s ease;
}
.switch::after{
  content:''; position:absolute; top:2px; left:2px; width:16px; height:16px; border-radius:50%;
  background:#fff; transition: transform .15s ease;
}
.switch.on{ background: var(--accent); }
.switch.on::after{ transform: translateX(16px); }

/* ── Фильтры журнала логов ── */
.filters-bar{
  display:flex; flex-wrap:wrap; gap:10px; margin-bottom:18px;
  background: var(--panel); border:1px solid var(--border); border-radius: var(--radius-lg);
  padding:16px 18px;
}
.filters-bar .field{ margin-bottom:0; flex:1; min-width:130px; }
.filters-bar .field.narrow{ min-width:100px; flex:0 0 100px; }
.filters-bar-actions{ display:flex; align-items:flex-end; gap:8px; }

@media (max-width: 760px){
  .topbar{ padding:14px 16px; }
  .main{ padding:18px 16px; }
  .stat-grid, .punish-grid{ grid-template-columns: repeat(2, 1fr); }
  .drawer{ width:100%; max-width:100vw; }
}
@media (prefers-reduced-motion: reduce){
  *{ animation-duration:.001ms !important; transition-duration:.001ms !important; }
}
