/* Оформление админки «Техно без паники» поверх стандартной */

:root, html[data-theme="light"] {
  --primary: #1f5fd6;
  --secondary: #0f2d6b;
  --accent: #7cc4ff;
  --primary-fg: #fff;
  --header-color: #dfe9ff;
  --header-branding-color: #fff;
  --header-bg: #071433;
  --header-link-color: #cfe0ff;
  --breadcrumbs-fg: #dfe8ff;
  --breadcrumbs-link-fg: #fff;
  --breadcrumbs-bg: #123a86;
  --link-fg: #1c58c9;
  --link-hover-color: #0b3aa6;
  --link-selected-fg: #0b3aa6;
  --button-bg: #1f5fd6;
  --button-hover-bg: #174bb0;
  --default-button-bg: #0f2d6b;
  --default-button-hover-bg: #0b224f;
  --selected-row: #eaf2ff;
  --tbp-card: #f5f8ff;
  --tbp-card-border: #d9e4fb;
}
@media (prefers-color-scheme: dark) {
  :root {
    --primary: #2f7bff;
    --secondary: #0f2d6b;
    --link-fg: #7cc4ff;
    --link-hover-color: #a9d8ff;
    --link-selected-fg: #a9d8ff;
    --breadcrumbs-bg: #0e2a63;
    --button-bg: #2f6fe8;
    --button-hover-bg: #1f5fd6;
    --default-button-bg: #1f5fd6;
    --default-button-hover-bg: #2f6fe8;
    --selected-row: #10244d;
    --tbp-card: #111a2e;
    --tbp-card-border: #243659;
  }
}
html[data-theme="dark"] {
  --primary: #2f7bff;
  --secondary: #0f2d6b;
  --link-fg: #7cc4ff;
  --link-hover-color: #a9d8ff;
  --link-selected-fg: #a9d8ff;
  --breadcrumbs-bg: #0e2a63;
  --button-bg: #2f6fe8;
  --button-hover-bg: #1f5fd6;
  --default-button-bg: #1f5fd6;
  --default-button-hover-bg: #2f6fe8;
  --selected-row: #10244d;
  --tbp-card: #111a2e;
  --tbp-card-border: #243659;
}

#header { background: linear-gradient(90deg, #071433, #0c2257); }
.tbp-brand { display: inline-flex; align-items: center; gap: 10px; }
.tbp-badge {
  display: inline-block;
  padding: 2px 8px;
  border: 2px solid #4aa8ff;
  border-radius: 9px;
  font-weight: 900;
  color: #fff;
  box-shadow: 0 0 12px rgba(60, 160, 255, 0.55);
}
.tbp-brand__name { font-weight: 700; }
.tbp-brand__sub { font-size: 0.8em; opacity: 0.7; }

/* Главная панель */
.tbp-actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin-bottom: 20px; }
.tbp-action {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid var(--tbp-card-border);
  background: var(--tbp-card);
  color: var(--body-fg) !important;
  text-decoration: none !important;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}
.tbp-action:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(20, 60, 160, 0.18); }
.tbp-action b { display: block; font-size: 1.05rem; margin-bottom: 2px; }
.tbp-action small { display: block; color: var(--body-quiet-color); line-height: 1.35; }
.tbp-action__icon { flex: none; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 12px; background: rgba(47, 123, 255, 0.14); color: var(--primary); }
.tbp-action--primary { grid-column: span 2; background: linear-gradient(135deg, #2f7bff, #1a4fd0); border-color: transparent; color: #fff !important; }
.tbp-action--primary small { color: #dbe7ff; }
.tbp-action--primary .tbp-action__icon { background: rgba(255, 255, 255, 0.18); color: #fff; }
@media (max-width: 767px) { .tbp-action--primary { grid-column: auto; } }

.tbp-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 20px; }
.tbp-stat { padding: 14px 16px; border-radius: 12px; border: 1px solid var(--tbp-card-border); background: var(--tbp-card); }
.tbp-stat b { display: block; font-size: 1.8rem; line-height: 1.1; color: var(--primary); }
.tbp-stat span { color: var(--body-quiet-color); font-size: 0.85rem; }
.tbp-recent table { width: 100%; }
.tbp-h2 { margin: 26px 0 10px; font-size: 1rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--body-quiet-color); }
.tbp-empty { padding: 14px; color: var(--body-quiet-color); }
.tbp-ok { color: #1b9e5a; font-weight: 600; }
.tbp-muted { color: var(--body-quiet-color); }
.tbp-side__body { padding: 10px 14px; }
.tbp-side__body p { margin: 0 0 10px; }
.tbp-meter { height: 8px; border-radius: 8px; background: var(--hairline-color); overflow: hidden; margin-bottom: 10px; }
.tbp-meter span { display: block; height: 100%; background: linear-gradient(90deg, #2fcf7e, #2f7bff); }
.tbp-meter--warn span { background: linear-gradient(90deg, #ffad42, #ff5a6e); }
.tbp-key { display: block; word-break: break-all; padding: 8px 10px; margin-bottom: 8px; border-radius: 8px; background: var(--darkened-bg); font-size: 0.85em; }

/* Списки и формы */
.tbp-thumb { display: block; border-radius: 10px; object-fit: cover; background: var(--darkened-bg); }
.tbp-thumb--empty { border: 1px dashed var(--border-color); }
.tbp-chip { display: inline-block; padding: 1px 8px; margin: 1px 2px; border-radius: 999px; background: rgba(47, 123, 255, 0.14); color: var(--link-fg); font-size: 0.85em; white-space: nowrap; }
.tbp-chip--beta { background: rgba(255, 173, 66, 0.2); color: #c77700; }
.tbp-feeds { margin: 0; padding-left: 18px; }
.tbp-details th { padding-right: 16px; white-space: nowrap; }
.tbp-details code { word-break: break-all; }
code.tbp-token { display: inline-block; margin-top: 6px; padding: 6px 10px; font-size: 1.05em; background: #fff; color: #111; border-radius: 6px; user-select: all; }
.object-tools a.tbp-tool-primary { background: #1b9e5a; }
.object-tools a.tbp-tool-primary:hover { background: #148048; }
fieldset .description { font-size: 0.95em; }
textarea.tbp-code { font-family: ui-monospace, Consolas, monospace; }
.help, .help p, div.help { max-width: 820px; }

/* Справка */
.tbp-help { max-width: 860px; font-size: 15px; line-height: 1.65; }
.tbp-help h1 { margin: 0 0 16px; }
.tbp-help h2 { margin: 28px 0 10px; padding: 0; background: none; color: var(--body-fg); font-size: 1.35rem; text-transform: none; letter-spacing: 0; }
.tbp-help h3 { margin: 20px 0 8px; font-size: 1.1rem; }
.tbp-help ul, .tbp-help ol { padding-left: 22px; }
.tbp-help li { margin: 4px 0; list-style: inherit; }
.tbp-help ol li { list-style: decimal; }
.tbp-help ul li { list-style: disc; }
.tbp-help blockquote { margin: 12px 0; padding: 10px 16px; border-left: 3px solid var(--primary); background: var(--tbp-card); }

/* Страницы установки пароля и блокировки */
.tbp-setup #content { display: grid; place-items: center; min-height: 60vh; }
.tbp-setup__card { width: min(480px, 100%); padding: 28px 30px; border-radius: 16px; border: 1px solid var(--tbp-card-border); background: var(--tbp-card); }
.tbp-setup__card h1 { margin-bottom: 14px; }
.tbp-setup__card .form-row { padding: 10px 0; border: 0; }
.tbp-setup__card label { display: block; padding: 0 0 4px; width: auto; float: none; }
.tbp-setup__card input[type="password"] { width: 100%; box-sizing: border-box; padding: 10px; }
.tbp-setup__card .submit-row { margin-top: 12px; padding: 0; background: none; border: 0; justify-content: flex-start; }
.tbp-setup__card .hidden { display: none; }

/* Окно загрузки файла */
.tbp-upload {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(4, 10, 28, 0.72);
}
.tbp-upload__box { width: min(460px, 100%); padding: 24px 26px; border-radius: 16px; background: var(--body-bg); color: var(--body-fg); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4); }
.tbp-upload__box h2 { margin: 0 0 6px; font-size: 1.2rem; }
.tbp-upload__file { margin: 0 0 14px; color: var(--body-quiet-color); word-break: break-all; }
.tbp-upload__bar { height: 12px; border-radius: 12px; background: var(--hairline-color); overflow: hidden; }
.tbp-upload__bar span { display: block; width: 0; height: 100%; background: linear-gradient(90deg, #2f7bff, #36d6ff); transition: width 0.2s ease; }
.tbp-upload__text { margin: 10px 0 0; font-weight: 600; }
.tbp-upload__error { color: #d9364a; }
