/* Lunatik web (Stage 6.2) — власні стилі, без зовнішніх фреймворків. */

:root {
  --bg: #f7f7f9;
  --surface: #ffffff;
  --border: #e3e3e8;
  --text: #1c1c22;
  --muted: #6a6a75;
  --accent: #2d6cdf;
  --q-yes-bg: #d3f5d3;
  --q-review-bg: #fdf0cc;
  --q-no-bg: #efeff2;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 15px/1.5 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

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

header.site {
  display: flex;
  align-items: baseline;
  gap: 24px;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
header.site .brand { font-weight: 700; font-size: 17px; color: var(--text); }
header.site .brand:hover { text-decoration: none; }
header.site nav a { margin-right: 18px; color: var(--muted); font-weight: 500; }
header.site nav a.active { color: var(--text); }

header.site .user { margin-left: auto; display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; }
header.site .user form { margin: 0; }
.linkish { background: none; border: none; padding: 0; font: inherit; color: var(--accent); cursor: pointer; }
.linkish:hover { text-decoration: underline; }

main { max-width: 1200px; margin: 0 auto; padding: 24px; }

.login { max-width: 360px; margin: 40px auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.login form { display: flex; flex-direction: column; gap: 6px; }
.login label { margin-top: 8px; }
.login button { margin-top: 16px; padding: 9px 14px; border: none; border-radius: 8px; background: var(--accent); color: #fff; font: inherit; font-weight: 600; cursor: pointer; }
.login button:hover { filter: brightness(1.08); }
.login .muted { margin: 16px 0 0; font-size: 13px; }
.error { background: #fde8e8; color: #9b1c1c; padding: 9px 12px; border-radius: 8px; margin: 0 0 4px; font-size: 14px; }
.success { background: #eafbea; color: #256029; padding: 9px 12px; border-radius: 8px; margin: 0 0 4px; font-size: 14px; }
.password-reveal { background: #fff8e1; border: 1px solid #f0d98c; border-radius: 8px; padding: 12px 14px; margin: 0 0 16px; }
.password-reveal code { font-size: 15px; font-weight: 600; user-select: all; }
.pw-field { position: relative; display: flex; align-items: center; }
.pw-field input { flex: 1; padding-right: 38px; }
/* Ховаємо нативне око/хрестик Edge, щоб не дублювати нашу кнопку .pw-eye */
.pw-field input::-ms-reveal, .pw-field input::-ms-clear { display: none; }
.pw-field .pw-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: auto; margin: 0; padding: 4px; border: none; background: none; color: var(--muted); cursor: pointer; display: flex; }
.pw-field .pw-eye:hover { color: var(--text); filter: none; }
.pw-field .pw-eye svg { width: 20px; height: 20px; }

h1, h2 { margin: 0 0 4px; }
.subtitle { color: var(--muted); margin: 0 0 18px; }

.toolbar {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
label { color: var(--muted); font-size: 13px; }
select, input {
  font: inherit;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}

.count { color: var(--muted); font-size: 14px; margin: 0 0 10px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; background: var(--surface); }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { position: sticky; top: 0; background: #fafafb; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
tbody tr.row-yes { background: #eafbea; }
tbody tr.row-review { background: #fdf6e3; }
tbody tr:hover { background: #f5f8ff; }
th.num, td.num { text-align: center; }
td.num { font-variant-numeric: tabular-nums; }
/* Сортовний заголовок = кнопка на всю комірку: падінг переноситься з th на кнопку,
   тож клікабельна вся комірка й підсвітка-фон покриває її повністю. */
th.sort-col { padding: 0; }
.sort-th {
  display: flex; align-items: center; gap: 6px; width: 100%;
  padding: 9px 12px;  /* = старий падінг th → зона кліку на всю комірку */
  font: inherit; color: inherit; background: none; border: none;
  cursor: pointer; text-transform: inherit; letter-spacing: inherit; white-space: nowrap;
}
th.num .sort-th { justify-content: center; }  /* «Кваліфіковано» лишається по центру */
.sort-th:hover { background: #eef2fb; color: var(--text); }
/* Індикатор сортування: завжди видима пара ▲▼ (сигнал «колонку можна сортувати»);
   активний напрям підсвічений акцентом, неактивний — блідий. */
.sort-ind { display: inline-flex; flex-direction: column; line-height: .68; font-size: 12px; }
.sort-ind span { color: var(--muted); opacity: .45; }
.sort-ind span.on { color: var(--accent); opacity: 1; }
.sort-th:hover .sort-ind span { opacity: .7; }
.sort-th:hover .sort-ind span.on { opacity: 1; }

td.socials { line-height: 1; }
td.socials a { display: inline-block; margin-right: 8px; color: var(--muted); }
td.socials a:last-child { margin-right: 0; }
td.socials a:hover { color: var(--accent); }
.soc { width: 18px; height: 18px; vertical-align: middle; display: block; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.q-yes { background: var(--q-yes-bg); }
.q-review { background: var(--q-review-bg); }
.q-no, .q-unchecked { background: var(--q-no-bg); color: var(--muted); }
.overridden { margin-left: 4px; }

.cards { display: flex; gap: 16px; flex-wrap: wrap; margin: 8px 0 20px; }
.metric { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 20px; min-width: 150px; }
.metric .value { font-size: 26px; font-weight: 700; }
.metric .label { color: var(--muted); font-size: 13px; }

.info { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 12px 0 20px; }
.info dt { color: var(--muted); }
.info dd { margin: 0; }

.contacts { list-style: none; padding: 0; margin: 0 0 20px; }
.contacts li { padding: 3px 0; }

.renders { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.render figure { margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.render img { width: 100%; display: block; }
.render figcaption { padding: 8px 12px; font-size: 13px; color: var(--muted); }
/* Плейсхолдер для рендерів з мертвим URL (image_unavailable) — замість битого <img> */
.render-missing { display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; min-height: 160px; padding: 20px; text-align: center; color: var(--muted);
  background: var(--q-no-bg); font-size: 14px; }
.render-missing small { font-size: 12px; opacity: .8; }

.muted { color: var(--muted); }
.empty { color: var(--muted); padding: 24px; text-align: center; }

/* Ручний рев'ю (Stage 12): кнопки рішень на картці об'єкта */
.review-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 0 0 20px; }
.review-actions .btn {
  font: inherit; font-weight: 600; padding: 8px 14px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer;
}
.review-actions .btn:hover:not(:disabled) { filter: brightness(.97); border-color: var(--accent); }
.review-actions .btn:disabled { opacity: .5; cursor: default; }
.review-actions .btn-yes { background: var(--q-yes-bg); border-color: var(--q-yes-bg); }
.review-actions .btn-no { background: var(--q-no-bg); }

.toolbar input[type="search"] { min-width: 320px; }
.role-select { padding: 4px 8px; font-size: 14px; }
.pager { display: flex; align-items: center; gap: 14px; margin-top: 14px; color: var(--muted); font-size: 14px; }
.pager button { font: inherit; padding: 6px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); cursor: pointer; }
.pager button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.pager button:disabled { opacity: .5; cursor: default; }

/* Кандидати ЄДРПОУ у формі рев'ю (Етап 15): кожен варіант — окремим рядком */
.edrpou-candidate {
  display: block;
  margin: 0.25rem 0;
  font-size: 0.92rem;
}
.edrpou-candidate input[type="text"] {
  width: 8rem;
  margin-left: 0.4rem;
}
