:root {
  --bg: #f5f3ee;
  --card: #ffffff;
  --ink: #18181b;
  --muted: #6b6b70;
  --line: #e6e2d8;
  --soft: #efece4;
  --accent: #1f4d3f;
  --accent-ink: #f5f3ee;
  --held-bg: #fdf0d5; --held: #8a4b06;
  --fixed-bg: #dfe9fb; --fixed: #1e3f8a;
  --ok-bg: #dcf1e2; --ok: #17633a;
  --shadow: 0 1px 2px rgb(0 0 0 / .04), 0 6px 20px rgb(0 0 0 / .05);
  --radius: 18px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212; --card: #1c1c1e; --ink: #f2f2f2; --muted: #a1a1aa; --line: #2e2e31; --soft: #252528;
    --accent: #7fc8ad; --accent-ink: #10221c;
    --held-bg: #3a2a10; --held: #f3c77b; --fixed-bg: #1b2a47; --fixed: #a9c3f5; --ok-bg: #16301f; --ok: #8fd8a8;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 15px/1.55 Heebo, -apple-system, "Segoe UI", Arial, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
button { font: inherit; color: inherit; }
img, video { display: block; max-width: 100%; }
.wrap { max-width: 560px; margin: 0 auto; padding: 0 16px 40px; }
.muted { color: var(--muted); }
.loading, .empty { text-align: center; color: var(--muted); padding: 48px 8px; }
.empty b { display: block; color: var(--ink); font-size: 17px; margin-bottom: 4px; }

/* ---------- כותרת וניווט ---------- */
.top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.brand { display: flex; align-items: center; gap: 8px; direction: ltr; }
.mark { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 800; font-size: 15px; }
.word { font-weight: 800; letter-spacing: -.2px; font-size: 16px; }
.biz { background: var(--ink); color: var(--bg); border-radius: 999px; padding: 3px 12px; font-size: 13px; font-weight: 500; }
.biz:empty { display: none; }
.pages { display: flex; gap: 6px; max-width: 560px; margin: 4px auto 0; padding: 0 16px; }
.pages a {
  flex: 1; text-align: center; text-decoration: none; color: var(--muted); font-weight: 500; padding: 9px 0;
  border-bottom: 2px solid transparent;
}
.pages a[aria-current="page"] { color: var(--ink); border-color: var(--ink); }

/* ---------- לשוניות ופעולה ראשית ---------- */
.bar { display: flex; align-items: center; gap: 10px; margin: 16px 0 14px; }
.grow { flex: 1; }
.tabs { display: flex; flex: 1; background: var(--soft); border-radius: 12px; padding: 3px; }
.tabs button {
  flex: 1; border: 0; background: none; padding: 8px 0; border-radius: 10px; cursor: pointer; color: var(--muted); font-weight: 500;
}
.tabs button[aria-selected="true"] { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.btn {
  border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 9px 14px; cursor: pointer; font-weight: 500;
  min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn:disabled { opacity: .5; cursor: default; }
.link { border: 0; background: none; color: var(--muted); text-decoration: underline; cursor: pointer; padding: 8px; }
.row-end { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }

/* ---------- כרטיס פוסט ---------- */
.day-title { font-weight: 700; margin: 22px 2px 10px; font-size: 15px; }
.day-title:first-child { margin-top: 4px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 16px; border: 1px solid var(--line); }
.card-h { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; gap: 8px; }
.when { font-weight: 700; }
.fmt { font-size: 12px; color: var(--muted); background: var(--soft); border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.media { position: relative; background: var(--soft); }
.media .track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.media .track::-webkit-scrollbar { display: none; }
.media .slide { flex: 0 0 100%; scroll-snap-align: center; }
.media img, .media video { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }
.media.tall img, .media.tall video { aspect-ratio: 9 / 16; max-height: 78vh; object-fit: contain; background: #000; }
.media.natural img { object-fit: contain; }
.media .count { position: absolute; top: 10px; left: 10px; background: rgb(0 0 0 / .6); color: #fff; font-size: 12px; border-radius: 999px; padding: 2px 9px; }
.state { margin: 12px 14px 0; border-radius: 12px; padding: 9px 12px; font-size: 14px; font-weight: 500; }
.state.held { background: var(--held-bg); color: var(--held); }
.state.fixed { background: var(--fixed-bg); color: var(--fixed); }
.state.approved, .state.published { background: var(--ok-bg); color: var(--ok); }
.title { font-weight: 700; padding: 12px 14px 0; margin: 0; }
.cap { padding: 10px 14px 0; margin: 0; white-space: pre-line; }
.cap.clamp { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.more { border: 0; background: none; color: var(--muted); padding: 2px 14px 0; cursor: pointer; }
.actions { display: flex; gap: 6px; padding: 12px 14px 14px; }
.actions .btn { flex: 1; padding: 9px 4px; font-size: 14px; }
.actions .btn.on { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.liked { padding: 0 14px 12px; color: var(--ok); font-size: 13px; }
.tags { display: flex; align-items: center; gap: 6px; }
.chip { font-size: 12px; background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 2px 9px; font-weight: 500; white-space: nowrap; }
.state .asked { display: block; font-weight: 400; margin-top: 4px; }

/* ---------- גרסאות קודמות ---------- */
.versions-btn { display: block; padding: 0 14px 12px; text-decoration: underline; }
.versions { margin: 0 14px 14px; padding-top: 10px; border-top: 1px dashed var(--line); display: flex; flex-direction: column; gap: 12px; }
.ver { border-inline-start: 3px solid var(--line); padding-inline-start: 10px; }
.ver-h { font-size: 13px; color: var(--muted); font-weight: 500; }
.ver-media { display: flex; gap: 6px; overflow-x: auto; margin: 6px 0; scrollbar-width: none; }
.ver-media img, .ver-media video { width: 56px; height: 70px; object-fit: cover; border-radius: 8px; flex: none; background: var(--soft); }
.ver-cap { margin: 0; font-size: 13px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ver-req { margin: 4px 0 0; font-size: 13px; color: var(--held); }
.ver-ok { margin: 4px 0 0; font-size: 13px; color: var(--ok); }

/* ---------- כרטיס ההתראות ---------- */
.notice { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 6px 10px 12px; margin-top: 14px; box-shadow: var(--shadow); }
.notice p { margin: 0; flex: 1; font-size: 14px; }
.notice .btn { min-height: 40px; padding: 7px 12px; white-space: nowrap; }
.notice .x { border: 0; background: none; width: 40px; height: 40px; cursor: pointer; color: var(--muted); flex: none; }
.note { padding: 0 14px 14px; }
textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font: inherit; color: var(--ink);
  background: var(--bg); resize: vertical; min-height: 90px;
}
textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------- לוח חודשי ---------- */
.cal-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-h strong { font-size: 17px; }
.cal-h button { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); cursor: pointer; font-size: 18px; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal .dow { text-align: center; font-size: 12px; color: var(--muted); padding-bottom: 2px; }
.cal .day {
  position: relative; aspect-ratio: 4 / 5; border-radius: 10px; background: var(--card); border: 1px solid var(--line);
  overflow: hidden; cursor: pointer; padding: 0; text-align: start;
}
.cal .day.out { visibility: hidden; }
.cal .day.past { opacity: .45; }
.cal .day.today { outline: 2px solid var(--ink); outline-offset: -1px; }
.cal .day.sel { outline: 2px solid var(--accent); outline-offset: -1px; }
.cal .day img, .cal .day video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cal .day .n { position: relative; z-index: 1; margin: 3px; display: inline-block; font-size: 11px; line-height: 1; padding: 3px 4px; border-radius: 6px; background: color-mix(in srgb, var(--card) 85%, transparent); }
.cal .day .dot { position: absolute; bottom: 4px; left: 4px; z-index: 1; min-width: 16px; height: 16px; border-radius: 8px; background: var(--ink); color: var(--bg); font-size: 10px; display: grid; place-items: center; padding: 0 4px; }
.cal .day .flag { position: absolute; bottom: 4px; right: 4px; z-index: 1; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--card); }
.flag.held { background: #d97706; } .flag.fixed { background: #2563eb; }

/* ---------- הפרופיל ---------- */
.prof { display: flex; align-items: center; gap: 14px; margin: 4px 0 14px; }
.avatar { width: 64px; height: 64px; border-radius: 50%; background: var(--ink); color: var(--bg); display: grid; place-items: center; font-weight: 800; font-size: 24px; flex: none; }
.prof b { font-size: 16px; }
.stories { display: flex; gap: 12px; overflow-x: auto; padding: 2px 2px 12px; scrollbar-width: none; }
.stories::-webkit-scrollbar { display: none; }
.story { border: 0; background: none; padding: 0; cursor: pointer; text-align: center; font-size: 11px; color: var(--muted); flex: none; }
.story span.ring { display: block; width: 64px; height: 64px; border-radius: 50%; padding: 3px; background: conic-gradient(var(--accent), #c9a227, var(--accent)); margin-bottom: 4px; }
.story img, .story video { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; border: 2px solid var(--bg); }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; border-radius: 12px; overflow: hidden; }
.grid button { position: relative; padding: 0; border: 0; background: var(--soft); aspect-ratio: 4 / 5; cursor: pointer; }
.grid img, .grid video { width: 100%; height: 100%; object-fit: cover; }
.grid .past img, .grid .past video { opacity: .55; }
.grid .badge { position: absolute; top: 5px; right: 5px; background: var(--ink); color: var(--bg); font-size: 11px; border-radius: 6px; padding: 1px 6px; }
.grid .badge.held { background: #d97706; color: #fff; } .grid .badge.fixed { background: #2563eb; color: #fff; }
.grid .multi { position: absolute; top: 5px; left: 6px; color: #fff; font-size: 13px; text-shadow: 0 1px 3px rgb(0 0 0 / .6); }

/* ---------- חלונות ---------- */
dialog.sheet {
  width: min(560px, 100vw); max-height: 92vh; margin: auto auto 0; border: 0; border-radius: 22px 22px 0 0; padding: 18px 16px 24px;
  background: var(--bg); color: var(--ink); overflow-y: auto;
}
@media (min-width: 640px) { dialog.sheet { margin: auto; border-radius: 22px; } }
dialog::backdrop { background: rgb(0 0 0 / .45); }
dialog .close { position: sticky; top: 0; float: left; width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--soft); cursor: pointer; z-index: 2; }
dialog .card { margin: 44px 0 0; }
.request h2 { margin: 4px 0 4px; font-size: 19px; }
.request p { margin: 0 0 12px; }

.toast {
  position: fixed; bottom: calc(18px + env(safe-area-inset-bottom)); left: 50%; transform: translate(-50%, 20px); opacity: 0;
  background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-weight: 500; transition: .25s; pointer-events: none;
  max-width: calc(100vw - 32px); text-align: center; z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.foot { text-align: center; padding-bottom: 24px; }

.gate { max-width: 420px; margin: 12vh auto 0; text-align: center; padding: 0 16px; }
.gate .mark { width: 56px; height: 56px; font-size: 28px; border-radius: 16px; margin: 0 auto 16px; }
.gate h1 { font-size: 22px; margin: 0 0 8px; }
