/* gigit — בק-אופיס לחברות הפקה.
 * אותה שפה כמו האפליקציה (build 47, DESIGN.md): קרם כרקע, כרטיסים בהירים עם
 * מסגרת במקום צל, כסף תמיד על דיו עם ספרות זהב, שני משקלים בלבד (400/600),
 * סטטוס = נקודה + מילה, פעולה ראשית אחת = pill דיו. בלי dark mode.
 * פריסה: בורר המסכים (כמו ModeSelector) בימין העליון, הלוגו בשמאל; עמודה
 * ראשית רחבה ועמודת צד של רשימות, בצפיפות של מחשב. */
/* טוקנים = lib/theme.ts של האפליקציה ("דף חלק", build 47+): רקע לבן-עיפרון,
 * כרטיסים לבנים עם מסגרת 1px ופינות 14, דיו רק לכסף ולפעולה הראשית,
 * זהב רק על דיו, ספרות סכומים ב-Plex Mono, בלי שכבות דקורציה. */
:root {
  --page: #FFFFFF; /* רקע הדף: לבן (בקשת אביתר, 18.10), במקום #FAFAF8 */
  --surface: #FFFFFF;
  --surface-2: #F1EFEA;
  --note: #F1EFEA;
  --divider: #E8E6E1;
  --border: #E8E6E1;
  --ink: #1B1712;
  --on-ink: #F4EDE1;
  --on-ink-muted: rgba(244, 237, 225, 0.72);
  --on-ink-line: rgba(244, 237, 225, 0.14);
  --muted: #5F5A52;
  --faint: #6F6A61;
  --gold: #C4A67E;
  --gold-bright: #E8D6B7;
  --gold-brown: #755C31;
  --ok: #3F6B45;
  --ok-bg: #E6EFE6;
  --warn: #7A571B;
  --warn-bg: #F3E7CC;
  --bad: #A8503A;
  --bad-bg: #F6E7E1;
  --dashed: #D6D3CD;
  --p1: #755C31; --p2: #1B1712; --p3: #3F6B45; --p4: #A8503A; --p5: #5F5A52; --p6: #4F5D6B;
  --shadow-ink: 0 10px 24px rgba(27, 23, 18, 0.14);
  --font: "IBM Plex Sans Hebrew", "Arial Hebrew", "Segoe UI", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--page); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.5; font-weight: 400; }
h1, h2, h3 { margin: 0; line-height: 1.2; text-wrap: balance; font-weight: 600; }
h1 { font-size: 30px; letter-spacing: -0.01em; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
p { margin: 0; }
b, strong { font-weight: 600; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select { font: inherit; color: inherit; }
/* hidden תמיד מנצח: בלי זה .field (flex) דרס אותו, ושדות תלויים הופיעו בלי סיבה */
[hidden] { display: none !important; }
a { color: var(--gold-brown); }
.num { font-variant-numeric: tabular-nums; }
.money { font-family: var(--mono); font-weight: 500; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.up { color: var(--ok); } .down { color: var(--bad); }
:focus-visible { outline: 2px solid var(--gold-brown); outline-offset: 2px; }
/* על משטח דיו הזהב-חום יורד ל-2.83:1. שם הטבעת בשמנת בהירה. */
.ink-card :focus-visible, .bulk-bar :focus-visible { outline-color: var(--gold-bright); }

.app { direction: rtl; padding-inline: 22px; padding-block: 0 64px; max-width: 1320px; margin-inline: auto; }

/* ---------- top bar: בורר בימין, לוגו בשמאל ---------- */
.topbar { display: flex; align-items: center; gap: 16px; padding-block: 20px 8px; flex-wrap: wrap; }
.topbar .spacer { flex: 1; }
.brand { display: flex; align-items: center; gap: 10px; direction: ltr; }
.brand-mark { width: 38px; height: 38px; border-radius: 10px; display: block; }
.brand-text { display: flex; flex-direction: column; align-items: flex-start; }
.brand-name { font-weight: 600; font-size: 19px; letter-spacing: -0.01em; line-height: 1.1; }
.brand-sub { font-size: 12.5px; color: var(--muted); max-width: 240px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; direction: rtl; border: 0; background: none; padding: 0; }
select.brand-sub { cursor: pointer; min-height: 28px; }
/* הבורר: אותה צורה כמו ModeSelector באפליקציה — מסילה בהירה, pill דיו פעיל. */
.nav { display: flex; gap: 2px; background: var(--surface-2); border-radius: 999px; padding: 4px; overflow-x: auto; max-width: 100%; }
.nav button { border: 0; background: transparent; border-radius: 999px; height: 38px; padding: 0 16px; font-weight: 400; color: var(--muted); display: flex; align-items: center; gap: 8px; white-space: nowrap; transition: background 160ms var(--ease), color 160ms var(--ease); }
.nav button svg { width: 17px; height: 17px; }
.nav button:hover { color: var(--ink); }
.nav button.active { background: var(--ink); color: var(--on-ink); font-weight: 600; }
.tools { display: flex; align-items: center; gap: 8px; }
.quota { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; height: 38px; padding: 0 14px; font-size: 13px; white-space: nowrap; }
.quota-bar { width: 52px; height: 5px; background: var(--divider); border-radius: 999px; overflow: hidden; }
.quota-bar i { display: block; height: 100%; background: var(--gold-brown); }
.icon-btn { width: 38px; height: 38px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); display: grid; place-items: center; color: var(--muted); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { color: var(--ink); }
.icon-btn:active, .btn:active, .nav button:active, .row.clickable:active { transform: scale(0.97); }

/* ---------- page head ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding-block: 26px 18px; flex-wrap: wrap; }
.eyebrow { display: none; }
.page-head .sub { color: var(--muted); font-size: 14px; margin-top: 6px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- buttons ---------- */
.btn { border: 1px solid var(--border); background: #FFFFFF; color: var(--ink); border-radius: 999px; height: 42px; padding: 0 20px; font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; text-decoration: none; transition: transform 100ms var(--ease), opacity 100ms var(--ease); }
.btn svg { width: 16px; height: 16px; }
.btn:hover { border-color: var(--dashed); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--on-ink); height: 46px; padding: 0 24px; }
.btn.danger { color: var(--bad); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.small { height: 34px; padding: 0 14px; font-size: 13px; }
.btn.block { width: 100%; }
.pill-btn { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; height: 34px; padding: 0 14px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.pill-btn.active { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
select.pill-btn { padding-inline: 14px 34px; background-position: left 13px center; }
.period-nav { display: inline-flex; align-items: center; gap: 6px; }
.period-nav .icon-btn { width: 34px; height: 34px; }
.period-nav .icon-btn[disabled] { opacity: .35; cursor: default; }
.period-nav .link { font-size: 13px; margin-inline-start: 4px; white-space: nowrap; }
.link { background: none; border: 0; color: var(--gold-brown); font-size: 13px; padding: 0; text-decoration: none; display: inline-flex; align-items: center; min-height: 24px; }
.note { font-size: 12.5px; color: var(--muted); }

/* ---------- status strip ---------- */
.strip { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 14px; flex-wrap: wrap; font-size: 14px; }
.strip.warn { background: var(--warn-bg); color: var(--warn); }
.strip.ok { background: var(--ok-bg); color: var(--ok); }
.strip .spacer { flex: 1; }
.strip .btn.small { background: var(--surface); }

/* ---------- grid ---------- */
.grid { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 20px; align-items: start; }
.col { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 20px; min-width: 0; }
.card.dashed { border: 2px dashed var(--dashed); background: transparent; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-head .meta { font-size: 12.5px; color: var(--muted); }

/* ---------- כרטיס הכסף (דיו) ---------- */
.ink-card { position: relative; overflow: hidden; background: var(--ink); color: var(--on-ink); border-radius: 20px; padding: 24px; box-shadow: var(--shadow-ink); }
.ink-card > * { position: relative; }
.cta-wide { width: 100%; height: 52px; font-size: 17px; }
.ink-card .eyebrow-ink { font-size: 13px; color: var(--on-ink-muted); }
.ink-amounts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.ink-amounts .k { font-size: 13px; color: var(--on-ink-muted); }
.ink-amounts .v { font-family: var(--mono); font-weight: 500; font-size: 22px; color: var(--on-ink); line-height: 1.2; }
.ink-amounts .v.big { font-size: clamp(32px, 3.6vw, 44px); color: var(--gold-bright); }
.ink-bar { height: 8px; border-radius: 999px; background: var(--on-ink-line); overflow: hidden; margin-top: 20px; }
.ink-bar i { display: block; height: 100%; background: var(--on-ink); border-radius: 999px; }
.ink-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; font-size: 14px; }
.ink-foot .profit { color: var(--gold-bright); font-weight: 600; }
.ink-foot .d { color: var(--on-ink-muted); font-size: 12.5px; }
.ink-chip { display: inline-flex; align-items: center; gap: 8px; margin-top: 16px; background: rgba(241, 228, 198, 0.12); color: var(--warn-bg); border-radius: 13px; padding: 8px 14px; font-size: 13px; border: 0; width: 100%; text-align: start; }
.ink-chip .dot { background: var(--gold); }

/* tiles (אריחי אייקון כמו "מופע חדש / המופעים / צוות" באפליקציה) */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; min-width: 0; display: flex; gap: 12px; align-items: center; }
.tile .ti { width: 40px; height: 40px; border-radius: 14px; background: var(--surface-2); display: grid; place-items: center; flex: none; color: var(--ink); }
.tile .ti svg { width: 19px; height: 19px; }
.tile .k { font-size: 12.5px; color: var(--muted); }
.tile .v { font-size: 22px; margin-top: 1px; }
.tile .d { font-size: 12px; color: var(--muted); }
.tile .stat { min-width: 0; }
.tile .stat .v { white-space: nowrap; }
.d .up, .d .down { font-weight: 600; }

/* charts */
.charts { display: grid; grid-template-columns: 1.25fr 1fr; gap: 20px; }
.chart-wrap { position: relative; height: 260px; }
.legend-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; font-size: 13px; }
.legend-list div { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.legend-list .name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.legend-list .pct { color: var(--muted); font-size: 12px; width: 38px; display: inline-block; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; flex: none; }

/* שכר החודש: שלושה שלבים — מגיע, חשבונית, שולם */
.pay-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.pay-step { min-width: 0; }
.pay-step + .pay-step { border-inline-start: 1px solid var(--divider); padding-inline-start: 16px; }
.pay-step .k { font-size: 12.5px; color: var(--muted); }
.pay-step .v { font-size: 24px; line-height: 1.25; margin-top: 2px; }
.pay-step .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.pay-steps.compact .v { font-size: 22px; }
/* שני פסים על אותה מסילה: חשבונית (בהיר) מתחת, שולם (דיו) מעל */
.pay-bar { position: relative; height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin-top: 18px; }
.pay-bar i { position: absolute; inset-block: 0; inset-inline-start: 0; border-radius: 999px; }
.pay-bar .inv { background: var(--gold); }
.pay-bar .paid { background: var(--ink); }
.pay-nudge { display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%; margin-top: 16px; padding: 10px 14px; border: 0; border-radius: 14px; background: var(--warn-bg); color: var(--warn); font-size: 13.5px; text-align: start; }
.pay-nudge .link { color: var(--warn); text-decoration: underline; }

/* צעדים ראשונים (משרד חדש) */
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.steps li { display: flex; gap: 14px; padding-block: 14px; border-top: 1px solid var(--divider); }
.steps li:first-child { border-top: 0; }
.steps .step-n { width: 32px; height: 32px; border-radius: 999px; display: grid; place-items: center; flex: none; background: var(--surface-2); color: var(--muted); font-weight: 600; font-size: 14px; }
.steps li.done .step-n { background: var(--ok-bg); color: var(--ok); }
.steps li.next .step-n { background: var(--ink); color: var(--on-ink); }
.steps li.done .t { color: var(--muted); }
.steps .t { font-weight: 600; }
.steps .s { font-size: 13.5px; color: var(--muted); margin-top: 2px; max-width: 60ch; }
/* קישור דילוג: מוסתר עד שהמקלדת מגיעה אליו, ואז מופיע בראש הדף. */
.skip-link { position: absolute; inset-inline-start: 16px; top: -60px; z-index: 70; background: var(--ink); color: var(--on-ink); padding: 10px 16px; border-radius: 999px; text-decoration: none; }
.skip-link:focus { top: 12px; }
main:focus { outline: none; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* פנקס השכר */
/* .segmented (בהמשך הקובץ) דרס את אלה: ב-320 הסינון הפך לאליפסה. הספציפיות הכפולה מחזיקה. */
.segmented.ledger-filter { margin-bottom: 0; flex-wrap: wrap; border-radius: 22px; }
.segmented.ledger-filter button { flex: 0 1 auto; padding: 0 14px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
.ledger-filter .count { font-size: 11.5px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--surface); color: var(--muted); display: inline-grid; place-items: center; font-weight: 600; }
.ledger-filter button.active .count { background: var(--on-ink-line); color: var(--on-ink); }
table.ledger td .m, table.ledger td .n + .m { font-size: 12px; color: var(--muted); }
th.check, td.check { width: 36px; padding-inline-end: 0; }
td.check input, th.check input { width: 18px; height: 18px; accent-color: var(--ink); cursor: pointer; }
.docs { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bulk-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; padding: 10px 10px 10px 14px; border-radius: 14px; background: var(--ink); color: var(--on-ink); font-size: 14px; }
.bulk-bar .spacer { flex: 1; }
.bulk-bar .btn.small { background: transparent; color: var(--on-ink); border-color: var(--on-ink-line); }
.bulk-bar .btn.primary.small { background: var(--on-ink); color: var(--ink); border-color: var(--on-ink); height: 34px; padding: 0 16px; }
.bulk-bar .money { color: var(--gold-bright); }

/* rows */
.rows { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 12px; padding-block: 11px; border: 0; border-top: 1px solid var(--divider); background: none; width: 100%; text-align: start; font: inherit; color: inherit; transition: transform 100ms var(--ease); }
.row:first-child { border-top: 0; }
.row .ic { width: 40px; height: 40px; border-radius: 14px; display: grid; place-items: center; flex: none; font-weight: 600; font-size: 13px; background: var(--surface-2); color: var(--ink); }
.row .ic.date { flex-direction: column; gap: 0; line-height: 1.05; font-weight: 400; border-radius: 12px; width: 44px; height: 46px; }
.row .ic.date b { font-size: 17px; font-weight: 600; }
.row .ic.date span { font-size: 10.5px; color: var(--muted); }
.row .body { flex: 1; min-width: 0; }
.row .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .t.wrap { white-space: normal; }
.row .s { font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.nowrap { white-space: nowrap; }
.row .amt { white-space: nowrap; }
.row.clickable { cursor: pointer; border-radius: 0; }
.row.clickable:hover .t { color: var(--gold-brown); }
.av { width: 34px; height: 34px; border-radius: 999px; display: grid; place-items: center; font-size: 12.5px; font-weight: 600; background: var(--surface-2); color: var(--ink); flex: none; }
.prod-ic { color: var(--on-ink) !important; }

/* chips: נקודה + מילה, 26px */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 12px; border-radius: 999px; font-size: 12.5px; white-space: nowrap; }
.chip::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.chip.plain::before, .chip.prod::before { display: none; }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.bad { background: var(--bad-bg); color: var(--bad); }
.chip.neutral { background: var(--surface-2); color: var(--muted); }
.chip.accent { background: var(--ink); color: var(--on-ink); }
.chip.accent::before { background: var(--gold); }
.chip.prod { color: var(--on-ink); }
.chip.outline { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: start; font-weight: 400; color: var(--muted); font-size: 12.5px; padding: 8px 10px; border-bottom: 1px solid var(--divider); white-space: nowrap; }
td { padding: 11px 10px; border-bottom: 1px solid var(--divider); vertical-align: middle; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tfoot td { border-top: 1px solid var(--border); border-bottom: 0; font-weight: 600; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--note); }
td.end, th.end { text-align: end; }
.who { display: flex; align-items: center; gap: 10px; }
.who .m { font-size: 12.5px; color: var(--muted); }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.search { flex: 1; min-width: 200px; display: flex; align-items: center; gap: 8px; background: #FFFFFF; border: 1px solid var(--border); border-radius: 14px; height: 42px; padding: 0 12px; }
.search input { border: 0; background: transparent; outline: 0; width: 100%; }
/* הטבעת על המסגרת של החיפוש, כי לשדה עצמו אין גבול משלו. */
.search:focus-within { outline: 2px solid var(--gold-brown); outline-offset: 2px; }
.search svg { width: 16px; height: 16px; color: var(--muted); }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--divider); margin-bottom: 18px; overflow-x: auto; }
.tab { border: 0; background: none; padding: 10px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab.active { color: var(--ink); border-bottom-color: var(--ink); font-weight: 600; }

/* calendar */
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.cal-nav { display: flex; align-items: center; gap: 8px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-dow { font-size: 12px; color: var(--muted); text-align: center; padding-bottom: 4px; }
.cal-cell { min-height: 96px; border: 1px solid var(--divider); border-radius: 12px; padding: 6px; background: var(--surface); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cal-cell.out { background: transparent; border-style: dashed; }
.cal-cell.today { border-color: var(--ink); }
.cal-cell .d { font-size: 12px; color: var(--muted); }
.cal-cell.today .d { color: var(--ink); font-weight: 600; }
/* כל המשבצת בצבע ההפקה (--ev מגיע מה-JS לפי ההפקה). טיוטה = גוון בהיר עם קו מקווקו. */
.cal-ev { font-size: 11.5px; font-weight: 500; padding: 3px 7px; border-radius: 6px; background: var(--ev, var(--gold-brown)); color: var(--surface); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; border: 0; text-align: start; width: 100%; }
.cal-ev:hover { filter: brightness(1.12); }
.cal-ev.draft { background: color-mix(in srgb, var(--ev, var(--gold-brown)) 12%, var(--surface)); color: var(--ev, var(--gold-brown)); outline: 1px dashed var(--ev, var(--dashed)); outline-offset: -1px; }
/* הקו המקווקו של הטיוטה דרס את טבעת הפוקוס. */
.cal-ev.draft:focus-visible { outline: 2px solid var(--gold-brown); outline-offset: 2px; }

/* dialog */
.overlay { position: fixed; inset: 0; background: rgba(27, 23, 18, 0.42); display: grid; place-items: center; padding: 16px; z-index: 50; animation: fade 200ms var(--ease); }
.dialog { background: var(--surface); color: var(--ink); border-radius: 20px; width: min(520px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 24px; box-shadow: var(--shadow-ink); direction: rtl; animation: rise 260ms var(--ease); }
/* דיאלוג שכבר פתוח ומתרנדר מחדש (שגיאה, שינוי בחירה) לא קופץ שוב. */
.overlay.settled, .overlay.settled .dialog { animation: none; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
.dialog h2 { font-size: 22px; margin-bottom: 6px; }
.dialog .desc { color: var(--muted); font-size: 14px; margin-bottom: 18px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > label { font-size: 13px; color: var(--ink); font-weight: 600; }
.field input, .field select { border: 1px solid var(--border); background: #FFFFFF; border-radius: 14px; height: 46px; padding: 0 14px; width: 100%; }
.field input:focus, .field select:focus { outline: 2px solid var(--gold-brown); outline-offset: 0; border-color: transparent; }
/* select אחיד (אחרי .field, כדי שה-background שלו לא ידרוס את החץ): החץ של הדפדפן נדבק לקצה השדה. חץ משלנו, באותו ריווח של הטקסט
   (צד שמאל = סוף השורה ב-RTL). */
select.pill-btn, select.brand-sub, .field select {
  appearance: none; -webkit-appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%235F5A52' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-size: 12px 12px;
}
.field select { background-position: left 16px center; padding-inline-end: 42px; }
/* שדה מספר בלי חצי למעלה/למטה: הסכום מוקלד, לא נלחץ */
.field input[type=number] { appearance: textfield; -moz-appearance: textfield; }
.field input[type=number]::-webkit-inner-spin-button, .field input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.field .hint { font-size: 12px; color: var(--muted); }
.ltr { direction: ltr; text-align: right; }
.dialog-actions { display: flex; justify-content: flex-start; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.notice { background: var(--note); color: var(--ink); border-radius: 14px; padding: 10px 14px; font-size: 13px; margin-bottom: 14px; }
.notice.warn { background: var(--warn-bg); color: var(--warn); }
.notice.bad { background: var(--bad-bg); color: var(--bad); }
.notice.ok { background: var(--ok-bg); color: var(--ok); }
.toast { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--on-ink); padding: 12px 20px; border-radius: 999px; font-size: 14px; box-shadow: var(--shadow-ink); z-index: 60; direction: rtl; max-width: calc(100vw - 32px); animation: rise 260ms var(--ease); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 18px; font-size: 14px; margin: 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
/* חיוב בכרטיס במסך החיוב: מצב הכרטיס, ואז הכפתור. */
.card-billing { margin-top: 16px; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.card-billing .notice { margin: 0; align-self: stretch; }
/* פירוק המחיר: הסכומים בעמודה אחת בקצה, והשורה האחרונה מופרדת בקו. */
.kv.breakdown { margin-top: 16px; grid-template-columns: 1fr auto; }
.kv.breakdown dd { text-align: end; }
.kv.breakdown dt:last-of-type, .kv.breakdown dd:last-of-type { border-top: 1px solid var(--divider); padding-top: 8px; }
.segmented { display: flex; background: var(--surface-2); border-radius: 999px; padding: 4px; gap: 2px; margin-bottom: 16px; }
.segmented button { flex: 1; border: 0; background: none; height: 36px; border-radius: 999px; color: var(--muted); }
.segmented button.active { background: var(--ink); color: var(--on-ink); font-weight: 600; }

/* loading / empty / sign-in */
.skel { background: linear-gradient(90deg, var(--surface-2), var(--note), var(--surface-2)); background-size: 200% 100%; border-radius: 8px; height: 14px; animation: shimmer 1.2s infinite; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.empty { text-align: center; color: var(--muted); padding: 28px 16px; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.empty h3 { color: var(--ink); }
.error-box { background: var(--bad-bg); color: var(--bad); border-radius: 14px; padding: 12px 14px; font-size: 14px; }
.signin-wrap { min-height: 86vh; display: grid; place-items: center; padding-block: 24px; }
.signin { width: min(420px, 100%); display: flex; flex-direction: column; gap: 14px; }
.signin .card { padding: 24px; display: flex; flex-direction: column; gap: 4px; }
.signin h1 { font-size: 27px; }
.signin .lead { color: var(--muted); font-size: 14px; margin-bottom: 8px; }
.google-btn { display: flex; align-items: center; justify-content: center; gap: 10px; height: 48px; border-radius: 999px; border: 1px solid var(--border); background: #FFFFFF; font-weight: 600; width: 100%; }
.google-btn svg { width: 18px; height: 18px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: 12.5px; margin-block: 14px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--divider); }
.text-btn { background: none; border: 0; color: var(--gold-brown); font-size: 13px; padding: 4px 0; }

@media (max-width: 1080px) {
  .grid { grid-template-columns: 1fr; }
  .grid > .rail { order: 1; }
  .charts { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  .app { padding-inline: 16px; }
  .topbar .spacer { display: none; }
  .nav { order: 3; width: 100%; }
  /* שישה אייקונים בלי טקסט דרשו ניחוש: תווית קטנה מתחת לכל אייקון. */
  .nav { border-radius: 16px; }
  .nav button { flex: 1; flex-direction: column; justify-content: center; gap: 2px; height: auto; min-height: 48px; padding: 6px 2px; border-radius: 12px; }
  .nav button span { font-size: 11px; }
  .tabs { flex-wrap: wrap; }
  .ink-amounts { grid-template-columns: 1fr; }
  .pay-steps { grid-template-columns: 1fr; gap: 12px; }
  .pay-step + .pay-step { border-inline-start: 0; padding-inline-start: 0; border-top: 1px solid var(--divider); padding-top: 12px; }
  .cal-cell { min-height: 56px; }
  /* אירוע ביומן: פס צבע בלי טקסט, אבל בגובה 24px כדי שאפשר יהיה ללחוץ (WCAG 2.5.8). */
  .cal-ev { font-size: 0; height: 24px; padding: 0; margin-top: 2px; }
  .card { padding: 16px; }
  h1 { font-size: 26px; }
  /* שורות עם כפתורי פעולה (הרשאות, מנהלים): השם מקבל שורה משלו, והתגים
     והכפתורים יורדים מתחת לו, מיושרים לטקסט ולא לאווטר. */
  .row:has(> .btn) { flex-wrap: wrap; row-gap: 8px; }
  .row:has(> .btn) > .body { flex: 1 1 calc(100% - 52px); }
  .row:has(> .btn) > .body + * { margin-inline-start: 52px; }
}
/* הרשימה שליד היומן: בגובה המסך, עם גלילה משלה (ב-106 אירועים היא הגיעה ל-8,000px). */
.cal-list .rows { max-height: 70vh; overflow-y: auto; overscroll-behavior: contain; }
@media (max-width: 680px) {
  /* קלט מתחת ל-16px גורם ל-iOS להגדיל את הדף בכל לחיצה על שדה. */
  input, select, textarea, .field input, .field select, .search input { font-size: 16px; }
}
@media (max-width: 400px) {
  /* אריחים צרים: סכום של שש ספרות עלה על האריח השכן. */
  .tile { padding: 12px; gap: 8px; }
  .tile .ti { display: none; }
  .tile .v { font-size: 18px; }
  .tile .stat .v { white-space: normal; overflow-wrap: anywhere; }
  /* טבלת התשלומים של הפקה: בלי עמודת התפקיד, והסכום לא נחתך. */
  table.pay-table th:nth-child(2), table.pay-table td:nth-child(2) { display: none; }
  table.pay-table td, table.pay-table th { padding-inline: 6px; }
}
/* פנקס השכר בטלפון: כל שורה ככרטיס — שם וסכום למעלה, חשבונית/שולם/מצב מתחת */
@media (max-width: 680px) {
  table.ledger, table.ledger tbody, table.ledger tfoot { display: block; }
  table.ledger thead { display: none; }
  table.ledger tr { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding-block: 14px; border-bottom: 1px solid var(--divider); }
  table.ledger tbody tr:last-child { border-bottom: 0; }
  table.ledger td { border: 0; padding: 0; white-space: normal; }
  table.ledger td.check { width: auto; }
  table.ledger td.name { flex: 1 1 0; min-width: 0; }
  table.ledger td.owed { font-size: 17px; }
  table.ledger td.prod { flex-basis: 100%; order: 1; }
  table.ledger td.shows, table.ledger td.invoice, table.ledger td.paid { order: 2; display: flex; align-items: center; gap: 6px; text-align: start; font-size: 13.5px; }
  table.ledger td[data-label]::before { content: attr(data-label); color: var(--muted); font-family: var(--font); font-size: 12px; }
  table.ledger td.paid > div { display: inline; }
  table.ledger td.stage { order: 3; }
  table.ledger td.action { order: 3; margin-inline-start: auto; }
  table.ledger tfoot tr { justify-content: space-between; }
  table.ledger tfoot td:empty, table.ledger tfoot td.check { display: none; }
  table.ledger tfoot td.owed, table.ledger tfoot td.paid { display: flex; gap: 6px; align-items: baseline; font-size: 15px; }
  table.ledger tbody td.owed[data-label]::before { content: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .icon-btn:active, .btn:active, .nav button:active, .row.clickable:active { transform: none; }
}

.card-head h2 { font-size: 19px; }
.page-head h1 { font-size: 27px; }
