/* Slowbooks app shell and responsive navigation */
.app-topbar .navbar { min-height: 60px; z-index: 1040; }
.app-topbar .navbar { flex-wrap: nowrap; }
.app-topbar .navbar-brand { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-topbar .navbar > .d-flex { min-width: 0; }
.app-business-switcher { min-width: 0; }
.app-business-switcher-button { display: block; max-width: clamp(7rem, 28vw, 14rem); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-main { min-width: 0; }
.app-content { padding: 82px 1.25rem 2rem; }
.app-sidebar {
    --bs-offcanvas-width: 272px;
    color: var(--bs-body-color);
    background: var(--bs-body-bg);
}
.app-sidebar .offcanvas-body { overflow-y: auto; }
.app-sidebar-heading {
    color: var(--bs-secondary-color);
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .1em;
    padding: .6rem .75rem .35rem;
}
.app-sidebar-link,
.app-sidebar-section-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: .6rem .75rem;
    border: 0;
    border-radius: .45rem;
    color: var(--bs-body-color);
    background: transparent;
    text-align: left;
    text-decoration: none;
    font-size: .92rem;
    font-weight: 500;
    transition: background-color .15s ease, color .15s ease;
}
.app-sidebar-section-toggle { margin-top: .2rem; }
.app-sidebar-link:hover,
.app-sidebar-section-toggle:hover { color: var(--bs-primary); background: var(--bs-tertiary-bg); }
.app-sidebar-link.active,
.app-sidebar-section-toggle.active { color: var(--bs-primary-text-emphasis); background: var(--bs-primary-bg-subtle); font-weight: 650; }
.app-sidebar-section-toggle:focus-visible,
.app-sidebar-link:focus-visible { outline: 2px solid var(--bs-primary); outline-offset: 2px; }
.app-sidebar-chevron { color: var(--bs-secondary-color); transition: transform .15s ease; }
.app-sidebar-section-toggle[aria-expanded="true"] .app-sidebar-chevron { transform: rotate(180deg); }
.app-sidebar-subnav { display: grid; gap: .1rem; padding: .2rem 0 .5rem .8rem; }
.app-sidebar-subnav .app-sidebar-link { padding-top: .48rem; padding-bottom: .48rem; font-size: .875rem; }
.app-footer { transition: margin-left .2s ease; }
.budget-table { min-width: 1800px; }
.budget-month-input { min-width: 88px; }
.chart-scroll { overflow-x: auto; }
.dashboard-chart { display: block; width: 100%; min-width: 0; height: auto; }
.chart-axis { stroke: var(--bs-border-color); stroke-width: 1; }
.chart-grid { stroke: var(--bs-border-color); stroke-width: 1; stroke-dasharray: 3 5; opacity: .55; }
.chart-label { fill: var(--bs-secondary-color); font-size: 11px; }
.chart-income { fill: #18b99a; }
.chart-expense { fill: #f28b5b; }
.chart-legend { display: inline-block; width: .75rem; height: .75rem; margin-right: .3rem; border-radius: .2rem; vertical-align: -.05rem; }
.chart-legend.chart-income { background: linear-gradient(135deg, #0f9f8f, #48d6a5); }
.chart-legend.chart-expense { background: linear-gradient(135deg, #ed6a5a, #ffb347); }
.chart-cash-line { fill: none; stroke: #8063e8; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 2px 3px rgb(99 91 255 / 22%)); }
.chart-cash-point { fill: #8f5bdf; stroke: var(--bs-body-bg); stroke-width: 2.5; }

/* Keep wide data grids inside their own scroll area on narrow screens. */
.grid-view { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.grid-view > table { min-width: 40rem; }
.table-responsive { -webkit-overflow-scrolling: touch; }
.table-responsive > .table { margin-bottom: 0; }
.app-content img, .app-content video, .app-content canvas { max-width: 100%; }
.app-content pre, .app-content code { overflow-wrap: anywhere; }

/* Clean accounting workspace, inspired by modern cloud bookkeeping apps. */
body.app-authenticated {
    --bs-primary: #1677ff;
    --bs-primary-rgb: 22, 119, 255;
    --bs-link-color: #1677ff;
    --bs-link-hover-color: #0958d9;
    background: #f5f7fb;
    color: #27364b;
}
html[data-bs-theme="dark"] body.app-authenticated {
    --bs-primary: #6ea8fe;
    --bs-primary-rgb: 110, 168, 254;
    --bs-link-color: #8ab8ff;
    --bs-link-hover-color: #b6d2ff;
    background: #111821;
    color: #e6edf5;
}
.app-topbar .navbar {
    min-height: 62px;
    background: #fff !important;
    border-bottom: 1px solid #e7ebf1;
    box-shadow: 0 1px 3px rgb(16 24 40 / 5%);
    color: #27364b;
}
.app-topbar .navbar-brand { color: #1c2c42 !important; letter-spacing: -.025em; }
.app-brand-mark {
    display: inline-grid;
    width: 2rem;
    height: 2rem;
    place-items: center;
    border-radius: .55rem;
    color: #fff;
    background: linear-gradient(145deg, #1683ff, #1264d8);
    box-shadow: 0 .2rem .55rem rgb(22 119 255 / 22%);
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: -.04em;
}
.app-brand-name { font-size: 1.02rem; }
.app-topbar .navbar { background: #20263f !important; border-bottom-color: #20263f; box-shadow: none; }
.app-topbar .navbar-brand { color: #fff !important; }
.app-topbar .text-white, .app-topbar .text-white-50 { color: #eef2ff !important; }
.app-topbar .btn-outline-light { color: #edf1ff; border-color: rgb(255 255 255 / 28%); }
.app-topbar .btn-outline-light:hover { color: #fff; background: rgb(255 255 255 / 10%); border-color: rgb(255 255 255 / 45%); }
.app-topbar #theme-toggle { color: #fff !important; }
.app-topbar .text-white, .app-topbar .text-white-50 { color: #66758a !important; }
.app-topbar .btn-outline-light { color: #34445a; border-color: #d5dce6; }
.app-topbar .btn-outline-light:hover { color: #1e293b; background: #f1f4f8; border-color: #c6cfdb; }
.app-topbar .navbar-toggler { border-color: #d5dce6; }
.app-topbar .navbar-toggler:focus { box-shadow: 0 0 0 .2rem rgb(22 119 255 / 18%); }
.app-topbar #theme-toggle { color: #526176 !important; }
.app-sidebar {
    background: #fff;
    border-color: #e7ebf1 !important;
}
.app-sidebar .offcanvas-body { padding: 1rem .8rem !important; }
.app-sidebar-heading { color: #8793a5; font-size: .66rem; letter-spacing: .11em; }
.app-sidebar-link, .app-sidebar-section-toggle { border-radius: .45rem; }
.app-sidebar-link.active, .app-sidebar-section-toggle.active {
    color: #1264d8;
    background: #eaf2ff;
}
.app-sidebar-subnav { padding-left: .55rem; }
.app-sidebar-subnav .app-sidebar-link { color: #536277; }
.app-sidebar-subnav .app-sidebar-link:hover,
.app-sidebar-subnav .app-sidebar-link.active { color: #1264d8; background: #eef5ff; }
.app-main { background: #f5f7fb; }
.app-content { max-width: 1800px; margin: 0 auto; }
.app-content > .breadcrumb { color: #7c899b; font-size: .82rem; }
.app-content h1 { color: #202f43; font-weight: 650; letter-spacing: -.025em; }
.app-content .card,
.app-content .invoice-editor-card,
.app-content .account-index .grid-view {
    border-color: #e4e9f0;
    border-radius: .7rem;
    box-shadow: 0 1px 3px rgb(16 24 40 / 4%);
}
.app-content .grid-view {
    padding: 0;
    border: 1px solid #e4e9f0;
    border-radius: .7rem;
    background: #fff;
}
.app-content .grid-view > table { margin-bottom: 0; }
.app-content .grid-view > table thead th {
    color: #64748b;
    background: #f7f9fc;
    border-bottom-color: #e5eaf1;
    font-size: .74rem;
    font-weight: 700;
    letter-spacing: .035em;
    text-transform: uppercase;
    white-space: nowrap;
}
.app-content .grid-view > table tbody tr:hover > td { background: #f5f9ff; }
.app-content .form-control, .app-content .form-select {
    border-color: #d8e0ea;
    border-radius: .45rem;
}
.app-content input[type="date"] { cursor: pointer; }
.app-content .form-control:focus, .app-content .form-select:focus {
    border-color: #75aaff;
    box-shadow: 0 0 0 .2rem rgb(22 119 255 / 13%);
}
.app-content .btn { border-radius: .45rem; font-weight: 550; }
.app-content .btn-success { --bs-btn-bg: #15966a; --bs-btn-border-color: #15966a; --bs-btn-hover-bg: #117c58; --bs-btn-hover-border-color: #117c58; }
html[data-bs-theme="dark"] .app-topbar .navbar { background: #20263f !important; border-bottom-color: #303c4c; color: #e6edf5; }
html[data-bs-theme="dark"] .app-topbar .navbar-brand { color: #f0f4fa !important; }
html[data-bs-theme="dark"] .app-brand-mark { color: #fff; }
html[data-bs-theme="dark"] .app-topbar .text-white,
html[data-bs-theme="dark"] .app-topbar .text-white-50 { color: #bdc8d7 !important; }
html[data-bs-theme="dark"] .app-topbar .btn-outline-light { color: #dce5ef; border-color: #526174; }
html[data-bs-theme="dark"] .app-topbar .btn-outline-light:hover { color: #fff; background: #2b394b; }
html[data-bs-theme="dark"] .app-sidebar { background: #1b2532; border-color: #303c4c !important; }
html[data-bs-theme="dark"] .app-main { background: #111821; }
html[data-bs-theme="dark"] .app-content h1 { color: #edf2f8; }
html[data-bs-theme="dark"] .app-content .grid-view { border-color: #303c4c; background: #1b2532; }
html[data-bs-theme="dark"] .app-content .grid-view > table thead th { color: #b6c3d3; background: #222f3f; border-bottom-color: #303c4c; }
html[data-bs-theme="dark"] .app-content .grid-view > table tbody tr:hover > td { background: #253449; }
html[data-bs-theme="dark"] .app-content .form-control,
html[data-bs-theme="dark"] .app-content .form-select { border-color: #465467; }

/* Expense entry layout modeled on modern accounting workspaces. */
.expense-create-heading { display:flex; align-items:center; justify-content:space-between; gap:1rem; margin:0 0 1rem; }
.expense-create-eyebrow { margin-bottom:.25rem; color:#728099; font-size:.68rem; font-weight:750; letter-spacing:.12em; }
.expense-create-heading h1 { margin:0; font-size:1.65rem; }
.expense-create-heading p { margin:.25rem 0 0; color:var(--bs-secondary-color); font-size:.9rem; }
.expense-entry-form { margin:0 -1.25rem -2rem; }
.expense-entry-grid { display:grid; grid-template-columns:minmax(0, 1fr) minmax(250px, 320px); min-height:calc(100vh - 230px); background:var(--bs-body-bg); border-top:1px solid var(--bs-border-color); }
.expense-entry-main { min-width:0; }
.expense-entry-tabs { display:flex; align-items:stretch; gap:0; min-height:56px; padding:0 1.5rem; border-bottom:1px solid var(--bs-border-color); }
.expense-entry-tabs > * { display:flex; align-items:center; padding:0 1rem; color:var(--bs-primary); text-decoration:none; }
.expense-entry-tabs > .active { position:relative; color:var(--bs-emphasis-color); font-weight:650; }
.expense-entry-tabs > .active::before { position:absolute; top:0; right:0; left:0; height:3px; border-radius:3px 3px 0 0; background:#4388f5; content:""; }
.expense-fields { display:grid; gap:.2rem; max-width:920px; padding:1.25rem clamp(1rem, 2.5vw, 2rem) 1rem; }
.expense-field-row { display:grid; grid-template-columns:minmax(140px, 205px) minmax(0, 1fr); align-items:center; gap:1rem; }
.expense-field-row-top { align-items:start; }
.expense-field-row > .form-label { margin:0; font-weight:500; }
.expense-field-row > .form-label span { color:#df4147; }
.expense-field-row > .form-group, .expense-field-row .form-group { margin:0; }
.expense-field-row .form-control, .expense-field-row .form-select { min-height:42px; border-color:#d7dbea; border-radius:.45rem; box-shadow:none; }
.expense-field-row textarea.form-control { min-height:88px; }
.expense-field-with-action { display:flex; gap:.4rem; min-width:0; }
.expense-field-with-action > .form-group { flex:1; min-width:0; }
.expense-field-with-action > .btn { width:42px; min-height:42px; font-size:1.25rem; line-height:1; }
.expense-amount-input { display:flex; max-width:530px; }
.expense-amount-input > span { display:flex; align-items:center; padding:0 .8rem; border:1px solid #d7dbea; border-right:0; border-radius:.45rem 0 0 .45rem; color:var(--bs-secondary-color); background:var(--bs-tertiary-bg); }
.expense-amount-input > .form-group { flex:1; min-width:0; }
.expense-amount-input .form-control { border-radius:0 .45rem .45rem 0; }
.expense-posting-note { margin:0; padding:.2rem 2rem 1.4rem; color:var(--bs-secondary-color); font-size:.82rem; }
.expense-receipt-panel { align-self:start; margin:3rem 1.5rem 1.5rem 0; padding:2rem 1.25rem; border:1px dashed #d7dbea; border-radius:.8rem; text-align:center; }
.expense-receipt-icon { display:grid; width:3rem; height:3rem; place-items:center; margin:0 auto 1rem; border-radius:.75rem; color:#fff; background:#202b5d; font-size:1.6rem; }
.expense-receipt-panel h2 { font-size:1rem; font-weight:650; }
.expense-receipt-panel p { color:var(--bs-secondary-color); font-size:.85rem; }
.expense-receipt-placeholder { margin-top:1.25rem; padding:.8rem; border-radius:.65rem; color:var(--bs-secondary-color); background:var(--bs-tertiary-bg); font-size:.82rem; }
.expense-entry-actions { position:sticky; bottom:0; z-index:5; display:flex; gap:.6rem; padding:.75rem 1.5rem; border-top:1px solid var(--bs-border-color); background:var(--bs-body-bg); box-shadow:0 -2px 8px rgb(16 24 40 / 5%); }
.expense-entry-actions .btn { min-height:40px; }
html[data-bs-theme="dark"] .expense-entry-grid { background:#1b2532; }
html[data-bs-theme="dark"] .expense-field-row .form-control, html[data-bs-theme="dark"] .expense-field-row .form-select,
html[data-bs-theme="dark"] .expense-amount-input > span, html[data-bs-theme="dark"] .expense-receipt-panel { border-color:#465467; }
@media(max-width: 767.98px) {
    .expense-entry-form { margin-right:-.75rem; margin-left:-.75rem; }
    .expense-entry-grid { grid-template-columns:minmax(0, 1fr); }
    .expense-field-row { grid-template-columns:1fr; gap:.3rem; padding:.3rem 0; }
    .expense-fields { padding:1rem; }
    .expense-receipt-panel { margin:0 1rem 1rem; padding:1.2rem; }
    .expense-entry-actions { padding:.65rem 1rem; }
    .expense-entry-actions .btn:first-child { flex:1; }
    .expense-create-heading { align-items:flex-start; flex-direction:column; }
}
@media (max-width: 991.98px) {
    .app-sidebar { border-right: 0; box-shadow: 0 1rem 2rem rgb(16 24 40 / 14%); }
    .app-main { min-height: calc(100vh - 62px); }
}

.app-content .btn,
.app-content .form-control,
.app-content .form-select { touch-action: manipulation; }

/* Invoice and estimate entry workspace */
.invoice-editor-page { max-width: 1500px; margin: 0 auto; }
.invoice-page-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.invoice-page-heading h1 { margin: .15rem 0 .3rem; font-size: clamp(1.7rem, 3vw, 2.2rem); font-weight: 700; letter-spacing: -.035em; }
.invoice-page-heading p { margin: 0; color: var(--bs-secondary-color); }
.invoice-eyebrow { color: #198754; font-size: .72rem; font-weight: 750; letter-spacing: .12em; }
.invoice-form { display: grid; gap: 1rem; }
.invoice-editor-card { padding: clamp(1rem, 2vw, 1.5rem); border: 1px solid var(--bs-border-color); border-radius: .85rem; background: var(--bs-body-bg); box-shadow: 0 .25rem 1rem rgb(21 47 39 / 4%); }
.invoice-card-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.2rem; }
.invoice-card-heading > div:first-child { display: flex; align-items: flex-start; gap: .8rem; }
.invoice-card-heading h2 { margin: 0; font-size: 1.05rem; font-weight: 700; }
.invoice-card-heading p { margin: .2rem 0 0; color: var(--bs-secondary-color); font-size: .88rem; }
.invoice-step { display: grid; flex: 0 0 1.85rem; width: 1.85rem; height: 1.85rem; place-items: center; border-radius: 50%; color: #116149; background: #e4f4ec; font-size: .85rem; font-weight: 750; }
.invoice-currency-badge { padding: .38rem .65rem; border: 1px solid var(--bs-border-color); border-radius: 2rem; color: var(--bs-emphasis-color); font-size: .8rem; font-weight: 700; white-space: nowrap; }
.invoice-currency-badge span { margin-left: .25rem; color: var(--bs-secondary-color); font-weight: 400; }
.invoice-form .form-label { color: var(--bs-emphasis-color); font-size: .88rem; font-weight: 600; }
.invoice-lines-card { padding-bottom: 1.25rem; }
.invoice-lines-table { min-width: 1080px; margin-bottom: 1rem; }
.invoice-lines-table th { color: var(--bs-secondary-color); font-size: .75rem; font-weight: 700; letter-spacing: .035em; text-transform: uppercase; white-space: nowrap; }
.invoice-lines-table td { vertical-align: top; }
.invoice-lines-table .invoice-line-description { min-width: 300px; }
.invoice-lines-table td:nth-child(2) { min-width: 90px; }
.invoice-lines-table td:nth-child(3) { min-width: 120px; }
.invoice-lines-table td:nth-child(4) { min-width: 190px; }
.invoice-lines-table td:nth-child(5) { min-width: 145px; }
.invoice-line-amount { min-width: 120px; padding-top: .85rem !important; font-weight: 650; }
.invoice-form { gap: .8rem; padding-bottom: 4.5rem; }
.invoice-form .invoice-customer-card { padding:0; overflow:hidden; border:0; border-bottom:1px solid var(--bs-border-color); border-radius:0; box-shadow:none; }
.invoice-form-tabs { display:flex; align-items:stretch; justify-content:space-between; min-height:52px; padding:0 clamp(1rem, 2vw, 1.5rem); border-bottom:1px solid var(--bs-border-color); }
.invoice-form-tabs > .active { position:relative; display:flex; align-items:center; padding:0 1rem; color:var(--bs-emphasis-color); font-weight:650; }
.invoice-form-tabs > .active::before { position:absolute; top:0; right:0; left:0; height:3px; border-radius:3px 3px 0 0; background:#4388f5; content:""; }
.invoice-draft-indicator { align-self:center; color:var(--bs-secondary-color); font-size:.82rem; }
.invoice-meta-grid { display:grid; grid-template-columns:minmax(260px, 2fr) repeat(3, minmax(145px, 1fr)); align-items:end; gap:1rem; padding:1.25rem clamp(1rem, 2vw, 1.5rem) 1.4rem; background:var(--bs-tertiary-bg); }
.invoice-meta-grid .form-label, .invoice-number-preview label { display:block; margin-bottom:.4rem; color:var(--bs-body-color); font-size:.88rem; font-weight:500; }
.invoice-meta-grid .form-label span { color:#df4147; }
.invoice-meta-grid .form-group { margin:0; }
.invoice-meta-grid .form-control, .invoice-meta-grid .form-select { min-height:42px; border-color:#d7dbea; border-radius:.45rem; box-shadow:none; }
.invoice-customer-input { display:flex; min-width:0; gap:.35rem; }
.invoice-customer-input > .form-group { flex:1; min-width:0; }
.invoice-customer-input > .btn { flex:0 0 42px; min-height:42px; font-size:1.25rem; }
.invoice-number-preview > div { display:flex; min-height:42px; align-items:center; padding:0 .75rem; border:1px dashed #d7dbea; border-radius:.45rem; color:var(--bs-secondary-color); background:var(--bs-body-bg); font-size:.88rem; }
.invoice-form .invoice-lines-card { padding:0 1rem 1rem; border-radius:.5rem; }
.invoice-form .invoice-lines-heading { min-height:56px; margin:0; }
.invoice-form .invoice-lines-heading .invoice-step { display:none; }
.invoice-form .invoice-lines-heading h2 { font-size:1rem; }
.invoice-form .invoice-lines-heading p { display:none; }
.invoice-lines-table th { padding-top:.7rem; padding-bottom:.7rem; background:var(--bs-tertiary-bg); }
.invoice-memo-card { padding:1rem 1.25rem; border-radius:.5rem; }
.invoice-memo-card .invoice-card-heading { margin-bottom:.75rem; }
.invoice-memo-card .invoice-card-heading p { display:none; }
.invoice-memo-summary-grid { display:grid; grid-template-columns:minmax(0, 1fr) minmax(340px, .95fr); gap:1.25rem; align-items:stretch; }
.invoice-memo-card, .invoice-summary-card { min-width:0; margin:0; }
.invoice-memo-card .form-label { margin-bottom:.65rem; }
.invoice-memo-card textarea.form-control { min-height:110px; }
.invoice-summary-card { gap:1.1rem; padding:1.25rem; border:0; border-radius:.55rem; background:#f8f9fc; box-shadow:none; }
.invoice-summary-row, .invoice-summary-grand { display:flex; align-items:center; justify-content:space-between; gap:1rem; }
.invoice-summary-grand { margin-top:auto; padding-top:1rem; border-top:1px solid var(--bs-border-color); font-size:1.08rem; font-weight:700; }
.invoice-summary-grand strong { color:var(--bs-emphasis-color); font-size:1.3rem; }
.invoice-summary-row strong { font-weight:600; }
.invoice-sticky-total { display:flex; flex-direction:column; justify-content:center; min-width:220px; margin-left:auto; padding-left:1.25rem; border-left:1px solid var(--bs-border-color); }
.invoice-sticky-total > span { color:var(--bs-secondary-color); font-size:.8rem; }
.invoice-sticky-total > strong { color:var(--bs-emphasis-color); font-size:1.12rem; }
.invoice-sticky-total > small { color:var(--bs-secondary-color); font-size:.72rem; }
.invoice-form-actions { position:sticky; bottom:0; z-index:20; align-items:center; margin:0 -1.25rem -2rem; padding:.65rem 1.5rem; border-top:1px solid var(--bs-border-color); background:var(--bs-body-bg); box-shadow:0 -2px 8px rgb(16 24 40 / 5%); }
.invoice-form-actions .btn { min-height:40px; }
html[data-bs-theme="dark"] .invoice-meta-grid { background:#151e29; }
html[data-bs-theme="dark"] .invoice-summary-card { background:#151e29; }
html[data-bs-theme="dark"] .invoice-meta-grid .form-control, html[data-bs-theme="dark"] .invoice-meta-grid .form-select,
html[data-bs-theme="dark"] .invoice-number-preview > div { border-color:#465467; }
.invoice-total-card { display: flex; flex-direction: column; justify-content: center; gap: .8rem; padding: 1.5rem; border: 1px solid #cde8da; border-radius: .85rem; background: linear-gradient(145deg, #f4fbf7, #fff 75%); }
.invoice-grand-total { align-items: baseline; margin-top: .25rem; padding-top: .85rem; border-top: 1px solid #cde8da; font-size: 1.15rem; }
.invoice-grand-total strong { color: #116149; font-size: 1.55rem; }
.invoice-help { color: var(--bs-secondary-color); font-size: .82rem; }
.invoice-form-actions { display: flex; justify-content: flex-end; gap: .65rem; padding: .25rem 0 .5rem; }
[data-bs-theme="dark"] .invoice-total-card { border-color: #285c4b; background: linear-gradient(145deg, #132c25, var(--bs-body-bg) 75%); }
[data-bs-theme="dark"] .invoice-grand-total { border-color: #285c4b; }
[data-bs-theme="dark"] .invoice-grand-total strong { color: #8ee0b8; }

@media (min-width: 992px) {
    .app-sidebar.offcanvas-lg {
        position: fixed;
        top: 60px;
        right: auto;
        bottom: 0;
        left: 0;
        width: 272px;
        height: auto;
        visibility: visible;
        transform: none;
        border-right: 1px solid var(--bs-border-color);
        z-index: 1020;
        transition: transform .2s ease, visibility .2s ease;
    }
    .app-sidebar.offcanvas-lg .offcanvas-body { height: 100%; }
    .app-authenticated .app-main,
    .app-authenticated .app-footer { margin-left: 272px; transition: margin-left .2s ease; }
    .app-authenticated.sidebar-hidden .app-sidebar.offcanvas-lg { transform: translateX(-100%); visibility: hidden; }
    .app-authenticated.sidebar-hidden .app-main,
    .app-authenticated.sidebar-hidden .app-footer { margin-left: 0; }
}

@media (min-width: 576px) and (max-width: 991.98px) {
    .invoice-meta-grid { grid-template-columns:repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 767.98px) {
    .invoice-memo-summary-grid { grid-template-columns:1fr; }
    .invoice-summary-card { min-height:190px; }
}

@media (max-width: 575.98px) {
    .app-content { padding: 76px .75rem 1.5rem; }
    .app-topbar .navbar { padding-right: .65rem !important; padding-left: .65rem !important; }
    .app-topbar .navbar-brand { font-size: 1rem; margin-right: .45rem !important; }
    .app-topbar .navbar > .d-flex { gap: .35rem !important; }
    .app-business-switcher-button { max-width: 28vw; padding-right: .45rem; padding-left: .45rem; }
    .app-logout-button { padding-right: .45rem; padding-left: .45rem; }
    .app-content h1 { font-size: clamp(1.45rem, 6vw, 1.9rem); }
    .app-content .card-body { padding: 1rem; }
    .app-content .table { font-size: .875rem; }
    .app-content .table > :not(caption) > * > * { padding: .5rem .45rem; }
    .app-content .btn-group { flex-wrap: wrap; }
    .app-content .btn { min-height: 38px; }
    .app-content .form-actions,
    .app-content .d-flex.justify-content-between,
    .app-content .d-flex.gap-2,
    .app-content .d-flex.gap-3 { flex-wrap: wrap; row-gap: .5rem; }
    .app-footer .container { padding-right: .75rem; padding-left: .75rem; }
    .invoice-page-heading { align-items: flex-start; flex-direction: column; }
    .invoice-page-heading > .btn { align-self: flex-start; }
    .invoice-card-heading { align-items: flex-start; }
    .invoice-currency-badge { font-size: .72rem; }
    .invoice-form-actions { position: sticky; bottom: .5rem; z-index: 10; justify-content: stretch; padding: .6rem; border: 1px solid var(--bs-border-color); border-radius: .8rem; background: color-mix(in srgb, var(--bs-body-bg) 92%, transparent); box-shadow: 0 .2rem 1rem rgb(0 0 0 / 10%); backdrop-filter: blur(10px); }
    .invoice-form-actions .btn { flex: 1; }
    .invoice-total-card { padding: 1rem; }
    .invoice-meta-grid { grid-template-columns:1fr; gap:.7rem; }
    .invoice-memo-summary-grid { grid-template-columns:1fr; }
    .invoice-form-actions { margin-right:-.75rem; margin-left:-.75rem; flex-wrap:wrap; }
    .invoice-sticky-total { width:100%; min-width:0; margin:0; padding:.5rem 0 0; border-top:1px solid var(--bs-border-color); border-left:0; }
}

/* QuickBooks-inspired green accounting workspace for Slowbooks. */
body.app-authenticated {
    --bs-primary: #2ca01c;
    --bs-primary-rgb: 44, 160, 28;
    --bs-success: #2ca01c;
    --bs-success-rgb: 44, 160, 28;
    --bs-link-color: #238719;
    --bs-link-hover-color: #176a10;
    --bs-primary-text-emphasis: #176a10;
    --bs-primary-bg-subtle: #e8f4e6;
    background: #f4f5f8;
    color: #2d3339;
}
body.app-authenticated .app-main { background:#f4f5f8; }
.app-topbar .navbar { background:#fff !important; border-bottom:1px solid #e2e5e8; box-shadow:0 1px 3px rgb(24 39 31 / 6%); color:#2d3339; }
.app-topbar .navbar-brand { color:#202a32 !important; }
.app-brand-mark { background:#2ca01c; box-shadow:none; }
.app-topbar .text-white, .app-topbar .text-white-50 { color:#59636d !important; }
.app-topbar .btn-outline-light { color:#46515b; border-color:#d4d9dd; }
.app-topbar .btn-outline-light:hover { color:#263238; background:#f3f5f6; border-color:#c5ccd1; }
.app-topbar .navbar-toggler { border-color:#d4d9dd; }
.app-topbar #theme-toggle { color:#52616b !important; }
.app-topbar .btn-primary, .app-content .btn-primary { --bs-btn-bg:#2ca01c; --bs-btn-border-color:#2ca01c; --bs-btn-hover-bg:#238719; --bs-btn-hover-border-color:#238719; --bs-btn-active-bg:#176a10; --bs-btn-active-border-color:#176a10; --bs-btn-color:#fff; }
.app-content .btn-success { --bs-btn-bg:#2ca01c; --bs-btn-border-color:#2ca01c; --bs-btn-hover-bg:#238719; --bs-btn-hover-border-color:#238719; }
.app-content .btn-outline-primary { --bs-btn-color:#238719; --bs-btn-border-color:#2ca01c; --bs-btn-hover-bg:#2ca01c; --bs-btn-hover-border-color:#2ca01c; --bs-btn-hover-color:#fff; }
.app-sidebar { background:#fff; border-color:#e1e5e8 !important; }
.app-sidebar-heading { color:#75808a; }
.app-sidebar-link { justify-content:flex-start; gap:.75rem; }
.app-sidebar-icon { display:inline-grid; flex:0 0 1.4rem; width:1.4rem; place-items:center; color:#68737c; font-size:1.02rem; font-weight:600; }
.app-sidebar-group-label { display:flex; align-items:center; gap:.75rem; }
.app-sidebar-section-toggle { padding-top:.65rem; padding-bottom:.65rem; color:#303a42; }
.app-sidebar-link.active, .app-sidebar-section-toggle.active { color:#216e1a; background:#eaf5e8; font-weight:650; }
.app-sidebar-link.active .app-sidebar-icon, .app-sidebar-section-toggle.active .app-sidebar-icon { color:#238719; }
.app-sidebar-link:hover, .app-sidebar-section-toggle:hover { color:#238719; background:#f2f7f1; }
.app-sidebar-subnav .app-sidebar-link { padding-left:.55rem; }
.app-sidebar-subnav .app-sidebar-link.active { border-left:3px solid #2ca01c; border-radius:0 .45rem .45rem 0; }
.app-sidebar-section-toggle[aria-expanded="true"] .app-sidebar-chevron { color:#2ca01c; }
.app-content .card, .app-content .invoice-editor-card, .app-content .grid-view { border-color:#e2e6e8; box-shadow:0 1px 3px rgb(29 40 35 / 5%); }
.app-content h1 { color:#263238; }
.app-content .grid-view { background:#fff; }
.app-content .grid-view > table thead th { color:#59656c; background:#f6f7f7; border-bottom-color:#e2e6e8; }
.app-content .grid-view > table tbody tr:hover > td { background:#f4f8f3; }
.app-content .form-control:focus, .app-content .form-select:focus { border-color:#79c36d; box-shadow:0 0 0 .2rem rgb(44 160 28 / 15%); }
.app-content .btn, .app-content .form-control, .app-content .form-select { border-radius:.35rem; }
.app-create-menu > .btn { min-width:78px; font-weight:650; }
.app-create-menu .dropdown-menu { min-width:220px; padding:.4rem; border-color:#e0e5e7; box-shadow:0 .5rem 1.5rem rgb(22 35 28 / 12%); }
.app-create-menu .dropdown-item { padding:.55rem .75rem; border-radius:.3rem; }
.invoice-eyebrow, .invoice-step { color:#237b1a; }
.invoice-step { color:#216e1a; background:#e8f4e6; }
.invoice-form-tabs > .active::before, .expense-entry-tabs > .active::before { background:#2ca01c; }
.invoice-summary-grand strong, .invoice-grand-total strong { color:#237b1a; }
.invoice-total-card { border-color:#d7ead4; background:linear-gradient(145deg, #f4fbf2, #fff 75%); }
.invoice-memo-summary-grid .invoice-summary-card { background:#f7f8f7; }
.expense-receipt-icon { background:#257719; }
html[data-bs-theme="dark"] body.app-authenticated { --bs-primary:#59bd4b; --bs-primary-rgb:89,189,75; --bs-success:#59bd4b; --bs-success-rgb:89,189,75; --bs-link-color:#73cd68; --bs-link-hover-color:#a0e296; --bs-primary-text-emphasis:#a0e296; --bs-primary-bg-subtle:#19351a; background:#111821; color:#e6edf5; }
html[data-bs-theme="dark"] .app-topbar .navbar { background:#192126 !important; border-color:#303c43; }
html[data-bs-theme="dark"] .app-topbar .navbar-brand { color:#f0f4fa !important; }
html[data-bs-theme="dark"] .app-topbar .text-white, html[data-bs-theme="dark"] .app-topbar .text-white-50 { color:#bdc8d7 !important; }
html[data-bs-theme="dark"] .app-topbar #theme-toggle { color:#dbe4ea !important; }
html[data-bs-theme="dark"] .app-topbar .btn-outline-light { color:#dce5ef; border-color:#526174; }
html[data-bs-theme="dark"] .app-sidebar { background:#1b2532; }
html[data-bs-theme="dark"] .app-sidebar-link.active, html[data-bs-theme="dark"] .app-sidebar-section-toggle.active { color:#a0e296; background:#19351a; }
html[data-bs-theme="dark"] .app-sidebar-icon { color:#a9b5bd; }
html[data-bs-theme="dark"] .invoice-total-card, html[data-bs-theme="dark"] .invoice-memo-summary-grid .invoice-summary-card { border-color:#315c30; background:#17251a; }
@media (max-width:575.98px) {
    .app-create-menu > .btn { min-width:42px; padding-right:.5rem; padding-left:.5rem; }
    .app-sidebar-icon { flex-basis:1.25rem; width:1.25rem; }
}

/* Optional blue accent theme; theme selection is saved per browser. */
html[data-accent-theme="blue"] body.app-authenticated {
    --slowbooks-accent:#1677ff;
    --slowbooks-accent-hover:#0958d9;
    --slowbooks-accent-soft:#eaf2ff;
    --bs-primary:#1677ff;
    --bs-primary-rgb:22,119,255;
    --bs-success:#1677ff;
    --bs-success-rgb:22,119,255;
    --bs-link-color:#1264d8;
    --bs-link-hover-color:#0958d9;
    --bs-primary-text-emphasis:#1264d8;
    --bs-primary-bg-subtle:#eaf2ff;
}
html[data-accent-theme="blue"] .app-brand-mark { background:#1677ff; }
html[data-accent-theme="blue"] .app-topbar .btn-primary,
html[data-accent-theme="blue"] .app-content .btn-primary,
html[data-accent-theme="blue"] .app-content .btn-success {
    --bs-btn-bg:#1677ff; --bs-btn-border-color:#1677ff; --bs-btn-hover-bg:#0958d9;
    --bs-btn-hover-border-color:#0958d9; --bs-btn-active-bg:#0848b5; --bs-btn-active-border-color:#0848b5;
}
html[data-accent-theme="blue"] .app-content .btn-outline-primary { --bs-btn-color:#1264d8; --bs-btn-border-color:#1677ff; --bs-btn-hover-bg:#1677ff; --bs-btn-hover-border-color:#1677ff; --bs-btn-hover-color:#fff; }
html[data-accent-theme="blue"] .app-sidebar-link.active,
html[data-accent-theme="blue"] .app-sidebar-section-toggle.active { color:#1264d8; background:#eaf2ff; }
html[data-accent-theme="blue"] .app-sidebar-link.active .app-sidebar-icon,
html[data-accent-theme="blue"] .app-sidebar-section-toggle.active .app-sidebar-icon,
html[data-accent-theme="blue"] .app-sidebar-link:hover,
html[data-accent-theme="blue"] .app-sidebar-section-toggle:hover,
html[data-accent-theme="blue"] .app-sidebar-section-toggle[aria-expanded="true"] .app-sidebar-chevron { color:#1264d8; }
html[data-accent-theme="blue"] .app-sidebar-link.active { border-left-color:#1677ff; }
html[data-accent-theme="blue"] .app-content .form-control:focus,
html[data-accent-theme="blue"] .app-content .form-select:focus { border-color:#75aaff; box-shadow:0 0 0 .2rem rgb(22 119 255 / 15%); }
html[data-accent-theme="blue"] .invoice-step { color:#1264d8; background:#eaf2ff; }
html[data-accent-theme="blue"] .invoice-form-tabs > .active::before,
html[data-accent-theme="blue"] .expense-entry-tabs > .active::before { background:#1677ff; }
html[data-accent-theme="blue"] .invoice-eyebrow,
html[data-accent-theme="blue"] .invoice-summary-grand strong,
html[data-accent-theme="blue"] .invoice-grand-total strong { color:#1264d8; }
html[data-accent-theme="blue"] .invoice-total-card { border-color:#cfe0ff; background:linear-gradient(145deg,#f3f7ff,#fff 75%); }
html[data-accent-theme="blue"] .invoice-memo-summary-grid .invoice-summary-card { background:#f4f7fc; }
html[data-accent-theme="blue"] .expense-receipt-icon { background:#174ca6; }
html[data-accent-theme="blue"] .app-accent-theme-toggle { color:#1677ff !important; }
html[data-bs-theme="dark"][data-accent-theme="blue"] body.app-authenticated {
    --bs-primary:#69a8ff; --bs-primary-rgb:105,168,255; --bs-success:#69a8ff; --bs-success-rgb:105,168,255;
    --bs-link-color:#8ab8ff; --bs-link-hover-color:#b6d2ff; --bs-primary-text-emphasis:#b6d2ff; --bs-primary-bg-subtle:#172d49;
}
html[data-bs-theme="dark"][data-accent-theme="blue"] .app-topbar .btn-primary,
html[data-bs-theme="dark"][data-accent-theme="blue"] .app-content .btn-primary,
html[data-bs-theme="dark"][data-accent-theme="blue"] .app-content .btn-success {
    --bs-btn-bg:#2678d9; --bs-btn-border-color:#2678d9; --bs-btn-hover-bg:#3588ed; --bs-btn-hover-border-color:#3588ed;
}
html[data-bs-theme="dark"][data-accent-theme="blue"] .app-sidebar-link.active,
html[data-bs-theme="dark"][data-accent-theme="blue"] .app-sidebar-section-toggle.active { color:#b6d2ff; background:#172d49; }
html[data-bs-theme="dark"][data-accent-theme="blue"] .invoice-total-card,
html[data-bs-theme="dark"][data-accent-theme="blue"] .invoice-memo-summary-grid .invoice-summary-card { border-color:#294b74; background:#172638; }
html[data-bs-theme="dark"][data-accent-theme="blue"] .invoice-summary-grand strong,
html[data-bs-theme="dark"][data-accent-theme="blue"] .invoice-grand-total strong,
html[data-bs-theme="dark"][data-accent-theme="blue"] .invoice-eyebrow { color:#8ab8ff; }

.add-new-modal { border:0; border-radius:.85rem; box-shadow:0 1.25rem 3rem rgb(20 35 55 / 20%); }
.add-new-modal .modal-header { padding:1.25rem 1.35rem; }
.add-new-modal .modal-body { padding:1rem 1.25rem 1.35rem; }
.add-new-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:.65rem; }
.add-new-item { display:flex; align-items:center; gap:.8rem; min-width:0; padding:.8rem; color:inherit; text-decoration:none; border:1px solid var(--bs-border-color); border-radius:.65rem; transition:background-color .15s ease,border-color .15s ease,transform .15s ease; }
.add-new-item:hover { color:var(--bs-primary); border-color:var(--bs-primary); background:var(--bs-primary-bg-subtle); transform:translateY(-1px); }
.add-new-icon { display:grid; place-items:center; width:2.5rem; height:2.5rem; flex:0 0 2.5rem; color:var(--bs-primary); background:var(--bs-primary-bg-subtle); border-radius:.65rem; font-size:.75rem; font-weight:750; letter-spacing:.02em; }
.add-new-copy { display:flex; flex:1; min-width:0; flex-direction:column; gap:.18rem; }
.add-new-copy strong { font-size:.9rem; font-weight:650; }
.add-new-copy small { color:var(--bs-secondary-color); font-size:.75rem; line-height:1.35; }
.add-new-arrow { color:var(--bs-secondary-color); font-size:1.35rem; }
@media (max-width:575.98px) { .add-new-grid { grid-template-columns:1fr; } }
.app-quick-create-popup { min-height:100vh; }
.quick-create-content { max-width:52rem; margin:0 auto; padding:.5rem .75rem 1rem; }
.quick-create-content > h1 { display:none; }
.quick-create-content .form-group,
.quick-create-content .mb-3 { margin-bottom:.8rem !important; }
