/* ===== Tiktak Admin · компоненты ===== */

/* ---- панели и карточки ---- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(16px);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}

.card + .card { margin-top: 16px; }

.card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.card-head h2 { margin: 0; font-size: 17px; font-weight: 700; }
.card-head p { margin: 1px 0 0; font-size: 12.5px; color: var(--muted); }
.card-head .spacer { margin-left: auto; }

.card-ico {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 12px;
  background: var(--grad-soft);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-size: 20px;
}

.grid { display: grid; gap: 16px; }
.grid.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.side { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }

@media (max-width: 1250px) {
  .grid.g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.side { grid-template-columns: 1fr; }
}
@media (max-width: 780px) {
  .grid.g2, .grid.g3, .grid.g4 { grid-template-columns: 1fr; }
}

/* ---- метрика-карточка ---- */
.stat {
  position: relative;
  overflow: hidden;
  padding: 16px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(14px);
  transition: transform 0.25s var(--ease), border-color 0.25s;
}

.stat:hover { transform: translateY(-3px); border-color: var(--line-2); }
.stat::after {
  content: "";
  position: absolute;
  inset: -40% -60% auto auto;
  width: 180px;
  height: 180px;
  background: var(--grad-soft);
  filter: blur(28px);
  opacity: 0.7;
  pointer-events: none;
}

.stat-ico { font-size: 22px; }
.stat-name { font-size: 12px; color: var(--muted); margin-top: 8px; letter-spacing: 0.3px; }
.stat-value {
  font-size: 30px;
  font-weight: 800;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  position: relative;
}
.stat-foot { font-size: 12px; color: var(--dim); margin-top: 6px; }
.stat-foot b { color: var(--text); font-weight: 600; }

/* ---- кнопки ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.18s var(--ease), background 0.2s, border-color 0.2s, box-shadow 0.25s;
}

.btn:hover { transform: translateY(-2px); border-color: var(--line-2); background: rgba(255, 255, 255, 0.1); }
.btn:active { transform: translateY(0); }

.btn-primary { background: var(--grad); border-color: transparent; box-shadow: var(--shadow-glow); }
.btn-primary:hover { background: var(--grad); filter: brightness(1.08); }
.btn-green { background: var(--grad-green); border-color: transparent; color: #04231a; }
.btn-danger { background: rgba(255, 77, 109, 0.16); border-color: rgba(255, 77, 109, 0.4); color: #ffb3c1; }
.btn-danger:hover { background: rgba(255, 77, 109, 0.28); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 10px; }
.btn-icon { padding: 8px; width: 36px; height: 36px; justify-content: center; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---- поля ввода ---- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.field .hint { font-size: 11.5px; color: var(--dim); }

input[type="text"], input[type="password"], input[type="number"], input[type="search"],
select, textarea {
  width: 100%;
  padding: 11px 13px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.28);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: rgba(124, 92, 255, 0.65);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.16);
  background: rgba(0, 0, 0, 0.4);
}

textarea { resize: vertical; min-height: 120px; line-height: 1.55; }
textarea.mono, input.mono { font-family: "JetBrains Mono", Consolas, monospace; font-size: 13px; }

select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { display: none; }
.switch-track {
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid var(--line);
  position: relative;
  transition: background 0.25s var(--ease);
  flex: 0 0 46px;
}
.switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.25s var(--ease);
}
.switch input:checked + .switch-track { background: var(--grad-green); }
.switch input:checked + .switch-track::after { transform: translateX(20px); }

.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.form-grid .span2 { grid-column: 1 / -1; }  /* поле во всю ширину: каскад моделей */

/* ---- таблицы ---- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); }

table.tbl { width: 100%; border-collapse: separate; border-spacing: 0 6px; font-size: 14px; }
table.tbl th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--dim);
  font-weight: 700;
  padding: 4px 12px;
  white-space: nowrap;
}
table.tbl td {
  background: rgba(255, 255, 255, 0.035);
  padding: 12px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
table.tbl tr td:first-child { border-left: 1px solid var(--line); border-radius: 12px 0 0 12px; }
table.tbl tr td:last-child { border-right: 1px solid var(--line); border-radius: 0 12px 12px 0; }
table.tbl tbody tr { transition: transform 0.18s var(--ease); }
table.tbl tbody tr:hover td { background: rgba(255, 255, 255, 0.07); }
table.tbl .num { font-variant-numeric: tabular-nums; }
table.tbl .actions { display: flex; gap: 6px; justify-content: flex-end; }

.empty {
  padding: 46px 20px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}
.empty .big { font-size: 40px; display: block; margin-bottom: 10px; }

/* ---- бейджи ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge.ok { background: rgba(23, 227, 154, 0.14); color: #7bf3c8; border-color: rgba(23, 227, 154, 0.3); }
.badge.warn { background: rgba(255, 190, 61, 0.14); color: #ffd98a; border-color: rgba(255, 190, 61, 0.3); }
.badge.err { background: rgba(255, 77, 109, 0.15); color: #ffa8ba; border-color: rgba(255, 77, 109, 0.32); }
.badge.info { background: rgba(0, 212, 255, 0.13); color: #8de8ff; border-color: rgba(0, 212, 255, 0.28); }
.badge.violet { background: rgba(124, 92, 255, 0.16); color: #c4b5ff; border-color: rgba(124, 92, 255, 0.34); }
.badge.mute { background: rgba(255, 255, 255, 0.07); color: var(--muted); border-color: var(--line); }

/* ---- код и моно-текст ---- */
code.code, .code {
  font-family: "JetBrains Mono", Consolas, monospace;
  font-size: 13px;
  padding: 3px 8px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--line);
  letter-spacing: 0.6px;
}

.copy-code {
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.copy-code:hover { border-color: rgba(124, 92, 255, 0.6); color: #c4b5ff; }

pre.pre {
  margin: 0;
  padding: 14px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--line);
  font-family: "JetBrains Mono", Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 340px;
  overflow: auto;
}

/* ---- вкладки-фильтры ---- */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  transition: all 0.2s var(--ease);
}
.chip:hover { color: var(--text); border-color: var(--line-2); transform: translateY(-1px); }
.chip.on { background: var(--grad-soft); border-color: rgba(124, 92, 255, 0.45); color: var(--text); }
.chip .cnt { font-size: 11px; opacity: 0.75; font-variant-numeric: tabular-nums; }

/* ---- аккордеон ---- */
.acc { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); overflow: hidden; }
.acc + .acc { margin-top: 12px; }
.acc.open { border-color: rgba(124, 92, 255, 0.42); box-shadow: var(--shadow-glow); }

.acc-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s;
}
.acc-head:hover { background: rgba(255, 255, 255, 0.04); }

.acc-emoji {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 13px;
  background: var(--grad-soft);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-size: 23px;
}

.acc-title { font-weight: 700; font-size: 15.5px; }
.acc-sub { font-size: 12.5px; color: var(--muted); }
.acc-arrow { margin-left: auto; color: var(--muted); transition: transform 0.3s var(--ease); font-size: 13px; }
.acc.open .acc-arrow { transform: rotate(180deg); }

.acc-body { display: none; padding: 4px 18px 18px; border-top: 1px solid var(--line); }
.acc.open .acc-body { display: block; animation: rise 0.35s var(--ease) both; }

/* ---- тосты ---- */
.toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 90;
}

.toast {
  min-width: 240px;
  max-width: 380px;
  padding: 13px 16px;
  border-radius: 14px;
  border: 1px solid var(--line-2);
  background: rgba(18, 20, 30, 0.94);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  font-size: 13.5px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  animation: toast-in 0.35s var(--ease) both;
}
.toast.ok { border-color: rgba(23, 227, 154, 0.45); }
.toast.err { border-color: rgba(255, 77, 109, 0.5); }
.toast.hide { animation: toast-out 0.3s var(--ease) both; }

@keyframes toast-in { from { opacity: 0; transform: translateX(30px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(30px) scale(0.96); } }

/* ---- прогресс-полоска ---- */
.meter { height: 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.09); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 999px; background: var(--grad); transition: width 0.5s var(--ease); }
.meter.green > span { background: var(--grad-green); }
.meter.red > span { background: var(--grad-red); }

/* ---- пагинация ---- */
.pager { display: flex; gap: 6px; align-items: center; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.pager .btn-sm { min-width: 38px; justify-content: center; }
.pager .now { background: var(--grad); border-color: transparent; }


