/* Main CSS File */
:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --secondary: #64748b;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg-main: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-light: #e2e8f0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.5;
    min-height: 100vh;
}

.container {
    max-width: 100%;
    margin: 0;
    padding: 1.5rem 2rem;
}

/* Typography & Headers */
h1,
h2,
h3 {
    font-weight: 700;
}

.dashboard-header {
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Tabs Navigation */
.tab-nav {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 0.5rem;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 2rem;
    padding: 0.5rem;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    background: none;
    color: var(--text-muted);
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
}

.tab-btn:hover {
    background: #f1f5f9;
}

.tab-btn.active {
    background: var(--primary);
    color: white;
}

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Dashboard Grid - Horizontal Cards Force */
.stats-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)) !important;
    gap: 1.5rem;
    margin-bottom: 2.5rem;
    width: 100% !important;
}

.metric-card {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    padding: 1.25rem;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    /* Stacked internally, but cards are horizontal in grid */
    justify-content: space-between;
    min-height: 140px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.metric-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.metric-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

/* Vibrant Specific Styles */
.metric-card.revenue {
    border-bottom: 4px solid #4f46e5;
}

.metric-card.deals {
    border-bottom: 4px solid #10b981;
}

.metric-card.conversion {
    border-bottom: 4px solid #f59e0b;
}

.metric-card.balance {
    border-bottom: 4px solid #db2777;
}

.metric-card.costs {
    border-bottom: 4px solid #ef4444;
}


.metric-content h3 {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.metric-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1;
}

.metric-label {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* Charts & Analytics Layout */
.chart-grid,
.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
}

.chart-card {
    background: white;
    padding: 1.5rem;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-light);
}

/* Home Page Boxes */
.home-boxes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
    padding: 1rem;
}

.home-box {
    background: white;
    padding: 2.5rem;
    border-radius: 24px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-light);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: default;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.home-box:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 35px rgba(0, 0, 0, 0.1);
}

.home-box h3 {
    font-size: 1rem;
    color: var(--secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 1.5rem;
    font-weight: 700;
}

.home-charts-container {
    padding: 2rem;
    background: #f8fafc;
    border-radius: 32px;
    border: 1px solid var(--border-light);
    margin-bottom: 4rem;
}

.home-charts-container .charts-grid {
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
}

.home-charts-container .chart-card {
    background: white;
    padding: 2rem;
    border-radius: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
}

.home-charts-container canvas {
    width: 100% !important;
    height: 300px !important;
    margin-top: 1.5rem;
}

.home-charts-container h3 {
    font-size: 1.25rem;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.range-label {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.home-box p {
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--text-main);
}

.home-box strong {
    font-size: 3rem;
    font-weight: 800;
    color: var(--primary);
    display: block;
    margin-top: 0.5rem;
}

.home-box#lastDealBox {
    cursor: pointer;
    background: linear-gradient(135deg, #ffffff 0%, #f1f5f9 100%);
    border-left: 8px solid var(--primary);
}

.home-box span {
    font-weight: 800;
}

/* Modal tweaks for deal info */
.info-row {
    display: flex;
    justify-content: space-between;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-light);
}

.info-row:last-child {
    border-bottom: none;
}

.info-row .label {
    font-weight: 600;
    color: var(--secondary);
}

.info-row .value {
    font-weight: 700;
    color: var(--text-main);
}

/* Tables */
.table-container {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-light);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 1rem 1.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}

.data-table tbody tr {
    transition: background-color 0.2s;
    cursor: default;
}

.data-table tbody tr:hover {
    background-color: #f8fafc;
}

.data-table th {
    background: #f8fafc;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-active {
    background: #d1fae5;
    color: #065f46;
}

.status-pending {
    background: #fef3c7;
    color: #92400e;
}

.status-cancelled {
    background: #fee2e2;
    color: #991b1b;
}

.status-completed {
    background: #e0f2fe;
    color: #075985;
}

.status-on-hold {
    background: #ede9fe;
    color: #5b21b6;
}

/* Buttons */
.btn {
    padding: 0.625rem 1.25rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn:disabled {
    cursor: not-allowed;
    opacity: 0.7;
    transform: none;
}

[data-deal-save-button][aria-busy="true"] {
    cursor: wait;
}

[data-deal-save-button][aria-busy="true"]::before {
    width: 0.875rem;
    height: 0.875rem;
    content: "";
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: deal-save-spin 0.7s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
    [data-deal-save-button][aria-busy="true"]::before {
        animation: none;
    }
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: #f1f5f9;
    color: var(--text-main);
}

.btn-danger {
    background: #fee2e2;
    color: #991b1b;
}

.btn-success {
    background: #d1fae5;
    color: #065f46;
}

.btn-success:hover {
    background: #a7f3d0;
    transform: translateY(-1px);
}

.btn-info {
    background: #dbeafe;
    color: #1e40af;
}

.btn-info:hover {
    background: #bfdbfe;
    transform: translateY(-1px);
}


.action-btn {
    padding: 0.4rem;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    background: none;
    color: var(--text-main);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 52px;
    transition: background 0.2s;
}

.action-btn:hover {
    background: #f1f5f9;
}

.action-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}

.action-btn.btn-primary {
    color: #1d4ed8;
}

.action-btn.btn-primary:hover {
    background: #dbeafe;
}

.action-btn.btn-danger {
    color: #b91c1c;
}

.action-btn.btn-danger:hover {
    background: #fee2e2;
}

.action-btn.btn-secondary {
    color: #334155;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    z-index: 2000;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    width: 95%;
    max-width: 900px;
    max-height: 85vh;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
}

.modal-content.modal-xl {
    max-width: 1200px;
    width: 96%;
}

.modal-header {
    padding: 1.25rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-light);
    background: white;
    z-index: 10;
    flex-shrink: 0;
}

.close-btn {
    background: none;
    border: none;
    color: #64748b;
    font-size: 1.7rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 0.25rem;
}

.close-btn:hover {
    color: #0f172a;
}

.invoice-header-controls,
.invoice-footer-controls {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.invoice-header-controls label,
.invoice-footer-controls label {
    font-size: 0.78rem;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.invoice-header-controls select,
.invoice-footer-controls select {
    min-width: 130px;
    padding: 0.45rem 0.65rem;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #0f172a;
    background: #ffffff;
}

.invoice-footer-controls {
    margin-right: auto;
}

.modal-content > form,
.modal-content form {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    height: 100%;
    overflow: hidden;
}

.modal-body {
    padding: 1.5rem 2rem;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    background: #fcfdfe;
}

.modal-footer {
    padding: 1.25rem 2rem;
    background: #f8fafc;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    z-index: 10;
    flex-shrink: 0;
}

/* Pulsing Save Button to draw attention */
.btn-primary.btn-save-main {
    animation: savePulse 2s infinite;
    padding: 0.75rem 2.5rem;
    font-size: 1.1rem;
}

@keyframes savePulse {
    0% {
        box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(79, 70, 229, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(79, 70, 229, 0);
    }
}


.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.full-width {
    grid-column: span 2;
}

label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-main);
}

input,
select,
textarea {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Dynamic List in Modal */
.dynamic-list-header {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 40px;
    gap: 1rem;
    margin-bottom: 0.5rem;
    padding: 0 0.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
}

.line-item-row {
    display: grid;
    grid-template-columns: 1.5fr 1fr 120px 40px;
    gap: 15px;
    margin-bottom: 12px;
    align-items: center;
}

.line-item-header {
    display: grid;
    grid-template-columns: 1.5fr 1fr 120px 40px;
    gap: 15px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #64748b;
    margin-bottom: 8px;
    padding: 0 5px;
}

.amount-input {
    font-weight: 600;
    color: var(--text-main);
    text-align: right;
}

.mini-btn {
    background: none;
    border: none;
    color: var(--primary);
    font-weight: 600;
    cursor: pointer;
    font-size: 0.875rem;
    padding: 0.5rem;
}

/* Section Controls */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

/* Expense Management Specific */
.expense-category-row td {
    background: #fdf2f8;
    font-weight: 700;
    border-top: 2px solid #f9a8d4;
}

.month-cell input {
    width: 100px;
    padding: 0.5rem;
    font-size: 0.9rem;
    text-align: right;
}

/* Responsive Scaling */
@media (max-width: 1024px) {

    .chart-grid,
    .charts-grid {
        grid-template-columns: 1fr;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .full-width {
        grid-column: span 1;
    }

    .modal-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .invoice-header-controls {
        width: 100%;
        justify-content: flex-start;
    }
}

/* ==========================================
   BUSINESS CASE BUILDER VERTICAL STYLES
   ========================================== */
.bc-modal .modal-content {
    max-width: 95% !important;
    width: 1200px !important;
}

.bc-grid-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
    background: #f1f5f9;
}

.bc-item-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}

.bc-item-card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.bc-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f1f5f9;
}

.bc-card-index {
    font-weight: 800;
    color: var(--primary);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.bc-card-index::before {
    content: 'ID';
}

.bc-card-body {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.bc-field-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.bc-field-group.full-width {
    grid-column: 1 / -1;
}

.bc-field-group label {
    font-size: 0.75rem;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.bc-field-group input,
.bc-field-group select {
    padding: 10px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95rem;
    background: #fcfdfe;
    transition: all 0.2s;
    width: 100%;
}

.bc-field-group input:focus,
.bc-field-group select:focus {
    background: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
    outline: none;
}

.bc-card-footer {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 2px dashed #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 40px;
    background: #fbfcfd;
    margin: 20px -24px -24px -24px;
    padding: 20px 24px;
    border-radius: 0 0 12px 12px;
}

.bc-row-total {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.bc-row-total span {
    font-size: 0.7rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
}

.bc-row-total strong {
    font-size: 1.4rem;
    color: #0f172a;
    font-variant-numeric: tabular-nums;
}

.bc-summary {
    display: flex;
    justify-content: flex-end;
    gap: 60px;
    margin-top: 20px;
    padding: 25px;
    background: #1e293b;
    border-radius: 16px;
    color: white;
}

.bc-summary-item {
    text-align: right;
}

.bc-summary-label {
    font-size: 0.8rem;
    opacity: 0.7;
    font-weight: 600;
}

.bc-summary-value {
    font-size: 1.75rem;
    font-weight: 800;
    display: block;
}

.bc-summary-value.cost {
    color: #f87171;
}

.mini-btn-add {
    margin-top: 10px;
    background: #e0e7ff;
    color: #4338ca;
    padding: 10px 20px;
    border-radius: 10px;
}

.mini-btn-add:hover {
    background: #c7d2fe;
}

/* Modal footer buttons */
.modal-footer {
    padding: 1.5rem 2rem;
    background: #f8fafc;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

/* ==============================================
   FINANCIAL STATEMENTS STYLING
   ============================================== */

/* Subtitle for dates */
.subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 2rem;
}

/* Financial Statement Container */
.financial-statement-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.financial-statement-container.single-column {
    grid-template-columns: 1fr;
    max-width: 900px;
    margin: 0 auto;
}

/* Statement Sections */
.statement-section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.section-header {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 3px solid var(--primary);
}

.statement-subsection {
    margin-bottom: 2rem;
}

.statement-subsection h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 1rem;
}

/* Statement Tables */
.statement-table {
    width: 100%;
    border-collapse: collapse;
}

.statement-table tbody tr {
    border-bottom: 1px solid var(--border-light);
}

.statement-table tbody tr:last-child {
    border-bottom: none;
}

.statement-table td {
    padding: 0.75rem 0;
    font-size: 0.95rem;
}

.statement-table td.indent {
    padding-left: 2rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.statement-table td.sub-item {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Subtotal and Total Rows */
.statement-table tr.subtotal-row {
    border-top: 2px solid var(--border-light);
    border-bottom: 2px solid var(--border-light);
}

.statement-table tr.total-row {
    border-top: 2px solid var(--text-main);
    background: #f8fafc;
}

.statement-table tr.subtotal-row td,
.statement-table tr.total-row td {
    padding: 1rem 0;
    font-size: 1rem;
}

/* Statement Total Box */
.statement-total {
    margin-top: 2rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    text-align: center;
    color: white;
}

.statement-total h4 {
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
    opacity: 0.9;
}

.total-amount {
    font-size: 2rem;
    font-weight: 700;
    font-family: 'Courier New', monospace;
}

/* Gross Profit Section */
.statement-section.gross-profit {
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
    border: 2px solid var(--primary);
}

.statement-section.gross-profit .profit-row td {
    padding: 1.5rem 0;
    font-size: 1.3rem;
    color: var(--primary);
}

/* Net Profit Section */
.statement-section.net-profit {
    background: linear-gradient(135deg, #10b98115 0%, #059669 15 100%);
    border: 2px solid var(--success);
}

.statement-section.net-profit .profit-row.final td {
    padding: 1.5rem 0;
    font-size: 1.5rem;
    color: var(--success);
}

/* Balance Check */
.balance-check {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.check-label {
    font-weight: 600;
    color: var(--text-main);
}

.status-indicator {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--success);
}

.status-indicator.unbalanced {
    color: var(--danger);
}

/* Metrics Summary */
.metrics-summary {
    margin-top: 2rem;
    background: var(--card-bg);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.metrics-summary h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 1.5rem;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.metric-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: 10px;
    text-align: center;
}

.metric-name {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.metric-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary);
    font-family: 'Courier New', monospace;
}

/* Responsive Design for Financial Statements */
@media (max-width: 968px) {
    .financial-statement-container {
        grid-template-columns: 1fr;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
    }

    .total-amount {
        font-size: 1.5rem;
    }
}

.input-with-currency {
    display: flex;
    gap: 10px;
}

.input-with-currency input {
    flex: 2;
}

.input-with-currency select {
    flex: 1;
}

/* ==========================================
   CRM SIDEBAR & LAYOUT
   ========================================== */

.layout-wrapper {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

.main-content {
    flex: 1;
    min-width: 0;
}

.tracker-dock-tab {
    position: fixed;
    right: 60px;
    top: 45%;
    transform: translateY(-50%);
    z-index: 990;
    background: #1f2937;
    color: #ffffff;
    border: none;
    border-radius: 12px 0 0 12px;
    padding: 10px 14px;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.2);
}

.tracker-dock-tab.active {
    background: var(--primary);
}

.tracker-closed-hint {
    display: none;
    min-height: 70vh;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    text-align: center;
    color: #334155;
    background: #ffffff;
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 30px;
}

.tracker-closed-hint h2 {
    font-size: 2rem;
    margin-bottom: 0.6rem;
}

.tracker-closed-hint p {
    color: #64748b;
    font-size: 1rem;
}

body.tracker-panel-closed .main-content {
    display: none;
}

body.tracker-panel-closed .tracker-closed-hint {
    display: flex;
}

.opening-insights-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.range-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.range-filter-group {
    display: inline-flex;
    align-items: center;
    background: #e2e8f0;
    border-radius: 999px;
    padding: 4px;
    gap: 4px;
}

.range-filter-btn {
    border: none;
    background: transparent;
    color: #334155;
    font-size: 0.82rem;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 999px;
    cursor: pointer;
}

.range-filter-btn.active {
    background: #1d4ed8;
    color: #ffffff;
}

.opening-insights-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.deal-rank-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.deal-rank-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px;
}

.deal-rank-index {
    min-width: 30px;
    height: 30px;
    border-radius: 999px;
    background: #1d4ed8;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
}

.deal-rank-info {
    flex: 1;
    min-width: 0;
}

.deal-rank-info strong {
    display: block;
    font-size: 0.95rem;
    color: #0f172a;
    margin-bottom: 2px;
}

.deal-rank-info span {
    display: block;
    font-size: 0.8rem;
    color: #64748b;
}

.deal-rank-value {
    font-size: 0.92rem;
    font-weight: 700;
    color: #0f172a;
    white-space: nowrap;
}

.ai-insights-card {
    margin-bottom: 1.5rem;
}

.ai-insights-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.ai-insights-meta {
    font-size: 0.82rem;
    color: #64748b;
    margin-bottom: 10px;
}

.ai-insights-output {
    white-space: pre-wrap;
    background: #0f172a;
    color: #e2e8f0;
    border-radius: 12px;
    padding: 14px;
    border: 1px solid #1e293b;
    line-height: 1.45;
    min-height: 120px;
    font-size: 0.88rem;
}

.chart-legend {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 0.83rem;
    color: #475569;
    font-weight: 600;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    display: inline-block;
}

.legend-dot-revenue {
    background: #10b981;
}

.legend-dot-cost {
    background: #ef4444;
}

.legend-dot-profit {
    background: #2563eb;
}

.legend-dot-expense {
    background: #ef4444;
}

.crm-sidebar {
    width: 60px;
    /* Collapsed width */
    flex-shrink: 0;
    background: white;
    padding: 1.5rem 0.5rem;
    /* Reduced padding when collapsed */
    border-radius: 16px 0 0 16px;
    /* Rounded only on left */
    border: 1px solid var(--border-light);
    border-right: none;
    box-shadow: -4px 0 10px rgba(0, 0, 0, 0.05);
    position: fixed;
    right: 0;
    top: 0;
    height: 100vh;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s ease;
}

.crm-sidebar:hover {
    width: 340px;
    /* Expanded width */
    padding: 1.5rem;
}

/* Hide content when collapsed */
.crm-sidebar>* {
    opacity: 0;
    transition: opacity 0.2s ease;
    width: 310px;
    /* Prevent wrapping during transition */
    pointer-events: none;
}

.crm-sidebar:hover>* {
    opacity: 1;
    pointer-events: auto;
    transition-delay: 0.1s;
}

/* Collapsed Indicator Icon */
.crm-sidebar::before {
    content: "CRM";
    font-size: 1.5rem;
    position: absolute;
    top: 2rem;
    left: 50%;
    transform: translateX(-50%);
    opacity: 1;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.crm-sidebar:hover::before {
    opacity: 0;
}

/* Adjust layout wrapper since sidebar is fixed now */
.layout-wrapper {
    display: block;
    /* Remove flex since sidebar is fixed now */
    margin-left: 84px;
    margin-right: 0;
    /* Reserve space for fixed sidebar on left */
}

/* Multi-Select Dropdown Styles */
.multi-select-container {
    position: relative;
    width: 100%;
}

.multi-select-trigger {
    padding: 10px;
    background: #f8fafc;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 42px;
}

.multi-select-trigger:after {
    content: 'v';
    font-size: 0.8rem;
    color: var(--text-muted);
}

.multi-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 100;
    max-height: 200px;
    overflow-y: auto;
    display: none;
    margin-top: 4px;
    padding: 0.5rem;
}

.multi-select-dropdown.active {
    display: block;
}

.multi-select-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
}

.multi-select-option:hover {
    background: #f1f5f9;
}

.multi-select-option input[type="checkbox"] {
    accent-color: var(--primary);
    width: 16px;
    height: 16px;
}

.main-content {
    max-width: 100%;
}

.crm-header {
    margin-top: 1rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 1rem;
}

.crm-header h3 {
    font-size: 1.1rem;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.crm-header p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.crm-form-group {
    margin-bottom: 1.25rem;
}

.crm-form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: var(--text-main);
}

.crm-form-group input,
.crm-form-group select {
    width: 100%;
    padding: 0.6rem;
    font-size: 0.95rem;
    border-radius: 8px;
    border: 1px solid var(--border-light);
    transition: all 0.2s;
}

.crm-form-group input:focus,
.crm-form-group select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.crm-form-group textarea {
    width: 100%;
    padding: 0.6rem;
    font-size: 0.95rem;
    border-radius: 8px;
    border: 1px solid var(--border-light);
    transition: all 0.2s;
    resize: vertical;
    min-height: 70px;
}

.crm-form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

#quickDealForm {
    overflow-y: auto;
    max-height: calc(100vh - 360px);
    padding-right: 6px;
}

.input-with-currency {
    display: flex;
    gap: 0.5rem;
}

.input-with-currency select {
    width: 80px;
    background-color: #f8fafc;
}

.full-width-btn {
    width: 100%;
    justify-content: center;
    padding: 0.85rem;
    font-size: 1rem;
    margin-top: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.2);
}

.crm-recent-activity {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-light);
    flex: 1;
    overflow-y: auto;
}

.crm-recent-activity h4 {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 1rem;
    letter-spacing: 0.05em;
}

#crmRecentActivityList {
    list-style: none;
    padding: 0;
    margin: 0;
}

.activity-item {
    padding: 12px;
    background: #f1f5f9;
    border-radius: 10px;
    margin-bottom: 12px;
    border-left: 4px solid var(--primary);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.activity-item strong {
    display: block;
    font-size: 0.9rem;
    color: var(--text-main);
}

.activity-item span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.empty-state {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
    padding: 1.5rem 0;
    font-style: italic;
    opacity: 0.7;
}

/* Responsive Overrides */
@media (max-width: 1200px) {
    .crm-sidebar {
        width: 300px;
    }
}

@media (max-width: 1024px) {
    .layout-wrapper {
        flex-direction: column;
    }

    .tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .tabs .tab-btn {
        flex: 0 0 auto;
    }

    .crm-sidebar {
        width: 100%;
        position: static;
        margin-top: 2rem;
        max-height: none;
    }

    #quickDealForm {
        max-height: none;
        overflow: visible;
        padding-right: 0;
    }

    .main-content {
        width: 100%;
    }

    .tracker-dock-tab {
        right: 12px;
        top: auto;
        bottom: 16px;
        transform: none;
        border-radius: 10px;
        font-size: 0.8rem;
        padding: 9px 12px;
    }

    .opening-insights-grid {
        grid-template-columns: 1fr;
    }

    .opening-insights-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ==========================================
   Notifications, Tickets, Audit
   ========================================== */

.tab-badge {
    margin-left: 6px;
    min-width: 20px;
    height: 20px;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
}

.summary-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.summary-card {
    background: #ffffff;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.summary-card span {
    color: var(--text-muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.summary-card strong {
    font-size: 1.25rem;
    color: #0f172a;
}

.notifications-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.notif-item {
    border: 1px solid var(--border-light);
    border-left: 5px solid #94a3b8;
    border-radius: 10px;
    padding: 12px;
    background: #fff;
    cursor: pointer;
    transition: box-shadow 0.2s, transform 0.2s;
}

.notif-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}

.notif-item.active {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.notif-item.notif-critical {
    border-left-color: #dc2626;
    background: #fff7f7;
}

.notif-item.notif-high {
    border-left-color: #ea580c;
    background: #fffaf5;
}

.notif-item.notif-medium {
    border-left-color: #2563eb;
    background: #f8fbff;
}

.notif-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.notif-level {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 999px;
    background: #e2e8f0;
    color: #1e293b;
}

.notif-source {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.notif-amount {
    margin-left: auto;
    font-weight: 700;
}

.notif-body {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 0.85rem;
    color: #334155;
}

.notif-actions {
    margin-top: 10px;
}

.notif-action {
    padding: 0.35rem 0.7rem;
    font-size: 0.78rem;
}

.receivable-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

.receivable-detail-card {
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 10px;
    background: #fff;
}

.receivable-detail-card span {
    font-size: 0.74rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.receivable-detail-card strong {
    display: block;
    margin-top: 4px;
    font-size: 1rem;
}

.audit-form-block {
    background: #fff;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 18px;
}

.audit-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 14px;
    padding: 12px;
    border: 1px solid var(--border-light);
    border-radius: 10px;
    background: #fff;
}

.audit-filter-row .form-group {
    min-width: 180px;
    flex: 1;
}

.audit-inflow {
    color: #047857;
    font-weight: 600;
}

.audit-outflow {
    color: #b91c1c;
    font-weight: 600;
}

/* ==========================================
   Workspace Switcher (Right Menu)
   ========================================== */

.layout-wrapper {
    display: flex;
    align-items: flex-start;
    margin-left: 84px;
    margin-right: 0;
}

.workspace-stack {
    flex: 1;
    min-width: 0;
}

.workspace-panel {
    display: none;
}

.workspace-panel.active {
    display: block;
}

/* Home mode: analytics + AI only */
/* Home mode: show homePage tab, hide financialTrends specific parts */
body.workspace-mode-home #financialTrends .stats-grid {
    display: none !important;
}

body.workspace-mode-home #financialWorkspace .tabs {
    display: none;
}

body.workspace-mode-home #financialTrends .ai-insights-card {
    display: none !important;
}

#homeAiInsightsBtn {
    display: none;
}

body.workspace-mode-home #homeAiInsightsBtn {
    display: inline-flex;
    align-items: center;
}

/* Workspace logic */

.ai-model-popup {
    position: fixed;
    top: 22px;
    right: 96px;
    z-index: 2100;
    background: #0f172a;
    color: #e2e8f0;
    border: 1px solid #334155;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 0.82rem;
    font-weight: 600;
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

.ai-model-popup.show {
    opacity: 1;
    transform: translateY(0);
}

.ai-insights-modal-content {
    width: min(96vw, 1000px);
}

.ai-insights-modal-content .ai-insights-output {
    min-height: 340px;
    max-height: 65vh;
    overflow: auto;
}

.app-sidebar-menu {
    position: fixed;
    left: 0;
    top: 0;
    width: 84px;
    height: 100vh;
    padding: 16px 8px;
    border-right: 1px solid var(--border-light);
    background: #ffffff;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 10px;
    z-index: 1100;
    box-shadow: 2px 0 8px rgba(0,0,0,0.04);
}

.side-menu-btn {
    border: none;
    border-radius: 0 12px 12px 0;
    background: #e2e8f0 !important;
    color: #475569 !important;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 11px 8px;
    cursor: grab;
    text-align: center;
    transition: background 0.18s, color 0.18s, transform 0.15s, box-shadow 0.18s;
    user-select: none;
}

.side-menu-btn:active {
    cursor: grabbing;
}

.side-menu-btn:hover {
    background: #cbd5e1 !important;
    color: #1e293b !important;
    transform: translateX(3px);
}

.side-menu-btn.active {
    background: var(--primary) !important;
    color: #ffffff !important;
    font-weight: 700;
    box-shadow: 0 8px 16px rgba(79, 70, 229, 0.25);
    transform: translateX(4px);
}

.side-menu-btn.drag-over {
    background: #ddd6fe !important;
    border: 2px dashed #4f46e5;
    transform: translateX(2px);
}

.side-menu-btn.dragging {
    opacity: 0.4;
    transform: scale(0.97);
}

/* Reporting has-submenu indicator */
.side-menu-btn.has-submenu {
    position: relative;
}
.side-menu-btn.has-submenu::after {
    content: '›';
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
    opacity: 0.5;
}
.side-menu-btn.has-submenu.submenu-open::after {
    content: '›';
    transform: translateY(-50%) rotate(90deg);
    opacity: 1;
}


/* Multi-step Reporting Sub-panel */
.reporting-submenu-panel {
    position: fixed;
    left: 84px;
    top: 0;
    width: 160px;
    height: 100vh;
    background: #f8fafc;
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: 16px 8px;
    gap: 8px;
    z-index: 1099;
    box-shadow: 3px 0 10px rgba(0,0,0,0.06);
    transform: translateX(-100%);
    opacity: 0;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.22s ease;
    pointer-events: none;
}

.reporting-submenu-panel.open {
    transform: translateX(0);
    opacity: 1;
    pointer-events: all;
}

.reporting-submenu-panel .submenu-header {
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--primary);
    padding: 4px 6px 10px;
    border-bottom: 2px solid var(--primary);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.reporting-submenu-panel .submenu-header::before {
    content: '📊';
    font-size: 1rem;
}

.submenu-btn {
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #334155;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 10px 10px;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s, color 0.15s, transform 0.12s;
    border-left: 3px solid transparent;
    position: relative;
}

.submenu-btn:hover {
    background: #e0e7ff;
    color: var(--primary);
    border-left-color: var(--primary);
    transform: translateX(2px);
}

.submenu-btn.active {
    background: #ede9fe;
    color: var(--primary);
    font-weight: 700;
    border-left-color: var(--primary);
}

/* When submenu is open, shift main content further right */
.layout-wrapper.submenu-open {
    margin-left: calc(84px + 160px);
    transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.crm-workspace-card {
    background: #ffffff;
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 1.5rem;
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
    gap: 1.5rem;
}

/* Deals Log specific override to take full width */
#deals_standalone.crm-workspace-card {
    display: block;
    width: 100%;
}

.crm-workspace-card #quickDealForm {
    max-height: none;
    overflow: visible;
    padding-right: 0;
}

.crm-workspace-card .crm-recent-activity {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    border-left: 1px solid var(--border-light);
    padding-left: 1rem;
    max-height: none;
}

@media (max-width: 1024px) {
    .layout-wrapper {
        margin-left: 0;
        margin-right: 0;
    }

    .app-sidebar-menu {
        top: auto;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: auto;
        padding: 8px;
        border-right: none;
        border-top: 1px solid var(--border-light);
        background: #ffffff;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        z-index: 1100;
    }

    .reporting-submenu-panel {
        left: 0;
        right: 0;
        top: auto;
        bottom: auto;
        width: 100%;
        height: auto;
        flex-direction: row;
        flex-wrap: wrap;
        padding: 8px;
        border-right: none;
        border-top: 1px solid var(--border-light);
        transform: translateY(100%);
    }

    .reporting-submenu-panel.open {
        transform: translateY(0);
    }

    .side-menu-btn {
        border-radius: 10px;
        padding: 10px 12px;
    }

    .side-menu-btn.has-submenu::after {
        display: none;
    }

    .layout-wrapper.submenu-open {
        margin-left: 0;
    }

    .crm-workspace-card {
        grid-template-columns: 1fr;
    }

    .crm-workspace-card .crm-recent-activity {
        border-left: none;
        border-top: 1px solid var(--border-light);
        padding-left: 0;
        padding-top: 1rem;
    }
}


.mini-btn-link {
    background: none;
    border: none;
    color: #4f46e5;
    font-weight: 700;
    cursor: pointer;
    font-size: 0.7rem;
    padding: 2px 5px;
    border-radius: 4px;
    transition: background 0.2s;
}

.mini-btn-link:hover {
    background: rgba(79, 70, 229, 0.1);
}

.admin-item-row {
    transition: background 0.2s;
}

.admin-item-row:hover {
    background: #f8fafc;
}

.admin-list {
    background: #ffffff;
    border: 1px solid #f1f5f9;
    border-radius: 8px;
    max-height: 250px;
    overflow-y: auto;
}

/* User management */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

body.modal-open {
    overflow: hidden;
}

.user-management-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 1.5rem 0 1rem;
}

.user-management-toolbar h2 {
    margin: 0 0 0.25rem;
    color: var(--text-main);
    font-size: 1.25rem;
}

.user-management-toolbar p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.user-management-status {
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: #f8fafc;
    color: var(--text-main);
    font-size: 0.9rem;
}

.user-management-status-success {
    border-color: #a7f3d0;
    background: #ecfdf5;
    color: #065f46;
}

.user-management-status-error {
    border-color: #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

.user-table-container {
    margin-top: 0;
}

.user-table-scroll {
    overflow-x: auto;
}

.user-management-table {
    min-width: 820px;
}

.user-management-table td {
    vertical-align: middle;
}

.user-table-message {
    color: var(--text-muted);
    text-align: center !important;
    padding: 2rem !important;
}

.current-user-label {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.125rem 0.4rem;
    border-radius: 9999px;
    background: #e0e7ff;
    color: #3730a3;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.user-role-badge {
    display: inline-block;
    padding: 0.25rem 0.65rem;
    border: 1px solid #cbd5e1;
    border-radius: 9999px;
    background: #f8fafc;
    color: #334155;
    font-size: 0.75rem;
    font-weight: 700;
}

.user-row-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.user-action-button {
    min-height: 36px;
    padding: 0.45rem 0.65rem;
    border: 1px solid #cbd5e1;
    border-radius: 7px;
    background: #ffffff;
    color: #334155;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    font-weight: 700;
}

.user-action-button:hover:not(:disabled) {
    background: #f8fafc;
    border-color: #94a3b8;
}

.user-action-delete {
    color: #b91c1c;
}

.user-action-delete:hover:not(:disabled) {
    background: #fef2f2;
    border-color: #fecaca;
}

.user-action-button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.user-management-toolbar button:focus-visible,
.user-action-button:focus-visible,
.user-modal button:focus-visible,
.user-modal input:focus-visible,
.user-modal select:focus-visible {
    outline: 3px solid rgba(79, 70, 229, 0.25);
    outline-offset: 2px;
}

.user-modal {
    padding: 1rem;
}

.user-modal-content {
    width: min(100%, 680px);
    max-height: min(90vh, 760px);
    border-radius: 16px;
}

.user-modal-header {
    align-items: flex-start;
}

.user-modal-header h2 {
    margin: 0.15rem 0 0.3rem;
    color: var(--text-main);
    font-size: 1.35rem;
}

.user-modal-header p {
    margin: 0;
}

.user-modal-kicker {
    color: var(--primary);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

#userModalDescription {
    color: var(--text-muted);
    font-size: 0.88rem;
}

.user-form-alert {
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    border: 1px solid #fecaca;
    border-radius: 8px;
    background: #fef2f2;
    color: #991b1b;
    font-size: 0.88rem;
}

.user-form-grid {
    gap: 1rem;
}

.form-helper {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.75rem;
    line-height: 1.45;
}

.user-status-control {
    padding: 0.85rem 1rem;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: #f8fafc;
}

.user-status-control-locked {
    opacity: 0.7;
}

.user-status-toggle {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    cursor: pointer;
}

.user-status-toggle input {
    width: 1.1rem;
    height: 1.1rem;
    margin-top: 0.1rem;
    padding: 0;
    accent-color: var(--primary);
}

.user-status-toggle strong,
.user-status-toggle small {
    display: block;
}

.user-status-toggle small {
    margin-top: 0.2rem;
    color: var(--text-muted);
    font-weight: 400;
}

@media (max-width: 720px) {
    .user-management-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .user-management-toolbar .btn {
        justify-content: center;
        min-height: 44px;
        width: 100%;
    }

    .user-table-container {
        background: transparent;
        border: 0;
        box-shadow: none;
        overflow: visible;
    }

    .user-table-scroll {
        overflow: visible;
    }

    .user-management-table,
    .user-management-table tbody,
    .user-management-table tr,
    .user-management-table td {
        display: block;
        min-width: 0;
        width: 100%;
    }

    .user-management-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
    }

    .user-management-table tbody tr {
        margin-bottom: 0.75rem;
        border: 1px solid var(--border-light);
        border-radius: 10px;
        background: #ffffff;
        box-shadow: 0 2px 5px rgba(15, 23, 42, 0.04);
    }

    .user-management-table td {
        display: grid;
        grid-template-columns: minmax(90px, 0.75fr) minmax(0, 1.25fr);
        gap: 0.75rem;
        padding: 0.75rem 1rem;
        text-align: right;
        overflow-wrap: anywhere;
    }

    .user-management-table td::before {
        content: attr(data-label);
        color: var(--text-muted);
        font-size: 0.72rem;
        font-weight: 800;
        letter-spacing: 0.04em;
        text-align: left;
        text-transform: uppercase;
    }

    .user-table-message {
        display: block !important;
        text-align: center !important;
    }

    .user-table-message::before {
        content: none !important;
    }

    .user-row-actions {
        justify-content: flex-end;
    }

    .user-action-button {
        min-height: 40px;
    }

    .user-modal {
        align-items: flex-end;
        padding: 0;
    }

    .user-modal-content {
        width: 100%;
        max-height: 94vh;
        border-radius: 14px 14px 0 0;
    }

    .user-modal-header {
        align-items: flex-start;
        flex-direction: row;
        padding: 1rem 1.25rem;
    }

    .user-modal .modal-body,
    .user-modal .modal-footer {
        padding-left: 1.25rem;
        padding-right: 1.25rem;
    }

    .user-modal .modal-footer {
        gap: 0.75rem;
    }

    .user-modal .modal-footer .btn {
        flex: 1;
        justify-content: center;
        min-height: 44px;
    }
}

/* ==========================================
   BILLING HUB WORKSPACE
   ========================================== */

/* Summary Cards */
.hub-summary-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: white;
    border-radius: 14px;
    padding: 20px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    overflow: hidden;
}
.hub-summary-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    border-radius: 14px 14px 0 0;
}
.hub-summary-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}
.hub-card-icon {
    font-size: 2rem;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    flex-shrink: 0;
}
.hub-card-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.hub-card-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}
.hub-card-value {
    font-size: 1.4rem;
    font-weight: 800;
    font-family: 'Courier New', monospace;
    color: var(--text-main);
}
.hub-card-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Card color variants */
.hub-card-billed::before { background: linear-gradient(90deg, #4f46e5, #7c3aed); }
.hub-card-billed .hub-card-icon { background: #ede9fe; color: #4f46e5; }
.hub-card-billed .hub-card-value { color: #4f46e5; }

.hub-card-collected::before { background: linear-gradient(90deg, #059669, #10b981); }
.hub-card-collected .hub-card-icon { background: #d1fae5; color: #059669; }
.hub-card-collected .hub-card-value { color: #059669; }

.hub-card-uncollected::before { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.hub-card-uncollected .hub-card-icon { background: #fef3c7; color: #d97706; }
.hub-card-uncollected .hub-card-value { color: #d97706; }

.hub-card-postdue::before { background: linear-gradient(90deg, #ef4444, #dc2626); }
.hub-card-postdue .hub-card-icon { background: #fee2e2; color: #ef4444; }
.hub-card-postdue .hub-card-value { color: #ef4444; }

/* Billing table row highlights */
.billing-row-overdue {
    background-color: #fff1f2 !important;
    border-left: 3px solid #ef4444;
}
.billing-row-overdue:hover {
    background-color: #ffe4e6 !important;
}
.billing-row-grace {
    background-color: #fffbeb !important;
    border-left: 3px solid #f59e0b;
}
.billing-row-grace:hover {
    background-color: #fef3c7 !important;
}
.billing-row-collected {
    background-color: #f0fdf4 !important;
    border-left: 3px solid #10b981;
}
.billing-row-collected:hover {
    background-color: #dcfce7 !important;
}

/* Grace period status badge */
.hub-badge-grace {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

/* Utilities */
.text-warning {
    color: #f59e0b;
}

/* ==========================================
   EMPLOYEE PROFILES MODULE
   ========================================== */

.employee-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
    gap: 20px;
    padding: 5px 0;
}

.employee-card {
    background: white;
    border-radius: 16px;
    border: 1px solid var(--border-light);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.employee-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(79, 70, 229, 0.12);
    border-color: #c7d2fe;
}

.emp-card-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 20px 20px 14px;
}

.emp-avatar {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 800;
    color: white;
    flex-shrink: 0;
    letter-spacing: -0.5px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.emp-card-info {
    flex: 1;
    min-width: 0;
}

.emp-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0 0 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.emp-role-badge {
    font-size: 0.72rem;
    font-weight: 600;
    background: #e0e7ff;
    color: #4f46e5;
    padding: 2px 10px;
    border-radius: 20px;
    letter-spacing: 0.02em;
}

.emp-card-details {
    padding: 0 20px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.emp-detail {
    font-size: 0.82rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.emp-stats-row {
    display: flex;
    border-top: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
    margin: 0;
}

.emp-stat {
    flex: 1;
    padding: 12px 16px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.emp-stat:not(:last-child) {
    border-right: 1px solid var(--border-light);
}

.emp-stat-label {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.emp-stat-value {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-main);
}

.emp-cashout-color {
    color: #ef4444;
}

.emp-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 14px 16px;
    background: #f8fafc;
}

/* ==========================================
   MOBILE NAVIGATION & PWA INSTALL EXPERIENCE
   ========================================== */

.mobile-app-bar,
.mobile-navigation-backdrop,
.mobile-sidebar-header {
    display: none;
}

.install-app-menu-button {
    border-top: 1px solid var(--border-light);
    color: var(--primary) !important;
}

.pwa-install-prompt[hidden] {
    display: none;
}

.pwa-install-prompt {
    position: fixed;
    inset: 0;
    z-index: 12000;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    padding: 1.5rem;
    background: rgba(15, 23, 42, 0.42);
    backdrop-filter: blur(3px);
}

.pwa-install-card {
    position: relative;
    width: min(100%, 430px);
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 1rem;
    padding: 1.5rem;
    border: 1px solid var(--border-light);
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.24);
}

.pwa-install-icon {
    width: 72px;
    height: 72px;
    border: 1px solid var(--border-light);
    border-radius: 16px;
}

.pwa-install-copy {
    min-width: 0;
    padding-right: 1.5rem;
}

.pwa-install-kicker {
    color: var(--primary);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.pwa-install-copy h2 {
    margin: 0.2rem 0 0.35rem;
    color: var(--text-main);
    font-size: 1.25rem;
}

.pwa-install-copy p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.88rem;
    line-height: 1.5;
}

.pwa-install-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
}

.pwa-install-close:hover,
.pwa-install-close:focus-visible {
    background: #f1f5f9;
    color: var(--text-main);
}

.pwa-install-instructions {
    margin: 0.75rem 0 0;
    padding-left: 1.25rem;
    color: #334155;
    font-size: 0.84rem;
    line-height: 1.55;
}

.pwa-install-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding-top: 0.25rem;
}

body.pwa-prompt-open {
    overflow: hidden;
}

@media (max-width: 1024px) {
    .mobile-app-bar {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1150;
        display: grid;
        grid-template-columns: 44px minmax(0, 1fr) auto;
        align-items: center;
        gap: 0.75rem;
        min-height: calc(64px + env(safe-area-inset-top));
        padding: calc(0.6rem + env(safe-area-inset-top)) 1rem 0.6rem;
        border-bottom: 1px solid var(--border-light);
        background: rgba(255, 255, 255, 0.96);
        box-shadow: 0 4px 18px rgba(15, 23, 42, 0.08);
        backdrop-filter: blur(12px);
    }

    .mobile-menu-button {
        width: 44px;
        height: 44px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 5px;
        border: 1px solid var(--border-light);
        border-radius: 10px;
        background: #ffffff;
        cursor: pointer;
    }

    .mobile-menu-button span {
        width: 19px;
        height: 2px;
        border-radius: 2px;
        background: var(--text-main);
    }

    .mobile-app-logo {
        width: min(150px, 42vw);
        height: auto;
    }

    .mobile-install-button {
        min-height: 40px;
        padding: 0.55rem 0.8rem;
        border: 1px solid #c7d2fe;
        border-radius: 9px;
        background: #eef2ff;
        color: #4338ca;
        cursor: pointer;
        font-size: 0.8rem;
        font-weight: 700;
    }

    .container {
        padding: calc(5rem + env(safe-area-inset-top)) 1rem 1.5rem;
    }

    .layout-wrapper,
    .layout-wrapper.submenu-open {
        display: block;
        margin: 0;
    }

    .mobile-sidebar-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        padding-bottom: 1rem;
        border-bottom: 1px solid var(--border-light);
    }

    .mobile-sidebar-header img {
        width: 150px;
        height: auto;
    }

    .mobile-sidebar-header button {
        width: 40px;
        height: 40px;
        border: 0;
        border-radius: 8px;
        background: #f1f5f9;
        color: var(--text-main);
        cursor: pointer;
        font-size: 1.6rem;
    }

    .app-sidebar-menu {
        top: 0;
        right: auto;
        bottom: 0;
        left: 0;
        width: min(86vw, 320px);
        height: 100dvh;
        max-height: none;
        padding: calc(1rem + env(safe-area-inset-top)) 1rem calc(1rem + env(safe-area-inset-bottom));
        flex-direction: column;
        flex-wrap: nowrap;
        justify-content: flex-start;
        gap: 0.75rem;
        overflow-y: auto;
        border-top: 0;
        border-right: 1px solid var(--border-light);
        background: #ffffff;
        box-shadow: 18px 0 48px rgba(15, 23, 42, 0.18);
        transform: translateX(-105%);
        transition: transform 0.24s ease;
    }

    .app-sidebar-menu.mobile-open {
        transform: translateX(0);
    }

    .app-sidebar-menu > div[style*="flex-grow"] {
        min-height: 0;
    }

    #sortableSidebarNav {
        flex: 0 0 auto !important;
        width: 100%;
    }

    .side-menu-btn {
        width: 100%;
        min-height: 44px;
        padding: 0.7rem 0.9rem;
        border-radius: 9px;
        cursor: pointer;
        text-align: left;
    }

    .side-menu-btn:hover,
    .side-menu-btn.active {
        transform: none;
    }

    .side-menu-btn.has-submenu::after {
        display: block;
        right: 0.9rem;
    }

    .mobile-navigation-backdrop {
        position: fixed;
        inset: 0;
        z-index: 1090;
        border: 0;
        background: rgba(15, 23, 42, 0.46);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
    }

    body.mobile-navigation-open {
        overflow: hidden;
    }

    body.mobile-navigation-open .mobile-navigation-backdrop {
        display: block;
        opacity: 1;
        pointer-events: auto;
    }

    .reporting-submenu-panel {
        top: calc(4.75rem + env(safe-area-inset-top));
        right: 1rem;
        bottom: auto;
        left: 1rem;
        width: auto;
        height: auto;
        padding: 0.75rem;
        flex-direction: column;
        flex-wrap: nowrap;
        border: 1px solid var(--border-light);
        border-radius: 12px;
        box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
        transform: translateY(-12px) scale(0.98);
        transform-origin: top left;
    }

    .reporting-submenu-panel.open {
        transform: translateY(0) scale(1);
    }

    .home-boxes-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1rem;
        padding: 0;
        margin-bottom: 1.5rem;
    }

    .home-box {
        padding: 1.5rem;
        border-radius: 16px;
    }

    .home-charts-container {
        padding: 1.25rem;
        border-radius: 18px;
        margin-bottom: 2rem;
    }

    .home-charts-container .charts-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .header,
    .dashboard-header,
    .section-header {
        gap: 1rem;
        flex-wrap: wrap;
    }

    .table-container,
    .user-table-scroll {
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .data-table:not(.user-management-table) {
        min-width: 720px;
    }

    .modal {
        padding: 1rem;
    }

    .modal-content,
    .modal-content.modal-xl,
    .bc-modal .modal-content {
        width: 100% !important;
        max-width: 100% !important;
        max-height: calc(100dvh - 2rem);
        border-radius: 14px;
    }

    .modal-header {
        flex-direction: row;
        align-items: flex-start;
        padding: 1rem 1.25rem;
    }

    .modal-body,
    .modal-footer {
        padding: 1rem 1.25rem;
    }

    .modal-footer {
        flex-wrap: wrap;
    }

    #globalNotificationsPanel {
        top: calc(4.75rem + env(safe-area-inset-top)) !important;
        right: 1rem !important;
        left: 1rem !important;
        width: auto !important;
        max-height: calc(100dvh - 6rem) !important;
    }

    .crm-workspace-card {
        padding: 1.25rem;
    }
}

@media (max-width: 720px) {
    #loginOverlay > div {
        width: calc(100% - 1.5rem) !important;
        max-width: 400px !important;
        padding: 1.5rem !important;
    }

    .container {
        padding: calc(4.75rem + env(safe-area-inset-top)) 0.75rem 1.25rem;
    }

    .mobile-app-bar {
        grid-template-columns: 42px minmax(0, 1fr) auto;
        gap: 0.6rem;
        padding-right: 0.75rem;
        padding-left: 0.75rem;
    }

    .mobile-app-logo {
        width: min(126px, 38vw);
    }

    .home-boxes-grid,
    .summary-cards-grid,
    .employee-card-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    #adminBc .admin-grid {
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 1rem !important;
        padding: 1rem 0 !important;
    }

    .admin-add-form {
        flex-wrap: wrap;
    }

    .admin-add-form input {
        min-width: 0;
    }

    .home-box {
        align-items: flex-start;
        padding: 1.25rem;
        text-align: left;
    }

    .home-box h3 {
        margin-bottom: 0.75rem;
    }

    .home-box:hover,
    .hub-summary-card:hover,
    .employee-card:hover {
        transform: none;
    }

    .home-charts-container,
    .home-charts-container .chart-card,
    .crm-workspace-card {
        padding: 1rem;
        border-radius: 14px;
    }

    .header-content h1,
    .dashboard-header h1 {
        font-size: 1.6rem;
    }

    .tabs,
    .tab-nav {
        max-width: 100%;
        margin-bottom: 1rem;
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .tab-btn,
    .tabs .tab-btn {
        flex: 0 0 auto;
        min-height: 42px;
        padding: 0.65rem 0.9rem;
    }

    .modal {
        align-items: flex-end;
        padding: 0;
    }

    .modal-content,
    .modal-content.modal-xl,
    .bc-modal .modal-content {
        max-height: calc(100dvh - env(safe-area-inset-top));
        border-radius: 14px 14px 0 0;
    }

    .modal-header {
        padding: 1rem;
    }

    .modal-header > div {
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .modal-body,
    .modal-footer {
        padding: 1rem;
    }

    .modal-footer .btn {
        min-height: 44px;
    }

    .input-with-currency {
        flex-direction: column;
    }

    .bc-card-body {
        grid-template-columns: minmax(0, 1fr);
    }

    .pwa-install-prompt {
        padding: 0;
    }

    .pwa-install-card {
        width: 100%;
        grid-template-columns: 60px minmax(0, 1fr);
        gap: 0.9rem;
        padding: 1.25rem 1rem calc(1.25rem + env(safe-area-inset-bottom));
        border-right: 0;
        border-bottom: 0;
        border-left: 0;
        border-radius: 16px 16px 0 0;
    }

    .pwa-install-icon {
        width: 60px;
        height: 60px;
        border-radius: 13px;
    }

    .pwa-install-copy {
        padding-right: 1.75rem;
    }

    .pwa-install-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .pwa-install-actions .btn {
        min-height: 46px;
        justify-content: center;
    }
}

@media (max-width: 360px) {
    .mobile-install-button {
        padding-right: 0.6rem;
        padding-left: 0.6rem;
        font-size: 0.75rem;
    }

    .mobile-app-logo {
        width: 112px;
    }

    .pwa-install-card {
        grid-template-columns: 52px minmax(0, 1fr);
    }

    .pwa-install-icon {
        width: 52px;
        height: 52px;
    }
}

@media (display-mode: standalone) {
    .mobile-install-button,
    .install-app-menu-button {
        display: none !important;
    }
}

