:root {
  --bg: #f6f4ef; --card: #ffffff; --ink: #1c1f1e; --muted: #5f6662; --line: #e3e0d8;
  --accent: #0f766e; --accent-ink: #ffffff; --accent-soft: #e2f1ee;
  --good: #15803d; --good-soft: #e3f4e8; --warn: #b45309; --warn-soft: #fbf0dc;
  --bad: #b91c1c; --bad-soft: #fbe5e3; --info: #1d4ed8; --info-soft: #e5ecfb;
  --radius: 14px; --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.04);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
@media (max-width: 640px) { .hide-sm { display: none; } }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 16px/1.5 "Segoe UI", "Noto Sans Hebrew", "Arial Hebrew", Arial, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }

/* top bar */
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 24px; padding: 12px 24px;
  background: rgba(246,244,239,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; color: var(--ink); text-decoration: none; }
.logo { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); position: relative; }
.logo::after { content: ""; position: absolute; inset: 8px 7px; border-top: 2.5px solid #fff; border-bottom: 2.5px solid #fff; }
.top nav { display: flex; gap: 4px; flex-wrap: wrap; }
.top nav a { padding: 8px 14px; border-radius: 999px; color: var(--muted); text-decoration: none; font-weight: 600; }
.top nav a.on { background: var(--ink); color: #fff; }
.top nav a:hover:not(.on) { background: #ebe8e0; color: var(--ink); }
.top .pill { margin-inline-start: auto; }

main { max-width: 1120px; margin: 0 auto; padding: 28px 24px 80px; }
h1 { font-size: 28px; margin: 0 0 4px; letter-spacing: -.01em; }
h2 { font-size: 20px; margin: 0 0 12px; }
h3 { font-size: 16px; margin: 0 0 8px; }
.sub { color: var(--muted); margin: 0 0 24px; }
.head { display: flex; align-items: flex-start; gap: 16px; justify-content: space-between; flex-wrap: wrap; margin-bottom: 24px; }
.head .sub { margin: 0; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.stack > * + * { margin-top: 16px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: 1.3fr 1fr; }
@media (max-width: 860px) { .grid.two { grid-template-columns: 1fr; } }

/* buttons & inputs */
button, .btn { font: inherit; font-weight: 600; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 10px 18px;
  border-radius: 10px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
button:hover, .btn:hover { border-color: #cfcabe; }
button.primary, .btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.primary:hover { filter: brightness(1.07); }
button.big { padding: 14px 26px; font-size: 17px; }
button.danger { color: var(--bad); }
button.link { border: 0; background: none; padding: 4px 6px; color: var(--accent); }
button:disabled { opacity: .5; cursor: not-allowed; }
input, select, textarea { font: inherit; color: var(--ink); background: #fff; border: 1px solid #d6d2c7; border-radius: 10px; padding: 10px 12px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
textarea { min-height: 140px; resize: vertical; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--accent); }
label.field { display: block; }
label.field > span { display: block; font-weight: 600; margin-bottom: 6px; }
label.field > small { display: block; color: var(--muted); margin-top: 4px; }
label.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
label.check input { margin-top: 3px; flex: none; }

/* badges */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; font-size: 14px; font-weight: 600; background: #ebe8e0; color: var(--muted); white-space: nowrap; }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.info { background: var(--info-soft); color: var(--info); }

/* stat tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; cursor: default; }
.tile.clickable { cursor: pointer; }
.tile.clickable:hover { border-color: var(--accent); }
.tile.on { outline: 2px solid var(--accent); }
.tile b { display: block; font-size: 28px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.tile span { color: var(--muted); font-size: 14px; font-weight: 600; }
.tile.good b { color: var(--good); } .tile.bad b { color: var(--bad); } .tile.warn b { color: var(--warn); } .tile.info b { color: var(--info); }

.bar { height: 10px; background: #ebe8e0; border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .4s; }
.bar.thin { height: 6px; }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: start; padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 13px; color: var(--muted); font-weight: 700; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; } tr.click:hover td { background: #faf9f6; }
td.num { font-variant-numeric: tabular-nums; }

/* notices */
.note { border-radius: 12px; padding: 12px 16px; background: var(--info-soft); color: #1e3a8a; }
.note.warn { background: var(--warn-soft); color: #7c2d12; }
.note.bad { background: var(--bad-soft); color: #7f1d1d; }
.note.good { background: var(--good-soft); color: #14532d; }

/* steps on empty home */
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.step { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.step .n { width: 32px; height: 32px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-weight: 700; margin-bottom: 12px; }
.step.done .n { background: var(--good); }
.step p { color: var(--muted); margin: 6px 0 14px; }

/* numbers grid */
.agents { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.agent { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.agent .top-line { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.agent .name { font-weight: 700; }
.agent .actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; }
.agent .actions button { padding: 7px 12px; font-size: 14px; }
.agent.off { opacity: .6; }

/* file drop */
.drop { border: 2px dashed #cfcabe; border-radius: var(--radius); padding: 40px 20px; text-align: center; background: #fbfaf7; cursor: pointer; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop b { display: block; font-size: 18px; margin-bottom: 4px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tabs button { border: 0; border-radius: 0; background: none; padding: 10px 14px; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--ink); }

/* phone preview bubble */
.phone { background: #e7dfd4; border-radius: 18px; padding: 18px 14px; min-height: 160px; }
.bubble { background: #d9fdd3; border-radius: 10px 0 10px 10px; padding: 8px 12px; max-width: 92%; margin-inline-start: auto; white-space: pre-wrap; word-break: break-word; box-shadow: 0 1px 1px rgba(0,0,0,.08); }
.bubble + .bubble { margin-top: 10px; }
.bubble small { display: block; color: #667; font-size: 12px; margin-top: 2px; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button { padding: 6px 12px; font-size: 14px; border-radius: 999px; }
.chips button.on { background: var(--ink); color: #fff; border-color: var(--ink); }

.agent-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px; max-height: 260px; overflow: auto; padding: 4px; }
.agent-pick label { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; display: flex; gap: 8px; align-items: center; cursor: pointer; font-size: 14px; }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(20,20,18,.45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--card); border-radius: 18px; padding: 24px; width: min(480px, 100%); max-height: 92vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal h2 { margin-bottom: 8px; }
.modal .foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }
.qr { display: grid; place-items: center; min-height: 280px; background: #fff; border: 1px solid var(--line); border-radius: 12px; margin: 16px 0; }
.qr img { width: 264px; height: 264px; image-rendering: pixelated; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 12px; z-index: 60; box-shadow: var(--shadow); max-width: 90vw; }
.toast.bad { background: var(--bad); }

.login { max-width: 380px; margin: 12vh auto; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.pager { display: flex; gap: 8px; align-items: center; justify-content: center; margin-top: 12px; }

@media (max-width: 640px) {
  .top { padding: 10px 14px; gap: 10px; }
  .top .pill { display: none; }
  main { padding: 20px 14px 60px; }
  h1 { font-size: 24px; }
  .tile b { font-size: 22px; }
}

/* auto-reply: chat window */
.chat { background: #e7dfd4; border-radius: 18px; padding: 14px; height: 420px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.chat .msg { border-radius: 10px; padding: 7px 11px; max-width: 85%; white-space: pre-wrap; word-break: break-word; box-shadow: 0 1px 1px rgba(0,0,0,.08); }
.chat .msg.in { background: #fff; align-self: flex-start; border-start-start-radius: 0; }
.chat .msg.out { background: #d9fdd3; align-self: flex-end; border-start-end-radius: 0; }
.chat .msg small { display: block; color: #667; font-size: 12px; margin-top: 2px; }
.chat .note-line { align-self: center; background: #fff8e1; color: #6b5300; font-size: 13px; border-radius: 8px; padding: 4px 10px; max-width: 92%; text-align: center; }
.chat .note-line.error { background: #fdecea; color: #8a1c13; }
.sim-banner { background: #fff3cd; color: #6b5300; border-radius: 10px; padding: 6px 12px; font-size: 13px; font-weight: 600; text-align: center; margin-bottom: 10px; }
.rule { border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.rule + .rule { margin-top: 10px; }
.rule.off { opacity: .55; }

.chat-row { display: block; width: 100%; text-align: start; background: var(--card, #fff); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; cursor: pointer; }
.chat-row:hover { background: #f4f7f5; }
.small-btn { padding: 3px 10px; font-size: 13px; }
.badge { display: inline-block; min-width: 20px; padding: 1px 6px; border-radius: 10px; background: #25d366; color: #fff; font-size: 12px; font-weight: 700; text-align: center; line-height: 18px; vertical-align: middle; }

/* ================= WhatsApp-style chats ================= */
body.wide main { max-width: 1500px; padding-top: 16px; padding-bottom: 16px; }
.wa { --wa-green: #00a884; --wa-ink: #111b21; --wa-sub: #667781; --wa-bar: #f0f2f5; --wa-line: #e9edef;
  display: grid; grid-template-columns: minmax(300px, 30%) 1fr; height: calc(100dvh - 110px); min-height: 520px;
  background: #fff; border-radius: 14px; overflow: hidden; box-shadow: 0 1px 3px rgba(11,20,26,.12), 0 8px 30px rgba(11,20,26,.06);
  font-family: "Segoe UI", "Helvetica Neue", "Noto Sans Hebrew", Arial, sans-serif; color: var(--wa-ink); }
.wa button { font: inherit; }
.wa-side { display: flex; flex-direction: column; border-inline-end: 1px solid var(--wa-line); min-width: 0; background: #fff; }
.wa-bar { display: flex; align-items: center; gap: 12px; height: 60px; padding: 0 16px; background: var(--wa-bar); flex-shrink: 0; }
.wa-bar select { flex: 1; min-width: 0; border: 0; background: transparent; font-weight: 600; font-size: 15px; color: var(--wa-ink); padding: 6px 4px; cursor: pointer; }
.wa-icon { border: 0; background: transparent; color: #54656f; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; padding: 0; }
.wa-icon:hover { background: rgba(11,20,26,.06); }
.wa-newchat { display: flex; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--wa-line); }
.wa-newchat input { flex: 1; }
.wa-search { margin: 8px 12px; display: flex; align-items: center; gap: 10px; background: var(--wa-bar); border-radius: 8px; padding: 0 14px; color: #54656f; }
.wa-search input { border: 0; background: transparent; padding: 8px 0; flex: 1; font-size: 15px; outline: none; box-shadow: none; }
.wa-list { overflow-y: auto; flex: 1; }
.wa-empty-list { padding: 40px 20px; text-align: center; color: var(--wa-sub); }
.wa-item { display: flex; align-items: center; gap: 14px; width: 100%; border: 0; background: #fff; padding: 0 14px; height: 72px; cursor: pointer; text-align: start; }
.wa-item:hover { background: #f5f6f6; }
.wa-item.on { background: #f0f2f5; }
.wa-item-body { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: center; border-bottom: 1px solid var(--wa-line); gap: 2px; }
.wa-item-top, .wa-item-bottom { display: flex; align-items: center; gap: 6px; }
.wa-item-name { flex: 1; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-item-time { font-size: 12px; color: var(--wa-sub); }
.wa-item-time.new { color: #25d366; font-weight: 600; }
.wa-item-last { flex: 1; font-size: 14px; color: var(--wa-sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 3px; }
.wa-unread { background: #25d366; color: #fff; border-radius: 12px; min-width: 20px; height: 20px; padding: 0 6px; font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.wa-chip { font-size: 11px; background: #fff3c4; color: #7a5b00; border-radius: 10px; padding: 1px 8px; white-space: nowrap; }
.wa-chip.big { font-size: 13px; padding: 3px 12px; display: inline-block; margin: 6px 3px 0; }
.wa-chip.bad { background: #fde2e1; color: #b3261e; }
.wa-av { position: relative; display: inline-block; border-radius: 50%; overflow: hidden; flex-shrink: 0; background: #dfe5e7; }
.wa-av svg, .wa-av img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.wa-av img { opacity: 0; transition: opacity .2s; } .wa-av img.ok { opacity: 1; }

.wa-main { position: relative; display: flex; flex-direction: column; min-width: 0; background: #efeae2; }
.wa-chat-head { border-inline-start: 0; }
.wa-head-who { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; border: 0; background: transparent; cursor: pointer; text-align: start; padding: 0; height: 100%; }
.wa-head-who > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.wa-head-who b { font-weight: 500; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-head-who small { color: var(--wa-sub); font-size: 13px; }
.wa-back { display: none; }
.wa-msgs { flex: 1; overflow-y: auto; padding: 12px 6% 8px; display: flex; flex-direction: column;
  background-color: #efeae2;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg fill='none' stroke='%23d9d1c4' stroke-width='1.2' opacity='.55'%3E%3Ccircle cx='18' cy='20' r='7'/%3E%3Cpath d='M70 12l8 8-8 8-8-8z'/%3E%3Cpath d='M100 60c6 0 10 4 10 10s-4 10-10 10'/%3E%3Cpath d='M20 80h16M28 72v16'/%3E%3Crect x='60' y='86' width='14' height='10' rx='2'/%3E%3Cpath d='M44 46q6-8 12 0t12 0'/%3E%3C/g%3E%3C/svg%3E"); }
.wa-day { align-self: center; margin: 10px 0 8px; }
.wa-msgs > :first-child { margin-top: auto; } /* few messages sit at the bottom, like WhatsApp */
.wa-day span { background: #fff; color: #54656f; font-size: 12.5px; padding: 5px 12px; border-radius: 7.5px; box-shadow: 0 1px .5px rgba(11,20,26,.13); display: inline-block; }
.wa-row { display: flex; margin-top: 2px; }
.wa-row.first { margin-top: 10px; }
.wa-row.in { justify-content: flex-start; }
.wa-row.out { justify-content: flex-end; }
.wa-msg { position: relative; max-width: min(65%, 560px); padding: 6px 9px 8px; border-radius: 7.5px; font-size: 14.5px; line-height: 19px;
  box-shadow: 0 1px .5px rgba(11,20,26,.13); white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; }
.wa-row.in .wa-msg { background: #fff; }
.wa-row.out .wa-msg { background: #d9fdd3; }
.wa-row.first.in .wa-msg { border-start-start-radius: 0; }
.wa-row.first.out .wa-msg { border-start-end-radius: 0; }
.wa-row.first.in .wa-msg::before, .wa-row.first.out .wa-msg::before { content: ""; position: absolute; top: 0; width: 8px; height: 13px; }
.wa-row.first.in .wa-msg::before { inset-inline-start: -8px; background: #fff; clip-path: polygon(0 0, 100% 0, 100% 100%); }
.wa-row.first.out .wa-msg::before { inset-inline-end: -8px; background: #d9fdd3; clip-path: polygon(0 0, 100% 0, 0 100%); }
[dir="rtl"] .wa-row.first.in .wa-msg::before { clip-path: polygon(0 0, 100% 0, 0 100%); }
[dir="rtl"] .wa-row.first.out .wa-msg::before { clip-path: polygon(0 0, 100% 0, 100% 100%); }
.wa-row.pending { opacity: .75; }
.wa-text a { color: #027eb5; }
.wa-text code { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.wa-meta { float: inline-end; margin-inline-start: 10px; margin-top: 6px; margin-bottom: -5px; font-size: 11px; color: var(--wa-sub); display: inline-flex; align-items: center; gap: 3px; position: relative; top: 4px; }
.wa-tick { display: inline-flex; color: #8696a0; }
.wa-tick.read { color: #53bdeb; }
.wa-tick.err { color: #e53935; font-weight: 700; }
.wa-media { display: block; margin: -2px -5px 4px; border-radius: 6px; overflow: hidden; max-width: 330px; }
.wa-media img { display: block; width: 100%; max-height: 360px; object-fit: cover; min-height: 60px; background: #e5ddd5; }
.wa-media.sticker { max-width: 150px; background: transparent; }
.wa-media.sticker img { background: transparent; object-fit: contain; }
video.wa-media { width: 330px; max-width: 100%; }
.wa-doc { display: flex; align-items: center; gap: 8px; background: rgba(11,20,26,.05); border-radius: 6px; padding: 10px 12px; margin-bottom: 4px; color: var(--wa-ink); text-decoration: none; }
.wa-missing { display: block; color: var(--wa-sub); font-style: italic; margin-bottom: 2px; }
.wa-compose { display: flex; align-items: flex-end; gap: 8px; padding: 8px 14px; background: var(--wa-bar); }
.wa-compose textarea { flex: 1; min-height: 42px; height: 42px; width: auto; resize: none; border: 0; border-radius: 8px; padding: 10px 14px; font-size: 15px; line-height: 20px; max-height: 140px; background: #fff; outline: none; box-shadow: none; font-family: inherit; }
.wa-send { border: 0; width: 44px; height: 44px; border-radius: 50%; background: var(--wa-green); color: #fff; display: grid; place-items: center; cursor: pointer; flex-shrink: 0; }
.wa-send:hover { background: #008f72; }
[dir="rtl"] .wa-send svg { transform: scaleX(-1); }
.wa-locked { background: #fff8d6; color: #54656f; text-align: center; padding: 14px; font-size: 14px; border-top: 1px solid var(--wa-line); }
.wa-welcome { margin: auto; text-align: center; max-width: 460px; color: var(--wa-sub); padding: 24px; }
.wa-welcome-art { width: 120px; height: 120px; margin: 0 auto 18px; opacity: .8; }
.wa-welcome h2 { color: #41525d; font-weight: 300; font-size: 30px; margin-bottom: 10px; }
.wa-main:has(.wa-welcome) { background: #f8f9fa; border-bottom: 6px solid #25d366; }

.wa-info { position: absolute; inset: 0 auto 0 0; inset-inline-start: auto; inset-inline-end: 0; width: min(400px, 100%); background: var(--wa-bar); display: flex; flex-direction: column; box-shadow: 0 0 20px rgba(11,20,26,.15); z-index: 5; animation: waSlide .18s ease-out; }
@keyframes waSlide { from { transform: translateX(-30px); opacity: 0; } }
.wa-info .wa-bar { background: #fff; gap: 18px; font-size: 16px; }
.wa-info-body { overflow-y: auto; flex: 1; }
.wa-card { background: #fff; padding: 14px 24px; margin-bottom: 10px; box-shadow: 0 1px 3px rgba(11,20,26,.08); }
.wa-profile { text-align: center; padding: 28px 24px; }
.wa-profile h2 { margin: 14px 0 2px; font-weight: 400; font-size: 23px; }
.wa-profile p { margin: 0; color: var(--wa-sub); font-size: 16px; }
.wa-camp { display: flex; flex-direction: column; padding: 8px 0; border-bottom: 1px solid var(--wa-line); text-decoration: none; color: var(--wa-ink); }
.wa-camp:last-child { border-bottom: 0; }
.wa-actions { padding: 6px 0; }
.wa-danger { display: flex; align-items: center; gap: 22px; width: 100%; border: 0; background: transparent; color: #ea0038; padding: 14px 26px; font-size: 16px; cursor: pointer; text-align: start; }
.wa-danger:hover { background: #f5f6f6; }
.wa-report { display: flex; align-items: flex-start; gap: 22px; padding: 14px 26px; color: #ea0038; }
.wa-report b { color: #ea0038; font-weight: 400; font-size: 16px; }

@media (max-width: 760px) {
  body.wide main { padding: 0; }
  .wa { grid-template-columns: 1fr; height: calc(100dvh - 60px); border-radius: 0; }
  .wa.has-chat .wa-side { display: none; }
  .wa:not(.has-chat) .wa-main { display: none; }
  .wa-back { display: grid; }
  .wa-msg { max-width: 85%; }
  .wa-msgs { padding: 10px 12px; }
}
/* pictures / videos attached to a campaign message */
.media-list { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }
.media-list:empty { display: none; }
.media-item { position: relative; width: 120px; display: flex; flex-direction: column; gap: 4px; }
.media-item img, .media-item video { width: 120px; height: 120px; object-fit: cover; border-radius: 10px; background: #000; border: 1px solid var(--line); }
.media-item small { color: #667; font-size: 12px; text-align: center; }
.media-item.loading { height: 120px; border: 2px dashed var(--line); border-radius: 10px; align-items: center; justify-content: center; text-align: center; font-size: 13px; padding: 6px; }
.media-x { position: absolute; top: -8px; inset-inline-start: -8px; width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fff; background: #d33; color: #fff; padding: 0; font-size: 13px; line-height: 1; cursor: pointer; }
.bubble-media { display: block; width: 100%; max-height: 260px; object-fit: cover; border-radius: 8px; margin-bottom: 6px; background: #000; }
/* choosing people from a list */
.pick-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.btn.small, button.small { padding: 6px 12px; font-size: 13px; }
.modal.wide { width: min(860px, 100%); }
.pick-bulk { background: #f6f4ef; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: grid; gap: 8px; }
.pick-bulk .row .field { flex: 1 1 160px; }
.pick-table { border: 1px solid var(--line); border-radius: 12px; max-height: 46vh; overflow: auto; }
.pick-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.pick-row:last-child { border-bottom: 0; }
.pick-row:hover { background: #faf8f3; }
.pick-row .n { color: #889; font-size: 12px; min-width: 34px; }
.pick-row.out { opacity: .45; }
.pick-row.off { opacity: .5; cursor: default; }
.row.wrap { flex-wrap: wrap; }
/* the chat screen keeps its height: only the messages scroll (grid/flex children would otherwise grow with their content) */
.wa { grid-template-rows: minmax(0, 1fr); }
.wa-side, .wa-main, .wa-list, .wa-msgs, .wa-info-body { min-height: 0; }
.wa-main > :not(.wa-msgs):not(.wa-info) { flex-shrink: 0; }

/* ================= menu icons, combined inbox extras ================= */
.top nav a svg, .nav-more-btn svg { display: none; width: 24px; height: 24px; }
.nav-more-btn { display: none; }
.top nav a { position: relative; }
.wa-all-ic { width: 40px; height: 40px; border-radius: 50%; background: var(--wa-green); color: #fff; display: grid; place-items: center; flex-shrink: 0; }
.wa-all-ic svg { width: 22px; height: 22px; }
.wa-item { height: auto; min-height: 72px; }
.wa-item-body { padding: 10px 0; }
.wa-item-via { display: flex; align-items: center; gap: 4px; font-size: 12px; color: #0f766e; font-weight: 600; }
.wa-hint { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 4px; padding-inline-start: 14px; background: #e7f8f1; color: #14532d; font-size: 14px; border-bottom: 1px solid var(--wa-line); }
.wa-hint span { flex: 1; }
.wa-hint a { font-weight: 700; color: var(--wa-green); text-decoration: none; white-space: nowrap; }
.wa-hint .wa-icon { width: 32px; height: 32px; }
.wa-hint .wa-icon svg { width: 18px; height: 18px; }
.wa-warn { background: #fff3c4; color: #7a5b00; font-size: 13px; padding: 6px 14px; }
.wa-newchat select { width: auto; max-width: 40%; padding: 8px; }
.steps-ol { margin: 8px 0; padding-inline-start: 22px; }
.steps-ol li { margin: 4px 0; }
.ios-share { display: inline-block; border: 1.5px solid currentColor; border-radius: 5px; padding: 0 5px; font-size: 13px; line-height: 18px; }

/* ================= phones ================= */
@media (max-width: 760px) {
  /* app-like: small header on top, menu as a bar at the bottom */
  /* no blur here: it would pin the bottom menu to the header instead of the screen */
  .top { padding: 8px 14px; padding-top: calc(8px + env(safe-area-inset-top)); gap: 10px; flex-wrap: nowrap; backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--bg); }
  .top .pill { display: none; }
  .brand { font-size: 17px; }
  .top nav { position: fixed; z-index: 30; bottom: 0; left: 0; right: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 0;
    background: #fff; border-top: 1px solid var(--line);
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); }
  .top nav a, .nav-more-btn { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 5px 2px; border-radius: 12px; font-size: 11.5px; font-weight: 600;
    color: var(--muted); background: none; border: 0; text-decoration: none; }
  .top nav a svg, .nav-more-btn svg { display: block; }
  .top nav a.on, .nav-more-btn.on { background: none; color: var(--accent); }
  .top nav a.on svg, .nav-more-btn.on svg { background: var(--accent-soft); border-radius: 999px; width: 48px; padding: 0 12px; box-sizing: border-box; }
  .top nav a:hover:not(.on) { background: none; }
  .top nav a .badge { position: absolute; top: 0; inset-inline-start: 50%; margin-inline-start: 6px; font-size: 11px; min-width: 18px; line-height: 16px; padding: 1px 5px; }
  /* the three less-used pages open from "עוד" */
  .top nav a.more { display: none; }
  .nav-more-btn { display: flex; cursor: pointer; }
  body.more-open .top nav a.more { display: flex; position: fixed; inset-inline-end: 10px; flex-direction: row; gap: 12px; width: 210px; padding: 12px 16px;
    font-size: 16px; background: #fff; color: var(--ink); border-radius: 0; box-shadow: 0 6px 24px rgba(0,0,0,.18); }
  body.more-open .top nav a.more svg { width: 22px; padding: 0; background: none; }
  body.more-open .top nav a.more.on { color: var(--accent); }
  body.more-open .nav-settings { bottom: calc(70px + env(safe-area-inset-bottom)); border-radius: 0 0 14px 14px !important; }
  body.more-open .nav-autoreply { bottom: calc(118px + env(safe-area-inset-bottom)); }
  body.more-open .nav-optouts { bottom: calc(166px + env(safe-area-inset-bottom)); border-radius: 14px 14px 0 0 !important; }

  main { padding: 16px 12px calc(90px + env(safe-area-inset-bottom)); }
  h1 { font-size: 23px; }
  .head { margin-bottom: 16px; }
  .card { padding: 16px 14px; }
  .tile b { font-size: 22px; }
  /* iPhone zooms in on small text fields; 16px stops it */
  input, select, textarea, .wa-search input, .wa-compose textarea { font-size: 16px; }
  button.big { width: 100%; justify-content: center; }
  .head > .row, .head > div:last-child:not(:first-child) { width: 100%; }

  /* tables become a list of cards: every value with its column name */
  table.cards, table.cards tbody { display: block; width: 100%; }
  table.cards tr { display: grid; grid-template-columns: 1fr 1fr; column-gap: 12px; }
  table.cards td { width: auto; min-width: 0; }
  table.cards td:first-child, table.cards td[data-label=""] { grid-column: 1 / -1; }
  table.cards thead, table.cards tr:has(> th) { display: none; }
  table.cards tr { border: 1px solid var(--line); border-radius: 12px; padding: 6px 12px; margin-bottom: 10px; background: #fff; }
  table.cards td { display: flex; flex-direction: column; align-items: flex-start; gap: 0; border: 0; padding: 5px 0; text-align: start; min-height: 0; overflow-wrap: anywhere; }
  table.cards td::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 600; }
  table.cards td:first-child { border-bottom: 1px solid var(--line); padding-bottom: 8px; margin-bottom: 2px; }
  table.cards td:first-child::before { content: none; }
  table.cards td .bar { width: 100%; }
  table.cards td[data-label=""]::before { content: none; }
  table.cards td[data-label=""] { flex-direction: row; flex-wrap: wrap; gap: 6px; justify-content: flex-start; }
  table.cards td:first-child { font-weight: 700; font-size: 16px; }
  .card:has(> .table-wrap > table.cards), .card:has(> table.cards) { background: transparent; border: 0; box-shadow: none; padding: 0; }
  .table-wrap { overflow: visible; }

  /* windows slide up from the bottom */
  .modal-bg { place-items: end center; padding: 0; }
  .modal { width: 100%; max-width: 100%; border-radius: 18px 18px 0 0; max-height: 92dvh; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); }
  .modal.wide { width: 100%; }
  .modal .foot { position: sticky; bottom: calc(-20px - env(safe-area-inset-bottom)); background: #fff; padding: 12px 0 0; margin-bottom: -4px; }
  .modal .foot button { flex: 1; justify-content: center; }
  .modal .foot { flex-wrap: wrap; }
  .modal .foot > :not(button) { flex-basis: 100%; text-align: center; }
  .pick-row .ltr, .pick-row [dir=ltr] { white-space: nowrap; }
  .pick-table { max-height: 40dvh; }

  /* settings: day + from + to on one line */
  #sf .row > label.check[style] { width: 72px !important; }
  #sf input[type=time] { width: auto !important; flex: 1; min-width: 0; padding: 8px 6px; }
  .toast { bottom: calc(84px + env(safe-area-inset-bottom)); }

  /* chats: full screen, like the WhatsApp app */
  body.wide .top { padding: 0; border: 0; min-height: 0; }
  body.wide .top .brand { display: none; }
  body.chat-open .top nav, body.chat-open .toast { display: none; }
  body.wide main { padding: 0; }
  .wa { position: fixed; left: 0; right: 0; top: 0; min-height: 0; border-radius: 0; box-shadow: none; z-index: 5; }
  .wa-side > .wa-bar:first-child { padding-top: env(safe-area-inset-top); height: calc(60px + env(safe-area-inset-top)); }
  .wa-chat-head { padding-top: env(safe-area-inset-top); height: calc(60px + env(safe-area-inset-top)); padding-inline: 4px 12px; gap: 6px; }
  .wa-info > .wa-bar { padding-top: env(safe-area-inset-top); height: calc(60px + env(safe-area-inset-top)); }
  .wa-compose { padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
  .wa-info { width: 100%; }
  .wa-item-name { font-size: 16px; }
  .wa-media, video.wa-media { max-width: 100%; }
  .wa-welcome { display: none; }
}
@media (max-width: 760px) and (display-mode: standalone) {
  .wa-compose { padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
}

/* saved messages (templates) in a new campaign */
.tpl-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; border: 1px dashed var(--line, #d6dde3); border-radius: 10px; background: var(--bg); }
.tpl-bar select { flex: 1; min-width: 160px; width: auto; }
.danger-link { color: var(--bad) !important; }
.modal .foot.wrap { flex-wrap: wrap; }
.tpl-bar > b { margin-inline-end: auto; }
.tpl-bar .tpl-hint { flex-basis: 100%; order: 3; }
@media (max-width:760px) { .tpl-bar select { flex-basis: 100%; order: 2; } }

/* chats: searching a phone number */
.wa-find { margin: 6px 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); display: flex; flex-direction: column; gap: 6px; }
.wa-find.bad { color: var(--bad); }
.wa-find .ok { color: var(--good); font-weight: 600; }
.wa-find .bad { color: var(--bad); font-weight: 600; }
.wa-find-chat { display: flex; align-items: center; gap: 6px; text-align: start; background: var(--bg); border: 0; border-radius: 8px; padding: 8px 10px; cursor: pointer; }
.wa-find-chat svg { width: 14px; height: 14px; flex: none; }
.wa-find-new { display: flex; gap: 6px; flex-wrap: wrap; }
.wa-find-new select { flex: 1; min-width: 120px; width: auto; }
