/* ROI CRM mobile. Full-screen app: stacked screens, bottom tab bar, bottom sheets. Tokens shared with the task system. */
:root {
  --bg: #EDF4E4; --surface: #FFFFFF; --sunken: #F4F8EE; --line: #D9E8C6;
  --ink: #16283A; --muted: #5B7285; --accent: #4F9E12; --accent-ink: #FFFFFF; --accent-soft: #E3F3D2;
  --blue: #2F6FB0; --blue-bg: #E2EDF8; --purple: #6B4FA0; --purple-bg: #EDE7F6;
  --amber: #B4700F; --amber-bg: #FBEDD8; --red: #A23B3B; --red-bg: #F5E3E1; --green: #2E8B4F; --green-bg: #E1F2E5;
  --wa: #1A9E4E; --ig: #B2357A; --out-bg: #DDF2CC; --chat-bg: #E4ECDA; --tick-read: #2F6FB0;
  --shadow: 0 1px 2px rgba(22,40,58,.06), 0 4px 14px rgba(22,40,58,.06);
  --f-display: "Rubik", "Arial Hebrew", system-ui, sans-serif;
  --f-body: "Assistant", "Arial Hebrew", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root {
  --bg: #10190F; --surface: #17221A; --sunken: #121C13; --line: #2A3B26;
  --ink: #E9F2E3; --muted: #9BAE9E; --accent: #7ED33F; --accent-ink: #0E1A0A; --accent-soft: #223B18;
  --blue: #8DB9E8; --blue-bg: #1A2A3A; --purple: #BCA5E8; --purple-bg: #2A2137;
  --amber: #E0A548; --amber-bg: #2E2517; --red: #E5766A; --red-bg: #331C1A; --green: #55C77B; --green-bg: #16301F;
  --wa: #25C463; --ig: #E270B0; --out-bg: #1F3A17; --chat-bg: #0B130A; --tick-read: #8DB9E8;
  --shadow: 0 1px 2px rgba(0,0,0,.3);
  color-scheme: dark;
} }

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; direction: rtl; }
.app { direction: rtl; text-align: right; unicode-bidi: isolate; }
.app input, .app textarea, .app select { text-align: right; }
.app input[type="tel"], .app .code-input { direction: ltr; }
.app .code-input { text-align: center; }
body { background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 15px; -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
a { color: var(--accent); }

.app { position: fixed; inset: 0; display: flex; flex-direction: column; padding-top: env(safe-area-inset-top, 0px); }
.screen { flex: 1; overflow-y: auto; padding: 0 16px calc(96px + env(safe-area-inset-bottom, 0px)); min-height: 0; -webkit-overflow-scrolling: touch; }
.topbar { position: sticky; top: 0; z-index: 3; background: var(--bg); padding: 14px 0 10px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.topbar h2 { font-family: var(--f-display); font-weight: 600; font-size: 24px; margin: 0; }
.eyebrow { font-size: 13px; color: var(--muted); }
.demo { font-size: 11px; font-weight: 700; color: var(--amber); background: var(--amber-bg); padding: 3px 8px; border-radius: 99px; white-space: nowrap; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; flex-shrink: 0; }
svg.i { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* Login */
.login { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 24px; gap: 12px; max-width: 440px; width: 100%; margin: 0 auto; }
.login .logo { font-family: var(--f-display); font-size: 36px; font-weight: 700; color: var(--accent); }
.login p { color: var(--muted); margin: 0 0 12px; line-height: 1.5; }
.login form { display: grid; gap: 4px; }
.code-input { letter-spacing: .4em; text-align: center; font-family: var(--f-display); font-size: 24px !important; direction: ltr; }
.err { color: var(--red); font-weight: 600; min-height: 1.4em; margin: 0; }
.demo-note { font-size: 13px; color: var(--amber); }

.field { display: grid; gap: 6px; margin-bottom: 12px; }
.field label { font-size: 13px; font-weight: 700; color: var(--muted); }
.field input, .field select { height: 48px; border: 1px solid var(--line); border-radius: 12px; background: var(--sunken); padding: 0 12px; font: inherit; font-size: 16px; color: var(--ink); width: 100%; }
.field input[type="tel"] { direction: ltr; text-align: right; }

.btn { border: 1px solid var(--line); background: var(--sunken); border-radius: 10px; padding: 8px 12px; font-size: 14px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; color: var(--ink); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.big { width: 100%; height: 50px; font-size: 16px; }
.btn[disabled] { opacity: .6; }
.btn svg.i { width: 18px; height: 18px; }
.link { background: none; border: 0; color: var(--accent); font-weight: 700; font-size: 14px; padding: 8px 4px; }

/* Lists */
.list { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 0; background: none; width: 100%; text-align: start; border-bottom: 1px solid var(--line); min-height: 62px; color: var(--ink); }
.row:last-child { border-bottom: 0; }
.row .grow { flex: 1; min-width: 0; }
.row .t { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .s { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .chev { color: var(--muted); }
.av { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-family: var(--f-display); font-weight: 600; font-size: 15px; flex-shrink: 0; background: var(--accent-soft); color: var(--accent); }
.av-wrap { position: relative; flex-shrink: 0; }
.ch-badge { position: absolute; bottom: -2px; inset-inline-end: -3px; width: 19px; height: 19px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--surface); color: #fff; font-size: 9px; font-weight: 700; }
.c-wa { background: var(--wa); } .c-sms { background: var(--purple); } .c-mail { background: var(--blue); } .c-ig { background: var(--ig); } .c-fb { background: var(--blue); } .c-call { background: var(--amber); } .c-other { background: var(--muted); }
.conv.unread .t, .conv.unread .s { color: var(--ink); font-weight: 700; }
.side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.time { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.conv.unread .time { color: var(--wa); font-weight: 700; }
.badge { min-width: 20px; height: 20px; border-radius: 99px; background: var(--wa); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; padding: 0 6px; }
.empty { text-align: center; color: var(--muted); padding: 36px 20px; line-height: 1.5; }
.skel { height: 62px; border-bottom: 1px solid var(--line); background: linear-gradient(90deg, var(--surface), var(--sunken), var(--surface)); background-size: 200% 100%; animation: skel 1.2s infinite; }
@keyframes skel { to { background-position: -200% 0; } }

.search { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 0 12px; height: 46px; margin-bottom: 10px; color: var(--muted); }
.search input { border: 0; background: transparent; flex: 1; font: inherit; font-size: 16px; color: var(--ink); outline: none; min-width: 0; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 10px; scrollbar-width: none; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 7px 14px; font-size: 14px; white-space: nowrap; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.install { display: flex; align-items: center; gap: 10px; background: var(--accent-soft); color: var(--ink); border-radius: 14px; padding: 10px 12px; margin-bottom: 10px; font-size: 14px; }
.install .grow { flex: 1; }
.install b { color: var(--accent); }

/* Chat */
.app.in-chat .tabbar { display: none !important; }
.chat { padding: 0; display: flex; flex-direction: column; overflow: hidden; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--surface); border-bottom: 1px solid var(--line); }
.chat-head .who { flex: 1; min-width: 0; border: 0; background: none; padding: 0; text-align: start; display: flex; align-items: center; gap: 10px; }
.chat-head .who .t { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-head .who .s { font-size: 12.5px; color: var(--muted); }
.chat-head .av { width: 38px; height: 38px; font-size: 14px; }
.ch-pill { border: 1px solid var(--line); background: var(--sunken); border-radius: 99px; font-size: 12.5px; font-weight: 600; padding: 6px 10px; white-space: nowrap; display: inline-flex; align-items: center; gap: 5px; }
.ch-pill i { width: 8px; height: 8px; border-radius: 50%; }
.msgs { flex: 1; overflow-y: auto; padding: 10px 12px 14px; display: flex; flex-direction: column; gap: 4px; background: var(--chat-bg); }
.day-sep { align-self: center; font-size: 12px; font-weight: 600; background: var(--surface); color: var(--muted); padding: 3px 10px; border-radius: 99px; margin: 10px 0 6px; box-shadow: var(--shadow); }
.sys { align-self: center; font-size: 12px; color: var(--muted); margin: 4px 0; }
.bub { max-width: 84%; padding: 7px 10px 5px; border-radius: 14px; font-size: 15px; line-height: 1.4; box-shadow: 0 1px 1px rgba(0,0,0,.07); overflow-wrap: anywhere; white-space: pre-wrap; }
.bub.inbound { align-self: flex-start; background: var(--surface); border-start-start-radius: 4px; }
.bub.outbound { align-self: flex-end; background: var(--out-bg); border-start-end-radius: 4px; }
.bub.pending { opacity: .6; }
.bub.failed { outline: 1px solid var(--red); }
.bub img { display: block; max-width: 100%; border-radius: 10px; margin-bottom: 4px; }
.bub audio { width: 230px; max-width: 100%; height: 36px; margin: 2px 0; direction: ltr; }
.callrow { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.callrow svg.i { width: 18px; height: 18px; color: var(--accent); }
.meta { font-size: 11px; color: var(--muted); display: flex; gap: 4px; justify-content: flex-end; margin-top: 2px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.meta .ch { opacity: .8; }
.file { display: flex; gap: 8px; align-items: center; padding: 6px 8px; background: var(--sunken); border-radius: 10px; margin-bottom: 4px; text-decoration: none; color: var(--ink); }
.composer { display: flex; align-items: flex-end; gap: 8px; padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px)); background: var(--surface); border-top: 1px solid var(--line); }
.composer textarea { flex: 1; min-width: 0; resize: none; border: 1px solid var(--line); border-radius: 21px; padding: 10px 14px; font: inherit; font-size: 16px; background: var(--sunken); color: var(--ink); max-height: 120px; height: 42px; line-height: 1.35; scrollbar-width: none; overflow-y: hidden; }
.round { width: 42px; height: 42px; border-radius: 50%; border: 0; display: grid; place-items: center; flex-shrink: 0; background: var(--accent); color: var(--accent-ink); }

/* Contact */
.detail-head { text-align: center; padding: 4px 0 16px; }
.detail-head .av { width: 76px; height: 76px; font-size: 26px; margin: 0 auto 10px; }
.detail-head h2 { font-family: var(--f-display); font-size: 24px; margin: 0; }
.actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 16px; }
.act { display: flex; flex-direction: column; align-items: center; gap: 6px; background: var(--surface); border: 0; border-radius: 14px; padding: 12px 4px; font-size: 13px; font-weight: 600; box-shadow: var(--shadow); text-decoration: none; color: var(--ink); }
.act svg { color: var(--accent); }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 14px; }
.kv:last-child { border-bottom: 0; }
.kv span:first-child { color: var(--muted); flex-shrink: 0; }
.kv span:last-child { font-weight: 600; text-align: end; min-width: 0; overflow-wrap: anywhere; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.tag { font-size: 12px; background: var(--sunken); border: 1px solid var(--line); border-radius: 99px; padding: 2px 8px; }

/* Pipeline */
.stage-tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 12px; scrollbar-width: none; }
.stage-tab { border: 0; border-radius: 12px; padding: 8px 12px; background: var(--surface); display: flex; flex-direction: column; align-items: flex-start; min-width: 108px; box-shadow: var(--shadow); text-align: start; }
.stage-tab b { font-size: 13px; white-space: nowrap; }
.stage-tab span { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.stage-tab[aria-pressed="true"] { outline: 2px solid var(--accent); }
.opp { background: var(--surface); border-radius: 16px; padding: 14px; box-shadow: var(--shadow); margin-bottom: 10px; display: grid; gap: 8px; }
.opp-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.opp-top b { font-size: 16px; }
.money { font-family: var(--f-display); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.opp-btns { display: flex; gap: 8px; }
.more-note { font-size: 13px; color: var(--muted); text-align: center; margin: 8px 0; }

.menu .row svg { color: var(--muted); }
.version { text-align: center; color: var(--muted); font-size: 12px; margin-top: 16px; }

/* Tab bar + FAB */
.tabbar { position: fixed; bottom: 0; inset-inline: 0; z-index: 5; background: var(--surface); border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(5, 1fr); padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px)); }
.tab { border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11.5px; font-weight: 600; color: var(--muted); padding: 6px 0; min-height: 52px; }
.tab[aria-current="page"] { color: var(--accent); }
.tab-wrap { position: relative; }
.dot { position: absolute; top: -3px; inset-inline-end: -9px; background: var(--wa); color: #fff; font-size: 10px; font-weight: 700; border-radius: 99px; padding: 0 5px; line-height: 16px; }
.fab { position: fixed; z-index: 6; inset-inline-start: 18px; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); width: 58px; height: 58px; border-radius: 18px; border: 0; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; box-shadow: 0 8px 20px rgba(79,158,18,.35); }
.fab svg.i { width: 28px; height: 28px; stroke-width: 2.4; }

/* Sheet + toast */
.scrim { position: fixed; inset: 0; background: rgba(10,20,15,.45); z-index: 10; opacity: 0; pointer-events: none; transition: opacity .2s; }
.scrim.open { opacity: 1; pointer-events: auto; }
.sheet { position: fixed; inset-inline: 0; bottom: 0; z-index: 11; background: var(--surface); border-radius: 22px 22px 0 0; padding: 10px 16px calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateY(105%); transition: transform .25s ease; max-height: 88%; overflow-y: auto; }
.sheet.open { transform: none; }
.grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 12px; }
.sheet h3 { font-family: var(--f-display); font-size: 20px; margin: 0 0 14px; }
.sheet-note { font-size: 13px; color: var(--muted); line-height: 1.5; margin: 4px 0 12px; }
.opt { width: 100%; display: flex; align-items: center; justify-content: space-between; border: 0; background: none; padding: 14px 4px; border-bottom: 1px solid var(--line); font-size: 16px; text-align: start; }
.opt[aria-checked="true"] { font-weight: 700; color: var(--accent); }
.steps { margin: 0; padding-inline-start: 20px; line-height: 1.8; }
.toast { position: fixed; z-index: 20; inset-inline: 16px; top: calc(12px + env(safe-area-inset-top, 0px)); background: var(--ink); color: var(--bg); border-radius: 14px; padding: 12px 16px; font-weight: 600; transform: translateY(-160%); transition: transform .25s; }
.toast.show { transform: none; }

@media (min-width: 700px) { .screen, .login { max-width: 640px; margin-inline: auto; width: 100%; } }
@media (prefers-reduced-motion: reduce) { .sheet, .scrim, .toast { transition: none; } .skel { animation: none; } }

/* Composer: channel chips above the text box, in the chat and in "new message" */
.composer-box { background: var(--surface); border-top: 1px solid var(--line); }
.composer-box .composer { border-top: 0; }
.ch-row { display: flex; gap: 6px; overflow-x: auto; padding: 8px 10px 0; scrollbar-width: none; }
.ch-chip { border: 1px solid var(--line); background: var(--sunken); border-radius: 99px; padding: 5px 11px; font-size: 13px; font-weight: 600; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.ch-chip i { width: 8px; height: 8px; border-radius: 50%; }
.ch-chip[aria-checked="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.ch-chip[disabled] { opacity: .45; }
.subject { display: block; margin: 8px 10px 0; width: calc(100% - 20px); height: 40px; border: 1px solid var(--line); border-radius: 12px; background: var(--sunken); padding: 0 12px; font: inherit; font-size: 16px; color: var(--ink); }

/* Inbox: "new message" bar above the tab bar */
#v-inbox { padding-bottom: calc(150px + env(safe-area-inset-bottom, 0px)); }
.compose-bar { position: fixed; inset-inline: 0; bottom: calc(64px + env(safe-area-inset-bottom, 0px)); z-index: 4; padding: 8px 12px; background: linear-gradient(to top, var(--bg) 70%, transparent); }
.compose-open { width: 100%; max-width: 616px; margin: 0 auto; display: flex; align-items: center; gap: 10px; height: 48px; border: 1px solid var(--line); border-radius: 24px; background: var(--surface); color: var(--muted); padding: 0 16px; font-size: 16px; box-shadow: var(--shadow); }
.compose-open svg.i { color: var(--accent); }
.nc-to { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--sunken); padding: 0 12px; min-height: 48px; margin-bottom: 8px; }
.nc-to label { font-weight: 700; color: var(--muted); }
.nc-to input { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; font-size: 16px; color: var(--ink); outline: none; height: 46px; }
.nc-picked { display: inline-flex; align-items: center; gap: 6px; background: var(--accent-soft); color: var(--ink); border-radius: 99px; padding: 4px 6px 4px 10px; font-weight: 600; }
.nc-picked button { border: 0; background: none; color: var(--muted); padding: 0 4px; font-size: 16px; }
.nc-results { margin-bottom: 8px; max-height: 220px; overflow-y: auto; }
.nc-results .row { min-height: 52px; }
.sheet .ch-row { padding: 0 0 8px; }
.sheet .subject { margin: 0 0 8px; width: 100%; }
.nc-text { width: 100%; min-height: 96px; resize: vertical; border: 1px solid var(--line); border-radius: 12px; background: var(--sunken); padding: 10px 12px; font: inherit; font-size: 16px; color: var(--ink); margin-bottom: 10px; }

/* Account / pipeline pickers: a clear "choose from a list" control */
.picker { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; margin-bottom: 6px; padding: 7px 12px; font: inherit; font-size: 15px; font-weight: 700; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.picker svg.i { width: 18px; height: 18px; color: var(--accent); flex-shrink: 0; }
.picker span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.picker[disabled] { padding: 0; background: none; border-color: transparent; box-shadow: none; font-size: 13px; font-weight: 600; color: var(--muted); }
.picker[disabled] svg { display: none; }

/* Tasks */
.dot.late-dot { background: var(--red); }
.task { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.task:last-child { border-bottom: 0; }
.task .grow { flex: 1; min-width: 0; border: 0; background: none; padding: 0; text-align: start; color: var(--ink); }
.task .t { font-weight: 700; line-height: 1.35; }
.task .s { font-size: 13px; color: var(--muted); margin-top: 2px; display: flex; gap: 8px; flex-wrap: wrap; }
.task.done .t { text-decoration: line-through; color: var(--muted); }
.check { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line); background: var(--surface); flex-shrink: 0; display: grid; place-items: center; padding: 0; margin-top: 1px; color: var(--accent-ink); }
.check svg.i { width: 16px; height: 16px; stroke-width: 3; opacity: 0; }
.task.done .check { background: var(--accent); border-color: var(--accent); }
.task.done .check svg.i { opacity: 1; }
.late { color: var(--red); font-weight: 700; }
.today { color: var(--accent); font-weight: 700; }
.due-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.task-detail .kv span:last-child { font-weight: 600; }
.task-body { white-space: pre-wrap; line-height: 1.5; background: var(--sunken); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; }
