:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: #eef3f1;
  color: #17211f;
  font-synthesis: none;
  text-rendering: geometricPrecision;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: #eef3f1;
}

button,
input,
label,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

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

.sidebar {
  background: #102421;
  color: #eaf7f4;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 0 8px;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #17a884;
  color: #fff;
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: #9ac6bb;
  font-size: 12px;
  line-height: 1.35;
}

nav {
  display: grid;
  gap: 6px;
}

nav button {
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #b7d5ce;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  text-align: left;
}

nav button.active,
nav button:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

main {
  padding: 26px;
  min-width: 0;
}

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

.topbar > div {
  min-width: 0;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.1;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.topbar p,
.panel-title p {
  color: #65736f;
  margin-top: 6px;
  overflow-wrap: anywhere;
}

.date-chip {
  background: #ffffff;
  border: 1px solid #d9e3df;
  color: #40504b;
  border-radius: 8px;
  padding: 10px 12px;
  white-space: nowrap;
  font-size: 14px;
}

.action-status {
  background: #e7f6f0;
  border: 1px solid #c9e6db;
  color: #17614d;
  border-radius: 8px;
  padding: 10px 12px;
  margin: -8px 0 16px;
  font-size: 13px;
}

.access-bar {
  background: #ffffff;
  border: 1px solid #d9e3df;
  border-radius: 8px;
  padding: 12px;
  margin: -8px 0 16px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
}

.access-bar strong,
.access-bar span {
  display: block;
}

.access-bar span {
  color: #65736f;
  font-size: 12px;
  margin-top: 3px;
}

.access-bar select {
  max-width: 320px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.summary-card {
  background: #ffffff;
  border: 1px solid #d9e3df;
  border-left: 4px solid #17a884;
  border-radius: 8px;
  padding: 16px;
}

.summary-card span {
  color: #65736f;
  font-size: 13px;
}

.summary-card strong {
  display: block;
  font-size: 30px;
  margin-top: 6px;
}

.summary-card.warn {
  border-left-color: #d98c12;
}

.summary-card.bad {
  border-left-color: #d64545;
}

.summary-card.blue {
  border-left-color: #2876c9;
}

.summary-card.purple {
  border-left-color: #7c55c7;
}

.summary-card.slate {
  border-left-color: #53636c;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
  align-items: start;
}

.panel {
  background: #ffffff;
  border: 1px solid #d9e3df;
  border-radius: 8px;
  padding: 16px;
}

.import-panel {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
}

.import-panel h2 {
  font-size: 18px;
}

.import-panel p {
  color: #65736f;
  margin-top: 6px;
  max-width: 720px;
}

.import-actions {
  display: grid;
  gap: 8px;
  justify-items: end;
  min-width: 260px;
}

.upload-button,
.whatsapp-button,
.queue-item a {
  border: 0;
  border-radius: 8px;
  background: #17a884;
  color: #ffffff;
  padding: 10px 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.upload-button input {
  display: none;
}

.import-status {
  color: #65736f;
  font-size: 12px;
  text-align: right;
  line-height: 1.35;
}

.readonly-note {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 32px;
  border-radius: 8px;
  background: #edf2f0;
  color: #65736f;
  padding: 7px 9px;
  font-size: 12px;
  font-weight: 700;
}

.register {
  min-width: 0;
}

.smart-import-panel {
  margin-bottom: 16px;
}

.smart-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.smart-summary article {
  border: 1px solid #edf2f0;
  border-radius: 8px;
  background: #fbfdfc;
  padding: 12px;
}

.smart-summary span {
  color: #65736f;
  font-size: 12px;
}

.smart-summary strong {
  display: block;
  margin-top: 5px;
  font-size: 21px;
}

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

.smart-group {
  border: 1px solid #edf2f0;
  border-radius: 8px;
  padding: 12px;
  background: #ffffff;
}

.smart-group h3 {
  margin: 0 0 9px;
  font-size: 14px;
}

.smart-group div {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.smart-group span {
  border: 1px solid #dbe6e2;
  border-radius: 8px;
  background: #f6faf8;
  color: #25322f;
  padding: 7px 8px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
  max-width: 100%;
}

.smart-group span.matched {
  border-color: #bfe7dc;
  background: #edf9f5;
  color: #17614d;
}

.smart-group em {
  display: block;
  color: #7a8783;
  font-style: normal;
  font-weight: 500;
  margin-top: 2px;
  overflow-wrap: anywhere;
}

.history-panel {
  margin-bottom: 16px;
}

.history-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.history-summary article {
  border: 1px solid #edf2f0;
  border-radius: 8px;
  background: #fbfdfc;
  padding: 12px;
}

.history-summary article.attention {
  border-color: #ffcaca;
  background: #fff6f6;
}

.history-summary span,
.history-note {
  color: #65736f;
  font-size: 12px;
}

.history-summary strong {
  display: block;
  margin-top: 5px;
  color: #17211f;
  font-size: 21px;
}

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

.history-table {
  min-width: 760px;
}

.history-table th:nth-child(1),
.history-table td:nth-child(1) { width: 21%; }
.history-table th:nth-child(2),
.history-table td:nth-child(2) { width: 18%; }
.history-table th:nth-child(3),
.history-table td:nth-child(3) { width: 31%; }
.history-table th:nth-child(4),
.history-table td:nth-child(4) { width: 10%; }
.history-table th:nth-child(5),
.history-table td:nth-child(5) { width: 10%; }
.history-table th:nth-child(6),
.history-table td:nth-child(6) { width: 10%; }

.year-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.year-chips span {
  display: inline-flex;
  width: fit-content;
  border: 1px solid #dbe6e2;
  border-radius: 8px;
  background: #f6faf8;
  color: #25322f;
  padding: 6px 8px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
}

.year-chips.compact {
  margin-top: 8px;
}

.flat-history {
  background: #fbfdfc;
}

.panel-title {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 14px;
}

.panel-title h2 {
  font-size: 18px;
  letter-spacing: 0;
}

.ghost-button {
  border: 1px solid #cbd8d4;
  color: #25322f;
  background: #ffffff;
  border-radius: 8px;
  padding: 9px 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  white-space: nowrap;
}

.toolbar {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}

.search {
  position: relative;
  min-width: 230px;
  height: 40px;
  flex: 0 1 280px;
}

.search svg {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: #6b7a76;
}

input {
  width: 100%;
  height: 40px;
  border: 1px solid #cbd8d4;
  border-radius: 8px;
  padding: 0 12px;
  color: #17211f;
  background: #fbfdfc;
}

textarea {
  width: 100%;
  min-height: 94px;
  border: 1px solid #cbd8d4;
  border-radius: 8px;
  padding: 10px 12px;
  color: #17211f;
  background: #fbfdfc;
  font: inherit;
  resize: vertical;
}

.search input {
  padding-left: 38px;
}

select {
  height: 40px;
  border: 1px solid #cbd8d4;
  border-radius: 8px;
  padding: 0 10px;
  background: #fbfdfc;
  color: #17211f;
}

.segments,
.switch-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.segments button,
.switch-row button {
  border: 1px solid #cbd8d4;
  background: #fbfdfc;
  color: #43534f;
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 13px;
}

.segments button.selected,
.switch-row button.selected {
  background: #102421;
  border-color: #102421;
  color: #ffffff;
}

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

table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  min-width: 0;
  font-size: 14px;
}

th {
  text-align: left;
  font-size: 12px;
  color: #6a7874;
  font-weight: 700;
  padding: 10px 6px;
  border-bottom: 1px solid #d9e3df;
}

td {
  padding: 14px 8px;
  border-bottom: 1px solid #edf2f0;
  color: #25322f;
  vertical-align: middle;
  overflow: visible;
}

th:nth-child(1), td:nth-child(1) { width: 20%; }
th:nth-child(2), td:nth-child(2) { width: 17%; }
th:nth-child(3), td:nth-child(3) { width: 10%; }
th:nth-child(4), td:nth-child(4) { width: 30%; }
th:nth-child(5), td:nth-child(5) { width: 13%; }
th:nth-child(6), td:nth-child(6) { width: 10%; }

td span {
  display: block;
  color: #7a8783;
  font-size: 12px;
  margin-top: 2px;
}

td em {
  display: block;
  color: #7a8783;
  font-style: normal;
  font-size: 12px;
  margin-top: 2px;
}

tr[data-select] {
  cursor: pointer;
}

tr[data-select]:hover,
.selected-row {
  background: #f4faf8;
}

.pay-cell {
  display: grid;
  gap: 5px;
}

.pay-cell.inactive {
  color: #7a8783;
}

.payment-summary {
  display: grid;
  gap: 6px;
}

.mini-pay {
  border-radius: 8px;
  border: 1px solid #edf2f0;
  padding: 7px 8px;
  background: #fbfdfc;
}

.mini-pay strong,
.mini-pay em {
  display: block;
}

.mini-pay strong {
  color: #25322f;
  font-size: 12px;
}

.mini-pay em {
  color: #65736f;
  font-size: 12px;
  font-style: normal;
  margin-top: 2px;
}

.mini-pay.ok {
  border-color: #cceee3;
  background: #f0fbf7;
}

.mini-pay.warn {
  border-color: #ffe1a3;
  background: #fff8e8;
}

.mini-pay.bad {
  border-color: #ffcaca;
  background: #fff2f2;
}

.mini-pay.inactive {
  color: #7a8783;
  background: #f3f6f5;
}

.pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.pill.ok {
  color: #087255;
  background: #e5f7f0;
}

.pill.warn {
  color: #956000;
  background: #fff3d7;
}

.pill.bad {
  color: #a52020;
  background: #ffe4e4;
}

.pill.blue {
  color: #165ea8;
  background: #e6f0ff;
}

.pill.neutral {
  color: #687772;
  background: #edf2f0;
}

.date-text {
  display: block;
  color: #7a8783;
  font-size: 12px;
  margin-top: 5px;
}

.detail {
  position: sticky;
  top: 20px;
}

.detail-block {
  border: 1px solid #edf2f0;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
}

.detail-facts {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.detail-facts div {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 10px;
  align-items: start;
}

.detail-facts strong {
  color: #6a7874;
  font-size: 12px;
}

.detail-facts em {
  color: #25322f;
  font-style: normal;
  font-size: 13px;
  line-height: 1.35;
}

.detail-block > span,
.contact-card span {
  display: block;
  color: #6a7874;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 9px;
}

.imported-fields {
  display: grid;
  gap: 10px;
}

.imported-field-group {
  border-top: 1px solid #edf2f0;
  padding-top: 10px;
  display: grid;
  gap: 7px;
}

.imported-field-group > strong {
  color: #25322f;
  font-size: 13px;
}

.imported-field-group div {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.imported-field-group em {
  color: #6a7874;
  font-style: normal;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.imported-field-group span {
  color: #25322f;
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.payment-list {
  display: grid;
  gap: 10px;
}

.payment-row {
  border: 1px solid #edf2f0;
  border-radius: 8px;
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 10px;
  align-items: center;
}

.payment-row span,
.payment-row small {
  display: block;
  color: #6a7874;
  font-size: 12px;
  margin-top: 4px;
}

.payment-row button {
  border: 0;
  border-radius: 8px;
  padding: 8px 10px;
  background: #17a884;
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
}

.payment-row button.paid {
  color: #087255;
  background: #e5f7f0;
}

.payment-row small {
  grid-column: 1 / -1;
}

.payment-row small.overdue {
  color: #a52020;
}

.payment-row small.unpaid {
  color: #956000;
}

.warning-box {
  margin-top: 12px;
  border-radius: 8px;
  border: 1px solid #d9e3df;
  background: #f8fbfa;
  padding: 13px;
}

.warning-box.needs-warning {
  border-color: #f0bbbb;
  background: #fff4f4;
}

.warning-box div {
  display: flex;
  gap: 8px;
  align-items: center;
}

.warning-box p {
  margin-top: 8px;
  color: #596864;
  line-height: 1.45;
}

.contact-card {
  margin-top: 12px;
  border-top: 1px solid #edf2f0;
  padding-top: 13px;
  display: grid;
  gap: 6px;
}

.queue {
  margin-top: 16px;
}

.accounting-panel,
.tools-grid {
  margin-top: 16px;
}

.accounting-totals {
  display: grid;
  gap: 4px;
  justify-items: end;
  color: #65736f;
  font-size: 13px;
}

.accounting-totals strong {
  color: #17211f;
}

.accounting-overview {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.accounting-overview div {
  border: 1px solid #edf2f0;
  border-radius: 8px;
  padding: 12px;
  background: #fbfdfc;
}

.accounting-overview div.attention {
  border-color: #ffe1a3;
  background: #fff8e8;
}

.accounting-overview span {
  color: #65736f;
  font-size: 12px;
}

.accounting-overview strong {
  display: block;
  margin-top: 5px;
  font-size: 19px;
}

.accounting-workflow {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.accounting-card {
  border: 1px solid #dbe6e2;
  border-radius: 8px;
  background: #fbfdfc;
  padding: 14px;
}

.workflow-title {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.workflow-title h3 {
  margin: 0;
  font-size: 16px;
}

.workflow-title p {
  color: #65736f;
  margin-top: 4px;
  line-height: 1.35;
}

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

.field-grid label {
  display: grid;
  gap: 5px;
  color: #52615d;
  font-size: 12px;
  font-weight: 700;
}

.field-grid label:first-child,
.field-grid label:last-child:nth-child(7) {
  grid-column: 1 / -1;
}

.field-grid .wide-field {
  grid-column: 1 / -1;
}

.resident-portal,
.maintenance-panel {
  margin-bottom: 16px;
}

.resident-login {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr 1fr auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid #dbe6e2;
  border-radius: 8px;
  background: #fbfdfc;
}

.resident-login label {
  display: grid;
  gap: 5px;
  color: #52615d;
  font-size: 12px;
  font-weight: 700;
}

.resident-login .primary-action {
  margin: 0;
}

.portal-status {
  margin-top: 10px;
  color: #49605a;
  font-size: 13px;
  font-weight: 700;
}

.resident-dashboard {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.resident-overview,
.resident-balance-grid {
  display: grid;
  gap: 10px;
}

.resident-overview {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.resident-balance-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.resident-overview article,
.resident-balance-grid article {
  border: 1px solid #edf2f0;
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
}

.resident-balance-grid article.due {
  border-color: #ffcaca;
  background: #fff7f7;
}

.receipt-upload {
  margin-top: 10px;
  min-height: 34px;
  border: 1px solid #cbd8d4;
  border-radius: 8px;
  background: #ffffff;
  color: #25322f;
  display: inline-flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 9px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.receipt-upload input {
  display: none;
}

.receipt-note {
  display: block;
  margin-top: 8px;
  color: #65736f;
  font-size: 11px;
  line-height: 1.35;
}

.utility-link {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.utility-link span {
  border: 1px solid #c9e6db;
  border-radius: 8px;
  background: #f0fbf7;
  color: #17614d;
  padding: 5px 7px;
  font-size: 11px;
  font-weight: 800;
}

.bill-analysis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  margin-top: 10px;
}

.bill-analysis span {
  border: 1px solid #edf2f0;
  border-radius: 8px;
  background: #ffffff;
  padding: 8px;
}

.bill-analysis span.danger {
  border-color: #ffcaca;
  background: #fff4f4;
}

.bill-analysis em,
.bill-analysis strong,
.bill-analysis small {
  display: block;
}

.bill-analysis em {
  color: #65736f;
  font-style: normal;
  font-size: 11px;
  font-weight: 700;
}

.bill-analysis strong {
  color: #17211f;
  margin-top: 3px;
  font-size: 13px;
}

.bill-analysis small {
  grid-column: 1 / -1;
  color: #65736f;
  font-size: 11px;
  line-height: 1.35;
}

.bill-analysis.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.resident-receipts,
.receipt-review {
  border: 1px solid #dbe6e2;
  border-radius: 8px;
  background: #fbfdfc;
  padding: 14px;
}

.resident-receipts h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.resident-overview span,
.resident-balance-grid span {
  color: #65736f;
  font-size: 12px;
}

.resident-overview strong,
.resident-balance-grid strong {
  display: block;
  margin-top: 5px;
  color: #17211f;
  font-size: 18px;
}

.resident-overview em,
.resident-balance-grid em {
  display: block;
  margin-top: 7px;
  color: #65736f;
  font-style: normal;
  font-size: 12px;
}

.resident-request-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
  gap: 12px;
}

.resident-request-form,
.resident-request-list {
  border: 1px solid #dbe6e2;
  border-radius: 8px;
  background: #fbfdfc;
  padding: 14px;
}

.resident-request-list h3,
.maintenance-panel h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.maintenance-list {
  display: grid;
  gap: 9px;
}

.maintenance-row {
  border: 1px solid #edf2f0;
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.maintenance-row.compact {
  grid-template-columns: minmax(0, 1fr) auto;
  margin-bottom: 8px;
}

.maintenance-row span,
.maintenance-row p {
  color: #65736f;
  font-size: 12px;
  line-height: 1.4;
}

.maintenance-row span {
  display: block;
  margin-top: 4px;
}

.maintenance-row p {
  margin-top: 7px;
}

.maintenance-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  max-width: 260px;
}

.maintenance-actions button {
  border: 1px solid #cbd8d4;
  background: #ffffff;
  color: #43534f;
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 11px;
  font-weight: 700;
}

.section-heading-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-bottom: 10px;
}

.section-heading-row h3 {
  margin: 0;
  font-size: 15px;
}

.section-heading-row p {
  margin-top: 4px;
  color: #65736f;
  font-size: 12px;
  line-height: 1.35;
}

.receipt-review {
  margin-bottom: 14px;
}

.receipt-list {
  display: grid;
  gap: 8px;
}

.receipt-row {
  border: 1px solid #edf2f0;
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.receipt-row.compact {
  grid-template-columns: minmax(0, 1fr) auto;
  margin-bottom: 8px;
}

.receipt-row span,
.receipt-row p {
  display: block;
  color: #65736f;
  font-size: 12px;
  line-height: 1.4;
}

.receipt-row span {
  margin-top: 4px;
}

.receipt-row p {
  margin-top: 6px;
}

.receipt-preview {
  width: 56px;
  height: 56px;
  border: 1px solid #dbe6e2;
  border-radius: 8px;
  background: #f6faf8;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: #65736f;
}

.receipt-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.receipt-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  max-width: 210px;
}

.receipt-actions button,
.receipt-actions a {
  border: 1px solid #cbd8d4;
  background: #ffffff;
  color: #43534f;
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
}

.reviewed-note {
  color: #65736f;
  font-size: 11px;
  font-weight: 700;
}

.primary-action {
  width: 100%;
  margin-top: 12px;
}

.primary-action,
.ai-input button,
.section-actions button {
  border: 0;
  border-radius: 8px;
  padding: 10px 12px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #102421;
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.section-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

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

.expense-table {
  display: grid;
  gap: 8px;
}

.ledger-box,
.invoice-box,
.category-box {
  border: 1px solid #edf2f0;
  border-radius: 8px;
  padding: 12px;
}

.expense-row,
.invoice-row {
  border: 1px solid #edf2f0;
  border-radius: 8px;
  padding: 11px 12px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
}

.expense-row span,
.invoice-row span {
  display: block;
  color: #65736f;
  font-size: 12px;
  margin-top: 4px;
}

.expense-row > div:last-child,
.invoice-row > div:last-child {
  display: grid;
  justify-items: end;
  gap: 5px;
}

.invoice-box h3,
.ledger-box h3,
.category-box h3 {
  margin: 0 0 10px;
  font-size: 14px;
}

.invoice-box {
  display: grid;
  gap: 8px;
}

.authority-strip {
  border: 1px solid #c9e6db;
  background: #f3fbf8;
  color: #17614d;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
  display: grid;
  gap: 4px;
}

.authority-strip span {
  color: #497267;
  font-size: 13px;
}

.form-label {
  color: #25322f;
  font-size: 13px;
  font-weight: 800;
  margin: 12px 0 7px;
}

.row-actions {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.row-actions button {
  border: 1px solid #cbd8d4;
  background: #ffffff;
  color: #43534f;
  border-radius: 8px;
  padding: 5px 7px;
  font-size: 11px;
}

.category-box {
  grid-column: 1 / -1;
}

.category-box div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-top: 1px solid #edf2f0;
}

.category-box span {
  color: #65736f;
}

.tools-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 16px;
}

.upload-button.secondary {
  background: #102421;
}

.tool-status {
  margin-top: 10px;
  color: #65736f;
}

.ocr-text {
  min-height: 132px;
  max-height: 220px;
  overflow: auto;
  margin: 12px 0 0;
  border: 1px solid #edf2f0;
  border-radius: 8px;
  background: #fbfdfc;
  color: #25322f;
  padding: 12px;
  white-space: pre-wrap;
  font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.ai-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.ai-input input {
  padding-left: 12px;
}

.ai-answer {
  margin-top: 12px;
  border: 1px solid #d6e8e2;
  background: #f3fbf8;
  color: #25322f;
  border-radius: 8px;
  padding: 13px;
  line-height: 1.45;
}

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

.ai-chips button {
  border: 1px solid #cbd8d4;
  background: #ffffff;
  color: #43534f;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
}

.reports-panel {
  margin-top: 16px;
}

.access-panel {
  margin-top: 16px;
}

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

.user-card {
  border: 1px solid #edf2f0;
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 8px;
  background: #fbfdfc;
}

.user-card.current {
  border-color: #17a884;
  background: #f0fbf7;
}

.user-card span {
  color: #65736f;
  font-size: 12px;
  line-height: 1.35;
}

.user-card button,
.notice-form button {
  border: 0;
  border-radius: 8px;
  background: #102421;
  color: #ffffff;
  padding: 9px 10px;
  font-size: 13px;
  font-weight: 700;
}

.permission-box,
.notice-workflow,
.notice-list {
  border: 1px solid #edf2f0;
  border-radius: 8px;
  padding: 12px;
  margin-top: 12px;
  background: #ffffff;
}

.permission-box h3,
.notice-workflow h3,
.notice-list h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.permission-box div {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.permission-box span {
  background: #edf7f3;
  color: #17614d;
  border-radius: 999px;
  padding: 6px 9px;
  font-size: 12px;
  font-weight: 700;
}

.notice-workflow.locked {
  opacity: 0.68;
}

.notice-form {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 10px;
}

.notice-row {
  border-top: 1px solid #edf2f0;
  padding: 10px 0;
}

.notice-row span {
  display: block;
  color: #65736f;
  font-size: 12px;
  margin-top: 3px;
}

.notice-row p {
  margin-top: 6px;
  color: #25322f;
}

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

.report-grid article {
  border: 1px solid #edf2f0;
  border-radius: 8px;
  padding: 12px;
  background: #fbfdfc;
}

.report-grid span {
  color: #65736f;
  font-size: 12px;
}

.report-grid strong {
  display: block;
  margin-top: 6px;
  font-size: 19px;
}

.report-list {
  border-top: 1px solid #edf2f0;
  margin-top: 14px;
  padding-top: 12px;
}

.report-list h3 {
  font-size: 15px;
  margin: 0 0 6px;
}

.report-list p {
  color: #596864;
  line-height: 1.45;
}

.queue-list {
  display: grid;
  gap: 8px;
}

.queue-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.queue-list button {
  width: 100%;
  border: 1px solid #edf2f0;
  background: #fbfdfc;
  border-radius: 8px;
  padding: 11px 12px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  text-align: left;
  color: #25322f;
}

.queue-list strong {
  color: #a52020;
  font-size: 13px;
}

.queue-item a {
  min-height: 42px;
}

.missing-phone {
  color: #7a8783;
  font-size: 12px;
  padding-right: 4px;
}

.empty {
  color: #6a7874;
}

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 12px 14px;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    max-width: 100vw;
    min-width: 0;
    overflow-x: auto;
  }

  nav {
    display: flex;
    overflow-x: auto;
  }

  nav button {
    white-space: nowrap;
  }

  .content-grid {
    grid-template-columns: 1fr;
  }

  .detail {
    position: static;
  }
}

@media (max-width: 760px) {
  main {
    padding: 16px;
    width: 100%;
    min-width: 0;
  }

  .topbar,
  .toolbar,
  .panel-title,
  .access-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .import-panel {
    flex-direction: column;
    align-items: stretch;
  }

  .import-actions {
    justify-items: start;
    min-width: 0;
  }

  .search {
    min-width: 0;
    flex-basis: auto;
  }

  .accounting-overview,
  .accounting-workflow,
  .field-grid,
  .accounting-grid,
  .user-grid,
  .notice-form,
  .tools-grid,
  .resident-login,
  .resident-overview,
  .resident-balance-grid,
  .resident-request-layout,
  .receipt-row,
  .ai-input,
  .report-grid,
  .smart-summary,
  .smart-groups,
  .history-summary {
    grid-template-columns: 1fr;
  }

  .accounting-totals {
    justify-items: start;
  }

  h1 {
    font-size: 25px;
  }
}

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

  .brand span,
  nav button span {
    display: none;
  }

  .sidebar {
    gap: 10px;
  }

  .queue-list button {
    flex-direction: column;
  }

  .queue-item {
    grid-template-columns: 1fr;
  }

  .maintenance-row {
    grid-template-columns: 1fr;
  }

  .maintenance-actions {
    justify-content: flex-start;
    max-width: none;
  }

  .receipt-row {
    grid-template-columns: 1fr;
  }

  .receipt-preview {
    width: 100%;
    height: 120px;
  }

  .receipt-actions,
  .section-heading-row {
    justify-content: flex-start;
    align-items: stretch;
    max-width: none;
  }

  .section-heading-row {
    flex-direction: column;
  }
}
