/* עיצוב לפי ההדגמה שאושרה (29.11.2026): נראות Pipedrive, צבעי STAMP, פונט IBM Plex Sans Hebrew */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Hebrew:wght@400;500;600;700&display=swap');

:root {
  --copper: #BE936B;
  --copper-dark: #8A5A30;
  --copper-darker: #7A4E26;
  --copper-hover: #5E3A18;
  --cream: #FFF4EB;
  --light: #FFFBF7;
  --text: #26231f;
  --muted: #635d57;
  --line: #E2DFDC;
  --input-line: #CFCAC5;
  --work-bg: #F5F4F2;
  --head-active: #EFECE9;
  --nav-on-bg: #F4E7D9;
  --nav-on-text: #6B4220;
  --chip-on-bg: #F0E0CF;
  --chip-on-text: #4a2c10;
  --red: #A3261C;
  --green: #2F6B2F;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: #ffffff; color: var(--text); font-family: 'IBM Plex Sans Hebrew', Arial, sans-serif; font-size: 14px; }
a { color: var(--copper-dark); }
a:hover { color: var(--copper-hover); }
button, input, select, textarea { font-family: inherit; }
button { cursor: pointer; }

/* ---------- מסגרת ---------- */
.app { display: flex; min-height: 100vh; }
.nav { flex: 0 0 216px; background: #fff; border-left: 1px solid var(--line); padding: 0 8px 12px; display: flex; flex-direction: column; gap: 2px; }
.brand { height: 56px; display: flex; align-items: center; gap: 8px; padding: 0 10px; border-bottom: 1px solid var(--line); margin: 0 -8px 8px; }
.brand b { font-size: 17px; font-weight: 700; letter-spacing: 1.5px; color: var(--copper-dark); }
.brand span { font-size: 14px; color: var(--muted); }
.nav-item { display: flex; gap: 10px; align-items: center; text-align: right; border: 0; border-radius: 4px; background: transparent; color: #2f2b27; min-height: 38px; padding: 0 10px; font-size: 14.5px; margin-top: 4px; text-decoration: none; }
.nav-item.sub { min-height: 32px; font-size: 13.5px; margin-top: 0; }
.nav-item .ico { width: 18px; height: 18px; flex: none; display: flex; }
.nav-item.on { background: var(--nav-on-bg); color: var(--nav-on-text); font-weight: 600; }
.nav-item:hover:not(.on) { background: #FAF6F2; }
.nav-foot { margin-top: auto; padding: 10px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { min-height: 56px; display: flex; gap: 12px; align-items: center; padding: 0 20px; border-bottom: 1px solid var(--line); background: #fff; }
.top h1 { margin: 0; font-size: 16px; font-weight: 600; min-width: 170px; }
.top h1 .parent { color: var(--muted); font-weight: 400; }
.top .center { flex: 1; display: flex; justify-content: center; gap: 10px; align-items: center; }
.gsearch { position: relative; width: min(340px, 100%); }
.gsearch input { width: 100%; height: 36px; border: 1px solid var(--input-line); border-radius: 18px; padding: 0 16px; font-size: 14px; background: #fff; }
.hits { position: absolute; top: 40px; right: 0; left: 0; background: #fff; border: 1px solid var(--input-line); border-radius: 6px; box-shadow: 0 6px 20px rgba(30,25,20,.16); display: flex; flex-direction: column; z-index: 4; padding: 4px; }
.hits button { border: 0; background: none; text-align: right; padding: 8px 12px; font-size: 14px; color: var(--text); border-radius: 4px; }
.hits button:hover { background: var(--work-bg); }
.round-plus { width: 36px; height: 36px; flex: none; border-radius: 50%; border: 1px solid var(--input-line); background: #fff; font-size: 20px; color: var(--text); }
.top .end { min-width: 100px; display: flex; justify-content: flex-end; }

.work { flex: 1; background: var(--work-bg); padding: 16px 20px 28px; display: flex; flex-direction: column; gap: 14px; }

.testbar { background: var(--cream); border-bottom: 1px solid #EBD9C6; color: var(--copper-darker); font-size: 13px; padding: 6px 20px; }

/* ---------- רכיבים ---------- */
.link { border: 0; background: none; padding: 4px 2px; min-height: 28px; font-size: 14px; color: var(--copper-dark); text-decoration: underline; text-underline-offset: 3px; text-align: right; }
.link.muted { color: var(--muted); }
.btn-fill { min-height: 32px; padding: 0 12px; border-radius: 4px; font-size: 14px; font-weight: 600; border: 1px solid var(--copper-darker); background: var(--copper-dark); color: #fff; }
.btn-fill:hover { background: var(--copper-darker); }
.btn-fill:disabled { opacity: .6; cursor: default; }
.chip { height: 28px; padding: 0 10px; border-radius: 4px; font-size: 13px; border: 0; background: none; color: #46403a; }
.chip.on { background: var(--chip-on-bg); color: var(--chip-on-text); font-weight: 600; }
.chip:hover:not(.on) { background: #EEEAE6; }
.sep { width: 1px; height: 20px; background: var(--input-line); }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.grow { flex: 1; }
.count { font-size: 14px; color: var(--muted); }
.tsearch { height: 32px; min-width: 200px; border: 1px solid var(--input-line); border-radius: 4px; padding: 0 10px; font-size: 14px; background: #fff; }

.card { background: #fff; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.card h2 { margin: 0; padding: 10px 14px; font-size: 15px; font-weight: 600; border-bottom: 1px solid var(--line); }
h2.section { margin: 0; font-size: 18px; }

/* כרטיסי מספרים */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.kpi { text-align: right; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; color: var(--text); text-decoration: none; }
.kpi .l { font-size: 14px; font-weight: 600; }
.kpi .v { font-size: 32px; font-weight: 500; }
.kpi .h { font-size: 13px; color: var(--copper-dark); text-decoration: underline; text-underline-offset: 3px; }

/* פסי שלבים */
.bars { padding: 8px 16px 14px; display: flex; flex-direction: column; }
.bar-row { display: flex; gap: 10px; align-items: center; border: 0; border-bottom: 1px solid #EFE3D7; background: none; padding: 8px 0; font-size: 15px; color: var(--text); text-align: right; text-decoration: none; }
.bar-row:last-child { border-bottom: 0; }
.bar-row .lbl { width: 150px; }
.bar-row .track { flex: 1; }
.bar-row .fill { display: block; height: 10px; border-radius: 4px; background: var(--copper); }
.bar-row b { width: 24px; }

/* טבלה */
.tbl-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: 4px; }
.tbl-row { display: grid; align-items: stretch; border-bottom: 1px solid var(--line); min-height: 40px; }
.tbl-row:last-child { border-bottom: 0; }
.tbl-head { min-height: 0; }
.tbl-head button { border: 0; border-left: 1px solid var(--line); padding: 8px 10px; text-align: right; font-size: 13px; font-weight: 600; color: var(--text); background: #fff; }
.tbl-head button.sorted { background: var(--head-active); }
.tbl-head button .arr { font-size: 9px; }
.cell { border-left: 1px solid var(--line); padding: 5px 10px; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; min-width: 0; }
.tbl-row > :last-child, .tbl-head > :last-child { border-left: 0; }
.cell .name { border: 0; background: none; padding: 0; font-size: 14px; font-weight: 500; color: var(--copper-darker); text-align: right; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.cell .sub { font-size: 12px; color: var(--muted); }
.cell .bold { font-weight: 700; }
.cell .red { color: var(--red); font-weight: 600; }
.cell .green { color: var(--green); font-weight: 600; }
.cell .gray { color: var(--muted); }
.empty { padding: 24px; text-align: center; color: var(--muted); }

.placeholder { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 28px; color: var(--muted); }
.placeholder b { color: var(--text); display: block; font-size: 16px; margin-bottom: 6px; }

/* חלון */
.dialog-back { position: fixed; inset: 0; background: rgba(30,25,20,.35); display: flex; align-items: center; justify-content: center; z-index: 10; }
.dialog { background: #fff; border-radius: 6px; padding: 20px 22px; width: min(440px, 92vw); display: flex; flex-direction: column; gap: 12px; box-shadow: 0 10px 30px rgba(30,25,20,.25); }
.dialog h3 { margin: 0; font-size: 17px; }
.dialog .actions { display: flex; gap: 16px; justify-content: flex-start; align-items: center; }

/* כרטיס תלמיד (חלון צד) */
.card-back { position: fixed; inset: 0; background: rgba(30,27,24,.4); display: flex; justify-content: flex-end; z-index: 5; }
.card-panel { width: min(1120px, 100%); height: 100%; overflow-y: auto; background: var(--work-bg); display: flex; flex-direction: column; }
.card-head { background: #fff; border-bottom: 1px solid var(--line); padding: 16px 22px 12px; display: flex; flex-direction: column; gap: 12px; }
.card-head .top-line { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.card-head h2 { margin: 0; font-size: 22px; font-weight: 600; }
.card-head .en { color: var(--muted); }
.card-head .acts { display: flex; flex-wrap: wrap; gap: 20px; align-items: center; }
.btn-line { min-height: 32px; padding: 0 12px; border-radius: 4px; font-size: 14px; font-weight: 600; border: 1px solid var(--input-line); background: #fff; color: var(--text); }
.btn-x { width: 36px; height: 36px; border-radius: 4px; border: 1px solid var(--input-line); background: #fff; font-size: 20px; color: var(--text); }
.chevs { display: flex; gap: 2px; overflow-x: auto; }
.chev { flex: 1 0 108px; min-height: 30px; display: flex; align-items: center; justify-content: center; text-align: center; padding: 2px 14px; font-size: 12px;
  clip-path: polygon(100% 0, 10px 0, 0 50%, 10px 100%, 100% 100%, calc(100% - 10px) 50%); background: #E7E4E0; color: #46403a; }
.chev.done { background: var(--copper-dark); color: #fff; }
.chev.cur { background: #4F3117; color: #fff; font-weight: 700; }
.card-body { display: flex; flex-wrap: wrap; align-items: stretch; flex: 1; }
.card-side { flex: 1 0 270px; max-width: 100%; background: #fff; border-left: 1px solid var(--line); padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.card-side h3 { margin: 0 0 6px; font-size: 15px; font-weight: 700; }
.card-side h3.sep-top { margin: 14px 0 4px; padding-top: 14px; border-top: 1px solid var(--line); }
.kv { display: grid; grid-template-columns: 80px 1fr; gap: 10px; padding: 5px 0; }
.kv .k { color: var(--muted); font-size: 13px; }
.kv .v { font-size: 14px; overflow-wrap: anywhere; white-space: pre-line; }
.card-main { flex: 999 1 480px; min-width: 0; padding: 16px 22px; display: flex; flex-direction: column; gap: 14px; }
.next-label { font-size: 14px; font-weight: 700; padding-bottom: 6px; }
.next-box { background: #fff; border: 1px solid var(--line); border-radius: 4px; padding: 12px 14px; font-size: 16px; font-weight: 600; }
.tabs-box { background: #fff; border: 1px solid var(--line); border-radius: 4px; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--line); padding: 0 8px; }
.tab { min-height: 40px; padding: 0 10px; font-size: 14px; background: none; border: 0; border-bottom: 3px solid transparent; color: var(--muted); }
.tab.on { border-bottom-color: var(--copper-dark); color: #12100e; font-weight: 700; }
.tab-body { padding: 6px 16px 12px; }
.tl { display: flex; gap: 12px; }
.tl .dotcol { display: flex; flex-direction: column; align-items: center; }
.tl .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--copper); margin-top: 5px; }
.tl .stem { flex: 1; width: 2px; background: var(--line); }
.tl .txt { padding-bottom: 16px; }
.tl .txt .d { font-size: 12px; color: var(--muted); }
.line-row { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px solid #EDEAE7; }
.line-row:last-child { border-bottom: 0; }
.line-row .k { color: var(--muted); }
.line-row .v { font-weight: 500; text-align: left; white-space: pre-line; }

/* מצב סנכרון בתפריט */
.sync { font-size: 12px; color: var(--muted); line-height: 1.5; }
.sync .warn { color: var(--red); }

/* מסך כניסה */
.login-page { min-height: 100vh; background: var(--work-bg); display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-box { background: #fff; border: 1px solid var(--line); border-radius: 6px; width: min(380px, 100%); padding: 28px 26px; display: flex; flex-direction: column; gap: 14px; }
.login-box .brand { border: 0; margin: 0; padding: 0; height: auto; }
.login-box h1 { margin: 0; font-size: 18px; font-weight: 600; }
.login-box label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; }
.login-box input { height: 38px; border: 1px solid var(--input-line); border-radius: 4px; padding: 0 10px; font-size: 15px; font-weight: 400; }
.login-box input.code { letter-spacing: 6px; font-size: 20px; text-align: center; direction: ltr; }
.login-box .btn-fill { min-height: 38px; }
.login-box .note { font-size: 13px; color: var(--muted); }
.login-box .err { font-size: 13px; color: var(--red); min-height: 18px; }
.login-box .testcode { background: var(--cream); border: 1px solid #EBD9C6; border-radius: 4px; padding: 8px 10px; font-size: 13px; color: var(--copper-darker); }
.login-box .testcode b { letter-spacing: 3px; font-size: 16px; }
.hidden { display: none !important; }

/* ---------- עריכה והוספה (שלב 3) ---------- */
.dialog-back { z-index: 30; }
.dialog.wide { width: min(720px, 94vw); max-height: 90vh; overflow-y: auto; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px 16px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field.check { flex-direction: row-reverse; justify-content: flex-end; align-items: center; gap: 8px; }
.field label { font-size: 13px; color: var(--muted); }
.field input, .field select, .field textarea { min-height: 34px; border: 1px solid var(--input-line); border-radius: 4px; padding: 6px 10px; font-size: 14px; background: #fff; color: var(--text); width: 100%; box-sizing: border-box; }
.field input[type=checkbox] { width: 18px; min-height: 18px; height: 18px; }
.field input:disabled { background: var(--work-bg); color: var(--muted); }
.field .ro { min-height: 34px; display: flex; align-items: center; padding: 0 10px; background: var(--work-bg); border-radius: 4px; color: var(--muted); text-align: right; }
.field .hint { font-size: 12px; color: var(--muted); }
.form-err { color: var(--red); font-weight: 600; background: #FBEDEB; border: 1px solid #EBC3BE; border-radius: 4px; padding: 8px 12px; }
.blocked { background: var(--cream); border: 1px solid #EBD9C6; color: var(--copper-darker); border-radius: 4px; padding: 8px 12px; }
.diff { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 4px; }
.diff-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; padding: 7px 12px; border-bottom: 1px solid var(--line); }
.diff-row:last-child { border-bottom: 0; }
.diff-row .k { color: var(--muted); min-width: 130px; }
.diff-row .old { color: var(--muted); text-decoration: line-through; }
.diff-row .arrow { color: var(--muted); }
.fx { margin: 0; padding-inline-start: 20px; display: flex; flex-direction: column; gap: 6px; }
.fx li.danger { color: var(--red); font-weight: 600; }
.btn-danger { min-height: 32px; padding: 0 14px; border-radius: 4px; font-size: 14px; font-weight: 600; border: 1px solid #7E1C14; background: var(--red); color: #fff; }
.btn-danger:disabled { opacity: .6; }
.toast { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); background: var(--green); color: #fff; padding: 12px 22px; border-radius: 6px; font-weight: 600; font-size: 16px; z-index: 40; box-shadow: 0 6px 20px rgba(30,25,20,.2); }

/* ---------- הבוקר שלי ומטלות הקמה (שלב 4) – לפי ההדגמה ---------- */
.m-row { min-height: 46px; }
.m-row .mh { border-left: 1px solid var(--line); padding: 8px 10px; font-size: 13px; font-weight: 600; color: var(--text); }
.m-row .mh:last-child { border-left: 0; }
.mc { border-left: 1px solid var(--line); padding: 6px 10px; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-width: 0; }
.mc:last-child { border-left: 0; }
.mc.center { justify-content: center; }
.mc.sub-col { font-size: 13px; color: var(--muted); flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; }
.m-title { font-size: 15.5px; font-weight: 700; color: #12100e; }
.m-item { border-bottom: 1px solid var(--line); }
.m-item .tbl-row { border-bottom: 0; }
.m-group { width: 100%; display: flex; gap: 10px; align-items: center; border: 0; border-bottom: 1px solid var(--line); background: #FAF9F8; padding: 8px 18px; text-align: right; font-size: 14px; color: var(--text); }
.m-group .caret { width: 14px; font-size: 11px; }
.m-group .gdot { width: 8px; height: 8px; border-radius: 50%; }
.m-group .gcount { color: var(--muted); }
.done-circle { width: 20px; height: 20px; padding: 0; border-radius: 50%; border: 2px solid #9C948C; background: #fff; display: inline-block; }
.done-circle:hover { border-color: var(--green); }
.done-circle.on { background: var(--green); border-color: var(--green); }
.more { border: 0; background: none; width: 32px; height: 32px; font-size: 18px; font-weight: 700; color: var(--muted); border-radius: 4px; }
.more:hover { background: var(--work-bg); }
.m-menu { display: flex; flex-wrap: wrap; gap: 20px; justify-content: flex-end; padding: 4px 18px; background: #FAF9F8; border-top: 1px solid var(--line); }
.stag { border: 1px solid var(--input-line); border-radius: 4px; background: #fff; color: var(--copper-darker); padding: 2px 8px; font-size: 13px; font-weight: 500; }
.stag:hover { border-color: var(--copper); }
.pill { display: inline-block; border-radius: 4px; padding: 1px 7px; font-size: 12px; font-weight: 500; }
.pill-grey { background: #ECEAE7; color: #46403a; }
.pill-amber { background: #FCEFC7; color: #664900; }
.pill-red { background: #FBE3DF; color: #8c1d10; }
.m-note { font-size: 12.5px; color: var(--copper-darker); }
.m-done .m-title { color: var(--muted); font-weight: 500; text-decoration: line-through; }
.m-foot { font-size: 13px; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.red { color: var(--red); font-weight: 600; }

.pickup-box { border: 1px solid #E8C77A; border-right: 4px solid #C98A12; }
.pickup-head { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; padding: 0 14px 0 0; border-bottom: 1px solid var(--line); background: #FFF8E6; }
.pickup-head h2 { border: 0; }
.pickup-row { display: grid; grid-template-columns: 110px 160px minmax(220px, 1.6fr) 1fr auto; gap: 12px; align-items: center; padding: 8px 14px; border-bottom: 1px solid var(--line); }
.pickup-row:last-child { border-bottom: 0; }
.pickup-row.late { background: #FDF1EF; }
.pickup-row .pday { display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.pickup-row .pday b { font-size: 16px; }
.pickup-row .paddr { font-size: 13px; text-align: left; overflow-wrap: anywhere; }
.pickup-row .pacts { display: flex; gap: 16px; }
.pickup-done { padding: 6px 14px; font-size: 13px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; border-top: 1px solid var(--line); }

.mail-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; align-items: center; }
.mail-body { white-space: pre-wrap; background: var(--work-bg); border: 1px solid var(--line); border-radius: 4px; padding: 12px 14px; max-height: 40vh; overflow-y: auto; font-size: 14px; line-height: 1.6; }
.notes-list { border: 1px solid var(--line); border-radius: 4px; padding: 0 12px; max-height: 30vh; overflow-y: auto; }
.toast-undo { display: flex; gap: 16px; align-items: center; }
.toast-link { color: #fff !important; font-weight: 600; }

.setup-row { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.setup-row:last-child { border-bottom: 0; }
.setup-row .st-main { flex: 1 1 300px; display: flex; flex-direction: column; gap: 2px; }
h2.small-h { font-size: 15px; color: var(--muted); }
.mail-history { display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--line); border-radius: 4px; padding: 8px 12px; }

/* ---------- משלוחים (שלב 5) ---------- */
.packs { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 12px; }
.pack-col { background: #ECEAE7; border-radius: 6px; padding: 10px; display: flex; flex-direction: column; gap: 10px; }
.pack-col .ph { padding: 2px 4px; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.pack-col .ph h2 { margin: 0; font-size: 16px; font-weight: 700; }
.pack-card { background: #fff; border-radius: 4px; box-shadow: 0 1px 3px rgba(30,25,20,.18); padding: 14px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.pack-card .mez-l { font-size: 13px; color: var(--muted); padding-bottom: 6px; }
.mez-row { display: flex; gap: 8px; }
.mez { flex: 1; height: 58px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--input-line); border-radius: 4px; font-size: 24px; font-weight: 600; }
.pack-card .where { font-size: 15px; font-weight: 600; }
.pack-card .info { font-size: 13px; color: var(--muted); }
.pack-card .pacts { display: flex; flex-wrap: wrap; gap: 4px 18px; border-top: 1px solid var(--line); padding-top: 8px; }
.pack-card.free { outline: 2px solid #8DBE97; }
.pill-green { background: #DFF0E1; color: #17542a; }
.pill-blue { background: #E3ECF6; color: #1F3F66; }
.ship-note { font-size: 13px; color: var(--muted); }
.kpi.static { cursor: default; }
.kpi .v.small { font-size: 18px; color: var(--muted); }
@media (max-width: 700px) { .pickup-row { grid-template-columns: 1fr; } }
