/* admin.css — светлый минимал админки Vibi.
   Жёсткий контракт дизайна: системный шрифт, акцент #2563eb, нейтральная
   серая шкала, плотные таблицы с hover. Всё через CSS-переменные. */

:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --border: #e2e8f0;
  --radius: 10px;

  --text: #0f172a;
  --muted: #64748b;

  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #eff6ff;

  --thead-bg: #f1f5f9;
  --row-hover: #f8fafc;

  --ok-bg: #ecfdf5;
  --ok-fg: #059669;
  --warn-bg: #fefce8;
  --warn-fg: #a16207;
  --muted-bg: #f1f5f9;
  --muted-fg: #64748b;
  --err-bg: #fef2f2;
  --err-fg: #dc2626;
  --owner-bg: #eff6ff;
  --owner-fg: #2563eb;
  --employee-bg: #f5f3ff;
  --employee-fg: #7c3aed;

  --gap: 16px;
  --page-width: 1100px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "SF Pro Text", Inter, system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  background: var(--thead-bg);
  border-radius: 6px;
  padding: 1px 5px;
}

.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.num { text-align: right; white-space: nowrap; }
.empty { color: var(--muted); }

/* --- шапка ------------------------------------------------------------- */

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap);
}

.logo { display: flex; align-items: baseline; gap: 8px; text-decoration: none; }
.logo:hover { text-decoration: none; }
.logo-word { font-size: 18px; font-weight: 600; color: var(--text); }
.logo-sub { font-size: 12px; color: var(--muted); }

.topbar-actions { display: flex; align-items: center; gap: 8px; }
.logout-form { margin: 0; }

/* --- страница ---------------------------------------------------------- */

.page {
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 24px;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--gap);
  margin-bottom: var(--gap);
}

.page-title { font-size: 20px; font-weight: 600; margin: 0 0 4px; }
.section-title { font-size: 15px; font-weight: 600; margin: 24px 0 12px; }

.page-head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* --- сообщения --------------------------------------------------------- */

.notice {
  background: var(--accent-soft);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: var(--gap);
}
.notice-ok { background: var(--ok-bg); color: var(--ok-fg); border-color: transparent; }
.notice-error { background: var(--err-bg); color: var(--err-fg); border-color: transparent; }

/* --- карточки ---------------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: var(--gap);
}

.card-flush { padding: 0; overflow: hidden; }
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap);
  margin-bottom: 8px;
}
.card-flush .card-head { padding: 16px 16px 0; }
.card-title { font-size: 15px; font-weight: 600; margin: 0; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--gap);
}

.company-card { display: block; text-decoration: none; color: inherit; }
.company-card:hover { border-color: #cbd5e1; text-decoration: none; }
.company-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.company-name { font-size: 15px; font-weight: 600; }
.company-slug { font-size: 12px; color: var(--muted); }
.company-stats { display: flex; gap: 12px; color: var(--muted); margin: 10px 0 6px; }

.progress-line {
  height: 6px;
  background: var(--thead-bg);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 6px;
}
.progress-bar { display: block; height: 100%; background: var(--accent); }

/* --- таблицы ----------------------------------------------------------- */

.table { width: 100%; border-collapse: collapse; font-size: 13px; }

/* Таблица в card-flush: внутренние отступы карточки задаёт обёртка. */
.table-wrap { padding: 4px 16px 14px; }

.table thead th {
  background: var(--thead-bg);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: left;
  padding: 9px 14px;
  white-space: nowrap;
}

.table tbody td {
  border-top: 1px solid var(--border);
  padding: 10px 14px;
  vertical-align: top;
}

.table tbody tr:hover { background: var(--row-hover); }
.answer-cell { max-width: 420px; }

/* --- список вопросов карточки «Опросник» ------------------------------- */

.question-list { list-style: none; margin: 0; padding: 0; }
.question-list li { margin: 3px 0; }
.question-list .q-num { color: var(--muted); margin-right: 4px; }

/* --- бейджи ------------------------------------------------------------ */

.badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  white-space: nowrap;
}
.badge-ok { background: var(--ok-bg); color: var(--ok-fg); }
.badge-warn { background: var(--warn-bg); color: var(--warn-fg); }
.badge-muted { background: var(--muted-bg); color: var(--muted-fg); }
.badge-error { background: var(--err-bg); color: var(--err-fg); }
.badge-owner { background: var(--owner-bg); color: var(--owner-fg); }
.badge-employee { background: var(--employee-bg); color: var(--employee-fg); }

/* --- формы и кнопки ---------------------------------------------------- */

.field { display: block; margin-bottom: 12px; }
.field-label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }

.input {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
.input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.textarea { resize: vertical; }

.btn {
  display: inline-block;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
}
.btn-primary { background: var(--accent); color: #ffffff; }
.btn-primary:hover { background: var(--accent-hover); color: #ffffff; text-decoration: none; }
.btn-secondary { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-secondary:hover { border-color: #cbd5e1; color: var(--text); text-decoration: none; }
.btn-sm { padding: 4px 9px; font-size: 12px; }

.invite-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.invite-form .input { width: 240px; }

/* Строка действий в таблице: кнопки в один ряд. */
.row-actions { display: flex; gap: 6px; align-items: flex-start; flex-wrap: wrap; }
.row-actions form { margin: 0; display: inline; }

.filters { margin: 0; }
.filters .input { width: auto; padding: 5px 8px; }

.check { display: flex; align-items: center; gap: 6px; margin-bottom: 12px; }

.details-edit { display: inline-block; }
.details-edit summary { display: inline-block; list-style: none; }
.details-edit summary::-webkit-details-marker { display: none; }
.details-edit form {
  margin-top: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  min-width: 320px;
}

/* --- вход -------------------------------------------------------------- */

.login-wrap { display: flex; justify-content: center; padding-top: 48px; }
.login-card { width: 360px; }
.login-title { font-size: 18px; font-weight: 600; margin: 0 0 8px; }
.form-error { color: var(--err-fg); margin: 0 0 12px; }

/* --- markdown сводки (страница просмотра) ------------------------------ */

.md { max-width: 760px; }
.md h1 { font-size: 18px; font-weight: 600; margin: 20px 0 10px; }
.md h2 { font-size: 15px; font-weight: 600; margin: 18px 0 8px; }
.md h3 { font-size: 13.5px; font-weight: 600; margin: 15px 0 6px; }
.md h1:first-child, .md h2:first-child, .md h3:first-child { margin-top: 0; }

.md p, .md li { font-size: 14px; line-height: 1.55; }
.md p { margin: 0 0 10px; }
.md ul, .md ol { margin: 0 0 10px; padding-left: 22px; }
.md li { margin: 3px 0; }

.md table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 0 0 12px; }
.md table th {
  background: var(--thead-bg);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: left;
}
.md table th, .md table td {
  border: 1px solid var(--border);
  padding: 9px 14px;
  vertical-align: top;
}

.md code {
  background: #f1f5f9;
  border-radius: 4px;
  padding: 1px 5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
}
.md pre {
  background: #f1f5f9;
  border-radius: 6px;
  padding: 10px 12px;
  overflow-x: auto;
}
.md pre code { background: none; border-radius: 0; padding: 0; }

.md blockquote {
  margin: 0 0 10px;
  padding: 2px 0 2px 12px;
  border-left: 3px solid var(--border);
  color: var(--muted);
}
