/* Кабинет mailbox: верхняя полоса с разделами — как в authbox, страница шире под таблицы. */
.app { display: flex; flex-direction: column; min-height: 100vh; }

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

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

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

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

.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; }
.topbar .who { color: var(--muted); font-size: 12px; font-weight: 600; }
.topbar form { display: inline-flex; margin: 0; }
.topbar select { min-height: 32px; padding: 4px 8px; font-size: 12px; max-width: 200px; }

.nav {
  display: flex;
  gap: 2px;
  padding: 0 14px;
  overflow-x: auto;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  scrollbar-width: thin;
}

.nav a {
  padding: 11px 10px 10px;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.nav a:hover { color: var(--text); text-decoration: none; }
.nav a.active { color: var(--text); border-bottom-color: var(--accent); }

.main { flex: 1; min-width: 0; display: grid; justify-items: center; padding: 18px 20px 56px; background: var(--bg); }
.page { width: min(1120px, 100%); }
.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) {
  .topbar .who { display: none; }
  .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; }
  .topbar select { max-width: 130px; }
}
