.head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.head-actions form {
  margin: 0;
}

.metrics small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.journal-metrics {
  margin: 0 0 18px;
}

.journal-metrics > div {
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow);
}

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

.chart-legend span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chart-legend span::before {
  content: "";
  width: 11px;
  height: 11px;
  border-radius: 3px;
  background: currentColor;
}

.electricity { color: #2563eb; }
.water { color: #0d9488; }
.heating { color: #e87924; }
.other { color: #94a3b8; }

.year-chart {
  display: grid;
  gap: 11px;
}

.year-bar-row {
  display: grid;
  grid-template-columns: 48px 1fr 95px;
  gap: 12px;
  align-items: center;
  text-decoration: none;
}

.year-bar-row:hover b,
.year-bar-row:hover strong {
  color: var(--teal);
}

.year-bar-row strong {
  text-align: right;
  font-size: 13px;
}

.year-bar-track {
  height: 21px;
  border-radius: 6px;
  background: #edf1f3;
  overflow: hidden;
}

.year-bar {
  display: flex;
  height: 100%;
  min-width: 2px;
  border-radius: 6px;
  overflow: hidden;
}

.year-bar span { display: block; height: 100%; }
.year-bar .electricity { background: #2563eb; }
.year-bar .water { background: #0d9488; }
.year-bar .heating { background: #e87924; }
.year-bar .other { background: #94a3b8; }

.journal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.journal-table th,
.journal-table td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

.journal-table th {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .035em;
}

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

.journal-table tbody tr:hover { background: #f8fafb; }
.journal-table a { color: var(--navy); text-decoration: none; }

.active-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 6px;
  border-radius: 99px;
  background: #e8f4ef;
  color: var(--success);
  font-size: 10px;
  font-weight: 800;
}

.status.historical {
  background: #eef2f5;
  color: #52606d;
}

.notice.historical {
  background: #f1f5f7;
  color: #405263;
}

.notice.historical span {
  color: var(--muted);
}

.historical-card {
  border-left: 4px solid #94a3b8;
}

.trend-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.trend-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfcfd;
}

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

.trend-head h3 {
  margin: 0;
  font-size: 18px;
}

.trend-head span,
.trend-head small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.trend-head > strong {
  text-align: right;
  font-size: 17px;
}

.trend-svg {
  display: block;
  width: 100%;
  height: auto;
  min-height: 180px;
  overflow: visible;
}

.trend-gridline {
  stroke: #dfe6ea;
  stroke-width: 1;
}

.trend-axis,
.trend-year {
  fill: #6b7b88;
  font: 10px system-ui, -apple-system, "Segoe UI", sans-serif;
}

.trend-line {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.trend-point {
  stroke: #fff;
  stroke-width: 2;
}

.due-text { color: var(--danger) !important; }
.credit-text { color: var(--success) !important; }

.panel-note {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.group-badge {
  display: inline-block;
  padding: 3px 7px;
  border-radius: 99px;
  background: #eef2f5;
  font-size: 11px;
  font-weight: 700;
}

.group-badge.electricity { background: #e9f0ff; }
.group-badge.water { background: #e5f7f5; }
.group-badge.heating { background: #fff0e4; }
.group-badge.other { background: #eef2f5; }

.journal-table .total-row { background: #f2f6f8; }

.journal-table .total-row td {
  font-weight: 800;
  border-top: 2px solid var(--navy);
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.detail-list { margin: 0; }

.detail-list > div {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.detail-list dt { color: var(--muted); }
.detail-list dd { margin: 0; font-weight: 750; }
.notes-list { margin: 0; padding-left: 20px; }
.notes-list li + li { margin-top: 8px; }

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

@media (max-width: 520px) {
  .year-bar-row { grid-template-columns: 40px 1fr 82px; gap: 8px; }
  .year-bar-row strong { font-size: 12px; }
  .trend-card { padding: 12px 8px; }
  .trend-svg { min-height: 150px; }
}
