/* ‎mechir — רכיבים. צבע, מידה ופונט נכתבים רק ב-tokens.css. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--font); font-size: 17px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; line-height: 1.2; font-weight: 800; letter-spacing: -0.01em; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; font-weight: 700; }
p { margin: 0; }
a { color: var(--accent); }
img { max-width: 100%; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; unicode-bidi: isolate; direction: ltr; }
.soft { color: var(--ink-soft); }
.small { font-size: .88rem; }
.center { text-align: center; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ── שלד ─────────────────────────────────────────────────────────── */
.top {
  position: sticky; top: 0; z-index: 20; background: var(--paper);
  border-bottom: 1px solid var(--rule);
}
.top-in {
  max-width: var(--wide); margin: 0 auto; padding: 10px var(--gap);
  display: flex; align-items: center; gap: 10px; min-height: 58px;
}
.top-title { flex: 1; min-width: 0; font-weight: 800; font-size: 1.1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 900; font-size: 1.15rem; color: var(--ink); text-decoration: none; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 900; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--rule); background: var(--sheet);
  display: grid; place-items: center; color: var(--ink); text-decoration: none; font-size: 1.2rem; cursor: pointer;
  font-family: inherit;
}
.page { max-width: var(--wide); margin: 0 auto; padding: var(--gap) var(--gap) calc(var(--bar) + 40px); }
.page.has-bar { padding-bottom: calc(var(--bar) * 2 + 72px); }
.stack > * + * { margin-top: var(--gap); }
.stack-s > * + * { margin-top: 8px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-wrap { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grow { flex: 1; min-width: 0; }

/* ניווט תחתון — חמישה יעדים, אגודל אחד. */
.tabs {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 30; background: var(--sheet);
  border-top: 1px solid var(--rule); padding-bottom: env(safe-area-inset-bottom);
}
.tabs-in { max-width: var(--wide); margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); height: var(--bar); }
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--ink-soft); text-decoration: none; font-size: .74rem; font-weight: 600;
}
.tab svg { width: 24px; height: 24px; }
.tab[aria-current='page'] { color: var(--accent); font-weight: 800; }
.tab-new span.plus {
  width: 46px; height: 46px; border-radius: 50%; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-size: 1.7rem; line-height: 1; font-weight: 400;
}

/* ── כרטיסים ─────────────────────────────────────────────────────── */
.card { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-m); padding: var(--gap); }
.card-link { display: block; color: inherit; text-decoration: none; }
.card-link:active { background: var(--mist); }
.list { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-m); overflow: hidden; }
.list > * { display: flex; align-items: center; gap: 12px; padding: 14px var(--gap); color: inherit; text-decoration: none; min-height: var(--tap); }
.list > * + * { border-top: 1px solid var(--rule); }
.list > a:active { background: var(--mist); }
.list .end { margin-inline-start: auto; text-align: end; flex-shrink: 0; }
.list strong { display: block; font-weight: 700; }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-m); padding: 14px; color: inherit; text-decoration: none; display: block; }
.stat-label { font-size: .84rem; color: var(--ink-soft); font-weight: 600; }
.stat-value { font-size: 1.55rem; font-weight: 800; letter-spacing: -0.02em; margin-top: 2px; }

.section-title { font-size: .84rem; font-weight: 700; color: var(--ink-soft); margin: 26px 4px 8px; }

/* ── כפתורים ─────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 20px; border-radius: var(--r-m);
  border: 1px solid var(--rule-strong); background: var(--sheet); color: var(--ink);
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; text-align: center;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { background: var(--mist); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:active { background: var(--ink); border-color: var(--ink); }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #FFFFFF; }
.btn-danger { color: var(--stop); border-color: var(--stop); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--accent); padding: 0 10px; }
.btn-block { display: flex; width: 100%; }
.btn-huge { min-height: 68px; font-size: 1.25rem; font-weight: 800; border-radius: var(--r-l); }
.btn-s { min-height: 40px; padding: 0 14px; font-size: .9rem; border-radius: 10px; }
.btn[disabled], .btn[aria-disabled='true'] { background: var(--mist); border-color: var(--rule); color: var(--ink-soft); cursor: not-allowed; }
.btn-row { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 10px; }

/* ── טפסים ───────────────────────────────────────────────────────── */
.field { display: block; }
.field + .field { margin-top: 14px; }
.label { display: block; font-weight: 700; font-size: .92rem; margin-bottom: 6px; }
.hint { display: block; font-size: .84rem; color: var(--ink-soft); margin-top: 4px; }
input[type='text'], input[type='tel'], input[type='email'], input[type='password'], input[type='number'],
input[type='date'], input[type='search'], select, textarea {
  width: 100%; min-height: var(--tap); padding: 10px 14px; border-radius: 12px;
  border: 1.5px solid var(--rule-strong); background: var(--sheet); color: var(--ink);
  font: inherit; font-size: 1.05rem; appearance: none;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2314181F' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-position: left 14px center; background-size: 12px 8px; background-repeat: no-repeat; padding-inline-end: 38px;
}
input:focus, select:focus, textarea:focus { outline: 3px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
input[dir='ltr'], input[type='number'] { text-align: start; }
.errorlist { list-style: none; margin: 6px 0 0; padding: 0; color: var(--stop); font-size: .9rem; font-weight: 600; }
.check { display: flex; align-items: center; gap: 12px; min-height: var(--tap); cursor: pointer; }
.check input { width: 26px; height: 26px; accent-color: var(--accent); flex-shrink: 0; }

/* שדה מידה גדול עם צעדים. מקלדת מספרים, ספרות ענקיות. */
.measure { display: grid; grid-template-columns: 60px 1fr 60px; gap: 8px; align-items: stretch; }
.measure input { text-align: center; font-size: 1.6rem; font-weight: 800; min-height: 62px; padding: 6px; font-variant-numeric: tabular-nums; }
.measure button { border-radius: 12px; border: 1.5px solid var(--rule-strong); background: var(--sheet); font: inherit; font-size: 1.6rem; font-weight: 700; color: var(--ink); cursor: pointer; }
.measure button:active { background: var(--mist); }
.measure-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.measure-grid > .field + .field { margin-top: 0; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.pair > .field + .field { margin-top: 0; }
.unit-tag { font-weight: 600; color: var(--ink-soft); font-size: .84rem; }

/* בחירה מתוך כמה — כפתורים גדולים במקום רשימה נפתחת. */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.seg label { position: relative; }
.seg input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; appearance: none; cursor: pointer; border-radius: 12px; }
.seg span { display: grid; place-items: center; min-height: var(--tap); border: 1.5px solid var(--rule-strong); border-radius: 12px; font-weight: 700; padding: 4px 8px; text-align: center; background: var(--sheet); }
.seg input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.seg input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile {
  background: var(--sheet); border: 1.5px solid var(--rule); border-radius: var(--r-m); padding: 16px 14px;
  color: inherit; text-decoration: none; display: flex; flex-direction: column; gap: 4px; min-height: 92px;
  font: inherit; text-align: start; cursor: pointer; position: relative;
}
.tile:active { background: var(--mist); }
.tile strong { font-size: 1.05rem; font-weight: 800; }
.tile input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; appearance: none; border-radius: var(--r-m); cursor: pointer; }
.tile:has(input:checked) { border-color: var(--accent); background: var(--accent-tint); }

details.fold { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-m); }
details.fold > summary { list-style: none; cursor: pointer; padding: 14px var(--gap); font-weight: 700; display: flex; justify-content: space-between; align-items: center; min-height: var(--tap); }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::after { content: '+'; font-size: 1.4rem; color: var(--ink-soft); line-height: 1; }
details.fold[open] > summary::after { content: '−'; }
details.fold > .fold-body { padding: 0 var(--gap) var(--gap); }

/* ── תגיות מצב ───────────────────────────────────────────────────── */
.tag { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 99px; font-size: .78rem; font-weight: 700; background: var(--mist); color: var(--ink); white-space: nowrap; }
.tag-ok { background: var(--ok-bg); color: var(--ok); }
.tag-warn { background: var(--warn-bg); color: var(--warn); }
.tag-stop { background: var(--stop-bg); color: var(--stop); }
.tag-accent { background: var(--accent-tint); color: var(--accent); }

.note { border-radius: var(--r-m); padding: 12px 14px; border: 1px solid var(--rule); background: var(--sheet); font-size: .95rem; }
.note-warn { background: var(--warn-bg); border-color: var(--warn); color: var(--warn); }
.note-stop { background: var(--stop-bg); border-color: var(--stop); color: var(--stop); }
.note-ok { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); }

/* ── מצב ריק ─────────────────────────────────────────────────────── */
.empty { text-align: center; padding: 44px 20px; background: var(--sheet); border: 1.5px dashed var(--rule-strong); border-radius: var(--r-l); }
.empty h2 { margin-bottom: 6px; }
.empty p { color: var(--ink-soft); margin-bottom: 20px; }
.empty-art { width: 72px; height: 72px; margin: 0 auto 14px; border-radius: 20px; background: var(--accent-tint); color: var(--accent); display: grid; place-items: center; }
.empty-art svg { width: 36px; height: 36px; }

/* ── סרגל פעולה דביק ─────────────────────────────────────────────── */
.bar {
  position: fixed; inset-inline: 0; bottom: calc(var(--bar) + env(safe-area-inset-bottom)); z-index: 25;
  background: var(--sheet); border-top: 2px solid var(--ink);
}
.bar.no-tabs { bottom: 0; padding-bottom: env(safe-area-inset-bottom); }
.bar-in { max-width: var(--wide); margin: 0 auto; padding: 10px var(--gap); }
.bar-figures { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: flex-end; padding-bottom: 8px; }
.figure { flex-shrink: 0; }
.figure-label { font-size: .74rem; color: var(--ink-soft); font-weight: 600; display: block; }
.figure-value { font-weight: 800; font-size: 1.02rem; font-variant-numeric: tabular-nums; }
.figure-main { margin-inline-start: auto; text-align: end; }
.figure-main .figure-value { font-size: 1.45rem; color: var(--accent); }
.cost-only[data-hidden='1'] { display: none; }

/* ── שורות הצעה ──────────────────────────────────────────────────── */
.item { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-m); padding: 14px var(--gap); }
.item-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.item-title { font-weight: 800; font-size: 1.05rem; }
.item-price { font-weight: 800; font-size: 1.1rem; white-space: nowrap; }
.item-meta { color: var(--ink-soft); font-size: .9rem; margin-top: 2px; }
.item-tools { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--rule); align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--rule-strong); background: var(--sheet); font: inherit; font-size: .88rem; font-weight: 700; cursor: pointer; color: var(--ink); text-decoration: none; }
.chip[aria-pressed='true'] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip select { min-height: 36px; border: 0; padding: 0; padding-inline-end: 22px; background-position: left 2px center; font-size: .88rem; font-weight: 700; background-color: transparent; width: auto; }
.chip-danger { color: var(--stop); border-color: var(--stop); }

.mats { width: 100%; border-collapse: collapse; font-size: .9rem; }
.mats td { padding: 7px 0; border-top: 1px solid var(--rule); }
.mats td:last-child { text-align: end; white-space: nowrap; font-weight: 700; }
.mats tr:first-child td { border-top: 0; }

.totals { width: 100%; border-collapse: collapse; }
.totals td { padding: 6px 0; }
.totals td:last-child { text-align: end; font-weight: 700; }
.totals .grand td { border-top: 2px solid var(--ink); padding-top: 12px; font-size: 1.3rem; font-weight: 900; }

/* ציר אירועים */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--rule); }
.timeline li:first-child { border-top: 0; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); margin-top: 8px; flex-shrink: 0; }

.linkbox { display: flex; gap: 8px; align-items: stretch; }
.linkbox input { font-size: .9rem; direction: ltr; background: var(--mist); }

/* ── הודעות צפות ─────────────────────────────────────────────────── */
.toasts { position: fixed; inset-inline: var(--gap); bottom: calc(var(--bar) * 2 + 30px); z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  pointer-events: auto; background: var(--ink); color: #FFFFFF; border-radius: 12px; padding: 12px 16px;
  font-weight: 600; display: flex; gap: 14px; align-items: center; max-width: 100%;
}
.toast button { background: transparent; border: 0; color: #FFFFFF; font: inherit; font-weight: 800; text-decoration: underline; cursor: pointer; padding: 4px; }
.toast-stop { background: var(--stop); }

/* שלד טעינה — פס שמחליף ערך שעוד מחושב. */
.skel { display: inline-block; min-width: 3.5em; height: 1em; border-radius: 6px; background: var(--mist); vertical-align: middle; }
.busy .figure-value { color: var(--ink-soft); }

/* ── דפי כניסה ונחיתה ────────────────────────────────────────────── */
.auth { max-width: 440px; margin: 0 auto; padding: 28px var(--gap) 60px; }
.auth .brand { justify-content: center; margin-bottom: 26px; font-size: 1.4rem; }
.hero { padding: 36px 0 8px; }
.hero h1 { font-size: 2.2rem; line-height: 1.1; letter-spacing: -0.03em; }
.hero p { font-size: 1.12rem; color: var(--ink-soft); margin-top: 12px; }
.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.steps li { counter-increment: step; display: flex; gap: 14px; padding: 14px 0; border-top: 1px solid var(--rule); align-items: baseline; }
.steps li::before { content: counter(step); font-weight: 900; font-size: 1.3rem; color: var(--accent); min-width: 1.2em; }

/* מסך רחב — אותו טור, רק נושם יותר. */
@media (min-width: 560px) {
  .measure-grid { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 760px) {
  body { font-size: 18px; }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .tiles { grid-template-columns: repeat(3, 1fr); }
}

/* תנועה: רק כניסת הודעה צפה, ורק למי שלא ביקש פחות תנועה. */
@media (prefers-reduced-motion: no-preference) {
  .toast { animation: toast-in .18s ease-out; }
  @keyframes toast-in { from { transform: translateY(10px); } to { transform: none; } }
}

/* עזרים קטנים שהחליפו סגנון בתוך תבנית. */
.contents { display: contents; }
fieldset.card { margin-inline: 0; min-width: 0; }
.stat-value.is-text { font-size: 1.1rem; }
.signature { background: var(--sheet); border-radius: 8px; border: 1px solid var(--rule); }
.fold-in-card { margin-top: 8px; }
