.dash-filter-toggle { display: none; }
#dash-extra-filters { display: contents; }
.desktop [data-tauri-drag-region="deep"] { -webkit-user-select: none; user-select: none; }
.desktop [data-tauri-drag-region="deep"] :is(input, textarea, select, [contenteditable]) { -webkit-user-select: text; user-select: text; }

@media (max-width: 740px) {
  :root {
    --mobile-height: var(--mobile-visual-height, 100dvh);
    --mobile-bottom: calc(58px + env(safe-area-inset-bottom));
    --mobile-gutter: 14px;
    --mobile-control: 44px;
  }

  /* Keep the content and its dialogs above the browser controls and keyboard. */
  .mobile-keyboard-overlay { --mobile-bottom: 0px; --mobile-chat-bottom: 0px; }
  .mobile-keyboard-overlay #mobile-bottom-nav { display: none; }

  .app-shell {
    height: var(--mobile-height);
    padding-bottom: var(--mobile-bottom);
  }

  #main,
  .content-page,
  .inbox-page {
    overflow-x: clip;
  }

  .app-shell.is-unauthed { --mobile-bottom: env(safe-area-inset-bottom); }

  .app-shell:has(.inbox-page.has-mobile-chat) {
    --mobile-bottom: var(--mobile-chat-bottom, env(safe-area-inset-bottom));
  }
  .app-shell:has(.inbox-page.has-mobile-chat) #mobile-bottom-nav { display: none; }
  .app-shell .comments-page.has-mobile-chat .comment-ai-header-actions { display: none !important; }

  .app-shell :is(.inbox-page, .content-page),
  .app-shell.is-unauthed .content-page {
    height: calc(var(--mobile-height) - env(safe-area-inset-top) - var(--mobile-bottom)) !important;
    scrollbar-gutter: auto;
    overscroll-behavior-y: contain;
  }

  /* Only the message history scrolls while a conversation occupies the screen. */
  html:has(body:not(.desktop) #main[data-page="inbox"] .has-mobile-chat),
  body:not(.desktop):has(#main[data-page="inbox"] .has-mobile-chat) {
    overflow: hidden;
    overscroll-behavior: none;
  }

  body:not(.desktop) #app:has(#main[data-page="inbox"] .has-mobile-chat) {
    --mobile-height: var(--chat-viewport-height, 100dvh);
    position: fixed;
    inset: var(--chat-viewport-top, 0px) 0 auto;
    overflow: clip;
  }

  body:not(.desktop) #main[data-page="inbox"] .has-mobile-chat :is(.inbox-body, .chat, .chat-scroll-wrap) {
    min-height: 0;
    overflow: clip;
  }

  body:not(.desktop) #main[data-page="inbox"] .has-mobile-chat .chat-scroll {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior-y: none;
  }

  body:not(.desktop) #main[data-page="inbox"] .has-mobile-chat #message-input {
    max-height: clamp(48px, calc(var(--mobile-height) / 4), 144px);
    resize: none;
  }

  .mobile-keyboard-overlay body:not(.desktop) #main[data-page="inbox"] .has-mobile-chat .composer {
    margin-bottom: 4px;
  }

  .app-shell :is(.tiktoday-body, .content-page > .trends-layout) {
    padding: 12px var(--mobile-gutter) 24px;
  }

  .app-shell :is(.page-title-group, .comment-ai-title-group) h1 {
    font-size: 18px !important;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .app-shell:not(.is-unauthed) .sidebar-toggle-btn {
    display: none !important;
  }

  .app-shell .mobile-drawer-close {
    width: var(--mobile-control);
    height: var(--mobile-control);
    min-width: var(--mobile-control);
    min-height: var(--mobile-control);
  }

  .app-shell :is(.content-page, .inbox-page) .heading-actions { flex-wrap: wrap; }

  .app-shell :is(.heading-actions .button, .composer-toolbar #send-button,
    .comment-composer-actions .button, .knowledge-detail-actions .button,
    .published-pagination .button,
    .connection-group-actions .button, .connection-card .button,
    .settings-form-footer .button, .admin-toolbar :is(.button, input), .news-header-actions .text-button) {
    min-height: var(--mobile-control) !important;
  }

  :is(.app-shell, dialog) :is(.back-mobile, .knowledge-back-mobile,
    .chat-action-btn, .composer-toolbar .icon-button, .admin-row-menu summary,
    #modal-close, #close-post-composer, #trend-keyword-close, #reuse-back) {
    min-height: var(--mobile-control);
    min-width: var(--mobile-control);
  }

  .app-shell :is(.dash-filters-row select,
    #published-account,
    #dash-bar-metric, #shop-sort, #shop-limit,
    #reuse-sort, #trend-platform, #trend-keyword-filter) {
    min-height: var(--mobile-control);
    font-size: 16px !important;
  }

  .app-shell :is(.chat-scroll, .comments-scroll, .knowledge-list-pane, .knowledge-detail-pane) {
    overscroll-behavior-y: contain;
    scrollbar-gutter: auto;
  }

  .app-shell :is(.inbox-list-toolbar, .inbox-subbar, .chat-tabs) { column-gap: 6px; }
  .app-shell .inbox-list-toolbar {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
  }
  .app-shell .inbox-list-toolbar .list-search {
    flex: 1 1 0;
    min-width: 0;
    min-height: 36px;
    height: 36px;
    border-radius: 8px;
  }
  .app-shell .inbox-list-toolbar #search {
    min-width: 0;
    font-size: 13px !important;
  }
  .app-shell .inbox-list-toolbar .inbox-filter-select {
    flex: none;
    width: auto;
    max-width: 118px;
    min-height: 36px !important;
    height: 36px;
    padding: 0 22px 0 8px !important;
    font-size: 13px !important;
    border-radius: 8px;
  }
  .app-shell .inbox-list-toolbar .list-sync-btn {
    flex: none;
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
    border-radius: 8px;
  }
  .app-shell .inbox-subbar {
    padding: 5px 12px !important;
    flex-wrap: nowrap;
    gap: 6px;
    min-height: 0;
  }
  .app-shell .inbox-subbar .list-status-tabs {
    flex: none;
    display: inline-flex;
    padding: 2px;
    border-radius: 8px;
  }
  .app-shell .inbox-subbar .list-status-tabs .tab {
    min-height: 28px !important;
    height: 28px;
    padding: 0 8px !important;
    font-size: 12px;
    border-radius: 6px;
    white-space: nowrap;
  }
  .app-shell :is(#admin-search, #knowledge-search, #shop-query),
  #post-composer-dialog :is(input[type="search"], input[type="datetime-local"], textarea) { font-size: 16px !important; }
  .app-shell .inbox-page .chat-tabs { padding: 6px 8px; flex-shrink: 0; }
  .app-shell .inbox-page .chat-tab-items { min-width: 0; flex: 1; gap: 8px; }
  .app-shell .inbox-page .chat-contact { min-width: 0; flex: 1; }
  .chat-contact-head { flex-wrap: nowrap; align-items: baseline; gap: 5px; min-width: 0; }
  .chat-contact-head > strong { flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .app-shell .inbox-page .chat-contact-meta { flex-wrap: nowrap; min-width: 0; overflow: hidden; }
  .app-shell .inbox-page .chat-reply-pill { min-width: 0; max-width: 100%; }
  .app-shell .inbox-page .chat-reply-pill > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .composer-wrap { padding-bottom: 2px; }
  .app-shell .inbox-page:not(.comments-page) .composer {
    margin: 4px 10px max(8px, env(safe-area-inset-bottom));
    min-height: 0;
    padding: 8px 10px 6px;
    border-radius: 14px;
  }
  .app-shell .inbox-page:not(.comments-page) .composer textarea { min-height: 24px; line-height: 1.45; }
  /* Comments tab: ultra-minimal mobile hierarchy */
  .hide-mobile-text { display: none; }
  .app-shell .comments-page,
  .app-shell .comments-page #chat,
  .app-shell .comments-page #comment-activity {
    background: #fff !important;
  }
  .app-shell .comments-page .comment-ai-header {
    padding: 6px 12px 6px !important;
    min-height: 0 !important;
    row-gap: 6px;
    background: #fff;
    border-bottom: 0;
  }
  .desktop .app-shell .comments-page .comment-ai-header {
    padding-right: 12px !important;
  }
  .desktop .app-shell .comments-page .comment-ai-title-group h1 {
    padding-right: 90px;
  }
  .app-shell .comments-page .comment-ai-title-group {
    gap: 6px 8px;
  }
  .app-shell .comments-page .comment-ai-title-group h1 {
    font-size: 16.5px !important;
    line-height: 1.25;
  }
  .app-shell .comments-page .comment-workspace-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2px;
    flex-basis: 100%;
    width: 100%;
    margin: 0;
    padding: 2px;
    border: 0;
    border-radius: 8px;
    background: #f4f4f5;
  }
  .app-shell .comments-page .comment-workspace-tabs button {
    min-height: 28px !important;
    height: 28px;
    padding: 0 8px;
    border: 0;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    color: #71717a;
    background: transparent;
  }
  .app-shell .comments-page .comment-workspace-tabs button[aria-selected="true"] {
    background: #fff !important;
    color: #18181b !important;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .06);
  }
  .app-shell .comments-page #comment-activity {
    padding: 0 12px 16px !important;
  }
  .app-shell .comments-page .comment-activity-bar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 0;
    margin-bottom: 0;
    gap: 0;
  }
  .app-shell .comments-page .comment-activity-meta {
    order: -1;
    padding: 4px 0 6px;
    width: 100%;
    border-bottom: 1px solid #f1f0ee;
  }
  .app-shell .comments-page:not(.show-ai-activity) .comment-ai-header-actions {
    padding: 4px 12px 6px;
    border-bottom: 1px solid #f1f0ee;
    background: #fff;
  }
  .app-shell .comments-page .comment-ai-header-actions {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start !important;
    width: 100%;
    gap: 6px;
  }
  .app-shell .comments-page .comment-activity-meta .comment-ai-header-actions {
    padding: 0;
  }
  .app-shell .comments-page .comment-ai-header-actions :is(.button, .comment-ai-toggle) {
    min-height: 28px !important;
    height: 28px;
    font-size: 12px;
    white-space: nowrap;
  }
  .app-shell .comments-page .comment-ai-toggle {
    padding: 0 2px;
    gap: 6px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #3f3f46;
  }
  .app-shell .comments-page .comment-ai-toggle:hover {
    background: transparent;
  }
  .app-shell .comments-page #comment-ai-refresh {
    flex: none;
    width: 28px;
    min-width: 28px;
    padding: 0;
    justify-content: center;
    border: 0;
    background: transparent;
    color: #71717a;
    border-radius: 7px;
  }
  .app-shell .comments-page #comment-ai-refresh > span { display: none; }
  .app-shell .comments-page #reviewed-comment-new {
    margin-left: auto;
    padding: 0 11px;
    gap: 4px;
    border-radius: 999px;
    flex-shrink: 0;
  }
  .app-shell .comments-page .comment-ai-overview {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 10px;
    width: 100%;
    padding: 0 2px;
    border-bottom: 1px solid #f1f0ee;
  }
  .app-shell .comments-page .comment-ai-overview::-webkit-scrollbar { display: none; }
  .app-shell .comments-page .comment-ai-overview button {
    flex: none;
    min-height: 30px !important;
    height: 30px;
    padding: 0 1px;
    gap: 4px;
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    background: transparent !important;
    color: #71717a;
    font-size: 11.5px;
    white-space: nowrap;
  }
  .app-shell .comments-page .comment-ai-overview button strong {
    min-width: 0;
    height: auto;
    padding: 0;
    background: transparent !important;
    color: inherit;
    opacity: .72;
    font-size: 11px;
    font-weight: 600;
  }
  .app-shell .comments-page .comment-ai-overview button[aria-pressed="true"] {
    background: transparent !important;
    color: #e03313 !important;
    border-bottom-color: #e03313;
    font-weight: 600;
  }
  .app-shell .comments-page .comment-ai-overview button[aria-pressed="true"] span {
    color: inherit;
  }
  .app-shell .comments-page .comment-ai-overview button[aria-pressed="true"] strong {
    opacity: .95;
    color: inherit;
  }
  .app-shell .comments-page .comment-activity-list {
    border: 0;
    border-radius: 0;
    background: #fff;
  }
  .app-shell .comments-page .comment-activity-list .comment-activity-card {
    padding: 11px 0 !important;
    border-top: 0;
    border-bottom: 1px solid #f1f0ee;
  }
  .app-shell .comments-page .comment-activity-list .comment-activity-card:last-child {
    border-bottom: 0;
  }
  .app-shell .comments-page .comment-activity-card header {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    grid-template-rows: auto auto;
    align-items: center;
    gap: 1px 6px;
  }
  .app-shell .comments-page .comment-activity-card .platform-badge {
    grid-column: 1;
    grid-row: 1;
    padding: 0;
    border: 0;
    background: transparent;
    gap: 0;
  }
  .app-shell .comments-page .comment-activity-card .platform-badge > span { display: none; }
  .app-shell .comments-page .comment-activity-card header strong {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ink);
  }
  .app-shell .comments-page .comment-activity-card .comment-ai-status {
    grid-column: 3;
    grid-row: 1;
    font-size: 10.5px;
    padding: 2px 6px;
    border-radius: 5px;
    white-space: nowrap;
  }
  .app-shell .comments-page .comment-activity-card .entry-open {
    grid-column: 4;
    grid-row: 1 / span 2;
    align-self: center;
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px !important;
    margin-left: 2px;
    border: 0;
    background: transparent;
    color: #8e8e93;
  }
  .app-shell .comments-page .comment-activity-card header time {
    grid-column: 2 / 4;
    grid-row: 2;
    margin: 0;
    justify-self: start;
    font-size: 11px;
    color: #9ca3af;
  }
  .app-shell .comments-page .comment-activity-content {
    margin: 6px 0 0 !important;
    gap: 5px !important;
  }
  .app-shell .comments-page .comment-activity-content small { display: none; }
  .app-shell .comments-page .comment-activity-content p {
    margin: 0 !important;
    font-size: 13px !important;
    line-height: 1.45 !important;
    color: #18181b;
  }
  .app-shell .comments-page .comment-activity-content .comment-activity-answer {
    padding: 1px 0 1px 9px !important;
    border-radius: 0 !important;
    background: transparent !important;
    border-left: 2px solid #e4e4e7 !important;
  }
  .app-shell .comments-page .comment-activity-answer p {
    font-size: 12.5px !important;
    color: #52525b;
  }

  /* Comments manual list & detail */
  .app-shell .comments-page .comments-list-toolbar {
    padding: 6px 12px;
    gap: 6px;
    border-bottom: 1px solid #f1f0ee;
  }
  .app-shell .comments-page .comments-list-toolbar .list-search {
    border: 0;
    background: #f5f5f6;
    height: 34px;
    min-height: 34px;
    border-radius: 8px;
  }
  .app-shell .comments-page .comments-list-toolbar .inbox-filter-select {
    border: 0;
    background: #f5f5f6;
    height: 34px;
    min-height: 34px !important;
    border-radius: 8px;
  }
  .app-shell .comments-page .comments-subbar { display: none; }
  .app-shell .comments-page .post-row {
    padding: 9px 12px;
    gap: 10px;
    border-bottom: 1px solid #f1f0ee;
  }
  .app-shell .comments-page .post-thumb { width: 34px; height: 34px; border-radius: 8px; background: #f5f5f6; }
  .app-shell .comments-page .post-thumb > svg { width: 17px; height: 17px; }
  .app-shell .comments-page .post-row:not(:has(.post-thumbnail)) .post-meta-plat { display: none; }
  .app-shell .comments-page .post-caption { font-size: 13px; line-height: 1.38; font-weight: 550; }
  .app-shell .comments-page .post-row-meta { margin-top: 3px; gap: 6px; font-size: 11px; color: #8e8e93; }

  .app-shell .comments-page .comments-header {
    padding: 6px 12px 6px;
    justify-content: flex-start;
    gap: 4px 8px;
    border-bottom: 1px solid #f1f0ee;
  }
  .app-shell .comments-page .comments-header .back-mobile {
    border: 0;
    background: transparent;
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
  }
  .app-shell .comments-page .comments-header h2 {
    font-size: 15px;
    font-weight: 600;
    margin: 0 auto 0 0;
  }
  .app-shell .comments-page .comments-header-controls {
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr) 30px;
    gap: 5px;
  }
  .app-shell .comments-page .comment-filter-tabs {
    display: flex;
    gap: 14px;
    padding: 0 2px;
    border-radius: 0;
    background: transparent;
    border-bottom: 1px solid #f1f0ee;
  }
  .app-shell .comments-page .comment-filter-tabs .tab {
    flex: none;
    min-height: 28px !important;
    height: 28px;
    padding: 0 1px 2px;
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    background: transparent !important;
    color: #71717a;
    font-size: 12px;
  }
  .app-shell .comments-page .comment-filter-tabs .tab.active {
    color: #e03313 !important;
    border-bottom-color: #e03313;
    font-weight: 600;
  }
  .app-shell .comments-page #comment-ai-filter,
  .app-shell .comments-page #comment-sort {
    min-height: 30px !important;
    height: 30px;
    max-width: none;
    padding: 0 20px 0 8px !important;
    border: 0;
    background: #f5f5f6;
    font-size: 12px !important;
    border-radius: 7px;
  }
  .app-shell .comments-page .comments-header-controls #reload-chat {
    width: 30px;
    height: 30px;
    min-width: 30px;
    min-height: 30px !important;
    border: 0;
    background: #f5f5f6;
    border-radius: 7px;
  }
  .app-shell .comments-page .comments-scroll { padding: 4px 12px 12px !important; }
  .app-shell .comments-page .comments-stream { gap: 0; }
  .app-shell .comments-page .comments-stream > .comment-item {
    padding: 10px 0;
    gap: 9px;
    border: 0;
    border-bottom: 1px solid #f1f0ee;
    border-radius: 0;
    background: transparent;
  }
  .app-shell .comments-page .comments-stream > .comment-item:last-child { border-bottom: 0; }
  .app-shell .comments-page .comments-stream > .comment-item.selected-comment {
    background: #fffaf8;
    margin-inline: -12px;
    padding-inline: 12px;
  }
  .app-shell .comments-page .comment-heading { margin-bottom: 2px; gap: 5px; }
  .app-shell .comments-page .comment-heading strong { font-size: 13px; }
  .app-shell .comments-page .comment-text { font-size: 13px; line-height: 1.45; }
  .app-shell .comments-page .comment-actions { margin-top: 4px; gap: 10px; }
  .app-shell .comments-page .comment-replies { margin: 6px 0 0 2px !important; padding-left: 8px !important; border-left-color: #ecebef; }
  .app-shell .comments-page .comment-replies .comment-item {
    border: 0;
    background: #f7f7f8;
    padding: 7px 10px;
    gap: 7px;
    border-radius: 8px;
    margin-bottom: 4px;
  }
  .app-shell .comments-page .comment-replies .own-comment { background: #fff6f4; }
  .app-shell .comments-page .comment-bottom-composer { padding: 6px 12px max(8px, env(safe-area-inset-bottom)); border-top-color: #f1f0ee; }
  .app-shell .comments-page:not(:has(.reply-context)) .comment-composer {
    padding: 6px 10px;
    border: 0;
    border-radius: 9px;
    background: #f5f5f6;
  }
  .app-shell .comments-page:not(:has(.reply-context)) .comment-composer textarea {
    min-height: 20px;
    height: 20px;
    padding: 0;
    font-size: 12px !important;
    line-height: 20px;
    overflow: hidden;
  }
  .app-shell .comments-page:not(:has(.reply-context)) .comment-composer-actions { display: none; }
  .app-shell .comments-page:has(.reply-context) .comment-composer { padding: 8px 10px; border-radius: 12px; }
  .app-shell .comments-page:has(.reply-context) .comment-composer textarea { min-height: 28px; font-size: 15px !important; line-height: 1.4; }
  .app-shell .comments-page .comment-composer-actions { padding-top: 6px; gap: 6px; }
  .app-shell .comments-page .comment-composer-actions .button {
    min-height: 32px !important;
    height: 32px;
    padding: 0 12px;
    border-radius: 8px;
    font-size: 12px;
  }
  .reviewed-fields { padding: 12px 14px; }
  .reviewed-pickers { gap: 8px; }
  .reviewed-footer { padding: 10px 14px max(12px, env(safe-area-inset-bottom)); gap: 8px; }

  /* Dashboard, publish, and calendar. */
  .dashboard-analytics-page .dash-topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto auto;
    align-items: start;
    gap: 6px;
  }
  .dashboard-analytics-page .dash-filters-row,
  .dashboard-analytics-page .dash-topbar-actions { display: contents !important; }
  .dashboard-analytics-page #dash-days { grid-column: 1; grid-row: 1; }
  .dashboard-analytics-page .dash-filter-toggle {
    display: inline-flex;
    grid-column: 2;
    grid-row: 1;
    justify-content: center;
    min-height: var(--mobile-control);
    padding-inline: 9px;
  }
  .dash-filter-toggle[aria-expanded="true"] { background: #f0ece8; }
  .dash-filter-toggle[aria-expanded="false"] + #dash-extra-filters { display: none; }
  .dashboard-analytics-page #dash-extra-filters {
    display: grid;
    grid-column: 1 / -1;
    grid-row: 2;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }
  .dashboard-analytics-page #dashboard-metrics-status {
    grid-column: 1 / -1;
    grid-row: 3;
    margin: 2px 0 0;
  }
  .dashboard-analytics-page .dash-topbar-actions .button {
    grid-row: 1;
    width: 44px;
    min-height: 44px;
    padding: 0;
  }
  .dashboard-analytics-page #dash-refresh { grid-column: 3; }
  .dashboard-analytics-page #dash-export { grid-column: 4; }
  .dashboard-analytics-page .dash-topbar-actions .button span { display: none; }
  .dash-kpi-cell dd { overflow-wrap: anywhere; }
  .app-shell .dash-filters-row select { padding-inline: 8px 24px; }
  .published-pagination { flex-wrap: wrap; justify-content: center; }
  #published-pages { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; }
  .calendar-shell.calendar-full.is-month .month-grid { min-width: 0; }

  .published-list-table, .published-list-table tbody { display: block; }

  .published-list-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  .published-list-table tbody tr {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px 10px;
    padding: 10px 12px;
    margin-bottom: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
  }

  .published-list-table tbody td {
    display: block;
    min-width: 0;
    padding: 0;
    border: 0;
    text-align: start;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .published-list-table :is(.published-list-caption, .published-list-channel) { grid-column: 1 / -1; }

  .published-list-table .published-list-caption button {
    width: 100%;
    max-width: 100%;
    min-height: var(--mobile-control);
    text-align: start;
    white-space: normal;
  }

  .published-list-table td[data-label]::before {
    display: block;
    content: attr(data-label);
    margin-bottom: 2px;
    color: var(--muted);
    font-size: 11px;
  }

  /* Forms use a single scroll area and keep their actions visible. */
  .publish-page #post-composer-dialog .modal-header { padding: 8px var(--mobile-gutter); }

  #post-form .composer-columns {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
  }

  .publish-page #post-composer-dialog #post-form :is(.post-fields, .composer-sidebar) {
    min-width: 0;
    padding: 12px var(--mobile-gutter);
    border-inline: 0;
  }

  .publish-page #post-composer-dialog #post-form .composer-sidebar { border-top: 1px solid var(--line); }
  #post-composer-dialog #post-account .post-target-list { max-height: none; }
  #post-account .post-platform-group :is(header, .check-row) { min-height: var(--mobile-control); }
  #post-composer-dialog :is(.reuse-button, #post-form input[type="search"], #post-form select, #post-form input[type="datetime-local"], .composer-mode label) { min-height: var(--mobile-control); }
  #post-composer-dialog #post-form .post-publish-bar { flex-wrap: wrap; padding: 8px var(--mobile-gutter); }
  #post-composer-dialog #post-form .post-publish-bar .button { min-height: var(--mobile-control); }
  .publish-page #post-composer-dialog .composer-body { background: #f8f7f5; }
  .publish-page #post-composer-dialog #post-form .composer-columns {
    gap: 8px;
    align-content: start;
  }
  .publish-page #post-composer-dialog #post-form :is(.post-fields, .composer-sidebar) { background: #fff; }
  .publish-page #post-composer-dialog #post-form .caption-editor {
    overflow: hidden;
    border-radius: 10px;
  }
  .publish-page #post-composer-dialog #post-form .caption-editor:focus-within {
    border-color: var(--primary);
  }
  .publish-page #post-composer-dialog #post-content {
    min-height: 108px;
    padding: 12px;
    resize: none;
  }
  .publish-page #post-composer-dialog #post-content:focus { outline: 0; }
  .publish-page #post-composer-dialog #post-form .post-media-drop { min-height: 48px; gap: 6px; }
  #post-composer-dialog .post-media-drop small { display: none; }
  #post-composer-dialog #post-account :is(input[type="search"], select) { border-radius: 7px; }
  #post-composer-dialog #post-form .post-publish-bar #publish-post { flex: 1; justify-content: center; }
  #post-composer-dialog #post-result:empty { display: none; }
  #post-composer-dialog #post-result:not(:empty) {
    flex-basis: 100%;
    max-height: min(5em, 22dvh);
    overflow: auto;
    overflow-wrap: anywhere;
  }

  #post-composer-dialog #reuse-post-view {
    width: 100% !important;
    height: auto !important;
    padding-block: 0;
  }

  .reuse-heading { min-width: 0; }
  .reuse-controls { width: 100%; margin: 0; }
  .reuse-search { flex: 1; width: auto; min-width: 0; height: var(--mobile-control); }
  #post-composer-dialog #reuse-sort { flex-shrink: 0; max-width: 45%; min-height: var(--mobile-control); }

  /* Keep the canvas, edit tabs and final action in one full-screen editor. */
  #modal.design-dialog :is(#modal-content, .modal-body) { height: 100%; min-height: 0; }
  #modal.design-dialog .modal-body { display: flex; flex-direction: column; padding: 0; }
  #modal.design-dialog .modal-body > p:empty { display: none; }
  #modal.design-dialog .modal-header { flex: none; padding: 7px var(--mobile-gutter); }
  #modal.design-dialog .design-workspace { flex: 1; height: auto; }
  #modal.design-dialog .design-controls { min-height: 0; }
  #modal.design-dialog .draft-editor-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 0 var(--mobile-gutter); }
  #modal.design-dialog .draft-editor-scroll { min-height: 0; padding: 12px var(--mobile-gutter); overscroll-behavior-y: contain; }
  #modal.design-dialog :is(.design-assets > *, .design-assets input) { min-width: 0; max-width: 100%; }
  #modal.design-dialog .draft-submit { padding: 8px var(--mobile-gutter); }
  #modal.design-dialog .draft-submit .button { min-height: var(--mobile-control); }

  .mobile-keyboard-overlay #modal.design-dialog .design-preview { display: none; }
  .mobile-keyboard-overlay #modal.design-dialog .design-workspace { grid-template: minmax(0, 1fr) / minmax(0, 1fr); }

  /* Feeds and directories stay readable down to a narrow screen. */
  .competitor-page .competitor-post-actions .button { min-height: var(--mobile-control); white-space: normal; }
  #main .trends-page :is(.trend-tabs button, .trend-filter-actions button, .trend-filter-actions select, .trend-more-filters > summary) { min-height: var(--mobile-control); }
  .trends-page .trend-filter-actions { display: grid; grid-template-columns: minmax(0, 1fr) var(--mobile-control) auto; }
  .trends-page .trend-filter-actions > .form-field { width: 100%; min-width: 0; }
  #main .trends-page #trend-window { width: 100%; max-width: none; }
  .trends-page .trend-more-filters { margin: 0; }
  .trends-page .trend-more-filters > summary { width: var(--mobile-control); }
  .trend-keyword-dialog :is(.button, select, input) { min-height: var(--mobile-control); }

  .tiktoday-top { justify-content: space-between; gap: 8px; padding: 4px 12px 0; }
  .tiktoday-tabs { flex: 1; display: flex; align-items: stretch; gap: 10px; min-width: 0; }
  .tiktoday-tabs button { flex: 0 1 auto; justify-content: center; min-height: var(--mobile-control); min-width: 0; padding-inline: 2px; font-size: 13px; }
  .tiktoday-directory .tiktoday-feed-settings {
    flex: none;
    max-width: min(38%, 128px);
    min-height: 36px;
    padding: 0 10px;
    gap: 5px;
    border: 1px solid var(--shop-line);
    border-radius: 999px;
    background: #f8f6f4;
    color: var(--ink);
    font-size: 12px;
    font-weight: 500;
  }
  .tiktoday-feed-settings svg { width: 13px; height: 13px; color: var(--primary); }
  .tiktoday-toolbar { gap: 6px; padding-inline: 10px; }
  .tiktoday-toolbar :is(.button, select), .tiktoday-option-actions button { min-height: var(--mobile-control); }
  .tiktoday-directory .tiktoday-options > summary { width: var(--mobile-control); }
  .tiktoday-table .tiktoday-action .text-button { min-height: var(--mobile-control); min-width: var(--mobile-control); }
  .tiktoday-directory :is(.tiktoday-select-page, .tiktoday-selection .button, .tiktoday-selection .icon-button, .tiktoday-table .tiktoday-select-cell .tiktoday-row-check, .tiktoday-pages .button),
  .tiktoday-message-list .button { min-height: var(--mobile-control); }
  .tiktoday-directory { background: transparent; border: 0; }
  .tiktoday-directory :is(.tiktoday-top, .tiktoday-toolbar) { background: #fff; }
  .tiktoday-directory .tiktoday-top {
    border: 1px solid var(--shop-line);
    border-bottom: 0;
    border-radius: 12px 12px 0 0;
  }
  .tiktoday-directory .tiktoday-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    border: 1px solid var(--shop-line);
    border-radius: 0 0 12px 12px;
  }
  .tiktoday-directory #shop-search { grid-row: 1; margin: 0; }
  .tiktoday-directory .tiktoday-options { grid-row: 1; }
  .tiktoday-directory .tiktoday-result-summary {
    grid-column: 1 / -1;
    padding: 1px 0;
  }
  .tiktoday-directory .tiktoday-result-summary:empty { display: none; }
  .tiktoday-directory :is(.tiktoday-table tbody, .tiktoday-empty) { padding-top: 8px; }
  .tiktoday-directory .tiktoday-table,
  .tiktoday-directory .tiktoday-table tbody { display: block; }
  .tiktoday-directory .tiktoday-table thead:not(:has(.tiktoday-select-page)),
  .tiktoday-directory .tiktoday-table thead th:not(.tiktoday-select-cell) {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    padding: 0;
  }
  .tiktoday-directory .tiktoday-table thead,
  .tiktoday-directory .tiktoday-table thead tr,
  .tiktoday-directory .tiktoday-table thead .tiktoday-select-cell { display: block; }
  .tiktoday-directory .tiktoday-table thead .tiktoday-select-cell {
    width: auto;
    padding: 0 12px;
    margin-top: 8px;
    border: 1px solid var(--shop-line);
    border-radius: 10px;
    background: #fff;
  }
  .tiktoday-directory .tiktoday-select-page { justify-content: start; gap: 8px; }
  .tiktoday-directory .tiktoday-select-page span { display: inline; }
  .tiktoday-directory .tiktoday-table tbody tr {
    position: relative;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 8px;
    padding: 11px 12px;
    border: 1px solid var(--shop-line);
    border-radius: 12px;
    background: #fff;
  }
  .tiktoday-directory .tiktoday-table tbody :is(th, td) { min-width: 0; padding: 0; border: 0; }
  .tiktoday-directory .tiktoday-table tbody th { grid-column: 1 / -1; padding-inline-end: 50px; overflow-wrap: anywhere; }
  .tiktoday-directory .tiktoday-table tbody tr:has(.tiktoday-select-cell) th { padding-inline-start: 40px; }
  .tiktoday-directory .tiktoday-table tbody .tiktoday-select-cell { position: absolute; inset: 6px auto auto 5px; width: 38px; }
  .tiktoday-directory .tiktoday-table td[data-label]::before {
    display: block;
    content: attr(data-label);
    margin-bottom: 2px;
    color: var(--shop-muted);
    font-size: 11px;
    font-weight: 400;
  }
  .tiktoday-directory .tiktoday-table td[data-field] {
    grid-column: span 1;
    padding: 7px 9px;
    border-radius: 8px;
    background: #faf9f7;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
    overflow-wrap: normal;
  }
  .tiktoday-directory .tiktoday-table td:is([data-field="categories"], [data-field="shop"], [data-field="author"]) {
    overflow-wrap: anywhere;
  }
  .tiktoday-directory .tiktoday-table[data-kind="creators"] td[data-field="gmv"],
  .tiktoday-directory .tiktoday-table[data-kind="creators"] tbody tr:not(:has([data-field="change"])) td[data-field="sold"],
  .tiktoday-directory .tiktoday-table[data-kind="products"] tbody tr:has([data-field="change"]) td[data-field="shop"],
  .tiktoday-directory .tiktoday-table[data-kind="videos"] tbody tr:not(:has([data-field="change"])) td[data-field="engagement"] {
    grid-column: 1 / -1;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
  }
  .tiktoday-directory .tiktoday-table[data-kind="creators"] td[data-field="gmv"]::before,
  .tiktoday-directory .tiktoday-table[data-kind="creators"] tbody tr:not(:has([data-field="change"])) td[data-field="sold"]::before,
  .tiktoday-directory .tiktoday-table[data-kind="products"] tbody tr:has([data-field="change"]) td[data-field="shop"]::before,
  .tiktoday-directory .tiktoday-table[data-kind="videos"] tbody tr:not(:has([data-field="change"])) td[data-field="engagement"]::before {
    margin-bottom: 0;
    flex-shrink: 0;
    font-size: 12px;
  }
  .tiktoday-directory .tiktoday-table[data-kind="products"] tbody tr:has([data-field="change"]) td[data-field="shop"] {
    text-align: end;
  }
  .tiktoday-directory .tiktoday-table td[data-field="categories"] {
    grid-column: 1 / -1;
    order: 2;
    font-size: 12.5px;
    font-weight: 500;
    color: #3f3f46;
  }
  .tiktoday-directory .tiktoday-table[data-kind="videos"] td:is([data-field="author"], [data-field="published"]) {
    order: -1;
    padding: 0 2px 3px;
    background: transparent;
    color: var(--shop-muted);
    font-size: 12px;
    font-weight: 500;
  }
  .tiktoday-directory .tiktoday-table[data-kind="videos"] tbody th { order: -2; }
  .tiktoday-directory .tiktoday-table tbody .tiktoday-action { position: absolute; inset: 6px 6px auto auto; }
  .tiktoday-directory .tiktoday-pages { padding-inline: 0; }

  .dash-card-head { flex-wrap: wrap; gap: 8px; }
  .dash-card-head-right { flex-wrap: wrap; gap: 6px 8px; }
  .dash-modal-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .published-history-table .published-timeline { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .published-history-table .published-timeline :is(th, td) { white-space: nowrap; }
  #post-scheduled-for { width: 100%; min-width: 0; max-width: 100%; }
  .reuse-grid { grid-template-columns: minmax(0, 1fr); }
  .app-shell .competitor-page > .content-inner { padding: 10px var(--mobile-gutter) 20px !important; }
  .app-shell .competitor-page .competitor-feed-heading {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 6px 8px;
    margin-bottom: 10px;
  }
  .app-shell .competitor-page .competitor-source-tabs {
    width: 100%;
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    gap: 3px;
    padding: 2px;
  }
  .app-shell .competitor-page .competitor-source-tabs::-webkit-scrollbar { display: none; }
  .app-shell .competitor-page .competitor-source-tabs button {
    flex: 1 0 auto;
    justify-content: center;
    min-height: 28px;
    padding: 3px 8px;
    font-size: 12px;
    white-space: nowrap;
  }
  .app-shell .competitor-page .competitor-view-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
    width: 100%;
  }
  .app-shell .competitor-page #competitor-channel-filter {
    order: 1;
    flex: 1 1 0;
    min-width: 0;
    width: auto;
    max-width: none;
    height: 34px;
    min-height: 34px !important;
    padding: 0 20px 0 8px !important;
    font-size: 12.5px !important;
    border-radius: 7px;
    text-overflow: ellipsis;
  }
  .app-shell .competitor-page #competitor-page-size {
    order: 1;
    flex: none;
    width: auto;
    height: 34px;
    min-height: 34px !important;
    padding: 0 18px 0 7px !important;
    font-size: 12.5px !important;
    border-radius: 7px;
  }
  .app-shell .competitor-page #competitor-manage-open {
    order: 1;
    flex: none;
    height: 34px;
    min-height: 34px !important;
    padding: 0 9px;
    gap: 5px;
    font-size: 12.5px !important;
    border-radius: 7px;
    white-space: nowrap;
  }
  .app-shell .competitor-page .competitor-result-count {
    order: 2;
    flex: 0 0 auto;
    font-size: 11.5px;
    line-height: 1.2;
    color: var(--muted);
    padding-inline: 2px;
  }
  .trend-detail-layout .trend-analysis-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .trend-detail-layout .trend-analysis-table :is(th, td) { white-space: nowrap; }
  /* Settings tab: flat minimal mobile hierarchy */
  .app-shell .settings-page { background: #fff; }
  .app-shell .settings-header {
    min-height: 44px !important;
    padding: 6px 14px !important;
    background: #fff;
    border-bottom: 1px solid #f1f0ee;
  }
  .app-shell .settings-body { padding: 4px 14px 20px !important; }
  .app-shell .settings-sheet { border: 0; border-radius: 0; background: transparent; }
  .app-shell .settings-row { padding: 12px 0 !important; gap: 7px !important; border-color: #f1f0ee; }
  .app-shell .settings-row-info h2,
  .app-shell .settings-row .settings-disclosure-summary h2 { font-size: 13.5px; margin: 0; color: var(--ink); }
  .app-shell .settings-row-fields { gap: 8px; }
  .app-shell .settings-switch-row {
    padding: 3px 0;
    gap: 12px;
    border: 0;
    border-radius: 0;
    background: transparent;
  }
  .app-shell .settings-switch-row strong { font-size: 13px; font-weight: 500; }
  .app-shell .settings-switch-row small { display: none; }
  .app-shell .ai-control-rows .settings-switch-row { min-height: 44px; }
  .app-shell .ai-control-rows .ai-control-inline small { display: inline; }
  .app-shell .settings-ai-advanced > .settings-disclosure-summary {
    min-height: 36px;
    padding: 7px 10px;
    border: 0;
    border-radius: 10px;
    background: #f7f7f8;
  }
  .app-shell .settings-disclosure-label { font-size: 12.5px; }
  .app-shell .settings-disclosure-meta { font-size: 11.5px; color: #71717a; }
  .app-shell .settings-ai-advanced[open] > .settings-disclosure-body {
    margin-top: 6px;
    padding: 10px;
    border: 0;
    border-radius: 10px;
    background: #f9f9fa;
  }
  .app-shell .settings-disclosure-body .settings-grid-2 { gap: 8px; }
  .app-shell .settings-disclosure-body .form-field label { font-size: 11.5px; margin-bottom: 3px; }
  .app-shell .settings-disclosure-body .form-field :is(input, select) {
    min-height: 36px !important;
    height: 36px;
    padding: 6px 10px;
    font-size: 14px !important;
    border-radius: 8px;
  }
  .app-shell .settings-push { gap: 5px !important; }
  .app-shell .settings-push-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
  .app-shell .settings-push-row .settings-empty-note { flex: 1 1 170px; font-size: 11.5px; line-height: 1.4; color: #71717a; }
  .app-shell .settings-push .settings-image-actions { gap: 6px; margin-left: auto; }
  .app-shell .settings-push .settings-image-actions .button {
    min-height: 32px !important;
    height: 32px;
    padding: 0 12px;
    font-size: 12px;
    font-weight: 500;
    border: 0;
    border-radius: 8px;
    background: #f4f4f5;
    color: var(--ink);
  }
  .app-shell .settings-retention {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between;
    gap: 10px;
  }
  .app-shell .settings-page .radio-group:has(> :only-child) input { display: none; }
  .app-shell .settings-page .radio-option {
    min-height: 28px;
    padding: 4px 10px;
    border: 0;
    border-radius: 999px;
    background: #f4f4f5 !important;
    color: #3f3f46 !important;
    font-size: 12px;
    font-weight: 500;
  }
  .app-shell .settings-backend-row { gap: 8px; }
  .app-shell .settings-backend-row .button { min-height: 34px; border-radius: 8px; font-size: 12.5px; }
  .app-shell .settings-form-footer { margin-top: 10px; }
  .app-shell .settings-form-footer .settings-save-btn {
    width: 100%;
    justify-content: center;
    min-height: 40px !important;
    height: 40px;
    border-radius: 10px;
    font-size: 13.5px;
    font-weight: 600;
  }
  .knowledge-toolbar-right :is(#add-knowledge, #add-product) { flex: 1 1 auto; justify-content: center; min-height: var(--mobile-control); }
  .knowledge-search-box { min-height: var(--mobile-control); }

  .connections-section:has(.connections-empty-card button) .connections-add-btn { display: none; }
  .connections-page .connections-empty-card { gap: 8px; padding: 12px; }
  .connections-page .connections-empty-card .button { min-height: var(--mobile-control); }

  .admin-toolbar { flex-wrap: wrap; }
  .admin-search-field { flex: 1 1 180px; min-width: 0; }
  .admin-toolbar-actions { min-width: 0; flex-wrap: wrap; }
  .admin-row-actions button { min-height: var(--mobile-control); }
  .admin-form .admin-password-row, .settings-form-footer, .connection-group-actions { flex-wrap: wrap; }
  .admin-form .admin-password-row input { min-width: 0; }

  #modal:not(.design-dialog) :is(.form-field, fieldset, select, input, textarea),
  .settings-body :is(.form-field, fieldset, select, input, textarea) { min-width: 0; max-width: 100%; }
}

@media (max-width: 650px) {
  #modal.design-dialog .design-workspace { grid-template-rows: minmax(110px, 41%) minmax(0, 1fr); }
  #modal.design-dialog .design-preview { padding: 8px 12px; gap: 4px; }
  #modal.design-dialog .design-preview > .design-layer-tools { display: flex; }
  #modal.design-dialog .design-preview > .design-layer-tools .button { min-height: 38px; padding: 4px 8px; }
  #modal.design-dialog .draft-editor-panel #draft-caption { min-height: 110px; }
}

@media (max-width: 480px) {
  .tiktoday-tabs button svg { display: none; }
}

@media (max-width: 410px) {
  #post-account .post-target-filters { grid-template-columns: minmax(0, 1fr); }
  #post-account .post-target-filters input { padding-inline: 10px; }
  #modal:not(.design-dialog) .admin-form-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 740px) and (max-height: 450px) {
  #modal.design-dialog .design-workspace { grid-template: minmax(0, 1fr) / minmax(0, 1fr) minmax(0, 1fr); }
  .mobile-keyboard-overlay #modal.design-dialog .design-workspace { grid-template: minmax(0, 1fr) / minmax(0, 1fr); }
}

@media (max-width: 740px) {
  .app-shell .publish-page > .published-posts {
    padding: 10px var(--mobile-gutter) 20px !important;
  }
  .app-shell .publish-page .published-toolbar {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 5px;
    margin: 0 0 10px;
    padding: 0;
  }
  .app-shell .publish-page .published-toolbar :is(select, .button) {
    min-height: 36px !important;
    height: 36px;
    font-size: 12.5px !important;
    border-radius: 8px;
  }
  .publish-page .published-filter {
    flex: none;
  }
  .app-shell .publish-page .published-filter > summary {
    position: relative;
    width: auto;
    min-width: 34px;
    padding: 0 8px;
    gap: 4px;
    justify-content: center;
    white-space: nowrap;
  }
  .app-shell .publish-page #published-sort {
    flex: 1 1 0;
    min-width: 0;
    width: auto;
    max-width: none;
    padding: 0 18px 0 8px !important;
    text-overflow: ellipsis;
  }
  .app-shell .publish-page .published-view-controls {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 1px;
    height: 36px;
    padding: 2px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
  }
  .app-shell .publish-page .published-view-controls .button {
    position: relative;
    min-width: 28px !important;
    width: 28px;
    min-height: 30px !important;
    height: 30px;
    padding: 0;
    border-radius: 6px;
    justify-content: center;
  }
  .app-shell .publish-page .published-view-controls .button svg {
    width: 15px;
    height: 15px;
  }
  .app-shell .publish-page .published-view-controls .calendar-nav-button .calendar-count-badge {
    position: absolute;
    top: 1px;
    right: 1px;
    min-width: 14px;
    height: 14px;
    padding: 0 3px;
    font-size: 9.5px;
    line-height: 1;
    border-radius: 999px;
    background: #e03313;
    color: #fff;
    box-shadow: 0 0 0 1.5px #fff;
    pointer-events: none;
  }
  .app-shell .publish-page .published-toolbar #open-post-composer {
    flex: none;
    margin: 0;
    padding: 0 9px;
    gap: 4px;
    white-space: nowrap;
  }
  .app-shell .publish-page .published-toolbar #open-post-composer svg {
    width: 14px;
    height: 14px;
  }
  .app-shell .calendar-bar {
    align-items: stretch;
    padding: 8px 10px;
    gap: 6px;
  }
  .app-shell .calendar-bar-left {
    width: 100%;
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr) 32px 32px;
    align-items: center;
    gap: 5px;
  }
  .app-shell .calendar-bar-left [data-month],
  .app-shell #refresh-scheduled {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
  }
  .app-shell #calendar-month-select {
    width: 100%;
    min-height: 32px !important;
    height: 32px;
    font-size: 13.5px !important;
  }
  .app-shell .calendar-bar-left .calendar-status {
    display: contents;
  }
  .app-shell .calendar-bar-left #refresh-scheduled {
    grid-column: 4;
    grid-row: 1;
  }
  .app-shell .calendar-bar-left .calendar-status > :not(#refresh-scheduled) {
    grid-column: 1 / -1;
    font-size: 12px;
    justify-self: start;
  }
  .app-shell .calendar-bar-right {
    width: 100%;
    gap: 6px;
  }
  .app-shell .calendar-bar-right > [data-month="0"],
  .app-shell .calendar-week-btns button {
    min-height: 32px !important;
    height: 32px;
    padding: 0 10px;
    font-size: 12.5px;
  }
  .admin-directory .admin-filters {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    scroll-padding-inline: 12px;
  }
  .admin-directory .admin-filters button { flex: none; min-height: var(--mobile-control); }
  #post-composer-dialog #post-form .post-publish-bar {
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }
  .mobile-bottom-nav {
    height: var(--mobile-bottom);
    padding-block: 3px calc(3px + env(safe-area-inset-bottom));
    padding-inline: max(4px, env(safe-area-inset-left)) max(4px, env(safe-area-inset-right));
    box-shadow: 0 -2px 12px #231e1a0a;
  }
  .mobile-nav-btn { min-width: 0; min-height: 46px; gap: 2px; }
  .mobile-nav-btn.active { background: #f8ece7; }
  .mobile-nav-label { font-size: 11px; }
  .app-shell .sidebar-brand-row { padding: 2px 4px 10px; margin-bottom: 6px; }
  .app-shell .sidebar nav { flex-grow: 0; gap: 8px; padding-bottom: 10px; }
  .app-shell .nav-group-label { padding: 2px 10px 2px; font-size: 11px; }
  .app-shell .nav-item,
  .app-shell.sidebar-collapsed .nav-item,
  .app-shell .sidebar-footer-item,
  .app-shell .sidebar-account { padding: 8px 12px !important; min-height: var(--mobile-control); }
  .app-shell .sidebar-footer { margin-top: auto !important; padding-top: 8px !important; gap: 2px; }
  .app-shell .publish-page .published-view-controls .button[aria-pressed="true"] {
    background: #f8ece7;
    border-color: transparent;
    color: var(--primary);
  }
  .publish-page #published-status:not(:empty) {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
  }
  .published-pagination:has(#published-pages:empty):has(#published-next:disabled) { display: none; }
  #toast {
    bottom: calc(var(--mobile-bottom) + 10px);
  }
  .app-shell:has(.inbox-page.has-mobile-chat) ~ #toast,
  .mobile-keyboard-overlay #toast {
    top: calc(env(safe-area-inset-top) + 64px);
    bottom: auto;
  }
}

@media (min-width: 741px) and (max-width: 960px) {
  .dashboard-analytics-page .dash-topbar {
    display: grid;
    grid-template-columns: minmax(140px, 210px) auto minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 8px;
  }
  .dashboard-analytics-page .dash-filters-row,
  .dashboard-analytics-page .dash-topbar-actions { display: contents !important; }
  .dashboard-analytics-page #dash-days { grid-column: 1; grid-row: 1; min-width: 0; }
  .dashboard-analytics-page .dash-filter-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    grid-column: 2;
    grid-row: 1;
    min-height: 30px;
    padding-inline: 10px;
    white-space: nowrap;
  }
  .dashboard-analytics-page .dash-filter-toggle[aria-expanded="true"] { background: #f0ece8; }
  .dashboard-analytics-page .dash-filter-toggle[aria-expanded="false"] + #dash-extra-filters { display: none; }
  .dashboard-analytics-page #dash-extra-filters {
    display: grid;
    grid-column: 1 / -1;
    grid-row: 2;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
  }
  .dashboard-analytics-page #dash-extra-filters select { min-width: 0; width: 100%; }
  .dashboard-analytics-page #dashboard-metrics-status {
    grid-column: 1 / -1;
    grid-row: 3;
    margin: 0;
  }
  .dashboard-analytics-page #dash-refresh { grid-column: 4; grid-row: 1; white-space: nowrap; }
  .dashboard-analytics-page #dash-export { grid-column: 5; grid-row: 1; white-space: nowrap; }

  .app-shell .dash-kpi-strip {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
  .app-shell .dash-kpi-strip .dash-kpi-cell {
    grid-column: span 2;
    min-width: 0;
    border-left: 1px solid var(--line) !important;
    border-right: 0 !important;
    border-top: 0;
  }
  .app-shell .dash-kpi-strip .dash-kpi-cell:first-child,
  .app-shell .dash-kpi-strip .dash-kpi-cell:nth-child(4) {
    border-left: 0 !important;
  }
  .app-shell .dash-kpi-strip .dash-kpi-cell:nth-child(n+4) {
    grid-column: span 3;
    border-top: 1px solid var(--line);
  }

  .publish-page .published-toolbar {
    flex-wrap: wrap;
    row-gap: 8px;
  }
  .comments-page .comment-ai-header {
    gap: 8px 12px;
  }
  .comments-page .comment-ai-header-actions {
    gap: 6px;
    justify-content: flex-end;
  }
  .comments-page .comment-ai-header-actions > * {
    white-space: nowrap;
  }
  .tiktoday-directory .tiktoday-top {
    gap: 8px;
  }
  .tiktoday-directory .tiktoday-tabs {
    overflow-x: auto;
    scrollbar-width: none;
  }
  .tiktoday-directory .tiktoday-tabs::-webkit-scrollbar {
    display: none;
  }
  .tiktoday-directory .tiktoday-toolbar {
    flex-wrap: wrap;
    gap: 8px;
  }
  .tiktoday-directory .tiktoday-toolbar #shop-search {
    flex: 1 1 220px;
    min-width: 180px;
  }
}

@media (max-width: 740px) {
  .desktop .app-shell :is(
    .inbox-page.has-mobile-chat .chat-tabs,
    .comments-page.has-mobile-chat .comments-header,
    .knowledge-page.has-mobile-detail .knowledge-detail-head
  ) {
    padding-right: 96px !important;
  }
}

@media (max-width: 480px) {
  .app-shell .publish-page .published-filter-label { display: none; }
  .app-shell .publish-page .published-filter > summary { width: 36px; padding: 0; }
  .app-shell .publish-page #published-filter-active:not([hidden]) {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 15px;
    height: 15px;
    padding: 0 3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-size: 10px;
  }
  .published-list-table tbody tr { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .connections-page .connection-group > header { flex-wrap: wrap; }
  .connections-page .connection-info { flex: 1 1 150px; }
  .connections-page .connection-group-actions { margin-left: auto; }
  .admin-directory .admin-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }
  .admin-directory .admin-search-field { width: 100%; }
  .admin-directory .admin-toolbar-actions { justify-content: flex-end; }
}

@media (max-width: 380px) {
  .app-shell .publish-page .published-toolbar { gap: 4px; }
  .app-shell .publish-page .published-filter > summary { width: 34px; min-width: 34px; }
  .app-shell .publish-page #published-sort { padding: 0 18px 0 7px !important; font-size: 12.5px !important; }
  .app-shell .publish-page .published-view-controls .button { min-width: 28px !important; width: 28px; }
  .app-shell .publish-page .published-toolbar #open-post-composer { padding: 0 8px; gap: 3px; font-size: 12.5px !important; }
}

@media (max-width: 740px) {
  .app-shell .secondary-page-actions :is(.button, .icon-button) {
    min-height: 40px;
    padding-inline: 8px;
    gap: 4px;
    font-size: 12px;
  }

  .app-shell .secondary-page-actions .tiktoday-feed-settings {
    max-width: min(110px, 31vw);
  }

  .app-shell .knowledge-page.has-mobile-detail > .secondary-page-header {
    display: none;
  }

  .secondary-options-menu .button {
    min-height: 40px;
  }
}
