:root {
  --bg: #f6eee5;
  --bg-soft: #fff9f3;
  --surface: #fffdfa;
  --surface-muted: #f4ebe2;
  --surface-strong: #fff6ec;
  --border: #ead6c4;
  --border-strong: #ddb79b;
  --text: #241c16;
  --text-soft: #6e6257;
  --text-inverse: #fef9f3;
  --accent: #c96d37;
  --accent-dark: #9f481f;
  --accent-soft: rgba(201, 109, 55, 0.12);
  --accent-strong: #f6b56a;
  --sidebar-bg: linear-gradient(180deg, #19242b 0%, #253742 100%);
  --sidebar-border: rgba(255, 255, 255, 0.08);
  --highlight: #2f7f72;
  --highlight-soft: rgba(47, 127, 114, 0.12);
  --danger: #c44c4c;
  --shadow: 0 24px 54px rgba(41, 24, 12, 0.12);
  --shadow-soft: 0 14px 28px rgba(41, 24, 12, 0.08);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --sidebar-width: 286px;
  --sidebar-collapsed: 100px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  margin: 0;
  overflow-x: hidden;
  font-family: "Manrope", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(201, 109, 55, 0.16), transparent 24%),
    radial-gradient(circle at bottom right, rgba(47, 127, 114, 0.14), transparent 26%),
    linear-gradient(180deg, #fff8f0 0%, var(--bg) 100%);
}

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

button,
select,
input,
textarea {
  outline: none;
}

body::-webkit-scrollbar,
.content-scroller::-webkit-scrollbar,
.table-wrap::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

body::-webkit-scrollbar-thumb,
.content-scroller::-webkit-scrollbar-thumb,
.table-wrap::-webkit-scrollbar-thumb {
  background: rgba(159, 72, 31, 0.28);
  border-radius: 999px;
}

.dashboard-app {
  min-height: 100vh;
  max-width: 100%;
  overflow-x: clip;
}

.sidebar {
  position: fixed;
  inset: 18px auto 18px 18px;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px;
  border-radius: 30px;
  background: var(--sidebar-bg);
  border: 1px solid var(--sidebar-border);
  box-shadow: 0 28px 58px rgba(12, 19, 24, 0.34);
  color: var(--text-inverse);
  z-index: 30;
  transition: width 0.28s ease, padding 0.28s ease;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(246, 181, 106, 0.24), rgba(246, 181, 106, 0.42));
  border: 1px solid rgba(246, 181, 106, 0.32);
  color: var(--accent-strong);
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  flex-shrink: 0;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  transition: opacity 0.2s ease;
}

.brand-copy strong {
  font-size: 1rem;
}

.brand-copy span,
.sidebar-metric span {
  color: rgba(254, 249, 243, 0.68);
}

.sidebar-toggle {
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  gap: 4px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

.sidebar-toggle span {
  display: block;
  width: 16px;
  height: 2px;
  border-radius: 999px;
  background: #ffffff;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid transparent;
  border-radius: 18px;
  background: transparent;
  color: rgba(254, 249, 243, 0.72);
  cursor: pointer;
  transition:
    background-color 0.22s ease,
    color 0.22s ease,
    border-color 0.22s ease,
    transform 0.22s ease,
    box-shadow 0.22s ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  transform: translateX(3px);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(246, 181, 106, 0.2), rgba(201, 109, 55, 0.32));
  color: #ffffff;
  border-color: rgba(246, 181, 106, 0.28);
  box-shadow: 0 14px 24px rgba(0, 0, 0, 0.16);
}

.nav-icon {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.07);
  font-size: 0.96rem;
  flex-shrink: 0;
}

.nav-item.active .nav-icon {
  background: rgba(255, 255, 255, 0.14);
}

.nav-label {
  font-weight: 700;
  white-space: nowrap;
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 10px;
}

.sidebar-metric {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-metric strong {
  display: block;
  margin-top: 4px;
  color: #ffffff;
}

.sidebar.collapsed .brand-copy,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .sidebar-footer {
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
  overflow: hidden;
}


.main-panel {
  margin-left: calc(var(--sidebar-width) + 36px);
  min-height: 100vh;
  max-width: calc(100vw - var(--sidebar-width) - 36px);
  padding: 24px 24px 140px 0;
  overflow-x: clip;
  transition: margin-left 0.28s ease;
}

.dashboard-app.sidebar-collapsed .main-panel {
  margin-left: calc(var(--sidebar-collapsed) + 36px);
  max-width: calc(100vw - var(--sidebar-collapsed) - 36px);
}

.topbar {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
  padding-right: 8px;
}

.topbar-copy {
  flex: 1;
}

.backend-status-pill {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 12px 16px;
  border-radius: 999px;
  font-weight: 700;
  border: 1px solid rgba(234, 214, 196, 0.92);
  background: rgba(255, 255, 255, 0.82);
  color: var(--text-soft);
}

.backend-status-pill::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: currentColor;
}

.backend-status-pill.connected {
  color: var(--highlight);
}

.backend-status-pill.loading {
  color: #9b610f;
}

.backend-status-pill.disconnected {
  color: var(--danger);
}

.eyebrow,
.card-kicker {
  margin: 0 0 10px;
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.topbar h1,
.card h2,
.summary-card h2 {
  margin: 0;
}

.topbar h1 {
  font-size: clamp(2rem, 3vw, 3rem);
  line-height: 1.05;
}

.page-copy {
  max-width: 760px;
  margin: 14px 0 0;
  color: var(--text-soft);
  font-size: 1rem;
  line-height: 1.65;
}

.content-scroller {
  overflow-y: auto;
  overflow-x: clip;
  max-width: 100%;
  padding-right: 8px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.dashboard-grid {
  display: grid;
  gap: 22px;
}

.stats-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 24px;
}

.card {
  background: linear-gradient(180deg, rgba(255, 253, 250, 0.98), rgba(250, 243, 236, 0.96));
  border: 1px solid rgba(234, 214, 196, 0.92);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  padding: 24px;
}

.stat-card {
  min-height: 180px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: "";
  position: absolute;
  inset: auto -24px -36px auto;
  width: 118px;
  height: 118px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(201, 109, 55, 0.18), transparent 68%);
}

.stat-value {
  display: block;
  margin-top: 20px;
  font-size: clamp(1.7rem, 2.4vw, 2.35rem);
  color: var(--accent-dark);
}

.stat-meta {
  color: var(--text-soft);
  font-size: 0.92rem;
}

.dashboard-table-card {
  padding-bottom: 18px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.status-chip.success {
  background: rgba(47, 127, 114, 0.14);
  color: var(--highlight);
}

.status-chip.pending {
  background: rgba(246, 181, 106, 0.22);
  color: #9b610f;
}

.status-chip.review {
  background: rgba(83, 102, 184, 0.12);
  color: #495db2;
}

.module-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(340px, 0.9fr);
  gap: 24px;
  align-items: start;
}

.form-column,
.summary-column {
  min-width: 0;
}

.form-column .card + .card {
  margin-top: 20px;
}

.card-head,
.summary-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.card-head-inline {
  align-items: center;
}

.card h2,
.summary-card h2 {
  font-size: 1.35rem;
  line-height: 1.2;
}

.form-grid {
  display: grid;
  gap: 18px;
}

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

.single-col {
  grid-template-columns: minmax(0, 1fr);
}

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

.span-2 {
  grid-column: span 2;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.field span {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

.field em {
  color: var(--danger);
  font-style: normal;
}

.field input,
.field select,
.field textarea,
.entries-table input,
.entries-table select {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease,
    background-color 0.2s ease;
}


.field select.native-search-select,
.entries-table select.native-search-select {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
  padding: 0;
  margin: 0;
}

.search-select {
  position: relative;
  width: 100%;
}

.search-select-trigger,
.search-select-input {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}

.entries-table .search-select-trigger,
.entries-table .search-select-input {
  min-width: 0;
  width: 100%;
  padding: 13px 14px;
  border-radius: 14px;
}

.search-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  cursor: pointer;
}

.search-select-trigger.placeholder .search-select-trigger-label {
  color: var(--text-soft);
}

.search-select-trigger-icon {
  color: var(--text-soft);
  flex: 0 0 auto;
}

.search-select-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 25;
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 18px;
  background: rgba(255, 253, 250, 0.99);
  border: 1px solid rgba(234, 214, 196, 0.94);
  box-shadow: var(--shadow);
}

.search-select-input {
  padding-right: 16px;
}

.search-select-options {
  display: grid;
  gap: 6px;
  max-height: 220px;
  overflow: auto;
}

.search-select-option {
  width: 100%;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  border-radius: 12px;
  padding: 11px 12px;
  text-align: left;
  cursor: pointer;
}

.search-select-option.placeholder {
  color: var(--text-soft);
}

.search-select-option.active,
.search-select-option:hover {
  border-color: rgba(47, 127, 114, 0.28);
  background: rgba(47, 127, 114, 0.12);
}

.search-select-empty {
  padding: 10px 12px;
  color: var(--text-soft);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
}

.entry-type-stack {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.entries-table .entry-type-other {
  width: 100%;
}

.entries-table .icon-btn.delete-row-btn {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  margin-top: auto;
}

@media (max-width: 900px) {
  .entries-table tbody tr {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #godownEntriesBody tr td,
  #sellingEntriesBody tr td,
  #homeEntriesBody tr td {
    grid-column: auto !important;
    grid-row: auto !important;
  }
}

@media (max-width: 620px) {
  .entries-table tbody tr {
    grid-template-columns: minmax(0, 1fr);
  }
}

.field textarea {
  resize: vertical;
  min-height: 112px;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.entries-table input:focus,
.entries-table select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(201, 109, 55, 0.12);
  background: #ffffff;
}

.field input[readonly],
.entries-table input[readonly] {
  background: var(--surface-muted);
  color: var(--text-soft);
  font-weight: 700;
}

.table-wrap {
  overflow-x: visible;
  border-radius: var(--radius-lg);
  border: none;
  background: transparent;
}

.entries-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 14px;
  min-width: 0;
}

.entries-table thead {
  display: none;
}

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

.entries-table.dashboard-table {
  min-width: 680px;
}

.entries-table.dashboard-table tbody tr {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
}

.entries-table.dashboard-table td {
  flex-direction: row;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.entries-table.dashboard-table td:nth-child(1) {
  flex: 0 0 96px;
  color: var(--text-soft);
}

.entries-table.dashboard-table td:nth-child(2) {
  flex: 0 0 84px;
  font-weight: 700;
  color: var(--accent-dark);
}

.entries-table.dashboard-table td:nth-child(3) {
  flex: 0 0 120px;
}

.entries-table.dashboard-table td:nth-child(4) {
  flex: 1 1 140px;
  font-weight: 700;
}

.entries-table.dashboard-table td:nth-child(5) {
  flex: 0 0 70px;
  text-align: center;
}

.entries-table.dashboard-table td:nth-child(6) {
  flex: 0 0 110px;
  font-weight: 800;
  text-align: right;
}

.entries-table.dashboard-table td:nth-child(7) {
  flex: 0 0 110px;
  display: flex;
  justify-content: flex-end;
}

.entries-table.dashboard-table td[colspan] {
  flex: 1 1 auto;
  white-space: normal;
  color: var(--text-soft);
}

.entries-table tbody {
  display: grid;
  gap: 14px;
}

.entries-table tbody tr {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px 16px;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid rgba(234, 214, 196, 0.94);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(250, 243, 236, 0.98));
  box-shadow: var(--shadow-soft);
}

.entries-table td {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0;
  border-bottom: none;
  background: transparent;
}

.entries-table td::before {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 800;
  color: var(--text-soft);
}

#godownEntriesBody td:nth-child(1)::before,
#sellingEntriesBody td:nth-child(1)::before,
#homeEntriesBody td:nth-child(1)::before {
  content: "Paddy Type";
}

#godownEntriesBody td:nth-child(2)::before,
#sellingEntriesBody td:nth-child(2)::before,
#homeEntriesBody td:nth-child(2)::before {
  content: "No. of Bags";
}

#godownEntriesBody td:nth-child(3)::before,
#sellingEntriesBody td:nth-child(3)::before {
  content: "Rate / 100 Kg";
}

#homeEntriesBody td:nth-child(3)::before {
  content: "Weight / Bag";
}

#godownEntriesBody td:nth-child(4)::before,
#sellingEntriesBody td:nth-child(4)::before,
#homeEntriesBody td:nth-child(4)::before {
  content: "Paddy Weight";
}

#godownEntriesBody td:nth-child(5)::before,
#sellingEntriesBody td:nth-child(5)::before,
#homeEntriesBody td:nth-child(5)::before {
  content: "Moisture / 100 Kg";
}

#godownEntriesBody td:nth-child(6)::before,
#sellingEntriesBody td:nth-child(6)::before,
#homeEntriesBody td:nth-child(6)::before {
  content: "Moisture Deduction";
}

#godownEntriesBody td:nth-child(7)::before,
#sellingEntriesBody td:nth-child(7)::before,
#homeEntriesBody td:nth-child(7)::before {
  content: "Net Weight";
}

#godownEntriesBody td:nth-child(8)::before,
#sellingEntriesBody td:nth-child(8)::before {
  content: "Amount";
}

#homeEntriesBody td:nth-child(8)::before {
  content: "Rate / 100 Kg";
}

#homeEntriesBody td:nth-child(9)::before {
  content: "Amount";
}

#godownEntriesBody td:nth-child(9)::before,
#sellingEntriesBody td:nth-child(9)::before,
#homeEntriesBody td:nth-child(10)::before {
  content: "Action";
}

#godownEntriesBody tr td:nth-child(3n + 1),
#sellingEntriesBody tr td:nth-child(3n + 1),
#homeEntriesBody tr td:nth-child(3n + 1) {
  grid-column: 1;
}

#godownEntriesBody tr td:nth-child(3n + 2),
#sellingEntriesBody tr td:nth-child(3n + 2),
#homeEntriesBody tr td:nth-child(3n + 2) {
  grid-column: 2;
}

#godownEntriesBody tr td:nth-child(3n),
#sellingEntriesBody tr td:nth-child(3n),
#homeEntriesBody tr td:nth-child(3n) {
  grid-column: 3;
}

.entries-table input,
.entries-table select {
  min-width: 0;
  width: 100%;
  padding: 13px 14px;
  border-radius: 14px;
}

.secondary-btn,
.primary-btn,
.ghost-btn,
.icon-btn {
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition:
    transform 0.22s ease,
    box-shadow 0.22s ease,
    background-color 0.22s ease,
    color 0.22s ease;
}

.secondary-btn,
.ghost-btn {
  padding: 12px 18px;
  font-weight: 700;
}

.secondary-btn {
  background: rgba(47, 127, 114, 0.12);
  color: var(--highlight);
}

.secondary-btn:hover,
.primary-btn:hover,
.ghost-btn:hover,
.icon-btn:hover {
  transform: translateY(-2px);
}

.secondary-btn:hover {
  background: rgba(47, 127, 114, 0.18);
}

.icon-btn {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  background: #fff0ef;
  color: var(--danger);
  border: 1px solid #f3d1d1;
  font-size: 1.1rem;
}

.icon-btn:hover {
  background: #ffe4e2;
  box-shadow: 0 10px 18px rgba(196, 76, 76, 0.18);
}

.summary-card {
  position: sticky;
  top: 0;
  overflow: hidden;
}

.summary-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  background: linear-gradient(90deg, var(--highlight), var(--accent));
}

.summary-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 18px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(201, 109, 55, 0.08), rgba(47, 127, 114, 0.08));
  margin-bottom: 18px;
}

.summary-meta div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.summary-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.summary-row,
.summary-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.summary-row {
  padding: 12px 0;
  border-bottom: 1px dashed rgba(221, 183, 155, 0.95);
}

.summary-row span {
  color: var(--text-soft);
}

.summary-row strong,
.summary-total strong {
  color: var(--accent-dark);
}

.summary-total {
  margin-top: 20px;
  padding: 20px 22px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(201, 109, 55, 0.12), rgba(255, 255, 255, 0.92));
  border: 1px solid rgba(221, 183, 155, 0.95);
}

.summary-total span {
  font-size: 1rem;
  font-weight: 800;
}

.summary-total strong {
  font-size: clamp(1.5rem, 2.2vw, 2.1rem);
  font-weight: 800;
}

.summary-total strong.negative {
  color: var(--danger);
}

.sticky-actions {
  position: fixed;
  left: calc(var(--sidebar-width) + ((100vw - var(--sidebar-width)) / 2));
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 25;
  display: none;
  align-items: center;
  gap: 14px;
  width: min(calc(100vw - var(--sidebar-width) - 64px), 680px);
  padding: 14px;
  border-radius: 24px;
  background: rgba(25, 36, 43, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 20px 40px rgba(12, 19, 24, 0.24);
  backdrop-filter: blur(14px);
}

.dashboard-app.sidebar-collapsed .sticky-actions {
  left: calc(var(--sidebar-collapsed) + ((100vw - var(--sidebar-collapsed)) / 2));
  width: min(calc(100vw - var(--sidebar-collapsed) - 64px), 680px);
}

.view.active .sticky-actions {
  display: flex;
}

.primary-btn,
.ghost-btn {
  flex: 1;
}

.primary-btn {
  padding: 15px 18px;
  background: linear-gradient(135deg, #dd8751, var(--accent-dark));
  color: #ffffff;
  font-weight: 800;
  box-shadow: 0 14px 28px rgba(201, 109, 55, 0.24);
}

.primary-btn.alt {
  background: linear-gradient(135deg, #45998c, var(--highlight));
}

.primary-btn:hover {
  box-shadow: 0 18px 30px rgba(201, 109, 55, 0.28);
}

.ghost-btn {
  padding: 15px 18px;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-weight: 800;
}

.ghost-btn:hover {
  background: rgba(255, 255, 255, 0.18);
}

.primary-btn:disabled,
.primary-btn.alt:disabled,
.ghost-btn:disabled,
.secondary-btn:disabled {
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  opacity: 0.52;
}

.primary-btn:disabled:hover,
.primary-btn.alt:disabled:hover,
.ghost-btn:disabled:hover,
.secondary-btn:disabled:hover {
  transform: none;
  box-shadow: none;
}

.app-toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 80;
  min-width: 220px;
  max-width: min(420px, calc(100vw - 32px));
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(25, 36, 43, 0.94);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 20px 40px rgba(12, 19, 24, 0.28);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.app-toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.app-toast.success {
  background: linear-gradient(135deg, rgba(47, 127, 114, 0.96), rgba(32, 94, 84, 0.96));
}

.app-toast.error {
  background: linear-gradient(135deg, rgba(196, 76, 76, 0.96), rgba(154, 46, 46, 0.96));
}

.placeholder-view {
  max-width: 840px;
}

.placeholder-card {
  min-height: 280px;
}

.print-only {
  display: none;
}

@media (max-width: 1320px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1120px) {
  .sidebar {
    position: static;
    width: auto;
    margin: 18px 18px 0;
    inset: auto;
  }

  .sidebar.collapsed {
    width: auto;
  }

  .sidebar.collapsed .brand-copy,
  .sidebar.collapsed .nav-label,
  .sidebar.collapsed .sidebar-footer {
    opacity: 1;
    pointer-events: auto;
    width: auto;
    height: auto;
  }

  .main-panel,
  .dashboard-app.sidebar-collapsed .main-panel {
    margin-left: 0;
    max-width: 100%;
    padding: 20px 18px 140px;
  }

  .topbar {
    padding-right: 0;
    flex-direction: column;
  }


  .module-layout {
    grid-template-columns: 1fr;
  }

  .summary-card {
    position: static;
  }

  .sticky-actions,
  .dashboard-app.sidebar-collapsed .sticky-actions {
    left: 50%;
    width: min(calc(100% - 36px), 680px);
  }
}

@media (max-width: 760px) {
  .sidebar {
    margin: 10px 10px 0;
    padding: 10px 12px;
    border-radius: 22px;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .sidebar-top {
    flex: 0 0 auto;
  }

  .brand-copy,
  .sidebar-toggle {
    display: none;
  }

  .brand-mark {
    width: 40px;
    height: 40px;
    font-size: 0.78rem;
  }

  .sidebar-nav {
    flex-direction: row;
    flex: 0 0 auto;
    gap: 6px;
  }

  .nav-item {
    flex-direction: column;
    flex-shrink: 0;
    width: auto;
    gap: 4px;
    padding: 8px 10px;
  }

  .nav-item:hover {
    transform: none;
  }

  .nav-icon {
    width: 24px;
    height: 24px;
    font-size: 0.82rem;
  }

  .nav-label {
    font-size: 0.6rem;
  }

  .sidebar-bottom {
    flex: 0 0 auto;
    margin-top: 0;
  }

  .logout-btn {
    width: auto;
    flex-direction: column;
    gap: 4px;
    padding: 8px 10px;
    font-size: 0.6rem;
  }

  .main-panel,
  .dashboard-app.sidebar-collapsed .main-panel {
    padding: 16px 10px 132px;
  }

  .card,
  .summary-card {
    padding: 18px;
    border-radius: 20px;
  }

  .stats-grid,
  .two-col,
  .weight-grid,
  .summary-meta {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: auto;
  }

  .sticky-actions,
  .dashboard-app.sidebar-collapsed .sticky-actions {
    width: calc(100% - 16px);
    left: 8px;
    right: 8px;
    transform: none;
    bottom: 10px;
    padding: 10px;
    gap: 10px;
    flex-wrap: wrap;
  }

  .primary-btn,
  .ghost-btn {
    min-width: calc(50% - 5px);
  }
}

@media print {
  @page {
    size: A4;
    margin: 10mm;
  }

  html,
  body {
    background: #ffffff !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  body * {
    visibility: hidden !important;
  }

  .view.print-active,
  .view.print-active * {
    visibility: visible !important;
  }

  .dashboard-app,
  .main-panel,
  .content-scroller,
  .view.print-active {
    margin: 0 !important;
    padding: 0 !important;
    min-height: auto !important;
    overflow: visible !important;
    width: 100% !important;
  }

  .sidebar,
  .topbar,
  .form-column,
  .sticky-actions,
  .reports-modal-backdrop,
  .payments-modal-backdrop,
  .summary-pill,
  .summary-list,
  .summary-total,
  .summary-meta,
  .summary-head,
  .placeholder-view,
  .dashboard-grid,
  .dashboard-table-card,
  .reports-layout > :not(#reportsPrintArea),
  .reports-subsection,
  .reports-grid-head,
  .reports-grid,
  .reports-toolbar-card,
  .payments-layout,
  .settings-layout {
    display: none !important;
  }

  .view {
    display: none !important;
  }

  .view.print-active {
    display: block !important;
  }

  .view.print-active[data-view-panel="reports"] {
    position: static !important;
    inset: auto !important;
    background: #ffffff !important;
  }

  .view.print-active[data-view-panel="reports"] .print-only.reports-print-sheet {
    display: block !important;
    visibility: visible !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .view.print-active[data-view-panel="reports"] .reports-print-block {
    display: block !important;
    background: #ffffff;
    color: #1f2b24;
    border: 1px solid #d6e1d4;
    border-radius: 14px;
    padding: 16px 18px 18px;
    box-shadow: none;
    page-break-inside: avoid;
  }

  .view.print-active[data-view-panel="reports"] .reports-print-block.hidden {
    display: none !important;
  }

  .statement-header {
    text-align: center;
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 4px double #1f2b24;
  }

  .statement-header h1 {
    margin: 0;
    font-size: 26px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #1f2b24;
  }

  .statement-header p {
    margin: 6px 0 0;
    font-style: italic;
    color: #4b5d50;
    font-size: 13px;
  }

  .statement-meta-row,
  .statement-totals-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border-top: 1px solid #c9d6cd;
    border-bottom: 1px solid #c9d6cd;
    margin-bottom: 16px;
  }

  .statement-meta-row > div,
  .statement-totals-row > div {
    padding: 10px 16px;
    text-align: center;
    border-right: 1px solid #c9d6cd;
  }

  .statement-meta-row > div:last-child,
  .statement-totals-row > div:last-child {
    border-right: none;
  }

  .statement-meta-row span,
  .statement-totals-row span {
    display: block;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #5d6b62;
  }

  .statement-meta-row strong {
    display: block;
    margin-top: 6px;
    font-size: 14px;
    color: #1f2b24;
  }

  .statement-totals-row strong {
    display: block;
    margin-top: 6px;
    font-size: 19px;
    color: #1f2b24;
  }

  .statement-totals-row strong.amount-positive {
    color: #2f7f72;
  }

  .statement-totals-row strong.amount-negative {
    color: #c44c4c;
  }

  .statement-section-divider {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 24px 0 14px;
  }

  .statement-section-divider::before,
  .statement-section-divider::after {
    content: "";
    flex: 1;
    border-top: 1px solid #1f2b24;
  }

  .statement-section-divider span {
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #1f2b24;
    font-size: 12.5px;
    white-space: nowrap;
  }

  .reports-statement-table th,
  .reports-statement-table td {
    font-size: 10.5px;
    padding: 7px 9px;
    vertical-align: top;
  }

  .reports-statement-table th:last-child,
  .reports-statement-table td:last-child {
    text-align: right;
    font-variant-numeric: tabular-nums;
  }

  .statement-total-row td {
    border-top: 3px double #1f2b24;
    border-bottom: none;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    background: #f3efe6;
  }

  .module-layout {
    display: block;
  }

  .summary-column {
    width: 100%;
  }

  .summary-card {
    position: static;
    top: auto;
    box-shadow: none;
    border: none;
    padding: 0;
    background: #ffffff;
  }

  .summary-card::before {
    display: none;
  }

  .print-only {
    display: block;
  }

  .print-title {
    text-align: center;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 2px solid #234238;
  }

  .print-title h3 {
    margin: 0;
    font-size: 21px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .print-title p {
    margin: 5px 0 0;
    color: #4b5d50;
    font-size: 12px;
  }

  .print-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 18px;
    margin-bottom: 14px;
  }

  .view.print-active[data-view-panel="reports"] .print-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 12px;
  }

  .print-grid div,
  .print-totals div {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 6px 0;
    border-bottom: 1px solid #d6e1d4;
  }

  .print-grid span,
  .print-note-block span,
  .print-totals span,
  .signature-box span {
    font-size: 11px;
    font-weight: 700;
    color: #4b5d50;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }

  .print-grid strong,
  .print-totals strong {
    color: #1f2b24;
  }

  .print-note-block {
    margin-bottom: 14px;
  }

  .print-note-block p {
    min-height: 44px;
    margin: 8px 0 0;
    padding: 10px 12px;
    border: 1px solid #d6e1d4;
    border-radius: 8px;
    white-space: pre-wrap;
    background: #fafcf9;
  }

  .print-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 14px;
  }

  .print-table th,
  .print-table td {
    border: 1px solid #d6e1d4;
    padding: 8px 10px;
    font-size: 11.5px;
    text-align: left;
  }

  .print-table th {
    background: #edf4ef;
    color: #234238;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }

  .view.print-active[data-view-panel="reports"] .print-table tbody tr:nth-child(even) td {
    background: #fafcf9;
  }

  .print-totals {
    display: grid;
    gap: 8px;
    margin-bottom: 22px;
  }

  .view.print-active[data-view-panel="reports"] .print-totals {
    margin-top: 8px;
    padding: 10px 12px;
    border: 1px solid #d6e1d4;
    border-radius: 10px;
    background: #f7faf7;
  }

  .signature-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
    margin-top: 34px;
  }

  .signature-box {
    border-top: 1px solid #4b5d50;
    padding-top: 10px;
    text-align: center;
  }

  .statement-sheet {
    border: 1px solid #1f2b24;
    border-radius: 6px;
    padding: 12px 16px 20px;
  }

  .statement-topline {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 9.5px;
    margin-bottom: 6px;
    color: #6b7280;
  }

  .statement-brand-header {
    border-bottom: 1.5px solid #1f2b24;
    margin-bottom: 10px;
    padding-bottom: 5px;
    text-align: center;
  }

  .statement-brand-header h3 {
    font-size: 21px;
    letter-spacing: 0.06em;
    color: #111a15;
  }

  .statement-brand-header p {
    font-size: 11px;
    font-style: italic;
    color: #5a5f66;
  }

  .statement-meta-panels,
  .statement-totals-panels {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    margin-bottom: 8px;
    border: 1px solid #d6dcd6;
  }

  .statement-meta-panels div,
  .statement-totals-panels div {
    padding: 6px 12px;
    border-right: 1px solid #d6dcd6;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 2px;
  }

  .statement-meta-panels div:last-child,
  .statement-totals-panels div:last-child {
    border-right: 0;
  }

  .statement-meta-panels span,
  .statement-totals-panels span {
    font-size: 9px;
    font-weight: 700;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }

  .statement-meta-panels strong,
  .statement-totals-panels strong {
    font-size: 13.5px;
  }

  .statement-totals-panels .amount-positive {
    color: #0f8f45;
  }

  .statement-totals-panels .amount-negative {
    color: #da1f1f;
  }

  .statement-main-table th:nth-child(1),
  .statement-main-table td:nth-child(1) {
    width: 6%;
  }

  .statement-main-table th:nth-child(2),
  .statement-main-table td:nth-child(2) {
    width: 10%;
  }

  .statement-main-table th:nth-child(3),
  .statement-main-table td:nth-child(3) {
    width: 14%;
  }

  .statement-main-table th:nth-child(5),
  .statement-main-table td:nth-child(5) {
    text-align: right;
  }

  .statement-payments-table th,
  .statement-payments-table td {
    font-size: 11px;
    text-align: center;
    vertical-align: middle;
  }

  .statement-payments-table td:last-child {
    font-variant-numeric: tabular-nums;
  }

  .statement-payments-table th:nth-child(1),
  .statement-payments-table td:nth-child(1) {
    width: 7%;
  }

  .statement-payments-table th:nth-child(2),
  .statement-payments-table td:nth-child(2) {
    width: 13%;
  }

  .statement-payments-table th:nth-child(3),
  .statement-payments-table td:nth-child(3) {
    width: 14%;
  }

  .statement-payments-table th:nth-child(4),
  .statement-payments-table td:nth-child(4) {
    width: 15%;
  }

  .statement-payments-table th:nth-child(5),
  .statement-payments-table td:nth-child(5) {
    width: 19%;
  }

  .statement-payments-table th:nth-child(6),
  .statement-payments-table td:nth-child(6) {
    width: 18%;
  }

  .statement-payments-table th:last-child,
  .statement-payments-table td:last-child {
    width: 14%;
  }

  .statement-payments-table .statement-total-row td {
    text-align: left;
  }

  .statement-payments-table .statement-total-row td:last-child {
    text-align: right;
  }

  .statement-section-divider {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 12px;
    align-items: center;
    margin: 26px 0 12px;
    font-weight: 700;
    text-transform: uppercase;
  }

  .statement-section-divider::before,
  .statement-section-divider::after {
    content: "";
    height: 2px;
    background: #1f2b24;
  }
}


.settings-layout {
  display: grid;
  gap: 24px;
}

.settings-intro-card {
  max-width: 980px;
}

.settings-shell {
  display: grid;
  gap: 22px;
}

.settings-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.settings-switch-btn {
  padding: 12px 18px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text-soft);
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.settings-switch-btn:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
  color: var(--text);
}

.settings-switch-btn.active {
  background: linear-gradient(135deg, #dd8751, var(--accent-dark));
  color: #ffffff;
  border-color: transparent;
}

.settings-panel {
  display: none;
  gap: 18px;
}

.settings-panel.active {
  display: grid;
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.settings-form-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 12px;
}

.settings-form-actions .primary-btn {
  min-width: 160px;
  flex: 0 0 auto;
}

.settings-list-block {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 4px;
}

.settings-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-soft);
  font-size: 0.88rem;
  font-weight: 700;
}

.settings-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.settings-chip {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(47, 127, 114, 0.12);
  color: var(--highlight);
  font-weight: 700;
}

.settings-chip span {
  min-width: 0;
}

.settings-record-list {
  display: grid;
  gap: 12px;
}

.settings-record {
  display: grid;
  gap: 6px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(234, 214, 196, 0.94);
}

.settings-record.compact {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.settings-record-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.settings-record strong {
  color: var(--text);
}

.settings-action-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.settings-edit-btn,
.settings-delete-btn {
  min-width: auto;
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
}

.settings-edit-btn {
  border: 1px solid rgba(47, 127, 114, 0.24);
  background: rgba(47, 127, 114, 0.08);
  color: var(--highlight);
}

.settings-edit-btn:hover {
  background: rgba(47, 127, 114, 0.14);
}

.settings-delete-btn {
  border: 1px solid rgba(196, 76, 76, 0.24);
  background: rgba(196, 76, 76, 0.08);
  color: var(--danger);
}

.settings-delete-btn:hover {
  background: rgba(196, 76, 76, 0.14);
}

.field-note {
  margin-top: 8px;
  color: var(--text-soft);
  font-size: 0.84rem;
}

.settings-record span,
.settings-record p,
.settings-empty {
  color: var(--text-soft);
}

.settings-record p {
  margin: 0;
  line-height: 1.6;
}

.settings-empty {
  display: inline-flex;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.58);
  border: 1px dashed rgba(221, 183, 155, 0.94);
}

@media (max-width: 1120px) {
  .settings-switcher {
    gap: 10px;
  }
}


.reports-layout {
  display: grid;
  gap: 24px;
}

.reports-toolbar-card {
  display: grid;
  gap: 18px;
}

.reports-toolbar-head {
  align-items: center;
}

.reports-view-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.reports-view-btn {
  padding: 12px 18px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text-soft);
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.reports-view-btn:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
  color: var(--text);
}

.reports-view-btn.active {
  background: linear-gradient(135deg, #dd8751, var(--accent-dark));
  color: #ffffff;
  border-color: transparent;
}

.reports-search-field {
  margin: 0;
}

.toolbar-search-row {
  display: flex;
  align-items: flex-end;
  gap: 16px;
}

.toolbar-search-row .reports-search-field,
.toolbar-search-row .payments-search-field {
  flex: 1 1 0;
  min-width: 0;
}

.compact-search-field {
  flex: 0 0 180px;
  max-width: 220px;
  margin: 0;
}

.compact-search-field input {
  min-width: 0;
}

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

.reports-toolbar-actions {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

.reports-toolbar-actions .primary-btn,
.reports-toolbar-actions .ghost-btn {
  min-width: 0;
  flex: 1 1 0;
}

.reports-grid-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-soft);
  font-size: 0.92rem;
  font-weight: 700;
}

.reports-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.reports-record-card {
  width: 100%;
  padding: 20px;
  border: 1px solid rgba(234, 214, 196, 0.94);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(250, 243, 236, 0.96));
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.reports-record-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}

.reports-card-top,
.reports-card-meta,
.reports-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.reports-card-top > div {
  display: grid;
  gap: 8px;
}

.reports-card-top strong,
.reports-card-grid strong,
.reports-balance-pill strong {
  color: var(--text);
}

.reports-card-top span,
.reports-card-meta span,
.reports-card-grid span,
.reports-balance-pill span,
.reports-card-link {
  color: var(--text-soft);
}

.reports-card-tag {
  display: inline-flex;
  width: fit-content;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(69, 153, 140, 0.12);
  color: var(--highlight) !important;
  font-size: 0.82rem;
  font-weight: 700;
}

.reports-card-meta {
  margin-top: 10px;
}

.reports-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.reports-card-grid div {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(234, 214, 196, 0.94);
}

.reports-card-grid strong,
.reports-card-link {
  display: block;
  margin-top: 6px;
}

.reports-card-link {
  margin-top: 14px;
  font-weight: 700;
}

.reports-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(20, 26, 31, 0.34);
  backdrop-filter: blur(10px);
}

.reports-modal-card {
  position: relative;
  width: min(980px, 100%);
  max-height: min(92vh, 960px);
  overflow: hidden;
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(255, 253, 250, 0.99), rgba(248, 239, 231, 0.98));
  border: 1px solid rgba(234, 214, 196, 0.94);
  box-shadow: 0 30px 60px rgba(12, 19, 24, 0.28);
}

.reports-modal-scroll {
  overflow: auto;
  max-height: min(92vh, 960px);
  padding: 28px;
  display: grid;
  gap: 24px;
}

.reports-modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(221, 183, 155, 0.94);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--text);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
}

.reports-balance-pill {
  min-width: 180px;
  padding: 16px 18px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(221, 135, 81, 0.14), rgba(255, 255, 255, 0.94));
  border: 1px solid rgba(221, 183, 155, 0.94);
}

.reports-balance-pill strong {
  display: block;
  margin-top: 6px;
  font-size: 1.2rem;
  color: var(--accent-dark);
}

.reports-subsection {
  display: grid;
  gap: 16px;
}

.tally-table-wrap {
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid #1f2b24;
}

.tally-table {
  width: 100%;
  border-collapse: collapse;
  background: #fffdf9;
  font-family: "Courier New", "Consolas", monospace;
  font-size: 0.92rem;
}

.tally-table th,
.tally-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #d7cdbf;
  border-right: 1px solid #d7cdbf;
  text-align: left;
  color: #1f2b24;
}

.tally-table th:last-child,
.tally-table td:last-child {
  border-right: none;
}

.tally-table tbody tr:last-child th,
.tally-table tbody tr:last-child td {
  border-bottom: none;
}

.reports-keyvalue-table tr th {
  width: 46%;
  background: #f3efe6;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-size: 0.78rem;
}

.reports-items-table thead th {
  background: #1f2b24;
  color: #fffdf9;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.78rem;
  border-right: 1px solid rgba(255, 253, 249, 0.18);
}

.reports-items-table tbody tr:nth-child(even) td {
  background: rgba(31, 43, 36, 0.04);
}

.tally-amount-col {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.tally-total-row td {
  border-top: 3px double #1f2b24;
  border-bottom: none;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: #f3efe6;
}

.reports-actions {
  display: flex;
  justify-content: flex-start;
}

.reports-actions .primary-btn {
  min-width: 220px;
  flex: 0 0 auto;
}

.reports-empty {
  display: inline-flex;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.58);
  border: 1px dashed rgba(221, 183, 155, 0.94);
  color: var(--text-soft);
}

.reports-empty.inline {
  width: fit-content;
}

body.reports-modal-open {
  overflow: hidden;
}

@media (max-width: 1120px) {
  .reports-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .reports-view-switcher,
  .reports-toolbar-actions,
  .reports-modal-head,
  .reports-card-top,
  .reports-card-meta,
  .reports-grid-head,
  .toolbar-search-row {
    flex-direction: column;
    align-items: stretch;
  }

  .compact-search-field {
    flex-basis: auto;
    max-width: none;
  }

  .reports-filter-grid,
  .reports-card-grid {
    grid-template-columns: 1fr;
  }

  .reports-modal-scroll {
    padding: 22px 18px;
  }
}

.payments-layout {
  display: grid;
  gap: 24px;
}

.payments-toolbar-card {
  display: grid;
  gap: 18px;
}

.payments-toolbar-head {
  align-items: center;
}

.payments-view-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.payments-view-btn {
  padding: 12px 18px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text-soft);
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.payments-view-btn:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
  color: var(--text);
}

.payments-view-btn.active {
  background: linear-gradient(135deg, #45998c, var(--highlight));
  color: #ffffff;
  border-color: transparent;
}

.payments-search-field {
  margin: 0;
}

.payments-grid-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-soft);
  font-size: 0.92rem;
  font-weight: 700;
}

.payments-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.payments-record-card {
  width: 100%;
  padding: 20px;
  border: 1px solid rgba(234, 214, 196, 0.94);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(250, 243, 236, 0.96));
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.payments-record-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}

.payments-card-top,
.payments-card-meta,
.payments-history-top,
.payments-history-meta,
.payments-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.payments-card-top strong,
.payments-stat-box strong,
.payments-info-row strong,
.payments-balance-pill strong,
.payments-card-grid strong {
  color: var(--text);
}

.payments-card-top span,
.payments-card-meta span,
.payments-history-meta span,
.payments-balance-pill span,
.payments-stat-box span,
.payments-info-row span,
.payments-card-grid span {
  color: var(--text-soft);
}

.payments-card-meta {
  margin-top: 10px;
}

.payments-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.payments-card-grid div {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(234, 214, 196, 0.94);
}

.payments-card-grid strong {
  display: block;
  margin-top: 6px;
}

.payments-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(20, 26, 31, 0.34);
  backdrop-filter: blur(10px);
}

.payments-modal-card {
  position: relative;
  width: min(980px, 100%);
  max-height: min(92vh, 960px);
  overflow: hidden;
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(255, 253, 250, 0.99), rgba(248, 239, 231, 0.98));
  border: 1px solid rgba(234, 214, 196, 0.94);
  box-shadow: 0 30px 60px rgba(12, 19, 24, 0.28);
}

.payments-modal-scroll {
  overflow: auto;
  max-height: min(92vh, 960px);
  padding: 28px;
  display: grid;
  gap: 24px;
}

.payments-modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(221, 183, 155, 0.94);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--text);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
}

.payments-balance-pill {
  min-width: 180px;
  padding: 16px 18px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(221, 135, 81, 0.14), rgba(255, 255, 255, 0.94));
  border: 1px solid rgba(221, 183, 155, 0.94);
}

.payments-balance-pill strong {
  display: block;
  margin-top: 6px;
  font-size: 1.2rem;
  color: var(--accent-dark);
}

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

.payments-stat-box {
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(234, 214, 196, 0.94);
}

.payments-stat-box strong {
  display: block;
  margin-top: 6px;
  font-size: 1.05rem;
}

.payments-subsection {
  display: grid;
  gap: 16px;
}

.payments-keyvalue-grid,
.payments-history-list {
  display: grid;
  gap: 12px;
}

.payments-info-row,
.payments-history-item {
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(234, 214, 196, 0.94);
}

.payments-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.payments-history-item p {
  margin: 10px 0 0;
  color: var(--text-soft);
  line-height: 1.6;
}

.payments-history-item .payments-card-grid {
  margin-top: 14px;
}

.payments-entry-form,
.payments-entry-actions {
  display: grid;
  gap: 18px;
}

.payments-entry-actions {
  justify-content: flex-start;
}

.payments-entry-actions .primary-btn {
  min-width: 180px;
  flex: 0 0 auto;
}

.payments-empty {
  display: inline-flex;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.58);
  border: 1px dashed rgba(221, 183, 155, 0.94);
  color: var(--text-soft);
}

.payments-empty.inline {
  width: fit-content;
}

body.payments-modal-open {
  overflow: hidden;
}

.hidden {
  display: none !important;
}

@media (max-width: 980px) {
  .payments-detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .payments-grid-head,
  .payments-card-top,
  .payments-card-meta,
  .payments-history-top,
  .payments-history-meta,
  .payments-modal-head,
  .payments-info-row {
    flex-direction: column;
    align-items: flex-start;
  }

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

  .payments-modal-backdrop {
    padding: 10px;
  }

  .payments-modal-scroll {
    padding: 20px;
  }

  .payments-balance-pill {
    min-width: 0;
    width: 100%;
  }
}

.backend-status-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(17, 23, 29, 0.56);
  backdrop-filter: blur(10px);
}

.backend-status-card {
  width: min(560px, 100%);
  padding: 32px;
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(255, 253, 250, 0.99), rgba(248, 239, 231, 0.98));
  border: 1px solid rgba(234, 214, 196, 0.94);
  box-shadow: 0 30px 60px rgba(12, 19, 24, 0.28);
  text-align: center;
}

.backend-status-spinner {
  width: 54px;
  height: 54px;
  margin: 0 auto 18px;
  border-radius: 50%;
  border: 4px solid rgba(201, 109, 55, 0.18);
  border-top-color: var(--accent-dark);
  animation: backend-spin 0.9s linear infinite;
}

.backend-status-actions {
  display: flex;
  justify-content: center;
  margin-top: 18px;
}

@keyframes backend-spin {
  to {
    transform: rotate(360deg);
  }
}

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 140;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(17, 23, 29, 0.66);
  backdrop-filter: blur(10px);
}

.login-card {
  width: min(380px, 100%);
  padding: 32px;
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(255, 253, 250, 0.99), rgba(248, 239, 231, 0.98));
  border: 1px solid rgba(234, 214, 196, 0.94);
  box-shadow: 0 30px 60px rgba(12, 19, 24, 0.28);
  text-align: center;
}

.login-card form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 18px;
  text-align: left;
}

.login-card .primary-btn {
  width: 100%;
  justify-content: center;
}

.field-error {
  color: #c0392b;
  font-size: 0.85rem;
  margin: 0;
}

.sidebar-bottom {
  margin-top: auto;
}

.logout-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-inverse);
  cursor: pointer;
  font-weight: 600;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.logout-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  transform: translateY(-1px);
}
