:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --ink: #16202e;
  --muted: #64748b;
  --line: #dde3ea;
  --accent: #1d5aa0;
  --accent-soft: #eaf1fa;
  --ok: #12805c;
  --ok-soft: #e6f5ef;
  --warn: #b45309;
  --warn-soft: #fdf3e3;
  --bad: #b42318;
  --bad-soft: #fdeceb;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 32, 46, .06), 0 8px 24px rgba(16, 32, 46, .06);
}

* { box-sizing: border-box; }

/* חוקי display של .btn/.row גוברים על תכונת hidden — מחזירים לה עדיפות */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: "Heebo", "Segoe UI", "Arial Hebrew", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  direction: rtl;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--accent); }

.wrap { max-width: 1080px; margin: 0 auto; padding: 24px 20px 64px; }
.wrap.narrow { max-width: 760px; }

header.top {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
header.top .inner {
  max-width: 1080px; margin: 0 auto; padding: 14px 20px;
  display: flex; align-items: center; gap: 14px;
}
header.top h1 { font-size: 18px; margin: 0; font-weight: 700; letter-spacing: -.2px; }
header.top .sub { color: var(--muted); font-size: 13px; margin: 0; }
header.top .spacer { flex: 1; }

.logo {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  background: var(--accent); color: #fff;
  display: grid; place-items: center; font-size: 17px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.card h2 { margin: 0 0 4px; font-size: 17px; }
.card .hint { color: var(--muted); font-size: 13px; margin: 0 0 18px; }

label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }

input[type=text], input[type=email], input[type=tel], input[type=password],
input[type=date], textarea, select {
  width: 100%; padding: 10px 12px; font: inherit; font-size: 14px;
  border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink);
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { resize: vertical; min-height: 68px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 18px; font: inherit; font-size: 14px; font-weight: 600;
  border-radius: 9px; border: 1px solid transparent; cursor: pointer;
  background: var(--accent); color: #fff; transition: filter .15s, background .15s;
}
.btn:hover:not(:disabled) { filter: brightness(1.08); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover:not(:disabled) { background: #f7f9fc; filter: none; }
.btn.danger { background: var(--bad); }
.btn.sm { padding: 6px 12px; font-size: 12.5px; border-radius: 7px; }
.btn.wide { width: 100%; padding: 13px; font-size: 15px; }

.drop {
  border: 2px dashed var(--line); border-radius: 12px; padding: 30px 20px;
  text-align: center; cursor: pointer; background: #fafbfd; transition: .15s;
}
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop .big { font-size: 15px; font-weight: 600; }
.drop .small { color: var(--muted); font-size: 13px; }
.drop.has-file { border-style: solid; border-color: var(--ok); background: var(--ok-soft); }

.signer-row {
  display: grid; grid-template-columns: 1.3fr 1fr 1.3fr .9fr auto; gap: 8px;
  margin-bottom: 8px; align-items: center;
}
.signer-row input { padding: 8px 10px; font-size: 13.5px; }
.icon-btn {
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  width: 34px; height: 34px; border-radius: 8px; cursor: pointer; font-size: 16px; line-height: 1;
}
.icon-btn:hover { color: var(--bad); border-color: var(--bad); }

.pill {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.pill.pending  { background: #eef1f5; color: var(--muted); }
.pill.viewed   { background: var(--warn-soft); color: var(--warn); }
.pill.signed   { background: var(--ok-soft); color: var(--ok); }
.pill.declined { background: var(--bad-soft); color: var(--bad); }
.pill.sent      { background: var(--accent-soft); color: var(--accent); }
.pill.completed { background: var(--ok-soft); color: var(--ok); }
.pill.cancelled { background: #eef1f5; color: var(--muted); }

.doc-item {
  display: flex; align-items: center; gap: 14px; padding: 14px 4px;
  border-bottom: 1px solid var(--line); cursor: pointer;
}
.doc-item:last-child { border-bottom: none; }
.doc-item:hover { background: #fafbfd; }
.doc-item .name { font-weight: 600; font-size: 14.5px; }
.doc-item .meta { color: var(--muted); font-size: 12.5px; }
.doc-item .grow { flex: 1; min-width: 0; }
.doc-item .name, .doc-item .meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.bar { height: 6px; background: #eef1f5; border-radius: 99px; overflow: hidden; width: 110px; flex: none; }
.bar > i { display: block; height: 100%; background: var(--ok); border-radius: 99px; }

.link-row {
  display: flex; align-items: center; gap: 8px; margin-top: 8px;
  background: #f7f9fc; border: 1px solid var(--line); border-radius: 8px; padding: 6px 6px 6px 10px;
}
.link-row code {
  flex: 1; direction: ltr; text-align: left; font-size: 11.5px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: ui-monospace, Consolas, monospace;
}

.mono { direction: ltr; text-align: left; font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.notice { padding: 12px 14px; border-radius: 10px; font-size: 13.5px; margin-bottom: 14px; }
.notice.err { background: var(--bad-soft); color: var(--bad); }
.notice.ok  { background: var(--ok-soft); color: var(--ok); }
.notice.info{ background: var(--accent-soft); color: var(--accent); }
.notice:empty { display: none; }

.pdfbox {
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  background: #525659; height: 62vh; min-height: 380px;
}
.pdfbox iframe, .pdfbox embed { width: 100%; height: 100%; border: 0; display: block; }

.padbox { border: 1px solid var(--line); border-radius: 12px; background: #fff; overflow: hidden; }
#pad { display: block; width: 100%; height: 190px; touch-action: none; cursor: crosshair; background: #fff; }
.padbox .padfoot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; border-top: 1px solid var(--line); background: #fafbfd; font-size: 12.5px;
}

.consent {
  display: flex; gap: 10px; align-items: flex-start; padding: 14px;
  background: #f7f9fc; border: 1px solid var(--line); border-radius: 10px; font-size: 13.5px;
}
.consent input { margin-top: 4px; width: 17px; height: 17px; flex: none; accent-color: var(--accent); }

.timeline { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.timeline li { padding: 7px 0; border-bottom: 1px dashed var(--line); display: flex; gap: 10px; }
.timeline li:last-child { border-bottom: none; }
.timeline .t { color: var(--muted); flex: none; font-size: 12px; min-width: 118px; }

.big-ok { font-size: 44px; line-height: 1; }

@media (max-width: 720px) {
  .signer-row { grid-template-columns: 1fr 1fr; }
  .signer-row .icon-btn { grid-column: 2; justify-self: end; }
  .grid2 { grid-template-columns: 1fr; }
  .wrap { padding: 16px 14px 48px; }
  .card { padding: 16px; }
  .pdfbox { height: 52vh; }
}
