/*
 * Operator 1.9.2 — canonical mobile layout.
 * Loaded last. This file owns all authenticated layouts at phone widths.
 */
@media (max-width: 760px) {
  :root {
    --mobile-gutter: 14px;
    --mobile-nav-height: 64px;
  }

  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }

  html,
  body {
    width: 100%;
    max-width: 100%;
    min-height: 100dvh;
    overflow-x: clip !important;
  }

  body[data-state="dashboard"] > .stage {
    width: 100% !important;
    min-height: 100dvh;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  body[data-state="dashboard"] .dashboard {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  button,
  input,
  textarea,
  select {
    min-width: 0;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  }

  input,
  textarea,
  select {
    max-width: 100%;
    font-size: 16px !important;
    touch-action: manipulation;
  }

  button {
    line-height: 1.2;
    touch-action: manipulation;
  }

  img,
  svg,
  canvas {
    max-width: 100%;
  }

  .ui-icon,
  button > svg,
  .operator-mobile-nav svg,
  .metric-icon svg,
  .stat-icon svg {
    flex: 0 0 auto;
    aspect-ratio: 1 / 1;
  }

  /* Bottom navigation */
  body[data-auth-state="authenticated"][data-state="dashboard"] .operator-mobile-nav {
    position: fixed;
    z-index: 100;
    inset: auto 0 0;
    display: grid;
    width: 100%;
    min-height: calc(var(--mobile-nav-height) + var(--safe-bottom, 0px));
    padding: 6px max(4px, var(--safe-right, 0px)) var(--safe-bottom, 0px) max(4px, var(--safe-left, 0px));
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border-top: 1px solid var(--op-line);
    background: color-mix(in srgb, var(--op-surface) 96%, transparent);
    box-shadow: 0 -8px 28px rgba(0,0,0,.055);
    backdrop-filter: blur(20px);
  }

  .operator-mobile-nav button {
    display: flex;
    min-width: 0;
    min-height: 56px;
    padding: 5px 2px 4px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 3px;
    overflow: hidden;
    color: var(--op-muted);
    background: transparent;
    font-size: 9px;
    white-space: nowrap;
  }

  .operator-mobile-nav button span {
    display: block;
    width: 100%;
    overflow: hidden;
    text-align: center;
    text-overflow: ellipsis;
  }

  .operator-mobile-nav svg {
    width: 20px !important;
    height: 20px !important;
    max-width: 20px;
    max-height: 20px;
    fill: none;
    stroke: currentColor;
  }

  /* Dashboard */
  .dashboard-context {
    display: grid !important;
    width: 100%;
    min-width: 0;
    margin: 0 !important;
    padding: calc(16px + var(--safe-top, 0px)) var(--mobile-gutter) 16px;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    align-items: start;
  }

  body.knowledge-active .dashboard-context,
  body.dialogs-active .dashboard-context {
    display: none !important;
  }

  .dashboard-context > div {
    min-width: 0;
  }

  .dashboard-context .eyebrow {
    margin-bottom: 7px;
    font-size: 9px;
    line-height: 1.25;
  }

  .dashboard-context h1 {
    max-width: 100%;
    margin: 0;
    overflow-wrap: break-word;
    font-size: clamp(28px, 9vw, 36px);
    line-height: 1;
    letter-spacing: -.04em;
  }

  .dashboard-context p {
    max-width: 100%;
    margin-top: 8px;
    overflow-wrap: anywhere;
    font-size: 11px;
    line-height: 1.4;
  }

  .live-status {
    width: max-content;
    max-width: 100%;
    margin: 0;
    padding: 7px 10px;
    font-size: 9px;
  }

  body[data-state="dashboard"] #dashboardAnalytics {
    width: 100% !important;
    margin: 0 !important;
    padding: 0 var(--mobile-gutter) calc(var(--mobile-nav-height) + var(--safe-bottom, 0px) + 24px) !important;
  }

  .metric-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 10px;
  }

  .metric-card {
    display: grid;
    min-width: 0;
    min-height: 132px;
    padding: 14px;
    grid-template-columns: minmax(0, 1fr) 34px;
    gap: 8px;
    border-radius: 12px;
  }

  .metric-card > div:first-child {
    min-width: 0;
  }

  .metric-card p {
    min-height: 30px;
    margin: 0;
    overflow-wrap: break-word;
    font-size: 11px;
    line-height: 1.35;
  }

  .metric-card strong {
    display: inline-block;
    max-width: 100%;
    margin-top: 14px;
    font-size: clamp(24px, 8vw, 29px);
    line-height: 1;
  }

  .metric-card > div:first-child > span {
    margin-left: 2px;
    font-size: 13px;
  }

  .metric-card small {
    display: block;
    margin-top: 12px;
    overflow-wrap: anywhere;
    font-size: 9px;
    line-height: 1.35;
  }

  .metric-icon {
    width: 34px;
    height: 34px;
  }

  .metric-icon svg {
    width: 17px !important;
    height: 17px !important;
  }

  .dash-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    margin-bottom: 10px;
  }

  .panel {
    width: 100%;
    min-width: 0;
    padding: 14px;
    border-radius: 12px;
    overflow: hidden;
  }

  .panel-head {
    min-width: 0;
    gap: 8px;
  }

  .panel-head h2,
  .panel > h2 {
    min-width: 0;
    overflow-wrap: break-word;
    font-size: 13px;
  }

  .panel-head span {
    flex: 0 1 auto;
    max-width: 48%;
    overflow: hidden;
    font-size: 9px;
    text-align: right;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .chart-panel,
  .donut-panel {
    height: 250px;
  }

  .wide-panel {
    height: 205px;
  }

  .donut-layout {
    min-width: 0;
    gap: 10px;
  }

  /* Knowledge header and tabs */
  #knowledgeWorkspace {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  #knowledgeWorkspace .knowledge-shell {
    width: 100% !important;
    min-width: 0;
    max-width: none !important;
    margin: 0 !important;
    padding: calc(16px + var(--safe-top, 0px)) var(--mobile-gutter) calc(var(--mobile-nav-height) + var(--safe-bottom, 0px) + 28px) !important;
  }

  .knowledge-shell-head {
    display: grid;
    width: 100%;
    min-width: 0;
    min-height: 44px;
    margin: 0;
    padding: 0 0 14px;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
  }

  .knowledge-shell-head > div:first-child {
    min-width: 0;
  }

  .knowledge-shell-head h2 {
    max-width: 100%;
    margin: 0;
    overflow-wrap: break-word;
    font-size: clamp(24px, 7.8vw, 30px);
    line-height: 1.05;
    letter-spacing: -.04em;
  }

  .knowledge-shell-head p,
  .knowledge-state,
  .reference-search {
    display: none;
  }

  .knowledge-head-actions {
    display: flex;
    min-width: 0;
    gap: 7px;
    align-items: center;
  }

  .knowledge-icon-button,
  .knowledge-primary#newProductButton {
    display: inline-flex !important;
    min-width: 40px;
    width: auto;
    height: 40px;
    min-height: 40px;
    padding: 0 11px;
    flex: 0 0 auto;
    border-radius: 10px;
    white-space: nowrap;
  }

  .knowledge-icon-button {
    width: 40px;
    padding: 0;
  }

  .knowledge-icon-button svg {
    width: 19px !important;
    height: 19px !important;
  }

  .knowledge-tabs {
    display: grid;
    width: calc(100% + (2 * var(--mobile-gutter)));
    margin-inline: calc(-1 * var(--mobile-gutter));
    padding: 0 var(--mobile-gutter);
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0 !important;
    overflow: hidden;
  }

  .knowledge-tabs button {
    min-width: 0;
    padding: 0 4px 11px;
    overflow: hidden;
    font-size: 11px !important;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .knowledge-tabs button span {
    display: inline;
    margin-left: 3px;
    padding: 1px 4px;
  }

  .knowledge-view {
    width: 100%;
    min-width: 0;
    padding-top: 13px;
    padding-bottom: 74px;
  }

  .catalog-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 12px;
  }

  .catalog-stats article {
    min-width: 0;
    min-height: 86px;
    padding: 11px;
    gap: 9px;
    align-items: flex-start;
    border-radius: 11px;
    font-size: 10px;
    line-height: 1.25;
  }

  .catalog-stats article:last-child {
    display: none;
  }

  .catalog-stats article > div {
    min-width: 0;
    overflow-wrap: break-word;
  }

  .catalog-stats b {
    margin-right: 4px;
    font-size: 20px;
  }

  .catalog-stats small {
    margin-top: 4px;
    overflow-wrap: break-word;
    font-size: 9px;
    line-height: 1.25;
  }

  .stat-icon {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
  }

  .stat-icon .ui-icon {
    width: 18px !important;
    height: 18px !important;
  }

  .catalog-layout {
    display: block !important;
    width: 100%;
    min-width: 0;
  }

  .catalog-categories {
    width: 100%;
    min-width: 0;
    min-height: 0;
    margin: 0 0 14px;
    padding: 7px;
    overflow: hidden;
    border-radius: 11px;
  }

  .catalog-categories h3,
  .catalog-categories .new-group-row {
    display: none;
  }

  .catalog-categories nav {
    display: flex;
    width: 100%;
    min-width: 0;
    gap: 5px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .catalog-categories nav::-webkit-scrollbar {
    display: none;
  }

  .catalog-categories nav button {
    width: auto;
    min-width: max-content;
    min-height: 38px;
    padding: 9px 10px;
    flex: 0 0 auto;
    font-size: 11px;
    white-space: nowrap;
  }

  .catalog-main {
    width: 100%;
    min-width: 0;
  }

  .catalog-main > header {
    display: grid;
    min-width: 0;
    margin-bottom: 11px;
    grid-template-columns: minmax(0, 1fr) minmax(120px, auto);
    gap: 8px;
    align-items: center;
  }

  .catalog-main h3 {
    min-width: 0;
    margin: 0;
    overflow: hidden;
    font-size: 15px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .catalog-main select {
    width: 100%;
    max-width: 148px;
    min-height: 38px;
    padding: 7px 26px 7px 9px;
    justify-self: end;
    font-size: 12px !important;
  }

  .product-card-grid,
  .product-card-grid:has(.product-card:nth-child(2)) {
    display: grid;
    width: 100%;
    min-width: 0;
    grid-template-columns: minmax(0, 1fr);
    gap: 9px;
  }

  .product-card {
    position: relative;
    display: grid;
    width: 100%;
    min-width: 0;
    min-height: 104px;
    padding: 11px;
    grid-template-columns: 62px minmax(0, 1fr);
    gap: 11px;
    align-items: start;
    border-radius: 12px;
    overflow: hidden;
  }

  .product-card-image {
    width: 62px;
    height: 82px;
    flex: 0 0 62px;
    border-radius: 9px;
  }

  .product-card-copy {
    min-width: 0;
    gap: 4px;
    padding-right: 12px;
  }

  .product-card-copy b {
    display: -webkit-box;
    max-width: 100%;
    overflow: hidden;
    font-size: 14px;
    line-height: 1.25;
    overflow-wrap: break-word;
    white-space: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .product-card-copy > small {
    display: -webkit-box;
    min-height: 0;
    overflow: hidden;
    font-size: 11px;
    line-height: 1.35;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .product-card-copy .product-readiness {
    min-width: 0;
    margin: 0;
    overflow: hidden;
    font-size: 9px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .product-card-copy .product-facts {
    display: flex;
    min-width: 0;
    margin-top: 4px;
    gap: 6px 12px;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .product-facts span {
    min-width: 0;
    font-size: 10px !important;
    white-space: nowrap;
  }

  .product-facts .ui-icon {
    width: 13px !important;
    height: 13px !important;
  }

  .product-card-meta {
    position: absolute;
    top: 10px;
    right: 8px;
    min-width: 0;
  }

  /* Product editor */
  #knowledgeProductView {
    width: 100%;
    min-width: 0;
  }

  #knowledgeProductView .product-back {
    width: max-content;
    max-width: 100%;
    min-height: 36px;
    margin: 0 0 8px;
    padding: 0;
    font-size: 11px;
  }

  #knowledgeProductView .product-page-head {
    display: grid;
    width: 100%;
    min-width: 0;
    min-height: 94px;
    padding: 12px;
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 12px;
    border-radius: 12px;
  }

  #knowledgeProductView .product-image-editor {
    width: 64px;
    height: 64px;
    flex: 0 0 64px;
    border-radius: 9px;
  }

  #knowledgeProductView .product-image-editor input {
    width: 100%;
    height: 100%;
  }

  #knowledgeProductView .product-title-block {
    min-width: 0;
  }

  #knowledgeProductView .product-title-block h3 {
    display: -webkit-box;
    max-width: 100%;
    margin: 0 0 5px;
    overflow: hidden;
    font-size: clamp(20px, 6.8vw, 25px);
    line-height: 1.05;
    overflow-wrap: break-word;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  #knowledgeProductView .product-title-block p {
    display: -webkit-box;
    max-width: 100%;
    margin: 0 0 6px;
    overflow: hidden;
    font-size: 10px;
    line-height: 1.35;
    overflow-wrap: break-word;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  #knowledgeProductView .product-title-block span {
    max-width: 100%;
    min-height: 20px;
    padding: 0 6px;
    overflow: hidden;
    font-size: 8px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #knowledgeProductView .product-page-grid {
    display: flex;
    width: 100%;
    min-width: 0;
    gap: 10px;
    flex-direction: column;
  }

  #knowledgeProductView .product-form-main {
    display: contents;
  }

  #knowledgeProductView .product-section,
  #knowledgeProductView .product-bot-settings {
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 15px 13px 16px;
    border: 1px solid var(--pe-line);
    border-radius: 12px;
  }

  #knowledgeProductView .product-bot-settings {
    position: static;
    order: -1;
  }

  #knowledgeProductView .product-fields,
  #knowledgeProductView .product-fields.compact {
    display: grid;
    width: 100%;
    min-width: 0;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  #knowledgeProductView .product-fields label,
  #knowledgeProductView .product-bot-settings label {
    min-width: 0;
    font-size: 11px;
  }

  #knowledgeProductView .product-fields input,
  #knowledgeProductView .product-fields textarea,
  #knowledgeProductView .product-bot-settings select {
    display: block;
    width: 100%;
    min-width: 0;
    min-height: 46px;
    margin-top: 6px;
    padding: 11px 12px;
    border-radius: 9px;
    font-size: 16px !important;
    line-height: 1.35;
  }

  #knowledgeProductView .product-fields textarea {
    resize: vertical;
  }

  #knowledgeProductView .product-page-actions {
    position: fixed;
    z-index: 95;
    inset: auto 0 calc(var(--mobile-nav-height) + var(--safe-bottom, 0px));
    display: block;
    width: 100%;
    padding: 8px var(--mobile-gutter);
    border-top: 1px solid var(--pe-line);
    background: color-mix(in srgb, var(--op-surface) 97%, transparent);
    backdrop-filter: blur(18px);
  }

  #knowledgeProductView .product-page-actions .knowledge-secondary {
    display: none;
  }

  #knowledgeProductView .product-page-actions .knowledge-primary {
    width: 100%;
    min-height: 44px;
    border-radius: 10px;
  }

  body.knowledge-active .knowledge-shell.showing-product ~ .knowledge-ai-fab {
    right: 14px;
    bottom: calc(var(--mobile-nav-height) + var(--safe-bottom, 0px) + 68px);
    width: 48px;
    height: 48px;
  }

  /* Documents */
  .document-library,
  .document-library-head,
  .document-library-toolbar,
  .documents-list {
    width: 100%;
    min-width: 0;
  }

  .document-library-head {
    display: block;
    margin-bottom: 12px;
  }

  #toggleDocumentUpload {
    width: 100%;
    min-height: 44px;
    justify-content: center;
  }

  .document-library #documentUploadForm:not([hidden]) {
    display: grid;
    width: 100%;
    min-width: 0;
    margin-bottom: 16px;
    padding: 12px;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "drop" "fields" "desc" "check" "submit";
    gap: 10px;
    overflow: hidden;
    border-radius: 12px;
  }

  .document-library .file-drop {
    width: 100%;
    min-width: 0;
    min-height: 130px;
    padding: 18px 12px;
  }

  .document-library .file-drop b,
  .document-library .file-drop small {
    max-width: 100%;
    overflow-wrap: break-word;
    text-align: center;
  }

  .document-uploader .knowledge-form-row {
    display: grid;
    min-width: 0;
    grid-template-columns: minmax(0, 1fr);
    gap: 9px;
  }

  .document-uploader input,
  .document-uploader textarea,
  .document-uploader select,
  .document-uploader button[type="submit"] {
    width: 100%;
    min-width: 0;
  }

  .document-table-head {
    display: none;
  }

  .document-row {
    display: grid;
    width: 100%;
    min-width: 0;
    min-height: 82px;
    padding: 13px 7px;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }

  .document-name-cell,
  .document-identity {
    min-width: 0;
  }

  .document-identity strong,
  .document-identity small {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .document-linked,
  .document-size {
    display: none;
  }

  .document-inspector {
    width: 100%;
    max-width: none;
    padding: calc(64px + var(--safe-top, 0px)) var(--mobile-gutter) calc(var(--mobile-nav-height) + var(--safe-bottom, 0px) + 24px);
    overflow-x: hidden;
  }

  #closeDocumentInspector {
    top: calc(14px + var(--safe-top, 0px));
    right: var(--mobile-gutter);
  }

  .document-inspector header,
  .document-inspector header > div {
    min-width: 0;
  }

  .document-inspector h3,
  .document-inspector p {
    max-width: 100%;
    overflow-wrap: break-word;
  }

  body:has(#documentUploadForm:not([hidden])) .knowledge-ai-fab {
    display: none !important;
  }

  /* Prompt */
  .knowledge-prompt-card {
    width: 100%;
    min-width: 0;
    padding: 18px 14px;
    border-radius: 12px;
  }

  .knowledge-prompt-card h3 {
    max-width: 100%;
    overflow-wrap: break-word;
    font-size: 23px;
    line-height: 1.05;
  }

  .knowledge-prompt-card textarea {
    width: 100%;
    min-width: 0;
    min-height: 260px;
    padding: 13px;
    font-size: 16px !important;
  }

  .knowledge-actions {
    min-width: 0;
    gap: 8px;
  }

  .knowledge-message {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  /* Dialogs */
  .dialogs-workspace {
    position: relative;
    width: 100% !important;
    min-width: 0;
    margin: 0 !important;
    padding: calc(16px + var(--safe-top, 0px)) 0 calc(var(--mobile-nav-height) + var(--safe-bottom, 0px)) !important;
  }

  .workspace-heading {
    display: grid;
    width: 100%;
    min-width: 0;
    margin: 0 0 13px;
    padding: 0 var(--mobile-gutter);
    grid-template-columns: minmax(0, 1fr) 42px;
    gap: 10px;
    align-items: center;
  }

  .workspace-heading > div {
    min-width: 0;
  }

  .workspace-heading h2 {
    max-width: 100%;
    margin: 0;
    overflow-wrap: break-word;
    font-size: 28px;
    line-height: 1.05;
  }

  .workspace-heading p {
    display: none;
  }

  .workspace-search {
    width: 42px;
    min-width: 42px;
    min-height: 42px;
    padding: 0 11px;
  }

  .workspace-search input {
    width: 0;
    padding: 0;
    opacity: 0;
  }

  .dialogs-layout {
    display: block;
    width: 100%;
    min-width: 0;
    height: auto;
    min-height: calc(100dvh - var(--mobile-nav-height) - var(--safe-top, 0px) - var(--safe-bottom, 0px) - 72px);
    border: 0;
    border-radius: 0;
  }

  .dialog-inbox,
  .dialogs-list {
    width: 100%;
    min-width: 0;
  }

  .dialog-filters {
    width: 100%;
    min-width: 0;
    padding: 8px var(--mobile-gutter);
    overflow-x: auto;
  }

  .dialog-filters button {
    min-width: max-content;
    flex: 0 0 auto;
  }

  .dialogs-list {
    padding: 0 var(--mobile-gutter);
  }

  .dialog-row {
    display: grid;
    width: 100%;
    min-width: 0;
    min-height: 78px;
    margin: 0 0 6px;
    padding: 10px;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    gap: 9px;
  }

  .dialog-avatar {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
  }

  .dialog-copy,
  .dialog-meta {
    min-width: 0;
  }

  .dialog-copy b,
  .dialog-copy span {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .dialog-copy b {
    white-space: nowrap;
  }

  .dialog-copy span {
    display: -webkit-box;
    white-space: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .dialog-meta {
    max-width: 64px;
  }

  .dialogs-workspace.detail-open .dialog-detail {
    position: fixed;
    z-index: 110;
    inset: 0;
    display: block;
    width: 100%;
    min-width: 0;
    background: var(--op-bg);
  }

  .detail-open .dialog-detail-content {
    display: grid;
    width: 100%;
    min-width: 0;
    height: 100%;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
  }

  .dialog-detail-content > header {
    display: grid;
    min-width: 0;
    min-height: 70px;
    padding: calc(10px + var(--safe-top, 0px)) var(--mobile-gutter) 10px;
    grid-template-columns: 34px 42px minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
  }

  .dialog-detail-content > header > div {
    min-width: 0;
  }

  .dialog-detail-content > header h3,
  .dialog-detail-content > header a {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .dialog-thread {
    min-width: 0;
    min-height: 0;
    max-height: none;
    padding: 14px var(--mobile-gutter);
    overflow-y: auto;
  }

  .dialog-bubble {
    max-width: 88%;
    overflow-wrap: anywhere;
  }

  .dialog-reply {
    position: static;
    display: grid;
    width: 100%;
    min-width: 0;
    padding: 9px var(--mobile-gutter) calc(9px + var(--safe-bottom, 0px));
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }

  .dialog-reply textarea {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    font-size: 16px !important;
  }

  .dialog-reply button {
    min-width: 78px;
  }

  /* Full-screen sheets */
  .app-overlay {
    place-items: stretch;
    padding: 0 !important;
  }

  .app-sheet {
    width: 100% !important;
    height: 100dvh;
    max-height: 100dvh !important;
    margin: 0;
    padding: calc(18px + var(--safe-top, 0px)) var(--mobile-gutter) calc(22px + var(--safe-bottom, 0px));
    overflow-x: hidden;
    overflow-y: auto;
    border: 0;
    border-radius: 0 !important;
  }

  .sheet-head {
    position: static;
    width: 100%;
    min-width: 0;
    margin: 0 0 18px;
    padding: 0 0 16px;
  }

  .sheet-head > div {
    min-width: 0;
  }

  .sheet-head h2 {
    max-width: 100%;
    overflow-wrap: break-word;
    font-size: 27px;
  }

  .settings-section,
  .settings-section-head,
  .settings-toggles,
  .settings-actions {
    width: 100%;
    min-width: 0;
  }

  .theme-switch {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .theme-switch button {
    min-width: 0;
    padding-inline: 5px;
    font-size: 11px;
    white-space: nowrap;
  }

  .settings-bot-row,
  .settings-action,
  .settings-toggles label {
    width: 100%;
    min-width: 0;
  }

  .settings-bot-row > span,
  .settings-action > span,
  .settings-toggles label > span {
    min-width: 0;
  }

  .settings-bot-row b,
  .settings-bot-row small,
  .settings-action b,
  .settings-action small,
  .settings-toggles b,
  .settings-toggles small {
    max-width: 100%;
    overflow-wrap: break-word;
  }

  .settings-toggles input {
    flex: 0 0 42px;
  }

  /* Dialog surfaces */
  .import-dialog,
  .product-preview-dialog {
    width: calc(100vw - 16px) !important;
    max-width: calc(100vw - 16px) !important;
    max-height: calc(100dvh - var(--safe-top, 0px) - var(--safe-bottom, 0px) - 16px) !important;
    margin: auto;
    overflow: hidden;
    border-radius: 15px;
  }

  .import-dialog .product-dialog-shell,
  .product-preview-sheet {
    width: 100%;
    min-width: 0;
    max-height: inherit;
    padding: 15px;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .product-dialog-head,
  .product-preview-head,
  .product-preview-card,
  .product-preview-copy,
  .product-preview-details {
    min-width: 0;
  }

  .product-dialog-head h2,
  .product-preview-copy h3,
  .product-preview-details p {
    max-width: 100%;
    overflow-wrap: break-word;
  }

  .import-preview article {
    min-width: 0;
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .product-dialog-actions {
    display: grid;
    min-width: 0;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .product-dialog-actions button {
    min-width: 0;
    padding-inline: 8px;
    white-space: normal;
  }

  /* AI assistant */
  .knowledge-ai-dock.is-open {
    position: fixed !important;
    z-index: 120 !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100dvh !important;
    padding: calc(14px + var(--safe-top, 0px)) var(--mobile-gutter) calc(14px + var(--safe-bottom, 0px)) !important;
    overflow: hidden;
  }

  .knowledge-ai-mobile-head,
  .knowledge-ai-mobile-head > div {
    min-width: 0;
  }

  .knowledge-ai-mobile-head b,
  .knowledge-ai-mobile-head span {
    max-width: 100%;
    overflow-wrap: break-word;
  }

  .knowledge-ai-composer {
    display: grid;
    min-width: 0;
    grid-template-columns: 40px minmax(0, 1fr) 42px;
    gap: 6px;
  }

  .knowledge-ai-composer textarea {
    width: 100%;
    min-width: 0;
    font-size: 16px !important;
  }

  .knowledge-ai-composer label,
  .knowledge-ai-composer button {
    width: 40px;
    min-width: 40px;
    height: 40px;
  }

  .knowledge-ai-composer button {
    width: 42px;
    min-width: 42px;
  }
}

@media (max-width: 359px) {
  :root {
    --mobile-gutter: 12px;
  }

  .metric-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .metric-card {
    min-height: 112px;
    grid-template-columns: minmax(0, 1fr) 36px;
  }

  .metric-card p {
    min-height: 0;
  }

  .knowledge-shell-head h2 {
    font-size: 24px;
  }

  .knowledge-primary#newProductButton {
    max-width: 76px;
    padding-inline: 9px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .catalog-stats {
    grid-template-columns: minmax(0, 1fr);
  }

  .catalog-stats article {
    min-height: 72px;
  }

  .catalog-main > header {
    grid-template-columns: minmax(0, 1fr) 116px;
  }

  .product-card {
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 9px;
  }

  .product-card-image {
    width: 56px;
    height: 74px;
  }

  #knowledgeProductView .product-page-head {
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 10px;
  }

  #knowledgeProductView .product-image-editor {
    width: 58px;
    height: 58px;
  }

  .dialog-row {
    grid-template-columns: 40px minmax(0, 1fr);
  }

  .dialog-meta {
    position: absolute;
    top: 10px;
    right: 8px;
  }
}
