/* Дизайн-система Factor H (см. design/factor-h-demo.html): JetBrains Mono,
   индиго/оранжевый, карточки-пилюли, [скобки] у заголовков, тёмная шапка таблиц. */
:root {
  --indigo: #5B5BD6;
  --indigo-d: #4747c0;
  --indigo-tint: #eeeefb;
  --orange: #F77F00;
  --ink: #0A0A0A;
  --white: #FFFFFF;
  --mute: #F5F5F5;
  --gray: #6B6B6B;
  --line: #e8e8ee;
  --radius: 16px;
  --font: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--mute);
  color: var(--ink);
  line-height: 1.5;
}

/* --- Шапка ---------------------------------------------------------------- */
header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 64px;
  padding: 18px 30px;
  background: var(--white);
  border-bottom: 2px solid var(--ink);
}
.fh-logo {
  display: flex;
  align-items: center;
  font-weight: 700;
  font-size: 21px;
  color: var(--ink);
  white-space: nowrap;
}
header h1 {
  margin: 0 auto 0 26px;
  font-weight: 700;
  font-size: 20px;
  color: var(--ink);
  white-space: nowrap;
}
.user-bar { display: flex; align-items: center; gap: 16px; white-space: nowrap; }
.who { color: var(--gray); font-size: 12px; }
.logout-link {
  display: inline-block;
  text-decoration: none;
  font-weight: 600;
  font-size: 13px;
  color: var(--ink);
  background: var(--white);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 6px 16px;
  cursor: pointer;
  transition: .15s;
}
.logout-link:hover { background: var(--ink); color: #fff; }

/* --- Основа и карточки ---------------------------------------------------- */
main { max-width: 1080px; margin: 0 auto; padding: 28px 24px 90px; }

.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(10, 10, 10, .04), 0 8px 24px rgba(10, 10, 10, .04);
  padding: 30px;
  margin: 24px 0;
  position: relative;
}
.login-card { max-width: 420px; margin: 48px auto; }

/* Заголовки секций в [скобках] */
.card h2, .card h3 {
  font-weight: 700;
  color: var(--ink);
  font-size: 19px;
  margin: 26px 0 18px;
}
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card h2::before, .card h3::before { content: "["; color: var(--indigo); margin-right: 6px; }
.card h2::after, .card h3::after { content: "]"; color: var(--indigo); margin-left: 6px; }

/* details/summary («Настройки») */
.card details > summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 19px;
  list-style: none;
  user-select: none;
}
.card details > summary::-webkit-details-marker { display: none; }
.card details > summary::before { content: "▸ "; color: var(--indigo); }
.card details[open] > summary::before { content: "▾ "; }
.card details[open] > summary { margin-bottom: 14px; }

/* --- Строки, метки -------------------------------------------------------- */
.row { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; margin: 12px 0; }
label { color: var(--gray); font-size: 13px; }

/* --- Поля ввода ----------------------------------------------------------- */
input[type="text"], input[type="email"], input[type="password"], input[type="number"] {
  font-family: var(--font);
  background: var(--mute);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 14px;
  transition: .14s;
  width: 100%;
}
input:focus {
  outline: none;
  background: #fff;
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px rgba(91, 91, 214, .15);
}
input::placeholder { color: #b0b0b0; }
input[type="number"] { width: 80px; }
/* Поля, живущие в общей строке с кнопкой — гибкие, не на всю ширину. */
#new-name, #new-email, #su-username, #su-password { width: auto; flex: 1 1 180px; }

input[type="file"] { color: var(--gray); font-size: 13px; }
input[type="file"]::file-selector-button {
  font-family: var(--font);
  font-weight: 600;
  color: #fff;
  background: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 7px 16px;
  cursor: pointer;
  margin-right: 12px;
  transition: opacity .14s;
}
input[type="file"]::file-selector-button:hover { opacity: .85; }

select {
  font-family: var(--font);
  background: var(--mute);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 14px;
}

/* --- Кнопки --------------------------------------------------------------- */
button {
  font-family: var(--font);
  font-weight: 600;
  font-size: 14px;
  color: #fff;
  background: var(--indigo);
  border: 2px solid var(--indigo);
  border-radius: 999px;
  padding: 9px 20px;
  cursor: pointer;
  transition: .14s;
}
button:hover {
  background: var(--indigo-d);
  border-color: var(--indigo-d);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(91, 91, 214, .28);
}
button:active { transform: translateY(0); box-shadow: none; }
button:disabled { opacity: .5; cursor: default; transform: none; box-shadow: none; }
button.small { padding: 7px 14px; font-size: 13px; }
/* «Удалить» — призрачная кнопка */
button.remove-acc {
  background: #fff;
  color: var(--gray);
  border: 2px solid var(--line);
}
button.remove-acc:hover {
  background: var(--mute);
  color: var(--ink);
  border-color: var(--gray);
  box-shadow: none;
  transform: none;
}

/* Ссылка-кнопка скачивания ZIP */
.btn-link {
  display: inline-block;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  color: #fff;
  background: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 9px 20px;
  margin: 8px 0;
}
.btn-link:hover { opacity: .9; }

/* --- Статусы, подсказки --------------------------------------------------- */
.status { color: var(--gray); font-size: 13px; min-height: 18px; margin: 6px 0; }
.hint { font-size: 13px; color: var(--gray); }
.hidden { display: none; }

/* --- Вердикт -------------------------------------------------------------- */
.verdict {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  background: var(--indigo-tint);
  color: var(--ink);
  border: 1px solid var(--indigo);
  border-left: 6px solid var(--indigo);
  border-radius: 12px;
  padding: 18px 22px;
  font-weight: 500;
  font-size: 15px;
  margin: 22px 0 8px;
}
.verdict.unsure {
  background: #fff4e8;
  border-color: var(--orange);
  border-left-color: var(--orange);
}
.verdict strong { color: var(--indigo-d); font-weight: 700; margin: 0 4px; }
.verdict.unsure strong { color: #c66000; }
.verdict .mono { color: var(--gray); }
.verdict-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-right: 10px;
  border-radius: 6px;
  background: var(--indigo);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  flex: 0 0 auto;
}
.verdict.unsure .verdict-check { background: var(--orange); }

/* --- Таблицы -------------------------------------------------------------- */
table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  margin: 12px 0;
  font-size: 14px;
}
th {
  background: var(--ink);
  color: #fff;
  text-align: left;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .3px;
  padding: 11px 14px;
}
td { border-bottom: 1px solid var(--line); padding: 10px 14px; color: var(--ink); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr.winner td { background: var(--indigo-tint); font-weight: 700; }
tr.winner td:first-child { box-shadow: inset 4px 0 0 var(--indigo); }
.mono { font-variant-numeric: tabular-nums; }
.fh-neg { color: var(--orange); }
#users-mgmt-table td:last-child,
#sysusers-table td:last-child { width: 1%; white-space: nowrap; }

/* --- Доказательства (картинки) ------------------------------------------- */
figure { margin: 6px 0; }
figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 8px;
  box-shadow: 0 2px 8px rgba(10, 10, 10, .05);
}
figcaption { font-size: 12px; color: var(--gray); margin-top: 8px; }

/* --- Декор ---------------------------------------------------------------- */
.fh-plus {
  position: fixed;
  color: var(--indigo);
  font-weight: 700;
  font-size: 30px;
  pointer-events: none;
  z-index: 5;
}
::selection { background: var(--indigo); color: #fff; }
a { color: var(--indigo); }
