/* Pedant PRO uses Instrument Sans for its interface. Keep the files local so
   the web client has the same typography without a third-party request. */
@font-face {
  font-family: "Instrument Sans";
  src: url("/assets/fonts/instrument-sans-latin-400.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Instrument Sans";
  src: url("/assets/fonts/instrument-sans-latin-500.woff2") format("woff2");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: "Instrument Sans";
  src: url("/assets/fonts/instrument-sans-latin-600.woff2") format("woff2");
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}

:root {
  --ink: #252525;
  --ink-soft: #454545;
  --muted: #777773;
  --muted-light: #9a9a95;
  --canvas: #f7f7f5;
  --paper: #ffffff;
  --line: #e4e4df;
  --line-dark: #cecec7;
  --blue: #1768c6;
  --blue-dark: #1256a5;
  --blue-wash: #edf5ff;
  --yellow: #f4c638;
  --yellow-hover: #eaba26;
  --green: #28805a;
  --orange: #bd7611;
  --violet: #7257bf;
  --slate: #687178;
  --radius: 10px;
  --mobile-header-h: 72px;
  --mobile-nav-h: 68px;
  --visual-viewport-height: 100dvh;
  color: var(--ink);
  background: var(--canvas);
  /* The same UI stack as Pedant PRO; system fonts cover Cyrillic glyphs. */
  --font-sans: "Instrument Sans", ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  font-family: var(--font-sans);
  font-synthesis: none;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--canvas); }

body { min-width: 320px; min-height: 100vh; margin: 0; background: var(--canvas); }

button,
input,
textarea,
select { font: inherit; }

button { cursor: pointer; }

button,
a,
input,
select,
textarea { -webkit-tap-highlight-color: transparent; }

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(23, 104, 198, .24);
  outline-offset: 2px;
}

.icon { display: inline-block; flex: 0 0 auto; width: 18px; height: 18px; vertical-align: middle; }

.in-app-notification {
  position: fixed;
  z-index: 200;
  top: max(14px, calc(env(safe-area-inset-top) + 10px));
  left: 50%;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: min(calc(100vw - 28px), 440px);
  border: 1px solid #bfdbfe;
  border-radius: 16px;
  padding: 12px 14px;
  color: #1e3a8a;
  background: rgba(239, 246, 255, .98);
  box-shadow: 0 16px 42px rgba(15, 23, 42, .18);
  font: inherit;
  text-align: left;
  cursor: pointer;
  opacity: 0;
  transform: translate(-50%, -18px);
  transition: opacity .18s ease, transform .18s ease;
  backdrop-filter: blur(12px);
}

.in-app-notification.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.in-app-notification-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #4f46e5);
}

.in-app-notification-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.in-app-notification-copy strong {
  color: #1e3a8a;
  font-size: 13px;
}

.in-app-notification-copy small {
  overflow: hidden;
  color: #5f7892;
  font-size: 10px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.in-app-notification-copy > span {
  display: -webkit-box;
  overflow: hidden;
  color: #334155;
  font-size: 12px;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-header {
  position: sticky;
  z-index: 10;
  top: 0;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(10px);
}

.header-inner {
  display: flex;
  align-items: center;
  width: min(1200px, calc(100% - 40px));
  min-height: 72px;
  margin: 0 auto;
  gap: 34px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}

.brand-symbol {
  display: grid;
  place-items: center;
  width: 33px;
  height: 33px;
  border-radius: 9px;
  color: var(--blue);
  background: var(--blue-wash);
}

.brand-symbol .icon { width: 20px; height: 20px; }

.brand-copy strong,
.brand-copy small { display: block; }

.brand-copy strong { font-size: 14px; font-weight: 760; letter-spacing: -.015em; }

.brand-copy small { margin-top: 1px; color: var(--muted); font-size: 11px; }

.user-nav { display: flex; align-self: stretch; gap: 24px; }

.header-nav {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  padding: 0;
  color: var(--muted);
  background: transparent;
  font-size: 14px;
  font-weight: 640;
}

.header-nav::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 2px;
  background: transparent;
  content: "";
}

.header-nav:hover,
.header-nav.is-active { color: var(--ink); }

.header-nav.is-active::after { background: var(--blue); }

.header-nav span {
  min-width: 19px;
  padding: 1px 5px;
  border-radius: 10px;
  color: var(--blue-dark);
  background: var(--blue-wash);
  text-align: center;
  font-size: 11px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-left: auto;
}

.mobile-bottom-nav { display: none; }

.header-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 620;
  text-decoration: none;
}

.header-link:hover { color: var(--blue-dark); }

.header-link .icon { width: 15px; height: 15px; }

.primary-button,
.secondary-button,
.quiet-action,
.back-button,
.text-button,
.details-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 720;
  line-height: 1;
  text-decoration: none;
  transition: background-color .16s ease, color .16s ease, border-color .16s ease;
}

.primary-button {
  min-height: 42px;
  border: 1px solid var(--yellow);
  padding: 0 15px;
  color: #252525;
  background: var(--yellow);
}

.primary-button:hover { border-color: var(--yellow-hover); background: var(--yellow-hover); }

.primary-button .icon { width: 16px; height: 16px; }
.primary-button.external-action { text-decoration: none; }

.secondary-button {
  min-height: 40px;
  border: 1px solid var(--line-dark);
  padding: 0 14px;
  color: var(--ink);
  background: var(--paper);
}

.secondary-button:hover { border-color: var(--blue); color: var(--blue-dark); background: var(--blue-wash); }

.quiet-action {
  border: 0;
  padding: 7px 0;
  color: var(--blue-dark);
  background: transparent;
}

.quiet-action:hover { color: var(--ink); }

.quiet-action .icon { width: 16px; height: 16px; }

.app-main {
  width: min(1100px, calc(100% - 40px));
  min-height: calc(100vh - 73px);
  margin: 0 auto;
  padding: 46px 0 64px;
}

/* User flow is intentionally compact: the topic choice is visible sooner. */
body[data-role="user"] .header-inner {
  min-height: 60px;
  gap: 24px;
}

body[data-role="user"] .brand-symbol {
  width: 29px;
  height: 29px;
  border-radius: 8px;
}

body[data-role="user"] .brand-symbol .icon { width: 18px; height: 18px; }

body[data-role="user"] .app-main {
  min-height: calc(100vh - 61px);
  padding-top: 24px;
}

body[data-role="user"] .header-cta,
body[data-role="user"] .user-hero .quiet-action,
body[data-role="user"] .page-title-row > .primary-button { display: none; }

.eyebrow {
  margin: 0 0 9px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p { overflow-wrap: anywhere; }

h1,
h2,
h3 {
  margin: 0;
  color: var(--ink);
  font-weight: 600;
  letter-spacing: -.03em;
}

h1 { font-size: clamp(26px, 3vw, 34px); line-height: 1.12; }

h2 { font-size: 21px; line-height: 1.2; }

h3 { font-size: 16px; }

.user-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  padding: 8px 0 38px;
  border-bottom: 1px solid var(--line);
}

body[data-role="user"] .user-hero {
  gap: 20px;
  padding: 0 0 20px;
}

.user-hero h1 { max-width: 630px; }

.user-hero p:not(.eyebrow) {
  max-width: 620px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.62;
}

body[data-role="user"] .user-hero p:not(.eyebrow) {
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.5;
}

.topic-section { padding-top: 32px; }

body[data-role="user"] .topic-section { padding-top: 18px; }

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}

body[data-role="user"] .section-heading { margin-bottom: 12px; }

.section-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.topic-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.topic-card {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 12px;
  min-height: 104px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px;
  color: var(--ink);
  background: var(--paper);
  text-align: left;
  transition: border-color .16s ease, background-color .16s ease;
}

.topic-card:hover { border-color: #a8c6e8; background: #fbfdff; }

.topic-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  color: var(--blue);
  background: var(--blue-wash);
}

.topic-icon .icon { width: 19px; height: 19px; }

.topic-copy { min-width: 0; }

.topic-copy strong,
.topic-copy small { display: block; }

.topic-copy strong { font-size: 14px; line-height: 1.32; }

.topic-copy small {
  display: -webkit-box;
  margin-top: 5px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.42;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.topic-arrow { color: var(--muted-light); }

.topic-arrow .icon { width: 16px; height: 16px; }

.topic-card-tickets { border-style: dashed; background: transparent; }

.knowledge-page,
.form-page,
.thread-page { width: min(850px, 100%); margin: 0 auto; }

.back-button {
  min-height: 32px;
  border: 0;
  padding: 0;
  color: var(--blue-dark);
  background: transparent;
}

.back-button:hover { color: var(--ink); }

.back-button .icon { width: 17px; height: 17px; }

.breadcrumbs {
  margin: 20px 0 14px;
  color: var(--muted-light);
  font-size: 12px;
  line-height: 1.5;
}

.breadcrumbs span { padding: 0 5px; color: var(--line-dark); }

.knowledge-heading { max-width: 720px; padding-bottom: 30px; }

.knowledge-heading p:not(.eyebrow) {
  margin: 13px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.58;
}

.knowledge-body {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 25px 0 27px;
}

.choice-caption {
  margin: 0 0 10px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
}

.decision-list {
  display: grid;
  gap: 8px;
}

.decision-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  min-height: 60px;
  border: 1px solid var(--line-dark);
  border-radius: 9px;
  padding: 11px 12px 11px 16px;
  color: var(--ink);
  background: var(--paper);
  text-align: left;
  font-size: 15px;
  font-weight: 690;
  line-height: 1.4;
  box-shadow: 0 1px 2px rgba(37, 37, 37, .04);
  transition: border-color .16s ease, background-color .16s ease, color .16s ease, box-shadow .16s ease;
}

.decision-row:hover {
  border-color: #a8c6e8;
  color: var(--blue-dark);
  background: #fbfdff;
  box-shadow: 0 4px 12px rgba(23, 104, 198, .08);
}

.decision-row:active { background: var(--blue-wash); }

.decision-row > span {
  min-width: 0;
  flex: 1;
  overflow-wrap: anywhere;
}

.decision-row .icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  padding: 6px;
  color: var(--blue);
  background: var(--blue-wash);
}

.answer-block {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 15px;
  align-items: start;
  padding: 4px 0 23px;
}

.answer-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: var(--blue);
  background: var(--blue-wash);
}

.answer-mark .icon { width: 18px; height: 18px; }

.answer-block h2 { margin: 4px 0 9px; font-size: 19px; }

.answer-block p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.67;
}

.answer-block .answer-link {
  color: var(--blue-dark);
  overflow-wrap: anywhere;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.answer-block .answer-link:hover { color: var(--ink); }

.media-list {
  display: grid;
  gap: 8px;
  margin-top: 4px;
}

.media-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid #dbe7f4;
  border-radius: 8px;
  padding: 12px;
  background: #f7fbff;
  color: inherit;
  text-decoration: none;
}

.media-preview.is-linked { cursor: pointer; transition: border-color .18s ease, background .18s ease; }
.media-preview.is-linked:hover { border-color: #93c5fd; background: #eff6ff; }

.topic-media-image {
  overflow: hidden;
  margin: 0;
  border: 1px solid #dbe7f4;
  border-radius: 10px;
  background: #f7fbff;
}

.topic-media-image > button {
  display: block;
  width: 100%;
  border: 0;
  padding: 0;
  cursor: zoom-in;
  background: #e2e8f0;
}

.topic-media-image img {
  display: block;
  width: 100%;
  max-height: min(260px, 34dvh);
  object-fit: contain;
  pointer-events: none;
}

.topic-media-image figcaption { display: block; padding: 11px 12px 12px; }
.topic-media-image strong,
.topic-media-image small { display: block; }
.topic-media-image strong { font-size: 13px; }
.topic-media-image small { margin-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.4; }

@media (max-width: 640px) {
  .topic-media-image img { max-height: min(190px, 27dvh); }
  .topic-media-image figcaption { padding: 8px 10px 9px; }
}

.media-preview > span {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 31px;
  height: 31px;
  color: var(--blue);
  background: #e7f2ff;
}

.media-preview strong,
.media-preview small { display: block; }

.media-preview strong { font-size: 13px; }

.media-preview small { margin-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.4; }

.resource-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 13px;
}

.resource-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  padding: 3px 0;
  color: var(--blue-dark);
  background: transparent;
  font-size: 12px;
  font-weight: 690;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.resource-links a:hover { color: var(--ink); }

.resource-links .icon { width: 14px; height: 14px; }

.answer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.inline-result,
.help-contact {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 16px;
  color: var(--green);
  font-size: 13px;
  font-weight: 650;
}

.inline-result .icon { width: 16px; height: 16px; }

.help-contact { color: var(--muted); font-weight: 500; }

.help-contact button,
.form-note button {
  border: 0;
  padding: 0;
  color: var(--blue-dark);
  background: transparent;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.list-page { width: min(940px, 100%); margin: 0 auto; }

.page-title-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 27px;
}

.page-title-row-simple { align-items: center; margin-bottom: 18px; }

.page-title-row p:not(.eyebrow),
.form-heading p:not(.eyebrow) {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

.ticket-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 13px;
}

.search-control {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 41px;
  flex: 1 1 300px;
  border: 1px solid var(--line-dark);
  border-radius: 8px;
  padding: 0 11px;
  color: var(--muted);
  background: var(--paper);
}

.search-control:focus-within { border-color: var(--blue); }

.search-control .icon { width: 17px; height: 17px; }

.search-control input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 13px;
}

.search-control input::placeholder { color: var(--muted-light); }

.sort-control {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.sort-control select,
.extra-filter select,
.status-select select {
  min-height: 39px;
  border: 1px solid var(--line-dark);
  border-radius: 7px;
  padding: 0 28px 0 9px;
  color: var(--ink-soft);
  background: var(--paper);
  font-size: 12px;
}

.status-filters {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 0 0 17px;
  scrollbar-width: none;
}

.status-filters::-webkit-scrollbar { display: none; }

.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  min-height: 31px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 10px;
  color: var(--muted);
  background: var(--paper);
  font-size: 12px;
  font-weight: 670;
}

.filter-pill:hover { border-color: #9dbfe7; color: var(--blue-dark); }

.filter-pill.is-active { border-color: #b8d2f4; color: var(--blue-dark); background: var(--blue-wash); }

.filter-pill span {
  min-width: 15px;
  color: inherit;
  text-align: center;
  font-size: 10px;
  font-weight: 780;
}

.ticket-list {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.ticket-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 112px auto;
  gap: 15px;
  align-items: center;
  width: 100%;
  min-height: 112px;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 16px 5px;
  color: var(--ink);
  background: transparent;
  text-align: left;
}

.ticket-row:last-child { border-bottom: 0; }

.ticket-row:hover { background: #fbfdff; }

.ticket-row-status { align-self: start; padding-top: 2px; }

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--slate);
  font-size: 11px;
  font-weight: 720;
  line-height: 1.25;
  white-space: nowrap;
}

.status-chip i {
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status-chip.is-new { color: var(--blue); }
.status-chip.is-work { color: var(--violet); }
.status-chip.is-waiting { color: var(--orange); }
.status-chip.is-closed { color: var(--green); }
.status-chip.is-paused { color: var(--slate); }

.ticket-row-main { min-width: 0; }

.ticket-row-main strong,
.ticket-row-main small,
.ticket-row-main em { display: block; }

.ticket-row-main strong {
  overflow: hidden;
  font-size: 14px;
  line-height: 1.32;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ticket-row-main small {
  overflow: hidden;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ticket-row-main em {
  overflow: hidden;
  margin-top: 6px;
  color: var(--ink-soft);
  font-size: 12px;
  font-style: normal;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ticket-row-meta { color: var(--muted); text-align: right; }

.ticket-row-meta time,
.ticket-row-meta small { display: block; font-size: 11px; line-height: 1.4; }

.ticket-row-meta small { margin-top: 5px; color: var(--muted-light); }

.ticket-row-id {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--blue-dark);
  font-size: 11px;
  font-weight: 720;
  white-space: nowrap;
}

.ticket-row-id .icon { width: 15px; height: 15px; }

/* Compact ticket stream for the user: topic and state are the only signals. */
.user-ticket-list,
body[data-role="user"] .ticket-list {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}

.user-ticket-row,
body[data-role="user"] .ticket-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  min-height: 66px;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 13px 15px;
  color: var(--ink);
  background: var(--paper);
  text-align: left;
}

.user-ticket-row:last-child,
body[data-role="user"] .ticket-row:last-child { border-bottom: 0; }

.user-ticket-row:hover,
body[data-role="user"] .ticket-row:hover { background: #fbfdff; }

.user-ticket-row.is-awaiting-response,
body[data-role="user"] .ticket-row.is-awaiting-response {
  background: #f2f7ff;
  box-shadow: inset 3px 0 #2f6fed;
}

.user-ticket-row.is-awaiting-response:hover,
body[data-role="user"] .ticket-row.is-awaiting-response:hover { background: #eaf3ff; }

.user-ticket-title,
body[data-role="user"] .ticket-row-main {
  display: grid;
  gap: 5px;
  min-width: 0;
  grid-column: 1;
  grid-row: 1;
}

.ticket-awaiting-response {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: max-content;
  color: #215dc4;
  font-size: 11px;
  font-weight: 720;
  line-height: 1.2;
}

.ticket-awaiting-response i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #2f6fed;
  box-shadow: 0 0 0 3px rgba(47, 111, 237, .12);
}

.ticket-awaiting-rating {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border: 1px solid #fde68a;
  border-radius: 999px;
  padding: 3px 8px;
  color: #92400e;
  background: #fffbeb;
  font-size: 11px;
  font-weight: 700;
}

.user-ticket-title strong,
body[data-role="user"] .ticket-row-main strong {
  display: inline;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  font-weight: 720;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-ticket-topic-line {
  display: grid;
  gap: 2px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
  overflow-wrap: break-word;
  white-space: normal;
}

.user-ticket-number {
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
}

.user-ticket-topic-name {
  overflow-wrap: break-word;
  white-space: normal;
}

body[data-role="user"] .ticket-row-main small,
body[data-role="user"] .ticket-row-main em,
body[data-role="user"] .ticket-row-meta,
body[data-role="user"] .ticket-row-id { display: none; }

body[data-role="user"] .ticket-row-status {
  align-self: center;
  grid-column: 2;
  grid-row: 1;
  padding: 0;
}

.user-ticket-state,
body[data-role="user"] .status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 11px;
  font-weight: 730;
  line-height: 1;
  white-space: nowrap;
}

.user-ticket-state.is-open,
body[data-role="user"] .status-chip:not(.is-closed) {
  color: #165d9f;
  background: #eaf4ff;
}

.user-ticket-state.is-closed,
body[data-role="user"] .status-chip.is-closed {
  color: #2f7655;
  background: #eaf6ef;
}

body[data-role="user"] .status-chip i { display: none; }

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  color: var(--muted);
  font-size: 12px;
}

.pagination > div { display: flex; gap: 10px; }

.text-button {
  min-height: 30px;
  border: 0;
  padding: 0;
  color: var(--blue-dark);
  background: transparent;
}

.text-button:disabled { cursor: default; color: var(--muted-light); }

.empty-state,
.operator-empty {
  display: grid;
  place-items: center;
  min-height: 275px;
  padding: 35px;
  text-align: center;
}

.empty-state .icon,
.operator-empty .icon {
  width: 29px;
  height: 29px;
  margin-bottom: 12px;
  color: var(--blue);
}

.empty-state h1,
.empty-state h2,
.operator-empty h2 { font-size: 21px; }

.empty-state p,
.operator-empty p { max-width: 340px; margin: 8px 0 15px; color: var(--muted); font-size: 14px; line-height: 1.5; }

.form-page { width: min(680px, 100%); }

.form-heading { margin-top: 23px; }

.form-context {
  display: grid;
  gap: 4px;
  margin-top: 24px;
  border-left: 3px solid var(--yellow);
  padding: 4px 0 4px 12px;
}

.form-context span { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }

.form-context strong { color: var(--ink-soft); font-size: 13px; line-height: 1.45; }

.request-form {
  display: grid;
  gap: 18px;
  margin-top: 25px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 23px;
  background: var(--paper);
}

.request-form > label {
  display: grid;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 720;
}

.request-form input:not([type="file"]),
.request-form textarea {
  width: 100%;
  border: 1px solid var(--line-dark);
  border-radius: 7px;
  padding: 10px 11px;
  color: var(--ink);
  background: #fff;
  font-size: 14px;
  font-weight: 500;
}

.request-form input:not([type="file"]) { min-height: 42px; }

.request-form textarea { min-height: 142px; resize: vertical; line-height: 1.55; }

.request-form input:focus,
.request-form textarea:focus { border-color: var(--blue); outline: 0; }

.request-form label small { color: var(--muted); font-size: 11px; font-weight: 500; }

.file-control {
  position: relative;
  display: flex !important;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
  color: var(--blue-dark) !important;
}

.file-control .icon { width: 17px; height: 17px; }

.file-control input {
  position: absolute;
  inset: 0;
  width: 100%;
  cursor: pointer;
  opacity: 0;
}

.file-control em {
  margin-left: auto;
  overflow: hidden;
  max-width: 45%;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding-top: 2px;
}

.form-error { color: #b64937; font-size: 12px; line-height: 1.35; }

.form-note { margin: 17px 0 0; color: var(--muted); font-size: 13px; }

.thread-page { width: min(820px, 100%); }

.thread-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-top: 22px;
  padding-bottom: 25px;
  border-bottom: 1px solid var(--line);
}

.thread-heading h1 { font-size: clamp(25px, 3.2vw, 34px); }

.thread-heading .thread-topic-title {
  font-weight: 600;
}

.thread-heading-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.thread-heading-meta > span { color: var(--muted); font-size: 12px; }

.details-toggle {
  flex: 0 0 auto;
  min-height: 34px;
  border: 0;
  padding: 0;
  color: var(--blue-dark);
  background: transparent;
  font-size: 12px;
}

.details-toggle .icon { width: 15px; height: 15px; transform: rotate(90deg); }

.ticket-details-inline {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 17px 28px;
  border-bottom: 1px solid var(--line);
  padding: 18px 0;
}

.ticket-details-inline > div { min-width: 0; }

.ticket-details-inline > div > span,
.detail-files > span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted-light);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.ticket-details-inline strong { color: var(--ink-soft); font-size: 12px; line-height: 1.5; }

.detail-files { grid-column: 1 / -1; }

.thread { border-bottom: 1px solid var(--line); }

.messages {
  display: grid;
  gap: 17px;
  padding: 26px 0;
}

.message-item {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  max-width: 88%;
}

.message-item.is-own { flex-direction: row-reverse; margin-left: auto; }

.message-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  color: #49637d;
  background: #eaf1f8;
  font-size: 9px;
  font-weight: 800;
}

.message-item.is-own .message-avatar { color: #1761a9; background: #e4f1ff; }

.message-item.is-system .message-avatar { color: #9a6c11; background: #fff3cc; }

.message-item.is-technical-notification {
  width: 100%;
  max-width: 100%;
  justify-content: center;
  margin: 2px auto;
}

.technical-notification {
  display: flex;
  align-items: baseline;
  justify-content: center;
  flex-wrap: wrap;
  gap: 3px 8px;
  max-width: min(100%, 760px);
  border: 1px solid #cfdeec;
  border-radius: 999px;
  padding: 7px 13px;
  color: #5f7892;
  background: #f1f6fb;
  font-size: 11px;
  line-height: 1.45;
  text-align: center;
}

.technical-notification time {
  color: #8aa0b5;
  font-size: 10px;
  white-space: nowrap;
}

.message-info {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
  color: var(--muted);
}

.message-item.is-own .message-info { justify-content: flex-end; }

.message-info strong { color: var(--ink-soft); font-size: 11px; }

.message-info time { color: var(--muted-light); font-size: 10px; }

.message-bubble {
  border: 1px solid var(--line);
  border-radius: 3px 10px 10px 10px;
  padding: 10px 12px;
  color: var(--ink-soft);
  background: #fff;
  font-size: 13px;
  line-height: 1.55;
}

.message-link {
  color: #1761a9;
  text-decoration: underline;
  text-decoration-color: rgba(23, 97, 169, .4);
  text-underline-offset: 2px;
}

.message-link:hover {
  color: #0f477e;
  text-decoration-color: currentColor;
}

.message-item.is-own .message-bubble {
  border-color: #cfe0f2;
  border-radius: 10px 3px 10px 10px;
  color: #215380;
  background: #f1f8ff;
}

.message-bubble-with-delivery {
  display: flex;
  flex-direction: column;
}

.message-bubble-with-delivery > .message-files:first-child {
  margin-top: 0;
}

.message-item.is-system .message-bubble { border-color: #f1dfad; color: #7a641f; background: #fffaf0; }

.message-delivery {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.message-delivery.is-failed {
  color: #b42318;
}

.message-delivery.is-sent {
  color: #1683d8;
  font-size: 10px;
}

.message-delivery-confirmed {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-weight: 650;
}

.message-delivery-confirmed .icon {
  width: 16px;
  height: 16px;
  stroke-width: 2.2;
}

.message-delivery button {
  border: 0;
  padding: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.message-delivery button:disabled {
  cursor: wait;
  opacity: .55;
}

@media (max-width: 640px) {
  .technical-notification {
    border-radius: 14px;
    padding: 8px 11px;
  }
}

.message-files { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }

.message-files span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--blue-dark);
  font-size: 10px;
  font-weight: 680;
}

.message-files .icon { width: 13px; height: 13px; }

.reply-form {
  display: grid;
  gap: 10px;
  padding: 19px 0 23px;
}

.reply-form textarea {
  width: 100%;
  min-height: 92px;
  border: 1px solid var(--line-dark);
  border-radius: 8px;
  padding: 11px;
  color: var(--ink);
  background: var(--paper);
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
}

.reply-form textarea:focus { border-color: var(--blue); outline: 0; }

.reply-form > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.closed-thread {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 16px 0 21px;
  color: var(--green);
  font-size: 13px;
  font-weight: 650;
}

.closed-thread .icon { width: 17px; height: 17px; }

.ticket-rating {
  display: grid;
  gap: 14px;
  border: 1px solid #dbeafe;
  border-radius: 16px;
  padding: 16px;
  color: #334155;
  background: linear-gradient(135deg, #f8fbff, #eff6ff);
}

.ticket-rating-heading {
  display: grid;
  gap: 4px;
}

.ticket-rating-heading strong,
.ticket-rating.is-complete strong {
  color: #1e3a8a;
  font-size: 14px;
}

.ticket-rating-heading p {
  margin: 0;
  color: #64748b;
  font-size: 12px;
}

.ticket-rating-status {
  width: max-content;
  border-radius: 999px;
  padding: 4px 9px;
  color: #166534;
  background: #dcfce7;
  font-size: 10px;
  font-weight: 750;
}

.ticket-rating-status.is-waiting {
  color: #92400e;
  background: #fef3c7;
}

.ticket-rating-keyboard {
  display: grid;
  gap: 7px;
}

.ticket-rating-keyboard > div {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 7px;
}

.ticket-rating-keyboard > div:last-child {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.ticket-rating-keyboard button {
  min-height: 38px;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  color: #1d4ed8;
  background: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 750;
}

.ticket-rating-keyboard button:hover {
  border-color: #60a5fa;
  background: #dbeafe;
}

.ticket-rating-keyboard button:disabled {
  cursor: wait;
  opacity: .55;
}

.ticket-rating.is-complete {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.ticket-rating.is-complete > div {
  display: grid;
  gap: 7px;
}

.ticket-rating.is-complete > b {
  color: #15803d;
  font-size: 22px;
}

@media (max-width: 640px) {
  .ticket-rating {
    padding: 13px;
  }

  .ticket-rating-keyboard > div {
    gap: 5px;
  }

  .ticket-rating-keyboard button {
    min-height: 36px;
    padding: 0;
  }
}

.attachment-list { display: grid; gap: 6px; }

.attachment-list > span {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 7px;
  align-items: center;
  padding: 8px;
  border-radius: 6px;
  color: var(--ink-soft);
  background: #fafafa;
}

.attachment-list .icon { grid-row: 1 / span 2; width: 16px; height: 16px; color: var(--blue); }

.attachment-list b,
.attachment-list small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.attachment-list b { font-size: 11px; }
.attachment-list small { color: var(--muted); font-size: 10px; }
.details-empty { color: var(--muted); font-size: 12px; }

/* Операторская */
body[data-role="operator"] { background: #f3f4f4; }
body[data-role="operator"] .site-header { border-color: #343434; background: #252525; }
body[data-role="operator"] .app-main { width: min(1440px, calc(100% - 32px)); padding-top: 22px; }

.header-inner-operator { min-height: 62px; }
.header-inner-operator .brand { color: #fff; }
.header-inner-operator .brand-symbol { color: var(--yellow); background: rgba(255, 255, 255, .1); }
.header-inner-operator .brand-copy small { color: #bdbdb8; }

.operator-header-right {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-left: auto;
}

.operator-presence {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #d4d4d0;
  font-size: 12px;
}

.operator-presence i { width: 7px; height: 7px; border-radius: 50%; background: #6fca92; }
.header-inner-operator .header-link { color: #f2f2ee; }
.header-inner-operator .header-link:hover { color: var(--yellow); }

.operator-avatar {
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  border-radius: 50%;
  color: #272727;
  background: var(--yellow);
  font-size: 10px;
  font-weight: 800;
}

.operator-workspace {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr) 280px;
  min-height: calc(100vh - 110px);
  overflow: hidden;
  border: 1px solid #dedfdd;
  border-radius: 11px;
  background: var(--paper);
}

.queue-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-right: 1px solid var(--line);
  background: #fff;
}

.queue-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 20px 18px 14px;
}

.queue-title h1 { font-size: 25px; }

.queue-title > span {
  display: grid;
  place-items: center;
  min-width: 25px;
  height: 25px;
  border-radius: 50%;
  color: var(--blue-dark);
  background: var(--blue-wash);
  font-size: 11px;
  font-weight: 800;
}

.queue-search { margin: 0 18px 12px; }
.queue-panel .status-filters { margin: 0; padding: 0 18px 13px; }
.queue-panel .filter-pill { min-height: 27px; padding: 0 8px; font-size: 10px; }

.extra-filter {
  margin: 0 18px 12px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.extra-filter summary {
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 35px;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 680;
  list-style: none;
}

.extra-filter summary::-webkit-details-marker { display: none; }
.extra-filter summary .icon { width: 14px; height: 14px; }

.extra-filter label {
  display: grid;
  gap: 5px;
  padding: 0 0 11px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.extra-filter select { min-height: 35px; width: 100%; }

.queue-list {
  overflow: auto;
  border-top: 1px solid var(--line);
}

.queue-item {
  display: block;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 13px 17px;
  color: var(--ink);
  background: transparent;
  text-align: left;
}

.queue-item:hover { background: #fafcff; }
.queue-item.is-active { box-shadow: inset 3px 0 0 var(--blue); background: var(--blue-wash); }

.queue-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.queue-item-top time { color: var(--muted-light); font-size: 10px; white-space: nowrap; }

.queue-item > strong {
  display: block;
  overflow: hidden;
  margin-top: 7px;
  font-size: 12px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.queue-item > small {
  display: block;
  overflow: hidden;
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.queue-empty { padding: 26px 18px; color: var(--muted); font-size: 12px; text-align: center; }
.queue-panel .pagination { margin: auto 18px 15px; padding-top: 12px; border-top: 1px solid var(--line); }

.operator-thread {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #fff;
}

.operator-thread-head {
  padding: 21px 24px 17px;
  border-bottom: 1px solid var(--line);
}

.operator-ticket-title p {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.operator-ticket-title h2 { font-size: 20px; line-height: 1.25; }

.operator-ticket-title > span {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  margin-top: 11px;
}

.operator-ticket-title em {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.operator-messages {
  flex: 1;
  align-content: start;
  overflow: auto;
  padding: 23px 24px;
}

.operator-thread .reply-form { margin: 0 24px; border-top: 1px solid var(--line); }

.operator-context {
  overflow: auto;
  border-left: 1px solid var(--line);
  background: #fafafa;
}

.context-section {
  padding: 20px;
  border-bottom: 1px solid var(--line);
}

.context-section .eyebrow { margin-bottom: 11px; color: var(--muted); font-size: 10px; }

.status-select {
  position: relative;
  display: block;
}

.status-select select {
  width: 100%;
  appearance: none;
  color: var(--ink);
  font-weight: 680;
}

.status-select .icon {
  position: absolute;
  top: 11px;
  right: 8px;
  width: 14px;
  height: 14px;
  pointer-events: none;
}

.context-list {
  display: grid;
  gap: 12px;
  margin: 0;
}

.context-list div { display: grid; gap: 3px; }
.context-list dt { color: var(--muted-light); font-size: 10px; }
.context-list dd { margin: 0; color: var(--ink-soft); font-size: 12px; font-weight: 620; line-height: 1.42; }

.mobile-queue-back,
.mobile-context-open,
.mobile-thread-back { display: none; }

@media (max-width: 1050px) {
  .topic-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .operator-workspace { grid-template-columns: 300px minmax(0, 1fr) 245px; }
  .operator-thread-head,
  .operator-messages { padding-right: 18px; padding-left: 18px; }
  .operator-thread .reply-form { margin-right: 18px; margin-left: 18px; }
  .context-section { padding: 17px; }
}

@media (max-width: 850px) {
  .header-inner { width: min(100% - 28px, 1200px); gap: 20px; }
  .desktop-only { display: none; }
  .user-nav { gap: 17px; }
  .topic-grid { grid-template-columns: 1fr; }
  .topic-card { min-height: 76px; }
  .operator-workspace {
    display: block;
    min-height: calc(100dvh - var(--mobile-header-h));
    border-radius: 0;
    border-right: 0;
    border-left: 0;
  }
  .operator-workspace[data-focus="queue"] .operator-thread,
  .operator-workspace[data-focus="queue"] .operator-context { display: none; }
  .operator-workspace[data-focus="ticket"] .queue-panel,
  .operator-workspace[data-focus="ticket"] .operator-context { display: none; }
  .operator-workspace[data-focus="details"] .queue-panel,
  .operator-workspace[data-focus="details"] .operator-thread { display: none; }
  .queue-panel {
    min-height: 0;
    height: calc(100dvh - var(--mobile-header-h));
    border-right: 0;
  }
  .queue-list { min-height: 0; flex: 1 1 auto; }
  .operator-thread {
    min-height: 0;
    height: calc(100dvh - var(--mobile-header-h));
  }
  .operator-messages {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    align-content: end;
    grid-auto-rows: max-content;
  }
  .operator-context {
    min-height: 0;
    height: calc(100dvh - var(--mobile-header-h));
    overflow-y: auto;
    border-top: 0;
    border-left: 0;
  }
  .mobile-queue-back {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: 0;
    padding: 0 0 14px;
    color: var(--blue-dark);
    background: transparent;
    font-size: 12px;
    font-weight: 700;
  }
  .mobile-queue-back .icon { width: 16px; height: 16px; }
  .mobile-context-open {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 44px;
    border: 0;
    padding: 0;
    color: var(--blue-dark);
    background: transparent;
    font-size: 12px;
    font-weight: 720;
  }
  .mobile-context-open .icon { width: 15px; height: 15px; }
  .mobile-thread-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    margin: 0 16px;
    border: 0;
    padding: 0;
    color: var(--blue-dark);
    background: transparent;
    font-size: 12px;
    font-weight: 720;
  }
  .mobile-thread-back .icon { width: 16px; height: 16px; }
}

@media (max-width: 640px) {
  :root { --mobile-header-h: 62px; }
  .site-header { position: sticky; top: 0; }
  .header-inner { min-height: 62px; gap: 12px; }
  .brand-copy small { display: none; }
  .brand-copy strong { max-width: 125px; overflow: hidden; text-overflow: ellipsis; }
  body[data-role="user"] .user-nav,
  body[data-role="user"] .header-actions { display: none; }
  body[data-role="user"] .header-inner { justify-content: space-between; }
  .user-nav { gap: 13px; margin-left: auto; }
  .header-nav { font-size: 12px; }
  .header-actions { margin-left: 0; gap: 0; }
  .header-cta { width: 37px; min-width: 37px; padding: 0; font-size: 0; }
  .header-cta .icon { width: 18px; height: 18px; }
  .app-main { width: min(100% - 28px, 1100px); padding-top: 29px; padding-bottom: calc(var(--mobile-nav-h) + env(safe-area-inset-bottom) + 20px); }
  body[data-role="user"] .mobile-bottom-nav {
    position: fixed;
    z-index: 50;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    min-height: calc(var(--mobile-nav-h) + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    padding: 5px 8px calc(5px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, .97);
    box-shadow: 0 -7px 22px rgba(30, 30, 30, .06);
    backdrop-filter: blur(12px);
  }
  .mobile-nav-item {
    position: relative;
    display: grid;
    place-items: center;
    gap: 2px;
    min-height: 54px;
    border: 0;
    border-radius: 9px;
    color: var(--muted);
    background: transparent;
    font-size: 10px;
    font-weight: 680;
  }
  .mobile-nav-item .icon { width: 19px; height: 19px; }
  .mobile-nav-item.is-active { color: var(--blue-dark); background: var(--blue-wash); }
  .mobile-nav-item b {
    position: absolute;
    top: 3px;
    right: calc(50% - 29px);
    display: grid;
    place-items: center;
    min-width: 15px;
    height: 15px;
    border-radius: 10px;
    color: #fff;
    background: var(--blue);
    font-size: 9px;
  }
  .mobile-nav-create { color: #6a5510; }
  .mobile-nav-create .icon { color: var(--ink); }
  .user-hero { display: block; padding-bottom: 28px; }
  .user-hero h1 { font-size: 31px; }
  .user-hero p:not(.eyebrow) { font-size: 14px; }
  .user-hero .quiet-action { margin-top: 13px; }
  .section-heading { display: block; }
  .section-heading p { margin-top: 6px; }
  .topic-card { min-height: 70px; }
  .topic-copy small { -webkit-line-clamp: 1; }
  .knowledge-heading { padding-bottom: 23px; }
  .knowledge-heading h1 { font-size: 30px; }
  .knowledge-heading p:not(.eyebrow) { font-size: 14px; }
  .knowledge-body { padding: 19px 0 22px; }
  .decision-row { min-height: 54px; font-size: 14px; }
  .answer-block { grid-template-columns: 32px minmax(0, 1fr); gap: 11px; }
  .answer-mark { width: 30px; height: 30px; }
  .answer-block p { font-size: 14px; }
  .page-title-row { display: block; margin-bottom: 22px; }
  .page-title-row h1 { font-size: 31px; }
  .page-title-row .primary-button { margin-top: 16px; }
  .ticket-tools { display: grid; }
  .sort-control { justify-content: space-between; }
  .sort-control select { flex: 1; }
  .ticket-row {
    grid-template-columns: 1fr auto;
    gap: 9px 12px;
    min-height: 0;
    padding: 14px 0;
  }
  .ticket-row-status { grid-column: 1; grid-row: 1; }
  .ticket-row-id { grid-column: 2; grid-row: 1; }
  .ticket-row-main { grid-column: 1 / -1; grid-row: 2; }
  .ticket-row-meta { grid-column: 1 / -1; grid-row: 3; display: flex; gap: 9px; text-align: left; }
  .ticket-row-meta small { margin-top: 0; }
  .ticket-row-main em { white-space: normal; }
  .form-page { width: 100%; }
  .request-form { padding: 17px; }
  .form-footer { align-items: flex-end; flex-direction: column-reverse; }
  .form-footer .primary-button { width: 100%; }
  .thread-heading { display: block; }
  .thread-heading h1 { font-size: 27px; }
  .details-toggle { margin-top: 15px; }
  .ticket-details-inline { grid-template-columns: 1fr; gap: 14px; }
  .detail-files { grid-column: auto; }
  .message-item { max-width: 100%; }
  .message-info { flex-wrap: wrap; }
  .reply-form > div { align-items: flex-end; flex-direction: column; }
  .reply-form .primary-button { width: 100%; }
  body[data-role="operator"] .app-main { width: 100%; padding-top: 0; }
  .header-inner-operator { width: calc(100% - 28px); }
  .operator-presence,
  .header-inner-operator .header-link { display: none; }
  .operator-header-right { margin-left: auto; }
  .operator-workspace { min-height: calc(100vh - 62px); }
  .operator-thread-head { padding: 17px 14px 14px; }
  .operator-ticket-title h2 { font-size: 18px; }
  .operator-ticket-title > span { align-items: flex-start; flex-direction: column; gap: 5px; }
  .operator-messages { padding: 18px 14px; }
  .operator-thread .reply-form { margin: 0 14px; }
  .context-section { padding: 16px 14px; }
  .queue-title { padding: 18px 14px 12px; }
  .queue-search { margin-right: 14px; margin-left: 14px; }
  .queue-panel .status-filters { padding-right: 14px; padding-left: 14px; }
  .extra-filter { margin-right: 14px; margin-left: 14px; }
  .queue-item { padding-right: 14px; padding-left: 14px; }

  .back-button,
  .mobile-queue-back,
  .mobile-context-open,
  .mobile-thread-back { min-height: 44px; }
  .queue-panel .filter-pill { min-height: 40px; }
  .search-control input,
  .request-form input:not([type="file"]),
  .request-form textarea,
  .reply-form textarea,
  .sort-control select,
  .extra-filter select,
  .status-select select { font-size: 16px; }

  /* Keep only two primary user destinations on small screens. */
  body[data-role="user"] { --mobile-header-h: 56px; }
  body[data-role="user"] .header-inner { min-height: 56px; gap: 10px; }
  body[data-role="user"] .brand-symbol { width: 27px; height: 27px; }
  body[data-role="user"] .brand-symbol .icon { width: 17px; height: 17px; }
  body[data-role="user"] .app-main {
    min-height: calc(100vh - var(--mobile-header-h));
    padding-top: 16px;
  }
  body[data-role="user"] .mobile-bottom-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body.keyboard-open[data-role="user"] .mobile-bottom-nav { display: none; }
  body[data-role="user"] .mobile-nav-create { display: none; }
  body[data-role="user"] .user-hero {
    padding: 0 0 12px;
    border-bottom: 0;
  }
  body[data-role="user"] .user-hero .eyebrow,
  body[data-role="user"] .user-hero p:not(.eyebrow),
  body[data-role="user"] .section-heading p { display: none; }
  body[data-role="user"] .user-hero h1 { font-size: 25px; }
  body[data-role="user"] .topic-section { padding-top: 0; }
  body[data-role="user"] .section-heading { margin-bottom: 10px; }
  body[data-role="user"] .page-title-row-simple {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
  }
  body[data-role="user"] .page-title-row-simple h1 { font-size: 24px; }
  body[data-role="user"] .topic-card { min-height: 68px; padding: 12px; }
  body[data-role="user"] .topic-copy strong { font-size: 15px; line-height: 1.35; }
  body[data-role="user"] .topic-copy small { display: none; }
  .user-ticket-row,
  body[data-role="user"] .ticket-row { min-height: 72px; padding: 13px; }
  body[data-role="user"] .user-ticket-title strong {
    display: inline;
    font-size: 13px;
    line-height: 1.35;
  }
  .user-ticket-state,
  body[data-role="user"] .status-chip { min-height: 30px; padding: 0 10px; font-size: 12px; }
  body[data-role="user"] .mobile-nav-item { font-size: 11px; }
  body[data-role="user"] .request-form textarea { min-height: 110px; max-height: 34dvh; resize: none; }

  body[data-role="user"][data-view="ticket"] .message-bubble,
  body[data-role="operator"] .operator-thread .message-bubble {
    padding: 11px 13px;
    font-size: 14px;
    line-height: 1.55;
  }
  body[data-role="user"][data-view="ticket"] .message-info strong,
  body[data-role="operator"] .operator-thread .message-info strong { font-size: 12px; }
  body[data-role="user"][data-view="ticket"] .message-info time,
  body[data-role="operator"] .operator-thread .message-info time { font-size: 11px; }

  /* Полноэкранный диалог пользователя: прокручиваются только сообщения. */
  body[data-role="user"][data-view="ticket"] .app-main {
    width: 100%;
    min-height: calc(100dvh - var(--mobile-nav-h) - env(safe-area-inset-bottom));
    padding: 0;
  }
  body[data-role="user"][data-view="ticket"] .site-header { display: none; }
  body[data-role="user"][data-view="ticket"] .thread-page {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: calc(100dvh - var(--mobile-nav-h) - env(safe-area-inset-bottom));
    margin: 0;
  }
  body.keyboard-open[data-role="user"][data-view="ticket"] .thread-page {
    height: var(--visual-viewport-height);
  }
  body[data-role="user"][data-view="ticket"] .thread-page > .back-button {
    flex: 0 0 auto;
    padding: 0 14px;
  }
  body[data-role="user"][data-view="ticket"] .thread-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    flex: 0 0 auto;
    margin: 0;
    padding: 10px 14px 13px;
  }
  body[data-role="user"][data-view="ticket"] .thread-heading h1 { font-size: 19px; line-height: 1.25; }
  body[data-role="user"][data-view="ticket"] .thread-heading .eyebrow { margin-bottom: 4px; font-size: 10px; }
  body[data-role="user"][data-view="ticket"] .thread-heading-meta { gap: 8px; margin-top: 7px; }
  body[data-role="user"][data-view="ticket"] .thread-heading-meta > span { font-size: 10px; }
  body[data-role="user"][data-view="ticket"] .details-toggle { min-height: 44px; margin: 0; font-size: 0; }
  body[data-role="user"][data-view="ticket"] .details-toggle .icon { width: 18px; height: 18px; }
  body[data-role="user"][data-view="ticket"] .ticket-details-inline {
    max-height: 32vh;
    overflow-y: auto;
    flex: 0 0 auto;
    padding: 13px 14px;
  }
  body[data-role="user"][data-view="ticket"] .thread {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    border-bottom: 0;
  }
  body[data-role="user"][data-view="ticket"] .thread .messages {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    align-content: end;
    grid-auto-rows: max-content;
    padding: 17px 14px;
  }
  body[data-role="user"][data-view="ticket"] .thread .message-item { max-width: 82%; }
  body[data-role="user"][data-view="ticket"] .thread .message-item.is-system { max-width: 100%; }

  /* Композер как в мессенджере: одно поле и круглая кнопка отправки. */
  .reply-form,
  .operator-thread .reply-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px;
    align-items: end;
    gap: 8px;
    flex: 0 0 auto;
    margin: 0;
    border-top: 1px solid var(--line);
    padding: 10px 14px max(10px, env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, .98);
    box-shadow: 0 -5px 16px rgba(30, 30, 30, .05);
  }
  .reply-form textarea {
    grid-column: 1;
    grid-row: 1;
    min-height: 44px;
    max-height: 128px;
    margin: 0;
    border-radius: 22px;
    padding: 11px 15px;
    line-height: 1.35;
  }
  .reply-form > div { display: contents; }
  .reply-form .form-error { grid-column: 1 / -1; grid-row: 2; }
  .reply-form .message-send {
    grid-column: 2;
    grid-row: 1;
    width: 44px;
    min-width: 44px;
    min-height: 44px;
    border-radius: 50%;
    padding: 0;
  }
  .reply-form .message-send span { display: none; }
  .reply-form .message-send .icon { width: 19px; height: 19px; }

  /* Оператор: на телефоне очереди, диалог и детали — отдельные экраны. */
  body[data-role="operator"][data-view="operator-ticket"] .operator-thread { height: calc(100dvh - var(--mobile-header-h)); }
  body.keyboard-open[data-role="operator"][data-view="operator-ticket"] .operator-thread {
    height: calc(var(--visual-viewport-height) - var(--mobile-header-h));
  }
  body[data-role="operator"][data-view="operator-ticket"] .operator-messages { flex: 1 1 auto; }
  body[data-role="operator"][data-view="operator-ticket"] .operator-messages .message-item { max-width: 82%; }
  body[data-role="operator"][data-view="operator-ticket"] .operator-messages .message-item.is-system { max-width: 100%; }
  body[data-role="operator"][data-view="operator-ticket"] .operator-thread .reply-form { margin: 0; }
}
