/* NXT CashFlow: treasury grids, legends and toolbars. Plain CSS on top of the Filament panel (no Tailwind). */

.nxt-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 1rem;
    margin-bottom: 1rem;
}

.nxt-toolbar-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 12rem;
}

.nxt-toolbar-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-500);
}

.nxt-toolbar-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    padding-bottom: 0.5rem;
}

.nxt-muted {
    color: var(--gray-500);
    font-size: 0.875rem;
}

.nxt-note {
    font-size: 0.8125rem;
    color: var(--gray-600);
    margin: 0.5rem 0 0;
}

.dark .nxt-note,
.dark .nxt-muted {
    color: var(--gray-400);
}

/* Grids */

.nxt-grid-wrap {
    overflow-x: auto;
    border: 1px solid var(--gray-200);
    border-radius: 0.75rem;
    background: white;
}

.dark .nxt-grid-wrap {
    border-color: rgb(255 255 255 / 0.1);
    background: var(--gray-900);
}

.nxt-grid {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.8125rem;
    font-variant-numeric: tabular-nums;
}

.nxt-grid th,
.nxt-grid td {
    padding: 0.4rem 0.6rem;
    border-bottom: 1px solid var(--gray-100);
    white-space: nowrap;
    text-align: right;
}

.dark .nxt-grid th,
.dark .nxt-grid td {
    border-bottom-color: rgb(255 255 255 / 0.05);
}

.nxt-grid thead th {
    position: sticky;
    top: 0;
    background: var(--gray-50);
    font-weight: 600;
    color: var(--gray-600);
    z-index: 1;
}

.dark .nxt-grid thead th {
    background: var(--gray-800);
    color: var(--gray-300);
}

.nxt-grid .nxt-grid-label {
    position: sticky;
    left: 0;
    text-align: left;
    background: inherit;
    min-width: 14rem;
    z-index: 2;
}

.nxt-grid tbody tr {
    background: white;
}

.dark .nxt-grid tbody tr {
    background: var(--gray-900);
}

.nxt-grid tr.nxt-grid-section td {
    background: var(--gray-50);
    font-weight: 700;
    text-align: left;
    color: var(--gray-700);
}

.dark .nxt-grid tr.nxt-grid-section td {
    background: var(--gray-800);
    color: var(--gray-200);
}

.nxt-grid tr.nxt-grid-parent td {
    font-weight: 600;
}

.nxt-grid tr.nxt-grid-child .nxt-grid-label {
    padding-left: 1.75rem;
    color: var(--gray-600);
}

.nxt-grid tr.nxt-grid-total td {
    font-weight: 700;
    background: var(--gray-50);
}

.dark .nxt-grid tr.nxt-grid-total td {
    background: var(--gray-800);
}

.nxt-grid td.nxt-grid-year {
    font-weight: 600;
    border-left: 1px solid var(--gray-200);
}

.nxt-grid .nxt-current {
    background: color-mix(in srgb, var(--primary-500) 7%, transparent);
}

.nxt-cell {
    all: unset;
    cursor: pointer;
    display: block;
    width: 100%;
    text-align: right;
    border-radius: 0.25rem;
}

.nxt-cell:hover,
.nxt-cell:focus-visible {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
}

.nxt-cell-sub {
    display: block;
    font-size: 0.6875rem;
    color: var(--gray-500);
}

.nxt-pos {
    color: var(--success-700);
}

.nxt-neg {
    color: var(--danger-700);
}

.dark .nxt-pos {
    color: var(--success-400);
}

.dark .nxt-neg {
    color: var(--danger-400);
}

.nxt-zero {
    color: var(--gray-400);
}

/* Colour codes, always shown with a legend */

.nxt-tone-success { background: color-mix(in srgb, var(--success-500) 16%, transparent); }
.nxt-tone-warning { background: color-mix(in srgb, var(--warning-500) 20%, transparent); }
.nxt-tone-danger { background: color-mix(in srgb, var(--danger-500) 18%, transparent); }
.nxt-tone-info { background: color-mix(in srgb, var(--info-500) 14%, transparent); }
.nxt-tone-gray { background: transparent; }

.nxt-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
    margin-top: 0.75rem;
    font-size: 0.8125rem;
}

.nxt-legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.nxt-swatch {
    width: 0.9rem;
    height: 0.9rem;
    border-radius: 0.2rem;
    border: 1px solid var(--gray-300);
    flex: none;
}

/* Cash position cards */

.nxt-accounts {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
    gap: 1rem;
}

.nxt-account {
    border-radius: 0.75rem;
    padding: 1rem;
    border: 1px solid var(--gray-200);
}

.dark .nxt-account {
    border-color: rgb(255 255 255 / 0.1);
}

.nxt-account-name {
    font-weight: 600;
}

.nxt-account-balance {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0.25rem 0;
    font-variant-numeric: tabular-nums;
}

.nxt-account-meta {
    font-size: 0.75rem;
    color: var(--gray-600);
}

.dark .nxt-account-meta {
    color: var(--gray-400);
}

.nxt-stack {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.nxt-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nxt-list-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    font-size: 0.875rem;
}

.nxt-list-actions {
    display: flex;
    gap: 0.5rem;
}

/* Demo banner */

.nxt-demo-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    background: color-mix(in srgb, var(--warning-500) 15%, transparent);
    border: 1px solid color-mix(in srgb, var(--warning-500) 40%, transparent);
    font-size: 0.875rem;
}

/* Cell detail */

.nxt-detail-table {
    width: 100%;
    font-size: 0.8125rem;
    border-collapse: collapse;
    font-variant-numeric: tabular-nums;
}

.nxt-detail-table td,
.nxt-detail-table th {
    padding: 0.35rem 0.25rem;
    border-bottom: 1px solid var(--gray-100);
    text-align: left;
    vertical-align: top;
}

.dark .nxt-detail-table td,
.dark .nxt-detail-table th {
    border-bottom-color: rgb(255 255 255 / 0.06);
}

.nxt-detail-table .nxt-num {
    text-align: right;
    white-space: nowrap;
}

.nxt-sum {
    display: grid;
    grid-template-columns: auto auto;
    gap: 0.25rem 1rem;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.nxt-sum dd {
    margin: 0;
    text-align: right;
    font-variant-numeric: tabular-nums;
}
