/* sitebackup — панель. Цвета и размеры по утверждённому макету (TZ.md 6.2, п. 2). */
:root {
  --bg: #F5F6F8;
  --surface: #FFFFFF;
  --border: #E3E6EA;
  --row: #EEF0F3;
  --text: #14171C;
  --muted: #5B6472;
  --muted2: #4A5260;
  --accent: #1D4ED8;
  --accent-hover: #1E3A8A;
  --ok: #146C43;
  --ok-bg: #E5F3EA;
  --err: #B42318;
  --err-bg: #FCE9E6;
  --err-row: #FFF8F6;
  --err-text: #7A1A10;
  --font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 400 14px/1.45 var(--font);
  font-variant-numeric: tabular-nums;
}
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
h1 { margin: 0; font-size: 28px; line-height: 36px; font-weight: 700; }
h2 { margin: 0 0 12px; font-size: 16px; font-weight: 600; }
p { margin: 0; }
code, pre, .mono { font-family: var(--mono); font-size: 13px; }

.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.muted2 { color: var(--muted2); }
.ok { color: var(--ok); }
.err { color: var(--err); }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.wrap { overflow-wrap: anywhere; }
.num { text-align: right; }
.center { text-align: center; }
.hint { font-size: 13px; color: var(--muted); }
.ic { flex: none; }

/* шапка */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar-in {
  max-width: 1200px; margin: 0 auto; padding: 10px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 700; color: var(--text); text-decoration: none; }
.brand .ic { color: var(--accent); }
.brand:hover { color: var(--text); }
.userbox { display: flex; align-items: center; gap: 12px; color: var(--muted2); }
.userbox form { margin: 0; }

/* кнопки */
.btn {
  min-height: 44px; padding: 0 14px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid #CDD2D9; border-radius: 8px; background: var(--surface); color: var(--text);
  font: 500 14px var(--font); cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: #AEB5BF; }
.btn:focus-visible, .field input:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn[disabled] { color: var(--muted); cursor: default; background: var(--bg); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #FFFFFF; font-weight: 600; padding: 0 18px; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-primary[disabled] { background: #8DA6E8; border-color: #8DA6E8; color: #FFFFFF; }

/* страница */
.page { max-width: 1200px; margin: 0 auto; padding: 32px 24px 48px; display: flex; flex-direction: column; gap: 24px; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.page-head form { margin: 0; }
.page-head p { margin-top: 4px; }
.title-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.back { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font-weight: 500; text-decoration: none; align-self: flex-start; margin-bottom: -12px; }
.flash { padding: 12px 16px; border-radius: 10px; background: #E8EEFC; color: #1E3A8A; }
.footnote { font-size: 13px; color: var(--muted); }

/* карточки */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.card.pad, .pad { padding: 20px 24px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.cards.two { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.stat { padding: 16px 20px; display: flex; flex-direction: column; gap: 6px; }
.stat-label { font-size: 13px; color: var(--muted); }
.stat-value { font-size: 28px; font-weight: 700; line-height: 1.2; }
.stat-disk { font-size: 18px; font-weight: 600; }
.stat-disk .muted { font-weight: 400; }
progress.disk { width: 100%; height: 8px; border: 0; border-radius: 4px; background: var(--border); appearance: none; -webkit-appearance: none; overflow: hidden; }
progress.disk::-webkit-progress-bar { background: var(--border); border-radius: 4px; }
progress.disk::-webkit-progress-value { background: var(--accent); border-radius: 4px; }
progress.disk::-moz-progress-bar { background: var(--accent); border-radius: 4px; }

.empty { padding: 24px; display: flex; flex-direction: column; gap: 8px; }
.empty pre { margin: 0; padding: 12px; background: var(--bg); border-radius: 8px; overflow-x: auto; }

/* бейджи */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-err { background: var(--err-bg); color: var(--err); }

/* плашка ошибки */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 16px 20px; border-radius: 10px; background: var(--err-bg); color: var(--err-text); }
.alert .ic { color: var(--err); margin-top: 1px; }
.alert div { display: flex; flex-direction: column; gap: 4px; line-height: 20px; }
.alert strong { font-weight: 600; }

/* таблицы */
.table-wrap { overflow-x: auto; position: relative; }
.table-title { padding: 20px 24px 8px; margin: 0; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl.sites { min-width: 1040px; }
.tbl.sets { min-width: 640px; }
.tbl th {
  padding: 12px 16px; text-align: left; font-size: 12px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 1px solid var(--border);
}
.tbl th.num { text-align: right; }
.tbl td { padding: 12px 16px; border-bottom: 1px solid var(--row); vertical-align: top; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl.sets th, .tbl.sets td { padding-left: 24px; padding-right: 24px; }
.row-err { background: var(--err-row); }
.site-link { font-weight: 600; text-decoration: none; }
.problem { margin-top: 4px; font-size: 13px; color: var(--err); max-width: 320px; }
.sub { margin-top: 2px; font-size: 13px; color: var(--muted); }
.sub.err { color: var(--err); }
.actions { text-align: right; padding-top: 8px; padding-bottom: 8px; }
.actions form { margin: 0; }

/* описания */
.dl { margin: 0; display: grid; grid-template-columns: minmax(140px, 190px) minmax(0, 1fr); row-gap: 10px; column-gap: 16px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }

/* события */
.events { margin: 0; padding: 0; list-style: none; }
.events li { display: grid; grid-template-columns: 130px 28px minmax(0, 1fr); align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--row); }
.events li:last-child { border-bottom: 0; }
.ev { display: inline-flex; width: 24px; height: 24px; border-radius: 6px; align-items: center; justify-content: center; }
.ev-error { background: var(--err-bg); color: var(--err); }
.ev-downloaded { background: #E8EEFC; color: var(--accent); }
.ev-rotated, .ev-status_change, .ev-other { background: var(--row); color: var(--muted2); }
.ev-recovered { background: var(--ok-bg); color: var(--ok); }

/* вход */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card {
  width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 32px; display: flex; flex-direction: column; gap: 20px;
}
.login-head { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.login-head .ic { color: var(--accent); }
.login-head h1 { font-size: 22px; line-height: 28px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 500; }
.field input { min-height: 44px; padding: 0 12px; border: 1px solid #CDD2D9; border-radius: 8px; font: 400 15px var(--font); color: var(--text); background: var(--surface); }
.form-error { padding: 10px 12px; border-radius: 8px; background: var(--err-bg); color: var(--err-text); }

@media (max-width: 640px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .cards.two { grid-template-columns: 1fr; }
  .stat-wide { grid-column: 1 / -1; }
  .stat-value { font-size: 24px; }
  .page { padding: 20px 16px 32px; gap: 16px; }
  .topbar-in { padding: 8px 16px; }
  h1 { font-size: 24px; line-height: 30px; }
  .dl { grid-template-columns: 1fr; row-gap: 2px; }
  .dl dd { margin-bottom: 8px; }
  .events li { grid-template-columns: 28px minmax(0, 1fr); }
  .events li > .muted { grid-column: 1 / -1; font-size: 12px; }
}
