/* Kết quả tra cứu và thông tin thủ tục trên trang Khác. */
#procedure-search-results,
#procedure-detail {
    min-width: 0;
    color: var(--text-color);
}

#procedure-search-results[hidden],
#procedure-detail[hidden] {
    display: none !important;
}

#procedure-search-results .procedure-result {
    width: 100%;
    box-sizing: border-box;
    appearance: none;
    font: inherit;
    text-align: left;
}

#procedure-search-results .procedure-result .row-content {
    min-width: 0;
}

#procedure-search-results .procedure-meta,
#procedure-search-results .procedure-codes,
#procedure-search-results .procedure-department {
    overflow-wrap: anywhere;
}

#procedure-search-results .procedure-department {
    color: var(--text-color);
    font-weight: 600;
    font-size: 12px;
    line-height: 1.6;
}

#procedure-search-results .badge-unknown,
#procedure-detail .badge-unknown {
    color: #475569;
    background: #f1f5f9;
    border-color: #cbd5e1;
}

#procedure-search-results .procedure-result:hover,
#procedure-search-results .procedure-result:focus-visible {
    background-color: var(--card-hover);
    border-color: #93c5fd;
}

#procedure-search-results .procedure-result:focus-visible,
#procedure-detail .khac-back-button:focus-visible,
#procedure-detail .khac-detail-link:focus-visible,
#procedure-detail .khac-support a:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 3px;
}

#procedure-detail {
    max-width: 1160px;
    margin: 18px auto 0;
    scroll-margin-top: 100px;
}

#procedure-detail .khac-back-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    max-width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--primary-color);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: background-color .2s ease, border-color .2s ease;
}

#procedure-detail .khac-back-button:hover {
    background: var(--card-hover);
    border-color: var(--primary-color);
}

#procedure-detail .khac-detail-department {
    margin: 10px 0 12px;
    font-size: 14px;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

#procedure-detail .khac-info-card {
    padding: 16px 20px;
    margin-bottom: 16px;
    border: 1px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 18px;
    background: var(--card-bg);
}

#procedure-detail .khac-detail-kicker {
    margin: 0 0 8px;
    font-size: 12px;
    line-height: 1.6;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

#procedure-detail #procedure-detail-title {
    margin: 0 0 12px;
    color: var(--primary-color);
    font-size: 20px;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

#procedure-detail .khac-info-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px 18px;
    margin: 0;
}

#procedure-detail .khac-info-grid > div {
    min-width: 0;
}

#procedure-detail .khac-info-grid dt {
    margin-bottom: 4px;
    font-size: 12px;
    line-height: 1.5;
    font-weight: 600;
    letter-spacing: .035em;
    text-transform: uppercase;
}

#procedure-detail .khac-info-grid dd {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    font-weight: 600;
    overflow-wrap: anywhere;
}

#procedure-detail .procedure-badge {
    display: inline-block;
    max-width: 100%;
    box-sizing: border-box;
    font-size: 13px;
    white-space: normal;
}

#procedure-detail .khac-qr-panel {
    display: flex;
    align-items: center;
    gap: 40px;
    padding: 30px;
    border: 2px solid var(--primary-color);
    border-radius: 20px;
    background: var(--card-bg);
    box-shadow: 0 6px 20px rgba(201, 81, 23, .04);
}

#procedure-detail .khac-qr-code {
    display: flex;
    flex: 0 0 320px;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 320px;
    max-width: 100%;
    min-width: 0;
    text-align: center;
}

#procedure-detail #procedure-qr-image {
    width: 100%;
    min-width: 0;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

#procedure-detail #procedure-qr-image svg,
#procedure-detail #procedure-qr-image img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    background: #fff;
}

#procedure-detail .khac-qr-caption {
    font-size: 13px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

#procedure-detail .khac-qr-copy {
    flex: 1;
    min-width: 0;
}

#procedure-detail .khac-qr-copy h2 {
    margin: 0 0 12px;
    color: var(--primary-color);
    font-size: 24px;
    line-height: 1.55;
    overflow-wrap: anywhere;
}

#procedure-detail .khac-qr-copy p {
    margin: 0 0 20px;
    font-size: 16px;
    line-height: 1.8;
    overflow-wrap: anywhere;
}

#procedure-detail .khac-detail-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 46px;
    max-width: 100%;
    box-sizing: border-box;
    padding: 12px 18px;
    border: 1px solid var(--primary-color);
    border-radius: 10px;
    background: var(--primary-color);
    color: #fff;
    font-size: 15px;
    line-height: 1.6;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    overflow-wrap: anywhere;
    transition: filter .2s ease;
}

#procedure-detail .khac-detail-link:hover {
    filter: brightness(.9);
}

#procedure-detail .khac-qr-copy .khac-support {
    margin: 20px 0 0;
    font-size: 14px;
}

#procedure-detail .khac-support a {
    color: var(--primary-color);
    font-weight: 600;
    text-underline-offset: 3px;
}

@media (max-width: 980px) {
    #procedure-detail .khac-info-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    #procedure-detail .khac-qr-code {
        flex-basis: 280px;
        width: 280px;
    }
}

@media (max-width: 760px) {
    #procedure-detail .khac-info-card {
        padding: 16px 18px;
    }

    #procedure-detail #procedure-detail-title {
        font-size: 18px;
    }

    #procedure-detail .khac-info-grid {
        gap: 12px 16px;
    }

    #procedure-detail .khac-qr-panel {
        flex-direction: column;
        gap: 22px;
        padding: 24px 20px;
    }

    #procedure-detail .khac-qr-code {
        flex-basis: auto;
        width: 280px;
    }

    #procedure-detail .khac-qr-copy {
        width: 100%;
    }
}

@media (max-width: 600px) {
    #procedure-search-results .procedure-result {
        display: grid;
        grid-template-columns: 42px minmax(0, 1fr);
        gap: 10px;
        transform: none;
    }

    #procedure-search-results .procedure-result-icon {
        align-self: start;
    }

    #procedure-search-results .procedure-open {
        grid-column: 2;
        margin-left: 0;
        white-space: normal;
    }

    #procedure-search-results .procedure-results-heading {
        flex-wrap: wrap;
    }

    #procedure-detail .khac-info-card {
        padding: 14px 16px;
    }

    #procedure-detail .khac-info-grid > div:nth-child(n + 3) {
        grid-column: 1 / -1;
    }

    #procedure-detail .khac-qr-panel {
        padding: 24px 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    #procedure-search-results .procedure-result,
    #procedure-detail .khac-back-button,
    #procedure-detail .khac-detail-link {
        transition: none;
    }

    #procedure-search-results .procedure-result:hover {
        transform: none;
    }
}
