/* Public portal: fluid shell, with the established desktop layout above 1000px. */
#wrap { width: 100%; max-width: 1000px; box-sizing: border-box; }
.site-container { min-width: 0; }
.site-main { table-layout: fixed; }
.site-main > tbody > tr > td { min-width: 0; overflow-wrap: anywhere; }
#wrap img, #wrap video { max-width: 100%; }
#wrap img { object-fit: contain; }
#wrap iframe { max-width: 100%; }
#wrap .articles_show img { height: auto; }
#wrap .articles_show { overflow-wrap: anywhere; }
#wrap .articles_show pre { max-width: 100%; overflow-x: auto; white-space: pre-wrap; }
.mobile-table-scroll { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
@media (max-width: 1000px) {
    .site-header { table-layout: fixed; }
    .site-header > tbody > tr > td:first-child { width: 180px; }
    .site-header > tbody > tr > td:last-child { width: auto !important; }
    #search_line table { width: 100%; table-layout: fixed; }
    #search_line td:last-child { width: 76px; }
    #search_line input[type=text] { width: 100%; min-width: 0; box-sizing: border-box; }
    .navigation { height: auto; display: flex; flex-wrap: wrap; gap: 8px; background: #f5f5f5; }
    .navigation ul { float: none; display: flex; flex-wrap: wrap; }
    .navigation > .button1 { float: none !important; margin-left: auto; }
    .blockpage-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
    .blockpage-grid > div, .blockpage-grid > div.banner { float: none; width: auto; margin: 0; }
}
@media (max-width: 767px) {
    body { font-size: 16px; line-height: 1.5; }
    .site-container { margin: 0 12px !important; display: flex; flex-direction: column; }
    .site-container > * { order: 5; min-width: 0; }
    .site-account { order: 0; }
    .site-header { order: 1; }
    .site-container > .navigation { order: 2; }
    .site-top-articles { order: 3; }
    .site-main { order: 4; margin-top: 20px !important; }
    .site-account, .site-account tbody, .site-account tr, .site-account td { display: block; width: auto; }
    .site-account td:first-child { display: none; }
    .site-account td:last-child { padding: 8px 0 !important; }
    .site-account .autorizline { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
    .site-account a { display: inline-flex; align-items: center; min-height: 40px; }
    .site-header, .site-header > tbody, .site-header > tbody > tr, .site-header > tbody > tr > td { display: block; width: 100% !important; box-sizing: border-box; }
    .site-header { margin: 4px 0 16px !important; }
    .site-header img[src="/img/logo.gif"] { margin-left: 0 !important; }
    .site-header td:has(> form) { padding: 0 12px !important; }
    #search_line input[type=text], #search_line input[type=submit] { min-height: 44px; font-size: 16px; }
    .site-header form > div:last-child { padding: 8px 0; font-size: 14px !important; }
    .site-header form > div:last-child > span { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
    .site-header label { display: inline-flex; align-items: center; min-height: 40px; gap: 6px; }
    .navigation { gap: 8px; padding: 0; background: transparent; }
    .navigation ul { display: grid; width: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; background: transparent; }
    .navigation li, .navigation li.navigation_active { float: none; margin: 0; background: #f5f5f5; font: inherit; }
    .navigation li a, .navigation li.navigation_active a { float: none; display: flex; min-height: 44px; padding: 8px 10px; box-sizing: border-box; align-items: center; background: transparent; line-height: 1.3; }
    .navigation li.navigation_active { background: #88aa34; }
    .navigation > .button1 { width: 100%; margin: 4px 0 0; background: #88aa34; }
    .navigation > .button1 a { display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 4px 12px; box-sizing: border-box; background: transparent; }
    .site-top-articles .blockpage-grid { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x proximity; padding: 8px 0; text-align: left; }
    .site-top-articles .blockpage-grid > div.banner { flex: 0 0 260px; height: auto; min-height: 100px; scroll-snap-align: start; }
    .site-main table { max-width: 100%; }
    .site-main table[width="100%"] { table-layout: fixed; }
    .site-main table:has(> tbody > tr > td[width="50%"]:not(.c1):not(.c2):not(.c3):not(.c4)),
    .site-main table:has(> tbody > tr > td[style*="width: 50%"]),
    .site-main table:has(> tbody > tr > td[width="33%"]),
    .site-main table:has(> tbody > tr > td[width="25%"]) { display: block; }
    .site-main table:has(> tbody > tr > td[width="50%"]:not(.c1):not(.c2):not(.c3):not(.c4) ) > tbody,
    .site-main table:has(> tbody > tr > td[style*="width: 50%"] ) > tbody,
    .site-main table:has(> tbody > tr > td[width="33%"] ) > tbody,
    .site-main table:has(> tbody > tr > td[width="25%"] ) > tbody { display: block; }
    .site-main tr:has(> td[width="50%"]:not(.c1):not(.c2):not(.c3):not(.c4)), .site-main tr:has(> td[style*="width: 50%"]),
    .site-main tr:has(> td[width="33%"]), .site-main tr:has(> td[width="25%"]) { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; }
    .site-main td[width="50%"]:not(.c1):not(.c2):not(.c3):not(.c4), .site-main td[style*="width: 50%"],
    .site-main td[width="33%"], .site-main td[width="25%"] { display: block; width: 100% !important; padding: 0 !important; box-sizing: border-box; }
    .site-main .nowrap, .breadcrumb { white-space: normal; overflow-wrap: anywhere; }
    .site-main h1, .site-main .h1 { font-size: 24px !important; line-height: 1.3; }
    .site-main .fsize3 { font-size: 16px; }
    .site-main .fsize4 { font-size: 20px; }
    .site-main input:not([type=radio]):not([type=checkbox]), .site-main select, .site-main textarea { max-width: 100%; box-sizing: border-box; font-size: 16px; min-height: 40px; }
    .theme1_blockpage { width: 100%; table-layout: fixed; }
    .theme1_blockpage_content { height: auto !important; min-height: 120px; }
    .theme1_blockpage_pages ul { display: flex; flex-wrap: wrap; }
    .theme1_blockpage_pages li a { display: block; padding: 8px; min-height: 40px; box-sizing: border-box; }
    .blockpage-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
    .blockpage-grid > div { height: auto; min-height: 100px; font-size: 14px; }
    .blockpage-grid > div .name, .blockpage-grid > div .name.type2, .blockpage-grid > div .descr { max-height: none; }
    .blockpage_paginator { min-height: 32px; }
    .product-grid > div.bl { float: none; width: 100%; box-sizing: border-box; margin-right: 0; }
    .product-grid .list .photo { width: 90px; }
    .product-grid .list .cont { padding-left: 104px; }
    .board-grid .list .photo { width: 80px; }
    .board-grid .list .cont { padding-left: 92px; }
    .product-grid .list, .board-grid .list { overflow-wrap: anywhere; }
    #show_context > .informer-content { flex-basis: 100%; }
    #show_context .informer-name { font-size: 16px; }
    #show_context .informer-price, #show_context .informer-descr { font-size: 14px; }
    .articles_show { font-size: 16px; line-height: 1.65; }
    .articles_show [style*="float: left"] { float: none !important; margin: 0 0 16px !important; }
    .modal { width: calc(100% - 24px); max-width: 640px; box-sizing: border-box; }
    .modal-header, .modal-body { padding: 16px; }
    .jmsg { width: calc(100% - 32px); left: 16px; margin-left: 0; box-sizing: border-box; }
    #popup_container { min-width: 0; max-width: calc(100vw - 32px); box-sizing: border-box; }
    #wrap :focus-visible { outline: 2px solid #0077bb !important; outline-offset: 2px; }
}
.site-search { padding: 12px 16px; background: #ffcc66; border-radius: 6px; }
.site-search form { margin: 0; }
.search-controls { display: flex; gap: 8px; }
#search_line.search-controls input[type=text] { flex: 1 1 0; width: 0; min-width: 0; margin: 0; box-sizing: border-box; }
#search_line.search-controls input[type=submit] { flex: 0 0 auto; margin: 0; }
.search-options { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 12px; margin-top: 6px; }
.search-options label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
@media (max-width: 767px) {
    .site-container > .site-main { order: 3; }
    .site-top-articles { order: 4; margin: 24px 0 !important; }
    .site-search { padding: 12px; }
    .search-options { font-size: 14px; }
    .search-options-label { display: none; }
    .site-header form > div:last-child { padding: 0; }
    .site-header .search-options label { margin: 0; }
    .theme1_blockpage_pages { height: auto; min-height: 40px; }
    .theme1_blockpage_pages ul { float: none; margin-left: 0; }
    .theme1_blockpage_pages li { margin-top: 0; }
    .theme1_blockpage_pages li a { float: none; }
    .site-top-articles .blockpage-grid > div.banner { min-height: 140px; }
    .site-top-articles .blockpage-grid > div .descr { max-height: none; }
    [id^="filtr_"] { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
    [id^="filtr_"] > .float_right { float: none; display: flex; flex-wrap: wrap; gap: 8px; }
}
@media (max-width: 767px) {
    .theme1_blockpage_content div[style*="white-space: nowrap"] { width: auto !important; max-width: 100%; white-space: normal !important; }
    .articles_show table { display: block; max-width: 100%; overflow-x: auto; }
}
@media (max-width: 1000px) {
    .theme1_blockpage_content div[style*="width: 328px"] { width: auto !important; max-width: 100%; }
    .theme1_blockpage_content div[style*="white-space: nowrap"] { white-space: normal !important; }
}
@media (max-width: 767px) {
    .site-header .search-options-label { display: none; }
    .site-main .bcolor2 span[style*="white-space: nowrap"] { white-space: normal !important; }
    .ui-container { margin: 0 12px !important; overflow-wrap: anywhere; }
    .ui-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 0; }
    .ui-header img { margin-left: 0 !important; }
    .ui-header > .fcolor4 { float: none !important; }
    .ui-container .navigation > .fcolor3 { float: none !important; width: 100%; }
    .ui-container .navigation > .fcolor3 a { display: flex; align-items: center; min-height: 44px; }
    .ui-container .box:has(form[action="login.php"]) { width: 100% !important; max-width: 100%; box-sizing: border-box; margin: 24px 0 !important; }
    .ui-container form div[style*="width: 300px"] { width: 100% !important; }
    .ui-container table { max-width: 100%; }
    .ui-container input:not([type=radio]):not([type=checkbox]):not([type=hidden]):not([type=image]), .ui-container select, .ui-container textarea { max-width: 100%; box-sizing: border-box; min-height: 44px; font-size: 16px; }
    .ui-container input[type=checkbox], .ui-container input[type=radio] { min-width: 20px; min-height: 20px; vertical-align: middle; }
    .ui-container h1, .ui-container .fsize5 { font-size: 24px; line-height: 1.3; }
    #regform table, #regform tbody, #regform tr, #regform td { display: block; width: 100% !important; box-sizing: border-box; }
    #regform td { padding: 8px 0 !important; }
    #regform td:empty, #regform td:has(> b:empty) { display: none; }
    #regform input[type=image] { max-width: 100%; margin: 20px 0 !important; }
    #regform .comment_form { font-size: 14px; }
}
@media (max-width: 1000px) {
    #regform table, #regform tbody, #regform tr, #regform td { display: block; width: 100% !important; box-sizing: border-box; }
    #regform td { padding: 8px 0 !important; }
}
@media (max-width: 767px) {
    .site-header .search-options > .search-options-label { display: none; }
    #show_context .informer-descr { color: #555; }
}
@media (max-width: 767px) {
    .modal form table, .modal form tbody, .modal form tr, .modal form td { display: block; width: 100% !important; box-sizing: border-box; }
    .modal form td { padding: 4px 0 !important; }
    .modal form input:not([type=radio]):not([type=checkbox]):not([type=hidden]):not([type=image]), .modal form select, .modal form textarea { width: 100% !important; max-width: 100%; min-height: 44px; font-size: 16px; box-sizing: border-box; }
    .modal form textarea { min-height: 120px; }
    .modal-close { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; }
}
@media (max-width: 767px) {
    /* The legacy modal script sets an inline width when opening the dialog. */
    .modal { width: calc(100% - 24px) !important; max-width: calc(100vw - 24px); }
    .modal-backdrop { max-width: 100vw; }
}
@media (max-width: 767px) {
    /* Keep the page fluid while the legacy dialog locks body scrolling. */
    body { width: auto !important; max-width: 100%; }
}
