/* ג.מ המצפן — shared design tokens & components (RTL) */
:root {
  --navy-950: #0b1d3a;
  --navy-900: #102a52;
  --navy-800: #163a72;
  --navy-700: #1e4a91;
  --blue-600: #2a62c9;
  --blue-500: #3b78e0;
  --blue-50: #eef4fe;
  --red-600: #c41e3a;
  --red-50: #fdeef0;
  --green-600: #157a3d;
  --green-50: #e8f6ed;
  --amber-600: #b25d06;
  --amber-50: #fff4e5;
  --gray-900: #17202e;
  --gray-700: #3a4658;
  --gray-600: #566275;
  --gray-500: #737f91;
  --gray-400: #9aa4b2;
  --gray-300: #c9d0da;
  --gray-200: #e1e6ed;
  --gray-100: #eef1f5;
  --gray-50: #f6f8fb;
  --white: #fff;

  --bg: var(--gray-50);
  --surface: var(--white);
  --text: var(--gray-900);
  --muted: var(--gray-600);
  --border: var(--gray-200);
  --focus: 0 0 0 3px rgba(42, 98, 201, 0.28);

  --r-sm: 6px;
  --r: 10px;
  --r-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(16, 42, 82, 0.06);
  --shadow: 0 2px 8px rgba(16, 42, 82, 0.08), 0 1px 2px rgba(16, 42, 82, 0.05);
  --shadow-lg: 0 12px 40px rgba(11, 29, 58, 0.18);
  --font: 'Heebo', 'Rubik', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  direction: rtl;
}
h1, h2, h3, h4 {
  margin: 0;
  line-height: 1.25;
  color: var(--navy-950);
}
a {
  color: var(--blue-600);
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
[hidden] {
  display: none !important;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.ltr {
  direction: ltr;
  unicode-bidi: isolate;
  display: inline-block;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 13px;
}
.nowrap {
  white-space: nowrap;
}

/* ---------- buttons ---------- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 16px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  background: var(--navy-800);
  color: var(--white);
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.05s;
}
.btn:hover {
  background: var(--navy-700);
}
.btn:active {
  transform: translateY(1px);
}
.btn:focus-visible,
label.btn:focus-within {
  outline: none;
  box-shadow: var(--focus);
}
.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.btn-secondary {
  background: var(--white);
  color: var(--navy-900);
  border-color: var(--gray-300);
}
.btn-secondary:hover {
  background: var(--gray-50);
  border-color: var(--gray-400);
}
.btn-ghost {
  background: transparent;
  color: var(--navy-800);
}
.btn-ghost:hover {
  background: var(--gray-100);
}
.btn-danger {
  background: var(--red-600);
}
.btn-danger:hover {
  background: #a5172f;
}
.btn-success {
  background: var(--green-600);
}
.btn-success:hover {
  background: #0f6631;
}
.btn-sm {
  min-height: 30px;
  padding: 0 10px;
  font-size: 13px;
}
.btn-lg {
  min-height: 50px;
  padding: 0 24px;
  font-size: 17px;
  border-radius: var(--r);
}
.btn-block {
  width: 100%;
}
.icon {
  width: 18px;
  height: 18px;
  flex: none;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- forms ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}
.field > label,
.label {
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-700);
}
.input,
select.input,
textarea.input {
  width: 100%;
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--r-sm);
  background: var(--white);
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea.input {
  min-height: 90px;
  resize: vertical;
}
.input:focus {
  outline: none;
  border-color: var(--blue-600);
  box-shadow: var(--focus);
}
.input[aria-invalid='true'] {
  border-color: var(--red-600);
}
.field-error {
  font-size: 13px;
  color: var(--red-600);
  min-height: 0;
}
.field-hint {
  font-size: 12.5px;
  color: var(--muted);
}
.check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
}
.check input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--navy-800);
}
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
@media (max-width: 640px) {
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }
}

/* ---------- surfaces ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
}
.card-pad {
  padding: 20px;
}

/* ---------- badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  background: var(--gray-100);
  color: var(--gray-700);
}
.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.8;
}
.badge.plain::before {
  display: none;
}
.b-blue {
  background: var(--blue-50);
  color: var(--blue-600);
}
.b-green {
  background: var(--green-50);
  color: var(--green-600);
}
.b-red {
  background: var(--red-50);
  color: var(--red-600);
}
.b-amber {
  background: var(--amber-50);
  color: var(--amber-600);
}
.b-navy {
  background: #e6ecf7;
  color: var(--navy-800);
}
.b-gray {
  background: var(--gray-100);
  color: var(--gray-600);
}

/* ---------- toast ---------- */
.toasts {
  position: fixed;
  inset-inline: 0;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 1000;
  pointer-events: none;
  padding: 0 16px;
}
.toast {
  pointer-events: auto;
  max-width: 480px;
  padding: 11px 18px;
  border-radius: var(--r);
  background: var(--navy-950);
  color: var(--white);
  box-shadow: var(--shadow-lg);
  font-size: 14.5px;
  animation: toast-in 0.2s ease-out;
}
.toast.error {
  background: var(--red-600);
}
.toast.success {
  background: var(--green-600);
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11, 29, 58, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 900;
  animation: fade 0.15s ease-out;
}
.modal {
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 32px);
  overflow: auto;
  background: var(--white);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
}
.modal-wide {
  max-width: 900px;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 0;
}
.modal-head h3 {
  font-size: 18px;
}
.modal-body {
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.modal-foot {
  display: flex;
  gap: 10px;
  justify-content: flex-start;
  padding: 0 22px 20px;
}
@keyframes fade {
  from {
    opacity: 0;
  }
}

.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--navy-800);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.center-screen {
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
