/* מטה הסוכנים. Light cream world, navy ink, one blue accent. Planned = dashed "hidden line" from drafting. */
:root {
  --bg: #f6f5f0;
  --surface: #fffefb;
  --surface-2: #f0efe9;
  --ink: #1b2160;
  --ink-2: #454b7e;
  --muted: #62688f;
  --line: #dcdde6;
  --line-strong: #b9bcd3;
  --accent: #2d55c8;
  --accent-2: #4870e6;
  --accent-soft: #e8eefc;
  --ok: #1c7248;
  --ok-soft: #e2f1e8;
  --wait: #9a5708;
  --wait-soft: #fcf0d9;
  --bad: #a8243a;
  --bad-soft: #fbe6ea;
  --r: 10px;
  --r-sm: 7px;
  --shadow: 0 1px 2px rgb(27 33 96 / .05), 0 4px 14px rgb(27 33 96 / .06);
  --shadow-up: 0 2px 4px rgb(27 33 96 / .05), 0 12px 40px rgb(27 33 96 / .14);
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --ease-glide: cubic-bezier(.3, 1.35, .5, 1);
  --rail-w: 232px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 15px/1.55 Heebo, "Segoe UI", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; border-radius: 4px; }
.num { font-variant-numeric: tabular-nums; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 0 16px; border-radius: var(--r-sm);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: background .18s, border-color .18s, transform .12s;
}
.btn:hover { background: var(--accent-soft); border-color: var(--accent-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #2548ad; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); min-height: 34px; padding: 0 10px; }
.btn.ghost:hover { background: var(--surface-2); }
.btn[disabled] { opacity: .55; cursor: default; }

/* boot */
.boot { position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--muted); }
.boot-mark { display: flex; gap: 6px; }
.boot-mark span { width: 14px; height: 14px; border: 1.5px dashed var(--line-strong); border-radius: 3px; animation: fill 1.2s var(--ease-out) infinite; }
.boot-mark span:nth-child(2) { animation-delay: .15s; }
.boot-mark span:nth-child(3) { animation-delay: .3s; }
@keyframes fill { 0%, 100% { background: transparent; border-style: dashed; } 50% { background: var(--accent-soft); border-style: solid; border-color: var(--accent-2); } }

/* login */
.login { min-height: 100dvh; display: grid; grid-template-columns: minmax(340px, 460px) 1fr; }
.login-form { padding: 64px 48px; display: flex; flex-direction: column; justify-content: center; background: var(--surface); border-inline-end: 1px solid var(--line); }
.brand-line { color: var(--muted); font-size: 13px; font-weight: 500; }
.login-form h1 { font-size: 34px; line-height: 1.15; font-weight: 700; margin-top: 4px; }
.login-sub { color: var(--ink-2); margin: 12px 0 30px; max-width: 34ch; }
.login-form form { display: grid; gap: 6px; }
.login-form label { font-size: 13px; font-weight: 500; color: var(--ink-2); margin-top: 10px; }
.login-form input {
  height: 44px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--surface); text-align: left;
}
.login-form input:focus { outline: none; border-color: var(--accent-2); box-shadow: 0 0 0 3px var(--accent-soft); }
.login-form .btn { margin-top: 20px; min-height: 46px; }
.form-err { color: var(--bad); background: var(--bad-soft); border-radius: var(--r-sm); padding: 8px 12px; font-size: 14px; margin-top: 10px; }
.login-plan {
  display: grid; place-items: center; padding: 40px;
  background-color: var(--bg);
}
.plan { display: grid; justify-items: center; padding: 36px 40px; }
.plan-node {
  padding: 10px 18px; border: 1.5px dashed var(--line-strong); border-radius: var(--r-sm);
  color: var(--muted); font-weight: 500; font-size: 14px; background: var(--bg); white-space: nowrap;
}
.plan-node.solid { border-style: solid; border-color: var(--accent-2); color: var(--ink); background: var(--surface); }
.plan-stem { width: 1.5px; height: 28px; background: var(--line-strong); }
.plan-row { display: grid; grid-template-columns: repeat(4, auto); gap: 18px; padding-top: 22px; border-top: 1.5px solid var(--line-strong); }
.plan-col { display: grid; justify-items: center; gap: 8px; align-content: start; }
.plan-col i { width: 74px; height: 16px; border-radius: 4px; border: 1.5px solid var(--accent-2); background: var(--surface); }
.plan-col i.d { border-style: dashed; border-color: var(--line-strong); background: transparent; }
.plan-key { margin-top: 26px; color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.plan-key .k { width: 22px; height: 12px; border: 1.5px dashed var(--line-strong); border-radius: 3px; margin-inline-start: 10px; }
.plan-key .k.solid { border-style: solid; border-color: var(--accent-2); margin-inline-start: 0; }

/* shell */
.app { min-height: 100dvh; display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); }
.rail {
  position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column;
  padding: 22px 14px 16px; background: var(--surface); border-inline-end: 1px solid var(--line);
}
.rail-brand { padding: 0 10px 22px; display: grid; }
.rail-brand strong { font-size: 19px; font-weight: 700; }
.rail-brand span { color: var(--muted); font-size: 12.5px; }
.rail-nav { position: relative; display: grid; gap: 2px; }
.rail-nav a {
  position: relative; z-index: 1; display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 12px;
  border-radius: var(--r-sm); color: var(--ink-2); text-decoration: none; font-weight: 500;
  transition: color .18s;
}
.rail-nav a i { font-size: 20px; }
.rail-nav a:hover { color: var(--ink); }
.rail-nav a[aria-current="page"] { color: var(--accent); }
.nav-glide {
  position: absolute; inset-inline: 0; top: 0; height: 44px; border-radius: var(--r-sm);
  background: var(--accent-soft); box-shadow: inset 0 0 0 1px rgb(72 112 230 / .28);
  transition: transform .42s var(--ease-glide);
}
.count {
  margin-inline-start: auto; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px;
  display: inline-grid; place-items: center; font-size: 12px; font-weight: 600;
  background: var(--wait-soft); color: var(--wait);
}
.rail-foot { margin-top: auto; display: grid; gap: 4px; padding: 0 4px; }
.rail-foot span { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; text-align: right; padding: 0 8px; }
.rail-foot .btn { justify-content: flex-start; }

.view { padding: 30px 36px 60px; min-width: 0; outline: none; }
.view > * { animation: enter .34s var(--ease-out) both; }
@keyframes enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font-size: 26px; font-weight: 700; line-height: 1.2; }
.page-head p { color: var(--muted); margin-top: 2px; }

/* figures row */
.figures { display: flex; gap: 34px; flex-wrap: wrap; padding: 4px 0 26px; }
.figure b { display: block; font-size: 30px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.figure span { color: var(--muted); font-size: 13.5px; }
.figure.wait b { color: var(--wait); }

/* org chart */
.org { display: grid; gap: 0; }
.org-top { display: grid; justify-items: center; }
.org-staff { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.org-stem { width: 1.5px; height: 26px; background: var(--line-strong); }
.org-cols { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; padding-top: 22px; border-top: 1.5px solid var(--line-strong); }
.dept { display: grid; gap: 10px; align-content: start; min-width: 0; }
.dept-head { padding: 0 2px 4px; }
.dept-head h2 { font-size: 16px; font-weight: 600; }
.dept-head p { color: var(--muted); font-size: 13px; line-height: 1.4; }
.dept-sub { display: grid; gap: 8px; padding-inline-start: 14px; border-inline-start: 1.5px solid var(--line); }

.agent {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 10px; align-items: center; text-align: start;
  width: 100%; padding: 11px 12px; border-radius: var(--r); cursor: pointer;
  background: var(--surface); border: 1.5px solid var(--line); box-shadow: var(--shadow);
  transition: border-color .18s, transform .18s var(--ease-out), box-shadow .18s;
}
.agent:hover { border-color: var(--accent-2); transform: translateY(-1px); }
.agent i { grid-row: span 2; font-size: 22px; color: var(--accent); width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); }
.agent strong { font-weight: 600; font-size: 14.5px; line-height: 1.3; overflow-wrap: anywhere; }
.agent small { color: var(--muted); font-size: 12.5px; line-height: 1.35; overflow-wrap: anywhere; }
.agent.planned { border-style: dashed; border-color: var(--line-strong); background: transparent; box-shadow: none; }
.agent.planned i { background: transparent; color: var(--muted); border: 1.5px dashed var(--line-strong); }
.agent.planned strong { color: var(--ink-2); }
.org-top .agent { width: auto; min-width: 230px; }

.pill { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 11px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.plan { border: 1px dashed var(--line-strong); color: var(--muted); }
.pill.wait { background: var(--wait-soft); color: var(--wait); }
.pill.soft { background: var(--accent-soft); color: var(--accent); }
.pill.none { background: var(--surface-2); color: var(--muted); }

/* projects table */
.section-title { font-size: 18px; font-weight: 600; margin: 40px 0 12px; }
.ptable { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); }
.ptable th { text-align: start; font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 10px 14px; background: var(--surface-2); }
.ptable td { padding: 11px 14px; border-top: 1px solid var(--line); vertical-align: middle; }
.ptable tr.row { cursor: pointer; transition: background .15s; }
.ptable tr.row:hover { background: var(--accent-soft); }
.ptable a { text-decoration: none; font-size: 13px; }
.table-wrap { overflow-x: auto; }

/* board */
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.chip {
  height: 32px; padding: 0 12px; border-radius: 16px; border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--ink-2); font-size: 13.5px; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  transition: background .15s, border-color .15s;
}
.chip:hover { border-color: var(--accent-2); }
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent-2); color: var(--accent); box-shadow: 0 0 0 2px rgb(72 112 230 / .16); }
.chip b { font-weight: 600; font-variant-numeric: tabular-nums; opacity: .75; }
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(214px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.col { background: var(--surface-2); border-radius: var(--r); padding: 10px; min-height: 140px; display: grid; gap: 8px; align-content: start; }
.col-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 4px; font-weight: 600; font-size: 14px; }
.col-head span { color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.col-empty { color: var(--muted); font-size: 13px; padding: 14px 4px; }
.ticket {
  display: grid; gap: 7px; text-align: start; width: 100%; padding: 11px 12px; border-radius: var(--r-sm); cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
  transition: border-color .18s, transform .18s var(--ease-out);
}
.ticket:hover { border-color: var(--accent-2); transform: translateY(-1px); }
.ticket strong { font-weight: 500; font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; }
.ticket .meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: 12.5px; }

/* drawer */
.veil { position: fixed; inset: 0; background: rgb(246 245 240 / .72); z-index: 20; animation: fade .2s both; }
@keyframes fade { from { opacity: 0; } }
.drawer {
  position: fixed; inset-block: 0; inset-inline-end: 0; width: min(520px, 100vw); z-index: 21; overflow-y: auto;
  background: var(--surface); border-inline-start: 1px solid var(--line); box-shadow: var(--shadow-up);
  padding: 26px 26px 40px; animation: slide .32s var(--ease-out) both;
}
@keyframes slide { from { transform: translateX(-40px); opacity: 0; } }
.drawer-x { position: absolute; top: 14px; inset-inline-end: 14px; width: 36px; height: 36px; border: 0; background: transparent; border-radius: 8px; cursor: pointer; color: var(--ink-2); font-size: 18px; display: grid; place-items: center; }
.drawer-x:hover { background: var(--surface-2); }
.drawer h2 { font-size: 21px; font-weight: 700; line-height: 1.3; margin: 4px 0 4px; padding-inline-end: 40px; overflow-wrap: anywhere; }
.drawer .over { color: var(--muted); font-size: 13px; }
.drawer h3 { font-size: 14px; font-weight: 600; margin: 26px 0 8px; }
.drawer p.lead { color: var(--ink-2); margin-top: 6px; }

.route { display: grid; grid-template-columns: repeat(6, 1fr); margin: 20px 0 6px; }
.route li { list-style: none; display: grid; justify-items: center; gap: 6px; font-size: 12px; color: var(--muted); position: relative; text-align: center; }
.route { padding: 0; }
.route li::before { content: ""; position: absolute; top: 8px; inset-inline-start: -50%; width: 100%; height: 1.5px; background: var(--line-strong); }
.route li:first-child::before { display: none; }
.route li span { position: relative; width: 17px; height: 17px; border-radius: 50%; background: var(--surface); border: 1.5px dashed var(--line-strong); }
.route li.done span { border-style: solid; border-color: var(--accent-2); background: var(--accent-soft); }
.route li.done::before, .route li.now::before { background: var(--accent-2); }
.route li.now span { border-style: solid; border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.route li.now { color: var(--accent); font-weight: 600; }

.props { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 0; margin-top: 14px; }
.props dt { color: var(--muted); font-size: 13.5px; padding: 7px 0; border-top: 1px solid var(--line); }
.props dd { margin: 0; padding: 7px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.props dt:first-of-type, .props dd:first-of-type { border-top: 0; }

.decide { display: grid; gap: 10px; background: var(--surface-2); border-radius: var(--r); padding: 14px; }
.decide .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field { display: grid; gap: 4px; }
.field label { font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.field select, .field textarea, .composer textarea, .composer select {
  width: 100%; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); padding: 8px 10px;
}
.field select, .composer select { height: 40px; padding-block: 0; }
.field textarea, .composer textarea { resize: vertical; min-height: 64px; line-height: 1.5; }
.field select:focus, .field textarea:focus, .composer textarea:focus, .composer select:focus { outline: none; border-color: var(--accent-2); box-shadow: 0 0 0 3px var(--accent-soft); }
.hint { color: var(--muted); font-size: 12.5px; }

.events { display: grid; gap: 0; padding: 0; margin: 0; }
.events li { list-style: none; padding: 8px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.events li:first-child { border-top: 0; }
.events time, .msg time { color: var(--muted); font-size: 12px; margin-inline-start: 8px; }

/* chat */
.chat { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 18px; height: calc(100dvh - 150px); min-height: 420px; }
.channels { overflow-y: auto; display: grid; gap: 2px; align-content: start; padding-inline-end: 4px; }
.channels h3 { font-size: 12.5px; color: var(--muted); font-weight: 600; margin: 14px 8px 4px; }
.channels h3:first-child { margin-top: 0; }
.chan { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px; border: 0; background: transparent; border-radius: var(--r-sm); cursor: pointer; text-align: start; color: var(--ink-2); font-weight: 500; font-size: 14px; }
.chan:hover { background: var(--surface-2); }
.chan[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.chan b { margin-inline-start: auto; font-size: 12px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.room { display: grid; grid-template-rows: minmax(0, 1fr) auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); min-height: 0; overflow: hidden; }
.msgs { overflow-y: auto; padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.msg { max-width: 76ch; }
.msg header { font-size: 13px; font-weight: 600; display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 0; }
.msg header .to { color: var(--accent); font-weight: 500; margin-inline-start: 8px; }
.msg p { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 2px; }
.msg.ben { align-self: flex-end; background: var(--accent-soft); border-radius: var(--r) var(--r) var(--r) 3px; padding: 9px 13px; }
.msg.system { color: var(--muted); font-size: 13.5px; border-inline-start: 2px dashed var(--line-strong); padding-inline-start: 12px; }
.msg.system header { font-weight: 500; }
.msg .tlink { border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; font-size: 12.5px; text-decoration: underline; margin-top: 3px; }
.empty { margin: auto; text-align: center; color: var(--muted); max-width: 40ch; display: grid; gap: 6px; justify-items: center; }
.empty i { font-size: 30px; color: var(--line-strong); }
.empty strong { color: var(--ink-2); font-weight: 600; }
.composer { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 10px; padding: 12px 14px; border-top: 1px solid var(--line); background: var(--surface); align-items: end; }
.composer .to-row { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.composer .to-row select { width: auto; min-width: 170px; height: 34px; }
.composer textarea { min-height: 44px; max-height: 160px; }
.drawer .msgs { padding: 0; max-height: none; overflow: visible; }
.drawer .composer { padding: 12px 0 0; border-top: 0; }

/* report */
.report { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 18px; align-items: start; }
.paper { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 30px 34px 36px; max-width: 78ch; }
.paper .over { color: var(--muted); font-size: 13px; }
.paper h2 { font-size: 24px; font-weight: 700; margin: 2px 0 6px; }
.paper h3 { font-size: 16px; font-weight: 600; margin: 24px 0 6px; }
.paper ul { margin: 0; padding-inline-start: 20px; }
.paper li { margin: 3px 0; }
.paper p { margin: 6px 0; color: var(--ink-2); }

.toast { position: fixed; bottom: 24px; inset-inline-start: 50%; transform: translateX(50%); z-index: 40; background: var(--surface); color: var(--ink); border: 1px solid var(--accent-2); box-shadow: var(--shadow-up); border-radius: var(--r); padding: 10px 16px; font-weight: 500; animation: enter .25s var(--ease-out) both; }
.toast.bad { border-color: var(--bad); color: var(--bad); }

@media (max-width: 1100px) {
  .org-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 28px; }
}
@media (max-width: 820px) {
  .login { grid-template-columns: 1fr; }
  .login-plan { display: none; }
  .login-form { padding: 48px 24px; border: 0; }
  .app { grid-template-columns: 1fr; }
  .rail { position: sticky; top: 0; z-index: 10; height: auto; flex-direction: row; align-items: center; padding: 8px 10px; gap: 8px; border-inline-end: 0; border-bottom: 1px solid var(--line); }
  .rail-brand, .rail-foot span { display: none; }
  .rail-nav { grid-auto-flow: column; grid-auto-columns: 1fr; flex: 1; }
  .rail-nav a { justify-content: center; padding: 0 6px; gap: 6px; font-size: 13px; }
  .rail-nav a span { display: none; }
  .nav-glide { display: none; }
  .rail-nav a[aria-current="page"] { background: var(--accent-soft); }
  .rail-foot { margin: 0; }
  .view { padding: 20px 16px 48px; }
  .org-cols { grid-template-columns: 1fr; }
  .chat, .report { grid-template-columns: 1fr; height: auto; }
  .channels { grid-auto-flow: column; grid-auto-columns: max-content; overflow-x: auto; padding-bottom: 6px; }
  .channels h3 { display: none; }
  .room { height: 62dvh; }
  .board { grid-auto-flow: row; grid-auto-columns: auto; overflow: visible; }
  .col { min-height: 0; }
  .decide .two { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
