/* xPMS expenses */
.expenses-page { width: 100%; padding: 20px 20px 0; }
.exp-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.exp-title { color: #17262b; font-size: 26px; font-weight: 800; letter-spacing: -.03em; }
.exp-subtitle { margin: 3px 0 0; color: #64748b; font-size: 12px; }
.exp-head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.exp-head-actions select { border: 1px solid #d7e3e7; border-radius: 8px; background: #fff; color: #17262b; padding: 8px 10px; font: inherit; font-size: 12px; }
.exp-btn { border: 1px solid #d7e3e7; border-radius: 8px; background: #fff; color: #17262b; padding: 9px 13px; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.exp-btn:hover { background: #f2f5f6; }
.exp-btn.primary { background: #17262b; border-color: #17262b; color: #fff; }
.exp-btn.primary:hover { background: #356a8a; border-color: #356a8a; }

.exp-tabs { display: flex; gap: 4px; padding: 4px; border-radius: 10px; background: #e1e9eb; width: fit-content; margin-bottom: 16px; }
.exp-tab { border: 0; border-radius: 7px; background: transparent; color: #40565d; padding: 7px 14px; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.exp-tab.active { background: #fff; color: #17262b; box-shadow: 0 1px 2px rgba(23,38,43,.07); }

.exp-summary { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.exp-summary-card { padding: 14px; border: 1px solid #e1e9eb; border-radius: 10px; background: #fff; }
.exp-summary-card.main { background: #17262b; border-color: #17262b; }
.exp-summary-card span { display: block; color: #64748b; font-size: 11px; font-weight: 600; }
.exp-summary-card b { display: block; margin-top: 4px; color: #17262b; font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.exp-summary-card.main span { color: #afc3c7; }
.exp-summary-card.main b { color: #fff; }

.exp-filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.exp-filters select { border: 1px solid #d7e3e7; border-radius: 8px; background: #fff; color: #17262b; padding: 8px 10px; font: inherit; font-size: 12px; }

.exp-table { border: 1px solid #e1e9eb; border-radius: 10px; background: #fff; overflow: hidden; }
.exp-table-head, .exp-row { display: grid; grid-template-columns: 82px minmax(150px, 1.2fr) minmax(150px, 1.1fr) minmax(120px, .8fr) 112px 110px 58px; gap: 10px; align-items: center; padding: 10px 12px; }
.exp-table-head { background: #f2f5f6; color: #64748b; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.exp-row { border-top: 1px solid #eef3f4; font-size: 12px; color: #40565d; }
.exp-row:hover { background: #f8fafb; }
.exp-date { color: #64748b; font-size: 11px; }
.exp-category b, .exp-where b { display: block; color: #17262b; font-size: 12px; }
.exp-category small, .exp-where small { display: block; margin-top: 2px; color: #94a3b8; font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exp-amount { color: #17262b; font-weight: 800; text-align: right; white-space: nowrap; }
.exp-row-actions { display: flex; gap: 3px; justify-content: flex-end; }
.exp-row-actions button { width: 24px; height: 24px; border: 0; border-radius: 5px; background: transparent; color: #94a3b8; cursor: pointer; }
.exp-row-actions button:hover { background: #e1e9eb; color: #17262b; }
.exp-source { display: inline-flex; padding: 3px 7px; border-radius: 999px; font-size: 9px; font-weight: 800; white-space: nowrap; }
.exp-source.manual { background: #eef2f4; color: #40565d; }
.exp-source.recurring { background: #e0f2fe; color: #075985; }
.exp-source.cleaning_task { background: #ecfdf5; color: #166534; }
.exp-empty { padding: 32px 16px; border: 1px dashed #d7e3e7; border-radius: 10px; color: #94a3b8; font-size: 13px; text-align: center; }

.exp-section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.exp-section-head h3 { margin: 0; color: #17262b; font-size: 16px; font-weight: 800; }
.exp-section-head p { margin: 3px 0 0; color: #94a3b8; font-size: 11px; }
.exp-recurring-list { display: flex; flex-direction: column; gap: 8px; }
.exp-recurring-card { display: grid; grid-template-columns: minmax(180px, 1fr) auto auto auto; align-items: center; gap: 14px; padding: 13px; border: 1px solid #e1e9eb; border-radius: 10px; background: #fff; }
.exp-recurring-card b { display: block; color: #17262b; font-size: 13px; }
.exp-recurring-card small { color: #94a3b8; font-size: 10px; }
.exp-recurring-amount { color: #17262b; font-weight: 800; text-align: right; }
.exp-recurring-amount small { display: block; font-weight: 500; }

.exp-settings { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, .8fr); gap: 14px; align-items: start; }
.exp-card { border: 1px solid #e1e9eb; border-radius: 10px; background: #fff; padding: 15px; }
.exp-field { margin-bottom: 11px; }
.exp-field label { display: block; margin-bottom: 4px; color: #64748b; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.exp-field input, .exp-field select, .exp-field textarea { width: 100%; border: 1px solid #d7e3e7; border-radius: 7px; background: #fff; color: #17262b; padding: 9px 10px; font: inherit; font-size: 13px; }
.exp-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.exp-inline { display: flex; gap: 5px; }
.exp-hint { color: #64748b; font-size: 11px; line-height: 1.45; }
.exp-check { display: flex; align-items: center; gap: 8px; color: #40565d; font-size: 12px; }
.exp-check input { width: auto; }
.exp-object-table { overflow-x: auto; margin: 10px 0 14px; }
.exp-object-table table { width: 100%; border-collapse: collapse; font-size: 11px; }
.exp-object-table th { text-align: left; padding: 6px 8px; color: #94a3b8; font-size: 9px; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid #e1e9eb; }
.exp-object-table td { padding: 6px 8px; border-bottom: 1px solid #f1f5f9; color: #17262b; }
.exp-object-table td small { display: block; color: #94a3b8; font-size: 9px; }
.exp-object-table input { width: 88px; border: 1px solid #d7e3e7; border-radius: 6px; padding: 6px; font: inherit; font-size: 11px; }
.exp-categories { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.exp-category-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 999px; background: #f2f5f6; color: #40565d; font-size: 11px; }
.exp-category-chip i { width: 7px; height: 7px; border-radius: 50%; }
.exp-category-chip small { color: #94a3b8; font-size: 9px; }
.exp-category-chip button { border: 0; background: transparent; color: #94a3b8; cursor: pointer; padding: 0 0 0 2px; }
.exp-add-category { display: flex; gap: 6px; }
.exp-add-category input { flex: 1; border: 1px solid #d7e3e7; border-radius: 7px; padding: 8px 9px; font: inherit; font-size: 12px; }

/* Chessboard add menu */
.cb-add-wrap { position: relative; }
.cb-add-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 80; width: 168px; padding: 5px; border: 1px solid #e1e9eb; border-radius: 9px; background: #fff; box-shadow: 0 14px 30px rgba(23,38,43,.15); }
.cb-add-menu button { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; border-radius: 6px; background: transparent; color: #17262b; padding: 9px 10px; font: inherit; font-size: 13px; font-weight: 600; text-align: left; cursor: pointer; }
.cb-add-menu button:hover { background: #f2f5f6; }
.cb-add-menu i { width: 16px; height: 16px; color: #356a8a; }

html[data-theme="dark"] .expenses-page { color: #eaf1f2; }
html[data-theme="dark"] .exp-title,
html[data-theme="dark"] .exp-section-head h3,
html[data-theme="dark"] .exp-summary-card b,
html[data-theme="dark"] .exp-category b,
html[data-theme="dark"] .exp-where b,
html[data-theme="dark"] .exp-amount,
html[data-theme="dark"] .exp-recurring-card b,
html[data-theme="dark"] .exp-recurring-amount,
html[data-theme="dark"] .exp-card,
html[data-theme="dark"] .exp-object-table td { color: #eaf1f2; }
html[data-theme="dark"] .exp-subtitle,
html[data-theme="dark"] .exp-section-head p { color: #8fa7ad; }
html[data-theme="dark"] .exp-tabs { background: #17282d; }
html[data-theme="dark"] .exp-tab { color: #afc3c7; }
html[data-theme="dark"] .exp-tab.active { background: #1e3137; color: #eaf1f2; box-shadow: none; }
html[data-theme="dark"] .exp-head-actions select,
html[data-theme="dark"] .exp-filters select,
html[data-theme="dark"] .exp-btn,
html[data-theme="dark"] .exp-field input,
html[data-theme="dark"] .exp-field select,
html[data-theme="dark"] .exp-field textarea,
html[data-theme="dark"] .exp-add-category input,
html[data-theme="dark"] .exp-object-table input { background: #17282d; border-color: #2a4148; color: #eaf1f2; }
html[data-theme="dark"] .exp-btn:hover { background: #1e3137; }
html[data-theme="dark"] .exp-btn.primary { background: #7fb0c4; border-color: #7fb0c4; color: #0f1d21; }
html[data-theme="dark"] .exp-summary-card,
html[data-theme="dark"] .exp-table,
html[data-theme="dark"] .exp-recurring-card,
html[data-theme="dark"] .exp-card { background: #17282d; border-color: #2a4148; }
html[data-theme="dark"] .exp-summary-card.main { background: #1e3137; border-color: #3d5f6b; }
html[data-theme="dark"] .exp-summary-card span { color: #8fa7ad; }
html[data-theme="dark"] .exp-table-head { background: #1e3137; color: #8fa7ad; }
html[data-theme="dark"] .exp-row { border-top-color: #243a40; color: #afc3c7; }
html[data-theme="dark"] .exp-row:hover { background: #1e3137; }
html[data-theme="dark"] .exp-date,
html[data-theme="dark"] .exp-category small,
html[data-theme="dark"] .exp-where small { color: #8fa7ad; }
html[data-theme="dark"] .exp-empty { border-color: #2a4148; color: #8fa7ad; }
html[data-theme="dark"] .exp-row-actions button { color: #8fa7ad; }
html[data-theme="dark"] .exp-row-actions button:hover { background: #2a4148; color: #eaf1f2; }
html[data-theme="dark"] .exp-source.manual { background: #2a4148; color: #dbe6e9; }
html[data-theme="dark"] .exp-source.recurring { background: #12384a; color: #7dd3fc; }
html[data-theme="dark"] .exp-source.cleaning_task { background: #153a33; color: #a7f3d0; }
html[data-theme="dark"] .exp-category-chip { background: #1e3137; color: #dbe6e9; }
html[data-theme="dark"] .exp-category-chip small { color: #8fa7ad; }
html[data-theme="dark"] .exp-object-table th { color: #8fa7ad; border-bottom-color: #2a4148; }
html[data-theme="dark"] .exp-object-table td { border-bottom-color: #243a40; }
html[data-theme="dark"] .exp-hint { color: #8fa7ad; }
html[data-theme="dark"] .exp-check { color: #afc3c7; }
html[data-theme="dark"] .cb-add-menu { background: #17282d; border-color: #2a4148; }
html[data-theme="dark"] .cb-add-menu button { color: #eaf1f2; }
html[data-theme="dark"] .cb-add-menu button:hover { background: #1e3137; }

@media (max-width: 1050px) {
    .exp-summary { grid-template-columns: 1fr 1fr; }
    .exp-settings { grid-template-columns: 1fr; }
    .exp-table-head, .exp-row { grid-template-columns: 72px minmax(130px, 1.2fr) minmax(130px, 1fr) 92px 100px 52px; }
    .exp-table-head span:nth-child(4), .exp-row > span:nth-child(4) { display: none; }
}
@media (max-width: 700px) {
    .expenses-page { padding: 14px 12px 40px; }
    .exp-header { align-items: flex-start; }
    .exp-head-actions { width: 100%; }
    .exp-head-actions select { flex: 1; min-width: 0; }
    .exp-btn.primary { flex: 0 0 auto; }
    .exp-summary { grid-template-columns: 1fr 1fr; gap: 8px; }
    .exp-summary-card { padding: 11px; }
    .exp-summary-card b { font-size: 18px; }
    .exp-table-head { display: none; }
    .exp-row { grid-template-columns: 1fr auto; gap: 4px 10px; padding: 12px; }
    .exp-row > span { min-width: 0; }
    .exp-date { grid-column: 1; grid-row: 1; }
    .exp-amount { grid-column: 2; grid-row: 1; }
    .exp-category { grid-column: 1 / 3; grid-row: 2; }
    .exp-where { grid-column: 1 / 3; grid-row: 3; }
    .exp-staff { grid-column: 1; grid-row: 4; font-size: 10px; }
    .exp-row > span:nth-child(5) { grid-column: 2; grid-row: 4; justify-self: end; }
    .exp-row-actions { grid-column: 2; grid-row: 3; }
    .exp-recurring-card { grid-template-columns: 1fr auto; gap: 6px 10px; }
    .exp-recurring-amount { text-align: left; }
    .exp-form-row { grid-template-columns: 1fr; gap: 0; }
    .exp-add-category { flex-direction: column; }
}

.exp-breakdowns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.exp-breakdown h3 { margin: 0 0 9px; color: #17262b; font-size: 13px; font-weight: 800; }
.exp-breakdown-row { display: grid; grid-template-columns: 1fr auto; gap: 3px 8px; margin-bottom: 8px; color: #40565d; font-size: 11px; }
.exp-breakdown-row b { color: #17262b; }
.exp-breakdown-bar { grid-column: 1 / 3; height: 4px; overflow: hidden; border-radius: 99px; background: #eef3f4; }
.exp-breakdown-bar i { display: block; height: 100%; border-radius: inherit; background: #356a8a; }
html[data-theme="dark"] .exp-breakdown h3,
html[data-theme="dark"] .exp-breakdown-row b { color: #eaf1f2; }
html[data-theme="dark"] .exp-breakdown-row { color: #afc3c7; }
html[data-theme="dark"] .exp-breakdown-bar { background: #2a4148; }
html[data-theme="dark"] .exp-breakdown-bar i { background: #7fb0c4; }
@media (max-width: 900px) { .exp-breakdowns { grid-template-columns: 1fr; } }
.exp-history { margin-top: 14px; border-top: 1px solid #e1e9eb; padding-top: 10px; }
.exp-history summary { cursor: pointer; color: #40565d; font-size: 11px; font-weight: 700; }
.exp-history-row { display: flex; flex-direction: column; gap: 2px; padding: 7px 0; border-bottom: 1px solid #f1f5f9; color: #64748b; font-size: 10px; }
.exp-history-row b { color: #40565d; font-weight: 600; }
html[data-theme="dark"] .exp-history { border-top-color: #2a4148; }
html[data-theme="dark"] .exp-history summary,
html[data-theme="dark"] .exp-history-row b { color: #dbe6e9; }
html[data-theme="dark"] .exp-history-row { color: #8fa7ad; border-bottom-color: #243a40; }
.exp-alerts { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.exp-alerts > div { display: flex; align-items: flex-start; gap: 7px; padding: 8px 10px; border: 1px solid #fde68a; border-radius: 8px; background: #fffbeb; color: #92400e; font-size: 11px; line-height: 1.4; }
.exp-alerts span { display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px; border-radius: 50%; background: #f59e0b; color: #fff; font-size: 10px; font-weight: 800; flex: 0 0 auto; }
html[data-theme="dark"] .exp-alerts > div { background: #3a2a18; border-color: #6b4a23; color: #fcd9a4; }
.exp-allocation-list { display: flex; flex-wrap: wrap; gap: 6px 12px; padding: 8px 0; }
.exp-allocation-list label { display: inline-flex; align-items: center; gap: 5px; color: #40565d; font-size: 11px; }
.exp-allocation-list input { width: auto; }
html[data-theme="dark"] .exp-allocation-list label { color: #dbe6e9; }
.exp-layout { width: 100%; align-items: stretch; }
.exp-sidebar { background: #fff; }
.exp-content { padding: 4px 24px 60px; width: 100%; }
.exp-header { padding-bottom: 14px; }
@media (max-width: 1024px) {
    .exp-content { padding: 14px 16px 40px; }
    .exp-sidebar { background: #fff; }
}
@media (max-width: 640px) {
    .expenses-page { padding: 14px 12px 0; }
    .exp-content { padding: 12px 12px 40px; }
}
html[data-theme="dark"] .exp-sidebar { background: #17282d; border-color: #2a4148; }
/* Operations header and compact recurring forecast */
.exp-header { margin-bottom: 14px; padding-top: 4px; }
.exp-upcoming { margin-bottom: 12px; }
.exp-upcoming-toggle { display: inline-flex; align-items: center; gap: 7px; border: 1px solid #dbe6e9; border-radius: 8px; background: #fff; color: #17262b; padding: 7px 10px; font: inherit; font-size: 11px; font-weight: 700; cursor: pointer; }
.exp-upcoming-toggle b { display: inline-flex; align-items: center; justify-content: center; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px; background: #fef3c7; color: #92400e; font-size: 9px; }
.exp-upcoming-toggle i { width: 14px; height: 14px; color: #64748b; }
.exp-upcoming-list { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; margin-top: 7px; }
.exp-upcoming-list.hidden { display: none; }
.exp-upcoming-row { display: inline-flex; align-items: baseline; gap: 7px; max-width: 100%; padding: 5px 8px; border-radius: 6px; background: #f7fafb; color: #40565d; font-size: 11px; }
.exp-upcoming-row b { color: #17262b; }
.exp-upcoming-row small { color: #94a3b8; font-size: 10px; }
html[data-theme="dark"] .exp-upcoming-toggle { background: #17282d; border-color: #2a4148; color: #eaf1f2; }
html[data-theme="dark"] .exp-upcoming-row { background: #1e3137; color: #afc3c7; }
html[data-theme="dark"] .exp-upcoming-row b { color: #eaf1f2; }

/* Expense drawer sections */
#drawerExpense .drawer-body { padding-top: 8px; }
.exp-form-section { padding: 13px 0; border-bottom: 1px solid #eef3f4; }
.exp-form-section:first-child { padding-top: 4px; }
.exp-form-section:last-child { border-bottom: 0; padding-bottom: 4px; }
.exp-form-section-title { margin-bottom: 9px; color: #17262b; font-size: 12px; font-weight: 800; }
.exp-form-section .exp-field:last-child { margin-bottom: 0; }
.exp-form-section .exp-inline input { min-width: 0; }
html[data-theme="dark"] .exp-form-section { border-bottom-color: #243a40; }
html[data-theme="dark"] .exp-form-section-title { color: #eaf1f2; }