/* Final application-shell breakpoints. Keep this stylesheet after the legacy
   prototype styles so the responsive layout has one authoritative cascade. */

/* KYC demand choices are compact cards like the prototype, never stretched
   to fill the entire row when only one or two demands are available. */
.customer-kyc-demand-tab {
  flex: 0 0 240px;
}

@media (min-width: 1024px) and (max-width: 1280px) {
  html,
  body {
    height: 100%;
  }

  body {
    overflow: hidden;
  }

  .app,
  .app.sidebar-collapsed {
    --side: 64px;
    display: grid;
    grid-template-columns: var(--side) minmax(0, 1fr);
    min-height: 0;
    height: 100vh;
  }

  .app:has(.knowledge-menu > [aria-expanded="true"]),
  .app:has(.system-menu > [aria-expanded="true"]) {
    --side: 220px;
  }

  .sidebar,
  .sidebar-collapsed .sidebar {
    position: relative;
    top: auto;
    z-index: auto;
    width: 100%;
    min-height: 0;
    max-height: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 12px 5px 20px;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .sidebar .brand {
    display: flex;
    justify-content: center;
    padding: 4px 0 12px;
    margin-bottom: 10px;
  }

  .sidebar .brand-text,
  .sidebar .sidebar-toggle,
  .sidebar .knowledge-toggle-icon,
  .sidebar .system-toggle-icon,
  .sidebar .dev-toggle-icon {
    display: none;
  }

  .sidebar .brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 8px;
  }

  .sidebar > .nav-btn,
  .sidebar .knowledge-menu > .nav-btn,
  .sidebar .system-menu > .nav-btn,
  .sidebar .dev-launcher > .nav-btn,
  .sidebar-collapsed .nav-btn {
    display: flex;
    width: 52px;
    min-width: 0;
    min-height: 50px;
    margin: 3px auto;
    padding: 7px 4px;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    border-radius: 8px;
  }

  .sidebar .nav-item,
  .sidebar-collapsed .nav-item {
    display: grid;
    place-items: center;
    gap: 3px;
  }

  .sidebar .nav-label,
  .sidebar-collapsed .nav-label,
  .sidebar .knowledge-submenu,
  .sidebar .system-submenu,
  .sidebar .dev-submenu {
    display: none !important;
  }

  .sidebar .nav-btn[data-short]::after,
  .sidebar-collapsed .nav-btn[data-short]::after {
    content: attr(data-short);
    display: block;
    width: 100%;
    overflow: hidden;
    color: currentColor;
    font-size: 10px;
    line-height: 1.15;
    text-align: center;
    white-space: nowrap;
    opacity: .9;
  }

  .sidebar .knowledge-menu,
  .sidebar .system-menu,
  .sidebar .dev-launcher {
    position: relative;
    flex: 0 0 auto;
    margin: 0;
  }

  .app:has(.knowledge-menu > [aria-expanded="true"]) .sidebar,
  .app:has(.system-menu > [aria-expanded="true"]) .sidebar {
    padding-right: 10px;
    padding-left: 10px;
  }

  .app:has(.knowledge-menu > [aria-expanded="true"]) .sidebar .brand,
  .app:has(.system-menu > [aria-expanded="true"]) .sidebar .brand {
    justify-content: flex-start;
    gap: 10px;
    padding-right: 8px;
    padding-left: 8px;
  }

  .app:has(.knowledge-menu > [aria-expanded="true"]) .sidebar .brand-text,
  .app:has(.system-menu > [aria-expanded="true"]) .sidebar .brand-text {
    display: block;
  }

  .app:has(.knowledge-menu > [aria-expanded="true"]) .sidebar > .nav-btn,
  .app:has(.knowledge-menu > [aria-expanded="true"]) .sidebar .knowledge-menu > .nav-btn,
  .app:has(.knowledge-menu > [aria-expanded="true"]) .sidebar .system-menu > .nav-btn,
  .app:has(.system-menu > [aria-expanded="true"]) .sidebar > .nav-btn,
  .app:has(.system-menu > [aria-expanded="true"]) .sidebar .knowledge-menu > .nav-btn,
  .app:has(.system-menu > [aria-expanded="true"]) .sidebar .system-menu > .nav-btn {
    width: 100%;
    min-height: 42px;
    margin: 2px 0;
    padding: 8px 10px;
    flex-direction: row;
    justify-content: space-between;
  }

  .app:has(.knowledge-menu > [aria-expanded="true"]) .sidebar .nav-item,
  .app:has(.system-menu > [aria-expanded="true"]) .sidebar .nav-item {
    display: inline-flex;
    justify-content: flex-start;
    gap: 9px;
  }

  .app:has(.knowledge-menu > [aria-expanded="true"]) .sidebar .nav-label,
  .app:has(.system-menu > [aria-expanded="true"]) .sidebar .nav-label {
    display: inline !important;
    font-size: 13px;
  }

  .app:has(.knowledge-menu > [aria-expanded="true"]) .sidebar .nav-btn[data-short]::after,
  .app:has(.system-menu > [aria-expanded="true"]) .sidebar .nav-btn[data-short]::after {
    display: none;
  }

  .app:has(.knowledge-menu > [aria-expanded="true"]) .sidebar .knowledge-toggle-icon,
  .app:has(.knowledge-menu > [aria-expanded="true"]) .sidebar .system-toggle-icon,
  .app:has(.system-menu > [aria-expanded="true"]) .sidebar .knowledge-toggle-icon,
  .app:has(.system-menu > [aria-expanded="true"]) .sidebar .system-toggle-icon {
    display: block;
  }

  .app .sidebar .knowledge-submenu:not(.is-collapsed),
  .app .sidebar .system-submenu:not(.is-collapsed) {
    display: grid !important;
    gap: 3px;
    padding: 4px 0 6px 20px;
  }

  .app .sidebar .knowledge-submenu:not(.is-collapsed) .nav-btn,
  .app .sidebar .system-submenu:not(.is-collapsed) .nav-btn {
    width: 100%;
    min-height: 36px;
    margin: 0;
    padding: 7px 9px;
    flex-direction: row;
    justify-content: flex-start;
    gap: 7px;
  }

  .main {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 0;
    height: 100vh;
  }

  .topbar {
    position: relative;
    top: auto;
  }

  .workspace {
    min-height: 0;
    overflow: auto;
    padding: 12px;
  }

  .route.list-page.active,
  #todos.route.list-page.active,
  #knowledge.route.active {
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }

  .route.list-page .list-data-panel {
    min-height: 0;
    overflow: hidden;
  }

  .route.list-page .list-data-panel > .table-wrap,
  .route.list-page .list-split > .panel:first-child > .table-wrap,
  .table-wrap {
    max-width: 100%;
    overflow: auto;
  }

  #customers .customer-filter-bar {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  #knowledge .record-table.knowledge-list {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
  }

  #knowledge .knowledge-policy-table {
    width: 1380px;
    min-width: 1380px;
  }
}

@media (min-width: 721px) and (max-width: 1023px) {
  html,
  body {
    min-height: 100%;
    height: auto;
  }

  body {
    overflow-x: hidden;
    overflow-y: auto;
  }

  .app,
  .app.sidebar-collapsed {
    display: flex;
    min-height: 100vh;
    height: auto;
    flex-direction: column;
  }

  .sidebar,
  .sidebar-collapsed .sidebar {
    position: sticky;
    top: 0;
    z-index: 40;
    width: 100%;
    min-height: 58px;
    max-height: 58px;
    flex: 0 0 58px;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
  }

  .sidebar .brand,
  .sidebar .sidebar-toggle {
    display: none;
  }

  .sidebar > .nav-btn,
  .sidebar .knowledge-menu > .nav-btn,
  .sidebar .system-menu > .nav-btn,
  .sidebar .dev-launcher > .nav-btn,
  .sidebar-collapsed .nav-btn {
    display: flex;
    width: auto;
    min-width: 64px;
    min-height: 42px;
    margin: 0;
    padding: 7px 9px;
    flex: 0 0 auto;
    flex-direction: row;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
  }

  .sidebar .nav-item,
  .sidebar-collapsed .nav-item {
    display: inline-flex;
    gap: 6px;
  }

  .sidebar .nav-label,
  .sidebar-collapsed .nav-label {
    display: inline;
    font-size: 12px;
  }

  .sidebar .nav-btn[data-short]::after,
  .sidebar-collapsed .nav-btn[data-short]::after,
  .sidebar .knowledge-submenu,
  .sidebar .system-submenu,
  .sidebar .dev-submenu {
    display: none !important;
  }

  .sidebar .knowledge-menu,
  .sidebar .system-menu,
  .sidebar .dev-launcher {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 0 0 auto;
    margin: 0;
  }

  .sidebar .knowledge-submenu:not(.is-collapsed),
  .sidebar .system-submenu:not(.is-collapsed) {
    display: flex !important;
    align-items: center;
    gap: 4px;
    padding: 0;
  }

  .sidebar .knowledge-submenu:not(.is-collapsed) .nav-btn,
  .sidebar .system-submenu:not(.is-collapsed) .nav-btn {
    width: auto;
    min-width: max-content;
    min-height: 42px;
    margin: 0;
    padding: 7px 9px;
    flex-direction: row;
    gap: 6px;
  }

  .main {
    display: flex;
    min-height: calc(100vh - 58px);
    height: auto;
    flex-direction: column;
  }

  .topbar {
    position: sticky;
    top: 58px;
    z-index: 30;
  }

  .workspace {
    flex: 1;
    min-height: 0;
    overflow: visible;
    padding: 12px;
  }

  .route.list-page.active,
  #todos.route.list-page.active,
  #knowledge.route.active {
    height: auto;
    overflow: visible;
  }

  .route.list-page .list-data-panel,
  .route.list-page .list-split,
  .route.list-page .list-split > .panel:first-child,
  .todo-data-views {
    min-height: 0;
    overflow: visible;
  }

  .route.list-page .list-data-panel > .table-wrap,
  .route.list-page .list-split > .panel:first-child > .table-wrap,
  .table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  #customers .customer-filter-bar {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  #ai .chat-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 260px minmax(500px, 1fr);
    height: auto;
    min-height: 0;
  }

  #ai .chat-shell > aside.panel,
  #ai .chat-sidebar-inner {
    display: block;
    width: 100%;
    min-height: 0;
    height: 260px;
  }

  #ai .chat-sidebar-inner {
    display: grid;
    grid-template-rows: auto minmax(120px, 1fr);
  }

  #ai .chat-recent-list-wrap,
  #ai .chat-recent-list {
    min-height: 120px;
  }

  #ai .chat-recent-list {
    height: 100%;
    max-height: 160px;
  }

  #knowledge .knowledge-policy-toolbar .knowledge-product-toolbar-main {
    align-items: stretch;
    flex-direction: column;
  }

  #knowledge .knowledge-policy-toolbar .knowledge-product-filters {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #knowledge .knowledge-policy-toolbar .knowledge-product-filters .field,
  #knowledge .knowledge-policy-toolbar .knowledge-product-filters .knowledge-product-name-field,
  #knowledge .knowledge-policy-toolbar .knowledge-product-filters .knowledge-level-field {
    width: auto;
    min-width: 0;
  }

  #knowledge .knowledge-policy-toolbar .knowledge-product-filters input,
  #knowledge .knowledge-policy-toolbar .knowledge-product-filters select {
    width: 100%;
    min-width: 0;
  }

  #knowledge .knowledge-policy-toolbar .actions {
    width: 100%;
    margin-left: 0;
  }

  #knowledge .record-table.knowledge-list {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  #knowledge .knowledge-policy-table {
    width: 1380px;
    min-width: 1380px;
  }
}

@media (max-width: 720px) {
  html,
  body {
    min-height: 100%;
    height: auto;
  }

  body {
    overflow-x: hidden;
    overflow-y: auto;
  }

  .app,
  .app.sidebar-collapsed {
    display: flex;
    min-height: 100dvh;
    height: auto;
    flex-direction: column;
  }

  .sidebar,
  .sidebar-collapsed .sidebar {
    position: sticky;
    top: 0;
    z-index: 40;
    order: 0;
    width: 100%;
    min-height: 54px;
    max-height: none;
    flex: 0 0 auto;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    padding: 6px 8px;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
  }

  .sidebar .brand,
  .sidebar .sidebar-toggle {
    display: none;
  }

  .sidebar > .nav-btn,
  .sidebar .knowledge-menu > .nav-btn,
  .sidebar .system-menu > .nav-btn,
  .sidebar .dev-launcher > .nav-btn,
  .sidebar-collapsed .nav-btn {
    display: flex;
    width: auto;
    min-width: 54px;
    min-height: 42px;
    margin: 0;
    padding: 7px 10px;
    flex: 0 0 auto;
    flex-direction: row;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
  }

  .sidebar .nav-item,
  .sidebar-collapsed .nav-item {
    display: inline-flex;
    gap: 6px;
  }

  .sidebar .nav-label,
  .sidebar-collapsed .nav-label {
    display: inline;
    font-size: 12px;
  }

  .sidebar .nav-btn[data-short]::after,
  .sidebar-collapsed .nav-btn[data-short]::after,
  .sidebar .knowledge-submenu,
  .sidebar .system-submenu,
  .sidebar .dev-submenu {
    display: none !important;
  }

  .sidebar .knowledge-menu,
  .sidebar .system-menu,
  .sidebar .dev-launcher {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 0 0 auto;
    margin: 0;
  }

  .sidebar .knowledge-submenu:not(.is-collapsed),
  .sidebar .system-submenu:not(.is-collapsed) {
    display: flex !important;
    align-items: center;
    gap: 4px;
    padding: 0;
  }

  .sidebar .knowledge-submenu:not(.is-collapsed) .nav-btn,
  .sidebar .system-submenu:not(.is-collapsed) .nav-btn {
    width: auto;
    min-width: max-content;
    min-height: 42px;
    margin: 0;
    padding: 7px 9px;
    flex-direction: row;
    gap: 6px;
  }

  .main {
    display: flex;
    min-height: calc(100dvh - 54px);
    height: auto;
    flex: 1 0 auto;
    flex-direction: column;
  }

  .topbar {
    position: sticky;
    top: 54px;
    z-index: 30;
    padding: 9px 12px;
  }

  .workspace {
    min-height: 0;
    flex: 1;
    overflow: visible;
    padding: 12px;
  }

  .route.list-page.active,
  #todos.route.list-page.active,
  #knowledge.route.active {
    display: grid;
    height: auto;
    min-height: 0;
    grid-template-rows: auto auto auto;
    overflow: visible;
  }

  .route.list-page .list-data-panel,
  .route.list-page .list-split,
  .route.list-page .list-split > .panel:first-child,
  .todo-data-views {
    display: block;
    min-height: 0;
    overflow: visible;
  }

  .route.list-page .list-data-panel > .table-wrap,
  .route.list-page .list-split > .panel:first-child > .table-wrap,
  .table-wrap {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .top-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .top-left {
    min-width: 0;
  }

  .top-left strong,
  .top-left span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .top-actions {
    min-width: 0;
    flex-wrap: nowrap;
  }

  .account-menu {
    margin-left: 0;
  }

  .customer-list-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .customer-attention-filters {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .customer-attention-chip {
    flex: 0 0 auto;
  }

  .customer-list-toolbar .actions {
    width: 100%;
    margin-left: 0;
  }

  .customer-list-toolbar .actions .btn {
    flex: 1 1 0;
  }

  .list-data-panel .pagination {
    align-items: stretch;
    flex-direction: column;
  }

  .list-data-panel .pagination-controls {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .list-data-panel .pagination-controls > * {
    flex: 0 0 auto;
  }

  .customer-table {
    min-width: 860px;
  }

  #ai .chat-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 224px minmax(460px, 1fr);
    height: auto;
    min-height: 0;
  }

  #ai .chat-shell > aside.panel,
  #ai .chat-sidebar-inner {
    display: block;
    width: 100%;
    min-height: 0;
    height: 224px;
  }

  #ai .chat-sidebar-inner {
    display: grid;
    grid-template-rows: auto minmax(112px, 1fr);
  }

  #ai .chat-recent-list-wrap,
  #ai .chat-recent-list {
    min-height: 112px;
  }

  #ai .chat-recent-list {
    height: 100%;
    max-height: 126px;
  }

  #ai .chat-recent-more {
    opacity: 1;
    pointer-events: auto;
  }

  #knowledge .knowledge-policy-toolbar .knowledge-product-toolbar-main {
    align-items: stretch;
    flex-direction: column;
  }

  #knowledge .knowledge-policy-toolbar .knowledge-product-filters {
    display: grid;
    width: 100%;
    grid-template-columns: minmax(0, 1fr);
  }

  #knowledge .knowledge-policy-toolbar .knowledge-product-filters .field,
  #knowledge .knowledge-policy-toolbar .knowledge-product-filters .knowledge-product-name-field,
  #knowledge .knowledge-policy-toolbar .knowledge-product-filters .knowledge-level-field {
    width: auto;
    min-width: 0;
  }

  #knowledge .knowledge-policy-toolbar .knowledge-product-filters input,
  #knowledge .knowledge-policy-toolbar .knowledge-product-filters select {
    width: 100%;
    min-width: 0;
  }

  #knowledge .knowledge-policy-toolbar .actions {
    width: 100%;
    margin-left: 0;
  }

  #knowledge .record-table.knowledge-list {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  #knowledge .knowledge-policy-table {
    width: 1380px;
    min-width: 1380px;
  }

  /* A desktop sticky action column can cover most of a phone viewport.
     Keep actions in normal table flow so every field remains reachable by
     horizontally scrolling the table. */
  .route.list-page .table-wrap > table .table-actions,
  .route.list-page .table-wrap > table .ai-question-actions-column,
  .knowledge-list > .data-list-table .table-actions {
    position: static !important;
    right: auto !important;
    z-index: auto !important;
    box-shadow: none !important;
  }

  .route.list-page .table-wrap > table thead .table-actions,
  .route.list-page .table-wrap > table thead .ai-question-actions-column,
  .knowledge-list > .data-list-table thead .table-actions {
    background: var(--soft);
  }
}

@media (max-width: 520px) {
  .top-actions .platform-switch-button span,
  .top-actions .account-meta {
    display: none;
  }

  .top-actions .platform-switch-button {
    width: 34px;
    padding: 0;
    justify-content: center;
  }

  .top-actions .account-box {
    min-width: 40px;
    grid-template-columns: 30px;
    padding: 2px 4px;
  }

  .top-actions .account-box::after {
    display: none;
  }
}

@media (max-width: 420px) {
  .customer-attention-filters {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .customer-attention-chip {
    width: 100%;
    justify-content: space-between;
  }
}

/* Focused phone layouts for dense list and workspace pages. */
@media (max-width: 720px) {
  #demands.route.list-page.active,
  #plans.route.list-page.active {
    grid-template-rows: auto auto minmax(0, 1fr);
    gap: 10px;
  }

  #demands > .page-head,
  #plans > .page-head {
    align-items: stretch;
  }

  #demands > .page-head .actions,
  #plans > .page-head .actions {
    width: 100%;
  }

  #demands > .page-head .actions .btn,
  #plans > .page-head .actions .btn {
    flex: 1 1 auto;
  }

  #demands > .panel:not(.list-data-panel),
  #plans > .panel:not(.list-data-panel) {
    padding: 10px;
  }

  #demands .compact-filters,
  #plans .compact-filters {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    width: 100%;
    min-width: 0;
  }

  #demands .compact-filters > .field,
  #plans .compact-filters > .field {
    width: 100%;
    min-width: 0;
  }

  #demands .compact-filters input,
  #demands .compact-filters select,
  #demands .compact-filters .personnel-picker-trigger,
  #plans .compact-filters input,
  #plans .compact-filters select,
  #plans .compact-filters .personnel-picker-trigger {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
  }

  #plans .compact-filters .range-field,
  #plans .compact-filters .range-inputs {
    width: 100%;
    min-width: 0;
  }

  #plans .compact-filters .range-inputs {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 5px;
    align-items: center;
  }

  #plans .compact-filters .range-inputs .date-placeholder-wrap,
  #plans .compact-filters .range-inputs input[type="date"] {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
  }

  #demands .list-data-panel,
  #plans .list-data-panel {
    display: block;
    width: 100%;
    min-width: 0;
    overflow: visible;
  }

  #demands .list-data-panel > .table-wrap,
  #plans .list-data-panel > .table-wrap {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
  }

  #demands .demand-list-table,
  #plans .plan-list-table {
    min-width: 860px;
  }

  #demands .demand-list-table .data-list-actions,
  #plans .plan-list-table .data-list-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
  }

  #demands .demand-list-table .data-list-actions .btn,
  #plans .plan-list-table .data-list-actions .btn {
    flex: 0 0 auto;
  }

  /* Keep the history visible as its own scroll area above the chat composer. */
  #ai.route.active {
    display: grid;
    grid-template-rows: minmax(0, 1fr);
    align-content: start;
  }

  #ai .chat-shell {
    display: grid;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 196px minmax(520px, 1fr);
    gap: 10px;
    height: auto;
    min-height: 0;
    padding: 8px;
    overflow: visible;
  }

  #ai .chat-shell > aside.panel {
    display: block;
    width: 100%;
    height: 196px;
    min-height: 0;
    max-height: none;
    overflow: hidden;
  }

  #ai .chat-sidebar-inner {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    width: 100%;
    height: 100%;
    min-height: 0;
    padding: 10px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 10px;
  }

  #ai .chat-recent-head {
    grid-template-columns: minmax(120px, .8fr) minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    margin-bottom: 7px;
  }

  #ai .chat-recent-head h2 {
    font-size: 13px;
  }

  #ai .chat-recent-list-wrap {
    height: auto;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
  }

  #ai .chat-recent-list {
    display: grid;
    height: auto;
    min-height: 0;
    max-height: none;
    overflow: visible;
  }

  #ai .chat-recent-item {
    min-height: 34px;
  }

  #ai .chat-recent-more {
    opacity: 1;
    pointer-events: auto;
  }

  #ai .chat-main {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    min-height: 520px;
    height: min(72dvh, 720px);
    max-height: 720px;
  }

  #ai,
  #ai .chat-shell,
  #ai .chat-main,
  #ai .chat-header,
  #ai .chat-messages,
  #ai .chat-footer,
  #ai .chat-compose,
  #ai .chat-input-shell {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
  }

  #ai .chat-main {
    grid-template-columns: minmax(0, 1fr);
  }

  #ai .chat-messages {
    grid-template-columns: minmax(0, 1fr);
    overflow-x: hidden;
  }

  #ai .chat-messages > *,
  #ai .message-group,
  #ai .message,
  #ai .message-text,
  #ai .message .ai-markdown,
  #ai .message .ai-markdown p,
  #ai .ai-response-state {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  #ai .message-group.ai {
    width: 100%;
    max-width: 100%;
  }

  #ai .message.error {
    width: 100%;
  }

  #ai .message .ai-response-state {
    display: block;
    white-space: normal;
  }

  #todos .todo-data-views {
    display: block;
    width: 100%;
    min-width: 0;
    overflow: visible;
  }

  #todos .todo-calendar-panel:not(.is-hidden) {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
    min-width: 0;
    min-height: 0;
    gap: 12px;
    overflow: visible;
  }

  #todos .todo-calendar-main {
    display: grid;
    grid-template-rows: auto auto auto;
    width: 100%;
    min-width: 0;
    overflow: visible;
  }

  #todos .todo-calendar-week,
  #todos .todo-calendar-grid {
    width: 100%;
    min-width: 0;
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }

  #todos .todo-calendar-grid {
    grid-auto-rows: 58px;
    overflow: visible;
  }

  #todos .todo-calendar-day {
    min-width: 0;
    min-height: 58px;
  }

  #knowledge .knowledge-product-area.product-compare-page {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  #knowledge .product-compare-page > .knowledge-product-toolbar,
  #knowledge .product-compare-page > .product-compare-selector,
  #knowledge .product-compare-page > .product-compare-panel {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  #knowledge .product-compare-selector {
    padding: 10px;
  }

  #knowledge .product-compare-selector-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  #knowledge .product-compare-picker-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
    min-width: 0;
  }

  #knowledge .product-compare-picker {
    width: 100%;
    min-width: 0;
  }

  #knowledge .product-compare-picker-value {
    max-height: 88px;
  }

  #knowledge .product-compare-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  #knowledge .product-compare-actions .btn {
    min-width: 0;
  }

  #knowledge .product-compare-panel {
    display: grid;
    grid-template-rows: auto minmax(180px, 1fr);
    min-height: 260px;
    overflow: visible;
  }

  #knowledge .product-compare-table-wrap {
    width: 100%;
    min-width: 0;
    max-height: 60dvh;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  #knowledge .product-compare-table {
    width: max-content;
    min-width: 100%;
    table-layout: fixed;
    font-size: 12px;
  }

  #knowledge .product-compare-table th:first-child,
  #knowledge .product-compare-table td:first-child {
    width: 116px;
    min-width: 116px;
  }

  #knowledge .product-compare-table th:not(:first-child),
  #knowledge .product-compare-table td:not(:first-child) {
    width: 210px;
    min-width: 210px;
  }

  #knowledge .product-compare-table th,
  #knowledge .product-compare-table td {
    padding: 8px;
    font-size: 12px;
  }
}
