:root {
  font-family:
    Inter,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "Microsoft YaHei",
    sans-serif;
  color: #26384c;
  background: #eef5fb;
  font-size: 14px;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
  border: 1px solid #d5e1ed;
  border-radius: 9px;
  background: white;
  color: #334b65;
  padding: 10px 15px;
}
button:hover {
  background: #eaf3ff;
}
button:disabled {
  opacity: 0.45;
  cursor: wait;
}
.primary {
  color: white;
  background: #2878ef;
  border-color: #2878ef;
}
.danger {
  color: #c44046;
}
.muted {
  color: #7a8b9f;
}
.income {
  color: #15805e;
}
.expense {
  color: #c25b4a;
}
header {
  background: #fff;
  border-bottom: 1px solid #dee9f4;
  padding: 20px 32px;
  display: flex;
  align-items: center;
  gap: 28px;
}
header h1 {
  font-size: 22px;
  margin: 0;
}
nav {
  display: flex;
  gap: 8px;
  flex: 1;
}
nav button.active {
  background: #eaf3ff;
  color: #2678ec;
  border-color: #bdd6fb;
}
main {
  max-width: 1480px;
  margin: auto;
  padding: 28px;
}
.card {
  background: white;
  border: 1px solid #e3ebf4;
  border-radius: 16px;
  padding: 22px;
  margin-bottom: 20px;
  box-shadow: 0 4px 18px #24476a05;
}
.heading {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
h2 {
  font-size: 20px;
  margin: 0;
}
h3 {
  font-size: 16px;
}
.filters,
.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 15px;
}
label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: #65788e;
  font-size: 13px;
}
input,
select,
textarea {
  width: 100%;
  border: 1px solid #d6e2ef;
  border-radius: 9px;
  padding: 10px;
  background: #fff;
  color: #24374f;
  min-width: 0;
}
select[multiple] {
  min-height: 72px;
  height: 72px;
}
textarea {
  min-height: 90px;
  resize: vertical;
}
input[type="checkbox"] {
  width: auto;
}
label.check {
  flex-direction: row;
  align-items: center;
}
.actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 18px;
}
.summary {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.summary article {
  padding: 17px 24px;
  background: white;
  border: 1px solid #e0eaf4;
  border-radius: 14px;
  min-width: 245px;
  margin-bottom: 18px;
}
.summary strong {
  font-size: 22px;
  display: block;
  margin: 6px 0;
}
.scroll {
  overflow: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}
th {
  text-align: left;
  color: #718197;
  font-size: 12px;
  background: #f7faff;
}
th,
td {
  padding: 14px 12px;
  border-bottom: 1px solid #edf1f7;
}
tbody tr:hover {
  background: #f8fbff;
}
td .note {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}
.tag {
  display: inline-block;
  border-radius: 6px;
  background: #edf4fb;
  padding: 4px 7px;
  font-size: 12px;
}
.pager {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: flex-end;
  margin-top: 20px;
}
.login {
  max-width: 430px;
  margin: 12vh auto;
}
.login h1 {
  font-size: 28px;
}
.login form {
  display: grid;
  gap: 18px;
}
.empty {
  padding: 45px;
  text-align: center;
  color: #77889b;
}
.error {
  background: #fff1f1;
  color: #ad3434;
  padding: 12px;
  border-radius: 8px;
}
.full {
  grid-column: 1/-1;
}
dialog {
  border: none;
  border-radius: 18px;
  width: min(900px, 95vw);
  max-height: 92vh;
  padding: 26px;
  color: #26384c;
  box-shadow: 0 20px 70px #162d5240;
}
dialog::backdrop {
  background: #14264070;
}
.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.detail-grid small {
  display: block;
  color: #77889c;
  margin-bottom: 6px;
}
.gallery {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}
.gallery button {
  padding: 0;
  height: 110px;
  overflow: hidden;
}
.gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.viewer {
  text-align: center;
}
.viewer img {
  max-width: 100%;
  max-height: 65vh;
  object-fit: contain;
}
.viewer.zoom img {
  max-width: none;
  max-height: none;
  width: auto;
}
.viewer.zoom {
  overflow: auto;
  max-height: 70vh;
}
.audit {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 12px;
  background: #f4f8fc;
  padding: 14px;
}
.secret {
  overflow-wrap: anywhere;
  background: #f3f7fd;
  padding: 12px;
  border-radius: 9px;
}
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 22px;
  background: #243a53;
  color: white;
  border-radius: 10px;
  display: none;
  z-index: 10;
}
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid #9dc4fd;
  outline-offset: 2px;
}
@media (max-width: 900px) {
  .filters,
  .form-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  header {
    padding: 16px;
    flex-wrap: wrap;
    gap: 12px;
  }
  main {
    padding: 16px;
  }
  .detail-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .gallery {
    grid-template-columns: repeat(3, 1fr);
  }
  nav {
    overflow: auto;
  }
  nav button {
    white-space: nowrap;
  }
}
@media (max-width: 480px) {
  .filters,
  .form-grid {
    grid-template-columns: 1fr;
  }
  .card {
    padding: 16px;
  }
  .heading {
    flex-wrap: wrap;
  }
  .summary article {
    width: 100%;
  }
  .gallery {
    grid-template-columns: repeat(2, 1fr);
  }
}

.common-filters {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-items: start;
}
#advanced-filters {
  margin-top: 16px;
}
#advanced-filters summary {
  cursor: pointer;
  color: #2878ef;
  padding: 7px 0;
}
#advanced-count {
  margin-left: 12px;
}
#advanced-filters[open] .filters {
  margin-top: 12px;
}
@media (max-width: 1100px) {
  .common-filters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 600px) {
  .common-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

[hidden] {
  display: none !important;
}
.counterparty-panel {
  border: 1px solid #e1eafa;
  padding: 14px;
  background: #f8fbff;
  border-radius: 12px;
}
.counterparty-panel h3 {
  margin-top: 0;
}
.entity-search {
  margin-bottom: 18px;
  max-width: 720px;
}
