/* ===== Expense modal (#addExpenseModal) ===== */
.bt-xf .modal-dialog { max-width: 560px; }
.bt-xf .modal-content { border-radius: 22px; overflow: hidden; }
.bt-xf .modal-header { padding: 18px 22px 12px; border-bottom: 1px solid #eef2f6 !important; align-items: flex-start; }
.bt-xf .modal-title { color: #0f172a; font-size: 1.15rem; display: flex; align-items: center; gap: 4px; }
.bt-xf .modal-title i { color: #16a34a; }
.bt-xf-sub { color: #64748b; font-size: .82rem; font-weight: 600; margin-top: 2px; }
.bt-xf-sub:empty { display: none; }
.bt-xf .modal-body { padding: 18px 22px 8px; background: #f8fafc; }

.bt-xf-label { display: block; font-size: .82rem; font-weight: 700; color: #334155; margin-bottom: 6px; }
.bt-xf-label b { color: #dc2626; font-weight: 700; }
.bt-xf-hint { font-size: .78rem; color: #64748b; margin-top: 6px; }
.bt-xf .form-control, .bt-xf .form-select, .bt-xf .bt-combo-input {
    border-radius: 12px; border-color: #e2e8f0; min-height: 44px; font-size: .95rem; }
.bt-xf textarea.form-control { min-height: 64px; resize: vertical; }
.bt-xf .form-control:focus, .bt-xf .form-select:focus { border-color: #16a34a; box-shadow: 0 0 0 3px rgba(22, 163, 74, .12); }

/* amount card */
.bt-xf-amount { background: #fff; border: 1px solid #e2e8f0; border-radius: 18px; padding: 14px 16px; margin-bottom: 14px; }
.bt-xf-amount-box { position: relative; }
.bt-xf-amount-box input.form-control {
    font-size: 2rem; font-weight: 800; color: #15803d; height: 64px; border: 0; background: #f0fdf4;
    border-radius: 14px; padding-inline-start: 64px; direction: ltr; text-align: right; font-variant-numeric: tabular-nums; }
.bt-xf-amount-box input.form-control::placeholder { color: #a7d7b5; }
.bt-xf-amount-box input.form-control:focus { background: #ecfdf3; box-shadow: 0 0 0 3px rgba(22, 163, 74, .15); }
.bt-xf-amount-box input::-webkit-outer-spin-button, .bt-xf-amount-box input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.bt-xf-amount-box input[type=number] { -moz-appearance: textfield; }
.bt-xf-cur { position: absolute; inset-inline-end: auto; left: 16px; top: 50%; transform: translateY(-50%); color: #15803d; font-weight: 800; font-size: 1rem; pointer-events: none; }
.bt-xf-words:empty { display: none; }
.bt-xf-words { font-size: .78rem; color: #15803d; font-weight: 700; margin: 6px 2px 0; }
.bt-xf-date { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed #e2e8f0; }
.bt-xf-date > i { color: #94a3b8; }
.bt-xf-date input.form-control { flex: 1; min-height: 40px; max-width: 200px; }
.bt-xf-quick { display: flex; gap: 6px; margin-inline-start: auto; }
.bt-xf-quick button, .bt-xf-pills button {
    border: 1px solid #e2e8f0; background: #fff; color: #475569; border-radius: 999px; font-weight: 700;
    font-size: .82rem; padding: 6px 12px; line-height: 1.2; transition: all .15s; }
.bt-xf-quick button:hover, .bt-xf-pills button:hover { border-color: #86efac; color: #15803d; }
.bt-xf-quick button.on { background: #dcfce7; border-color: #86efac; color: #15803d; }

/* sections */
.bt-xf-sec { background: #fff; border: 1px solid #e2e8f0; border-radius: 18px; padding: 14px 16px 4px; margin-bottom: 14px; }
.bt-xf-sec-title { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: .92rem; color: #0f172a; margin-bottom: 12px; }
.bt-xf-sec-title span { width: 22px; height: 22px; border-radius: 50%; background: #dcfce7; color: #15803d; font-size: .75rem; display: inline-flex; align-items: center; justify-content: center; }
.bt-xf-sec-title small { color: #94a3b8; font-weight: 600; font-size: .75rem; }
.bt-xf-link { color: #16a34a !important; font-weight: 700; font-size: .8rem !important; }

/* pills */
.bt-xf-pills { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 6px; margin-bottom: 12px; }
.bt-xf-pills button { display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding: 9px 6px; white-space: nowrap; border-radius: 12px; }
.bt-xf-pills button i { font-size: .78rem; opacity: .7; }
.bt-xf-pills button.on { background: #16a34a; border-color: #16a34a; color: #fff; box-shadow: 0 4px 10px rgba(22, 163, 74, .22); }
.bt-xf-pills button.on i { opacity: 1; }

/* switch row */
.bt-xf-more { padding-bottom: 14px; }
.bt-xf-switch.form-switch { padding: 0; }
.bt-xf-switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; margin: 0; }
.bt-xf-switch b { display: block; font-size: .88rem; color: #0f172a; }
.bt-xf-switch b i { color: #f59e0b; margin-inline-end: 4px; }
.bt-xf-switch small { color: #64748b; font-size: .76rem; }
.bt-xf-switch .form-check-input { width: 2.6em; height: 1.4em; margin: 0 !important; float: none; flex-shrink: 0; cursor: pointer; }
.bt-xf-switch .form-check-input:checked { background-color: #f59e0b; border-color: #f59e0b; }

/* errors */
.bt-xf-err { color: #dc2626; font-size: .78rem; font-weight: 700; margin-top: 6px; }
.mb-3.bt-xf-bad .form-control, .mb-3.bt-xf-bad .form-select, .mb-3.bt-xf-bad .bt-combo-input { border-color: #fca5a5 !important; }
.bt-xf-amount.bt-xf-bad .bt-xf-amount-box input.form-control { background: #fef2f2; color: #b91c1c; }

/* sticky footer */
.bt-xf-foot { border-top: 1px solid #eef2f6; padding: 12px 22px; background: #fff; }
.bt-xf-foot .btn { margin: 0; padding: 13px; border-radius: 14px; font-size: 1rem; box-shadow: 0 6px 16px rgba(22, 163, 74, .25); }

@media (max-width: 575.98px) {
    .bt-xf .modal-dialog { margin: 0; max-width: none; min-height: 100%; align-items: flex-end; }
    .bt-xf .modal-dialog-scrollable { height: 100%; }
    .bt-xf .modal-content { border-radius: 22px 22px 0 0; max-height: 94vh; margin-top: auto; }
    .bt-xf .modal-body { padding: 14px 14px 6px; }
    .bt-xf .modal-header { padding: 16px 16px 10px; }
    .bt-xf-foot { padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); }
    .bt-xf-amount-box input.form-control { font-size: 1.7rem; height: 58px; }
    .bt-xf-date input.form-control { max-width: none; }
}

/* dark theme */
[data-theme="dark"] .bt-xf .modal-body, body.dark-mode .bt-xf .modal-body { background: #0f172a; }
[data-theme="dark"] .bt-xf-amount, [data-theme="dark"] .bt-xf-sec,
body.dark-mode .bt-xf-amount, body.dark-mode .bt-xf-sec { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .bt-xf-sec-title, [data-theme="dark"] .bt-xf-switch b, [data-theme="dark"] .bt-xf .modal-title,
body.dark-mode .bt-xf-sec-title, body.dark-mode .bt-xf-switch b, body.dark-mode .bt-xf .modal-title { color: #f1f5f9; }
[data-theme="dark"] .bt-xf-label, body.dark-mode .bt-xf-label { color: #cbd5e1; }
[data-theme="dark"] .bt-xf-amount-box input.form-control, body.dark-mode .bt-xf-amount-box input.form-control { background: #052e16; color: #4ade80; }
[data-theme="dark"] .bt-xf-quick button, [data-theme="dark"] .bt-xf-pills button,
body.dark-mode .bt-xf-quick button, body.dark-mode .bt-xf-pills button { background: #0f172a; border-color: #334155; color: #cbd5e1; }
[data-theme="dark"] .bt-xf-pills button.on, body.dark-mode .bt-xf-pills button.on { background: #16a34a; border-color: #16a34a; color: #fff; }
[data-theme="dark"] .bt-xf-foot, [data-theme="dark"] .bt-xf .modal-header,
body.dark-mode .bt-xf-foot, body.dark-mode .bt-xf .modal-header { background: #1e293b; border-color: #334155 !important; }

/* 2026-11-27: type/phase as full-width segmented controls (equal widths, no clipped text) */
.bt-xf-pills { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; padding: 4px; background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 14px; }
.bt-xf-pills button { min-width: 0; height: 42px; padding: 0 8px; border: 0 !important; background: transparent; border-radius: 10px; font-weight: 700; color: #475569; box-shadow: none; }
.bt-xf-pills button span { overflow: hidden; text-overflow: ellipsis; }
.bt-xf-pills button:hover { background: #fff; color: #15803d; }
.bt-xf-pills button.on { background: #fff; color: #15803d; box-shadow: 0 1px 3px rgba(15, 23, 42, .14), inset 0 -2px 0 #16a34a; }
.bt-xf-pills button.on i { color: #16a34a; }
@media (max-width: 420px) { #addExpenseModal .bt-xf-pills[role="radiogroup"]:has(> button:nth-child(4)) { grid-auto-flow: row; grid-template-columns: 1fr 1fr; } }
[data-theme="dark"] .bt-xf-pills, body.dark-mode .bt-xf-pills { background: #0f172a; border-color: #334155; }
[data-theme="dark"] .bt-xf-pills button, body.dark-mode .bt-xf-pills button { background: transparent; color: #cbd5e1; }
[data-theme="dark"] .bt-xf-pills button.on, body.dark-mode .bt-xf-pills button.on { background: #1e293b; color: #4ade80; box-shadow: inset 0 -2px 0 #22c55e; }

/* ===== Contract picker (js/contract-picker.js, 2026-11-27) ===== */
#expense-contract-status { display: none !important; }
.bt-cp-field { width: 100%; display: flex; align-items: center; gap: 10px; text-align: right; background: #f8fafc; border: 1.5px dashed #cbd5e1; border-radius: 14px; padding: 10px 12px; color: inherit; transition: border-color .15s, background .15s; }
.bt-cp-field:hover, .bt-cp-field:focus-visible { border-color: #0f4170; background: #fff; outline: none; }
.bt-cp-field.has-value { border-style: solid; border-color: #bfdbfe; background: #eff6ff; }
.bt-cp-f-ic { width: 38px; height: 38px; border-radius: 11px; display: inline-grid; place-items: center; background: rgba(15, 65, 112, .1); color: #0f4170; flex-shrink: 0; }
.bt-cp-f-txt { flex: 1; min-width: 0; }
.bt-cp-f-txt b { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: .95rem; }
.bt-cp-f-txt small { display: block; color: #64748b; font-size: .8rem; margin-top: 2px; }
.bt-cp-f-txt small strong { color: #15803d; }
.bt-cp-f-go { color: #94a3b8; font-size: .8rem; }
.bt-cp-f-change { font-size: .8rem; font-weight: 800; color: #0f4170; background: #fff; border: 1px solid #bfdbfe; border-radius: 999px; padding: 3px 10px; flex-shrink: 0; }
.bt-cp-warn { margin-top: 8px; background: #fffbeb; color: #92400e; border: 1px solid #fde68a; border-radius: 12px; padding: 8px 12px; font-size: .85rem; font-weight: 600; }
.bt-cp-warn i { color: #d97706; margin-left: 4px; }

.bt-cp-st { display: inline-flex; align-items: center; font-size: .7rem; font-weight: 800; padding: 2px 8px; border-radius: 999px; }
.bt-cp-st.is-active { background: #dbeafe; color: #1d4ed8; }
.bt-cp-st.is-done { background: #dcfce7; color: #15803d; }
.bt-cp-st.is-over { background: #fee2e2; color: #b91c1c; }
.bt-cp-st.is-quote { background: #f1f5f9; color: #475569; }

.bt-cp-modal .modal-content { border-radius: 20px; }
.bt-cp-modal .modal-title i { color: #e77c28; }
.bt-cp-tools { padding: 0 1rem .6rem; display: grid; gap: .6rem; border-bottom: 1px solid #e2e8f0; }
.bt-cp-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: #f1f5f9; border-radius: 12px; padding: 4px; }
.bt-cp-tabs button { border: 0; background: none; border-radius: 9px; padding: 8px; font-weight: 700; color: #64748b; font-size: .88rem; }
.bt-cp-tabs button span { display: inline-block; min-width: 22px; padding: 0 6px; border-radius: 999px; background: #e2e8f0; color: #475569; font-size: .75rem; margin-right: 4px; }
.bt-cp-tabs button.on { background: #fff; color: #0f4170; box-shadow: 0 1px 3px rgba(15, 23, 42, .12); }
.bt-cp-tabs button.on span { background: #0f4170; color: #fff; }
.bt-cp-search { position: relative; }
.bt-cp-search i { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: #94a3b8; }
.bt-cp-search input { padding-right: 36px; border-radius: 12px; height: 42px; }
.bt-cp-list { display: grid; gap: .6rem; }
.bt-cp-card { display: block; width: 100%; text-align: right; background: #fff; border: 1.5px solid #e2e8f0; border-radius: 16px; padding: 12px 14px; color: inherit; transition: border-color .15s, box-shadow .15s, transform .1s; }
.bt-cp-card:hover, .bt-cp-card:focus-visible { border-color: #0f4170; box-shadow: 0 10px 24px -16px rgba(15, 65, 112, .55); outline: none; }
.bt-cp-card.is-selected { border-color: #0f4170; background: #f8fbff; box-shadow: inset 0 0 0 1px #0f4170; }
.bt-cp-card.is-done:not(.is-selected) { opacity: .62; }
.bt-cp-none { display: flex; align-items: center; gap: 10px; }
.bt-cp-none b { display: block; } .bt-cp-none small { color: #64748b; }
.bt-cp-c-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bt-cp-no { font-weight: 800; color: #0f4170; background: rgba(15, 65, 112, .08); border-radius: 8px; padding: 1px 8px; font-size: .85rem; }
.bt-cp-sup { font-size: 1rem; }
.bt-cp-chosen { margin-right: auto; font-size: .75rem; font-weight: 800; color: #0f4170; }
.bt-cp-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; color: #64748b; font-size: .8rem; margin-top: 6px; }
.bt-cp-meta i { margin-left: 5px; opacity: .7; }
.bt-cp-stmt { margin-top: 6px; font-size: .88rem; color: #334155; }
.bt-cp-items { list-style: none; margin: 8px 0 0; padding: 6px 10px; background: #f8fafc; border-radius: 10px; display: grid; gap: 2px; }
.bt-cp-items li { display: flex; justify-content: space-between; gap: 10px; font-size: .8rem; color: #475569; }
.bt-cp-items li.more { color: #94a3b8; }
.bt-cp-nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.bt-cp-nums div { background: #f8fafc; border-radius: 10px; padding: 6px 8px; }
.bt-cp-nums small { display: block; color: #64748b; font-size: .72rem; }
.bt-cp-nums b { font-size: .95rem; }
.bt-cp-nums b.is-paid { color: #0f4170; } .bt-cp-nums b.is-rem { color: #15803d; } .bt-cp-nums b.is-neg { color: #dc2626; }
.bt-cp-bar { height: 6px; background: #e2e8f0; border-radius: 6px; overflow: hidden; margin-top: 8px; }
.bt-cp-bar span { display: block; height: 100%; background: linear-gradient(90deg, #16a34a, #22c55e); border-radius: 6px; }
.bt-cp-card.is-over .bt-cp-bar span { background: #dc2626; }
.bt-cp-pending { margin-top: 6px; font-size: .78rem; color: #b45309; }
.bt-cp-empty { text-align: center; color: #64748b; padding: 1rem; }
@media (max-width: 575px) { .bt-cp-nums b { font-size: .82rem; } }

[data-theme="dark"] .bt-cp-field, body.dark-mode .bt-cp-field { background: #0f172a; border-color: #334155; }
[data-theme="dark"] .bt-cp-field.has-value, body.dark-mode .bt-cp-field.has-value { background: #172554; border-color: #1e3a8a; }
[data-theme="dark"] .bt-cp-card, [data-theme="dark"] .bt-cp-tabs button.on, body.dark-mode .bt-cp-card { background: #1e293b; border-color: #334155; color: #e2e8f0; }
[data-theme="dark"] .bt-cp-nums div, [data-theme="dark"] .bt-cp-items, [data-theme="dark"] .bt-cp-tabs { background: #0f172a; }
[data-theme="dark"] .bt-cp-stmt, [data-theme="dark"] .bt-cp-items li { color: #cbd5e1; }
[data-theme="dark"] .bt-cp-f-ic, [data-theme="dark"] .bt-cp-no, [data-theme="dark"] .bt-cp-nums b.is-paid { color: #93c5fd; }
