/* Job Tracker — mobile first, logical properties so Hebrew (RTL) mirrors automatically. */

:root {
  --bg: #f3f5f7;
  --surface: #ffffff;
  --surface-2: #f7f9fa;
  --surface-3: #eef2f4;
  --border: #e1e6ea;
  --border-strong: #cbd3da;
  --text: #17212b;
  --muted: #5f6b78;
  --faint: #8a95a1;
  --primary: #0f6e6a;
  --primary-hover: #0b5c58;
  --primary-soft: #e3f1f0;
  --primary-text: #ffffff;
  --focus: rgba(15, 110, 106, 0.28);

  --red: #b42318;
  --red-soft: #fdecea;
  --amber: #9a5800;
  --amber-soft: #fff3dc;
  --green: #18794e;
  --green-soft: #e5f4ec;
  --blue: #2457a6;
  --blue-soft: #e8f0fb;
  --teal: #0f6e6a;
  --teal-soft: #e3f1f0;
  --gray: #556270;
  --gray-soft: #eef1f4;

  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 7px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 1px 3px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.16);
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans', 'Noto Sans Hebrew', 'Arial Hebrew', Arial, sans-serif;
  --sidebar: 248px;
  --bottom-nav: 64px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1418;
    --surface: #171e23;
    --surface-2: #1c242a;
    --surface-3: #232d34;
    --border: #2a353d;
    --border-strong: #3a4852;
    --text: #e8edf1;
    --muted: #a0acb7;
    --faint: #7b8792;
    --primary: #2bb3a9;
    --primary-hover: #39c4ba;
    --primary-soft: #143533;
    --primary-text: #062523;
    --focus: rgba(43, 179, 169, 0.35);
    --red: #ff8b80;
    --red-soft: #3a1d1b;
    --amber: #f3b65a;
    --amber-soft: #372a14;
    --green: #5fd39a;
    --green-soft: #15301f;
    --blue: #8ab4ff;
    --blue-soft: #172a45;
    --teal: #5fd3c9;
    --teal-soft: #143533;
    --gray: #b0bac4;
    --gray-soft: #242e35;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.45);
    color-scheme: dark;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

body.has-modal {
  overflow: hidden;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1,
h2 {
  margin: 0;
  line-height: 1.2;
}

h1 {
  font-size: 1.45rem;
  font-weight: 700;
}

h2 {
  font-size: 1rem;
  font-weight: 650;
}

p {
  margin: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 1px;
}

.icon {
  flex-shrink: 0;
}

[dir='rtl'] .icon-dir {
  transform: scaleX(-1);
}

bdi {
  unicode-bidi: isolate;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.85rem;
}

.center {
  text-align: center;
  display: flex;
  justify-content: center;
}

.stack.center {
  flex-direction: column;
  align-items: center;
}

.nowrap {
  white-space: nowrap;
}

.pre {
  white-space: pre-wrap;
}

.is-owed {
  color: var(--red);
}

.is-paid {
  color: var(--green);
}

.is-warn {
  color: var(--amber);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.stack-lg {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.grid-2 {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
  align-items: start;
}

.grid-form {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .grid-form {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 1100px) {
  .grid-2 {
    grid-template-columns: 1fr 1fr;
  }
}

/* ---------- Shell ---------- */

.shell {
  min-height: 100vh;
}

.sidebar {
  display: none;
}

.main {
  padding-bottom: calc(var(--bottom-nav) + env(safe-area-inset-bottom) + 24px);
}

.bottom-nav {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
  height: calc(var(--bottom-nav) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.bottom-nav .nav-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 2px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.bottom-nav .nav-link.is-active {
  color: var(--primary);
}

.nav-plus {
  justify-self: center;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-top: -18px;
  border: 0;
  border-radius: 50%;
  background: var(--primary);
  color: var(--primary-text);
  box-shadow: var(--shadow-lg);
  cursor: pointer;
}

@media (min-width: 960px) {
  .sidebar {
    position: fixed;
    inset-block: 0;
    inset-inline-start: 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    gap: 18px;
    width: var(--sidebar);
    padding: 18px 14px;
    background: var(--surface);
    border-inline-end: 1px solid var(--border);
    overflow-y: auto;
  }

  .main {
    margin-inline-start: var(--sidebar);
    padding-bottom: 40px;
  }

  .bottom-nav {
    display: none;
  }
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px;
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
}

.brand-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--primary);
  color: var(--primary-text);
  flex-shrink: 0;
}

.brand-mark-lg {
  width: 52px;
  height: 52px;
  border-radius: 14px;
}

.sidebar-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav .nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-weight: 600;
  text-decoration: none;
}

.nav .nav-link:hover {
  background: var(--surface-2);
  color: var(--text);
}

.nav .nav-link.is-active {
  background: var(--primary-soft);
  color: var(--primary);
}

.sidebar-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.sidebar-user {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-inline-start: 6px;
  color: var(--muted);
  font-size: 0.9rem;
}

.lang-switch {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--surface-3);
}

.lang-switch button {
  padding: 5px 11px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 650;
  cursor: pointer;
}

.lang-switch button.is-on {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

/* ---------- Page ---------- */

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 16px;
}

.page-narrow {
  max-width: 760px;
}

@media (min-width: 960px) {
  .page {
    padding: 26px 32px;
  }
}

.page-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.page-title {
  flex: 1;
  min-width: 0;
}

.page-title h1 {
  overflow-wrap: anywhere;
}

.page-sub {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.9rem;
}

.page-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.page-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

@media (max-width: 639px) {
  .page-head {
    flex-wrap: wrap;
  }

  .page-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .page-actions .btn {
    flex: 1;
  }

  .page-actions .menu {
    flex: 0;
  }
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 8px 15px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-weight: 650;
  font-size: 0.93rem;
  line-height: 1.1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.btn:hover {
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-text);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--surface-2);
}

.btn-secondary.is-on {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

.btn-ghost {
  background: transparent;
  color: var(--primary);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--primary-soft);
}

.btn-danger {
  background: var(--red);
  color: #fff;
}

.btn-sm {
  min-height: 32px;
  padding: 5px 11px;
  font-size: 0.85rem;
}

.btn-block {
  width: 100%;
}

.btn.is-loading {
  opacity: 0.8;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
}

.icon-btn:hover:not(:disabled) {
  background: var(--surface-3);
  color: var(--text);
}

.icon-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.back-btn {
  margin-inline-start: -8px;
}

/* ---------- Cards ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  min-width: 0;
}

.card-flush {
  padding: 0;
  overflow: hidden;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.card-flush .card-head {
  padding: 14px 16px 0;
  margin-bottom: 10px;
}

.card-actions {
  display: flex;
  gap: 6px;
}

.card-pad {
  padding: 12px 16px;
}

.card-empty {
  padding: 14px 16px 18px;
  color: var(--muted);
}

/* ---------- Forms ---------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field-label {
  font-size: 0.86rem;
  font-weight: 650;
  color: var(--text);
}

.req {
  color: var(--red);
}

.field-hint {
  font-size: 0.8rem;
  color: var(--muted);
}

.field-error,
.form-error {
  font-size: 0.85rem;
  color: var(--red);
  font-weight: 600;
}

.form-error {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--red-soft);
}

.field-warn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.82rem;
  color: var(--amber);
  font-weight: 600;
}

.input {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
  transition: border-color 0.12s, box-shadow 0.12s;
}

textarea.input {
  resize: vertical;
  min-height: 64px;
  line-height: 1.4;
}

.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus);
}

.input:disabled {
  background: var(--surface-3);
  color: var(--faint);
}

.input::placeholder {
  color: var(--faint);
}

input[type='date'].input {
  min-width: 0;
}

.select-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}

.select {
  appearance: none;
  padding-inline-end: 34px;
  cursor: pointer;
}

.select-caret {
  position: absolute;
  inset-inline-end: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.with-button {
  display: flex;
  gap: 6px;
  align-items: center;
}

.with-button .pills {
  flex: 1;
}

.money-input {
  position: relative;
}

.money-prefix {
  position: absolute;
  inset-inline-start: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-weight: 600;
  pointer-events: none;
}

.money-input .input {
  padding-inline-start: 30px;
  font-variant-numeric: tabular-nums;
}

[dir='rtl'] .money-input .input {
  text-align: right;
}

.money-input.is-invalid .input {
  border-color: var(--red);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

@media (max-width: 639px) {
  .form-actions {
    position: sticky;
    bottom: calc(var(--bottom-nav) + env(safe-area-inset-bottom) + 8px);
    z-index: 5;
    padding: 10px;
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
  }

  .form-actions .btn {
    flex: 1;
  }
}

/* Combobox */

.combo {
  position: relative;
}

.combo-control {
  position: relative;
}

.combo-control .input {
  padding-inline-start: 36px;
  padding-inline-end: 36px;
}

.combo-search {
  position: absolute;
  inset-inline-start: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--faint);
  pointer-events: none;
}

.combo-clear {
  position: absolute;
  inset-inline-end: 6px;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--muted);
  cursor: pointer;
}

.combo-menu {
  position: absolute;
  inset-inline: 0;
  top: calc(100% + 4px);
  z-index: 40;
  max-height: 300px;
  overflow-y: auto;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.combo-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: var(--radius-xs);
  background: none;
  text-align: start;
  cursor: pointer;
}

.combo-item small {
  color: var(--muted);
}

.combo-item.is-active,
.combo-item:hover {
  background: var(--surface-3);
}

.combo-item.is-selected {
  color: var(--primary);
  font-weight: 650;
}

.combo-create {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  color: var(--primary);
  font-weight: 650;
  border-top: 1px solid var(--border);
  border-radius: 0 0 var(--radius-xs) var(--radius-xs);
}

.combo-empty {
  padding: 10px;
  color: var(--muted);
}

/* Pills (segmented choice) */

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 7px 13px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
}

.pill:hover:not(:disabled) {
  background: var(--surface-2);
}

.pill:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.pill.is-on {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.pill-amber.is-on {
  border-color: var(--amber);
  background: var(--amber-soft);
  color: var(--amber);
}

.pill-green.is-on {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green);
}

.pill-blue.is-on {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue);
}

.pills-wide .pill {
  flex: 1 1 auto;
  justify-content: center;
}

/* Toggle and checkbox */

.toggle {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
}

.toggle input,
.check input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.toggle-track {
  position: relative;
  flex-shrink: 0;
  width: 44px;
  height: 26px;
  margin-top: 1px;
  border-radius: 999px;
  background: var(--border-strong);
  transition: background 0.15s;
}

.toggle-thumb {
  position: absolute;
  top: 3px;
  inset-inline-start: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  transition: inset-inline-start 0.15s;
}

.toggle input:checked + .toggle-track {
  background: var(--primary);
}

.toggle input:checked + .toggle-track .toggle-thumb {
  inset-inline-start: 21px;
}

.toggle input:focus-visible + .toggle-track {
  outline: 3px solid var(--focus);
}

.toggle-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-weight: 600;
}

.toggle-text small {
  font-weight: 400;
  color: var(--muted);
}

.toggle.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
}

.check-box {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border: 2px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  color: transparent;
}

.check input:checked + .check-box {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--primary-text);
}

.check input:focus-visible + .check-box {
  outline: 3px solid var(--focus);
}

.check input:disabled + .check-box {
  opacity: 0.6;
}

/* ---------- Badges, money ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  white-space: nowrap;
  vertical-align: middle;
}

.badge-red { background: var(--red-soft); color: var(--red); }
.badge-amber { background: var(--amber-soft); color: var(--amber); }
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-blue { background: var(--blue-soft); color: var(--blue); }
.badge-teal { background: var(--teal-soft); color: var(--teal); }
.badge-gray { background: var(--gray-soft); color: var(--gray); }

.money {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  font-weight: 650;
}

.balance {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  flex-wrap: wrap;
  font-size: 0.86rem;
  font-weight: 650;
  white-space: nowrap;
}

.balance.is-owed { color: var(--red); }
.balance.is-credit { color: var(--green); }
.balance.is-settled { color: var(--muted); }

.balance-big {
  font-size: 1.35rem;
  font-weight: 750;
}

.balance-big .money {
  font-weight: 750;
}

.avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 50%;
  font-size: 0.85rem;
  font-weight: 700;
  background: var(--teal-soft);
  color: var(--teal);
}

.avatar[data-hue='1'] { background: var(--blue-soft); color: var(--blue); }
.avatar[data-hue='2'] { background: var(--amber-soft); color: var(--amber); }
.avatar[data-hue='3'] { background: var(--green-soft); color: var(--green); }
.avatar[data-hue='4'] { background: var(--red-soft); color: var(--red); }
.avatar[data-hue='5'] { background: var(--gray-soft); color: var(--gray); }

/* ---------- Dashboard ---------- */

.quick-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .quick-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.quick {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-radius: var(--radius);
  color: #fff;
  text-decoration: none;
  box-shadow: var(--shadow);
}

.quick:hover {
  text-decoration: none;
  filter: brightness(1.05);
}

.quick-job {
  background: linear-gradient(135deg, #0f6e6a, #138a7f);
}

.quick-pay {
  background: linear-gradient(135deg, #1d6b45, #2a8a5a);
}

.quick-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.18);
  flex-shrink: 0;
}

.quick-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.quick-text strong {
  font-size: 1.05rem;
}

.quick-text small {
  opacity: 0.85;
}

.stats {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr 1fr;
}

@media (min-width: 900px) {
  .stats {
    grid-template-columns: repeat(4, 1fr);
  }

  .stats-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--text);
  text-decoration: none;
  min-width: 0;
}

a.stat:hover {
  text-decoration: none;
  border-color: var(--border-strong);
}

.stat-label {
  font-size: 0.8rem;
  font-weight: 650;
  color: var(--muted);
}

.stat-value {
  font-size: 1.35rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.stat-value .balance {
  font-size: 1rem;
}

.stat-sub {
  font-size: 0.8rem;
  color: var(--muted);
}

/* ---------- Rows and lists ---------- */

.rows {
  display: flex;
  flex-direction: column;
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  border-top: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  min-width: 0;
}

.rows .row:first-child {
  border-top: 0;
}

a.row:hover,
.row a.row-main:hover {
  background: var(--surface-2);
  text-decoration: none;
}

.row.is-void {
  opacity: 0.55;
}

.row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: var(--text);
  text-decoration: none;
}

.row-title {
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-sub {
  font-size: 0.83rem;
  color: var(--muted);
}

.row-end {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  text-align: end;
}

.row-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 10px;
  background: var(--surface-3);
  color: var(--muted);
}

.tone-teal { background: var(--teal-soft); color: var(--teal); }
.tone-green { background: var(--green-soft); color: var(--green); }

.row-chevron {
  color: var(--faint);
}

.list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.list-flush {
  gap: 0;
}

.list-flush .job-row {
  border: 0;
  border-top: 1px solid var(--border);
  border-radius: 0;
  box-shadow: none;
}

.job-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--text);
  text-decoration: none;
}

.job-row:hover {
  text-decoration: none;
  border-color: var(--border-strong);
}

.job-row.is-selectable {
  cursor: pointer;
}

.job-row.is-selected {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.job-row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.job-row-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

.job-place {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.job-place.is-missing {
  color: var(--amber);
}

.job-amount {
  flex-shrink: 0;
}

.job-desc {
  color: var(--text);
  font-size: 0.92rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.job-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.82rem;
  color: var(--muted);
}

.job-badges {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

/* ---------- Toolbar, filters ---------- */

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

.search {
  position: relative;
  flex: 1 1 240px;
}

.search .icon {
  position: absolute;
  inset-inline-start: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--faint);
}

.search .input {
  padding-inline-start: 38px;
}

.filters {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr 1fr;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

@media (min-width: 900px) {
  .filters {
    grid-template-columns: repeat(4, 1fr);
  }
}

.filters-foot {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
}

.sums {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  padding: 2px 4px;
  font-size: 0.88rem;
  color: var(--muted);
}

.sums .money {
  color: var(--text);
}

.sums .is-owed .money {
  color: var(--red);
}

.bulk-bar {
  position: sticky;
  top: 8px;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--text);
  color: var(--bg);
  box-shadow: var(--shadow-lg);
}

.bulk-bar > span {
  flex: 1;
  font-weight: 650;
}

/* ---------- Detail pages ---------- */

.kv {
  display: grid;
  gap: 0;
  margin: 0;
}

.kv-row {
  display: grid;
  grid-template-columns: minmax(110px, 34%) 1fr;
  gap: 12px;
  padding: 9px 0;
  border-top: 1px solid var(--border);
}

.kv-row:first-child {
  border-top: 0;
}

.kv dt {
  color: var(--muted);
  font-size: 0.88rem;
}

.kv dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.status-line {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.note-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px;
  border-radius: var(--radius-sm);
}

.note-amber {
  background: var(--amber-soft);
  color: var(--text);
}

.note-amber strong {
  color: var(--amber);
}

.money-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.money-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.money-line-main {
  font-size: 1.1rem;
  font-weight: 700;
}

.money-note {
  margin-top: -4px;
  padding-inline-start: 10px;
  border-inline-start: 3px solid var(--border);
  color: var(--muted);
  font-size: 0.86rem;
  white-space: pre-wrap;
}

.money-status {
  display: flex;
  justify-content: flex-end;
}

.amount-hero {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.amount-big {
  font-size: 2rem;
  font-weight: 800;
}

.balance-hero {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.balance-parts {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.balance-parts > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.credit-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: var(--green-soft);
  color: var(--green);
  font-weight: 600;
}

.card .credit-line {
  margin: 0;
}

.card-flush .credit-line {
  border-radius: 0;
}

.link-input {
  font-size: 0.85rem;
  color: var(--muted);
}

.history {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.88rem;
}

.history li {
  display: flex;
  gap: 10px;
}

.history-when {
  flex-shrink: 0;
  color: var(--muted);
  min-width: 120px;
}

.notify-list,
.file-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.notify-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.notify-item.is-sent .icon {
  color: var(--green);
}

.notify-item.is-failed .icon {
  color: var(--red);
}

.file-list li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.file-list a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.add-row {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

/* ---------- Tabs ---------- */

.tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  scrollbar-width: none;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--muted);
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
}

.tab.is-on {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-count {
  padding: 0 7px;
  border-radius: 999px;
  background: var(--surface-3);
  font-size: 0.75rem;
}

/* ---------- Tables ---------- */

.table-wrap {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.table th,
.table td {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  text-align: start;
  vertical-align: top;
}

.table thead th {
  border-top: 0;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.table tfoot th {
  background: var(--surface-2);
}

.table .num {
  text-align: end;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.table tr.is-link {
  cursor: pointer;
}

.table tr.is-link:hover td {
  background: var(--surface-2);
}

.table tr.is-warn td {
  background: var(--amber-soft);
}

.ledger tr.is-payment td:first-child {
  border-inline-start: 3px solid var(--green);
}

@media (max-width: 639px) {
  .hide-sm {
    display: none;
  }
}

/* ---------- Payment form ---------- */

.worker-strip {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.pick-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pick {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
}

.pick.is-on {
  border-color: var(--primary);
}

.pick-main {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 11px 12px;
  cursor: pointer;
}

.pick-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.pick-title {
  font-weight: 650;
}

.pick-desc {
  font-size: 0.88rem;
}

.pick-meta {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: var(--muted);
}

.pick-amount {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: end;
}

.pick-alloc {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border-top: 1px dashed var(--border);
  background: var(--primary-soft);
  font-size: 0.88rem;
  font-weight: 600;
}

.pick-alloc .money-input {
  width: 150px;
}

.plan {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 14px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 0.9rem;
}

.plan > div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.plan-after {
  padding-top: 6px;
  border-top: 1px solid var(--border);
}

.new-job-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.split-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.split-total {
  display: flex;
  justify-content: space-between;
  font-size: 1.05rem;
}

.msg-preview {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.msg-bubble {
  max-width: 460px;
  padding: 11px 14px;
  border-radius: 16px;
  border-end-start-radius: 4px;
  background: var(--surface-3);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 0.92rem;
}

.msg-email {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
}

.sms-counter {
  font-size: 0.78rem;
  color: var(--muted);
}

.sms-counter.is-multi {
  color: var(--amber);
  font-weight: 650;
}

.sms-sample {
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  background: var(--surface-2);
}

.var-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.var-list code {
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--surface-3);
  font-size: 0.82rem;
  direction: ltr;
}

.test-row {
  display: flex;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* ---------- Alerts, empty, loading ---------- */

.alert {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
}

.alert-body {
  flex: 1;
  min-width: 0;
}

.alert-blue { background: var(--blue-soft); color: var(--blue); }
.alert-amber { background: var(--amber-soft); color: var(--amber); }
.alert-red { background: var(--red-soft); color: var(--red); }
.alert-green { background: var(--green-soft); color: var(--green); }

.alert .badge {
  margin: 2px;
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 36px 16px;
  text-align: center;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--muted);
}

.empty-title {
  font-weight: 700;
}

.empty-text {
  color: var(--muted);
  max-width: 360px;
  margin-bottom: 6px;
}

.loading {
  display: grid;
  place-items: center;
  min-height: 40vh;
}

.loading-inline {
  display: grid;
  place-items: center;
  padding: 18px;
}

.spinner {
  display: inline-block;
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner-sm {
  width: 16px;
  height: 16px;
  border-width: 2px;
  border-color: rgba(255, 255, 255, 0.4);
  border-top-color: currentColor;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.boot {
  display: grid;
  place-items: center;
  min-height: 100vh;
}

.boot-logo {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--primary);
  opacity: 0.85;
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.4;
  }
}

.center-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 100vh;
  padding: 24px;
  text-align: center;
}

/* ---------- Modals, sheets, toasts, menus ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(10, 16, 22, 0.5);
  animation: fade 0.12s ease-out;
}

@media (min-width: 640px) {
  .modal-backdrop {
    align-items: center;
    padding: 24px;
  }
}

.modal {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  border-radius: 18px 18px 0 0;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  animation: rise 0.16s ease-out;
}

@media (min-width: 640px) {
  .modal {
    border-radius: 18px;
  }
}

.modal-sm {
  max-width: 460px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 14px 6px 18px;
}

[dir='rtl'] .modal-head {
  padding: 14px 18px 6px 14px;
}

.modal-head h2 {
  font-size: 1.1rem;
}

.modal-body {
  padding: 6px 18px 16px;
  overflow-y: auto;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
}

.dialog-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  width: 100%;
}

@media (max-width: 639px) {
  .dialog-buttons {
    flex-direction: column-reverse;
  }

  .dialog-buttons .btn {
    width: 100%;
  }
}

.dialog-message {
  color: var(--muted);
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

@keyframes rise {
  from {
    transform: translateY(16px);
    opacity: 0.6;
  }
}

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  background: rgba(10, 16, 22, 0.45);
  animation: fade 0.12s ease-out;
}

.sheet {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  padding: 14px 14px calc(14px + env(safe-area-inset-bottom));
  border-radius: 18px 18px 0 0;
  background: var(--surface);
  animation: rise 0.16s ease-out;
}

.sheet-action {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
}

.sheet-action:hover {
  background: var(--surface-2);
  text-decoration: none;
}

.sheet-action > span:last-child {
  display: flex;
  flex-direction: column;
}

.sheet-action small {
  color: var(--muted);
}

.sheet-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
}

.sheet-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text);
  font-weight: 600;
  text-align: start;
  text-decoration: none;
  cursor: pointer;
}

.sheet-link:hover {
  background: var(--surface-2);
  text-decoration: none;
}

.sheet-row {
  padding: 8px 12px;
}

.toasts {
  position: fixed;
  inset-inline: 0;
  bottom: calc(var(--bottom-nav) + env(safe-area-inset-bottom) + 12px);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  pointer-events: none;
}

@media (min-width: 960px) {
  .toasts {
    bottom: 24px;
    margin-inline-start: var(--sidebar);
  }
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 520px;
  padding: 11px 16px;
  border-radius: 12px;
  background: var(--text);
  color: var(--bg);
  box-shadow: var(--shadow-lg);
  font-weight: 600;
  pointer-events: auto;
  cursor: pointer;
  animation: rise 0.16s ease-out;
}

.toast-success .icon { color: #5fd39a; }
.toast-error { background: var(--red); color: #fff; }
.toast-info .icon { color: #8ab4ff; }

.menu {
  position: relative;
}

.menu-list {
  position: absolute;
  inset-inline-end: 0;
  top: calc(100% + 4px);
  z-index: 50;
  min-width: 210px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--radius-xs);
  background: none;
  text-align: start;
  font-weight: 600;
  cursor: pointer;
}

.menu-item:hover {
  background: var(--surface-3);
}

.menu-item.is-danger {
  color: var(--red);
}

/* ---------- Import ---------- */

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 28px 16px;
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--muted);
  text-align: center;
  cursor: pointer;
}

.dropzone strong {
  color: var(--text);
}

.dropzone.is-drag,
.dropzone:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

/* ---------- Login ---------- */

.auth {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 20px;
  background: linear-gradient(160deg, var(--primary-soft), var(--bg) 55%);
}

.auth-card {
  display: flex;
  flex-direction: column;
  gap: 22px;
  width: 100%;
  max-width: 400px;
  padding: 26px 22px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.auth-title {
  font-size: 1.3rem;
  font-weight: 750;
}

.auth-langs {
  display: flex;
  justify-content: center;
  gap: 4px;
}

.auth-langs button {
  padding: 6px 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
}

.auth-langs button.is-on {
  background: var(--surface-3);
  color: var(--text);
}

/* ---------- Print ---------- */

@media print {
  .sidebar,
  .bottom-nav,
  .page-actions,
  .toolbar,
  .filters,
  .form-actions,
  .toasts {
    display: none !important;
  }

  .main {
    margin: 0 !important;
    padding: 0 !important;
  }

  .card,
  .job-row {
    box-shadow: none;
    break-inside: avoid;
  }
}

/* ---------- Printable documents (#/print/...) ---------- */

.print-page {
  min-height: 100vh;
  padding-bottom: 40px;
  background: var(--surface-3);
}

.print-toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.print-hint {
  flex: 1;
  min-width: 180px;
  color: var(--muted);
  font-size: 0.82rem;
}

.print-sheet {
  max-width: 210mm;
  margin: 20px auto;
  padding: 15mm 14mm;
  border-radius: 4px;
  background: #fff;
  color: #111;
  box-shadow: var(--shadow-lg);
  color-scheme: light;
}

.p-doc {
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-size: 10.5pt;
  line-height: 1.4;
  color: #111;
}

.p-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid #0f6e6a;
}

.p-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.p-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: #0f6e6a;
  color: #fff;
  flex-shrink: 0;
}

.p-business {
  font-size: 13pt;
  font-weight: 700;
}

.p-title {
  text-align: end;
}

.p-title h1 {
  margin: 0;
  font-size: 16pt;
  color: #0f6e6a;
}

.p-small {
  font-size: 8.5pt;
}

.p-muted {
  color: #666;
}

.p-strong {
  font-size: 11.5pt;
  font-weight: 700;
}

.p-grid2,
.p-grid3 {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
}

.p-grid3 {
  grid-template-columns: 1fr 1fr 1fr;
}

.p-box {
  padding: 8px 10px;
  border: 1px solid #d8dde2;
  border-radius: 6px;
}

.p-amount-box {
  background: #f1f7f6;
}

.p-label {
  margin-bottom: 3px;
  font-size: 8pt;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #666;
}

.p-amount {
  font-size: 20pt;
  font-weight: 800;
}

.p-table {
  width: 100%;
  border-collapse: collapse;
}

.p-table th,
.p-table td {
  padding: 6px;
  border-bottom: 1px solid #e3e6ea;
  text-align: start;
  vertical-align: top;
}

.p-table thead th {
  border-bottom: 1px solid #c9d3d2;
  background: #eef4f3;
  font-size: 8.5pt;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #333;
}

.p-table tfoot th {
  border-top: 2px solid #333;
  border-bottom: 0;
  font-weight: 800;
}

.p-table-dense th,
.p-table-dense td {
  padding: 4px 5px;
  font-size: 9pt;
}

.p-num {
  text-align: end !important;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.p-nowrap {
  white-space: nowrap;
}

.p-total-row td {
  font-weight: 700;
}

.p-row-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.p-owed {
  color: #b42318;
}

.p-credit {
  color: #18794e;
}

.p-notes {
  padding-inline-start: 10px;
  border-inline-start: 3px solid #0f6e6a;
}

.p-pre {
  white-space: pre-wrap;
}

.p-section .p-text {
  font-size: 11pt;
}

.p-h2 {
  margin: 6px 0 -6px;
  font-size: 11pt;
  color: #0f6e6a;
}

.p-signs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  margin-top: 26px;
}

.p-sign-line {
  height: 40px;
  margin-bottom: 4px;
  border-bottom: 1px solid #333;
}

.p-foot {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #e3e6ea;
  font-size: 8pt;
  text-align: center;
  color: #777;
}

.p-void {
  padding: 8px;
  border: 2px solid #b42318;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
  color: #b42318;
}

@media (max-width: 640px) {
  .print-sheet {
    margin: 0;
    padding: 16px;
    border-radius: 0;
  }

  .p-grid2,
  .p-grid3 {
    grid-template-columns: 1fr;
  }
}

@media print {
  @page {
    size: A4;
    margin: 12mm;
  }

  body {
    background: #fff;
  }

  .print-toolbar {
    display: none;
  }

  .print-page {
    padding: 0;
    background: #fff;
  }

  .print-sheet {
    max-width: none;
    margin: 0;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .p-doc,
  .p-head,
  .p-table thead th,
  .p-mark,
  .p-amount-box {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .p-table tr,
  .p-signs {
    break-inside: avoid;
  }
}

/* Mixed Hebrew/Latin text: the words keep their own order, but align with the page. */
[dir='rtl'] [dir='auto']:not(input):not(textarea) {
  text-align: right;
}

[dir='ltr'] [dir='auto']:not(input):not(textarea) {
  text-align: left;
}
