.thai-date-field {
    display: grid;
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.4fr) minmax(0, 1fr);
    gap: 0.35rem;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    align-items: center;
}

.thai-date-field select,
.thai-date-field input {
    min-width: 0;
    max-width: 100%;
    width: 100%;
    min-height: 2.25rem;
    padding: 0.45rem 0.55rem;
    border: 1px solid #cbd5e1;
    border-radius: 0.5rem;
    background: #fff;
    color: #334155;
    font: inherit;
}

/* ชุดวันเดือนปีมักถูกวางอยู่ในช่องกรองที่กว้างไม่เท่ากัน
   จึงต้องยอมให้คอลัมน์ย่อได้ตามพื้นที่จริง ไม่ดันไปทับช่องถัดไป */
.thai-date-field > * {
    min-width: 0;
}

.thai-date-field select:focus,
.thai-date-field input:focus {
    outline: 2px solid rgba(59, 130, 246, 0.2);
    border-color: #3b82f6;
}

.thai-date-field input[readonly] {
    background: #f8fafc;
}

@media (max-width: 420px) {
    .thai-date-field {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.2rem;
    }

    .thai-date-field [data-thai-date-year] {
        grid-column: 1 / -1;
    }
}

@media (min-width: 421px) and (max-width: 768px) {
    .thai-date-field {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.25rem;
    }
}
