/* KDA HQ: black and white, Bodoni Moda headings (the agency site's look), phone first. */
:root {
  --ink: #0b0c0e; --ink2: #2a2d33; --muted: #6b6f76; --line: #e2e2de; --mist: #f5f5f3; --paper: #ffffff;
  --red: #b42318; --red-bg: #fdf1f0; --green: #067647; --green-bg: #eef8f2; --amber: #8a5a00; --amber-bg: #fdf6e7;
  --serif: 'Bodoni Moda', 'Amiri', Georgia, serif;
  --sans: 'Inter', 'IBM Plex Sans Arabic', system-ui, -apple-system, sans-serif;
  --r: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.5 var(--sans); }
[lang="ar"], [lang="ar"] * { letter-spacing: 0 !important; }
html[lang="ar"] body { font-family: 'IBM Plex Sans Arabic', 'Inter', system-ui, sans-serif; font-size: 16px; }
h1, h2 { font-family: var(--serif); font-weight: 500; font-optical-sizing: auto; margin: 0; line-height: 1.2; }
html[lang="ar"] h1, html[lang="ar"] h2 { font-family: 'Amiri', var(--serif); font-weight: 700; }
h1 { font-size: 26px; }
h2 { font-size: 21px; }
h3 { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
html[lang="ar"] h3 { text-transform: none; font-size: 15px; color: var(--ink2); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
small { color: var(--muted); font-size: 12px; font-weight: 400; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
bdi { unicode-bidi: isolate; }

/* buttons and fields */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 18px; border: 1px solid var(--ink); background: var(--ink); color: #fff; border-radius: 999px; font-weight: 600; }
.btn:disabled { opacity: .4; cursor: default; }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 13px; }
.btn.big { width: 100%; min-height: 52px; font-size: 16px; }
.link { background: none; border: 0; padding: 0; text-decoration: underline; text-underline-offset: 3px; color: var(--ink); font-size: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; margin: 0 0 14px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--ink2); }
input[type=text], input[type=tel], input[type=number], input[type=date], input[type=password], select, textarea {
  width: 100%; min-height: 44px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: 16px; }
textarea { resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.check { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-size: 14px; }
.check input { width: 20px; height: 20px; accent-color: var(--ink); flex: none; }
.seg { display: inline-flex; border: 1px solid var(--ink); border-radius: 999px; overflow: hidden; align-self: flex-start; max-width: 100%; }
.seg button { border: 0; background: #fff; min-height: 40px; padding: 0 16px; font-weight: 600; font-size: 14px; }
.seg button + button { border-inline-start: 1px solid var(--ink); }
.seg button.on { background: var(--ink); color: #fff; }
.err { color: var(--red); font-size: 14px; margin: 0 0 12px; }
.err[hidden] { display: none; }

/* header and navigation */
.top { position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line); backdrop-filter: blur(6px); }
body[data-state="login"] .top, body[data-state="login"] .botnav { display: none; }
.top-in { max-width: 1240px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; }
.brand img { display: block; height: 20px; width: auto; }
.brand span { font-family: var(--serif); font-size: 19px; letter-spacing: .04em; }
.topnav { display: none; }
.top-r { margin-inline-start: auto; display: flex; align-items: center; gap: 12px; font-size: 14px; }
.me { font-weight: 600; }
.langs { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.lang { border: 0; background: #fff; min-width: 38px; min-height: 32px; font-size: 13px; font-weight: 600; color: var(--muted); }
.lang.on { background: var(--ink); color: #fff; }
.botnav { position: fixed; z-index: 20; inset-inline: 0; bottom: 0; display: flex; background: #fff; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.botnav a { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 6px; text-decoration: none; color: var(--muted); font-size: 11px; }
.botnav a span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.botnav a.on { color: var(--ink); font-weight: 600; }
.botnav a.on svg { stroke-width: 2.2; }
.view { max-width: 1240px; margin: 0 auto; padding: 18px 16px 96px; }

/* login */
.login { max-width: 380px; margin: 8vh auto 0; display: flex; flex-direction: column; }
.login-logo { width: 130px; height: auto; margin: 0 auto 18px; }
.login h1 { text-align: center; font-size: 34px; margin-bottom: 26px; }
.lbl { font-size: 13px; font-weight: 600; margin: 0 0 8px; color: var(--ink2); }
.who { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.who-b { min-height: 64px; border: 1px solid var(--line); background: #fff; border-radius: var(--r); font-family: var(--serif); font-size: 21px; }
html[lang="ar"] .who-b { font-family: 'Amiri', var(--serif); }
.who-b.on { border-color: var(--ink); background: var(--ink); color: #fff; }
#pin { font-size: 24px; letter-spacing: .4em; text-align: center; margin-bottom: 12px; }
.login-lang { margin: 22px auto 0; display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }

/* page parts */
.daynav { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.daynav h1 { flex: 1; text-align: center; font-size: 22px; }
.nav-arrow { width: 44px; height: 44px; flex: none; border: 1px solid var(--line); border-radius: 50%; background: #fff; font-size: 22px; line-height: 1; }
.nav-arrow:disabled { opacity: .3; cursor: default; }
html[dir="rtl"] .nav-arrow { transform: scaleX(-1); }
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.cols { display: grid; gap: 18px; }
.col { min-width: 0; }
.pname { font-size: 24px; margin: 4px 0 10px; padding-bottom: 8px; border-bottom: 2px solid var(--ink); }
.box { border: 1px solid var(--line); border-radius: var(--r); padding: 14px; margin-bottom: 14px; background: #fff; }
.box.mine { border-color: var(--ink); }
.count { display: inline-flex; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--mist); color: var(--ink); font-size: 12px; align-items: center; justify-content: center; letter-spacing: 0; }
.dv { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--mist); font-size: 14px; }
.dv:last-child { border-bottom: 0; }
.dv b { font-weight: 600; white-space: nowrap; }
.dnote { margin: 10px 0 0; padding: 10px; background: var(--mist); border-radius: 8px; font-size: 14px; white-space: pre-wrap; }
.bar { height: 8px; background: var(--mist); border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--ink); border-radius: inherit; }
.bar.full i { background: var(--green); }
.bar.sm { height: 5px; margin: -8px 0 14px; }
.ci-yours { font-size: 14px; color: var(--green); font-weight: 600; margin: 4px 0 0; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* evening check-in */
.checkin { border: 2px solid var(--ink); border-radius: var(--r); padding: 14px; margin-bottom: 18px; }
.checkin h2 { font-size: 19px; margin-bottom: 10px; }
.ci-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ci-p { display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; align-items: center; padding: 10px; border-radius: 8px; background: var(--mist); font-size: 13px; }
.ci-p b { font-size: 15px; }
.ci-p span:last-child { grid-column: 1 / -1; }
.ci-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.ci-p.ok { background: var(--green-bg); color: var(--green); } .ci-p.ok .ci-dot { background: var(--green); }
.ci-p.bad { background: var(--red-bg); color: var(--red); } .ci-p.bad .ci-dot { background: var(--red); }
.ci-p.wait { background: var(--amber-bg); color: var(--amber); } .ci-p.wait .ci-dot { background: var(--amber); }

/* tasks */
.tasks { list-style: none; margin: 0 0 10px; padding: 0; }
.task { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid var(--mist); }
.task:last-child { border-bottom: 0; }
.tick { flex: none; width: 24px; height: 24px; margin-top: 2px; border: 1.5px solid var(--ink); border-radius: 6px; background: #fff; position: relative; }
.task.done .tick { background: var(--ink); }
.task.done .tick::after { content: ''; position: absolute; inset: 4px 7px 7px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.tbody { flex: 1; min-width: 0; text-align: start; background: none; border: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.tline { display: flex; gap: 8px; align-items: flex-start; }
.ttl { font-size: 15px; line-height: 1.4; overflow-wrap: anywhere; }
.task.done .ttl { text-decoration: line-through; color: var(--muted); }
.tmeta { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; color: var(--muted); align-items: center; }
.task.late .due { color: var(--red); font-weight: 600; }
.pri { flex: none; display: inline-flex; align-items: center; justify-content: center; min-width: 28px; height: 21px; border-radius: 4px; font-size: 11px; font-weight: 700; letter-spacing: 0; margin-top: 1px; }
.pri.p1 { background: var(--ink); color: #fff; }
.pri.p2 { border: 1px solid var(--ink); color: var(--ink); }
.pri.p3 { border: 1px solid var(--line); color: var(--muted); }
.chip { display: inline-flex; padding: 1px 8px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 11px; font-weight: 600; }
.chip.ghost { background: var(--mist); color: var(--ink2); font-weight: 500; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; align-items: center; }
.chips-sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.chip-b { min-height: 36px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: #fff; font-size: 14px; }
.chip-b.on { border-color: var(--ink); background: var(--ink); color: #fff; }

/* follow-ups */
.follow { border-color: var(--red); }
.fu { list-style: none; margin: 0; padding: 0; }
.fu li { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--mist); }
.fu li:last-child { border-bottom: 0; }
.fu-name { flex: 1; min-width: 0; text-align: start; background: none; border: 0; padding: 0; display: flex; flex-direction: column; font-size: 13px; color: var(--muted); }
.fu-name b { color: var(--ink); font-size: 15px; }
.fu li.late .fu-name span { color: var(--red); font-weight: 600; }

/* week */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.field.num small.pipe { color: var(--muted); }
.tgt { margin-bottom: 14px; }
.tgt-h { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; margin-bottom: 5px; }
.rules { margin-bottom: 18px; }
.rules h2 { font-size: 19px; margin-bottom: 10px; }
.rule { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border: 1px solid var(--line); border-inline-start: 4px solid var(--green); border-radius: 8px; margin-bottom: 8px; font-size: 14px; }
.rule span { color: var(--muted); }
.rule.hit { border-color: var(--red); background: var(--red-bg); }
.rule.hit span { color: var(--red); font-weight: 700; font-size: 15px; }

/* clients board */
.board { display: flex; flex-direction: column; gap: 10px; }
.stage { border: 1px solid var(--line); border-radius: var(--r); background: var(--mist); padding: 10px; min-width: 0; }
.stage h2 { font-family: var(--sans); font-size: 14px; font-weight: 600; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
html[lang="ar"] .stage h2 { font-family: 'IBM Plex Sans Arabic', var(--sans); font-weight: 600; font-size: 15px; }
.stage .count { background: #fff; }
.stage.empty { padding: 8px 10px; opacity: .75; }
.stage ul { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.stage[data-stage="paid"] { border-color: var(--green); }
.stage[data-stage="lost"] h2, .stage[data-stage="nofit"] h2 { color: var(--muted); }
.card { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px; }
.card-b { width: 100%; text-align: start; background: none; border: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.card-b b { font-size: 15px; overflow-wrap: anywhere; }
.card .fl .late { color: var(--red); font-weight: 600; }
.card .fl .due-today { color: var(--amber); font-weight: 600; }
.card-move { display: flex; gap: 6px; margin-top: 8px; align-items: center; }
.card-move .btn { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-move select { width: auto; max-width: 48%; min-height: 34px; padding: 4px 8px; font-size: 13px; flex: none; }
.card-move .btn + select { max-width: 42%; }
.stages { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.st-b { min-height: 40px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: 13px; padding: 4px 8px; }
.st-b.on { background: var(--ink); color: #fff; border-color: var(--ink); }

/* messages */
.msgs { display: flex; flex-direction: column; }
.msg-head { margin: 22px 0 6px; display: flex; flex-direction: column; gap: 2px; }
.msg-head .ar { font-family: 'Amiri', serif; font-size: 20px; color: var(--ink2); }
.msg h3 { text-transform: none; letter-spacing: 0; font-size: 15px; color: var(--ink); }
.msg-ar { display: flex; gap: 10px; align-items: flex-start; background: var(--mist); border-radius: 8px; padding: 12px; }
.msg-ar .ar { flex: 1; margin: 0; }
p.ar { font-family: 'IBM Plex Sans Arabic', sans-serif; font-size: 17px; line-height: 1.75; text-align: right; }
p.en { font-size: 14px; color: var(--ink2); }
.intro p.ar { margin-top: 0; }
details { margin-top: 8px; }
summary { cursor: pointer; font-size: 13px; color: var(--muted); }
.msg-x { display: flex; flex-direction: column; gap: 2px; font-size: 13px; margin: 10px 0 0; }
.msg-x b { font-size: 12px; color: var(--muted); }
.msg-x span { overflow-wrap: anywhere; }

/* sheet (dialog) */
#layer:empty { display: none; }
.veil { position: fixed; inset: 0; z-index: 40; background: rgba(11,12,14,.45); }
.sheet { position: fixed; z-index: 41; inset-inline: 0; bottom: 0; max-height: 92vh; overflow-y: auto; background: #fff; border-radius: 16px 16px 0 0; padding: 20px 16px calc(24px + env(safe-area-inset-bottom)); }
.sheet h2 { margin: 0 40px 16px 0; }
html[dir="rtl"] .sheet h2 { margin: 0 0 16px 40px; }
.sheet h3 { margin-top: 18px; }
.x { position: absolute; top: 12px; inset-inline-end: 12px; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 50%; background: #fff; font-size: 22px; line-height: 1; }
.sheet-actions { display: flex; gap: 10px; margin: 6px 0 4px; }
.sheet-actions .btn { flex: 1; }
body.sheet-open { overflow: hidden; }

#toast { position: fixed; z-index: 60; left: 50%; bottom: 84px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 14px; transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px); text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.bad { background: var(--red); }

@media (min-width: 900px) {
  .botnav { display: none; }
  .topnav { display: flex; gap: 4px; margin-inline-start: 18px; }
  .topnav a { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 999px; text-decoration: none; color: var(--muted); font-size: 14px; }
  .topnav a svg { width: 18px; height: 18px; }
  .topnav a.on { background: var(--ink); color: #fff; }
  .view { padding: 26px 24px 60px; }
  .cols { grid-template-columns: 1fr 1fr; gap: 24px; }
  .daynav h1 { font-size: 28px; }
  .board { flex-direction: row; overflow-x: auto; align-items: flex-start; padding-bottom: 10px; }
  .stage { flex: 0 0 236px; }
  .stage.empty { opacity: 1; padding: 10px; min-height: 80px; }
  .sheet { inset: 0; margin: auto; bottom: auto; top: 6vh; width: min(560px, calc(100vw - 32px)); max-height: 88vh; border-radius: 16px; }
  #toast { bottom: 28px; }
  .stages { grid-template-columns: 1fr 1fr 1fr; }
}
