.clients-hero {
    align-items: center;
    background: linear-gradient(135deg, #ffffff 0%, var(--accent-soft) 100%);
    border: 1px solid var(--border-focus);
    border-radius: 18px;
    padding: 22px;
    box-shadow: var(--shadow-card);
}

.clients-hero .page-header-info h2 {
    font-size: 2rem;
    margin-bottom: 4px;
}

.clients-hero-action {
    height: 46px;
    border-radius: 12px;
    box-shadow: 0 18px 30px -18px rgba(37, 99, 235, 0.85);
}

.clients-toolbar {
    display: flex;
    align-items: stretch;
    gap: 14px;
    margin-bottom: 22px;
}

.clients-search {
    flex: 1;
    position: relative;
    min-width: 260px;
}

.clients-search i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    font-size: 1.15rem;
    z-index: 1;
}

.clients-search .form-control {
    height: 52px;
    padding-left: 46px;
    border-radius: 14px;
    box-shadow: var(--shadow-sm);
}

.clients-toolbar-stats {
    display: flex;
    gap: 10px;
}

.clients-stat {
    min-width: 108px;
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: 14px;
    padding: 10px 14px;
    box-shadow: var(--shadow-sm);
}

.clients-stat span {
    display: block;
    color: var(--text-tertiary);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.clients-stat strong {
    color: var(--primary);
    font-size: 1.25rem;
    line-height: 1.1;
}

.clients-list {
    min-width: 0;
}

.clients-table-shell {
    overflow: hidden;
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: 14px;
    box-shadow: var(--shadow-card);
}

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

.clients-table th {
    padding: 12px 14px;
    background: var(--bg-gray);
    color: var(--text-tertiary);
    font-size: 0.7rem;
    font-weight: 850;
    letter-spacing: 0.06em;
    text-align: left;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border-light);
}

.clients-table th:nth-child(1) { width: 18%; }
.clients-table th:nth-child(2) { width: 12%; }
.clients-table th:nth-child(3) { width: 11%; }
.clients-table th:nth-child(4) { width: 15%; }
.clients-table th:nth-child(5) { width: 11%; }
.clients-table th:nth-child(6) { width: 11%; }
.clients-table th:nth-child(7) { width: 8%; }
.clients-table th:nth-child(8) { width: 14%; }

.client-row {
    transition: background 0.18s ease;
}

.client-row:hover {
    background: #f8fafc;
}

.client-row + .client-row {
    border-top: 1px solid var(--border-light);
}

.client-cell {
    padding: 10px 14px;
    color: var(--text-secondary);
    font-size: 0.78rem;
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.client-person-cell {
    white-space: normal;
}

.client-identity {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

#clientes .client-avatar,
#transportadoras .client-avatar {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: var(--accent-soft);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 850;
    flex-shrink: 0;
}

#clientes .client-avatar.client-avatar-sm,
#transportadoras .client-avatar.client-avatar-sm {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    font-size: 0.78rem;
}

.client-name-stack {
    min-width: 0;
}

.client-name-link {
    display: block;
    max-width: 100%;
    border: 0;
    background: transparent;
    color: var(--primary);
    cursor: pointer;
    font: inherit;
    font-size: 0.84rem;
    font-weight: 850;
    padding: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
}

.client-name-link:hover,
.client-details-link:hover {
    color: var(--accent);
}

.client-details-link {
    border: 0;
    background: transparent;
    color: var(--accent);
    cursor: pointer;
    font-size: 0.7rem;
    font-weight: 750;
    padding: 2px 0 0;
}

.client-document {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 5px;
    color: var(--text-secondary);
    font-size: 0.82rem;
}

.client-kind {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    border-radius: 999px;
    padding: 5px 10px;
    background: var(--bg-gray);
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
    font-size: 0.72rem;
    font-weight: 800;
    white-space: nowrap;
}

.compact-kind {
    padding: 4px 8px;
    font-size: 0.66rem;
}

.client-actions-cell {
    overflow: visible;
}

.client-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: flex-end;
}

.compact-actions .btn {
    min-height: 32px;
    border-radius: 9px;
    padding: 7px 9px;
    font-size: 0.72rem;
}

.client-action-budget {
    width: 32px;
    min-width: 32px;
    height: 32px;
    padding: 0;
    flex: 0 0 auto;
}

.client-icon-action {
    width: 32px;
    min-width: 32px;
    height: 32px;
    padding: 0;
}

.client-details-modal {
    max-width: 760px;
}

.client-detail-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 0 18px;
    border-bottom: 1px solid var(--border-light);
}

.client-detail-head .client-avatar {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    font-size: 1rem;
    margin-bottom: 0;
}

.client-detail-head h4 {
    margin: 0 0 4px;
    color: var(--primary);
    font-size: 1rem;
}

.client-detail-head span {
    color: var(--text-tertiary);
    font-size: 0.78rem;
    font-weight: 750;
}

.client-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 16px;
}

.client-detail-item {
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--border-light);
    border-radius: 10px;
    background: var(--bg-gray);
}

.client-detail-item.span-2 {
    grid-column: span 2;
}

.client-detail-item span {
    display: block;
    margin-bottom: 5px;
    color: var(--text-tertiary);
    font-size: 0.68rem;
    font-weight: 850;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.client-detail-item strong {
    display: block;
    color: var(--primary);
    font-size: 0.86rem;
    overflow-wrap: anywhere;
}

.client-detail-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
}

@media (max-width: 768px) {
    #clientes,
    #transportadoras {
        padding-bottom: 86px;
    }

    .clients-hero {
        padding: 18px;
    }

    .clients-hero-action {
        position: fixed;
        right: 18px;
        bottom: calc(100px + env(safe-area-inset-bottom, 0px));
        z-index: 1260;
        width: 52px;
        min-width: 52px;
        height: 52px;
        min-height: 52px;
        overflow: hidden;
        padding: 0;
        border: 0;
        border-radius: 16px;
        color: #fff;
        font-size: 0;
        background: linear-gradient(135deg, #2563eb, #0ea5e9);
        box-shadow: 0 22px 45px -22px rgba(37, 99, 235, .85), 0 1px 0 rgba(255, 255, 255, .34) inset;
        transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
    }

    .clients-hero-action::before {
        content: "";
        position: absolute;
        inset: 0;
        background: linear-gradient(135deg, rgba(255, 255, 255, .26), rgba(255, 255, 255, 0) 58%);
        pointer-events: none;
    }

    .clients-hero-action:active {
        transform: translateY(1px) scale(.96);
        box-shadow: 0 14px 28px -20px rgba(37, 99, 235, .9), 0 1px 0 rgba(255, 255, 255, .24) inset;
        filter: saturate(1.08);
    }

    .clients-hero-action i {
        position: relative;
        z-index: 1;
        margin: 0;
        color: #fff;
        font-size: 1.32rem;
        line-height: 1;
    }

    .clients-toolbar {
        flex-direction: column;
    }

    .clients-toolbar-stats {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .clients-table-shell {
        overflow: hidden;
        border: 1px solid var(--border-light);
        border-radius: 14px;
        background: var(--bg-white);
        box-shadow: var(--shadow-sm);
    }

    .clients-table,
    .clients-table tbody,
    .clients-table tr,
    .clients-table td {
        display: block;
        width: 100%;
    }

    .clients-table thead {
        display: none;
    }

    .client-row {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 3px 10px;
        margin-bottom: 0;
        padding: 12px;
        background: var(--bg-white);
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .client-row + .client-row {
        border-top: 1px solid var(--border-light);
    }

    .client-cell {
        display: flex;
        align-items: center;
        justify-content: flex-start;
        gap: 6px;
        min-width: 0;
        padding: 0;
        white-space: normal;
        border: 0;
        color: var(--text-secondary);
        font-size: 0.78rem;
        overflow-wrap: anywhere;
        width: auto;
        max-width: 100%;
    }

    .client-cell::before {
        content: attr(data-label);
        color: var(--text-tertiary);
        font-size: 0.66rem;
        font-weight: 850;
        letter-spacing: 0.02em;
        text-transform: uppercase;
        flex: 0 0 auto;
    }

    .client-person-cell {
        display: flex;
        grid-column: 1;
        align-items: center;
        padding: 0 0 3px;
        border-bottom: 0;
    }

    .client-person-cell::before,
    .client-actions-cell::before {
        display: none;
    }

    .client-identity.compact {
        gap: 10px;
        min-width: 0;
    }

    #clientes .client-avatar.client-avatar-sm,
    #transportadoras .client-avatar.client-avatar-sm {
        width: 36px;
        height: 36px;
        border-radius: 12px;
        font-size: .76rem;
        margin-bottom: 0;
    }

    .client-name-stack {
        min-width: 0;
    }

    .client-name-link {
        max-width: 100%;
        font-size: .86rem;
        line-height: 1.2;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .client-details-link {
        margin-top: 2px;
        font-size: .68rem;
    }

    .client-cell[data-label="E-mail"],
    .client-cell[data-label="Responsável"],
    .client-cell[data-label="Tipo"] {
        display: none;
    }

    .client-cell[data-label="CPF/CNPJ"],
    .client-cell[data-label="Telefone"],
    .client-cell[data-label="Cidade/UF"] {
        grid-column: 1;
        padding-left: 46px;
    }

    .client-actions-cell {
        grid-column: 2;
        grid-row: 1 / span 4;
        align-self: center;
        padding: 0;
        border-top: 0;
        margin-top: 0;
        width: auto;
    }

    .client-actions {
        width: auto;
        justify-content: flex-end;
        flex-wrap: nowrap;
        gap: 6px;
    }

    .client-action-budget,
    .client-icon-action {
        width: 34px;
        height: 34px;
        min-width: 34px;
        padding: 0;
        border-radius: 10px;
    }

    .client-action-budget {
        flex: 0 0 34px;
    }

    .client-detail-grid {
        grid-template-columns: 1fr;
    }

    .client-detail-item.span-2 {
        grid-column: span 1;
    }

    .client-detail-actions {
        flex-direction: column;
    }
}
