.cl-wrapper {
    max-width: 900px;
    margin: 20px auto;
    font-family: 'Segoe UI', sans-serif;
    color: #333;
}

.cl-header-box { text-align: center; margin-bottom: 20px; }
.cl-header-box h2 { color: #0073aa; margin-bottom: 5px; }

/* Thanh tìm kiếm */
.cl-search-bar { display: flex; gap: 10px; margin-bottom: 20px; }
#cl-keyword { 
    flex: 1; padding: 12px; border: 2px solid #ddd; 
    border-radius: 5px; font-size: 16px; 
}
#cl-keyword:focus { border-color: #0073aa; outline: none; }
#cl-submit { 
    padding: 0 30px; background: #0073aa; color: white; 
    border: none; border-radius: 5px; cursor: pointer; 
    font-weight: bold; font-size: 15px; 
}
#cl-submit:hover { background: #005177; }

/* Chú thích */
.cl-legend { display: flex; gap: 15px; margin-bottom: 25px; flex-wrap: wrap; justify-content: center; }
.legend-item { display: flex; align-items: center; font-size: 13px; }
.badge { 
    display: inline-block; width: 22px; height: 22px; 
    line-height: 22px; text-align: center; border-radius: 4px; 
    color: white; font-weight: bold; margin-right: 5px; font-size: 12px;
}

/* Màu sắc */
.E, .bg-E { background-color: #28a745 !important; color: white; border-color: #28a745; }
.G, .bg-G { background-color: #17a2b8 !important; color: white; border-color: #17a2b8; }
.F, .bg-F { background-color: #ffc107 !important; color: #333; border-color: #ffc107; }
.N, .bg-N { background-color: #dc3545 !important; color: white; border-color: #dc3545; }

/* Card Kết Quả */
.cl-card {
    background: #fff; border: 1px solid #e5e5e5;
    border-radius: 8px; padding: 20px; margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.cl-card-header { 
    display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid #eee; padding-bottom: 10px; margin-bottom: 15px;
}
.cl-chem-name { margin: 0; color: #0073aa; font-size: 20px; }
.cl-chem-formula { 
    background: #eee; padding: 3px 8px; border-radius: 4px; 
    font-weight: bold; color: #555; 
}

/* Thông số Nồng độ & Nhiệt độ */
.cl-card-meta { 
    display: flex; gap: 15px; flex-wrap: wrap; margin-bottom: 20px; 
    align-items: center; background: #f9f9f9; padding: 10px; border-radius: 5px;
}
.cl-meta-item { margin-right: 15px; color: #555; }
.cl-meta-badge {
    padding: 5px 12px; border-radius: 20px; font-size: 14px; font-weight: 600;
}
.cl-conc { background: #e3f2fd; color: #0d47a1; border: 1px solid #bbdefb; }
.cl-temp { background: #fbe9e7; color: #d84315; border: 1px solid #ffccbc; }

/* Grid Vật liệu */
.cl-mat-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); gap: 10px;
}
.cl-mat-box {
    text-align: center; padding: 10px 5px; border-radius: 5px;
    border: 1px solid #ddd; background: #fff;
}
.mat-name { display: block; font-size: 12px; margin-bottom: 5px; font-weight: 600; }
.mat-rate { display: block; font-size: 18px; font-weight: 800; }

.cl-message { text-align: center; padding: 20px; font-weight: bold; }
.cl-message.error { color: #dc3545; }

/* Tiêu đề phân cách nhóm vật liệu */
.cl-section-title {
    font-size: 13px;
    font-weight: 700;
    color: #888;
    text-transform: uppercase;
    margin-top: 15px;
    margin-bottom: 8px;
    border-bottom: 1px dashed #ddd;
    padding-bottom: 4px;
}

/* Điều chỉnh lại grid để hiển thị đẹp hơn với tên kim loại dài */
.cl-mat-grid {
    display: grid;
    /* Tự động chia cột, tối thiểu 70px */
    grid-template-columns: repeat(auto-fill, minmax(75px, 1fr)); 
    gap: 8px;
}

.mat-name {
    font-size: 11px; /* Giảm font chữ một chút để chữ "Inox 304" không bị tràn */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}