.fd{
    --fd-navy:#102b4c;
    --fd-blue:#1463a6;
    --fd-text:#172b45;
    --fd-muted:#66768b;
    --fd-line:#e4ebf3;
    font-family:inherit;
    color:var(--fd-text);
    background:#f7f9fc;
    min-height:100vh;
}
.fd *{box-sizing:border-box}
.fd-container{width:min(1180px,calc(100% - 36px));margin:auto}
.fd-hero{
    background:linear-gradient(120deg,#102b4c,#174f81);
    color:#fff;
    padding:66px 0 95px;
}
.fd-eyebrow,.fd-kicker{
    font-size:12px;font-weight:800;letter-spacing:2px;
}
.fd-eyebrow{color:#a7d8ff}
.fd-hero h1{
    font-size:clamp(32px,4.5vw,54px);
    line-height:1.2;
    margin:17px 0;
    font-weight:800;
}
.fd-hero h1 span{color:#f5ce72}
.fd-hero p{
    max-width:670px;
    line-height:1.85;
    color:#dbe9f7;
    font-size:16px;
}
.fd-stats{display:flex;gap:40px;margin-top:28px;flex-wrap:wrap}
.fd-stats div{display:flex;flex-direction:column;gap:4px}
.fd-stats strong{font-size:27px}
.fd-stats span{font-size:13px;color:#d2e4f4}
.fd-search-section{margin-top:-45px;position:relative;z-index:2}
.fd-search{
    display:grid;
    grid-template-columns:1.4fr 1fr 1.2fr auto auto;
    gap:13px;
    align-items:end;
    padding:22px;
    border-radius:18px;
    background:#fff;
    box-shadow:0 12px 35px #142f4a16;
}
.fd-field{min-width:0}
.fd-field label{
    display:block;
    margin-bottom:7px;
    font-size:13px;
    font-weight:700;
}
.fd-field input,.fd-field select{
    width:100%;
    min-width:0;
    height:45px;
    border:1px solid #d8e2ed;
    border-radius:9px;
    padding:0 12px;
    background:#fff;
    font:inherit;
    font-size:14px;
    color:#203651;
}
.fd-search button{
    height:45px;
    border:0;
    border-radius:9px;
    background:#1565a8;
    color:#fff;
    font-weight:800;
    padding:0 21px;
    cursor:pointer;
}
.fd-reset{
    align-self:center;
    font-size:13px;
    color:#60758a;
    text-decoration:none;
    white-space:nowrap;
}
.fd-results{padding:42px 0 70px}
.fd-results-head{
    display:flex;justify-content:space-between;align-items:center;
    gap:20px;margin-bottom:22px;
}
.fd-kicker{color:#1471b5}
.fd-results h2{font-size:26px;margin:5px 0}
.fd-results-head p{color:var(--fd-muted);margin:0}
.fd-preview-tag{
    background:#fff1d8;color:#93611b;
    padding:9px 13px;border-radius:999px;
    font-size:11px;font-weight:800;
}
.fd-grid{
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:17px;
}
.fd-card{
    min-width:0;
    background:#fff;
    border:1px solid var(--fd-line);
    border-radius:15px;
    padding:21px;
    display:flex;
    flex-direction:column;
    box-shadow:0 3px 12px #1a355009;
}
.fd-card-top{display:flex;justify-content:space-between;align-items:center;gap:10px}
.fd-card-icon{
    display:grid;place-items:center;
    width:43px;height:43px;
    background:#eaf3fb;border-radius:12px;font-size:22px;
}
.fd-card-type{
    font-size:11px;color:#226ca8;background:#eaf3fb;
    padding:6px 9px;border-radius:7px;
}
.fd-card h3{
    font-size:17px;
    line-height:1.5;
    margin:16px 0 9px;
    overflow-wrap:anywhere;
}
.fd-location{color:#56718a;font-size:13px}
.fd-activity{
    font-size:13px;
    line-height:1.75;
    color:#617187;
    margin:15px 0;
    display:-webkit-box;
    -webkit-line-clamp:3;
    -webkit-box-orient:vertical;
    overflow:hidden;
}
.fd-card-bottom{
    margin-top:auto;
    border-top:1px solid #edf1f6;
    padding-top:13px;
    font-size:12px;
    color:#245e90;
}
.fd-fid{font-size:11px;color:#9aa7b5;margin-top:9px}
.fd-pagination{
    display:flex;justify-content:center;align-items:center;
    flex-wrap:wrap;gap:15px;margin:32px 0;
}
.fd-pagination a{
    border:1px solid #d9e5ef;
    border-radius:9px;
    padding:10px 17px;
    color:#155e9a;
    text-decoration:none;
    background:#fff;
}
.fd-pagination span{font-size:13px;color:#617187}
.fd-empty{
    background:#fff;border:1px solid var(--fd-line);
    border-radius:14px;padding:50px;text-align:center;
}
.fd-source{
    font-size:12px;line-height:1.8;color:#7a8797;
    margin-top:35px;
    border-top:1px solid #e1e8f0;
    padding-top:18px;
}
@media(max-width:1000px){
    .fd-search{grid-template-columns:repeat(2,minmax(0,1fr))}
    .fd-wide{grid-column:1/-1}
    .fd-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:640px){
    .fd-container{width:calc(100% - 26px)}
    .fd-hero{padding:42px 0 75px}
    .fd-hero h1{font-size:30px}
    .fd-hero p{font-size:14px}
    .fd-stats{gap:22px}
    .fd-stats strong{font-size:22px}
    .fd-search{grid-template-columns:1fr;padding:15px;gap:12px}
    .fd-wide{grid-column:auto}
    .fd-search button{width:100%}
    .fd-reset{text-align:center}
    .fd-results{padding-top:30px}
    .fd-results-head{align-items:flex-start}
    .fd-results h2{font-size:21px}
    .fd-preview-tag{font-size:9px;white-space:nowrap}
    .fd-grid{grid-template-columns:1fr;gap:12px}
    .fd-card{padding:17px}
}

/* FACTORY DIRECTORY FOOTER FLOW FIX V1.3 */

.fd {
    display: flow-root;
    width: 100%;
    clear: both;
}

.fd-results {
    display: flow-root;
    clear: both;
}

.fd-grid {
    display: grid;
    float: none;
    clear: both;
}

.fd-grid::after {
    content: none;
}

body > .alaidee-footer {
    clear: both;
    position: relative;
    float: none;
    width: 100%;
}


/* FACTORY DIRECTORY MAIN FLOW FIX V1.4 */

main.fd {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: auto;
    min-height: 100vh;
}

main.fd > .fd-hero,
main.fd > .fd-search-section,
main.fd > .fd-results {
    flex-shrink: 0;
    width: 100%;
}


/* FACTORY DIRECTORY BODY FLOW FIX V1.5 */

/* Override global body flex layout on factory page only */
body:has(main.fd) {
    display: block !important;
    height: auto !important;
    min-height: 100vh;
    overflow-y: auto;
}

/* Allow factory main to grow with all result cards */
body:has(main.fd) > main.fd {
    display: block !important;
    height: auto !important;
    min-height: 100vh;
    max-height: none !important;
}

/* Keep results in normal document flow */
main.fd > .fd-results {
    display: flow-root;
    position: static;
    height: auto;
}

/* Footer follows the entire factory directory */
body:has(main.fd) > .alaidee-footer {
    clear: both;
    position: relative;
}


/* =====================================================
   ALAIDEE FACTORY DIRECTORY V2
   Desktop 1500px / Tablet / Mobile
   ===================================================== */

.fd .fd-container {
    width: 100%;
    max-width: 1500px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 24px;
    padding-right: 24px;
}

.fd-results {
    background: #f5f8fd;
}

.fd-results-head {
    margin-bottom: 26px;
}

.fd-results h2 {
    color: #11264c;
    font-size: clamp(23px, 2.2vw, 32px);
    font-weight: 800;
}

.fd-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.fd-card {
    min-width: 0;
    border: 1px solid #e3ebf5;
    border-radius: 19px;
    padding: 23px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(25, 60, 110, .045);
    transition: transform .2s ease, box-shadow .2s ease;
}

.fd-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 34px rgba(25, 60, 110, .1);
}

.fd-card-top {
    justify-content: flex-start;
    gap: 11px;
}

.fd-card-icon {
    width: 54px;
    height: 54px;
    flex: 0 0 54px;
    border-radius: 14px;
    background: linear-gradient(135deg, #e8f3ff, #d7eaff);
    font-size: 27px;
}

.fd-card-category {
    min-width: 0;
    max-width: 100%;
    padding: 8px 11px;
    border-radius: 10px;
    background: #eaf3ff;
    color: #2462a5;
    font-size: 12px;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fd-card-type {
    margin-left: auto;
    flex-shrink: 0;
    font-size: 12px;
}

.fd-card h3 {
    min-height: 52px;
    margin: 18px 0 8px;
    color: #10264d;
    font-size: 19px;
    line-height: 1.45;
    font-weight: 800;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.fd-location {
    color: #587096;
    font-size: 13px;
    line-height: 1.6;
}

.fd-activity {
    min-height: 70px;
    margin: 14px 0 20px;
    color: #586e8d;
    font-size: 13px;
    line-height: 1.75;
    -webkit-line-clamp: 3;
}

.fd-card-bottom {
    padding-top: 15px;
    color: inherit;
}

.fd-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
}

.fd-metric {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 3px 8px;
    border-right: 1px solid #e8edf5;
}

.fd-metric:first-child {
    padding-left: 0;
}

.fd-metric:last-child {
    border-right: 0;
    padding-right: 0;
}

.fd-metric-icon {
    color: #1672c6;
    font-size: 19px;
    flex-shrink: 0;
}

.fd-metric small {
    display: block;
    color: #7384a0;
    font-size: 10px;
    line-height: 1.5;
}

.fd-metric strong {
    display: block;
    color: #152c50;
    font-size: 12px;
    line-height: 1.5;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.fd-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    border-top: 1px solid #e9eef6;
    padding-top: 14px;
    margin-top: 17px;
}

.fd-fid {
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
    font-size: 11px;
}

.fd-view-label {
    flex-shrink: 0;
    padding: 10px 13px;
    border-radius: 11px;
    background: #eaf3ff;
    color: #145fbd;
    font-size: 12px;
    font-weight: 800;
}

/* Tablet */
@media (max-width: 1100px) {
    .fd-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Mobile */
@media (max-width: 640px) {
    .fd .fd-container {
        padding-left: 13px;
        padding-right: 13px;
    }

    .fd-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 13px;
    }

    .fd-card {
        padding: 17px;
        border-radius: 17px;
    }

    .fd-card-icon {
        width: 46px;
        height: 46px;
        flex-basis: 46px;
        font-size: 23px;
    }

    .fd-card-category {
        font-size: 11px;
        padding: 7px;
    }

    .fd-card h3 {
        min-height: 0;
        font-size: 17px;
    }

    .fd-activity {
        min-height: 0;
    }

    .fd-metric {
        gap: 4px;
        padding: 3px 5px;
    }

    .fd-metric-icon {
        font-size: 16px;
    }

    .fd-metric small {
        font-size: 9px;
    }

    .fd-metric strong {
        font-size: 10px;
    }

    .fd-view-label {
        padding: 9px;
        font-size: 11px;
    }

    .fd-results-head {
        align-items: flex-start;
        gap: 8px;
    }

    .fd-preview-tag {
        font-size: 9px;
        padding: 7px 9px;
    }
}
