.thdm-section {
    padding: 24px 0 40px;
}

.thdm-layout {
    display: flex;
    gap: 32px;
    align-items: flex-start;
}

/* ── Sidebar ── */

.thdm-sidebar {
    flex: 0 0 240px;
    min-width: 240px;
    position: sticky;
    top: 16px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #d1d5db transparent;
}

.thdm-sidebar-title {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 16px;
    line-height: 1.3;
}

.thdm-search-wrap {
    position: relative;
    margin-bottom: 12px;
}

.thdm-search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    color: #9ca3af;
    pointer-events: none;
}

.thdm-search-input {
    width: 100%;
    height: 38px;
    padding: 0 12px 0 34px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 13px;
    color: #1D2939;
    background: #fff;
    outline: none;
    transition: border-color 0.2s;
}

.thdm-search-input::placeholder {
    color: #9ca3af;
}

.thdm-search-input:focus {
    border-color: #f35b04;
}

.thdm-sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.thdm-sidebar-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 12px;
    border: 0;
    font-size: 14px;
    color: #1D2939;
    background: transparent;
    text-decoration: none;
    border-radius: 6px;
    transition: background-color 0.15s, color 0.15s;
    line-height: 1.4;
    text-align: left;
    cursor: pointer;
}

.thdm-sidebar-item:hover,
.thdm-sidebar-item.is-active {
    background: #f3f4f6;
    color: #1a1a1a;
    text-decoration: none;
}

.thdm-sidebar-item.is-active {
    font-weight: 700;
}

.thdm-sidebar-item:focus {
    outline: none;
}

.thdm-sidebar-item.is-hidden {
    display: none;
}

.thdm-badge-new {
    display: inline-flex;
    align-items: center;
    padding: 1px 6px;
    font-size: 10px;
    font-weight: 600;
    color: #fff;
    background: #ef4444;
    border-radius: 4px;
    line-height: 1.6;
    text-transform: uppercase;
    flex-shrink: 0;
}

.thdm-sidebar-empty {
    padding: 12px;
    font-size: 13px;
    color: #9ca3af;
}

/* ── Main area ── */

.thdm-main {
    flex: 1;
    min-width: 0;
}

/* ── Letter sections ── */

.thdm-letter-group {
    margin-bottom: 24px;
}

.thdm-letter-group.is-hidden {
    display: none;
}

.thdm-letter-heading {
    font-size: 20px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #f3f4f6;
    line-height: 1.3;
}

.thdm-cat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px 24px;
}

.thdm-cat-link {
    display: block;
    padding: 6px 0;
    font-size: 14px;
    color: #1D2939;
    text-decoration: none;
    line-height: 1.5;
    transition: color 0.15s;
    white-space: normal;
    overflow-wrap: anywhere;
}

.thdm-cat-link:hover {
    color: #f35b04;
    text-decoration: none;
}

.thdm-cat-link.is-hidden {
    display: none;
}

.thdm-empty-state {
    padding: 40px 0;
    text-align: center;
    color: #9ca3af;
    font-size: 14px;
}

.thdm-no-results {
    display: none;
    padding: 24px 0;
    text-align: center;
    color: #9ca3af;
    font-size: 14px;
}

.thdm-no-results.is-visible {
    display: block;
}

/* ── Responsive ── */

@media (max-width: 1024px) {
    .thdm-cat-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .thdm-layout {
        flex-direction: column;
        gap: 20px;
    }

    .thdm-sidebar {
        flex: none;
        min-width: 0;
        width: 100%;
        position: static;
        max-height: none;
        overflow-y: visible;
    }

    .thdm-cat-grid {
        grid-template-columns: repeat(2, 1fr);
    }

}

@media (max-width: 480px) {
    .thdm-cat-grid {
        grid-template-columns: 1fr;
    }
}
