:root {
    --green: #2e7d32;
    --green-light: #e8f5e9;
    --green-bg: #f1f8e9;
    --red: #c62828;
    --red-light: #ffebee;
    --red-bg: #fce4ec;
    --blue: #1565c0;
    --blue-light: #e3f2fd;
    --gray: #616161;
    --gray-light: #f5f5f5;
    --border: #e0e0e0;
    --shadow: 0 1px 3px rgba(0,0,0,0.12);
    --radius: 6px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f8f9fa;
    color: #333;
    line-height: 1.5;
}

.year-bar {
    background: #1a237e;
    color: white;
    padding: 10px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    flex-wrap: wrap;
}

.year-bar h1 {
    font-size: 18px;
    font-weight: 600;
    margin-right: auto;
}

.year-bar select {
    padding: 6px 12px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.year-bar button {
    padding: 6px 14px;
    border: 1px solid rgba(255,255,255,0.3);
    background: transparent;
    color: white;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
}

.year-bar button:hover { background: rgba(255,255,255,0.15); }

.year-badge {
    display: inline-block;
    background: #e8eaf6;
    color: #1a237e;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 4px;
}

.closed-badge {
    background: #fff3e0;
    color: #e65100;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
}

nav {
    background: white;
    border-bottom: 1px solid var(--border);
    display: flex;
    padding: 0 24px;
    gap: 0;
    overflow-x: auto;
}

nav button {
    padding: 12px 20px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    color: var(--gray);
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    transition: all 0.2s;
}

nav button:hover { color: #333; }
nav button.active {
    color: var(--blue);
    border-bottom-color: var(--blue);
    font-weight: 600;
}

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

.view { display: none; }
.view.active { display: block; }

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

.card {
    background: white;
    border-radius: var(--radius);
    padding: 16px 20px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--border);
}

.card.income { border-left-color: var(--green); }
.card.expense { border-left-color: var(--red); }
.card.net { border-left-color: var(--blue); }
.card.info { border-left-color: #ff9800; }

.card-label {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--gray);
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.card-value {
    font-size: 24px;
    font-weight: 700;
}

.card-value.positive { color: var(--green); }
.card-value.negative { color: var(--red); }
.card-sub { font-size: 12px; color: var(--gray); margin-top: 4px; }

.two-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.three-panel {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
}

@media (max-width: 1200px) {
    .three-panel { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 900px) {
    .two-panel { grid-template-columns: 1fr; }
    .three-panel { grid-template-columns: 1fr; }
}

.panel {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.panel-header {
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
}

.panel-header.income-header { background: var(--green-light); }
.panel-header.cogs-header { background: #fff3e0; }
.panel-header.deduction-header { background: var(--red-light); }

.panel-header h2 {
    font-size: 16px;
    font-weight: 600;
}

.panel-body { padding: 16px 20px; }

.form-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.form-row input, .form-row select {
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    flex: 1;
    min-width: 100px;
}

.form-row input:focus, .form-row select:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 2px rgba(21,101,192,0.15);
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: opacity 0.2s;
}

.btn:hover { opacity: 0.85; }
.btn-green { background: var(--green); color: white; }
.btn-red { background: var(--red); color: white; }
.btn-blue { background: var(--blue); color: white; }
.btn-cogs { background: #e65100; color: white; }
.btn-outline {
    background: white;
    border: 1px solid var(--border);
    color: #333;
}

.btn-sm { padding: 4px 10px; font-size: 12px; }

.entries-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
}

.entries-header span { font-size: 13px; color: var(--gray); }

.entry-row {
    display: flex;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f5f5f5;
    font-size: 13px;
    gap: 8px;
}

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

.entry-date { width: 85px; color: var(--gray); flex-shrink: 0; }
.entry-desc { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry-cat {
    font-size: 11px;
    background: var(--gray-light);
    padding: 2px 6px;
    border-radius: 3px;
    white-space: nowrap;
    flex-shrink: 0;
}
.entry-amount { font-weight: 600; width: 90px; text-align: right; flex-shrink: 0; }
.entry-amount.income-amount { color: var(--green); }
.entry-amount.deduction-amount { color: var(--red); }

.entry-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.entry-actions button {
    padding: 2px 6px;
    border: 1px solid var(--border);
    background: white;
    border-radius: 3px;
    cursor: pointer;
    font-size: 11px;
    color: var(--gray);
}

.entry-actions button:hover { background: var(--gray-light); }

.total-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-top: 2px solid #333;
    margin-top: 8px;
    font-weight: 700;
    font-size: 15px;
}

.pnl-section {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    overflow: hidden;
}

.pnl-section-header {
    padding: 12px 20px;
    font-weight: 600;
    font-size: 14px;
}

.pnl-section-header.income-header { background: var(--green-light); color: var(--green); }
.pnl-section-header.deduction-header { background: var(--red-light); color: var(--red); }

.pnl-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 20px;
    font-size: 13px;
    border-bottom: 1px solid #f5f5f5;
}

.pnl-cat-header {
    background: #fafafa;
    font-weight: 600;
    padding: 8px 20px;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
}

.pnl-subtotal {
    display: flex;
    justify-content: space-between;
    padding: 6px 20px;
    font-weight: 600;
    font-size: 13px;
    background: #f5f5f5;
    border-bottom: 1px solid var(--border);
}

.pnl-total {
    display: flex;
    justify-content: space-between;
    padding: 14px 20px;
    font-weight: 700;
    font-size: 16px;
    border-top: 2px solid #333;
}

.pnl-net {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    text-align: center;
    margin-bottom: 20px;
}

.pnl-net-label { font-size: 14px; color: var(--gray); margin-bottom: 4px; }
.pnl-net-value { font-size: 32px; font-weight: 700; }

.tax-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.tax-table th {
    background: #f5f5f5;
    text-align: left;
    padding: 10px 14px;
    font-weight: 600;
    border-bottom: 2px solid var(--border);
}

.tax-table td {
    padding: 8px 14px;
    border-bottom: 1px solid #f5f5f5;
}

.tax-table tr:hover { background: #fafafa; }

.tax-flag {
    color: #e65100;
    font-size: 11px;
    font-style: italic;
}

.tax-line-ref {
    color: var(--blue);
    font-weight: 500;
    font-size: 12px;
}

.monthly-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.month-card {
    background: white;
    border-radius: var(--radius);
    padding: 12px;
    box-shadow: var(--shadow);
    text-align: center;
}

.month-card h4 {
    font-size: 13px;
    color: var(--gray);
    margin-bottom: 6px;
}

.month-income { color: var(--green); font-size: 13px; }
.month-deductions { color: var(--red); font-size: 13px; }
.month-net { font-weight: 700; font-size: 14px; margin-top: 4px; }

.multi-year-bar {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    padding: 20px;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    min-height: 200px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.year-col {
    flex: 1;
    min-width: 100px;
    text-align: center;
}

.bar-group {
    display: flex;
    gap: 4px;
    justify-content: center;
    align-items: flex-end;
    height: 150px;
}

.bar {
    width: 24px;
    border-radius: 3px 3px 0 0;
    min-height: 4px;
    position: relative;
}

.bar.income-bar { background: var(--green); }
.bar.deduction-bar { background: var(--red); }
.bar-label { font-size: 11px; color: var(--gray); margin-top: 6px; }
.bar-year { font-weight: 600; font-size: 14px; margin-top: 2px; }

.quarter-filter {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.quarter-filter button {
    padding: 6px 16px;
    border: 1px solid var(--border);
    background: white;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 13px;
}

.quarter-filter button.active {
    background: var(--blue);
    color: white;
    border-color: var(--blue);
}

.comparison-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 700px) {
    .comparison-grid { grid-template-columns: 1fr; }
}

.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    align-items: center;
    justify-content: center;
}

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

.modal {
    background: white;
    border-radius: var(--radius);
    padding: 24px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.modal h3 { margin-bottom: 12px; }
.modal p { margin-bottom: 16px; color: var(--gray); font-size: 14px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }

.edit-form {
    background: #fffde7;
    border: 1px solid #fff9c4;
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 8px;
}

.edit-form .form-row { margin-bottom: 8px; }

.bs-entry-row:hover { background: #f5f5f5; }
.bs-edit-btn {
    font-size: 11px;
    padding: 2px 10px;
    cursor: pointer;
    background: #e3f2fd;
    border: 1px solid #90caf9;
    border-radius: 4px;
    color: #1565c0;
    font-weight: 500;
    margin-right: 4px;
}
.bs-edit-btn:hover { background: #bbdefb; }
.bs-del-btn {
    font-size: 11px;
    padding: 2px 10px;
    cursor: pointer;
    background: #ffebee;
    border: 1px solid #ef9a9a;
    border-radius: 4px;
    color: #c62828;
    font-weight: 500;
}
.bs-del-btn:hover { background: #ffcdd2; }

.btn-delete-cat {
    font-size: 11px;
    padding: 2px 10px;
    cursor: pointer;
    background: #ffebee;
    border: 1px solid #ef9a9a;
    border-radius: 4px;
    color: #c62828;
    font-weight: 600;
    white-space: nowrap;
    transition: background 0.15s;
}
.btn-delete-cat:hover { background: #ffcdd2; }

.category-group {
    margin-bottom: 12px;
}

.category-group-header {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--gray-light);
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
}

.category-group-header:hover { background: #eeeeee; }

.category-entries {
    padding: 4px 0 4px 12px;
}

.toggle-group {
    display: flex;
    gap: 4px;
    background: var(--gray-light);
    border-radius: var(--radius);
    padding: 2px;
}

.toggle-group button {
    padding: 4px 12px;
    border: none;
    background: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.toggle-group button.active {
    background: white;
    box-shadow: var(--shadow);
}

.export-section {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 16px;
}

@media print {
    .year-bar, nav, .form-row, .entry-actions, .btn, .quarter-filter, .export-section { display: none !important; }
    .panel, .pnl-section { box-shadow: none; break-inside: avoid; }
    body { background: white; }
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray);
}

.empty-state p { font-size: 14px; }

.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(2px);
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 560px;
    max-width: 95vw;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: modalIn 0.2s ease-out;
}

@keyframes modalIn {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(135deg, #1a237e, #283593);
    border-radius: 12px 12px 0 0;
}

.modal-header h2 {
    color: white;
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0 4px;
    opacity: 0.8;
}

.modal-close:hover { opacity: 1; }

.modal-body {
    padding: 24px;
}

.modal-section {
    margin-bottom: 20px;
}

.modal-section h3 {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #1a237e;
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 2px solid #e8eaf6;
}

.modal-field {
    margin-bottom: 12px;
}

.modal-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #555;
    margin-bottom: 4px;
}

.modal-field input,
.modal-field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.modal-field input:focus,
.modal-field textarea:focus {
    outline: none;
    border-color: #1a237e;
    box-shadow: 0 0 0 3px rgba(26,35,126,0.1);
}

.modal-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: #fafafa;
    border-radius: 0 0 12px 12px;
}

.btn-blue {
    background: linear-gradient(135deg, #1a237e, #283593);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-blue:hover {
    background: linear-gradient(135deg, #283593, #303f9f);
    box-shadow: 0 2px 8px rgba(26,35,126,0.3);
}

.settings-section {
    background: white;
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 20px;
}

.settings-section h2 {
    font-size: 18px;
    margin-bottom: 4px;
    color: #1a237e;
}

.settings-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.settings-form {
    max-width: 700px;
}

.settings-row {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
}

.settings-field {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-bottom: 12px;
}

.settings-field label {
    font-size: 12px;
    font-weight: 600;
    color: #666;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.settings-field input,
.settings-field select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    transition: border-color 0.2s;
}

.settings-field input:focus,
.settings-field select:focus {
    border-color: #1a237e;
    outline: none;
    box-shadow: 0 0 0 2px rgba(26,35,126,0.1);
}

.state-tax-info {
    background: var(--blue-light);
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--blue);
    margin-top: 8px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th {
    background: #f5f5f5;
    padding: 8px 12px;
    text-align: left;
    font-weight: 600;
    color: #555;
    border-bottom: 2px solid var(--border);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #f0f0f0;
}

.data-table tr:hover {
    background: #fafafa;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 4px 6px;
    border-radius: 4px;
    color: #666;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: #e3f2fd;
    color: #1a237e;
}

.btn-icon.delete:hover {
    background: #ffebee;
    color: #c62828;
}

.payroll-summary-cards {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.payroll-card {
    flex: 1;
    background: linear-gradient(135deg, #e8f5e9, #f1f8e9);
    border-radius: 8px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.payroll-card-label {
    font-size: 12px;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.payroll-card-value {
    font-size: 20px;
    font-weight: 700;
    color: #2e7d32;
}

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

.tax-breakdown-table td {
    padding: 8px 12px;
    font-size: 14px;
}

.tax-breakdown-table tr:hover {
    background: #f5f5f5;
}

.cogs-pct-control {
    padding: 8px 0 12px;
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 8px;
}

@media (max-width: 768px) {
    .settings-row {
        flex-direction: column;
        gap: 0;
    }
    .payroll-summary-cards {
        flex-direction: column;
    }
}

.client-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.client-card {
    background: white;
    border-radius: 10px;
    box-shadow: var(--shadow);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.client-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

.client-card.active {
    border-color: var(--blue);
    box-shadow: 0 4px 12px rgba(21,101,192,0.2);
}

.client-card-header {
    padding: 16px 20px 12px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.client-card-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #1a237e;
    margin: 0;
}

.client-active-badge {
    background: var(--blue-light);
    color: var(--blue);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    flex-shrink: 0;
}

.client-card-body {
    padding: 0 20px 12px;
}

.client-card-row {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
    font-size: 13px;
    color: #555;
}

.client-card-label {
    font-size: 12px;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-weight: 500;
}

.client-card-actions {
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
    background: #fafafa;
}

#clientSelect {
    min-width: 180px;
    max-width: 300px;
}

nav button:disabled {
    cursor: not-allowed;
    color: #bbb;
}

nav button:disabled:hover {
    color: #bbb;
}

@media (max-width: 768px) {
    .client-grid {
        grid-template-columns: 1fr;
    }
}

.modal-field select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
    background: white;
}

.modal-field select:focus {
    outline: none;
    border-color: #1a237e;
    box-shadow: 0 0 0 3px rgba(26,35,126,0.1);
}

.asset-header { background: #2e7d32; color: white; }
.btn-asset { background: #2e7d32; color: white; }
.btn-asset:hover { background: #1b5e20; }
.liability-header { background: #c62828; color: white; }
.btn-liability { background: #c62828; color: white; }
.btn-liability:hover { background: #b71c1c; }
.equity-section {
    background: #e3f2fd;
    border: 2px solid #1565c0;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
}
.equity-section h3 { color: #1565c0; margin-bottom: 12px; }
.balance-equation {
    background: #1a237e;
    color: white;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    margin-top: 20px;
    font-family: 'Courier New', monospace;
    font-size: 16px;
}
.balance-equation .eq-val { font-size: 20px; font-weight: bold; }

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

/* ── Statement Template Builder ─────────────────────────────────────────── */
.bsb-layout { display:flex; flex-direction:column; height:calc(100vh - 140px); overflow:hidden; background:#e8ecef; }

.bsb-toolbar {
    display:flex; align-items:center; gap:6px; padding:8px 12px;
    background:#1a237e; color:#fff; flex-shrink:0; flex-wrap:wrap;
}
.bsb-toolbar select { padding:4px 8px; border-radius:4px; border:none; font-size:12px; min-width:180px; }
.bsb-tbtn {
    padding:5px 10px; border:none; border-radius:4px; cursor:pointer; font-size:12px; font-weight:600;
    background:#2c3e8c; color:#fff; transition:background .15s; white-space:nowrap;
}
.bsb-tbtn:hover { background:#3949ab; }
.bsb-tbtn.green { background:#2e7d32; } .bsb-tbtn.green:hover { background:#388e3c; }
.bsb-tbtn.red   { background:#c62828; } .bsb-tbtn.red:hover   { background:#d32f2f; }
.bsb-tbtn.blue  { background:#1565c0; } .bsb-tbtn.blue:hover  { background:#1976d2; }
.bsb-tbtn.orange{ background:#e65100; } .bsb-tbtn.orange:hover{ background:#f57c00; }
.bsb-sep { width:1px; height:24px; background:rgba(255,255,255,.25); margin:0 2px; }
.bsb-mode-hint { font-size:11px; color:#90caf9; margin-left:6px; }
#bsb-save-btn { transition:outline .2s; }

.bsb-body { display:flex; flex:1; overflow:hidden; }

/* Left Panel */
.bsb-left {
    width:200px; flex-shrink:0; background:#fff; border-right:1px solid #d0d4da;
    display:flex; flex-direction:column; overflow:hidden;
}
.bsb-panel-tabs { display:flex; border-bottom:2px solid #e0e0e0; }
.bsb-panel-tab {
    flex:1; padding:7px 4px; text-align:center; font-size:11px; font-weight:600;
    cursor:pointer; color:#666; border-bottom:2px solid transparent; margin-bottom:-2px;
}
.bsb-panel-tab.active { color:#1565c0; border-bottom-color:#1565c0; }
.bsb-panel-body { flex:1; overflow-y:auto; }

/* Element Palette */
.elem-palette { padding:8px; }
.elem-palette-title { font-size:10px; font-weight:700; color:#888; text-transform:uppercase; padding:4px 0 6px; }
.elem-btn {
    display:flex; align-items:center; gap:7px; width:100%; padding:7px 8px; margin-bottom:4px;
    border:1px solid #e0e0e0; border-radius:5px; background:#f8f9fa; cursor:pointer;
    font-size:12px; font-weight:500; color:#333; transition:background .12s, border-color .12s;
}
.elem-btn:hover { background:#e3f2fd; border-color:#90caf9; color:#1565c0; }
.elem-btn .eico { font-size:14px; width:20px; text-align:center; }

/* Placeholder Sidebar */
#bsb-ph-list { padding:6px; }
.ph-cat { margin-bottom:4px; }
.ph-cat-hdr {
    display:flex; justify-content:space-between; align-items:center;
    padding:6px 8px; background:#e8eaf6; border-radius:4px; font-size:11px;
    font-weight:700; color:#3949ab; cursor:pointer; user-select:none;
}
.ph-cat-hdr:hover { background:#c5cae9; }
.ph-caret { font-size:9px; transition:transform .2s; }
.ph-cat-hdr.open .ph-caret { transform:rotate(90deg); }
.ph-items { display:none; padding:3px 0; }
.ph-items.open { display:block; }
.ph-item {
    padding:4px 12px; font-size:10px; font-family:monospace; color:#1565c0;
    cursor:pointer; border-radius:3px; transition:background .1s;
}
.ph-item:hover { background:#e3f2fd; }

/* Canvas area */
.bsb-canvas-scroll {
    flex:1; overflow:auto; background:#c5c8cc; padding:30px;
    display:flex; justify-content:flex-start; align-items:flex-start;
}
.bsb-canvas-row { display:flex; gap:24px; align-items:flex-start; flex-shrink:0; }
.bsb-live-pdf-pane {
    width:816px; flex-shrink:0; background:#fff;
    box-shadow:0 4px 20px rgba(0,0,0,.35);
    display:flex; flex-direction:column;
    position:sticky; top:0;
}
.bsb-live-pdf-hdr {
    display:flex; align-items:center; justify-content:space-between;
    padding:8px 12px; background:#e65100; color:#fff;
    font-size:12px; font-weight:600;
}
.bsb-live-pdf-status { font-size:10px; font-weight:500; opacity:0.9; }
#bsb-live-pdf-frame { width:100%; height:1056px; border:none; background:#fff; }
.bsb-canvas-scroll.bsb-live-split { justify-content:flex-start; }
#bsb-page-wrap { flex-shrink:0; position:relative; }
#bsb-page {
    width:816px; height:1056px; background:#fff; position:relative;
    box-shadow:0 4px 20px rgba(0,0,0,.35); transform-origin:top left;
    overflow:hidden;
}
#bsb-page .bsb-elem { transition:none !important; }

/* Right Panel */
.bsb-right {
    width:230px; flex-shrink:0; background:#fff; border-left:1px solid #d0d4da;
    overflow-y:auto; display:flex; flex-direction:column;
}
.bsb-right-hdr { padding:10px 12px; background:#f5f5f5; border-bottom:1px solid #e0e0e0; font-size:12px; font-weight:700; color:#333; }

/* Property Panel */
.pp-section { padding:10px 12px; border-bottom:1px solid #f0f0f0; }
.pp-type-badge { display:flex; align-items:center; gap:8px; padding:8px 12px; background:#e8eaf6; }
.pp-type-tag { font-size:11px; font-weight:700; color:#1a237e; background:#c5cae9; padding:2px 8px; border-radius:10px; text-transform:uppercase; }
.pp-lock-badge { font-size:10px; color:#888; }
.pp-label { font-size:10px; font-weight:700; color:#888; text-transform:uppercase; margin-bottom:6px; }
.pp-row2 { display:flex; gap:6px; margin-bottom:6px; }
.pp-field { display:flex; flex-direction:column; gap:3px; flex:1; }
.pp-field label { font-size:10px; color:#555; }
.pp-field input, .pp-field select { width:100%; padding:4px 6px; border:1px solid #ddd; border-radius:4px; font-size:11px; }
.pp-select, .pp-textarea { width:100%; padding:5px 6px; border:1px solid #ddd; border-radius:4px; font-size:11px; }
.pp-textarea { resize:vertical; font-family:inherit; }
.pp-rte-toolbar {
    display:flex; align-items:center; gap:2px; padding:3px 4px;
    background:#f5f5f5; border:1px solid #ddd; border-bottom:none;
    border-radius:4px 4px 0 0; flex-wrap:wrap;
}
.pp-rte-toolbar button {
    padding:2px 6px; border:1px solid #ccc; border-radius:3px;
    background:#fff; cursor:pointer; font-size:12px; color:#333; min-width:22px;
}
.pp-rte-toolbar button:hover { background:#e3f2fd; }
.pp-rte-sep { width:1px; height:16px; background:#ccc; margin:0 3px; }
.pp-rte-editor {
    width:100%; min-height:60px; max-height:160px; overflow-y:auto;
    padding:6px 8px; border:1px solid #ddd; border-radius:0 0 4px 4px;
    font-size:11px; font-family:inherit; line-height:1.5;
    outline:none; white-space:pre-wrap; word-wrap:break-word;
    background:#fff;
}
.pp-rte-editor:focus { border-color:#1565c0; box-shadow:0 0 0 2px rgba(21,101,192,.15); }
.pp-actions { display:flex; flex-wrap:wrap; gap:5px; }
.pp-btn { padding:5px 8px; border:1px solid #ddd; border-radius:4px; background:#f5f5f5; cursor:pointer; font-size:11px; font-weight:600; color:#333; }
.pp-btn:hover { background:#e0e0e0; }
.pp-btn-del { color:#c62828 !important; border-color:#ffcdd2 !important; }
.pp-btn-del:hover { background:#ffebee !important; }

/* ── Property Panel Kit V2 ────────────────────────────────────────────────── */
.pp-shell { display:flex; flex-direction:column; }
.pp-toolbar {
    position:sticky; top:0; z-index:5;
    background:#fff; border-bottom:1px solid #e0e0e0;
    padding:8px 10px; display:flex; gap:6px; align-items:center;
}
.pp-search {
    flex:1; padding:6px 9px; border:1px solid #ddd; border-radius:4px;
    font-size:11px; background:#fafafa; outline:none;
}
.pp-search:focus { border-color:#1565c0; box-shadow:0 0 0 2px rgba(21,101,192,.1); background:#fff; }
.pp-toolbar-btn {
    padding:5px 8px; border:1px solid #ddd; background:#fff;
    border-radius:4px; cursor:pointer; font-size:10px; color:#555; line-height:1;
}
.pp-toolbar-btn:hover { background:#f5f5f5; border-color:#aaa; color:#1565c0; }
.pp-mini-preview {
    margin:8px 10px; padding:6px; background:#fafafa;
    border:1px solid #e0e0e0; border-radius:6px;
    position:relative;
}
.pp-mini-preview-label {
    font-size:9px; text-transform:uppercase; color:#888;
    font-weight:700; letter-spacing:0.5px; margin-bottom:4px;
    pointer-events:auto;
}
.pp-mini-preview-clip {
    width:100%; height:120px; overflow:hidden; position:relative;
    background:#fff; border:1px solid #eee; border-radius:3px;
}
.pp-mini-preview-inner {
    transform:scale(0.42); transform-origin:top left;
    pointer-events:none; user-select:none;
    padding:8px;
}
.pp-group { border-bottom:1px solid #f0f0f0; background:#fff; }
.pp-group-header {
    display:flex; align-items:center; gap:8px;
    padding:9px 10px; cursor:pointer; user-select:none;
    background:#fafafa; border-left:3px solid transparent;
    transition:background 0.1s, border-color 0.1s;
}
.pp-group-header:hover { background:#f0f0f0; }
.pp-group.is-open > .pp-group-header { border-left-color:#1565c0; background:#fff; }
.pp-group-icon { font-size:13px; opacity:0.85; width:16px; text-align:center; }
.pp-group-title {
    flex:1; font-size:11px; font-weight:700; color:#333;
    text-transform:uppercase; letter-spacing:0.3px;
}
.pp-group-chevron {
    transition:transform 0.15s; font-size:9px; color:#888;
}
.pp-group.is-open > .pp-group-header > .pp-group-chevron { transform:rotate(90deg); }
.pp-group-body { display:none; padding:8px 10px 12px; }
.pp-group.is-open > .pp-group-body { display:block; }
.pp-field2 {
    display:grid; grid-template-columns:90px 1fr 22px;
    gap:6px; align-items:center; padding:3px 0;
}
.pp-field2--full { grid-template-columns:1fr 22px; }
.pp-field2-label {
    font-size:10px; color:#555; line-height:1.25;
}
.pp-field2-control { min-width:0; }
.pp-field2-control input,
.pp-field2-control select,
.pp-field2-control textarea {
    width:100%; padding:4px 6px; border:1px solid #ddd;
    border-radius:3px; font-size:11px; font-family:inherit; box-sizing:border-box;
    background:#fff; color:#222;
}
.pp-field2-control input:focus,
.pp-field2-control select:focus,
.pp-field2-control textarea:focus {
    outline:none; border-color:#1565c0; box-shadow:0 0 0 1px rgba(21,101,192,.2);
}
.pp-field2-control input[type=number] {
    font-family:'SF Mono','Menlo','Consolas',monospace; text-align:right;
}
.pp-field2-control input[type=color] {
    height:24px; padding:1px; cursor:pointer;
}
.pp-field2-control input[type=checkbox] {
    width:auto; cursor:pointer; margin:0;
}
.pp-reset-btn {
    width:22px; height:22px; padding:0; border:1px solid transparent;
    background:transparent; cursor:pointer; color:#bbb;
    border-radius:3px; font-size:13px; line-height:1;
    display:flex; align-items:center; justify-content:center;
}
.pp-reset-btn:hover { color:#1565c0; background:#e3f2fd; border-color:#bbdefb; }
.pp-field2.is-hidden { display:none; }
.pp-group.is-hidden { display:none; }
.pp-row-card {
    border:1px solid #e0e0e0; border-radius:5px; padding:8px;
    margin-bottom:8px; background:#fafbfc;
}
.pp-row-card-header {
    display:flex; align-items:center; gap:4px;
    margin-bottom:6px; padding-bottom:6px;
    border-bottom:1px dashed #ddd;
}
.pp-row-card-title {
    flex:1; font-size:10px; font-weight:700; color:#555;
    text-transform:uppercase; letter-spacing:0.2px;
    white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.pp-row-card-actions { display:flex; gap:2px; }
.pp-row-card-actions .pp-btn { padding:2px 6px; font-size:10px; }

/* ── Trace / Background Layer Toolbar ─────────────────────────────────────── */
.bsb-trace-bar {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    background: #4a148c;
    color: #fff;
    flex-shrink: 0;
    flex-wrap: wrap;
    border-top: 1px solid #7b1fa2;
}
.bsb-trace-lbl {
    font-size: 11px;
    color: #e1bee7;
    white-space: nowrap;
}
.bsb-trace-hint {
    font-size: 11px;
    color: #ce93d8;
    margin-left: 8px;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ═══════════════════════════════════════════════════════════
   STATEMENT BUILDER — SPREADSHEET GRID EDITOR (SSGrid)
   ═══════════════════════════════════════════════════════════ */
#ssg-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 9000;
    display: none;
}
#ssg-modal {
    position: fixed; inset: 0; z-index: 9001; display: none;
    flex-direction: column; background: #f7f8fa; font-family: Arial, sans-serif;
    font-size: 13px; overflow: hidden;
}
/* Title bar */
#ssg-titlebar {
    background: #1a237e; color: #fff; padding: 7px 12px;
    display: flex; align-items: center; gap: 10px; flex-shrink: 0;
}
#ssg-titlebar span { flex: 1; font-size: 13px; font-weight: bold; }
#ssg-titlebar button {
    background: transparent; border: 1px solid rgba(255,255,255,.5); color: #fff;
    padding: 2px 10px; border-radius: 3px; cursor: pointer; font-size: 12px;
}
#ssg-titlebar button:hover { background: rgba(255,255,255,.15); }
/* Formatting toolbar */
#ssg-toolbar {
    background: #fff; border-bottom: 1px solid #ddd;
    padding: 5px 10px; display: flex; align-items: center; gap: 3px;
    flex-wrap: wrap; flex-shrink: 0; min-height: 38px;
}
.ssg-tbtn {
    padding: 3px 7px; border: 1px solid transparent; border-radius: 3px;
    cursor: pointer; font-size: 12px; background: transparent; height: 26px;
    min-width: 28px; display: inline-flex; align-items: center; justify-content: center;
    line-height: 1;
}
.ssg-tbtn:hover { background: #f0f0f0; border-color: #ccc; }
.ssg-tbtn.active { background: #e3f2fd; border-color: #1565c0; color: #1565c0; }
.ssg-divider { width: 1px; height: 22px; background: #ddd; margin: 0 4px; flex-shrink: 0; }
.ssg-color-wrap {
    position: relative; height: 26px; width: 28px; display: inline-flex;
    align-items: center; justify-content: center;
}
.ssg-color-wrap span {
    font-size: 13px; font-weight: bold; pointer-events: none; user-select: none;
    line-height: 1; display: block;
}
.ssg-color-wrap input[type=color] {
    position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0;
    cursor: pointer; border: none; padding: 0;
}
.ssg-color-wrap:hover { background: #f0f0f0; border-radius: 3px; }
.ssg-border-btn { position: relative; }
.ssg-border-menu {
    display: none; position: absolute; top: 100%; left: 0; background: #fff;
    border: 1px solid #ccc; border-radius: 4px; box-shadow: 0 3px 8px rgba(0,0,0,.15);
    z-index: 200; min-width: 160px; padding: 4px 0;
}
.ssg-border-menu.show { display: block; }
.ssg-border-menu div {
    padding: 6px 14px; cursor: pointer; font-size: 12px; white-space: nowrap;
}
.ssg-border-menu div:hover { background: #f0f4ff; }
.ssg-border-menu hr { border: none; border-top: 1px solid #eee; margin: 3px 0; }
.ssg-font-size-sel {
    font-size: 11px; padding: 2px 3px; border: 1px solid #ccc; border-radius: 3px;
    height: 26px; width: 55px;
}
/* Filter bar */
#ssg-filter-bar {
    background: #fff; border-bottom: 1px solid #eee;
    padding: 5px 10px; display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}
#ssg-search {
    flex: 1; min-width: 180px; font-size: 12px; padding: 4px 8px;
    border: 1px solid #ccc; border-radius: 4px; height: 28px;
}
#ssg-search:focus { outline: none; border-color: #1565c0; }
.ssg-filter-sel {
    font-size: 12px; padding: 3px 6px; border: 1px solid #ccc; border-radius: 4px;
    height: 28px;
}
#ssg-stats { flex: 1; font-size: 11px; color: #777; text-align: right; white-space: nowrap; }
/* Grid area */
#ssg-grid-wrap {
    flex: 1; overflow: auto; background: #fff; position: relative;
}
/* Table */
#ssg-table {
    border-collapse: collapse; min-width: 100%; table-layout: fixed;
    font-size: 12px;
}
.ssg-th-rn { width: 36px; }
.ssg-th-date { width: 95px; }
.ssg-th-desc { min-width: 200px; }
.ssg-th-debit, .ssg-th-credit { width: 100px; }
.ssg-th-balance { width: 110px; }
.ssg-th-category { width: 120px; }
.ssg-th-notes { width: 170px; }
.ssg-th-source { width: 72px; }
.ssg-header-cell {
    background: #1a237e; color: #fff; padding: 6px 7px; text-align: left;
    font-weight: bold; white-space: nowrap; cursor: default;
    position: sticky; top: 0; z-index: 20; user-select: none;
    border-right: 1px solid #283593;
}
.ssg-header-cell.sortable { cursor: pointer; }
.ssg-header-cell.sortable:hover { background: #283593; }
.ssg-rn-header {
    background: #111843; color: #aaa; text-align: center;
    padding: 6px 4px; position: sticky; top: 0; left: 0; z-index: 30;
    border-right: 2px solid #1a237e; width: 36px; user-select: none;
}
.ssg-rn {
    background: #f5f5f5; color: #999; text-align: center;
    padding: 3px 4px; font-size: 11px; user-select: none;
    border-bottom: 1px solid #e0e0e0; border-right: 2px solid #ccc;
    position: sticky; left: 0; z-index: 10; min-width: 36px; width: 36px;
}
.ssg-cell {
    padding: 3px 7px; border-bottom: 1px solid #e0e0e0;
    border-right: 1px solid #e8e8e8; cursor: default; overflow: hidden;
    white-space: nowrap; max-height: 28px; position: relative;
}
.ssg-cell.selected { background: #bbdefb !important; outline: 1px solid #1565c0; outline-offset: -1px; }
.ssg-cell.anchor { background: #90caf9 !important; outline: 2px solid #1565c0; outline-offset: -2px; }
.ssg-cell.editing { overflow: visible; padding: 0; }
.ssg-cell-input {
    width: 100%; height: 100%; min-height: 24px; border: 2px solid #1565c0;
    padding: 2px 5px; font-size: 12px; font-family: Arial, sans-serif;
    outline: none; box-sizing: border-box; background: #fff; display: block;
}
.ssg-readonly { cursor: not-allowed; opacity: .75; }
.ssg-row-income { }
.ssg-row-deduction { }
.ssg-row-manual { }
.ssg-row-header td { background: #e8eaf6 !important; font-weight: bold; font-style: italic; color: #283593; }
.ssg-row-header .ssg-rn { background: #e8eaf6; }
/* Source badge */
.ssg-badge {
    font-size: 10px; padding: 1px 5px; border-radius: 10px; font-weight: bold;
    display: inline-block;
}
.ssg-badge-income    { background: #e8f5e9; color: #2e7d32; }
.ssg-badge-deduction { background: #fce4ec; color: #b71c1c; }
.ssg-badge-manual    { background: #e8eaf6; color: #283593; }
.ssg-badge-header    { background: #fff3e0; color: #e65100; }
/* Footer */
#ssg-footer {
    background: #fff; border-top: 1px solid #ddd;
    padding: 7px 12px; display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}
.ssg-btn {
    padding: 5px 14px; border: 1px solid #ccc; border-radius: 4px;
    cursor: pointer; font-size: 12px; background: #fff;
}
.ssg-btn:hover { background: #f5f5f5; }
.ssg-btn.primary { background: #1565c0; color: #fff; border-color: #1565c0; }
.ssg-btn.primary:hover { background: #1976d2; }
.ssg-btn.danger { color: #c62828; border-color: #e57373; }
.ssg-btn.danger:hover { background: #ffebee; }
.ssg-spacer { flex: 1; }
/* Sort icons */
.ssg-sort-icon { font-size: 10px; margin-left: 3px; opacity: .7; }

/* ═══════════════════════════════════════════════════════
   DASHBOARD HUB
═══════════════════════════════════════════════════════ */
.hub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    padding: 32px 24px;
    max-width: 1200px;
    margin: 0 auto;
}
.hub-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.10);
    padding: 36px 28px;
    cursor: pointer;
    transition: transform 0.18s, box-shadow 0.18s;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    border: 2px solid transparent;
    text-decoration: none;
    color: inherit;
    position: relative;
    overflow: hidden;
}
.hub-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.16);
    border-color: var(--card-accent, #1565c0);
}
.hub-card-icon {
    font-size: 52px;
    line-height: 1;
    margin-bottom: 4px;
}
.hub-card-title {
    font-size: 20px;
    font-weight: 700;
    color: #1a1a2e;
    line-height: 1.2;
}
.hub-card-desc {
    font-size: 13px;
    color: #666;
    line-height: 1.5;
    flex: 1;
}
.hub-card-tag {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 3px 10px;
    border-radius: 20px;
    align-self: flex-start;
}
.hub-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 5px;
    background: var(--card-accent, #1565c0);
    border-radius: 16px 16px 0 0;
}
.hub-card.client-area   { --card-accent: #1565c0; }
.hub-card.stmt-builder  { --card-accent: #6a1b9a; }
.hub-card.psb-builder   { --card-accent: #2e7d32; }
.hub-card.tfb-builder   { --card-accent: #b71c1c; }

.hub-welcome {
    text-align: center;
    padding: 32px 24px 8px;
    max-width: 1200px;
    margin: 0 auto;
}
.hub-welcome h2 { font-size: 26px; font-weight: 700; color: #1a237e; margin-bottom: 6px; }
.hub-welcome p  { font-size: 14px; color: #666; }

/* ═══════════════════════════════════════════════════════
   CLIENT AREA SECONDARY NAV
═══════════════════════════════════════════════════════ */
.client-area-nav {
    background: #fff;
    border-bottom: 2px solid #e0e0e0;
    padding: 0 20px;
    display: flex;
    gap: 2px;
    flex-wrap: wrap;
    overflow-x: auto;
    position: sticky;
    top: 100px;
    z-index: 50;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}
.client-area-nav button {
    padding: 10px 16px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #555;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
    transition: color 0.15s, border-color 0.15s;
    border-radius: 0;
}
.client-area-nav button:hover { color: #1565c0; }
.client-area-nav button.active { color: #1565c0; border-bottom-color: #1565c0; font-weight: 600; }
.client-area-content { min-height: calc(100vh - 180px); }
.client-sub-view { display: none; }
.client-sub-view.active { display: block; }

/* ═══════════════════════════════════════════════════════
   GENERIC CANVAS BUILDER LAYOUT (gcb-*)
═══════════════════════════════════════════════════════ */
.gcb-layout {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 100px);
    overflow: hidden;
    background: #ede7f6;
}
.gcb-toolbar {
    background: #2c3e50;
    padding: 6px 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    flex-shrink: 0;
    min-height: 46px;
}
.gcb-toolbar select {
    padding: 5px 10px;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 4px;
    background: rgba(255,255,255,0.1);
    color: #fff;
    font-size: 13px;
    max-width: 200px;
}
.gcb-tbtn {
    padding: 5px 12px;
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 4px;
    background: rgba(255,255,255,0.1);
    color: #fff;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
}
.gcb-tbtn:hover { background: rgba(255,255,255,0.22); }
.gcb-tbtn.green  { background: #2e7d32; border-color: #2e7d32; }
.gcb-tbtn.green:hover { background: #388e3c; }
.gcb-tbtn.red    { background: #c62828; border-color: #c62828; }
.gcb-tbtn.red:hover { background: #d32f2f; }
.gcb-tbtn.blue   { background: #1565c0; border-color: #1565c0; }
.gcb-tbtn.blue:hover { background: #1976d2; }
.gcb-tbtn.active { outline: 2px solid #fff; }
.gcb-tbtn.dirty  { outline: 2px solid #ffd600; }
.gcb-sep { width: 1px; height: 24px; background: rgba(255,255,255,0.2); margin: 0 4px; }
.gcb-zoom-lbl { color: rgba(255,255,255,0.8); font-size: 12px; min-width: 36px; text-align: center; }

.gcb-body {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}
.gcb-left {
    width: 200px;
    background: #fff;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
}
.gcb-panel-tabs {
    display: flex;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
}
.gcb-panel-tab {
    flex: 1;
    padding: 8px 4px;
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    color: #666;
    border-bottom: 2px solid transparent;
    transition: color 0.15s;
}
.gcb-panel-tab.active { color: #1565c0; border-bottom-color: #1565c0; }
.gcb-panel-body { flex: 1; overflow-y: auto; min-height: 0; }
.gcb-panel-section { overflow-y: auto; }
.gcb-pal-title { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: #888; padding: 8px 10px 4px; }
.gcb-elem-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 7px 10px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 12px;
    color: #333;
    text-align: left;
    border-radius: 4px;
    transition: background 0.12s;
}
.gcb-elem-btn:hover { background: #e3f2fd; color: #1565c0; }
.gcb-eico { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; font-size: 12px; border: 1px solid #ddd; border-radius: 3px; background: #f5f5f5; flex-shrink: 0; }
.gcb-field-btn {
    display: block;
    width: calc(100% - 12px);
    margin: 2px 6px;
    padding: 4px 8px;
    background: rgba(123,31,162,0.07);
    border: 1px solid rgba(123,31,162,0.2);
    border-radius: 3px;
    color: #7b1fa2;
    font-size: 10.5px;
    font-family: 'Courier New', monospace;
    cursor: pointer;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background 0.12s;
}
.gcb-field-btn:hover { background: rgba(123,31,162,0.15); }

.gcb-canvas-wrap-outer {
    flex: 1;
    overflow: auto;
    background: #ede7f6;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 24px;
}
.gcb-canvas-transform {
    transform-origin: top left;
}

.gcb-right {
    width: 230px;
    background: #fff;
    border-left: 1px solid #e0e0e0;
    overflow-y: auto;
    flex-shrink: 0;
    padding: 0;
}
.gcb-prop-section { padding: 10px 10px 6px; border-bottom: 1px solid #f0f0f0; }
.gcb-prop-section-title { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: #1565c0; padding: 8px 10px 2px; background: #e3f2fd; }
.gcb-prop-row { margin-bottom: 6px; }
.gcb-prop-row label { display: block; font-size: 10px; color: #888; margin-bottom: 2px; font-weight: 600; }
.gcb-prop-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 0; }
.gcb-handles { position: absolute; pointer-events: none; left: 0; top: 0; width: 0; height: 0; }
.gcb-handle { position: absolute; pointer-events: auto; }

/* Page */
.gcb-page { flex-shrink: 0; }

/* Nav bar changes for new structure */
nav { flex-wrap: wrap; gap: 2px; }
nav button.nav-section-label {
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.4);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    pointer-events: none;
    padding: 4px 8px;
    cursor: default;
}

/* Client setup wizard */
.wizard-modal .modal-body.wizard-body {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    padding: 20px 24px;
}
.wizard-steps-bar {
    display: flex;
    gap: 0;
    padding: 12px 16px;
    background: #e0f2f1;
    border-bottom: 1px solid #b2dfdb;
    flex-shrink: 0;
    overflow-x: auto;
}
.wizard-step-pill {
    flex: 1;
    min-width: 72px;
    text-align: center;
    font-size: 11px;
    color: #546e7a;
    padding: 6px 4px;
    position: relative;
}
.wizard-step-pill.active { color: #004d40; font-weight: 700; }
.wizard-step-pill.done { color: #2e7d32; }
.wizard-step-pill .wiz-num {
    display: inline-block;
    width: 22px;
    height: 22px;
    line-height: 22px;
    border-radius: 50%;
    background: #cfd8dc;
    color: #455a64;
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 4px;
}
.wizard-step-pill.active .wiz-num { background: #00695c; color: white; }
.wizard-step-pill.done .wiz-num { background: #2e7d32; color: white; }
.wizard-checklist {
    list-style: none;
    padding: 0;
    margin: 12px 0 0;
}
.wizard-checklist li {
    padding: 8px 10px;
    margin-bottom: 6px;
    border-radius: 6px;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.wizard-checklist li .wizard-step-label { flex: 1; min-width: 0; }
.wizard-checklist li.ok { background: #e8f5e9; color: #1b5e20; }
.wizard-checklist li.pending { background: #fff8e1; color: #f57f17; }
.wizard-checklist-action {
    flex-shrink: 0;
    background: #f57f17;
    color: white;
    border: none;
    padding: 4px 10px;
    border-radius: 5px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.wizard-checklist-action:hover { background: #ef6c00; }
.wizard-checklist-action:disabled { opacity: 0.6; cursor: wait; }

.profit-warning-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    background: #ffebee;
    border: 1px solid #ef9a9a;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 13px;
    color: #b71c1c;
}
.profit-warning-banner strong { display: block; margin-bottom: 4px; font-size: 14px; }
.profit-warning-banner span { color: #c62828; }
.profit-warning-fix {
    background: #c62828;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.profit-warning-fix:hover { background: #b71c1c; }
.client-profit-badge {
    background: #ffcdd2;
    color: #b71c1c;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.wizard-progress-log {
    max-height: 220px;
    overflow-y: auto;
    background: #263238;
    color: #eceff1;
    font-family: ui-monospace, monospace;
    font-size: 11px;
    padding: 12px;
    border-radius: 8px;
    margin-top: 12px;
    white-space: pre-wrap;
}
.wizard-progress-panel {
    margin-top: 16px;
    padding: 14px 16px;
    background: #f5f7fa;
    border: 1px solid #cfd8dc;
    border-radius: 10px;
}
.wizard-progress-bar-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}
.wizard-progress-bar {
    flex: 1;
    height: 14px;
    background: #eceff1;
    border-radius: 999px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.08);
}
.wizard-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #00897b, #26a69a);
    border-radius: 999px;
    transition: width 0.45s ease;
    position: relative;
    overflow: hidden;
}
.wizard-progress-fill.is-running::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.35) 50%,
        transparent 100%
    );
    animation: wizard-progress-shimmer 1.4s infinite;
}
.wizard-progress-fill.is-complete {
    background: linear-gradient(90deg, #2e7d32, #43a047);
}
.wizard-progress-fill.is-error {
    background: linear-gradient(90deg, #c62828, #e53935);
}
.wizard-progress-pct {
    min-width: 42px;
    font-size: 13px;
    font-weight: 700;
    color: #00695c;
    text-align: right;
}
.wizard-progress-label {
    margin-top: 8px;
    font-size: 13px;
    color: #455a64;
    font-weight: 500;
}
.wizard-progress-panel.is-error .wizard-progress-pct {
    color: #c62828;
}
@keyframes wizard-progress-shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}
.wizard-status-panel {
    margin-top: 20px;
    padding: 16px;
    background: #f5f5f5;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}
.wizard-dash-mount { margin-top: 12px; }
.wizard-budget-warning {
    margin-bottom: 10px;
    padding: 10px 12px;
    background: #fff3e0;
    border: 1px solid #ffcc80;
    border-radius: 8px;
    color: #e65100;
    font-size: 11px;
    line-height: 1.45;
}
.wizard-budget-warning p { margin: 0 0 6px; }
.wizard-budget-warning p:last-child { margin-bottom: 0; }
.wizard-live-dashboard {
    padding: 12px 14px;
    background: linear-gradient(180deg, #e8f4fd 0%, #f3f9ff 100%);
    border: 1px solid #90caf9;
    border-radius: 10px;
    font-size: 12px;
    color: #0d47a1;
}
.wizard-dash-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 13px;
}
.wizard-dash-year { font-size: 11px; color: #546e7a; font-weight: normal; }
.wizard-dash-section { margin-top: 10px; padding-top: 10px; border-top: 1px solid rgba(21,101,192,.15); }
.wizard-dash-section:first-of-type { margin-top: 0; padding-top: 0; border-top: none; }
.wizard-dash-grid {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4px 16px;
    margin-top: 6px;
}
.wizard-dash-grid span:nth-child(odd) { color: #546e7a; }
.wizard-dash-grid span:nth-child(even) { font-weight: 600; text-align: right; }
.wizard-dash-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 6px;
    font-size: 11px;
}
.wizard-dash-table th,
.wizard-dash-table td {
    padding: 6px 8px;
    border-bottom: 1px solid rgba(21,101,192,.12);
}
.wizard-dash-table th { text-align: left; color: #546e7a; font-weight: 600; }
.wizard-roster-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.wizard-roster-table th,
.wizard-roster-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #e0e0e0;
    text-align: left;
}
.wizard-roster-table th {
    background: #eceff1;
    font-size: 11px;
    text-transform: uppercase;
    color: #546e7a;
}
.wizard-roster-table input,
.wizard-roster-table select {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 12px;
}
.continuity-chain-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    margin-top: 8px;
}
.continuity-chain-table th,
.continuity-chain-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #e0e0e0;
    text-align: left;
}
.continuity-chain-table th {
    background: #eceff1;
    font-size: 11px;
    text-transform: uppercase;
    color: #546e7a;
}
.continuity-gap-row { background: #ffebee; }
.continuity-ok-row { background: #f1f8e9; }
.continuity-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
}
.continuity-badge.ok { background: #c8e6c9; color: #1b5e20; }
.continuity-badge.gap { background: #ffcdd2; color: #b71c1c; }
.continuity-badge.missing { background: #fff9c4; color: #f57f17; }
.continuity-flow {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    font-size: 11px;
    color: #666;
}
.continuity-flow-arrow { color: #90a4ae; }

.year-actions-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 180px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,.12);
    z-index: 200;
    padding: 4px 0;
}
.year-actions-dropdown button {
    display: block;
    width: 100%;
    text-align: left;
    border: none;
    background: none;
    padding: 8px 12px;
    font-size: 13px;
    cursor: pointer;
}
.year-actions-dropdown button:hover { background: #f5f5f5; }
.year-actions-dropdown button.danger { color: #b71c1c; }
