/* Responsive finishing layer shared by every public, account, supplier and admin page. */
html, body { max-width: 100%; overflow-x: clip; }
img, svg, video, canvas { max-width: 100%; height: auto; }
.app-content, .panel, .card, .product-comparison { min-width: 0; }
.table-wrap { max-width: 100%; -webkit-overflow-scrolling: touch; }
.btn { touch-action: manipulation; }
.input, .select, .textarea { min-height: 44px; }
.mobile-menu { width: 44px; height: 44px; padding: 0; border: 1px solid transparent; border-radius: 11px; line-height: 1; }
.mobile-menu:hover, .mobile-menu[aria-expanded="true"] { background: var(--surface-2); border-color: var(--line); }
.payment-panel { max-width: 760px; }
.payment-summary { padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.payment-steps { margin: 22px 0; padding: 20px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; }
.payment-steps h2 { margin: 10px 0 18px; font-size: 21px; line-height: 1.35; }
.payment-steps ol { display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; }
.payment-steps li { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 11px; align-items: start; }
.payment-step-number { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: #fff; font-weight: 850; }
.payment-or { display: flex; align-items: center; gap: 12px; margin: 4px 0 16px; color: var(--muted); font-size: 13px; font-weight: 800; text-transform: uppercase; }
.payment-or::before, .payment-or::after { content: ''; height: 1px; flex: 1; background: var(--line); }
.comparison-results { padding: 16px; }
.comparison-results .toolbar { margin-bottom: 12px; }
.comparison-results .toolbar h2 { font-size: 22px; }
.comparison-results .comparison-table th,
.comparison-results .comparison-table td { padding: 9px 10px; }
.comparison-results .comparison-table td:first-child { width: 30%; }
.comparison-results .product-meta { font-size: 12px; line-height: 1.4; }
.comparison-results .supplier-offers { gap: 5px; }
.comparison-results .supplier-offer { grid-template-columns: minmax(130px, 1fr) auto auto; gap: 8px; padding: 7px 9px; border-radius: 9px; }
.comparison-results .supplier-offer-name,
.comparison-results .supplier-offer-price { gap: 5px; font-size: 13px; }
.comparison-results .supplier-offer .badge { padding: 2px 6px; font-size: 10px; }
.comparison-results .supplier-offer-action { min-height: 32px; padding: 5px 9px; white-space: nowrap; }
.limitation-alert { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.limitation-alert .btn { flex: 0 0 auto; }
.limitation-alert { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.limitation-alert .btn { flex: 0 0 auto; }

@media (max-width: 980px) {
    .nav-wrap { position: relative; gap: 12px; }
    .main-nav { top: calc(100% + 8px); left: 0; right: 0; max-height: calc(100dvh - 96px); overflow-y: auto; }
    .main-nav a { padding: 12px 14px; }
    .app-shell { padding-top: 20px; }
    .sidebar { margin-inline: -1px; padding: 8px; border-radius: 13px; scrollbar-width: thin; }
    .sidebar a { padding: 9px 12px; }
}

@media (max-width: 700px) {
    .limitation-alert { align-items: stretch; flex-direction: column; }
    .limitation-alert .btn { width: 100%; }
    .limitation-alert { align-items: stretch; flex-direction: column; }
    .limitation-alert .btn { width: 100%; }
    .container { width: calc(100% - 24px); }
    .nav-wrap { min-height: 64px; }
    .brand { min-width: 0; gap: 8px; }
    .brand-mark { width: 38px; height: 38px; border-radius: 10px; }
    .brand strong { font-size: 15px; }
    .brand small { font-size: 9px; letter-spacing: .09em; }
    .mobile-menu { order: 3; margin-left: 0; }
    .nav-actions { margin-left: auto; }
    .nav-actions .theme-control { display: none; }
    .nav-actions form { margin: 0; }
    .nav-actions .btn { min-height: 38px; padding: 7px 10px; }
    .nav-actions .btn-primary { display: none; }
    .main-nav { top: calc(100% + 6px); left: 0; right: 0; }

    .hero { padding: 38px 0 42px; }
    .hero-grid { gap: 28px; }
    .hero h1 { font-size: clamp(34px, 11vw, 44px); overflow-wrap: anywhere; }
    .hero p { font-size: 16px; }
    .hero-card { padding: 18px; border-radius: 20px; }
    .page-header { padding: 30px 0 18px; }
    .page-header h1 { font-size: clamp(28px, 9vw, 34px); line-height: 1.15; overflow-wrap: anywhere; }
    .page-header p { font-size: 15px; }
    .section { padding: 36px 0; }
    .section-head { align-items: start; flex-direction: column; margin-bottom: 20px; }
    .section-head h2 { font-size: 28px; }
    .panel, .card, .stat-card, .plan-card { padding: 16px; border-radius: 14px; }
    .auth-wrap { padding: 28px 12px; }
    .auth-card { padding: 20px; border-radius: 17px; }
    .auth-card h1 { font-size: 28px; }
    .plan-price { font-size: 30px; }
    .payment-steps { padding: 16px; }
    .payment-steps h2 { font-size: 18px; }

    .toolbar { display: grid; grid-template-columns: minmax(0, 1fr); align-items: stretch; }
    .toolbar form, .filter-form { display: grid; grid-template-columns: minmax(0, 1fr); width: 100%; }
    .filter-form > .field, .toolbar form > .input { min-width: 0 !important; max-width: none !important; width: 100%; }
    .toolbar .actions, .actions { width: 100%; }
    .toolbar .actions .btn, .toolbar .actions form, .toolbar > .btn, .filter-form > .btn { width: 100%; }
    .actions form .btn { width: 100%; }
    .flex.justify-between { align-items: stretch; }
    .flex.justify-between > .btn { width: 100%; }
    .demo-row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
    .demo-row .price-value { text-align: left; }
    .dashboard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .kpi { padding: 14px; }
    .kpi strong { font-size: 24px; overflow-wrap: anywhere; }
    .stats-grid, .card-grid, .plans-grid { grid-template-columns: minmax(0, 1fr); }
    .form-grid, .order-row { grid-template-columns: minmax(0, 1fr); }
    .check { align-items: flex-start; }
    .check input { margin-top: 5px; }
    .input[type="file"] { padding: 8px; max-width: 100%; }

    .cart-drawer { width: 100%; }
    .cart-header, .cart-body, .cart-footer { padding-left: 16px; padding-right: 16px; }
    .cart-header h2 { font-size: 22px; }
    .cart-supplier-title, .cart-supplier-subtotal { align-items: flex-start; flex-direction: column; }
    .cart-item-controls { grid-template-columns: 74px minmax(0, 1fr) 36px; }
    .cart-item-controls > strong { font-size: 14px; overflow-wrap: anywhere; }

    .dt-container .dt-layout-row { display: grid !important; grid-template-columns: minmax(0, 1fr); }
    .dt-container .dt-layout-cell { min-width: 0; }
    .dt-container .dt-search, .dt-container .dt-length { display: grid; grid-template-columns: auto minmax(0, 1fr); justify-content: initial; }
    .dt-container .dt-paging { display: flex; flex-wrap: wrap; gap: 4px; }
    .fallback-datatable-controls, .fallback-datatable-footer { align-items: stretch; flex-direction: column; }
    .fallback-datatable-controls label { display: grid; grid-template-columns: auto minmax(0, 1fr); }
    .fallback-datatable-controls .input { max-width: none; }

    .table-wrap, .datatable-wrap { overflow: visible; border: 0; border-radius: 0; }
    .table, .modern-table, .comparison-table { display: block; width: 100%; min-width: 0 !important; }
    .table thead { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
    .table tbody { display: grid; gap: 12px; }
    .table tbody tr { display: block; padding: 6px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 13px; box-shadow: 0 6px 18px rgba(17,55,47,.05); }
    .table tbody td { display: grid; grid-template-columns: minmax(92px, 34%) minmax(0, 1fr); gap: 12px; width: 100% !important; padding: 10px 0; border: 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
    .table tbody td:last-child { border-bottom: 0; }
    .table tbody td::before { content: attr(data-label); color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
    .table tbody td[colspan] { display: block; text-align: center; }
    .table tbody td[colspan]::before { content: none; }
    .table tfoot { display: block; margin-top: 12px; }
    .table tfoot tr { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 14px; background: var(--surface-2); border-radius: 12px; }
    .table tfoot th { display: block; padding: 0; border: 0; }
    .comparison-table tbody td { display: block; padding: 12px 0; }
    .comparison-table tbody td::before { display: block; margin-bottom: 7px; }
    .comparison-table tbody td:first-child { width: 100% !important; }
    .supplier-offers { gap: 10px; }
    .supplier-offer { grid-template-columns: minmax(0, 1fr); padding: 12px; }
    .supplier-offer .btn { width: 100%; }
    .comparison-results > .toolbar { gap: 12px; }
    .comparison-results { padding: 14px; }
    .comparison-results .comparison-table tbody td { padding: 9px 0; }
    .comparison-results .supplier-offers { gap: 7px; }
    .comparison-results .supplier-offer { grid-template-columns: minmax(0, 1fr); gap: 6px; padding: 9px; }

    .pagination { max-width: 100%; overflow-x: auto; padding-bottom: 8px; }
    .page-link { white-space: nowrap; }
    .footer-grid { gap: 20px; }
    .site-footer { padding-top: 30px; }
}

@media (max-width: 390px) {
    .container { width: calc(100% - 18px); }
    .brand small { display: none; }
    .dashboard-grid { grid-template-columns: minmax(0, 1fr); }
}
