/* ORKEN CRM — calm, readable, mobile first. Colours: felt (кийиз) neutrals + ORKEN blue. */
:root {
  --bg: #f5f1ea; --surface: #fffdf9; --ink: #22201c; --muted: #6f6a62; --line: #e4ddd1;
  --accent: #1f4e8c; --accent-ink: #fff; --accent-soft: #e6eef8;
  --late: #b4441c; --late-soft: #fbe9e1; --ok: #2f7d4f; --ok-soft: #e4f2e9;
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 var(--font); padding-bottom: 76px; }
a { color: var(--accent); }
h1, h2 { font-family: var(--serif); font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 26px; margin: 4px 0 16px; }
h2 { font-size: 19px; margin: 28px 0 10px; display: flex; align-items: center; gap: 8px; }
.wrap { max-width: 980px; margin: 0 auto; padding: 16px; }
.top { position: sticky; top: 0; z-index: 10; background: var(--surface); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; justify-content: space-between; padding-block: 10px; }
.brand { font-family: var(--serif); font-size: 20px; font-weight: 700; color: var(--ink); text-decoration: none; }
.who { font-size: 13px; color: var(--muted); display: flex; gap: 10px; align-items: center; }
.linkbtn { background: none; border: 0; color: var(--accent); font: inherit; font-size: 13px; padding: 4px; cursor: pointer; text-decoration: underline; }
.topnav { display: none; gap: 4px; }
.topnav a, .bottomnav a { text-decoration: none; color: var(--muted); }
.topnav a.on { color: var(--ink); font-weight: 600; }
.bottomnav { position: fixed; inset: auto 0 0 0; z-index: 10; background: var(--surface); border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(var(--n, 4), 1fr); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
.bottomnav a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11.5px; padding: 6px 2px; border-radius: 8px; }
.bottomnav a.on { color: var(--accent); font-weight: 600; }
.bottomnav .ico { font-size: 20px; line-height: 1; }
.bottomnav a.add .ico { background: var(--accent); color: var(--accent-ink); width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: 26px; margin-top: -14px; box-shadow: 0 4px 12px rgb(31 78 140 / .3); }
@media (min-width: 820px) {
  body { padding-bottom: 0; }
  .topnav { display: flex; gap: 18px; }
  .bottomnav { display: none; }
}
.flash { background: var(--ok-soft); color: var(--ok); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 14px; font-weight: 600; }
.flash.warn { background: #fff4d6; color: #7a5a00; }
.error { background: var(--late-soft); color: var(--late); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.stack { display: grid; gap: 10px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); font-size: 14px; }
.small { font-size: 13px; }
.empty { color: var(--muted); padding: 14px; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); }
.badge { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.badge.late { background: var(--late-soft); color: var(--late); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.grey { background: #eee9e0; color: var(--muted); }
.count { font-family: var(--font); font-size: 13px; background: var(--ink); color: #fff; border-radius: 99px; padding: 1px 8px; }
.item { display: grid; gap: 8px; }
.item .name { font-weight: 600; }
.item a.title { color: var(--ink); text-decoration: none; }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 18px; }
.timer.late { color: var(--late); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; padding: 0 18px; border-radius: 10px;
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); font: 600 16px var(--font); cursor: pointer; text-decoration: none; }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.small { min-height: 40px; font-size: 14px; padding: 0 12px; }
.btn.wide { width: 100%; }
.btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
form.inline { display: inline; }
label { display: grid; gap: 4px; font-size: 14px; color: var(--muted); }
input, select, textarea { font: 16px var(--font); color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; width: 100%; min-height: 48px; }
textarea { min-height: 72px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chips label { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-size: 15px; cursor: pointer; }
.chips input:checked + span { color: var(--accent-ink); }
.chips label:has(input:checked) { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chips label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.grid2 { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid2 { grid-template-columns: 1fr 1fr; } }
details > summary { cursor: pointer; color: var(--accent); font-weight: 600; padding: 8px 0; }
.hint { font-size: 14px; border-radius: 10px; padding: 8px 12px; background: #fff4d6; color: #7a5a00; }
.filters { display: grid; gap: 8px; grid-template-columns: 1fr 1fr; }
.filters .full { grid-column: 1 / -1; }
@media (min-width: 820px) { .filters { grid-template-columns: repeat(4, 1fr); } }
.tablewrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-weight: 600; color: var(--muted); font-size: 12.5px; background: #faf7f1; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 15px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.timeline { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.timeline li { font-size: 14px; border-left: 3px solid var(--line); padding-left: 10px; }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 120px; padding: 8px 0; }
.bars div { flex: 1; background: var(--accent); border-radius: 3px 3px 0 0; min-height: 2px; position: relative; }
.bars div span { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font-size: 11px; color: var(--muted); }
.barlabels { display: flex; gap: 3px; font-size: 10.5px; color: var(--muted); }
.barlabels span { flex: 1; text-align: center; }
.kpi { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
@media (min-width: 820px) { .kpi { grid-template-columns: repeat(4, 1fr); } }
.kpi .card b { display: block; font-family: var(--serif); font-size: 28px; font-variant-numeric: tabular-nums; }
.login { max-width: 380px; margin: 12vh auto 0; }
.mt { margin-top: 12px; }
.mb6 { margin-bottom: 6px; }
input.check { width: auto; min-height: 0; }
.bottomnav[data-n="2"] { grid-template-columns: repeat(2, 1fr); }
.bottomnav[data-n="5"] { grid-template-columns: repeat(5, 1fr); }
.ink { color: var(--ink); }
.btn.danger { color: var(--late); border-color: var(--late); }

/* §16.1 WhatsApp follow-up and the status chain on the card */
.btn.wa { background: #1f7a4d; color: #fff; border-color: #1f7a4d; }
.chain { list-style: none; display: flex; flex-wrap: wrap; gap: 4px; padding: 0; margin: 0 0 12px; font-size: 12px; }
.chain li { padding: 3px 8px; border-radius: 99px; background: #eee9e0; color: var(--muted); }
.chain li + li::before { content: "→ "; }
.chain li.on { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.bar-h { display: block; height: 8px; border-radius: 4px; background: var(--accent); min-width: 2px; }
