/* CMS workspace. Scoped to #adminView so the public site and guide keep their theme. */
html[data-route="admin"] {
  color-scheme: dark;
  --cms-bg: #101216;
  --cms-surface: #191c22;
  --cms-raised: #25282f;
  --cms-line: #30333b;
  --cms-text: #eeedea;
  --cms-muted: #9b9ea8;
  --cms-accent: #ddc49b;
}
html[data-route="admin"] body { background: var(--cms-bg); }
html[data-route="admin"] body::before,
html[data-route="admin"] body::after { display: none; }
html[data-route="admin"] #adminView {
  width: 100%; max-width: 1440px; min-height: 100vh; margin: 0 auto;
  padding: 24px 32px 48px; color: var(--cms-text); background: transparent;
  font-family: Inter, system-ui, sans-serif; --dim: var(--cms-muted);
}
#adminView *, #adminView *::before, #adminView *::after { box-sizing: border-box; }
#adminView [hidden] { display: none !important; }
html[data-route="admin"] #adminView > .topbar {
  position: sticky; top: 0; z-index: 65; min-height: 68px; margin: 0 0 30px; padding: max(12px, env(safe-area-inset-top, 0px), var(--tg-content-safe-area-inset-top, 0px)) 0 16px;
  border: 0; border-bottom: 1px solid var(--cms-line); border-radius: 0;
  background: var(--cms-bg); box-shadow: 0 -32px 0 0 var(--cms-bg); backdrop-filter: none; transform: none;
}
html[data-route="admin"] { scroll-padding-top: 110px; }
#adminView > .topbar::before, #adminView > .topbar::after { display: none; }
#adminView .brand-name { font-size: 22px; letter-spacing: -.7px; }
#adminView .brand-suffix { color: var(--cms-muted); font-size: 11px; letter-spacing: .12em; }
#adminView .mark-img { width: 46px; height: 46px; object-fit: contain; }
#adminView .top-actions { gap: 10px; }
#adminView #adminAutomation { display: none !important; }
#adminView .admin-app-link { font-size: 10px; }
#adminView .eyebrow { color: var(--cms-muted); font-size: 10px; font-weight: 600; letter-spacing: .13em; background: none; -webkit-text-fill-color: currentColor; }
#adminView :is(h2,h3) { font-family: Inter, system-ui, sans-serif; letter-spacing: -.035em; }
#adminView .admin-title { text-align: left; }
#adminView .admin-title h2 { margin: 8px 0 0; font-size: clamp(24px, 3vw, 32px); line-height: 1.2; }
#adminView .admin-page { min-width: 0; }
#adminView :is(.autopost-panel,.users-panel,.site-stats-page,.automation-panel) { margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
#adminView :is(.reports-panel,.images-panel,.automation-panel) > .admin-title { margin-bottom: 24px; }
#adminView .cms-page-description { max-width: 620px; margin: 12px 0 24px; color: var(--cms-muted); font-size: 13px; line-height: 1.7; }
#adminView :is(button,a,input,textarea,select,summary):focus-visible { outline: 2px solid #ddc49b; outline-offset: 4px; }
#adminView label:has(> input:focus-visible) { outline: 2px solid #ddc49b; outline-offset: 3px; }
#adminView button { -webkit-tap-highlight-color: transparent; }
#adminView :is(.btn,.cms-nav-link) { text-transform: none; letter-spacing: 0; }
#adminView .btn { min-height: 44px; border-radius: 11px; font-size: 13px; }
#adminView .btn.primary { color: #26221d; border: 1px solid #ead6b3; background: linear-gradient(105deg, #ead6b3, #d2b58a); box-shadow: 0 5px 18px #ddc49b20; }
#adminView .btn.primary::before, #adminView .btn.primary::after { display: none; }
#adminView .btn.ghost { background: var(--cms-raised); border: 1px solid var(--cms-line); box-shadow: none; }
#adminView :is(input,select,textarea) { color: var(--cms-text); font-family: inherit; }
#adminView :is(input:not([type="checkbox"]):not([type="radio"]),select,textarea) { min-width: 0; border: 1px solid var(--cms-line); border-radius: 10px; background: #13161c; font-size: 14px; box-shadow: none; }
#adminView input::placeholder, #adminView textarea::placeholder { color: #80849b; }
#adminView select option { color: var(--cms-text); background: #25282f; }
#adminView input[type="file"] { max-width: 100%; font-size: 12px; }
#adminView input[type="file"]::file-selector-button { margin-right: 12px; padding: 8px 12px; border: 0; border-radius: 6px; color: var(--cms-text); background: #30333b; cursor: pointer; }

/* Persistent navigation */
#adminView #adminMenu { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 8px 0; background: transparent; border: 0; box-shadow: none; animation: none; }
#adminView .cms-nav-caption { display: block; padding: 12px 14px; color: #7e8594; font-size: 10px; letter-spacing: .09em; text-transform: uppercase; }
#adminView .cms-nav-link { display: flex; align-items: center; justify-content: flex-start; gap: 12px; width: 100%; min-height: 46px; padding: 12px 14px; color: #9b9ea8; border: 1px solid transparent; border-radius: 10px; background: transparent; font: 500 13px Inter, system-ui, sans-serif; text-align: left; cursor: pointer; box-shadow: none; }
#adminView .cms-nav-link svg { width: 19px; height: 19px; flex: 0 0 19px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
#adminView .cms-nav-link.active { color: #e3cfaf; border-color: #ddc49b28; background: #ddc49b10; }
#adminView .cms-nav-secondary { display: grid; gap: 6px; margin-top: 18px; }
#adminView .cms-nav-more { display: none; }
#adminView .cms-nav-footer { margin: 36px 14px 0; padding-top: 22px; border-top: 1px solid var(--cms-line); color: #c5c9d2; font-size: 11px; }
#adminView .cms-nav-footer small { display: block; margin-top: 9px; color: #7e8594; font-size: 10px; line-height: 1.6; }
#adminView .cms-project-dot { display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: var(--cms-accent); }

/* Overview and consistent data surfaces */
#adminView .admin-home-page { display: grid; grid-template-columns: minmax(0,1fr); gap: 24px; width: 100%; max-width: none; min-width: 0; }
#adminView .admin-home-page > * { width: 100%; min-width: 0; margin-left: 0; margin-right: 0; }
#adminView .overview-head { padding: 0; margin-bottom: 4px; }
#adminView .overview-head h2 { margin-top: 9px; font-size: clamp(27px, 3.2vw, 38px); line-height: 1.2; }
#adminView .overview-head p { color: var(--cms-muted); font-size: 12px; line-height: 1.6; }
#adminView :is(.overview-summary,.overview-projects) { gap: 16px; }
#adminView :is(.overview-summary article,.admin-metrics article,.site-metrics article) { padding: 22px; border: 1px solid var(--cms-line); border-radius: 14px; background: var(--cms-surface); box-shadow: none; }
#adminView :is(.overview-summary,.admin-metrics,.site-metrics) span { min-height: auto; color: #a7aebc; font-size: 11px; line-height: 1.4; font-weight: 500; }
#adminView :is(.overview-summary,.admin-metrics,.site-metrics) strong { margin-top: 16px; font-size: clamp(25px, 3vw, 36px); line-height: 1.1; font-weight: 600; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
#adminView .overview-summary .overview-online { background: linear-gradient(130deg, #98cab508, transparent), var(--cms-surface); border-color: #98cab52b; }
#adminView :is(.overview-summary .overview-online,.metric-online) strong { color: #98cab5; }
#adminView .overview-chart-panel { margin: 0; padding: 26px; background: var(--cms-surface); border: 1px solid var(--cms-line); border-radius: 16px; box-shadow: none; }
#adminView .overview-chart-head { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; margin-bottom: 20px; padding: 0; }
#adminView .overview-chart-head h3 { margin-top: 8px; font-size: 19px; font-weight: 550; }
#adminView .overview-chart-legend { width: 100%; max-width: none; justify-content: flex-start; gap: 16px; padding: 0; font-size: 11px; }
#adminView .overview-chart-legend span { flex: 0 0 auto; white-space: nowrap; }
#adminView :is(#statsPage,#goshowStatsPage) > .admin-title { margin: 0 0 20px; }
#adminView .overview-chart svg { max-height: 320px; }
#adminView .overview-project { padding: 24px; border: 1px solid var(--cms-line); border-radius: 14px; background: var(--cms-surface); box-shadow: none; text-align: left; }
#adminView .overview-project::before { width: 3px; height: auto; inset: 24px auto 24px 0; border-radius: 3px; background: #ddc49b; }
#adminView .overview-project-goshow::before { background: #a5b0c7; }
#adminView .overview-project-name { font-size: 14px; }
#adminView .overview-project strong { margin-top: 14px; font-size: 30px; font-weight: 600; }
#adminView .overview-project small { margin-top: 10px; color: var(--cms-muted); font-size: 12px; line-height: 1.5; }
#adminView .overview-project i { color: var(--cms-muted); background: var(--cms-raised); box-shadow: none; }
#adminView .overview-summary { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); align-items: stretch; }
#adminView .overview-summary article { display: grid; grid-template-rows: minmax(3em,1fr) auto; align-content: start; gap: 12px; grid-column: auto; }
#adminView .overview-summary article > span { min-height: 0; margin: 0; }
#adminView .overview-summary article > strong { margin: 0; }
#adminView .overview-projects { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); align-items: stretch; }
#adminView .overview-project { grid-template-rows: auto auto 1fr; align-content: start; }
#adminView .overview-project-name { padding-right: 32px; }
#adminView .overview-project small { display: grid; gap: 3px; align-content: start; }
#adminView .overview-project i { display: grid; place-items: center; top: 18px; bottom: auto; right: 18px; width: 28px; height: 28px; border-radius: 8px; }
#adminView .overview-project::before { filter: none; }
#adminView .cms-quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
#adminView .cms-quick-actions > div { grid-column: 1 / -1; margin-top: 4px; }
#adminView .cms-quick-actions h3 { margin: 8px 0 2px; font-size: 19px; }
#adminView .cms-quick-actions button { display: flex; align-items: center; gap: 14px; min-width: 0; padding: 18px; border: 1px solid var(--cms-line); border-radius: 12px; color: var(--cms-text); background: transparent; text-align: left; cursor: pointer; }
#adminView .cms-quick-actions strong { display: block; font-size: 12px; font-weight: 550; }
#adminView .cms-quick-actions small { display: block; margin-top: 7px; color: var(--cms-muted); font-size: 11px; line-height: 1.5; }
#adminView .cms-quick-actions b { margin-left: auto; color: #888ca5; }
#adminView .cms-action-symbol { display: grid; place-items: center; width: 36px; height: 36px; flex: 0 0 36px; border-radius: 10px; color: #ddc49b; background: #ddc49b12; font-size: 20px; }
#adminView .analytics-tabs { position: static; width: min(460px, 100%); margin: 0 0 24px; background: var(--cms-surface); border-color: var(--cms-line); box-shadow: none; }
#adminView .analytics-tab { min-height: 42px; font-size: 12px; }
#adminView .analytics-tab.active { color: #eeedea; background: #30333b; box-shadow: none; }
#adminView :is(.user-filter-chips,.site-breakdown-tabs) { gap: 8px; margin-top: 18px; }
#adminView .user-filter-chips button { min-height: 36px; padding: 8px 13px; font-size: 11px; box-shadow: none; }
#adminView :is(.user-card,.autopost-card,.report-card,.site-visit-row,.automation-rule,.campaign-panel,.site-funnel-panel) { border-color: var(--cms-line); border-radius: 12px; background: var(--cms-surface); box-shadow: none; }
#adminView .user-card { padding: 16px; }
#adminView .user-card.online { border-color: #98cab536; background: linear-gradient(90deg, #98cab50b, transparent), var(--cms-surface); box-shadow: none; }
#adminView .user-card.blocked { border-color: #fa819136; background: linear-gradient(90deg, #fa81910b, transparent), var(--cms-surface); box-shadow: none; }
#adminView .admin-metrics, #adminView .site-metrics { gap: 12px; margin: 0 0 24px; }
#adminView .site-funnel-panel, #adminView .campaign-panel { padding: 22px; margin: 18px 0; }
#adminView .site-retention, #adminView .reports-retention, #adminView .automation-hint { color: var(--cms-muted); font-size: 12px; line-height: 1.6; }

/* Message composer */
#adminView .cms-draft-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 22px; }
#adminView .cms-draft-toolbar > span { flex: 1 1 180px; color: var(--cms-muted); font-size: 11px; line-height: 1.6; }
#adminView .cms-draft-toolbar button { min-height: 36px; padding: 8px 12px; color: #d5d7e6; border: 1px solid var(--cms-line); border-radius: 8px; background: var(--cms-surface); font: 500 11px Inter, system-ui, sans-serif; cursor: pointer; }
#adminView .cms-composer-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(260px, 1fr); align-items: start; gap: 24px; margin-bottom: 40px; }
#adminView #autopostForm { min-width: 0; gap: 20px; margin: 0; padding: 22px; border: 1px solid var(--cms-line); border-radius: 16px; background: var(--cms-surface); }
#adminView #autopostForm label > span { color: #bac0d4; font-size: 12px; font-weight: 500; }
#adminView #autopostForm :is(.localized-posts,.autopost-target) { padding: 0; border: 0; border-radius: 0; background: transparent; }
#adminView #autopostForm legend { margin-bottom: 12px; padding: 0; color: #bac0d4; font-size: 12px; font-weight: 500; }
#adminView .autopost-target label { min-height: 46px; border-color: var(--cms-line); background: #13161c; }
#adminView .autopost-target label:has(input:checked) { border-color: #ee76b26b; background: #ddc49b10; box-shadow: none; }
#adminView .autopost-target label span { margin: 0; font-size: 11px; }
#adminView #autopostForm .localized-posts { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
#adminView .localized-posts > label b { display: none; }
#adminView .localized-posts textarea { min-height: 220px; padding: 15px; font-size: 14px; line-height: 1.7; }
#adminView .cms-language-tabs { display: flex; gap: 5px; padding: 4px; border-radius: 10px; background: #0e0f18; }
#adminView .cms-language-tabs button { display: flex; align-items: center; justify-content: center; gap: 6px; flex: 1; min-width: 0; min-height: 38px; border: 0; border-radius: 7px; color: #989eb9; background: transparent; font: 600 11px Inter, system-ui, sans-serif; cursor: pointer; }
#adminView .cms-language-tabs button[aria-selected="true"] { color: #fafaff; background: #2c2d40; box-shadow: 0 2px 6px #0003; }
#adminView .cms-language-tabs i { width: 4px; height: 4px; border-radius: 50%; background: #555a72; }
#adminView .cms-language-tabs .is-complete i { background: #98cab5; }
#adminView .cms-editor-meta { display: flex; justify-content: space-between; gap: 8px; color: var(--cms-muted); font-size: 10px; font-variant-numeric: tabular-nums; }
#adminView .audience-field small { color: #a2cde1; font-size: 11px; }
#adminView .autopost-switch { display: grid; grid-template-columns: 1fr 1fr; }
#adminView .autopost-switch label { border-radius: 9px; min-height: 44px; background: #13161c; }
#adminView .autopost-switch label:has(input:checked) { background: #ddc49b10; border-color: #ee76b26b; }
#adminView .autopost-switch label span, #adminView .autopost-days label span { margin: 0; font-size: 11px; }
#adminView .cms-schedule-time { align-items: center; }
#adminView .cms-schedule-time p { color: #bec2d5; font-size: 11px; line-height: 1.6; }
#adminView .cms-schedule-time small { color: var(--cms-muted); font-size: 10px; }
#adminView .autopost-days label { border-radius: 8px; min-height: 36px; }
#adminView .autopost-buttons .toggle-row { max-width: none; min-height: 48px; padding: 12px; border-radius: 10px; background: #13161c; }
#adminView .autopost-buttons .toggle-row span { margin: 0; }
#adminView .cms-send-summary { padding-top: 16px; border-top: 1px solid var(--cms-line); color: #bfc3d7; font-size: 11px; line-height: 1.7; }
#adminView #autopostSubmit { width: 100%; min-height: 48px; }
#adminView .cms-preview { position: sticky; top: 24px; min-width: 0; padding: 20px; border: 1px solid var(--cms-line); border-radius: 16px; background: #11121b; }
#adminView .cms-preview-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
#adminView #cmsPreviewLanguage { padding: 4px 7px; border: 1px solid var(--cms-line); border-radius: 5px; color: var(--cms-muted); font-size: 10px; }
#adminView .cms-preview-chat { padding: 16px; border: 1px solid #292e41; border-radius: 14px; background: #18202d; }
#adminView .cms-preview-chat-head { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
#adminView .cms-preview-avatar { display: grid; place-items: center; flex: 0 0 34px; height: 34px; border-radius: 50%; color: #ffe1f0; background: #8b426c; font-size: 11px; font-weight: 600; }
#adminView .cms-preview-chat-head strong { display: block; font-size: 12px; }
#adminView .cms-preview-chat-head small { display: block; margin-top: 4px; color: #9faec4; font-size: 10px; }
#adminView .cms-message-bubble { min-width: 0; padding: 14px; border-radius: 12px 12px 12px 3px; background: #273345; }
#adminView #cmsPreviewText { margin: 0; color: #eff3fb; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; line-height: 1.65; }
#adminView #cmsPreviewText.is-placeholder { color: #a9b5c9; }
#adminView .cms-message-time { display: block; margin-top: 12px; color: #9daec6; text-align: right; font-size: 9px; }
#adminView #cmsPreviewMedia { margin: -8px -8px 12px; }
#adminView #cmsPreviewMedia :is(img,video) { display: block; width: 100%; max-height: 260px; object-fit: contain; border-radius: 7px; background: #141b26; }
#adminView .cms-preview-app-button { margin-top: 5px; padding: 12px 6px; color: #dce9fa; border-radius: 4px 4px 10px 10px; background: #31425a; text-align: center; font-size: 11px; }
#adminView .cms-preview-note { margin: 16px 0 0; color: var(--cms-muted); font-size: 11px; line-height: 1.7; }
#adminView .admin-login { max-width: 420px; margin: clamp(32px, 9vh, 110px) auto; padding: 32px; border: 1px solid var(--cms-line); border-radius: 20px; background: var(--cms-surface); box-shadow: 0 24px 80px #0003; }
#adminView .admin-login .admin-title { text-align: center; }
#adminView .admin-login-form { gap: 20px; }
#adminView .admin-login-form input { min-height: 46px; margin-top: 8px; }

/* All statistics tabs share the same outer edges and funnel component. */
#adminView :is(#statsPage,#siteStatsPage,#goshowStatsPage) { width: 100%; max-width: none; min-width: 0; }
#adminView :is(#statsPage,#goshowStatsPage,#siteStatsPage) :is(.admin-metrics,.site-metrics) { display: grid; width: 100%; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; }
#adminView :is(#statsPage,#goshowStatsPage,#siteStatsPage) :is(.admin-metrics,.site-metrics) > article { grid-column: auto; grid-row: auto; width: auto; min-width: 0; margin: 0; }
#adminView :is(#statsPage,#goshowStatsPage) .users-panel { width: 100%; max-width: none; margin: 24px 0 0; padding: 0; border: 0; background: transparent; }
#adminView :is(#statsPage,#goshowStatsPage) :is(.user-cards,.user-filter-chips,.user-card) { width: 100%; max-width: none; min-width: 0; margin-left: 0; margin-right: 0; }
#adminView :is(#statsPage,#goshowStatsPage) .user-cards { display: grid; grid-template-columns: minmax(0,1fr); gap: 10px; }
#adminView :is(#statsPage,#goshowStatsPage) .user-filter-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px; }
#adminView :is(#statsPage,#goshowStatsPage) .user-filter-chips button { flex: 1 1 100px; min-width: 0; min-height: 40px; padding: 10px 8px; font-size: 12px; line-height: 1.4; white-space: normal; }
#adminView :is(#statsPage,#goshowStatsPage) .user-card { padding: 14px; }
#adminView :is(#statsPage,#goshowStatsPage) .user-card-top { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; }
#adminView :is(#statsPage,#goshowStatsPage) .user-card-top > div { flex: 1 1 150px; min-width: 0; }
#adminView :is(#statsPage,#goshowStatsPage) .user-card-top strong { white-space: normal; overflow-wrap: anywhere; font-size: 16px; line-height: 1.4; }
#adminView :is(#statsPage,#goshowStatsPage) .user-card-top small { white-space: normal; overflow-wrap: anywhere; font-size: 12px; line-height: 1.5; }
#adminView :is(#statsPage,#goshowStatsPage) .last-seen { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 6px 10px; padding: 12px; }
#adminView :is(#statsPage,#goshowStatsPage) .last-seen :is(span,b) { min-width: 0; font-size: 12px; line-height: 1.5; white-space: normal; overflow-wrap: anywhere; }
#adminView :is(#statsPage,#goshowStatsPage) .last-seen b { grid-column: 1; text-align: left; }
#adminView :is(#statsPage,#goshowStatsPage) .last-seen::after { grid-column: 2; grid-row: 1 / 3; align-self: center; }
#adminView .site-funnel { display: block; width: 100%; min-width: 0; }
#adminView .funnel-journey { display: grid; gap: 8px; }
#adminView .site-funnel .site-funnel-step { display: grid; grid-template-columns: 28px minmax(0,1fr) 50px 40px; align-items: center; gap: 8px; min-height: 62px; padding: 12px; margin: 0; border: 1px solid var(--cms-line); border-radius: 12px; background: var(--cms-raised); }
#adminView .site-funnel .funnel-step-number { width: 28px; height: 28px; font-size: 10px; }
#adminView .site-funnel .site-funnel-step .funnel-step-body { display: grid; grid-template-columns: minmax(0,1fr); justify-content: stretch; align-items: stretch; width: 100%; min-width: 0; gap: 8px; padding: 0; }
#adminView .site-funnel .funnel-step-body strong { margin: 0; font-size: 13px; line-height: 1.4; white-space: normal; overflow: visible; overflow-wrap: break-word; text-overflow: clip; }
#adminView .site-funnel .funnel-step-body i { width: 100%; height: 4px; margin: 0; }
#adminView .site-funnel .site-funnel-step > b { font-size: 15px; line-height: 1.3; white-space: normal; overflow-wrap: anywhere; }
#adminView .site-funnel .site-funnel-step > small { font-size: 12px; line-height: 1.3; }
#adminView .funnel-result { gap: 12px; margin: 10px 0 0; padding: 12px; font-size: 13px; line-height: 1.5; }
#adminView .funnel-result b { flex-shrink: 0; font-size: 20px; }
@media (max-width: 420px) {
  #adminView :is(#statsPage,#goshowStatsPage,#siteStatsPage) :is(.admin-metrics,.site-metrics) { grid-template-columns: repeat(2,minmax(0,1fr)); }
  #adminView .site-funnel .site-funnel-step { grid-template-columns: 24px minmax(0,1fr) 38px 34px; gap: 6px; padding: 10px 8px; }
  #adminView .site-funnel .funnel-step-number { width: 24px; height: 26px; }
}

@media (min-width: 1000px) {
  html[data-route="admin"] body.admin-authorized #adminView { padding-left: 280px; }
  html[data-route="admin"] body.admin-authorized #adminView > .topbar { width: calc(100% + 248px); margin-left: -248px; }
  #adminView #adminMenu { position: fixed; top: 120px; left: max(32px, calc((100vw - 1440px) / 2 + 32px)); width: 210px; max-height: calc(100dvh - 144px); overflow-y: auto; }
}
@media (max-width: 1199px) and (min-width: 1000px) {
  #adminView .cms-composer-layout { grid-template-columns: minmax(0, 1fr); }
  #adminView .cms-preview { position: static; }
}
@media (max-width: 999px) {
  html[data-route="admin"] #adminView { padding: calc(16px + var(--tg-content-safe-area-inset-top, 0px)) 22px calc(108px + env(safe-area-inset-bottom, 0px)); }
  #adminView #adminMenu { position: fixed; inset: auto 0 0; z-index: 60; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2px; padding: 8px 10px calc(8px + max(env(safe-area-inset-bottom, 0px), var(--tg-content-safe-area-inset-bottom, 0px))); border-top: 1px solid #33364c; background: #12151af5; backdrop-filter: blur(18px); }
  #adminView .cms-nav-caption, #adminView .cms-nav-footer { display: none; }
  #adminView .cms-nav-link { flex-direction: column; justify-content: center; gap: 6px; min-height: 54px; padding: 6px 2px; border-radius: 9px; font-size: 10px; text-align: center; }
  #adminView .cms-nav-link svg { width: 20px; height: 20px; }
  #adminView .cms-nav-more { display: flex; }
  #adminView .cms-nav-secondary { display: none; position: absolute; bottom: calc(100% + 8px); right: 12px; width: 228px; padding: 8px; margin: 0; border: 1px solid var(--cms-line); border-radius: 14px; background: #25282f; box-shadow: 0 16px 48px #0006; }
  #adminView #adminMenu.is-expanded .cms-nav-secondary { display: grid; }
  #adminView .cms-nav-secondary .cms-nav-link { flex-direction: row; justify-content: flex-start; gap: 12px; padding: 12px; font-size: 13px; text-align: left; }
  #adminView .overview-summary article { padding: 20px 16px; }
  html[data-route="admin"] #toast { bottom: calc(100px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 699px) {
  html[data-route="admin"] #adminView { padding-right: 16px; padding-left: 16px; }
  html[data-route="admin"] #adminView > .topbar { min-height: 55px; margin-bottom: 26px; padding-bottom: 12px; }
  #adminView .brand-name { font-size: 19px; }
  #adminView .mark-img { width: 39px; height: 39px; }
  #adminView .brand-suffix { font-size: 9px; }
  #adminView .overview-head { align-items: start; }
  #adminView .overview-head p { display: none; }
  #adminView .admin-home-page { gap: 18px; }
  #adminView :is(.overview-summary,.overview-projects) { gap: 9px; }
  #adminView :is(.overview-summary article,.admin-metrics article,.site-metrics article) { padding: 16px 12px; border-radius: 12px; }
  #adminView :is(.overview-summary,.admin-metrics,.site-metrics) span { min-height: 2.8em; font-size: 10px; }
  #adminView :is(.overview-summary,.admin-metrics,.site-metrics) strong { margin-top: 9px; font-size: 26px; }
  #adminView .overview-chart-panel { padding: 18px 12px 12px; }
  #adminView .overview-chart-head { flex-wrap: wrap; gap: 14px; padding: 0 4px; }
  #adminView .overview-chart-head h3 { font-size: 17px; }
  #adminView .overview-chart-legend { gap: 14px; font-size: 10px; }
  #adminView .overview-project { padding: 18px 14px; }
  #adminView .overview-project-name { font-size: 12px; }
  #adminView .overview-project small { font-size: 10px; }
  #adminView .overview-project i { right: 12px; top: 14px; width: 24px; height: 24px; font-size: 15px; }
  #adminView .overview-summary article { padding: 14px 10px; gap: 10px; grid-template-rows: minmax(42px,1fr) auto; }
  #adminView .overview-summary article > strong { font-size: clamp(18px,4.8vw,26px); }
  #adminView .overview-summary article > span { min-height: 0; font-size: 10px; line-height: 1.4; }
  #adminView .cms-quick-actions { grid-template-columns: minmax(0, 1fr); }
  #adminView .cms-quick-actions button { padding: 16px; }
  #adminView .cms-composer-layout { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  #adminView #autopostForm { padding: 16px; gap: 18px; }
  #adminView .cms-preview { position: static; padding: 16px; }
  #adminView .cms-draft-toolbar { margin-bottom: 18px; }
  #adminView .cms-draft-toolbar > span { flex-basis: 100%; }
  #adminView .site-funnel-panel, #adminView .campaign-panel { padding: 14px; }
  #adminView .admin-login { padding: 26px 20px; }
}
@media (prefers-reduced-motion: reduce) {
  #adminView *, #adminView *::before, #adminView *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media (hover: hover) {
  #adminView .cms-nav-link:hover { color: var(--cms-text); background: #ffffff07; }
  #adminView .cms-nav-link.active:hover { color: #e3cfaf; background: #ddc49b18; }
  #adminView .cms-quick-actions button:hover, #adminView .overview-project:hover { border-color: #676079; background: #20232a; transform: translateY(-1px); }
  #adminView .cms-draft-toolbar button:hover { border-color: #676079; }
}

/* Authenticated Live Stars support inbox. */
#adminView .chat-nav { position: relative; }
#adminView #chatNavBadge { position: absolute; right: 8px; top: 3px; padding: 2px 5px; border-radius: 12px; background: #ddc49b; color: #26221d; font-size: 10px; line-height: 1.5; }
#adminView .support-page { width: 100%; min-width: 0; }
#adminView .support-page [hidden] { display: none !important; }
#adminView .support-page :is(button,input,textarea,select) { font: inherit; box-sizing: border-box; }
#adminView .support-page button, #adminView .chat-user-link { min-height: 40px; padding: 9px 13px; border: 1px solid #30333b; border-radius: 9px; background: #25282f; color: #eeedea; cursor: pointer; line-height: 1.35; }
#adminView .support-page button:hover { border-color: #ddc49b; }
#adminView .support-page :is(button,input,textarea,select):focus-visible { outline: 2px solid #ddc49b; outline-offset: 3px; }
#adminView .support-page button:disabled { opacity: .55; cursor: default; }
#adminView .chat-page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
#adminView .chat-page-head h2 { font-size: clamp(24px,3vw,32px); line-height: 1.25; margin: 6px 0; }
#adminView .chat-page-head p { margin: 0; font-size: 13px; color: #b7b9cd; }
#adminView .chat-feedback { margin: 0 0 12px; font-size: 13px; color: #8ee1c0; overflow-wrap: anywhere; }
#adminView .chat-feedback:empty { display: none; }
#adminView .chat-feedback.is-error { color: #ffb6c3; }
#adminView .chat-workspace { display: grid; grid-template-columns: minmax(230px,.72fr) minmax(0,1.28fr); border: 1px solid #30333b; border-radius: 16px; overflow: hidden; background: #191c22; min-height: 620px; }
#adminView .chat-sidebar { border-right: 1px solid #30333b; min-width: 0; padding: 16px; }
#adminView .chat-search { display: grid; gap: 8px; font-size: 12px; color: #b7b9cd; }
#adminView .support-page :is(input[type=search],textarea,select) { width: 100%; min-width: 0; border: 1px solid #373b45; border-radius: 9px; padding: 11px 12px; color: #eeedea; background: #13161c; font-size: 14px; }
#adminView .chat-filters { display: flex; flex-wrap: wrap; gap: 6px; padding: 14px 0; }
#adminView .chat-filters button { font-size: 11px; min-height: 36px; padding: 8px; background: transparent; }
#adminView .chat-filters button[aria-pressed=true] { color: #e3cfaf; background: #2b2823; border-color: #66573e; }
#adminView .chat-list { display: grid; align-content: start; gap: 7px; max-height: 650px; overflow-y: auto; }
#adminView button.chat-ticket { display: flex; text-align: left; align-items: start; gap: 9px; width: 100%; padding: 12px 9px; background: transparent; border: 1px solid transparent; }
#adminView button.chat-ticket.is-selected { background: #242321; border-color: #66573e; }
#adminView .chat-avatar { display: grid; place-items: center; width: 32px; height: 32px; flex: 0 0 32px; border-radius: 10px; background: #302b24; color: #ddc49b; font-size: 15px; }
#adminView .chat-ticket-content { min-width: 0; flex: 1; display: grid; gap: 5px; }
#adminView .chat-ticket-content strong { color: #eeedea; font-size: 14px; overflow-wrap: anywhere; }
#adminView .chat-ticket-content > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; color: #b7b9cd; }
#adminView .chat-ticket-content small { font-size: 10px; color: #a6abc1; line-height: 1.5; }
#adminView .chat-unread { background: #ddc49b; color: #26221d; min-width: 20px; padding: 3px 5px; font-size: 10px; border-radius: 10px; text-align: center; }
#adminView .chat-placeholder { display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 28px; }
#adminView .chat-placeholder-icon { color: #c2aa87; font-size: 44px; }
#adminView .chat-placeholder h3 { font-size: 21px; margin: 20px 0 8px; }
#adminView .chat-placeholder p { color: #b7b9cd; max-width: 320px; font-size: 14px; line-height: 1.65; }
#adminView .chat-thread { min-width: 0; padding: 20px; }
#adminView #chatBack { margin-bottom: 16px; font-size: 12px; }
#adminView .chat-thread-head { display: flex; flex-wrap: wrap; align-items: start; justify-content: space-between; gap: 10px; }
#adminView .chat-thread-head > div { min-width: 0; flex: 1 1 180px; }
#adminView .chat-thread-head h3 { margin: 0 0 7px; font-size: 20px; line-height: 1.3; overflow-wrap: anywhere; }
#adminView .chat-thread-head p { margin: 0; font-size: 12px; color: #b7b9cd; overflow-wrap: anywhere; }
#adminView #chatStatus { font-size: 11px; }
#adminView .chat-context { font-size: 11px; line-height: 1.6; color: #a6abc1; padding: 12px 0; margin: 0; border-bottom: 1px solid #30333b; }
#adminView .chat-messages { display: flex; flex-direction: column; gap: 12px; height: clamp(420px,55dvh,700px); overflow-y: auto; overscroll-behavior: contain; padding: 18px 3px; }
#adminView .chat-message { max-width: 90%; min-width: 0; padding: 11px 14px; background: #20242c; border: 1px solid #30333b; border-radius: 13px 13px 13px 3px; align-self: flex-start; flex-shrink: 0; }
#adminView .chat-message.from-admin { align-self: flex-end; background: #2a2722; border-color: #554a38; border-radius: 13px 13px 3px 13px; }
#adminView .chat-message.from-system { align-self: center; max-width: 100%; text-align: center; background: transparent; border: 0; padding: 5px 12px; }
#adminView .chat-message.from-system p { font-size: 12px; color: #b7b9cd; }
#adminView .chat-message.from-system time { text-align: center; }
#adminView .chat-message.from-system small { display: none; }
#adminView .chat-lifecycle { padding: 10px 0; color: #ddc49b; font-size: 12px; }
#adminView .chat-lifecycle p { margin: 0 0 6px; line-height: 1.5; }
#adminView .chat-message small { font-size: 10px; color: #b7aa95; }
#adminView .chat-message p { margin: 6px 0 9px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.6; color: #eeedea; }
#adminView .chat-message time { display: block; text-align: right; font-size: 10px; color: #9b9ea8; }
#adminView .chat-media { margin: 10px 0; }
#adminView .chat-media :is(img,video,audio) { display: block; max-width: 100%; max-height: 340px; border-radius: 8px; }
#adminView .chat-media a { color: #e3cfaf; }
#adminView .chat-media button { font-size: 12px; }
#adminView .chat-composer { display: grid; gap: 9px; padding-top: 14px; border-top: 1px solid #30333b; }
#adminView .chat-composer label { font-size: 12px; color: #ccc9d8; }
#adminView .chat-template-label { display: grid; gap: 6px; }
#adminView .chat-composer textarea { resize: vertical; min-height: 88px; max-height: 240px; line-height: 1.5; }
#adminView .chat-compose-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
#adminView #chatCount { margin-left: auto; color: #a6abc1; font-size: 10px; }
#adminView #chatSend { background: #ddc49b; border-color: #ddc49b; color: #26221d; font-weight: 700; }
#adminView .chat-file-button { position: relative; padding: 11px 10px; border: 1px solid #373b45; border-radius: 9px; cursor: pointer; overflow: hidden; }
#adminView .chat-file-button:focus-within { outline: 2px solid #ddc49b; }
#adminView .chat-file-button input { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }
#adminView #chatComposerHint { font-size: 11px; line-height: 1.5; color: #a6abc1; margin: 0; }
#adminView .chat-attachment-row { display: flex; gap: 8px; align-items: center; overflow-wrap: anywhere; font-size: 12px; }
#adminView .chat-attachment-row:has(#chatAttachment:empty) { display: none; }
#adminView .chat-empty { padding: 16px; font-size: 13px; line-height: 1.7; color: #b7b9cd; }
#adminView .chat-user-link { margin-top: 12px; font-size: 12px; color: #ddc49b; background: transparent; }
@media (max-width: 999px) {
  #adminView #adminMenu { grid-template-columns: repeat(5,minmax(0,1fr)); }
}
@media (max-width: 760px) {
  #adminView .chat-workspace { grid-template-columns: minmax(0,1fr); min-height: 360px; }
  #adminView .chat-sidebar { border: 0; padding: 12px; }
  #adminView .chat-placeholder { display: none; }
  #adminView .support-page:not(.chat-open) .chat-thread { display: none; }
  #adminView .support-page.chat-open .chat-sidebar { display: none; }
  #adminView .chat-thread { padding: 12px; }
  #adminView .chat-list { max-height: none; }
  #adminView .chat-message { max-width: 94%; }
  #adminView .chat-page-head .eyebrow { font-size: 9px; }
  #adminView .chat-page-head button { font-size: 12px; }
  #adminView .chat-messages { height: clamp(200px,36dvh,360px); }
  #adminView .chat-compose-actions { gap: 5px; }
  #adminView #chatSend { padding: 10px; font-size: 12px; }
  #adminView .support-page.chat-open .chat-page-head { display: none; }
  #adminView .support-page.chat-open .chat-workspace { height: auto; min-height: 0; }
  #adminView .support-page.chat-open .chat-thread { display: flex; flex-direction: column; min-height: 0; }
  #adminView .support-page.chat-open #chatBack { align-self: flex-start; flex: 0 0 auto; margin-bottom: 12px; }
  #adminView .support-page.chat-open #chatBody { display: flex; flex-direction: column; flex: 1; min-height: 0; }
  #adminView .support-page.chat-open .chat-messages { flex: 0 0 auto; height: clamp(320px,calc(100dvh - 390px),700px); min-height: 320px; }
  #adminView .support-page.chat-open .chat-composer { flex: 0 0 auto; gap: 7px; padding-top: 10px; }
  #adminView .support-page.chat-open .chat-composer textarea { min-height: 64px; height: 64px; }
  #adminView .support-page.chat-open .chat-template-label { grid-template-columns: auto minmax(0,1fr); align-items: center; gap: 9px; }
  #adminView .support-page.chat-open .chat-template-label select { font-size: 12px; padding: 9px; }
  #adminView .support-page.chat-open .chat-thread-head h3 { font-size: 17px; }
  #adminView .support-page.chat-open #chatOlder { align-self: center; min-height: 30px; padding: 6px 10px; font-size: 11px; }
}

/* Compact controls leave room for the conversation; extra information stays available. */
#adminView .chat-person-details { border-bottom: 1px solid #30333b; padding: 2px 0 8px; }
#adminView :is(.chat-person-details,.chat-templates) summary { cursor: pointer; color: #c7bdd1; font-size: 12px; padding: 7px 0; min-height: 32px; }
#adminView #chatPersonMeta { color: #b7b9cd; font-size: 12px; overflow-wrap: anywhere; }
#adminView .chat-person-details .chat-context { border: 0; padding: 4px 0; }
#adminView .chat-thread-head { align-items: center; flex-wrap: nowrap; gap: 8px; }
#adminView .chat-profile-avatar { display:grid;place-items:center;flex:0 0 42px;width:42px;height:42px;overflow:hidden;border:1px solid #ffffff22;border-radius:50%;background:#302b24;color:#ddc49b;font-size:17px;font-weight:650; }
#adminView .chat-profile-avatar img { display:block;width:100%;height:100%;object-fit:cover; }
#adminView .chat-thread-head > div { flex: 1 1 0; }
#adminView .chat-thread-head h3 { margin: 0; }
#adminView #chatStatus { flex: 0 0 auto; padding: 8px 10px; min-height: 36px; }
#adminView #chatBack { padding: 7px 10px; min-height: 36px; margin-bottom: 8px; }
#adminView .chat-composer textarea { min-height: 60px; height: 60px; padding: 10px 12px; }
#adminView .chat-template-label { padding-bottom: 8px; }
#adminView .chat-feedback { font-size: 12px; line-height: 1.5; }
@media (max-width: 999px) {
  html[data-route="admin"] { scroll-padding-bottom: 110px; }
  #adminView .chat-composer { scroll-margin-bottom: 110px; }
  #adminView .chat-composer :is(button,textarea,select,input) { scroll-margin-block: 120px; }
}
#adminView .user-journey { display:grid; gap:12px; margin:14px 0; }
#adminView .user-journey-chips { display:flex; flex-wrap:wrap; gap:7px; }
#adminView .user-journey-chips > span { padding:5px 9px; border:1px solid #a9a4b52a; border-radius:8px; background:#a9a4b50c; font-size:11px; line-height:1.4; }
#adminView .user-journey-chips > .converted { color:#98cab5; border-color:#98cab533; background:#98cab50c; }
#adminView .user-first-start { display:flex; flex-wrap:wrap; justify-content:space-between; gap:4px 12px; font-size:12px; line-height:1.6; }
#adminView .user-first-start > span { opacity:.65; }
#adminView .user-first-start time { font-weight:500; font-variant-numeric:tabular-nums; }
#adminView .user-journey-track { height:3px; border-radius:3px; overflow:hidden; background:#a9a4b522; }
#adminView .user-journey-track i { display:block; height:100%; background:linear-gradient(90deg,#a5b0c7,#ddc49b); border-radius:inherit; }
