:root {

    --primary: #071d49;
    --primary-light: #0d2f73;
    --primary-soft: #dfe8ff;
    --primary-dark: #04122d;

    --secondary: #ffffff;

    --bg: #eef2f9;

    --card: #ffffff;

    --border: #cfd9ea;

    --text: #071d49;

    --muted: #52627f;

    --success: #12b76a;

    --warning: #f79009;

    --danger: #f04438;

    --shadow:
        0 12px 34px rgba(7, 29, 73, 0.10);

    --shadow-strong:
        0 24px 50px rgba(7, 29, 73, 0.18);

    --radius: 18px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Inter, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}

.app-shell {
    min-height: 100vh;
}

.app-header {

    background:
        linear-gradient(
            135deg,
            #04122d 0%,
            #071d49 55%,
            #0d2f73 100%
        );

    color: white;

    border-radius: 0 0 26px 26px;

    padding: 22px 36px;

    display: flex;

    align-items: center;

    justify-content: space-between;

    box-shadow:
        0 12px 34px rgba(4, 18, 45, 0.35);
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-icon {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    background:
        linear-gradient(
            135deg,
            #2f67c7,
            #76a7ff
        );
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    font-weight: 700;
    box-shadow: 0 8px 18px rgba(47, 103, 199, 0.35);
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1;
}

.brand-text strong {
    color: white;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.brand-text span {
    color: #76a7ff;
    font-size: 15px;
    font-weight: 600;
    margin-top: 6px;
    display: block;
}

.logo-link-button {
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 14px;
    padding: 10px 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.client-logo {
    max-width: 150px;
    max-height: 42px;
    object-fit: contain;
    display: block;
}

/* PAGE */
.main-content {
    max-width: 1280px;
    margin: 0 auto;
    padding: 28px;
}

.page-title {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
}

.page-title h1 {
    margin: 0;
    font-size: 30px;
    color: var(--text);
}

.page-title p {
    margin: 6px 0 0;
    color: var(--muted);
}

.info-banner,
.info-box,
.warning-box {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    border-radius: 14px;
    padding: 14px 16px;
}

.info-banner,
.info-box {

    background:
        linear-gradient(
            135deg,
            #e5eeff,
            #f3f7ff
        );

    color: #071d49;
}

.warning-box {
    background: #fff4df;
    color: #a15c00;
    margin-top: 16px;
}

/* CARDS */
.flow-card,
.interactions-card,
.logs-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border-bottom: 1px solid var(--border);
}

.step {
    padding: 18px 24px;
    display: flex;
    gap: 12px;
    align-items: center;
    color: var(--muted);
}

.step span {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    border: 1px solid #cfd4dc;
    font-weight: 700;
    background: white;
}

.step.active {
    color: var(--primary);
    border-bottom: 2px solid var(--primary-light);
}

.step.active span {

    background:
        linear-gradient(
            135deg,
            #04122d,
            #0d2f73
        );

    color: white;

    box-shadow:
        0 8px 18px rgba(4, 18, 45, 0.32);
}

.step.completed {
    color: var(--success);
}

.step.completed span {
    background: var(--success);
    color: #fff;
    border-color: var(--success);
}

.step small {
    display: block;
    margin-top: 2px;
}

/* ORIGIN */
.origin-grid {
    padding: 28px;
    display: grid;
    grid-template-columns: 1fr 1fr 320px;
    gap: 28px;
    align-items: start;
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.field-group label,
.modal-section label,
label {
    font-size: 14px;
    font-weight: 600;
    color: #344054;
}

input,
select {

    width: 100%;

    height: 54px;

    border: 1px solid #c7d2e5;

    border-radius: 14px;

    padding: 0 16px;

    background: #ffffff;

    color: #071d49;

    outline: none;

    font-size: 14px;

    transition: 0.2s ease;
}

input:focus,
select:focus {

    border-color: #0d2f73;

    box-shadow:
        0 0 0 4px rgba(13, 47, 115, 0.12);
}

.hidden-select {
    display: none;
}

/* AUTOCOMPLETE */
.autocomplete-field {
    position: relative;
}

.autocomplete-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-strong);
    max-height: 260px;
    overflow-y: auto;
    z-index: 50;
}

.autocomplete-option {
    padding: 13px 15px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text);
    transition: 0.15s ease;
}

.autocomplete-option:hover {
    background: var(--primary-soft);
    color: var(--primary);
}

.autocomplete-empty {
    padding: 13px 15px;
    color: var(--muted);
    font-size: 14px;
}

.selected-agent-card {

    min-height: 92px;

    background:
        linear-gradient(
            135deg,
            #edf3ff,
            #f8fbff
        );

    border: 1px solid #c9d7f0;

    border-radius: 18px;

    padding: 18px;

    display: flex;

    gap: 14px;

    align-items: center;
}

.avatar-icon {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    border: 2px solid var(--primary-light);
    color: var(--primary-light);
    background: white;
}

.selected-agent-card small {
    display: block;
    color: var(--muted);
    margin-bottom: 4px;
}

.selected-agent-card strong {
    color: var(--primary-dark);
}

.status-pill {
    display: inline-block;
    margin-left: 8px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.status-online {
    background: #eaf3ff;
    color: var(--primary-light);
}

.status-interacting {
    background: #eff8ff;
    color: #1570ef;
}

.status-offline {
    background: #f2f4f7;
    color: var(--muted);
}

.status-unknown {
    background: #fff7ed;
    color: var(--warning);
}

/* INTERACTIONS */
.interactions-card {
    padding: 22px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
}

.section-header h2 {
    margin: 0;
    font-size: 20px;
    color: var(--text);
}

.section-header p {
    margin: 4px 0 0;
    color: var(--muted);
}

#interactionCountBadge {
    background: var(--primary-soft);
    color: var(--primary);
    border-radius: 999px;
    padding: 4px 8px;
    font-size: 12px;
}

.selection-actions {
    display: flex;
    align-items: center;
    gap: 18px;
    color: var(--muted);
    font-size: 14px;
}

.select-all-label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.select-all-label input {
    width: 16px;
    height: 16px;
}

.table-wrapper {
    overflow-x: auto;
}

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

.interactions-table th,
.interactions-table td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    font-size: 14px;
}

.interactions-table th {
    color: var(--muted);
    font-weight: 600;
}

.interactions-table input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

/* BUTTONS */
.bottom-actions,
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 14px;
    margin-top: 20px;
}

.primary-button,
.secondary-button {
    height: 46px;
    border-radius: 14px;
    padding: 0 22px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s ease;
}

.primary-button {

    background:
        linear-gradient(
            135deg,
            #04122d,
            #0d2f73
        );

    color: white;

    border: none;

    border-radius: 14px;

    padding: 0 24px;

    font-weight: 700;

    cursor: pointer;

    transition: 0.2s ease;

    box-shadow:
        0 10px 22px rgba(4, 18, 45, 0.28);
}

.primary-button:hover {

    transform: translateY(-2px);

    background:
        linear-gradient(
            135deg,
            #071d49,
            #1445a1
        );

    box-shadow:
        0 14px 28px rgba(4, 18, 45, 0.34);
}

.primary-button:disabled {
    background: #d0d5dd;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.secondary-button {
    border: 1px solid var(--border);
    background: #fff;
    color: #344054;
}

.secondary-button:hover {
    border-color: var(--primary-light);
    color: var(--primary);
}

/* MODAL */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(16, 24, 40, 0.58);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 9999;
}

.transfer-modal {
    width: 100%;
    max-width: 520px;
    background: #fff;
    border-radius: 20px;
    padding: 24px;
    box-shadow: var(--shadow-strong);
    position: relative;
}

.modal-close {
    position: absolute;
    right: 18px;
    top: 18px;
    border: none;
    background: transparent;
    font-size: 24px;
    color: var(--muted);
    cursor: pointer;
}

.modal-title span {
    display: inline-block;
    background: var(--primary-soft);
    color: var(--primary);
    border-radius: 999px;
    padding: 4px 10px;
    font-weight: 700;
    font-size: 12px;
}

.modal-title h2 {
    margin: 12px 0 4px;
    color: var(--text);
}

.modal-title p {
    margin: 0;
    color: var(--muted);
}

.modal-section {
    margin-top: 18px;
}

.destination-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 8px;
}

.toggle-option {
    border: 1px solid var(--border);
    border-radius: 14px;
    height: 46px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: 0.2s ease;
}

.toggle-option input {
    display: none;
}

.toggle-option.active {
    border-color: var(--primary-light);
    color: var(--primary);
    background: var(--primary-soft);
}

.transfer-summary {
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
    margin-top: 18px;
}

.transfer-summary h3 {
    margin: 0 0 12px;
    font-size: 15px;
    color: var(--text);
}

.transfer-summary div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 7px 0;
    color: var(--muted);
    font-size: 14px;
}

.transfer-summary strong {
    color: var(--text);
    text-align: right;
}

/* ALERT */
.app-alert-overlay {
    position: fixed;
    inset: 0;
    background: rgba(16, 24, 40, 0.55);
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.app-alert-modal {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 20px;
    padding: 28px;
    text-align: center;
    box-shadow: var(--shadow-strong);
    border: 1px solid var(--border);
}

.app-alert-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 16px;
    border-radius: 16px;
    background: var(--primary-soft);
    color: var(--primary);
    display: grid;
    place-items: center;
    font-size: 24px;
    font-weight: 800;
}

.app-alert-modal h2 {
    margin: 0 0 8px;
    color: var(--text);
}

.app-alert-modal p {
    color: var(--muted);
    margin: 0 0 24px;
    line-height: 1.5;
}

/* LEGACY/HIDDEN */
#loading,
#error,
#userInfo {
    max-width: 1280px;
    margin: 12px auto;
}

/* RESPONSIVO */
@media (max-width: 900px) {
    .page-title {
        flex-direction: column;
    }

    .steps {
        grid-template-columns: 1fr;
    }

    .origin-grid {
        grid-template-columns: 1fr;
    }

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

    .bottom-actions,
    .modal-actions {
        flex-direction: column-reverse;
    }

    .primary-button,
    .secondary-button {
        width: 100%;
    }
}

@media (max-width: 560px) {
    .app-header {
        height: auto;
        padding: 16px;
    }

    .brand-text strong {
        font-size: 20px;
    }

    .brand-text span {
        font-size: 13px;
    }

    .brand-icon {
        width: 46px;
        height: 46px;
        font-size: 22px;
    }

    .logo-link-button {
        display: none;
    }

    .main-content {
        padding: 16px;
    }

    .transfer-modal {
        max-height: 92vh;
        overflow-y: auto;
    }

    .destination-toggle {
        grid-template-columns: 1fr;
    }

    .interactions-table th,
    .interactions-table td {
        font-size: 12px;
        padding: 10px;
    }
}

.brand-icon {
    background:
        linear-gradient(
            135deg,
            #04122d,
            #0d2f73
        );
    box-shadow: 0 8px 18px rgba(4, 18, 45, 0.35);
}

.brand-text span {
    color: #9ebeff;
}

.toggle-option.active {
    border-color: #071d49;
    color: #071d49;
    background: #e5eeff;
}

#interactionCountBadge,
.modal-title span,
.app-alert-icon {
    background: #e5eeff;
    color: #071d49;
}

.autocomplete-option:hover {
    background: #e5eeff;
    color: #071d49;
}

/* espaçamento do campo agente */
.field-group + .field-group {
    margin-top: 18px;
}

/* card do logo branco */
.logo-link-button {

    background: white !important;

    border: 1px solid #d7e1f0;

    padding: 12px 20px;

    border-radius: 16px;

    box-shadow:
        0 8px 22px rgba(7, 29, 73, 0.08);
}

/* logo maior e mais destacado */
.client-logo {

    max-width: 165px;

    max-height: 46px;

    object-fit: contain;

    display: block;
}

.transfer-modal {
    max-height: 88vh;
    overflow-y: auto;
}

.modal-overlay {
    align-items: center;
}

@media (max-height: 720px) {
    .transfer-modal {
        max-height: 82vh;
    }
}

@media (max-width: 560px) {
    .transfer-modal {
        max-height: 90vh;
        width: 96%;
    }
}