/* Layout and common controls. Financial values and permissions are rendered by app.js. */
* {
  box-sizing: border-box;
}
html {
  font: 16px/1.5 var(--font-sans);
  color: var(--ink);
  background: var(--bg);
}
body {
  margin: 0;
  background: var(--bg);
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
  border: 0;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}
a {
  color: inherit;
  text-decoration: none;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  font-size: 28px;
  line-height: 1.25;
  font-weight: 650;
  letter-spacing: -0.7px;
  text-wrap: balance;
}
h2 {
  font-size: 20px;
  line-height: 1.3;
  font-weight: 620;
  letter-spacing: -0.4px;
}
h3 {
  font-size: 18px;
  line-height: 1.4;
  font-weight: 600;
}
small {
  font-size: 12px;
}
a,
button,
input,
select,
textarea {
  transition:
    background-color 160ms,
    border-color 160ms,
    box-shadow 160ms;
}
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
input,
select,
textarea {
  width: 100%;
  min-height: var(--tap);
  min-width: 0;
  font-size: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  padding: 11px 13px;
  background: var(--paper);
  color: var(--ink);
}
input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
}
textarea {
  resize: vertical;
  min-height: 96px;
}
input[type='checkbox'],
input[type='radio'] {
  width: 20px;
  min-height: 20px;
  height: 20px;
  accent-color: var(--green);
  flex: none;
}
input[type='file'] {
  font-size: 14px;
}
input[readonly],
input:disabled {
  background: var(--surface-2);
}
label {
  display: grid;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
}
label em {
  font-style: normal;
  color: var(--muted);
  font-weight: 400;
}
progress {
  appearance: none;
  border: 0;
  border-radius: 8px;
  width: 100%;
  height: 7px;
  display: block;
  background: var(--surface-3);
  overflow: hidden;
}
progress::-webkit-progress-bar {
  background: var(--surface-3);
}
progress::-webkit-progress-value {
  background: var(--green);
  border-radius: 8px;
}
progress::-moz-progress-bar {
  background: var(--green);
  border-radius: 8px;
}
.icon {
  width: 20px;
  height: 20px;
  flex: none;
  vertical-align: middle;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.initial-loading {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  color: var(--muted);
}
.shell {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  min-height: 100dvh;
}
.sidebar {
  position: fixed;
  inset: 16px auto 16px 16px;
  width: 232px;
  padding: 24px 14px 16px;
  border-radius: 24px;
  background: var(--paper);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  z-index: 5;
  overflow-y: auto;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 24px;
  font-weight: 650;
  letter-spacing: -0.8px;
  padding: 0 8px;
}
.brand img {
  width: 36px;
  height: 36px;
}
.village {
  font-size: 12px;
  color: var(--muted);
  margin: 10px 8px 28px;
}
.nav {
  display: grid;
  gap: 5px;
}
.nav a {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 46px;
  padding: 10px 12px;
  border-radius: 24px;
  color: var(--secondary);
  font-size: 14px;
  font-weight: 500;
}
.nav a:hover {
  background: var(--surface-2);
}
.nav a.active {
  background: var(--nav-active);
  color: var(--on-nav-active);
}
.navicon {
  display: inline-flex;
  width: 20px;
  flex: none;
  align-items: center;
  justify-content: center;
}
.nav .count {
  margin-left: auto;
  min-width: 22px;
  padding: 0 5px;
  border-radius: 10px;
  background: var(--orange-soft);
  color: var(--orange);
  font-size: 12px;
  text-align: center;
}
.sidebar-bottom {
  margin-top: auto;
  padding-top: 28px;
}
.neighbor-note {
  padding: 16px 12px;
  color: var(--secondary);
  font-size: 13px;
}
.leaf {
  color: var(--green);
  display: inline-flex;
  margin-bottom: 10px;
}
.neighbor-note strong {
  font-weight: 550;
  display: block;
}
.neighbor-note p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}
.profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 6px 0;
  border-top: 1px solid var(--line);
}
.profile > div {
  min-width: 0;
  flex: 1;
}
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green);
  font-size: 13px;
  font-weight: 600;
  flex: none;
}
.profile-name {
  font-size: 13px;
  overflow-wrap: anywhere;
}
.profile-role {
  font-size: 12px;
  color: var(--muted);
}
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  min-height: 44px;
  border-radius: 12px;
  background: transparent;
  color: var(--secondary);
  flex: none;
}
.icon-btn:hover {
  background: var(--surface-2);
}
.main {
  grid-column: 2;
  min-width: 0;
}
.topbar {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 32px;
  color: var(--secondary);
  font-size: 13px;
}
.topbar strong {
  color: var(--ink);
  font-weight: 500;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--muted);
}
.access-tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.access-tag::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
}
.content {
  padding: 20px 32px 36px;
  max-width: 1480px;
  margin: 0 auto;
}
.page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}
.page-heading p {
  font-size: 14px;
  color: var(--muted);
  margin-top: 10px;
  max-width: 65ch;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 11px 18px;
  border-radius: 24px;
  background: var(--green);
  color: var(--on-green);
  font-weight: 550;
  font-size: 14px;
  line-height: 1.4;
  text-align: center;
}
.btn:hover {
  background: var(--green-strong);
}
.btn:active {
  transform: translateY(1px);
}
.btn.secondary {
  background: var(--surface-2);
  color: var(--ink);
}
.btn.secondary:hover {
  background: var(--surface-3);
}
.btn.soft {
  background: var(--green-soft);
  color: var(--green);
}
.btn.danger {
  background: var(--red-soft);
  color: var(--red);
}
.btn.small {
  font-size: 13px;
  padding: 9px 13px;
}
.text-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--green);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.text-link:hover {
  text-decoration: underline;
}
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat {
  min-height: 164px;
  padding: 23px;
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 0;
}
.stat.primary {
  background: var(--hero-bg);
  color: var(--on-hero);
  box-shadow: var(--hero-shadow);
}
.stat-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}
.stat-icon {
  color: var(--muted);
  display: inline-flex;
}
.stat-value {
  font-size: clamp(24px, 2.3vw, 36px);
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: -0.8px;
  margin-top: 18px;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.stat-note {
  margin-top: 18px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}
.stat.primary .stat-label,
.stat.primary .stat-note,
.stat.primary .stat-icon,
.stat.primary .text-link {
  color: var(--hero-secondary);
}
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 30px 0 18px;
}
.section-heading .subtitle {
  font-size: 13px;
  color: var(--muted);
  font-weight: 400;
  margin-left: 12px;
  letter-spacing: normal;
}
.campaign-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}
.campaign-card {
  background: var(--paper);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}
.campaign-card-body {
  padding: 24px;
  flex: 1;
}
.campaign-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}
.campaign-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  width: 44px;
  border-radius: 14px;
  background: var(--green-soft);
  color: var(--green);
}
.campaign-card h3 {
  margin-bottom: 9px;
}
.campaign-card p {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 24px;
  min-height: 44px;
  overflow-wrap: anywhere;
}
.campaign-amount {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  font-variant-numeric: tabular-nums;
}
.campaign-amount strong {
  font-size: 26px;
  font-weight: 650;
  letter-spacing: -0.5px;
}
.campaign-amount > span {
  font-size: 12px;
  color: var(--muted);
}
.campaign-meta {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  margin-top: 12px;
}
.campaign-owed {
  margin-top: 6px;
}
.campaign-card-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
}
.lower-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr);
  gap: 24px;
}
.panel {
  background: var(--paper);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  min-width: 0;
}
.panel-head {
  padding: 22px 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}
.panel-head h2 {
  font-size: 18px;
}
.panel-body {
  padding: 24px;
}
.table-scroll {
  overflow: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
}
th {
  font-weight: 500;
  color: var(--muted);
  font-size: 12px;
  background: var(--surface-2);
  padding: 14px 20px;
  white-space: nowrap;
}
td {
  padding: 18px 20px;
  border-top: 1px solid var(--line);
  vertical-align: middle;
}
td:first-child {
  min-width: 140px;
}
td .muted {
  display: block;
  font-size: 12px;
  margin-top: 6px;
}
td .offset-action {
  margin-top: 8px;
}
td.amount,
th.amount {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
td .btn {
  margin: 3px;
}
.muted {
  color: var(--muted);
}
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--secondary);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
}
.badge.active,
.badge.paid,
.badge.confirmed {
  background: var(--positive-soft);
  color: var(--positive);
}
.badge.pending,
.badge.partial {
  background: var(--orange-soft);
  color: var(--orange);
}
.badge.unpaid,
.badge.rejected {
  background: var(--red-soft);
  color: var(--red);
}
.badge.closed,
.badge.reversed {
  background: var(--surface-2);
  color: var(--muted);
}
.badge + .badge {
  margin-left: 5px;
}
.expense-list {
  padding: 0 24px;
}
.expense-item {
  display: flex;
  gap: 12px;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
  align-items: flex-start;
}
.expense-item:last-child {
  border: 0;
}
.expense-icon {
  height: 36px;
  width: 36px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--secondary);
  flex: none;
}
.expense-text {
  flex: 1;
  min-width: 0;
}
.expense-item strong {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
  display: block;
}
.expense-item small {
  color: var(--muted);
  display: block;
  margin-top: 6px;
}
.expense-price {
  font-size: 14px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.panel-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--line);
}
.notice {
  background: var(--green-soft);
  border: 1px solid transparent;
  border-radius: 16px;
  padding: 16px 20px;
  display: flex;
  gap: 12px;
  font-size: 14px;
  line-height: 1.65;
  color: var(--green);
  margin: 16px 0;
}
.notice.orange {
  background: var(--orange-soft);
  color: var(--orange);
}
.notice p {
  margin: 0;
}
.dashboard-note {
  margin-top: 28px;
}
.footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 32px;
  font-size: 12px;
  color: var(--muted);
}
.filters {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 22px;
  align-items: end;
}
.filters label {
  flex: 1;
  min-width: 130px;
  max-width: 250px;
}
.empty {
  padding: 36px 24px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}
.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr);
  gap: 24px;
  align-items: start;
}
.detail-description {
  font-size: 16px;
  line-height: 1.7;
  white-space: pre-wrap;
  color: var(--secondary);
}
.kv {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, auto);
  gap: 14px;
  margin-top: 20px;
  font-size: 14px;
}
.kv dt {
  color: var(--muted);
}
.kv dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.details-copy {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 16px;
  line-height: 1.7;
  padding: 18px;
  background: var(--surface-2);
  border-radius: 12px;
  margin: 16px 0;
}
.stack {
  display: grid;
  gap: 24px;
}
.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.doc-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.doc-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--green);
  background: var(--green-soft);
  border-radius: 8px;
  padding: 8px 10px;
  overflow-wrap: anywhere;
}
.plot-card {
  padding: 24px;
}
.plot-card .kv {
  margin-bottom: 20px;
}
.plot-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.help-copy {
  font-size: 14px;
  line-height: 1.7;
  color: var(--muted);
  margin: 16px 0;
}
.audit-text {
  font:
    12px/1.7 ui-monospace,
    monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-width: 550px;
}
.file-note {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.form-grid {
  display: grid;
  gap: 20px;
}
.form-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}
.check-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
  line-height: 1.6;
}
.check-label input {
  margin-top: 2px;
}
.check-list {
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  display: grid;
  gap: 12px;
}
.assessment-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px;
  align-items: center;
  gap: 12px;
}
.error {
  color: var(--red);
  font-size: 14px;
  background: var(--red-soft);
  padding: 14px;
  border-radius: 12px;
  line-height: 1.6;
}
.error:empty {
  display: none;
}
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 8px;
}
.form-actions .btn {
  min-width: 120px;
}
.appearance-field {
  margin-bottom: 24px;
}
.modal-subtitle {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
  margin: 12px 0 24px;
}
dialog {
  width: min(620px, calc(100vw - 32px));
  max-height: calc(100dvh - 40px);
  overflow: auto;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 24px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: var(--shadow-sheet);
}
dialog::backdrop {
  background: var(--overlay);
  backdrop-filter: blur(3px);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.modal-head h2 {
  font-size: 23px;
}
.modal-head .icon-btn {
  font-size: 24px;
}
.modal-result {
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 16px;
  border-radius: 12px;
  overflow-wrap: anywhere;
  line-height: 1.7;
  font-size: 14px;
}
.auth-screen {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--paper);
}
.auth-story {
  background: var(--hero-bg);
  padding: 48px;
  color: var(--on-hero);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 40px;
}
.auth-story .brand {
  font-size: 28px;
}
.auth-story h1 {
  font-size: clamp(36px, 4.2vw, 62px);
  line-height: 1.12;
  letter-spacing: -1.8px;
  max-width: 600px;
  margin-bottom: 24px;
}
.auth-story p {
  color: var(--hero-secondary);
  line-height: 1.8;
  max-width: 40ch;
}
.auth-story small {
  color: var(--hero-secondary);
}
.auth-form-area {
  display: grid;
  place-items: center;
  padding: 48px;
}
.auth-form {
  width: 100%;
  max-width: 390px;
}
.auth-form [hidden] {
  display: none;
}
.auth-form h2 {
  font-size: 28px;
  margin-bottom: 12px;
}
.auth-form > p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
  margin-bottom: 26px;
}
.auth-form .btn {
  width: 100%;
}
.auth-help {
  margin-top: 26px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--muted);
}
#toast {
  position: fixed;
  bottom: calc(24px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: var(--nav-active);
  color: var(--on-nav-active);
  border-radius: 14px;
  padding: 16px 22px;
  font-size: 14px;
  box-shadow: var(--shadow-pop);
  z-index: 100;
  max-width: calc(100vw - 32px);
  display: none;
}
#toast.show {
  display: block;
}
.mobile-brand {
  display: none;
}
.summary-strip {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  padding: 20px 24px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.summary-strip strong {
  display: block;
  font-size: 23px;
  font-weight: 600;
  margin-top: 8px;
  font-variant-numeric: tabular-nums;
}
.balance-item {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 14px;
}
.balance-item:last-child {
  border: 0;
}
.inline-detail {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}
.page-error {
  max-width: 550px;
  margin: 48px auto;
}
.subnav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.subnav .btn[aria-pressed='true'] {
  background: var(--nav-active);
  color: var(--on-nav-active);
}
.stat-value.compact {
  font-size: 28px;
}
@media (max-width: 1180px) {
  .content {
    padding: 20px 24px 32px;
  }
  .topbar {
    padding: 18px 24px;
  }
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .campaign-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .lower-grid,
  .detail-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .campaign-amount {
    flex-wrap: wrap;
    gap: 4px;
  }
}
@media (max-width: 850px) {
  .shell {
    display: block;
  }
  .sidebar {
    position: sticky;
    top: 0;
    width: 100%;
    padding: calc(12px + var(--safe-top)) 16px 0;
    border-radius: 0 0 20px 20px;
    overflow: visible;
  }
  .sidebar > .brand,
  .village,
  .sidebar-bottom {
    display: none;
  }
  .mobile-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
  }
  .mobile-brand .brand {
    font-size: 23px;
    padding: 0;
  }
  .mobile-brand .brand img {
    width: 32px;
    height: 32px;
  }
  .nav {
    display: flex;
    overflow: auto;
    gap: 6px;
    padding: 3px 0 12px;
    scrollbar-width: none;
  }
  .nav a {
    flex: none;
    padding: 10px 12px;
    min-height: 44px;
    font-size: 13px;
  }
  .nav .count {
    margin-left: 4px;
  }
  .topbar {
    display: none;
  }
  .content {
    padding: 28px 20px calc(32px + var(--safe-bottom));
  }
  .page-heading {
    align-items: flex-start;
  }
  .stat-value {
    font-size: 32px;
  }
  .settings-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .auth-story {
    padding: 32px;
  }
  .auth-form-area {
    padding: 32px;
  }
}
@media (max-width: 540px) {
  .content {
    padding: 24px 16px calc(32px + var(--safe-bottom));
  }
  .page-heading {
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
  }
  .page-heading h1 {
    font-size: 26px;
  }
  .page-heading p {
    font-size: 14px;
  }
  .page-heading .actions {
    width: 100%;
  }
  .stats {
    gap: 12px;
  }
  .stat {
    padding: 18px 16px;
    min-height: 160px;
  }
  .stat-label {
    font-size: 12px;
  }
  .stat-icon {
    display: none;
  }
  .stat-value {
    font-size: 28px;
    margin-top: 14px;
  }
  .stat-note {
    font-size: 12px;
  }
  .campaign-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }
  .campaign-card-body,
  .panel-body,
  .plot-card {
    padding: 20px;
  }
  .campaign-card p {
    min-height: 0;
  }
  .campaign-card-footer,
  .panel-head,
  .panel-footer {
    padding: 16px 20px;
  }
  .section-heading {
    margin-top: 28px;
  }
  .section-heading .subtitle {
    display: none;
  }
  .lower-grid {
    gap: 0;
  }
  .footer {
    flex-wrap: wrap;
  }
  .notice {
    padding: 16px;
  }
  .filters label {
    min-width: calc(50% - 8px);
    max-width: none;
  }
  .filters label:first-child {
    min-width: 100%;
  }
  .auth-screen {
    grid-template-columns: minmax(0, 1fr);
  }
  .auth-story {
    padding: 28px 24px;
    gap: 28px;
  }
  .auth-story h1 {
    font-size: 36px;
  }
  .auth-story small {
    display: none;
  }
  .auth-form-area {
    padding: 32px 24px;
  }
  .form-row {
    grid-template-columns: minmax(0, 1fr);
  }
  .form-actions .btn {
    flex: 1;
    min-width: 0;
  }
  dialog {
    padding: 22px;
    width: calc(100vw - 24px);
    max-height: calc(100dvh - 24px - var(--safe-top) - var(--safe-bottom));
  }
  .modal-head h2 {
    font-size: 21px;
  }
  .assessment-row {
    grid-template-columns: minmax(0, 1fr) 100px;
  }
}
@media (max-width: 360px) {
  .stats {
    grid-template-columns: minmax(0, 1fr);
  }
  .stat {
    min-height: 140px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}

/* M-02: mobile actions keep their labels and respect the phone's safe area. */
.phone-nav {
  display: none;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.more-menu {
  display: grid;
  gap: 8px;
  margin-top: 20px;
}
.more-menu a,
.more-menu button {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 52px;
  padding: 14px;
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 16px;
  text-align: left;
}
.more-menu [aria-current='page'] {
  background: var(--green-soft);
  color: var(--green);
}
@media (max-width: 850px) {
  .sidebar .nav {
    display: none;
  }
  .sidebar {
    padding-bottom: 8px;
  }
  .mobile-brand {
    margin-bottom: 0;
  }
  .content {
    padding-bottom: calc(110px + var(--safe-bottom));
  }
  .phone-nav {
    position: fixed;
    inset: auto 0 0;
    z-index: 8;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    padding: 6px 8px calc(6px + var(--safe-bottom));
    background: var(--paper);
    border-radius: 22px 22px 0 0;
    box-shadow: var(--shadow-dock);
  }
  .phone-nav a,
  .phone-nav button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 0;
    min-height: 54px;
    padding: 4px 2px;
    font-size: 11px;
    line-height: 1.3;
    font-weight: 500;
    border-radius: 12px;
    background: transparent;
    color: var(--secondary);
  }
  .phone-nav .icon {
    width: 22px;
    height: 22px;
  }
  .phone-nav [aria-current='page'] {
    color: var(--green);
    background: var(--green-soft);
  }
  .phone-nav [data-action='phone-pay'] .icon {
    width: 36px;
    height: 28px;
    padding: 3px 7px;
    border-radius: 9px;
    color: var(--on-green);
    background: var(--green);
  }
  #toast {
    bottom: calc(82px + var(--safe-bottom));
  }
}

/* Personal contributions: pending reports and confirmed money have separate meanings. */
.overview-dashboard {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(250px, 1fr);
  gap: 20px;
  margin-bottom: 20px;
}
.personal-summary {
  min-width: 0;
  padding: 26px;
  background: var(--hero-bg);
  color: var(--on-hero);
  border-radius: var(--radius);
  box-shadow: var(--hero-shadow);
}
.personal-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 20px;
}
.personal-head p {
  margin-top: 8px;
  font-size: 13px;
  color: var(--hero-secondary);
}
.personal-head label {
  font-size: 12px;
  max-width: 250px;
}
.personal-head select {
  max-width: 100%;
}
.personal-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  gap: 24px;
  margin-top: 26px;
}
.personal-balance .stat-label,
.personal-balance p {
  color: var(--hero-secondary);
}
.personal-balance .stat-value {
  font-size: clamp(28px, 3vw, 40px);
  margin-top: 8px;
}
.personal-balance p {
  font-size: 12px;
  margin-top: 12px;
}
.contribution-totals {
  display: grid;
  gap: 12px;
  margin: 0;
  padding-left: 24px;
  border-left: 1px solid rgb(255 255 255 / 25%);
}
.contribution-totals > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 14px;
}
.contribution-totals dt {
  color: var(--hero-secondary);
}
.contribution-totals dd {
  margin: 0;
  font-weight: 600;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.personal-warning {
  display: flex;
  align-items: start;
  gap: 10px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid rgb(255 255 255 / 25%);
  color: var(--hero-secondary);
  font-size: 13px;
  line-height: 1.7;
}
.village-summary {
  min-width: 0;
}
.village-summary .stat {
  min-height: 200px;
}
.village-summary > p {
  padding: 0 12px;
}
.contribution-actions {
  padding: 4px 22px;
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}
.contribution-action {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 16px 0;
}
.contribution-action + .contribution-action {
  border-top: 1px solid var(--line);
}
.contribution-action strong {
  display: block;
  font-size: 14px;
}
.contribution-action .muted {
  display: block;
  margin-top: 4px;
  font-size: 12px;
}
.contribution-action .actions {
  flex: none;
}
@media (max-width: 1180px) {
  .overview-dashboard {
    grid-template-columns: minmax(0, 1fr);
  }
  .village-summary .stat {
    min-height: 140px;
  }
}
@media (max-width: 600px) {
  .personal-summary {
    padding: 22px;
  }
  .personal-head {
    flex-direction: column;
    gap: 16px;
  }
  .personal-head label {
    max-width: none;
    width: 100%;
  }
  .personal-body {
    grid-template-columns: minmax(0, 1fr);
    gap: 22px;
  }
  .contribution-totals {
    border-left: 0;
    padding-left: 0;
    border-top: 1px solid rgb(255 255 255 / 25%);
    padding-top: 20px;
  }
  .contribution-action {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .contribution-action .actions {
    justify-content: space-between;
  }
}

.organization-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 24px;
  margin: 22px 0;
}
.organization-panel .help-copy,
.queue-panel .help-copy {
  margin: 6px 0 0;
}
.queue-panel {
  margin: 24px 0;
}
.queue-list {
  padding: 0 24px;
}
.queue-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 20px 0;
}
.queue-item + .queue-item {
  border-top: 1px solid var(--line);
}
.queue-item strong {
  font-size: 16px;
  font-weight: 600;
}
.queue-item p,
.queue-item small {
  color: var(--muted);
  font-size: 13px;
  margin-top: 7px;
}
.queue-item small {
  display: block;
}
.queue-item .actions {
  flex: none;
}
@media (max-width: 850px) {
  .organization-panel,
  .queue-item {
    flex-direction: column;
    align-items: stretch;
  }
  .queue-panel .panel-head {
    flex-wrap: wrap;
  }
  .queue-list {
    padding: 0 20px;
  }
}
.queue-item > div {
  min-width: 0;
}
.queue-item strong,
.queue-item p,
.queue-item small,
.personal-head p,
.contribution-action strong,
.contribution-action .muted {
  overflow-wrap: anywhere;
}

.staff-primary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
  margin: 24px 0;
}
.staff-primary > .stat:only-child {
  grid-column: 1 / -1;
}
.staff-primary .organization-panel {
  margin: 0;
  flex-direction: column;
  align-items: stretch;
}
.staff-secondary {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (max-width: 850px) {
  .staff-primary {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 540px) {
  .staff-secondary {
    grid-template-columns: minmax(0, 1fr);
  }
}

.bank-details {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  font-size: 14px;
}
.bank-details summary {
  cursor: pointer;
  color: var(--secondary);
  padding: 8px 0;
}
.bank-details label {
  margin-top: 12px;
}
.receipt-candidates {
  padding-left: 22px;
  margin: 0;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}
.pagination label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.pagination select {
  width: auto;
  min-height: 36px;
}
.selection-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 32px;
  padding: 16px 0;
}
.selection-summary dt {
  font-size: 12px;
  color: var(--muted);
}
.selection-summary dd {
  margin: 4px 0 0;
  font-weight: 600;
}
.budget-details,
.template-details {
  margin: 24px 0;
}
/* P1-12: short instructions on «Платежи». */
.how-to {
  margin: 16px 0;
}
.how-to > summary {
  cursor: pointer;
  min-height: var(--tap);
  padding: 11px 0;
  box-sizing: border-box;
  font-weight: 600;
}
.how-to ol {
  margin: 4px 0 0;
  padding-left: 22px;
  max-width: 72ch;
  color: var(--secondary);
  font-size: 14px;
  line-height: 1.6;
}
.how-to li + li {
  margin-top: 6px;
}
.queue-item small.queue-age {
  color: var(--secondary);
  font-weight: 500;
}
/* P1-12: a message waiting longer than the review term — text and color both say so. */
.queue-age.overdue,
.queue-item small.queue-age.overdue {
  display: block;
  width: fit-content;
  margin-top: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--orange-soft);
  color: var(--orange);
  font-size: 13px;
  font-weight: 600;
}
.overdue-count {
  margin-top: 6px;
  color: var(--orange);
  font-size: 14px;
  font-weight: 600;
}
.payment-table .review-term,
.payment-table .review-late {
  display: block;
  margin-top: 4px;
  font-size: 13px;
}
.payment-table .review-late {
  color: var(--orange);
  font-weight: 600;
}
.budget-details > summary,
.template-details > summary {
  cursor: pointer;
  padding: 12px 0;
  font-weight: 600;
}
.subnav {
  overflow: auto;
}
.pagination .actions {
  flex-wrap: wrap;
}
@media (max-width: 600px) {
  .pagination {
    padding: 12px;
  }
  .pagination > .actions {
    width: 100%;
  }
  .pagination button {
    flex: 1;
  }
  .selection-summary > div {
    width: calc(50% - 16px);
  }
  .subnav .btn {
    white-space: nowrap;
  }
}

.row-details {
  margin-top: 8px;
  max-width: 560px;
  overflow-wrap: anywhere;
}
.row-details summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--green);
}
.row-details[open] {
  padding: 8px 0;
}
.history-table td {
  overflow-wrap: anywhere;
}
@media (max-width: 600px) {
  .history-table,
  .history-table tbody {
    display: block;
    width: 100%;
  }
  .history-table thead {
    display: none;
  }
  .history-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: 'date amount' 'description description' 'actions actions';
    gap: 10px;
    padding: 16px;
    border-bottom: 1px solid var(--line);
  }
  .history-table td {
    display: block;
    padding: 0;
    border: 0;
    min-width: 0;
  }
  .history-table td:nth-child(1) {
    grid-area: date;
    font-size: 12px;
  }
  .history-table td:nth-child(2) {
    grid-area: description;
  }
  .history-table td:nth-child(3) {
    grid-area: amount;
    align-self: start;
  }
  .history-table td:nth-child(4) {
    grid-area: actions;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  .history-table td .btn {
    margin: 0;
  }
  .history-table td:nth-child(2) > .muted {
    margin-top: 4px;
  }
  .payment-table tr {
    grid-template-areas: 'description amount' 'context status' 'actions actions';
  }
  .payment-table td:nth-child(1) {
    grid-area: description;
    font-size: 14px;
  }
  .payment-table td:nth-child(2) {
    grid-area: context;
    font-size: 12px;
  }
  .payment-table td:nth-child(4) {
    grid-area: status;
    display: block;
    max-width: 140px;
  }
  .payment-table td:nth-child(5) {
    grid-area: actions;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  .row-details {
    width: 100%;
    max-width: 100%;
  }
}

.filters label:has(input[type='search']) {
  flex: 2;
  min-width: 220px;
}
@media (max-width: 600px) {
  .filters label:has(input[type='search']) {
    min-width: 100%;
  }
}

.user-lifecycle {
  border-top: 1px solid var(--line);
  padding-top: 20px;
  margin-top: 8px;
  display: grid;
  gap: 12px;
}
.user-lifecycle h3 {
  font-size: 16px;
}
.users-table td {
  overflow-wrap: anywhere;
}
.users-table td:last-child .btn {
  margin: 4px 8px 4px 0;
}
@media (max-width: 600px) {
  .users-table,
  .users-table tbody {
    display: block;
    width: 100%;
  }
  .users-table thead {
    display: none;
  }
  .users-table tr {
    display: grid;
    gap: 10px;
    padding: 16px;
    border-bottom: 1px solid var(--line);
  }
  .users-table td {
    display: block;
    padding: 0;
    border: 0;
    min-width: 0;
  }
  .users-table td:last-child {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  .users-table td:last-child .btn {
    margin: 0;
  }
}

.audit-table td {
  overflow-wrap: anywhere;
}
.audit-table summary {
  cursor: pointer;
  color: var(--green);
}
@media (max-width: 600px) {
  .audit-table,
  .audit-table tbody {
    display: block;
    width: 100%;
  }
  .audit-table thead {
    display: none;
  }
  .audit-table tr {
    display: grid;
    gap: 10px;
    padding: 16px;
    border-bottom: 1px solid var(--line);
  }
  .audit-table td {
    display: block;
    padding: 0;
    border: 0;
    min-width: 0;
  }
  .audit-table pre {
    max-width: 100%;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }
}

/* Long forms scroll inside the body; their title and actions stay reachable. */
dialog:has(> form) {
  padding: 0;
  overflow: hidden;
}
dialog[open]:has(> form) {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}
dialog:has(> form) > .modal-head {
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--line);
}
dialog > form.form-grid {
  min-height: 0;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 0;
}
.modal-body {
  display: grid;
  gap: 20px;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 20px 24px;
  scroll-padding-block: 16px;
}
.modal-body > .modal-subtitle {
  margin: 0;
}
.modal-body .form-row {
  align-items: end;
}
.modal-body .form-row > .btn {
  align-self: end;
}
.modal-body .check-label {
  min-width: 0;
  overflow-wrap: anywhere;
}
dialog > form > .form-actions {
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  background: var(--paper);
}
@media (max-width: 600px) {
  dialog:has(> form) > .modal-head {
    padding: 18px 18px 16px;
  }
  .modal-body {
    padding: 18px;
  }
  dialog > form > .form-actions {
    padding: 14px 18px max(14px, var(--safe-bottom));
  }
}
/* Date controls and the shared calendar use the current light/dark palette. */
.date-field {
  display: grid;
  gap: 8px;
  min-width: 0;
}
.date-control {
  position: relative;
  min-width: 0;
}
.date-control input {
  padding-right: 48px;
  font-variant-numeric: tabular-nums;
}
.date-toggle {
  position: absolute;
  right: 2px;
  top: 2px;
  bottom: 2px;
  min-width: 42px;
  display: grid;
  place-items: center;
  background: transparent;
  color: var(--green);
  border-radius: 10px;
}
.date-toggle:hover {
  background: var(--green-soft);
}
.date-error,
.amount-error {
  color: var(--red);
  font-size: 12px;
  line-height: 1.5;
}
.file-status {
  font-size: 12px;
  color: var(--secondary);
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.date-error:empty,
.file-status:empty,
.amount-error:empty {
  display: none;
}
input[name='attachment'][aria-invalid='true'],
input[name='amount'][aria-invalid='true'] {
  border-color: var(--red);
}
.payment-context .kv dd {
  text-align: right;
}
.refund-effect {
  margin: 0;
  padding-left: 18px;
  font-size: 14px;
}
.date-control input[aria-invalid='true'] {
  border-color: var(--red);
}
.filters > .date-field {
  flex: 1;
  min-width: 130px;
  max-width: 250px;
}
.calendar-panel {
  position: fixed;
  inset: auto;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow-pop);
  overflow: auto;
  z-index: 20;
  font-family: var(--font-sans);
}
.calendar-panel::backdrop {
  background: transparent;
}
.calendar-panel.calendar-fallback {
  display: block;
}
.calendar-heading {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 70px 32px;
  align-items: center;
  gap: 4px;
}
.calendar-heading select,
.calendar-heading input {
  min-height: 40px;
  padding: 6px;
  font-size: 14px;
  background: var(--surface-2);
  border-color: transparent;
  border-radius: 8px;
}
.calendar-heading select {
  text-transform: capitalize;
}
.calendar-heading input {
  appearance: textfield;
}
.calendar-heading input::-webkit-inner-spin-button {
  appearance: none;
}
.calendar-nav {
  display: grid;
  place-items: center;
  width: 32px;
  height: 40px;
  background: transparent;
  color: var(--green);
  border-radius: 8px;
}
.calendar-nav:hover {
  background: var(--green-soft);
}
.calendar-week,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 2px;
}
.calendar-week {
  margin: 14px 0 6px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}
.calendar-week span {
  padding: 6px 0;
}
.calendar-day {
  aspect-ratio: 1;
  min-width: 0;
  min-height: 32px;
  border-radius: 9px;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.calendar-day.adjacent {
  color: var(--muted);
}
.calendar-day.today {
  box-shadow: inset 0 0 0 1px var(--green);
}
.calendar-day:hover:not(:disabled) {
  background: var(--green-soft);
}
.calendar-day[aria-selected='true'] {
  background: var(--green);
  color: var(--on-green);
}
.calendar-day:disabled {
  opacity: 0.32;
}
.calendar-footer {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  border-top: 1px solid var(--line);
  margin-top: 12px;
  padding-top: 8px;
}
.calendar-link {
  min-height: 40px;
  padding: 6px 3px;
  background: transparent;
  color: var(--green);
  font-size: 12px;
  border-radius: 6px;
}
.calendar-link:hover {
  background: var(--green-soft);
}
.calendar-hint {
  margin-top: 4px;
  font-size: 11px;
  line-height: 1.4;
  color: var(--muted);
}
@media (max-width: 600px) {
  .filters > .date-field {
    min-width: calc(50% - 8px);
    max-width: none;
  }
  .calendar-panel {
    padding: 12px;
  }
}

.calendar-grid {
  grid-template-columns: minmax(0, 1fr);
}
.calendar-row {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 2px;
}
.modal-body {
  grid-auto-rows: max-content;
  align-content: start;
}

.assessment-table td {
  overflow-wrap: anywhere;
}
@media (max-width: 600px) {
  .assessment-table,
  .assessment-table tbody {
    display: block;
    width: 100%;
  }
  .assessment-table thead {
    display: none;
  }
  .assessment-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid var(--line);
  }
  .assessment-table td {
    display: block;
    min-width: 0;
    padding: 0;
    border: 0;
    text-align: left;
    white-space: normal;
  }
  .assessment-table td:first-child,
  .assessment-table td:nth-child(6) {
    grid-column: 1/-1;
  }
  .assessment-table td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: 12px;
    color: var(--muted);
    font-weight: 400;
    margin-bottom: 4px;
  }
}

.plot-picker {
  display: grid;
  gap: 16px;
  min-width: 0;
}
.picker-filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.picker-summary {
  font-weight: 600;
}
.plot-picker .check-list {
  min-height: 180px;
}
.plot-picker .picker-row {
  padding: 8px 0;
}
.plot-picker .pagination {
  padding: 0;
}
.plot-picker [aria-busy='true'] {
  opacity: 0.6;
  pointer-events: none;
}
.plot-picker .check-label {
  min-width: 0;
  overflow-wrap: anywhere;
}
@media (max-width: 600px) {
  .picker-filters {
    grid-template-columns: minmax(0, 1fr);
  }
  .plots-table,
  .plots-table tbody {
    display: block;
    width: 100%;
  }
  .plots-table thead {
    display: none;
  }
  .plots-table tr {
    display: grid;
    gap: 10px;
    padding: 16px;
    border-bottom: 1px solid var(--line);
  }
  .plots-table td {
    display: block;
    padding: 0;
    border: 0;
    min-width: 0;
    overflow-wrap: anywhere;
  }
}
.searchable-field {
  display: grid;
  gap: 8px;
  min-width: 0;
}
.reference-pages {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
}
.reference-pages .btn {
  min-height: 36px;
  padding: 8px 12px;
}
.receipt-plot-search {
  display: grid;
  gap: 10px;
}
.receipt-plot-search .pagination {
  padding: 0;
}
.picker-error,
.reference-error {
  color: var(--red);
  font-size: 14px;
  overflow-wrap: anywhere;
}
.picker-error:empty,
.reference-error:empty {
  display: none;
}
@media (max-width: 420px) {
  .plot-picker .assessment-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
  }
  .plot-picker .assessment-row input[type='text'] {
    margin-left: 32px;
    width: calc(100% - 32px);
  }
}

/* A catalogue pager controls the cards; it is not a separate content panel. */
.catalogue-pagination {
  margin: 8px 0 24px;
  min-width: 0;
}
.catalogue-pagination > .pagination {
  padding: 0;
}
.assessment-panel {
  container: assessment / inline-size;
}
.assessment-panel > .filters {
  margin: 20px 24px;
}
.assessment-panel > .selection-summary {
  padding: 0 24px 20px;
  margin: 0;
}
.assessment-panel > .campaign-composition {
  margin: 16px 24px 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
}
.campaign-composition > .help-copy {
  margin: 0;
  font-variant-numeric: tabular-nums;
}
.assessment-panel .assessment-table .btn,
.assessment-panel .assessment-table .badge {
  white-space: nowrap;
}
@container assessment (max-width:760px) {
  .assessment-table,
  .assessment-table tbody {
    display: block;
    width: 100%;
  }
  .assessment-table thead {
    display: none;
  }
  .assessment-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--line);
  }
  .assessment-table td {
    display: block;
    min-width: 0;
    padding: 0;
    border: 0;
    text-align: left;
    white-space: normal;
  }
  .assessment-table td:first-child,
  .assessment-table td:nth-child(6) {
    grid-column: 1/-1;
  }
  .assessment-table td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: 12px;
    color: var(--muted);
    font-weight: 400;
    margin-bottom: 4px;
  }
}
@media (max-width: 1180px) {
  .campaign-detail > .campaign-funds {
    order: -1;
  }
}
@media (max-width: 600px) {
  .assessment-panel > .filters {
    margin: 16px 20px;
  }
  .assessment-panel > .selection-summary {
    padding: 0 20px 16px;
  }
  .assessment-panel > .campaign-composition {
    margin: 12px 20px 0;
  }
}
@media (max-width: 600px) {
  .pagination.single-page {
    flex-wrap: nowrap;
    gap: 8px;
  }
  .pagination.single-page > span {
    white-space: nowrap;
  }
  .pagination.single-page > .actions {
    width: auto;
    margin-left: auto;
  }
  .pagination.single-page [data-action='list-page'] {
    display: none;
  }
  .pagination.single-page label {
    gap: 6px;
    white-space: nowrap;
  }
}
.audit-diff {
  display: grid;
  gap: 16px;
  margin: 16px 0 0;
}
.audit-diff > div {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.audit-diff dt {
  font-weight: 600;
}
.audit-diff dd {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.audit-change summary {
  cursor: pointer;
}
.audit-change {
  min-width: 0;
}
@media (max-width: 600px) {
  .audit-diff > div {
    grid-template-columns: minmax(0, 1fr);
  }
  .audit-table,
  .audit-table tbody {
    display: block;
    width: 100%;
  }
  .audit-table thead {
    display: none;
  }
  .audit-table tr {
    display: grid;
    gap: 12px;
    padding: 16px;
  }
  .audit-table td {
    display: block;
    padding: 0;
    border: 0;
    min-width: 0;
    overflow-wrap: anywhere;
  }
}
.discard-dialog {
  max-width: 480px;
  padding: 24px;
}
.discard-dialog h2 {
  font-size: 22px;
}
.discard-dialog p {
  margin: 16px 0;
  color: var(--muted);
}
.discard-dialog .actions {
  align-items: stretch;
}
.discard-dialog .btn {
  white-space: normal;
}
.auth-screen.reset-screen {
  grid-template-columns: minmax(0, 1fr);
}
.filters.compact-filters {
  display: grid;
  gap: 12px;
}
.filter-toolbar {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
}
.filters .filter-toolbar > label {
  flex: 1;
  min-width: 200px;
  max-width: none;
}
.filter-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  gap: 12px;
  align-items: end;
}
.filter-fields[hidden],
.filter-applied[hidden] {
  display: none;
}
.filters .filter-fields > label,
.filters .filter-fields > .searchable-field {
  width: 100%;
  max-width: none;
  min-width: 0;
}
.filter-applied {
  margin: 0;
  overflow-wrap: anywhere;
}
.filter-toggle {
  white-space: nowrap;
}
@media (max-width: 600px) {
  .filters .filter-toolbar > label {
    flex-basis: 100%;
    min-width: 0;
  }
  .filter-fields {
    grid-template-columns: minmax(0, 1fr);
  }
  .filters .filter-fields label:has(input[type='search']) {
    min-width: 0;
  }
  .filter-toolbar .btn {
    min-height: 44px;
  }
}
.compact-journal td {
  padding: 8px 16px;
}
.row-title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.row-context {
  display: -webkit-box !important;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  overflow: hidden;
}
.row-details p {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 12px 0;
}
.row-actions > summary {
  cursor: pointer;
  white-space: nowrap;
  color: var(--accent);
  padding: 8px 0;
}
.row-actions .actions {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}
.row-actions .btn {
  margin: 0;
  white-space: normal;
}
@media (max-width: 600px) {
  .compact-journal td {
    padding: 0;
  }
  .compact-journal tr {
    padding: 16px;
  }
  .row-actions .actions {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  }
}
.payment-table td {
  padding: 10px 16px;
}
@media (max-width: 600px) {
  .payment-table td {
    padding: 0;
  }
}
.payment-table .row-title {
  display: -webkit-box;
}
.draft-tools {
  border-top: 1px solid var(--line);
  margin-top: 8px;
  padding-top: 12px;
  min-width: 0;
}
.draft-tools [hidden] {
  display: none;
}
.draft-tools .actions,
.draft-banner .actions {
  flex-wrap: wrap;
}
.draft-banner .actions > span {
  flex: 1;
  min-width: 150px;
}
.draft-banner {
  margin-bottom: 20px;
  display: grid;
  gap: 12px;
}
.draft-tools p {
  overflow-wrap: anywhere;
}
@media (max-width: 600px) {
  .stats.finance-stats {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    border-radius: 24px;
    background: var(--paper);
    overflow: hidden;
  }
  .finance-stats .stat {
    min-height: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 12px 16px;
  }
  .finance-stats .stat.primary {
    padding: 16px;
  }
  .finance-stats .stat.primary .stat-note {
    margin-top: 12px;
  }
  .finance-stats .stat:not(.primary) {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 12px;
    border-top: 1px solid var(--line);
  }
  .finance-stats .stat:not(.primary) .stat-label {
    flex: 1;
    min-width: 110px;
    font-size: 13px;
  }
  .finance-stats .stat:not(.primary) .stat-value {
    font-size: 22px;
    margin: 0;
  }
  .finance-stats .stat:not(.primary) .stat-note {
    flex-basis: 100%;
    margin: 0;
    font-size: 11px;
    min-height: 0;
  }
  .finance-stats .stat:nth-child(n + 3) .stat-note {
    display: none;
  }
}

/* M-01c: motion of myMoney (ui/base.css, «motion»). Light and only on arrival — a section, a dialog, a toast, a new
   journal row, a progress bar, a block that unfolds; nothing loops. Under «reduce motion» none of it exists (see also
   the global rule above). Animations fill backwards only, so no transform stays after arrival. A closed dialog closes
   at once; its inert copy (.dialog-ghost, added by app.js) plays the exit. */
@media (prefers-reduced-motion: no-preference) {
  .content.page-enter {
    animation: page-enter var(--dur-base) var(--ease-out) backwards;
  }
  /* Chromium does not animate ::-webkit-progress-value: the whole bar is revealed from its start instead */
  .content.page-enter progress {
    animation: grow var(--dur-slow) var(--ease-out) backwards;
  }
  dialog[open] {
    animation: dialog-in var(--dur-base) var(--ease-out) backwards;
  }
  dialog[open]::backdrop {
    animation: fade-in var(--dur-fast) ease-out backwards;
  }
  #toast.show {
    animation: toast-in var(--dur-base) var(--ease-out) backwards;
  }
  tr.row-new {
    animation: row-new 1.6s var(--ease-out) backwards;
  }
  details[open] > :not(summary) {
    animation: fold-in var(--dur-base) var(--ease-out) backwards;
  }
  .dialog-ghost {
    animation: fade-out var(--dur-exit) ease-in forwards;
  }
  .dialog-ghost > .dialog-leaving {
    animation: dialog-out var(--dur-exit) ease-in forwards;
  }
  .phone-nav [data-action='phone-pay'] .icon {
    transition: transform var(--dur-fast) var(--ease-spring);
  }
  .phone-nav [data-action='phone-pay']:not(:disabled):active .icon {
    transform: scale(0.9);
  }
}
@media (prefers-reduced-motion: no-preference) and (max-width: 860px) {
  dialog[open] {
    animation-name: sheet-up; /* a phone's sheet comes up from the bottom edge */
  }
  .dialog-ghost > .dialog-leaving {
    animation-name: sheet-down;
  }
}
.dialog-ghost {
  position: fixed;
  inset: 0;
  z-index: 99;
  background: var(--overlay);
  backdrop-filter: blur(3px);
  pointer-events: none;
}
.dialog-ghost > .dialog-leaving {
  position: fixed;
  inset: 0;
  height: fit-content;
  margin: auto;
}
@keyframes page-enter {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}
@keyframes fade-in {
  from {
    opacity: 0;
  }
}
@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.985);
  }
}
@keyframes sheet-up {
  from {
    opacity: 0;
    transform: translateY(32px);
  }
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 8px); /* #toast is centred with translateX(-50%) */
  }
}
@keyframes grow {
  from {
    clip-path: inset(0 100% 0 0);
  }
}
@keyframes fold-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
}
@keyframes row-new {
  0% {
    opacity: 0;
    transform: translateY(-4px);
    background-color: var(--green-soft);
  }
  25% {
    opacity: 1;
    transform: none;
    background-color: var(--green-soft);
  }
  100% {
    background-color: transparent;
  }
}
@keyframes fade-out {
  to {
    opacity: 0;
  }
}
@keyframes dialog-out {
  to {
    opacity: 0;
    transform: translateY(4px) scale(0.985);
  }
}
@keyframes sheet-down {
  to {
    transform: translateY(100%);
  }
}
/* P1-14: reconciliation summary when closing a campaign, its snapshot on the page, and the reduction preview. */
.closing-summary h3,
.reduction-preview h3 {
  margin: 0;
  font-size: 15px;
}
.closing-summary .kv,
.closing-panel .kv {
  margin-top: 12px;
  gap: 10px 14px;
}
.closing-summary .kv dd,
.closing-panel .kv dd {
  text-align: right;
}
.closing-reason {
  margin: 8px 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.6;
}
.closing-pending {
  flex-direction: column;
  gap: 8px;
}
.closing-pending .text-link {
  align-self: flex-start;
}
.reduction-preview,
.closing-summary {
  min-width: 0;
}
.reduction-preview p {
  overflow-wrap: anywhere;
}
.reduction-preview table {
  width: 100%;
}
.reduction-preview td.amount,
.reduction-preview th.amount {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.reduction-mode,
.split-mode {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  border: 0;
}
.reduction-mode legend,
.split-mode legend {
  font-weight: 600;
  margin-bottom: 4px;
}
.reduction-total {
  margin: 12px 0 0;
}
.campaign-composition > .actions {
  flex-wrap: wrap;
}
.reduction-mode label[hidden] {
  display: none;
}

/* M-04: journal days — a quiet band per day with the server's totals of the whole day; never reads as an operation. */
.journal-by-day .day-head th {
  padding: 10px 16px;
  background: var(--surface-2);
  border-top: 1px solid var(--line);
  color: var(--secondary);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  white-space: normal;
}
.journal-by-day thead + .journal-day .day-head th {
  border-top: 0;
}
.day-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 16px;
}
.day-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
}
.day-title strong {
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}
.day-sum {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}
.day-chip {
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.day-chip.positive {
  background: var(--positive-soft);
  color: var(--positive);
}
.day-chip-label {
  font-weight: 500;
}
.day-chip.transfer {
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--secondary);
}
.day-cut {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted);
}
@media (max-width: 600px) {
  .history-table tr.day-head {
    display: block;
    padding: 0;
  }
  .history-table .day-head th {
    display: block;
    padding: 10px 16px;
  }
  .day-sum {
    justify-content: flex-start;
  }
}
/* Inside a day the row's date is in the band; the row starts with its kind. */
.journal-by-day td > .sr-only + .muted {
  margin-top: 0;
}

/* M-05: the period report. */
.report-tabs .btn[aria-current='page'] {
  background: var(--nav-active);
  color: var(--on-nav-active);
}
.report-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px 20px;
  margin-bottom: 16px;
}
.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  border-radius: 24px;
  background: var(--surface-3);
}
.segmented .btn {
  min-height: 36px;
  background: transparent;
  box-shadow: none;
  border-color: transparent;
}
.segmented .btn[aria-pressed='true'] {
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow-raise);
}
.report-range {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
}
.report-range label {
  min-width: 150px;
}
.report-period-label {
  min-width: 9ch;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.icon-only {
  min-width: 44px;
  padding-inline: 0;
  font-size: 18px;
}
.report-budget {
  min-width: 220px;
  margin-left: auto;
}
.report-scope,
.report-pending {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 0 0 16px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--secondary);
}
.report-scope .icon,
.report-pending .icon {
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 1px;
}
.report-scope.budget {
  color: var(--green);
}
.report-pending {
  margin: 0;
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  background: var(--orange-soft);
  color: var(--orange);
}
.report-statement th,
.report-statement td {
  background: none;
  padding: 14px 24px;
  border-top: 1px solid var(--line);
  font-size: 15px;
  color: var(--ink);
  white-space: normal;
}
.report-statement tr:first-child th,
.report-statement tr:first-child td {
  border-top: 0;
}
.report-statement th {
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
}
.report-statement th .muted {
  display: block;
  margin-top: 2px;
  font-size: 13px;
  font-weight: 400;
}
.report-statement .report-balance th,
.report-statement .report-balance td {
  background: var(--surface-2);
  font-weight: 650;
}
.report-statement .report-balance td {
  font-size: 18px;
}
.report-statement .report-subtotal td,
.report-statement .report-subtotal th {
  font-weight: 600;
}
.report-sum {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 4px;
  font-variant-numeric: tabular-nums;
}
.report-sum:hover,
.report-sum:focus-visible {
  color: var(--green);
  text-decoration-color: currentColor;
}
.report-explain {
  max-width: 75ch;
  margin: 20px 0 8px;
  line-height: 1.65;
  color: var(--secondary);
}
.report-history {
  margin-top: 16px;
}
.report-charts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}
.chart-panel {
  margin: 0;
  padding: 18px 20px 10px;
}
.chart-panel figcaption {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 16px;
  margin-bottom: 8px;
  font-size: 14px;
}
.chart-panel figcaption .muted {
  font-size: 13px;
}
.chart-legend {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--secondary);
}
.chart-legend .key {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-left: 8px;
}
.chart-legend .key:first-child {
  margin-left: 0;
}
.chart-legend .key.received,
.chart-bar.received {
  background: var(--chart-1);
  fill: var(--chart-1);
}
.chart-legend .key.spent,
.chart-bar.spent {
  background: var(--chart-2);
  fill: var(--chart-2);
}
.chart {
  min-height: 200px;
}
.chart-svg {
  display: block;
  overflow: visible;
}
.chart-grid {
  stroke: var(--line);
  stroke-width: 1;
}
.chart-tick {
  fill: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.chart-value {
  fill: var(--ink);
  font-size: 13px;
  font-weight: 600;
}
.chart-line {
  fill: none;
  stroke: var(--chart-1);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.chart-area {
  fill: var(--chart-1);
  opacity: 0.1;
}
.chart-dot {
  fill: var(--chart-1);
  stroke: var(--paper);
  stroke-width: 2;
}
.chart-hit > rect {
  fill: transparent;
}
.chart-hit:hover > rect {
  fill: var(--surface-2);
}
.report-months th[scope='row'],
.report-categories th[scope='row'] {
  background: none;
  font-size: 14px;
  color: var(--ink);
  font-weight: 500;
  text-transform: none;
}
.report-months td,
.report-months th[scope='row'],
.report-categories td,
.report-categories th[scope='row'] {
  padding: 12px 16px;
}
.print-heading {
  display: none;
}
@media (max-width: 850px) {
  .report-charts {
    grid-template-columns: minmax(0, 1fr);
  }
  .report-budget {
    margin-left: 0;
    width: 100%;
  }
}
@media (max-width: 540px) {
  .report-controls {
    gap: 12px;
  }
  .segmented {
    display: flex;
    width: 100%;
  }
  .segmented .btn {
    flex: 1 1 auto;
    padding-inline: 10px;
  }
  .report-range {
    width: 100%;
    justify-content: space-between;
  }
  .report-range label {
    min-width: 0;
    flex: 1;
  }
  .report-statement th,
  .report-statement td {
    padding: 12px 16px;
  }
  .report-pending {
    padding: 14px 16px;
  }
  .chart-panel {
    padding: 14px 12px 6px;
  }
}
/* M-05: a printed report is a plain page on white paper: no menus, controls or buttons; sums stay readable. */
@media print {
  :root:root:root {
    --bg: #fff;
    --paper: #fff;
    --surface-2: #f2f1ed;
    --surface-3: #e6e4de;
    --ink: #1c1e1b;
    --secondary: #3a3e39;
    --muted: #50554f;
    --line: #c9c5bb;
    --green: #2f5640;
    --orange: #6b4600;
    --orange-soft: #fff;
    --chart-1: #2e7d4f;
    --chart-2: #6250d6;
    --shadow: none;
    color-scheme: light;
  }
  body {
    background: #fff;
  }
  .sidebar,
  .topbar,
  .phone-nav,
  .footer,
  .subnav,
  .report-controls,
  .page-heading,
  .btn,
  #toast {
    display: none !important;
  }
  .shell,
  .main,
  .content {
    display: block;
    padding: 0;
    margin: 0;
    max-width: none;
  }
  .print-heading {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 16px;
    font-size: 13px;
    color: var(--secondary);
  }
  .print-heading strong {
    font-size: 22px;
    color: var(--ink);
  }
  .panel {
    box-shadow: none;
    border: 1px solid var(--line);
    break-inside: avoid;
  }
  .report-sum,
  .report-months a {
    color: inherit;
    text-decoration: none;
  }
  .report-charts {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    break-inside: avoid;
  }
  .table-scroll {
    overflow: visible;
  }
}
.report-months th[scope='row'] {
  border-top: 1px solid var(--line);
}
.report-panel .panel-head {
  flex-wrap: wrap;
}
@media (max-width: 600px) {
  .report-months thead,
  .report-categories thead {
    display: none;
  }
  .report-months,
  .report-categories,
  .report-months tbody,
  .report-categories tbody,
  .report-months tr,
  .report-categories tr,
  .report-months th[scope='row'],
  .report-categories th[scope='row'] {
    display: block;
    width: 100%;
  }
  .report-months tr,
  .report-categories tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    border-top: 1px solid var(--line);
    padding: 12px 16px 14px;
  }
  .report-months tr:first-child,
  .report-categories tr:first-child {
    border-top: 0;
  }
  .report-months th[scope='row'],
  .report-categories th[scope='row'] {
    grid-column: 1 / -1;
    border-top: 0;
    padding: 0 0 6px;
    font-weight: 600;
  }
  .report-months td,
  .report-categories td {
    display: flex;
    flex-direction: column;
    gap: 2px;
    border-top: 0;
    padding: 6px 0;
    text-align: left;
    min-width: 0;
  }
  .report-months td::before,
  .report-categories td::before {
    content: attr(data-label);
    font-size: 12px;
    color: var(--muted);
  }
  .report-months td:first-child,
  .report-categories td:first-child {
    min-width: 0;
  }
}
/* M-06: expense categories and templates. A category is a quiet label with its icon — not a status color. */
.category-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-right: 6px;
  color: var(--secondary);
  font-weight: 500;
  white-space: nowrap;
}
.category-tag .icon {
  width: 14px;
  height: 14px;
  flex: none;
}
.row-context .category-tag::after {
  content: '·';
  margin-left: 6px;
  color: var(--muted);
  font-weight: 400;
}
.report-categories .category-tag {
  color: var(--ink);
  margin: 0;
}
.report-categories .category-tag .icon {
  width: 16px;
  height: 16px;
  color: var(--secondary);
}
.report-categories tfoot th[scope='row'],
.report-categories tfoot td {
  border-top: 1px solid var(--line);
  font-weight: 600;
}
.template-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
}
.template-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.template-icon {
  height: 36px;
  width: 36px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--secondary);
  flex: none;
}
.template-text {
  flex: 1;
  min-width: 0;
}
.template-text strong {
  display: block;
  font-weight: 600;
}
.template-text small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}
.template-item .actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}
.category-history ol {
  margin: 4px 0 0;
  padding-left: 22px;
  font-size: 14px;
  line-height: 1.6;
}
.category-history h3 {
  font-size: 14px;
  margin: 12px 0 0;
}
@media (max-width: 600px) {
  .template-item {
    flex-wrap: wrap;
  }
  .template-item .actions {
    width: 100%;
    justify-content: flex-start;
  }
  .report-categories tfoot {
    display: block;
    width: 100%;
  }
  /* One line of three figures per category: the list stays short on a phone. */
  .report-categories tr {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    column-gap: 12px;
  }
}
@media print {
  .template-details {
    display: none;
  }
  .report-categories a {
    color: inherit;
    text-decoration: none;
  }
}
/* M-07: bank statement import — one list of incoming rows, amount and state on the right. */
.statement-upload {
  display: grid;
  gap: 12px;
}
.statement-upload input[type='file'] {
  margin-top: 6px;
}
.statement-file {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  color: var(--secondary);
  overflow-wrap: anywhere;
}
.statement-columns {
  margin: 18px 0 0;
}
.statement-columns > summary {
  cursor: pointer;
  font-weight: 600;
  padding: 6px 0;
  overflow-wrap: anywhere;
}
.statement-mapping {
  display: block;
  margin-top: 2px;
  font-weight: 400;
  font-size: 13px;
  color: var(--muted);
}
.statement-columns form {
  margin-top: 10px;
}
.statement-column-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.statement-summary {
  margin: 18px 0 12px;
  color: var(--secondary);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.statement-list {
  list-style: none;
  margin: 0;
  padding: 0 24px;
}
.statement-row {
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}
.statement-row:last-child {
  border-bottom: 0;
}
.statement-main {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: 4px;
}
.statement-line,
.statement-ref {
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.statement-payer {
  font-weight: 600;
  overflow-wrap: anywhere;
}
.statement-purpose,
.statement-note {
  margin: 0;
  font-size: 14px;
  color: var(--secondary);
  overflow-wrap: anywhere;
  white-space: pre-line;
}
.statement-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex: none;
}
.statement-amount {
  font-weight: 600;
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.statement-side .actions {
  justify-content: flex-end;
  flex-wrap: wrap;
}
.statement-row.is-recorded .statement-payer,
.statement-row.is-repeat .statement-payer,
.statement-row.is-excluded .statement-payer,
.statement-row.is-excluded .statement-amount,
.statement-row.is-repeat .statement-amount {
  color: var(--muted);
  font-weight: 500;
}
.statement-hints {
  list-style: none;
  margin: 8px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--orange-soft);
  display: grid;
  gap: 8px;
  font-size: 14px;
}
.statement-hints li {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  overflow-wrap: anywhere;
}
@media (max-width: 600px) {
  .statement-list {
    padding: 0 16px;
  }
  .statement-row,
  .statement-hints li {
    flex-direction: column;
    align-items: stretch;
  }
  .statement-side {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
  }
}

/* M-08: connection and update line. Fixed above the content, below the toast; never covers an open form. */
.system-status {
  position: fixed;
  right: 24px;
  bottom: calc(24px + var(--safe-bottom));
  z-index: 90;
  display: grid;
  gap: 10px;
  width: min(420px, calc(100vw - 32px));
}
.system-status:empty {
  display: none;
}
.system-line {
  display: grid;
  gap: 12px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
  box-shadow: var(--shadow-pop);
}
.system-line p {
  margin: 0;
}
.system-offline {
  background: var(--orange-soft);
  color: var(--orange);
  border-color: transparent;
}
.system-line .btn {
  justify-self: start;
}
@media (max-width: 860px) {
  .system-status {
    right: 16px;
    bottom: calc(82px + var(--safe-bottom));
  }
}
/* M-08: own sessions in «Мой профиль», operating status in «Управление». */
.account-sessions {
  border-top: 1px solid var(--line);
  padding-top: 20px;
  margin-bottom: 24px;
  display: grid;
  gap: 12px;
}
.account-sessions h3 {
  font-size: 16px;
}
.session-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.session-list li {
  display: grid;
  gap: 2px;
  padding: 10px 14px;
  border-radius: var(--radius-control);
  background: var(--surface-2);
}
.session-list li.current {
  background: var(--green-soft);
}
.account-sessions .btn {
  justify-self: start;
}
.ops-panel {
  grid-column: 1 / -1;
}
.ops-warning {
  margin-bottom: 4px;
}
@media (max-width: 560px) {
  .ops-status {
    grid-template-columns: 1fr;
    gap: 2px;
  }
  .ops-status dd {
    margin-bottom: 10px;
  }
}
.ops-status code,
.ops-panel .help-copy code {
  font-size: 13px;
  overflow-wrap: anywhere;
}

/* Campaign goal rule: the hidden distribution block never takes space; read-only shares look computed. */
.form-row[data-split][hidden] {
  display: none;
}
.assessment-row input[readonly] {
  background: transparent;
  border-style: dashed;
}
