:root {
  --paper: #f3eee4;
  --paper-2: #ebe4d6;
  --card: #fbf8f1;
  --ink: #26221d;
  --ink-2: #5d564b;
  --ink-3: #8c8374;
  --rule: #d8cfbd;
  --accent: #a8431f;      /* טרקוטה — פעולות */
  --accent-ink: #fff8f0;
  --ok: #3d6b45;          /* ירוק מחובר */
  --bad: #a3262a;
  --serif: 'Frank Ruhl Libre', 'David Libre', Georgia, serif;
  --sans: 'Heebo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--sans); font-size: 16px; line-height: 1.5;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- סרגל עליון ---------- */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 28px;
  padding: 14px clamp(16px, 4vw, 48px);
  background: var(--paper); border-bottom: 1px solid var(--rule);
}
.wordmark {
  font-family: var(--serif); font-weight: 900; font-size: 26px; letter-spacing: -.01em;
  color: var(--ink); text-decoration: none; direction: ltr;
}
.wordmark span { color: var(--accent); }
.projects { display: flex; align-items: center; gap: 4px; flex: 1; }
.crumb-sep { color: var(--ink-3); font-size: 20px; padding: 0 4px; }
.projects a {
  padding: 6px 14px; border-radius: 99px; text-decoration: none; color: var(--ink-2);
  font-weight: 500; transition: background .2s, color .2s;
}
.projects a:hover { background: var(--paper-2); }
.projects a[aria-current="page"] { background: var(--ink); color: var(--paper); }
.topbar-end { display: flex; align-items: center; gap: 14px; color: var(--ink-3); font-size: 14px; }

/* ---------- כללי ---------- */
.view { max-width: 1040px; margin: 0 auto; padding: 36px clamp(16px, 4vw, 48px) 80px; }
.view > * { animation: rise .5s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.eyebrow { font-size: 13px; letter-spacing: .08em; color: var(--ink-3); font-weight: 500; }
h1, h2, h3 { font-family: var(--serif); margin: 0; line-height: 1.15; }
h1 { font-size: clamp(32px, 5vw, 46px); font-weight: 900; }
h2 { font-size: 24px; font-weight: 700; }
h3 { font-size: 18px; font-weight: 700; }
.muted { color: var(--ink-3); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px; border-radius: 10px; border: 1.5px solid var(--ink);
  background: var(--ink); color: var(--paper); font-weight: 700;
  transition: transform .15s var(--ease), background .2s, color .2s, border-color .2s;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn[disabled] { opacity: .45; cursor: default; transform: none; }
.btn.accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: var(--paper-2); }
.btn.danger { background: transparent; color: var(--bad); border-color: var(--bad); }
.btn.danger:hover { background: var(--bad); color: #fff; }
.btn.small { min-height: 36px; padding: 0 14px; font-size: 14px; }

input[type=text], input[type=email], input[type=password] {
  width: 100%; min-height: 46px; padding: 0 14px; border-radius: 10px;
  border: 1.5px solid var(--rule); background: var(--card);
  transition: border-color .2s, box-shadow .2s;
}
input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(38, 34, 29, .08); }
label.field { display: block; font-size: 14px; color: var(--ink-2); font-weight: 500; margin-bottom: 14px; }
label.field > span { display: block; margin-bottom: 6px; }
.ltr { direction: ltr; text-align: left; }
.err { color: var(--bad); font-weight: 500; min-height: 1.4em; margin: 6px 0 0; }

/* ---------- התחברות ---------- */
.login { max-width: 420px; margin: 8vh auto 0; }
.login h1 { margin: 6px 0 28px; }
.login .btn { width: 100%; margin-top: 10px; }

/* ---------- דף הבית: רשימת הפרויקטים ---------- */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-top: 32px; }
.project-card {
  display: flex; flex-direction: column; gap: 8px; padding: 24px; text-decoration: none; color: inherit;
  background: var(--card); border: 1px solid var(--rule); border-radius: 14px;
  transition: border-color .25s, box-shadow .3s var(--ease), transform .2s var(--ease);
  animation: rise .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 60ms);
}
.project-card:hover { border-color: var(--ink); box-shadow: 0 10px 30px -18px rgba(38, 34, 29, .45); transform: translateY(-2px); }
.project-name { font-family: var(--serif); font-weight: 900; font-size: 30px; line-height: 1.1; }
.project-card p { margin: 0; flex: 1; }
.project-go { font-weight: 700; color: var(--accent); margin-top: 8px; }

/* ---------- ראש הדף + סיכום ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.page-head .actions { display: flex; gap: 10px; }

.summary {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin: 32px 0 8px; border-top: 2px solid var(--ink); border-bottom: 1px solid var(--rule);
}
.stat { padding: 18px 0 16px; padding-inline-end: 16px; }
.stat + .stat { padding-inline-start: 20px; border-inline-start: 1px solid var(--rule); }
.stat b { display: block; font-family: var(--serif); font-size: 44px; font-weight: 900; line-height: 1; font-variant-numeric: lining-nums; }
.stat b.txt { font-size: 28px; padding-top: 12px; }
.stat small { color: var(--ink-3); font-size: 14px; }

.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 36px 0 14px; }

/* ---------- כרטיס לקוח (נפתח במקום) ---------- */
.clients { display: grid; gap: 12px; }
.client {
  background: var(--card); border: 1px solid var(--rule); border-radius: 14px;
  transition: border-color .25s, box-shadow .3s var(--ease);
  animation: rise .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms);
}
.client:hover { border-color: #c4b9a2; }
.client[data-open="true"] { border-color: var(--ink); box-shadow: 0 10px 30px -18px rgba(38, 34, 29, .45); }
.client-head {
  width: 100%; display: grid; grid-template-columns: 14px 1fr auto 20px; align-items: center; gap: 16px;
  padding: 18px 20px; background: none; border: 0; text-align: start;
}
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--rule); }
.dot.live { background: var(--ok); box-shadow: 0 0 0 4px rgba(61, 107, 69, .16); }
.client-name { font-family: var(--serif); font-weight: 700; font-size: 22px; }
.client-sub { color: var(--ink-3); font-size: 14px; }
.nums { display: flex; gap: 22px; }
.nums div { text-align: center; line-height: 1.1; }
.nums b { display: block; font-family: var(--serif); font-size: 24px; }
.nums small { font-size: 12px; color: var(--ink-3); }
.chev { width: 14px; height: 14px; border: solid var(--ink-2); border-width: 0 0 2px 2px; transform: rotate(45deg); transition: transform .3s var(--ease); margin-top: -4px; }
.client[data-open="true"] .chev { transform: rotate(-45deg); margin-top: 4px; }

.client-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .4s var(--ease); }
.client[data-open="true"] .client-body { grid-template-rows: 1fr; }
.client-inner { overflow: hidden; min-height: 0; }
.client-content { padding: 4px 20px 22px; opacity: 0; transform: translateY(-6px); transition: opacity .3s .1s, transform .35s .1s var(--ease); }
.client[data-open="true"] .client-content { opacity: 1; transform: none; }

.block { padding: 18px 0; border-top: 1px solid var(--rule); }
.block:first-child { border-top: 0; }
.block-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.block p { margin: 0 0 10px; color: var(--ink-2); }
.rows { display: grid; }
.row { display: flex; align-items: center; gap: 14px; padding: 10px 0; border-top: 1px dashed var(--rule); }
.row:first-child { border-top: 0; }
.row .grow { flex: 1; min-width: 0; }
.row .title { font-weight: 700; }
.row .title.revoked { color: var(--ink-3); text-decoration: line-through; }
.tag { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--paper-2); color: var(--ink-2); }
.tag.bad { background: #f2d9d6; color: var(--bad); }
.tag.ok { background: #dbe8dc; color: var(--ok); }
.skeleton { height: 16px; width: 60%; border-radius: 6px; background: linear-gradient(90deg, var(--paper-2), var(--rule), var(--paper-2)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- דיאלוגים ---------- */
dialog {
  border: 0; padding: 0; background: var(--card); color: var(--ink); border-radius: 16px;
  width: min(480px, calc(100vw - 32px)); box-shadow: 0 30px 80px -20px rgba(38, 34, 29, .55);
}
dialog[open] { animation: pop .28s var(--ease); }
dialog::backdrop { background: rgba(38, 34, 29, .45); animation: fade .25s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.dlg { padding: 26px 26px 22px; }
.dlg h2 { margin-bottom: 14px; }
.dlg-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.code {
  direction: ltr; text-align: center; font-family: var(--serif); font-weight: 900; font-size: 52px;
  letter-spacing: .08em; padding: 18px 0; margin: 6px 0 14px; background: var(--paper-2); border-radius: 12px; user-select: all;
}
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--ink-2); }
.check input { margin-top: 4px; accent-color: var(--accent); }

/* ---------- הודעות ---------- */
.toasts { position: fixed; inset-inline-start: 20px; bottom: 20px; display: grid; gap: 8px; z-index: 20; }
.toast { background: var(--ink); color: var(--paper); padding: 11px 16px; border-radius: 10px; font-weight: 500; animation: pop .3s var(--ease); transition: opacity .4s; }
.toast.out { opacity: 0; }

@media (max-width: 720px) {
  .client-head { grid-template-columns: 12px 1fr 18px; }
  .client-head .nums { grid-column: 2 / 3; grid-row: 2; }
  .topbar { gap: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; animation-delay: 0ms !important; }
}
