@font-face {
  font-family: "Assistant"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url("/fonts/Assistant-hebrew.woff2") format("woff2");
  unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F;
}
@font-face {
  font-family: "Assistant"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url("/fonts/Assistant-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+2000-206F, U+2212;
}

/* צבעים - אותה שפה של מערכת היציאות (DESIGN.md שם) */
:root {
  --navy: #14284f; --navy-deep: #0b1730; --navy-line: #24375f;
  --gold: #c4aa72; --gold-bright: #dcc493; --gold-soft: #f6efdf; --gold-ink: #6e5521;
  --flame: #1f9ad6; --flame-deep: #1786c0; --now-soft: #e1f1fb; --now-ink: #0b6fa8;
  --on-navy: #fff; --on-navy-soft: #b9c5dc;
  --bg: #f3f5f8; --surface: #fff; --surface-2: #f6f8fb;
  --border: #dfe4ec; --border-strong: #c3ccda;
  --text: #0f1e3d; --text-soft: #4a5a78; --text-faint: #66758f;
  --ok: #1d7f53; --ok-soft: #e3f3ea;
  --danger: #c2342c; --danger-soft: #fbe6e4;
  --warn: #9a5a0a; --warn-soft: #fbf0d9;
  --r-sm: 10px; --r-md: 14px;
  --shadow: 0 1px 2px rgb(15 30 61 / .06), 0 4px 14px rgb(15 30 61 / .06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #081226; --surface: #0f1d38; --surface-2: #132446;
    --border: #22355c; --border-strong: #31476f;
    --text: #eef2f9; --text-soft: #b9c5dc; --text-faint: #8e9cb8;
    --ok-soft: #12352a; --ok: #5fcf99; --danger-soft: #3d1a1c; --danger: #ff8a80;
    --now-soft: #0f3150; --now-ink: #7cc7f0; --gold-soft: #2e2716; --gold-ink: #e6cf9b;
    --warn-soft: #3a2a0f; --warn: #f0b860;
    --shadow: 0 1px 2px rgb(0 0 0 / .3);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Assistant", "Segoe UI", "Noto Sans Hebrew", Arial, sans-serif;
  font-size: 17px; line-height: 1.5; color: var(--text); background: var(--bg);
  font-feature-settings: "tnum"; -webkit-tap-highlight-color: transparent;
  user-select: none; -webkit-user-select: none; overscroll-behavior: none;
  display: flex; flex-direction: column;
}
input, textarea { user-select: text; -webkit-user-select: text; }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

/* ---------- סרגל עליון ---------- */
.top {
  display: flex; align-items: center; gap: 16px; padding: 10px 20px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: var(--navy); color: var(--on-navy); border-bottom: 3px solid var(--gold);
}
.logo { height: 42px; width: auto; }
.top-title { flex: 1; display: flex; align-items: baseline; gap: 12px; }
.top h1 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -.01em; }
.mock { font-size: 12px; font-weight: 700; background: var(--gold); color: var(--navy-deep); padding: 2px 10px; border-radius: 999px; }
.clock { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; }
#clockTime { font-size: 26px; font-weight: 800; }
#clockDate { font-size: 13px; color: var(--on-navy-soft); }
.icon-btn { background: transparent; border: 1px solid var(--navy-line); border-radius: var(--r-sm); width: 44px; height: 44px; display: grid; place-items: center; color: var(--on-navy-soft); }
.icon-btn:active { background: var(--navy-line); }

main { flex: 1; overflow: auto; padding: 20px; padding-bottom: max(20px, env(safe-area-inset-bottom)); }
.wrap { max-width: 1180px; margin: 0 auto; }

/* ---------- מסך ראשי ---------- */
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.big-action {
  display: flex; align-items: center; gap: 16px; padding: 22px 26px; border-radius: var(--r-md);
  border: 0; text-align: start; box-shadow: var(--shadow); min-height: 96px;
}
.big-action .ico { width: 52px; height: 52px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.big-action b { display: block; font-size: 28px; font-weight: 800; line-height: 1.1; }
.big-action small { font-size: 15px; opacity: .85; }
.big-action.lend { background: var(--navy); color: #fff; }
.big-action.lend .ico { background: var(--flame); }
.big-action.ret { background: var(--surface); color: var(--text); border: 2px solid var(--gold); }
.big-action.ret .ico { background: var(--gold); color: var(--navy-deep); }
.big-action:active { transform: scale(.99); }
.big-action:disabled { opacity: .45; }

.board-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 2px 12px; flex-wrap: wrap; }
.board-head h2 { margin: 0; font-size: 19px; font-weight: 800; }
.counts { display: flex; gap: 8px; flex-wrap: wrap; }
.count { font-size: 14px; font-weight: 700; padding: 4px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--text-soft); }
.count i { font-style: normal; display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-inline-end: 6px; vertical-align: 1px; }

/* ---------- קוביות המחשבים ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.tile {
  position: relative; display: flex; flex-direction: column; align-items: stretch; gap: 2px;
  min-height: 92px; padding: 10px 12px; border-radius: var(--r-sm); text-align: start;
  background: var(--surface); border: 1.5px solid var(--border); box-shadow: var(--shadow);
}
.tile .num { font-size: 30px; font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.tile .who { font-size: 14px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .sub { font-size: 12px; color: var(--text-faint); }
.tile.free .who { color: var(--ok); }
.tile.out { background: var(--now-soft); border-color: color-mix(in srgb, var(--flame) 45%, transparent); }
.tile.out .who { color: var(--now-ink); }
.tile.broken, .tile.retired { background: var(--surface-2); border-style: dashed; }
.tile.broken .who { color: var(--danger); }
.tile.retired { opacity: .55; }
.tile.overdue::after { content: ""; position: absolute; inset-inline-end: 10px; top: 12px; width: 9px; height: 9px; border-radius: 50%; background: var(--warn); }

/* בחירה */
.tile.pick:disabled { opacity: .5; box-shadow: none; cursor: default; }
.tile.pick.sel { background: var(--gold-soft); border-color: var(--gold); border-width: 2.5px; padding: 9px 11px; }
.tile .check { position: absolute; inset-inline-end: 8px; top: 8px; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--border-strong); display: grid; place-items: center; }
.tile.sel .check { background: var(--gold); border-color: var(--gold); color: var(--navy-deep); }
.tile .flag { margin-top: 6px; align-self: flex-start; font-size: 13px; font-weight: 700; border: 1px solid var(--border-strong); background: var(--surface); border-radius: 999px; padding: 3px 10px; color: var(--text-soft); }
.tile .flag.on { background: var(--danger); border-color: var(--danger); color: #fff; }

/* ---------- תהליך ---------- */
.step-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.step-head h2 { margin: 0; font-size: 24px; font-weight: 800; flex: 1; }
.step-head .kind { font-size: 13px; font-weight: 800; padding: 3px 12px; border-radius: 999px; background: var(--navy); color: #fff; }
.step-head .kind.ret { background: var(--gold); color: var(--navy-deep); }
.steps { display: flex; gap: 6px; }
.steps span { width: 34px; height: 6px; border-radius: 3px; background: var(--border); }
.steps span.on { background: var(--gold); }
.btn {
  border-radius: var(--r-sm); border: 1.5px solid var(--border-strong); background: var(--surface);
  padding: 12px 22px; font-size: 17px; font-weight: 700; min-height: 52px;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.gold { background: var(--gold); border-color: var(--gold); color: var(--navy-deep); }
.btn:disabled { opacity: .45; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-soft); }

.search {
  width: 100%; font: inherit; font-size: 19px; padding: 14px 18px; border-radius: var(--r-sm);
  border: 1.5px solid var(--border-strong); background: var(--surface); color: var(--text); margin-bottom: 14px;
}
.search:focus { outline: 3px solid color-mix(in srgb, var(--flame) 40%, transparent); border-color: var(--flame); }
.names { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.name-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; text-align: start;
  min-height: 60px; padding: 10px 16px; border-radius: var(--r-sm); border: 1.5px solid var(--border);
  background: var(--surface); font-size: 18px; font-weight: 700; box-shadow: var(--shadow);
}
.name-btn:active, .name-btn.sel { border-color: var(--gold); background: var(--gold-soft); }
.name-btn .pill { font-size: 13px; font-weight: 800; background: var(--now-soft); color: var(--now-ink); border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.empty { text-align: center; color: var(--text-faint); padding: 40px 10px; font-size: 18px; }

.bar {
  position: sticky; bottom: -20px; margin: 18px -20px -20px; padding: 14px 20px;
  padding-bottom: max(14px, env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--border); display: flex; align-items: center; gap: 12px;
  box-shadow: 0 -6px 16px rgb(15 30 61 / .06);
}
.bar .info { flex: 1; font-size: 18px; font-weight: 700; }
.bar .info small { display: block; font-size: 14px; font-weight: 600; color: var(--text-soft); }
.tools { display: flex; gap: 8px; margin-bottom: 12px; }
.tools .btn { min-height: 42px; padding: 6px 16px; font-size: 15px; }

/* ---------- חתימה ---------- */
.sign { display: grid; grid-template-columns: 1fr 340px; gap: 22px; align-items: start; }
.summary { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 18px 20px; margin-bottom: 18px; box-shadow: var(--shadow); }
.summary dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; }
.summary dt { color: var(--text-soft); font-weight: 600; }
.summary dd { margin: 0; font-weight: 800; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-weight: 800; font-size: 15px; padding: 2px 10px; border-radius: 6px; background: var(--gold-soft); color: var(--gold-ink); }
.chip.bad { background: var(--danger-soft); color: var(--danger); }
.label { font-size: 14px; font-weight: 700; color: var(--text-soft); margin: 0 2px 8px; }

.pinpad { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 18px; box-shadow: var(--shadow); }
.pinpad .who { text-align: center; font-weight: 800; font-size: 17px; min-height: 26px; }
.dots { display: flex; justify-content: center; gap: 14px; margin: 12px 0 16px; }
.dots i { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border-strong); }
.dots i.on { background: var(--navy); border-color: var(--navy); }
@media (prefers-color-scheme: dark) { .dots i.on { background: var(--gold); border-color: var(--gold); } }
.dots.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(8px); } 50% { transform: translateX(-8px); } 75% { transform: translateX(4px); } }
.keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; direction: ltr; }
.keys button { height: 64px; border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--surface-2); font-size: 26px; font-weight: 700; }
.keys button:active { background: var(--gold-soft); }
.keys button:disabled { opacity: .35; }
.pin-err { text-align: center; color: var(--danger); font-weight: 700; min-height: 24px; margin-top: 10px; }
@media (prefers-reduced-motion: reduce) { .dots.shake { animation: none; } }

/* ---------- סיום ---------- */
.done { max-width: 620px; margin: 30px auto; text-align: center; }
.done .mark { width: 92px; height: 92px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: grid; place-items: center; margin: 0 auto 16px; }
.done h2 { font-size: 30px; margin: 0 0 6px; }
.done p { color: var(--text-soft); font-size: 18px; margin: 4px 0; }
.done .summary { text-align: start; margin: 22px 0; }

/* ---------- חלון תחתון ---------- */
.sheet { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; }
.sheet-backdrop { position: absolute; inset: 0; background: rgb(5 12 28 / .55); }
.sheet-card { position: relative; width: min(520px, calc(100% - 32px)); max-height: 86vh; overflow: auto; background: var(--surface); border-radius: var(--r-md); padding: 22px; box-shadow: 0 20px 50px rgb(0 0 0 / .3); }
.sheet-card h3 { margin: 0 0 12px; font-size: 22px; }
.sheet-card textarea { width: 100%; font: inherit; padding: 12px; border-radius: var(--r-sm); border: 1.5px solid var(--border-strong); background: var(--surface-2); color: var(--text); min-height: 90px; resize: vertical; }
.sheet-card .row { display: flex; gap: 10px; justify-content: flex-start; margin-top: 16px; flex-wrap: wrap; }
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.quick button { border: 1px solid var(--border-strong); background: var(--surface-2); border-radius: 999px; padding: 6px 14px; font-weight: 700; font-size: 15px; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 30; background: var(--danger); color: #fff; padding: 14px 24px; border-radius: var(--r-sm); font-weight: 700; box-shadow: 0 10px 30px rgb(0 0 0 / .25); max-width: 90vw; }
.toast.ok { background: var(--ok); }

/* ---------- ניהול ---------- */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 16px; flex-wrap: wrap; }
.tabs button { border: 0; background: transparent; padding: 12px 18px; font-weight: 700; font-size: 17px; color: var(--text-soft); border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--text); border-bottom-color: var(--gold); }
.table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--r-md); overflow: hidden; box-shadow: var(--shadow); }
.table th, .table td { padding: 10px 14px; border-bottom: 1px solid var(--border); text-align: start; font-size: 15px; }
.table th { background: var(--surface-2); font-size: 13px; color: var(--text-soft); font-weight: 700; position: sticky; top: 0; }
.table tr:last-child td { border-bottom: 0; }
.muted { color: var(--text-faint); }
.btn.small { min-height: 0; padding: 4px 12px; font-size: 14px; }
.table tr.off td { opacity: .5; }
.toggle { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.toggle input { width: 22px; height: 22px; accent-color: var(--navy); }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: 6px 12px; font-size: 14px; font-weight: 700; }
.seg button.on { background: var(--navy); color: #fff; }
.filters { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.filters select, .filters input { font: inherit; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); }
.table-wrap { overflow: auto; max-height: calc(100vh - 290px); border-radius: var(--r-md); }

@media (max-width: 820px) {
  .sign { grid-template-columns: 1fr; }
  .actions { grid-template-columns: 1fr; }
  .top h1 { font-size: 20px; }
  .logo { height: 34px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
}
@media (max-width: 520px) { .clock #clockDate { display: none; } main { padding: 14px; } .bar { margin: 18px -14px -14px; } }
