@font-face {
  font-family: "ManagerNewsSerif";
  src: url("./assets/fonts/georgia.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "ManagerNewsSerif";
  src: url("./assets/fonts/georgiab.ttf") format("truetype");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

:root,
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #0a1f44;
  --panel: rgba(7, 24, 55, 0.96);
  --panel-solid: #081e43;
  --panel-strong: #0c2756;
  --text: #f4f7fc;
  --muted: #a7b6cc;
  --accent: #d4af37;
  --accent-strong: #e6c96b;
  --line: rgba(109, 129, 168, 0.36);
  --line-soft: rgba(109, 129, 168, 0.26);
  --backdrop: rgba(10, 31, 68, 0.46);
  --hero-start: rgba(12, 35, 76, 0.98);
  --hero-end: rgba(7, 24, 55, 0.96);
  --ambient-a: rgba(230, 201, 107, 0.12);
  --ambient-b: rgba(47, 95, 168, 0.12);
  --tabs-bg: rgba(255, 255, 255, 0.92);
  --secondary-button-bg: rgba(12, 35, 76, 0.92);
  --media-bg: rgba(255, 255, 255, 0.06);
  --media-line: rgba(109, 129, 168, 0.26);
  --close-bg: rgba(255, 255, 255, 0.08);
  --operator-message-bg: rgba(19, 55, 110, 0.82);
  --contact-link-bg: rgba(255, 255, 255, 0.08);
  --empty-bg: rgba(10, 31, 68, 0.94);
  --empty-line: rgba(109, 129, 168, 0.36);
  --drag-handle-bg: rgba(212, 175, 55, 0.32);
  --shadow: 0 24px 60px rgba(2, 8, 20, 0.34);
  --radius: 24px;
  --content-max-width: 1180px;
  --tabs-gap: clamp(6px, 1vw, 10px);
  --tabs-padding: clamp(5px, 0.7vw, 8px);
  --tab-font-size: clamp(12px, 0.28vw + 12px, 15px);
  --tab-min-height: clamp(44px, 5vw, 54px);
  --card-padding-x: clamp(16px, 2vw, 26px);
  --card-padding-y: clamp(18px, 2.1vw, 28px);
  --card-title-size: clamp(22px, 2.2vw + 10px, 48px);
  --body-font-size: clamp(14px, 0.35vw + 13px, 18px);
  --body-line-height: 1.58;
  --fab-font-size: clamp(12px, 0.2vw + 12px, 14px);
  --fab-padding-y: clamp(10px, 0.8vw, 12px);
  --fab-padding-x: clamp(11px, 1vw, 14px);
  --drawer-padding-x: clamp(12px, 1.6vw, 18px);
  --drawer-padding-y: clamp(12px, 1.5vw, 18px);
  --message-max-width: min(86%, 42rem);
  --news-card-height: clamp(420px, calc(100dvh - 220px), 960px);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: light;
  --bg: #0a1f44;
  --panel: rgba(7, 24, 55, 0.96);
  --panel-solid: #081e43;
  --panel-strong: #0c2756;
  --text: #f4f7fc;
  --muted: #a7b6cc;
  --accent: #d4af37;
  --accent-strong: #e6c96b;
  --line: rgba(109, 129, 168, 0.36);
  --line-soft: rgba(109, 129, 168, 0.26);
  --backdrop: rgba(10, 31, 68, 0.46);
  --hero-start: rgba(12, 35, 76, 0.98);
  --hero-end: rgba(7, 24, 55, 0.96);
  --ambient-a: rgba(230, 201, 107, 0.12);
  --ambient-b: rgba(47, 95, 168, 0.12);
  --tabs-bg: rgba(255, 255, 255, 0.92);
  --secondary-button-bg: rgba(12, 35, 76, 0.92);
  --media-bg: rgba(255, 255, 255, 0.06);
  --media-line: rgba(109, 129, 168, 0.26);
  --close-bg: rgba(255, 255, 255, 0.08);
  --operator-message-bg: rgba(19, 55, 110, 0.82);
  --contact-link-bg: rgba(255, 255, 255, 0.08);
  --empty-bg: rgba(10, 31, 68, 0.94);
  --empty-line: rgba(109, 129, 168, 0.36);
  --drag-handle-bg: rgba(212, 175, 55, 0.32);
  --shadow: 0 24px 60px rgba(2, 8, 20, 0.34);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(230, 201, 107, 0.12), transparent 32%),
    radial-gradient(circle at bottom right, rgba(47, 95, 168, 0.14), transparent 30%),
    var(--bg);
  color: var(--text);
}

body {
  overflow-x: hidden;
}

.app-shell {
  position: relative;
  min-height: 100vh;
  --shell-top: clamp(12px, 1.3vw, 20px);
  --shell-left: max(clamp(12px, 1.4vw, 22px), env(safe-area-inset-left));
  --shell-right: max(clamp(12px, 1.4vw, 22px), env(safe-area-inset-right));
  --shell-bottom: calc(clamp(130px, 15vw, 160px) + env(safe-area-inset-bottom));
  padding: var(--shell-top) var(--shell-right) var(--shell-bottom) var(--shell-left);
}

.ambient {
  position: fixed;
  border-radius: 999px;
  filter: blur(20px);
  pointer-events: none;
  opacity: 0.45;
}

.ambient-a {
  width: 180px;
  height: 180px;
  top: 24px;
  right: -60px;
  background: var(--ambient-a);
}

.ambient-b {
  width: 220px;
  height: 220px;
  bottom: 84px;
  left: -90px;
  background: var(--ambient-b);
}

.content,
.tab-panel,
.drawer {
  position: relative;
  z-index: 1;
}

.eyebrow,
.drawer-eyebrow {
  margin: 0 0 8px;
  color: var(--accent-strong);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 11px;
}

.drawer h2,
.placeholder-card h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
}

.status-anchor {
  display: none;
}

.tabs {
  display: flex;
  align-items: stretch;
  width: 100%;
  gap: var(--tabs-gap);
  padding: var(--tabs-padding);
  margin-bottom: clamp(14px, 2vw, 20px);
  background: var(--tabs-bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  backdrop-filter: blur(16px);
}

.tab-button {
  flex: 1 1 0;
  min-height: var(--tab-min-height);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  padding: clamp(10px, 1vw, 14px) clamp(10px, 1.3vw, 18px);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: var(--tab-font-size);
  line-height: 1.15;
  text-align: center;
  cursor: pointer;
}

.tab-button.active {
  background: linear-gradient(180deg, #325a98, #1f477f);
  color: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(230, 201, 107, 0.34), 0 8px 18px rgba(10, 31, 68, 0.16);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.chat-tab-panel.active {
  display: flex;
  min-height: 0;
}

.chat-tab-shell {
  flex: 1 1 auto;
  width: 100%;
  height: calc(100dvh - var(--shell-top) - var(--shell-bottom));
  min-height: 0;
  max-height: calc(100dvh - var(--shell-top) - var(--shell-bottom));
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: clamp(12px, 1.4vw, 18px);
  border-radius: 28px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.chat-tab-shell .messages {
  min-height: 0;
  flex: 1 1 auto;
  padding-bottom: 8px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: max(clamp(12px, 1.6vw, 22px), env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(calc(100vw - 24px), 760px);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 8px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(8, 16, 38, 0.96);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(20px);
  z-index: 24;
}

.bottom-nav-button {
  min-height: 58px;
  border: 1px solid transparent;
  border-radius: 18px;
  background: transparent;
  color: rgba(167, 182, 204, 0.72);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.15;
  text-align: center;
  padding: 8px 6px 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: color 180ms ease;
}

.bottom-nav-icon {
  width: 22px;
  height: 22px;
  stroke-width: 1.8;
  flex-shrink: 0;
}

.bottom-nav-button.active {
  background: transparent;
  border-color: transparent;
  color: var(--accent-strong);
}

.bottom-nav-button.active .bottom-nav-icon {
  stroke: var(--accent-strong);
}

.bottom-nav-button:hover:not(.active) {
  color: var(--text);
}

.survey-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
  border-radius: 28px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  transition: background 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.survey-theme-preview-active {
  box-shadow: 0 18px 44px color-mix(in srgb, var(--accent) 18%, transparent);
}

.survey-form,
.survey-question-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.survey-card {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  border-radius: var(--radius);
  padding: 18px;
  color: var(--text);
}

.survey-intro-card h2,
.survey-maintenance-card h2,
.survey-success-card h2,
.survey-question-card h3 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
}

.survey-intro-text {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.survey-identity-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.survey-identity-label,
.survey-freeform-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.survey-identity-input,
.survey-freeform-input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  color: var(--text);
  border-radius: 16px;
  padding: 14px 16px;
  font: inherit;
}

.survey-freeform-input {
  resize: vertical;
  min-height: 88px;
}

.survey-question-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.survey-question-title-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.survey-selection-hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.survey-color-builder {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--panel-strong) 78%, white);
}

.survey-color-builder-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.survey-color-builder-head h4,
.survey-color-builder-head p {
  margin: 0;
}

.survey-color-builder-head h4 {
  font-size: 15px;
  color: var(--text);
}

.survey-color-builder-head p {
  color: var(--muted);
  line-height: 1.5;
  font-size: 13px;
}

.survey-color-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}

.survey-color-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.survey-color-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.survey-color-input {
  width: 44px;
  height: 36px;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.survey-color-value {
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.survey-question-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--survey-on-accent, white);
  font-size: 13px;
  font-weight: 800;
  flex: 0 0 auto;
}

.survey-options {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.survey-option {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel-strong);
  color: var(--text);
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.survey-option:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent) 32%, var(--line));
}

.survey-option-selected {
  background: color-mix(in srgb, var(--accent) 16%, var(--panel-strong));
  border-color: color-mix(in srgb, var(--accent) 58%, var(--line));
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.12);
}

.survey-option input {
  margin-top: 3px;
  accent-color: var(--accent);
}

.survey-submit-row {
  display: flex;
  justify-content: flex-end;
}

.survey-submit-button {
  min-width: 180px;
  background: var(--accent);
  color: var(--survey-on-accent, white);
}

@media (max-width: 640px) {
  .chat-tab-shell {
    padding: 14px;
  }

  .survey-panel {
    padding: 12px;
  }

  .survey-card {
    padding: 16px;
  }

  .survey-question-head {
    gap: 10px;
  }

  .survey-color-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.tabs,
.content,
.blocked-state {
  width: min(100%, var(--content-max-width));
  margin-inline: auto;
}

/* ── Page header (logo + title per tab) ── */
.page-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 0 18px;
  gap: 10px;
}

.page-header-logo {
  width: 110px;
  height: 88px;
  filter: blur(3px);
  opacity: 0.82;
}

.page-header-logo--sm {
  width: 110px;
  height: 88px;
  filter: blur(3px);
  opacity: 0.82;
}

.page-header-title {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(26px, 6vw, 36px);
  font-weight: 800;
  color: var(--accent-strong);
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.chat-page-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 8px 0 18px;
  flex-shrink: 0;
}

.chat-page-header .page-header-title {
  font-size: clamp(26px, 6vw, 36px);
}

/* ── News feed shell ── */
.news-feed-shell {
  position: relative;
  min-height: calc(100dvh - 260px);
}

.news-feed {
  min-height: 0;
}

.news-carousel-shell {
  position: relative;
  width: calc(100% + var(--shell-left) + var(--shell-right));
  max-width: none;
  margin-left: calc(var(--shell-left) * -1);
  margin-right: calc(var(--shell-right) * -1);
  overflow: visible;
}

.news-carousel-track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 100%;
  gap: 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0 0 8px;
  scroll-snap-type: x mandatory;
  scroll-padding: 0;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  transform: translate3d(var(--track-intro-shift, 0px), 0, 0);
  transition: transform 460ms cubic-bezier(0.22, 0.61, 0.36, 1);
  will-change: transform;
}

.news-carousel-track::-webkit-scrollbar {
  display: none;
}

.hidden {
  display: none !important;
}

.news-card,
.placeholder-card,
.blocked-card,
.message-form,
.drawer,
.contact-card,
.message {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.news-card,
.placeholder-card,
.blocked-card {
  padding: 18px;
  border-radius: var(--radius);
}

.news-thumb-card {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  text-align: left;
  padding: 0;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.news-thumb-card:hover,
.news-thumb-card:active {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 20px 48px rgba(2, 8, 20, 0.4);
}

.news-thumb-media {
  width: 100%;
  height: 120px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--panel-strong);
}

.news-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.news-thumb-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--panel-strong), var(--bg));
}

.news-thumb-body {
  padding: 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}

.news-thumb-title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-thumb-date {
  font-size: 11px;
  color: var(--muted);
  display: block;
  margin-bottom: 8px;
}

.news-learn-more-btn {
  display: block;
  border: 0;
  border-radius: 999px;
  padding: 8px 12px;
  background: linear-gradient(180deg, var(--accent-strong), var(--accent));
  color: #0f2a5a;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
}

/* Full article overlay */
.news-article-overlay {
  position: absolute;
  inset: 0;
  background: var(--panel);
  border-radius: 20px;
  border: 1px solid var(--line);
  z-index: 10;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.news-article-overlay.hidden {
  display: none;
}

.news-article-topbar {
  padding: 14px 16px 10px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--line);
}

.news-article-back {
  border: 0;
  background: transparent;
  color: var(--accent-strong);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}

.news-article-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  overscroll-behavior: contain;
}

.news-article-full {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.news-article-full-head {
  display: grid;
  gap: 8px;
}

.news-article-full-head h2 {
  margin: 0;
  font-family: "ManagerNewsSerif", Georgia, serif;
  font-size: clamp(22px, 5vw, 32px);
  line-height: 1.1;
}

.news-article-full-head time {
  color: var(--muted);
  font-size: 12px;
}

.news-card {
  scroll-snap-align: center;
  scroll-snap-stop: always;
  display: flex;
  flex-direction: column;
  gap: clamp(16px, 1.8vw, 22px);
  width: 100%;
  max-width: 100%;
  height: var(--news-card-height);
  min-height: 360px;
  padding: var(--card-padding-y) var(--card-padding-x);
  overflow: hidden;
  border-radius: clamp(20px, 5vw, 28px);
  touch-action: pan-y pinch-zoom;
  container-type: inline-size;
  transform-style: preserve-3d;
  transform-origin: center center;
  transform:
    perspective(1600px)
    translateX(calc(var(--card-shift, 0px) + var(--card-intro-shift, 0px)))
    rotateY(var(--card-rotate, 0deg))
    scale(var(--card-scale, 0.92));
  opacity: var(--card-opacity, 0.72);
  transition:
    transform 220ms cubic-bezier(0.22, 0.61, 0.36, 1),
    opacity 200ms ease,
    box-shadow 220ms ease,
    border-color 220ms ease;
}

.news-card.is-active {
  border-color: var(--accent);
  box-shadow: 0 30px 72px rgba(24, 20, 17, 0.22);
  opacity: 1;
}

.news-card-head {
  display: grid;
  gap: clamp(8px, 1.2vw, 14px);
}

.news-card-body {
  flex: 1 1 auto;
  display: grid;
  gap: clamp(16px, 1.6vw, 22px);
  min-height: 0;
  overflow-y: auto;
  padding-right: 6px;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y pinch-zoom;
}

.news-card-body::-webkit-scrollbar {
  display: none;
}

.blocked-state {
  margin-top: 12px;
}

.news-card h2 {
  margin: 0;
  font-family: "ManagerNewsSerif", Georgia, "Times New Roman", serif;
  font-size: clamp(28px, 4.2vw + 8px, 52px);
  line-height: 0.98;
  letter-spacing: -0.02em;
}

.news-card time {
  display: inline-block;
  margin-bottom: 0;
  color: var(--muted);
  font-size: clamp(12px, 0.2vw + 12px, 14px);
}

.news-card p {
  margin: 0;
  white-space: pre-wrap;
  line-height: var(--body-line-height);
  font-size: var(--body-font-size);
}

.news-card-text {
  width: 100%;
  max-width: 78ch;
  justify-self: start;
  line-height: var(--body-line-height);
  color: var(--text);
}

.news-card-text::after {
  content: "";
  display: block;
  clear: both;
}

.publication-inline-media,
.publication-block-media {
  margin: 8px 0 18px;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--media-bg);
}

.publication-inline-media {
  width: var(--publication-width, 44%);
}

.publication-inline-media--left {
  float: left;
  margin-right: 16px;
}

.publication-inline-media--right {
  float: right;
  margin-left: 16px;
}

.publication-block-media {
  clear: both;
  width: 100%;
}

.publication-inline-media img,
.publication-block-media img,
.publication-inline-media video,
.publication-block-media video {
  display: block;
  width: 100%;
  max-width: 100%;
  background: var(--media-bg);
}

.publication-inline-media audio,
.publication-block-media audio {
  display: block;
  width: calc(100% - 24px);
  margin: 12px;
}

.publication-inline-media figcaption,
.publication-block-media figcaption {
  padding: 10px 12px 12px;
  color: var(--muted);
  font-size: 13px;
}

.news-card-text p {
  margin: 0 0 14px;
}

.news-card-text h2,
.news-card-text h3,
.news-card-text h4,
.news-card-text table,
.news-card-text blockquote,
.news-card-text ul,
.news-card-text ol {
  clear: both;
}

.news-article-media {
  width: 100%;
  display: grid;
  gap: clamp(12px, 1.6vw, 18px);
}

.news-article-media:empty {
  display: none;
}

@container (max-width: 560px) {
  .news-card h2 {
    font-size: clamp(24px, 7vw, 38px);
  }

  .news-card-text {
    max-width: none;
  }
}

.news-layout {
  position: relative;
  width: 100%;
  aspect-ratio: var(--news-layout-width, 960) / var(--news-layout-height, 960);
  --news-layout-scale: 1;
}

.news-layout-block {
  position: absolute;
  overflow: visible;
}

.news-layout-block--text {
  padding: calc(14px * var(--news-layout-scale, 1)) calc(16px * var(--news-layout-scale, 1));
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
  border-radius: calc(18px * var(--news-layout-scale, 1));
}

.news-layout-text {
  min-height: 100%;
  overflow: visible;
  color: var(--text);
  font-size: calc(15px * var(--news-layout-scale, 1));
  line-height: 1.6;
}

.news-layout-text p,
.news-layout-text ul,
.news-layout-text ol,
.news-layout-text blockquote,
.news-layout-text h2,
.news-layout-text h3,
.news-layout-text h4,
.news-layout-text table {
  margin: 0 0 12px;
}

.news-layout-text table {
  width: 100%;
  border-collapse: collapse;
}

.news-layout-text th,
.news-layout-text td {
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
  padding: calc(8px * var(--news-layout-scale, 1)) calc(10px * var(--news-layout-scale, 1));
  vertical-align: top;
}

.news-layout-text h2 {
  font-size: calc(32px * var(--news-layout-scale, 1));
  line-height: 1.04;
}

.news-layout-text h3 {
  font-size: calc(24px * var(--news-layout-scale, 1));
  line-height: 1.12;
}

.news-layout-text h4 {
  font-size: calc(19px * var(--news-layout-scale, 1));
  line-height: 1.2;
}

.news-layout-text a {
  color: var(--accent);
}

.news-layout-media-item {
  position: relative;
  margin: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: calc(18px * var(--news-layout-scale, 1));
}

.news-layout-media-item img,
.news-layout-media-item video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.news-layout-media-item[data-fit="cover"] img,
.news-layout-media-item[data-fit="cover"] video {
  object-fit: cover;
}

.news-layout-media-item--audio {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 8px;
  padding: calc(10px * var(--news-layout-scale, 1));
  box-sizing: border-box;
  border-radius: calc(16px * var(--news-layout-scale, 1));
  background: var(--panel-strong);
  border: 1px solid var(--line);
}

.news-layout-audio-label {
  color: var(--muted);
  font-size: calc(12px * var(--news-layout-scale, 1));
  font-weight: 700;
}

.news-layout-media-item audio {
  width: 100%;
}

.news-layout-text img[data-wrap="left"],
.news-layout-text img[data-wrap="left-wrap"] {
  float: left;
  margin: 4px calc(14px * var(--news-layout-scale, 1)) calc(12px * var(--news-layout-scale, 1)) 0;
  max-width: 58%;
}

.news-layout-text img[data-wrap="right"],
.news-layout-text img[data-wrap="right-wrap"] {
  float: right;
  margin: 4px 0 calc(12px * var(--news-layout-scale, 1)) calc(14px * var(--news-layout-scale, 1));
  max-width: 58%;
}

.news-layout-text img[data-wrap="inline"] {
  display: inline-block;
  vertical-align: middle;
  margin: 0 calc(8px * var(--news-layout-scale, 1)) calc(8px * var(--news-layout-scale, 1)) 0;
  max-width: 48%;
}

.news-layout-text img[data-wrap="block"] {
  display: block;
  margin: calc(10px * var(--news-layout-scale, 1)) auto calc(14px * var(--news-layout-scale, 1));
  max-width: 100%;
}

.news-card-text img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 18px;
  border: 1px solid var(--line);
  box-shadow: 0 14px 34px rgba(18, 24, 38, 0.18);
  cursor: zoom-in;
}

.news-card-text img[align="left"] {
  float: left;
  margin: 2px 14px 10px 0;
  max-width: min(56%, 340px);
}

.news-card-text img[align="right"] {
  float: right;
  margin: 2px 0 10px 14px;
  max-width: min(56%, 340px);
}

.news-card-text img:not([align]),
.news-card-text img[align="center"],
.news-card-text img[align="block"] {
  margin: 10px auto 14px;
}

@media (max-width: 700px) {
  .news-card-text img[align="left"],
  .news-card-text img[align="right"] {
    float: none;
    display: block;
    max-width: 100%;
    margin: 10px auto 14px;
  }
}

.media-canvas {
  position: relative;
  width: 100%;
  margin-top: 14px;
  aspect-ratio: var(--media-canvas-width, 720) / var(--media-canvas-height, 220);
  --media-canvas-scale: 1;
}

.media-canvas-item {
  position: absolute;
  margin: 0;
  overflow: hidden;
  background: transparent;
  border-radius: calc(16px * var(--media-canvas-scale, 1));
}

.media-canvas-item img,
.media-canvas-item video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: transparent;
  transform: scale(var(--media-canvas-scale, 1));
  transform-origin: center center;
}

.media-canvas-item img {
  cursor: zoom-in;
}

.media-canvas-item--audio {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 8px;
  padding: calc(10px * var(--media-canvas-scale, 1));
  box-sizing: border-box;
  border-radius: calc(16px * var(--media-canvas-scale, 1));
  background: var(--panel-strong);
  border: 1px solid var(--media-line);
}

.media-audio-shell {
  color: var(--muted);
  font-size: calc(12px * var(--media-canvas-scale, 1));
  font-weight: 700;
}

.media-canvas-item audio {
  width: 100%;
}

.media-caption {
  display: none;
}

.referral-panel {
  display: grid;
  gap: 14px;
}

.referral-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 14px;
}

.referral-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  padding: 18px;
}

.referral-card-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.referral-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.copy-link-button {
  border: 0;
  border-radius: 14px;
  padding: 10px 12px;
  background: var(--contact-link-bg);
  color: var(--accent-strong);
  cursor: pointer;
}

.copy-link-button.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
}

.copy-link-button:disabled {
  opacity: 0.55;
  cursor: default;
}

.referral-link-box {
  margin-top: 12px;
  padding: 14px;
  border-radius: 18px;
  background: var(--panel-strong);
  border: 1px dashed var(--line);
  line-height: 1.5;
  word-break: break-word;
}

.referral-note {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.referral-person,
.referral-list {
  display: grid;
  gap: 10px;
}

.referral-person-card {
  padding: 14px;
  border-radius: 18px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
}

.referral-person-card.empty {
  border-style: dashed;
  color: var(--muted);
}

.referral-person-card h3 {
  margin: 0 0 6px;
  font-size: 16px;
}

.referral-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.referral-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 9px;
  border-radius: 999px;
  background: var(--contact-link-bg);
  color: var(--accent-strong);
  font-size: 12px;
}

.referral-date {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.news-nav {
  position: absolute;
  inset-inline: clamp(6px, 1vw, 16px);
  bottom: calc(var(--shell-bottom) + 16px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
  z-index: 4;
}

.tab-panel[data-panel="news"] {
  position: relative;
}

.news-nav.hidden {
  display: none;
}

.fab {
  border: 1px solid transparent;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 0;
  padding: var(--fab-padding-y) var(--fab-padding-x);
  font-size: var(--fab-font-size);
  cursor: pointer;
  box-shadow: var(--shadow);
}

.fab.primary {
  background: linear-gradient(180deg, var(--accent-strong), var(--accent));
  border-color: rgba(194, 154, 25, 0.48);
  color: #0f2a5a;
}

.fab.secondary {
  background: var(--secondary-button-bg);
  border-color: var(--line);
  color: var(--text);
}

.fab.tertiary {
  min-width: 42px;
  padding: calc(var(--fab-padding-y) - 1px) var(--fab-padding-x);
  background: var(--secondary-button-bg);
  border-color: var(--line);
  color: var(--text);
}

.news-nav-button {
  width: clamp(42px, 4.6vw, 54px);
  height: clamp(42px, 4.6vw, 54px);
  min-width: clamp(42px, 4.6vw, 54px);
  padding: 0;
  font-size: clamp(18px, 1vw + 14px, 24px);
  border: 1px solid color-mix(in srgb, var(--line) 88%, transparent);
  background: color-mix(in srgb, var(--panel-solid) 88%, transparent);
  backdrop-filter: blur(16px);
  pointer-events: auto;
}

.news-nav-button:disabled {
  opacity: 0.45;
  cursor: default;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(420px, calc(100vw - 16px));
  height: 100vh;
  padding: var(--drawer-padding-y) var(--drawer-padding-x);
  border-radius: 28px 0 0 28px;
  transform: translateX(104%);
  transition: transform 220ms ease;
  z-index: 30;
  display: flex;
  flex-direction: column;
}

.drawer.open {
  transform: translateX(0);
}

.chat-drawer {
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  width: 100vw;
  max-width: none;
  height: 100dvh;
  padding:
    calc(10px + env(safe-area-inset-top))
    max(12px, env(safe-area-inset-right))
    calc(10px + env(safe-area-inset-bottom))
    max(12px, env(safe-area-inset-left));
  border-radius: 0;
  transform: translateY(104%);
  transition:
    transform
    var(--chat-transition-duration, 180ms)
    var(--chat-transition-easing, cubic-bezier(0.16, 0.92, 0.28, 1));
}

.chat-drawer.open {
  transform: translateY(calc(var(--chat-drag-y, 0px) + var(--chat-open-bounce-y, 0px)));
}

#chat-drawer {
  left: 0 !important;
  right: 0 !important;
  top: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  max-width: none !important;
  height: 100dvh !important;
  padding:
    calc(10px + env(safe-area-inset-top))
    max(12px, env(safe-area-inset-right))
    calc(10px + env(safe-area-inset-bottom))
    max(12px, env(safe-area-inset-left)) !important;
  border-radius: 0 !important;
  transform: translateY(104%) !important;
  z-index: 42;
}

#chat-drawer.open {
  transform: translateY(calc(var(--chat-drag-y, 0px) + var(--chat-open-bounce-y, 0px))) !important;
}

#chat-drawer .messages {
  min-height: 0;
  flex: 1 1 auto;
  padding-bottom: 8px;
}

.chat-typing-status {
  min-height: 38px;
  display: flex;
  align-items: flex-end;
  padding: 4px 2px 0;
  margin-top: 4px;
  flex: 0 0 auto;
}

.chat-typing-status:not(.is-active) {
  pointer-events: none;
}

.drawer-drag-handle {
  width: 82px;
  height: 8px;
  border-radius: 999px;
  margin: 0 auto 10px;
  background: var(--drag-handle-bg);
  flex: 0 0 auto;
  cursor: pointer;
  box-shadow: 0 0 0 1px var(--line);
  transition: transform 140ms ease, opacity 140ms ease, background-color 140ms ease;
}

.drawer-drag-handle:hover {
  opacity: 0.92;
}

.drawer-drag-handle:active {
  transform: scaleX(0.94);
}

.drawer-drag-handle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: var(--backdrop);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
  z-index: 25;
}

body.image-viewer-open {
  overflow: hidden;
}

.image-viewer {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding:
    calc(18px + env(safe-area-inset-top))
    max(14px, env(safe-area-inset-right))
    calc(18px + env(safe-area-inset-bottom))
    max(14px, env(safe-area-inset-left));
  background: var(--backdrop);
  backdrop-filter: blur(12px);
  z-index: 60;
}

.image-viewer.open {
  display: flex;
}

.image-viewer-dialog {
  position: relative;
  width: min(100%, 1280px);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.image-viewer-stage {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
}

.image-viewer-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.image-viewer-action {
  min-width: 52px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 14px;
  background: var(--panel-solid);
  color: var(--accent-strong);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.image-viewer-action:disabled {
  opacity: 0.45;
  cursor: default;
}

.image-viewer-image {
  display: block;
  max-width: 100%;
  max-height: min(88dvh, 100%);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 24px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
  background: color-mix(in srgb, var(--panel) 92%, black);
  transition: transform 160ms ease;
  transform-origin: center center;
}

.image-viewer-video {
  display: none;
  max-width: 100%;
  max-height: min(88dvh, 100%);
  border-radius: 24px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
  background: var(--panel-solid);
}

.image-viewer-close {
  position: absolute;
  top: 0;
  right: 0;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-solid);
  color: var(--accent-strong);
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.image-viewer.image-viewer-video-mode .image-viewer-image {
  display: none;
}

.image-viewer.image-viewer-video-mode .image-viewer-video {
  display: block;
}

.image-viewer.image-viewer-video-mode [data-image-viewer-zoom-in],
.image-viewer.image-viewer-video-mode [data-image-viewer-zoom-out] {
  opacity: 0.45;
  pointer-events: none;
}

.message-attachment-video video,
.media-canvas-item--video video,
.news-card-text video {
  cursor: zoom-in;
}

.drawer-backdrop.visible {
  opacity: 1;
  pointer-events: auto;
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: clamp(10px, 1vw, 16px);
}

.close-button,
.submit-button,
.contact-card a,
.theme-toggle-button {
  border: 0;
  border-radius: 14px;
  cursor: pointer;
}

.close-button {
  padding: 10px 12px;
  background: var(--close-bg);
  color: var(--text);
}

.chat-close-button {
  width: 30px;
  height: 30px;
  min-width: 30px;
  padding: 0;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--close-bg);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  line-height: 1;
  transition: border-color 180ms ease, color 180ms ease, background-color 180ms ease;
}

.chat-close-button:hover,
.chat-close-button:active {
  border-color: var(--accent);
  color: var(--text);
  background: var(--panel-strong);
}

.messages {
  flex: 1;
  overflow: auto;
  display: grid;
  gap: 10px;
  padding-right: 4px;
  padding-bottom: 8px;
  align-content: start;
}

.message {
  justify-self: start;
  width: fit-content;
  max-width: var(--message-max-width);
  padding: clamp(12px, 1vw, 15px) clamp(13px, 1.1vw, 16px);
  border-radius: 20px;
}

.message.user {
  justify-self: end;
  background: linear-gradient(180deg, #325a98, #1f477f);
  border-color: rgba(230, 201, 107, 0.34);
  color: white;
}

.message.message--audio-wide {
  width: 100%;
  max-width: 100%;
}

.message.operator {
  background: var(--operator-message-bg);
}

.message.assistant,
.message.system {
  background: var(--panel-strong);
}

.message.user .message-meta {
  color: rgba(255, 255, 255, 0.72);
}

.message-meta {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
}

.message-body {
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.5;
}

.message-status {
  margin-top: 8px;
  font-size: 11px;
  line-height: 1.35;
  color: var(--muted);
}

.message.user .message-status {
  color: rgba(255, 255, 255, 0.78);
  text-align: right;
}

.typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  max-width: var(--message-max-width);
  padding: 12px 14px;
  border-radius: 18px;
  background: var(--panel-strong);
  color: var(--muted);
  font-size: 13px;
  box-shadow: 0 8px 18px rgba(16, 21, 34, 0.06);
}

.typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.32;
  animation: typing-dot-pulse 1.1s ease-in-out infinite;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.18s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.36s;
}

@keyframes typing-dot-pulse {
  0%,
  100% {
    opacity: 0.28;
    transform: translateY(0);
  }
  50% {
    opacity: 0.92;
    transform: translateY(-1px);
  }
}

.message-form {
  margin-top: 6px;
  padding: clamp(9px, 1vw, 12px);
  border-radius: clamp(18px, 2vw, 22px);
  position: relative;
  display: block;
  min-height: 74px;
  flex: 0 0 auto;
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  border: 1px solid var(--line);
  box-shadow: 0 -10px 28px rgba(16, 21, 34, 0.08);
}

.message-form textarea {
  width: 100%;
  resize: none;
  min-height: 52px;
  max-height: 34vh;
  border: 0;
  outline: none;
  background: transparent;
  font: inherit;
  color: var(--text);
  line-height: 1.45;
  overflow-y: hidden;
  display: block;
  box-sizing: border-box;
  padding: 14px 96px 10px 52px;
}

.message-tool-button {
  width: 38px;
  min-width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 12px;
  border: 1px solid var(--line-soft);
  background: var(--panel-strong);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  position: absolute;
  bottom: 12px;
  z-index: 2;
}

.message-tool-button#attach-file-button {
  left: 12px;
}

.message-tool-button#voice-message-button {
  right: 58px;
}

.message-tool-button.recording {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.submit-button {
  width: 38px;
  min-width: 38px;
  height: 38px;
  margin-top: 0;
  padding: 0;
  background: linear-gradient(180deg, var(--accent-strong), var(--accent));
  color: #0f2a5a;
  border-radius: 12px;
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 2;
}

.message-attachment {
  display: block;
  margin-bottom: 10px;
  text-decoration: none;
}

.message-attachment img,
.message-attachment video {
  display: block;
  width: min(240px, 100%);
  max-width: 100%;
  border-radius: 14px;
}

.message-attachment-file,
.message-attachment-audio {
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--panel-strong);
  border: 1px solid var(--line-soft);
}

.message.user .message-attachment-file,
.message.user .message-attachment-audio {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.18);
}

.message.message--audio-wide .message-attachment-audio {
  width: 100%;
}

.message-attachment-audio audio {
  width: min(240px, 100%);
}

.message.message--audio-wide .message-attachment-audio audio {
  width: 100%;
}

.message-file-title {
  display: block;
  font-weight: 600;
  color: inherit;
}

.message-file-meta {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--muted);
}

.message.user .message-file-meta {
  color: rgba(255, 255, 255, 0.74);
}

.contacts-list {
  display: grid;
  gap: 10px;
}

.contact-card {
  padding: 14px;
  border-radius: 20px;
}

.contact-card h3 {
  margin: 0 0 6px;
  font-size: 18px;
}

.contact-card p {
  margin: 0 0 10px;
  color: var(--muted);
  line-height: 1.45;
}

.contact-card a {
  display: inline-block;
  padding: 10px 12px;
  background: var(--contact-link-bg);
  color: var(--accent-strong);
  text-decoration: none;
}

.empty-state {
  padding: 18px;
  border-radius: 20px;
  background: var(--empty-bg);
  color: var(--muted);
  border: 1px dashed var(--empty-line);
}

.chat-registration-card {
  padding: 18px;
  border-radius: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: grid;
  gap: 12px;
}

.chat-registration-card h3,
.chat-registration-card p {
  margin: 0;
}

.chat-registration-text {
  color: var(--muted);
  line-height: 1.5;
}

.chat-registration-form {
  display: grid;
  gap: 12px;
}

.chat-registration-field {
  display: grid;
  gap: 6px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.chat-registration-field input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  color: var(--text);
  border-radius: 14px;
  padding: 12px 14px;
  font: inherit;
}

.chat-registration-submit {
  border: 0;
  border-radius: 16px;
  padding: 12px 14px;
  background: linear-gradient(180deg, var(--accent-strong), var(--accent));
  color: #0f2a5a;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.chat-registration-submit:disabled {
  opacity: 0.6;
  cursor: default;
}

.chat-registration-skip {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 11px 14px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}

.chat-registration-skip:hover {
  border-color: var(--accent);
  color: var(--text);
}

/* ── Post-auth info modal ── */
.post-auth-modal {
  position: fixed;
  inset: 0;
  background: rgba(5, 12, 30, 0.78);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px max(24px, env(safe-area-inset-left));
  z-index: 80;
}

.post-auth-modal[hidden] {
  display: none;
}

.post-auth-modal-inner {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 26px;
  padding: 26px;
  max-width: 340px;
  width: 100%;
  display: grid;
  gap: 14px;
  box-shadow: 0 28px 72px rgba(0, 0, 0, 0.5);
}

.post-auth-modal-title {
  margin: 0;
  font-family: Georgia, serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.post-auth-modal-text {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.post-auth-modal-text strong {
  color: var(--accent-strong);
}

/* ── Settings card ── */
.settings-card {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.settings-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
}

.settings-toggle-icon {
  color: var(--muted);
  font-size: 14px;
  transition: transform 200ms ease;
}

.settings-card-header.open .settings-toggle-icon {
  transform: rotate(180deg);
}

.settings-card-body {
  display: grid;
  gap: 14px;
  padding-top: 16px;
}

.settings-card-body[hidden] {
  display: none;
}

.settings-auth-form {
  display: grid;
  gap: 12px;
}

.settings-save-btn {
  border: 0;
  border-radius: 16px;
  padding: 12px 14px;
  background: linear-gradient(180deg, var(--accent-strong), var(--accent));
  color: #0f2a5a;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.settings-save-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

@media (max-width: 740px) {
  .app-shell {
    --shell-left: max(10px, env(safe-area-inset-left));
    --shell-right: max(10px, env(safe-area-inset-right));
    padding: 16px var(--shell-right) 118px var(--shell-left);
  }

  .referral-grid {
    grid-template-columns: 1fr;
  }

  .fab {
    padding: 11px 12px;
  }

  .bottom-nav {
    left: 14px;
    right: 14px;
    width: auto;
    transform: none;
  }

  .news-carousel-track {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .referral-card-header {
    flex-direction: column;
  }

  .referral-actions {
    width: 100%;
    justify-content: stretch;
  }

  .referral-actions .copy-link-button {
    flex: 1 1 0;
  }

  .drawer {
    width: 100vw;
    border-radius: 24px 24px 0 0;
    top: auto;
    bottom: 0;
    height: min(82vh, 720px);
    transform: translateY(104%);
  }

  .drawer.open {
    transform: translateY(0);
  }

  .chat-drawer {
    height: 100dvh;
    max-height: none;
    border-radius: 0;
  }

  .chat-drawer.open {
    transform: translateY(calc(var(--chat-drag-y, 0px) + var(--chat-open-bounce-y, 0px)));
  }

  #chat-drawer {
    height: 100dvh !important;
    max-height: none !important;
    border-radius: 0 !important;
  }

  #chat-drawer.open {
    transform: translateY(calc(var(--chat-drag-y, 0px) + var(--chat-open-bounce-y, 0px))) !important;
  }
}

@media (max-width: 980px) {
  :root {
    --content-max-width: 100%;
    --message-max-width: min(90%, 34rem);
  }

  .news-card h2 {
    line-height: 1.02;
  }

  .drawer {
    width: min(420px, calc(100vw - 12px));
  }
}

@media (max-width: 420px) {
  .chat-tab-shell {
    padding: 12px;
  }

  :root {
    --card-title-size: clamp(18px, 8vw, 34px);
    --body-font-size: 14px;
    --fab-font-size: 12px;
    --message-max-width: 94%;
  }

  .tabs {
    gap: 5px;
    padding: 5px;
  }

  .tab-button {
    padding-inline: 8px;
  }

  .news-card {
    min-height: 320px;
  }

  .bottom-nav {
    left: 10px;
    right: 10px;
    width: auto;
    transform: none;
    gap: 4px;
    padding: 6px;
  }

  .bottom-nav-button {
    min-height: 52px;
    font-size: 10px;
  }
}

@media (min-width: 981px) {
  .news-card-body {
    padding-right: 10px;
  }
}

/* ── Splash screen ── */
.splash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  transition: opacity 0.4s ease;
}

.splash.splash--hidden {
  opacity: 0;
  pointer-events: none;
}

.splash-logo {
  width: 120px;
  height: 96px;
}

.splash-progress {
  position: absolute;
  bottom: clamp(36px, 8vh, 64px);
  width: 48px;
  height: 48px;
  transform: rotate(-90deg);
}

.splash-progress__track {
  fill: none;
  stroke: var(--line);
  stroke-width: 3;
}

.splash-progress__fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 125.66;
  stroke-dashoffset: 125.66;
  animation: splash-fill 2s linear forwards;
}

@keyframes splash-fill {
  to {
    stroke-dashoffset: 0;
  }
}

/* ── App watermark ── */
.app-watermark {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 0;
}

.app-watermark__svg {
  width: 340px;
  height: 272px;
  opacity: 0.045;
  filter: blur(6px);
}
