:root {
  --desk: #1f3d33;
  --desk-2: #2c5446;
  --desk-ink: #e7efe9;
  --desk-ink-2: #b7cbbf;
  --ground: #f3f4f1;
  --wall: #e4e7e1;
  --paper: #ffffff;
  --line: #d9ddd6;
  --line-2: #eceee9;
  --ink: #1d2420;
  --ink-2: #4c5850;
  --ink-3: #6b766f;
  --done: #2f6b4f;
  --brass: #b8893a;
  --brass-ink: #241806;
  --brass-wash: #f6efe1;
  --fail: #b3362b;
  --fail-wash: #fbeceb;
  --radius: 6px;
  --step: steps(2, end);
  font-family: Heebo, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--ground);
  font-size: 15px;
  line-height: 1.5;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--ground); }
::selection { background: var(--desk); color: var(--desk-ink); }
:focus-visible { outline: 2px solid var(--desk); outline-offset: 2px; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
button { font: inherit; color: inherit; }
a { color: var(--desk); text-underline-offset: 3px; }
.num, time { font-variant-numeric: tabular-nums; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #c9cec6; border-radius: 10px; border: 2px solid var(--ground); }
::-webkit-scrollbar-track { background: transparent; }

/* --- buttons --- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 0 16px; border-radius: var(--radius); border: 1px solid var(--desk); background: var(--paper); color: var(--desk); font-weight: 700; font-size: 14px; cursor: pointer; white-space: nowrap; }
.btn:hover { background: #eef2ef; }
.btn.primary { background: var(--desk); color: #fff; }
.btn.primary:hover { background: var(--desk-2); }
.btn.quiet { border-color: var(--line); color: var(--ink-2); }
.btn.danger { border-color: var(--fail); color: var(--fail); }
.btn[disabled] { opacity: .5; cursor: default; }
.link { background: none; border: 0; padding: 0; color: var(--desk); font-weight: 700; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* --- login --- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px; background: var(--desk); }
.login-card { width: min(380px, 100%); background: var(--paper); border-radius: 10px; padding: 32px 28px; display: grid; gap: 14px; text-align: center; box-shadow: 0 12px 32px rgb(0 0 0 / .25); }
.login-avatar { border-radius: 50%; justify-self: center; object-fit: cover; }
.login-card h1 { font-size: 22px; font-weight: 800; }
.login-card p { color: var(--ink-2); }
.code-row { display: grid; gap: 8px; text-align: start; }
.code-row label { font-weight: 700; font-size: 14px; }
.code-row input { font: 700 24px Heebo; letter-spacing: .3em; text-align: center; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); }
.form-error { color: var(--fail); min-height: 1.5em; font-size: 14px; }

/* --- shell --- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100dvh; }
.rail { background: var(--desk); color: var(--desk-ink); padding: 24px 16px; display: flex; flex-direction: column; gap: 8px; position: sticky; top: 0; height: 100dvh; }
.brand { display: flex; gap: 12px; align-items: center; padding: 0 6px 18px; }
.brand img { border-radius: 50%; object-fit: cover; }
.brand strong { display: block; font-size: 19px; font-weight: 800; line-height: 1.2; }
.brand span { font-size: 12px; color: var(--desk-ink-2); }
.nav { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius); color: var(--desk-ink); text-decoration: none; font-size: 15px; }
.nav a:hover { background: rgb(255 255 255 / .06); }
.nav a[aria-current="page"] { background: var(--desk-2); font-weight: 700; }
.nav svg, .tabbar svg { flex: none; }
.count { margin-inline-start: auto; min-width: 22px; height: 20px; padding: 0 7px; border-radius: 10px; background: var(--brass); color: var(--brass-ink); font-size: 12px; font-weight: 800; display: inline-grid; place-items: center; }
.rail-out { margin-top: auto; background: none; border: 0; color: var(--desk-ink-2); text-align: start; padding: 8px 10px; cursor: pointer; font-size: 14px; }
.rail-out:hover { color: #fff; }
.tabbar { display: none; }

.main { padding: 28px 32px 48px; min-width: 0; outline: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; font-weight: 800; line-height: 1.2; }
.page-head p { color: var(--ink-2); margin-top: 4px; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; align-items: start; }
.cols.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.section { margin-top: 28px; }
.section:first-child { margin-top: 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head h2 { font-size: 16px; font-weight: 700; }
.section-head span, .section-head a { font-size: 14px; color: var(--ink-2); }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; }
.panel-pad { padding: 18px 20px; }
.muted { color: var(--ink-3); }
.empty { color: var(--ink-3); padding: 18px 20px; }
.loading { color: var(--ink-3); padding: 40px 0; }

/* --- the slip: what waits for Dolev (brass only here) --- */
.slip { position: relative; background: var(--paper); border: 1px solid #e3d3b2; border-radius: 8px; padding: 22px 20px 16px; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.slip + .slip { margin-top: 18px; }
.more-waiting { margin-top: 12px; font-weight: 700; }
.slip-tag { position: absolute; top: -10px; inset-inline-start: 18px; background: var(--brass); color: var(--brass-ink); font-size: 12px; font-weight: 800; padding: 2px 10px; border-radius: 3px; }
.slip-text { flex: 1 1 320px; min-width: 0; }
.slip-text strong { display: block; font-size: 16px; }
.slip-text p { color: var(--ink-2); font-size: 14px; white-space: pre-line; margin-top: 2px; }
.slip-actions { display: flex; gap: 8px; }

/* --- alerts (failure only) --- */
.alert { background: var(--fail-wash); border: 1px solid #efc7c3; color: #7c2219; border-radius: 8px; padding: 12px 16px; display: flex; gap: 10px; align-items: flex-start; }
.alert + .alert { margin-top: 8px; }
.alert strong { color: #6a1c14; }

/* --- the pigeonhole wall --- */
.wall { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; background: var(--wall); padding: 10px 10px 14px; border-radius: 8px; box-shadow: inset 0 1px 3px rgb(31 61 51 / .12), 0 1px 0 #fff; position: relative; }
.wall::after { content: ""; position: absolute; inset-inline: 0; bottom: 0; height: 6px; background: #cfd5cc; border-radius: 0 0 8px 8px; }
.cell { all: unset; box-sizing: border-box; position: relative; background: var(--paper); border: 1px solid #d3d8d0; border-radius: 3px; box-shadow: inset 0 8px 8px -8px rgb(31 61 51 / .22); min-height: 136px; padding: 16px 14px 12px; display: flex; flex-direction: column; gap: 2px; cursor: pointer; }
.cell:hover { border-color: #a9b4ab; }
.cell:focus-visible { outline: 2px solid var(--desk); outline-offset: 2px; }
.cell-no { align-self: flex-start; font-size: 11px; font-weight: 700; color: var(--ink-2); font-variant-numeric: tabular-nums; background: var(--ground); border: 1px solid #cdd3ca; border-radius: 2px; padding: 0 6px; line-height: 18px; margin-bottom: 4px; }
.cell-name { font-size: 17px; font-weight: 700; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-kind { font-size: 12px; color: var(--ink-3); }
.cell-stage { margin-top: auto; font-size: 13px; color: var(--ink-2); line-height: 1.35; }
.cell.booked { background: #eff6f1; border-color: #bfd8c8; }
.cell.booked .cell-stage { color: var(--done); font-weight: 700; }
.cell.closed { background: #f6f7f4; }
.cell.closed .cell-name { color: var(--ink-3); }
.cell .slip-tag { top: -9px; }
.cell.vacant { cursor: default; background: #dde1da; border-color: #cbd0c7; box-shadow: inset 0 10px 12px -8px rgb(31 61 51 / .28); display: grid; place-items: center; color: var(--ink-2); font-size: 13px; }

/* --- lists and tables --- */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: 12px; padding: 11px 20px; border-bottom: 1px solid var(--line-2); align-items: baseline; }
.list li:last-child { border-bottom: 0; }
.list time { flex: none; width: 48px; font-weight: 700; color: var(--ink); }
.list .what { flex: 1; min-width: 0; }
.list .what small { display: block; color: var(--ink-3); font-size: 13px; }
.tag { display: inline-block; font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 10px; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.tag.ok { background: #e3efe8; color: var(--done); }
.tag.fail { background: var(--fail-wash); color: var(--fail); }
.tag.wait { background: var(--brass-wash); color: #6b4c14; }
table.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
.grid th { text-align: start; font-weight: 500; color: var(--ink-3); font-size: 13px; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.grid td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.grid tr:last-child td { border-bottom: 0; }
.grid .num { text-align: end; white-space: nowrap; }
.late { color: var(--fail); font-weight: 700; }

.health li { justify-content: space-between; }
.health small { display: block; font-size: 12px; color: var(--ink-3); }
.health .state { font-weight: 700; font-size: 14px; white-space: nowrap; }
.health .state.ok { color: var(--done); }
.health .state.fail { color: var(--fail); }
.figure { font-size: 28px; font-weight: 800; line-height: 1.1; }
.figure-row { display: flex; gap: 28px; flex-wrap: wrap; }
.figure-row div span { display: block; font-size: 13px; color: var(--ink-3); }

/* --- tabs / segmented --- */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); padding: 2px; gap: 2px; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 4px; font-size: 14px; cursor: pointer; color: var(--ink-2); }
.seg button[aria-pressed="true"] { background: var(--desk); color: #fff; font-weight: 700; }

/* --- chart --- */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis { fill: var(--ink-3); font-size: 11px; font-family: Heebo, sans-serif; }
.chart .gridline { stroke: var(--line-2); stroke-width: 1; }
.chart .baseline { stroke: #c9cec6; stroke-width: 1; }
.chart .bar { fill: var(--desk); }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover + .bar, .chart .bar.on { fill: var(--desk-2); }
.tip { position: absolute; pointer-events: none; background: var(--ink); color: #fff; font-size: 13px; padding: 6px 10px; border-radius: 6px; white-space: nowrap; transform: translate(50%, -100%); margin-top: -8px; }

/* --- details (meeting summaries) --- */
details.meeting { border-bottom: 1px solid var(--line-2); }
details.meeting:last-child { border-bottom: 0; }
details.meeting summary { list-style: none; cursor: pointer; padding: 13px 20px; display: flex; gap: 12px; align-items: baseline; }
details.meeting summary::-webkit-details-marker { display: none; }
details.meeting summary .what { flex: 1; font-weight: 700; }
details.meeting .body { padding: 0 20px 16px; color: var(--ink-2); font-size: 14px; }
details.meeting .body h4 { margin: 10px 0 4px; font-size: 13px; color: var(--ink); }
details.meeting ul { margin: 0; padding-inline-start: 18px; }

/* --- facts --- */
.fact { display: flex; gap: 10px; align-items: flex-start; padding: 12px 20px; border-bottom: 1px solid var(--line-2); }
.fact:last-child { border-bottom: 0; }
.fact p { flex: 1; }
.fact textarea { flex: 1; font: inherit; padding: 8px; border: 1px solid var(--line); border-radius: var(--radius); min-height: 70px; }

/* --- the conversation drawer --- */
.drawer, .sheet { position: fixed; inset: 0; z-index: 40; }
.drawer-scrim { position: absolute; inset: 0; background: rgb(17 30 25 / .35); }
.drawer-panel { position: absolute; inset-block: 0; left: 0; width: min(560px, 100%); background: var(--ground); box-shadow: 8px 0 30px rgb(0 0 0 / .18); display: flex; flex-direction: column; animation: hinge 120ms var(--step); }
@keyframes hinge { from { transform: translateX(-100%); } to { transform: none; } }
.drawer-head { background: var(--paper); border-bottom: 1px solid var(--line); padding: 18px 22px 14px; display: grid; gap: 4px; }
.drawer-head .row { display: flex; align-items: center; gap: 12px; }
.drawer-head h2 { font-size: 22px; font-weight: 800; flex: 1; }
.drawer-close { border: 0; background: none; cursor: pointer; padding: 6px; border-radius: var(--radius); color: var(--ink-2); }
.drawer-close:hover { background: var(--line-2); }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 22px; display: grid; gap: 18px; align-content: start; }
.facts dt { font-size: 12px; color: var(--ink-3); }
.facts dd { margin: 0 0 10px; white-space: pre-line; }
.chat { display: flex; flex-direction: column; gap: 8px; background: #e9ece6; border-radius: 8px; padding: 14px; }
.bubble { max-width: 82%; padding: 8px 12px 6px; border-radius: 10px; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble time { display: block; font-size: 11px; color: var(--ink-3); margin-top: 2px; }
.bubble.them { align-self: flex-start; background: var(--paper); border-start-start-radius: 2px; }
.bubble.ronit { align-self: flex-end; background: #dfeee5; border-start-end-radius: 2px; }
.bubble.ronit::before { content: "רונית"; display: block; font-size: 11px; font-weight: 700; color: var(--done); }
.drawer-foot { background: var(--paper); border-top: 1px solid var(--line); padding: 14px 22px calc(14px + env(safe-area-inset-bottom)); display: grid; gap: 10px; }
.drawer-foot textarea { font: inherit; width: 100%; min-height: 64px; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); resize: vertical; }
.drawer-foot .row { display: flex; gap: 8px; justify-content: space-between; flex-wrap: wrap; }

/* --- phone sheet (the rest of the nav) --- */
.sheet-panel { position: absolute; inset-inline: 0; bottom: 0; margin: 0; padding: 10px 10px calc(16px + env(safe-area-inset-bottom)); list-style: none; background: var(--desk); border-radius: 14px 14px 0 0; display: grid; gap: 2px; animation: rise 120ms var(--step); }
@keyframes rise { from { transform: translateY(100%); } to { transform: none; } }
.sheet-panel a { display: flex; gap: 12px; align-items: center; padding: 13px 14px; color: var(--desk-ink); text-decoration: none; border-radius: var(--radius); }
.sheet-panel a[aria-current="page"] { background: var(--desk-2); font-weight: 700; }

/* --- toast --- */
.toast { position: fixed; bottom: 24px; inset-inline-start: 50%; transform: translateX(50%); z-index: 60; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 14px; max-width: min(520px, calc(100% - 32px)); box-shadow: 0 6px 20px rgb(0 0 0 / .2); }

/* --- responsive --- */
@media (max-width: 1180px) {
  .cols { grid-template-columns: 1fr; }
  .wall { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .rail { display: none; }
  .main { padding: 18px 16px calc(92px + env(safe-area-inset-bottom)); }
  .page-head h1 { font-size: 22px; }
  .wall { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 8px; }
  .cell { min-height: 124px; padding: 15px 12px 10px; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; inset-inline: 0; bottom: 0; z-index: 30; background: var(--desk); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .tabbar a, .tabbar button { all: unset; display: grid; justify-items: center; gap: 2px; padding: 6px 2px; color: var(--desk-ink-2); font-size: 11px; position: relative; cursor: pointer; text-align: center; }
  .tabbar a[aria-current="page"] { color: #fff; font-weight: 700; }
  .tabbar .count { position: absolute; top: 0; inset-inline-start: calc(50% + 6px); margin: 0; min-width: 18px; height: 17px; font-size: 11px; padding: 0 5px; }
  .slip { padding: 22px 16px 14px; }
  .slip-actions { width: 100%; }
  .slip-actions .btn { flex: 1; }
  .list li { padding: 11px 16px; }
  .grid th, .grid td { padding: 10px; }
  .toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .hide-phone { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .drawer-panel, .sheet-panel { animation: none; }
}
