/* Компоненты Mini App. Цвета — только семантические токены из tokens.css
   (и производные от них через color-mix), никаких значений «на глаз». */

[data-platform="tdesktop"] .app,
[data-platform="macos"] .app,
[data-platform="web"] .app,
[data-platform="weba"] .app,
[data-platform="unknown"] .app { max-width: 560px; margin-inline: auto; }

.icon { width: 20px; height: 20px; flex: 0 0 auto; fill: none; stroke: currentColor;
        stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon--sm { width: 16px; height: 16px; }
.icon--fill { fill: currentColor; stroke: none; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* ── шапка: вкладки; ниже в ленте — «герой» с типом и фигурами ── */
.app-header { padding-bottom: var(--sp-2); }
.app[data-tab="saved"] .app-header,
.app[data-tab="compare"] .app-header { border-bottom: var(--hairline) solid var(--separator); }
.hero {
  position: relative; overflow: hidden;
  padding: var(--sp-3) var(--sp-4) var(--sp-4);
  background: var(--header-bg);
}
.hero__art { position: absolute; right: -6px; top: -4px; width: 190px; height: 128px; max-width: none; pointer-events: none; }
.hero__caption, .hero__title, .hero .profile-pill { position: relative; }
.hero__caption { font-size: var(--fs-caption); font-weight: 500; color: var(--subtitle); }
.hero__title {
  max-width: 60%; margin-top: 2px;
  font-size: var(--fs-large); font-weight: 800; line-height: 1.08; letter-spacing: -.02em;
}
.profile-pill {
  display: inline-flex; align-items: center; gap: 6px;
  max-width: 100%; min-height: 32px; margin-top: var(--sp-3);
  padding: 0 var(--sp-2) 0 10px;
  border-radius: var(--r-pill);
  background: var(--section-bg); color: var(--text);
  font-size: var(--fs-caption); font-weight: 600;
}
.profile-pill .icon { width: 15px; height: 15px; }
.profile-pill .icon:first-child { color: var(--brand-ink); }
.profile-pill .icon:last-child { color: var(--hint); }

/* ── сегменты (вкладки) ── */
.segmented {
  display: flex; gap: 2px;
  padding: 2px;
  background: color-mix(in srgb, var(--ink) 8%, transparent);
  border-radius: var(--r-md);
  user-select: none; -webkit-user-select: none;
}
.segmented__item {
  flex: 1; min-height: 34px;
  border-radius: calc(var(--r-md) - 2px);
  font-size: var(--fs-subhead); font-weight: 500;
  color: var(--text);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: background var(--dur) var(--ease);
}
.segmented__item.is-active { background: var(--section-bg); font-weight: 600; }
.badge {
  min-width: 18px; padding: 0 5px; border-radius: 9px;
  font-size: var(--fs-caption2); line-height: 18px; font-weight: 700;
  background: var(--button); color: var(--button-text);
}

/* ── панель поиска и фильтров: прилипает к верху ленты ── */
.toolbar {
  position: sticky; top: 0; z-index: 3;
  padding: var(--sp-1) 0 var(--sp-3);
  background: var(--header-bg);
  border-bottom: var(--hairline) solid var(--separator);
}
.search { position: relative; margin: 0 var(--sp-4) var(--sp-3); }
.search__icon { position: absolute; left: 12px; top: 11px; color: var(--brand-ink); pointer-events: none; }
.search__input {
  width: 100%; min-height: 42px;
  padding: 0 40px 0 40px;
  border-radius: var(--r-lg); border: 0;
  background: var(--section-bg); color: var(--text);
  font-size: var(--fs-body);
  -webkit-appearance: none; appearance: none;
}
.search__input::placeholder { color: var(--hint); }
.search__input::-webkit-search-cancel-button { display: none; }
.search__input:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; }
.search__clear {
  position: absolute; right: 0; top: 0;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  color: var(--hint);
}

/* Чипы: на телефоне — лента со свайпом и затуханием у края, на компьютере — переносятся
   по строкам (колесо мыши горизонтальную ленту не листает). */
.chips {
  display: flex; gap: var(--sp-2);
  padding: 0 var(--sp-4);
  overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x proximity; scroll-padding-inline: var(--sp-4);
  scrollbar-width: none;
  -webkit-mask-image: var(--chips-mask, none); mask-image: var(--chips-mask, none);
}
.chips::-webkit-scrollbar { display: none; }
.chips.fade-r { --chips-mask: linear-gradient(to right, black calc(100% - 32px), transparent); }
.chips.fade-l { --chips-mask: linear-gradient(to right, transparent, black 32px); }
.chips.fade-l.fade-r { --chips-mask: linear-gradient(to right, transparent, black 32px, black calc(100% - 32px), transparent); }
@media (hover: hover) and (pointer: fine) {
  .chips { flex-wrap: wrap; overflow: visible; --chips-mask: none; }
}
.chip {
  flex: 0 0 auto; scroll-snap-align: start;
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 34px; padding: 0 14px;
  border-radius: var(--r-pill);
  font-size: var(--fs-subhead); font-weight: 500;
  background: var(--section-bg);
  color: var(--text);
  white-space: nowrap;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.chip[aria-pressed="true"] { background: var(--button); color: var(--button-text); font-weight: 600; }
.chip--filters, .chip--filters[aria-pressed="true"] { padding-left: 10px; background: var(--section-bg); color: var(--text); }
.chip--filters .icon { color: var(--brand-ink); }
.chip--filters .badge { margin-left: 2px; }

/* ── строка над лентой: сколько нашлось, сортировка, обновить ── */
.list-head {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4) var(--sp-2);
}
.list-head__count { flex: 1; min-width: 0; }
.list-head__count b { display: block; font-size: var(--fs-headline); font-weight: 700; line-height: var(--lh-tight); }
.list-head__count span { display: block; font-size: var(--fs-caption); color: var(--hint); }
.pill-btn {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 34px; padding: 0 12px;
  border-radius: var(--r-pill);
  background: var(--section-bg);
  font-size: var(--fs-caption); font-weight: 600; color: var(--text);
}
.pill-btn .icon { width: 16px; height: 16px; color: var(--accent); }
.icon-btn {
  width: var(--tap); height: var(--tap); flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: 50%;
  color: var(--hint);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.icon-btn:active { background: color-mix(in srgb, var(--text) 8%, transparent); }
.icon-btn[aria-pressed="true"] { color: var(--accent); }
.icon-btn[aria-pressed="true"] .icon:not(.icon--fill) { fill: color-mix(in srgb, currentColor 20%, transparent); }
.icon-btn--solid { width: 34px; height: 34px; background: var(--section-bg); color: var(--text); }

.insight {
  display: flex; gap: var(--sp-2); align-items: flex-start;
  margin: 0 var(--sp-3) var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-lg);
  background: color-mix(in srgb, var(--c-e) 16%, var(--section-bg));
  font-size: var(--fs-subhead); line-height: var(--lh-tight);
}
.insight__icon { font-size: 18px; line-height: 1; }
.hint-line { margin: 0 var(--sp-4) var(--sp-3); font-size: var(--fs-caption); color: var(--hint); }

/* ── карточка вакансии ── */
.card {
  background: var(--section-bg);
  margin: 0 var(--sp-3) var(--sp-3);
  border-radius: var(--r-xl);
  overflow: hidden;
}
[data-platform="android"] .card { margin-inline: var(--sp-2); border-radius: var(--r-lg); }

.vac { padding: var(--sp-4) var(--sp-4) var(--sp-1); }
.vac__head { display: flex; align-items: center; gap: var(--sp-3); }
.avatar {
  --av: var(--brand); --av-ink: var(--brand-ink);
  width: 40px; height: 40px; flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: 13px;
  background: color-mix(in srgb, var(--av) 18%, transparent);
  color: var(--av-ink);
  font-size: 18px; font-weight: 800;
}
.vac__company { flex: 1; min-width: 0; }
.vac__employer {
  display: flex; align-items: baseline; gap: 6px;
  font-size: var(--fs-subhead); font-weight: 600; color: var(--text);
}
.rating { flex: 0 0 auto; font-size: var(--fs-caption); font-weight: 600; color: var(--subtitle); }
.vac__sub { font-size: var(--fs-caption); color: var(--hint); }

.match {
  --p: 0; --c: var(--c-r); --t: var(--c-r-ink);
  width: 46px; height: 46px; flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), color-mix(in srgb, var(--hint) 20%, transparent) 0);
}
.match::before {
  content: ""; grid-area: 1 / 1;
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--section-bg);
}
.match > span { grid-area: 1 / 1; position: relative; font-size: 14px; font-weight: 800; color: var(--t); letter-spacing: -.02em; }
.match small { font-size: 9px; font-weight: 700; }
.match--mid { --c: var(--c-e); --t: var(--c-e-ink); }
.match--low { --c: var(--c-s); --t: var(--c-s-ink); }

.vac__title {
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  margin-top: var(--sp-3);
  text-align: left;
  font-size: var(--fs-headline); font-weight: 600; line-height: var(--lh-tight);
  color: var(--text);
}
.vac__salary { margin-top: 6px; font-size: var(--fs-headline); font-weight: 700; color: var(--text); }
.vac__salary--none { font-size: var(--fs-subhead); font-weight: 500; color: var(--hint); }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--sp-3); }
.tag {
  padding: 3px 9px; border-radius: var(--r-sm);
  font-size: var(--fs-caption); font-weight: 500;
  background: color-mix(in srgb, var(--hint) 13%, transparent);
  color: var(--text);
}
.tag--accent { background: color-mix(in srgb, var(--brand) 16%, transparent); color: var(--brand-ink); }
.tag--it { background: color-mix(in srgb, var(--c-i) 14%, transparent); color: var(--c-i-ink); }
.tag--xp { background: color-mix(in srgb, var(--c-e) 18%, transparent); color: var(--c-e-ink); }

.why { margin-top: var(--sp-2); font-size: var(--fs-subhead); }
.why summary {
  display: flex; align-items: center; gap: var(--sp-3);
  min-height: var(--tap); cursor: pointer; list-style: none;
  font-size: var(--fs-caption); font-weight: 600;
}
.why summary::-webkit-details-marker { display: none; }
.why__pro { color: var(--positive); display: inline-flex; align-items: center; gap: 4px; }
.why__con { color: var(--destructive); display: inline-flex; align-items: center; gap: 4px; }
.why__toggle { margin-left: auto; display: inline-flex; align-items: center; gap: 2px; color: var(--hint); font-weight: 500; }
.why__toggle .icon { transition: transform var(--dur) var(--ease); }
.why[open] .why__toggle .icon { transform: rotate(180deg); }
.why ul { margin: 0; padding: 0 0 var(--sp-2); list-style: none; }
.why li { position: relative; padding: 3px 0 3px 22px; line-height: var(--lh-tight); }
.why li::before { position: absolute; left: 2px; top: 3px; font-weight: 700; }
.why li.pro::before { content: "✓"; color: var(--positive); }
.why li.con::before { content: "!"; left: 6px; color: var(--destructive); }
.why__snippet { color: var(--hint); font-size: var(--fs-caption); margin: var(--sp-1) 0 var(--sp-2); }

.vac__actions {
  display: flex; align-items: center; gap: var(--sp-1);
  margin: var(--sp-1) calc(-1 * var(--sp-2)) 0 0;
  padding: var(--sp-2) 0;
  border-top: var(--hairline) solid var(--separator);
}
.vac__actions .btn { flex: 1; margin-right: var(--sp-1); white-space: nowrap; }

/* ── кнопки ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--tap); padding: 0 var(--sp-5);
  border-radius: var(--r-md);
  background: var(--button); color: var(--button-text);
  font-size: var(--fs-subhead); font-weight: 600;
  transition: opacity var(--dur) var(--ease);
}
.btn:active { opacity: .8; }
.btn .icon { width: 16px; height: 16px; }
.btn--tinted { background: color-mix(in srgb, var(--button) 13%, transparent); color: var(--accent); padding: 0 var(--sp-3); }
.btn--block { width: 100%; }
.btn--plain { background: transparent; color: var(--link); font-weight: 500; }
.link-btn { color: var(--link); font: inherit; }
@media (hover: hover) {
  .chip:hover, .pill-btn:hover { background: color-mix(in srgb, var(--text) 8%, var(--section-bg)); }
  .chip[aria-pressed="true"]:hover { background: color-mix(in srgb, var(--button) 22%, transparent); }
  .icon-btn:hover { background: color-mix(in srgb, var(--text) 6%, transparent); }
  .btn--tinted:hover { background: color-mix(in srgb, var(--button) 20%, transparent); }
  .vac__title:hover { color: var(--accent); }
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Premium ── */
.premium {
  position: relative;
  padding: var(--sp-5) var(--sp-4) var(--sp-4);
  text-align: center;
  background: color-mix(in srgb, var(--brand-2) 14%, var(--section-bg));
}
.premium > * { position: relative; }
.premium > .premium__art { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; pointer-events: none; }
.premium__icon { font-size: 40px; line-height: 1; }
.premium__title { margin-top: var(--sp-2); font-size: var(--fs-title); font-weight: 700; line-height: var(--lh-tight); }
.premium__text { margin: var(--sp-2) 0 var(--sp-4); font-size: var(--fs-subhead); color: var(--subtitle); }
.plans { display: grid; gap: var(--sp-2); }
.plan {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 52px; padding: 0 var(--sp-4);
  border-radius: var(--r-md);
  background: var(--section-bg);
  font-size: var(--fs-body); font-weight: 600; color: var(--text);
}
.plan b { color: var(--accent); }
.premium__hint { margin-top: var(--sp-3); font-size: var(--fs-caption); color: var(--hint); }
.more-weak { display: block; margin: 0 var(--sp-3) var(--sp-3); width: calc(100% - 2 * var(--sp-3)); }

/* ── пустые состояния и ошибки ── */
.empty { padding: var(--sp-6) var(--sp-5) var(--sp-5); text-align: center; }
.empty__art {
  position: relative; width: 96px; height: 96px; margin: 0 auto;
  display: grid; place-items: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--brand) 16%, transparent);
  font-size: 46px; line-height: 1;
}
.empty__art::before, .empty__art::after { content: ""; position: absolute; border-radius: 50%; }
.empty__art::before { width: 22px; height: 22px; right: -6px; top: 4px; background: var(--brand-2); }
.empty__art::after { width: 12px; height: 12px; left: 2px; bottom: 6px; background: var(--c-e); }
.empty__title { margin: var(--sp-3) 0 var(--sp-1); font-size: var(--fs-headline); font-weight: 600; color: var(--text); }
.empty__text { margin: 0 0 var(--sp-4); font-size: var(--fs-subhead); color: var(--hint); }
.page { padding-top: var(--sp-3); }

/* ── скелетон по форме карточки ── */
.sk {
  display: block; height: 12px; margin-top: 8px;
  border-radius: var(--r-sm);
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--hint) 14%, transparent) 25%,
    color-mix(in srgb, var(--hint) 24%, transparent) 37%,
    color-mix(in srgb, var(--hint) 14%, transparent) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
}
.sk--avatar { width: 40px; height: 40px; margin: 0; border-radius: 12px; flex: 0 0 auto; }
.sk--ring { width: 46px; height: 46px; margin: 0; border-radius: 50%; flex: 0 0 auto; }
.sk--title { height: 18px; margin-top: var(--sp-4); width: 85%; }
.sk--tag { display: inline-block; width: 72px; height: 22px; margin: var(--sp-3) 6px var(--sp-3) 0; }
.status-line { margin: 0 var(--sp-4) var(--sp-3); font-size: var(--fs-caption); color: var(--hint); }
@keyframes shimmer { from { background-position: 100% 50%; } to { background-position: 0 50%; } }

/* ── сравнение ── */
.cmp-wrap { overflow-x: auto; }
.cmp { border-collapse: separate; border-spacing: 0; min-width: 100%; font-size: var(--fs-subhead); }
.cmp th, .cmp td {
  padding: var(--sp-3);
  vertical-align: top; text-align: left;
  border-bottom: var(--hairline) solid var(--separator);
  background: var(--section-bg);
  min-width: 168px; max-width: 220px;
}
.cmp tr:last-child th, .cmp tr:last-child td { border-bottom: 0; }
.cmp thead th { font-weight: 600; }
.cmp thead .vac__title { margin-top: 0; font-size: var(--fs-subhead); }
.cmp tbody th {
  position: sticky; left: 0; z-index: 1;
  min-width: 112px; max-width: 124px;
  color: var(--hint); font-weight: 500; font-size: var(--fs-caption);
  border-right: var(--hairline) solid var(--separator);
}
.cmp thead th:first-child { position: sticky; left: 0; z-index: 2; min-width: 112px; }
.cmp ul { margin: 0; padding: 0; list-style: none; }
.cmp li + li { margin-top: 4px; }
.best {
  display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: var(--r-sm);
  font-size: var(--fs-caption2); font-weight: 700; line-height: 18px;
  background: color-mix(in srgb, var(--button) 16%, transparent); color: var(--accent);
}
.cmp__remove { margin-top: var(--sp-1); font-size: var(--fs-caption); }

/* ── нижняя панель (только вне Telegram, где нет MainButton) ── */
.app-bar .btn { width: 100%; }

/* ── шторки: фильтры, сортировка, действия ── */
.sheet-scrim {
  position: fixed; inset: 0; z-index: 10;
  background: color-mix(in srgb, black 40%, transparent);
  animation: fade var(--dur) var(--ease);
}
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 11;
  max-height: 88%;
  padding: var(--sp-2) 0 max(var(--sp-4), var(--pad-bottom));
  background: var(--bg-secondary);
  border-radius: var(--r-2xl) var(--r-2xl) 0 0;
  overflow-y: auto; overscroll-behavior: contain;
  animation: sheet-in 260ms var(--ease);
}
[data-platform="tdesktop"] .sheet, [data-platform="macos"] .sheet, [data-platform="web"] .sheet,
[data-platform="weba"] .sheet, [data-platform="unknown"] .sheet { max-width: 560px; margin-inline: auto; }
.sheet__handle {
  width: 36px; height: 5px; margin: 0 auto var(--sp-3);
  border-radius: 3px; background: color-mix(in srgb, var(--hint) 45%, transparent);
  display: none;
}
[data-platform="ios"] .sheet__handle, [data-platform="unknown"] .sheet__handle { display: block; }
.sheet__head { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-1) var(--sp-4) var(--sp-3); }
.sheet__title {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  font-size: var(--fs-title); font-weight: 700; line-height: var(--lh-tight);
}
.sheet__subtitle { font-size: var(--fs-caption); color: var(--hint); margin-top: 2px; }
.sheet .card { margin-bottom: 0; }
.sheet__footer { padding: var(--sp-4) var(--sp-4) 0; display: grid; gap: var(--sp-1); }

.section-header {
  padding: var(--sp-5) var(--sp-4) var(--sp-2);
  margin-inline: var(--sp-3);
  font-size: var(--fs-caption);
  color: var(--section-header-text);
  text-transform: uppercase; letter-spacing: .04em;
}
.sheet__head + .section-header { padding-top: 0; }
[data-platform="android"] .section-header { text-transform: none; color: var(--accent); font-weight: 600; }
.section-footer {
  padding: var(--sp-2) var(--sp-4) 0; margin-inline: var(--sp-3);
  font-size: var(--fs-caption); color: var(--hint);
}

.cell {
  display: flex; align-items: center; gap: var(--sp-3);
  width: 100%; min-height: var(--tap);
  padding: 10px var(--sp-4);
  text-align: left; position: relative;
  transition: background var(--dur) var(--ease);
}
.cell + .cell::before {
  content: ""; position: absolute; inset: 0 0 auto var(--sp-4);
  border-top: var(--hairline) solid var(--separator);
}
.cell--icon + .cell--icon::before { left: calc(var(--sp-4) + 28px + var(--sp-3)); }
button.cell:active, label.cell:active { background: color-mix(in srgb, var(--text) 6%, transparent); }
@media (hover: hover) { button.cell:hover { background: color-mix(in srgb, var(--text) 4%, transparent); } }
.cell__icon { width: 28px; height: 28px; flex: 0 0 auto; display: grid; place-items: center; color: var(--accent); }
.cell__body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cell__title { flex: 1; min-width: 0; font-size: var(--fs-body); }
.cell__subtitle { font-size: var(--fs-caption); color: var(--hint); }
.cell__check { color: var(--accent); }
.cell--destructive .cell__title, .cell--destructive .cell__icon { color: var(--destructive); }
.cell__input {
  flex: 1 1 auto; min-width: 0;
  border: 0; background: transparent;
  font-size: var(--fs-body); color: var(--text);
}
.cell__input::placeholder { color: var(--hint); }
.cell__input:focus { outline: none; }
.switch {
  appearance: none; -webkit-appearance: none;
  width: 51px; height: 31px; flex: 0 0 auto; margin: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--hint) 40%, transparent);
  position: relative; cursor: pointer;
  transition: background var(--dur) var(--ease);
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 27px; height: 27px; border-radius: 50%;
  background: var(--knob);
  box-shadow: 0 1px 3px color-mix(in srgb, black 25%, transparent);
  transition: transform var(--dur) var(--ease);
}
.switch:checked { background: var(--button); }
.switch:checked::after { transform: translateX(20px); }

/* ── тост ── */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--sp-5) + var(--pad-bottom)); z-index: 20;
  transform: translateX(-50%);
  width: max-content; max-width: calc(100% - 2 * var(--sp-4));
  padding: 10px var(--sp-4);
  border-radius: var(--r-lg);
  background: color-mix(in srgb, var(--text) 88%, transparent); color: var(--bg);
  font-size: var(--fs-subhead); line-height: var(--lh-tight);
  animation: toast-in var(--dur) var(--ease);
}

@keyframes sheet-in { from { transform: translateY(100%); } to { transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
