/* Kibbutzit client demo - one stylesheet, right to left, system fonts only, no external files. */

:root {
  --bg: #f5f5f5;
  --surface: #ffffff;
  --text: #242424;
  --muted: #616161;
  --line: #e0e0e0;
  --line-strong: #d1d1d1;
  --brand: #0f6cbd;
  --brand-dark: #115ea3;
  --brand-soft: #ebf3fc;
  --green: #0e700e;
  --green-soft: #f1faf1;
  --orange: #bc4b09;
  --orange-soft: #fff9f5;
  --red: #b10e1c;
  --red-soft: #fdf3f4;
  --grey: #424242;
  --grey-soft: #f0f0f0;
  --blue: #115ea3;
  --blue-soft: #ebf3fc;
  --purple: #6b3fa0;
  --purple-soft: #f0e8fa;
  --radius: 4px;
  --shadow: 0 0 2px rgba(0, 0, 0, 0.12), 0 2px 4px rgba(0, 0, 0, 0.14);
}

* { box-sizing: border-box; }

html { font-size: 14px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Segoe UI Variable Text", system-ui, -apple-system, BlinkMacSystemFont, "Noto Sans Hebrew", "Arial Hebrew", Arial, sans-serif;
  line-height: 1.5;
  direction: rtl;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { font-size: 1.6rem; margin: 0 0 0.5rem; }
h2 { font-size: 1.25rem; margin: 1.5rem 0 0.6rem; }
h3 { font-size: 1.05rem; margin: 1.2rem 0 0.5rem; }

code { font-family: Consolas, "Courier New", monospace; background: var(--grey-soft); padding: 0 0.3em; border-radius: 2px; }

/* ---------------------------------------------------------------- demo mark, header, navigation */
.demo-bar {
  background: #fff3c4;
  color: #6a4b00;
  border-bottom: 1px solid #e6cf73;
  text-align: center;
  font-weight: 600;
  padding: 0.35rem 1rem;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  background: var(--brand);
  color: #fff;
  padding: 0.6rem 1.25rem;
}
.site-header a { color: #fff; }
.brand { font-size: 1.3rem; font-weight: 700; }
.brand-sub { font-size: 0.85rem; font-weight: 400; opacity: 0.85; margin-inline-start: 0.4rem; }
.company-box { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.company-label { opacity: 0.85; }
.company-change {
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius);
  padding: 0.15rem 0.6rem;
  font-size: 0.9rem;
}
/* the signed-in user and the sign-out link (AUTH_DESIGN_V1 section 2) */
.user-box { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.user-label { opacity: 0.85; }
.sign-out {
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius);
  padding: 0.15rem 0.6rem;
  font-size: 0.9rem;
}
/* the sign-in page and the refusal pages */
.sign-in-card { max-width: 520px; margin: 2rem auto; }
.sign-in-mount { min-height: 12rem; display: flex; justify-content: center; }

.main-nav {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 0 1.25rem;
}
.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}
.nav-list a {
  display: inline-block;
  padding: 0.6rem 0.8rem;
  color: var(--text);
  border-bottom: 3px solid transparent;
  font-weight: 500;
}
.nav-list a:hover { background: var(--brand-soft); text-decoration: none; }
.nav-list a.active { border-bottom-color: var(--brand); color: var(--brand-dark); font-weight: 700; }
.nav-next { border-top: 1px dashed var(--line); padding: 0.25rem 0; align-items: center; font-size: 0.85rem; }
/* Polish round, D-DEMO-1008-10 (walk-through F10): the title of the greyed row is a link to the "next version" page
   and looks like one - the brand colour and an underline - instead of a label. */
.nav-next .nav-next-title a {
  padding: 0.2rem 0.4rem;
  color: var(--brand);
  font-weight: 600;
  border: 0;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}
.nav-disabled {
  display: inline-block;
  color: #707070;
  padding: 0.2rem 0.45rem;
  cursor: not-allowed;
  border: 1px dashed #d1d1d1;
  border-radius: var(--radius);
}

/* ---------------------------------------------------------------- page layout */
.page { max-width: 1400px; margin: 0 auto; padding: 1.25rem; }

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.page-header h1 { margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.breadcrumbs { font-size: 0.9rem; color: var(--muted); margin-bottom: 0.5rem; }
.breadcrumbs a { color: var(--muted); }
.lead { font-size: 1.05rem; color: var(--muted); max-width: 70ch; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.nowrap { white-space: nowrap; }
.text-red { color: var(--red); font-weight: 600; }
.text-green { color: var(--green); }
.text-orange { color: var(--orange); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }

.section { margin-top: 1.5rem; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }

/* definition lists for record pages */
dl.fields {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.35rem 1rem;
  margin: 0;
}
dl.fields dt { color: var(--muted); font-weight: 500; }
dl.fields dd { margin: 0; }
dl.fields-compact { font-size: 0.9rem; gap: 0.15rem 0.75rem; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-block;
  font: inherit;
  font-size: 0.95rem;
  line-height: 1.2;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { background: var(--grey-soft); text-decoration: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-secondary { background: var(--brand-soft); border-color: #b4d6fa; color: var(--brand-dark); }
.btn-warning { background: var(--orange-soft); border-color: #fdcfb4; color: var(--orange); }
.btn-danger { background: var(--red-soft); border-color: #eeacb2; color: var(--red); }
.btn-small { padding: 0.2rem 0.55rem; font-size: 0.85rem; }
.btn[disabled], .btn.disabled { opacity: 0.5; cursor: not-allowed; }
form.inline { display: inline; }

/* ---------------------------------------------------------------- messages and notices */
.messages { list-style: none; margin: 0 0 1rem; padding: 0; }
.msg { padding: 0.6rem 0.9rem; border-radius: var(--radius); margin-bottom: 0.4rem; border: 1px solid; }
.msg-success { background: var(--green-soft); border-color: #9fd89f; color: var(--green); }
.msg-info { background: var(--blue-soft); border-color: #b4d6fa; color: var(--brand-dark); }
.msg-warning { background: var(--orange-soft); border-color: #fdcfb4; color: var(--orange); }
.msg-error { background: var(--red-soft); border-color: #eeacb2; color: var(--red); }
/* Polish round, D-DEMO-1008-10 (lane 3 F3): on the work-order page (body.has-sections) an action returns to its own
   section, so the message at the top of the page would be out of view: there the messages stay at the top edge of
   the window while the page is scrolled, and a section the page scrolls to leaves room for them above it. */
body.has-sections .messages { position: sticky; top: 0; z-index: 5; margin-bottom: 0.5rem; }
body.has-sections .section, body.has-sections #reminder { scroll-margin-top: 5.5rem; }

.alert { padding: 0.7rem 1rem; border-radius: var(--radius); border: 1px solid; margin: 0.75rem 0; }
.alert-info { background: var(--blue-soft); border-color: #b4d6fa; }
.alert-warning { background: var(--orange-soft); border-color: #fdcfb4; }
.alert-danger { background: var(--red-soft); border-color: #eeacb2; }

/* "בגרסה הבאה" inline note for a feature the demo does not yet perform */
.next-version {
  display: inline-block;
  color: #707070;
  border: 1px dashed #d1d1d1;
  border-radius: var(--radius);
  padding: 0.1rem 0.5rem;
  font-size: 0.85rem;
  background: #fafafa;
}
.next-version::before { content: "בגרסה הבאה: "; font-weight: 600; }

.empty {
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  color: var(--muted);
}

/* ---------------------------------------------------------------- badges (states and priorities) */
.badge {
  display: inline-block;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge-green { background: var(--green-soft); color: var(--green); border-color: #9fd89f; }
.badge-orange { background: var(--orange-soft); color: var(--orange); border-color: #fdcfb4; }
.badge-red { background: var(--red-soft); color: var(--red); border-color: #eeacb2; }
.badge-grey { background: var(--grey-soft); color: var(--grey); border-color: #d1d1d1; }
.badge-blue { background: var(--blue-soft); color: var(--blue); border-color: #b4d6fa; }
.badge-purple { background: var(--purple-soft); color: var(--purple); border-color: #d6c3ee; }

/* priority colours of SPEC 11.2: normal green, medium orange, urgent red */
.priority-normal { color: var(--green); }
.priority-medium { color: var(--orange); }
.priority-urgent { color: var(--red); font-weight: 700; }
tr.row-priority-normal > td:first-child { box-shadow: inset -4px 0 0 var(--green); }
tr.row-priority-medium > td:first-child { box-shadow: inset -4px 0 0 #bc4b09; }
tr.row-priority-urgent > td:first-child { box-shadow: inset -4px 0 0 var(--red); }

/* ---------------------------------------------------------------- filter bar */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.6rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}
.filter-bar > div, .filter-bar .filter-field {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 140px;
}
.filter-bar label { font-size: 0.82rem; color: var(--muted); font-weight: 500; }
.filter-bar input, .filter-bar select { min-width: 140px; }
/* V13 (browser check V12B-04): the labels and the bounds of a range share one text line (baseline), so a bound whose
   error line grows under it moves nothing else in the row. */
.filter-bar .filter-range { flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 0.3rem; }
.filter-bar .filter-buttons { flex-direction: row; gap: 0.4rem; min-width: 0; }
.filter-bar .helptext { display: none; }
/* V13 (browser check V12B-04): each bound of a range is one part - its box and, under it, its own error line (V12 put
   the line under the whole range row). In every filter bar an error line takes the width of its own field and wraps
   there (width 0 with min-width 100%: it never widens the field). */
.filter-bar .filter-range-part { display: flex; flex-direction: column; gap: 0.15rem; }
.filter-bar ul.errorlist { width: 0; min-width: 100%; margin: 0; }

.count { color: var(--muted); margin: 0.25rem 0 0.5rem; font-size: 0.92rem; }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table.data {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  font-size: 0.93rem;
}
table.data th, table.data td {
  padding: 0.35rem 0.6rem;
  border-bottom: 1px solid var(--line);
  text-align: right;
  vertical-align: top;
}
table.data thead th {
  background: #f5f5f5;
  color: #242424;
  font-weight: 600;
  position: sticky;
  top: 0;
  white-space: nowrap;
}
table.data tbody tr:nth-child(even) { background: #fafafa; }
table.data tbody tr:hover { background: #f5f5f5; }
table.data td.num, table.data th.num { text-align: left; white-space: nowrap; }
table.data td.company-cell { font-size: 0.85rem; color: var(--muted); }
table.data tfoot td { font-weight: 700; background: #f5f5f5; }
table.data tr.is-cancelled td { color: #707070; text-decoration: line-through; }
table.data tr.is-overdue td.due { color: var(--red); font-weight: 600; }
.money { unicode-bidi: isolate; white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- wide tables (polish round, D-DEMO-1008-10; walk-through F1, F2, lane 2 F11) */
/* A wide list keeps every column: its frame scrolls sideways (.table-wrap), a short line above it says so, and its
   actions column - the last one, at the left edge of this right-to-left layout - stays in view while the rest scrolls. */
.table-scroll-hint { font-size: 0.82rem; color: var(--muted); margin: 0 0 0.3rem; }
.table-scroll-hint::before { content: "\2194\00a0"; }
.table-wrap-wide table.data th.sticky-col,
.table-wrap-wide table.data td.sticky-col {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--surface);
  box-shadow: 1px 0 0 var(--line), 6px 0 8px -4px rgba(0, 0, 0, 0.14);
}
.table-wrap-wide table.data thead th.sticky-col { background: #f5f5f5; z-index: 2; }
.table-wrap-wide table.data tbody tr:nth-child(even) td.sticky-col { background: #fafafa; }
.table-wrap-wide table.data tbody tr:hover td.sticky-col { background: #f5f5f5; }
.table-wrap-wide table.data tfoot td.sticky-col { background: #f5f5f5; }

/* ---------------------------------------------------------------- forms */
.form-card { max-width: 820px; }
.form-stack > div, .form-stack p { margin-bottom: 0.8rem; display: flex; flex-direction: column; gap: 0.2rem; }
.form-stack label, .form-row label { font-weight: 600; font-size: 0.92rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0.6rem 1rem; }
.form-grid > div { display: flex; flex-direction: column; gap: 0.2rem; }
.form-actions { display: flex; gap: 0.5rem; margin-top: 1rem; flex-wrap: wrap; }
.helptext, .help { color: var(--muted); font-size: 0.85rem; }

input[type="text"], input[type="number"], input[type="email"], input[type="search"],
input[type="tel"], input[type="file"], select, textarea {
  font: inherit;
  font-size: 0.95rem;
  padding: 0.38rem 0.5rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  max-width: 100%;
}
input[type="number"], input[type="email"], input[type="tel"] { direction: ltr; text-align: right; }
textarea { min-height: 4.5rem; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid #000000; outline-offset: 0; border-color: var(--brand); }
/* V12 (browser check V11B-02): a field the server refused (aria-invalid="true") is marked, not only its message. */
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--red); background-color: #fdf3f4; }
.required-mark { color: var(--red); }
/* V12: text for a screen reader only (a date field's format description, the context of a range's "עד"). */
.kbz-sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
/* Polish round, D-DEMO-1008-10 (lane 3 F8): a stacked field is a flex column, so a label and a mark that are two
   children land on two lines; the templates wrap them in one .field-label, inside which both stay inline. */
.field-label > label { display: inline; }

ul.errorlist { list-style: none; margin: 0.15rem 0; padding: 0; color: var(--red); font-size: 0.88rem; }
ul.errorlist.nonfield { background: var(--red-soft); border: 1px solid #eeacb2; padding: 0.5rem 0.75rem; border-radius: var(--radius); }

/* ---------------------------------------------------------------- the Israeli date field (V11, D-V9-1014-13) */
/* core.date_fields: a text field that shows and accepts dd/mm/yyyy (mm/yyyy for a month, HH:MM for a time) and the
   Hebrew calendar of core/static/core/il_forms.js - right to left, Sunday first. The button is hidden until the
   script shows it. */
.kbz-date {
  position: relative;
  display: inline-flex;
  align-items: stretch;
  gap: 0.25rem;
  max-width: 100%;
  align-self: flex-start;
  vertical-align: middle;
}
.kbz-date-input { direction: ltr; text-align: right; width: 9em; }
.kbz-month-input { width: 6.5em; }
/* V12 (browser check V11B-01): the time box holds its example "18:30" and a typed time whole, also on a narrow screen
   (it never shrinks; the date-and-time pair wraps instead). */
.kbz-time-input { direction: ltr; text-align: right; width: 5.5em; min-width: 5.5em; flex: none; }
.kbz-datetime { display: inline-flex; flex-wrap: wrap; align-items: stretch; gap: 0.4rem; align-self: flex-start; max-width: 100%; }
.kbz-date-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.2rem;
  padding: 0 0.45rem;
  font: inherit;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--brand-soft);
  color: var(--brand-dark);
  cursor: pointer;
}
.kbz-date-button:hover { background: #cfe4fa; }
.kbz-date-button:focus-visible { outline: 2px solid #000000; outline-offset: 1px; }
.kbz-date-button[hidden], .kbz-cal[hidden] { display: none; }
/* The calendar is fixed to the window; il_forms.js places it under (or above) its field. */
.kbz-cal {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 60;
  width: 18.5rem;
  max-width: calc(100vw - 1rem);
  padding: 0.6rem;
  direction: rtl;
  text-align: right;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: 0 0 2px rgba(0, 0, 0, 0.12), 0 8px 16px rgba(0, 0, 0, 0.14);
}
.kbz-cal-head { display: flex; align-items: center; gap: 0.2rem; margin-bottom: 0.4rem; }
.kbz-cal-title { flex: 1; text-align: center; font-weight: 700; }
.kbz-cal-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--brand-dark);
  cursor: pointer;
}
.kbz-cal-nav:hover { background: var(--brand-soft); }
table.kbz-cal-grid { width: 100%; border-collapse: separate; border-spacing: 2px; table-layout: fixed; }
.kbz-cal-grid th { padding: 0.15rem 0; font-size: 0.8rem; font-weight: 600; color: var(--muted); text-align: center; }
.kbz-cal-grid td { height: 2.1rem; padding: 0; text-align: center; vertical-align: middle; border-radius: var(--radius); }
.kbz-cal-grid td.kbz-cal-month { height: 2.6rem; }
.kbz-cal-day, .kbz-cal-month { cursor: pointer; font-variant-numeric: tabular-nums; }
.kbz-cal-day:hover, .kbz-cal-month:hover { background: var(--brand-soft); }
.kbz-cal-grid td.is-today { box-shadow: inset 0 0 0 2px var(--brand); font-weight: 700; }
.kbz-cal-grid td.is-selected { background: var(--brand); color: #fff; font-weight: 700; }
.kbz-cal-grid td.is-disabled { color: #bdbdbd; background: none; cursor: not-allowed; }
.kbz-cal-grid td:focus { outline: 2px solid var(--text); outline-offset: 1px; }
.kbz-cal-foot { display: flex; justify-content: space-between; gap: 0.5rem; margin-top: 0.4rem; }

/* ---------------------------------------------------------------- the file field (V12, D-V12-1014-01) */
/* core.file_fields: the browser's file input stays the real control; once il_forms.js has set the control up it lies
   transparent over our face - "בחירת קובץ" and the chosen file's name (or "לא נבחר קובץ") - so the browser's own
   text, in the browser's language, is never seen. Without the script the face stays hidden and the input is shown. */
.kbz-file { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 0.3rem; max-width: 100%; align-self: flex-start; }
.kbz-file-control { position: relative; display: inline-flex; max-width: 100%; }
.kbz-file-face { display: inline-flex; align-items: center; gap: 0.6rem; max-width: 100%; min-width: 0; }
.kbz-file-face[hidden] { display: none; }
.kbz-file-button {
  display: inline-block;
  flex: none;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
  padding: 0.45rem 0.9rem;
  border: 1px solid #b4d6fa;
  border-radius: var(--radius);
  background: var(--brand-soft);
  color: var(--brand-dark);
  white-space: nowrap;
}
.kbz-file-name { min-width: 0; max-width: 22rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 0.92rem; }
.kbz-file-name.has-file { color: var(--text); font-weight: 500; }
.kbz-file[data-kbz-ready] .kbz-file-input {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
}
.kbz-file-input:hover + .kbz-file-face .kbz-file-button { background: #cfe4fa; }
.kbz-file-input:focus + .kbz-file-face .kbz-file-button { outline: 2px solid var(--brand); outline-offset: 2px; }
.kbz-file-input[aria-invalid="true"] + .kbz-file-face .kbz-file-button { border-color: var(--red); }
.kbz-file-again { color: var(--orange); font-size: 0.85rem; }

/* ---------------------------------------------------------------- the confirmation dialog (V12, D-V12-1014-01) */
/* il_forms.js: a modal <dialog> (the page behind it is inert), right to left, the two buttons named by the action. */
dialog.kbz-dialog {
  width: 30rem;
  max-width: calc(100vw - 2rem);
  padding: 1.1rem 1.25rem 1rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  direction: rtl;
  text-align: right;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.12), 0 32px 64px rgba(0, 0, 0, 0.14);
}
dialog.kbz-dialog::backdrop { background: rgba(0, 0, 0, 0.4); }
.kbz-dialog-question { font-size: 1.15rem; margin: 0 0 0.5rem; }
.kbz-dialog-detail { margin: 0; color: var(--muted); }
.kbz-dialog-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
.kbz-dialog .btn:focus { outline: 2px solid var(--text); outline-offset: 2px; }

/* V11 (browser check C-02): a phone number inside free text (a work order's description) is isolated left to right
   and never broken, so its digits, hyphen and parentheses keep their order inside right-to-left text. */
.phone { direction: ltr; unicode-bidi: isolate; white-space: nowrap; }
/* V11 (browser check C-03; Hebrew-copy review H2-05): a long left-to-right token (a file's digital fingerprint, a
   file name) is isolated and may wrap anywhere, so it never widens its column or scrolls the page sideways. */
.ltr-token { direction: ltr; unicode-bidi: isolate; overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- tiles, company choice, tree */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.tile {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.2rem;
  color: var(--text);
}
.tile:hover { border-color: var(--brand); text-decoration: none; }
.tile-title { font-size: 1.15rem; font-weight: 700; color: var(--brand-dark); }
.tile-text { color: var(--muted); }
.tile-figure { margin-top: auto; font-weight: 600; }

.company-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
.company-card { display: flex; flex-direction: column; gap: 0.5rem; }
.company-card h2 { margin: 0; }
.company-card.is-current { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.company-card-number { color: var(--muted); font-size: 0.9rem; }

/* the not-found page (polish round, D-DEMO-1008-10) */
.not-found-card { max-width: 720px; margin: 1rem auto; }
.not-found-links { list-style: none; margin: 0.5rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; }

ul.tree, ul.tree ul { list-style: none; margin: 0; padding-inline-start: 1.25rem; }
ul.tree { padding-inline-start: 0; }
ul.tree li { margin: 0.2rem 0; }
ul.tree .tree-node { font-weight: 600; }

.tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; flex-wrap: wrap; }
.tabs a { padding: 0.45rem 0.8rem; border: 1px solid transparent; border-bottom: 0; border-radius: var(--radius) var(--radius) 0 0; color: var(--text); }
.tabs a.active { background: var(--surface); border-color: var(--line); font-weight: 600; }

.history { list-style: none; margin: 0; padding: 0; border-inline-start: 2px solid var(--line); }
.history li { padding: 0.25rem 0.75rem; position: relative; }
.history li::before { content: ""; position: absolute; right: -6px; top: 0.7rem; width: 10px; height: 10px; border-radius: 50%; background: var(--line-strong); }
.history .when { color: var(--muted); font-size: 0.85rem; margin-inline-end: 0.5rem; }

.photo-grid { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.photo-grid figure { margin: 0; width: 180px; }
.photo-grid img { width: 180px; height: 135px; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--line); background: var(--grey-soft); }
.photo-grid figcaption { font-size: 0.82rem; color: var(--muted); }

/* ---------------------------------------------------------------- the printable Payment Demand */
.doc {
  background: #fff;
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 2.25rem;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.doc-mark {
  border: 2px solid #c79a00;
  color: #6a4b00;
  background: #fff8db;
  text-align: center;
  font-weight: 700;
  padding: 0.4rem;
  margin-bottom: 1rem;
}
.doc-header { display: flex; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; border-bottom: 2px solid var(--text); padding-bottom: 0.75rem; margin-bottom: 1rem; }
.doc-issuer { font-size: 0.92rem; }
.doc-issuer .issuer-name { font-size: 1.15rem; font-weight: 700; }
.doc-title { font-size: 1.4rem; font-weight: 700; }
.doc-meta { display: grid; grid-template-columns: max-content 1fr; gap: 0.15rem 0.75rem; font-size: 0.92rem; }
.doc-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; font-size: 0.92rem; }
table.doc-lines { width: 100%; border-collapse: collapse; margin: 0.75rem 0; font-size: 0.92rem; }
table.doc-lines th, table.doc-lines td { border-bottom: 1px solid var(--line); padding: 0.35rem 0.5rem; text-align: right; vertical-align: top; }
table.doc-lines th { border-bottom: 2px solid var(--text); }
table.doc-lines td.num, table.doc-lines th.num { text-align: left; white-space: nowrap; }
table.doc-lines tr.line-discount td, table.doc-lines tr.line-manual_credit td { color: #355c2f; }
table.doc-lines tr.line-note td { font-style: italic; color: var(--muted); }
.line-reason { display: block; font-size: 0.85rem; color: var(--muted); }
.doc-totals { margin-inline-start: auto; width: 320px; max-width: 100%; border-collapse: collapse; }
.doc-totals td { padding: 0.25rem 0.5rem; }
.doc-totals td.num { text-align: left; }
.doc-totals tr.grand td { border-top: 2px solid var(--text); font-weight: 700; font-size: 1.05rem; }
/* Polish round, D-DEMO-1008-10 (walk-through F11): the reminder's totals table carries longer labels ("סכום דרישת
   התשלום (כולל מע"מ)", "בפיגור 115 ימים") than the Payment Demand's, so it is wider and its values do not wrap. */
.doc-totals-reminder { width: 480px; }
.doc-totals-reminder td.num { white-space: nowrap; }
.doc-balances { margin-top: 1rem; font-size: 0.9rem; }
.doc-footer { margin-top: 1.5rem; font-size: 0.82rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: 0.5rem; }

/* ---------------------------------------------------------------- footer */
.site-footer {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  max-width: 1400px;
  margin: 1rem auto 0;
  padding: 0.75rem 1.25rem 1.5rem;
  color: var(--muted);
  font-size: 0.82rem;
}

/* ---------------------------------------------------------------- V13.1 (human-factors polish; UX_V13_1_SCOPE_V4, D-V13-1016-06) */
/* UX-05 (D-5 A): money columns align on their right edge; every amount has two decimals and tabular figures, so the
   decimals stand under each other. */
table.data td.num, table.data th.num { text-align: right; }
/* UX-41: a rare button of a row of buttons goes to the far end, away from the main one. */
.push-end { margin-inline-start: auto; }
/* UX-31: a box that only informs is quieter than a warning or a refusal. */
.alert-quiet { background: var(--grey-soft); border-color: var(--line); color: var(--muted); font-size: 0.92rem; padding: 0.45rem 0.8rem; }

/* ---------------------------------------------------------------- V13.2 (the MINOR findings of V13.1; UX_V13_2_SCOPE_V3, D-V13-1016-09) */
/* V132-01 (D132-06 A): a buttons row inside a stacked form card stays a row (the stacked rule above makes every
   direct child a column), so a push-end button stands at the far end of the row and the row wraps on a narrow screen. */
.form-stack > div.form-actions-row { flex-direction: row; align-items: center; gap: 0.5rem; }
/* V132-12 (D132-10 A): on a narrow screen the period of a document line may wrap at its spaces, so the Payment Demand
   does not scroll sideways; a date and an amount never break. Screen only: the printed document is unchanged. */
@media screen and (max-width: 700px) { table.doc-lines td.nowrap { white-space: normal; } }

/* ---------------------------------------------------------------- V14-LIST (the contracts list; UX_V14_SCOPE_V2 V14-02 / V14-03, D-V13-1019-09) */
/* V14-02: the one GET form of the list's upper part; the search field above the strip (Fluent look through the tokens). */
.list-head { margin-bottom: 0.75rem; }
.search-field { display: flex; flex-direction: column; gap: 0.15rem; max-width: 560px; margin-bottom: 0.75rem; }
.search-field label { font-size: 0.82rem; color: var(--muted); font-weight: 500; }
.search-field input { width: 100%; }
/* V14-02 (D14-08 (a)): the summary strip - four cards, each a link with its count over all the company's contracts;
   the current view carries aria-current. */
.quick-views { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.6rem; margin-bottom: 0.35rem; }
.quick-views a {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.6rem 0.8rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--text);
}
.quick-views a:hover { background: var(--brand-soft); border-color: var(--line-strong); text-decoration: none; }
.quick-views a[aria-current="true"] { border-color: var(--brand); box-shadow: var(--shadow), inset 0 -3px 0 var(--brand); }
.quick-views .quick-view-count { font-size: 1.4rem; font-weight: 700; line-height: 1.2; color: var(--brand-dark); font-variant-numeric: tabular-nums; }
.quick-views .quick-view-label { font-size: 0.85rem; color: var(--muted); }
.quick-views-note { font-size: 0.82rem; color: var(--muted); margin: 0 0 0.75rem; }
/* V14-02: the applied-filter chips ("label: value", the remove link named "הסרת הסינון: ..."). */
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin-bottom: 0.75rem; font-size: 0.88rem; }
.chips .chips-prefix { color: var(--muted); }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.15rem 0.65rem;
  background: var(--brand-soft);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--brand-dark);
}
.chip a.chip-remove { color: inherit; font-weight: 700; line-height: 1; padding: 0 0.1rem; }
.chip a.chip-remove:hover { color: var(--red); text-decoration: none; }
/* V14-02 (C04): the 15 controls inside the collapsed block within .filter-bar (the bar's own rules above stay verbatim;
   the block is its one flex item and takes the full width; the fields inside keep the bar's column layout). */
.filter-bar > details.filter-details { flex: 1 1 100%; min-width: 0; }
.filter-details summary { cursor: pointer; font-weight: 600; color: var(--brand-dark); padding: 0.1rem 0; }
.filter-details[open] summary { margin-bottom: 0.6rem; }
.filter-fields { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.6rem 0.9rem; }
.filter-fields > div { display: flex; flex-direction: column; gap: 0.15rem; min-width: 140px; }
/* V14-02: the hint above the table (only when rows exist). */
.list-hint { font-size: 0.85rem; color: var(--muted); margin: 0 0 0.4rem; }
/* V14-03 (C01, C02): the first column - the opener, the docnum link under it, the company line (the class
   company-cell kept on the line; its td rule above styles the customers list's cell). */
table.data td.customer-cell { min-width: 12rem; }
table.data a[data-kbz-drawer] { font-weight: 600; }
table.data td .company-cell { font-size: 0.85rem; color: var(--muted); }
/* V14-02 (risk R6): under 700 px the strip shows two cards per row. */
@media screen and (max-width: 700px) { .quick-views { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------------------------------------------------------------- V14-DRAWER (the contract drawer; UX_V14_SCOPE_V2 V14-04 / V14-05 / V14-06, D-V13-1019-09) */
/* V14-05 (D14-05 (a)): the drawer is a fixed panel at the left edge of this right-to-left page (the inline end), 63vw
   wide on a wide screen and the whole width at 900 px and below, above the calendar (.kbz-cal, z 60); the page
   behind it is dimmed by the backdrop and blocked (inert, set by kbz_drawer.js). No motion: it appears at once. */
.kbz-drawer {
  position: fixed;
  inset-block: 0;
  inset-inline-end: 0;
  z-index: 70;
  width: 63vw;
  max-width: 100vw;
  overflow-y: auto;
  padding: 1rem 1.25rem 1.5rem;
  direction: rtl;
  text-align: right;
  color: var(--text);
  background: var(--surface);
  border-inline-start: 1px solid var(--line-strong);
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.12), 0 32px 64px rgba(0, 0, 0, 0.14);
}
.kbz-drawer[hidden], .kbz-drawer-backdrop[hidden] { display: none; }
.kbz-drawer-backdrop { position: fixed; inset: 0; z-index: 65; background: rgba(0, 0, 0, 0.4); }
.kbz-drawer-backdrop:not(.is-active) { opacity: 0; }
body.kbz-drawer-open { overflow: hidden; }
@media (max-width: 900px) { .kbz-drawer { width: 100vw; } }
/* The drawer's head: the eyebrow, the close button (the word), the contract number as the focused title, the badges,
   the three names and the one metric. The same markup on the standalone page sits inside a card (.kbz-drawer-page). */
.kbz-drawer-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.2rem 0.75rem; align-items: start; }
.kbz-drawer-eyebrow { font-size: 0.82rem; font-weight: 600; color: var(--muted); }
.kbz-drawer-close { grid-column: 2; grid-row: 1 / span 2; justify-self: end; }
.kbz-drawer-title { grid-column: 1; margin: 0; font-size: 1.4rem; }
.kbz-drawer-title:focus { outline: 2px solid var(--text); outline-offset: 2px; }
.kbz-drawer-badges { grid-column: 1; display: flex; flex-wrap: wrap; gap: 0.35rem; }
.kbz-drawer-meta { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 0.2rem 1rem; color: var(--text); }
.kbz-drawer-metric { grid-column: 1 / -1; grid-template-columns: max-content max-content; margin-top: 0.35rem; font-size: 1rem; }
.kbz-drawer-metric dd { font-weight: 700; }
/* The tab row (D14-15 (a): the seven tabs wrap onto two rows on a narrow screen); the selected tab is underlined in
   the brand colour, as the active item of the main navigation. */
.kbz-tabs { display: flex; flex-wrap: wrap; gap: 0.15rem; margin: 1rem 0 0.75rem; border-bottom: 1px solid var(--line); }
.kbz-tabs [role="tab"] {
  font: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.5rem 0.8rem;
  margin-bottom: -1px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: none;
  color: var(--text);
  cursor: pointer;
}
.kbz-tabs [role="tab"]:hover { background: var(--brand-soft); }
.kbz-tabs [role="tab"][aria-selected="true"] { border-bottom-color: var(--brand); color: var(--brand-dark); font-weight: 700; }
.kbz-tabs [role="tab"]:focus-visible { outline: 2px solid #000000; outline-offset: -2px; }
.kbz-panel[hidden] { display: none; }
.kbz-panel > h3:first-child { margin-top: 0.5rem; }
.kbz-panel .card { box-shadow: none; }
.kbz-section-links { font-weight: 600; }
/* V14-06 (D14-11 (a)): the expansion control of a row of the payments tab is a triangle drawn by CSS borders (no icon
   file); it points down while the detail row is closed and up while it is open. The detail row holds one cell. */
table.data td.kbz-expand-cell, table.data th.kbz-expand-col { width: 2.4rem; padding-inline-end: 0.3rem; }
.kbz-expand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.7rem;
  height: 1.7rem;
  padding: 0;
  font: inherit;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--brand-dark);
  cursor: pointer;
}
.kbz-expand:hover { background: var(--brand-soft); }
.kbz-expand:focus-visible { outline: 2px solid #000000; outline-offset: 1px; }
.kbz-expand::before { content: ""; border: 0.35rem solid transparent; border-top: 0.45rem solid currentColor; border-bottom: 0; margin-top: 0.1rem; }
.kbz-expand[aria-expanded="true"]::before { border-top: 0; border-bottom: 0.45rem solid currentColor; margin-top: 0; margin-bottom: 0.1rem; }
table.data tr.kbz-detail-row td { background: var(--grey-soft); border-bottom: 1px solid var(--line-strong); }
table.data tr.kbz-detail-row[hidden] { display: none; }
.kbz-detail { padding: 0.25rem 0.5rem 0.25rem 0; }
.kbz-detail h4 { margin: 0 0 0.4rem; font-size: 0.95rem; }
.kbz-detail dl.fields { gap: 0.15rem 1rem; }
.kbz-detail p { margin: 0.5rem 0 0; }
.kbz-drawer-foot { margin-top: 1.5rem; padding-top: 0.75rem; border-top: 1px solid var(--line); }
.kbz-drawer-foot .actions { margin-bottom: 0.5rem; }

/* ---------------------------------------------------------------- V15-LOOK (the three look items of the V15 browser check; D-V15-1019-02) */
/* m-02 (BROWSER_CHECK_V15_V1 PR-A6): the first cell of the properties list carries the class customer-cell, so the
   rule table.data td.customer-cell of the V14-LIST block gives it the width of the other lists' first cell; this
   block adds no rule for it. */
/* m-01 (BI-B5): under 700 px each bound of a range of the billing list's inline form is one row - its label beside its
   own field (the label held against the field) - so the word for "to" never stays at the end of the row above its
   field. Wider screens keep the V13 range row (each pair one row). */
@media screen and (max-width: 700px) {
  .filter-fields .filter-range { display: grid; grid-template-columns: max-content minmax(0, 1fr); align-items: baseline; gap: 0.3rem 0.5rem; }
  .filter-fields .filter-range > label { justify-self: end; }
}
/* S-m2 (MA-A4): the figure of the maintenance strip's urgent card is red, as the urgent tile's figure was (the rule
   .priority-urgent above); the card is found by its link (the filter priority=urgent), so the strip's markup stays as
   V15 pinned it. */
.quick-views a.quick-view[href*="priority=urgent"] .quick-view-count { color: var(--red); }

/* ---------------------------------------------------------------- small screens */
@media (max-width: 700px) {
  .page { padding: 0.75rem; }
  .site-header { padding: 0.5rem 0.75rem; }
  .main-nav { padding: 0 0.5rem; }
  dl.fields { grid-template-columns: 1fr; }
  .doc { padding: 1rem; }
  .doc-parties { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------- print (the Payment Demand page) */
@media print {
  html { font-size: 12px; }
  body { background: #fff; }
  .no-print, .site-header, .main-nav, .site-footer, .messages, .actions, .filter-bar, .btn { display: none !important; }
  .demo-bar { border: 2px solid #000; background: #fff; color: #000; }
  .page { max-width: none; padding: 0; }
  .doc { border: 0; box-shadow: none; padding: 0; max-width: none; }
  .doc-mark { border-color: #000; background: #fff; color: #000; }
  /* Polish round, D-DEMO-1008-10 (walk-through F6, lane 2 F13): a page that carries a customer document with its own
     mark (body.has-doc - the Payment Demand page, the reminder page) prints the document's mark only; the page bar
     would print the same demo line a second time. Every other page keeps the page bar in print. */
  body.has-doc .demo-bar { display: none !important; }
  a { color: inherit; text-decoration: none; }
  table.data thead th { position: static; }
  .table-scroll-hint { display: none; }
  .table-wrap-wide table.data th.sticky-col, .table-wrap-wide table.data td.sticky-col { position: static; box-shadow: none; }
  /* V11 (D-V9-1014-13): the calendar button and the calendar of a date field are never printed. */
  .kbz-date-button, .kbz-cal { display: none !important; }
  /* V12 (D-V12-1014-01): the confirmation dialog is never printed. */
  dialog.kbz-dialog { display: none !important; }
  dialog.kbz-dialog::backdrop { display: none !important; }
  /* V14 (UX_V14_SCOPE_V2 V14-05): the contract drawer and its backdrop are never printed. */
  .kbz-drawer, .kbz-drawer-backdrop { display: none !important; }
  /* V11 (browser check P-02): the account state of the Payment Demand - from "מצב החשבון בחוזה" to "סה"כ לתשלום" -
     and the document's totals above it (.doc-account) are never split across two printed pages; the heading stays
     with its table. */
  .doc-account { break-inside: avoid; page-break-inside: avoid; }
  .doc-balances h3 { break-after: avoid; page-break-after: avoid; }
  .doc-totals tr { break-inside: avoid; page-break-inside: avoid; }
}
