/* Палитра и размеры — из прежней ленты «Статистика» (samples/reference/statistics-feed.html). */
:root {
  --bg: #121826;
  --card: #1c2333;
  --raised: #2a3245;
  --muted: #8b93a7;
  --text: #e9edf5;
  --green: #3ddc84;
  --active: #1fbf4c;
  --danger: #ef5350;
  --warn: #ffd54f;
  --focus: #7fb3ff;
  --on-active: #08210f;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font:
    15px/1.35 -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    Roboto,
    Arial,
    sans-serif;
  font-variant-numeric: tabular-nums;
}

a {
  color: var(--focus);
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.top {
  padding: 18px 16px 0;
}

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 18px 16px 64px;
}

.wrap.wide {
  max-width: 1100px;
}

h1 {
  font-size: 26px;
  margin: 0 0 4px;
}

h2 {
  font-size: 19px;
  margin: 26px 0 10px;
}

.lead,
.muted {
  color: var(--muted);
}

.lead {
  margin: 0 0 18px;
}

/* Навигация и фильтры — чипы, как на прежней странице. */
.chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.chip {
  background: var(--raised);
  color: var(--text);
  border: 0;
  border-radius: 10px;
  padding: 6px 12px;
  font: inherit;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
}

.chip[aria-current='page'],
.chip.on {
  background: var(--active);
  /* Тёмный текст на зелёном: белый даёт контраст 2.4 (меньше нормы WCAG AA 4.5). */
  color: var(--on-active);
}

.chips.left {
  justify-content: flex-start;
  margin-bottom: 18px;
}

button,
input,
select {
  font: inherit;
  color: var(--text);
}

button {
  background: var(--raised);
  border: 0;
  border-radius: 8px;
  padding: 7px 12px;
  cursor: pointer;
}

button.primary {
  background: var(--active);
  color: var(--on-active);
}

button.danger {
  background: transparent;
  color: var(--danger);
  box-shadow: inset 0 0 0 1px var(--danger);
}

button.link {
  background: none;
  padding: 0;
  color: var(--focus);
  text-decoration: underline;
}

button:disabled {
  opacity: 0.5;
  cursor: default;
}

input,
select {
  background: var(--card);
  border: 1px solid var(--raised);
  border-radius: 8px;
  padding: 7px 10px;
  min-width: 0;
}

label {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--muted);
}

label.inline {
  flex-direction: row;
  align-items: center;
  gap: 6px;
}

.row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.error {
  color: var(--danger);
}

.error:empty {
  display: none;
}

/* Вход */
.login {
  max-width: 340px;
  margin: 12vh auto 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login label {
  font-size: 14px;
}

/* Загрузка */
.drop {
  display: block;
  position: relative;
  border: 2px dashed var(--raised);
  border-radius: 14px;
  padding: 34px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 15px;
  cursor: pointer;
}

.drop.over,
.drop:focus-within {
  border-color: var(--active);
  color: var(--text);
}

.drop strong {
  display: block;
  color: var(--text);
  font-size: 17px;
  margin-bottom: 6px;
}

.drop input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.report {
  list-style: none;
  padding: 0;
  margin: 18px 0 0;
}

.report > li,
.history > li {
  background: var(--card);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 10px;
}

.head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.file {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.status {
  font-size: 13px;
  border-radius: 6px;
  padding: 2px 8px;
  background: var(--raised);
  white-space: nowrap;
}

.status.ok {
  color: var(--green);
}

.status.bad {
  color: var(--danger);
}

.status.warn {
  color: var(--warn);
}

.counts {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin-top: 6px;
  font-size: 14px;
}

.counts b {
  font-weight: 600;
}

.problems {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--danger);
  font-size: 14px;
}

/* Счета */
.owner {
  margin-bottom: 30px;
}

.owner > .title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.group {
  background: var(--card);
  border-radius: 14px;
  padding: 12px 16px;
  margin-top: 12px;
}

.group > .title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.group .name {
  font-size: 17px;
  font-weight: 600;
}

.account {
  padding: 10px 0;
  border-top: 1px solid var(--raised);
}

.group > .title + .account {
  border-top: 0;
}

.account .line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.iban {
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.coverage {
  display: flex;
  gap: 3px;
  margin: 8px 0 4px;
  flex-wrap: wrap;
}

.coverage span {
  width: 18px;
  height: 10px;
  border-radius: 2px;
  background: var(--raised);
}

.coverage .full {
  background: var(--active);
}

.coverage .partial {
  background: #1f7a3a;
}

.coverage .none {
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--danger);
}

/* Операции */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 14px;
}

.filters .grow {
  flex: 1 1 220px;
}

.filters .grow input {
  width: 100%;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 10px 0;
}

.totals {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  font-size: 14px;
}

.scroll {
  overflow-x: auto;
  border-radius: 12px;
  background: var(--card);
}

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

.ops th,
.ops td {
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--raised);
}

.ops th {
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}

.ops th button {
  background: none;
  padding: 0;
  color: inherit;
}

.ops td.num,
.ops th.num {
  text-align: right;
  white-space: nowrap;
}

.ops .in {
  color: var(--green);
}

.ops .desc {
  color: var(--muted);
  font-size: 12px;
  max-width: 420px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ops .sweep {
  color: var(--muted);
}

.editor {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 200px;
}

details.columns {
  position: relative;
}

details.columns > summary {
  list-style: none;
}

details.columns > div {
  position: absolute;
  right: 0;
  z-index: 2;
  background: var(--card);
  border: 1px solid var(--raised);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 200px;
  margin-top: 6px;
}

summary {
  cursor: pointer;
}

/* Лента «Статистика» — как прежняя страница. */
.year {
  background: var(--card);
  border-radius: 14px;
  padding: 14px 16px;
  margin: 18px 0 26px;
  overflow-x: auto;
}

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

.year table + table {
  margin-top: 14px;
}

.year td,
.year th {
  padding: 5px 6px;
  text-align: right;
  vertical-align: top;
}

.year td:first-child,
.year th:first-child {
  text-align: left;
}

.year td span {
  display: inline-block;
  white-space: nowrap;
  margin-left: 10px;
}

.year th {
  color: var(--muted);
  font-weight: 500;
}

.year .sum td {
  font-weight: 600;
  border-top: 1px solid var(--raised);
}

details.month {
  margin-bottom: 18px;
}

details.month > summary {
  list-style: none;
}

details.month > summary::-webkit-details-marker {
  display: none;
}

.mh {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.mh .name {
  font-size: 24px;
  font-weight: 600;
}

.mh .tot {
  font-size: 17px;
  font-weight: 600;
  text-align: right;
}

.bar {
  display: flex;
  gap: 4px;
  height: 8px;
  margin: 12px 0 6px;
}

.bar span {
  border-radius: 2px;
  min-width: 4px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.legend i {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  margin-right: 4px;
}

.day {
  font-size: 19px;
  font-weight: 600;
  margin: 22px 0 8px;
}

.op {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
}

.ic {
  flex: 0 0 46px;
  height: 46px;
  border-radius: 12px;
  background: var(--card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.mid {
  flex: 1;
  min-width: 0;
}

.t {
  font-size: 17px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.s {
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.r {
  text-align: right;
  white-space: nowrap;
}

.a {
  font-size: 17px;
}

.a.in {
  color: var(--green);
}

.m {
  color: var(--muted);
  font-size: 13px;
}

.note {
  color: var(--muted);
  font-size: 12px;
  margin-top: 30px;
  line-height: 1.5;
}

/* История */
.history {
  list-style: none;
  padding: 0;
  margin: 0;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.conflict {
  border-top: 1px solid var(--raised);
  padding-top: 8px;
  margin-top: 8px;
  font-size: 14px;
}

.conflict dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 2px 12px;
  margin: 4px 0 0;
}

.conflict dt {
  color: var(--muted);
}

.conflict dd {
  margin: 0;
  overflow-wrap: anywhere;
}

@media (max-width: 560px) {
  .mh .name {
    font-size: 20px;
  }
  .ic {
    flex-basis: 40px;
    height: 40px;
    font-size: 19px;
  }
  .t,
  .a {
    font-size: 15px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}
