/* ==========================================================================
   components.css — shared UI building blocks
   ========================================================================== */

/* ---------- buttons ---------- */
.btn {
  height: 38px; border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: var(--surface);
  padding: 0 14px; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-weight: 500; font-size: 14px; white-space: nowrap; text-decoration: none; color: var(--fg);
  box-shadow: 0 1px 2px rgba(27, 36, 51, .04);
  transition: background .15s, border-color .15s, box-shadow .15s, transform .08s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: 0 2px 6px rgba(47, 107, 255, .25); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); box-shadow: 0 4px 12px rgba(47, 107, 255, .3); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); border-color: #F3C6C1; }
.btn.danger.armed { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn.ghost { border-color: transparent; background: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13.5px; }
.btn.icon { width: 38px; padding: 0; }
.btn.sm.icon { width: 32px; }

.link { border: 0; background: none; color: var(--accent); font-weight: 600; font-size: 13.5px; padding: 4px 8px; border-radius: 8px; display: inline-flex; align-items: center; gap: 4px; }
.link:hover { background: var(--accent-soft); }

/* ---------- dropdown menu ---------- */
.addwrap { position: relative; }
.menu {
  position: absolute; left: 0; top: calc(100% + 8px); z-index: 20;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow-float); padding: 6px; min-width: 240px; display: grid; gap: 1px;
  animation: pop .16s var(--ease);
}
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
.menu button, .menu label {
  border: 0; background: none; text-align: right; padding: 10px 12px; border-radius: 9px;
  font-weight: 500; font-size: 14px; display: flex; align-items: center; gap: 10px; cursor: pointer;
}
.menu button:hover, .menu label:hover { background: var(--accent-soft); color: var(--accent); }
.menu button:hover .ico, .menu label:hover .ico { color: var(--accent); }
.menu .ico { color: var(--faint); }

/* ---------- tags ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 5px; border-radius: 99px;
  padding: 0 10px; height: 24px; font-size: 12.5px; font-weight: 500; white-space: nowrap; text-decoration: none;
}
.chip.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
button.chip { border: 0; cursor: pointer; font-family: inherit; }
a.chip:hover, button.chip:hover { filter: brightness(.96); }
.t-info { background: var(--info-soft); color: var(--info); }
.t-accent { background: var(--accent-soft); color: var(--accent); }
.t-violet { background: var(--violet-soft); color: var(--violet); }
.t-warn { background: var(--warn-soft); color: var(--warn); }
.t-good { background: var(--good-soft); color: var(--good); }
.t-bad { background: var(--bad-soft); color: var(--bad); }
.t-muted { background: var(--surface-2); color: var(--muted); }

/* segmented filters (soft track, white thumb) */
.chips, .tfilter, .seg {
  display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px;
  background: var(--surface-3); border-radius: 12px; width: fit-content; max-width: 100%;
}
.chips button, .tfilter button, .seg button {
  border: 0; background: none; border-radius: 9px;
  height: 32px; padding: 0 14px; font-weight: 500; font-size: 13.5px; color: var(--muted);
  transition: background .15s, color .15s, box-shadow .15s;
}
.chips button:hover, .tfilter button:hover, .seg button:hover { color: var(--fg); }
.chips button[aria-pressed="true"], .tfilter button[aria-pressed="true"], .seg button[aria-pressed="true"] {
  background: var(--surface); color: var(--fg); font-weight: 600; box-shadow: 0 1px 3px rgba(27, 36, 51, .1);
}

/* ---------- panels ---------- */
.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); align-content: start;
  padding: 0 20px 8px; box-shadow: var(--shadow-card);
}
.panel.flush { padding: 0; overflow: hidden; }
.panel-h {
  display: flex; align-items: center; gap: 10px; justify-content: space-between; flex-wrap: wrap;
  min-height: 56px; padding: 14px 20px 10px; margin: 0 -20px;
}
.panel-h h2, .panel-h h3 { font-size: 16px; font-weight: 700; }
.panel-h .meta { font-size: 13px; color: var(--muted); }
.ico-badge { display: none; }

.panel-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 18px 0 12px; }
.panel-row .txt { flex: 1 1 260px; display: grid; gap: 2px; }
.panel-row .txt b { font-weight: 700; }
.panel-row .txt span { color: var(--muted); font-size: 13.5px; }

/* ---------- banners ---------- */
.banners { display: grid; gap: 10px; }
.banner {
  border-radius: var(--r); padding: 12px 16px; display: flex; gap: 12px; align-items: center;
  flex-wrap: wrap; font-size: 14px; background: var(--accent-soft); border: 1px solid var(--accent-soft-2);
}
.banner.warn { background: var(--warn-soft); border-color: #F8E2B8; }
.banner p { flex: 1 1 260px; }

/* ---------- lists ---------- */
/* minmax(0,1fr): rows may shrink below their text width, long names get "…" instead of widening the page */
.list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); }
.row {
  min-width: 0;
  display: flex; align-items: center; gap: 14px; padding: 10px 10px; margin: 0 -10px; min-height: 60px;
  border-radius: 12px; cursor: pointer; transition: background .12s;
}
.row:hover { background: var(--surface-2); }
.row .main { flex: 1; min-width: 0; }
.row .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .s { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .end { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; min-width: 0; flex-shrink: 1; }
@media (max-width: 560px) {
  .row { flex-wrap: wrap; }
  .row .main { flex-basis: calc(100% - 64px); }
  .row .end { flex-basis: 100%; justify-content: flex-start; }
}

.datebox {
  width: 48px; flex: none; text-align: center; line-height: 1.15; padding: 6px 0;
  border-radius: 12px; background: var(--surface-2);
}
.datebox b { display: block; font-size: 18px; font-weight: 700; }
.datebox span { font-size: 11.5px; color: var(--muted); }
.datebox.today { background: var(--accent-soft); }
.datebox.today b, .datebox.today span { color: var(--accent); }

.empty { color: var(--muted); font-size: 14px; padding: 14px 0; }
.empty b { color: var(--fg); font-weight: 600; }
.empty-state { display: grid; justify-items: center; text-align: center; gap: 6px; padding: 30px 12px; color: var(--muted); font-size: 14px; }
.empty-state .ico-wrap { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 4px; }
.empty-state b { color: var(--fg); font-weight: 600; font-size: 15px; }
.hint-line { color: var(--muted); font-size: 14px; }

/* ---------- tables ---------- */
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: right; font-weight: 600; color: var(--muted); font-size: 12.5px; padding: 12px 18px; background: var(--bg); border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 13px 18px; border-bottom: 1px solid var(--line); white-space: nowrap; }
tbody tr { cursor: pointer; transition: background .12s; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }

/* ---------- forms ---------- */
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 18px; }
.field { display: grid; gap: 6px; min-width: 0; align-content: start; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 13px; font-weight: 600; color: var(--fg-2); }
.field input, .field select, .field textarea, .inp {
  width: 100%; min-height: 42px; border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--surface); padding: 8px 12px; transition: border-color .15s, box-shadow .15s;
}
.inp { width: auto; height: 38px; min-height: 0; padding: 0 10px; font-size: 14px; }
.field input:hover, .field select:hover, .field textarea:hover { border-color: #BFC8D6; }
.field input:focus, .field select:focus, .field textarea:focus, .inp:focus,
.addlog select:focus, .addlog input:focus, .addlog textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-ring);
}
.field textarea { min-height: 84px; resize: vertical; }
.field.cb { display: flex; align-items: center; gap: 10px; }
.field.cb input { width: 18px; height: 18px; min-height: 0; accent-color: var(--accent); }
.field .hint { font-size: 12.5px; color: var(--muted); }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--bad); box-shadow: 0 0 0 4px rgba(211, 58, 44, .12); }
@media (max-width: 560px) { .fields { grid-template-columns: 1fr; } }

.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 24px; align-items: center; }
.actions .spacer { flex: 1; }

/* ---------- sheets (modals) ---------- */
.scrim {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(27, 36, 51, .28);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: 16px;
  animation: fade .18s ease-out;
}
.scrim.top { z-index: 50; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.sheet {
  background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-modal);
  width: min(580px, 100%); max-height: min(90vh, 100%); overflow: auto; padding: 26px 28px;
  animation: sheetIn .28s var(--ease);
}
.sheet.wide { width: min(1060px, 100%); }
@keyframes sheetIn { from { transform: translateY(12px) scale(.985); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet h2 { font-size: 21px; font-weight: 700; }
.sheet-h { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; }
.sheet-sub { color: var(--muted); font-size: 14px; margin-top: 2px; }
.x { width: 36px; height: 36px; border-radius: 10px; border: 0; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); flex: none; }
.x:hover { background: var(--surface-3); color: var(--fg); }
.form-note { background: var(--accent-soft); color: var(--fg-2); border-radius: 12px; padding: 11px 14px; font-size: 14px; margin-bottom: 18px; }
.sec-h { font-size: 14px; font-weight: 700; margin: 0 0 10px; color: var(--fg); }

@media (max-width: 640px) {
  .scrim { padding: 0; place-items: end stretch; }
  .sheet, .sheet.wide { width: 100%; max-height: 94vh; border-radius: 22px 22px 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom, 0px)); }
}

/* ---------- toast ---------- */
.toast {
  position: fixed; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%);
  background: #1B2433; color: #fff; padding: 11px 18px; border-radius: 12px; font-weight: 500; font-size: 14px;
  z-index: 70; box-shadow: var(--shadow-float); max-width: calc(100% - 32px);
  animation: toastIn .22s var(--ease);
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- floating add button: phones / tablets only ---------- */
.fab {
  position: fixed; left: calc(16px + env(safe-area-inset-left, 0px)); bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 14; height: 50px; padding: 0 20px; border-radius: 25px; border: 0;
  background: var(--accent); color: #fff; font-weight: 600; font-size: 15px;
  display: none; align-items: center; gap: 6px; box-shadow: 0 8px 20px rgba(47, 107, 255, .35);
}
@media (max-width: 1023px) { .fab { display: inline-flex; } .fab[hidden] { display: none; } }

/* ---------- misc ---------- */
.progress { height: 8px; background: var(--surface-3); overflow: hidden; border-radius: 99px; }
.progress i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .5s var(--ease); }
.chart svg { width: 100%; height: auto; display: block; }

/* ---------- checklist field (pick several items) ---------- */
.checklist { display: grid; gap: 6px; max-height: 260px; overflow: auto; padding: 2px; }
.check-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--line);
  border-radius: 12px; cursor: pointer; background: var(--surface); transition: background .12s, border-color .12s;
}
.check-row:hover { background: var(--surface-2); }
.check-row:has(input:checked) { background: var(--accent-soft); border-color: var(--accent-soft-2); }
.check-row input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; margin: 0; }
.check-badge { font-size: 10.5px; font-weight: 700; letter-spacing: .03em; padding: 3px 6px; border-radius: 6px; background: var(--surface-2); color: var(--muted); flex: none; }
.check-txt { display: grid; min-width: 0; }
.check-txt b { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.check-txt small { color: var(--muted); font-size: 12.5px; }
.send-summary { font-size: 13.5px; color: var(--fg-2); background: var(--surface-2); border-radius: 10px; padding: 9px 12px; }
.check-tools { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.check-tools input { flex: 1; min-width: 0; height: 36px; border: 1px solid var(--line-strong); border-radius: 10px; padding: 0 10px; background: var(--surface); }
.check-tools input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-ring); }
.check-row.done { opacity: .6; }
.check-row.done .check-txt b::after { content: " · נשלח"; color: var(--good); font-weight: 600; }
