body {
    font-family: 'Segoe UI', sans-serif;
    margin: 0;
    background: #f8f9fa;
    color: #333;
}

.header-inner,
.footer-inner,
.container {
    max-width: 1200px;
    min-width: 1200px;
    margin: 0 auto;
}
.header {
    background: #fff;
    padding: 8px 20px;
    border-bottom: 1px solid #ddd;
    position: sticky;
    top: 0;
    z-index: 1000;
    min-width: 1200px;
}
.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}
.logo {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    width: 290px;
}
.header-logo {
    height: 48px;
}

.header-search-form {
    flex-grow: 1;
    display: flex;
}
.header-search-input {
    flex-grow: 1;
    padding: 10px 15px;
    font-size: 14px;
    border: 1px solid #666;
    border-radius: 999em 0 0 999em;
    border-right: none;
    outline: none;
    transition: border-color 0.2s;
    max-width: 600px;
}
.header-search-input:focus,
.header-search-input:focus + .header-search-button {
    border-color: #165a9c;
}
.header-search-input:focus ~ .header-filter-buttons .header-filter-button {
    border-color: #3a9ef0;
}
.header-search-input:focus ~ .header-filter-buttons .header-new-search-button {
    border-color: #165a9c;
}
.header-search-form:has(.header-search-button.hidden) .header-search-input {
    border-right: none;
}
.header-search-form:has(.header-filter-buttons:not(.hidden)) .header-search-input {
    border-right: none;
}
.header-search-button {
    padding: 10px 20px;
    border: 1px solid #165a9c;
    border-left: none;
    background-color: #165a9c;
    color: #fff;
    cursor: pointer;
    border-radius: 0 999em 999em 0;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s, border-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
}
.header-search-button svg {
    flex-shrink: 0;
}
.header-search-button:hover {
    background-color: #0d4a85;
    border-color: #0d4a85;
}
.header-search-button:active {
    background-color: #0a3d6b;
    border-color: #0a3d6b;
}
.header-search-button.hidden {
    display: none;
}

.header-filter-buttons {
    display: flex;
    align-items: center;
}
.header-filter-buttons.hidden {
    display: none;
}
.header-filter-button,
.header-new-search-button {
    padding: 10px 20px;
    border: 1px solid #165a9c;
    border-left: none;
    background-color: #165a9c;
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s, border-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
}
.header-filter-button svg,
.header-new-search-button svg {
    flex-shrink: 0;
}
.header-filter-button {
    border-radius: 0;
    border-left: 1px solid #3a9ef0;
    border-color: #3a9ef0;
    background-color: #3a9ef0;
    border-right: 1px solid rgba(255, 255, 255, 0.3);
}
.header-filter-button:hover {
    background-color: #2585d0;
    border-color: #2585d0;
    border-right-color: rgba(255, 255, 255, 0.3);
}
.header-filter-button:active {
    background-color: #1f7bc2;
    border-color: #1f7bc2;
}
.header-new-search-button {
    border-radius: 0 999em 999em 0;
    border-left: 1px solid rgba(255, 255, 255, 0.3);
}
.header-new-search-button:hover {
    background-color: #0d4a85;
    border-color: #0d4a85;
    border-left-color: rgba(255, 255, 255, 0.3);
}
.header-filter-button:active {
    background-color: #124a85;
    border-color: #124a85;
}
.header-new-search-button:active {
    background-color: #0a3d6b;
    border-color: #0a3d6b;
}
.header-search-input:focus + .header-search-button.hidden + .header-filter-buttons .header-filter-button,
.header-search-input:focus ~ .header-filter-buttons .header-filter-button {
    border-color: #165a9c;
}

.container {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    padding: 20px;
}

.sidebar {
    width: 250px;
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    font-weight: bold;
}
.filter-header .filter-title {
    font-size: 16px;
}
.reset-all {
    font-size: 13px;
    color: #165a9c;
    text-decoration: none;
}
.reset-all:hover {
    text-decoration: underline;
}

.filter-group {
    margin-bottom: 20px;
    position: relative;
}
.filter-label {
    background: #f1f3f5;
    padding: 6px 8px;
    font-weight: bold;
    margin-bottom: 8px;
    display: block;
}

.selection-controls {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 8px;
    font-size: 12px;
}
.selection-controls a {
    color: #165a9c;
    text-decoration: none;
}
.selection-controls a:hover {
    text-decoration: underline;
}

.reset-link {
    float: right;
    margin-top: 8px;
    font-size: 12px;
    color: #165a9c;
    text-decoration: none;
}
.reset-link:hover {
    text-decoration: underline;
}

.keyword-box {
    display: flex;
}
.keyword-box input {
    flex: 1;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 6px;
}

.category-filter-input {
    width: 100%;
    padding: 6px;
    border: 1px solid #ccc;
    border-radius: 4px;
    margin-bottom: 8px;
    box-sizing: border-box;
    font-size: 13px;
}

.recommendation-filters {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
    margin-bottom: 10px;
    font-size: 13px;
}
.recommendation-filters label {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.category-scroll {
    list-style: none;
    margin: 0;
    height: 120px;
    overflow-y: auto;
    border: 1px solid #ccc;
    padding: 8px;
    font-size: 12px;
}
.category-scroll li {
    margin-bottom: 4px;
}
.category-scroll li label {
    display: flex;
    align-items: center;
}

input[type="checkbox"], input[type="radio"] {
    accent-color: #165a9c;
}

.price-slider-wrapper {
    position: relative;
    margin-top: 10px;
}
.price-slider-line {
    width: 100%;
    height: 4px;
    background: #d6e5f7;
    position: absolute;
    left: 0;
    z-index: 0;
    border-radius: 2px;
}
.price-slider {
    position: relative;
    height: 4px;
    margin: 20px 0;
}
.price-slider input[type=range] {
    position: absolute;
    width: 100%;
    margin: 2px 0 0;
    left: 0;
    pointer-events: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background: none;
    height: 4px;
    top: 0;
}
.price-slider input[type=range]::-webkit-slider-thumb {
    pointer-events: auto;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #165a9c;
    cursor: pointer;
    -webkit-appearance: none;
    margin-top: -6px;
}
.price-slider input[type=range]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #165a9c;
    cursor: pointer;
}

.price-inputs {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 13px;
}
.price-inputs input {
    width: 45%;
    padding: 6px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.main-content {
    position: sticky;
    bottom: 0;
    flex: 1;
    align-self: flex-end;
    min-width: 0;
    min-height: calc(100vh - 104px);
    padding: 0 0 20px;
}
.sort-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 15px;
}
.sort-view-wrapper {
    display: flex;
    align-items: center;
    gap: 16px;
}
.sort-controls, .view-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}
#sort-key {
    max-width: 180px;
}
.sort-bar .btn-primary {
    padding: 4px 8px;
    font-size: 12px;
}

.item-count-info {
    font-size: 14px;
}
.item-count-info .total-count {
    font-size: 26px;
}

.table-container {
    overflow-x: auto;
    width: 100%;
    cursor: grab;
    cursor: -webkit-grab;
}

.product-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
.product-table th,
.product-table td {
    padding: 10px;
    text-align: center;
    border-bottom: 1px solid #eee;
    font-size: 12px;
    white-space: nowrap;
}
.product-table tr:hover {
    background: #f8f9fa;
}
.product-table th.sticky-left,
.product-table td.sticky-left {
    position: -webkit-sticky;
    position: sticky;
    background: #fff;
    z-index: 1;
}

.product-table th.sticky-left,
.product-table td.sticky-left {
    box-shadow: 2px 0 5px rgba(0,0,0,0.05);
}
.product-table th:last-child,
.product-table td:last-child {
    position: -webkit-sticky;
    position: sticky;
    right: 0;
    background: #fff;
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.05);
    z-index: 1;
}

.product-table tr:hover td.sticky-left,
.product-table tr:hover td:last-child {
    background: #f8f9fa;
}

.btn-primary {
    background: #165a9c;
    color: #fff;
    border-radius: 6px;
    border: none;
    cursor: pointer;
}
.btn-primary:hover {
    background: #0d4a85;
}

.btn-ghost {
    background: transparent;
    color: #165a9c;
    font-weight: bold;
    border: 1px solid #165a9c;
    border-radius: 6px;
    width: 100%;
    margin: 0 0 24px;
    padding: 8px 10px;
    font-size: 12px;
    cursor: pointer;
}
.btn-ghost:hover {
    background: rgba(22, 90, 156, 0.06);
}
.btn-ghost:active {
    background: rgba(22, 90, 156, 0.12);
}
.btn-ghost:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(22, 90, 156, 0.2);
}

.pagination {
    margin-top: 15px;
    text-align: center;
}
.pagination a,
.pagination span.dots {
    display: inline-block;
    margin: 0 2px;
    padding: 6px 12px;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    color: #333;
    text-decoration: none;
}
.pagination a.active {
    background: #165a9c;
    color: #fff;
    font-weight: bold;
}
.pagination span.dots {
    background: none;
    border: none;
    color: #999;
    cursor: default;
    padding: 6px 4px;
}

.footer {
    background: #fff;
    border-top: 1px solid #ddd;
    padding: 15px 20px;
    min-width: 1200px;
}
.footer-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.footer-links a {
    margin: 0 8px;
    color: #333;
    text-decoration: none;
    font-size: 13px;
}
.footer-links a:hover {
    text-decoration: underline;
}
.footer-copy {
    font-size: 12px;
    color: #777;
}

.js-maker-select {
    width: 100%;
    padding: 6px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    justify-content: center;
    align-items: center;
    z-index: 9999;
}
.modal-content {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    width: 500px;
    max-width: 90%;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    animation: fadeIn 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    max-height: 85vh;
}
.modal-content h2 {
    margin-top: 0;
    margin-bottom: 16px;
    font-size: 20px;
    font-weight: bold;
    text-align: center;
}
.modal-scroll-content {
    overflow-y: auto;
    margin-bottom: 16px;
}
.modal-image-container {
    text-align: center;
    margin-bottom: 16px;
}
.modal-image-container img {
    max-width: 100%;
    height: auto;
    max-height: 250px;
    border-radius: 8px;
    border: 1px solid #eee;
    box-sizing: border-box;
}
.detail-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}
.detail-table + .detail-table {
    margin-top: 16px;
}
.detail-table th,
.detail-table td {
    width: 25%;
    padding: 10px;
    border-bottom: 1px solid #eee;
    text-align: left;
    font-size: 12px;
    overflow-wrap: break-word;
    word-break: break-all;
    line-height: 1.3;
}
.detail-table th {
    background: #f9f9f9;
}
.detail-table td:nth-child(2) {
    border-right: 1px solid #eee;
}
.close-btn {
    position: absolute;
    top: 12px;
    right: 16px;
    font-size: 24px;
    color: #888;
    cursor: pointer;
    transition: color 0.2s;
    display: block;
    z-index: 10000;
}
.close-btn:hover {
    color: #165a9c;
}
#print-btn {
    width: 100%;
    padding: 12px;
    font-size: 14px;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.sidebar-footer {
    position: -webkit-sticky;
    position: sticky;
    bottom: 0;
    background: #fff;
    margin: 20px -20px -20px -20px;
    padding: 20px;
    border-top: 1px solid #eee;
    box-shadow: 0 -5px 10px -5px rgba(0,0,0,0.1);
    border-radius: 0 0 8px 8px;
}

#filter-search-btn {
    width: 100%;
    padding: 12px;
    font-size: 16px;
}

@media print {
    body > *:not(.modal) {
        display: none;
    }

    .modal {
        position: static;
        display: block !important;
        background: none;
        width: 100%;
        height: auto;
        overflow: visible;
        box-shadow: none;
    }

    .modal-content {
        box-shadow: none;
        border: none;
        width: 100%;
        max-width: 100%;
        max-height: none;
        overflow: visible;
    }

    .modal-scroll-content {
        overflow: visible;
    }

    .close-btn, #print-btn {
        display: none;
    }
}

.filter-label[data-accordion-toggle] {
    cursor: pointer;
    position: relative;
    width: 100%;
    text-align: left;
    border: none;
    background: #f1f3f5;
    font-weight: bold;
    padding: 6px 8px 6px 28px;
    margin-bottom: 8px;
    display: block;
    outline: none;
    transition: background 0.2s;
}
.filter-label[data-accordion-toggle]::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 50%;
    width: 14px;
    height: 14px;
    background: url('data:image/svg+xml;utf8,<svg width="14" height="14" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><polyline points="6 8 10 12 14 8" stroke="%23165a9c" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"/></svg>') no-repeat center center;
    background-size: 14px 14px;
    transform: translateY(-50%) rotate(0deg);
    transition: transform 0.2s;
}
.filter-label[data-accordion-toggle].collapsed::before {
    transform: translateY(-50%) rotate(-90deg);
}
.accordion-content[data-accordion-content] {
    max-height: 2000px;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.4,0,0.2,1);
}
.accordion-content[data-accordion-content].collapsed {
    max-height: 0;
    padding: 0 !important;
    margin: 0 !important;
}

.category-tree {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 12px;
}
.category-tree li {
    margin-bottom: 4px;
}
.tree-item label {
    cursor: pointer;
    margin-left: 4px;
    transition: color 0.2s;
}
.tree-item label.has-selected-children {
    background-color: #e6f2ff;
    color: #0d4a85;
    font-weight: bold;
    border-color: #b3d7ff;
}
.tree-item label.all-children-selected {
    background-color: #165a9c !important;
    color: #fff !important;
    font-weight: bold;
    border-color: #0d4a85 !important;
}
.tree-item {
    display: flex;
    align-items: center;
    width: 100%;
}
.tree-toggle {
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-left: auto;
    text-align: center;
    line-height: 16px;
    position: relative;
    flex-shrink: 0;
}
.tree-toggle::before {
    content: '+';
    font-weight: bold;
    color: #888;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}
.tree-toggle.open::before {
    content: '−';
}
.category-tree input[type="checkbox"] {
    opacity: 0;
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}
.category-tree label {
    display: flex;
    align-items: center;
    flex-grow: 1;
    padding: 4px 8px;
    border-radius: 4px;
    background-color: #fff;
    border: 1px solid #ddd;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}
.subcategory-list input[disabled] + label,
.subcategory-list label.is-disabled {
    background-color: #f5f5f5;
    border-color: #f5f5f5;
    color: #999;
}
.subcategory-list input[disabled] + label:hover,
.subcategory-list label.is-disabled:hover {
    background-color: #f5f5f5;
    border-color: #f5f5f5;
}
.tree-item label.is-disabled {
    background-color: #f5f5f5;
    border-color: #f5f5f5;
    color: #999;
}
.tree-item label.is-disabled:hover {
    background-color: #f5f5f5;
    border-color: #f5f5f5;
}
.category-tree .child-category + label:hover {
    background-color: #f8f9fa;
    border-color: #bbb;
}
.category-tree .child-category:checked + label {
    background-color: #e6f2ff;
    color: #0d4a85;
    font-weight: bold;
    border-color: #b3d7ff;
}
.subcategory-list {
    list-style: none;
    padding-left: 28px;
    margin: 0 0 12px;
    display: none;
}
.subcategory-list.open {
    display: block;
}
.subcategory-list li {
    margin-top: 0;
}
.subcategory-list label {
    flex-grow: 0;
    display: inline-flex;
}
.category-selection-controls-item {
    margin-top: 4px !important;
    margin-bottom: 4px !important;
}
.category-selection-controls {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    font-size: 12px;
}
.category-selection-controls a {
    color: #165a9c;
    text-decoration: none;
}
.category-selection-controls a:hover {
    text-decoration: underline;
}

.cloned-table-container {
    cursor: initial;
    position: fixed;
    z-index: 100;
    background: #fff;
    margin-bottom: 0;
    overflow-x: hidden;
    opacity: 1;
    transition: opacity 0.15s ease-in-out;
}

.cloned-table-container.fade-out {
    opacity: 0;
}

.cloned-table-container .product-table {
    table-layout: fixed;
}

.cloned-table-container .product-table tbody {
    display: none;
}

.cloned-table-container .product-table thead {
    display: table-header-group;
}