/* CardScan — компоненты приложения поверх дизайн-системы IPS OS (css/ips.css):
   плавающая стеклянная панель с вкладками (как в ImPuls Mails), блок действий,
   лента по дням, карточки визиток и записей без визитки, ответы коллег,
   форма анкеты, меню действий. Телефон — одна колонка; ноутбук (≥ 1024 px) —
   слева «Новая запись», справа лента. */

html, body { min-height: 100%; }
/* clip, а не hidden: hidden сделал бы body прокручиваемым контейнером, и шапка
   перестала бы «прилипать» при прокрутке */
html { overflow-x: clip; }
body { font-size: 14.5px; }
/* Приложение, сохранённое на экран «Домой» iPhone, рисуется ПОД строкой состояния
   (viewport-fit=cover): отступаем на безопасную зону и закрываем её полосой фона,
   чтобы прокручиваемая лента не просвечивала под часами. */
body::before {
  content: ""; position: fixed; inset: 0 0 auto; z-index: 29;
  height: env(safe-area-inset-top, 0px); background: var(--bg);
}
button { font: inherit; color: inherit; }
.hidden { display: none !important; }

/* --- каркас --------------------------------------------------------------------- */
.shell {
  max-width: 1280px; margin: 0 auto;
  padding: env(safe-area-inset-top, 0px) max(12px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 28px) max(12px, env(safe-area-inset-left, 0px));
}

.topbar {
  position: sticky; top: calc(env(safe-area-inset-top, 0px) + 10px); z-index: 30;
  display: flex; align-items: center; gap: 10px;
  margin: 10px 0 14px; padding: 7px 8px 7px 10px; min-height: 54px;
  border-radius: 18px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; min-width: 0; text-decoration: none; color: var(--text); flex: none; }
.glyph {
  width: 36px; height: 36px; border-radius: 11px; flex: none;
  display: grid; place-items: center; color: #fff;
  background: var(--brand-grad);
  box-shadow: 0 8px 20px -8px var(--brand), inset 0 1px 0 rgb(255 255 255 / .3);
}
.glyph .icon { width: 20px; height: 20px; }
.glyph.xl { width: 64px; height: 64px; border-radius: 20px; }
.glyph.xl .icon { width: 34px; height: 34px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-name { font: 700 16px/1.1 var(--font-display); letter-spacing: -.01em; }
.brand-sub { font-size: 11.5px; color: var(--text-3); white-space: nowrap; }

/* вкладки разделов с «таблеткой», как в ImPuls Mails */
.views { display: flex; gap: 2px; min-width: 0; }
.views button {
  position: relative; isolation: isolate;
  display: inline-flex; align-items: center; gap: 7px;
  height: 38px; padding: 0 12px; border: 0; border-radius: 12px; background: none;
  color: var(--text-2); font: 500 13.5px/1 var(--font); white-space: nowrap; cursor: pointer;
  transition: color .2s, background-color .2s;
}
.views button:hover { color: var(--text); background: var(--surface-2); }
.views button.on { color: var(--text); font-weight: 600; background: none; }
.views button.on .icon { color: var(--accent); }
.views button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.views .pillbg { position: absolute; inset: 0; z-index: -1; border-radius: 12px; background: var(--surface-solid); box-shadow: var(--shadow), inset 0 0 0 1px var(--border); }
.views .count {
  min-width: 19px; height: 19px; padding: 0 6px; border-radius: 99px;
  display: inline-grid; place-items: center;
  font: 700 11px/1 var(--font); color: #fff; background: var(--accent);
  box-shadow: 0 4px 10px -4px var(--accent-glow);
}
.topbar .grow { flex: 1; }

.me { position: relative; flex: none; }
.me-btn {
  display: inline-flex; align-items: center; gap: 9px; max-width: 220px; height: 38px; padding: 0 12px 0 4px;
  border-radius: 99px; border: 1px solid transparent; background: none; color: var(--text);
  font: 600 13px/1 var(--font); cursor: pointer; transition: background-color .2s, border-color .2s;
}
.me-btn:hover, .me-btn[aria-expanded="true"] { background: var(--surface-solid); border-color: var(--border); box-shadow: var(--shadow); }
.me-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.me-btn .avatar { box-shadow: none; }
.me-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 40;
  width: 280px; padding: 6px; border-radius: var(--radius);
  background: var(--surface-strong); border: 1px solid var(--border-strong); box-shadow: var(--shadow-l);
  backdrop-filter: blur(20px) saturate(1.5); -webkit-backdrop-filter: blur(20px) saturate(1.5);
  animation: rise .3s var(--ease) both;
}
.menu-head { display: flex; align-items: center; gap: 10px; padding: 8px 8px 12px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.menu-head b { display: block; font-size: 14px; }
.menu-head span { font-size: 12px; color: var(--text-2); }
.menu-item {
  display: flex; align-items: center; gap: 11px; width: 100%; min-height: 40px; padding: 8px 10px;
  border: 0; border-radius: 10px; background: none; color: var(--text); text-align: left; text-decoration: none;
  font: 500 13.5px/1.2 var(--font); cursor: pointer;
}
.menu-item:hover { background: var(--surface-3); }
.menu-item .icon { color: var(--text-2); }
.menu-item .grow { flex: 1; min-width: 0; }
.menu-item small { display: block; color: var(--text-3); font-size: 11.5px; margin-top: 2px; }
.menu-item.danger { color: color-mix(in srgb, var(--bad) var(--pill-mix), var(--text)); }
.menu-item.danger .icon { color: inherit; }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }
.menu .switch { pointer-events: none; }

/* --- раскладка ------------------------------------------------------------------ */
.layout { display: block; }
.compose { display: none; }

.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* блок действий на телефоне */
.actions { padding: 14px; margin-bottom: 14px; }
.event-chip {
  display: inline-flex; align-items: center; gap: 7px; max-width: 100%;
  height: 32px; padding: 0 12px 0 9px; margin-bottom: 12px;
  border-radius: 99px; border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text-2); font: 500 13px/1 var(--font); cursor: pointer;
}
.event-chip:hover { background: var(--surface-3); color: var(--text); }
.event-chip b { color: var(--text); font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event-chip .icon { color: var(--brand); }
.event-chip .edit { color: var(--text-3); }
.btn.xl { width: 100%; height: 56px; border-radius: 16px; font-size: 16px; font-weight: 600; gap: 10px; }
.btn.xl .icon { width: 22px; height: 22px; }
.actions .row { display: grid; grid-template-columns: 1fr; gap: 10px; }
.actions .alt { display: flex; justify-content: center; margin-top: 10px; }
.actions .alt .link { font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }

.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; }

/* --- очередь отправки и баннеры ------------------------------------------------- */
.banner { display: flex; align-items: center; gap: 10px; padding: 10px 14px; margin-bottom: 12px; border-radius: 14px; font-size: 13.5px;
  color: color-mix(in srgb, var(--bad) var(--pill-mix), var(--text)); background: color-mix(in srgb, var(--bad) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--bad) 28%, transparent); }
.pending { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.pending li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; }
.pending img { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; flex: none; }
.pending .grow { min-width: 0; font-size: 13.5px; }
.pending small { display: block; color: var(--text-3); font-size: 12px; }
.pending li.failed .grow > div { color: color-mix(in srgb, var(--bad) var(--pill-mix), var(--text)); }

.feed-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 4px 2px 10px; }
.feed-head h2 { font-size: 17px; font-weight: 650; }
.feed-head .clear-btn { color: var(--text-2); }
.feed-head .clear-btn:hover { color: var(--text); }
#historyGroup { margin: -2px 2px 12px; }

/* --- дни (сворачиваемые группы) ------------------------------------------------- */
.day { margin-bottom: 12px; overflow: hidden; }
.day.card { background: var(--surface-solid); }
.day-summary { display: flex; align-items: center; gap: 10px; min-height: 58px; padding: 10px 14px; cursor: pointer; list-style: none; user-select: none; }
.day-summary::-webkit-details-marker { display: none; }
.day-summary::after {
  content: ""; flex: none; width: 16px; height: 16px; background: var(--chevron) center / 16px no-repeat;
  transition: rotate .25s var(--ease);
}
.day[open] > .day-summary::after { rotate: 180deg; }
.day[open] > .day-summary { border-bottom: 1px solid var(--border); }
.day-titles { flex: 1; min-width: 0; }
.day-title { font: 650 15.5px/1.2 var(--font-display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.day-sub { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.day-chips { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; flex: none; }
.day-jobs { list-style: none; margin: 0; padding: 0; }

/* --- карточка записи ------------------------------------------------------------- */
.job-wrap { position: relative; overflow: hidden; }
.job-wrap + .job-wrap { border-top: 1px solid var(--border); }
.job-wrap.collapse { transition: height .22s var(--ease), opacity .22s; opacity: 0; }
/* подложка свайпа: видна только пока карточку тянут пальцем (класс .swiping) */
.job-under { position: absolute; inset: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 22px;
  visibility: hidden; background: color-mix(in srgb, var(--brand) 16%, var(--surface-solid));
  color: var(--brand-text); font-weight: 650; font-size: 13.5px; }
.job-under.restore { background: color-mix(in srgb, var(--ok) 16%, var(--surface-solid)); color: color-mix(in srgb, var(--ok) var(--pill-mix), var(--text)); }
.job-under span { display: inline-flex; align-items: center; gap: 7px; }
.job-wrap.swiping .job-under { visibility: visible; }
/* карточка непрозрачная — иначе сквозь неё просвечивает подложка */
.job { position: relative; display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; background: var(--surface-solid); touch-action: pan-y; }
.job.settle { transition: transform .22s var(--ease); }
.job-thumb-btn { flex: none; position: relative; padding: 0; border: 0; background: none; border-radius: 12px; cursor: zoom-in; }
.job-thumb { display: block; width: 58px; height: 58px; border-radius: 12px; object-fit: cover; background: var(--surface-3); border: 1px solid var(--border); }
.job-glyph { flex: none; width: 58px; height: 58px; border-radius: 12px; display: grid; place-items: center;
  color: var(--brand-text); background: color-mix(in srgb, var(--brand) 14%, transparent); border: 1px solid color-mix(in srgb, var(--brand) 26%, transparent); }
.job-glyph .icon { width: 24px; height: 24px; }
.job-body { flex: 1; min-width: 0; }
.job-head { display: flex; align-items: baseline; gap: 8px; }
.job-title { flex: 1; min-width: 0; font: 650 15px/1.3 var(--font); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job-time { flex: none; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.job-act { flex: none; width: 32px; height: 32px; margin: -7px -8px -7px 0; padding: 0; display: grid; place-items: center;
  border: 0; border-radius: 9px; background: none; color: var(--text-3); cursor: pointer; }
.job-act:hover { background: var(--surface-3); color: var(--text); }
.job-company { font-size: 13.5px; margin-top: 1px; color: var(--text); overflow-wrap: anywhere; }
.job-meta { font-size: 12.5px; color: var(--text-2); margin-top: 2px; overflow-wrap: anywhere; }
.job-meta a { color: inherit; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
.job-status { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; }
.job-error { font-size: 12.5px; margin-top: 4px; color: color-mix(in srgb, var(--bad) var(--pill-mix), var(--text)); }
.job-cards { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.job-cards > li { padding: 8px 10px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.job-card-title { font-weight: 650; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* что записал сотрудник: запрос клиента и следующие шаги */
.note { display: flex; gap: 8px; margin-top: 8px; padding: 7px 10px; border-radius: 11px; font-size: 13px; line-height: 1.45;
  background: color-mix(in srgb, var(--brand) 8%, transparent); border: 1px solid color-mix(in srgb, var(--brand) 20%, transparent); }
.note > .icon { color: var(--brand-text); margin-top: 1px; }
.note .text { white-space: pre-wrap; overflow-wrap: anywhere; }
.note .steps { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.note-add { margin-top: 6px; }

/* Результат сверки предприятия. У найденной компании вся строка открывает справочник. */
.sips { display: flex; gap: 6px; align-items: baseline; margin-top: 6px; font-size: 12.5px; line-height: 1.4; color: var(--text-2); }
.sips-mark { font-weight: 700; }
.sips-text { overflow-wrap: anywhere; }
.sips-found { color: var(--ok); }
.sips-found .sips-text { color: var(--text); }
button.sips { max-width: 100%; min-height: 28px;
  padding: 4px 0; border: 0; background: none; font-family: inherit; text-align: left; cursor: pointer; }
button.sips .sips-name { color: var(--brand-text); font-weight: 650; text-decoration: underline; text-underline-offset: 3px; }
button.sips:focus-visible { outline: 2px solid var(--brand-text); outline-offset: 2px; border-radius: 3px; }
@media (pointer: coarse) { button.sips { min-height: 44px; } }
.sips-maybe .sips-mark { color: var(--warn); }
.sips-none, .sips-error { color: var(--text-3); }

/* справочник: есть ли предприятие в базе SalesIPS и кто его ведёт */
.directory { display: none; }
body.mode-directory .directory { display: block; }
body.mode-directory .actions, body.mode-directory #pending, body.mode-directory .feed-head, body.mode-directory #historyGroup,
body.mode-directory #feed, body.mode-directory #feedEmpty { display: none !important; }
body.mode-directory.has-ips-directory .layout { display: block; max-width: 780px; margin: 0 auto; }
body.mode-directory.has-ips-directory .compose { display: none; }
.dir-heading { display: flex; align-items: center; gap: 14px; margin: 22px 4px 16px; }
.dir-glyph { width: 48px; height: 48px; border-radius: 14px; }
.dir-glyph .icon { width: 24px; height: 24px; }
.dir-heading h1 { margin: 0; font: 750 clamp(25px, 4vw, 34px)/1.12 var(--font-display); letter-spacing: -.025em; }
.dir-heading p { margin: 3px 0 0; color: var(--text-2); font-size: 13px; }
.dir-search { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 72px); z-index: 12;
  display: flex; align-items: center; gap: 4px; padding: 5px; margin: 0 0 12px; border-radius: var(--radius); }
.dir-input { display: flex; align-items: center; gap: 10px; padding: 0 12px; border-radius: 13px;
  flex: 1; min-width: 0; border: 1px solid var(--border-strong); background: var(--surface-solid); }
.dir-input .icon { color: var(--text-3); flex: none; }
/* 16px — меньше iPhone приближает страницу при вводе */
.dir-input input { flex: 1; min-width: 0; min-height: 46px; padding: 0; border: 0; border-radius: 0;
  background: transparent; font-size: 16px; outline: none; box-shadow: none; }
.dir-input input:focus { border: 0; box-shadow: none; outline: none; }
.dir-input:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.btn.dir-refresh { width: 44px; height: 46px; flex: none; }
.dir-status { margin: 2px 4px 10px; font-size: 13.5px; font-weight: 650; }
.dir-found { color: color-mix(in srgb, var(--ok) var(--pill-mix), var(--text)); }
.dir-maybe { color: color-mix(in srgb, var(--warn) var(--pill-mix), var(--text)); }
.dir-none, .dir-busy { color: var(--text-2); }
.dir-error { color: color-mix(in srgb, var(--bad) 55%, var(--text)); }
.dir-item { padding: 12px 14px; margin-bottom: 10px; display: grid; gap: 7px; }
.dir-exact { border-color: color-mix(in srgb, var(--ok) 45%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 10%, transparent); }
.dir-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.dir-name { font: 650 15px/1.3 var(--font); overflow-wrap: anywhere; }
.dir-sub { font-size: 12.5px; color: var(--text-2); overflow-wrap: anywhere; }
.dir-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.dir-who { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; font-size: 13.5px; }
.dir-who .icon { color: var(--text-3); }
.dir-who small { font-size: 11.5px; color: var(--text-3); }
.dir-meta { font-size: 12px; color: var(--text-3); overflow-wrap: anywhere; }
.dir-add { width: 100%; margin: 2px 0 12px; }
.dir-results { display: grid; gap: 8px; }
.dir-company { width: 100%; text-align: left; color: var(--text); cursor: pointer; display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 16px; align-items: center; gap: 12px; min-height: 70px;
  padding: 12px 13px; }
.dir-company:focus-visible { outline: 2px solid var(--brand-text); outline-offset: 2px; }
.dir-company:active { background: var(--surface-solid); }
.dir-company-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  background: color-mix(in srgb, var(--brand) 12%, var(--surface-solid)); color: var(--brand-text); }
.dir-company-icon .icon { width: 20px; height: 20px; }
.dir-company > .icon { color: var(--text-3); transform: rotate(-90deg); }
.dir-company .dir-name { display: block; font-size: 15.5px; }
.dir-company .dir-sub { display: block; margin-top: 3px; }
.dir-next { display: flex; justify-content: center; width: 100%; margin: 10px 0 0; min-height: 46px; }

.dir-dialog { position: fixed; inset: 0 0 0 auto; width: min(580px, 100%); max-width: none;
  height: 100dvh; max-height: none; margin: 0; padding: 0; overflow: hidden; color: var(--text);
  background: var(--bg); border: 0; border-left: 1px solid var(--border); border-radius: 22px 0 0 22px; box-shadow: var(--shadow-l); }
.dir-dialog[open] { display: flex; flex-direction: column; }
.dir-dialog::backdrop { background: rgb(8 14 28 / .52); }
html:has(.dir-dialog[open]) { overflow: hidden; }
.dir-toolbar { display: flex; align-items: center; justify-content: space-between; flex: none;
  padding: calc(6px + env(safe-area-inset-top, 0px)) 12px 6px; border-bottom: 1px solid var(--border);
  background: var(--surface-solid); }
.dir-back { min-height: 44px; }
.dir-back .icon { transform: rotate(180deg); }
.dir-detail-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain;
  padding: 18px 18px calc(24px + env(safe-area-inset-bottom, 0px)); }
.dir-detail-hero { margin-bottom: 16px; }
.dir-detail-hero h2 { margin: 10px 0 0; font: 750 clamp(23px, 5.7vw, 31px)/1.15 var(--font-display);
  letter-spacing: -.024em; overflow-wrap: anywhere; }
.dir-detail-meta { color: var(--text-2); margin: 5px 0 0; overflow-wrap: anywhere; }
.dir-detail-meta:empty { display: none; }
.dir-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 10px; }
.dir-fact { min-width: 0; padding: 12px; }
.dir-fact dt { color: var(--text-2); font-size: 12.5px; }
.dir-fact dt .icon { color: var(--brand-text); vertical-align: -3px; margin-right: 4px; }
.dir-fact dd { margin: 5px 0 0; font-weight: 700; overflow-wrap: anywhere; }
.dir-jumps { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dir-jumps .btn { min-height: 44px; }
.dir-section { margin-top: 18px; scroll-margin-block-start: 14px; }
.dir-section h3 { font: 700 17px/1.2 var(--font-display); margin: 0 0 10px; }
.dir-section-list { margin: 0; padding: 0; list-style: none; }
.dir-section-list > li { padding: 12px; list-style: none; overflow-wrap: anywhere; }
.dir-section-list > li + li { border-top: 1px solid var(--border); }
.dir-muted { color: var(--text-2); font-size: 13.5px; margin: 0; }
.dir-contact-links { display: flex; flex-wrap: wrap; column-gap: 14px; }
.dir-contact-links a { color: var(--brand-text); font-size: 13.5px; min-height: 44px; display: inline-flex;
  align-items: center; gap: 5px; max-width: 100%; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.dir-contact-links .icon { flex: none; }
.dir-message-byline { display: flex; flex-wrap: wrap; gap: 3px 12px; font-size: 12px; color: var(--text-2); }
.dir-message-byline time { margin-left: auto; }
.dir-message-title { margin: 6px 0 0; font-size: 14px; }
.dir-message-text { margin: 6px 0 0; white-space: pre-wrap; }
@media (max-width: 599px) {
  .dir-dialog { width: 100%; border: 0; border-radius: 0; }
  .dir-detail-scroll { padding-left: 14px; padding-right: 14px; }
}
@media (hover: hover) and (pointer: fine) {
  .dir-company:hover { background: var(--surface-solid); border-color: var(--border-strong); }
}

/* ответ коллег из таблицы */
.fb { margin-top: 8px; padding: 9px 11px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border);
  transition: background-color .8s var(--ease), border-color .8s var(--ease), box-shadow .8s var(--ease); }
.fb-new { background: color-mix(in srgb, var(--accent) 10%, transparent); border-color: color-mix(in srgb, var(--accent) 38%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 10%, transparent); }
.fb-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.fb-who { display: flex; flex-direction: column; font-size: 13.5px; }
.fb-label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); }
.fb-new-tag { margin-left: auto; transition: opacity .6s var(--ease), scale .6s var(--ease); }
.fb.fading .fb-new-tag { opacity: 0; scale: .8; }
.fb-comment { margin: 0; font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.fb-top + .fb-comment { margin-top: 7px; padding-top: 7px; border-top: 1px dashed var(--border-strong); }
.fb-wait { margin-top: 7px; font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 6px; }
.pill.lead-progress { --c: var(--warn); }
.pill.lead-won { --c: var(--ok); }
.pill.lead-lost { --c: var(--bad); }
.pill.lead-stale { --c: var(--idle); }
.pill.lead-other { --c: var(--accent); }

/* пустая лента */
.empty { display: grid; justify-items: center; gap: 10px; padding: 34px 20px; text-align: center; color: var(--text-2); }
.empty-icon { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center;
  color: var(--brand-text); background: color-mix(in srgb, var(--brand) 14%, transparent); animation: float 4s ease-in-out infinite; }
.empty-icon .icon { width: 30px; height: 30px; }
.empty b { color: var(--text); font-size: 15px; }
@keyframes float { 50% { translate: 0 -5px; } }

/* --- форма анкеты («Запись без визитки») --------------------------------------- */
.entry-form { display: grid; gap: 12px; }
.field { display: grid; gap: 5px; }
.field > span { font-size: 12px; font-weight: 600; color: var(--text-2); }
.field > span i { font-style: normal; color: var(--bad); }
.field input, .field textarea { width: 100%; min-height: 40px; font-size: 15px; }
.field textarea { min-height: 74px; }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 12px; }
.steps-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-toggle {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px;
  border-radius: 99px; border: 1px solid var(--control-border); background: var(--field-bg);
  color: var(--text-2); font: 500 13px/1 var(--font); cursor: pointer; user-select: none;
  transition: background-color .2s, border-color .2s, color .2s;
}
.chip-toggle .icon { width: 14px; height: 14px; display: none; }
.chip-toggle[aria-pressed="true"] { color: var(--accent-text); border-color: color-mix(in srgb, var(--accent) 50%, transparent);
  background: color-mix(in srgb, var(--accent) 12%, transparent); }
.chip-toggle[aria-pressed="true"] .icon { display: inline-block; }
.chip-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* «Куда записывать»: листы таблицы */
.sheet-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; min-width: 0;
  max-height: 260px; overflow: hidden auto; overscroll-behavior: contain; }
.sheet-opt {
  display: flex; align-items: center; gap: 10px; width: 100%; min-width: 0; min-height: 44px; padding: 0 12px;
  border-radius: 12px; border: 1px solid var(--control-border); background: var(--field-bg);
  color: var(--text); font: 500 14px/1.2 var(--font); text-align: left; cursor: pointer;
  transition: background-color .2s, border-color .2s;
}
.sheet-opt .icon { width: 16px; height: 16px; flex: none; color: var(--accent); visibility: hidden; }
.sheet-opt small { flex: none; font-size: 11.5px; color: var(--text-3); }
.sheet-opt[aria-checked="true"] { border-color: color-mix(in srgb, var(--accent) 50%, transparent);
  background: color-mix(in srgb, var(--accent) 12%, transparent); font-weight: 650; }
.sheet-opt[aria-checked="true"] .icon { visibility: visible; }
.sheet-opt:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sheet-status { margin: 0; font-size: 12.5px; }
.sheet-status.bad { color: color-mix(in srgb, var(--bad) var(--pill-mix), var(--text)); }
.sheet-new { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.sheet-new input { min-width: 0; }
.sheet-new .btn { height: 40px; }
.compose > .event-chip { margin: -4px 0 14px; }
.step-extra { display: none; }
.step-extra.on { display: grid; }
.form-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.form-foot .who { font-size: 12px; color: var(--text-3); flex: 1; min-width: 0; }
.form-error { display: flex; gap: 8px; align-items: center; font-size: 13px; color: color-mix(in srgb, var(--bad) var(--pill-mix), var(--text)); }

/* зона «перетащите фото визитки» (ноутбук) */
.dropzone {
  display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 14px; cursor: pointer;
  border: 1.5px dashed var(--control-border); background: var(--surface-2); color: var(--text-2); font-size: 13px;
  transition: border-color .2s, background-color .2s;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); color: var(--text); }
.dropzone b { display: block; color: var(--text); font-size: 13.5px; }
.dropzone .glyph { width: 40px; height: 40px; }

.compose-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.compose-head h2 { font-size: 16px; font-weight: 650; }
.compose .sep { display: flex; align-items: center; gap: 10px; margin: 16px 0 12px; color: var(--text-3); font-size: 12px; }
.compose .sep::before, .compose .sep::after { content: ""; flex: 1; border-top: 1px solid var(--border); }

/* --- диалоги -------------------------------------------------------------------- */
dialog.modal .modal-body { padding-bottom: 12px; }
.capture-preview { display: block; width: 100%; max-height: 42vh; object-fit: contain; border-radius: 14px; background: #000; margin-bottom: 12px; }

/* меню действий карточки — лист снизу на телефоне */
.actions-list { display: grid; gap: 6px; padding: 6px 16px 16px; }
.actions-list .btn { justify-content: flex-start; height: 48px; border-radius: 13px; font-size: 14.5px; gap: 12px; padding: 0 14px; }
.actions-list .btn small { display: block; font-size: 11.5px; font-weight: 500; opacity: .8; }
.actions-list .btn .lbl { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; }

/* фото визитки на весь экран */
.photo-dialog { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: #000; overflow: hidden; }
.photo-dialog[open] { display: flex; align-items: center; justify-content: center; }
.photo-dialog::backdrop { background: #000; }
.photo-dialog img { display: block; max-width: 100%; max-height: 100%; object-fit: contain; cursor: zoom-out; }
.photo-dialog .x { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 12px); right: 12px; width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center; border: 1px solid rgb(255 255 255 / .3); background: rgb(0 0 0 / .55); color: #fff; cursor: pointer; }
.photo-dialog .hint { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 24px); left: 16px; color: rgb(255 255 255 / .7); font-size: 12.5px; }
.photo-dialog .loading { position: absolute; bottom: 24px; color: rgb(255 255 255 / .7); font-size: 13px; }

/* тост: кнопка действия («Вернуть») */
.toast .act { flex: none; align-self: center; margin: 0; padding: 4px 8px; border: 0; border-radius: 8px; background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent-text); font: 650 13px/1 var(--font); cursor: pointer; }
.toast .act:hover { background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--accent-text); }

/* --- телефон -------------------------------------------------------------------- */
@media (max-width: 1023px) {
  dialog.modal.sheet {
    width: 100%; max-width: 100%; margin: auto 0 0; max-height: 92dvh;
    border-radius: 22px 22px 0 0; border-bottom: 0; padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  dialog.modal.sheet:not([open]) { translate: 0 30px; scale: 1; }
  @starting-style { dialog.modal.sheet[open] { translate: 0 40px; scale: 1; } }
  dialog.modal.sheet::before { content: ""; display: block; width: 40px; height: 4px; margin: 10px auto 0; border-radius: 2px; background: var(--border-strong); }
  /* разделы листаются свайпом (app.js, attachViewSwipe): горизонтальный жест —
     странице, прокрутка и щипок — браузеру */
  html { touch-action: pan-y pinch-zoom; }
}
.feed-col.view-settle { transition: transform .2s var(--ease), opacity .2s var(--ease); }
@media (max-width: 720px) {
  .shell {
    padding: env(safe-area-inset-top, 0px) max(8px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 24px) max(8px, env(safe-area-inset-left, 0px));
  }
  .topbar { top: calc(env(safe-area-inset-top, 0px) + 8px); margin: 8px 0 12px; padding: 6px 6px 6px 8px; border-radius: 16px; gap: 6px; }
  .brand-text { display: none; }
  /* подпись остаётся у «Ленты» и «Справочника»; «История» — значком */
  .views button { padding: 0 9px; gap: 5px; font-size: 13px; }
  .views button > span.lbl-wide { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .me-name { display: none; }
  .me-btn { padding: 0 3px; }
}
/* узкий телефон (360 px): иначе подписи «Лента» и «Справочник» не влезают — знак уходит */
@media (max-width: 399px) {
  .topbar .brand { display: none; }
}

/* --- ноутбук: слева «Новая запись», справа лента ------------------------------- */
@media (min-width: 1024px) {
  .shell { padding: 0 20px 40px; }
  .layout { display: grid; grid-template-columns: minmax(360px, 420px) 1fr; gap: 20px; align-items: start; }
  .compose { display: block; position: sticky; top: calc(env(safe-area-inset-top, 0px) + 84px); padding: 18px; max-height: calc(100dvh - 100px); overflow: auto; }
  .actions { display: none; }
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .feed-col { min-width: 0; }
  .job { padding: 14px 18px; }
  .job-thumb, .job-glyph { width: 72px; height: 72px; }
}

@media (hover: hover) and (pointer: fine) {
  .job-wrap:hover .job { background: color-mix(in srgb, var(--surface-solid) 94%, var(--text)); }
}
