/* Shared styles: public page + admin. RTL, mobile first.
   Brand colors live in :root so the client's palette can be swapped in one place. */
:root {
  --brand: #18305C;
  --brand-ink: #ffffff;
  --accent: #F28A19;
  --accent-ink: #18305C; /* navy on orange: 5.2:1. White on orange fails (2.5:1) */
  --bg: #f5f7fb;
  --surface: #ffffff;
  --ink: #142033;
  --muted: #5d6a80;
  --line: #dfe4ee;
  --ok: #13703f;
  --ok-soft: #e4f6ec;
  --bad: #c0392b;
  --bad-soft: #fdecea;
  --warn: #8a5206;
  --warn-soft: #fdf3e1;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 32, 51, .06), 0 4px 16px rgba(20, 32, 51, .06);
  --font: "Assistant", "Rubik", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 var(--font); direction: rtl; }
a { color: var(--brand); }
img { max-width: 100%; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.skip { position: absolute; inset-inline-start: 8px; top: -60px; background: #fff; color: var(--ink); padding: 8px 14px; border-radius: 8px; z-index: 50; font-weight: 700; }
.skip:focus { top: 8px; }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }

/* buttons & inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 10px;
  padding: 11px 18px; font: inherit; font-weight: 700; cursor: pointer; background: var(--brand); color: var(--brand-ink);
  text-decoration: none; min-height: 44px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.btn.danger { background: var(--bad); }
.btn.small { padding: 6px 12px; min-height: 34px; font-size: .9rem; }
.btn.block { width: 100%; }
label { display: block; font-weight: 600; margin-bottom: 4px; }
.field { margin-bottom: 14px; }
.hint { color: var(--muted); font-size: .88rem; font-weight: 400; }
input[type=text], input[type=tel], input[type=email], input[type=number], input[type=url], select, textarea {
  width: 100%; font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); min-height: 44px; }
textarea { min-height: 96px; resize: vertical; }
input[aria-invalid=true], select[aria-invalid=true] { border-color: var(--bad); background: var(--bad-soft); }
.err { color: var(--bad); font-size: .88rem; margin-top: 4px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; }
.check input { width: 20px; height: 20px; margin-top: 3px; flex: none; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choices label { font-weight: 500; border: 1px solid var(--line); border-radius: 10px; padding: 9px 14px; background: #fff; cursor: pointer; margin: 0; }
.choices input { position: absolute; opacity: 0; }
.choices input:checked + span { color: var(--brand); }
.choices label:has(input:checked) { border-color: var(--brand); background: #eef3ff; }

/* cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.pill { display: inline-block; font-size: .8rem; font-weight: 700; padding: 2px 10px; border-radius: 99px; background: #eef3ff; color: var(--brand); }
.notice { padding: 12px 14px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); }
.notice.ok { background: var(--ok-soft); color: var(--ok); }
.notice.bad { background: var(--bad-soft); color: var(--bad); }

/* ---------- public page ---------- */
.hero { background: var(--brand); color: #fff; padding: 44px 0 64px; }
.hero h1 { font-size: clamp(1.8rem, 5vw, 2.6rem); margin: 0 0 8px; line-height: 1.2; }
.hero p { margin: 0; opacity: .92; font-size: 1.1rem; max-width: 60ch; }
.hero .kicker { font-size: .95rem; font-weight: 700; margin-bottom: 6px; opacity: 1; color: var(--accent); }
.hero .benefits { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 16px 0 0; }
.hero .benefits li { background: rgba(255, 255, 255, .14); border-radius: 99px; padding: 4px 12px; font-size: .9rem; font-weight: 600; }
.hero .benefits li::before { content: "✓ "; color: var(--accent); }
.brandline { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .02em; margin-bottom: 18px; opacity: .95; }
.brandline img { height: 34px; width: auto; }
.topbar .logo { height: 24px; width: auto; display: block; }
main.public { margin-top: -36px; padding-bottom: 60px; }
.job-card { display: flex; flex-direction: column; gap: 8px; }
.job-card h2 { font-size: 1.2rem; margin: 0; }
.job-card .meta { color: var(--muted); font-size: .92rem; }
.job-card .btn { margin-top: auto; }
.job-card .btn:not(.secondary) { background: var(--accent); color: var(--accent-ink); }
.job-card { border-top: 4px solid var(--accent); }
.pay { font-weight: 800; color: var(--brand); font-size: 1.05rem; }
.pay.big { font-size: 1.35rem; background: #fff4e6; border-radius: 10px; padding: 8px 14px; display: inline-block; margin: 6px 0 10px; }
.checks { list-style: none; padding: 0; margin: 2px 0; display: grid; gap: 4px; }
.checks li { position: relative; padding-inline-start: 26px; }
.checks li::before { content: "✓"; position: absolute; inset-inline-start: 0; top: 0; width: 19px; height: 19px; margin-top: 3px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); font-size: .72rem; font-weight: 900; display: grid; place-items: center; }
.job-detail h2 { margin-top: 0; margin-bottom: 4px; font-size: 1.6rem; }
.job-detail h3 { font-size: 1.05rem; margin: 18px 0 8px; }
.job-detail .lead { color: var(--muted); margin: 0 0 6px; }
.job-detail .tags { display: flex; flex-wrap: wrap; gap: 6px; }
.job-detail .desc { white-space: pre-line; margin-top: 12px; }
.btn.cta { background: var(--accent); color: var(--accent-ink); font-size: 1.05rem; padding-inline: 28px; }
.apply-bar { margin-top: 20px; }
@media (max-width: 640px) {
  /* Keep the apply button in reach on a phone while reading the details */
  .apply-bar { position: sticky; bottom: 0; margin: 20px -18px -18px; padding: 12px 18px; background: var(--surface);
    border-top: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); }
  .apply-bar .btn { width: 100%; }
}
.back { background: none; border: 0; color: var(--brand); font: inherit; cursor: pointer; padding: 0; margin-bottom: 10px; }
.steps { display: flex; gap: 6px; margin-bottom: 14px; }
.steps i { flex: 1; height: 5px; border-radius: 99px; background: var(--line); }
.steps i.on { background: var(--brand); }
.thanks { text-align: center; padding: 36px 18px; }
.thanks .big { font-size: 3rem; line-height: 1; color: var(--ok); }
footer.site { color: var(--muted); font-size: .85rem; padding: 24px 0 40px; text-align: center; }
.honey { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- admin ---------- */
.admin .wrap { max-width: 1320px; }
.topbar { background: var(--brand); color: #fff; position: sticky; top: 0; z-index: 10; box-shadow: 0 1px 0 rgba(255,255,255,.08); }
/* One line on every width: the links scroll sideways on a phone instead of wrapping into three rows */
.topbar .wrap { display: flex; align-items: center; gap: 18px; min-height: 54px; overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
.topbar .wrap::-webkit-scrollbar { display: none; }
.topbar strong { font-size: 1rem; }
.topbar a { color: #fff; text-decoration: none; opacity: .78; font-weight: 600; padding: 15px 0 13px; border-bottom: 3px solid transparent; }
.topbar a:hover { opacity: 1; }
.topbar a[aria-current=page] { opacity: 1; border-bottom-color: var(--accent); }
.topbar .who { margin-inline-start: auto; font-size: .82rem; opacity: .7; }
.admin main { padding: 18px 0 60px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; }
.toolbar .field { margin: 0; min-width: 140px; flex: 0 1 170px; }
.toolbar .field.search { flex: 1 1 220px; }
.toolbar .field select, .toolbar .field input { min-height: 42px; }
.toolbar .group { display: flex; gap: 8px; margin-inline-start: auto; }
@media (max-width: 700px) {
  .toolbar .field { flex: 1 1 calc(50% - 8px); min-width: 0; }
  .toolbar .group { width: 100%; }
  .toolbar .group .btn { flex: 1; padding-inline: 10px; }
}
.load-error { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.load-error .btn { margin-inline-start: auto; }
.stats { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; font-size: .9rem; cursor: pointer; }
.stat b { font-size: 1.15rem; margin-inline-start: 6px; }
.stat[aria-pressed=true] { border-color: var(--brand); background: #eef3ff; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; min-width: 760px; font-size: .93rem; }
th, td { padding: 10px 12px; text-align: right; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { background: #f0f3f9; font-size: .82rem; color: var(--muted); position: sticky; top: 0; }
tr.row { cursor: pointer; }
tr.row:hover { background: #f8faff; }
.status { font-weight: 700; font-size: .82rem; padding: 3px 10px; border-radius: 99px; background: #eef1f6; white-space: nowrap; }
.status[data-s="pass"], .status[data-s="hired"] { background: var(--ok-soft); color: var(--ok); }
.status[data-s="fail"], .status[data-s="rejected"], .status[data-s="no_show"], .status[data-s="not_interested"] { background: var(--bad-soft); color: var(--bad); }
.status[data-s="review"], .status[data-s="pending_answers"] { background: var(--warn-soft); color: var(--warn); }
.status[data-s="invite"], .status[data-s="booked"] { background: #eef3ff; color: var(--brand); }
.empty { padding: 30px; text-align: center; color: var(--muted); }
.counter { font-size: .78rem; color: var(--muted); text-align: left; margin-top: 2px; font-variant-numeric: tabular-nums; }
.counter.near { color: var(--warn); font-weight: 700; }
.botwarn { background: var(--warn-soft); color: var(--warn); border-radius: 10px; padding: 8px 12px; font-size: .88rem; margin: 0 0 14px; }
.botwarn ul { margin: 4px 0 0; padding-inline-start: 18px; }
.preview-bar { background: var(--warn-soft); color: var(--warn); text-align: center; font-weight: 700; padding: 8px 12px; font-size: .9rem; }

/* board: status columns that scroll sideways inside their own container (as in the approved demo) */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
@media (max-width: 700px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { padding: 12px 16px; border-inline-start: 4px solid var(--brand); }
.kpi:nth-child(2) { border-inline-start-color: var(--accent); }
.kpi:nth-child(3) { border-inline-start-color: var(--ok); }
.kpi:nth-child(4) { border-inline-start-color: #6a5acd; }
.kpi b { display: block; font-size: 1.6rem; line-height: 1.2; font-variant-numeric: tabular-nums; color: var(--brand); }
.kpi span { font-size: .85rem; color: var(--muted); }
/* Columns scroll sideways; the fade on the far edge shows there is more */
.cols { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 1fr); gap: 10px; overflow-x: auto; padding-bottom: 10px; align-items: start;
  scroll-snap-type: x proximity; -webkit-mask-image: linear-gradient(to right, transparent 0, #000 28px); mask-image: linear-gradient(to right, transparent 0, #000 28px); }
.cols .col.empty-col { min-height: 0; background: #f0f3f7; }
.col { background: #eef1f6; border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 160px; scroll-snap-align: start; }
.col h3 { font-size: .9rem; margin: 0; display: flex; align-items: center; gap: 6px; }
.col h3 .n { margin-inline-start: auto; font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600; }
.col .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.dot[data-s="pass"], .dot[data-s="hired"] { background: var(--ok); }
.dot[data-s="fail"], .dot[data-s="rejected"], .dot[data-s="no_show"], .dot[data-s="not_interested"] { background: var(--bad); }
.dot[data-s="review"], .dot[data-s="pending_answers"] { background: var(--warn); }
.dot[data-s="invite"], .dot[data-s="booked"] { background: var(--brand); }
.col-empty { font-size: .82rem; color: var(--muted); padding: 6px 2px; }
.cand { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px; text-align: right; cursor: pointer;
  display: flex; flex-direction: column; gap: 5px; width: 100%; font: inherit; color: inherit; }
.cand:hover, .cand:focus-visible { border-color: var(--brand); }
.cand .nm { font-weight: 700; }
.cand .sub { font-size: .82rem; color: var(--muted); }
.cand .tags { display: flex; gap: 6px; flex-wrap: wrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.mute { background: #eef1f6; color: var(--muted); font-weight: 600; }

/* drawer */
.drawer-bg { position: fixed; inset: 0; background: rgba(10, 18, 32, .45); z-index: 20; }
.drawer { position: fixed; top: 0; bottom: 0; inset-inline-start: 0; width: min(520px, 100vw); background: var(--surface); z-index: 21;
  overflow-y: auto; padding: 18px; box-shadow: var(--shadow); }
.drawer h2 { margin: 0 0 4px; }
.drawer .close { position: absolute; inset-inline-end: 14px; top: 12px; background: none; border: 0; font-size: 1.6rem; cursor: pointer; color: var(--muted); }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 10px; margin: 14px 0; font-size: .95rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.answers li { margin-bottom: 6px; }
.answers .no { color: var(--bad); font-weight: 700; }
.history { font-size: .85rem; color: var(--muted); padding-inline-start: 18px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }

/* edit page */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 10px 14px; font: inherit; font-weight: 700; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs button[aria-selected=true] { color: var(--ink); border-color: var(--brand); }
.list-item { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .sub { color: var(--muted); font-size: .85rem; }
.list-item .title-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.list-item .pay { font-size: .9rem; font-weight: 700; }
.list-item.off { background: #fafbfd; }
.list-item.off .title-row b { color: var(--muted); }
.list-item .btns { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 640px) { .list-item { flex-wrap: wrap; } .list-item .btns { width: 100%; justify-content: flex-start; } }
.pill.on { background: var(--ok-soft); color: var(--ok); }
.pill.off { background: var(--warn-soft); color: var(--warn); }
.drawer .sticky-actions { position: sticky; bottom: -18px; background: var(--surface); margin: 0 -18px; padding: 12px 18px; border-top: 1px solid var(--line); }
.two { display: grid; gap: 0 14px; grid-template-columns: 1fr 1fr; }
@media (max-width: 640px) { .two { grid-template-columns: 1fr; } }
.toast { position: fixed; bottom: 18px; inset-inline-start: 50%; transform: translateX(50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 10px; z-index: 40; box-shadow: var(--shadow); }

/* WhatsApp inbox: conversation list beside the open thread; on a phone, one of them at a time */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.inbox { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 14px; align-items: start; }
.conv-list, .thread { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.conv-list { max-height: calc(100vh - 110px); overflow-y: auto; }
.conv-tools { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); }
.conv { display: flex; flex-direction: column; gap: 3px; width: 100%; text-align: right; background: none; border: 0; border-bottom: 1px solid var(--line); padding: 10px 12px; font: inherit; color: inherit; cursor: pointer; }
.conv:hover { background: #f8faff; }
.conv[aria-current=true] { background: #eef3ff; }
.conv-top { display: flex; align-items: center; gap: 6px; }
.conv .nm { font-weight: 700; }
.conv .when { margin-inline-start: auto; font-size: .78rem; color: var(--muted); }
.conv .sub { font-size: .82rem; color: var(--muted); }
.conv .preview { font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv .tags { display: flex; gap: 6px; flex-wrap: wrap; }
.badge { background: var(--bad); color: #fff; border-radius: 99px; min-width: 20px; padding: 0 6px; font-size: .78rem; font-weight: 700; text-align: center; }
.thread { display: flex; flex-direction: column; min-height: 420px; }
.thread > .empty { margin: auto; }
.thread-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.thread-head h2 { margin: 0; font-size: 1.15rem; }
.thread-head .grow { flex: 1; min-width: 0; }
.thread-head .sub { font-size: .85rem; color: var(--muted); }
.back-list { display: none; }
.bot-state { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding: 8px 14px; font-size: .88rem; font-weight: 600; }
.bot-state.on { background: var(--ok-soft); color: var(--ok); }
.bot-state.off { background: var(--warn-soft); color: var(--warn); }
.msgs { flex: 1; overflow-y: auto; max-height: calc(100vh - 430px); min-height: 180px; padding: 14px; display: flex; flex-direction: column; gap: 8px; background: #f5f7fb; }
.msg { max-width: min(78%, 520px); padding: 8px 12px; border-radius: 12px; white-space: pre-line; word-break: break-word; }
.msg.in { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); }
.msg.out { align-self: flex-end; background: #dcebff; }
.msg.out.bot { background: #e8edf5; }
.msg .meta { font-size: .74rem; color: var(--muted); margin-top: 3px; }
.composer { padding: 12px 14px; border-top: 1px solid var(--line); }
.composer textarea { width: 100%; }
.composer details { margin-top: 8px; }
.composer summary { cursor: pointer; font-weight: 600; }
.composer select { flex: 1; min-width: 180px; }
@media (max-width: 760px) {
  .inbox { grid-template-columns: minmax(0, 1fr); }
  .inbox .thread { display: none; }
  .inbox.show-thread .thread { display: flex; }
  .inbox.show-thread .conv-list { display: none; }
  .back-list { display: inline-flex; }
  .msgs { max-height: 50vh; }
}
