.mobile-section-picker {
  display: none;
}

.product-filter-options { min-width: 0; }
.product-filter-options > summary { display: none; }

@media (max-width: 1100px) {
  [data-login-page] .login-layout,
  [data-channel-login-page] .login-layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 360px);
    width: min(760px, 100%);
    gap: 32px;
  }

  [data-login-page] .login-panel,
  [data-channel-login-page] .login-panel {
    width: 100%;
    min-width: 0;
  }

  .portal-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    height: auto;
    gap: 8px 16px;
    padding: 10px 20px;
  }

  .portal-logo { grid-area: 1 / 1; }
  .portal-user { grid-area: 1 / 2; margin: 0; }
  .portal-user > span { display: none; }

  .portal-nav {
    grid-area: 2 / 1 / 3 / -1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    height: auto;
    margin: 0;
  }

  .portal-nav a { justify-content: center; }
  .portal-header,
  .channel-topbar { position: static; }

  .channel-shell,
  .personal-center {
    grid-template-columns: minmax(0, 1fr);
  }

  .channel-sidebar,
  .personal-sidebar { display: none; }

  .mobile-section-picker {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    padding: 12px;
    margin: 0 0 16px;
    color: #294458;
    background: #fff;
    border: 1px solid #dbe5ed;
    border-radius: 6px;
    font-size: 14px;
  }

  .mobile-section-picker select {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 8px 10px;
    font: inherit;
    font-size: 16px;
    color: #163c62;
    background: #f7fbff;
    border: 1px solid #cbdde9;
    border-radius: 4px;
  }

  .personal-center { gap: 0; background: #fff; }
  .personal-center > .mobile-section-picker { margin: 0; }
  .personal-content { margin: 0; }

  .channel-main,
  .channel-card,
  .personal-center,
  .personal-content,
  .product-body > *,
  .application-page,
  .application-form fieldset,
  .application-form label,
  .proposal-grid > *,
  .proposal-job-card > *,
  .channel-edit-form > * { min-width: 0; }

  .product-body { grid-template-columns: 116px minmax(0, 1fr); gap: 16px; }
  .product-image,
  .product-image.small,
  .score,
  .product-media a { width: 104px; }
  .product-image,
  .product-image.small { height: 104px; font-size: 23px; }
  .product-rules { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .product-rules p,
  .product-meta,
  .channel-order-item p,
  .channel-stats strong { overflow-wrap: anywhere; }
  .product-body > .price-box { grid-column: 1 / -1; }
  .price-box { grid-template-columns: 48px 1fr 1fr 1fr; padding: 14px; }
  .price-box .insurer-logo { width: 42px; height: 42px; border-radius: 6px; }

  .channel-message { grid-template-columns: minmax(0, 1fr); }
  .channel-message p { margin: 0; padding: 0 20px 18px; text-align: left; }
  .channel-stats,
  .channel-summary,
  .agent-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .channel-stats article:last-child { grid-column: 1 / -1; }
  .channel-edit-form,
  .agent-module-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .channel-edit-form label[style] { grid-column: 1 / -1 !important; }
  .channel-edit-form input,
  .channel-edit-form select,
  .channel-edit-form textarea,
  .agent-module-form input { width: 100%; min-width: 0; }

  .order-table-wrap,
  .channel-table-wrap { max-width: 100%; overscroll-behavior-x: contain; }
  .pagination { flex-wrap: wrap; gap: 12px; font-size: 14px; }
  .pagination > div { flex-wrap: wrap; gap: 8px; }
  .proposal-grid .wide,
  .proposal-job-card .option-line { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
  button { min-height: 44px; touch-action: manipulation; }
  a, button, input, select, textarea { -webkit-tap-highlight-color: rgba(31, 124, 255, 0.12); }
  :focus-visible { outline: 2px solid #0878d2; outline-offset: 3px; }

  .login-page,
  [data-login-page].login-page,
  [data-channel-login-page].login-page {
    min-height: 100svh;
    padding: max(28px, env(safe-area-inset-top)) 20px max(28px, env(safe-area-inset-bottom));
  }

  [data-login-page] .login-layout,
  [data-channel-login-page] .login-layout {
    width: min(400px, 100%);
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }

  [data-login-page] .login-copy,
  [data-channel-login-page] .login-copy { padding: 4px 0 4px 16px; }
  .login-copy::before { display: none; }
  [data-login-page] .login-copy h1,
  [data-channel-login-page] .login-copy h1 { font-size: 34px; }
  .login-system-name { margin-top: 8px; font-size: 16px; }

  [data-login-page] .login-panel,
  [data-channel-login-page] .login-panel {
    min-height: 0;
    padding: 28px 20px;
    border-radius: 8px;
  }

  [data-login-page] .login-panel h2,
  [data-channel-login-page] .login-panel h2 { font-size: 24px; }
  [data-login-page] .title-line,
  [data-channel-login-page] .title-line { margin: 16px auto 24px; }
  .login-page .login-form .login-field { grid-template-columns: 48px minmax(0, 1fr); height: 56px; }
  .login-page .login-form .login-field input { min-width: 0; font-size: 16px; padding: 0 10px; }
  .login-page .login-form .field-icon { width: 48px; height: 56px; transform: translate(-7px, -5px) scale(0.8); }
  .login-page .login-form .login-button { height: 50px; margin-top: 0; font-size: 18px; letter-spacing: 0; }
  .login-error { overflow-wrap: anywhere; }

  .portal-header { padding: 8px 12px; gap: 8px; }
  .portal-logo { width: 86px; height: 46px; padding: 0; }
  .portal-logo img { width: 72px; height: 44px; object-fit: contain; }
  .portal-user .avatar-button { display: none; }
  .portal-user .logout-link { height: 44px; padding: 0 14px; font-size: 14px; }
  .portal-nav { padding: 3px; border-radius: 6px; gap: 3px; }
  .portal-nav a { height: auto; min-height: 44px; padding: 10px 2px; font-size: 15px; text-align: center; border-radius: 4px; }
  .portal-banner { height: 86px; align-items: center; padding: 16px; border-radius: 0 0 8px 8px; }
  .portal-banner::before { display: none; }
  .portal-banner h1 { font-size: 24px; }
  .portal-banner h1::after { margin-top: 6px; font-size: 14px; }
  .portal-content { margin-top: 12px; margin-bottom: max(24px, env(safe-area-inset-bottom)); }

  .filter-panel { padding: 8px 12px 0; border-radius: 8px; min-width: 0; }
  .product-filter-options > summary { display: list-item; min-height: 44px; padding: 12px 0; color: #163c62; font-size: 15px; cursor: pointer; }
  .filter-row {
    flex-wrap: nowrap;
    align-items: center;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    gap: 6px;
    padding: 8px 0;
  }
  .filter-row .filter-label { position: sticky; left: 0; z-index: 1; flex: 0 0 80px; align-self: stretch; display: flex; align-items: center; padding: 0; background: #fff; font-size: 14px; }
  .filter-row button { flex: 0 0 auto; min-width: 0; height: auto; padding: 10px 12px; white-space: nowrap; }
  .search-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 12px; margin-top: 8px; border-radius: 0; }
  .search-row > .filter-label,
  .search-row > input[type="search"],
  .search-row > .checkbox-label,
  .search-row > .result-count { grid-column: 1 / -1; }
  .search-row select:first-of-type,
  .search-row select:nth-of-type(2),
  .search-row input[type="search"] { width: 100%; min-width: 0; height: 44px; padding: 0 8px; font-size: 16px; }
  .search-row > .filter-label { padding: 0; }
  .search-row .checkbox-label { min-height: 32px; }
  .search-row input[type="checkbox"] { width: 20px; height: 20px; }
  .result-count { margin: 0; font-size: 14px; text-align: right; }

  .product-list { margin-top: 12px; gap: 12px; }
  .business-product-card { border-radius: 8px; box-shadow: none; border: 1px solid #e0e9f1; }
  .business-product-card > header { padding: 16px; gap: 12px; }
  .business-product-card h2 { font-size: 20px; line-height: 1.5; overflow-wrap: anywhere; }
  .card-actions { width: 100%; justify-content: flex-start; gap: 8px; }
  .card-actions button { flex: 1; height: auto; padding: 10px 8px; border-radius: 4px; }
  .product-body { grid-template-columns: minmax(0, 1fr); padding: 16px; gap: 16px; }
  .product-media { display: grid; grid-template-columns: 64px minmax(0, 1fr); align-items: center; gap: 0 12px; }
  .product-image,
  .product-image.small { grid-row: 1 / 3; width: 64px; height: 64px; font-size: 17px; border-radius: 8px; }
  .score { width: 100%; min-height: 26px; margin: 0; padding: 0; justify-content: flex-start; background: none; }
  .product-media a { width: auto; min-height: 44px; display: flex; align-items: center; margin: 0; font-size: 14px; }
  .product-rules { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .product-rules p { padding: 10px; font-size: 14px; border-radius: 6px; }
  .product-rules p span { font-size: 14px; }
  .coverage { padding: 14px; border-radius: 6px; }
  .coverage h3 { font-size: 17px; }
  .coverage p { font-size: 15px; overflow-wrap: anywhere; }
  .price-box { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; border-radius: 6px; padding: 12px; }
  .price-box .insurer-logo { justify-self: start; }
  .price-box strong { justify-self: end; font-size: 24px; overflow-wrap: anywhere; }
  .price-box button { height: auto; padding: 10px 8px; border-radius: 4px; }
  .business-product-card > footer { margin: 0 16px 16px; padding: 12px; border-radius: 6px; overflow-wrap: anywhere; }
  .portal-site-footer { flex-wrap: wrap; gap: 12px; padding: 12px 0; }
  .portal-site-footer a { min-height: 44px; display: flex; align-items: center; }
  .portal-float-help { position: relative; top: auto; right: auto; display: block; margin: 12px auto 24px; }

  .personal-content,
  .portal-placeholder:not(.personal-center):not(.application-page) { padding: 16px; }
  .personal-center { padding: 0; }
  .agent-module-header { gap: 12px; margin-bottom: 12px; }
  .agent-module-header h2 { font-size: 20px; }
  .agent-module-actions { justify-content: flex-start; gap: 8px; }
  .agent-module-query { padding: 12px; gap: 8px; }
  .agent-module-query input { width: 100%; min-width: 0; height: 44px; font-size: 16px; }
  .agent-module-form { grid-template-columns: minmax(0, 1fr); padding: 12px; }
  .agent-module-form label { min-width: 0; }
  .agent-stat-grid { gap: 10px; }
  .agent-stat-grid article { padding: 14px; }
  .agent-stat-grid strong { font-size: 22px; overflow-wrap: anywhere; }
  .order-tabs { gap: 24px; margin-top: 16px; }
  .order-tabs button { font-size: 16px; }
  .pagination { align-items: flex-start; }
  .pagination > div { gap: 6px; }
  .pagination button { padding: 0 10px; }
  .job-search { flex-wrap: wrap; gap: 8px; }
  .job-search input { width: 100%; min-width: 0; height: 44px; font-size: 16px; }
  .job-search button { min-height: 44px; }

  .application-header { gap: 12px; padding: 16px; }
  .application-header h2 { font-size: 20px; overflow-wrap: anywhere; }
  .application-stepper { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; padding: 16px 12px; }
  .application-stepper span { height: auto; min-height: 44px; padding: 8px 4px; text-align: center; font-size: 14px; border-radius: 4px; }
  .application-form,
  .application-form-step,
  .application-review { min-width: 0; }
  .application-form fieldset { grid-template-columns: minmax(0, 1fr); min-inline-size: 0; padding: 14px; gap: 14px; }
  .application-form legend { font-size: 16px; }
  .application-form input:not([type="checkbox"]),
  .application-form select,
  .proposal-form input,
  .proposal-form select,
  .option-line select,
  .agent-module-form input { width: 100%; min-width: 0; min-height: 44px; font-size: 16px; }
  .application-summary { padding: 14px; margin: 16px; gap: 12px; }
  .application-summary h3 { font-size: 19px; overflow-wrap: anywhere; }
  .application-summary p { line-height: 1.6; overflow-wrap: anywhere; }
  .application-summary .product-badge { width: 48px; height: 48px; font-size: 14px; }
  .application-review { grid-template-columns: minmax(0, 1fr); }
  .application-review section { padding: 14px; min-height: 0; }
  .application-review strong,
  .application-result dd,
  .detail-benefits dd { overflow-wrap: anywhere; }
  .application-result { padding: 16px; }
  .application-result dl { grid-template-columns: minmax(0, 1fr); }
  .application-form footer button,
  .application-result footer button { width: 100%; height: auto; padding: 12px; border-radius: 4px; }
  .product-detail-layout { padding: 16px; gap: 12px; grid-template-columns: minmax(0, 1fr); }
  .scheme-panel,
  .detail-benefits,
  .proposal-card { padding: 14px; min-width: 0; border-radius: 6px; box-shadow: none; }
  .option-line { gap: 8px; margin-bottom: 12px; min-width: 0; }
  .option-chip { min-width: 0; height: auto; padding: 10px 12px; border-radius: 4px; }
  .detail-benefits div { align-items: flex-start; flex-wrap: wrap; gap: 8px; border-radius: 4px; }
  .detail-doc-tabs { border-radius: 6px 6px 0 0; }
  .detail-doc-tabs a { min-width: 0; flex: 1 0 50%; padding: 12px 8px; font-size: 14px; }
  .detail-notice { padding: 14px; border-radius: 0 0 6px 6px; }
  .floating-premium,
  .proposal-total { gap: 12px; padding: 16px; border-radius: 0; }
  .floating-premium > *,
  .proposal-total > * { width: 100%; min-width: 0; margin: 0; }
  .floating-premium button,
  .proposal-total button { height: auto; padding: 12px; border-radius: 4px; }
  .proposal-grid,
  .proposal-job-card { grid-template-columns: minmax(0, 1fr); }
  .proposal-grid .wide,
  .proposal-job-card .option-line { grid-column: auto; }
  .proposal-card header { align-items: flex-start; flex-wrap: wrap; gap: 10px; }
  .proposal-card header h3 { font-size: 18px; }

  .channel-topbar { height: auto; min-height: 68px; padding: 10px 12px; gap: 10px; }
  .channel-brand { gap: 8px; min-width: 0; }
  .channel-brand-logo { width: 42px; height: 42px; border-radius: 6px; }
  .channel-brand strong { font-size: 20px; }
  .channel-brand small { font-size: 12px; }
  .channel-account { margin-left: auto; flex: 0 0 auto; }
  .channel-account > span { display: none; }
  .channel-account button { min-height: 44px; padding: 0 10px; font-size: 14px; border-radius: 4px; }
  .channel-main { padding: 12px 12px max(24px, env(safe-area-inset-bottom)); }
  .channel-card { margin-bottom: 12px; border-radius: 6px; box-shadow: none; }
  .channel-card > header,
  .channel-card-header { padding: 12px; min-height: 60px; flex-wrap: wrap; gap: 10px; }
  .channel-card > header h2,
  .channel-card-header h2 { font-size: 18px; }
  .channel-card-icon { width: 28px; height: 28px; flex: 0 0 28px; border-radius: 6px; }
  .channel-message p { padding: 0 12px 14px; font-size: 15px; }
  .channel-stats,
  .channel-summary { padding: 12px; gap: 10px; }
  .channel-stats article,
  .channel-summary article { padding: 12px; border-radius: 6px; }
  .channel-stats strong,
  .channel-summary strong { font-size: 21px; overflow-wrap: anywhere; }
  .channel-order-item { padding: 14px 12px; gap: 6px; }
  .channel-order-item p { margin: 0 0 6px; }
  .channel-workspace { min-height: 0; }
  .channel-workspace-header p { line-height: 1.6; overflow-wrap: anywhere; }
  .channel-workspace-actions { flex-wrap: wrap; gap: 8px; }
  .channel-query,
  .channel-form-panel { padding: 12px; }
  .channel-query-form { gap: 8px; }
  .channel-query-form input { width: 100%; min-width: 0; min-height: 44px; }
  .channel-edit-form { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .channel-edit-form input,
  .channel-edit-form select,
  .channel-edit-form textarea { min-height: 44px; font-size: 16px; }
  .channel-form-actions { flex-wrap: wrap; }
  .channel-form-actions button { flex: 1; }
  .channel-module-footer { padding: 14px 12px; font-size: 14px; }

  .reserved-feature-panel { padding: 12px; }
  .reserved-feature-card,
  .record-detail-card { width: 100%; max-height: calc(100dvh - 24px); overflow-y: auto; overscroll-behavior: contain; }
  .reserved-feature-card header { padding: 16px; gap: 8px; }
  .reserved-feature-card h2 { font-size: 20px; overflow-wrap: anywhere; }
  .reserved-feature-card header button { flex: 0 0 44px; width: 44px; }
  .reserved-feature-card > p { padding: 16px; overflow-wrap: anywhere; }
  .reserved-feature-card dl { padding: 0 16px 16px; grid-template-columns: minmax(0, 1fr); }
  .reserved-feature-card dl div { grid-template-columns: minmax(0, 1fr); padding: 12px; gap: 6px; }
  .reserved-feature-card dd { overflow-wrap: anywhere; }
  .reserved-feature-card footer { padding: 12px 16px; }
  .portal-toast { left: 12px; right: 12px; bottom: max(16px, env(safe-area-inset-bottom)); max-width: none; overflow-wrap: anywhere; }
}

/* Record labels are shared with table headings, so mobile retains every field. */
@media (max-width: 600px) {
  .order-table-wrap { max-height: none; }
  .agent-module-table,
  .channel-table { display: block; min-width: 0; width: 100%; }
  .agent-module-table thead,
  .channel-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .agent-module-table tbody,
  .channel-table tbody { display: block; }
  .agent-module-table tr,
  .channel-table tr { display: block; padding: 8px 12px; border-bottom: 10px solid #f2f5f8; }
  .agent-module-table td,
  .channel-table td {
    display: grid;
    grid-template-columns: 86px minmax(0, 1fr);
    align-items: start;
    gap: 12px;
    width: auto !important;
    min-width: 0 !important;
    height: auto;
    padding: 10px 0;
    text-align: left !important;
    font-size: 14px;
    line-height: 1.7;
    border: 0;
    border-bottom: 1px solid #edf1f5;
    background: #fff !important;
  }
  .channel-table tbody tr:nth-child(even) { background: #fff; }
  .agent-module-table td::before,
  .channel-table td::before { content: attr(data-label); color: #697786; }
  .record-cell-value { min-width: 0; overflow-wrap: anywhere; }
  .agent-module-table td.mobile-record-actions,
  .channel-table td.mobile-record-actions { display: flex; flex-wrap: wrap; gap: 8px; border: 0; }
  .mobile-record-actions::before { display: none; }
  .agent-module-table .mobile-record-actions button,
  .channel-table .mobile-record-actions button { flex: 1 1 100px; width: auto; min-height: 44px; margin: 0; padding: 8px; text-align: center; white-space: normal; border: 1px solid #d4e5ee; border-radius: 4px; background: #f5faff; }
  .agent-module-table td[colspan],
  .channel-table td[colspan] { display: block; padding: 24px 0; text-align: center !important; }
  .agent-module-table td[colspan]::before,
  .channel-table td[colspan]::before { display: none; }
}

@media (max-width: 540px) {
  .search-row > select { grid-column: 1 / -1; }
}
