/* Xero Dashboard Styles */

/* Reset & Base */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f1f5f9;
    color: #1e293b;
    line-height: 1.5;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.header h1 {
    font-size: 24px;
    font-weight: 700;
    color: #0f172a;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* Freshness indicator */
.freshness-indicator {
    font-size: 12px;
    color: #64748b;
    background: #f8fafc;
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.freshness-fresh { color: #16a34a; border-color: #bbf7d0; background: #f0fdf4; }
.freshness-stale { color: #d97706; border-color: #fde68a; background: #fffbeb; }
.freshness-old { color: #dc2626; border-color: #fecaca; background: #fef2f2; }
.freshness-none { color: #94a3b8; }

.freshness-refresh-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid currentColor;
    border-radius: 4px;
    color: inherit;
    font-size: 13px;
    width: 22px;
    height: 22px;
    padding: 0;
    margin-left: 6px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.15s, transform 0.15s;
    vertical-align: middle;
    line-height: 1;
}

.freshness-refresh-btn:hover {
    opacity: 1;
    transform: rotate(45deg);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: #13b5ea;
    color: white;
}
.btn-primary:hover {
    background: #0ea5e0;
}

.btn-secondary {
    background: #e2e8f0;
    color: #475569;
}
.btn-secondary:hover {
    background: #cbd5e1;
}

/* Tab Navigation */
.tab-nav {
    display: flex;
    gap: 2px;
    background: #e2e8f0;
    border-radius: 8px;
    padding: 3px;
    margin-bottom: 20px;
    overflow-x: auto;
}

.tab-btn {
    flex: 1;
    padding: 10px 16px;
    border: none;
    background: transparent;
    color: #64748b;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.15s;
    white-space: nowrap;
    min-width: 100px;
    text-align: center;
}

.tab-btn:hover {
    color: #1e293b;
    background: rgba(255,255,255,0.5);
}

.tab-btn.active {
    background: white;
    color: #13b5ea;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.tab-separator {
    width: 1px;
    background: #cbd5e1;
    margin: 6px 4px;
    flex-shrink: 0;
}

.tab-link {
    text-decoration: none;
    color: #64748b;
}

.tab-nav + .sub-tab-nav { margin-top: -16px; }
.sub-tab-nav {
    display: flex;
    gap: 2px;
    background: #f1f5f9;
    border-radius: 8px;
    padding: 3px;
    margin-bottom: 20px;
    margin-left: 24px;
    overflow-x: auto;
}
.sub-tab-nav .tab-btn {
    flex: 0;
    padding: 8px 16px;
    font-size: 13px;
    min-width: auto;
}

.tab-content {
    display: none;
}
.tab-content.active {
    display: block;
}

/* KPI Cards */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.kpi-label {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.kpi-value {
    font-size: 28px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
}

.kpi-value.positive { color: #16a34a; }
.kpi-value.negative { color: #dc2626; }

.kpi-sub {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 4px;
}

.kpi-trend {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    margin-top: 6px;
}

.kpi-trend.up { color: #16a34a; background: #f0fdf4; }
.kpi-trend.down { color: #dc2626; background: #fef2f2; }
.kpi-trend.flat { color: #64748b; background: #f8fafc; }

/* Primary KPI Grid (sortable) */
.kpi-grid-primary {
    grid-template-columns: repeat(4, 1fr);
}

.kpi-card-primary {
    position: relative;
}

.kpi-drag-handle {
    position: absolute;
    top: 10px;
    right: 10px;
    cursor: grab;
    color: #94a3b8;
    font-size: 16px;
    padding: 2px 4px;
    user-select: none;
    opacity: 0;
    transition: opacity 0.15s;
    line-height: 1;
}

.kpi-card-primary:hover .kpi-drag-handle {
    opacity: 0.6;
}

.kpi-drag-handle:hover {
    opacity: 1 !important;
}

.kpi-drag-handle:active {
    cursor: grabbing;
}

.kpi-card-ghost {
    opacity: 0.4;
    background: #dbeafe !important;
}

.kpi-card-chosen {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    background: #f0f9ff !important;
}

.kpi-card-drag {
    opacity: 0.9;
}

/* KPI Sparkline */
.kpi-sparkline {
    height: 40px;
    width: 100%;
    margin-top: 8px;
}

.kpi-sparkline canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Bank Accounts Section */
.bank-accounts-section {
    margin-bottom: 24px;
    background: white;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
}

.bank-header {
    padding: 14px 20px;
    border-bottom: 1px solid #e2e8f0;
}

.bank-section-title {
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
    margin: 0;
}

.bank-list {
    display: flex;
    flex-direction: column;
}

a.bank-row {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.bank-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.1s;
}

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

.bank-row:hover {
    background: #f8fafc;
}

.bank-row-total {
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
}

.bank-row-total .bank-name {
    color: #0f172a;
    font-weight: 700;
    font-size: 14px;
}

.bank-row-total .bank-balance {
    font-size: 20px;
    font-weight: 700;
}

.bank-row-negative .bank-balance {
    color: #dc2626;
}

.bank-row-archived {
    opacity: 0.55;
}

.bank-row-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.bank-name {
    font-size: 14px;
    font-weight: 500;
    color: #1a6fb5;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bank-acct-num {
    font-size: 11px;
    color: #94a3b8;
    font-family: 'SF Mono', SFMono-Regular, Consolas, monospace;
    white-space: nowrap;
    flex-shrink: 0;
}

.bank-row-right {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
    margin-left: 16px;
}

.bank-balance {
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    text-align: right;
    min-width: 100px;
}

.bank-balance.negative {
    color: #dc2626;
}

.bank-unrecon {
    font-size: 12px;
    color: #d97706;
    white-space: nowrap;
    min-width: 100px;
    text-align: right;
}

.bank-reconciled {
    font-size: 12px;
    color: #16a34a;
    white-space: nowrap;
    min-width: 100px;
    text-align: right;
}

/* Bank drag handle */
.bank-drag-handle {
    cursor: grab;
    color: #94a3b8;
    font-size: 18px;
    padding: 0 6px;
    flex-shrink: 0;
    user-select: none;
    opacity: 0.4;
    transition: opacity 0.15s;
    line-height: 1;
}

.bank-row:hover .bank-drag-handle {
    opacity: 0.8;
}

.bank-drag-handle:active {
    cursor: grabbing;
}

.bank-row-ghost {
    opacity: 0.4;
    background: #dbeafe !important;
}

.bank-row-chosen {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    background: #f0f9ff !important;
}

.bank-row-drag {
    opacity: 0.9;
}

@media (max-width: 600px) {
    .bank-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        padding: 12px 16px;
    }
    .bank-row-left {
        flex-wrap: wrap;
    }
    .bank-row-right {
        margin-left: 0;
        width: 100%;
        justify-content: space-between;
    }
    .bank-drag-handle {
        position: absolute;
        right: 8px;
        top: 50%;
        transform: translateY(-50%);
    }
    .bank-row {
        position: relative;
    }
}

/* Charts */
.chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.chart-container {
    background: white;
    border-radius: 10px;
    padding: 20px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.chart-container h3 {
    font-size: 15px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 16px;
}

.chart-placeholder {
    text-align: center;
    padding: 40px;
    color: #94a3b8;
    font-size: 14px;
}

/* DataTables wrapper */
.table-container {
    background: white;
    border-radius: 10px;
    padding: 20px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    overflow-x: auto;
}

.table-filters {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.table-filters input,
.table-filters select {
    padding: 7px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 13px;
    background: white;
    color: #1e293b;
}

.table-filters input:focus,
.table-filters select:focus {
    outline: none;
    border-color: #13b5ea;
    box-shadow: 0 0 0 3px rgba(19, 181, 234, 0.1);
}

/* Status filter badges */
.status-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.status-badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.15s;
}

.status-badge:hover {
    opacity: 0.8;
}

.status-badge.active {
    border-color: #0f172a;
}

.status-badge-all { background: #f1f5f9; color: #475569; }
.status-badge-DRAFT { background: #f1f5f9; color: #64748b; }
.status-badge-SUBMITTED { background: #dbeafe; color: #1d4ed8; }
.status-badge-AUTHORISED { background: #fef3c7; color: #b45309; }
.status-badge-PAID { background: #dcfce7; color: #16a34a; }
.status-badge-VOIDED { background: #fecaca; color: #dc2626; }
.status-badge-DELETED { background: #f1f5f9; color: #94a3b8; }

/* Xero-styled DataTable */
table.dataTable {
    width: 100% !important;
    border-collapse: collapse;
}

table.dataTable thead th {
    background: #f8fafc;
    color: #475569;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 12px 16px;
    border-bottom: 2px solid #e2e8f0;
    text-align: left;
}

table.dataTable tbody td {
    padding: 12px 16px;
    font-size: 13px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

table.dataTable tbody tr:hover {
    background: #f8fafc;
}

/* Invoice status badges in table */
.inv-status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.inv-status-DRAFT { background: #f1f5f9; color: #64748b; }
.inv-status-SUBMITTED { background: #dbeafe; color: #1d4ed8; }
.inv-status-AUTHORISED { background: #fef3c7; color: #b45309; }
.inv-status-PAID { background: #dcfce7; color: #16a34a; }
.inv-status-VOIDED { background: #fee2e2; color: #dc2626; }
.inv-status-DELETED { background: #f1f5f9; color: #94a3b8; }

.amount-cell {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-family: 'SF Mono', 'Consolas', 'Menlo', monospace;
    font-size: 13px;
}

.amount-overdue {
    color: #dc2626;
    font-weight: 600;
}

/* Reports tab */
.report-toggle {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.report-toggle .btn.active {
    background: #13b5ea;
    color: white;
}

.report-table-wrap {
    background: white;
    border-radius: 10px;
    padding: 20px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    overflow-x: auto;
}

.report-table {
    width: 100%;
    border-collapse: collapse;
}

.report-table th,
.report-table td {
    padding: 10px 16px;
    text-align: left;
    border-bottom: 1px solid #f1f5f9;
    font-size: 13px;
}

.report-table th {
    background: #f8fafc;
    font-weight: 600;
    color: #475569;
}

.report-row-header td {
    font-weight: 700;
    color: #0f172a;
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
}

.report-row-section td {
    font-weight: 600;
    color: #334155;
    padding-top: 16px;
}

.report-row-summary td {
    font-weight: 700;
    border-top: 2px solid #e2e8f0;
    color: #0f172a;
}

.report-amount {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-family: 'SF Mono', 'Consolas', 'Menlo', monospace;
}

/* Refresh overlay */
.refresh-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.refresh-overlay.active {
    display: flex;
}

.refresh-box {
    background: white;
    border-radius: 12px;
    padding: 30px 40px;
    text-align: center;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.refresh-box h3 {
    font-size: 18px;
    color: #0f172a;
    margin-bottom: 16px;
}

.refresh-progress-bar {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.refresh-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #13b5ea, #38bdf8);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.refresh-step {
    font-size: 13px;
    color: #64748b;
    margin-bottom: 8px;
}

.refresh-elapsed {
    font-size: 12px;
    color: #94a3b8;
}

/* Confirmation overlay */
.confirm-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.confirm-overlay.active {
    display: flex;
}

.confirm-box {
    background: white;
    border-radius: 12px;
    padding: 30px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.confirm-box p {
    font-size: 15px;
    color: #334155;
    margin-bottom: 20px;
}

.confirm-box .btn {
    margin: 0 6px;
}

/* Loading spinner */
.loading {
    text-align: center;
    padding: 60px 20px;
    color: #94a3b8;
}

.loading-spinner {
    display: inline-block;
    width: 32px;
    height: 32px;
    border: 3px solid #e2e8f0;
    border-top-color: #13b5ea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 12px;
}

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

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #94a3b8;
}

.empty-state p {
    font-size: 15px;
    margin-bottom: 16px;
}

/* Reconciliation */
.recon-account-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.recon-account-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    cursor: pointer;
    transition: all 0.15s;
}

.recon-account-card:hover {
    border-color: #13b5ea;
    box-shadow: 0 2px 8px rgba(19, 181, 234, 0.15);
}

.recon-account-card.active {
    border-color: #13b5ea;
    box-shadow: 0 0 0 2px rgba(19, 181, 234, 0.3);
}

.recon-account-name {
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 2px;
}

.recon-account-code {
    font-size: 11px;
    color: #94a3b8;
    margin-bottom: 8px;
}

.recon-percentage {
    font-size: 32px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
    margin-bottom: 8px;
}

.recon-progress-bar {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.recon-progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.recon-bar-good { background: #22c55e; }
.recon-bar-ok { background: #f59e0b; }
.recon-bar-bad { background: #ef4444; }

.recon-account-stats {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #64748b;
    margin-bottom: 4px;
}

.recon-account-amount {
    font-size: 12px;
    color: #dc2626;
    font-weight: 600;
    margin-top: 4px;
}

.recon-account-oldest {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 2px;
}

.recon-type {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.recon-type-receive { background: #dcfce7; color: #16a34a; }
.recon-type-spend { background: #fee2e2; color: #dc2626; }

/* Recurring */
.kpi-card-mrr {
    border-left: 4px solid #14b8a6;
}

.recurring-section-title {
    font-size: 17px;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 4px;
}

/* Month tab bar */
.recurring-month-tabs {
    display: flex;
    gap: 6px;
    padding: 8px 4px;
    margin-bottom: 20px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.recurring-month-tabs::-webkit-scrollbar {
    height: 4px;
}

.recurring-month-tabs::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 2px;
}

.recurring-month-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 10px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    background: white;
    cursor: pointer;
    transition: all 0.15s;
    min-width: 90px;
    flex-shrink: 0;
}

.recurring-month-tab:hover {
    border-color: #14b8a6;
    background: #f0fdfa;
}

.recurring-month-tab.active {
    border-color: #14b8a6;
    background: #f0fdfa;
    box-shadow: 0 0 0 1px #14b8a6;
}

.recurring-month-tab-label {
    font-size: 13px;
    font-weight: 600;
    color: #334155;
}

.recurring-month-tab-amount {
    font-size: 12px;
    font-weight: 500;
    color: #64748b;
    font-variant-numeric: tabular-nums;
}

.recurring-month-tab.active .recurring-month-tab-label {
    color: #0d9488;
}

.recurring-month-tab.active .recurring-month-tab-amount {
    color: #0d9488;
    font-weight: 600;
}

/* Month summary */
.recurring-month-summary {
    background: white;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.recurring-month-stats {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.recurring-month-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.recurring-stat-label {
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.recurring-stat-value {
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
    font-variant-numeric: tabular-nums;
}

.recurring-stat-value.positive { color: #16a34a; }
.recurring-stat-value.negative { color: #dc2626; }

/* Type badges */
.recurring-type-revenue { background: #dcfce7; color: #16a34a; }
.recurring-type-expense { background: #fee2e2; color: #dc2626; }

.recurring-type-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* Payroll Summary */
.payroll-summary {
    margin-bottom: 24px;
}

.payroll-summary-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.payroll-summary-link {
    font-size: 13px;
    font-weight: 500;
    color: #13b5ea;
    text-decoration: none;
    white-space: nowrap;
}

.payroll-summary-link:hover {
    text-decoration: underline;
}

.payroll-summary-chart {
    margin-top: 16px;
}

/* Business Summary */
.business-summary {
    margin-top: 24px;
    margin-bottom: 24px;
}

.summary-section-title {
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
    margin: 0 0 12px 0;
}

.fy-comparison {
    margin-bottom: 20px;
}

.fy-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.fy-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.fy-label {
    font-size: 13px;
    font-weight: 700;
    color: #13b5ea;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.fy-revenue {
    font-size: 24px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
    margin-bottom: 6px;
}

.fy-detail {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 2px;
}

.fy-yoy {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    margin-top: 8px;
}

.fy-yoy.positive { color: #16a34a; background: #f0fdf4; }
.fy-yoy.negative { color: #dc2626; background: #fef2f2; }

.annual-chart-container {
    margin-bottom: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .container { padding: 12px; }
    .header h1 { font-size: 18px; }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .kpi-grid-primary { grid-template-columns: repeat(2, 1fr); }
    .kpi-value { font-size: 22px; }
    .kpi-drag-handle { opacity: 0.4; }
    .kpi-sparkline { height: 32px; }
    .chart-grid { grid-template-columns: 1fr; }
    .tab-btn { padding: 8px 10px; font-size: 12px; min-width: 70px; }
    .recon-account-cards { grid-template-columns: repeat(2, 1fr); }
    .recon-percentage { font-size: 24px; }
    .recurring-month-tabs { gap: 4px; }
    .recurring-month-tab { min-width: 76px; padding: 8px 10px; }
    .recurring-month-tab-label { font-size: 12px; }
    .recurring-month-tab-amount { font-size: 11px; }
    .recurring-month-stats { gap: 16px; }
    .recurring-stat-value { font-size: 16px; }
    .fy-cards { grid-template-columns: 1fr; }
    .fy-revenue { font-size: 20px; }
}

@media (max-width: 480px) {
    .kpi-grid { grid-template-columns: 1fr; }
    .kpi-grid-primary { grid-template-columns: 1fr; }
    .header { flex-direction: column; align-items: flex-start; }
    .recon-account-cards { grid-template-columns: 1fr; }
}

/* ========================================
   Dark Mode - [data-theme="dark"]
   ======================================== */

[data-theme="dark"] body {
    background: #0f172a;
    color: #e2e8f0;
}

[data-theme="dark"] .header h1 {
    color: #f1f5f9;
}

[data-theme="dark"] .freshness-indicator {
    background: #1e293b;
    border-color: #334155;
    color: #94a3b8;
}

[data-theme="dark"] .freshness-fresh { color: #4ade80; border-color: #166534; background: #14532d33; }
[data-theme="dark"] .freshness-stale { color: #fbbf24; border-color: #92400e; background: #78350f33; }
[data-theme="dark"] .freshness-old { color: #f87171; border-color: #991b1b; background: #7f1d1d33; }

[data-theme="dark"] .freshness-refresh-btn {
    border-color: currentColor;
}

[data-theme="dark"] .btn-primary {
    background: #38bdf8;
    color: #0c4a6e;
}
[data-theme="dark"] .btn-primary:hover {
    background: #7dd3fc;
}

[data-theme="dark"] .btn-secondary {
    background: #334155;
    color: #cbd5e1;
}
[data-theme="dark"] .btn-secondary:hover {
    background: #475569;
}

/* Tabs dark */
[data-theme="dark"] .tab-nav {
    background: #1e293b;
}

[data-theme="dark"] .tab-btn {
    color: #94a3b8;
}

[data-theme="dark"] .tab-btn:hover {
    color: #e2e8f0;
    background: rgba(255,255,255,0.05);
}

[data-theme="dark"] .tab-btn.active {
    background: #334155;
    color: #38bdf8;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

[data-theme="dark"] .tab-separator {
    background: #475569;
}

[data-theme="dark"] .tab-link {
    color: #94a3b8;
}

[data-theme="dark"] .sub-tab-nav {
    background: #0f172a;
}

/* KPI cards dark */
[data-theme="dark"] .kpi-card {
    background: #1e293b;
    border-color: #334155;
}

[data-theme="dark"] .kpi-label {
    color: #94a3b8;
}

[data-theme="dark"] .kpi-value {
    color: #f1f5f9;
}

[data-theme="dark"] .kpi-value.positive { color: #4ade80; }
[data-theme="dark"] .kpi-value.negative { color: #f87171; }

[data-theme="dark"] .kpi-sub {
    color: #64748b;
}

[data-theme="dark"] .kpi-trend.up { color: #4ade80; background: #14532d44; }
[data-theme="dark"] .kpi-trend.down { color: #f87171; background: #7f1d1d44; }
[data-theme="dark"] .kpi-trend.flat { color: #94a3b8; background: #1e293b; }

[data-theme="dark"] .kpi-drag-handle {
    color: #64748b;
}

[data-theme="dark"] .kpi-card-ghost {
    background: #1e3a5f !important;
}

[data-theme="dark"] .kpi-card-chosen {
    background: #253348 !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

/* Bank accounts dark */
[data-theme="dark"] .bank-accounts-section {
    background: #1e293b;
    border-color: #334155;
}

[data-theme="dark"] .bank-header {
    border-color: #334155;
}

[data-theme="dark"] .bank-section-title {
    color: #f1f5f9;
}

[data-theme="dark"] a.bank-row {
    color: inherit;
}

[data-theme="dark"] .bank-row {
    border-color: #293548;
}

[data-theme="dark"] .bank-row:hover {
    background: #253348;
}

[data-theme="dark"] .bank-row-total {
    background: #253348;
    border-color: #334155;
}

[data-theme="dark"] .bank-name {
    color: #5eaed5;
}

[data-theme="dark"] .bank-row-total .bank-name {
    color: #f1f5f9;
}

[data-theme="dark"] .bank-balance {
    color: #f1f5f9;
}

[data-theme="dark"] .bank-balance.negative {
    color: #f87171;
}

[data-theme="dark"] .bank-acct-num {
    color: #64748b;
}

[data-theme="dark"] .bank-unrecon {
    color: #fbbf24;
}

[data-theme="dark"] .bank-reconciled {
    color: #4ade80;
}

[data-theme="dark"] .bank-unrecon {
    color: #fbbf24;
    background: #78350f33;
}

[data-theme="dark"] .bank-drag-handle {
    color: #64748b;
}

[data-theme="dark"] .bank-row-ghost {
    background: #1e3a5f !important;
}

[data-theme="dark"] .bank-row-chosen {
    background: #253348 !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

/* Charts dark */
[data-theme="dark"] .chart-container {
    background: #1e293b;
    border-color: #334155;
}

[data-theme="dark"] .chart-container h3 {
    color: #e2e8f0;
}

[data-theme="dark"] .chart-placeholder {
    color: #64748b;
}

/* Tables dark */
[data-theme="dark"] .table-container {
    background: #1e293b;
    border-color: #334155;
}

[data-theme="dark"] .table-filters input,
[data-theme="dark"] .table-filters select {
    background: #0f172a;
    border-color: #334155;
    color: #e2e8f0;
}

[data-theme="dark"] .table-filters input:focus,
[data-theme="dark"] .table-filters select:focus {
    border-color: #38bdf8;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}

[data-theme="dark"] table.dataTable thead th {
    background: #0f172a;
    color: #94a3b8;
    border-bottom-color: #334155;
}

[data-theme="dark"] table.dataTable tbody td {
    border-bottom-color: #1e293b;
    color: #e2e8f0;
}

[data-theme="dark"] table.dataTable tbody tr:hover {
    background: #334155;
}

/* Status badges dark */
[data-theme="dark"] .status-badge-all { background: #334155; color: #94a3b8; }
[data-theme="dark"] .status-badge-DRAFT { background: #334155; color: #94a3b8; }
[data-theme="dark"] .status-badge-SUBMITTED { background: #1e3a5f; color: #60a5fa; }
[data-theme="dark"] .status-badge-AUTHORISED { background: #451a03; color: #fbbf24; }
[data-theme="dark"] .status-badge-PAID { background: #14532d; color: #4ade80; }
[data-theme="dark"] .status-badge-VOIDED { background: #7f1d1d; color: #f87171; }

[data-theme="dark"] .status-badge.active {
    border-color: #f1f5f9;
}

[data-theme="dark"] .inv-status-DRAFT { background: #334155; color: #94a3b8; }
[data-theme="dark"] .inv-status-SUBMITTED { background: #1e3a5f; color: #60a5fa; }
[data-theme="dark"] .inv-status-AUTHORISED { background: #451a03; color: #fbbf24; }
[data-theme="dark"] .inv-status-PAID { background: #14532d; color: #4ade80; }
[data-theme="dark"] .inv-status-VOIDED { background: #7f1d1d; color: #f87171; }
[data-theme="dark"] .inv-status-DELETED { background: #334155; color: #64748b; }

/* Reports dark */
[data-theme="dark"] .report-table-wrap {
    background: #1e293b;
    border-color: #334155;
}

[data-theme="dark"] .report-table th {
    background: #0f172a;
    color: #94a3b8;
}

[data-theme="dark"] .report-table td {
    border-bottom-color: #334155;
    color: #e2e8f0;
}

[data-theme="dark"] .report-row-header td {
    background: #0f172a;
    color: #f1f5f9;
    border-bottom-color: #334155;
}

[data-theme="dark"] .report-row-section td {
    color: #e2e8f0;
}

[data-theme="dark"] .report-row-summary td {
    border-top-color: #334155;
    color: #f1f5f9;
}

/* Refresh overlay dark */
[data-theme="dark"] .refresh-box {
    background: #1e293b;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}

[data-theme="dark"] .refresh-box h3 {
    color: #f1f5f9;
}

[data-theme="dark"] .refresh-progress-bar {
    background: #334155;
}

[data-theme="dark"] .refresh-step {
    color: #94a3b8;
}

/* Confirm overlay dark */
[data-theme="dark"] .confirm-box {
    background: #1e293b;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}

[data-theme="dark"] .confirm-box p {
    color: #e2e8f0;
}

/* DataTables dark overrides */
[data-theme="dark"] .dataTables_wrapper .dataTables_length select,
[data-theme="dark"] .dataTables_wrapper .dataTables_filter input {
    background: #0f172a;
    border: 1px solid #334155;
    color: #e2e8f0;
    border-radius: 4px;
    padding: 4px 8px;
}

[data-theme="dark"] .dataTables_wrapper .dataTables_info {
    color: #94a3b8;
}

[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button {
    color: #94a3b8 !important;
    border: 1px solid #334155;
    background: #1e293b;
}

[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    color: #e2e8f0 !important;
    background: #334155;
    border-color: #475569;
}

[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button.current {
    color: #38bdf8 !important;
    background: #334155;
    border-color: #38bdf8;
}

[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
    color: #475569 !important;
    background: #1e293b;
}

[data-theme="dark"] .dataTables_wrapper .dataTables_length label,
[data-theme="dark"] .dataTables_wrapper .dataTables_filter label {
    color: #94a3b8;
}

/* Report toggle buttons dark */
[data-theme="dark"] .report-toggle .btn {
    background: #334155;
    color: #94a3b8;
}

[data-theme="dark"] .report-toggle .btn:hover {
    background: #475569;
    color: #e2e8f0;
}

[data-theme="dark"] .report-toggle .btn.active {
    background: #38bdf8;
    color: #0c4a6e;
}

/* Loading / empty dark */
[data-theme="dark"] .loading {
    color: #64748b;
}

[data-theme="dark"] .loading-spinner {
    border-color: #334155;
    border-top-color: #38bdf8;
}

[data-theme="dark"] .empty-state {
    color: #64748b;
}

/* Reconciliation dark */
[data-theme="dark"] .recon-account-card {
    background: #1e293b;
    border-color: #334155;
}

[data-theme="dark"] .recon-account-card:hover {
    border-color: #38bdf8;
    box-shadow: 0 2px 8px rgba(56, 189, 248, 0.15);
}

[data-theme="dark"] .recon-account-card.active {
    border-color: #38bdf8;
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.3);
}

[data-theme="dark"] .recon-account-name {
    color: #f1f5f9;
}

[data-theme="dark"] .recon-account-code {
    color: #64748b;
}

[data-theme="dark"] .recon-percentage {
    color: #f1f5f9;
}

[data-theme="dark"] .recon-progress-bar {
    background: #334155;
}

[data-theme="dark"] .recon-account-stats {
    color: #94a3b8;
}

[data-theme="dark"] .recon-account-amount {
    color: #f87171;
}

[data-theme="dark"] .recon-account-oldest {
    color: #64748b;
}

[data-theme="dark"] .recon-type-receive { background: #14532d; color: #4ade80; }
[data-theme="dark"] .recon-type-spend { background: #7f1d1d; color: #f87171; }

/* Recurring dark */
[data-theme="dark"] .kpi-card-mrr {
    border-left-color: #2dd4bf;
}

[data-theme="dark"] .recurring-section-title {
    color: #f1f5f9;
}

[data-theme="dark"] .recurring-month-tabs::-webkit-scrollbar-thumb {
    background: #475569;
}

[data-theme="dark"] .recurring-month-tab {
    background: #1e293b;
    border-color: #334155;
}

[data-theme="dark"] .recurring-month-tab:hover {
    border-color: #2dd4bf;
    background: #1a2e3b;
}

[data-theme="dark"] .recurring-month-tab.active {
    border-color: #2dd4bf;
    background: #1a2e3b;
    box-shadow: 0 0 0 1px #2dd4bf;
}

[data-theme="dark"] .recurring-month-tab-label {
    color: #e2e8f0;
}

[data-theme="dark"] .recurring-month-tab-amount {
    color: #94a3b8;
}

[data-theme="dark"] .recurring-month-tab.active .recurring-month-tab-label {
    color: #2dd4bf;
}

[data-theme="dark"] .recurring-month-tab.active .recurring-month-tab-amount {
    color: #2dd4bf;
}

[data-theme="dark"] .recurring-month-summary {
    background: #1e293b;
    border-color: #334155;
}

[data-theme="dark"] .recurring-stat-label {
    color: #94a3b8;
}

[data-theme="dark"] .recurring-stat-value {
    color: #f1f5f9;
}

[data-theme="dark"] .recurring-stat-value.positive { color: #4ade80; }
[data-theme="dark"] .recurring-stat-value.negative { color: #f87171; }

[data-theme="dark"] .recurring-type-revenue { background: #14532d; color: #4ade80; }
[data-theme="dark"] .recurring-type-expense { background: #7f1d1d; color: #f87171; }

/* Payroll Summary dark */
[data-theme="dark"] .payroll-summary-link {
    color: #38bdf8;
}

/* Business Summary dark */
[data-theme="dark"] .summary-section-title {
    color: #f1f5f9;
}

[data-theme="dark"] .fy-card {
    background: #1e293b;
    border-color: #334155;
}

[data-theme="dark"] .fy-label {
    color: #38bdf8;
}

[data-theme="dark"] .fy-revenue {
    color: #f1f5f9;
}

[data-theme="dark"] .fy-detail {
    color: #94a3b8;
}

[data-theme="dark"] .fy-yoy.positive { color: #4ade80; background: #14532d44; }
[data-theme="dark"] .fy-yoy.negative { color: #f87171; background: #7f1d1d44; }

/* Chart Period Controls */
.chart-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}

.chart-header-row h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #0f172a;
}

.chart-period-control {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.chart-period-btn {
    padding: 4px 10px;
    font-size: 12px;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #64748b;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
}

.chart-period-btn:hover {
    background: #f1f5f9;
    color: #334155;
}

.chart-period-btn.active {
    background: #0ea5e9;
    color: #fff;
    border-color: #0ea5e9;
}

.chart-period-label {
    font-size: 12px;
    color: #94a3b8;
    font-weight: 400;
    margin-left: 8px;
}

/* Recurring Ongoing Badge */
.recurring-ongoing {
    color: #94a3b8;
    font-style: italic;
}

/* Refresh Banner (top of page) */
.xero-refresh-banner {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
    border-radius: 8px;
    margin: 0 0 0 0;
}

.xero-refresh-banner.xrb-visible {
    max-height: 80px;
    margin: 0 0 12px 0;
}

.xrb-inner {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    min-height: 56px;
    border-radius: 8px;
}

.xrb-icon {
    font-size: 22px;
    flex-shrink: 0;
    width: 32px;
    text-align: center;
}

.xrb-body {
    flex: 1;
    min-width: 0;
}

.xrb-title {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
}

.xrb-step {
    font-size: 13px;
    opacity: 0.85;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.xrb-progress {
    flex-shrink: 0;
    width: 180px;
}

.xrb-bar {
    height: 8px;
    background: rgba(255,255,255,0.3);
    border-radius: 4px;
    overflow: hidden;
}

.xrb-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s;
    width: 0;
    background: rgba(255,255,255,0.8);
}

.xrb-dismiss {
    flex-shrink: 0;
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    opacity: 0.6;
    padding: 4px 8px;
    line-height: 1;
    color: inherit;
}

.xrb-dismiss:hover {
    opacity: 1;
}

/* Running state - blue */
.xrb-running .xrb-inner {
    background: linear-gradient(135deg, #0369a1, #0ea5e9);
    color: white;
}

.xrb-running .xrb-icon {
    animation: xrb-spin 1.2s linear infinite;
}

@keyframes xrb-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Complete state - green */
.xrb-complete .xrb-inner {
    background: linear-gradient(135deg, #15803d, #22c55e);
    color: white;
}

.xrb-complete .xrb-fill {
    background: rgba(255,255,255,0.5);
}

/* Failed state - red */
.xrb-failed .xrb-inner {
    background: linear-gradient(135deg, #991b1b, #dc2626);
    color: white;
}

.xrb-failed .xrb-fill {
    background: rgba(255,255,255,0.3);
}

/* Responsive */
@media (max-width: 600px) {
    .xrb-progress { display: none; }
    .xrb-step { white-space: normal; }
}

/* Dark mode - Chart Period Controls */
[data-theme="dark"] .chart-header-row h3 {
    color: #f1f5f9;
}

[data-theme="dark"] .chart-period-btn {
    border-color: #475569;
    background: #1e293b;
    color: #94a3b8;
}

[data-theme="dark"] .chart-period-btn:hover {
    background: #334155;
    color: #e2e8f0;
}

[data-theme="dark"] .chart-period-btn.active {
    background: #0ea5e9;
    color: #fff;
    border-color: #0ea5e9;
}

[data-theme="dark"] .chart-period-label {
    color: #64748b;
}

/* Dark mode - Recurring Ongoing */
[data-theme="dark"] .recurring-ongoing {
    color: #64748b;
}

/* Dark mode - Refresh Banner */
[data-theme="dark"] .xrb-running .xrb-inner {
    background: linear-gradient(135deg, #0c4a6e, #075985);
}

[data-theme="dark"] .xrb-complete .xrb-inner {
    background: linear-gradient(135deg, #14532d, #166534);
}

[data-theme="dark"] .xrb-failed .xrb-inner {
    background: linear-gradient(135deg, #7f1d1d, #991b1b);
}
