/* Shared Stitch surfaces; data, authentication and route contracts stay server-owned. */
body.site-telegram.stitch-surface {
  --bg: #f7f9ff; --surface: #fff; --surface-2: #edf4ff;
  --fg: #121c26; --fg-muted: #414751; --border: #e2e8f0; --border-strong: #c0c7d2;
  --control-border: #717882; --tg-primary: #1f78c1; --tg-hover: #1965a3;
  --tg-link: #005f9f; --tg-soft: #edf4ff; --catalog-shadow: none;
  font-family: var(--font); font-variant-numeric: tabular-nums;
}
:root[data-theme="dark"] body.site-telegram.stitch-surface {
  --bg: #101923; --surface: #182430; --surface-2: #213244;
  --fg: #f2f6fc; --fg-muted: #b7c5d6; --border: #314256; --border-strong: #60758c;
  --control-border: #8da0b7; --tg-primary: #176fae; --tg-hover: #0d609c;
  --tg-link: #9ecaff; --tg-soft: #213244;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body.site-telegram.stitch-surface {
    --bg: #101923; --surface: #182430; --surface-2: #213244;
    --fg: #f2f6fc; --fg-muted: #b7c5d6; --border: #314256; --border-strong: #60758c;
    --control-border: #8da0b7; --tg-primary: #176fae; --tg-hover: #0d609c;
    --tg-link: #9ecaff; --tg-soft: #213244;
  }
}
.stitch-surface .shell { max-width: 1360px; padding-inline: 40px; }
.stitch-surface :is(.btn-primary, .btn-secondary, .listing-action, .field input, .field select, .field textarea) { border-radius: 8px; }
.stitch-surface :is(button, input, select) { min-height: 44px; }
.stitch-surface :focus-visible { outline: 2px solid var(--tg-link); outline-offset: 3px; }
.site-telegram.stitch-surface a.tg-link { background: var(--tg-primary); color: var(--tg-on-primary, #fff); }
.site-telegram.stitch-car #main { max-width: 1040px; }
.stitch-car .listing-context { gap: 10px; padding: 20px 0; }
.stitch-car .listing-meta { font-size: 12px; }
.site-telegram.stitch-car .detail { display: block; }
.site-telegram.stitch-car .detail-main { padding: 28px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
.stitch-car .detail-head { display: flex; align-items: start; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.stitch-car .detail-head h1 { flex: 1 1 420px; font: 700 28px/1.3 var(--font); }
.stitch-car .detail-price { flex: 0 1 auto; display: flex; flex-wrap: wrap; gap: 8px; }
.stitch-car .detail-price .price { font: 700 30px/1.25 var(--font); }
.site-telegram.stitch-car .listing-actions { gap: 8px; }
.site-telegram.stitch-car .listing-actions .listing-action { background: var(--surface-2); border-color: var(--border); font-size: 14px; }
.site-telegram.stitch-car .listing-actions .write-btn { color: var(--tg-link); }
.site-telegram.stitch-car .listing-media .detail-media { aspect-ratio: 4/3; max-height: 520px; border-radius: 12px; background: var(--surface-2); }
.site-telegram.stitch-car .listing-media .listing-photo { object-fit: contain; }
.stitch-car .detail-gallery { display: flex; gap: 8px; padding: 10px 0; }
.stitch-car .detail-gallery a { width: 86px; flex: 0 0 86px; height: 64px; border-radius: 8px; }
.stitch-car .detail-gallery a, .site-telegram #quick-view .detail-gallery a { opacity: 1; }
.stitch-car .video-thumb, .site-telegram #quick-view .video-thumb { color: var(--fg); background: var(--surface-2); }
.stitch-car .video-thumb small, .site-telegram #quick-view .video-thumb small { color: var(--fg-muted); opacity: 1; }
.stitch-car .section-title { font: 600 18px/1.4 var(--font); margin: 26px 0 12px; }
.site-telegram.stitch-car .specs { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.site-telegram.stitch-car .specs > div { display: flex; flex-direction: column; gap: 6px; padding: 14px; border: 0; border-radius: 12px; background: var(--surface-2); }
.stitch-car .specs dt { color: var(--fg-muted); font-size: 12px; }
.stitch-car .specs dd { margin: 0; font-size: 15px; font-weight: 600; }
.stitch-car .source-card.stitch-source-card { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; background: var(--surface-2); border: 0; padding: 18px; margin: 18px 0; }
.stitch-source-identity { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; min-width: 0; }
.stitch-source-profile { display: flex; align-items: center; gap: 12px; min-width: 0; text-decoration: none; }
.stitch-source-profile .avatar { width: 48px; height: 48px; flex: 0 0 48px; }
.stitch-source-profile > span:not(.avatar) { min-width: 0; }
.stitch-source-profile :is(small, strong, span > span) { display: block; overflow-wrap: anywhere; }
.stitch-source-profile small { font-size: 11px; color: var(--fg-muted); }
.stitch-source-profile strong { font-size: 15px; color: var(--fg); }
.stitch-source-profile span > span { font-size: 12px; }
.stitch-source-links { display: flex; flex-wrap: wrap; gap: 8px; }
.stitch-source-card .field-hint { flex-basis: 100%; margin: 0; font-size: 12px; }
.stitch-car .message { padding: 18px; background: var(--surface-2); border: 0; }
.stitch-car .message-body { padding-inline: 0; font-size: 16px; line-height: 1.65; }
.stitch-car .message-head { padding: 0 0 12px; }
.stitch-media-empty { padding: 40px 20px; border-radius: 12px; background: var(--surface-2); text-align: center; color: var(--fg-muted); }
.stitch-media-empty h2 { font-size: 18px; }
/* A centred card shares the standalone page's gallery and facts, not a second data model. */
.site-telegram #quick-view.quick-view-dialog {
  inset: 0; width: min(960px, calc(100vw - 32px)); max-width: calc(100vw - 32px);
  height: auto; max-height: 92dvh; margin: auto; padding: 0; border-radius: 16px;
  border: 1px solid var(--border); box-shadow: 0 16px 48px rgb(0 0 0 / 20%);
}
.site-telegram #quick-view .flyout-body { padding: 24px; gap: 20px; }
.site-telegram #quick-view .flyout-media { padding: 0; }
.site-telegram #quick-view .flyout-media .detail-media { aspect-ratio: 4/3; max-height: 460px; background: var(--surface-2); }
.site-telegram #quick-view .flyout-title h2 { font: 700 26px/1.3 var(--font); }
.site-telegram #quick-view .flyout-title .price { font: 700 30px/1.2 var(--font); }
.site-telegram #quick-view .flyout-specs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 0; gap: 10px; overflow: visible; }
.site-telegram #quick-view .flyout-specs > div { display: flex; flex-direction: column; align-items: start; border: 0; border-radius: 10px; padding: 12px; background: var(--surface-2); }
.site-telegram #quick-view .flyout-specs dt { font-size: 12px; }
.site-telegram #quick-view .flyout-specs dd { text-align: left; font-size: 14px; }
.site-telegram #quick-view .flyout-operations { gap: 8px; }
.site-telegram #quick-view .flyout-operations :is(a, button, label) { border-radius: 8px; }
.site-telegram #quick-view .flyout-planned { display: none; }
.site-telegram #quick-view .flyout-source-box { border: 0; background: var(--surface-2); }
/* Seven real workspace routes share the reference's dashboard navigation. */
.site-telegram.stitch-workspace #main { max-width: 1360px; padding-inline: 40px; }
.stitch-workspace .telegram-workspace-layout { grid-template-columns: 220px minmax(0, 1fr); gap: 32px; padding: 28px 0 48px; }
.stitch-workspace .telegram-workspace-side { position: sticky; top: 92px; }
.stitch-workspace .workspace-navigation { padding: 12px 8px; border: 0; border-radius: 12px; background: var(--surface); }
.stitch-nav-heading { margin: 0 12px 10px; color: var(--fg-muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.stitch-workspace .workspace-navigation a { min-height: 48px; padding: 12px; border-radius: 8px; }
.stitch-workspace .workspace-navigation a[aria-current="page"] { background: var(--surface-2); color: var(--tg-link); }
.stitch-workspace .telegram-side-note { padding: 16px; background: var(--surface); font-size: 12px; }
.stitch-workspace-help { display: flex; flex-direction: column; gap: 12px; padding: 12px 8px; font-size: 13px; }
.stitch-workspace-help form { margin: 0; }
.stitch-workspace-help button { width: 100%; text-align: left; color: var(--danger); }
.stitch-workspace .telegram-page-heading .eyebrow { font-size: 12px; font-weight: 600; }
.stitch-workspace .telegram-page-heading h1 { font-size: 28px; line-height: 1.25; }
.stitch-workspace .telegram-workspace-content { gap: 24px; }
.stitch-workspace .telegram-stats { gap: 16px; }
.stitch-workspace .telegram-stat { border: 1px solid var(--border); border-radius: 16px; padding: 18px; }
.stitch-workspace .telegram-stat > span { min-height: 36px; font-size: 12px; }
.stitch-workspace .telegram-stat strong { font-size: 30px; }
.stitch-workspace .telegram-stat small { font-size: 12px; }
.stitch-workspace .account-panel { padding: 20px; border: 1px solid var(--border); border-radius: 16px; box-shadow: none; }
.stitch-workspace .account-panel h2 { font-size: 20px; }
.stitch-workspace .telegram-panel-actions { gap: 8px; }
.stitch-inventory-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.stitch-inventory-toolbar > a { font-size: 13px; }
.stitch-workspace .telegram-status-tabs { border-radius: 8px; background: var(--surface-2); flex-wrap: wrap; }
.stitch-workspace .telegram-status-tabs a { border-radius: 6px; }
.stitch-inventory-head { display: grid; grid-template-columns: 64px minmax(130px, 1.3fr) minmax(120px, 1fr) 110px 120px; gap: 14px; padding: 14px 0; background: var(--surface-2); border-radius: 8px; font-size: 11px; color: var(--fg-muted); text-transform: uppercase; }
.stitch-inventory-head > span:first-child { grid-column: 1/3; padding-left: 8px; }
.stitch-inventory-head > span:nth-child(2) { grid-column: 3; }
.stitch-inventory-head > span:nth-child(3) { grid-column: 4; }
.stitch-inventory-head > span:nth-child(4) { grid-column: 5; }
.stitch-inventory-head > span:nth-child(5) { display: none; }
.stitch-workspace .telegram-listing-row { display: grid; grid-template-columns: 64px minmax(130px, 1.3fr) minmax(120px, 1fr) 110px 120px; gap: 10px 14px; align-items: center; padding: 18px 0; }
.stitch-workspace .telegram-listing-image { grid-column: 1; grid-row: 1; width: 64px; height: 52px; border-radius: 8px; }
.stitch-workspace .telegram-listing-main { grid-column: 2; grid-row: 1; }
.stitch-workspace .telegram-listing-main h3 { font-size: 15px; line-height: 1.4; }
.stitch-workspace .telegram-listing-main p { font-size: 11px; margin: 4px 0 0; }
.stitch-row-vin { display: block; overflow-wrap: anywhere; }
.stitch-listing-facts { grid-column: 3; grid-row: 1; display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--fg-muted); }
.stitch-listing-facts small { font-size: 11px; }
.stitch-workspace .telegram-listing-row > .status { grid-column: 4; grid-row: 1; font-size: 11px; white-space: normal; }
.stitch-workspace .telegram-listing-price { grid-column: 5; grid-row: 1; font-size: 18px; color: var(--fg); overflow-wrap: anywhere; }
.stitch-row-source { grid-column: 2/4; grid-row: 2; display: flex; align-items: center; gap: 8px; font-size: 11px; min-width: 0; text-decoration: none; }
.stitch-row-source .avatar { flex: 0 0 26px; width: 26px; height: 26px; }
.stitch-row-source > span:not(.avatar) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stitch-workspace .telegram-listing-views { grid-column: 4; grid-row: 2; font-size: 11px; }
.stitch-workspace .telegram-listing-row > :is(form, .btn-secondary) { grid-column: 5; grid-row: 2; margin: 0; }
.stitch-workspace .telegram-listing-row > form button { width: 100%; }
.stitch-workspace .personal-chart { background: var(--surface); }
.stitch-workspace .personal-chart svg rect { fill: var(--tg-primary); }
.stitch-workspace .analytics-range { gap: 12px; }
.stitch-workspace .telegram-favorite-card { border-radius: 12px; }
/* Centred authentication card: real Telegram challenge, existing password path,
   and honestly unavailable mail-dependent registration/recovery. */
.site-telegram.stitch-auth .telegram-auth-layout { display: flex; flex-direction: column; max-width: 620px; margin: 0 auto; padding: 32px 0 48px; gap: 24px; }
.stitch-auth-heading { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; }
.stitch-auth-mark { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 12px; background: var(--tg-primary); overflow: hidden; }
.stitch-auth-mark img { width: 100%; height: 100%; object-fit: cover; }
.stitch-auth-heading .pill { background: var(--surface-2); color: var(--tg-link); font-size: 12px; margin: 0; }
.stitch-auth-heading h1 { font: 700 28px/1.3 var(--font); margin: 0; }
.stitch-auth-heading > p:not(.pill) { font-size: 14px; line-height: 1.5; color: var(--fg-muted); max-width: 52ch; margin: 0; }
.site-telegram.stitch-auth .telegram-auth-card { max-width: none; width: 100%; padding: 28px; border: 1px solid var(--border); border-radius: 16px; box-shadow: none; }
.stitch-auth-method-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 20px 0 12px; font-size: 12px; color: var(--tg-link); }
.stitch-auth .telegram-login-primary { min-height: 48px; border-radius: 8px; }
.stitch-auth .telegram-auth-or { margin: 24px 0; }
.stitch-auth .field-hint { font-size: 13px; line-height: 1.55; }
.stitch-auth-instructions > summary { min-height: 44px; cursor: pointer; font-size: 13px; align-content: center; color: var(--tg-link); }
.stitch-auth .telegram-auth-steps { font-size: 13px; padding-left: 20px; }
.stitch-auth .telegram-email-heading { display: flex; flex-wrap: wrap; gap: 10px; font-size: 14px; }
.stitch-auth .telegram-soon { font-size: 11px; background: var(--surface-2); color: var(--fg-muted); border-radius: 6px; }
.stitch-auth #email-entry > summary { min-height: 44px; padding: 12px 0; font-size: 14px; }
.stitch-auth .auth-fields { display: grid; gap: 16px; margin: 12px 0; }
.stitch-auth .auth-fields .field :is(input, select) { background: var(--surface-2); border-color: var(--control-border); }
.stitch-auth .auth-fields:disabled { opacity: .7; }
.stitch-auth .auth-fields:disabled :is(input, button) { cursor: not-allowed; }
.stitch-auth .telegram-auth-footer { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); font-size: 12px; }
.site-telegram.stitch-auth .telegram-auth-benefits { position: static; padding: 0; border: 0; background: none; width: 100%; }
.stitch-auth .telegram-auth-benefits h2 { font-size: 18px; text-align: center; margin: 0 0 16px; }
.stitch-auth .telegram-auth-benefits ul { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.stitch-auth .telegram-auth-benefits li { display: flex; flex-direction: column; align-items: start; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; gap: 12px; }
.stitch-auth .telegram-auth-benefits li b { font-size: 13px; }
.stitch-auth .telegram-auth-benefits li p { font-size: 12px; line-height: 1.55; }
.stitch-auth .telegram-benefit-icon { width: 32px; height: 32px; border-radius: 8px; background: var(--surface-2); color: var(--tg-link); }
.stitch-auth .telegram-waiting { padding: 16px; background: var(--surface-2); border-radius: 8px; color: var(--tg-link); }
@media (prefers-reduced-motion: no-preference) {
  .site-telegram #quick-view[data-pointer-open] {
    transition: opacity 200ms var(--ease-overlay), transform 200ms var(--ease-overlay);
    @starting-style { opacity: 0; transform: translateY(8px) scale(.97); }
  }
}
@media (max-width: 1180px) {
  .stitch-inventory-head { display: none; }
  .stitch-workspace .telegram-listing-row { grid-template-columns: 64px minmax(0, 1fr) 120px; }
  .stitch-workspace .telegram-listing-main { grid-column: 2; }
  .stitch-workspace .telegram-listing-price { grid-column: 3; }
  .stitch-listing-facts { grid-column: 2; grid-row: 2; }
  .stitch-workspace .telegram-listing-row > .status { grid-column: 3; grid-row: 2; }
  .stitch-row-source { grid-column: 2; grid-row: 3; }
  .stitch-workspace .telegram-listing-views { grid-column: 3; grid-row: 3; }
  .stitch-workspace .telegram-listing-row > :is(form, .btn-secondary) { grid-column: 2/4; grid-row: 4; justify-self: end; }
}
@media (max-width: 1000px) {
  .site-telegram.stitch-workspace #main { padding-inline: 24px; }
  .stitch-workspace .telegram-workspace-layout { grid-template-columns: minmax(0, 1fr); padding-top: 20px; }
  .stitch-workspace .telegram-workspace-side { position: static; }
  .stitch-workspace .workspace-navigation { display: flex; flex-direction: row; flex-wrap: wrap; }
  .stitch-workspace .workspace-navigation a { flex: 1 1 180px; }
  .stitch-workspace .workspace-navigation .stitch-nav-heading { flex-basis: 100%; }
  .stitch-workspace .telegram-side-note, .stitch-workspace-help { display: none; }
}
@media (max-width: 1000px) {
  .stitch-surface .shell { padding-inline: 24px; }
  .site-telegram.stitch-car .specs, .site-telegram #quick-view .flyout-specs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .stitch-surface .shell { padding-inline: 16px; }
  .site-telegram.stitch-car .detail-main { padding: 16px; }
  .stitch-car .detail-head { gap: 0; }
  .stitch-car .detail-head h1 { font-size: 24px; }
  .stitch-car .stitch-source-links { width: 100%; }
  .stitch-car .stitch-source-links > a { flex: 1 1 100%; text-align: center; }
  .site-telegram #quick-view.quick-view-dialog { width: 100vw; max-width: 100vw; max-height: 100dvh; height: 100dvh; border: 0; border-radius: 0; }
  .site-telegram #quick-view .flyout-body { padding: 16px; }
  .site-telegram #quick-view .flyout-title h2 { font-size: 23px; }
  .site-telegram.stitch-workspace #main { padding-inline: 16px; }
  .stitch-workspace .workspace-navigation a { flex: 1 1 125px; font-size: 13px; }
  .stitch-workspace .account-panel { padding: 16px; }
  .stitch-workspace .telegram-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stitch-workspace .telegram-stat { padding: 14px; }
  .stitch-workspace .telegram-listing-row { grid-template-columns: 56px minmax(0, 1fr); }
  .stitch-workspace .telegram-listing-image { width: 56px; height: 48px; }
  .stitch-workspace .telegram-listing-main { grid-column: 2; grid-row: 1; }
  .stitch-workspace .telegram-listing-price { grid-column: 2; grid-row: 2; }
  .stitch-listing-facts { grid-column: 1/3; grid-row: 3; }
  .stitch-workspace .telegram-listing-row > .status { grid-column: 1/3; grid-row: 4; justify-self: start; }
  .stitch-row-source { grid-column: 1/3; grid-row: 5; }
  .stitch-workspace .telegram-listing-views { grid-column: 1/3; grid-row: 6; }
  .stitch-workspace .telegram-listing-row > :is(form, .btn-secondary) { grid-column: 1/3; grid-row: 7; justify-self: start; }
  .site-telegram.stitch-auth .telegram-auth-layout { padding-top: 24px; }
  .stitch-auth-heading h1 { font-size: 24px; }
  .site-telegram.stitch-auth .telegram-auth-card { padding: 20px 16px; }
  .stitch-auth .telegram-auth-benefits ul { grid-template-columns: minmax(0, 1fr); }
  .stitch-auth .telegram-auth-benefits li { flex-direction: row; }
}
