/* Client directory cards: the same restrained visual language as vehicles. */
.client-directory-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
    gap: 18px;
}

.client-directory-grid.directory-grid-single {
    grid-template-columns: minmax(0, 360px);
    justify-content: start;
}

.client-directory-card {
    min-width: 0;
    width: 100%;
    max-width: 360px;
    justify-self: start;
    min-height: 278px;
    align-self: stretch;
    padding: 16px;
    gap: 16px;
    border: 1px solid #d9e4ee;
    border-top: 3px solid #2f80c9;
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 12px 26px rgba(30, 63, 94, 0.07);
    transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.client-directory-card:hover {
    transform: translateY(-2px);
    border-color: #b9cfe2;
    border-top-color: #1769aa;
    box-shadow: 0 18px 32px rgba(30, 63, 94, 0.12);
}

.client-directory-card:focus-visible {
    outline: 3px solid rgba(47, 128, 201, 0.26);
    outline-offset: 3px;
}

.client-directory-card-topline {
    align-items: center;
    gap: 10px;
}

.client-directory-card-badge,
.client-directory-card-code {
    min-height: 24px;
    padding: 0 9px;
    border-radius: 6px;
    font-size: 0.64rem;
    letter-spacing: 0.08em;
}

.client-directory-card-badge {
    border: 0;
    background: #edf4fa;
    color: #41627c;
}

.client-directory-card-code {
    border: 1px solid #d6e1ea;
    background: #f8fbfd;
    color: #627b90;
}

.client-directory-card-hero {
    min-width: 0;
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 12px;
}

.client-directory-card-avatar {
    width: 58px;
    height: 58px;
    border: 1px solid #b8c9d8;
    border-left: 4px solid #2f80c9;
    border-radius: 12px;
    background: #f8fbfd;
    color: #173b59;
    box-shadow: inset 0 -2px 0 rgba(23, 59, 89, 0.07);
    font-size: 1.15rem;
}

.client-directory-card-copy {
    margin-top: 13px;
}

.client-directory-card-copy strong {
    display: -webkit-box;
    width: 100%;
    overflow: hidden;
    color: #102d47;
    font-size: 0.91rem;
    font-weight: 750;
    line-height: 1.25;
    word-break: break-word;
    white-space: normal !important;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.client-directory-card-copy p {
    margin: 4px 0 0;
    overflow: hidden;
    color: #637b91;
    font-size: 0.77rem;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.client-directory-card-meta {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    min-width: 0;
}

.client-directory-card-meta span {
    display: block;
    min-width: 0;
    overflow: hidden;
    padding: 7px 10px;
    border: 1px solid #dce7ef;
    border-radius: 8px;
    background: #f8fbfd;
    color: #5f768b;
    font-size: 0.69rem;
    font-weight: 700;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.client-directory-card-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid #e4ebf1;
}

.client-directory-card-stats .entity-stat {
    min-width: 0;
    padding: 10px 11px;
    border: 1px solid #e0e9f0;
    border-radius: 11px;
    background: #f8fbfd;
}

.client-directory-card-stats .entity-stat span {
    display: block;
    margin-bottom: 5px;
    overflow: hidden;
    color: #7890a5;
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
}

.client-directory-card-stats .entity-stat strong {
    display: block;
    overflow: hidden;
    color: #17324d;
    font-size: 0.9rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.client-directory-card .btn.danger.subtle {
    width: 36px;
    min-width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid #e1c3bd;
    border-radius: 10px;
    background: #f8fbfd;
    color: #b33a2e;
    box-shadow: none;
}

.client-directory-card .btn.danger.subtle:hover {
    border-color: #b91c1c;
    background: #fff;
    color: #b91c1c;
    transform: none;
}

/* Keep both directory filters discoverable without changing their behavior. */
.directory-search {
    position: relative;
    min-width: 0;
}

.directory-search::before {
    display: block;
    margin: 0 0 6px 2px;
    color: #5f768b;
    content: 'Buscar';
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.directory-search::after {
    position: absolute;
    bottom: 16px;
    left: 16px;
    color: #2f80c9;
    content: '\f002';
    font-family: 'Font Awesome 6 Free';
    font-size: 0.9rem;
    font-weight: 900;
    pointer-events: none;
}

.directory-search input {
    box-sizing: border-box;
    padding-left: 44px;
    border: 1px solid #c9d8e6;
    background: #ffffff;
    box-shadow: 0 8px 18px rgba(30, 63, 94, 0.06);
}

.directory-search input:focus {
    border-color: #2f80c9;
    box-shadow: 0 0 0 3px rgba(47, 128, 201, 0.14), 0 8px 18px rgba(30, 63, 94, 0.08);
}

body[data-theme="dark"] .client-directory-card {
    border-color: rgba(148, 163, 184, 0.2);
    border-top-color: #4b9bd1;
    background: #0d1b2a;
    box-shadow: 0 14px 28px rgba(2, 8, 20, 0.2);
}

body[data-theme="dark"] .client-directory-card:hover {
    border-color: rgba(148, 163, 184, 0.32);
    border-top-color: #69b4e5;
    box-shadow: 0 18px 32px rgba(2, 8, 20, 0.28);
}

body[data-theme="dark"] .client-directory-card-badge {
    background: rgba(60, 112, 153, 0.28);
    color: #c8e5f7;
}

body[data-theme="dark"] .client-directory-card-code,
body[data-theme="dark"] .client-directory-card-meta span,
body[data-theme="dark"] .client-directory-card-stats .entity-stat,
body[data-theme="dark"] .client-directory-card-avatar,
body[data-theme="dark"] .client-directory-card .btn.danger.subtle {
    border-color: rgba(148, 163, 184, 0.2);
    background: #122438;
    color: #a9c0d2;
}

body[data-theme="dark"] .client-directory-card-copy strong,
body[data-theme="dark"] .client-directory-card-stats .entity-stat strong {
    color: #edf6fc;
}

body[data-theme="dark"] .client-directory-card-copy p,
body[data-theme="dark"] .client-directory-card-stats .entity-stat span {
    color: #93aec2;
}

body[data-theme="dark"] .client-directory-card .btn.danger.subtle {
    border-color: rgba(216, 178, 170, 0.42);
    color: #f08b7e;
}

body[data-theme="dark"] .client-directory-card .btn.danger.subtle:hover {
    border-color: rgba(216, 178, 170, 0.58);
    background: #3b2525;
    color: #ffc6bc;
}

body[data-theme="dark"] .client-directory-card-stats {
    border-top-color: rgba(148, 163, 184, 0.17);
}

body[data-theme="dark"] .directory-search::before {
    color: #a9c0d2;
}

body[data-theme="dark"] .directory-search input {
    border-color: rgba(148, 163, 184, 0.24);
    background: #122438;
    color: #edf6fc;
    box-shadow: 0 8px 18px rgba(2, 8, 20, 0.16);
}

body[data-theme="dark"] .directory-search input::placeholder {
    color: #8ca4ba;
}

@media (max-width: 640px) {
    .client-directory-card {
        min-height: 298px;
    }

    .client-directory-card-avatar {
        width: 48px;
        height: 48px;
    }

    .client-directory-card .btn.danger.subtle {
        width: 44px;
        min-width: 44px;
        height: 44px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .client-directory-card {
        transition: none;
    }
}
