/* AvailSync review admin — dark, clean, keyboard-first compare UI. */
:root {
  --bg: #0f1216;
  --bg-2: #171b22;
  --bg-3: #1f2530;
  --line: #2b323d;
  --fg: #e7ecf3;
  --muted: #8b95a5;
  --accent: #4c8dff;
  --green: #2fbf6b;
  --green-d: #23994f;
  --red: #ef4d5a;
  --red-d: #c73742;
  --amber: #e0a53a;
  --slate: #5b6675;
  --gold: #ffd23f;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

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

/* -------------------------------------------------- top bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
}
.brand { font-weight: 600; letter-spacing: .2px; }
.topnav { display: flex; align-items: center; gap: 16px; }
.topnav .who { color: var(--muted); }

/* -------------------------------------------------- content */
.content {
  flex: 1;
  padding: 14px 16px 20px;
  width: 100%;
  max-width: 1500px;
  margin: 0 auto;
}

/* -------------------------------------------------- progress */
.progress { display: flex; gap: 10px; margin-bottom: 12px; }
.pill {
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 13px;
  color: var(--muted);
}
.pill b { color: var(--fg); }

/* -------------------------------------------------- error */
.error {
  background: rgba(239, 77, 90, .12);
  border: 1px solid var(--red-d);
  color: #ffb3b9;
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 12px;
}

/* -------------------------------------------------- compare card */
.compare {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
}

.heads {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.head {
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}
.head-object { border-left: 3px solid var(--green); }
.head-listing { border-left: 3px solid var(--accent); }
.head-tag {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--muted);
  margin-bottom: 2px;
}
.head-title { font-size: 16px; font-weight: 600; }
.head-addr { color: var(--muted); margin-top: 2px; }
.head-meta { font-size: 12px; color: var(--muted); margin-top: 6px; }

.tag {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.tag.ok { background: rgba(47,191,107,.16); color: #7ee0a4; }
.tag.off { background: rgba(91,102,117,.25); color: var(--muted); }
.tag.site { background: rgba(76,141,255,.18); color: #a9c6ff; }

/* exact-dup badge (strongest signal) */
.dupbadge {
  margin: 12px 0 2px;
  padding: 10px 14px;
  background: linear-gradient(90deg, rgba(255,210,63,.22), rgba(255,210,63,.05));
  border: 1px solid var(--gold);
  border-radius: 10px;
  color: var(--gold);
  font-weight: 800;
  letter-spacing: 1px;
  text-align: center;
}

/* -------------------------------------------------- middle: photos + side */
.middle {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, 1fr);
  gap: 14px;
  margin-top: 12px;
}

.photos-labels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-bottom: 6px;
}
.photos-labels span:first-child { color: #7ee0a4; }
.photos-labels span:last-child { color: #a9c6ff; }

/* single scroll container = synchronized scroll of both columns */
.photo-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  max-height: 62vh;
  overflow-y: auto;
  padding-right: 4px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
}
.photo-col { display: flex; flex-direction: column; gap: 10px; }
.thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  display: block;
}
.thumb.missing::after {
  content: "нет превью";
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--muted);
  font-size: 12px;
}
.no-photos {
  color: var(--muted);
  padding: 20px 8px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
}

/* side: attrs + signals */
.side { display: flex; flex-direction: column; gap: 14px; }
.attrs table, .signals { width: 100%; }
.attrs table { border-collapse: collapse; }
.attrs th, .attrs td {
  padding: 5px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}
.attrs thead th { color: var(--muted); font-size: 12px; font-weight: 600; }
.attrs thead th:not(:first-child) { text-align: right; }
.attr-name { color: var(--muted); }
.attr-val { text-align: right; font-variant-numeric: tabular-nums; }

.signals {
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}
.signals h3 {
  margin: 0 0 8px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--muted);
}
.sig-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 0;
  border-bottom: 1px dashed var(--line);
}
.sig-row:last-child { border-bottom: 0; }
.sig-name { color: var(--muted); }
.sig-val { font-variant-numeric: tabular-nums; font-weight: 600; }
.sig-row.strong {
  background: rgba(255,210,63,.10);
  border-radius: 6px;
  padding: 6px 8px;
  margin: 2px -4px;
  border-bottom: 0;
}
.sig-row.strong .sig-name, .sig-row.strong .sig-val { color: var(--gold); }

/* -------------------------------------------------- actions */
.actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 16px;
}
.btn {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 12px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  background: var(--bg-3);
  cursor: pointer;
  transition: transform .05s ease, filter .1s ease;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(1px); }
.btn kbd {
  display: inline-block;
  margin-left: 6px;
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 5px;
  background: rgba(0,0,0,.35);
  border: 1px solid rgba(255,255,255,.18);
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.btn-confirm { background: var(--green-d); border-color: var(--green); }
.btn-reject { background: var(--red-d); border-color: var(--red); }
.btn-postpone { background: var(--amber); border-color: var(--amber); color: #241a02; }
.btn-postpone kbd { background: rgba(0,0,0,.2); border-color: rgba(0,0,0,.3); }
.btn-skip { background: var(--slate); border-color: var(--slate); }

/* -------------------------------------------------- keyboard hint footer */
.keyhints {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
  padding: 8px 16px;
  background: var(--bg-2);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}
.keyhints kbd {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--fg);
}

/* -------------------------------------------------- login */
.login-wrap {
  display: flex;
  justify-content: center;
  padding-top: 8vh;
}
.login-card {
  width: 340px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.login-card h1 { margin: 0 0 4px; font-size: 20px; }
.login-card label { display: flex; flex-direction: column; gap: 5px; color: var(--muted); font-size: 13px; }
.login-card input {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--fg);
  font-size: 15px;
}
.login-card input:focus { outline: none; border-color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); }

/* -------------------------------------------------- empty */
.empty-page, .empty-inline {
  text-align: center;
  padding: 8vh 16px;
  color: var(--muted);
}
.empty-emoji {
  width: 64px; height: 64px; line-height: 64px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: rgba(47,191,107,.14);
  color: var(--green);
  font-size: 34px;
  font-weight: 800;
}
.empty-page h1, .empty-inline h2 { color: var(--fg); }
.empty-counts { display: flex; gap: 10px; justify-content: center; margin: 14px 0; }

/* -------------------------------------------------- stats */
.stats h1 { margin-top: 4px; }
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin: 14px 0 20px;
}
.stat-tile {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
}
.stat-num { font-size: 30px; font-weight: 800; }
.stat-label { color: var(--muted); font-size: 12px; margin-top: 4px; }
.stat-section { margin-bottom: 18px; }
.stat-section h2 { font-size: 15px; color: var(--muted); }
.stat-table {
  border-collapse: collapse;
  min-width: 280px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.stat-table td { padding: 8px 14px; border-bottom: 1px solid var(--line); }
.stat-table tr:last-child td { border-bottom: 0; }
.stat-table .num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }

/* -------------------------------------------------- sources monitoring */
.table-scroll { overflow-x: auto; }
.matrix-table {
  border-collapse: collapse;
  width: 100%;
  min-width: 720px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.matrix-table th, .matrix-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}
.matrix-table thead th { color: var(--muted); font-size: 12px; font-weight: 600; }
.matrix-table tr:last-child td { border-bottom: 0; }
.matrix-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.matrix-table td.site { font-weight: 700; }

.role-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.role-calendar { background: rgba(47,191,107,.16); color: #7ee0a4; }
.role-discovery { background: rgba(76,141,255,.18); color: #a9c6ff; }

.cell-ok { color: var(--green); font-weight: 600; }
.cell-fail { color: var(--red); font-weight: 700; }
.cell-stale { color: var(--amber); font-weight: 700; }

.run-done { color: var(--green); font-weight: 600; }
.run-failed { color: var(--red); font-weight: 700; }
.run-running { color: var(--amber); font-weight: 600; }
.run-skipped_locked { color: var(--muted); }

/* -------------------------------------------------- responsive */
@media (max-width: 980px) {
  .middle { grid-template-columns: 1fr; }
  .actions { grid-template-columns: repeat(2, 1fr); }
  .photo-compare { max-height: none; }
}
