/**
 * Excel-like sheet view — clear grid lines, easy scan, workflow unchanged.
 */

:root {
    --sheet-border: #c8c8c8;
    --sheet-header-bg: #e8e8e8;
    --sheet-row-alt: #f7f7f7;
    --sheet-hover: #e8f4fc;
    --sheet-select-col: #fff9e6;
}

/* ——— Sheet tables (lists & reports) ——— */
.main-content .data-table,
.main-content .party-outstanding-table,
.main-content .pl-month-table,
.main-content .pl-statement-table {
    border: 1px solid var(--sheet-border);
    border-radius: 0;
    background: #fff;
    font-size: 13px;
    line-height: 1.35;
}

.main-content .data-table th,
.main-content .data-table td,
.main-content .party-outstanding-table th,
.main-content .party-outstanding-table td,
.main-content .pl-month-table th,
.main-content .pl-month-table td,
.main-content .pl-statement-table th,
.main-content .pl-statement-table td {
    border: 1px solid var(--sheet-border);
    padding: 7px 10px;
    vertical-align: middle;
}

.main-content .data-table thead th,
.main-content .party-outstanding-table thead th,
.main-content .pl-month-table thead th,
.main-content .pl-statement-table thead th {
    background: var(--sheet-header-bg);
    color: #1a1a1a;
    font-size: 12px;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    white-space: nowrap;
    border-bottom: 1px solid var(--sheet-border);
    box-shadow: none;
}

.main-content .data-table tbody tr:nth-child(even),
.main-content .party-outstanding-table tbody tr:nth-child(even),
.main-content .pl-month-table tbody tr:nth-child(even) {
    background: var(--sheet-row-alt);
}

.main-content .data-table tbody tr:hover,
.main-content .party-outstanding-table tbody tr:hover,
.main-content .pl-month-table tbody tr:hover {
    background: var(--sheet-hover);
}

.main-content .data-table tfoot tr,
.main-content .party-outstanding-table tfoot tr,
.main-content .pl-month-table tfoot tr {
    background: #e2efda;
    border-top: 2px solid #6aa84f;
}

.main-content .data-table tfoot td,
.main-content .party-outstanding-table tfoot td,
.main-content .pl-month-table tfoot td {
    font-weight: 700;
    padding: 8px 10px;
}

/* Money columns — align like Excel */
.main-content .data-table .text-right,
.main-content .party-outstanding-table .text-right,
.main-content .pl-month-table .text-right,
.main-content .amount,
.main-content .party-outstanding-amt {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
}

/* Highlight pending / collect column */
.main-content .party-outstanding-table .party-outstanding-col {
    background: var(--sheet-select-col);
}

.main-content .party-outstanding-table thead .party-outstanding-col {
    background: #f5e6b8;
    color: #5c4a00;
}

.main-content .party-outstanding-table .party-payable-col {
    background: #e8f5e9;
}

.main-content .party-outstanding-table thead .party-payable-col {
    background: #c8e6c9;
    color: #1b5e20;
}

.main-content .party-outstanding-row--due .party-payable-col {
    background: #fff8e1;
}

.party-payable-badge {
    font-variant-numeric: tabular-nums;
    min-width: 4.5rem;
    display: inline-block;
    text-align: right;
}

.pl-report-filter-fields .form-group--grow {
    flex: 1 1 220px;
    min-width: 0;
}

.pl-report-hero-title--compact {
    font-size: 1.35rem;
}

.pl-report-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
}

.sheet-list-page .pl-report-presets {
    margin-bottom: 10px;
}

.pay-easy-page .pl-report-split {
    margin-top: 16px;
}

.pay-easy-page .cash-vs-bills-help + .pl-report-split,
.pay-easy-page .form-hint + .pl-report-split {
    margin-top: 12px;
}

.sheet-empty-state {
    text-align: center;
    padding: 40px 20px;
}

.sheet-empty-state .sheet-empty-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
    line-height: 1;
}

.main-content .party-outstanding-row--due td {
    background: #fff5f5;
}

.main-content .party-outstanding-row--due:hover td {
    background: #ffe8e8;
}

/* Card wraps sheet — less chrome, table is the focus */
.pl-report-page .pl-report-card:has(.data-table),
.pl-report-page .pl-report-card:has(.party-outstanding-table-wrap) {
    padding: 12px 12px 0;
    border-radius: 4px;
    box-shadow: none;
    border-color: var(--sheet-border);
}

.pl-report-page .pl-report-card-head {
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--sheet-border);
}

.pl-report-page .pl-report-card .table-responsive,
.pl-report-page .pl-report-card .party-outstanding-table-wrap {
    margin: 0 -12px;
}

/* Scrollable sheet with frozen header row */
.pl-report-page .pl-report-card .table-responsive,
.pl-report-page .pl-report-card .party-outstanding-table-wrap,
.main-content .table-responsive.sticky-head {
    max-height: min(70vh, 720px);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

.pl-report-page .pl-report-card .table-responsive thead th,
.pl-report-page .pl-report-card .party-outstanding-table-wrap thead th,
.main-content .table-responsive.sticky-head thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    box-shadow: 0 1px 0 var(--sheet-border);
}

/* Compact action buttons inside sheet rows */
.party-outstanding-actions {
    white-space: nowrap;
}

.party-outstanding-actions .btn {
    padding: 4px 8px;
    font-size: 11px;
    border-radius: 3px;
}

.party-outstanding-actions .btn + .btn {
    margin-left: 4px;
}

/* Badges inside cells — flat, not bulky */
.main-content .data-table .badge,
.main-content .party-outstanding-table .badge {
    border-radius: 3px;
    padding: 2px 6px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

/* Links in name column */
.party-outstanding-name {
    color: #0563c1;
    text-decoration: underline;
    text-underline-offset: 2px;
    font-weight: 500;
}

.party-outstanding-name:hover {
    color: #034694;
}

/* Dashboard & generic card tables */
.main-content .card .data-table {
    border-radius: 0;
}

.main-content .card:has(.data-table) {
    padding-bottom: 0;
    overflow: hidden;
}

/* Print — keep grid */
@media print {
    .main-content .data-table th,
    .main-content .data-table td,
    .main-content .party-outstanding-table th,
    .main-content .party-outstanding-table td {
        border: 1px solid #999;
    }

    .sheet-list-page > .pl-kpi-grid {
        display: grid;
    }
}

/* ——— Less clutter on sheet list pages ——— */
/* Hero + table footer already show totals */
.sheet-list-page > .pl-kpi-grid {
    display: none;
}

/* Table footer already has totals */
.pl-report-card:has(table tfoot) .list-summary-bar {
    display: none;
}

/* ——— Due-party sheet (pending / alerts) ——— */
.pl-report-card:has(.sheet-due-wrap) {
    padding: 12px 12px 0;
    border-radius: 4px;
    box-shadow: none;
    border-color: var(--sheet-border);
}

.pl-report-card:has(.sheet-due-wrap) .pl-report-card-head {
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--sheet-border);
}

.pl-report-card .sheet-due-wrap {
    margin: 0 -12px;
    max-height: min(60vh, 560px);
    overflow: auto;
}

.sheet-due-actions {
    white-space: nowrap;
}

.sheet-due-actions .btn {
    padding: 4px 8px;
    font-size: 11px;
    border-radius: 3px;
    margin-right: 4px;
}

/* Compact row actions on all sheet tables */
.main-content .data-table td .btn-sm {
    padding: 4px 8px;
    font-size: 11px;
    border-radius: 3px;
    margin: 1px 2px 1px 0;
}

/* Dashboard recent lists — full grid */
.main-content .dashboard-grid .card .table-responsive {
    max-height: 320px;
    overflow: auto;
}

.main-content .dashboard-grid .card .table-responsive thead th {
    position: sticky;
    top: 0;
    z-index: 1;
}

.main-content .dashboard-grid .card:has(.data-table) .card-body {
    padding-bottom: 0;
}

.main-content .party-invoice-table,
.main-content .audit-table {
    border: 1px solid var(--sheet-border);
    border-radius: 0;
}

.main-content .party-invoice-table th,
.main-content .party-invoice-table td,
.main-content .audit-table th,
.main-content .audit-table td {
    border: 1px solid var(--sheet-border);
    padding: 7px 10px;
}

/* Excel-style links in any sheet cell */
.main-content .data-table tbody a:not(.btn) {
    color: #0563c1;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.main-content .data-table tbody a:not(.btn):hover {
    color: #034694;
}

/* ——— Party view: amount summary as mini sheet ——— */
.party-account-summary {
    background: #fff;
    border: 1px solid var(--sheet-border);
    border-radius: 0;
    padding: 0;
    margin-bottom: 12px;
}

.party-account-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    padding: 7px 10px;
    border-bottom: 1px solid var(--sheet-border);
    font-size: 13px;
}

.party-account-row:last-child {
    border-bottom: none;
}

.party-account-row--main {
    background: var(--sheet-header-bg);
    font-weight: 600;
}

.party-account-row--payable {
    background: #e2efda;
    font-weight: 700;
    margin-top: 0;
    padding-top: 8px;
}

.party-account-row strong {
    font-variant-numeric: tabular-nums;
}

.party-account-card .party-invoice-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
}

.pl-report-page:has(.party-account-card) > .pl-kpi-grid {
    display: none;
}

/* Party view: hero + sheet panel — hide duplicate chips */
.txn-view-page:has(.party-account-card) .txn-view-chips {
    display: none;
}

/* ——— Financial statement tables (balance sheet, P&L) ——— */
.pl-report-card--statement {
    padding: 12px 12px 0;
    border-radius: 4px;
    box-shadow: none;
    border-color: var(--sheet-border);
}

.pl-report-card--statement .pl-report-card-head {
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--sheet-border);
}

.main-content .pl-statement-table {
    margin: 0 -12px 0;
    width: calc(100% + 24px);
}

.main-content .pl-statement-table td {
    border: 1px solid var(--sheet-border);
    padding: 7px 10px;
    font-variant-numeric: tabular-nums;
}

.main-content .pl-statement-section td {
    background: var(--sheet-header-bg);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #444;
}

.main-content .pl-statement-total td {
    background: #e2efda;
    border-top: 2px solid #6aa84f;
    font-weight: 700;
}

/* Inline payment history on Receive & Pay form */
.pay-history-list .table-responsive {
    margin-top: 8px;
    max-height: 240px;
    overflow: auto;
    border: 1px solid var(--sheet-border);
}

.pay-history-table {
    margin: 0;
}

.party-account-card {
    border-radius: 4px;
    border-color: var(--sheet-border);
    box-shadow: none;
}

.party-account-card .card-header {
    border-bottom: 1px solid var(--sheet-border);
    padding-bottom: 10px;
}

.party-account-card .table-responsive {
    max-height: 360px;
    overflow: auto;
    border: 1px solid var(--sheet-border);
}

/* Account statement: ledger table only (panel duplicates invoice list) */
#ledgerPrint .party-account-card {
    display: none;
}

/* Sale / purchase / invoice view cards */
.txn-view-page .txn-view-card {
    border-radius: 4px;
    box-shadow: none;
    border: 1px solid var(--sheet-border);
}

.txn-view-page .txn-view-card .card-header {
    border-bottom: 1px solid var(--sheet-border);
    padding: 12px 14px;
}

.txn-view-page .txn-view-card-body-flush {
    padding: 0;
}

.txn-view-page .txn-view-card-body-flush .table-responsive {
    max-height: 300px;
    overflow: auto;
    margin: 0;
    border: none;
    border-top: 1px solid var(--sheet-border);
}

.txn-view-page .txn-view-card-body-flush .data-table {
    border: none;
}

.main-content .signoff-table td {
    border: 1px solid var(--sheet-border);
    padding: 8px 10px;
    vertical-align: middle;
}

/* Dashboard mini sheets */
.main-content .dashboard-grid .card .data-table tfoot tr {
    background: #e2efda;
}

.main-content .dashboard-grid .list-summary-bar {
    display: none;
}


/* Compact money help — collapsed by default */
.money-help-details {
    margin: 0 0 12px;
    padding: 0;
    background: #f8fafc;
    border: 1px solid var(--sheet-border, #c8c8c8);
    border-radius: 4px;
    font-size: 12px;
    line-height: 1.45;
    color: #1e3a5f;
}

.money-help-details summary {
    padding: 8px 12px;
    cursor: pointer;
    font-weight: 600;
    color: #0d47a1;
    list-style: none;
}

.money-help-details summary::-webkit-details-marker {
    display: none;
}

.money-help-details summary::before {
    content: '▸ ';
}

.money-help-details[open] summary::before {
    content: '▾ ';
}

.money-help-body {
    padding: 0 12px 10px;
    border-top: 1px solid var(--sheet-border, #e0e0e0);
}

.money-help-body p {
    margin: 8px 0 0;
}

/* Sheet list workspace — table-first layout */
.sheet-list-page .pl-report-hero {
    padding: 14px 16px;
    margin-bottom: 12px;
    border-radius: 4px;
    box-shadow: none;
}

.sheet-list-page .pl-report-hero-title {
    font-size: 1.15rem;
}

.sheet-list-page .pl-report-filter {
    margin-bottom: 12px;
    padding: 10px 12px;
    border: 1px solid var(--sheet-border);
    border-radius: 4px;
    background: #fafafa;
}

.sheet-list-page .pl-report-presets {
    margin-bottom: 10px;
}

.sheet-list-page .data-table th:first-child,
.sheet-list-page .party-outstanding-table th:first-child {
    width: 36px;
    text-align: center;
}

.sheet-list-page .data-table td:first-child,
.sheet-list-page .party-outstanding-table td:first-child {
    text-align: center;
    color: #666;
}

.sheet-list-page .pl-report-card-head h3 {
    font-size: 0.95rem;
}

/* Period cash strip on sales / purchases / outstanding lists */
.cash-period-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 0;
    margin-bottom: 12px;
    border: 1px solid var(--sheet-border, #d4d4d4);
    border-radius: 4px;
    background: #fff;
    overflow: hidden;
}

.cash-period-strip__item {
    flex: 1 1 140px;
    padding: 10px 14px;
    border-right: 1px solid var(--sheet-border, #e8e8e8);
}

.cash-period-strip__item:last-of-type {
    border-right: none;
}

.cash-period-strip__label {
    display: block;
    font-size: 11px;
    color: #666;
    margin-bottom: 4px;
}

.cash-period-strip__value {
    font-size: 1.05rem;
}

.cash-period-strip__meta {
    flex: 0 0 100%;
    padding: 6px 14px 8px;
    font-size: 11px;
    color: #888;
    border-top: 1px solid var(--sheet-border, #eee);
    background: #fafafa;
}

.cash-period-strip__item--in {
    background: #f8fff8;
}

.cash-period-strip__item--out {
    background: #fff8f8;
}

/* Remove duplicate inline compact help rules — use details above */
.pl-report-page:has(.party-outstanding-table, .sheet-due-wrap) .money-help-box {
    padding: 0;
    margin-bottom: 12px;
    font-size: 12px;
    line-height: 1.45;
    border-radius: 4px;
    background: transparent;
    border: none;
}

.pl-report-page:has(.party-outstanding-table, .sheet-due-wrap) .money-help-title {
    display: list-item;
    margin: 0;
    font-size: 12px;
}

.pl-report-page:has(.party-outstanding-table, .sheet-due-wrap) .money-help-box p:not(.money-help-title) {
    display: block;
    margin: 8px 0 0;
}

.sheet-card-body {
    padding-bottom: 0;
}

.sheet-pending-col {
    background: #fffef5;
}

.sheet-grid-table .sheet-pending-col {
    font-weight: 600;
}

.sheet-list-page .sheet-table-wrap {
    max-height: min(70vh, 720px);
    overflow: auto;
}

.sheet-list-hint {
    margin: -4px 0 12px;
    font-size: 0.88rem;
    color: var(--text-muted, #5c6b5c);
}

.pl-report-card--cash-period {
    margin-top: 20px;
}

/* ——— Collections pay entry (compact Excel / Access style) ——— */
.pay-sheet-page .pl-report-hero--sheet {
    padding: 10px 12px;
    margin-bottom: 10px;
}

.pay-sheet-page .pl-report-hero--sheet .pl-report-hero-title {
    font-size: 1.15rem;
    margin: 0 0 4px;
}

.pay-sheet-page .pl-report-hero--sheet .pl-report-hero-sub {
    font-size: 12px;
    margin: 0;
}

.pay-sheet-card {
    margin-bottom: 12px;
}

.pay-sheet-tabs {
    display: flex;
    gap: 0;
    border: 1px solid var(--sheet-border);
    border-bottom: none;
    background: var(--sheet-header-bg);
}

.pay-sheet-tab {
    flex: 1;
    padding: 6px 10px;
    border: none;
    border-right: 1px solid var(--sheet-border);
    background: #f3f3f3;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    color: #333;
}

.pay-sheet-tab:last-child {
    border-right: none;
}

.pay-sheet-tab.active {
    background: #fff;
    box-shadow: inset 0 -2px 0 #217346;
}

.pay-sheet-wrap {
    border: 1px solid var(--sheet-border);
    background: #fff;
    max-width: 100%;
    overflow: hidden;
}

.pay-sheet-page {
    max-width: 100%;
    overflow-x: hidden;
    width: 100%;
    box-sizing: border-box;
}

.pay-sheet-page.pl-report-page {
    max-width: min(1140px, 100%);
}

.pay-sheet-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    margin: -4px 0 14px;
    padding: 0 2px 10px;
    font-size: 12px;
    border-bottom: 1px solid #e2e8f0;
}

.pay-sheet-tools a {
    color: #1b5e20;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.pay-sheet-tools a + a::before {
    content: '·';
    margin: 0 12px;
    color: #94a3b8;
    font-weight: 400;
    pointer-events: none;
}

.pay-sheet-tools a:hover {
    text-decoration: underline;
}

.pay-sheet-page .pl-report-hero {
    padding: 16px 18px;
}

.pay-sheet-page .pl-report-hero-main {
    min-width: 0;
    flex: 1 1 280px;
}

.pay-sheet-page .pl-report-hero-sub {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
    align-items: center;
}

.pay-sheet-title {
    background: #217346;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    text-align: left;
    padding: 6px 10px;
}

.pay-sheet-body {
    padding: 10px 12px 12px;
}

.pay-sheet-body[data-empty="1"] .pay-sheet-stats .pay-sheet-stat-value {
    opacity: 0.5;
}

.pay-sheet-row--party {
    display: grid;
    grid-template-columns: minmax(88px, auto) minmax(0, 1fr);
    gap: 8px 12px;
    align-items: center;
    margin-bottom: 10px;
}

.pay-sheet-label {
    font-size: 12px;
    font-weight: 600;
    color: #334155;
    margin: 0;
}

.pay-sheet-select {
    width: 100%;
    max-width: 100%;
}

.pay-sheet-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 10px;
}

.pay-sheet-stats--account {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.pay-sheet-stat {
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid var(--sheet-border);
    background: var(--sheet-header-bg, #f8faf8);
    border-radius: 4px;
}

.pay-sheet-stat-label {
    display: block;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #64748b;
    margin-bottom: 4px;
    line-height: 1.2;
}

.pay-sheet-stat-value {
    display: block;
    font-size: 13px;
    font-weight: 700;
    text-align: right;
    word-break: break-word;
}

.pay-sheet-stat--due .pay-sheet-stat-value,
.pay-sheet-due {
    color: #c45c00;
}

.pay-sheet-stat--due {
    background: #fff9e6;
}

.pay-sheet-entry {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px 10px;
    margin-bottom: 10px;
}

.pay-sheet-field label,
.pay-sheet-field-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 4px;
}

.pay-sheet-field--quick .pay-sheet-quick {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    min-height: 28px;
}

.pay-sheet-stats--meta {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.pay-sheet-more-stats {
    margin-bottom: 10px;
    font-size: 12px;
}

.pay-sheet-more-stats summary {
    cursor: pointer;
    font-weight: 600;
    color: #475569;
    padding: 4px 0 8px;
    list-style: none;
}

.pay-sheet-more-stats summary::-webkit-details-marker {
    display: none;
}

.pay-sheet-more-stats summary::before {
    content: '▸ ';
    color: #1b5e20;
}

.pay-sheet-more-stats[open] summary::before {
    content: '▾ ';
}

.pay-sheet-action-panel {
    margin-top: 4px;
    padding: 14px 12px 12px;
    border: 1px solid #c8e6c9;
    border-radius: 8px;
    background: linear-gradient(180deg, #f8fdf8 0%, #fff 100%);
}

.pay-sheet-action-due {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px dashed #dce8dc;
}

.pay-sheet-action-due-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #1b5e20;
}

.pay-sheet-action-due-value {
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1.2;
}

.pay-sheet-action-panel .pay-sheet-footer {
    border-top: none;
    padding-top: 0;
}

.pay-sheet-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
    justify-content: space-between;
    padding-top: 10px;
    border-top: 1px solid var(--sheet-border);
}

.pay-sheet-actions .btn {
    min-width: 110px;
    padding: 8px 16px;
    font-weight: 600;
}

.pay-sheet-field--grow {
    flex: 1 1 220px;
    min-width: 0;
}

.pay-sheet-actions {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 10px;
    justify-content: flex-end;
    flex: 0 0 auto;
    align-items: center;
}

.pay-sheet-tools--footer {
    margin: 20px 0 0;
    padding-top: 12px;
    border-top: 1px solid #e2e8f0;
    border-bottom: none;
}

.pay-sheet-body .form-control-sm {
    font-size: 12px;
    padding: 4px 8px;
    height: auto;
    min-height: 28px;
    border-radius: 0;
    border-color: var(--sheet-border);
    width: 100%;
    max-width: 100%;
}

@media (max-width: 1100px) {
    .pay-sheet-stats--account {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .pay-sheet-stats:not(.pay-sheet-stats--account) {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

@media (max-width: 640px) {
    .pay-sheet-row--party {
        grid-template-columns: 1fr;
    }

    .pay-sheet-stats,
    .pay-sheet-entry {
        grid-template-columns: 1fr;
    }

    .pay-sheet-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .pay-sheet-actions {
        flex-wrap: wrap;
        justify-content: stretch;
    }

    .pay-sheet-actions .btn {
        flex: 1 1 calc(50% - 5px);
    }
}

.pay-voucher-advance td,
.pay-history-advance td {
    opacity: 0.85;
    font-style: italic;
}

.header-right--compact {
    margin-left: auto;
    gap: 8px;
}

.top-header--compact {
    padding: 0 16px;
}

.top-header--compact .page-title {
    flex: 1;
    min-width: 0;
}

.pay-entry-sheet {
    margin: 0;
    width: 100%;
    font-size: 12px;
}

.pay-entry-sheet th,
.pay-entry-sheet td {
    padding: 5px 8px;
    vertical-align: middle;
}

.pay-entry-sheet .pay-sheet-title {
    background: #217346;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    text-align: left;
    padding: 6px 10px;
}

.pay-entry-sheet .pay-sheet-label {
    white-space: nowrap;
    width: 1%;
    background: var(--sheet-header-bg);
    font-weight: 600;
}

.pay-entry-sheet .form-control-sm {
    font-size: 12px;
    padding: 4px 8px;
    height: auto;
    min-height: 28px;
    border-radius: 0;
    border-color: var(--sheet-border);
}

.pay-entry-sheet .pay-sheet-select {
    max-width: 100%;
}

.pay-entry-sheet .pay-sheet-due {
    font-weight: 700;
    color: #c45c00;
    background: #fff9e6;
}

.pay-entry-sheet .pay-sheet-quick {
    white-space: nowrap;
}

.pay-entry-sheet .pay-sheet-quick .btn {
    padding: 2px 8px;
    font-size: 11px;
}

.pay-entry-sheet .pay-sheet-submit-cell {
    text-align: right;
    white-space: nowrap;
}

.pay-entry-sheet tbody tr:nth-child(even) {
    background: var(--sheet-row-alt);
}

.pay-sheet-form[data-empty="1"] .pay-sheet-balances td,
.pay-entry-sheet[data-empty="1"] .pay-sheet-due {
    opacity: 0.5;
}

.pay-sheet-history {
    margin-top: 8px;
    font-size: 12px;
}

.pay-sheet-history summary {
    cursor: pointer;
    font-weight: 600;
    padding: 4px 0;
}

.pay-sheet-page .pl-report-split {
    gap: 10px;
}

.pay-sheet-page .pl-report-card {
    padding: 10px;
}

/* Long-term: search, pagination, dashboard trend */
.search-results-list { display: flex; flex-direction: column; gap: 6px; }
.search-result-row {
    display: grid; grid-template-columns: 80px 1fr auto; gap: 10px; align-items: center;
    padding: 10px 12px; border: 1px solid var(--sheet-border, #e2e8f0); border-radius: 8px;
    text-decoration: none; color: inherit; background: #fff;
}
.search-result-row:hover { background: var(--sheet-row-alt, #f8fafc); }
.search-result-type { font-size: 11px; font-weight: 700; color: #64748b; }
.search-result-meta { font-size: 12px; color: #64748b; text-align: right; }
.erp-pagination { display: flex; align-items: center; gap: 12px; padding: 12px 0; flex-wrap: wrap; }
.erp-page-btn { font-size: 13px; padding: 6px 12px; border: 1px solid #cbd5e1; border-radius: 6px; text-decoration: none; color: #334155; }
.erp-page-info { font-size: 13px; color: #64748b; }
.dash-longterm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-bottom: 20px; }
.dash-longterm-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 14px 16px; }
.dash-longterm-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.dash-longterm-head h3 { margin: 0; font-size: 15px; }
.dash-trend-chart { display: flex; align-items: flex-end; gap: 4px; height: 100px; overflow-x: auto; }
.dash-trend-col { flex: 1; min-width: 18px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.dash-trend-bars { display: flex; gap: 2px; align-items: flex-end; height: 80px; width: 100%; justify-content: center; }
.dash-trend-bar { width: 6px; border-radius: 3px 3px 0 0; min-height: 2px; }
.dash-trend-bar--sale { background: #0d9488; }
.dash-trend-bar--purchase { background: #f59e0b; }
.dash-trend-label { font-size: 10px; color: #94a3b8; }
.dash-trend-legend { font-size: 11px; margin-right: 12px; }
.dash-trend-legend--sale::before { content: ''; display: inline-block; width: 8px; height: 8px; background: #0d9488; border-radius: 2px; margin-right: 4px; }
.dash-trend-legend--purchase::before { content: ''; display: inline-block; width: 8px; height: 8px; background: #f59e0b; border-radius: 2px; margin-right: 4px; }
.dash-activity-list, .dash-notif-list { list-style: none; margin: 0; padding: 0; }
.dash-activity-list li, .dash-notif-item { padding: 8px 0; border-bottom: 1px solid #f1f5f9; font-size: 13px; }
.dash-activity-time { color: #94a3b8; margin-right: 8px; font-size: 12px; }
.dash-activity-who { font-weight: 600; margin-right: 6px; }
.dash-notif-item { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.dash-notif-warn { border-left: 3px solid #f59e0b; padding-left: 8px; }
.dash-notif-alert { border-left: 3px solid #ef4444; padding-left: 8px; }
.header-search-btn { margin-right: 4px; }
