/* ARIO CRM. Графит и хвоя: спокойный интерфейс для телефона, один зелёный акцент. */
:root {
  --graphite: #161b17;
  --graphite-2: #1f2621;
  --paper: #f2f3ee;
  --card: #fcfcfa;
  --ink: #1b221d;
  --muted: #637064;
  --line: #dcdfd4;
  --line-strong: #c6cbbd;
  --accent: #2c7a50;
  --accent-ink: #ffffff;
  --accent-soft: #e0eee4;
  --accent-bright: #86d19d;
  --warn: #a8402a;
  --warn-soft: #f6e3dc;
  --amber: #8a6a12;
  --amber-soft: #f3ecd0;
  --radius: 14px;
  --tap: 44px;
  --rail: 236px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 72px; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 16px/1.5 Onest, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-variant-numeric: tabular-nums;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; line-height: 1.2; }
h1 { font-size: 24px; }
h2 { font-size: 18px; }
h3 { font-size: 16px; }
p { margin: 0 0 8px; }
small, .small { font-size: 13.5px; }
.muted { color: var(--muted); }
.i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.i.sm { width: 18px; height: 18px; }
.i.fill { fill: currentColor; stroke: none; }

/* шапка */
.top {
  position: sticky; top: 0; z-index: 30; height: 56px; padding: 0 16px;
  display: flex; align-items: center; gap: 12px; background: var(--graphite); color: #e8eee9;
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; letter-spacing: 0.08em; color: #fff; }
.brand:hover { text-decoration: none; }
.brand .i { color: var(--accent-bright); width: 26px; height: 26px; }
.brand em { font-style: normal; font-weight: 500; color: #8c9a8e; letter-spacing: 0.02em; }
.top .sp { flex: 1; }
.top .me { display: flex; align-items: center; gap: 10px; font-size: 14px; color: #b9c4bb; }
.top .me a { color: #b9c4bb; min-height: var(--tap); display: inline-flex; align-items: center; }
.top .me .who { display: none; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: #2a3a2f; color: var(--accent-bright);
  display: inline-grid; place-items: center; font-size: 13px; font-weight: 600;
}

/* навигация: нижняя панель на телефоне, левая колонка на широком экране */
.tabs {
  position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--graphite); padding-bottom: env(safe-area-inset-bottom); border-top: 1px solid #263028;
}
.tabs a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-height: 60px; font-size: 11.5px; font-weight: 500; color: #8f9d91; text-decoration: none;
}
.tabs a.on { color: #fff; }
.tabs a.on .i { color: var(--accent-bright); }
.tabs .extra, .tabs .rail-head { display: none; }
.page { padding: 18px 16px calc(92px + env(safe-area-inset-bottom)); max-width: 760px; margin: 0 auto; }
.page.wide { max-width: 1120px; }

.flash { margin: 12px 16px 0; padding: 12px 14px; border-radius: 12px; background: var(--accent-soft); color: #1d4f35; font-weight: 500; }
.flash.err { background: var(--warn-soft); color: var(--warn); }

@media (min-width: 960px) {
  .tabs {
    top: 56px; right: auto; width: var(--rail); display: flex; flex-direction: column; padding: 14px 10px; gap: 2px;
    border-top: 0; border-right: 1px solid #263028; overflow-y: auto;
  }
  .tabs a { flex-direction: row; justify-content: flex-start; gap: 12px; min-height: 46px; padding: 0 14px; font-size: 15px; border-radius: 12px; }
  .tabs a.on { background: #223027; }
  .tabs .extra, .tabs .rail-head { display: flex; }
  .tabs a.more-tab { display: none; }
  .tabs .rail-head { margin: 14px 14px 4px; font-size: 13px; color: #6f7d72; }
  .page, .flash { margin-left: var(--rail); max-width: none; }
  .page { padding: 28px 40px 60px; }
  .page > .in { max-width: 1080px; }
  .flash { margin: 16px 40px 0 calc(var(--rail) + 40px); }
  .top .me .who { display: inline; }
}

/* карточки, списки */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; }
.card > h2, .card > .card-h { margin-bottom: 8px; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pagehead { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.pagehead .sub { color: var(--muted); font-size: 14.5px; margin-top: 2px; }
.stack > * + * { margin-top: 14px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.sp { justify-content: space-between; }
.grid2 { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .grid2 { grid-template-columns: 1fr 1fr; } .grid3 { grid-template-columns: repeat(3, 1fr); } }
.grid3 { display: grid; gap: 12px; grid-template-columns: 1fr; }
.list { display: flex; flex-direction: column; }
.item {
  display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 10px 0; border-top: 1px solid var(--line);
  color: inherit; text-decoration: none;
}
.item:first-child { border-top: 0; }
a.item:hover { text-decoration: none; background: rgba(44, 122, 80, 0.04); }
.item .grow { flex: 1; min-width: 0; }
.item .t { font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.item .s { font-size: 13.5px; color: var(--muted); }
.empty { padding: 22px 8px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--ink); margin-bottom: 4px; }

/* кнопки */
.btn {
  min-height: var(--tap); padding: 0 16px; border-radius: 12px; border: 1px solid var(--line-strong); background: #fff; color: var(--ink);
  font: 600 15px Onest, system-ui, sans-serif; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { text-decoration: none; border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #256943; }
.btn.quiet { border-color: transparent; background: transparent; color: var(--accent); }
.btn.danger { color: var(--warn); border-color: #e1bdb2; }
.btn.sm { min-height: 44px; padding: 0 12px; font-size: 14px; border-radius: 10px; } /* Ж13: не меньше 44 px */
.btn.block { width: 100%; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.check {
  width: 44px; height: 44px; flex: none; border-radius: 50%; border: 2px solid var(--line-strong); background: #fff; color: transparent;
  display: grid; place-items: center; cursor: pointer; padding: 0;
}
.check:hover { border-color: var(--accent); color: var(--accent); }

/* формы */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field > label, .lbl { font-size: 14px; font-weight: 500; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], input[type=date],
input[type=datetime-local], input[type=url], input[type=search], select, textarea {
  width: 100%; min-height: var(--tap); padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line-strong);
  background: #fff; color: var(--ink); font: inherit;
}
textarea { min-height: 88px; resize: vertical; }
input[type=checkbox], input[type=radio] { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
.checks { display: flex; flex-direction: column; }
.checks label { display: flex; align-items: center; gap: 10px; min-height: var(--tap); font-size: 15px; color: var(--ink); font-weight: 400; }
.checks label .price { margin-left: auto; color: var(--muted); font-size: 14px; }
.two { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.filters select, .filters input { min-width: 140px; width: auto; flex: 1 1 calc(50% - 8px); }
@media (min-width: 960px) { .filters select, .filters input { flex: 0 1 auto; } }
details.fold > summary {
  list-style: none; cursor: pointer; min-height: var(--tap); display: flex; align-items: center; justify-content: space-between;
  font-weight: 600; gap: 10px;
}
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::after { content: "+"; font-size: 22px; color: var(--accent); font-weight: 500; }
details.fold[open] > summary::after { content: "–"; }

/* метки */
.chip {
  display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12.5px; font-weight: 500;
  background: #e8ebe2; color: #3b473e; white-space: nowrap;
}
.chip.a { background: var(--accent); color: #fff; }
.chip.b { background: var(--accent-soft); color: #1d4f35; }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.amber { background: var(--amber-soft); color: var(--amber); }
.chip.dark { background: var(--graphite); color: #dfe8e0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* тропа: прогресс сделки по этапам воронки */
.trail { display: flex; gap: 3px; align-items: center; height: 10px; }
.trail i { flex: 1; height: 4px; border-radius: 2px; background: #d8dccf; }
.trail i.done { background: var(--accent); }
.trail i.cur { background: var(--accent); height: 10px; flex: 0 0 10px; border-radius: 50%; box-shadow: 0 0 0 3px var(--accent-soft); }
.trail.won i { background: var(--accent); }
.trail.lost i.cur { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.trail.hold i.cur { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-soft); }

/* карточка сделки в списках */
.deal { display: block; padding: 12px 0; border-top: 1px solid var(--line); color: inherit; }
.deal:first-child { border-top: 0; }
.deal:hover { text-decoration: none; }
.deal .h { display: flex; justify-content: space-between; gap: 12px; font-weight: 600; }
.deal .m { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13.5px; color: var(--muted); margin: 3px 0 9px; }
.sum { font-weight: 600; white-space: nowrap; }

/* быстрые действия */
.quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 8px; }
.qa {
  min-height: 56px; border-radius: 12px; background: var(--graphite); color: #e9efe9; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px; font-size: 12.5px; font-weight: 500; text-decoration: none;
}
.qa:hover { text-decoration: none; background: #243026; }
.qa .i { color: var(--accent-bright); }
.qa.off { background: #e4e7de; color: #8a948c; pointer-events: none; }
.qa.off .i { color: #a4ada5; }

/* лента касаний */
.tl { list-style: none; margin: 0; padding: 0; }
.tl li { position: relative; padding: 0 0 18px 30px; }
.tl li::before { content: ""; position: absolute; left: 9px; top: 22px; bottom: 0; width: 2px; background: var(--line); }
.tl li:last-child::before { display: none; }
.tl .dot { position: absolute; left: 0; top: 2px; width: 20px; height: 20px; border-radius: 50%; background: #e4e8dd; color: #44514a; display: grid; place-items: center; }
.tl .dot .i { width: 12px; height: 12px; stroke-width: 2.4; }
.tl .dot.call { background: var(--accent-soft); color: var(--accent); }
.tl .dot.kp_sent { background: var(--accent); color: #fff; }
.tl .dot.sys { background: #f0f1ec; color: #98a199; }
.tl .meta { font-size: 13px; color: var(--muted); }
.tl .body { white-space: pre-wrap; overflow-wrap: anywhere; }
.tl .res { margin-top: 2px; font-weight: 500; }

/* канбан */
.board { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 2px 16px 14px; margin: 0 -16px; -webkit-overflow-scrolling: touch; }
@media (min-width: 960px) { .board { margin: 0; padding: 2px 0 14px; scroll-snap-type: none; } }
.col { flex: 0 0 min(86vw, 304px); scroll-snap-align: center; }
.col-h { display: flex; justify-content: space-between; align-items: baseline; padding: 0 2px 8px; margin-bottom: 8px; border-bottom: 2px solid var(--accent); }
.col-h b { font-weight: 600; }
.col-h span { font-size: 13px; color: var(--muted); }
.col.side .col-h { border-color: var(--line-strong); }
.col.lost .col-h { border-color: #d9aa9d; }
.bcard { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; margin-bottom: 8px; }
.bcard .n { font-weight: 600; display: block; color: var(--ink); overflow-wrap: anywhere; }
.bcard .m { font-size: 13px; color: var(--muted); margin: 2px 0 8px; }
.bcard select { min-height: 40px; font-size: 14px; padding: 6px 8px; }
.seg { display: inline-flex; background: #e6e9df; border-radius: 12px; padding: 3px; gap: 2px; }
.seg a { min-height: 38px; padding: 0 14px; border-radius: 9px; display: inline-flex; align-items: center; color: var(--muted); font-weight: 500; text-decoration: none; }
.seg a.on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.pills { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin: 0 -16px 10px; padding-left: 16px; padding-right: 16px; }
.pills a { flex: none; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-strong); display: inline-flex; align-items: center; color: var(--ink); background: #fff; font-weight: 500; text-decoration: none; }
.pills a.on { background: var(--graphite); color: #fff; border-color: var(--graphite); }
@media (min-width: 960px) { .pills { margin: 0 0 10px; padding: 0 0 8px; flex-wrap: wrap; } }

/* таблицы */
.scroll-x { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
@media (min-width: 960px) { .scroll-x { margin: 0; padding: 0; } }
.tbl { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.tbl th { text-align: left; font-weight: 500; color: var(--muted); padding: 8px 10px 8px 0; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
.tbl td { padding: 10px 10px 10px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl .num { text-align: right; padding-right: 0; padding-left: 10px; white-space: nowrap; }
.bar { height: 8px; border-radius: 4px; background: var(--accent); min-width: 2px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; }
.kv dt { color: var(--muted); font-size: 14px; }
.kv dd { margin: 0; overflow-wrap: anywhere; }

/* заказ: шаги */
.steps { list-style: none; margin: 0; padding: 0; }
.steps li { display: flex; gap: 12px; align-items: center; min-height: 40px; color: var(--muted); }
.steps li .pt { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-strong); background: #fff; flex: none; }
.steps li.done { color: var(--ink); } .steps li.done .pt { background: var(--accent); border-color: var(--accent); }
.steps li.cur { color: var(--ink); font-weight: 600; } .steps li.cur .pt { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); background: #fff; }
.steps .dd { margin-left: auto; font-size: 13px; color: var(--muted); font-weight: 400; }
.hint { background: var(--amber-soft); color: #5e4a0c; border-radius: 10px; padding: 10px 12px; font-size: 14px; }
.hint.ok { background: var(--accent-soft); color: #1d4f35; }
.tplbox { background: #f4f6f0; border: 1px dashed var(--line-strong); border-radius: 12px; padding: 12px; white-space: pre-wrap; overflow-wrap: anywhere; margin: 8px 0; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--graphite); }
.login .box { width: 100%; max-width: 380px; background: var(--card); border-radius: 18px; padding: 28px 24px; }
.login .brand { color: var(--ink); margin-bottom: 18px; }
.login .brand .i { color: var(--accent); }
.htmx-request { opacity: .6; transition: opacity .15s; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.mt { margin-top: 14px; } .mb0 { margin-bottom: 0; }
.toast-err { position: fixed; left: 16px; right: 16px; bottom: 84px; z-index: 50; background: var(--warn); color: #fff; padding: 12px 14px; border-radius: 12px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

.net-toast{position:fixed;left:12px;right:12px;bottom:calc(76px + env(safe-area-inset-bottom));z-index:60;background:#7a1f1f;color:#fff;
  padding:12px 14px;border-radius:12px;font-weight:600;box-shadow:0 6px 24px rgba(0,0,0,.25)}
@media (min-width:900px){.net-toast{left:auto;right:24px;bottom:24px;max-width:420px}}

/* Ж13: зона нажатия не меньше 44 px; строка «Выполнено, отменить» */
.check { min-width: 44px; min-height: 44px; }
.item.done-undo { background: #eef6ea; }
