﻿/* ══════════════════════════════════════════
           CLIENT PAGE — SPECIFIC STYLES
           ══════════════════════════════════════════ */

/* ── Page Header Bar ── */
.page-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
}

.page-header-bar .page-title-group {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.page-header-bar .page-icon {
    font-size: 2.2rem;
}

.title-text-col {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.page-header-bar h1 {
    font-size: clamp(1.4rem, 3vw, 1.8rem);
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.1;
    margin: 0;
}

.page-header-bar .page-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 400;
    margin-top: 2px;
    margin-left: 0;
    line-height: 1.2;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1.4rem;
    background: linear-gradient(135deg, #3d9be9, #2a7bd4);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #4daaf5, #3d9be9);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(61, 155, 233, 0.35);
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    font-family: var(--font-heading);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn-back:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

/* ── Toolbar (Search + Filters) ── */
.toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.search-box {
    flex: 1;
    min-width: 220px;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 0.7rem 1rem 0.7rem 2.5rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: var(--font-heading);
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.search-box input:focus {
    outline: none;
    border-color: rgba(61, 155, 233, 0.5);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 0 3px rgba(61, 155, 233, 0.1);
}

.search-box .search-icon {
    position: absolute;
    left: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.9rem;
    opacity: 0.5;
}

.filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.65rem 1rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    color: var(--text-secondary);
    font-family: var(--font-heading);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.filter-btn.active {
    background: rgba(61, 155, 233, 0.15);
    border-color: rgba(61, 155, 233, 0.3);
    color: #3d9be9;
}

.clients-count {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 300;
    white-space: nowrap;
}

/* ── Clients Table ── */
.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    overflow: hidden;
    backdrop-filter: blur(20px);
}

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

.clients-table thead {
    background: rgba(255, 255, 255, 0.03);
}

.clients-table th {
    padding: 0.9rem 1.2rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-subtle);
    white-space: nowrap;
}

.clients-table td {
    padding: 0.9rem 1.2rem;
    font-size: 0.9rem;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    vertical-align: middle;
}

.clients-table tbody tr {
    transition: background 0.2s ease;
    cursor: pointer;
}

.clients-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.04);
}

.clients-table tbody tr:last-child td {
    border-bottom: none;
}

.client-name-cell {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.client-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(61, 155, 233, 0.2), rgba(61, 155, 233, 0.1));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: #3d9be9;
    flex-shrink: 0;
}

.client-name {
    font-weight: 500;
}

.client-email {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.status-badge.active {
    background: rgba(13, 178, 107, 0.12);
    color: #0DB26B;
}

.status-badge.inactive {
    background: rgba(255, 149, 0, 0.12);
    color: #ff9500;
}

.processes-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.action-dots {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.3rem;
    border-radius: 6px;
    font-size: 1.2rem;
    transition: all 0.2s;
    line-height: 1;
}

.action-dots:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

/* ── Table Pagination ── */
.table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 1.2rem;
    border-top: 1px solid var(--border-subtle);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.pagination {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.pagination button {
    padding: 0.4rem 0.7rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    color: var(--text-secondary);
    font-family: var(--font-heading);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.pagination button:hover {
    background: rgba(255, 255, 255, 0.08);
}

.pagination button.active {
    background: rgba(61, 155, 233, 0.2);
    border-color: rgba(61, 155, 233, 0.3);
    color: #3d9be9;
}

/* ── Drawer Overlay ── */
.drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
}

.drawer-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ── Drawer Panel ── */
.drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: min(600px, 90vw);
    height: 100vh;
    height: 100dvh;
    background: var(--bg-primary);
    border-left: 1px solid var(--border-subtle);
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.drawer.active {
    transform: translateX(0);
}

.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.drawer-header-content {
    display: flex;
    gap: 0.6rem;
    align-items: flex-start;
    flex: 1;
    /* Allows title area to grow/shrink */
    min-width: 0;
    /* Critical for flexbox truncation */
}

.drawer-header-content>div:last-child {
    display: flex;
    flex-direction: column;
    min-width: 0;
    /* Critical for flexbox truncation */
    overflow: hidden;
}

.drawer-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    /* Truncates long names with ... */
}

.drawer-close {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.2s;
}

.drawer-close:hover {
    background: rgba(255, 80, 80, 0.15);
    border-color: rgba(255, 80, 80, 0.3);
    color: #ff5050;
}

.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.drawer-body::-webkit-scrollbar {
    width: 6px;
}

.drawer-header-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
    /* Prevents actions from shrinking */
}

@media (max-width: 600px) {
    .drawer-header {
        flex-direction: column;
        align-items: flex-start;
        padding-top: 1rem;
        padding-bottom: 1rem;
        gap: 0.8rem;
    }

    .drawer-header-content {
        width: 100%;
        padding-right: 2rem;
        /* Make room for the close button */
    }

    .drawer-header-actions {
        width: 100%;
        justify-content: flex-end;
        flex-wrap: wrap;
        /* Allow buttons to wrap to next line if needed on very small screens */
    }

    .drawer-close {
        position: absolute;
        top: 1rem;
        right: 1.2rem;
    }
}

.drawer-body::-webkit-scrollbar-track {
    background: transparent;
}

.drawer-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

/* ── Form Styles ── */
.form-section {
    margin-bottom: 2rem;
}

.form-section-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-row.single {
    grid-template-columns: 1fr;
}

.form-row.triple {
    grid-template-columns: 1fr 1fr 1fr;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.form-group label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group label .required {
    color: #ff5050;
    margin-left: 2px;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 0.65rem 0.9rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: var(--font-heading);
    font-size: 0.88rem;
    font-variant-numeric: lining-nums tabular-nums;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: rgba(61, 155, 233, 0.5);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 0 3px rgba(61, 155, 233, 0.1);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

.form-group select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23999' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.8rem center;
    padding-right: 2.2rem;
    cursor: pointer;
}

.form-group select option {
    background: #1a1a2e;
    color: var(--text-primary);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* Linhas repetíveis (telefone, e-mail, endereço).
   As de contato usam .contato-row — ver o bloco no fim do arquivo. */
.btn-remove-row {
    padding: 0.65rem;
    background: rgba(255, 80, 80, 0.1);
    border: 1px solid rgba(255, 80, 80, 0.2);
    border-radius: 10px;
    color: #ff5050;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    flex-shrink: 0;
    height: 38px;
    width: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-remove-row:hover {
    background: rgba(255, 80, 80, 0.2);
}

.btn-add-row {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.9rem;
    background: rgba(61, 155, 233, 0.08);
    border: 1px dashed rgba(61, 155, 233, 0.3);
    border-radius: 10px;
    color: #3d9be9;
    font-family: var(--font-heading);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 0.25rem;
}

/* Keep old class working */
.btn-add-phone {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.9rem;
    background: rgba(61, 155, 233, 0.08);
    border: 1px dashed rgba(61, 155, 233, 0.3);
    border-radius: 10px;
    color: #3d9be9;
    font-family: var(--font-heading);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 0.25rem;
}

.btn-add-row:hover,
.btn-add-phone:hover {
    background: rgba(61, 155, 233, 0.15);
}

/* Address block */
.address-block {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    position: relative;
}

.address-block .address-block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.address-block .address-block-header span {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.address-block .form-row {
    margin-bottom: 0.75rem;
}

.address-block .form-row:last-child {
    margin-bottom: 0;
}

/* Status Toggle */
.status-toggle-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.status-toggle {
    position: relative;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
}

.status-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.status-toggle .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 26px;
    transition: all 0.3s ease;
}

.status-toggle .slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    left: 3px;
    bottom: 3px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.status-toggle input:checked+.slider {
    background: rgba(13, 178, 107, 0.3);
}

.status-toggle input:checked+.slider::before {
    transform: translateX(22px);
    background: #0DB26B;
}

.status-toggle-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Export & Drive input */
.btn-export {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1rem;
    background: rgba(255, 149, 0, 0.1);
    border: 1px solid rgba(255, 149, 0, 0.2);
    border-radius: 10px;
    color: #ff9500;
    font-family: var(--font-heading);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
}

.btn-export:hover {
    background: rgba(255, 149, 0, 0.18);
    border-color: rgba(255, 149, 0, 0.35);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 149, 0, 0.15);
}

.drive-input-row {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
}

.drive-input-row .form-group {
    flex: 1;
}

.drive-input-row .btn-drive-open {
    padding: 0.65rem 0.9rem;
    background: rgba(66, 133, 244, 0.1);
    border: 1px solid rgba(66, 133, 244, 0.2);
    border-radius: 10px;
    color: #4285f4;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
    flex-shrink: 0;
    height: 38px;
    display: flex;
    align-items: center;
    text-decoration: none;
}

.drive-input-row .btn-drive-open:hover {
    background: rgba(66, 133, 244, 0.2);
}

/* ── Drawer Tabs ── */
.drawer-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
    padding: 0 1.5rem;
    gap: 0.25rem;
}

.drawer-tab {
    padding: 0.75rem 1.2rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
}

.drawer-tab:hover {
    color: var(--text-secondary);
}

.drawer-tab.active {
    color: #3d9be9;
    border-bottom-color: #3d9be9;
}

.drawer-tab .tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    font-size: 0.7rem;
    font-weight: 600;
}

.drawer-tab.active .tab-count {
    background: rgba(61, 155, 233, 0.15);
    color: #3d9be9;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ── Google Drive Button ── */
.btn-drive {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1rem;
    background: rgba(66, 133, 244, 0.1);
    border: 1px solid rgba(66, 133, 244, 0.2);
    border-radius: 10px;
    color: #4285f4;
    font-family: var(--font-heading);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
    text-decoration: none;
}

.btn-drive:hover {
    background: rgba(66, 133, 244, 0.18);
    border-color: rgba(66, 133, 244, 0.35);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(66, 133, 244, 0.15);
}

.btn-drive-mini {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.3rem;
    border-radius: 6px;
    font-size: 1rem;
    transition: all 0.2s;
    line-height: 1;
    text-decoration: none;
}

.btn-drive-mini:hover {
    color: #4285f4;
    background: rgba(66, 133, 244, 0.1);
}

.drawer-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ── Processes Tab Content ── */
.processes-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.processes-list-header h3 {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.btn-new-process {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #3d9be9, #2a7bd4);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-family: var(--font-heading);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-new-process:hover {
    background: linear-gradient(135deg, #4daaf5, #3d9be9);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(61, 155, 233, 0.3);
}

.process-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 1rem 1.2rem;
    margin-bottom: 0.75rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

.process-card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(61, 155, 233, 0.2);
}

.process-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.process-card-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

.process-status {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: 16px;
    font-size: 0.7rem;
    font-weight: 600;
}

.process-status.em-andamento {
    background: rgba(61, 155, 233, 0.12);
    color: #3d9be9;
}

.process-status.atendimento {
    background: rgba(255, 149, 0, 0.12);
    color: #ff9500;
}

.process-status.encerrado {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
}

.process-card-details {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.process-card-details span {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.process-card-drive {
    margin-top: 0.6rem;
    padding-top: 0.6rem;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.empty-processes {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-processes .empty-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.5;
}

.empty-processes p {
    font-size: 0.9rem;
    margin-bottom: 0.3rem;
}

.empty-processes .empty-hint {
    font-size: 0.8rem;
    opacity: 0.7;
}

/* ── Drawer Footer ── */
.drawer-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.btn-cancel {
    padding: 0.65rem 1.2rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: var(--text-secondary);
    font-family: var(--font-heading);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-cancel:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.btn-save {
    padding: 0.65rem 1.5rem;
    background: linear-gradient(135deg, #0DB26B, #0a9e5e);
    border: none;
    border-radius: 10px;
    color: #fff;
    font-family: var(--font-heading);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-save:hover {
    background: linear-gradient(135deg, #10c878, #0DB26B);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(13, 178, 107, 0.3);
}

/* ── Mobile Cards View ── */
.mobile-cards {
    display: none;
}

.mobile-client-card {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 1rem 1.2rem;
    margin-bottom: 0.9rem;
    box-shadow: var(--glass-shadow);
    transition: background 0.2s, border-color 0.2s;
    cursor: pointer;
}

.mobile-client-card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(61, 155, 233, 0.3);
}

.mobile-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.6rem;
}

.mobile-card-name {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.mobile-card-name .client-avatar {
    width: 32px;
    height: 32px;
    font-size: 0.7rem;
}

.mobile-card-name strong {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

.mobile-card-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
    font-size: 0.8rem;
}

.mobile-card-details span {
    color: var(--text-muted);
}

.mobile-card-details strong {
    color: var(--text-secondary);
    font-weight: 400;
}

/* ── Responsive ── */
@media (max-width: 900px) {
    .table-container {
        display: none;
    }

    .mobile-cards {
        display: block;
    }

    .page-header-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .page-header-bar .btn-primary {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
    }

    .form-row.triple {
        grid-template-columns: 1fr;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar .filter-btn {
        justify-content: center;
    }

    .drawer {
        width: 100vw;
    }
}


/* ══════════════════════════════════════════════════════════════════════════
   TIPO DE PESSOA, MENORIDADE E SELOS
   Espelham a área de Contratos: a ficha do cliente coleta a mesma
   qualificação, então usa os mesmos controles.
   ══════════════════════════════════════════════════════════════════════════ */

.tipo-pessoa-row {
    gap: 0.6rem;
}

.radio-pill {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.55rem 0.9rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-pill);
    cursor: pointer;
    font-size: var(--text-sm);
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    user-select: none;
}

.radio-pill input {
    accent-color: var(--accent-blue);
    margin: 0;
}

.radio-pill:has(input:checked) {
    border-color: var(--accent-blue);
    background: var(--accent-blue-glow);
    color: var(--text-primary);
    font-weight: 600;
}

.menor-ctrl {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.menor-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: var(--text-sm);
    color: var(--text-secondary);
    cursor: pointer;
}

.menor-toggle input {
    accent-color: var(--accent-orange);
}

.menor-sel {
    padding: 0.4rem 0.6rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: var(--text-sm);
}

.campo-info {
    width: 18px;
    height: 18px;
    border-radius: var(--radius-circle);
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: help;
}

.tipo-badge {
    display: inline-block;
    padding: 0.05rem 0.35rem;
    border-radius: var(--radius-sm);
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    vertical-align: middle;
}

.tipo-badge.pf {
    background: rgba(61, 155, 233, 0.15);
    color: var(--accent-blue);
}

.tipo-badge.pj {
    background: rgba(142, 45, 226, 0.18);
    color: #b98cf5;
}


/* ══════════════════════════════════════════════════════════════════════════
   LINHAS DE CONTATO (e-mail / telefone) E ENDEREÇO
   ══════════════════════════════════════════════════════════════════════════ */

.contato-row {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.contato-row .form-group {
    flex: 1;
    min-width: 0;
}

/* Só a primeira linha mostra os rótulos ("Email", "Tipo"). O HTML das linhas é
   sempre igual — esconder aqui evita que remover a primeira linha deixe a lista
   inteira sem cabeçalho. */
.contato-row:not(:first-child) .form-group label {
    display: none;
}

/* A estrela marca qual contato vai para o contrato — sem ela, o sistema escolhia o
   primeiro da lista e não havia como dizer qual era o certo. */
.principal-radio {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 38px;
    width: 38px;
    flex-shrink: 0;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.principal-radio input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.principal-radio span {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1;
}

.principal-radio:has(input:checked) {
    border-color: var(--accent-orange);
    background: rgba(255, 149, 0, 0.12);
}

.principal-radio:has(input:checked) span {
    color: var(--accent-orange);
}

.address-header-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.address-tipo {
    padding: 0.3rem 0.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: var(--text-xs);
}

.address-header-actions .principal-radio,
.address-header-actions .btn-remove-row {
    height: 30px;
    width: 30px;
}

/* Rua ocupa o triplo do número (o grid do .form-row é 1fr 1fr por padrão). */
.form-row.rua-numero {
    grid-template-columns: 3fr 1fr;
}


/* ══════════════════════════════════════════════════════════════════════════
   IMPORTAR DA ÁREA DE CONTRATOS
   ══════════════════════════════════════════════════════════════════════════ */

.page-header-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.btn-import {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1.2rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    color: var(--text-secondary);
    font-family: var(--font-heading);
    font-size: var(--text-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-import:hover {
    background: var(--bg-hover);
    border-color: var(--accent-blue);
    color: var(--text-primary);
}

.import-badge {
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: var(--radius-pill);
    background: var(--accent-orange);
    color: #1a1200;
    font-size: 0.65rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(5, 8, 12, 0.75);
    backdrop-filter: blur(4px);
    z-index: var(--z-modal);
    padding: var(--space-md);
    overflow-y: auto;
}

.modal-overlay.active {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 4vh;
}

.modal-box {
    width: 100%;
    max-width: 520px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--glass-shadow);
    padding: var(--space-lg);
}

.modal-box-wide {
    max-width: 820px;
}

.modal-box h3 {
    font-family: var(--font-heading);
    font-size: var(--text-lg);
    color: var(--text-primary);
    margin: 0 0 0.4rem;
}

.modal-hint {
    font-size: var(--text-sm);
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0 0 var(--space-md);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
    margin-top: var(--space-md);
}

.import-toolbar {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 0.6rem;
}

.import-search {
    flex: 1;
    min-width: 200px;
}

.sit-count {
    display: inline-block;
    margin-left: 0.3rem;
    padding: 0 0.35rem;
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.08);
    font-size: 0.65rem;
}

.import-filtros {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.import-selecao {
    display: flex;
    gap: 1.2rem;
    flex-wrap: wrap;
    padding: 0.5rem 0 0.7rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0.6rem;
}

.check-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: var(--text-sm);
    color: var(--text-secondary);
    cursor: pointer;
}

.check-inline input {
    accent-color: var(--accent-blue);
}

.import-lista {
    max-height: 46vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding-right: 0.2rem;
}

.import-item {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    padding: 0.7rem 0.8rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.import-item:hover {
    background: var(--bg-hover);
}

.import-item.is-checked {
    border-color: var(--accent-blue);
    background: var(--accent-blue-glow);
}

.import-item input[type="checkbox"] {
    margin-top: 0.2rem;
    accent-color: var(--accent-blue);
    flex-shrink: 0;
}

.import-item-body {
    flex: 1;
    min-width: 0;
}

.import-item-top {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    color: var(--text-primary);
    font-size: var(--text-base);
}

.import-item-doc {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.import-item-difs,
.import-item-contratos {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: 0.35rem;
}

.dif-chip {
    padding: 0.1rem 0.4rem;
    border-radius: var(--radius-sm);
    background: rgba(255, 149, 0, 0.12);
    border: 1px solid rgba(255, 149, 0, 0.25);
    color: var(--text-secondary);
    font-size: var(--text-xs);
}

.contrato-chip {
    padding: 0.1rem 0.4rem;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    font-size: var(--text-xs);
}

.sit-badge {
    padding: 0.05rem 0.4rem;
    border-radius: var(--radius-sm);
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.sit-novo {
    background: rgba(13, 178, 107, 0.15);
    color: var(--accent-green);
}

.sit-atualizavel {
    background: rgba(255, 149, 0, 0.15);
    color: var(--accent-orange);
}

.sit-igual {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
}


/* ── Responsivo dos blocos novos (auditado a 390px) ── */
@media (max-width: 600px) {
    .page-header-actions {
        width: 100%;
    }

    .page-header-actions .btn-import,
    .page-header-actions .btn-primary {
        flex: 1;
        justify-content: center;
    }

    .contato-row {
        flex-wrap: wrap;
    }

    .contato-row .form-group {
        flex: 1 1 100%;
    }

    .form-row.rua-numero {
        grid-template-columns: 1fr;
    }

    .modal-overlay.active {
        padding: var(--space-sm);
        padding-top: 2vh;
    }

    .modal-box {
        padding: var(--space-md);
    }

    .import-lista {
        max-height: 55vh;
    }

    .import-filtros {
        width: 100%;
    }

    .import-filtros .filter-btn {
        flex: 1;
        justify-content: center;
    }
}