.kyquy-section {
    background-color: #092244;
    padding: 50px 48px 60px;
    margin: 30px 0;
    border-radius: 8px;
    width: 100%;
    box-sizing: border-box;
}

.kyquy-header {
    margin-bottom: 32px;
}

.kyquy-label {
    font-size: 12px;
    font-weight: 500;
    color: #4da3ff;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    margin-bottom: 0 !important;
}

.kyquy-title {
    font-size: 36px;
    font-weight: 700;
    color: #ffffff;
    line-height: 48px;
    margin-bottom: 12px;
}

.kyquy-desc {
    font-size: 14px;
    color: rgba(180, 210, 255, 0.65);
    line-height: 20px;
    margin-bottom: 0 !important;
}

.kyquy-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    box-shadow: 0 8px 64px 0 rgba(0, 0, 0, 0.4);
    overflow: hidden;
}

.kyquy-card-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    padding: 20px 24px 21px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.kyquy-card-title-wrap {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.kyquy-card-title {
    font-size: 24px;
    font-weight: 600;
    color: #ffffff;
    line-height: 24px;
    margin-bottom: 4px;
}

.kyquy-card-count {
    font-size: 14px;
    color: rgba(180, 210, 255, 0.5);
    line-height: 16px;
}

.kyquy-controls {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 12px;
    flex-wrap: wrap;
}

.kyquy-filters {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 12px;
    padding: 6px 12px;
}

.kyquy-filter-btn {
    background: transparent;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: rgba(180, 210, 255, 0.6);
    padding: 6px 12px;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
    white-space: nowrap;
    height: 34px;
    line-height: 1;
    margin: 0 !important;
    text-transform: none;
}

.kyquy-filter-btn.active {
    background: linear-gradient(155.4deg, #1a6fc4 0%, #0d4fa0 100%);
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(26, 111, 196, 0.5);
}

.kyquy-filter-btn:hover:not(.active) {
    color: rgba(180, 210, 255, 0.9);
}

.kyquy-search-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 12px;
    padding: 6px 14px;
    width: 260px;
    height: 46px;
}

.kyquy-search-icon {
    color: rgba(180, 210, 255, 0.4);
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}

.kyquy-search {
    background: transparent !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    border-radius: 8px;
    font-size: 14px;
    color: rgba(180, 210, 255, 0.8) !important;
    width: 100%;
    padding: 0 !important;
    margin: 0 !important;
}

.kyquy-search::placeholder {
    color: rgba(180, 210, 255, 0.35) !important;
}

.kyquy-table-wrap {
    overflow-x: auto;
}

.kyquy-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.kyquy-table thead tr,
.kyquy-table thead th {
    border-bottom: 1px solid rgba(255, 255, 255, 0.04) !important;
    border-top: none !important;
}

.kyquy-table thead th {
    font-size: 11px;
    font-weight: 600;
    color: #ffffff;
    letter-spacing: 0.8px;
    text-align: left;
    padding: 14px 10px;
    white-space: nowrap;
    background: transparent;
    text-transform: uppercase;
}

.kyquy-table .col-ma {
    width: 65px;
    padding-left: 20px;
}

.kyquy-table .col-ten {
    width: 150px;
}

.kyquy-table .col-nhom {
    width: 140px;
}

.kyquy-table .col-san {
    width: 120px;
}

.kyquy-table .col-num {
    width: 150px;
    text-align: right;
}

.kyquy-table thead .col-num {
    text-align: right;
}

.kyquy-row {
    border-bottom: 1px solid rgba(255, 255, 255, 0.04) !important;
    transition: background 0.15s ease;
    height: 54px;
}

.kyquy-row:hover {
    background: rgba(255, 255, 255, 0.025);
}

.kyquy-row td {
    padding: 12px 10px;
    vertical-align: middle;
    font-size: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04) !important;
    border-top: none !important;
}

.kyquy-row:last-child td,
.kyquy-row:last-child {
    border-bottom: none !important;
}

.kyquy-row .col-ma {
    padding-left: 20px;
}

.kyquy-ma {
    font-size: 14px !important;
    font-weight: 700 !important;
    color: #4da3ff !important;
    white-space: nowrap;
}

.kyquy-ten {
    font-size: 12px;
    font-weight: 500;
    color: #ffffff;
    white-space: nowrap;
}

.kyquy-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 30px;
    padding: 0 10px;
    border-radius: 4px;
    border: 1px solid;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.kyquy-san-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 4px;
    height: 28px;
    padding: 0 10px;
    font-size: 12px;
    font-weight: 600;
    color: rgba(180, 210, 255, 0.7);
    white-space: nowrap;
}

.kyquy-num-dim {
    font-size: 13px !important;
    font-weight: 700 !important;
    color: rgba(255, 255, 255, 0.75) !important;
    text-align: right !important;
    white-space: nowrap;
}

.kyquy-num-mid {
    font-size: 13px !important;
    font-weight: 700 !important;
    color: #a5c8ff !important;
    text-align: right !important;
    white-space: nowrap;
}

.kyquy-num-light {
    font-size: 13px !important;
    font-weight: 700 !important;
    color: #c5daff !important;
    text-align: right !important;
    white-space: nowrap;
}

.kyquy-num-accent {
    font-size: 13px !important;
    font-weight: 700 !important;
    color: #4da3ff !important;
    text-align: right !important;
    white-space: nowrap;
    padding-right: 20px !important;
}

.kyquy-empty td,
.kyquy-no-results {
    text-align: center;
    color: rgba(180, 210, 255, 0.5);
    font-size: 13px;
    padding: 36px 20px;
}

@media (max-width: 1024px) {
    .kyquy-card-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .kyquy-controls {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .kyquy-search-wrap {
        width: 100%;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .kyquy-section {
        padding: 30px 20px;
    }

    .kyquy-details-wrap.kyquy-modal-active {
        display: block !important;
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        bottom: auto !important;
        transform: translate(-50%, -50%) !important;
        width: 85vw !important;
        max-width: 680px !important;
        max-height: 85vh !important;
        background: #ffffff !important;
        border-radius: 20px !important;
        z-index: 999999 !important;
        box-shadow: 0 25px 60px rgba(0, 0, 0, 0.4) !important;
        overflow-y: auto !important;
        padding: 32px 28px !important;
    }
}

@media (max-width: 768px) {
    .kyquy-section {
        padding: 20px;
        margin: 20px 0;
        border-radius: 8px;
    }

    .kyquy-header {
        margin-bottom: 20px;
    }

    .kyquy-title {
        font-size: 24px;
        line-height: 30px;
        margin-bottom: 5px;
    }

    .kyquy-filters {
        flex-wrap: wrap;
        gap: 2px;
    }

    .kyquy-filter-btn {
        font-size: 13px;
        height: 20px;
        padding: 1px 8px;
        line-height: 18px;
    }

    .kyquy-card-header {
        padding: 15px 15px 20px;
    }

    .kyquy-card-title {
        font-size: 18px;
        line-height: 20px;
    }
}

/* ─── Detail Modal Popup ─────────────────────────────────────────────────── */

.kyquy-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.kyquy-overlay.active {
    display: block;
    opacity: 1;
}

.kyquy-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 720px;
    max-width: 92vw;
    height: 560px;
    max-height: 85vh;
    background: #ffffff;
    z-index: 999999;
    box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.35);
    border-radius: 8px;
    transform: translate(-50%, -46%) scale(0.96);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.kyquy-panel.active {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    pointer-events: auto;
}

body.kyquy-panel-open {
    overflow: hidden;
}

.kyquy-panel-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* Header */
.kd-header {
    flex-shrink: 0;
    padding: 20px 24px 10px;
}

.kd-header-meta {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 16px;
}

.kd-header-info {
    flex: 1;
}

.kd-label {
    color: #E53E3E;
    font-size: 12px;
    font-weight: 700;
    line-height: 16px;
    text-transform: uppercase;
}

.kd-title {
    font-size: 24px;
    font-weight: 700;
    color: #0f172a;
    line-height: 32px;
    margin-bottom: 2px !important;
}

.kd-subtitle {
    font-size: 14px;
    font-weight: 400;
    color: #94a3b8;
    line-height: 20px;
    margin-bottom: 0 !important;
}

.kd-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    padding-top: 4px;
    flex-shrink: 0;
}

.kd-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 10px;
    cursor: pointer;
    color: #64748b;
    transition: background 0.15s ease, color 0.15s ease;
    text-decoration: none;
    padding: 0;
    margin: 0;
}

.kd-action-btn:hover {
    background: #f1f5f9;
    color: #0f172a;
}

/* Tabs */
.kd-tabs {
    display: flex;
    align-items: center;
    gap: 0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
    scrollbar-width: none;
}

.kd-tabs::-webkit-scrollbar {
    display: none;
}

.kd-tab {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 10px 16px;
    font-size: 16px;
    font-weight: 500;
    color: #94a3b8;
    cursor: pointer;
    text-transform: none;
    transition: color 0.2s ease, border-color 0.2s ease;
    white-space: nowrap;
    margin: 0;
    letter-spacing: 0;
    line-height: 20px;
    flex-shrink: 0;
}

.kd-tab.active {
    color: #001838;
    border-bottom-color: #001838;
    font-weight: 600;
}

.kd-tab:hover:not(.active) {
    color: #475569;
}

/* Body */
.kd-body {
    flex: 1;
    min-height: 380px;
    overflow-y: auto;
    position: relative;
    padding: 0;
}

.kd-loading {
    display: none;
    position: absolute;
    inset: 0;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
    z-index: 10;
}

.kd-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid #e2e8f0;
    border-top-color: #001838;
    border-radius: 50%;
    animation: kd-spin 0.7s linear infinite;
    display: block;
}

@keyframes kd-spin {
    to {
        transform: rotate(360deg);
    }
}

.kd-tab-content {
    display: none;
}

.kd-tab-content.active {
    display: block;
}

/* Đặc tả hợp đồng table */
.kd-detail-table {
    width: 100%;
    border-collapse: collapse;
}

.kd-detail-row {
    border-bottom: 1px solid #f1f5f9;
}

.kd-detail-table td,
.kd-detail-table th {
    padding: 16px 24px !important;
}

.kd-detail-label {
    width: 252px;
    min-width: 200px;
    font-weight: 500;
    color: #64748b;
    padding-left: 24px !important;
}

.kd-detail-value {
    font-weight: 400;
    color: #0f172a;
    padding-right: 24px !important;
}

/* Tiêu chuẩn chất lượng */
.kd-cl-intro {
    font-size: 14px;
    color: #475569;
    line-height: 22px;
    padding: 20px 24px;
    margin: 0;
}

.kd-cl-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 24px;
    width: calc(100% - 48px);
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
}

.kd-cl-table thead th {
    background: #f8fafc;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    padding: 12px 16px !important;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.kd-cl-table tbody td {
    padding: 12px 16px !important;
    font-size: 14px;
    color: #0f172a;
    line-height: 20px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: top;
}

.kd-cl-table tbody tr:last-child td {
    border-bottom: none;
}

/* Lịch đáo hạn */
.kd-exp-table {
    width: 100%;
    border-collapse: collapse;
}

.kd-exp-table thead tr {
    background: #f8fafc;
}

.kd-exp-table thead th {
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    text-align: left;
    padding: 12px 16px !important;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
}

.kd-exp-table thead th:first-child {
    padding-left: 24px !important;
}

.kd-exp-table thead th:last-child {
    padding-right: 24px !important;
}

.kd-exp-row {
    transition: background 0.15s ease;
}

.kd-exp-row:hover {
    background: #f8fafc;
}

.kd-exp-row td {
    font-size: 14px;
    color: #0f172a;
    padding: 14px 16px !important;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.kd-exp-row td:first-child {
    padding-left: 24px !important;
}

.kd-exp-row td:last-child {
    padding-right: 24px !important;
}

.kd-exp-row:last-child td {
    border-bottom: none;
}

.kd-exp-hd {
    font-weight: 500;
    color: #0f172a;
    white-space: nowrap;
}

.kd-exp-ma-badge {
    display: inline-block;
    font-weight: 700;
    font-size: 13px;
    color: #0f172a;
    background: #f1f5f9;
    padding: 3px 8px;
    border-radius: 6px;
    letter-spacing: 0.3px;
}

.kd-exp-san-badge {
    display: inline-block;
    font-weight: 600;
    font-size: 12px;
    color: #0369a1;
    background: #e0f2fe;
    padding: 3px 8px;
    border-radius: 6px;
}

.kd-exp-date {
    font-size: 13px;
    color: #475569;
    white-space: nowrap;
}

.kd-empty {
    text-align: center;
    color: #94a3b8;
    font-size: 14px;
    padding: 48px 24px;
}

.kyquy-row.kd-active-row {
    background: rgba(255, 255, 255, 0.06);
}

@media (max-width: 768px) {
    .kyquy-panel {
        width: 95vw;
        max-height: 90vh;
        border-radius: 12px;
    }

    .kyquy-panel-inner {
        max-height: 90vh;
    }

    .kd-header {
        padding: 16px 16px 0;
    }

    .kd-detail-label {
        width: 130px !important;
        min-width: 110px !important;
        font-size: 13px !important;
        padding: 12px 10px 12px 16px !important;
    }

    .kd-detail-value {
        font-size: 13px !important;
        padding: 12px 16px 12px 10px !important;
    }

    .kd-tab {
        font-size: 13px;
        padding: 10px 12px;
        flex-shrink: 0;
    }

    .kd-title {
        font-size: 20px;
        line-height: 26px;
    }

    .kd-subtitle {
        font-size: 13px;
    }

    .kd-exp-table thead th {
        padding: 10px 12px !important;
    }

    .kd-exp-table thead th:first-child {
        padding-left: 16px !important;
    }

    .kd-exp-table thead th:last-child {
        padding-right: 16px !important;
    }

    .kd-exp-row td {
        padding: 10px 12px !important;
    }

    .kd-exp-row td:first-child {
        padding-left: 16px !important;
    }

    .kd-exp-row td:last-child {
        padding-right: 16px !important;
    }
}