/* לוח התוכן של קיפי. השפה של קיפר: נייבי, מג'נטה מרוככת, תכלת. בהיר כברירת מחדל */
:root {
  --navy: #253C75; --magenta: #cf5b92; --cyan: #1DA1DC; --green: #2f9e6b; --amber: #d98a1c; --red: #d64545;
  --bg: #F1F1F1; --surface: #ffffff; --surface-2: #f7f7f9; --line: #e2e4ea; --text: #1d2433; --muted: #6b7385;
  --accent: var(--navy); --accent-ink: #ffffff; --shadow: 0 1px 2px rgba(20,30,60,.06), 0 4px 16px rgba(20,30,60,.06);
  --radius: 14px; --ig: #c13584; --fb: #1877f2; --tt: #111111; --yt: #e62117;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0f1420; --surface: #171e2d; --surface-2: #1d2537; --line: #2a3448; --text: #e8ecf4; --muted: #9aa4b8;
  --accent: #6f8fd8; --accent-ink: #0f1420; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
  --tt: #e8ecf4; color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text); font-family: "Assistant", system-ui, sans-serif; font-size: 16px;
  line-height: 1.5; -webkit-font-smoothing: antialiased; padding-bottom: env(safe-area-inset-bottom);
}
h1, h2, h3, .brand, button, .tab, .chip, .pill { font-family: "Rubik", "Assistant", sans-serif; }
h1 { font-size: 22px; margin: 0; } h2 { font-size: 18px; margin: 0 0 8px; } h3 { font-size: 15px; margin: 0 0 6px; }
a { color: var(--accent); }
button { font: inherit; cursor: pointer; }
textarea, input, select { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 10px; width: 100%; }
textarea { min-height: 140px; resize: vertical; line-height: 1.55; }
.hidden { display: none !important; }
.muted { color: var(--muted); } .small { font-size: 13px; } .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; } .pre { white-space: pre-wrap; word-break: break-word; }

/* כותרת וניווט */
.top { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--line); }
.top-in { max-width: 1280px; margin: 0 auto; display: flex; align-items: center; gap: 16px; padding: 10px 16px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--text); text-decoration: none; white-space: nowrap; }
.brand svg { width: 30px; height: 30px; }
.tabs { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.tab { border: 0; background: none; color: var(--muted); padding: 8px 12px; border-radius: 10px; white-space: nowrap; font-size: 15px; }
.tab:hover { background: var(--surface-2); }
.tab.on { color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); font-weight: 600; }
.count { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--magenta); color: #fff;
  font-size: 12px; line-height: 20px; text-align: center; margin-inline-start: 4px; }
.top-actions { display: flex; gap: 6px; align-items: center; }
.icon-btn { border: 1px solid var(--line); background: var(--surface); color: var(--text); width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center; }
.btn { border: 1px solid var(--line); background: var(--surface); color: var(--text); padding: 8px 14px; border-radius: 10px; font-size: 15px; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.good { background: var(--green); border-color: var(--green); color: #fff; }
.btn.danger { color: var(--red); }
.btn:disabled { opacity: .5; cursor: default; }
.bottom { display: none; }
.filter-toggle { display: none !important; }

/* התראות */
.alerts { max-width: 1280px; margin: 12px auto 0; padding: 0 16px; display: grid; gap: 6px; }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: 12px; background: var(--surface);
  border: 1px solid var(--line); border-inline-start: 4px solid var(--amber); cursor: pointer; }
.alert.error { border-inline-start-color: var(--red); }
.alert b { font-family: "Rubik", sans-serif; font-weight: 500; }

main { max-width: 1280px; margin: 0 auto; padding: 16px 16px 40px; }
.head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.head .sub { color: var(--muted); }
.empty { text-align: center; padding: 60px 20px; color: var(--muted); background: var(--surface); border-radius: var(--radius); border: 1px dashed var(--line); }

/* תוויות */
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 2px 8px; border-radius: 20px;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; font-weight: 500; }
.pill.pending, .pill.question, .pill.waiting { background: color-mix(in srgb, var(--magenta) 14%, transparent); color: var(--magenta); border-color: transparent; }
.pill.scheduled, .pill.approved, .pill.publishing, .pill.review, .pill.captions { background: color-mix(in srgb, var(--cyan) 14%, transparent); color: #127fb0; border-color: transparent; }
.pill.published { background: color-mix(in srgb, var(--green) 15%, transparent); color: var(--green); border-color: transparent; }
.pill.failed, .pill.stuck { background: color-mix(in srgb, var(--red) 14%, transparent); color: var(--red); border-color: transparent; }
.pill.held, .pill.changes_requested, .pill.production { background: color-mix(in srgb, var(--amber) 16%, transparent); color: #a86500; border-color: transparent; }
.pill.rejected { text-decoration: line-through; }
:root[data-theme="dark"] .pill.scheduled, :root[data-theme="dark"] .pill.approved { color: #6cc8f0; }
:root[data-theme="dark"] .pill.held, :root[data-theme="dark"] .pill.production, :root[data-theme="dark"] .pill.changes_requested { color: #f0b354; }
.net { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; color: #fff; font-size: 11px; font-weight: 700;
  font-family: "Rubik", sans-serif; flex: none; }
.net.instagram { background: var(--ig); } .net.facebook { background: var(--fb); } .net.tiktok { background: #111; } .net.youtube { background: var(--yt); }
.net.concept, .net.video, .net.slides { background: var(--navy); }
.netstat { display: inline-flex; align-items: center; gap: 4px; position: relative; }
.netstat .dot { position: absolute; bottom: -2px; inset-inline-start: -2px; width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--surface); background: var(--muted); }
.dot.pending, .dot.question { background: var(--magenta); } .dot.scheduled, .dot.approved, .dot.publishing { background: var(--cyan); }
.dot.published { background: var(--green); } .dot.failed, .dot.stuck { background: var(--red); } .dot.held, .dot.changes_requested { background: var(--amber); }

/* סינונים */
.filters { display: grid; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 14px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chips .lbl { font-size: 13px; color: var(--muted); min-width: 48px; }
.chip { border: 1px solid var(--line); background: var(--surface); color: var(--text); padding: 4px 12px; border-radius: 20px; font-size: 14px; }
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); color: var(--muted); padding: 6px 12px; font-size: 14px; }
.seg button.on { background: var(--accent); color: var(--accent-ink); }

/* גלריה */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  display: flex; flex-direction: column; cursor: pointer; transition: transform .12s; position: relative; }
.card:hover { transform: translateY(-2px); }
.thumb { position: relative; aspect-ratio: 4/5; background: var(--surface-2); overflow: hidden; }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .fmt { position: absolute; top: 8px; inset-inline-end: 8px; background: rgba(15,20,32,.72); color: #fff; font-size: 12px; padding: 2px 8px; border-radius: 10px; }
.thumb .nothumb { display: grid; place-items: center; height: 100%; color: var(--muted); font-size: 14px; padding: 16px; text-align: center; }
.card-body { padding: 10px 12px 12px; display: grid; gap: 6px; }
.card-title { font-family: "Rubik", sans-serif; font-weight: 500; font-size: 15px; line-height: 1.35; }
.card .nets { display: flex; gap: 8px; flex-wrap: wrap; }
.card .when { font-size: 13px; color: var(--muted); }
.card.busy::after { content: "נשמר, מתעדכן…"; position: absolute; inset: 0; display: grid; place-items: center; background: color-mix(in srgb, var(--surface) 70%, transparent);
  font-family: "Rubik", sans-serif; color: var(--accent); }

/* טבלה */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
table { border-collapse: collapse; width: 100%; min-width: 760px; }
th, td { text-align: start; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 14px; }
th { font-family: "Rubik", sans-serif; font-weight: 500; color: var(--muted); font-size: 13px; background: var(--surface-2); cursor: pointer; user-select: none; }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--surface-2); }
td .mini { width: 44px; height: 55px; border-radius: 6px; object-fit: cover; background: var(--surface-2); display: block; }

/* עמודות לפי שלב */
.columns { display: grid; grid-template-columns: repeat(5, minmax(220px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.col { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; display: grid; gap: 10px; align-content: start; min-height: 200px; }
.col h3 { display: flex; justify-content: space-between; }
.col .card .thumb { aspect-ratio: 16/10; }

/* מחכה לי */
.decisions { display: grid; gap: 16px; }
.decision { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  display: grid; grid-template-columns: minmax(220px, 320px) 1fr; overflow: hidden; position: relative; }
.decision .media { background: #0b0f18; display: grid; place-items: center; min-height: 260px; }
.decision .body { padding: 16px; display: grid; gap: 12px; align-content: start; }
.decision .ask { font-family: "Rubik", sans-serif; font-weight: 500; color: var(--magenta); font-size: 14px; }
.decision.busy::after { content: "נשמר, מתעדכן…"; position: absolute; inset: 0; display: grid; place-items: center;
  background: color-mix(in srgb, var(--surface) 75%, transparent); font-family: "Rubik", sans-serif; color: var(--accent); font-size: 18px; }
.caption-box { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.caption-box .for { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.select-box { position: absolute; top: 10px; inset-inline-start: 10px; z-index: 2; width: 22px; height: 22px; accent-color: var(--accent); }
.bulkbar { position: sticky; bottom: 12px; z-index: 15; margin-top: 16px; background: var(--navy); color: #fff; border-radius: 14px; padding: 10px 14px;
  display: flex; gap: 10px; align-items: center; box-shadow: var(--shadow); }
.bulkbar .btn { background: #fff; color: var(--navy); border: 0; }

/* מדיה */
.player { width: 100%; max-height: 560px; display: block; background: #000; }
.carousel { position: relative; width: 100%; }
.carousel .frame { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; direction: ltr; }
.carousel .frame img { width: 100%; flex: none; scroll-snap-align: center; object-fit: contain; max-height: 560px; background: #000; }
.carousel .nav { position: absolute; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border-radius: 50%; border: 0;
  background: rgba(255,255,255,.9); color: #111; display: grid; place-items: center; box-shadow: var(--shadow); }
.carousel .prev { left: 8px; } .carousel .next { right: 8px; }
.carousel .counter { position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,.6); color: #fff; font-size: 12px; padding: 2px 8px; border-radius: 10px; }

/* תיק פוסט */
.item { display: grid; grid-template-columns: minmax(280px, 420px) 1fr; gap: 20px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.panel + .panel { margin-top: 14px; }
.media-panel { padding: 0; overflow: hidden; position: sticky; top: 76px; }
.chan { border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: grid; gap: 8px; background: var(--surface); }
.chan + .chan { margin-top: 10px; }
.chan-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chan-head .name { font-family: "Rubik", sans-serif; font-weight: 500; }
.kv { display: flex; gap: 16px; flex-wrap: wrap; font-size: 14px; color: var(--muted); }
.kv b { color: var(--text); font-weight: 500; }
.stats { display: flex; gap: 14px; flex-wrap: wrap; font-size: 14px; }
.stats span b { font-family: "Rubik", sans-serif; }
details { border-top: 1px solid var(--line); padding-top: 10px; }
details summary { cursor: pointer; font-family: "Rubik", sans-serif; font-weight: 500; }
.timeline { display: grid; gap: 10px; }
.ev { display: grid; grid-template-columns: 90px 1fr; gap: 10px; font-size: 14px; }
.ev .t { color: var(--muted); font-size: 12px; }
.ev .who { font-weight: 600; }

/* יומן */
.cal-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--line); gap: 1px; }
.dow { background: var(--surface-2); text-align: center; padding: 6px; font-size: 13px; color: var(--muted); font-family: "Rubik", sans-serif; }
.day { background: var(--surface); min-height: 118px; padding: 6px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.day.out { background: var(--surface-2); } .day.out .num { opacity: .45; }
.day.today .num { background: var(--magenta); color: #fff; border-radius: 50%; width: 24px; height: 24px; display: grid; place-items: center; }
.day.shabbat { background: repeating-linear-gradient(135deg, var(--surface), var(--surface) 8px, var(--surface-2) 8px, var(--surface-2) 16px); }
.day.drop { outline: 2px dashed var(--accent); outline-offset: -3px; }
.num { font-size: 13px; font-family: "Rubik", sans-serif; }
.ev-chip { display: flex; gap: 4px; align-items: center; font-size: 12px; padding: 3px 6px; border-radius: 7px; background: var(--surface-2);
  border: 1px solid var(--line); cursor: pointer; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ev-chip .net { width: 16px; height: 16px; font-size: 9px; border-radius: 4px; }
.ev-chip .txt { overflow: hidden; text-overflow: ellipsis; }
.ev-chip.planned { border-style: dashed; background: transparent; color: var(--muted); }
.ev-chip.late { opacity: .5; text-decoration: line-through; }
.ev-chip.published { border-color: color-mix(in srgb, var(--green) 50%, transparent); }
.ev-chip.failed, .ev-chip.stuck { border-color: var(--red); color: var(--red); }
.ev-chip.held { opacity: .6; }
.ev-chip[draggable="true"] { cursor: grab; }
.quota { display: flex; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.quota .low { color: var(--red); font-weight: 600; }
.week-list { display: grid; gap: 10px; }
.week-day { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.week-day h3 { display: flex; justify-content: space-between; }
.week-day .ev-chip { font-size: 14px; padding: 6px 8px; white-space: normal; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }

/* חלונות */
.sheet-bg { position: fixed; inset: 0; background: rgba(10,15,25,.45); z-index: 50; display: grid; place-items: center; padding: 16px; }
.sheet { background: var(--surface); border-radius: 16px; width: min(560px, 100%); max-height: 88vh; overflow: auto; padding: 18px; box-shadow: var(--shadow); display: grid; gap: 12px; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 60; background: var(--navy); color: #fff;
  padding: 10px 16px; border-radius: 12px; box-shadow: var(--shadow); max-width: min(560px, calc(100% - 32px)); white-space: pre-wrap; }
.toast.err { background: var(--red); }

/* תצוגה מקדימה לפי רשת */
.preview { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: #fff; color: #111; max-width: 360px; font-family: system-ui, sans-serif; font-size: 14px; }
.preview .ph { display: flex; gap: 8px; align-items: center; padding: 8px 10px; font-weight: 600; }
.preview .av { width: 28px; height: 28px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font-size: 13px; }
.preview .pm { background: #000; aspect-ratio: 4/5; display: grid; place-items: center; overflow: hidden; }
.preview .pm img, .preview .pm video { width: 100%; height: 100%; object-fit: cover; }
.preview .pc { padding: 8px 10px 12px; white-space: pre-wrap; }
.preview .more { color: #737373; }
.preview.tiktok { background: #000; color: #fff; position: relative; aspect-ratio: 9/16; max-width: 300px; }
.preview.tiktok .pm { position: absolute; inset: 0; aspect-ratio: auto; }
.preview.tiktok .pc { position: absolute; bottom: 0; inset-inline: 0; background: linear-gradient(transparent, rgba(0,0,0,.75)); padding: 30px 12px 14px; }
.preview.youtube .pm { aspect-ratio: 9/16; max-height: 420px; }
.preview .yt-title { font-weight: 600; padding: 8px 10px 0; }

/* כניסה */
.login { max-width: 420px; margin: 10vh auto; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 28px; box-shadow: var(--shadow); display: grid; gap: 14px; text-align: center; }
.login svg { width: 56px; height: 56px; margin: 0 auto; }

/* מובייל */
@media (max-width: 900px) {
  .item { grid-template-columns: 1fr; }
  .media-panel { position: static; }
  .decision { grid-template-columns: 1fr; }
  .decision .media { min-height: 0; }
}
@media (max-width: 720px) {
  .tabs, .top-actions .wide { display: none; }
  .top-in { padding: 8px 16px; }
  main { padding: 12px 16px 96px; }
  .bottom { display: flex; position: fixed; bottom: 0; inset-inline: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); justify-content: space-around; }
  .bottom .tab { display: grid; justify-items: center; gap: 2px; font-size: 12px; padding: 4px 8px; }
  .bottom .tab svg { width: 22px; height: 22px; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .card-title { font-size: 14px; }
  .day { min-height: 74px; padding: 3px; }
  .month .ev-chip .txt, .month .ev-chip > span:not(.netstat) { display: none; }
  .month .ev-chip { padding: 2px; justify-content: center; }
  .legend { display: none; }
  .filters.closed { display: none; }
  .filter-toggle { display: inline-flex !important; }
  .dow { font-size: 11px; padding: 4px 0; }
  .bulkbar { bottom: 76px; }
  .toast { bottom: 84px; }
}
