:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --line: #d9dee5;
  --text: #17202a;
  --muted: #637083;
  --accent: #146c5f;
  --accent-strong: #0f5349;
  --warn: #9a6200;
  --danger: #a52222;
  --nav: #1e2933;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
}

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

.app {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: var(--nav);
  color: #fff;
  padding: 18px 14px;
}

.brand {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 4px;
}

.brand-subtitle {
  color: #b7c3cf;
  font-size: 12px;
  margin-bottom: 24px;
}

.nav-group-label {
  color: #91a1b2;
  font-size: 11px;
  font-weight: 700;
  margin: 18px 10px 7px;
  text-transform: uppercase;
}

.nav-link {
  align-items: center;
  border-radius: 6px;
  color: #dce5ee;
  display: flex;
  gap: 8px;
  min-height: 36px;
  padding: 8px 10px;
}

.nav-link.active,
.nav-link:hover {
  background: rgba(255, 255, 255, 0.11);
  color: #fff;
}

.main {
  min-width: 0;
  padding: 22px 28px 34px;
}

.topbar {
  align-items: flex-start;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.page-title {
  font-size: 24px;
  line-height: 1.2;
  margin: 0;
}

.page-subtitle {
  color: var(--muted);
  margin-top: 5px;
}

.badge {
  border-radius: 999px;
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 9px;
  white-space: nowrap;
}

.badge-test {
  background: #fff3cd;
  color: #7a5300;
  border: 1px solid #f0d38a;
}

.badge-ok {
  background: #e2f4ed;
  color: #12624f;
}

.badge-muted {
  background: #eef1f4;
  color: #526071;
}

.badge-warn {
  background: #fff3cd;
  color: var(--warn);
}

.grid-stats {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  margin-bottom: 18px;
}

.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 13px 14px;
}

.stat-value {
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
}

.stat-label {
  color: var(--muted);
  margin-top: 7px;
}

.module-bar,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.module-bar {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  padding: 12px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.btn,
button.btn {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  min-height: 34px;
  padding: 7px 11px;
}

.btn:hover {
  border-color: #aeb7c2;
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn.primary:hover {
  background: var(--accent-strong);
}

.btn.active {
  background: #e5f2ef;
  border-color: #8bbdb2;
  color: var(--accent-strong);
}

.table-wrap {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px 11px;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

th {
  background: #f8fafb;
  color: #3e4c5b;
  font-size: 12px;
  font-weight: 700;
}

td.amount,
th.amount {
  text-align: right;
}

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

.detail-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, 0.65fr);
}

.panel-header {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
}

.panel-title {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
}

.panel-body {
  padding: 14px;
}

.pdf-frame {
  border: 0;
  height: 720px;
  width: 100%;
}

.field-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

label {
  color: #3e4c5b;
  display: block;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 5px;
}

input,
select {
  border: 1px solid var(--line);
  border-radius: 5px;
  font: inherit;
  min-height: 36px;
  padding: 7px 9px;
  width: 100%;
}

.full {
  grid-column: 1 / -1;
}

.alert {
  border-radius: 6px;
  margin-bottom: 8px;
  padding: 10px;
}

.alert-warning {
  background: #fff8e6;
  border: 1px solid #efd394;
  color: #694800;
}

.alert-info {
  background: #edf5fb;
  border: 1px solid #bbd5e9;
  color: #244a63;
}

.raw-json {
  background: #101820;
  border-radius: 6px;
  color: #e8edf2;
  max-height: 360px;
  overflow: auto;
  padding: 12px;
}

@media (max-width: 980px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .grid-stats,
  .detail-grid {
    grid-template-columns: 1fr;
  }
}
