/*
 * NEXORA 5.20 – responsive application layer
 * The desktop canvas is intentionally untouched. Every rule below is scoped to
 * tablet or phone viewports and loaded after all module styles.
 */

@media (max-width: 1280px) {
  html, body { max-width: 100%; overflow-x: hidden; overflow-x: clip; }
  body.app-page { min-height: 100dvh; }
  .app-shell { min-height: 100dvh; }
  .main-area { min-height: 100dvh; }
  .sidebar { height: 100dvh; }
  .content-area { min-width: 0; }

  /* Navigation and global header */
  .topbar { padding-top: env(safe-area-inset-top); height: calc(72px + env(safe-area-inset-top)); }
  .topbar-title { min-width: 0; }
  .topbar-title strong { max-width: 28vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-actions { min-width: 0; }
  .notification-center { position: static; }
  .notification-panel { z-index: 160; }
  .workspace-tabs {
    display: flex;
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }
  .workspace-tabs::-webkit-scrollbar { display: none; }
  .ticket-work-tab { flex: 0 0 auto; scroll-snap-align: start; }

  /* Common page tools and tabs */
  .module-tabs,
  .accounting-tabs,
  .accounting-primary-tabs,
  .accounting-subtabs,
  .administration-tabs,
  .time-tabs,
  .ticket-section-tabs,
  .customer-tabs,
  .billing-status-tabs,
  .research-type-filters {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }
  .module-tabs::-webkit-scrollbar,
  .accounting-tabs::-webkit-scrollbar,
  .accounting-primary-tabs::-webkit-scrollbar,
  .accounting-subtabs::-webkit-scrollbar,
  .administration-tabs::-webkit-scrollbar,
  .time-tabs::-webkit-scrollbar,
  .ticket-section-tabs::-webkit-scrollbar,
  .customer-tabs::-webkit-scrollbar,
  .billing-status-tabs::-webkit-scrollbar,
  .research-type-filters::-webkit-scrollbar { display: none; }
  .module-tabs > button,
  .accounting-tabs > button,
  .accounting-primary-tabs > button,
  .accounting-subtabs > button,
  .administration-tabs > button,
  .time-tabs > button,
  .ticket-section-tabs > button,
  .customer-tabs > button,
  .billing-status-tabs > button,
  .research-type-filters > button { flex: 0 0 auto; scroll-snap-align: start; }

  .panel,
  .ticket-card-block,
  .time-card,
  .business-settings-card,
  .admin-settings-section { min-width: 0; }
  .panel-head,
  .section-title,
  .document-editor-section-head,
  .admin-settings-section-head { min-width: 0; }
  .panel-head > div,
  .section-title > div,
  .document-editor-section-head > div,
  .admin-settings-section-head > div { min-width: 0; }
  .panel-head h2,
  .section-title h2,
  .document-editor-section-head h3,
  .admin-settings-section-head h3 { overflow-wrap: anywhere; }

  /* Forms never push the viewport wider. */
  input, select, textarea, button { max-width: 100%; }
  input, select, textarea { font-size: 16px; }
  .form-grid,
  .form-grid.two,
  .form-grid.three,
  .form-grid.four,
  .settings-fields,
  .admin-company-grid,
  .number-sequence-grid,
  .datev-form-grid,
  .document-text-block-grid,
  .central-settings-grid { min-width: 0; }
  .form-grid > *,
  .settings-fields > *,
  .admin-company-grid > *,
  .number-sequence-grid > *,
  .datev-form-grid > *,
  .document-text-block-grid > *,
  .central-settings-grid > * { min-width: 0; }

  /* Dense data stays complete and becomes deliberately horizontally scrollable. */
  .table-wrap {
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }
  .data-table:not(.ticket-table),
  .accounting-table,
  .inventory-table,
  .time-table { min-width: 720px; }
  .data-table th:nth-child(5),
  .data-table td:nth-child(5) { display: table-cell; }
  /* Dialogs, drawers, previews */
  .overlay,
  .central-dialog-backdrop,
  .receipt-preview-backdrop,
  .receipt-correction-backdrop { padding: max(8px,env(safe-area-inset-top)) max(8px,env(safe-area-inset-right)) max(8px,env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left)); }
  .modal,
  .modal.wide,
  .central-dialog,
  .document-workspace-modal,
  .receipt-preview-modal,
  .receipt-correction-modal {
    width: 100%;
    max-width: 100%;
    max-height: calc(100dvh - 16px);
    overscroll-behavior: contain;
  }
  .modal-head,
  .receipt-preview-modal > header,
  .receipt-correction-modal > header { position: sticky; top: 0; z-index: 7; background: rgba(255,255,255,.98); }
  .modal-actions,
  .central-form-actions { padding-bottom: max(5px,env(safe-area-inset-bottom)); }
  .close-button { flex: 0 0 42px; width: 42px; height: 42px; }

  /* Tickets */
  .ticket-tab-strip { max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .ticket-tab-strip::-webkit-scrollbar { display: none; }
  .ticket-work-tab { flex: 0 0 auto; max-width: min(320px,78vw); }
  .ticket-workspace { min-width: 0; }
  .ticket-workspace-head { min-width: 0; }
  .ticket-heading-meta,
  .ticket-party,
  .ticket-head-actions { min-width: 0; }
  .ticket-heading-meta > *,
  .ticket-party > * { min-width: 0; }
  .quick-access-grid { overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .quick-access-grid::-webkit-scrollbar { display: none; }
  .information-layout,
  .ticket-two-column,
  .ticket-overview-grid,
  .work-split,
  .work-split.equal-columns,
  .files-split { grid-template-columns: minmax(0,1fr); }
  .ticket-controls,
  .work-session-live { grid-template-columns: minmax(0,1fr); }
  .structured-row,
  .attachment-row { min-width: 0; }
  .structured-row > *,
  .attachment-row > * { min-width: 0; }
  .structured-row strong,
  .attachment-row strong,
  .attachment-row small { overflow-wrap: anywhere; }

  /* Customers */
  .customer-layout { min-width: 0; }
  .customer-list,
  .customer-detail { min-width: 0; }
  .customer-table-toolbar,
  .customer-panel-search { flex-wrap: wrap; }
  .customer-table-toolbar .search-field,
  .customer-panel-search .search-field { min-width: min(100%,260px); flex: 1 1 260px; }
  .customer-tab-panel { min-width: 0; }
  .customer-meta,
  .customer-info-grid,
  .contact-grid { min-width: 0; }

  /* Documents and invoicing */
  .document-commandbar,
  .document-contextbar,
  .document-layout,
  .document-detail,
  .document-detail-content,
  .document-preview-card,
  .document-form { min-width: 0; }
  .document-command-actions,
  .document-actions,
  .document-head-actions { min-width: 0; }
  .document-item-editor { min-width: 0; }
  .document-item-grid { min-width: 0; }
  .document-detail-facts { min-width: 0; }
  .document-pdf-viewer { max-width: 100%; }
  .document-preview-card > header { flex-wrap: wrap; }

  /* Billing */
  .billing-layout,
  .billing-text-columns { grid-template-columns: minmax(0,1fr); }
  .billing-list,
  .billing-detail,
  .billing-text-columns > article { min-width: 0; }

  /* Inventory */
  .inventory-layout,
  .inventory-main,
  .inventory-tree,
  .inventory-detail-card,
  .inventory-form-section { min-width: 0; }
  .inventory-toolbar { min-width: 0; }
  .inventory-toolbar label { min-width: 0; }
  .inventory-folder > button,
  .inventory-tree > button { min-height: 44px; }

  /* Accounting */
  .accounting-toolbar,
  .accounting-export-card,
  .banking-grid,
  .online-portals-layout,
  .payment-order-list,
  .receipt-preview-layout,
  .receipt-correction-layout { min-width: 0; }
  .receipt-drop-field { max-width: 100%; }
  .receipt-preview-document,
  .receipt-correction-preview { min-width: 0; }
  .receipt-preview-image { max-width: 100%; height: auto; object-fit: contain; }
  .receipt-item-lines > * { overflow-wrap: anywhere; }
  .receipt-background-progress { z-index: 880; }

  /* Time tracking and calendars */
  .time-platform,
  .time-clock,
  .time-card,
  .time-chart,
  .daily-time-chart { min-width: 0; }
  .calendar-head { flex-wrap: wrap; }
  .calendar-controls { flex-wrap: wrap; }
  .calendar-weekdays,
  .calendar-items,
  .calendar-week-view { min-width: 680px; }
  .time-card:has(.calendar-weekdays),
  .time-card:has(.calendar-week-view),
  .team-calendar { overflow-x: auto; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
  .time-two-column { grid-template-columns: minmax(0,1fr); }
  .time-form.compact { grid-template-columns: minmax(0,1fr); }
  .schedule-grid { min-width: 680px; }

  /* Research, reporting, AI, administration */
  .research-toolbar,
  .research-global-filters,
  .research-results,
  .reports-grid,
  .integrated-admin-card,
  .ai-chat-shell,
  .ai-chat-workspace,
  .ai-chat-threads { min-width: 0; }
  .research-filter-popover { max-width: calc(100vw - 32px); }
  .reports-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .integrated-admin-card iframe,
  .integrated-admin-full iframe { width: 100%; min-height: 760px; }
}

/*
 * A 258 px desktop sidebar leaves too little usable width on common 10/11-inch
 * tablets. Switch to the existing off-canvas navigation before content starts
 * clipping; the desktop layout above this breakpoint remains unchanged.
 */
@media (max-width: 1120px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform .18s ease;
  }
  .sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: 20px 0 50px rgba(4,20,31,.25);
  }
  .main-area { width: 100%; margin-left: 0; }
  .mobile-menu { display: inline-flex; }
  .topbar { padding-right: 18px; padding-left: 18px; }
  .content-area { padding-right: 18px; padding-left: 18px; }
}

@media (max-width: 680px) {
  /* Global phone shell */
  html { scroll-padding-top: calc(64px + env(safe-area-inset-top)); }
  .sidebar { width: min(88vw,310px); }
  .topbar { height: calc(64px + env(safe-area-inset-top)); padding-right: max(8px,env(safe-area-inset-right)); padding-left: max(8px,env(safe-area-inset-left)); }
  .topbar-title { display: flex; }
  .topbar-title .eyebrow { display: none; }
  .topbar-title strong { max-width: 24vw; font-size: 13px; }
  .save-state { display: none; }
  .company-switcher { flex: 0 0 auto; }
  .company-switcher-current { min-width: 40px; max-width: 40px; min-height: 40px; grid-template-columns: 32px; padding: 3px; }
  .company-switcher-mark { width: 32px; height: 32px; }
  .mobile-menu,
  .icon-button { width: 40px; height: 40px; flex-basis: 40px; }
  .topbar-actions .primary-button { width: 40px; min-width: 40px; height: 40px; min-height: 40px; }
  .modal.app-download-modal { width: 100%; }
  .app-download-grid { grid-template-columns: 1fr; }
  .app-download-card { min-height: 88px; padding: 13px; }
  .app-download-brand { width: 46px; height: 46px; }
  .workspace-tabs { top: calc(64px + env(safe-area-inset-top)); }
  .content-area { padding-top: 12px; }
  .page-intro { margin-bottom: 14px; }
  .page-intro h1 { font-size: 23px; }
  .panel { border-radius: 11px; }
  .panel-head { align-items: flex-start; flex-wrap: wrap; padding: 14px 13px 11px; }
  .panel-head > button,
  .panel-head > .table-actions { margin-left: auto; }
  .section-title { flex-wrap: wrap; }
  .module-tabs { margin-bottom: 12px; padding: 4px; }
  .module-tabs button { min-height: 40px; padding: 0 12px; }
  .primary-button,
  .secondary-button,
  .ghost-button,
  .danger-button,
  .danger-outline-button,
  .small-button { min-height: 42px; }
  input:not([type="checkbox"]):not([type="radio"]),
  select,
  textarea { font-size: 16px !important; }

  /* Phone forms */
  .form-grid,
  .form-grid.two,
  .form-grid.three,
  .form-grid.four,
  .settings-fields,
  .admin-company-grid,
  .number-sequence-grid,
  .datev-form-grid,
  .document-text-block-grid,
  .central-settings-grid,
  .document-item-grid,
  .document-detail-facts,
  .inventory-detail-card dl,
  .account-mini-stats { grid-template-columns: minmax(0,1fr) !important; }
  .form-grid > .full,
  .document-item-grid > .full,
  .document-detail-facts > div:last-child { grid-column: auto !important; }
  label { min-width: 0; }
  label > input,
  label > select,
  label > textarea { width: 100%; }
  .check-row { align-items: flex-start; }

  /* Tables retain all columns; the wrapper owns scrolling. */
  .data-table:not(.ticket-table),
  .accounting-table,
  .inventory-table,
  .time-table { min-width: 680px; }

  /* Tickets */
  .ticket-tab-strip { margin: 0 -2px; }
  .ticket-work-tab { max-width: 82vw; }
  .ticket-workspace-head,
  .ticket-controls,
  .ticket-card-block { padding: 13px; }
  .ticket-controls { gap: 12px; }
  .ticket-workspace h1 { font-size: 20px; }
  .ticket-heading-meta { flex-wrap: wrap; }
  .ticket-party { display: grid; grid-template-columns: minmax(0,1fr); }
  .ticket-quick-access { grid-template-columns: minmax(0,1fr); }
  .quick-access-label { display: none; }
  .quick-access-grid { display: flex; margin: 0 -3px; padding-bottom: 3px; }
  .quick-access-button { flex: 0 0 72px; width: 72px; height: 64px; }
  .ticket-section-tabs { margin-right: -5px; margin-left: -5px; }
  .ticket-section-tabs button { padding: 0 11px; }
  .ticket-table tr.ticket-overview-row { grid-template-columns: minmax(0,1fr); }
  .ticket-table td:nth-child(n+2) { grid-column: 1; }
  .ticket-table td:last-child { justify-content: flex-end; }
  .attachment-row { align-items: flex-start; flex-wrap: wrap; }
  .attachment-row > div { flex: 1 1 180px; }
  .attachment-actions { flex: 1 0 100%; }
  .attachment-actions a,
  .attachment-actions button { display: inline-flex; min-height: 40px; align-items: center; justify-content: center; }

  /* Customers */
  .customer-layout { display: block; }
  .customer-list { max-height: 52dvh; margin-bottom: 12px; overflow-y: auto; overscroll-behavior: contain; }
  .customer-detail-head { grid-template-columns: 48px minmax(0,1fr); padding: 13px; }
  .customer-detail-head .company-avatar { width: 48px; height: 48px; flex-basis: 48px; }
  .detail-actions { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .customer-tabs { margin: 0 10px; }
  .customer-info-grid { margin: 10px; }
  .customer-table-toolbar { padding: 10px; }
  .contact-grid,
  .mini-ticket-list { padding-right: 10px; padding-left: 10px; }

  /* Documents */
  .document-commandbar,
  .document-contextbar { padding: 9px; }
  .document-command-actions,
  .document-head-actions,
  .document-actions,
  .page-actions { display: grid; grid-template-columns: minmax(0,1fr); width: 100%; }
  .document-command-actions > *,
  .document-head-actions > *,
  .document-actions > *,
  .page-actions > * { width: 100%; }
  .document-layout { display: block; }
  .document-list { margin-bottom: 12px; max-height: 42dvh; overflow: auto; }
  .document-detail-content { padding: 12px; }
  .document-detail-head { padding: 12px; }
  .document-detail-head h2 { font-size: 21px; }
  .document-total-cards { grid-template-columns: minmax(0,1fr); }
  .document-editor-section,
  .document-item-section { padding: 12px; }
  .document-item-editor > header { align-items: flex-start; flex-wrap: wrap; }
  .document-item-controls { margin-left: auto; }
  .document-item-controls button,
  .inventory-row-actions button,
  .row-arrow { min-width: 40px; min-height: 40px; }
  .document-preview-card > header { padding: 13px; }
  .document-pdf-viewer { height: 62dvh; }
  .document-workspace-modal .document-form { padding: 10px; }
  .document-workspace-modal .modal-actions { margin-right: -10px; margin-bottom: -10px; margin-left: -10px; padding: 11px; }

  /* Inventory */
  .inventory-layout { display: grid; grid-template-columns: minmax(0,1fr); }
  .inventory-tree { position: static; display: block; max-height: 34dvh; margin-bottom: 10px; overflow: auto; }
  .inventory-folder { display: block; }
  .inventory-tree > button,
  .inventory-folder > button { width: 100%; min-width: 0; border-right: 0; border-bottom: 1px solid #e4ecef; }
  .inventory-folder > button.child { padding-left: 30px; }
  .inventory-toolbar { display: grid; grid-template-columns: minmax(0,1fr); padding: 10px; }
  .inventory-toolbar-actions { display: grid; grid-template-columns: minmax(0,1fr); }
  .inventory-toolbar-actions > * { width: 100%; }
  .inventory-summary-card { padding: 11px; }
  .inventory-list-panel > .table-wrap { max-height: 58dvh; overflow: auto; overscroll-behavior: contain; }

  /* Billing */
  .billing-summary-grid,
  .billing-text-columns { grid-template-columns: minmax(0,1fr); }
  .billing-time-row { grid-template-columns: minmax(0,1fr) auto; }
  .billing-time-row > span:nth-child(2) { display: none; }
  .billing-choice { grid-template-columns: minmax(0,1fr); }

  /* Accounting */
  .accounting-primary-tabs,
  .accounting-tabs,
  .accounting-subtabs { margin-right: -2px; margin-left: -2px; }
  .accounting-toolbar { grid-template-columns: minmax(0,1fr) !important; padding: 10px; }
  .accounting-toolbar-actions { display: grid; grid-column: auto; grid-template-columns: minmax(0,1fr); }
  .accounting-toolbar-actions > * { width: 100%; }
  .receipt-table { min-width: 760px; }
  .bank-account-card,
  .payment-order { grid-template-columns: minmax(0,1fr); }
  .payment-order-actions,
  .table-actions { flex-wrap: wrap; }
  .payment-order-actions > *,
  .receipt-actions > * { flex: 1 1 140px; }
  .receipt-preview-modal,
  .receipt-correction-modal { height: calc(100dvh - 16px); }
  .receipt-preview-layout,
  .receipt-correction-layout { grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(0,45%) minmax(0,55%); }
  .receipt-preview-details,
  .receipt-correction-form { max-height: none; overflow: auto; }
  .receipt-preview-document,
  .receipt-correction-preview { min-height: 0; padding: 8px; }
  .receipt-preview-frame { min-height: 0; height: 100%; }
  .receipt-preview-image { max-height: 100%; }
  .receipt-preview-details dl { grid-template-columns: minmax(0,1fr) minmax(0,1fr); }
  .receipt-progress-steps { min-width: 460px; }
  .online-portal-card > footer .table-actions { grid-template-columns: minmax(0,1fr); }

  /* Time */
  .time-page-actions { display: grid; grid-template-columns: minmax(0,1fr); }
  .time-clock.time-clock-feature { padding: 13px; }
  .time-clock-ready,
  .time-clock-counter { flex-wrap: wrap; }
  .time-kpis { grid-template-columns: repeat(2,minmax(0,1fr)) !important; }
  .calendar-head { align-items: stretch; flex-direction: column; }
  .calendar-controls { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .calendar-controls select { grid-column: 1/-1; }
  .absence-row { grid-template-columns: minmax(0,1fr); }
  .absence-actions,
  .row-actions { justify-content: flex-start; }
  .active-time-hub { bottom: calc(38px + env(safe-area-inset-bottom)); }

  /* Research, reports, AI, administration */
  .research-global-filters { grid-template-columns: minmax(0,1fr); padding: 9px; }
  .research-filter-popover { position: fixed; top: auto; right: max(8px,env(safe-area-inset-right)); bottom: max(8px,env(safe-area-inset-bottom)); left: max(8px,env(safe-area-inset-left)); width: auto; max-width: none; max-height: 70dvh; }
  .research-filter-options { max-height: 52dvh; }
  .reports-grid { grid-template-columns: minmax(0,1fr); }
  .report-card { min-width: 0; }
  .ai-chat-shell { grid-template-columns: minmax(0,1fr); }
  .ai-chat-threads { max-height: 34dvh; }
  .ai-chat-compose { position: sticky; bottom: 0; z-index: 3; padding-bottom: max(10px,env(safe-area-inset-bottom)); }
  .ai-chat-messages { padding: 14px 11px; }
  .ai-chat-message,
  .ai-chat-message.assistant { max-width: 100%; }
  .administration-tabs { top: calc(64px + env(safe-area-inset-top)); }
  .integrated-admin-card iframe,
  .integrated-admin-full iframe { min-height: 82dvh; height: 82dvh; }

  /* Notifications, toasts and running work occupy separate layers. */
  .notification-panel { top: calc(64px + env(safe-area-inset-top) + 4px); right: max(8px,env(safe-area-inset-right)); left: max(8px,env(safe-area-inset-left)); max-height: calc(100dvh - 78px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
  .toast-region,
  .live-toast-region { right: max(8px,env(safe-area-inset-right)); left: max(8px,env(safe-area-inset-left)); width: auto; }
  .toast-region { bottom: calc(var(--ds-active-time-height,0px) + 46px + env(safe-area-inset-bottom)); }
  .live-toast-region { top: calc(68px + env(safe-area-inset-top)); }
  .app-version-badge { bottom: max(7px,env(safe-area-inset-bottom)); }
}

@media (max-width: 380px) {
  .topbar-title { display: none; }
  .app-download-card { grid-template-columns: 44px minmax(0,1fr) 26px; gap: 10px; }
  .app-download-brand { width: 44px; height: 44px; }
}

@media (max-width: 480px) {
  .topbar-title { display: none; }
  .topbar-actions { margin-left: auto; }
}

@media (max-width: 390px) {
  .detail-actions,
  .time-kpis,
  .calendar-controls { grid-template-columns: minmax(0,1fr) !important; }
  .receipt-preview-details dl { grid-template-columns: minmax(0,1fr); }
  .quick-access-button { flex-basis: 68px; width: 68px; }
}

@media (hover: none) and (pointer: coarse) {
  button,
  a,
  summary,
  [role="button"] { -webkit-tap-highlight-color: rgba(23,126,181,.12); }
  .main-nav button,
  .module-tabs button,
  .accounting-tabs button,
  .accounting-primary-tabs button,
  .accounting-subtabs button { min-height: 44px; }
}

/* Lokale KI: mobile Dokumentenanalyse ohne horizontales Abschneiden. */
@media (max-width: 760px) {
  .ai-workbench-head { margin-inline: 0; }
  .ai-chat-shell-v2 { border-radius: 15px; }
  .ai-chat-shell-v2 .ai-chat-workspace { min-height: 68dvh; }
  .ai-chat-compose-v2 { position: sticky; bottom: 0; z-index: 4; padding-bottom: max(10px,env(safe-area-inset-bottom)); }
  .ai-selected-files article,
  .ai-message-documents article { grid-template-columns: 32px minmax(0,1fr) 26px; }
  .ai-selected-files article>b,
  .ai-message-documents article>b { width: 32px; height: 32px; }
}

/* Download-Center: auf Tablet und Smartphone ohne abgeschnittene Karten. */
@media (max-width: 860px) {
  .modal.app-download-modal { width:min(760px,calc(100vw - 24px)); max-height:calc(100dvh - 24px); }
  .app-download-section.browser .app-download-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .app-download-security { grid-template-columns:42px minmax(0,1fr); }
  .app-download-security ul { grid-column:1/-1; justify-content:flex-start; padding-left:55px; }
}

@media (max-width: 680px) {
  .overlay:has(.app-download-modal) { align-items:flex-end; padding:7px; }
  .modal.app-download-modal { width:100%; max-height:calc(100dvh - 14px); border-radius:18px; }
  .app-download-modal .modal-head { align-items:flex-start; padding:20px 17px 17px; }
  .app-download-modal .modal-head h2 { margin-top:5px; font-size:22px; }
  .app-download-modal .modal-head p { font-size:10px; }
  .app-download-modal .close-button { width:38px; height:38px; min-height:38px; }
  .app-download-center { gap:13px; padding:14px; }
  .app-download-sections { gap:13px; }
  .app-download-section { padding:13px; border-radius:15px; }
  .app-download-section>header { margin-bottom:11px; }
  .app-download-section>header p { max-width:260px; }
  .app-download-section .app-download-grid,
  .app-download-section.browser .app-download-grid { grid-template-columns:1fr; }
  .app-download-card { grid-template-columns:50px minmax(0,1fr) 36px; min-height:96px; gap:11px; padding:12px; }
  .app-download-brand { width:50px; height:50px; padding:8px; border-radius:13px; }
  .app-download-title { align-items:flex-start; flex-direction:column; gap:4px; }
  .app-download-title strong { font-size:12px; }
  .app-download-card small { min-height:0; font-size:9px; }
  .app-download-meta { flex-wrap:wrap; margin-top:5px; }
  .app-download-action { width:36px; height:36px; }
  .app-download-security { grid-template-columns:38px minmax(0,1fr); gap:10px; padding:12px; }
  .app-download-security-icon { width:38px; height:38px; }
  .app-download-security ul { grid-column:1/-1; gap:5px; padding-left:0; flex-wrap:wrap; }
}

@media (max-width: 380px) {
  .app-download-card { grid-template-columns:46px minmax(0,1fr) 34px; gap:9px; }
  .app-download-brand { width:46px; height:46px; }
  .app-download-title b { display:none; }
  .app-download-security li { padding-inline:6px; }
}
