/* FunTime Bots — тёмное «стекло»: фон с мягкими пятнами, боковая рейка, стеклянные карточки. */

:root {
  --bg: #0B0E14;
  --surface: rgba(22, 27, 34, 0.58);
  --surface-2: rgba(32, 38, 49, 0.72);
  --surface-3: rgba(46, 53, 66, 0.85);
  --line: rgba(255, 255, 255, 0.10);
  --line-soft: rgba(255, 255, 255, 0.06);
  --line-strong: rgba(255, 255, 255, 0.18);
  --text: #E8EBF1;
  --text-2: #A2AAB8;
  --text-3: #6E7686;
  --accent: #8E8CFF;
  --accent-hover: #A9A7FF;
  --accent-soft: rgba(142, 140, 255, 0.14);
  --accent-line: rgba(142, 140, 255, 0.40);
  --ok: hsl(158 72% 46%);
  --warn: hsl(38 92% 58%);
  --err: hsl(0 88% 65%);
  --info: #38BDF8;
  --profit: #00FFA3;
  --blur: 16px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Mono", Consolas, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(620px 620px at 60px -40px, rgba(93, 91, 224, 0.42), transparent 70%),
    radial-gradient(520px 520px at calc(100% + 60px) 40%, rgba(56, 189, 248, 0.14), transparent 70%),
    radial-gradient(560px 560px at 55% calc(100% + 120px), rgba(0, 255, 163, 0.07), transparent 70%),
    radial-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px) 0 0 / 26px 26px;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
h2 { font-size: 24px; font-weight: 700; letter-spacing: -0.025em; }
h3 { font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-2); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
[hidden] { display: none !important; }

/* ====== Каркас ====== */

#app { position: relative; z-index: 1; min-height: 100%; padding-left: 76px; }

#sidebar {
  position: fixed; left: 0; top: 0; bottom: 0; width: 76px; z-index: 60;
  display: flex; flex-direction: column; gap: 2px; padding: 16px 12px;
  background: rgba(12, 15, 21, 0.74);
  backdrop-filter: blur(var(--blur)) saturate(140%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(140%);
  border-right: 1px solid var(--line-soft);
  overflow: hidden auto; scrollbar-width: none; white-space: nowrap;
  transition: width 0.28s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.28s;
}
#sidebar::-webkit-scrollbar { display: none; }
#sidebar:hover { width: 248px; box-shadow: 24px 0 60px -24px rgba(0, 0, 0, 0.8); }

.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; padding: 2px; }
.brand-icon {
  flex: 0 0 48px; height: 48px; border-radius: 14px; display: grid; place-items: center;
  background: linear-gradient(140deg, rgba(142, 140, 255, 0.35), rgba(56, 189, 248, 0.18));
  border: 1px solid var(--accent-line);
}
.brand-icon svg { width: 26px; height: 26px; }
.brand-text b { display: block; font-size: 16px; letter-spacing: -0.02em; }
.brand-text span { font-size: 12px; color: var(--text-3); }

.nav-link {
  display: flex; align-items: center; gap: 14px; height: 44px; padding: 0 13px;
  border-radius: var(--r-md); color: var(--text-2); font-weight: 500; font-size: 14px;
  transition: background 0.15s, color 0.15s;
}
.nav-link svg { flex: 0 0 24px; width: 24px; height: 24px; }
.nav-link:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.nav-link.active { background: var(--accent-soft); color: var(--accent-hover); box-shadow: inset 0 0 0 1px var(--accent-line); }

.side-section { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.side-section h3 { padding: 0 13px 8px; font-size: 11px; }
.side-bot { display: flex; align-items: center; gap: 14px; height: 38px; padding: 0 19px; border-radius: var(--r-md); color: var(--text-2); font-size: 14px; }
.side-bot:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.side-bot .dot { flex: 0 0 12px; }
.side-foot { margin-top: auto; padding-top: 12px; }

.brand-text, .nav-link > span, .side-section h3, .side-bot > span:last-child { opacity: 0; transition: opacity 0.18s; }
#sidebar:hover .brand-text, #sidebar:hover .nav-link > span, #sidebar:hover .side-section h3, #sidebar:hover .side-bot > span:last-child { opacity: 1; transition-delay: 0.06s; }

#content { padding: 0 28px 48px; max-width: 1500px; }

.page-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin: 0 -28px 22px; padding: 18px 28px;
  background: rgba(11, 14, 20, 0.72);
  backdrop-filter: blur(var(--blur)); -webkit-backdrop-filter: blur(var(--blur));
  border-bottom: 1px solid var(--line-soft);
}
.page-header h2 { display: flex; align-items: center; gap: 12px; }
.page-header .spacer { flex: 1; }
.page-sub { flex-basis: 100%; color: var(--text-2); font-size: 14px; margin-top: -6px; }

/* ====== Элементы ====== */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  backdrop-filter: blur(var(--blur)); -webkit-backdrop-filter: blur(var(--blur));
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.card + .card, .card + .grid, .grid + .card, .two-col + .card, .stats + .two-col, .stats + .card, .card + .two-col, .card + .stats { margin-top: 18px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-head .spacer { flex: 1; }
.card-click { cursor: pointer; transition: border-color 0.15s, transform 0.15s, background 0.15s; }
.card-click:hover { border-color: var(--accent-line); background: var(--surface-2); transform: translateY(-1px); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 18px; }
.two-col { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 18px; }
@media (max-width: 1100px) { .two-col { grid-template-columns: 1fr; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: var(--r-md);
  border: 1px solid var(--line); background: rgba(255, 255, 255, 0.05); color: var(--text);
  font: 600 14px var(--font); cursor: pointer; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.btn:hover { background: rgba(255, 255, 255, 0.10); border-color: var(--line-strong); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn-primary { background: var(--accent); border-color: transparent; color: #0B0E14; box-shadow: 0 6px 22px rgba(142, 140, 255, 0.3); }
.btn-primary:hover { background: var(--accent-hover); border-color: transparent; }
.btn-danger { color: var(--err); border-color: rgba(255, 90, 90, 0.35); background: rgba(255, 77, 77, 0.08); }
.btn-danger:hover { background: rgba(255, 77, 77, 0.18); border-color: rgba(255, 90, 90, 0.6); }
.btn-sm { height: 30px; padding: 0 11px; font-size: 13px; border-radius: var(--r-sm); }

.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--text-3); box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.04); }
.dot-WORKING { background: var(--ok); box-shadow: 0 0 12px rgba(30, 200, 130, 0.7); }
.dot-NO_ROLE { background: var(--warn); box-shadow: 0 0 12px rgba(240, 170, 50, 0.6); }
.dot-CONNECTING, .dot-WAITING { background: var(--info); animation: pulse 1.4s ease-in-out infinite; }
.dot-FATAL { background: var(--err); box-shadow: 0 0 12px rgba(255, 80, 80, 0.7); }
@keyframes pulse { 50% { opacity: 0.35; } }

.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: rgba(255, 255, 255, 0.07); color: var(--text-2); border: 1px solid var(--line-soft); }
.badge-accent { background: var(--accent-soft); color: var(--accent-hover); border-color: var(--accent-line); }
.badge-warn { background: rgba(240, 170, 50, 0.12); color: var(--warn); border-color: rgba(240, 170, 50, 0.35); }
.badge-ok { background: rgba(30, 200, 130, 0.12); color: var(--ok); border-color: rgba(30, 200, 130, 0.35); }

.bar { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, #ff5d6c, #ff8a8a); transition: width 0.3s; }

.banner { display: flex; gap: 10px; align-items: center; padding: 12px 16px; border-radius: var(--r-md); margin-bottom: 18px; font-size: 14px; border: 1px solid rgba(240, 170, 50, 0.35); background: rgba(240, 170, 50, 0.08); color: #ffd58a; }
.banner-err { border-color: rgba(255, 90, 90, 0.4); background: rgba(255, 77, 77, 0.08); color: #ffb3b3; }
.empty { padding: 36px 20px; text-align: center; color: var(--text-3); border: 1px dashed var(--line); border-radius: var(--r-lg); }

/* ====== Обзор ====== */

.bot-card .name { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.bot-card .activity { color: var(--text-2); font-size: 14px; min-height: 21px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 12px 0; font-size: 14px; }
.kv dt { color: var(--text-3); }
.kv dd { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-actions { display: flex; gap: 8px; margin-top: 14px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 16px; backdrop-filter: blur(var(--blur)); min-width: 0; }
.stat b { display: block; font: 600 20px var(--mono); font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat span { font-size: 12px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; }
.stat.good b { color: var(--profit); text-shadow: 0 0 18px rgba(0, 255, 163, 0.35); }
.stat.small b { font-size: 15px; font-family: var(--font); }
.stat.compact b { font-size: 16px; }
.stat.wide { grid-column: span 2; }

/* ====== Чат, логи ====== */

.console {
  height: 340px; overflow-y: auto; padding: 12px 14px; border-radius: var(--r-md);
  background: rgba(6, 8, 12, 0.6); border: 1px solid var(--line-soft);
  font: 13px/1.55 var(--mono); white-space: pre-wrap; word-break: break-word;
}
.console.tall { height: calc(100vh - 210px); min-height: 320px; }
.console .t { color: var(--text-3); }
.console .tag { color: var(--accent); }
.console .ACTIONBAR, .console .TITLE { color: var(--info); }
.console .DEBUG, .console .TRACE { color: var(--text-3); }
.console .WARN { color: var(--warn); }
.console .ERROR { color: var(--err); }
.chat-input { display: flex; gap: 8px; margin-top: 10px; }

input[type=text], input[type=password], input[type=number], select, textarea {
  width: 100%; height: 38px; padding: 0 12px; border-radius: var(--r-md);
  border: 1px solid var(--line); background: rgba(6, 8, 12, 0.5); color: var(--text);
  font: 14px var(--font); outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { height: auto; min-height: 220px; padding: 10px 12px; font: 13px/1.5 var(--mono); resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type=number] { font-family: var(--mono); }
select option { background: #151a22; }

.sb-title { font-weight: 700; text-align: center; padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1px solid var(--line-soft); }
.sb-line { font: 13px/1.7 var(--mono); white-space: pre-wrap; color: var(--text-2); }

/* ====== Инвентарь ====== */

.inv { display: grid; grid-template-columns: repeat(9, 58px); gap: 4px; }
.inv + .inv { margin-top: 10px; }
.slot {
  position: relative; width: 58px; height: 58px; border-radius: 8px; padding: 4px 5px;
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line-soft);
  font-size: 9.5px; line-height: 1.15; color: var(--text-2); overflow: hidden; word-break: break-word;
}
.slot.full { background: rgba(142, 140, 255, 0.08); border-color: var(--line); color: var(--text); border-left: 3px solid var(--tone, var(--accent)); cursor: help; }
.slot.held { box-shadow: 0 0 0 2px var(--accent-line); }
.slot .n { position: absolute; right: 4px; bottom: 2px; font: 600 12px var(--mono); color: #fff; text-shadow: 0 1px 3px #000; }
.inv-wrap { overflow-x: auto; padding-bottom: 4px; }

/* ====== Формы ====== */

.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px 18px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field > label { font-size: 13px; color: var(--text-2); font-weight: 500; }
.field .hint { font-size: 12px; color: var(--text-3); }
.row { display: flex; gap: 8px; align-items: center; }
.row > * { min-width: 0; }
.row > .btn { flex: 0 0 auto; }
.form-section { grid-column: 1 / -1; margin-top: 8px; padding-top: 14px; border-top: 1px solid var(--line-soft); }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch i { width: 42px; height: 24px; border-radius: 12px; background: rgba(255, 255, 255, 0.12); position: relative; transition: background 0.18s; flex: 0 0 auto; }
.switch i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform 0.18s; }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(18px); }
.switch input:focus-visible + i { box-shadow: 0 0 0 3px var(--accent-soft); }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em; padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 8px 10px; border-bottom: 1px solid var(--line-soft); }
td.num, th.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { height: 32px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.04); color: var(--text-2); font: 500 13px var(--font); cursor: pointer; }
.chip:hover { color: var(--text); border-color: var(--line-strong); }
.chip.active { background: var(--accent-soft); color: var(--accent-hover); border-color: var(--accent-line); }

.chart { width: 100%; height: 190px; display: block; }
.chart rect { fill: var(--accent); opacity: 0.85; }
.chart rect:hover { opacity: 1; fill: var(--accent-hover); }
.chart line { stroke: var(--line-soft); }
.chart text { fill: var(--text-3); font: 11px var(--mono); }

/* ====== Модальное окно, уведомления ====== */

#modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: start center; padding: 40px 16px; overflow-y: auto; background: rgba(4, 6, 10, 0.72); backdrop-filter: blur(6px); }
#modal .card { width: min(860px, 100%); background: rgba(20, 24, 32, 0.96); }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line-soft); }

#toasts { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 40px)); }
.toast { padding: 12px 16px; border-radius: var(--r-md); background: rgba(24, 29, 38, 0.96); border: 1px solid var(--line-strong); box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5); font-size: 14px; animation: rise 0.2s ease-out; }
.toast.err { border-color: rgba(255, 90, 90, 0.55); color: #ffb3b3; }
.toast.ok { border-color: rgba(30, 200, 130, 0.5); }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }

/* ====== Вход ====== */

.login-wrap { position: relative; z-index: 1; min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(380px, 100%); text-align: center; }
.login-card .brand-icon { width: 64px; height: 64px; flex: none; margin: 0 auto 16px; border-radius: 18px; }
.login-card .brand-icon svg { width: 34px; height: 34px; }
.login-card h1 { font-size: 22px; letter-spacing: -0.02em; }
.login-card p { color: var(--text-2); font-size: 14px; margin: 4px 0 20px; }
.login-card form { display: flex; flex-direction: column; gap: 12px; }
.login-card .error { color: var(--err); font-size: 14px; min-height: 21px; }

@media (max-width: 900px) {
  #app { padding-left: 0; padding-bottom: 68px; }
  #sidebar, #sidebar:hover { top: auto; right: 0; width: auto; height: 64px; flex-direction: row; padding: 8px; border-right: 0; border-top: 1px solid var(--line-soft); overflow: auto hidden; box-shadow: none; }
  .brand, .side-section, .side-foot { display: none; }
  .nav-link { flex: 0 0 48px; padding: 0 12px; }
  .nav-link > span { display: none; }
  #content { padding: 0 14px 30px; }
  .page-header { margin: 0 -14px 16px; padding: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
