/* Кабинет aibox. Сайдбар с группами разделов — запасной вид без JS; с JS его заменяет
   оболочка Admin Core (partials/admin-core-head, public/admin-integration). */
.app { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }

.side {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  background: var(--panel);
  border-right: 1px solid var(--line);
}

.side-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 18px 16px 14px;
  font: 800 14px/1 var(--font-display);
  letter-spacing: -0.02em;
  color: var(--text);
  white-space: nowrap;
}

.side-brand:hover { text-decoration: none; }

.side-brand .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--brand-gradient);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.side-nav { flex: 1; padding: 0 8px 12px; }
.side-section { margin-top: 10px; }
.side-section h6 { margin: 0 8px 4px; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }

.side-section a {
  display: block;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.side-section a:hover { color: var(--text); background: var(--panel-2); text-decoration: none; }
.side-section a.on { color: var(--text); background: var(--accent-soft); }

.side-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.side-foot .av { display: grid; place-items: center; width: 30px; height: 30px; flex: none; border-radius: 50%; background: var(--brand-black); color: var(--brand-mint); font-size: 12px; font-weight: 800; }
.side-foot .u { flex: 1; min-width: 0; }
.side-foot .u b { display: block; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.side-foot .u small { display: block; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.side-foot form { display: inline-flex; margin: 0; }
.side-foot .mb-switch { flex-basis: 100%; }
.side-foot select { width: 100%; min-height: 30px; padding: 4px 8px; font-size: 12px; }
.side-foot .btn { display: grid; place-items: center; width: 30px; min-height: 30px; padding: 0; }

.workspace { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 9px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.topbar-title { font-size: 14px; }

.topbar .region {
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.topbar .spacer { flex: 1; }

.main { flex: 1; min-width: 0; display: grid; justify-items: center; padding: 18px 20px 56px; background: var(--bg); }
.page { width: min(1120px, 100%); min-width: 0; }
.page.narrow { width: min(760px, 100%); }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.page-head h1 { font-size: 22px; }
.page-head .sub { margin-top: 6px; color: var(--muted); font-size: 13px; }
.page-head .actions { display: flex; flex-wrap: wrap; gap: 8px; }

.row-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.row-form .field { margin-bottom: 0; flex: 1 1 200px; }
.inline { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.muted { color: var(--muted); font-size: 13px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.stack { display: grid; gap: 12px; }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.metric .note { margin-top: 2px; color: var(--muted); font-size: 12px; }

.secret {
  display: block;
  padding: 10px 12px;
  margin-top: 8px;
  overflow-wrap: anywhere;
  border: 1px dashed var(--accent-border);
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  font: 600 13px/1.4 var(--font-mono);
}

/* DNS-записи: значение длинное, его копируют целиком. */
.dns td code { overflow-wrap: anywhere; white-space: normal; }
.dns td:first-child { width: 70px; }

.status-dot { display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: var(--line-strong); }
.status-dot.ok { background: var(--ok); }
.status-dot.warn { background: var(--warn); }
.status-dot.bad { background: var(--danger); }

.cond-row { display: grid; grid-template-columns: 1.2fr 1fr 1.2fr 1.2fr auto; gap: 8px; align-items: center; margin-bottom: 8px; }

.preview-frame { width: 100%; height: 640px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }

/* Редактор шаблона на всю ширину. */
.editor-page { width: 100%; }
#gjs { height: calc(100vh - 230px); min-height: 520px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.editor-tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.editor-tabs .btn.active { border-color: var(--accent-border); color: var(--accent); }

.checklist { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.checklist li { display: flex; align-items: center; gap: 8px; font-size: 13px; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; }
  .side-nav { display: flex; flex-wrap: wrap; gap: 0 12px; }
  .main { padding: 14px 12px 40px; }
  .grid.cols-4, .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cond-row { grid-template-columns: 1fr 1fr; }
  td, th { white-space: normal; }
}

@media (max-width: 560px) {
  .grid.cols-4, .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; }
}

/* Рабочая зона AI Box: выбор моделей ключа, заголовки примеров подключения. */
.model-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 12px; max-height: 280px; overflow-y: auto; padding: 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.model-picks label { font-size: 13px; overflow-wrap: anywhere; }
.snippet-title { margin: 14px 0 0; font-size: 13px; color: var(--muted); }
pre.secret { white-space: pre; overflow-x: auto; overflow-wrap: normal; }
