/* TeleBridge — стекло на градиенте */
:root {
  --accent: #5b3fa8;
  --glass: rgba(255, 255, 255, .16);
  --glass-border: rgba(255, 255, 255, .35);
  --text-dim: rgba(255, 255, 255, .72);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  background-attachment: fixed;
  color: #fff;
}

.container { max-width: 960px; margin: 0 auto; padding: 24px 16px 48px; }

/* --- Шапка --- */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; flex-wrap: wrap; margin-bottom: 20px;
}
.brand { font-size: 19px; font-weight: 700; }
.brand .ws { opacity: .75; font-weight: 400; }
.topbar-actions { display: flex; gap: 10px; align-items: center; }

/* --- Кнопки --- */
.btn {
  display: inline-block; border: none; cursor: pointer;
  border-radius: 10px; padding: 8px 16px;
  font-size: 14px; font-weight: 600; font-family: inherit;
  text-decoration: none; line-height: 1.3; transition: transform .06s, opacity .15s;
}
.btn:hover { opacity: .92; }
.btn:active { transform: scale(.97); }
.btn-primary { background: rgba(255, 255, 255, .92); color: var(--accent); }
.btn-ghost { background: transparent; border: 1px solid rgba(255, 255, 255, .45); color: #fff; }

/* --- Сетка карточек --- */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
@media (max-width: 700px) { .grid { grid-template-columns: 1fr; } }

.card {
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 16px;
}
.card-empty {
  border-style: dashed; background: rgba(255, 255, 255, .08);
  display: flex; align-items: center; justify-content: center;
  min-height: 120px; text-align: center; color: var(--text-dim);
  grid-column: 1 / -1;
}
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.card-head h3 { margin: 0 0 6px; font-size: 16px; }
.card-head-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.btn-del {
  background: transparent; border: none; cursor: pointer;
  color: #fca5a5; font-size: 15px; line-height: 1;
  padding: 4px 6px; border-radius: 8px;
}
.btn-del:hover { background: rgba(252, 165, 165, .2); color: #fecaca; }

/* --- Подписанные строки на карточке сайта --- */
.info-list { margin: 10px 0 0; padding: 4px 10px; background: rgba(0, 0, 0, .14); border-radius: 12px; }
.info-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 2px; font-size: 13px;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
  border-radius: 8px;
  transition: background .15s ease;
}
.info-row:last-child { border-bottom: none; }
.info-row:hover { background: rgba(255, 255, 255, .05); }
.info-row dt {
  flex: 0 0 158px; display: flex; align-items: center; gap: 8px;
  color: var(--text-dim); font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.info-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 8px; font-size: 12px;
  background: rgba(255, 255, 255, .09); flex-shrink: 0;
}
.row-site .info-icon { background: rgba(129, 140, 248, .28); }
.row-type .info-icon { background: rgba(96, 165, 250, .28); }
.row-id .info-icon { background: rgba(255, 255, 255, .12); }
.row-webhook .info-icon { background: rgba(52, 211, 153, .25); }
.row-bot .info-icon { background: rgba(251, 191, 36, .25); }
.row-managers .info-icon { background: rgba(244, 114, 182, .22); }
.info-row dd { margin: 0; overflow-wrap: anywhere; flex: 1; }
.info-row dd code {
  font-size: 12px; background: rgba(0, 0, 0, .3); color: #bfdbfe;
  padding: 3px 9px; border-radius: 7px;
}
.info-empty { color: var(--text-dim); font-style: italic; opacity: .75; }

.card-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.card-actions .btn { padding: 6px 12px; font-size: 13px; }

/* --- Блоки команд и меню на карточке --- */
.commands, .menu { margin-top: 18px; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, .18); }
.commands > strong, .menu > strong { display: block; margin-bottom: 8px; }
.commands-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.commands ul, .menu ul { list-style: none; margin: 0; padding: 0; }
.cmd-item { padding: 12px; margin-bottom: 8px; background: rgba(255, 255, 255, .06); border-radius: 10px; }
.cmd-title { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 10px; }
.cmd-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cmd-name code { font-size: 12px; color: var(--text-dim); background: rgba(0, 0, 0, .22); padding: 2px 8px; border-radius: 6px; overflow-wrap: anywhere; }
.cmd-title .btn-del { flex-shrink: 0; }
.cmd-btns { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.cmd-btns .btn { padding: 5px 11px; font-size: 12px; }

/* --- Пункты и форма меню бота --- */
.menu li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 7px 10px; margin-bottom: 6px; background: rgba(255, 255, 255, .06); border-radius: 8px; }
.menu li.meta { background: none; padding: 4px 0; }
.menu-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.menu-form input, .menu-form select {
  flex: 1 1 140px; min-width: 0;
  padding: 8px 11px; font-size: 13px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, .35);
  background: rgba(255, 255, 255, .12); color: #fff;
}
.menu-form input::placeholder { color: rgba(255, 255, 255, .6); }
.menu-form select option { color: #222; }
.menu-form .btn { flex: 0 0 auto; }

/* --- Бейджи статусов --- */
.badge {
  flex-shrink: 0; font-size: 11px; font-weight: 600;
  padding: 3px 10px; border-radius: 999px; white-space: nowrap;
}
.badge-active { background: rgba(74, 222, 128, .22); color: #bbf7d0; }
.badge-stale { background: rgba(253, 230, 138, .22); color: #fde68a; }
.badge-none { background: rgba(252, 165, 165, .22); color: #fecaca; }
.badge-mp { background: rgba(129, 140, 248, .22); color: #c7d2fe; }
.badge-ext { background: rgba(96, 165, 250, .22); color: #bfdbfe; }

.meta { color: var(--text-dim); font-size: 13px; margin: 4px 0; overflow-wrap: anywhere; }

.preview {
  display: block;
  margin: 6px 0 0;
  padding: 8px 10px;
  background: rgba(0, 0, 0, .25);
  border-radius: 8px;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 220px;
  overflow-y: auto;
}
.preview:empty { display: none; }

.sugg { margin-top: 8px; }
.sugg:empty { display: none; }
.sugg-msg { font-size: 13px; color: var(--text-dim); margin-bottom: 6px; }
.sugg-warn { font-size: 12px; color: #fecaca; margin-top: 6px; line-height: 1.4; }

/* --- Журнал действий --- */
.audit {
  background: rgba(0, 0, 0, .2);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 16px; padding: 16px 18px; margin-top: 22px;
}
.audit h2 { margin: 0 0 10px; font-size: 15px; }
.audit table { border-collapse: collapse; width: 100%; font-size: 13px; }
.audit td, .audit th {
  border-bottom: 1px solid rgba(255, 255, 255, .12);
  padding: 6px 8px; text-align: left;
}
.audit th { color: var(--text-dim); font-weight: 600; font-size: 12px; }
.audit td { color: rgba(255, 255, 255, .85); }
.audit tr:last-child td { border-bottom: none; }

/* --- Баннер ошибки --- */
.banner-error {
  background: rgba(220, 38, 38, .3);
  border: 1px solid rgba(252, 165, 165, .6);
  color: #fecaca; padding: 10px 14px; border-radius: 12px;
  margin-bottom: 16px; font-size: 14px;
}

/* --- Модалки --- */
dialog {
  border: none; border-radius: 18px; padding: 20px;
  width: calc(100vw - 40px); max-width: 380px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
  color: #222;
}
dialog::backdrop { background: rgba(20, 10, 40, .55); backdrop-filter: blur(3px); }
.dialog-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px; font-size: 15px;
}
.dialog-close {
  border: none; background: none; cursor: pointer;
  font-size: 16px; color: #999; padding: 2px 6px;
}
dialog label { display: block; font-size: 12px; color: #555; margin: 10px 0 4px; }
dialog input, dialog select {
  width: 100%; padding: 9px 10px; font-size: 14px; font-family: inherit;
  border: 1px solid #ddd; border-radius: 8px;
}
dialog fieldset { border: none; padding: 0; margin: 0; }
.dialog-submit {
  margin-top: 16px; width: 100%; border: none; cursor: pointer;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff; border-radius: 10px; padding: 10px;
  font-size: 14px; font-weight: 600; font-family: inherit;
}
.dialog-submit:hover { opacity: .92; }
.dialog-note { font-size: 13px; color: #666; margin: 0 0 4px; line-height: 1.4; }
.dialog-danger { background: linear-gradient(135deg, #e11d48, #9f1239); }

/* --- Поля отображения: список, пример JSON, чипсы --- */
.lp-form { margin-bottom: 10px; }
.lp-row { display: flex; gap: 8px; align-items: center; }
.lp-row input { flex: 1; }
.lp-row .btn-mini { flex: 0 0 auto; }
.disp-list { list-style: none; padding: 0; margin: 0 0 6px; }
.disp-list li { display: flex; align-items: center; gap: 8px; padding: 7px 11px; margin-bottom: 6px; background: #f3f0fa; border-radius: 8px; font-size: 13px; }
.disp-list li.meta { background: none; color: #999; padding: 4px 0; }
.disp-list .disp-label { font-weight: 600; color: #333; }
.disp-list .disp-arrow { color: #b0a8c8; }
.disp-list code { background: #e7e0f5; color: var(--accent); padding: 1px 8px; border-radius: 5px; }
.disp-list .disp-del { margin-left: auto; flex-shrink: 0; background: transparent; border: none; cursor: pointer; color: #b91c1c; font-size: 14px; line-height: 1; padding: 3px 6px; border-radius: 6px; }
.disp-list .disp-del:hover { background: rgba(185, 28, 28, .12); }
.disp-sample { margin: 12px 0; padding-top: 12px; border-top: 1px solid #eee; }
.disp-sample-head { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-mini { cursor: pointer; border: 1px solid #d4c9ee; background: #f3f0fa; color: var(--accent); border-radius: 8px; padding: 7px 13px; font-size: 12px; font-family: inherit; font-weight: 600; }
.btn-mini:hover { background: #e7e0f5; }
.param-list li { cursor: pointer; }
.param-list li:hover { background: #e7e0f5; }
.param-cancel:not([hidden]) { display: block; width: 100%; margin-top: 8px; text-align: center; }
.disp-hint { font-size: 12px; color: #777; margin: 10px 0 0; }
.disp-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; }
.chip { cursor: pointer; border: 1px solid #d4c9ee; background: #f3f0fa; color: var(--accent); border-radius: 999px; padding: 4px 12px; font-size: 12px; font-family: inherit; }
.chip:hover:not(:disabled) { background: var(--accent); color: #fff; }
.chip:disabled { opacity: .4; cursor: default; text-decoration: line-through; }
.disp-crumb { display: flex; flex-wrap: wrap; gap: 2px; margin: 8px 0 0; min-height: 18px; }
.crumb-btn { cursor: pointer; border: none; background: none; color: var(--accent); font-size: 12px; font-family: inherit; padding: 2px 4px; }
.crumb-btn:hover { text-decoration: underline; }
.chip-folder { font-weight: 600; }
.sample-json { background: #1e1633; color: #e8e2f7; border-radius: 8px; padding: 11px 13px; margin: 10px 0 0; font-size: 12px; line-height: 1.5; max-height: 240px; overflow: auto; white-space: pre; }
.sample-json:empty { display: none; }

/* --- Логин --- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card {
  background: var(--glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border);
  border-radius: 22px; padding: 36px 28px;
  max-width: 340px; width: 100%; text-align: center;
}
.login-logo { font-size: 40px; }
.login-title { font-size: 26px; font-weight: 800; margin: 6px 0 2px; }
.login-sub { color: var(--text-dim); font-size: 14px; margin-bottom: 22px; }

/* --- Лендинг --- */
.hero { max-width: 640px; margin: 48px auto 48px; padding: 0 8px; text-align: center; }
.hero h1 { font-size: 32px; line-height: 1.25; margin: 0 0 16px; }
.hero p { font-size: 16px; color: var(--text-dim); margin: 0 0 26px; }
.hero-cta { padding: 12px 28px; font-size: 15px; }
.features { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; margin-bottom: 40px; }
@media (max-width: 700px) { .features { grid-template-columns: 1fr; gap: 20px; } }
.feature { padding: 20px; }
.feature h3 { margin: 0 0 8px; font-size: 16px; }
.feature p { margin: 0; color: var(--text-dim); font-size: 14px; }
.landing-footer { text-align: center; color: var(--text-dim); font-size: 13px; padding: 16px 0 8px; }
