/* ===== לוח תחנות — עיצוב נקי, RTL, מותאם לטלפון (פריסה אנכית) ===== */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --ink: #1f2430;
  --muted: #8a91a0;
  --line: #e6e8ec;
  --accent: #2f6fed;
  /* צבעי סטטוס — עדינים (יופעלו בשלב הבא) */
  --s-none: #d7dbe2;   /* לא התחילו */
  --s-work: #f4c453;   /* בעבודה   */
  --s-done: #7fc99a;   /* הסתיים    */
}

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", "Rubik", Arial, sans-serif;
}

/* ----- סרגל עליון — שורה אחת דקה ----- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
/* הימים — גלילה אופקית אם צריך, בלי לשבור שורה */
.days {
  display: flex; gap: 6px; flex: 1; overflow-x: auto;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.days::-webkit-scrollbar { display: none; }
.day-btn {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 5px 14px; border-radius: 999px; font-size: 15px; cursor: pointer;
  white-space: nowrap; flex: 0 0 auto;
}
.day-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
/* כפתור עריכה — אייקון קטן בצד */
.edit-btn {
  flex: 0 0 auto;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  width: 38px; height: 34px; border-radius: 9px; font-size: 16px; cursor: pointer;
}
.edit-btn.on { background: #eaf3ea; border-color: #9cc9a6; }
.icon-btn {
  flex: 0 0 auto;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  width: 38px; height: 34px; border-radius: 9px; font-size: 15px; cursor: pointer;
}
.icon-btn.on { background: #eaf0fb; border-color: #a9c4f0; }

/* ----- שורת חיפוש ----- */
.search-bar {
  position: sticky; top: 47px; z-index: 9;
  background: #fff; border-bottom: 1px solid var(--line); padding: 8px 10px;
}
.search-bar[hidden] { display: none; }
.search-bar input {
  width: 100%; padding: 9px 12px; font-size: 15px;
  border: 1px solid var(--line); border-radius: 9px;
}
.search-results { margin-top: 6px; display: flex; flex-direction: column; gap: 2px; max-height: 40vh; overflow-y: auto; }
.search-results .res {
  padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 14px;
  display: flex; gap: 8px; align-items: center;
}
.search-results .res:hover, .search-results .res:active { background: #eef2fb; }
.search-results .res b { min-width: 42px; color: var(--accent); }

/* הבהוב סימון תחנה אחרי חיפוש */
@keyframes flashRow { 0%,70% { background: #fff3c4; } 100% { background: transparent; } }
.station.flash { animation: flashRow 3s ease-out; }
/* כפתור המשיכה — עכשיו בתוך סרגל העריכה */
.pull-btn {
  border: none; background: var(--accent); color: #fff;
  padding: 8px 14px; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.pull-btn:disabled { opacity: .55; cursor: default; }

/* ----- שורת סטטוס/הודעות — דקה ----- */
.statusline {
  padding: 4px 12px; font-size: 12px; color: var(--muted);
  white-space: nowrap; overflow-x: auto; scrollbar-width: none;
}
.statusline::-webkit-scrollbar { display: none; }
.statusline.error { color: #c0392b; white-space: normal; }

/* ----- הלוח ----- */
.board {
  padding: 12px;
  max-width: 640px;   /* עמודה נוחה לקריאה בטלפון וגם במחשב */
  margin: 0 auto;
}
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }

.line-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  margin-bottom: 16px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,.03);
}
.line-head {
  display: flex; align-items: baseline; gap: 10px;
  padding: 12px 14px;
  background: #f0f4ff;
  border-bottom: 1px solid var(--line);
}
/* מספר הקו בעיגול (במקום המילה "קו") */
.line-head .name {
  font-size: 16px; font-weight: 800; color: #fff; background: var(--accent);
  min-width: 30px; height: 30px; padding: 0 8px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
}
.line-head .name.txt { background: #efeaf6; color: #6b5b8a; border-radius: 9px; }
.line-head .count { font-size: 13px; color: var(--muted); }

/* ----- תחנות: רשימה אנכית, כל תחנה שורה ----- */
.stations { display: flex; flex-direction: column; }
.station {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 14px;               /* שורה צרה — פחות "מקום מת", כתב באותו גודל */
  border-bottom: 1px solid #f0f1f4;
  border-inline-start: 6px solid var(--s-none); /* פס סטטוס עדין בצד */
}
.station:last-child { border-bottom: none; }
.station.work { border-inline-start-color: var(--s-work); }
.station.done { border-inline-start-color: var(--s-done); }

.st-num {
  font-size: 26px; font-weight: 800; letter-spacing: .5px;
  min-width: 58px; text-align: center; color: var(--ink);
}
.st-name { flex: 1; font-size: 16px; color: #3c4353; }
/* צד שמאל של השורה — משטחים + מספר עובד (מופיע רק כשיש דיווח) */
.st-side {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  min-width: 54px; text-align: left;
}
/* מספר המשטחים — בלי אייקון, צבע לפי מצב: בתהליך (לא סופי) מול הסתיים (סופי) */
.st-side .pal { font-size: 17px; font-weight: 800; white-space: nowrap; }
.station.work .st-side .pal { color: #e08a00; }  /* כתום — עדיין בעבודה, לא סופי */
.station.done .st-side .pal { color: #2f8a4f; }  /* ירוק — סופי */
.st-side .wrk { font-size: 12px; color: var(--accent); cursor: pointer; text-decoration: underline; }

/* רקע עדין מאוד לפי סטטוס (בנוסף לפס הצבע בצד) */
.station.work { background: #fffaf0; }
.station.done { background: #f5fbf7; }

/* תחנה שלא בסדר של היום — מודגשת בעדינות */
.station.notinorder { opacity: .55; }

/* ----- כלי עריכה (מופיעים רק במצב עריכה) ----- */
.line-ctrls { margin-inline-start: auto; display: flex; gap: 4px; }
.line-ctrls button {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  width: 30px; height: 28px; border-radius: 7px; cursor: pointer; font-size: 13px;
}
.line-ctrls button { min-width: 30px; height: 28px; }
.line-ctrls button.add { border-color: #bcd6be; background: #f1f8f1; color: #256b39; }
.line-ctrls button.wed { border-color: #cdbce0; background: #f5f1fa; color: #6b4b9a; font-size: 12px; padding: 0 8px; width: auto; }

/* סרגל עריכה עליון */
.edit-bar {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 12px; padding: 10px; background: #eef2fb;
  border: 1px solid #d5def1; border-radius: 12px;
}
.edit-bar button {
  border: 1px solid #cdd6e8; background: #fff; color: var(--ink);
  padding: 7px 12px; border-radius: 8px; cursor: pointer; font-size: 14px;
}
.edit-bar button:disabled { opacity: .45; cursor: default; }
.edit-bar button.reset { border-color: #f0c9c9; background: #fff5f5; color: #c0392b; }

.st-edit { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.st-edit button.mini {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  width: 28px; height: 28px; border-radius: 6px; cursor: pointer; font-size: 12px;
}
.st-edit select {
  font-size: 13px; padding: 4px 6px; border: 1px solid var(--line);
  border-radius: 7px; background: #fff; color: var(--ink); max-width: 110px;
}
.st-edit .del {
  border: 1px solid #f0c9c9; background: #fff5f5; color: #c0392b;
  width: 32px; height: 28px; border-radius: 6px; cursor: pointer; font-size: 14px;
}
/* תחנה שנוספה ידנית — סימון עדין */
.station.added .st-num::after { content: " ➕"; font-size: 11px; color: var(--accent); }

/* ----- מסך קוד גישה ----- */
.login-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(244,245,247,.97);
  display: flex; align-items: center; justify-content: center;
}
.login-overlay[hidden] { display: none; }
.login-box {
  background: #fff; border: 1px solid var(--line); border-radius: 16px;
  padding: 28px 24px; width: min(340px, 90vw); text-align: center;
  box-shadow: 0 8px 30px rgba(0,0,0,.08);
}
.login-title { font-size: 22px; font-weight: 800; }
.login-sub { color: var(--muted); margin: 6px 0 16px; }
.login-box input {
  width: 100%; padding: 12px; font-size: 18px; text-align: center;
  border: 1px solid var(--line); border-radius: 10px; margin-bottom: 12px;
}
.login-box button {
  width: 100%; padding: 12px; font-size: 16px; font-weight: 600;
  border: none; border-radius: 10px; background: var(--accent); color: #fff; cursor: pointer;
}
.login-err { color: #c0392b; font-size: 13px; min-height: 16px; margin-top: 10px; }

/* ----- חלון תמונת עובד ----- */
.photo-overlay {
  position: fixed; inset: 0; z-index: 120;
  background: rgba(0,0,0,.88);
  display: flex; align-items: center; justify-content: center;
  touch-action: none; overflow: hidden;
}
.photo-overlay[hidden] { display: none; }
.photo-overlay img {
  max-width: 100%; max-height: 100%; object-fit: contain;
  transition: transform .15s ease-out; will-change: transform;
  -webkit-user-select: none; user-select: none;
}
.photo-overlay img.zoomed { transform: scale(2.4); cursor: zoom-out; }
.photo-info {
  position: absolute; bottom: 16px; left: 0; right: 0; text-align: center;
  color: #fff; font-size: 15px; opacity: .85;
}
.unassigned .line-head { background: #f2f0f5; }
.unassigned .line-head .name { color: #6b5b8a; }
/* במצב עריכה — קו מודגש קלות כדי להבין שאפשר לגעת */
body.editing .line-card { outline: 1px dashed #cfd6e4; }

@media (max-width: 480px) {
  .title { font-size: 18px; }
  .st-num { font-size: 24px; min-width: 52px; }
  .st-name { font-size: 15px; }
}
