/* IR Call — Design system */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
    --ir-sidebar: #0f172a;
    --ir-sidebar-hover: #1e293b;
    --ir-sidebar-active: #1d4ed8;
    --ir-accent: #2563eb;
    --ir-accent-soft: #dbeafe;
    --ir-bg: #f1f5f9;
    --ir-surface: #ffffff;
    --ir-border: #e2e8f0;
    --ir-text: #0f172a;
    --ir-muted: #64748b;
    --ir-radius: 12px;
    --ir-radius-sm: 8px;
    --ir-shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 4px 16px rgba(15, 23, 42, 0.04);
    --ir-shadow-lg: 0 8px 30px rgba(15, 23, 42, 0.08);
}

* {
    box-sizing: border-box;
}

body.app-body {
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    background: var(--ir-bg);
    color: var(--ir-text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* —— Sidebar —— */
.app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    height: 100vh;
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    z-index: 1040;
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem 1.5rem;
    text-decoration: none;
    color: #fff;
}

.sidebar-brand-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: #fff;
    flex-shrink: 0;
}

.sidebar-brand-text {
    font-weight: 700;
    font-size: 1.05rem;
    line-height: 1.2;
}

.sidebar-brand-sub {
    font-size: 0.7rem;
    font-weight: 500;
    color: #94a3b8;
    display: block;
}

.sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
    flex: 1;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.65rem 0.85rem;
    margin-bottom: 0.2rem;
    border-radius: var(--ir-radius-sm);
    color: #94a3b8;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: background 0.15s, color 0.15s;
}

.sidebar-nav .nav-link i {
    font-size: 1.15rem;
    width: 1.35rem;
    text-align: center;
    opacity: 0.9;
}

.sidebar-nav .nav-link:hover {
    background: var(--ir-sidebar-hover);
    color: #e2e8f0;
}

.sidebar-nav .nav-link.active {
    background: rgba(37, 99, 235, 0.25);
    color: #fff;
    box-shadow: inset 3px 0 0 #3b82f6;
}

.sidebar-footer {
    border-top: 1px solid rgba(148, 163, 184, 0.2);
    padding-top: 1rem;
    margin-top: 0.5rem;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.5rem;
    color: #cbd5e1;
    font-size: 0.85rem;
    text-decoration: none;
    border-radius: var(--ir-radius-sm);
    transition: background 0.15s, color 0.15s;
}

.sidebar-user:hover,
.sidebar-user.active {
    background: rgba(59, 130, 246, 0.15);
    color: #e2e8f0;
}

.sidebar-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #334155;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: #fff;
    font-size: 0.85rem;
}

.sidebar-footer .sidebar-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.65rem 0.85rem;
    border-radius: var(--ir-radius-sm);
    color: #fee2e2;
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.45);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.sidebar-footer .sidebar-logout:hover {
    background: #ef4444;
    color: #fff;
    border-color: #ef4444;
}

/* —— Main content —— */
.app-main {
    margin-left: 260px;
    min-height: 100vh;
    padding: 1.75rem 2rem 2.5rem;
}

@media (max-width: 991.98px) {
    .app-sidebar {
        transform: translateX(-100%);
        transition: transform 0.25s;
    }
    .app-sidebar.show {
        transform: translateX(0);
    }
    .app-main {
        margin-left: 0;
        padding: 1rem;
    }
    .mobile-topbar {
        display: flex !important;
    }
}

.mobile-topbar {
    display: none;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: var(--ir-surface);
    border-radius: var(--ir-radius);
    box-shadow: var(--ir-shadow);
}

/* —— Page header —— */
.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.page-header h1 {
    font-size: 1.65rem;
    font-weight: 700;
    margin: 0 0 0.25rem;
    letter-spacing: -0.02em;
}

.page-header .page-subtitle {
    color: var(--ir-muted);
    font-size: 0.9rem;
    margin: 0;
}

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

/* —— Cards —— */
.card-app {
    background: var(--ir-surface);
    border: 1px solid var(--ir-border);
    border-radius: var(--ir-radius);
    box-shadow: var(--ir-shadow);
    overflow: hidden;
}

.card-app .card-header {
    background: var(--ir-surface);
    border-bottom: 1px solid var(--ir-border);
    padding: 1rem 1.25rem;
    font-weight: 600;
    font-size: 0.95rem;
}

.card-app .card-body {
    padding: 1.25rem;
}

/* Stat cards */
.stat-card {
    background: var(--ir-surface);
    border: 1px solid var(--ir-border);
    border-radius: var(--ir-radius);
    padding: 1.25rem;
    box-shadow: var(--ir-shadow);
    height: 100%;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    transition: transform 0.15s, box-shadow 0.15s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--ir-shadow-lg);
}

.stat-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    flex-shrink: 0;
}

.stat-card-icon.blue { background: #dbeafe; color: #1d4ed8; }
.stat-card-icon.amber { background: #fef3c7; color: #b45309; }
.stat-card-icon.cyan { background: #cffafe; color: #0e7490; }
.stat-card-icon.green { background: #d1fae5; color: #047857; }

.stat-card-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ir-muted);
    margin-bottom: 0.25rem;
}

.stat-card-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

/* Info list in cards */
.info-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.info-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--ir-border);
    font-size: 0.9rem;
}

.info-list li:last-child {
    border-bottom: none;
}

.info-list .info-label {
    color: var(--ir-muted);
    font-weight: 500;
}

/* —— Tables —— */
.table-app {
    margin: 0;
}

.table-app thead th {
    background: #f8fafc;
    border-bottom: 1px solid var(--ir-border);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ir-muted);
    padding: 0.85rem 1rem;
    white-space: nowrap;
}

.table-app tbody td {
    padding: 0.9rem 1rem;
    vertical-align: middle;
    border-color: var(--ir-border);
    font-size: 0.9rem;
}

.table-app tbody tr:hover {
    background: #f8fafc;
}

.table-empty {
    text-align: center;
    padding: 3rem 1rem !important;
    color: var(--ir-muted);
}

.table-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

/* —— Badges status —— */
.badge-status {
    font-weight: 600;
    font-size: 0.72rem;
    padding: 0.35em 0.65em;
    border-radius: 6px;
}

.status-badge-pendente { background: #fef3c7; color: #92400e; }
.status-badge-documentos_recebidos { background: #cffafe; color: #0e7490; }
.status-badge-concluido { background: #d1fae5; color: #047857; }

.badge-canal {
    background: #f1f5f9;
    color: #475569;
    font-weight: 500;
    font-size: 0.75rem;
}

/* —— Forms —— */
.form-app .form-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--ir-text);
}

.form-app .form-control,
.form-app .form-select {
    border-radius: var(--ir-radius-sm);
    border-color: var(--ir-border);
    padding: 0.55rem 0.85rem;
}

.form-app .form-control:focus,
.form-app .form-select:focus {
    border-color: var(--ir-accent);
    box-shadow: 0 0 0 3px var(--ir-accent-soft);
}

.form-app .input-group .form-control {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.form-app .input-group .password-toggle-btn {
    border-color: var(--ir-border);
    border-top-right-radius: var(--ir-radius-sm);
    border-bottom-right-radius: var(--ir-radius-sm);
    color: var(--ir-text-muted);
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

.form-app .input-group .password-toggle-btn:hover,
.form-app .input-group .password-toggle-btn:focus {
    border-color: var(--ir-accent);
    color: var(--ir-accent);
    background: var(--ir-surface);
}

.form-app .input-group .form-control:focus + .password-toggle-btn {
    border-color: var(--ir-accent);
}

.search-bar {
    background: var(--ir-surface);
    border: 1px solid var(--ir-border);
    border-radius: var(--ir-radius);
    padding: 1rem;
    box-shadow: var(--ir-shadow);
    margin-bottom: 1.25rem;
}

.search-bar .input-group-text {
    background: #f8fafc;
    border-color: var(--ir-border);
    color: var(--ir-muted);
}

/* —— Buttons —— */
.btn-primary {
    background: var(--ir-accent);
    border-color: var(--ir-accent);
    font-weight: 600;
    border-radius: var(--ir-radius-sm);
    padding: 0.5rem 1.1rem;
}

.btn-primary:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
}

.btn-soft {
    background: var(--ir-accent-soft);
    color: var(--ir-accent);
    border: none;
    font-weight: 600;
}

.btn-soft:hover {
    background: #bfdbfe;
    color: #1d4ed8;
}

/* —— Alerts —— */
.alert-app {
    border: none;
    border-radius: var(--ir-radius-sm);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.alert-app.alert-success {
    background: #ecfdf5;
    color: #047857;
}

.alert-app.alert-danger {
    background: #fef2f2;
    color: #b91c1c;
}

/* —— SweetAlert2 toasts (flash) —— */
.app-swal-toast {
    font-family: var(--bs-font-sans-serif, system-ui, sans-serif) !important;
    border-radius: var(--ir-radius-sm, 0.5rem) !important;
    box-shadow: 0 10px 40px rgba(15, 23, 42, 0.12) !important;
    padding: 0.85rem 1rem !important;
}

.swal2-container.swal2-top-end {
    top: 1rem;
    padding: 0 1rem;
}

.swal2-popup.app-swal-modal {
    font-family: var(--bs-font-sans-serif, system-ui, sans-serif) !important;
    border-radius: var(--ir-radius, 0.75rem) !important;
    padding: 1.5rem 1.25rem 1.25rem !important;
}

.swal2-popup.app-swal-modal .swal2-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: #0f172a;
}

.swal2-popup.app-swal-modal .swal2-html-container,
.swal2-popup.app-swal-modal .swal2-content {
    font-size: 0.95rem;
    color: #475569;
}

/* —— Progress campanha —— */
.campaign-progress {
    height: 8px;
    border-radius: 99px;
    background: #e2e8f0;
    overflow: hidden;
}

.campaign-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #1d4ed8);
    border-radius: 99px;
    transition: width 0.3s;
}

.milestone-timeline .milestone-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0;
}

.milestone-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #cbd5e1;
    flex-shrink: 0;
}

.milestone-dot.done {
    background: #22c55e;
    box-shadow: 0 0 0 3px #dcfce7;
}

.milestone-dot.pending {
    background: #e2e8f0;
}

/* —— Login —— */
.login-page {
    min-height: 100vh;
    display: flex;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #1d4ed8 100%);
}

.login-brand-panel {
    flex: 1;
    display: none;
    flex-direction: column;
    justify-content: center;
    padding: 3rem;
    color: #fff;
}

@media (min-width: 992px) {
    .login-brand-panel {
        display: flex;
    }
}

.login-brand-panel h2 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.login-brand-panel p {
    color: #94a3b8;
    font-size: 1.05rem;
    max-width: 380px;
    line-height: 1.6;
}

.login-form-panel {
    flex: 1;
    max-width: 480px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: var(--ir-bg);
}

@media (min-width: 992px) {
    .login-form-panel {
        border-radius: 24px 0 0 24px;
        box-shadow: -20px 0 60px rgba(0, 0, 0, 0.15);
    }
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--ir-surface);
    border-radius: var(--ir-radius);
    padding: 2.5rem;
    box-shadow: var(--ir-shadow-lg);
    border: 1px solid var(--ir-border);
}

.login-card h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.login-card .login-sub {
    color: var(--ir-muted);
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

/* —— Code block —— */
.code-block {
    background: #0f172a;
    color: #e2e8f0;
    padding: 0.85rem 1rem;
    border-radius: var(--ir-radius-sm);
    font-size: 0.85rem;
    font-family: ui-monospace, monospace;
}

/* —— Pré-visualização WhatsApp —— */
.wa-preview-tabs .nav-link {
    font-size: 0.75rem;
    border-radius: 8px;
    color: var(--ir-muted);
}

.wa-preview-tabs .nav-link.active {
    background: #25d366;
    color: #fff;
}

.wa-phone {
    max-width: 340px;
    margin: 0 auto;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    border: 1px solid #d1d5db;
}

.wa-phone-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: #075e54;
    color: #fff;
}

.wa-phone-back {
    opacity: 0.9;
    font-size: 1.1rem;
}

.wa-phone-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.wa-phone-title {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.wa-phone-title small {
    font-size: 0.7rem;
    opacity: 0.85;
}

.wa-phone-chat {
    background: #e5ddd5 url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23d4cfc7' fill-opacity='0.4'%3E%3Cpath d='M0 0h30v30H0zM30 30h30v30H30z'/%3E%3C/g%3E%3C/svg%3E");
    padding: 20px 14px 24px;
    min-height: 140px;
}

.wa-bubble {
    position: relative;
    max-width: 92%;
    background: #fff;
    border-radius: 8px 8px 8px 2px;
    padding: 10px 12px 18px;
    font-size: 14px;
    line-height: 1.45;
    color: #111;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.wa-bubble-time {
    position: absolute;
    right: 8px;
    bottom: 4px;
    font-size: 10px;
    color: #667781;
}

.wa-text-plain {
    background: #f8fafc;
    border: 1px solid var(--ir-border);
    border-radius: 8px;
    padding: 12px;
    font-size: 0.8rem;
    white-space: pre-wrap;
    word-break: break-word;
}

/* —— Empty state —— */
.empty-state-icon {
    font-size: 2.5rem;
    color: #cbd5e1;
    margin-bottom: 0.5rem;
}
