/* Base tokens, layout and form controls. Calm, low-contrast-noise palette; RTL-first (logical properties). */
:root {
  --bg: #f6f4ee;
  --surface: #ffffff;
  --text: #25302b;
  --muted: #5f6b66;
  --line: #dbe0da;
  --primary: #2f6f5e;
  --primary-ink: #ffffff;
  --primary-soft: #e4efe9;
  --accent: #c98a2b;
  --danger: #b0413a;
  --danger-soft: #f8e7e5;
  --warn-soft: #fbf1dc;
  --focus: #1d5fa8;
  --radius: 14px;
  --radius-sm: 10px;
  --gap: 16px;
  --shadow: 0 1px 2px rgba(37, 48, 43, 0.06), 0 4px 16px rgba(37, 48, 43, 0.05);
  --font: system-ui, -apple-system, 'Segoe UI', 'Noto Sans Hebrew', 'Arial Hebrew', Arial, sans-serif;
  color-scheme: light;
}

*, *::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: 17px;
  line-height: 1.5;
}
.app { max-width: 920px; margin-inline: auto; padding: 16px max(16px, env(safe-area-inset-right)) 48px max(16px, env(safe-area-inset-left)); }

h1, h2, h3 { line-height: 1.25; margin: 0 0 8px; font-weight: 650; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 8px; }
.lead { color: var(--muted); font-size: 1.05rem; }
.muted { color: var(--muted); }
.small { font-size: 0.9rem; }
bdi { unicode-bidi: isolate; }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.stack > * + * { margin-top: var(--gap); }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row-between { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.grow { flex: 1 1 auto; }
.hidden { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.btn {
  appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  touch-action: manipulation;
}
.btn:hover { background: #f1f4f1; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { background: #285f50; }
.btn-danger { color: var(--danger); border-color: #e3c3c0; }
.btn-danger:hover { background: var(--danger-soft); }
.btn-quiet { background: transparent; border-color: transparent; color: var(--primary); }
.btn-small { min-height: 36px; padding: 0 12px; font-size: 0.95rem; }
.btn[aria-pressed="true"], .btn.is-active { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }

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

label { display: block; font-weight: 600; margin-bottom: 4px; }
.field { display: block; }
.field .hint { color: var(--muted); font-weight: 400; font-size: 0.9rem; margin-top: 2px; }
input[type="text"], input[type="password"], input[type="number"], textarea, select {
  width: 100%; min-height: 44px; padding: 8px 12px; border: 1px solid #c4cbc5; border-radius: var(--radius-sm);
  background: #fff; color: var(--text); font: inherit;
}
textarea { min-height: 88px; resize: vertical; }
input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--primary); }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; min-height: 44px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  font: inherit; font-weight: 600; cursor: pointer; touch-action: manipulation;
}
.chip[aria-pressed="true"], .chip.is-active { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.chip:disabled { opacity: 0.5; cursor: not-allowed; text-decoration: line-through; }

.notice { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--primary-soft); }
.notice-warn { background: var(--warn-soft); }
.notice-danger { background: var(--danger-soft); color: #7d2a25; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.85rem; font-weight: 600; background: var(--primary-soft); color: var(--primary); }
.badge-muted { background: #ecefec; color: var(--muted); }
.badge-warn { background: var(--warn-soft); color: #7a5410; }
.badge-danger { background: var(--danger-soft); color: var(--danger); }

.toast {
  position: fixed; inset-inline: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); margin-inline: auto; max-width: 420px;
  background: #25302b; color: #fff; padding: 12px 16px; border-radius: var(--radius-sm); box-shadow: var(--shadow); z-index: 50; text-align: center;
}

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
@media (max-width: 480px) { body { font-size: 16px; } .card { padding: 16px; } h1 { font-size: 1.4rem; } }
