/* Finance — spreadsheet look (interim, per Sharon: "closer to Excel, in the system's style").
   Only overrides styles.css inside #finance-view; delete this file to go back.
   v8: the sheets fit the screen width (no sideways scrolling) + expected expenses.
   v9: monthly tables only as wide as their content needs (no stretching on big screens).
   v11: the right-click menu (#finance-context): compact, in this look; a bottom sheet on phones.
   v12: yearly sheet: "סה״כ שנתי" column + year totals in the corner of the total rows.
   v13: undo / redo buttons ↶ ↷ (touch-sized on phones).
   v14: money cells with text + a number are not counted in totals: dotted underline + grey ∅.
   v15: 📅 calendar hint in empty "תיאור הוצאה" cells + its popover / batch window (finance-calendar-hint.js).
   v16: ⚠️ התראות כסף panel at the top of the monthly view (finance-alerts.js).
   v17: the sheet palette is shared through .fs-tokens (📣 פניות קרות, renderer/outreach.css uses the same colours). */

.sheet-tabs,
#finance-view,
.fs-tokens {
  --fs-grid: rgba(255, 255, 255, 0.13);
  --fs-grid-strong: rgba(255, 255, 255, 0.28);
  --fs-head: #1b2430;
  --fs-cell: #0d141d;
  --fs-cell-alt: #111a25;
  --fs-index: #161f2b;
  --fs-focus: #22c55e;
  --fs-income: #16a34a;
  --fs-expense: #e11d48;
  --fs-personal: #a855f7;
}
#finance-view { gap: 10px; }

/* ---- year / month tabs: like sheet tabs ----
   Shared: .sheet-tabs > .sheet-tab use the same look anywhere (client page tabs + social tabs, Sharon 14.10). */
#finance-view .finance-header { gap: 6px; }
.sheet-tabs[class] { display: flex; align-items: flex-end; flex-wrap: nowrap; overflow-x: auto; padding-top: 4px; margin-bottom: 12px; }
#finance-view .finance-year-tabs,
#finance-view .finance-month-tabs,
.sheet-tabs[class] {
  gap: 0;
  border-bottom: 1px solid var(--fs-grid-strong);
}
.sheet-tabs .sheet-tab { cursor: pointer; font-family: inherit; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.sheet-tabs .sheet-tab .sx-badge, .sheet-tabs .sheet-tab .sheet-count { margin: 0; min-width: 16px; padding: 0 5px; border-radius: 999px; font-size: 10px; line-height: 16px; background: rgba(255,255,255,0.12); color: #fff; }
.sheet-tabs .sheet-tab.active .sx-badge, .sheet-tabs .sheet-tab.active .sheet-count { background: var(--fs-focus); color: #04120a; }
#finance-view .finance-year-tab,
#finance-view .finance-month-tab,
.sheet-tabs .sheet-tab {
  min-width: 0;
  padding: 6px 14px;
  border-radius: 6px 6px 0 0;
  border: 1px solid var(--fs-grid);
  border-bottom: none;
  margin-inline-start: -1px;
  background: var(--fs-index);
  color: #94a3b8;
  font-weight: 600;
  font-size: 13px;
  box-shadow: none;
}
#finance-view .finance-year-tab.active,
#finance-view .finance-month-tab.active,
.sheet-tabs .sheet-tab.active {
  background: var(--fs-cell);
  color: #fff;
  border-color: var(--fs-grid-strong);
  border-top: 2px solid var(--fs-focus);
  box-shadow: none;
  position: relative;
  top: 1px;
}

/* ---- the sheet area ---- */
#finance-view .finance-scroll {
  border-radius: 6px;
  border: 1px solid var(--fs-grid-strong);
  background: var(--fs-cell);
  padding: 0;
  /* the sheet's own width decides the layout (the sidebar / side panel change it, not only the screen) */
  container-type: inline-size;
  container-name: fsheet;
}
/* no minimum width: the tables shrink to the screen instead of scrolling sideways */
#finance-view .finance-monthly-layout,
#finance-view .finance-annual-layout { gap: 0; min-width: 0 !important; }
#finance-view .finance-stack { gap: 0; }

/* each table = a block with a thin coloured title bar (like a merged header row) */
#finance-view .finance-card {
  border: none;
  border-radius: 0;
  background: transparent;
  padding: 0 0 14px;
  gap: 0;
}
#finance-view .finance-card-head {
  padding: 6px 10px;
  background: var(--fs-head);
  border-bottom: 1px solid var(--fs-grid-strong);
  border-inline-start: 4px solid var(--fs-income);
}
#finance-view .finance-card-expense .finance-card-head { border-inline-start-color: var(--fs-expense); }
#finance-view .finance-card-head-copy { display: flex; align-items: baseline; gap: 10px; }
#finance-view .finance-card-title { font-size: 14px; font-weight: 700; color: #f1f5f9; }
#finance-view .finance-card-subtitle { font-size: 12px; color: #64748b !important; }

/* ---- grid ---- */
#finance-view .finance-table {
  border-collapse: collapse;
  width: 100%;
  min-width: 0 !important;
  table-layout: fixed;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}
#finance-view .finance-table th,
#finance-view .finance-table td {
  border: 1px solid var(--fs-grid);
  padding: 2px 6px;
  height: 26px;
  background: var(--fs-cell);
  text-align: right;
  transition: none;
}
#finance-view .finance-table tbody tr:nth-child(even) td { background: var(--fs-cell-alt); }
#finance-view .finance-table tbody tr:hover td { background: #16212e; }
#finance-view .finance-table th,
#finance-view .finance-table-expense th {
  background: var(--fs-head);
  color: #cbd5e1;
  font-weight: 700;
  font-size: 12px;
  text-align: center;
  height: 28px;
  border-bottom: 1px solid var(--fs-grid-strong);
}

/* row numbers column, like Excel's grey gutter */
#finance-view .finance-table td.is-row-index,
#finance-view .finance-table th.is-row-index {
  width: 34px;
  min-width: 0;
  background: var(--fs-index) !important;
  color: #64748b;
  text-align: center;
  font-size: 11px;
}

/* numbers: left-to-right, aligned like a spreadsheet */
#finance-view .finance-table td.is-money { direction: ltr; min-width: 0; }
#finance-view .finance-table th.is-money { min-width: 0; }
#finance-view .finance-table td.is-day,
#finance-view .finance-table th.is-day { min-width: 0; text-align: center; }

/* long text: wraps, at most 2 lines (full text on hover and while editing) */
#finance-view .finance-cell {
  min-height: 20px;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}
/* numbers / dates: never split inside a number (only at spaces, e.g. "75.52 & -75.52") */
#finance-view .finance-table td:is(.is-money, .is-day) .finance-cell,
#finance-view .finance-annual-sheet td:not(.finance-annual-label-col) .finance-cell { overflow-wrap: normal; word-break: keep-all; }
/* הערות / תיאור (v23): their line breaks show (an item list), still 2 lines in the sheet; all of it on hover / editing */
#finance-view .finance-cell[data-finance-multiline="1"] { white-space: pre-line; }
#finance-view .finance-cell[contenteditable="true"]:focus {
  display: block;
  -webkit-line-clamp: none;
  line-clamp: none;
  overflow: visible;
  white-space: pre-wrap;
  background: transparent;
  box-shadow: none;
}
/* active cell: green frame */
#finance-view .finance-table td:focus-within {
  outline: 2px solid var(--fs-focus);
  outline-offset: -2px;
  position: relative;
  z-index: 1;
}

#finance-view .finance-cell-select {
  min-height: 20px;
  height: 20px;
  padding: 0 4px;
  border-radius: 3px;
  border: none;
  font-size: 12px;
}

/* totals row: bold with a double top border */
#finance-view .finance-table-footer-row td {
  background: var(--fs-head) !important;
  border-top: 3px double var(--fs-grid-strong);
  font-weight: 800;
  color: #fff;
}

#finance-view .finance-add-row,
#finance-view .finance-add-row.inline {
  justify-self: start;
  margin: 4px 0 0;
  padding: 3px 10px;
  font-size: 12px;
  border-radius: 4px;
  background: transparent;
  color: #86efac;
  border: 1px dashed var(--fs-grid-strong);
  box-shadow: none;
}
#finance-view .finance-card-expense .finance-add-row { color: #fda4af; }

/* summary chips → plain status line */
#finance-view .finance-summary-line { gap: 16px; padding: 6px 10px; font-size: 12px; }
#finance-view .finance-summary-chip { padding: 0; border: none; background: none; border-radius: 0; }

/* colour marks: flat fills like Excel */
#finance-view .finance-table td.finance-mark-yellow { background: rgba(250, 204, 21, 0.28) !important; }
#finance-view .finance-table td.finance-mark-red { background: rgba(248, 113, 113, 0.26) !important; }
#finance-view .finance-table td.finance-mark-green { background: rgba(74, 222, 128, 0.22) !important; }

/* income, automatic (live): "סכום" not fully paid yet / "כמה יחידות" not all delivered. Soft amber, so it isn't
   mistaken for the yellow he paints by hand; a colour he chose himself is never covered (the JS skips those cells). */
#finance-view .finance-table td.finance-due {
  background: rgba(245, 158, 11, 0.16) !important;
  box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.42);
}
#finance-view .finance-table td.finance-due .finance-cell { color: #fcd34d; }
/* units total "ordered // delivered" reads in the same order as the column's cells (right to left) */
#finance-view .finance-table tr.finance-table-footer-row td[data-total-col="serviceUnits"] { direction: rtl; }

/* ---- yearly sheet ---- */
#finance-view .finance-annual-sheet .finance-annual-label-col,
#finance-view .finance-annual-sheet td.finance-annual-label-col {
  min-width: 0;
  background: var(--fs-index) !important;
  font-weight: 600;
  text-align: right;
}
#finance-view .finance-annual-month-name { font-size: 12px; }
#finance-view .finance-annual-month-num { margin-top: 0; font-size: 10px; color: #64748b; }
#finance-view .finance-annual-sheet td { direction: ltr; text-align: left; }
#finance-view .finance-annual-sheet td.finance-annual-label-col { direction: rtl; text-align: right; }
#finance-view .finance-annual-summary-row td { font-weight: 800; }
#finance-view .finance-annual-summary-row.is-income-total td { background: rgba(22, 163, 74, 0.16) !important; border-top: 3px double var(--fs-grid-strong); }
#finance-view .finance-annual-summary-row.is-expense-total td { background: rgba(225, 29, 72, 0.14) !important; border-top: 3px double var(--fs-grid-strong); }
#finance-view .finance-annual-summary-row.is-balance-total td { background: var(--fs-head) !important; }
#finance-view .finance-annual-summary-row.is-cumulative-total td { background: #0f1a2e !important; color: #93c5fd; }

@media (max-width: 900px) {
  #finance-view .finance-year-tab,
  #finance-view .finance-month-tab { padding: 5px 9px; font-size: 12px; }
}

/* dropdown cells (סוג, נותן שירות) fill their column */
#finance-view .finance-cell-select { width: 100%; min-width: 0; max-width: 100%; text-overflow: ellipsis; }

/* yearly: amounts centred, names stay on the right */
#finance-view .finance-annual-sheet td { text-align: center; }
#finance-view .finance-annual-sheet td.finance-annual-label-col { text-align: right; }

/* the 4 total rows at the bottom: taller and easier to read */
#finance-view .finance-annual-summary-row td {
  height: 42px;
  padding: 8px 6px;
  font-size: 14px;
  letter-spacing: 0.2px;
}
#finance-view .finance-annual-summary-row td.finance-annual-label-col { font-size: 13px; }

/* ---- alignment (per Sharon): these columns centred, everything else right ---- */
#finance-view .finance-table td,
#finance-view .finance-table td .finance-cell { text-align: right; }
#finance-view .finance-table-income td:is([data-col="purchaseDate"], [data-col="amountReceived"], [data-col="amountClosed"], [data-col="serviceUnits"], [data-col="serviceProvider"], [data-col="installments"], [data-col="invoiceNumber"]),
#finance-view .finance-table-expense td:is([data-col="category"], [data-col="dayOfMonth"], [data-col="totalAmount"], [data-col="invoiceChecked"], [data-col="paymentMethod"]) {
  text-align: center;
}
#finance-view .finance-table-income td:is([data-col="purchaseDate"], [data-col="amountReceived"], [data-col="amountClosed"], [data-col="serviceUnits"], [data-col="serviceProvider"], [data-col="installments"], [data-col="invoiceNumber"]) :is(.finance-cell, .finance-cell-select),
#finance-view .finance-table-expense td:is([data-col="category"], [data-col="dayOfMonth"], [data-col="totalAmount"], [data-col="invoiceChecked"], [data-col="paymentMethod"]) :is(.finance-cell, .finance-cell-select) {
  text-align: center;
  text-align-last: center;
}
#finance-view .finance-table td.is-row-index { text-align: center; }
/* Sharon (11.10): expense totals — a fixed-width box centred in the cell, digits right-aligned in it,
   so the decimal point and every digit sit exactly under the row above */
#finance-view .finance-table-expense td[data-col="totalAmount"] .finance-cell.is-decimal2 {
  display: inline-block;
  min-width: 10ch;
  direction: ltr;
  unicode-bidi: isolate;
  text-align: right;
  text-align-last: right;
  font-variant-numeric: tabular-nums;
}
#finance-view .finance-annual-sheet td,
#finance-view .finance-annual-sheet td .finance-cell { text-align: center; }
#finance-view .finance-annual-sheet td.finance-annual-label-col,
#finance-view .finance-annual-sheet td.finance-annual-label-col .finance-cell { text-align: right; }

/* ---- drag rows (yearly): long-press a name, then drag ---- */
body.finance-dragging, body.finance-dragging * { cursor: grabbing !important; user-select: none !important; }
#finance-view tr.finance-row-dragging td { opacity: 0.55; outline: 1px dashed var(--fs-focus); }
#finance-view tr.finance-drop-before td { box-shadow: inset 0 3px 0 var(--fs-focus); }
#finance-view tr.finance-drop-after td { box-shadow: inset 0 -3px 0 var(--fs-focus); }

/* ---- Finbot / VAT ---- */
#finance-view .finbot-badge {
  /* Sharon (11.10): just the sign, pinned to the cell's left edge; details in the floating tooltip (.finbot-tip) */
  position: absolute;
  left: 3px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 800;
  line-height: 16px;
  text-align: center;
  cursor: help;
  user-select: none;
}
#finance-view .finance-table td.has-finbot-badge { position: relative; text-align: center; padding-inline: 22px; }
.finbot-tip {
  position: fixed;
  z-index: 10000;
  display: none;
  max-width: 260px;
  padding: 6px 10px;
  border-radius: 6px;
  background: #0f172a;
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  color: #e2e8f0;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-line;
  direction: rtl;
  text-align: right;
  pointer-events: none;
}
.finbot-tip[data-kind="warn"] { border-color: rgba(245, 158, 11, 0.6); }
.finbot-tip[data-kind="bad"] { border-color: rgba(239, 68, 68, 0.6); }
#finance-view .finbot-badge.ok { background: rgba(34, 197, 94, 0.18); color: #4ade80; }
#finance-view .finbot-badge-line { display: block; }
#finance-view .finbot-badge.warn { background: rgba(245, 158, 11, 0.18); color: #fbbf24; }
#finance-view .finance-table td[data-col="invoiceChecked"] { white-space: normal; }
#finance-view .finance-table td[data-col="invoiceChecked"] .finance-cell { display: inline-block; min-width: 14px; }

#finance-view .finance-vat-panel {
  margin: 0 0 12px;
  padding: 8px 12px;
  background: var(--fs-head);
  border: 1px solid var(--fs-grid-strong);
  border-inline-start: 4px solid #f59e0b;
  font-size: 13px;
}
#finance-view .fv-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; }
#finance-view .fv-title { font-weight: 800; color: #fff; }
#finance-view .fv-ok { color: #4ade80; font-weight: 700; }
#finance-view .fv-bad { color: #f87171; font-weight: 700; }
#finance-view .fv-save { color: #fbbf24; }
#finance-view .fv-urgent { color: #f87171; }
#finance-view .fv-sub { margin-top: 4px; font-size: 12px; color: #94a3b8; }
#finance-view .fv-btn {
  margin-inline-start: auto;
  padding: 3px 10px;
  font-size: 12px;
  border-radius: 4px;
  border: 1px solid var(--fs-grid-strong);
  background: transparent;
  color: #e2e8f0;
  cursor: pointer;
}
#finance-view .finance-vat-panel[data-worst="red"] { border-inline-start-color: #ef4444; }
#finance-view .finance-vat-panel[data-worst="ok"] { border-inline-start-color: #22c55e; }
#finance-view .fv-details { margin-top: 6px; font-size: 12px; color: #cbd5e1; }
#finance-view .fv-details summary { cursor: pointer; color: #94a3b8; }
#finance-view .fv-details > div { max-height: 180px; overflow: auto; padding: 4px 0; columns: 2; }
#finance-view .finbot-badge.bad { background: rgba(239, 68, 68, 0.18); color: #f87171; }
/* 📎 proof files filed for an expense row (web/pay_out.js) */
#finance-view .finance-doc-link { margin-inline-start: 4px; text-decoration: none; font-size: 13px; cursor: pointer; user-select: none; }
#finance-view .finbot-badge.unknown { background: rgba(148, 163, 184, 0.16); color: #94a3b8; }

/* ---- fit the screen (v8): no sideways scrolling ---- */
#finance-view .finance-table th {
  white-space: normal; /* long headers take 2 lines instead of widening the column */
  line-height: 1.2;
}

/* ---- monthly tables: as wide as their content, not the whole screen (v9, Sharon 2.10) ----
   Each column takes the room its content needs plus a little air. Spare room on a big screen is split on both
   sides (tables centred) instead of stretching every cell. When the sheet is narrower than the content, the text
   columns shrink first (wrap, 2 lines) and numbers never split; below 900px rows become blocks (further
   down). Never sideways scrolling. The yearly sheet keeps its full-width fixed layout. */
@container fsheet (width > 900px) {
  /* the card hugs its table, centred on the screen (Sharon 2.10); its title bar follows the table, never widens it */
  #finance-view .finance-monthly-layout .finance-card { justify-self: center; min-width: 0; max-width: 100%; }
  #finance-view .finance-monthly-layout .finance-card-head { contain: inline-size; }
  #finance-view .finance-monthly-layout .finance-table { width: auto; max-width: 100%; table-layout: auto; }
  /* air between cells: 6px on a small sheet → 11px on a big one */
  #finance-view .finance-monthly-layout .finance-table :is(th, td):not(.is-row-index) { padding-inline: clamp(6px, 0.75cqi, 11px); }

  /* long text: a sensible width, then 2 lines (full text on hover / while editing) instead of growing without end */
  #finance-view .finance-monthly-layout .finance-table .finance-cell { max-width: 16em; }
  #finance-view .finance-monthly-layout .finance-table td:is([data-col="clientName"], [data-col="vendorName"]) .finance-cell { max-width: 10em; }
  #finance-view .finance-monthly-layout .finance-table td:is([data-col="description"], [data-col="offerName"], [data-col="notes"]) .finance-cell { max-width: 17em; }
  /* payment method stays narrow: 8827 / ביט / העברה; longer ones wrap ("העברה 1770," / "העברה 1670") (Sharon 2.10) */
  #finance-view .finance-monthly-layout .finance-table td[data-col="paymentMethod"] .finance-cell { max-width: 6em; }
  #finance-view .finance-monthly-layout .finance-table-expense td[data-col="paymentMethod"] .finance-cell { margin-inline: auto; } /* centred column */
  /* service provider: room for a name, not the input's default width */
  #finance-view .finance-monthly-layout .finance-table .finance-cell-search { max-width: 8em; }
}

/* yearly: names 13%, 12 months share the rest; numbers scale with the sheet width so even
   "-104,625.81" stays on one line inside its month */
#finance-view .finance-annual-sheet th.finance-annual-label-col { width: 13%; }
#finance-view .finance-annual-sheet td { font-size: clamp(10px, 1.02cqi, 12.5px); padding-inline: 2px !important; } /* !important: beats styles.css's phone padding */
#finance-view .finance-annual-sheet td .finance-cell { font-size: inherit !important; }
#finance-view .finance-annual-sheet td.finance-annual-label-col { padding-inline: 6px !important; }
#finance-view .finance-annual-summary-row td {
  font-size: clamp(10px, 1.05cqi, 13px);
  padding: 6px 2px;
  letter-spacing: 0;
  white-space: nowrap;
}

/* ---- expected expenses: a payment that's about to happen, not counted until "✓ שולם" ---- */
#finance-view .finance-table tbody tr.finance-row-expected td:not(.is-row-index) {
  background: repeating-linear-gradient(-45deg, rgba(148, 163, 184, 0.07) 0 6px, rgba(148, 163, 184, 0.02) 6px 12px), var(--fs-cell);
}
#finance-view tr.finance-row-expected td :is(.finance-cell, .finance-cell-select) {
  opacity: 0.55;
  font-style: italic;
}
#finance-view tr.finance-row-expected td.is-row-index { color: #7dd3fc; }
#finance-view .finance-expected-tag,
#finance-view .finance-paid-btn {
  display: inline-block;
  margin-inline-start: 4px;
  padding: 0 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  font-style: normal;
  line-height: 18px;
  white-space: nowrap;
  vertical-align: middle;
  user-select: none;
}
#finance-view .finance-expected-tag { background: rgba(56, 189, 248, 0.16); color: #7dd3fc; }
#finance-view .finance-paid-btn {
  border: 1px solid rgba(74, 222, 128, 0.45);
  background: transparent;
  color: #4ade80;
  cursor: pointer;
  font-family: inherit;
}
#finance-view .finance-paid-btn:hover { background: rgba(34, 197, 94, 0.16); }
#finance-view .finance-table-footer-row td.finance-expected-total {
  color: #7dd3fc;
  font-weight: 700;
  font-size: 12px;
  text-align: right;
  white-space: normal;
}
#finance-view .finance-add-actions { display: flex; flex-wrap: wrap; gap: 6px; }
#finance-view .finance-card-expense .finance-add-expected { color: #7dd3fc; border-color: rgba(56, 189, 248, 0.4); }

/* ---- narrow sheet (iPhone, iPad portrait, small window): every row becomes a small block of cells ----
   monthly below 900px, yearly below 960px (12 months + totals need more room) */
@container fsheet (max-width: 900px) {
  #finance-view .finance-card-head-copy { flex-wrap: wrap; gap: 2px 10px; }
  #finance-view .finance-table,
  #finance-view .finance-table tbody { display: block; width: 100%; }
  #finance-view .finance-table thead { display: none; } /* each cell shows its own column name */
  #finance-view .finance-table tbody tr {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    position: relative;
    padding-inline-start: 26px; /* room for the row-number gutter */
    border-bottom: 2px solid var(--fs-grid-strong);
  }
  #finance-view .finance-table tbody td {
    display: block;
    grid-column: span 2;
    min-width: 0;
    height: auto;
    min-height: 34px;
    padding: 2px 5px 3px !important;
    border-width: 0 0 1px;
    border-inline-end-width: 1px; /* cells side by side: one line between them, not two */
  }
  #finance-view .finance-table tbody td::before {
    content: attr(data-label);
    display: block;
    direction: rtl;
    text-align: right;
    font-size: 9.5px;
    font-weight: 600;
    font-style: normal;
    line-height: 1.25;
    color: #64748b;
    overflow-wrap: anywhere;
  }
  #finance-view .finance-table tbody td:not([data-label])::before { content: none; }
  /* row number: a grey strip down the side of the block, like Excel's gutter */
  #finance-view .finance-table tbody td.is-row-index {
    position: absolute;
    inset-block: 0;
    inset-inline-start: 0;
    width: 26px;
    min-height: 0;
    padding: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
  }
  #finance-view .finance-table tbody td.is-row-index::before { content: none; }

  /* which cells take more room (6 slots per line) */
  #finance-view .finance-table td:is([data-col="dayOfMonth"], [data-col="serviceUnits"], [data-col="installments"]) { grid-column: span 1; }
  #finance-view .finance-table td:is([data-col="vendorName"], [data-col="description"]) { grid-column: span 3; }
  #finance-view .finance-table[data-finance-table="businessExpenseRows"] td[data-col="description"] { grid-column: span 4; }
  #finance-view .finance-table td[data-col="offerName"] { grid-column: span 4; }
  #finance-view .finance-table td[data-col="serviceProvider"] { grid-column: span 3; }
  #finance-view .finance-table[data-finance-table="incomeRows"] td[data-col="notes"] { grid-column: span 3; }

  /* totals: only the cells that have something */
  #finance-view .finance-table tr.finance-table-footer-row td:empty { display: none; }
  #finance-view .finance-table tr.finance-table-footer-row td:is(.is-money, .finance-expected-total) { grid-column: span 3; }
  #finance-view .finance-table tr.finance-table-footer-row td.finance-expected-total { display: flex; align-items: center; }
}
@container fsheet (max-width: 960px) {
  #finance-view .finance-annual-sheet,
  #finance-view .finance-annual-sheet tbody { display: block; width: 100%; }
  #finance-view .finance-annual-sheet thead { display: none; }
  /* yearly: name across the top, then the months (6 per line) */
  #finance-view .finance-annual-sheet tbody tr {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    padding-inline-start: 0;
    border-bottom: 2px solid var(--fs-grid-strong);
  }
  #finance-view .finance-annual-sheet tbody td {
    display: block;
    grid-column: span 1;
    min-width: 0;
    height: auto;
    min-height: 34px;
    padding: 2px 4px 3px !important;
    border-width: 0 0 1px;
    border-inline-end-width: 1px;
    font-size: 12px;
  }
  #finance-view .finance-annual-sheet tbody td::before {
    content: attr(data-label);
    display: block;
    direction: rtl;
    text-align: right;
    font-size: 9.5px;
    font-weight: 600;
    line-height: 1.25;
    color: #64748b;
  }
  #finance-view .finance-annual-sheet tbody td.finance-annual-label-col {
    grid-column: 1 / -1;
    position: static;
    min-height: 0;
    font-size: 12.5px;
  }
  #finance-view .finance-annual-sheet tbody td.finance-annual-label-col::before { content: none; }
}
@container fsheet (max-width: 480px) {
  #finance-view .finance-annual-sheet tbody tr { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ---- v12: yearly "סה״כ שנתי" column (each row's 12 months, computed, never stored) + the year in the corner
   of every total row. Data rows: bold on the header colour; the total rows keep their own colours. ---- */
#finance-view .finance-annual-sheet th.finance-annual-total-col { width: 9%; }
#finance-view .finance-annual-sheet td.finance-annual-total-col {
  font-weight: 800;
  white-space: nowrap;
  border-inline-start: 3px double var(--fs-grid-strong);
}
#finance-view .finance-annual-sheet tr[data-finance-row-id] td.finance-annual-total-col {
  background: var(--fs-head) !important;
  color: #f1f5f9;
}
@container fsheet (max-width: 960px) {
  /* narrow: one full-width line under the months — the name on the right, the amount on the left */
  #finance-view .finance-annual-sheet tbody td.finance-annual-total-col {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: row-reverse; /* the cell is ltr: its label (::before) goes to the right */
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    min-height: 0;
    padding: 4px 6px !important;
    border-inline-start: none;
    border-top: 1px solid var(--fs-grid-strong);
  }
  #finance-view .finance-annual-sheet tbody td.finance-annual-total-col::before { font-size: 11px; }
  #finance-view .finance-annual-sheet tbody td[data-row-total]:empty { display: none; } /* blank separator rows */
}

/* ---- v10: add / delete a year (renderer/finance-years.js) ---- */
#finance-view .finance-year-tabs { align-items: flex-end; }
#finance-view .finance-year-del,
#finance-view .finance-year-add {
  min-width: 0;
  padding: 6px 9px;
  border-radius: 6px 6px 0 0;
  border: 1px dashed var(--fs-grid);
  border-bottom: none;
  margin-inline-start: 2px;
  background: transparent;
  color: #64748b;
  font-weight: 600;
  font-size: 12px;
  line-height: 1.2;
  box-shadow: none;
}
#finance-view .finance-year-del { padding: 6px 7px; opacity: 0.55; border-style: solid; }
#finance-view .finance-year-del:hover,
#finance-view .finance-year-del:focus-visible { opacity: 1; color: #fda4af; border-color: rgba(225, 29, 72, 0.6); background: rgba(225, 29, 72, 0.1); }
#finance-view .finance-year-add { margin-inline-start: 8px; color: #86efac; }
#finance-view .finance-year-add:hover,
#finance-view .finance-year-add:focus-visible { border-color: rgba(34, 197, 94, 0.6); background: rgba(34, 197, 94, 0.08); }
@media (max-width: 900px) {
  #finance-view .finance-year-del,
  #finance-view .finance-year-add { padding: 5px 7px; font-size: 12px; }
}

/* the popup (appended to <body>, so its colours are spelled out here) */
.fy-overlay {
  position: fixed;
  inset: 0;
  z-index: 100000; /* above the "נשמר" badge (save-status.js) */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(2, 6, 12, 0.66);
  backdrop-filter: blur(3px);
  direction: rtl;
}
.fy-overlay *, .fy-overlay *::before, .fy-overlay *::after { box-sizing: border-box; }
.fy-overlay [hidden] { display: none !important; }
.fy-card {
  width: min(420px, 100%);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-top: 3px solid #22c55e;
  background: #0d141d;
  color: #e2e8f0;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  font-size: 14px;
}
.fy-card.is-danger { border-top-color: #e11d48; }
.fy-card.is-locked { border-top-color: #f59e0b; }
.fy-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #1b2430;
  border-bottom: 1px solid rgba(255, 255, 255, 0.13);
}
.fy-icon { font-size: 18px; line-height: 1; }
.fy-title { font-size: 15px; font-weight: 700; color: #f1f5f9; }
.fy-body { padding: 14px 14px 4px; display: grid; gap: 10px; }
.fy-question { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.5; color: #f8fafc; }
.fy-card.is-locked .fy-question { color: #fde68a; }
.fy-note { margin: 0; font-size: 12.5px; line-height: 1.5; color: #94a3b8; }
.fy-field { display: grid; gap: 6px; font-size: 13px; color: #cbd5e1; }
.fy-select {
  width: 100%;
  min-height: 38px;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: #111a25;
  color: #f8fafc;
  font-size: 16px; /* 16px: no zoom-in on iPhone */
  font-variant-numeric: tabular-nums;
}
.fy-select:focus { outline: 2px solid #22c55e; outline-offset: -1px; }
.fy-error {
  margin: 8px 14px 0;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid rgba(248, 113, 113, 0.45);
  background: rgba(248, 113, 113, 0.12);
  color: #fecaca;
  font-size: 13px;
  line-height: 1.45;
}
.fy-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px; }
.fy-btn {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 7px 14px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: #161f2b;
  color: #cbd5e1;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: none;
}
.fy-btn:hover:not(:disabled) { background: #1b2430; color: #fff; }
.fy-btn:focus-visible { outline: 2px solid #22c55e; outline-offset: 1px; }
.fy-btn.is-primary { background: #16a34a; border-color: #16a34a; color: #fff; }
.fy-btn.is-primary:hover:not(:disabled) { background: #15803d; }
.fy-btn.is-danger { background: #be123c; border-color: #be123c; color: #fff; }
.fy-btn.is-danger:hover:not(:disabled) { background: #9f1239; }
.fy-btn:disabled { opacity: 0.6; cursor: progress; }
@media (max-width: 520px) {
  /* phones: a bottom sheet with full-width buttons */
  .fy-overlay { align-items: flex-end; padding: 0; }
  .fy-card { width: 100%; border-radius: 12px 12px 0 0; max-height: 85dvh; padding-bottom: env(safe-area-inset-bottom, 0); }
  .fy-actions { flex-direction: column; }
  .fy-btn { width: 100%; min-height: 44px; }
}

/* ---- v11: the right-click menu on the finance tables (#finance-context, outside #finance-view, so its colours are
   spelled out here). Compact: colour row (swatches + clear + תא/שורה) · actions · delete. Phones: a bottom sheet. ---- */
#finance-context.ctx-menu-finance {
  --fcm-bg: #111a25;
  --fcm-hover: #1b2430;
  --fcm-line: rgba(255, 255, 255, 0.13);
  --fcm-line-strong: rgba(255, 255, 255, 0.28);
  --fcm-text: #e2e8f0;
  --fcm-muted: #94a3b8;
  --fcm-focus: #22c55e;
  position: fixed;
  z-index: 1220;
  display: flex;
  flex-direction: column;
  gap: 0;
  width: max-content;
  min-width: 200px;
  max-width: min(240px, calc(100vw - 16px));
  max-height: calc(100dvh - 16px);
  padding: 4px;
  overflow: auto;
  overscroll-behavior: contain;
  direction: rtl;
  background: var(--fcm-bg);
  border: 1px solid var(--fcm-line-strong);
  border-radius: 6px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  color: var(--fcm-text);
  font-size: 13px;
  line-height: 1.2;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
#finance-context .ctx-divider {
  flex: none;
  height: 1px;
  margin: 4px 2px;
  background: var(--fcm-line);
}
#finance-context .fcm-group { display: flex; flex-direction: column; }

/* action rows: 30px, 13px, flat like the sheet's cells */
#finance-context .ctx-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 30px;
  height: 30px;
  padding: 0 10px;
  border: none;
  border-radius: 4px;
  background: transparent;
  box-shadow: none;
  color: var(--fcm-text);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  text-align: right;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.1s ease;
}
#finance-context .ctx-item:hover,
#finance-context .ctx-item:focus-visible { background: var(--fcm-hover); color: #fff; }
#finance-context .ctx-item:focus-visible { outline: 1px solid var(--fcm-focus); outline-offset: -1px; }
#finance-context .ctx-item.danger { color: #fda4af; }
#finance-context .ctx-item.danger:hover,
#finance-context .ctx-item.danger:focus-visible { background: rgba(225, 29, 72, 0.16); color: #fecdd3; }

/* colour row: "צבע" · ● ● ● ⊘ · [תא | שורה] */
#finance-context .fcm-color {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 6px 0 4px;
}
#finance-context .fcm-label { flex: none; padding-inline-start: 4px; color: var(--fcm-muted); font-size: 12px; font-weight: 600; }
#finance-context .fcm-swatches { display: flex; align-items: center; gap: 6px; }
#finance-context .fcm-swatch {
  flex: none;
  width: 18px;
  height: 18px;
  min-height: 0;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.35);
  box-shadow: none;
  cursor: pointer;
  transition: transform 0.1s ease;
}
#finance-context .fcm-swatch.is-yellow { background: #facc15; }
#finance-context .fcm-swatch.is-red { background: #f87171; }
#finance-context .fcm-swatch.is-green { background: #4ade80; }
/* "no colour": an empty circle with a slash */
#finance-context .fcm-swatch.is-clear {
  border: 1px solid var(--fcm-line-strong);
  background: linear-gradient(135deg, transparent calc(50% - 1px), #94a3b8 calc(50% - 1px), #94a3b8 calc(50% + 1px), transparent calc(50% + 1px)), transparent;
}
#finance-context .fcm-swatch:hover { transform: scale(1.15); }
#finance-context .fcm-swatch.is-clear:hover { border-color: #cbd5e1; }
#finance-context .fcm-swatch.is-on { box-shadow: 0 0 0 2px var(--fcm-bg), 0 0 0 3px #fff; }
#finance-context .fcm-swatch:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--fcm-bg), 0 0 0 3px var(--fcm-focus); }

/* the tiny תא / שורה switch */
#finance-context .fcm-target {
  flex: none;
  display: inline-flex;
  margin-inline-start: auto;
  border: 1px solid var(--fcm-line-strong);
  border-radius: 4px;
  overflow: hidden;
}
#finance-context .fcm-target button {
  min-height: 0;
  height: 20px;
  padding: 0 7px;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--fcm-muted);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}
#finance-context .fcm-target button + button { border-inline-start: 1px solid var(--fcm-line-strong); }
#finance-context .fcm-target button:hover:not(:disabled) { color: #fff; background: var(--fcm-hover); }
#finance-context .fcm-target button.is-on { background: #16a34a; color: #fff; }
#finance-context .fcm-target button:disabled { opacity: 0.35; cursor: default; }
#finance-context .fcm-target button:focus-visible { outline: 1px solid var(--fcm-focus); outline-offset: -1px; }

/* phones / touch (long-press): the same menu as a compact bottom sheet */
#finance-context.ctx-menu-finance.is-sheet {
  z-index: 9900;
  left: 0 !important;
  right: 0;
  top: auto !important;
  bottom: 0;
  width: 100%;
  min-width: 0;
  max-width: none;
  max-height: 70dvh;
  padding: 6px 8px calc(8px + env(safe-area-inset-bottom, 0px));
  border-width: 1px 0 0;
  border-top: 3px solid var(--fcm-focus);
  border-radius: 10px 10px 0 0;
  box-shadow: 0 -12px 32px rgba(0, 0, 0, 0.55);
  animation: fcm-sheet-in 0.14s ease-out;
}
@keyframes fcm-sheet-in { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }
#finance-context.is-sheet .ctx-item { height: 40px; min-height: 40px; font-size: 14px; }
#finance-context.is-sheet .fcm-color { height: 44px; gap: 10px; }
#finance-context.is-sheet .fcm-label { font-size: 13px; }
#finance-context.is-sheet .fcm-swatches { gap: 12px; }
#finance-context.is-sheet .fcm-swatch { width: 26px; height: 26px; }
#finance-context.is-sheet .fcm-target button { height: 28px; padding: 0 12px; font-size: 13px; }
.fcm-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9899;
  background: rgba(2, 6, 12, 0.5);
  touch-action: none;
}
@media (prefers-reduced-motion: reduce) {
  #finance-context.ctx-menu-finance.is-sheet { animation: none; }
}

/* Settings → אדמין → fingerprint status line */
.admin-passkey-status { margin-top: 6px; }
.admin-passkey-status[data-tone="ok"] { color: #86efac; }
.admin-passkey-status[data-tone="error"] { color: #fca5a5; }

/* ---- v13: undo / redo ↶ ↷ at the end of the year-tab row (app.main.js financeUndo). Touch-sized on phones. ---- */
#finance-view .finance-undo-bar {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-inline-start: auto; /* right-to-left: the far (left) end of the row */
  padding: 0 2px 4px;
}
#finance-view .finance-undo-btn {
  min-width: 34px;
  height: 28px;
  min-height: 0;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid var(--fs-grid-strong);
  background: var(--fs-index);
  color: #e2e8f0;
  font-size: 17px;
  font-weight: 700;
  line-height: 1;
  box-shadow: none;
  cursor: pointer;
  touch-action: manipulation; /* no double-tap zoom when tapped twice quickly */
}
#finance-view .finance-undo-btn:hover:not(:disabled) { background: var(--fs-head); color: #fff; border-color: var(--fs-focus); }
#finance-view .finance-undo-btn:focus-visible { outline: 2px solid var(--fs-focus); outline-offset: 1px; }
#finance-view .finance-undo-btn:disabled { opacity: 0.35; cursor: default; }
@media (pointer: coarse) {
  #finance-view .finance-undo-bar { gap: 8px; }
  #finance-view .finance-undo-btn { min-width: 44px; height: 40px; font-size: 21px; }
}

/* ---- v14: a money cell with text + a number ("בוטל 500", "289?") is NOT counted in any total (app.main.js
   financeCellAmountAgorot). Marked softly, not with the yellow / red / green / amber marks (they mean other things):
   a dotted underline + a small grey ∅ in the corner; the tooltip says "לא נספר בסה״כ: יש טקסט בתא". ---- */
#finance-view .finance-cell.is-uncounted {
  text-decoration: underline dotted rgba(148, 163, 184, 0.85);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
#finance-view .finance-table td:has(.finance-cell.is-uncounted) { position: relative; }
#finance-view .finance-table td:has(.finance-cell.is-uncounted)::after {
  content: "∅";
  position: absolute;
  top: 1px;
  left: 2px;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  color: #94a3b8;
  opacity: 0.85;
  pointer-events: none;
}
/* ---- v15: 📅 "what was this expense for?" (renderer/finance-calendar-hint.js): a small button in an empty
   "תיאור הוצאה" cell, a popover next to it (bottom sheet on phones) and the batch fill window. ---- */
#finance-view .finance-table td.fch-has-btn { position: relative; padding-inline-end: 28px; }
#finance-view .finance-table tbody td.fch-has-btn { padding-inline-end: 28px !important; }
#finance-view .fch-btn {
  position: absolute;
  inset-inline-end: 3px;
  bottom: 2px;
  width: 22px;
  height: 22px;
  min-height: 0;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 5px;
  background: #161f2b;
  box-shadow: none;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.6;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
#finance-view tr:hover .fch-btn,
#finance-view .fch-btn:hover,
#finance-view .fch-btn:focus-visible { opacity: 1; border-color: rgba(34, 197, 94, 0.6); background: rgba(34, 197, 94, 0.12); }
#finance-view .fch-btn:focus-visible { outline: 2px solid #22c55e; outline-offset: 1px; }
#finance-view .fch-batch {
  flex: none;
  margin-inline-start: auto;
  min-height: 0;
  padding: 3px 10px;
  border: 1px solid rgba(34, 197, 94, 0.45);
  border-radius: 4px;
  background: transparent;
  box-shadow: none;
  color: #86efac;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
  white-space: nowrap;
}
#finance-view .fch-batch:hover,
#finance-view .fch-batch:focus-visible { background: rgba(34, 197, 94, 0.12); color: #fff; }
@media (pointer: coarse) {
  /* touch: a real finger-sized target */
  #finance-view .finance-table tbody td.fch-has-btn { padding-inline-end: 40px !important; min-height: 40px; }
  #finance-view .fch-btn { width: 34px; height: 34px; font-size: 16px; opacity: 0.9; bottom: 3px; }
  #finance-view .fch-batch { padding: 7px 12px; font-size: 13px; }
}
@container fsheet (max-width: 900px) {
  #finance-view .finance-card-head:has(.fch-batch) { flex-wrap: wrap; gap: 6px; }
}

/* popover / sheet / batch window (appended to <body>, colours spelled out) */
.fch-pop, .fch-overlay { direction: rtl; color: #e2e8f0; font-size: 13.5px; line-height: 1.45; }
.fch-pop *, .fch-overlay * { box-sizing: border-box; }
.fch-pop {
  position: fixed;
  z-index: 1230;
  width: min(380px, calc(100vw - 16px));
  max-height: min(70dvh, 520px);
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-top: 3px solid #22c55e;
  border-radius: 8px;
  background: #0d141d;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.6);
}
.fch-pop.is-sheet {
  z-index: 9900;
  left: 0 !important;
  right: 0;
  top: auto !important;
  bottom: 0;
  width: 100%;
  max-height: 80dvh;
  border-width: 3px 0 0;
  border-radius: 12px 12px 0 0;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  animation: fch-in 0.14s ease-out;
}
@keyframes fch-in { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }
.fch-backdrop { position: fixed; inset: 0; z-index: 9899; background: rgba(2, 6, 12, 0.5); touch-action: none; }
.fch-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  background: #1b2430;
  border-bottom: 1px solid rgba(255, 255, 255, 0.13);
}
.fch-icon { font-size: 17px; line-height: 1; }
.fch-head-copy { flex: 1; min-width: 0; }
.fch-title { font-size: 14.5px; font-weight: 700; color: #f1f5f9; }
.fch-sub { font-size: 12px; color: #94a3b8; overflow-wrap: anywhere; }
.fch-x {
  flex: none;
  width: 32px;
  height: 32px;
  min-height: 0;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  background: transparent;
  box-shadow: none;
  color: #94a3b8;
  font-size: 14px;
  cursor: pointer;
}
.fch-x:hover, .fch-x:focus-visible { color: #fff; background: #161f2b; }
.fch-body { padding: 10px 12px; display: grid; gap: 8px; }
.fch-note { margin: 0; font-size: 12.5px; color: #94a3b8; }
.fch-note.is-warn { padding: 7px 9px; border-radius: 6px; border: 1px solid rgba(245, 158, 11, 0.45); background: rgba(245, 158, 11, 0.12); color: #fde68a; }
.fch-empty { margin: 0; color: #64748b; font-size: 12.5px; }
.fch-events { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.fch-ev {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1px 8px;
  padding: 6px 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  background: #111a25;
}
.fch-ev.is-shoot { border-color: rgba(34, 197, 94, 0.45); background: rgba(34, 197, 94, 0.07); }
.fch-when { grid-row: span 2; align-self: start; color: #93c5fd; font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fch-ev-title { color: #f8fafc; font-weight: 600; overflow-wrap: anywhere; }
.fch-loc { color: #94a3b8; font-size: 12px; overflow-wrap: anywhere; }
.fch-tag { display: inline-block; margin-inline-start: 6px; padding: 0 5px; border-radius: 4px; background: rgba(56, 189, 248, 0.16); color: #7dd3fc; font-size: 10.5px; font-weight: 700; vertical-align: middle; }
.fch-sug-title { font-size: 12px; font-weight: 600; color: #cbd5e1; }
.fch-sugs { display: flex; flex-wrap: wrap; gap: 6px; }
.fch-sug, .fch-chip {
  min-height: 34px;
  padding: 5px 12px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 6px;
  background: #161f2b;
  box-shadow: none;
  color: #e2e8f0;
  font: inherit;
  font-weight: 600;
  text-align: right;
  cursor: pointer;
}
.fch-sug.is-shoot { border-color: #16a34a; background: #16a34a; color: #fff; }
.fch-sug:hover, .fch-sug:focus-visible { filter: brightness(1.15); outline: none; box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.5); }
.fch-nav { display: flex; justify-content: space-between; gap: 8px; padding: 0 12px 10px; }
.fch-navbtn {
  min-height: 30px;
  padding: 3px 10px;
  border: 1px dashed rgba(255, 255, 255, 0.22);
  border-radius: 6px;
  background: transparent;
  box-shadow: none;
  color: #94a3b8;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.fch-navbtn:hover, .fch-navbtn:focus-visible { color: #fff; border-color: rgba(255, 255, 255, 0.4); }

.fch-overlay {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(2, 6, 12, 0.66);
  backdrop-filter: blur(3px);
}
.fch-card {
  display: flex;
  flex-direction: column;
  width: min(620px, 100%);
  max-height: calc(100dvh - 32px);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-top: 3px solid #22c55e;
  border-radius: 8px;
  background: #0d141d;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}
.fch-batch-body { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; }
.fch-items { display: grid; gap: 6px; }
.fch-item { display: grid; gap: 5px; padding: 8px 10px; border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 6px; background: #111a25; }
.fch-item.is-none { opacity: 0.7; }
.fch-item-top { display: flex; align-items: center; gap: 8px; }
.fch-item-pick { flex: none; width: 20px; height: 20px; margin: 0; accent-color: #22c55e; cursor: pointer; }
.fch-item-head { flex: 1; min-width: 0; font-weight: 600; color: #f1f5f9; cursor: pointer; overflow-wrap: anywhere; }
.fch-item-events { font-size: 12px; color: #94a3b8; overflow-wrap: anywhere; }
.fch-item-text {
  width: 100%;
  min-height: 36px;
  padding: 5px 9px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 6px;
  background: #0d141d;
  color: #f8fafc;
  font: inherit;
  font-size: 16px; /* no zoom-in on iPhone */
}
.fch-item-text:focus { outline: 2px solid #22c55e; outline-offset: -1px; }
.fch-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.fch-chip { min-height: 30px; padding: 3px 9px; font-size: 12px; font-weight: 500; }
.fch-chip.is-on { border-color: #22c55e; color: #86efac; }
.fch-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 12px; border-top: 1px solid rgba(255, 255, 255, 0.13); background: #111a25; }
.fch-act {
  min-height: 38px;
  padding: 7px 14px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 6px;
  background: #161f2b;
  box-shadow: none;
  color: #cbd5e1;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.fch-act.is-primary { background: #16a34a; border-color: #16a34a; color: #fff; }
.fch-act.is-primary:hover:not(:disabled) { background: #15803d; }
.fch-act:disabled { opacity: 0.5; cursor: default; }
@media (max-width: 640px) {
  /* phones: the batch window is a bottom sheet with full-width buttons */
  .fch-overlay { align-items: flex-end; padding: 0; }
  .fch-card { width: 100%; max-height: 88dvh; border-radius: 12px 12px 0 0; padding-bottom: env(safe-area-inset-bottom, 0px); }
  .fch-actions { flex-direction: column; }
  .fch-act { width: 100%; min-height: 44px; }
  .fch-sug { width: 100%; min-height: 42px; }
}
@media (prefers-reduced-motion: reduce) { .fch-pop.is-sheet { animation: none; } }

/* ---- v16: ⚠️ התראות כסף (renderer/finance-alerts.js): a collapsible panel at the top of the monthly view, owner only.
   Red first, then yellow, then info; the left border takes the colour of the most urgent one. ---- */
#finance-view .finance-alerts-panel {
  margin: 0 0 12px;
  padding: 8px 12px;
  background: var(--fs-head);
  border: 1px solid var(--fs-grid-strong);
  border-inline-start: 4px solid #94a3b8;
  font-size: 13px;
}
#finance-view .finance-alerts-panel[data-worst="red"] { border-inline-start-color: #ef4444; }
#finance-view .finance-alerts-panel[data-worst="yellow"] { border-inline-start-color: #f59e0b; }
#finance-view .finance-alerts-panel.hidden,
#finance-view .finance-alerts-panel[hidden] { display: none; }
#finance-view .fa-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  cursor: pointer;
  list-style-position: inside;
  user-select: none;
  -webkit-user-select: none;
}
#finance-view .fa-title { font-weight: 800; color: #fff; }
#finance-view .fa-chips { display: inline-flex; flex-wrap: wrap; gap: 6px; }
#finance-view .fa-chip { padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; }
#finance-view .fa-chip.fa-red { background: rgba(239, 68, 68, 0.18); color: #f87171; }
#finance-view .fa-chip.fa-yellow { background: rgba(245, 158, 11, 0.18); color: #fbbf24; }
#finance-view .fa-chip.fa-info { background: rgba(148, 163, 184, 0.16); color: #cbd5e1; }
#finance-view .fa-list { margin: 8px 0 2px; padding: 0; list-style: none; display: grid; gap: 4px; }
#finance-view .fa-item { display: flex; align-items: baseline; gap: 8px; line-height: 1.45; color: #e2e8f0; }
#finance-view .fa-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: #94a3b8; transform: translateY(-1px); }
#finance-view .fa-item.fa-red .fa-dot { background: #ef4444; }
#finance-view .fa-item.fa-red .fa-text { color: #fecaca; font-weight: 600; }
#finance-view .fa-item.fa-yellow .fa-dot { background: #f59e0b; }
#finance-view .fa-item.fa-info .fa-text { color: #cbd5e1; }
#finance-view .fa-text { min-width: 0; overflow-wrap: anywhere; }
@media (pointer: coarse) {
  #finance-view .fa-summary { min-height: 40px; }
}

/* ---- v17: ⚠️ התראות כסף + 📑 מע״מ are collapsed by default: only the header line (title + chips / numbers + its
   buttons). The header is a <button aria-expanded> with a caret (◂ closed, ▾ open, RTL); the left border keeps the
   urgency colour while closed. Open / closed per viewer in localStorage. ---- */
#finance-view .fx-toggle {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: start;
  cursor: pointer;
}
#finance-view .finance-alerts-panel .fx-toggle { display: flex; width: 100%; }
#finance-view .fx-toggle:focus-visible { outline: 2px solid #d4af37; outline-offset: 3px; border-radius: 4px; }
#finance-view .fx-caret { display: inline-block; flex: none; width: 1em; text-align: center; font-size: 12px; color: #94a3b8; transition: transform 0.15s ease; }
#finance-view .fx-toggle[aria-expanded="false"] .fx-caret { transform: rotate(90deg); }
#finance-view .fx-head { cursor: pointer; }
#finance-view .fx-body[hidden],
#finance-view .fa-list[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) {
  #finance-view .fx-caret { transition: none; }
}

/* ---- v17: 📅 תשלומים שעוברים לשנה הבאה (renderer/finance-carryover.js): a small owner banner above the annual sheet ---- */
#finance-view .finance-carryover-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin: 0 0 12px;
  padding: 8px 12px;
  background: var(--fs-head);
  border: 1px solid var(--fs-grid-strong);
  border-inline-start: 4px solid #3b82f6;
  font-size: 13px;
}
#finance-view .finance-carryover-banner[hidden] { display: none; }
#finance-view .fco-text { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; flex: 1 1 320px; min-width: 0; color: #e2e8f0; }
#finance-view .fco-title { font-weight: 800; color: #fff; }
#finance-view .fco-item { overflow-wrap: anywhere; }
#finance-view .fco-new { padding: 0 6px; border-radius: 999px; font-size: 11px; background: rgba(59, 130, 246, 0.18); color: #93c5fd; }
#finance-view .fco-acts { display: flex; gap: 8px; flex: none; }
#finance-view .fco-btn {
  min-height: 32px;
  padding: 4px 12px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  border-radius: 6px;
  border: 1px solid var(--fs-grid-strong);
  background: transparent;
  color: #e2e8f0;
  cursor: pointer;
}
#finance-view .fco-btn.is-approve { background: #16a34a; border-color: #22c55e; color: #fff; }
#finance-view .fco-btn:disabled { opacity: 0.55; cursor: progress; }
#finance-view .fco-btn:focus-visible { outline: 2px solid #d4af37; outline-offset: 2px; }
#finance-view .fco-note { color: #fbbf24; font-size: 12px; }
#finance-view .fco-msg { flex-basis: 100%; color: #f87171; font-size: 12px; }
@media (pointer: coarse) {
  #finance-view .fco-btn { min-height: 40px; }
}

/* Sharon (11.10): rows marked by eye (click the מסד) + their count / sum bar */
#finance-view .finance-table td.is-row-index[data-pick-key] { cursor: pointer; user-select: none; }
#finance-view .finance-table tr.finance-row-picked td { box-shadow: inset 0 0 0 9999px rgba(56, 189, 248, 0.14); }
#finance-view .finance-table tr.finance-row-picked td.is-row-index { background: #0284c7; color: #fff; font-weight: 800; }
.finance-pick-bar {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9000;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 14px;
  border-radius: 10px;
  background: #0f172a;
  border: 1px solid #0284c7;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  color: #e2e8f0;
  font-size: 14px;
  direction: rtl;
  font-variant-numeric: tabular-nums;
}
.finance-pick-bar button { padding: 3px 10px; border-radius: 6px; border: 1px solid #334155; background: transparent; color: #e2e8f0; cursor: pointer; }

/* 🔍 search (Sharon 11.10): pinned to the left end of the months row; non-matching rows dim */
#finance-view .finance-month-tabs { align-items: flex-end; }
#finance-view .finance-search {
  order: 99;
  margin-inline-start: auto;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border: 1px solid var(--fs-grid-strong);
  border-radius: 8px;
  background: var(--fs-head);
  position: relative;
}
#finance-view .finance-search input {
  width: 220px;
  border: 0;
  outline: 0;
  background: transparent;
  color: inherit;
  font-size: 13px;
}
#finance-view .finance-search[data-count]:not([data-count=""])::after {
  content: attr(data-count);
  font-size: 11px;
  font-weight: 700;
  color: #38bdf8;
}
#finance-view .finance-table tr.finance-search-dim { opacity: 0.22; transition: opacity 0.15s; }
#finance-view .finance-table tr.finance-search-hit { opacity: 1; }
@media (max-width: 700px) {
  #finance-view .finance-search { width: 100%; margin-inline-start: 0; }
  #finance-view .finance-search input { width: 100%; }
}

/* ⚠️ alert click → what it talks about sits in the middle of the screen with a glowing ring for ~4s, then fades
   (Sharon 11.10; 4.11.26: every line, rows / the 📑 מע״מ box / a whole table). The ring is a fixed overlay in <body>
   (renderer/finance-alerts.js ring()) — a table row can't have rounded corners or a glow of its own. */
/* 4.11.26: only the words are clickable (and right-clickable), not the empty width of the line */
#finance-view .finance-alerts-panel li.fa-jump .fa-text { cursor: pointer; border-radius: 4px; }
#finance-view .finance-alerts-panel li.fa-jump .fa-text:hover { text-decoration: underline; text-underline-offset: 3px; }
#finance-view .finance-alerts-panel li.fa-jump .fa-text:focus-visible { outline: 2px solid #facc15; outline-offset: 2px; }
@keyframes finance-flash-fade {
  0%, 75% { box-shadow: inset 0 0 0 9999px rgba(250, 204, 21, 0.2); }
  100% { box-shadow: inset 0 0 0 9999px rgba(250, 204, 21, 0); }
}
#finance-view .finance-table tr.fa-target td { animation: finance-flash-fade 4s ease-out forwards; }
#finance-view tr.fa-target.finance-search-dim { opacity: 1; } /* a search filter never hides the row he asked for */
@keyframes fa-ring-in {
  0% { opacity: 0; transform: scale(1.04); }
  100% { opacity: 1; transform: scale(1); }
}
.fa-ring {
  position: fixed;
  z-index: 1200; /* above the sheet and its sticky header, under menus / dialogs */
  pointer-events: none;
  box-sizing: border-box;
  border: 3px solid #facc15;
  border-radius: 10px;
  box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.28), 0 0 22px 4px rgba(250, 204, 21, 0.55);
  animation: fa-ring-in 0.35s ease-out;
  transition: opacity 0.7s ease-out;
}
.fa-ring.is-fading { opacity: 0; }
@media (prefers-reduced-motion: reduce) {
  .fa-ring { animation: none; }
}

/* נותן שירות (Sharon 21.10): every name shows, wrapped like the other cells; the input lies over
   the names and shows only while typing (an input can't wrap, so "1-נהוראי, 2 יאיר…" was cut) */
#finance-view .finance-provider { position: relative; display: block; min-width: 0; max-width: 11em; margin-inline: auto; }
#finance-view .finance-provider-view {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  min-height: 20px;
  padding: 2px 4px;
  border-radius: 3px;
  background: rgba(7, 17, 31, 0.9);
  font-size: 12px;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: center;
}
#finance-view .finance-provider.is-empty .finance-provider-view { color: #64748b; }
#finance-view .finance-provider > .finance-cell-search { position: absolute; inset: 0; height: 100%; max-width: none; opacity: 0; }
#finance-view .finance-provider > .finance-cell-search:focus { opacity: 1; }
#finance-view .finance-provider:focus-within .finance-provider-view { visibility: hidden; }

/* ---- v25: 💰 3 תשלומים אחרונים (renderer/finance-last-paid.js + app.main.js renderFinanceAnnualTable): display only ---- */
#finance-view .finance-last-paid-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 14px;
  margin: 0 0 8px;
  font-size: 12.5px;
  color: #cbd5e1;
  direction: rtl;
}
#finance-view .finance-last-paid-line .flp-title { font-weight: 700; color: #fff; }
#finance-view .finance-last-paid-line .flp-item { overflow-wrap: anywhere; }
#finance-view .finance-last-paid-line .flp-item.is-missing { color: #fbbf24; }
#finance-view .finance-last-paid-line .flp-item.is-manual { color: #4ade80; }
#finance-view .finance-last-paid-line .flp-ok {
  margin-inline-start: 6px;
  padding: 0 7px;
  border: 1px solid #22c55e;
  border-radius: 999px;
  background: transparent;
  color: #4ade80;
  font: inherit;
  font-size: 11px;
  line-height: 18px;
  cursor: pointer;
}
#finance-view .finance-last-paid-line .flp-ok:hover { background: rgba(34, 197, 94, 0.15); }
#finance-view .finance-annual-sheet td.finance-last-paid-cell { position: relative; }
#finance-view .finance-annual-sheet td.finance-last-paid-cell.is-found {
  box-shadow: inset 0 0 0 2px #22c55e, 0 0 8px rgba(34, 197, 94, 0.45);
}
#finance-view .finance-annual-sheet td.finance-last-paid-cell.is-missing {
  background: rgba(245, 158, 11, 0.18);
  box-shadow: inset 0 0 0 2px #f59e0b;
}
#finance-view .finance-annual-sheet td.finance-last-paid-cell::after {
  content: attr(data-last-paid);
  position: absolute;
  top: 1px;
  inset-inline-end: 2px;
  padding: 0 4px;
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 800;
  line-height: 14px;
  color: #04120a;
  background: #22c55e;
  pointer-events: none;
}
#finance-view .finance-annual-sheet td.finance-last-paid-cell.is-missing::after { background: #f59e0b; color: #1a1205; }

/* ✓ אישור (Sharon 4.11.26): right-click / long-press a money alert or a 📑 מע״מ line → "אישור" → it moves to a faint
   grey "✓ אושרו (N)" group in the same place (renderer/finance-alerts.js openMenu, app.main.js renderFinanceVatPanel) */
.fa-menu {
  position: fixed;
  z-index: 10050; /* above the finance right-click menu's layer */
  min-width: 140px;
  padding: 4px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 10px;
  background: #0f172a;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}
.fa-menu button {
  display: block;
  width: 100%;
  padding: 9px 14px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: #e2e8f0;
  font: inherit;
  font-weight: 700;
  text-align: start;
  cursor: pointer;
}
.fa-menu button:hover,
.fa-menu button:focus-visible { background: rgba(250, 204, 21, 0.16); outline: none; }
#finance-view .fa-acked-group { margin-top: 4px; list-style: none; }
#finance-view .fa-acked-toggle { font-size: 12px; color: #64748b; cursor: pointer; }
#finance-view .fa-acked-list { margin-top: 4px; }
#finance-view .fa-item.fa-acked .fa-text,
#finance-view .fa-item.fa-acked.fa-red .fa-text { color: #64748b; font-weight: 400; }
#finance-view .fa-item.fa-acked .fa-dot { background: #475569; }
#finance-view .finance-vat-panel .fv-row { break-inside: avoid; padding: 1px 0; }
#finance-view .finance-vat-panel .fv-item { display: inline; cursor: pointer; border-radius: 6px; padding: 1px 4px; margin-inline: -4px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
#finance-view .finance-vat-panel .fv-item:hover { background: rgba(148, 163, 184, 0.14); }
#finance-view .finance-vat-panel .fv-item:focus-visible { outline: 2px solid #facc15; outline-offset: 1px; }
/* 🔧 תקן (4.11.26): next to an invoice with no row; red = this report's months or later */
#finance-view .finance-vat-panel .fv-fix-chip { margin-inline-start: 8px; padding: 0 7px; border: 1px solid rgba(148, 163, 184, 0.4); border-radius: 999px; background: transparent; color: #cbd5e1; font: inherit; font-size: 11px; line-height: 18px; cursor: pointer; vertical-align: baseline; }
#finance-view .finance-vat-panel .fv-fix-chip.is-hot { border-color: rgba(239, 68, 68, 0.7); background: rgba(239, 68, 68, 0.16); color: #fecaca; font-weight: 700; }
#finance-view .finance-vat-panel .fv-fix-chip:hover { filter: brightness(1.25); }
#finance-view .finance-vat-panel .fv-fix-count { border-color: rgba(239, 68, 68, 0.7); background: rgba(239, 68, 68, 0.18); color: #fecaca; font-weight: 700; }
/* 🤝 bit / PayBox (4.11.26): "לטיפול ידני עם שרון" — a violet marker of its own, never the red "to fix" */
#finance-view .finance-vat-panel .fv-p2p-tag { display: inline-block; padding: 0 6px; border: 1px solid rgba(167, 139, 250, 0.6); border-radius: 999px; background: rgba(139, 92, 246, 0.18); color: #ddd6fe; font-size: 11px; font-weight: 700; line-height: 17px; vertical-align: baseline; }
#finance-view .finance-vat-panel .fv-acked > summary { font-size: 12px; color: #64748b; cursor: pointer; margin-top: 4px; }
#finance-view .finance-vat-panel .fv-acked-item { color: #64748b; }
@media (pointer: coarse) {
  .fa-menu button { min-height: 44px; }
  #finance-view .fa-item .fa-text,
  #finance-view .finance-vat-panel .fv-item { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; } /* a hold opens ✓, not the text-selection menu */
}

/* 🔧 תיקון חשבונית (4.11.26): a drawer on the left so the table stays in sight; a sheet from the bottom on a phone
   (app.main.js openFinbotFixDrawer). Outside #finance-view (it lives in <body>). */
.fbx-drawer {
  position: fixed;
  z-index: 10040;
  top: 12px;
  bottom: 12px;
  left: 12px;
  width: min(400px, calc(100vw - 24px));
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 14px;
  background: #0f172a;
  color: #e2e8f0;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
  font-size: 13px;
}
.fbx-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px; border-bottom: 1px solid rgba(148, 163, 184, 0.2); }
.fbx-x { border: 0; background: none; color: #94a3b8; font-size: 16px; cursor: pointer; padding: 4px 8px; border-radius: 6px; }
.fbx-x:hover { background: rgba(148, 163, 184, 0.15); color: #e2e8f0; }
.fbx-body { flex: 1; overflow: auto; padding: 4px 14px 14px; }
.fbx-sec { padding: 10px 0; border-bottom: 1px solid rgba(148, 163, 184, 0.12); }
.fbx-sec:last-child { border-bottom: 0; }
.fbx-sec h4 { margin: 0 0 6px; font-size: 12px; font-weight: 700; color: #94a3b8; }
.fbx-read > div { display: flex; gap: 8px; line-height: 1.6; }
.fbx-read span { min-width: 56px; color: #94a3b8; }
.fbx-read b { overflow-wrap: anywhere; }
.fbx-muted { color: #94a3b8; }
.fbx-bad { color: #fca5a5; }
.fbx-note { margin: 8px 0; padding: 8px 10px; border-radius: 8px; background: rgba(148, 163, 184, 0.1); line-height: 1.5; }
.fbx-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.fbx-btn { display: inline-flex; align-items: center; gap: 4px; padding: 5px 10px; border: 1px solid rgba(148, 163, 184, 0.35); border-radius: 8px; background: rgba(148, 163, 184, 0.08); color: #e2e8f0; font: inherit; font-size: 12px; cursor: pointer; text-decoration: none; }
.fbx-btn:hover:not(:disabled) { background: rgba(148, 163, 184, 0.2); }
.fbx-btn:disabled { opacity: 0.45; cursor: default; }
.fbx-btn:focus-visible, .fbx-x:focus-visible { outline: 2px solid #facc15; outline-offset: 1px; }
.fbx-primary { border-color: rgba(250, 204, 21, 0.6); background: rgba(250, 204, 21, 0.14); color: #fde68a; font-weight: 700; }
.fbx-cand { margin-top: 8px; padding: 8px 10px; border: 1px solid rgba(148, 163, 184, 0.18); border-radius: 10px; }
.fbx-cand-main { line-height: 1.5; overflow-wrap: anywhere; }
.fbx-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.fbx-chip { padding: 0 7px; border-radius: 999px; background: rgba(34, 197, 94, 0.14); color: #bbf7d0; font-size: 11px; line-height: 18px; }
.fbx-chip-dim { background: rgba(148, 163, 184, 0.14); color: #cbd5e1; }
.fbx-chip-warn { background: rgba(245, 158, 11, 0.16); color: #fde68a; }
.fbx-check { display: flex; align-items: center; gap: 6px; margin-top: 4px; cursor: pointer; }
.fbx-check-row { display: flex; align-items: center; gap: 6px; }
/* "?" next to a button → a bubble with what it really does (renderer/finance-alerts.js helpIcon, 4.11.26) */
.lx-help { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 18px; height: 18px; margin-inline: 2px 6px; border: 1px solid rgba(148, 163, 184, 0.55); border-radius: 50%; color: #94a3b8; font-size: 11px; font-weight: 700; line-height: 1; cursor: help; user-select: none; -webkit-user-select: none; align-self: center; position: relative; }
.lx-help::before { content: ""; position: absolute; inset: -10px; } /* a finger-size target, the circle stays small */
.lx-help:hover, .lx-help:focus-visible { border-color: #facc15; color: #facc15; outline: none; }
.lx-help-pop { position: fixed; z-index: 10100; max-width: min(280px, calc(100vw - 16px)); padding: 8px 10px; border: 1px solid rgba(250, 204, 21, 0.45); border-radius: 10px; background: #111c33; color: #e2e8f0; font-size: 13px; line-height: 1.55; text-align: right; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); pointer-events: none; white-space: normal; }
.fa-menu-row { display: flex; align-items: center; gap: 2px; }
.fa-menu-row button { flex: 1; }
.fbx-form { display: grid; gap: 6px; margin-top: 8px; }
.fbx-form[hidden] { display: none; }
.fbx-form label { display: grid; grid-template-columns: 76px 1fr; align-items: center; gap: 8px; color: #94a3b8; font-size: 12px; }
.fbx-form input, .fbx-form select { min-width: 0; padding: 5px 8px; border: 1px solid rgba(148, 163, 184, 0.35); border-radius: 7px; background: #020617; color: #e2e8f0; font: inherit; font-size: 13px; }
@media (max-width: 720px) {
  .fbx-drawer { top: auto; left: 0; right: 0; bottom: 0; width: 100%; max-height: 72vh; border-radius: 14px 14px 0 0; }
  .fbx-btn { min-height: 36px; }
}
