/* =========================================================================
   60 — Phase 2B: Billing & WIP, bill-a-matter, rate card, timesheet,
   matter budget bar + disbursements, portal budget + text-alert prefs.
   Builds on the shared .panel / .stat-card / .data-table / .ft-tabpill.
   ========================================================================= */

.portal-shell .fl-tablewrap{max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}
.portal-shell.firm-shell .btn-sm{padding:7px 13px;font-size:12.5px;border-radius:7px;line-height:1.2}
.portal-shell.firm-shell .data-table th.num,
.portal-shell.firm-shell .data-table td.num{text-align:right;font-variant-numeric:tabular-nums;white-space:nowrap}
.portal-shell.firm-shell .fl-kpi-money{font-family:'Playfair Display',Georgia,serif;font-size:21px;font-weight:800;line-height:1.15;font-variant-numeric:tabular-nums;word-break:break-word}
.portal-shell.firm-shell .fl-kpi-word{font-family:'Playfair Display',Georgia,serif;font-size:24px;font-weight:800}
.portal-shell.firm-shell .firm-notice.is-warn{background:#fff7e6;border:1px solid #f8dfb5;color:#8a4b06}
.portal-shell.firm-shell .fl-link-danger{background:none;border:0;padding:0;color:#b3161c;font-size:13px;font-weight:600;cursor:pointer;text-decoration:underline;text-underline-offset:2px}
.portal-shell.firm-shell .fl-link-danger:hover{color:#ed1c24}

/* ---- head + sub-tabs ---------------------------------------------------- */
.portal-shell.firm-shell .fl-bill-head{flex-wrap:wrap;gap:14px}
.portal-shell.firm-shell .fl-bill-panel .panel-head{gap:10px;flex-wrap:wrap}
.portal-shell.firm-shell .fl-bill-two{display:grid;grid-template-columns:minmax(0,1.4fr) minmax(0,1fr);gap:var(--fp-gap,20px);align-items:start}
.portal-shell.firm-shell .fl-bill-table .matter-ref{display:block;font-size:11.5px;color:#6b7280;margin-top:2px}
.portal-shell.firm-shell .fl-bill-table td.desc{max-width:340px;color:#374151}
.portal-shell.firm-shell .fl-bill-act{text-align:right;white-space:nowrap}
.portal-shell.firm-shell .fl-bill-norate a{font-weight:700;color:inherit}

/* ---- budget chips + bar ------------------------------------------------- */
.portal-shell .fl-bud-chip{display:inline-block;padding:3px 9px;border-radius:999px;font-size:12px;font-weight:700;font-variant-numeric:tabular-nums;background:#e9f6ef;color:#16704a}
.portal-shell .fl-bud-chip.is-warn{background:#fff4e0;color:#8a4b06}
.portal-shell .fl-bud-chip.is-over{background:#fdeaea;color:#b3161c}
.portal-shell .fl-bud-chip.is-none{background:#f1f2f6;color:#6b7280;font-weight:600}

.portal-shell .fl-budget{--bud:#16a34a;--bud-bg:#e9f6ef;margin:2px 0 6px}
.portal-shell .fl-budget.is-warn{--bud:#d97706;--bud-bg:#fff4e0}
.portal-shell .fl-budget.is-over{--bud:#ed1c24;--bud-bg:#fdeaea}
.portal-shell .fl-budget-top{display:flex;justify-content:space-between;align-items:baseline;gap:8px;margin-bottom:7px}
.portal-shell .fl-budget-lbl{font-size:11.5px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:#6b7280}
.portal-shell .fl-budget-pct{font-family:'Playfair Display',Georgia,serif;font-size:22px;font-weight:800;color:var(--bud);font-variant-numeric:tabular-nums}
.portal-shell .fl-budget-track{position:relative;height:10px;border-radius:999px;background:var(--bud-bg);overflow:hidden}
.portal-shell .fl-budget-fill{position:absolute;inset:0 auto 0 0;border-radius:999px;background:var(--bud);transition:width .4s ease}
.portal-shell .fl-budget-mark{position:absolute;top:0;bottom:0;left:80%;width:2px;background:rgba(21,34,77,.28)}
.portal-shell .fl-budget-nums{display:flex;justify-content:space-between;flex-wrap:wrap;gap:4px 10px;margin-top:8px;font-size:13px;color:#374151;font-variant-numeric:tabular-nums}
.portal-shell .fl-budget-nums b{color:var(--blue-ink,#15224d)}
.portal-shell .fl-budget-state{font-weight:700;color:var(--bud)}
.portal-shell .fl-budget-split{margin-top:6px;font-size:12px;color:#6b7280;line-height:1.45}
@media (prefers-reduced-motion:reduce){.portal-shell .fl-budget-fill{transition:none}}

/* ---- matter page: budget panel (rail) + disbursements (main) ------------- */
.portal-shell.firm-shell .fl-budget-panel .fl-budget{padding:0 var(--fp-pad,20px)}
.portal-shell.firm-shell .fl-budget-none{margin:0;padding:0 var(--fp-pad,20px);font-size:13.5px;color:#6b7280}
.portal-shell.firm-shell .fl-wip-facts{margin-top:12px}
.portal-shell.firm-shell .fl-budget-edit{margin:12px var(--fp-pad,20px) var(--fp-pad,20px);border-top:1px solid #eef0f4;padding-top:12px}
.portal-shell.firm-shell .fl-budget-edit summary{cursor:pointer;font-size:13px;font-weight:700;color:var(--blue,#26408d);list-style:none}
.portal-shell.firm-shell .fl-budget-edit summary::-webkit-details-marker{display:none}
.portal-shell.firm-shell .fl-budget-edit summary::before{content:'+ '}
.portal-shell.firm-shell .fl-budget-edit[open] summary::before{content:'– '}
.portal-shell.firm-shell .fl-budget-form{display:flex;flex-direction:column;gap:10px;margin-top:10px}
.portal-shell.firm-shell .fl-budget-form .firm-field{display:flex;flex-direction:column;gap:4px}
.portal-shell.firm-shell .fl-budget-form label{font-size:12px;font-weight:600;color:#4b5260}
.portal-shell.firm-shell .fl-budget-form input[type=text],
.portal-shell.firm-shell .fl-budget-form select{width:100%;padding:9px 11px;border:1.5px solid #e5e7eb;border-radius:8px;font:inherit;font-size:14px;background:#fff}
.portal-shell.firm-shell .fl-budget-row{display:grid;grid-template-columns:110px minmax(0,1fr);gap:10px}
.portal-shell.firm-shell .fl-budget-form .btn{align-self:flex-start}
.portal-shell.firm-shell .fl-budget-flash{margin-bottom:var(--fp-gap,20px)}
.portal-shell.firm-shell .fl-disb-form{border-top:1px solid #eef0f4}
.portal-shell.firm-shell .fl-disb-form .fl-disb-desc{flex:2 1 260px}
.portal-shell.firm-shell .fl-disb-form input[type=file]{padding:7px 8px;font-size:13px}
.portal-shell.firm-shell .fl-disb-rcpt{display:inline-flex;align-items:center;gap:3px;font-size:12px;font-weight:600;margin-left:6px;white-space:nowrap}
.portal-shell.firm-shell .fl-disb-table .badge{white-space:nowrap}

/* ---- bill a matter ------------------------------------------------------ */
.portal-shell.firm-shell .fl-bill-summary{display:grid;grid-template-columns:minmax(0,1.6fr) auto minmax(220px,1fr);gap:18px 28px;align-items:center;padding:var(--fp-pad,20px)}
.portal-shell.firm-shell .fl-bill-mtitle{font-family:'Playfair Display',Georgia,serif;font-size:22px;margin:2px 0 6px;line-height:1.2}
.portal-shell.firm-shell .fl-bill-mtitle a{color:var(--blue-ink,#15224d);text-decoration:none}
.portal-shell.firm-shell .fl-bill-mtitle a:hover{color:var(--red-dark,#c8141b)}
.portal-shell.firm-shell .fl-bill-cur .ft-tabpill{margin-top:6px}
.portal-shell.firm-shell .fl-bill-cur .firm-hint{max-width:260px;margin-top:6px}
.portal-shell.firm-shell .fl-bill-draftlist{list-style:none;margin:0;padding:0 var(--fp-pad,20px) var(--fp-pad,20px)}
.portal-shell.firm-shell .fl-bill-draftlist li{display:flex;flex-wrap:wrap;align-items:center;gap:8px 14px;padding:10px 0;border-bottom:1px solid #eef0f4}
.portal-shell.firm-shell .fl-bill-draftlist li:last-child{border-bottom:0}
.portal-shell.firm-shell .fl-bill-draftamt{font-weight:700;color:var(--blue-ink,#15224d);font-variant-numeric:tabular-nums}
.portal-shell.firm-shell .fl-bill-draftlist form{margin-left:auto}
.portal-shell.firm-shell .fl-bill-all{font-size:13px;font-weight:600;color:#4b5260;display:inline-flex;gap:6px;align-items:center;cursor:pointer}
.portal-shell.firm-shell .fl-bill-chk{width:36px}
.portal-shell.firm-shell .fl-bill-chk input,.portal-shell.firm-shell .fl-bill-all input{width:17px;height:17px;accent-color:#ed1c24}
.portal-shell.firm-shell .fl-bill-amt{width:130px;max-width:100%;text-align:right;padding:7px 9px;border:1.5px solid #e5e7eb;border-radius:7px;font:inherit;font-size:13.5px;font-variant-numeric:tabular-nums}
.portal-shell.firm-shell .fl-bill-amt:focus{outline:none;border-color:#ed1c24;box-shadow:0 0 0 3px rgba(237,28,36,.12)}
.portal-shell.firm-shell .fl-bill-amt:disabled{background:#f5f6f8;color:#9ca3af}
.portal-shell.firm-shell .fl-bill-norate-cell{font-size:12px;color:#b3161c;font-weight:600}
.portal-shell.firm-shell .fl-bill-mode{display:flex;flex-wrap:wrap;gap:8px 20px;align-items:center;padding:14px var(--fp-pad,20px);border-top:1px solid #eef0f4;font-size:13.5px}
.portal-shell.firm-shell .fl-bill-mode label{display:inline-flex;gap:7px;align-items:center;cursor:pointer}
.portal-shell.firm-shell .fl-bill-mode input{accent-color:#ed1c24}
.portal-shell.firm-shell .fl-bill-xcur{padding:0 var(--fp-pad,20px) var(--fp-pad,20px);margin:0}
.portal-shell.firm-shell .fl-bill-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px 16px;padding:0 var(--fp-pad,20px);align-items:end}
.portal-shell.firm-shell .fl-bill-grid .firm-field{display:flex;flex-direction:column;gap:4px}
.portal-shell.firm-shell .fl-bill-grid label{font-size:12px;font-weight:600;color:#4b5260}
.portal-shell.firm-shell .fl-bill-grid input,.portal-shell.firm-shell .fl-bill-grid textarea{width:100%;padding:9px 11px;border:1.5px solid #e5e7eb;border-radius:8px;font:inherit;font-size:14px}
.portal-shell.firm-shell .fl-bill-vat{grid-column:1/-1;display:flex !important;align-items:center;justify-content:flex-start;gap:8px;text-align:left;font-size:14px;font-weight:600;color:#1a1a2e;cursor:pointer}
.portal-shell.firm-shell .fl-bill-grid input[type=checkbox]{width:17px;height:17px;padding:0;flex:0 0 auto;accent-color:#ed1c24}
.portal-shell.firm-shell .fl-bill-notes{grid-column:1/-1}
.portal-shell.firm-shell .fl-bill-totals{margin:16px var(--fp-pad,20px) 0;padding:14px 16px;border-radius:10px;background:#f6f7fb;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px}
.portal-shell.firm-shell .fl-bill-totals div{display:flex;flex-direction:column;gap:2px}
.portal-shell.firm-shell .fl-bill-totals dt{font-size:11.5px;font-weight:700;letter-spacing:.05em;text-transform:uppercase;color:#6b7280}
.portal-shell.firm-shell .fl-bill-totals dd{margin:0;font-weight:700;color:var(--blue-ink,#15224d);font-variant-numeric:tabular-nums}
.portal-shell.firm-shell .fl-bill-totals .is-grand dd{font-family:'Playfair Display',Georgia,serif;font-size:20px;color:#c8141b}
.portal-shell.firm-shell .fl-bill-actions{display:flex;flex-wrap:wrap;justify-content:space-between;align-items:center;gap:12px;padding:16px var(--fp-pad,20px) var(--fp-pad,20px)}
.portal-shell.firm-shell .fl-bill-actions .firm-hint{margin:0;max-width:520px}

/* ---- rate card ---------------------------------------------------------- */
.portal-shell.firm-shell .fl-rates-table input[type=text]{width:130px;max-width:100%;padding:7px 9px;border:1.5px solid #e5e7eb;border-radius:7px;font:inherit;font-size:13.5px;text-align:right;font-variant-numeric:tabular-nums}
.portal-shell.firm-shell .fl-rates-table input.fl-rate-label{width:100%;min-width:180px;text-align:left;font-weight:600}
.portal-shell.firm-shell .fl-rates-table select{padding:7px 9px;border:1.5px solid #e5e7eb;border-radius:7px;font:inherit;font-size:13.5px;max-width:100%}
.portal-shell.firm-shell .fl-rates-table .matter-ref{display:block;font-size:11.5px;color:#6b7280}
.portal-shell.firm-shell .fl-rate-target{display:flex;align-items:center;gap:8px}
.portal-shell.firm-shell .fl-rate-target label{font-size:12px;font-weight:600;color:#4b5260}
.portal-shell.firm-shell .fl-rate-target input{width:80px;padding:7px 9px;border:1.5px solid #e5e7eb;border-radius:7px;font:inherit;text-align:right}

/* ---- timesheet ---------------------------------------------------------- */
.portal-shell.firm-shell .fl-ts-head{flex-wrap:wrap;gap:12px}
.portal-shell.firm-shell .fl-ts-weeknav{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.portal-shell.firm-shell .fl-ts-range{font-weight:700;color:var(--blue-ink,#15224d);min-width:150px;text-align:center}
.portal-shell.firm-shell .fl-ts-grid th[scope=row]{font-weight:600;max-width:260px}
.portal-shell.firm-shell .fl-ts-grid th[scope=row] a{color:var(--blue-ink,#15224d);text-decoration:none}
.portal-shell.firm-shell .fl-ts-grid .matter-ref{display:block;font-size:11px;color:#6b7280;font-weight:500}
.portal-shell.firm-shell .fl-ts-grid .is-today{background:#fdf2f2}
.portal-shell.firm-shell .fl-ts-grid thead .is-today{color:#c8141b}
.portal-shell.firm-shell .fl-ts-dow{font-size:11px;text-transform:uppercase;letter-spacing:.05em}
.portal-shell.firm-shell .fl-ts-dom{font-weight:700}
.portal-shell.firm-shell .fl-ts-grid tfoot th,.portal-shell.firm-shell .fl-ts-grid tfoot td{font-weight:700;border-top:2px solid #e5e7eb;background:#fafbfd}
.portal-shell.firm-shell .fl-ts-tot{font-weight:700;color:var(--blue-ink,#15224d)}
.portal-shell.firm-shell .fl-ts-empty{text-align:center;color:#6b7280;padding:22px}
.portal-shell.firm-shell .fl-ts-form{display:flex;flex-direction:column;gap:12px}
.portal-shell.firm-shell .fl-ts-form .finlaw-tt-field{display:flex;flex-direction:column;gap:4px}
.portal-shell.firm-shell .fl-ts-entries{list-style:none;margin:0;padding:0 var(--fp-pad,20px) var(--fp-pad,20px)}
.portal-shell.firm-shell .fl-ts-entries li{display:grid;grid-template-columns:54px minmax(0,1fr) auto;gap:10px;align-items:center;padding:10px 0;border-bottom:1px solid #eef0f4}
.portal-shell.firm-shell .fl-ts-entries li:last-child{border-bottom:0}
.portal-shell.firm-shell .fl-ts-e-h{font-family:'Playfair Display',Georgia,serif;font-weight:800;font-size:17px;color:#c8141b;font-variant-numeric:tabular-nums}
.portal-shell.firm-shell .fl-ts-e-main{display:flex;flex-direction:column;min-width:0}
.portal-shell.firm-shell .fl-ts-e-main b{color:var(--blue-ink,#15224d);font-size:13.5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.portal-shell.firm-shell .fl-ts-e-main span{font-size:12.5px;color:#6b7280;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

/* ---- portal: budget + text-alert preferences ------------------------------ */
.portal-shell .fl-portal-budget .fl-budget,
.portal-shell .fl-portal-budget-note{padding:0 var(--fp-pad,22px)}
.portal-shell .fl-portal-budget-note{font-size:12.5px;color:#6b7280;margin:6px 0 var(--fp-pad,22px);line-height:1.5}
.portal-shell .fl-alert-prefs .fl-ap-lede{font-size:14px;color:#374151;line-height:1.55;margin:0 0 12px}
.portal-shell .fl-ap-phone{display:block;margin-top:4px;font-weight:600;color:var(--blue-ink,#15224d)}
.portal-shell .fl-ap-phone.is-missing{color:#b3161c}
.portal-shell .fl-ap-table{width:100%;border-collapse:collapse;margin:4px 0 14px}
.portal-shell .fl-ap-table th,.portal-shell .fl-ap-table td{padding:11px 6px;border-bottom:1px solid #eef0f4;text-align:center;font-size:14px}
.portal-shell .fl-ap-table thead th{font-size:11.5px;letter-spacing:.06em;text-transform:uppercase;color:#6b7280;font-weight:700}
.portal-shell .fl-ap-table th[scope=row],.portal-shell .fl-ap-table thead th:first-child{text-align:left;font-weight:600;color:#1a1a2e}
.portal-shell .fl-ap-table td{width:92px}
.portal-shell .fl-ap-row{display:flex;flex-direction:column;gap:5px;margin-bottom:12px;max-width:360px}
.portal-shell .fl-ap-row label{font-size:12.5px;font-weight:600;color:#4b5260}
.portal-shell .fl-ap-row input{padding:10px 12px;border:1.5px solid #e5e7eb;border-radius:8px;font:inherit;font-size:14px}
.portal-shell .fl-ap-stop{border-top:1px solid #eef0f4;padding-top:12px}
.portal-shell .fl-ap-small{font-size:12.5px;color:#6b7280;line-height:1.5;margin:10px 0 14px}

/* ---- responsive --------------------------------------------------------- */
@media (max-width:1100px){
	.portal-shell.firm-shell .fl-bill-summary{grid-template-columns:minmax(0,1fr) auto}
	.portal-shell.firm-shell .fl-bill-budget{grid-column:1/-1}
}
@media (max-width:900px){
	.portal-shell.firm-shell .fl-bill-two{grid-template-columns:minmax(0,1fr)}
	.portal-shell.firm-shell .fl-bill-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
	.portal-shell.firm-shell .fl-bill-totals{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media (max-width:640px){
	.portal-shell.firm-shell .fl-kpi-money{font-size:17px}
	.portal-shell.firm-shell .fl-bill-summary{grid-template-columns:minmax(0,1fr)}
	.portal-shell.firm-shell .fl-bill-grid{grid-template-columns:minmax(0,1fr)}
	.portal-shell.firm-shell .fl-bill-actions .btn{width:100%;justify-content:center}
	.portal-shell.firm-shell .fl-bill-draftlist form{margin-left:0}
	/* WIP / bill / rate tables → stacked cards with labels. */
	.portal-shell.firm-shell .fl-bill-table thead{display:none}
	.portal-shell.firm-shell .fl-bill-table,
	.portal-shell.firm-shell .fl-bill-table tbody,
	.portal-shell.firm-shell .fl-bill-table tr{display:block;width:100%}
	.portal-shell.firm-shell .fl-bill-table tr{padding:12px var(--fp-pad,16px);border-bottom:1px solid #eef0f4;position:relative}
	.portal-shell.firm-shell .fl-bill-table td{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:4px 0 !important;border:0;text-align:right;white-space:normal}
	.portal-shell.firm-shell .fl-bill-table td::before{content:attr(data-label);font-size:11.5px;font-weight:700;letter-spacing:.04em;text-transform:uppercase;color:#6b7280;text-align:left;flex:0 0 auto}
	.portal-shell.firm-shell .fl-bill-table td:first-child{display:block;text-align:left;font-weight:600}
	.portal-shell.firm-shell .fl-bill-table td:first-child::before{display:none}
	.portal-shell.firm-shell .fl-bill-table td.desc{max-width:none}
	.portal-shell.firm-shell .fl-bill-table td.fl-bill-chk{position:absolute;right:var(--fp-pad,16px);top:12px;display:block;width:auto}
	.portal-shell.firm-shell .fl-bill-pick td:nth-child(2){display:flex;padding-right:36px !important}
	.portal-shell.firm-shell .fl-bill-pick td:nth-child(2)::before{display:block}
	.portal-shell.firm-shell .fl-bill-act{justify-content:flex-end !important;padding-top:8px !important}
	.portal-shell.firm-shell .fl-bill-act::before{display:none}
	.portal-shell.firm-shell .fl-rates-table input.fl-rate-label{min-width:0}
	.portal-shell.firm-shell .fl-disb-form .fl-disb-desc{flex:0 0 auto}
	.portal-shell.firm-shell .fl-ts-weeknav{width:100%;justify-content:space-between}
	.portal-shell.firm-shell .fl-ts-range{min-width:0;flex:1}
	.portal-shell.firm-shell .fl-ts-grid{font-size:12.5px}
	.portal-shell.firm-shell .fl-ts-grid th,.portal-shell.firm-shell .fl-ts-grid td{padding:9px 7px !important}
	.portal-shell.firm-shell .fl-ts-grid th[scope=row]{min-width:130px}
	.portal-shell.firm-shell .fl-disb-table tr{grid-template-columns:minmax(0,1fr) auto !important}
	.portal-shell .fl-ap-table td{width:64px}
}
