/* Old navy/cyan palette: public + client pages only (login, agreement sign,
   booking, review). Admin pages (<html class="admin">, partials/header.ejs)
   get their tokens from admin.css instead - see the last section. */
:root:not(.admin) {
  --bg: #0a0e14;
  --bg-elevated: #121821;
  --bg-elevated-2: #1a2230;
  --ink: #e7edf5;
  --muted: #8b98ab;
  --border: #242e3d;
  --border-soft: #1c2431;
  --accent: #22d3ee;
  --accent-strong: #67e8f9;
  --accent-ink: #04222a;
  --danger: #f87171;
  --danger-ink: #3a1414;
  --success: #4ade80;
  --success-ink: #0f2e1c;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  direction: rtl;
  text-align: start;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Arial Hebrew", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  background-image:
    radial-gradient(circle at 15% 0%, rgba(34, 211, 238, 0.08), transparent 40%),
    radial-gradient(circle at 85% 10%, rgba(103, 232, 249, 0.05), transparent 35%);
  background-attachment: fixed;
  line-height: 1.5;
}

a { color: inherit; }

.topbar {
  border-block-end: 1px solid var(--border);
  background: linear-gradient(180deg, var(--bg-elevated), var(--bg));
  box-shadow: 0 1px 0 rgba(34, 211, 238, 0.08);
}

.topbar-inner {
  max-width: 1100px;
  margin-inline: auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
}

.brand {
  justify-self: center;
}

.brand-logo {
  height: 76px;
  display: block;
  filter: drop-shadow(0 0 12px rgba(34, 211, 238, 0.3));
}

@media (max-width: 480px) {
  /* At phone widths the logo's natural aspect ratio (~3.36:1) leaves too
     little room in the side grid columns for the back-link/logout text,
     which then visually overlaps the logo instead of wrapping (nowrap). */
  .brand-logo { height: 40px; }
}

.topbar-side { display: flex; align-items: center; min-width: 0; }
.topbar-side-start { justify-content: flex-start; }
.topbar-side-end { justify-content: flex-end; }

.back-link,
.logout-link {
  text-decoration: none;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  cursor: pointer;
  transition: color 0.15s ease;
}

.back-link:hover,
.logout-link:hover { color: var(--accent-strong); }

.container {
  max-width: 1100px;
  margin-inline: auto;
  padding: 28px 24px 60px;
}

h1 { font-size: 24px; margin-block-end: 20px; color: var(--ink); }
h2 { font-size: 18px; margin-block-end: 12px; color: var(--ink); }

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-block-end: 20px;
}

.table-scroll {
  overflow-x: auto;
  margin-block-end: 20px;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-block-end: 0;
}

th, td {
  padding: 10px 12px;
  border-block-end: 1px solid var(--border-soft);
  text-align: start;
  font-size: 14px;
}

th {
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
  border-block-end: 1px solid var(--accent);
  border-block-end-color: rgba(34, 211, 238, 0.4);
}

tbody tr:hover { background: rgba(34, 211, 238, 0.04); }

.num, td.num, input[type="number"] {
  direction: ltr;
  text-align: end;
  unicode-bidi: isolate;
}

.card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin-block-end: 20px;
  background: var(--bg-elevated);
}

.review-drag-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  margin-block-end: 8px;
  transition: opacity .15s ease, border-color .15s ease;
}
.review-drag-item.is-dragging { opacity: 0.35; border-color: var(--accent-strong); }
.review-drag-handle {
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  letter-spacing: -2px;
  cursor: grab;
  user-select: none;
  padding: 10px 6px;
  margin: -10px -6px;
  /* Without this, a touch-drag on the handle gets intercepted by the
     browser as a page-scroll gesture before our pointer JS ever sees it —
     this one rule is what makes dragging work on a phone at all. */
  touch-action: none;
}
.review-drag-item.is-dragging .review-drag-handle { cursor: grabbing; }

label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-block-end: 4px;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="date"],
input[type="time"],
textarea,
select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  margin-block-end: 14px;
  background: var(--bg-elevated-2);
  color: var(--ink);
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.15);
}

input:disabled, select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

select.flash-required {
  animation: flash-required-anim 0.9s ease;
}

@keyframes flash-required-anim {
  0%, 100% { border-color: var(--border); box-shadow: none; }
  20%, 60% { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.2); }
}

textarea { min-height: 90px; resize: vertical; }

.field-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.field-row > div { flex: 1; min-width: 180px; }

.btn {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-elevated-2);
  color: var(--ink);
  cursor: pointer;
  font-size: 14px;
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}

.btn:hover {
  background: var(--bg-elevated);
  border-color: var(--accent);
  box-shadow: 0 0 14px rgba(34, 211, 238, 0.25);
  transform: translateY(-1px);
}

.btn:active {
  transform: scale(0.94);
  box-shadow: 0 0 6px rgba(34, 211, 238, 0.35);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
  font-weight: 600;
  box-shadow: 0 0 16px rgba(34, 211, 238, 0.25);
}

.btn-primary:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  box-shadow: 0 0 24px rgba(34, 211, 238, 0.55);
}

.btn-danger { color: var(--danger); border-color: rgba(248, 113, 113, 0.4); }
.btn-danger:hover { background: rgba(248, 113, 113, 0.08); border-color: var(--danger); }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-block-start: 16px; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: var(--bg-elevated-2);
  color: var(--muted);
  border: 1px solid var(--border);
}

.badge.status-sent { background: rgba(34, 211, 238, 0.12); color: var(--accent-strong); border-color: rgba(34, 211, 238, 0.3); }
.badge.status-accepted { background: rgba(74, 222, 128, 0.12); color: var(--success); border-color: rgba(74, 222, 128, 0.3); }
.badge.status-draft { background: var(--bg-elevated-2); color: var(--muted); }

.muted { color: var(--muted); font-size: 13px; }

code {
  font-family: var(--mono);
  background: var(--bg-elevated-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 0.9em;
}

.line-items-table input {
  margin-block-end: 0;
}

.line-items-table td { vertical-align: top; padding: 6px; }

.total-row {
  display: flex;
  justify-content: space-between;
  font-size: 18px;
  font-weight: 700;
  border-block-start: 2px solid var(--accent);
  padding-block-start: 12px;
  margin-block-start: 6px;
  color: var(--ink);
}

.remove-row-btn {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 16px;
}

.quote-preview-frame {
  width: 100%;
  height: 80vh;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: #fff;
}

.alert {
  padding: 10px 14px;
  border-radius: 6px;
  margin-block-end: 16px;
  font-size: 14px;
  border: 1px solid transparent;
}

.alert-success { background: rgba(74, 222, 128, 0.1); color: var(--success); border-color: rgba(74, 222, 128, 0.25); }
.alert-error { background: rgba(248, 113, 113, 0.1); color: var(--danger); border-color: rgba(248, 113, 113, 0.25); }

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 360px;
  text-align: center;
}

.login-logo {
  height: 90px;
  margin-block-end: 12px;
}

.main-menu {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  max-width: 480px;
  margin-inline: auto;
  margin-block-start: clamp(16px, 8vh, 72px);
}

.menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100px;
  padding: 20px 16px;
  border-radius: var(--r);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--ink);
  font-size: 18px;
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}

.menu-btn:hover {
  border-color: var(--accent);
  background: var(--bg-elevated-2);
}

.menu-btn-wide { grid-column: 1 / -1; }

.login-card h1 { font-size: 20px; }
.login-card form { text-align: start; margin-block-start: 16px; }
.login-card .btn-row { justify-content: center; }

.login-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  margin-block: 18px;
}

.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.login-google-btn {
  display: block;
  width: 100%;
  text-align: center;
}

/* Monitoring page */
.monitor-summary { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.monitor-summary .btn { margin-inline-start: auto; }
.monitor-summary.monitor-ok { border-color: rgba(108, 197, 138, 0.4); background: var(--ok-tint); }
.monitor-summary.monitor-warn { border-color: rgba(233, 185, 73, 0.45); background: var(--warn-tint); }
.monitor-summary.monitor-bad { border-color: rgba(240, 100, 106, 0.45); background: var(--danger-tint); }
.monitor-list { padding: 4px 20px; }
.monitor-row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; padding: 10px 0; border-block-end: 1px solid var(--border-soft); }
.monitor-row:last-child { border-block-end: 0; }
.monitor-name { font-weight: 600; min-width: 180px; }
.monitor-name a { color: inherit; }
.monitor-detail { color: var(--muted); font-size: 13px; }
.monitor-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; align-self: center; }
.monitor-dot.monitor-ok { background: var(--ok); }
.monitor-dot.monitor-warn { background: var(--warn); }
.monitor-dot.monitor-bad { background: var(--danger); }
.monitor-dot.monitor-off { background: none; box-shadow: inset 0 0 0 1.5px var(--muted); }

/* Hub menu */
.menu-btn { position: relative; flex-direction: column; gap: 4px; }
.menu-btn small { font-size: 12px; font-weight: 400; color: var(--muted); }
.menu-btn-soon { opacity: 0.45; cursor: default; }
.menu-btn-soon:hover { border-color: var(--border); background: var(--bg-elevated); }
.menu-badge {
  position: absolute;
  inset-block-start: 10px;
  inset-inline-end: 10px;
  min-width: 22px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 12px;
  font-weight: 700;
  line-height: 18px;
}
.menu-badge-alert { background: var(--danger); color: var(--danger-ink); }

/* Projects page */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: 16px; margin-block-end: 28px; }
.project-card { display: flex; flex-direction: column; gap: 8px; margin: 0; min-width: 0; overflow-wrap: anywhere; }
.project-card p { margin: 0; }
.project-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.project-head strong { font-size: 17px; }
.project-status { flex: none; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--border); font-size: 12px; font-weight: 600; }
.project-live { color: var(--ok); border-color: transparent; background: var(--ok-tint); }
.project-partial { color: var(--warn); border-color: transparent; background: var(--warn-tint); }
.project-local { color: var(--info); border-color: transparent; background: var(--info-tint); }
.project-paused { color: var(--muted); background: transparent; }
.project-open { margin: 0; padding-inline-start: 18px; font-size: 14px; }
.project-open li { margin-block: 2px; }
.project-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-block-start: auto; padding-block-start: 6px; }
.project-foot .muted { margin-inline-end: auto; }

/* Visitor stats page */
.stats-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.stats-head h1 { margin: 0; }
.stats-range { display: inline-flex; border: 1.5px solid var(--border); border-radius: var(--r-sm); overflow: hidden; }
.stats-range a { padding: 6px 14px; color: var(--soft); text-decoration: none; font-size: 14px; font-weight: 700; }
.stats-range a + a { border-inline-start: 1px solid var(--border); }
.stats-range a:hover { color: var(--ink); background: var(--bg-elevated-2); }
.stats-range a.active { color: var(--bg); background: var(--ink); }
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr)); gap: 16px; margin-block: 16px 24px; }
.stat-tile { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 14px 16px 12px; color: var(--ink); }
.stat-label { color: var(--muted); font-size: 13px; font-weight: 700; }
.stat-value { font-family: var(--display); font-size: var(--fs-stat); font-weight: 700; line-height: 1; padding-block: 4px 2px; white-space: nowrap; }
.stats-chart { position: relative; }
.stats-chart svg { display: block; width: 100%; height: auto; direction: ltr; }
.stats-chart .grid { stroke: var(--border-soft); stroke-width: 1; }
.stats-chart .axis { stroke: var(--border); stroke-width: 1; }
.stats-chart .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.stats-chart .bar { fill: var(--soft); }
.stats-chart .bar.bar-paid { fill: var(--ok); }
.stats-chart .hit { fill: transparent; cursor: pointer; }
.stats-chart .hit.on { fill: rgba(239, 232, 221, 0.06); }
.stats-tip { position: absolute; top: 8px; transform: translateX(-50%); padding: 6px 10px; border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--bg-elevated-2); color: var(--ink); font-size: 13px; white-space: nowrap; pointer-events: none; }
.stats-table { margin-block-start: 10px; font-size: 14px; }
.stats-table summary { cursor: pointer; color: var(--muted); }
.stats-table table { margin-block-start: 8px; }
.stats-lists { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 0 16px; margin-block-start: 24px; }
.rank-list { display: flex; flex-direction: column; gap: 10px; }
.rank-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; }
.rank-label { overflow-wrap: anywhere; }
.rank-value { font-variant-numeric: tabular-nums; font-weight: 600; }
.rank-track { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--bg-elevated-2); }
.rank-bar { display: block; height: 100%; min-width: 2px; border-radius: 3px; background: var(--soft); }
.rank-note { margin: 0; }
.stats-about { margin-block-start: 8px; }
.stats-about p { margin-block: 4px; }

/* Income page (/income) */
.income-switches { display: flex; gap: 10px; flex-wrap: wrap; margin-block-end: 4px; }
.stat-tile-link { text-decoration: none; transition: border-color 0.15s ease; }
.stat-tile-link:hover { border-color: var(--soft); }
.stat-tile-warn { border-color: rgba(233, 185, 73, 0.45); }
.stats-chart .bar-pending { fill: rgba(127, 178, 229, 0.3); }
.chart-legend { margin: 8px 0 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.sw-paid { background: var(--ok); }
.sw-pending { background: rgba(127, 178, 229, 0.3); margin-inline-start: 8px; }
.rank-link { text-decoration: none; color: inherit; border-radius: 6px; }
.rank-link:hover .rank-label { color: var(--ink); text-decoration: underline; }
.income-filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 14px; }
.income-filters select, .income-filters input { width: auto; flex: 1 1 140px; margin: 0; }
.income-filters input[type="search"] { flex: 2 1 200px; }

.jobs-table td { vertical-align: top; }
.jobs-table tr { border-inline-start: 3px solid transparent; }
.jobs-table tr.job-paid { background: rgba(108, 197, 138, 0.04); }
/* Status = a coloured dot + text, no box: it must never look like a button
   (the action is the separate "₪ רישום תשלום" button). */
.job-status, .job-status-inline { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 9px; border: 1px solid transparent; border-radius: var(--r-pill); background: var(--surface-2); font-size: 12px; font-weight: 800; line-height: 1.5; white-space: nowrap; cursor: inherit; user-select: none; color: var(--soft); }
.job-status::before, .job-status-inline::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.job-paid .job-status, .job-status.job-paid, .job-status-inline.job-paid { color: var(--ok); background: var(--ok-tint); }
.job-partial .job-status, .job-status.job-partial, .job-status-inline.job-partial { color: var(--warn); background: var(--warn-tint); }
.job-invoiced .job-status, .job-status.job-invoiced, .job-status-inline.job-invoiced { color: var(--info); background: var(--info-tint); }
.job-open .job-status, .job-status.job-open, .job-status-inline.job-open { color: var(--muted); background: transparent; border-color: var(--line); }
.job-open .job-status::before, .job-status.job-open::before, .job-status-inline.job-open::before { background: none; box-shadow: inset 0 0 0 1.5px currentColor; }
.review-flag { font-size: 12px; color: var(--warn); }
.job-actions { white-space: nowrap; }
.job-actions > * { display: inline-flex; vertical-align: middle; }
/* "₪ רישום תשלום": an outline action button + a small panel (date + one
   button per payment method). */
.pay-pop { position: relative; display: inline-block; }
.pay-pop > summary { list-style: none; }
.pay-pop > summary::-webkit-details-marker { display: none; }
.btn-pay { min-height: 30px; padding: 4px 10px; font-size: 13px; font-weight: 800; white-space: nowrap; color: var(--ink); background: transparent; user-select: none; }
.pay-pop[open] > .btn-pay { border-color: var(--ink); background: var(--surface-2); }
.pay-pop-panel { position: absolute; z-index: 30; top: calc(100% + 6px); inset-inline-end: 0; width: 264px; display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow-pop); white-space: normal; text-align: start; cursor: default; }
.pay-pop-date { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0; font-size: 13px; color: var(--muted); }
.pay-pop-date input { width: auto; min-height: 34px; margin: 0; padding: 5px 8px; font-size: 13px; }
.pay-pop-hint { font-size: 13px; font-weight: 600; }
.pay-pop-hint .muted { font-weight: 400; font-size: 12px; }
.pay-pop-methods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.pay-pop-methods .btn { min-height: 40px; padding: 6px 4px; font-size: 13px; text-align: center; white-space: normal; line-height: 1.2; }
.table-scroll:has(.pay-pop[open]) { overflow: visible; }
.pay-info { font-size: 13px; color: var(--muted); white-space: nowrap; }
.job-view-state { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.job-view-top .job-status-inline { font-size: 15px; }
.job-view-top .job-status-inline::before { width: 10px; height: 10px; }

/* One invoice for several jobs of one client */
.combined-banner { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 12px 14px; border-color: rgba(127, 178, 229, 0.35); border-inline-start: 4px solid var(--info); }
.combined-cta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-block-start: 14px; padding-block-start: 14px; border-block-start: 1px solid var(--border-soft); }
.list-head-link { margin-inline-start: auto; font-size: 14px; color: var(--accent-strong); text-decoration: none; white-space: nowrap; }
.list-head-link:hover { text-decoration: underline; }
.ci-clients { display: flex; flex-direction: column; gap: 8px; }
.ci-client { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; margin: 0; padding: 12px 14px; color: var(--ink); text-decoration: none; }
.ci-client:hover { border-color: var(--soft); }
.ci-client .muted { grid-row: 2; font-size: 13px; }
.ci-client-total { grid-row: 1 / 3; grid-column: 2; align-self: center; font-weight: 800; color: var(--ink); }
.ci-form { padding: 14px; }
.ci-tools { display: flex; justify-content: space-between; align-items: center; margin-block-end: 8px; font-size: 13px; }
.ci-list { display: flex; flex-direction: column; gap: 6px; }
.ci-row { display: grid; grid-template-columns: auto auto 1fr auto; align-items: start; gap: 4px 10px; margin: 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r); background: var(--bg-elevated-2); color: var(--ink); font-size: 14px; cursor: pointer; }
.ci-row:has(input:checked) { border-color: var(--accent); background: var(--accent-tint); }
.ci-row input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--accent); }
.ci-row.ci-disabled { opacity: 0.6; cursor: not-allowed; }
.ci-date { color: var(--muted); font-size: 13px; padding-top: 1px; }
.ci-what { min-width: 0; }
.ci-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 3px; font-size: 12px; }
.ci-amount { font-weight: 700; white-space: nowrap; }
.ci-foot { position: sticky; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 12px -14px -14px; padding: 12px 14px; border-top: 1px solid var(--border); border-radius: 0 0 var(--r) var(--r); background: var(--bg-elevated); }
.ci-sum { font-size: 15px; }
.ci-sum strong { font-size: 18px; }
@media (max-width: 680px) {
  .ci-row { grid-template-columns: auto 1fr auto; }
  .ci-date { grid-column: 2; grid-row: 1; }
  .ci-what { grid-column: 2 / 4; grid-row: 2; }
  .ci-amount { grid-column: 3; grid-row: 1; }
  .ci-foot .btn { flex: 1 1 100%; text-align: center; }
}
.sheet-sync { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-block-start: 24px; }
.sync-error { color: var(--danger); }
.alert-warn { background: var(--warn-tint); color: var(--warn); border-color: rgba(233, 185, 73, 0.4); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-block-end: 16px; }
.chip { margin: 0; cursor: pointer; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: inline-block; padding: 8px 14px; border-radius: 999px; border: 1.5px solid var(--border); background: var(--bg-elevated-2); color: var(--ink); font-size: 14px; transition: border-color 0.15s ease, background 0.15s ease; }
.chip:hover span { border-color: var(--soft); }
.chip input:checked + span { background: var(--ink); color: var(--bg); border-color: var(--ink); font-weight: 700; }
.chip input:focus-visible + span { box-shadow: var(--focus); }
.paid-toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 16px; color: var(--ink); cursor: pointer; margin-block-end: 12px; }
.paid-toggle input { width: 20px; height: 20px; accent-color: var(--ok); }
.income-form details { margin-block: 8px 4px; }
.income-form summary { cursor: pointer; margin-block-end: 10px; }
.link-invoice { margin-block-start: 16px; }

.jobs-table td.num { white-space: nowrap; }

/* Phones: each job becomes a compact card instead of a wide table row. */
@media (max-width: 680px) {
  .stat-tiles:has(.stat-tile-link) { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-tiles:has(.stat-tile-link) .stat-tile { padding: 14px; }
  .stat-tiles:has(.stat-tile-link) .stat-value { font-size: 22px; }
  .stats-chart:has(.bar-pending) .tick { font-size: 20px; }
  .jobs-table thead { display: none; }
  .jobs-table, .jobs-table tbody { display: block; width: 100%; }
  .jobs-table tr { display: grid; grid-template-columns: auto 1fr auto; gap: 2px 10px; align-items: center; padding: 10px 12px; margin-block-end: 8px; border: 1px solid var(--border); border-radius: var(--r); background: var(--bg-elevated); }
  .jobs-table tr.job-paid { background: rgba(108, 197, 138, 0.04); border-color: rgba(108, 197, 138, 0.3); }
  .jobs-table tr.job-invoiced { border-color: rgba(127, 178, 229, 0.35); }
  .jobs-table tr.job-partial { border-color: rgba(233, 185, 73, 0.4); }
  .jobs-table td { display: block; border: 0; padding: 0; box-shadow: none !important; }
  .jobs-table td[data-label="תאריך"] { grid-area: 1 / 1; text-align: start; color: var(--muted); font-size: 13px; }
  .jobs-table td[data-label="לקוח"] { grid-area: 1 / 2; }
  .jobs-table td[data-label="סכום"] { grid-area: 1 / 3; font-size: 16px; }
  .jobs-table td[data-label="סוג"] { grid-area: 2 / 1 / 3 / -1; font-size: 13px; }
  .jobs-table td[data-label="חשבונית"] { grid-area: 3 / 1 / 4 / -1; font-size: 13px; }
  .jobs-table td[data-label="חשבונית"]:has(> .muted:only-child) { display: none; }
  .jobs-table td[data-label="סטטוס"] { grid-area: 4 / 1 / 5 / -1; padding-block-start: 6px; font-size: 13px; }
  .jobs-table td.job-actions { grid-area: 5 / 1 / 6 / -1; padding-block-start: 6px; display: flex; gap: 6px; flex-wrap: wrap; }
  .jobs-table .job-actions .btn { padding: 6px 10px; font-size: 13px; }
  .table-scroll:has(.jobs-table) { overflow: visible; }
}

/* Income page - spreadsheet ("טבלה") view */
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-block: 28px 12px; }
.list-head h2 { margin: 0; }
.sheet-wrap { overflow: auto; max-height: 75vh; border: 1px solid var(--border); border-radius: var(--r); background: var(--bg-elevated); margin-block-end: 8px; }
.sheet-table { border-collapse: separate; border-spacing: 0; min-width: 1150px; font-size: 13px; }
.sheet-table th, .sheet-table td { padding: 7px 10px; border-block-end: 1px solid var(--border-soft); border-inline-start: 1px solid var(--border-soft); white-space: nowrap; font-size: 13px; }
.sheet-table th:first-child, .sheet-table td:first-child { border-inline-start: 0; }
.sheet-table td.sheet-wide { white-space: normal; min-width: 150px; max-width: 260px; }
.sheet-table thead th { position: sticky; top: 0; z-index: 2; background: var(--bg-elevated-2); color: var(--muted); border-block-end: 1px solid var(--line); }
.sheet-table tbody tr[data-href] { cursor: pointer; }
.jobs-table tbody tr[data-href] { cursor: pointer; }
.jobs-table tbody tr[data-href]:hover { box-shadow: inset 0 0 0 999px rgba(239, 232, 221, 0.03); }
.jobs-table tbody tr[data-href]:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
/* Small chip: the trainee's page on the coach site (new tab) */
.coach-link { display: inline-flex; align-items: center; gap: 2px; padding: 1px 7px; border: 1px solid rgba(108, 197, 138, 0.45); border-radius: 999px; background: var(--ok-tint); color: var(--ink); font-size: 12px; line-height: 18px; text-decoration: none; white-space: nowrap; vertical-align: middle; }
.coach-link:hover { border-color: var(--ok); }
.sheet-table tbody tr[data-href]:hover td { background: rgba(239, 232, 221, 0.04); }
.sheet-table tbody tr[data-href]:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.sheet-table tr.job-paid td { background: rgba(108, 197, 138, 0.05); }
.sheet-table tr.job-invoiced td { background: rgba(127, 178, 229, 0.05); }
.sheet-table tr.job-partial td { background: rgba(233, 185, 73, 0.06); }
.sheet-table a { color: var(--ink); }
.sheet-month-head th { background: var(--bg); color: var(--ink); font-size: 14px; text-align: start; border-block-start: 2px solid var(--mc, var(--accent)); padding-block: 9px; }
.sheet-month-head .month-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--mc, var(--accent)); margin-inline-end: 8px; }
/* Month groups: one neutral line colour (the old rainbow of 12 month colours
   fought the single-accent admin look, 2026-12). .m1-.m12 stay as hooks. */
.m1, .m2, .m3, .m4, .m5, .m6, .m7, .m8, .m9, .m10, .m11, .m12 { --mc: var(--line); }
.sheet-table tfoot th { position: sticky; bottom: 0; background: var(--bg-elevated-2); color: var(--ink); font-size: 14px; border-block-start: 1.5px solid var(--line); text-align: start; }
.sheet-table th.num, .sheet-table td.num { text-align: end; }

/* List view: month groups + payment column */
.jobs-table .month-group td:first-child { box-shadow: inset -4px 0 0 var(--mc); }
.jobs-table tr.job-invoiced { background: rgba(127, 178, 229, 0.04); }
.jobs-table tr.job-partial { background: rgba(233, 185, 73, 0.05); }
.jobs-table .month-head th { background: var(--bg); color: var(--ink); font-size: 15px; padding-block: 14px 8px; border-block-start: 2px solid var(--mc); border-block-end: 1px solid var(--border-soft); }
.month-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--mc); margin-inline-end: 8px; }
.job-actions-inner { display: flex; align-items: center; gap: 8px; }
.job-actions-inner form { margin: 0; }

.btn-undo { padding: 6px 10px; color: var(--muted); }
@media (max-width: 680px) {
  .jobs-table tbody.month-group { display: block; }
  .jobs-table .month-head { display: block; background: none; border: 0; padding: 0; margin: 14px 0 6px; }
  .jobs-table .month-head th { display: block; border: 0; border-block-end: 2px solid var(--mc); padding: 4px 2px 6px; background: none; }
  .jobs-table .month-group td:first-child { box-shadow: none; }
  .jobs-table .month-group tr:not(.month-head) { border-inline-start: 4px solid var(--mc); }
}

/* Month subtotal row (both views) */
.month-total th { background: var(--bg-elevated-2); color: var(--ink); font-size: 14px; font-weight: 700; text-align: start; padding-block: 10px; border-block-start: 1px solid var(--mc); border-block-end: 2px solid var(--mc); }
.month-total th.num { text-align: end; font-size: 15px; }
.month-total .mt-paid { color: var(--ok); font-weight: 700; }
.month-total .mt-owed { color: var(--info); font-weight: 700; }
.sheet-table .month-total th { position: static; }
@media (max-width: 680px) {
  .jobs-table .month-total { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; padding: 10px 12px; margin-block-end: 6px; border: 0; border-radius: var(--r); border-inline-start: 4px solid var(--mc); background: var(--bg-elevated-2); }
  .jobs-table .month-total th { display: block; border: 0; padding: 0; background: none; }
  .jobs-table .month-total th:last-child { flex-basis: 100%; font-size: 13px; }
}

/* Activity (public / private) tag */
.activity-tag { display: inline-block; padding: 0 7px; border-radius: var(--r-sm); font-size: 11px; font-weight: 600; line-height: 18px; vertical-align: middle; border: 1px solid var(--border); color: var(--muted); }
.activity-tag.act-public { color: var(--info); border-color: rgba(127, 178, 229, 0.4); background: var(--info-tint); }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent-strong); text-decoration: underline; cursor: pointer; font: inherit; }

/* Invoice from the edit page: same-client jobs to add */
.sibling-list { display: flex; flex-direction: column; gap: 6px; margin-block: 8px 4px; }
.sibling { display: grid; grid-template-columns: auto auto 1fr auto; align-items: center; gap: 10px; margin: 0; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--r); background: var(--bg-elevated-2); color: var(--ink); font-size: 14px; cursor: pointer; }
.sibling:has(input:checked) { border-color: var(--accent); background: var(--accent-tint); }
.sibling input { width: 18px; height: 18px; accent-color: var(--accent); }
.sibling-amount { font-weight: 600; }
.linked-jobs a { color: inherit; font-weight: 600; }
.month-total th { white-space: nowrap; }

/* Phones: compact job rows (3 short lines per job).
   1: date · client · amount   2: type – details (one line) · invoice no.
   3: status · payment / quick-pay · edit */
@media (max-width: 680px) {
  .jobs-table tr:not(.month-head):not(.month-total) { grid-template-columns: auto 1fr auto; gap: 1px 8px; padding: 7px 10px; margin-block-end: 5px; border-radius: var(--r); }
  .jobs-table td { line-height: 1.35; }
  .jobs-table td[data-label="תאריך"] { font-size: 12px; }
  .jobs-table td[data-label="לקוח"] { font-size: 17px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .jobs-table td[data-label="לקוח"] br, .jobs-table td[data-label="לקוח"] a[href^="tel:"] { display: none; }
  .jobs-table td[data-label="סכום"] { font-size: 18px; }
  .jobs-table td[data-label="סוג"] { grid-area: 2 / 1 / 3 / 3; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .jobs-table td[data-label="סוג"] br { display: none; }
  .jobs-table td[data-label="סוג"] .muted::before { content: ' · '; }
  .jobs-table td[data-label="סוג"] .rf-text { display: none; }
  .jobs-table td[data-label="סוג"] .review-flag { margin-inline-start: 4px; }
  .jobs-table td[data-label="חשבונית"] { grid-area: 2 / 3 / 3 / 4; font-size: 11px; text-align: end; white-space: nowrap; }
  .jobs-table td[data-label="חשבונית"] br, .jobs-table td[data-label="חשבונית"] br + .muted { display: none; }
  .jobs-table td[data-label="סטטוס"] { grid-area: 3 / 1 / 4 / 2; padding-block-start: 4px; font-size: 12px; align-self: center; }
  .jobs-table td[data-label="סטטוס"] br, .jobs-table td[data-label="סטטוס"] br + .muted { display: none; }
  .jobs-table td.job-actions { grid-area: 3 / 2 / 4 / 4; padding-block-start: 4px !important; justify-content: flex-end; }
  .jobs-table .job-actions-inner { gap: 6px; justify-content: flex-end; flex-wrap: nowrap; }
  .jobs-table .job-status { font-size: 12px; }
  .jobs-table .pay-info { font-size: 12px; }
  .jobs-table .job-actions .btn-pay { padding: 4px 10px; font-size: 12px; }
  .jobs-table .month-total { padding: 8px 10px; }
}

/* Client name + amount stand out in the job list (desktop too) */
.jobs-table td[data-label="לקוח"] strong { font-size: 16px; }
.jobs-table td[data-label="סכום"] strong { font-size: 16px; color: var(--ink); }
@media (max-width: 680px) {
  .jobs-table td[data-label="לקוח"] strong { font-size: 17px; }
  .jobs-table td[data-label="סכום"] strong { font-size: 18px; }
  .jobs-table .activity-tag { font-size: 10px; padding: 0 5px; }
}

.amount-open { color: var(--warn); font-size: 13px; font-weight: 700; white-space: nowrap; }

/* Required-field marker (agreement / booking / sign forms) */
label.req::after { content: ' *'; color: var(--danger); font-weight: 700; }
.req-star { color: var(--danger); font-weight: 700; }
.req-note { font-size: 12px; color: var(--muted); margin: 0 0 10px; }

.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Agreement form: one card per event */
.event-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.event-head h2 { margin: 0 0 12px; }
.ev-open-wrap { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink); margin-top: -6px; }
.ev-open-wrap input { width: auto; margin: 0; }
.event-block .field-row > div { min-width: 150px; }

@media (max-width: 680px) {
}

/* Phone numbers -> WhatsApp (green WhatsApp icon) */
.wa-link { display: inline-flex; align-items: center; gap: 5px; color: inherit; text-decoration: none; white-space: nowrap; }
.wa-link::before { content: ""; flex: none; width: 17px; height: 17px; background: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2032%2032%22%3E%3Cpath%20fill%3D%22%2325D366%22%20d%3D%22M16%203C8.8%203%203%208.7%203%2015.8c0%202.5.7%204.9%202%207L3%2029l6.4-2c2%201.1%204.3%201.6%206.6%201.6%207.2%200%2013-5.7%2013-12.8S23.2%203%2016%203z%22/%3E%3Cpath%20fill%3D%22%23fff%22%20d%3D%22M23.4%2019.6c-.4-.2-2.4-1.2-2.7-1.3-.4-.1-.6-.2-.9.2-.3.4-1%201.3-1.2%201.5-.2.3-.4.3-.8.1-.4-.2-1.7-.6-3.2-2-1.2-1-2-2.3-2.2-2.7-.2-.4%200-.6.2-.8l.6-.7c.2-.2.3-.4.4-.7.1-.3.1-.5%200-.7l-1.2-2.9c-.3-.8-.6-.7-.9-.7h-.7c-.3%200-.7.1-1%20.5-.4.4-1.4%201.3-1.4%203.2s1.4%203.7%201.6%204c.2.3%202.8%204.2%206.7%205.9%202.6%201%203.4%201.1%204.6.9.8-.1%202.4-1%202.7-1.9.3-.9.3-1.7.2-1.9-.1-.2-.4-.3-.8-.5z%22/%3E%3C/svg%3E") center / contain no-repeat; }
.wa-link:hover { color: #25D366; text-decoration: underline; }
@media (max-width: 680px) {
  /* Compact rows: just the icon next to the name. */
  .jobs-table td[data-label="לקוח"] .wa-link { font-size: 0; gap: 0; margin-inline-start: 6px; vertical-align: middle; }
  .jobs-table td[data-label="לקוח"] .wa-link::before { width: 20px; height: 20px; }
}

/* Job details page (/income/:id) */
.job-view-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--border-soft); }
.job-view-amount { white-space: nowrap; font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; }
.job-facts { display: grid; grid-template-columns: max-content 1fr; gap: 10px 20px; margin: 0; }
.job-facts dt { color: var(--muted); font-size: 14px; }
.job-facts dd { margin: 0; font-size: 15px; }
@media (max-width: 680px) { .job-view-amount { font-size: 24px; } }

/* Date clashes between bookings - meant to be impossible to miss. */
.clash-alert {
  background: var(--danger-tint);
  color: var(--ink);
  border: 1.5px solid var(--danger);
  border-inline-start-width: 6px;
  border-radius: var(--r-sm);
  padding: 12px 16px;
  margin-block: 0 16px;
  font-size: 15px;
}
.clash-alert strong { color: var(--danger); }
.clash-alert ul { margin: 6px 0 0; padding-inline-start: 20px; }
.clash-alert a { color: var(--ink); font-weight: 700; }
.clash-alert .muted { color: var(--soft); }
.clash-live { margin-block: 8px 0; font-size: 14px; padding: 10px 12px; }
.clash-tag { font-size: 14px; }
.job-hours { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* Receipts from the income log (2026-12) */
.pay-pop-receipt { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; }
.pay-pop-receipt input { width: auto; margin: 0; }
.text-warn { color: var(--warn); font-weight: 700; }
.inline-form { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 0; }
.inline-form input[inputmode="email"] { width: auto; min-width: 210px; margin: 0; }
.email-edit summary { cursor: pointer; list-style: none; }
.email-edit summary::-webkit-details-marker { display: none; }
.email-edit[open] summary { margin-bottom: 6px; }
.link-like { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.docs-table { width: 100%; }
.docs-table td { vertical-align: middle; }
.docs-table tr.muted td { opacity: .6; }
.docs-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.docs-actions .btn { padding: 4px 10px; }
.doc-receipt { font-size: 12px; margin-top: 2px; white-space: nowrap; }
.doc-missing { font-size: 12px; margin-top: 2px; color: var(--warn); font-weight: 700; white-space: nowrap; }
@media (max-width: 640px) {
  .docs-table td { display: block; padding: 2px 0; border: 0; }
  .docs-table tr { display: block; padding: 8px 0; border-bottom: 1px solid var(--border-soft); }
  .docs-actions { justify-content: flex-start; }
}

/* ==========================================================================
   Top navigation tabs (2026-12) - views/partials/nav-tabs.ejs, src/nav.js
   Self-contained: only .navtabs / .navsub / .sites-* / .receipts-table classes below (job-page actions have their own section at the end).
   ========================================================================== */
/* Admin bar look per design-system/mock.html: one --surface band (topbar +
   tabs), text tabs in --soft, the active one ink with a 2px orange underline.
   The tab bar is the sticky part. Emoji icons are hidden except on the
   icon-only settings tab (shown greyscale). */
.navtabs {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--surface);
  border-block-end: 1px solid var(--line);
}
.navtabs-inner,
.navsub {
  max-width: var(--maxw);
  margin-inline: auto;
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.navtabs-inner::-webkit-scrollbar,
.navsub::-webkit-scrollbar { display: none; }
.navtabs-inner { gap: var(--s5); padding: 0 var(--s5); }
.navtab {
  position: relative;
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 12px 0 10px;
  color: var(--soft);
  text-decoration: none;
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  border-block-end: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.navtab:hover { color: var(--ink); }
.navtab.is-active { color: var(--ink); border-block-end-color: var(--accent); }
.navtab-icon { display: none; }
.navtab-icon-only { margin-inline-start: auto; }
.navtab-icon-only .navtab-icon { display: inline; font-size: 17px; line-height: 1; filter: grayscale(1) brightness(1.3); opacity: 0.7; }
.navtab-icon-only:hover .navtab-icon, .navtab-icon-only.is-active .navtab-icon { opacity: 1; }
/* Count badge: neutral (the orange is for actions only); red when it's a problem. */
.navtab-badge {
  min-width: 20px;
  padding: 0 6px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
  line-height: 17px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.navtab-badge-alert { background: var(--danger-tint); border-color: rgba(240, 100, 106, 0.5); color: var(--danger); }

.navsub {
  gap: 6px;
  padding: 10px var(--s5);
  border-block-start: 1px solid var(--line-soft);
}
.navsub-item {
  flex: none;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  color: var(--soft);
  text-decoration: none;
  font-size: var(--fs-sm);
  font-weight: 700;
  white-space: nowrap;
}
.navsub-item:hover { color: var(--ink); border-color: var(--soft); }
.navsub-item.is-active { color: var(--bg); background: var(--ink); border-color: var(--ink); }

@media (max-width: 640px) {
  /* Text tabs scroll sideways inside the bar (never the page), with a fade. */
  .navtabs-inner { gap: 18px; padding: 0 var(--s4); mask-image: linear-gradient(to left, #000 88%, transparent); -webkit-mask-image: linear-gradient(to left, #000 88%, transparent); }
  .navtab { padding: 12px 0 10px; font-size: 15px; }
  .navtab-icon-only { margin-inline-start: 0; }
  .navtab-badge { min-width: 18px; padding: 0 5px; font-size: 10px; line-height: 16px; }
  .navsub { padding: 8px var(--s4); }
}

/* "אתרים" page (views/sites.ejs) */
.sites-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 16px; }
.sites-card { margin: 0; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.sites-card h2 { margin: 0 0 4px; font-size: 18px; }
.sites-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--bg-elevated-2);
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  transition: border-color 0.15s ease;
}
.sites-link:hover { border-color: var(--soft); }
.sites-link small { color: var(--muted); font-weight: 400; font-size: 12px; }
.sites-link .navtab-badge { flex: none; }
.receipts-table tr.muted td { opacity: 0.6; }
.receipts-table td.num { white-space: nowrap; }
@media (max-width: 640px) {
  /* Phone: each receipt as a compact two-column block instead of a wide row. */
  .table-scroll:has(.receipts-table) { overflow: visible; }
  .receipts-table thead { display: none; }
  .receipts-table tr { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 12px 0; border-block-end: 1px solid var(--border-soft); }
  .receipts-table td { display: block; padding: 0; border: 0; }
  .receipts-table td:nth-child(even) { text-align: left; } /* the row's far side in RTL */
  .receipts-table td.receipt-actions { justify-content: flex-end; }
}

/* Job page actions (views/income-view.ejs, 2026-12) */
.job-actions-minor { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-block-start: 12px; }
.job-action-minor {
  background: none;
  border: 0;
  padding: 2px 0;
  font: inherit;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: transparent;
}
.job-action-minor:hover { color: var(--ink); text-decoration-color: currentColor; }
.job-action-danger:hover { color: var(--danger); }
.job-actions-more { margin-block-start: 12px; }
.job-actions-more > summary { cursor: pointer; color: var(--muted); font-size: 14px; }
.job-actions-more > summary:hover { color: var(--ink); }
.job-actions-more[open] > summary { margin-block-end: 6px; }
.job-link-invoice select { width: auto; max-width: 100%; min-width: 0; flex: 1 1 240px; margin: 0; }
.job-invoice-form .btn-row { margin-block-start: 8px; }

/* WhatsApp share + inline "send by email" (partials/send-email.ejs, 2026-12) */
.btn.btn-wa { color: #25d366; border-color: rgba(37, 211, 102, 0.45); }
.btn.btn-wa:hover { background: rgba(37, 211, 102, 0.12); border-color: #25d366; }
.wa-share-link { color: #25d366; white-space: nowrap; }
.send-email-inline { display: inline-block; }
.send-email-inline > summary { list-style: none; }
.send-email-inline > summary::-webkit-details-marker { display: none; }
.send-email-inline[open] { display: block; flex-basis: 100%; }
.send-email-inline[open] > form { margin-block-start: 6px; }
.send-email-inline input[inputmode="email"] { min-width: 0; flex: 1 1 200px; max-width: 100%; }
.receipt-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-start; }
.receipt-actions .btn { padding: 4px 10px; }
.send-email-inline > form { width: 100%; max-width: 520px; }

/* ==========================================================================
   Admin design line (2026-12) - design-system/admin.css v1.0.1
   Admin pages load /admin.css (tokens, fonts, components) BEFORE this file
   and carry <html class="admin"> (partials/header.ejs). Public / client
   pages (login, agreement sign, booking, review) load neither, so every rule
   below is scoped to .admin and the old :root at the top only matches them.
   Rule here: admin colours come from tokens only, never hex.
   ========================================================================== */

/* Old token names used across this file -> the new tokens. */
:root.admin {
  --bg-elevated: var(--surface);
  --bg-elevated-2: var(--surface-2);
  --border: var(--line);
  --border-soft: var(--line-soft);
  --accent-strong: var(--accent-hover);
  --success: var(--ok);
  --success-ink: #0b1a10;
  --danger-ink: #1f0a0b;
}

/* Base: shared element rules from the top of this file, re-pointed. */
.admin body {
  font-family: var(--font);
  font-size: var(--fs);
  line-height: 1.55;
  background: var(--bg);
  background-image: none;
}
.admin h1 { font-family: var(--display); font-weight: 700; font-size: var(--fs-h1); line-height: 1; letter-spacing: .005em; margin-block: 0 20px; }
.admin h2 { font-size: var(--fs-md); font-weight: 800; }
.admin h3 { color: var(--soft); }
.admin .page-head { align-items: flex-end; flex-wrap: wrap; gap: var(--s3) var(--s4); }
.admin .page-head h1, .admin .stats-head h1 { margin: 0; }
.admin .container { max-width: var(--maxw); padding: var(--s5) var(--s5) 64px; }
.admin .muted { color: var(--muted); }
.admin a { text-underline-offset: 3px; }
.admin code { background: var(--surface-2); border-color: var(--line); border-radius: var(--r-sm); }

/* App bar: logo + "צילום · ניהול" on the start side, back link, logout on the
   far side. Scrolls away; the tab bar under it is the sticky part. */
.admin .topbar { background: var(--surface); border-block-end: 0; box-shadow: none; }
.admin .topbar-inner { max-width: var(--maxw); display: flex; align-items: center; gap: var(--s4); padding: 10px var(--s5) 6px; }
.admin .brand { order: -1; display: flex; align-items: center; gap: 10px; text-decoration: none; }
.admin .brand { line-height: 0; }
.admin .brand-logo { height: 48px; width: auto; filter: none; }
.admin .brand-tag { font-size: var(--fs-xs); font-weight: 700; letter-spacing: .08em; color: var(--accent); white-space: nowrap; }
.admin .topbar-side-start { flex: 1; }
.admin .topbar-side-end { gap: var(--s3); }
.admin .back-link, .admin .logout-link { color: var(--muted); font-size: var(--fs-sm); font-weight: 600; padding: 6px; }
.admin .back-link:hover, .admin .logout-link:hover { color: var(--ink); }
@media (max-width: 640px) {
  .admin .topbar-inner { padding: 8px var(--s4) 4px; gap: var(--s2); }
  .admin .brand-logo { height: 32px; }
  /* Logo + app switcher + logout fill the row; the back link (when there is
     one) drops to its own short row under them. */
  .admin .topbar-inner { flex-wrap: wrap; row-gap: 0; }
  .admin .topbar-side-end { margin-inline-start: auto; gap: var(--s2); }
  .admin .topbar-side-start { order: 1; flex: 1 0 100%; }
  .admin .topbar.is-home .topbar-side-start { display: none; }
  .admin .back-link { padding: 2px 0 4px; }
  .admin .brand-tag { display: none; }
  .admin .container { padding: var(--s4) var(--s4) 48px; }
  .admin h1 { font-size: 30px; }
}

/* Forms */
:where(.admin) label { color: var(--soft); font-weight: 700; }
.admin :is(input[type="text"], input[type="email"], input[type="tel"], input[type="number"], input[type="date"], input[type="time"], input[type="search"], input[type="password"], input[type="url"], input:not([type]), textarea, select) {
  min-height: 40px;
  padding: 8px 12px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--ink);
  font-family: inherit;
  font-size: 15px;
}
.admin textarea { min-height: 90px; }
.admin :is(input, textarea, select):focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
.admin input[type="checkbox"], .admin input[type="radio"] { accent-color: var(--accent); }
.admin input[type="file"] { color: var(--soft); font: inherit; font-size: var(--fs-sm); }
/* compact fields the generic rule above would otherwise blow up */
.admin .pay-pop-date input { min-height: 34px; padding: 5px 8px; font-size: 13px; }
.admin .line-items-table :is(input, select) { min-height: 36px; padding: 6px 8px; }
@media (max-width: 640px) {
  .admin :is(input[type="text"], input[type="email"], input[type="tel"], input[type="number"], input[type="date"], input[type="time"], input[type="search"], input[type="password"], input:not([type]), textarea, select) { font-size: 16px; }
}
@keyframes flash-required-anim {
  0%, 100% { border-color: var(--border); box-shadow: none; }
  20%, 60% { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-tint); }
}

/* Tables */
/* :where() = element-level weight, so the app's own table rules (month rows,
   sheet, totals) still win over these. */
:where(.admin) th { color: var(--muted); font-weight: 700; font-size: var(--fs-sm); border-block-end: 1px solid var(--line); }
:where(.admin) thead th { background: var(--surface-2); }
:where(.admin) td { border-block-end-color: var(--line-soft); }
:where(.admin) tbody tr:hover { background: rgba(239, 232, 221, 0.03); }
.admin .table-scroll { border-radius: var(--r); }
/* Free-standing tables sit in a surface card, as in the mock (desktop only:
   on phones the job / receipt rows turn into their own cards). */
@media (min-width: 681px) {
  .admin .table-scroll:not(.card .table-scroll) { background: var(--surface); border: 1px solid var(--line); }
  .admin .table-scroll:not(.card .table-scroll) tbody tr:last-child td { border-block-end: 0; }
}
.admin .jobs-table .month-head th { background: var(--bg); color: var(--soft); font-size: var(--fs-sm); font-weight: 800; letter-spacing: .02em; }
.admin .month-total th { background: var(--surface-2); }
.admin .total-row { border-block-start: 1.5px solid var(--line); }

/* Cards: 6px, flat */
.admin .card { border-color: var(--line); border-radius: var(--r); padding: var(--s4) 18px; background: var(--surface); }
.admin .card.stat-tile { padding: 14px 16px 12px; }
.admin .quote-preview-frame { border-color: var(--line); }

/* Buttons - admin.css spec: 3px, 1.5px border, 800, no glow / translate / scale */
.admin .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 7px 16px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--line);
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.2;
  box-shadow: none;
  transform: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.admin .btn:hover { background: transparent; border-color: var(--ink); box-shadow: none; transform: none; }
.admin .btn:active { transform: none; box-shadow: none; background: var(--surface-2); }
.admin .btn:focus-visible { outline: none; box-shadow: var(--focus); }
.admin .btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 800; box-shadow: none; }
.admin .btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); box-shadow: none; }
.admin .btn-primary:active { background: var(--accent); }
.admin .btn-danger { color: var(--danger); border-color: rgba(240, 100, 106, 0.5); }
.admin .btn-danger:hover { background: var(--danger-tint); border-color: var(--danger); }
.admin .btn:disabled { opacity: 0.45; }
.admin .btn-row { gap: var(--s2); }
.admin .btn.btn-wa { color: #25d366; border-color: rgba(37, 211, 102, 0.45); } /* WhatsApp's own green, kept */
.admin .btn.btn-wa:hover { background: rgba(37, 211, 102, 0.1); border-color: #25d366; }
.admin .btn-pay { min-height: 30px; padding: 4px 10px; font-size: var(--fs-sm); }
.admin .pay-pop-methods .btn { min-height: 40px; padding: 6px 4px; }
.admin .docs-actions .btn, .admin .receipt-actions .btn { min-height: 30px; padding: 4px 10px; font-size: var(--fs-sm); }
.admin .btn-undo { color: var(--muted); }
.admin .remove-row-btn { color: var(--danger); }
.admin .link-btn { color: var(--ink); text-underline-offset: 3px; }
.admin .list-head-link { color: var(--ink); font-weight: 700; }
@media (max-width: 640px) {
  .admin .btn { min-height: 44px; }
  .admin .btn-pay, .admin .docs-actions .btn, .admin .receipt-actions .btn, .admin .jobs-table .job-actions .btn { min-height: 36px; }
}

/* Status badges (dot + text pill, admin.css .badge); old status-* names mapped */
.admin .badge { padding: 2px 10px 2px 9px; border: 1px solid transparent; border-radius: var(--r-pill); background: var(--surface-2); color: var(--soft); font-size: var(--fs-xs); font-weight: 800; }
.admin .badge.status-accepted, .admin .badge.status-signed, .admin .badge.status-paid { color: var(--ok); background: var(--ok-tint); border-color: transparent; }
.admin .badge.status-partial, .admin .badge.status-warn { color: var(--warn); background: var(--warn-tint); border-color: transparent; }
.admin .badge.status-sent, .admin .badge.status-open, .admin .badge.status-waiting { color: var(--info); background: var(--info-tint); border-color: transparent; }
.admin .badge.status-draft { color: var(--muted); background: transparent; border-color: var(--line); }
.admin .badge.status-draft::before { background: none; box-shadow: inset 0 0 0 1.5px currentColor; }
.admin .badge.status-revoked, .admin .badge.status-cancelled, .admin .badge.status-rejected { color: var(--danger); background: var(--danger-tint); border-color: transparent; }

/* Alerts: tint + 4px start bar (admin.css .alert) */
.admin .alert { border-radius: var(--r-sm); border: 1px solid; border-inline-start-width: 4px; }
.admin .alert-success { color: var(--ok); background: var(--ok-tint); border-color: rgba(108, 197, 138, 0.35); }
.admin .alert-error { color: var(--danger); background: var(--danger-tint); border-color: rgba(240, 100, 106, 0.45); }
.admin .alert-warn { color: var(--warn); background: var(--warn-tint); border-color: rgba(233, 185, 73, 0.4); }
.admin .alert b, .admin .alert strong { color: var(--ink); }
.admin .sync-error { color: var(--danger); }

/* Phones: stat tiles 2x2 with smaller numbers, as in the mock */
@media (max-width: 680px) {
  .admin .stat-tiles { grid-template-columns: 1fr 1fr; gap: var(--s2); }
  .admin .card.stat-tile { padding: 10px 12px; }
  .admin .stat-tiles .stat-value { font-size: 30px; }
}

/* Sticker share (views/partials/sticker-share.ejs): thumbnail + button + a
   one-line status after sharing. */
.sticker-share { display: inline-flex; align-items: center; gap: var(--s2, 8px); flex-wrap: wrap; }
.sticker-thumb { width: 44px; height: 44px; display: block; }
.btn.btn-sticker { color: var(--ok, #6cc58a); border-color: rgba(108, 197, 138, 0.45); }
.btn.btn-sticker:hover { background: var(--ok-tint, rgba(108, 197, 138, 0.12)); border-color: var(--ok, #6cc58a); }
.sticker-status:empty { display: none; }
/* Job-page success banners: text on top, actions under it. */
.admin .alert.receipt-done, .admin .alert.paid-done { flex-direction: column; gap: 0; }

/* ✕ on alerts / flashes / notices (public/dismiss.js, admin pages only).
   Boxed alerts: top corner on the end side. One-line notices: inline after
   the text. 32px hit area, the glyph itself stays small. */
.admin .has-dismiss { position: relative; padding-inline-end: 40px; }
.admin .dismiss-x {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; padding: 0; margin: 0;
  background: none; border: 0; border-radius: var(--r-sm);
  color: inherit; opacity: 0.6; cursor: pointer;
  font: inherit; font-size: 14px; font-weight: 700; line-height: 1;
}
.admin .has-dismiss > .dismiss-x { position: absolute; top: 4px; inset-inline-end: 4px; }
.admin .has-dismiss-inline > .dismiss-x { width: 26px; height: 26px; margin-inline-start: 4px; vertical-align: middle; }
.admin .dismiss-x:hover { opacity: 1; background: rgba(239, 232, 221, 0.08); }
.admin .dismiss-x:focus-visible { opacity: 1; outline: none; box-shadow: var(--focus); }
.admin .is-dismissed { display: none !important; }
