/* Leader Team LIMS: a calm, Apple-like look. Right to left, light and dark. */

:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #f5f5f7;
  --fill: rgba(120, 120, 128, 0.12);
  --fill-strong: rgba(120, 120, 128, 0.2);
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #86868b;
  --hairline: rgba(0, 0, 0, 0.08);
  --border: #d2d2d7;
  --accent: #e8772e;          /* Leader Team orange */
  --accent-hover: #d2661f;
  --accent-soft: rgba(232, 119, 46, 0.12);
  --accent-text: #b4551a;
  --navy: #2a3a8f;            /* Leader Team blue */
  --navy-soft: rgba(42, 58, 143, 0.1);
  --green: #248a3d;
  --green-soft: rgba(36, 138, 61, 0.12);
  --red: #d70015;
  --red-soft: rgba(215, 0, 21, 0.1);
  --bar: rgba(255, 255, 255, 0.72);
  --sidebar: rgba(232, 232, 237, 0.7);
  --side-active: rgba(0, 0, 0, 0.07);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 6px 24px rgba(0, 0, 0, 0.05);
  --radius: 18px;
  --radius-sm: 12px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --surface: #1c1c1e;
    --surface-2: #2c2c2e;
    --fill: rgba(120, 120, 128, 0.24);
    --fill-strong: rgba(120, 120, 128, 0.36);
    --text: #f5f5f7;
    --text-2: #a1a1a6;
    --text-3: #8e8e93;
    --hairline: rgba(255, 255, 255, 0.1);
    --border: #424245;
    --accent: #ff9a4d;
    --accent-hover: #ffad6b;
    --accent-soft: rgba(255, 154, 77, 0.16);
    --accent-text: #ffad6b;
    --navy: #8ea0ff;
    --navy-soft: rgba(142, 160, 255, 0.16);
    --green: #30d158;
    --green-soft: rgba(48, 209, 88, 0.16);
    --red: #ff6961;
    --red-soft: rgba(255, 105, 97, 0.16);
    --bar: rgba(22, 22, 23, 0.72);
    --sidebar: rgba(28, 28, 30, 0.9);
    --side-active: rgba(255, 255, 255, 0.1);
    --shadow: none;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Hebrew", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.47;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

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

:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 2px; border-radius: 8px; }

/* Emails are typed left to right, but an empty field shows its Hebrew hint on the right. */
input[dir=ltr]:placeholder-shown { direction: rtl; }

.icon { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- App layout: sidebar (on the right, the Hebrew start side) + content ---------- */
.app { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  padding: 20px 14px 14px;
  background: var(--sidebar);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-inline-end: 1px solid var(--hairline);
}

.brand { display: flex; align-items: center; gap: 12px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand img { width: 36px; height: 36px; flex: none; }
.brand-name { display: block; font-weight: 700; font-size: 17px; line-height: 1.2; }
.brand-sub { display: block; font-size: 12px; color: var(--text-3); }
.sidebar .brand { padding: 4px 10px 22px; }

.side-label { font-size: 12px; font-weight: 600; color: var(--text-3); padding: 14px 12px 6px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a {
  display: flex; align-items: center; gap: 12px;
  height: 38px; padding: 0 12px;
  border-radius: 9px;
  color: var(--text); font-size: 15px;
}
.side-nav a .icon { width: 20px; height: 20px; color: var(--accent); }
.side-nav a:hover { background: var(--fill); text-decoration: none; }
.side-nav a.active { background: var(--side-active); font-weight: 600; }

.side-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--hairline); }

/* user menu */
.menu { position: relative; }
.menu summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 10px;
  color: var(--text);
}
.menu summary::-webkit-details-marker { display: none; }
.menu summary:hover, .menu[open] summary { background: var(--fill); }
.menu .who { flex: 1; min-width: 0; line-height: 1.25; }
.menu .who strong { display: block; font-size: 14px; font-weight: 600; }
.menu .who span { display: block; font-size: 12px; color: var(--text-3); }
.menu-panel {
  position: absolute; inset-inline: 0; bottom: calc(100% + 8px);
  min-width: 220px; padding: 6px; z-index: 20;
  /* A frosted panel: the surface a little see-through, blurred behind, a soft shadow. */
  background: var(--surface); border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.14), 0 1px 3px rgba(0, 0, 0, 0.06); border: 1px solid var(--hairline);
}
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .menu-panel { background: color-mix(in srgb, var(--surface) 78%, transparent); -webkit-backdrop-filter: blur(22px) saturate(1.5); backdrop-filter: blur(22px) saturate(1.5); }
}
.menu-panel a, .menu-panel button {
  display: flex; width: 100%; align-items: center; gap: 10px;
  padding: 9px 12px; border: 0; border-radius: 8px;
  background: none; color: var(--text); font: inherit; font-size: 15px; text-align: start; cursor: pointer;
}
.menu-panel a:hover, .menu-panel button:hover { background: var(--fill); text-decoration: none; }
.menu-panel form { margin: 0; }

/* The bell: a count of unread alerts and a panel with the latest ones. */
.bell summary { position: relative; }
.bell summary .icon { width: 22px; height: 22px; color: var(--accent); flex: none; }
.bell-count { position: absolute; top: 2px; inset-inline-start: 24px; min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px;
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 600; line-height: 17px; text-align: center; box-shadow: 0 0 0 2px var(--surface-2); }
.bell .who-label { font-size: 15px; }
.bell-panel { min-width: 320px; max-width: min(92vw, 380px); padding: 4px 0 0; overflow: hidden; }
.bell-list { max-height: 360px; overflow-y: auto; }
.bell-panel .bell-item, .list .bell-item { position: relative; display: flex; flex-direction: column; align-items: stretch; gap: 3px; padding: 10px 16px; border-radius: 0; font-size: 14px; line-height: 1.45; border-bottom: 1px solid var(--hairline); color: var(--text-2); }
.bell-item small { color: var(--text-3); font-size: 12px; font-weight: 400; }
/* Unread: the text in full colour and a small orange dot, not a coloured block. */
.bell-item.unread { color: var(--text); font-weight: 500; padding-inline-start: 28px; }
.bell-item.unread::before { content: ""; position: absolute; inset-inline-start: 12px; top: 16px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.bell-item:hover { background: var(--fill); text-decoration: none; }
.bell-empty { padding: 18px 14px; color: var(--text-3); font-size: 14px; }
.bell-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 4px 6px; }
.bell-foot a, .bell-foot button { width: auto; font-size: 13px; color: var(--accent-text); padding: 8px; }
.topbar-end { display: flex; align-items: center; gap: 4px; }
@media (max-width: 700px) {
  .topbar .bell .who-label { display: none; }
  .topbar .bell summary { padding: 4px 8px; }
  .topbar .bell-panel { position: fixed; inset-inline: 12px; top: 56px; bottom: auto; max-width: none; }
}

/* ---------- Phone top bar and tab bar (hidden on larger screens) ---------- */
.topbar { display: none; }
.tabbar { display: none; }

/* ---------- Page ---------- */
.page { max-width: 1040px; margin: 0 auto; padding: 44px 40px 96px; }
.page-narrow { max-width: 720px; }

.title { font-size: 34px; line-height: 1.15; font-weight: 700; margin: 0; }
.subtitle { color: var(--text-2); font-size: 17px; margin: 6px 0 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }

.section-title {
  font-size: 13px; font-weight: 500; color: var(--text-2);
  margin: 28px 16px 8px; letter-spacing: 0.02em;
}
.section-note { font-size: 13px; color: var(--text-3); margin: 8px 16px 0; }

.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-head h2 { font-size: 19px; font-weight: 600; margin: 0; }
.card-icon {
  width: 32px; height: 32px; border-radius: 9px;
  display: grid; place-items: center; color: #fff; flex: none;
}
.card-icon .icon { width: 18px; height: 18px; }
.bg-accent { background: var(--accent); }
.bg-navy { background: var(--navy); }
.bg-green { background: var(--green); }

.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

.empty-state { display: flex; align-items: center; gap: 12px; color: var(--text-2); font-size: 15px; }
.empty-state .icon { color: var(--green); width: 22px; height: 22px; }
.muted { color: var(--text-2); }
.small { font-size: 13px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; margin-bottom: 16px; }
.stat { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; }
.stat-value { font-size: 28px; font-weight: 700; line-height: 1.1; }
.stat-label { font-size: 13px; color: var(--text-2); margin-top: 4px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 18px; min-height: 36px;
  border-radius: 999px; border: 0;
  background: var(--fill); color: var(--text);
  font: inherit; font-size: 15px; font-weight: 500;
  cursor: pointer; white-space: nowrap;
  transition: background-color 0.15s ease;
}
.btn:hover { background: var(--fill-strong); text-decoration: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { color: var(--red); }
.btn-block { width: 100%; min-height: 48px; font-size: 17px; }
.btn .icon { width: 17px; height: 17px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.actions form { margin: 0; }

/* ---------- Grouped lists (like iOS Settings) ---------- */
.list { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.list-row {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 18px; min-height: 60px;
  color: var(--text); position: relative;
}
.list-row + .list-row::before {
  content: ""; position: absolute; top: 0; inset-inline-end: 0; inset-inline-start: 70px;
  border-top: 1px solid var(--hairline);
}
a.list-row:hover { background: var(--surface-2); text-decoration: none; }
.list-main { flex: 1; min-width: 0; }
.list-title { font-weight: 500; }
.list-sub { font-size: 13px; color: var(--text-2); }
.list-end { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.chevron { color: var(--text-3); width: 16px; height: 16px; }

/* key / value rows */
.kv { display: flex; justify-content: space-between; gap: 16px; padding: 13px 18px; min-height: 48px; align-items: center; position: relative; }
.kv + .kv::before { content: ""; position: absolute; top: 0; inset-inline: 18px 0; border-top: 1px solid var(--hairline); }
.kv dt { color: var(--text); margin: 0; }
.kv dd { color: var(--text-2); margin: 0; text-align: end; }

/* ---------- Avatars and chips ---------- */
.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  font-size: 15px; font-weight: 600; color: #fff;
  background: linear-gradient(135deg, #5e6ad2, var(--navy));
}
.avatar.sub { background: linear-gradient(135deg, #f5a65b, var(--accent)); }
.avatar.off { background: #a1a1a6; }
.avatar-lg { width: 72px; height: 72px; font-size: 26px; }

.chip {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--fill); color: var(--text-2);
}
.chip-navy { background: var(--navy-soft); color: var(--navy); }
.chip-accent { background: var(--accent-soft); color: var(--accent-text); }
.chip-red { background: var(--red-soft); color: var(--red); }
.chip-green { background: var(--green-soft); color: var(--green); }

/* ---------- Search ---------- */
.search {
  display: flex; align-items: center; gap: 8px;
  background: var(--fill); border-radius: 10px; padding: 0 12px; height: 38px; min-width: 240px;
}
.search .icon { color: var(--text-3); width: 17px; height: 17px; }
.search input { border: 0; background: none; font: inherit; font-size: 16px; color: var(--text); width: 100%; outline: none; }

/* ---------- Forms ---------- */
.form-group { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 4px 18px; }
.field { padding: 14px 0; position: relative; }
.field + .field { border-top: 1px solid var(--hairline); }
.field label { display: block; font-size: 13px; font-weight: 500; color: var(--text-2); margin-bottom: 6px; }
.field input[type=text], .field input[type=email], .field input[type=password],
.field input[type=number], .field select {
  width: 100%; height: 44px; padding: 0 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 17px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  -webkit-appearance: none; appearance: none;
}
.field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2386868b' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: left 14px center; padding-inline-end: 36px;
}
/* A select with nothing chosen shows its options in light grey, as a hint. */
.field select:has(option[value=""]:checked) { color: var(--text-3); }
.field select option { color: var(--text); }
.field select option[value=""] { color: var(--text-3); }
.field input:focus, .field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.field.has-error input, .field.has-error select { border-color: var(--red); }
/* The work instruction on screen follows the printed sheet: two columns, right to left, row by row. */
.nav-badge { margin-inline-start: auto; padding: 1px 8px; font-size: 12px; }
.sheet-grid { display: grid; grid-template-columns: 1fr 1fr; column-gap: 24px; }
.sheet-grid.three { grid-template-columns: repeat(3, 1fr); }
.sheet-grid > .field + .field { border-top: 0; }
.sheet-grid > .field { border-top: 1px solid var(--hairline); }
.sheet-grid > .field:nth-child(-n+2) { border-top: 0; }
.sheet-grid.three > .field:nth-child(-n+3) { border-top: 0; }
/* A grid of six columns for rows of different widths (the work description block): span6 full row, span3 half, span2 third. */
.sheet-grid.six { grid-template-columns: repeat(6, 1fr); }
.sheet-grid.six > .cell { border-top: 1px solid var(--hairline); }
.sheet-grid.six > .cell:first-child { border-top: 0; }
.sheet-grid.six > .span6 { grid-column: span 6; }
.sheet-grid.six > .span3 { grid-column: span 3; }
.sheet-grid.six > .span4 { grid-column: span 4; }
.sheet-grid.six > .span2 { grid-column: span 2; }
.sheet-grid.six > .span1 { grid-column: span 1; }
.sheet-grid.six > .nb { border-top: 0; }
.sheet-grid.six .group > .angle-title { font-size: 17px; padding-bottom: 0; }
.sheet-grid.six .group > .span2 { grid-column: span 2; }
.sheet-grid.six > .group { display: contents; }
.sheet-grid.six > .group[hidden] { display: none; }
.sheet-grid[hidden], .section-title[hidden] { display: none; }
.sheet-grid.six .group > .cell { border-top: 1px solid var(--hairline); }
.sheet-grid.six .group > .nb { border-top: 1px solid var(--hairline); }
.sheet-grid.six .group > .span4 + .nb { border-top: 1px solid var(--hairline); }
.sheet-grid.six .group > .span2 { grid-column: span 2; }
.sheet-grid.six .group > .span3 { grid-column: span 3; }
.sheet-grid.six .group > .span6 { grid-column: span 6; }
.sheet-grid.six .group > .span1 { grid-column: span 1; }
.sheet-grid.six .group > .span4 { grid-column: span 4; }
@media (max-width: 700px) { .sheet-grid.six > .cell { grid-column: span 6 !important; } .sheet-grid.six > .cell:nth-child(n+2) { border-top: 1px solid var(--hairline); } }
/* What is taken from the job is shown in light grey: it is not typed here. */
.pulled-value {
  min-height: 44px; display: flex; align-items: center; padding: 0 14px; border-radius: var(--radius-sm);
  background: var(--fill); color: var(--text-3); font-size: 17px;
}
.field-value { min-height: 44px; display: flex; align-items: center; font-size: 17px; color: var(--text); }
@media (max-width: 700px) {
  .sheet-grid, .sheet-grid.three { grid-template-columns: 1fr; }
  .sheet-grid > .field:nth-child(n+2), .sheet-grid.three > .field:nth-child(n+2) { border-top: 1px solid var(--hairline); }
}
/* The film lines (type, size, quantity) of an RT job: one line per row. */
.film-row { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 8px; position: relative; }
.film-row[hidden] { display: none; }
.field .film-row select { width: 110px; flex: none; }
.field .film-row input[type=text] { width: auto; flex: 1; min-width: 100px; }
.field .film-row input[type=number] { width: 110px; flex: none; }
.film-del { display: none; }
.film-remove { border: 0; background: var(--fill); color: var(--text-2); width: 44px; height: 44px; flex: none; border-radius: var(--radius-sm); font-size: 20px; cursor: pointer; }
.film-row .suggest { top: 48px; }
#film-add { margin-top: 4px; }
/* A date box and a time box side by side (the start and end on site). */
.split-row { display: grid; grid-template-columns: 3fr 2fr; gap: 8px; }
.field .split-row input.split-part[dir] { width: 100%; min-width: 0; text-align: center; }
/* A line of the MT / PT field form: a small card of fields (a phone shows two to a row). */
.ff-row { margin-bottom: 10px; background: var(--fill); border-radius: var(--radius-sm); }
.ff-sum { display: flex; align-items: center; gap: 10px; padding: 14px 12px; cursor: pointer; list-style: none; font-weight: 600; }
.ff-sum::-webkit-details-marker { display: none; }
.ff-row.ff-accepted { background: var(--green-soft); }
.ff-row.ff-accepted .ff-sum-title { color: var(--green); }
.ff-row.ff-rejected { background: var(--red-soft); }
.ff-row.ff-after { margin-inline-start: 22px; border-inline-start: 4px solid var(--accent); }
.ff-more-chip { flex: none; background: var(--red-soft); color: var(--red); }
/* A second indication is only the indication fields under the item's line: no header of its own, the item's cells are the first line's. */
.ff-row.ff-more > .ff-sum { display: none; }
.ff-row.ff-more .ff-body { padding-top: 12px; }
.ff-row.ff-more .ff-body > :is(input[name$="-item"], input[name$="-weld_number"], input[name$="-size"], select[name$="-result"], input[name$="-remark"], .ff-note) { display: none; }
.ff-more-add { display: none; }
.ff-row.ff-rejected[data-saved][data-last] .ff-more-add { display: inline-flex; }
/* The extra indications are part of the item's card: no gap, a thin divider, and one compact line (type, size, location, remove). */
.ff-row:has(+ .ff-more:not(.ff-collapsed)) { margin-bottom: 0; border-end-start-radius: 0; border-end-end-radius: 0; }
.ff-row.ff-more { margin-bottom: 0; border-start-start-radius: 0; border-start-end-radius: 0; border-top: 1px solid color-mix(in srgb, var(--red) 22%, transparent); }
.ff-row.ff-more[data-last] { margin-bottom: 10px; }
.ff-row.ff-more .ff-body { grid-template-columns: 2fr 1fr 1.4fr auto; align-items: center; padding: 10px 12px; }
.ff-row.ff-more .film-remove { grid-column: auto; order: 1; width: 36px; height: 36px; }
.ff-row.ff-more .ff-photos { order: 2; }
.ff-photo-hint { display: none; }
@media (max-width: 700px) {
  .ff-row.ff-more .ff-body { grid-template-columns: 1fr 1fr auto; }
  .ff-row.ff-more .ff-cell { grid-column: 1 / -1; }
  .ff-row.ff-more .film-remove { grid-column: auto; }
}
/* Photos are added at the end of the item (after its last indication); photos already taken stay visible where they are. */
.ff-row:not([data-last]) .ff-photo-add, .ff-row:not([data-last]) .ff-photo-hint { display: none; }
.ff-row:not([data-last]) .ff-photos:not(:has(.photo-card)) { display: none; }
.ff-after-chip { background: var(--accent-soft); color: var(--accent-text); flex: none; }
.ff-fixed-chip { flex: none; }
.ff-repair { display: none; flex: none; height: 36px; padding: 0 14px; border: 0; border-radius: 999px; background: var(--accent-soft); color: var(--accent-text); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.ff-row.ff-rejected[data-saved]:not([data-fixed]) .ff-repair { display: inline-flex; align-items: center; }
.ff-row.ff-rejected .ff-sum-title { color: var(--red); }
.ff-sum-remark { color: var(--red); font-weight: 500; font-size: 14px; max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ff-sum-remark:empty { display: none; }
.ff-body input[name$="-remark"] { color: var(--red); }
.ff-body input[name$="-remark"]::placeholder { color: var(--text-3); }
.ff-num { flex: none; min-width: 28px; padding: 2px 8px; border-radius: 999px; background: var(--fill); color: var(--text-2); font-size: 13px; font-weight: 600; text-align: center; }
.ff-num:empty { display: none; }
.ff-sum-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ff-sum .icon { width: 16px; height: 16px; color: var(--text-3); flex: none; transition: transform .15s; }
.ff-row[open] > .ff-sum .icon { transform: rotate(90deg); }
.ff-body { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 0 12px 12px; }
.ff-row[hidden], .ff-row.ff-filtered, .ff-row.ff-collapsed { display: none; }
.ff-tools { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.ff-search { flex: 1; min-width: 0; height: 44px; padding: 0 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); font: inherit; font-size: 16px; color: var(--text); }
.ff-progress { color: var(--text-2); font-size: 14px; white-space: nowrap; }
.ff-note { grid-column: 1 / -1; color: var(--accent-text); background: var(--accent-soft); border-radius: 8px; padding: 8px 10px; font-size: 14px; }
.ff-quick { flex: none; width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--green-soft); color: var(--green); font-size: 18px; font-weight: 700; cursor: pointer; }
.ff-body input[name$="-remark"] { grid-column: 1 / -1; }
.ff-quick.ff-quick-reject { background: var(--red-soft); color: var(--red); }
.ff-cell { position: relative; min-width: 0; }
.ff-cell .suggest { top: calc(100% + 4px); min-width: 240px; }
.ff-row .film-remove { grid-column: 4; justify-self: end; background: var(--fill-strong); }
.section-link { font-size: 13px; margin-inline-start: 8px; }
@media (max-width: 700px) {
  .ff-body { grid-template-columns: 1fr 1fr; }
  .ff-row .film-remove { grid-column: 2; }
}
/* A box that holds several chips and takes typing in the same place (base materials). */
.tagbox {
  position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 44px; padding: 6px 36px 6px 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); cursor: text;
}
.tagbox:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.tag-chips { display: contents; }
.tag-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 15px; }
.tag-x { border: 0; background: rgba(255, 255, 255, 0.3); color: #fff; width: 20px; height: 20px; border-radius: 50%; line-height: 1; cursor: pointer; padding: 0; font-size: 14px; }
.field .tagbox .tag-input { flex: 1; min-width: 120px; height: 30px; border: 0; padding: 0 4px; box-shadow: none; background: none; font-size: 17px; }
.field .tagbox .tag-input:focus { box-shadow: none; outline: none; }
.tag-arrow { position: absolute; inset-inline-start: 14px; top: 50%; width: 12px; height: 8px; margin-top: -4px; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2386868b' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center; }
.field input.combo {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2386868b' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: left 14px center; padding-inline-end: 36px;
}
.suggest {
  position: absolute; inset-inline: 0; top: calc(100% - 14px); z-index: 20; margin: 0; padding: 4px; list-style: none;
  max-height: 260px; overflow-y: auto; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: 0 8px 28px rgba(0, 0, 0, 0.14);
}
.suggest li { padding: 10px 12px; border-radius: 8px; cursor: pointer; font-size: 16px; }
.suggest li:hover, .suggest li.active { background: var(--accent-soft); color: var(--accent-text); }
.help { color: var(--text-3); font-size: 13px; margin-top: 6px; }
.errors { color: var(--red); font-size: 13px; margin: 6px 0 0; padding: 0; list-style: none; }
.alert { border-radius: var(--radius-sm); padding: 12px 16px; margin-bottom: 20px; font-size: 15px; }
.alert-error { background: var(--red-soft); color: var(--red); }
.alert-success { background: var(--green-soft); color: var(--green); font-weight: 600; }

/* switch (for yes/no fields) */
.field.switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.field.switch label { font-size: 17px; font-weight: 400; color: var(--text); margin: 0; }
.field.switch .help { margin-top: 2px; }
.field.switch input[type=checkbox] {
  -webkit-appearance: none; appearance: none; flex: none;
  width: 51px; height: 31px; border-radius: 999px; margin: 0;
  background: var(--fill-strong); position: relative; cursor: pointer;
  transition: background-color 0.2s ease;
}
.field.switch input[type=checkbox]::after {
  content: ""; position: absolute; top: 2px; inset-inline-start: 2px;
  width: 27px; height: 27px; border-radius: 50%; background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  transition: inset-inline-start 0.2s ease;
}
.field.switch input[type=checkbox]:checked { background: var(--green); }
.field.switch input[type=checkbox]:checked::after { inset-inline-start: 22px; }

.form-actions { display: flex; gap: 10px; margin-top: 24px; }

/* ---------- Messages ---------- */
.messages { list-style: none; margin: 0 0 24px; padding: 0; }
.messages li {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: var(--radius-sm);
  background: var(--green-soft); color: var(--green); font-size: 15px; font-weight: 500;
}
.messages li.error { background: var(--red-soft); color: var(--red); }
.messages li + li { margin-top: 8px; }

/* ---------- Profile header ---------- */
.profile { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-bottom: 28px; }
.profile-main { flex: 1; min-width: 200px; }
.profile-main .title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.back { display: inline-flex; align-items: center; gap: 4px; font-size: 15px; margin-bottom: 18px; }
.back .icon { width: 16px; height: 16px; }

/* ---------- History timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 6px 18px; }
.timeline li { position: relative; padding: 14px 0 14px; padding-inline-start: 26px; }
.timeline li + li { border-top: 1px solid var(--hairline); }
.timeline li::before {
  content: ""; position: absolute; inset-inline-start: 2px; top: 21px;
  width: 9px; height: 9px; border-radius: 50%; background: var(--text-3);
}
.timeline li.created::before { background: var(--green); }
.timeline li.changed::before { background: var(--accent); }
.timeline .when { font-size: 13px; color: var(--text-3); }
.timeline .changes { margin: 6px 0 0; padding: 0; list-style: none; font-size: 15px; }
.timeline .changes li { padding: 2px 0; border: 0; }
.timeline .changes li::before { display: none; }
.old { color: var(--text-3); text-decoration: line-through; }
.arrow { color: var(--text-3); margin: 0 4px; }

/* ---------- Login ---------- */
.login-page {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1200px 600px at 50% -10%, var(--accent-soft), transparent 60%), var(--bg);
}
.login { width: 100%; max-width: 380px; text-align: center; }
.login .logo { width: 72px; height: 72px; margin-bottom: 18px; }
.login .title { font-size: 28px; }
.login .subtitle { margin-bottom: 28px; }
.remember { display: flex; align-items: center; gap: 8px; margin: 12px 2px; font-size: 15px; color: var(--text-2); cursor: pointer; }
.remember input { width: 18px; height: 18px; accent-color: var(--accent); }
.login-fields { background: var(--surface); border-radius: var(--radius-sm); box-shadow: var(--shadow); border: 1px solid var(--hairline); overflow: hidden; text-align: start; margin-bottom: 18px; }
.login-fields input {
  display: block; width: 100%; height: 54px; padding: 0 16px;
  border: 0; background: transparent; color: var(--text); font: inherit; font-size: 17px; outline: none;
}
.login-fields input + input { border-top: 1px solid var(--hairline); }
.login-fields input:focus { background: var(--surface-2); }
.login-foot { margin-top: 28px; font-size: 12px; color: var(--text-3); }

/* ---------- Tablets: a narrower sidebar ---------- */
@media (max-width: 1000px) {
  .app { grid-template-columns: 220px minmax(0, 1fr); }
  .page { padding: 32px 24px 96px; }
}

/* ---------- Phones: no sidebar; a top bar and a bottom tab bar ---------- */
@media (max-width: 700px) {
  .app { display: block; }
  .sidebar { display: none; }
  .topbar {
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 10;
    height: 52px; padding: 0 16px;
    background: var(--bar);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--hairline);
  }
  .topbar .brand img { width: 28px; height: 28px; }
  .topbar .brand-sub { display: none; }
  .topbar .menu summary { padding: 4px; border-radius: 999px; }
  .topbar .menu .who { display: none; }
  .topbar .menu-panel { inset-inline: auto 0; bottom: auto; top: calc(100% + 8px); }
  .page { padding: 24px 16px 110px; }
  .title { font-size: 30px; }
  .search { min-width: 0; width: 100%; }
  .page-head { align-items: stretch; }
  .page-head .actions { width: 100%; flex-wrap: nowrap; }
  .page-head .actions .search { flex: 1; }
  .tabbar {
    display: flex; position: fixed; bottom: 0; inset-inline: 0; z-index: 10;
    background: var(--bar);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-top: 1px solid var(--hairline);
    padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    font-size: 11px; font-weight: 500; color: var(--text-3);
  }
  .tabbar a:hover { text-decoration: none; }
  .tabbar a.active { color: var(--accent); }
  .tabbar .icon { width: 24px; height: 24px; }
  .stats { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .stat { padding: 14px; }
  .stat-value { font-size: 24px; }
  .stat-label { font-size: 12px; }
  .kv { flex-wrap: wrap; }
}

/* ---------- Step 2: equipment, checks, standards ---------- */
.field input[type=date], .field input[type=time], .field textarea {
  width: 100%; padding: 0 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 17px;
  -webkit-appearance: none; appearance: none;
}
.field input[type=date], .field input[type=time] { height: 44px; text-align: start; }
/* A time is typed hours first, left to right (in a right-to-left page the browser would put the minutes first). */
.field input[type=time][dir=ltr], .field input[type=datetime-local][dir=ltr] { text-align: right; }
.field textarea { padding: 10px 14px; resize: vertical; }
.field input[type=file] { font: inherit; font-size: 15px; color: var(--text-2); }
.field input[type=date]:focus, .field input[type=time]:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.field input[dir=ltr] { text-align: start; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; margin: -8px 0 4px; }
.filters select {
  height: 38px; padding: 0 14px; border: 0; border-radius: 10px;
  background: var(--fill); color: var(--text); font: inherit; font-size: 15px;
}

.section-bar { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.section-bar .btn { margin-bottom: 4px; }

.multi { position: relative; }
.multi summary {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; padding: 8px 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
  font-size: 17px; cursor: pointer; list-style: none;
}
.multi summary::-webkit-details-marker { display: none; }
.multi[open] summary { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.multi-text.placeholder { color: var(--text-3); }
.multi-arrow { width: 16px; height: 16px; flex: none; color: var(--text-3); }
.multi-list {
  position: absolute; inset-inline: 0; top: calc(100% + 6px); z-index: 20; padding: 4px; max-height: 280px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: 0 8px 28px rgba(0, 0, 0, 0.14);
}
.field .multi-option { display: flex; align-items: center; gap: 12px; margin: 0; padding: 10px 12px; border-radius: 8px; cursor: pointer; font-size: 16px; color: var(--text); }
.multi-option:hover { background: var(--accent-soft); }
.multi-option input { width: 20px; height: 20px; flex: none; margin: 0; accent-color: var(--accent); }
.choice-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.choice { display: inline-flex; margin: 0; cursor: pointer; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span {
  padding: 6px 14px; border-radius: 999px; background: var(--fill);
  color: var(--text); font-size: 15px; font-weight: 500; user-select: none;
}
.choice input:checked + span { background: var(--accent); color: #fff; }
.choice input:focus-visible + span { outline: 3px solid var(--accent-soft); outline-offset: 2px; }
.field .choice { display: inline-flex; font-size: 15px; color: var(--text); margin: 0; }

.chip-grey { background: var(--fill); color: var(--text-2); }
.review-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--text); margin-bottom: 8px; }
.review-card:hover { text-decoration: none; background: var(--surface-2); }

/* reminder rows on the home screen */
.reminder { display: flex; align-items: center; gap: 12px; padding: 11px 0; color: var(--text); }
.reminder + .reminder { border-top: 1px solid var(--hairline); }
.reminder:hover { text-decoration: none; }
.reminder .list-main { min-width: 0; }
.reminder-kind { font-size: 12px; color: var(--text-3); }
.reminder-days { font-size: 13px; color: var(--text-2); white-space: nowrap; }
.reminder-days.red { color: var(--red); font-weight: 600; }
.card-wide { grid-column: 1 / -1; }
.more { border-top: 1px solid var(--hairline); }
.more summary { cursor: pointer; padding: 12px 0; color: var(--accent-text); font-size: 15px; font-weight: 500; list-style: none; }
.more summary::-webkit-details-marker { display: none; }
.section-bar { align-items: center; }
@media (max-width: 700px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.reminder-group { border-top: 1px solid var(--hairline); }
.reminder-group:first-of-type { border-top: 0; }
.reminder-group summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; gap: 12px; padding: 14px 0;
}
.reminder-group summary::-webkit-details-marker { display: none; }
.reminder-group summary .chevron { transition: transform 0.2s ease; }
.reminder-group[open] summary .chevron { transform: rotate(-90deg); }
.group-title { display: block; font-size: 17px; font-weight: 600; }
.group-counts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.group-rows { padding: 0 0 8px; padding-inline-start: 14px; border-inline-start: 2px solid var(--hairline); margin-bottom: 8px; }
.reminder-note { display: block; font-size: 13px; color: var(--text-3); margin-top: 2px; }
.reminder { align-items: flex-start; }
.reminder-problem { display: block; font-size: 14px; color: var(--text); margin-top: 2px; }
.reminder-problem.red { color: var(--red); }
.reminder-action { display: block; font-size: 13px; color: var(--text-2); margin-top: 2px; }
.reminder-days { padding-top: 2px; }

/* equipment grouped by method */
.method-groups { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 0 18px; margin-top: 8px; }
.method-group + .method-group { border-top: 1px solid var(--hairline); }
.method-group summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px; padding: 16px 0; }
.method-group summary::-webkit-details-marker { display: none; }
.method-group summary .chevron { transition: transform 0.2s ease; }
.method-group[open] summary .chevron { transform: rotate(-90deg); }
.method-group .list.inner { box-shadow: none; border-radius: 0; background: none; margin: 0 -18px; border-top: 1px solid var(--hairline); }
.sub-head { font-size: 12px; font-weight: 600; color: var(--text-3); padding: 12px 18px 4px; background: var(--surface-2); }
@media (max-width: 700px) { .method-group summary { flex-wrap: wrap; } .group-counts { width: 100%; justify-content: flex-start; order: 3; } }

.sub-group { border-top: 1px solid var(--hairline); }
.sub-group summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px; padding: 12px 0 12px 0; padding-inline-start: 14px; background: var(--surface-2); margin: 0 -18px; padding-inline-end: 18px; padding-inline-start: 32px; }
.sub-group summary::-webkit-details-marker { display: none; }
.sub-group summary .chevron { transition: transform 0.2s ease; }
.sub-group[open] summary .chevron { transform: rotate(-90deg); }
.sub-title { font-size: 15px; font-weight: 600; }
.sub-group .list.inner { border-top: 0; }

/* Search hides rows with the "hidden" attribute; rows that set their own display must not override it. */
[hidden] { display: none !important; }

/* An open folder must look open: tinted header, orange title, and a recessed panel for what is inside. */
.method-group[open] > summary, .reminder-group[open] > summary {
  background: var(--accent-soft);
  margin: 0 -18px; padding-inline: 18px;
  border-radius: 0;
}
.method-group[open] > summary .group-title, .reminder-group[open] > summary .group-title { color: var(--accent-text); }
.method-group[open] > summary .chevron, .reminder-group[open] > summary .chevron { color: var(--accent-text); }
.method-group[open] { background: var(--surface-2); margin: 0 -18px; padding: 0 18px 4px; }
.method-group[open] .list.inner { background: var(--surface); border-radius: var(--radius-sm); margin: 8px 0 6px; border: 1px solid var(--hairline); }
.method-group[open] .sub-group summary { margin: 0; padding-inline: 18px; }
.sub-group[open] > summary { background: var(--navy-soft); }
.sub-group[open] > summary .sub-title, .sub-group[open] > summary .chevron { color: var(--navy); }
.method-group .sub-group { border-top: 0; margin-top: 8px; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); border: 1px solid var(--hairline); }
.method-group .sub-group .list.inner { margin: 0; border: 0; border-radius: 0; }
.method-group .sub-group summary { background: var(--surface); }
.reminder-group[open] { background: var(--surface-2); margin: 0 -22px; padding: 0 22px 8px; }
.reminder-group[open] > summary { margin: 0 -22px; padding-inline: 22px; }
.reminder-group[open] .group-rows { background: var(--surface); border-radius: var(--radius-sm); border: 1px solid var(--hairline); padding: 4px 16px; margin: 8px 0 0; }

.row-link { color: var(--text); }
.row-link:hover { text-decoration: none; }
a.chip:hover { text-decoration: none; filter: brightness(0.95); }
/* A section title with a button beside it: both on one line. */
.section-bar { margin: 28px 0 8px; align-items: center; }
.section-bar .section-title { margin: 0 16px; }
.section-bar .btn { margin: 0; min-height: 32px; padding: 6px 14px; font-size: 14px; }

/* Equipment dashboard tiles: only what needs action. */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.tile {
  display: flex; flex-direction: column; gap: 2px;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 20px; color: var(--text); border: 2px solid transparent;
  transition: border-color 0.15s ease;
}
.tile:hover { text-decoration: none; border-color: var(--fill-strong); }
.tile.active { border-color: currentColor; }
.tile-value { font-size: 30px; font-weight: 700; line-height: 1.1; }
.tile-label { font-size: 15px; font-weight: 600; }
.tile-hint { font-size: 13px; color: var(--text-2); }
.tile-red .tile-value { color: var(--red); }
.tile-red.active { border-color: var(--red); }
.tile-accent .tile-value { color: var(--accent-text); }
.tile-accent.active { border-color: var(--accent); }
.tile-grey .tile-value { color: var(--text-2); }
.tile-grey.active { border-color: var(--text-3); }
.tile.zero .tile-value { color: var(--text-3); }
.section-bar .filters { margin: 0; }
@media (max-width: 700px) {
  .tiles { grid-template-columns: 1fr; gap: 10px; }
  .tile { flex-direction: row; flex-wrap: wrap; align-items: baseline; column-gap: 10px; padding: 14px 16px; }
  .tile-value { font-size: 24px; }
  .tile-hint { width: 100%; }
  .section-bar { flex-wrap: wrap; }
}

.search { min-width: 300px; }
.search input::placeholder { color: var(--text-3); }
@media (max-width: 700px) { .search { min-width: 0; } }

/* the urgent flag: quiet when off, unmistakable when on */
.urgent-btn {
  -webkit-appearance: none; appearance: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  min-width: 32px; height: 32px; padding: 0; border: 0; border-radius: 999px; cursor: pointer;
  background: transparent; color: var(--text-3); font: inherit; font-size: 13px; font-weight: 600;
  opacity: 0.55; transition: opacity 0.15s ease, background-color 0.15s ease;
}
.urgent-btn .icon { width: 17px; height: 17px; }
.urgent-btn span { display: none; }
.list-row:hover .urgent-btn, .urgent-btn:focus-visible { opacity: 1; background: var(--fill); color: var(--text-2); }
.urgent-btn.on { opacity: 1; padding: 0 12px; background: var(--red); color: #fff; }
.urgent-btn.on span { display: inline; }
.urgent-btn.on .icon { fill: currentColor; }
.urgent-btn.on:hover { background: var(--red); color: #fff; filter: brightness(0.92); }
.list-row.is-urgent { background: var(--red-soft); }
@media (hover: none) { .urgent-btn { opacity: 0.8; } }
.tiles { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
@media (max-width: 700px) { .tiles { grid-template-columns: 1fr; } }

.reminder-who { display: block; font-size: 12px; color: var(--text-3); margin-top: 2px; }
.card-head .segmented { margin-inline-start: auto; }
.segmented { display: inline-flex; background: var(--fill); border-radius: 999px; padding: 3px; }
.segmented a { padding: 5px 14px; border-radius: 999px; font-size: 14px; font-weight: 500; color: var(--text-2); }
.segmented a:hover { text-decoration: none; color: var(--text); }
.segmented a span { font-size: 12px; opacity: 0.7; margin-inline-start: 2px; }
.segmented a.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,0.12); }

/* English text inside a Hebrew (right to left) row: keep it on the same side as the Hebrew around it. */
.ltr-start { display: inline-block; text-align: start; unicode-bidi: isolate; }

/* the export menu on list pages */
.export-menu summary.btn { padding: 8px 18px; color: var(--text); }
.export-menu summary.btn:hover { background: var(--fill-strong); }
.export-menu[open] summary.btn { background: var(--fill-strong); }
.export-menu .menu-panel { bottom: auto; top: calc(100% + 8px); inset-inline: auto 0; min-width: 260px; }
.export-menu .menu-panel a span { display: flex; flex-direction: column; line-height: 1.3; }
.export-menu .menu-panel small { font-size: 12px; color: var(--text-3); }
@media (max-width: 700px) {
  .page-head .actions { position: relative; }
  .export-menu { position: static; }
  .export-menu .menu-panel { inset-inline: 0; min-width: 0; }
}

/* The change history of a record: closed until opened. */
.history-fold { margin-top: 28px; }
.history-fold summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; }
.history-fold summary::-webkit-details-marker { display: none; }
.history-fold summary .section-title { margin: 0 16px; }
.history-fold summary .chevron { transition: transform 0.2s ease; color: var(--text-3); }
.history-fold[open] summary .chevron { transform: rotate(-90deg); }
.history-fold .list { margin-top: 10px; }
/* The note that lines are saved in the background (the field screen). */
.autosave-status { position: fixed; inset-inline-start: 16px; bottom: 84px; z-index: 30; padding: 8px 14px; border-radius: 999px; font-size: 14px; background: var(--surface); color: var(--text-2); box-shadow: var(--shadow); border: 1px solid var(--hairline); }
.autosave-status[hidden] { display: none; }
.autosave-status.ok { color: var(--green); }
.autosave-status.warn { color: var(--accent-text); background: var(--accent-soft); }
.autosave-status.bad { color: var(--red); background: var(--red-soft); }
.ff-row.ff-bad { outline: 2px solid var(--red-soft); }

/* The photos of a job: a grid of small pictures with a caption; in the field screen a caption box and a remove button too. */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 12px; }
.photo-grid:empty { display: none; }
.photo-card { position: relative; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.photo-card img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius-sm); background: var(--fill); display: block; }
.photo-card figcaption { font-size: 13px; color: var(--text-2); }
.photo-card .photo-caption { width: 100%; height: 38px; padding: 0 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); font: inherit; font-size: 14px; color: var(--text); }
.photo-label { font-size: 12px; color: var(--text-2); font-weight: 600; }
.ff-photos { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.ff-photo-list { display: contents; }
.ff-photos .photo-card.compact { width: 76px; }
.ff-photos .photo-card.compact img { aspect-ratio: 1; }
.ff-photos .photo-card.compact .photo-remove { width: 24px; height: 24px; font-size: 16px; top: 3px; inset-inline-start: 3px; }
.ff-photos[data-line-id=""] .ff-photo-add { opacity: .55; }
.ff-photo-hint { margin: 0; }
.photo-remove { position: absolute; top: 6px; inset-inline-start: 6px; width: 32px; height: 32px; border: 0; border-radius: 50%; background: rgba(0, 0, 0, 0.55); color: #fff; font-size: 20px; line-height: 1; cursor: pointer; }

/* The report screen: a box that still holds Hebrew (the report is in English) is red, and so is its label. */
input.has-hebrew, textarea.has-hebrew, .tagbox.has-hebrew { border: 2px solid var(--red); background: var(--red-soft); }
.field:has(.has-hebrew) > label { color: var(--red); font-weight: 600; }
#hebrew-alert a { color: inherit; text-decoration: underline; }
/* The price lines of a quote: a kind, the description, the detail and the price in one row; a heading line has only its description. */
.quote-line { display: grid; grid-template-columns: 130px 1fr 130px auto; gap: 8px; align-items: start; margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--hairline); position: relative; }
.quote-line[hidden] { display: none; }
.quote-line > span { min-width: 0; }
.quote-line .ql-kind { grid-column: 1; }
.quote-line .ql-desc { grid-column: 2 / -1; }
.quote-line .ql-detail { grid-column: 1 / 3; }
.quote-line .ql-price { grid-column: 3; }
.quote-line .ql-tools { grid-column: 4; display: flex; gap: 4px; }
.quote-line .ql-tools .film-remove { width: 36px; height: 44px; font-size: 16px; }
.quote-line[data-kind="heading"] .ql-detail, .quote-line[data-kind="heading"] .ql-price { visibility: hidden; }
.quote-line[data-kind="heading"] .ql-desc input { font-weight: 600; }
.quote-line .errors { grid-column: 1 / -1; }
@media (max-width: 700px) {
  .quote-line { grid-template-columns: 1fr 100px; }
  .quote-line .ql-kind, .quote-line .ql-desc, .quote-line .ql-detail { grid-column: 1 / -1; }
  .quote-line .ql-price { grid-column: 1; }
  .quote-line .ql-tools { grid-column: 2; justify-content: flex-end; }
}
/* The picker of the library of services on the quote screen, and the hint under a line with a suggested price. */
.line-buttons { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; }
.service-panel { width: min(560px, 92vw); max-height: 60vh; overflow-y: auto; padding: 6px; }
.service-category { margin: 10px 0 4px; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--fill-strong); color: var(--text); font-size: 14px; font-weight: 700; letter-spacing: .2px; }
.service-category:first-child { margin-top: 0; }
.service-item { display: block; width: 100%; text-align: start; background: none; border: 0; border-bottom: 1px solid var(--hairline); border-radius: 0; padding: 9px 12px; padding-inline-start: 24px; cursor: pointer; font: inherit; color: var(--text); }
.service-item small { display: block; color: var(--text-3); font-size: 13px; }
.service-item:hover { background: var(--fill); }
.quote-line .ql-hint { grid-column: 1 / -1; font-size: 13px; color: var(--text-3); }
/* The notes of a quote: one row each, with the arrows and the remove button. */
.term-row { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 8px; }
.term-row input { flex: 1; min-width: 0; }
.term-tools { display: flex; gap: 4px; flex: none; }
.term-tools .film-remove { width: 36px; height: 44px; font-size: 16px; }
#terms-ui[hidden], #terms-fallback[hidden] { display: none; }

/* The cost and price calculator */
.calc-scroll { overflow-x: auto; }
.calc-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.calc-table th { text-align: start; font-weight: 600; color: var(--text-2); font-size: 12.5px; padding: 8px 8px; border-bottom: 1px solid var(--hairline); }
.calc-table td { padding: 10px 8px; border-bottom: 1px solid var(--hairline); vertical-align: top; }
.calc-table tr:last-child td { border-bottom: 0; }
.calc-table .calc-label { min-width: 150px; }
.calc-table th:not(:first-child), .calc-table td:not(:first-child) { text-align: center; }
.calc-table td:not(:first-child) { vertical-align: middle; }
.calc-table td[dir="ltr"] { white-space: nowrap; }
.calc-table.calc-center th, .calc-table.calc-center td { text-align: center; }
.calc-note { display: block; font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.calc-neg { color: var(--red); }
.calc-pos { color: var(--green); }
.calc-sub { font-size: 15px; font-weight: 600; margin: 18px 0 6px; }
.kv-list { margin: 0; }
.calc-group .calc-row { display: grid; grid-template-columns: minmax(180px, 1.2fr) 140px 2fr; gap: 6px 14px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--hairline); }
.calc-group .calc-row:last-child { border-bottom: 0; }
.calc-group .calc-row .calc-note { margin: 0; }
.calc-group .calc-row .errors { grid-column: 1 / -1; }
.calc-input, .calc-edit input:not([type=checkbox]), .calc-edit select { width: 100%; min-width: 70px; }
.calc-edit td { padding: 6px; }
@media (max-width: 700px) { .calc-group .calc-row { grid-template-columns: 1fr 120px; } .calc-group .calc-row .calc-note { grid-column: 1 / -1; } }
.calc-try-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; align-items: start; }
.calc-try-item { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--text-2); }
.calc-try-item input, .calc-cell { width: 100%; min-width: 60px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; }
.calc-try-item.is-changed input, .calc-cell.is-changed { border-color: var(--accent); background: var(--accent-soft); }
.calc-scenario { margin-bottom: 14px; }
.calc-save { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 14px 0; }
.calc-try { margin-bottom: 16px; }
.calc-hint { font-size: 12px; color: var(--text-3); line-height: 1.4; }
.calc-try-item select, .calc-quote-line select, .calc-quote-pick select { width: 100%; padding: 8px 10px 8px 30px; border: 1px solid var(--border); border-radius: var(--radius-sm); background-color: var(--surface); color: var(--text); font: inherit; appearance: none; -webkit-appearance: none; text-overflow: ellipsis; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%238e8e93' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: left 10px center; }
.calc-job th:not(:first-child), .calc-job td:not(:first-child) { min-width: 170px; }
.calc-job .calc-label { min-width: 230px; }
.calc-job .chip { white-space: normal; display: inline-block; text-align: center; line-height: 1.5; border-radius: 12px; padding: 4px 10px; }
.calc-methods { display: flex; flex-direction: column; }
.calc-method { display: flex; align-items: center; gap: 12px; padding: 11px 6px; border-bottom: 1px solid var(--hairline); cursor: pointer; font-size: 15px; }
.calc-method:last-child { border-bottom: 0; }
.calc-method:hover { background: var(--fill); }
.calc-method.is-on { color: var(--accent-text); font-weight: 600; }
.calc-method input { accent-color: var(--accent); width: 18px; height: 18px; }
.calc-dd > summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; list-style: none; font-size: 15px; }
.calc-dd > summary::-webkit-details-marker { display: none; }
.calc-dd[open] > summary { border-color: var(--accent); }
.calc-dd .calc-methods { margin-top: 8px; border: 1px solid var(--hairline); border-radius: var(--radius-sm); padding: 4px 8px; background: var(--surface); }

.calc-sum { position: sticky; top: 8px; z-index: 20; display: flex; justify-content: space-around; gap: 16px; flex-wrap: wrap; padding: 10px 16px; margin-bottom: 16px; box-shadow: var(--shadow-md, 0 4px 16px rgba(0,0,0,.08)); }
.calc-sum > div { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.calc-sum-label { font-size: 12px; color: var(--text-3); }
.calc-sum strong { font-size: 17px; }

.cost-ok { color: var(--green); font-weight: 600; }
.cost-bad { color: var(--red); font-weight: 600; }

.print-preview { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--fill); color: var(--text-3); font-size: 14px; }
.print-preview-title { font-size: 12px; font-weight: 600; margin-bottom: 6px; }
.print-preview p { margin: 0 0 6px; }
.print-preview p:last-child { margin-bottom: 0; }
.calc-quote-lines { margin-top: 10px; }
.calc-quote-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 14px; margin: 6px 0; }
.calc-quote-line select { width: 190px; flex: none; }

.calc-quote-pick { display: flex; flex-direction: column; gap: 6px; max-width: 520px; }

/* An amount typed on a row of a list (the jobs of an invoice). */
.amount-box {
  width: 120px; height: 40px; padding: 0 12px; text-align: left;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font: inherit; font-size: 16px;
}
.amount-box:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }

/* The lines a job is billed for. */
.line-row label { display: block; }
.line-row input[type=text] {
  width: 100%; height: 40px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font: inherit; font-size: 16px;
}
.line-row input[type=text]:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.line-row input[name$="-quantity"], .line-row input[name$="-unit_price"] { text-align: left; }

/* The SUMIT documents of an invoice: a title, the day and who it was sent to, and the actions on the other side. */
.sumit-row { flex-wrap: wrap; gap: 10px 14px; }
.sumit-row .list-main { flex: 1 1 260px; min-width: 0; }
.sumit-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-start; }
.sumit-more { display: block; }
.sumit-more summary { cursor: pointer; color: var(--text-2); }
.sumit-card { overflow: visible; }                       /* the small menu of a draft opens over the next rows */
.sumit-card .menu { position: relative; }
.sumit-card .menu-panel { z-index: 20; }
.sumit-card .menu-panel { top: calc(100% + 6px); bottom: auto; inset-inline-start: auto; inset-inline-end: 0; min-width: 280px; }

/* A customer or a contact that is not in the register yet, typed on the quote screen. */
.new-box { border: 1px dashed var(--border); border-radius: var(--radius); padding: 10px 14px; margin: 4px 0 14px; }
.new-box[hidden] { display: none; }
.new-box > summary { cursor: pointer; font-weight: 600; }
.new-box[open] > summary { margin-bottom: 8px; }
