﻿.table-view-shell {
    display: flex;
    gap: 16px;
    height: 100%;
    min-height: 0;
}

.shell-left {
    width: 300px;
    min-width: 260px;
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--card-shadow);
}

.shell-left-panel-title {
    color: var(--text-primary);
    /*    font-family: var(--font-display);*/
    /*    font-size: 11px;*/
    /*    font-weight: 800;*/
    /*    text-transform: uppercase;*/
    /*    letter-spacing: 0.08em;*/
    /*    color: var(--text-muted);*/
}

.shell-left-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    color: var(--text-primary);
}



.shell-right-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

/* ── Table ──────────────────────────────────────────────── */
.data-table {
    width: 100%;
    border-collapse: collapse;
    /*    table-layout: fixed;*/
}

    .data-table th {
        font-family: var(--font-display);
        font-size: 11px;
        font-weight: 700;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        color: var(--text-muted);
        padding: 12px 16px;
        /*        text-align: left;*/
        border-bottom: 1px solid var(--border);
    }

    .data-table td {
        padding: 14px 16px;
        font-size: 11px;
        color: var(--text-primary);
        border-bottom: 1px solid var(--border);
        vertical-align: middle;
    }

    .data-table tr:last-child td {
        border-bottom: none;
    }

    .data-table tbody tr {
        transition: background var(--transition-fast);
        cursor: default;
    }

        .data-table tbody tr:hover {
            background: var(--border);
        }

    .data-table tfoot td {
        position: sticky;
        bottom: 0;
        background: var(--card-bg);
        box-shadow: 0 -1px 0 var(--border);
        border-bottom: none;
    }

    .data-table tfoot{
        z-index:20 !important;
    }

.col-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
    letter-spacing: 0.01em;
    white-space: nowrap;
}

    .col-num.receive {
        color: var(--status-success);
        font-weight: 600;
        border-right: 1px solid var(--border)
    }

    .col-num.payment {
        color: var(--status-danger);
        font-weight: 600;
    }

.col-date {
    white-space: nowrap;
    color: var(--text-secondary);
    font-size: 12px;
    width:100px;
}

.col-desc {
    min-width: 80px;
}

.col-narr {
    min-width: 300px;
    width:auto;
}

.col-check {
    width: 40px;
    padding-left: 16px;
}

/* Semantic cash/amount cues */
.amount-in {
    color: var(--status-success);
    font-weight: 500;
}

.amount-out {
    color: var(--status-danger);
    font-weight: 500;
}

.accounting-debit,
.accounting-credit {
    color: var(--text-primary);
    font-weight: 500;
}

/* Negative / warning cues. Avoid using these for accounting Debit/Credit direction. */
.cell-debit {
    color: var(--status-danger);
    font-weight: 500;
}

.cell-credit {
    color: var(--status-success);
    font-weight: 500;
}

/* Running balance — positive / negative */
.cell-balance-pos,
.cell-balance-neg {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.cell-balance-pos { color: var(--text-primary); }
.cell-balance-neg { color: var(--status-danger); }

/* Totals / summary row */
.data-table tr.row-total td {
    font-weight: 700;
    border-top: 2px solid var(--border-strong);
    border-bottom: none;
    background: var(--surface-bg);
}

/* Double underline on final total (accounting convention) */
.data-table tr.row-grand-total td {
    font-weight: 700;
    font-family: var(--font-display);
    border-top: 3px double var(--border-strong);
    border-bottom: none;
    background: var(--surface-bg);
}

/* Sticky header for long tables */
.table-scroll {
    overflow-y: auto; /*scroll*/
    overflow-x: auto;
    display: flex;
    /*    flex: 1;*/
    max-height: 100%;
    min-height: 0;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

    .table-scroll .data-table th {
        position: sticky;
        top: 0;
        background: var(--card-bg);
        z-index: 1;
        box-shadow: 0 1px 0 var(--border);
    }


/* ── Summary Bar ────────────────────────────────────── */
.table-summary {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

/* ── Toolbar ────────────────────────────────────────── */
.table-toolbar {
    margin-bottom: 12px;
}

.export-column-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 320px;
    overflow: auto;
}

.export-column-item {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 34px;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-bg);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
}

.export-column-item:hover {
    border-color: var(--border-strong);
    color: var(--text-primary);
}

.export-column-item input {
    flex-shrink: 0;
}


/* ── Reference pill ─────────────────────────────────── */
.ref-pill {
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--surface-bg);
    padding: 2px 8px;
    border-radius: 4px;
    white-space: nowrap;
}

/* ── Empty State ────────────────────────────────────── */
.table-view-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--text-muted);
}

.table-view-empty-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--surface-bg);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.table-view-empty-title {
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 700;
    color: var(--text-secondary);
}

.table-view-empty-sub {
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
    max-width: 260px;
}




/* Year group headers stick just below thead */
.ad-year-row td {
    position: sticky;
    top: 38px; /* match your th height */
    z-index: 2;
    box-shadow: 0 2px 0 var(--border);
}

/* ── Left Panel ─────────────────────────────────────── */

.ad-left-header {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.ad-account-list {
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
}

    .ad-account-list::-webkit-scrollbar {
        width: 4px;
    }

    .ad-account-list::-webkit-scrollbar-thumb {
        background: var(--border-strong);
        border-radius: 2px;
    }

/* ── Group Header ───────────────────────────────────── */
.ad-group-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    background: var(--surface-bg);
    transition: background var(--transition-fast);
    position: sticky;
    top: 0;
    z-index: 1;
}

    .ad-group-header:hover {
        /*        background: var(--border);*/
    }

.ad-group-name {
    flex: 1;
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ad-group-count {
    font-size: 11px;
    font-weight: 600;
    font-family: var(--font-display);
    color: var(--text-muted);
    background: var(--border);
    padding: 1px 7px;
    border-radius: 20px;
    flex-shrink: 0;
}

/* ── Account Items ──────────────────────────────────── */
.ad-account-item {
    padding: 0 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition-fast);
}

    .ad-account-item:hover {
        background: var(--surface-bg);
    }

    .ad-account-item.selected {
        background: var(--accent-glow);
        border-left: 3px solid var(--accent-primary);
    }

        .ad-account-item.selected .ad-account-name {
            color: var(--accent-primary);
            font-weight: 500;
        }

        .ad-account-item.selected .ad-account-code {
            color: var(--accent-primary);
            opacity: 0.7;
        }

.ad-account-item-inner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 0;
}

.ad-account-code {
    min-width: 60px;
    max-width: 60px;
    font-size: 11px;
    font-family: var(--font-display);
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
    text-wrap: auto;
    flex-shrink: 0;
    text-overflow: ellipsis;
}

.ad-account-name {
    font-size: 13px;
    color: var(--text-primary);
    white-space: nowrap;
    text-wrap: auto;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Right Panel ────────────────────────────────────── */
.ad-right {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--card-shadow);
}


/* ── Financial Reports ──────────────────────────────────
   ──────────────────────────────────────────────────────── */

.fr-table {
/*    table-layout: fixed;*/
    width: 100%;
}

.fr-name-col {
    min-width: 200px;
}

.fr-val-col {
    width: 120px;
}

/* ── Row level typography ───────────────────────────────── */
.fr-row {
    transition: background var(--transition-fast);
}

    .fr-row:hover td {
/*        background: var(--surface-bg) !important;*/
    }

.fr-level-1 td {
    background: var(--surface-bg);
    border-top: 2px solid var(--border-strong);
/*    position: sticky;
    top: 0;*/
    z-index: 2;
}

.fr-level-1 .fr-name,
.nl-name-level-1 {
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-primary);
}

.fr-level-2 .fr-name {
    font-weight: 700;
    font-size: 11px;
    color: var(--text-primary);
}

.fr-level-3 .fr-name {
    font-weight: 600;
    font-size: 11px;
    color: var(--text-primary);
}

.fr-level-4 .fr-name {
    font-weight: 500;
    font-size: 11px;
    color: var(--text-secondary);
}

.fr-level-5 .fr-name,
.fr-level-6 .fr-name {
    font-weight: 400;
    font-size: 11px;
    color: var(--text-secondary);
}

/* Subtotal rows (typically highest level numbers) */
.fr-level-8 td,
.fr-level-9 td,
.fr-level-10 td {
    font-weight: 700;
    border-top: 1px solid var(--border-strong);
    background: var(--surface-bg);
}

/* ── Value cells ─────────────────────────────────────────── */
.fr-val {
    font-variant-numeric: tabular-nums;
    font-size: 11px;
    color: var(--text-primary);
}

.fr-prior {
    color: var(--text-secondary) !important;
}

.fr-total {
    font-weight: 700;
    color: var(--text-primary) !important;
    border-left: 1px solid var(--border);
}

/* ── Scroll container ────────────────────────────────────── */
.fr-scroll {
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
}



.flag-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px 0 12px;
    scrollbar-width: none;
}

    .flag-list::-webkit-scrollbar {
        display: none;
    }

.flag-group-label {
    font-family: var(--font-display);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.10em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 14px 16px 4px;
}

.flag-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 16px;
    font-size: 13px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: background var(--transition-fast), color var(--transition-fast);
    border-left: 3px solid transparent;
    cursor: default;
}

    .flag-item:hover {
        background: var(--surface-bg);
        color: var(--text-primary);
    }

    .flag-item.active {
        background: var(--accent-glow);
        color: var(--accent-primary);
        font-weight: 600;
        border-left-color: var(--accent-primary);
    }

.flag-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--border-strong);
    flex-shrink: 0;
}

.flag-item.active .flag-dot {
    background: var(--accent-primary);
}






.nl-prior {
    color: var(--text-secondary) !important;
}

.nl-table {
    table-layout: fixed;
}

.nl-name-col {
    min-width: 220px;
}

/* ── Row base ───────────────────────────────────────── */
.nl-branch {
    cursor: pointer;
}

.nl-leaf {
    cursor: default;
}

/* Level 1 roots — section divider */
.nl-level-1 > td {
    border-top: 2px solid var(--border-strong) !important;
    /*    background: var(--surface-bg);*/
}

/* ── Name typography by level ───────────────────────── */

.nl-name-level-2 {
    font-weight: 700;
    font-size: 11px;
    color: var(--text-primary);
}

.nl-name-level-3 {
    font-weight: 600;
    font-size: 11px;
    color: var(--text-primary);
}

.nl-name-level-4,
.nl-leaf .nl-name {
    font-weight: 400;
    font-size: 11px;
    color: var(--text-secondary);
}

/* ── Name cell ──────────────────────────────────────── */
.nl-name-cell {
    padding: 0 !important;
}

.nl-name-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 9px;
    padding-bottom: 9px;
    padding-right: 16px;
}

/* ── Leaf dot ───────────────────────────────────────── */
.nl-leaf-dot {
    width: 13px;
    min-width: 13px;
    height: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

    .nl-leaf-dot::after {
        content: '';
        width: 4px;
        height: 4px;
        border-radius: 50%;
        background: var(--border-strong);
        display: block;
    }

/* ── Account code ───────────────────────────────────── */
.nl-code {
    font-size: 11px;
    font-family: var(--font-display);
    color: var(--text-muted);
    background: var(--surface-bg);
    padding: 1px 7px;
    border-radius: 4px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── Balance cells ──────────────────────────────────── */
.nl-bal {
    font-variant-numeric: tabular-nums;
    font-size: 11px;
}

/* ── Hover-reveal button (opacity toggle on parent hover) */
.reveal-btn {
    opacity: 0;
    transition: opacity var(--transition-fast);
}
