/**
 * iPhone / phone UI — compact density for injenium Core.
 * Priority: maximize content viewport; keep 16px inputs (no iOS zoom).
 */

:root {
  --touch-min: 40px;
  --touch-icon: 40px;
  --fs-control: 16px;
  --app-vh: 100dvh;
  --page-pad: 0.55rem;
}

/* —— Shell ≤1194 —— */
@media (max-width: 1194px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: clip;
  }

  .h-screen,
  #main-content,
  #main-content > .flex.h-screen.overflow-hidden {
    height: var(--app-vh);
    min-height: -webkit-fill-available;
  }

  .app-main-column,
  .app-content-scroll {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  .app-content-scroll {
    padding:
      0.35rem
      max(var(--page-pad), env(safe-area-inset-right))
      max(0.5rem, env(safe-area-inset-bottom))
      max(var(--page-pad), env(safe-area-inset-left)) !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
  }

  #page-content,
  #dashboard-view {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  #sidebar-toggle {
    min-width: var(--touch-min);
    min-height: var(--touch-min);
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* 16px font prevents iOS zoom — height can stay compact */
  input:not([type='checkbox']):not([type='radio']):not([type='range']):not([type='file']),
  select,
  textarea,
  .bom-search,
  .syslog-filters input,
  .syslog-filters select,
  .snmp-viewer-field input,
  .snmp-viewer-field select,
  .login-form input,
  .ui-modal-panel input,
  .ui-modal-panel select,
  .ui-modal-panel textarea {
    font-size: var(--fs-control) !important;
    line-height: 1.25 !important;
    min-height: 2.35rem;
    max-width: 100%;
  }

  .conn-icon-btn {
    width: var(--touch-icon);
    height: var(--touch-icon);
    min-width: var(--touch-icon);
    min-height: var(--touch-icon);
  }

  .conn-actions {
    gap: 0.35rem;
    flex-wrap: wrap;
  }
}

/* —— Full-bleed overlays ≤900 —— */
@media (max-width: 900px) {
  .ui-modal-root--open,
  #syslog-viewer-root.ui-modal-root--open,
  #snmp-viewer-root.ui-modal-root--open,
  #diagnostic-chat-viewer-root.ui-modal-root--open,
  #bom-modal-root.ui-modal-root--open,
  #ui-modal-root.ui-modal-root--open {
    padding: 0 !important;
    align-items: stretch !important;
    z-index: 400;
  }

  #bom-modal-root.ui-modal-root--open {
    z-index: 420;
  }

  .ui-modal-panel,
  .ui-modal-panel.snmp-viewer-panel,
  .ui-modal-panel.syslog-panel,
  .ui-modal-panel.diagnostic-chat-viewer-panel,
  .ui-modal-panel.bom-picker-panel,
  .ui-modal-panel.bom-i2c-panel,
  .ui-modal-panel.unit-label-modal-panel {
    width: 100% !important;
    max-width: 100vw !important;
    min-width: 0 !important;
    height: var(--app-vh) !important;
    max-height: var(--app-vh) !important;
    min-height: 0 !important;
    margin: 0 !important;
    border-radius: 0 !important;
    resize: none !important;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }

  .snmp-viewer-panel::after,
  .syslog-panel::after,
  .diagnostic-chat-viewer-panel::after {
    display: none !important;
  }

  .ui-modal-panel[style*='max-width'] {
    max-width: 100vw !important;
    width: 100% !important;
  }

  .ui-modal-panel [style*='grid-template-columns:1fr 1fr'],
  .ui-modal-panel [style*='grid-template-columns: 1fr 1fr'],
  .ui-modal-panel [style*='grid-template-columns:1fr 1fr 1fr'],
  .ui-modal-panel [style*='grid-template-columns: 1fr 1fr 1fr'],
  .bom-form-grid,
  .conn-settings-grid {
    grid-template-columns: 1fr !important;
  }

  .ui-modal-panel.conn-settings-panel {
    max-height: var(--app-vh) !important;
    overflow: auto !important;
  }

  .unit-label-modal__preview {
    min-height: 0;
    flex: 1 1 auto;
  }
  .unit-label-modal__frame {
    height: calc(var(--app-vh) - 8.5rem);
  }

  .conn-detail-panel--row {
    flex-wrap: wrap;
    overflow-x: visible;
    row-gap: 0.4rem;
  }

  .conn-detail-seg {
    white-space: normal;
    flex: 1 1 auto;
    min-width: min(100%, 8rem);
    border-right: 0;
    padding-right: 0;
  }

  .conn-detail-metrics {
    flex-wrap: wrap;
  }
}

/* —— Phone density ≤767 —— */
@media (max-width: 767px) {
  header.flex.h-16 {
    height: auto !important;
    min-height: 2.75rem;
    padding:
      max(0.2rem, env(safe-area-inset-top))
      max(0.45rem, env(safe-area-inset-right))
      0.2rem
      max(0.35rem, env(safe-area-inset-left)) !important;
  }

  #breadcrumb {
    font-size: 0.78rem;
    min-width: 0;
  }

  .breadcrumb-link,
  .breadcrumb-page {
    max-width: 7.5rem;
  }

  /* Dense page chrome */
  .data-table-container,
  .section-card,
  .dashboard-stat-card,
  .chart-area {
    padding: 0.55rem 0.65rem !important;
    margin-bottom: 0.45rem !important;
  }

  .section-cards,
  .dashboard-cards-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 0.35rem !important;
  }

  .section-card,
  .dashboard-stat-card {
    min-height: 0 !important;
  }

  .section-card .value,
  .ui-stat-value {
    font-size: 1.15rem !important;
    line-height: 1.2 !important;
  }

  .section-card h4,
  .dashboard-stat-card__title {
    font-size: 0.68rem !important;
    margin-bottom: 0.15rem !important;
  }

  /* Connection cards */
  .conn-table-wrap {
    width: 100%;
    overflow: visible;
  }

  table.conn-table {
    display: block !important;
    width: 100% !important;
    overflow: visible !important;
    white-space: normal !important;
    border: 0;
  }

  table.conn-table thead {
    display: none !important;
  }

  table.conn-table tbody {
    display: flex !important;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
  }

  table.conn-table tr.conn-row {
    display: grid !important;
    grid-template-columns: auto 1fr auto;
    grid-template-areas:
      'health label status'
      'host host host'
      'software software software'
      'unit unit unit'
      'checked checked checked'
      'actions actions actions';
    gap: 0.2rem 0.45rem;
    width: 100%;
    margin: 0;
    padding: 0.65rem 0.7rem;
    border: 1px solid hsl(var(--border));
    border-radius: 0.6rem;
    background: #fff;
  }

  table.conn-table tr.conn-row > td {
    display: block !important;
    width: auto !important;
    max-width: none !important;
    border: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: unset !important;
  }

  table.conn-table .conn-cell-health {
    grid-area: health;
    display: flex !important;
    align-items: center;
    padding-top: 0.15rem !important;
  }

  table.conn-table .conn-cell-label {
    grid-area: label;
    font-size: 0.98rem !important;
    font-weight: 700 !important;
    line-height: 1.25 !important;
  }

  table.conn-table .conn-cell-status {
    grid-area: status;
    justify-self: end;
  }

  table.conn-table .conn-cell-host {
    grid-area: host;
  }
  table.conn-table .conn-cell-software {
    grid-area: software;
  }
  table.conn-table .conn-cell-unit {
    grid-area: unit;
    color: hsl(var(--muted-foreground));
    font-size: 0.8rem !important;
  }
  table.conn-table .conn-cell-checked {
    grid-area: checked;
    font-size: 0.72rem !important;
  }

  table.conn-table .conn-cell-actions {
    grid-area: actions;
    margin-top: 0.2rem;
    padding-top: 0.45rem !important;
    border-top: 1px solid hsl(var(--border)) !important;
  }

  table.conn-table .conn-cell-host::before,
  table.conn-table .conn-cell-software::before,
  table.conn-table .conn-cell-unit::before,
  table.conn-table .conn-cell-checked::before {
    content: attr(data-label);
    display: inline-block;
    min-width: 4.8rem;
    margin-right: 0.3rem;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: hsl(var(--muted-foreground));
    font-family: inherit;
  }

  table.conn-table tr.conn-ota-row,
  table.conn-table tr.conn-detail-row,
  table.conn-table tr.conn-error-row {
    display: block !important;
    width: 100%;
    border: 1px solid hsl(var(--border));
    border-radius: 0.6rem;
    background: hsl(210 40% 98%);
    margin-top: -0.25rem;
    margin-bottom: 0.25rem;
    overflow: hidden;
  }

  table.conn-table tr.conn-ota-row > td,
  table.conn-table tr.conn-detail-row > td,
  table.conn-table tr.conn-error-row > td {
    display: block !important;
    width: 100% !important;
    padding: 0.5rem 0.65rem !important;
    white-space: normal !important;
    border: 0 !important;
  }

  table.conn-table tr.conn-detail-row.hidden {
    display: none !important;
  }

  /* —— SNMP compact chrome —— */
  .snmp-viewer-head {
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    padding: 0.45rem 0.65rem !important;
    gap: 0.4rem !important;
    align-items: center !important;
  }

  .snmp-viewer-head > div:first-child {
    min-width: 0;
    flex: 1 1 auto;
  }

  .snmp-viewer-head .ui-modal-title {
    font-size: 1rem !important;
    margin: 0 !important;
    line-height: 1.2 !important;
  }

  .snmp-viewer-sub {
    margin: 0.1rem 0 0 !important;
    font-size: 0.68rem !important;
    line-height: 1.25 !important;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .snmp-viewer-head-actions {
    width: auto !important;
    flex-wrap: nowrap !important;
    gap: 0.3rem !important;
  }

  .snmp-viewer-head-actions .ui-modal-btn,
  .snmp-viewer-btn-compact {
    flex: 0 0 auto !important;
    min-height: 2rem !important;
    height: 2rem !important;
    padding: 0 0.55rem !important;
    font-size: 0.72rem !important;
    line-height: 1 !important;
  }

  .snmp-viewer-fold__summary {
    padding: 0.4rem 0.65rem !important;
    font-size: 0.72rem !important;
  }

  .snmp-viewer-controls {
    padding: 0.45rem 0.65rem 0.55rem !important;
    gap: 0.4rem !important;
  }

  .snmp-viewer-field {
    gap: 0.12rem !important;
    font-size: 0.65rem !important;
  }

  .snmp-viewer-field--half {
    flex: 1 1 calc(50% - 0.25rem) !important;
    min-width: 0 !important;
  }

  .snmp-viewer-field--center,
  .snmp-viewer-field--custom {
    flex: 1 1 100% !important;
    min-width: 0 !important;
    width: 100% !important;
  }

  .snmp-viewer-field select,
  .snmp-viewer-field input,
  .snmp-viewer-field input[type='datetime-local'],
  .snmp-viewer-field input[type='number'] {
    min-height: 2.35rem !important;
    height: 2.35rem !important;
    font-size: 16px !important;
    padding: 0.25rem 0.45rem !important;
  }

  .snmp-viewer-controls__nav {
    gap: 0.35rem !important;
  }

  .snmp-viewer-controls__nav .ui-modal-btn {
    min-height: 2.25rem !important;
    padding: 0.35rem 0.5rem !important;
    font-size: 0.78rem !important;
  }

  .snmp-viewer-scrubber {
    padding: 0.35rem 0.65rem 0.45rem !important;
  }

  .snmp-viewer-scrubber__meta {
    margin-bottom: 0.15rem !important;
    font-size: 0.62rem !important;
    gap: 0.35rem !important;
  }

  .snmp-viewer-scrubber__hint {
    display: none !important;
  }

  .snmp-viewer-scrubber__legend {
    margin: 0 0 0.2rem !important;
    gap: 0.3rem 0.5rem !important;
    font-size: 0.58rem !important;
  }

  .snmp-viewer-scrubber__track-wrap {
    height: 1.65rem !important;
    padding-bottom: 0.2rem !important;
  }

  .snmp-viewer-scrubber__cursor {
    box-shadow: none !important;
    filter: none !important;
    -webkit-filter: none !important;
  }

  .snmp-viewer-scrubber__range::-webkit-slider-thumb,
  .snmp-viewer-scrubber__range::-moz-range-thumb {
    opacity: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
  }

  .snmp-collapse__summary::before,
  .snmp-viewer-fold__summary::after,
  .syslog-fold__summary::after {
    box-shadow: none !important;
    filter: none !important;
    text-shadow: none !important;
  }

  .snmp-viewer-body {
    padding: 0.4rem 0.55rem 0.75rem !important;
  }

  /* Drop duplicate title block — chrome already says SNMP metrics */
  .snmp-viewer-body .syslog-metrics-head {
    display: none !important;
  }

  .snmp-viewer-body .syslog-metrics-scroll {
    padding-top: 0.15rem;
  }

  .snmp-viewer-logs {
    margin-top: 0.55rem !important;
    padding-top: 0.45rem !important;
  }

  .snmp-viewer-logs__title {
    font-size: 0.85rem !important;
  }

  .snmp-viewer-logs__sub {
    margin: 0.1rem 0 0.35rem !important;
    font-size: 0.68rem !important;
  }

  .snmp-viewer-logs__list {
    max-height: min(28vh, 220px);
  }

  .snmp-chart {
    margin: 0 0 0.4rem !important;
    padding: 0.35rem 0.45rem 0.3rem !important;
  }

  .snmp-chart__svg {
    height: 64px !important;
  }

  .snmp-collapse__summary {
    min-height: 2.2rem !important;
    padding: 0.35rem 0.5rem !important;
  }

  /* Syslog compact */
  .syslog-head {
    padding: 0.45rem 0.65rem !important;
    gap: 0.4rem !important;
  }

  .syslog-head .ui-modal-title {
    font-size: 1rem !important;
  }

  .syslog-sub {
    font-size: 0.68rem !important;
    -webkit-line-clamp: 1;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .syslog-head-actions {
    width: auto !important;
    gap: 0.3rem !important;
  }

  .syslog-head-actions .ui-modal-btn {
    min-height: 2rem !important;
    height: 2rem !important;
    padding: 0 0.55rem !important;
    font-size: 0.72rem !important;
  }

  .syslog-fold__summary {
    padding: 0.4rem 0.65rem !important;
    font-size: 0.72rem !important;
  }

  .syslog-stats {
    padding: 0.35rem 0.65rem 0.25rem !important;
  }

  .syslog-chip {
    min-height: 1.85rem !important;
    padding: 0.2rem 0.5rem !important;
    font-size: 0.68rem !important;
  }

  .syslog-filters {
    grid-template-columns: 1fr 1fr !important;
    gap: 0.35rem !important;
    padding: 0.35rem 0.65rem 0.55rem !important;
  }

  .syslog-time-field,
  .syslog-time-actions,
  .syslog-time-hint,
  .syslog-filters input[type='search'],
  .syslog-filters .syslog-search {
    grid-column: 1 / -1;
  }

  .syslog-time-actions .ui-modal-btn {
    min-height: 2.25rem !important;
    font-size: 0.78rem !important;
  }

  .syslog-body {
    flex-direction: column;
  }

  .syslog-stream {
    flex: 1 1 55%;
    min-height: 10rem;
  }

  .syslog-metrics {
    width: 100%;
    min-width: 0;
    max-height: 34vh;
    border-left: none;
    border-top: 1px solid hsl(var(--border));
  }

  /* BOM compact */
  .bom-page {
    gap: 0.45rem !important;
    padding-bottom: 0.75rem !important;
  }

  .bom-toolbar {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.55rem !important;
  }

  .bom-toolbar__title {
    font-size: 1.05rem !important;
  }

  .bom-toolbar__subtitle {
    display: none !important;
  }

  .bom-toolbar__actions,
  .bom-toolbar > div:last-child {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-left: auto;
  }

  .bom-toolbar .bom-btn,
  .bom-toolbar button,
  .bom-btn--primary {
    min-height: 2.25rem !important;
    padding: 0.35rem 0.7rem !important;
    font-size: 0.8rem !important;
    width: auto !important;
    flex: 0 0 auto !important;
  }

  .bom-search {
    width: 100% !important;
    min-width: 0 !important;
    font-size: 16px !important;
    min-height: 2.35rem !important;
  }

  .bom-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0.35rem !important;
  }

  /* BOM groups: less chrome, no nested squeeze */
  .bom-page {
    gap: 0.4rem !important;
  }

  .bom-toolbar__subtitle {
    display: none !important;
  }

  .bom-board-groups {
    gap: 0.45rem !important;
  }

  .bom-board-group {
    padding: 0 !important;
  }

  .bom-board-group__summary {
    min-height: 0 !important;
    padding: 0.55rem 0.65rem !important;
    gap: 0.4rem 0.55rem !important;
  }

  .bom-board-group__summary::before {
    box-shadow: none !important;
    filter: none !important;
    -webkit-filter: none !important;
    background: transparent !important;
  }

  .bom-board-group__summary .bom-entity-img--list {
    width: 2.5rem !important;
    height: 2.5rem !important;
    min-width: 2.5rem !important;
  }

  .bom-board-group__table,
  .data-table-container.bom-board-group__table {
    padding: 0.4rem !important;
    margin: 0 !important;
    overflow: visible !important;
  }

  .bom-dl__row {
    grid-template-columns: 1fr !important;
    gap: 0.1rem;
  }

  .bom-btn--sm {
    min-height: 2rem;
    min-width: 2rem;
    padding: 0.3rem 0.55rem;
  }

  .bom-picker-list {
    overflow-x: hidden;
    max-width: 100%;
  }

  .bom-picker-table--library th:nth-child(2),
  .bom-picker-table--library td:nth-child(2),
  .bom-picker-table--library th:nth-child(4),
  .bom-picker-table--library td:nth-child(4),
  .bom-picker-table--library th:nth-child(5),
  .bom-picker-table--library td:nth-child(5) {
    display: none !important;
  }

  .bom-picker-list th.bom-picker-col-num,
  .bom-picker-list td.bom-picker-col-num,
  .bom-picker-list th.bom-picker-col-cost,
  .bom-picker-list td.bom-picker-col-cost {
    min-width: 0 !important;
    width: auto !important;
    max-width: none !important;
  }

  .release-channel-grid {
    grid-template-columns: 1fr !important;
    gap: 0.45rem !important;
  }

  #page-content .flex.items-center.justify-between {
    flex-wrap: wrap;
    gap: 0.35rem;
  }

  #page-content h2,
  #page-content h3,
  .bom-toolbar__title {
    margin-bottom: 0.2rem !important;
  }

  .devices-list {
    padding: 0.45rem !important;
  }

  .devices-list > h3 {
    display: none;
  }

  #page-content,
  #dashboard-view,
  .app-content-scroll {
    overflow-x: clip;
    max-width: 100%;
  }

  /*
   * Mobile stack tables: each row becomes a readable card.
   * No forced column crush, no horizontal scroll.
   */
  table.mobile-stack {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    table-layout: auto !important;
    overflow: visible !important;
    white-space: normal !important;
    border: 0 !important;
  }

  table.mobile-stack thead {
    display: none !important;
  }

  table.mobile-stack tbody {
    display: flex !important;
    flex-direction: column;
    gap: 0.45rem;
    width: 100%;
  }

  table.mobile-stack tr {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.2rem 0.55rem;
    width: 100%;
    margin: 0;
    padding: 0.65rem 0.7rem;
    border: 1px solid hsl(var(--border));
    border-radius: 0.6rem;
    background: #fff;
    box-sizing: border-box;
  }

  table.mobile-stack td {
    display: flex !important;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.55rem;
    min-width: 0 !important;
    max-width: none !important;
    width: auto !important;
    padding: 0.12rem 0 !important;
    border: 0 !important;
    font-size: 0.82rem !important;
    line-height: 1.35 !important;
    white-space: normal !important;
    overflow-wrap: break-word;
    word-break: normal;
    grid-column: 1 / -1;
  }

  table.mobile-stack td[data-label]::before {
    content: attr(data-label);
    flex: 0 0 5.25rem;
    max-width: 5.25rem;
    color: hsl(var(--muted-foreground));
    font-size: 0.68rem;
    font-weight: 650;
    letter-spacing: 0.02em;
    text-transform: uppercase;
  }

  table.mobile-stack td[data-label='']::before,
  table.mobile-stack td:not([data-label])::before {
    content: none;
  }

  table.mobile-stack td > * {
    min-width: 0;
    max-width: 100%;
  }

  table.mobile-stack .bom-truncate {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: unset !important;
    display: block;
  }

  /* Devices card: PN + status on first row */
  .devices-list table.mobile-stack td[data-label='P/N'] {
    grid-column: 1;
    grid-row: 1;
    font-size: 0.92rem !important;
    font-weight: 700;
  }

  .devices-list table.mobile-stack td[data-label='P/N']::before {
    display: none;
  }

  .devices-list table.mobile-stack td[data-label='Status'] {
    grid-column: 2;
    grid-row: 1;
    justify-content: flex-end;
    align-items: center;
  }

  .devices-list table.mobile-stack td[data-label='Status']::before {
    display: none;
  }

  .devices-list table.mobile-stack .dashboard-pill {
    max-width: none;
    white-space: nowrap;
  }

  /* Board / kit variants */
  table.mobile-stack--board td.bom-img-cell,
  table.mobile-stack--kit td.bom-img-cell {
    display: none !important;
  }

  table.mobile-stack--board td[data-label='HW rev'],
  table.mobile-stack--kit td[data-label='HW rev'] {
    grid-column: 1;
    grid-row: 1;
    font-size: 0.95rem !important;
    font-weight: 700;
    align-items: center;
  }

  table.mobile-stack--board td[data-label='HW rev']::before,
  table.mobile-stack--kit td[data-label='HW rev']::before {
    display: none;
  }

  table.mobile-stack--board td.bom-row-actions,
  table.mobile-stack--kit td.bom-row-actions {
    grid-column: 2;
    grid-row: 1;
    justify-content: flex-end;
    align-items: center;
    gap: 0.25rem;
    padding: 0 !important;
  }

  table.mobile-stack--board td[data-label='Attention'],
  table.mobile-stack--board td[data-label='Updated'] {
    display: none !important;
  }

  table.mobile-stack--kit td[data-label='Notes'] {
    display: none !important;
  }

  table.mobile-stack--board .bom-match,
  table.mobile-stack--board .match-progress,
  table.mobile-stack .bom-progress,
  table.mobile-stack [class*='match'] {
    max-width: 100%;
  }

  .login-card {
    width: min(22rem, 100%) !important;
    padding: 1.1rem !important;
  }

  .login-form input,
  .login-form button {
    min-height: 2.5rem;
    font-size: 16px !important;
  }
}

@media (max-width: 390px) {
  .section-cards,
  .dashboard-cards-grid {
    grid-template-columns: 1fr 1fr !important;
  }

  .section-cards > :last-child,
  .dashboard-cards-grid > :last-child {
    grid-column: 1 / -1;
  }

  .snmp-viewer-head-actions .ui-modal-btn {
    padding: 0 0.4rem !important;
    font-size: 0.68rem !important;
  }
}

@media (max-width: 900px) {
  .docs-layout {
    grid-template-columns: 1fr;
  }
  .docs-toc {
    position: static;
    max-height: 12rem;
  }
  .docs-field input,
  .docs-field select {
    min-width: 0;
    width: 100%;
  }
  .docs-toolbar__filters {
    width: 100%;
  }
}

@media (max-width: 900px) {
  .agent-chat-page {
    grid-template-columns: 1fr;
    min-height: calc(100vh - 4.5rem);
  }
  .agent-chat-sidebar {
    max-height: 11rem;
    border-right: 0;
    border-bottom: 1px solid hsl(var(--border));
  }
  .agent-chat-threads {
    display: flex;
    gap: 0.35rem;
    overflow-x: auto;
    padding: 0.5rem 0.75rem 0.75rem;
  }
  .agent-chat__thread-row {
    flex: none;
    min-width: 11.5rem;
    border: 1px solid hsl(var(--border));
    margin-bottom: 0;
  }
  .agent-chat__thread {
    min-width: 0;
    margin-bottom: 0;
    border: 0;
  }
  .agent-chat__thread-delete {
    opacity: 0.7;
  }
}
