/* ============================================================
   OUTBOUND AI — Design System
   Fondo: #F2F2F2 | Texto: #121124 | Accent: #2D6AE0
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&display=swap');

:root {
    --bg-page: #F2F2F2;
    --bg-surface: #FFFFFF;
    --bg-sidebar: #121124;
    --text-primary: #121124;
    --text-secondary: #6E6E80;
    --text-muted: #9E9EAD;
    --text-white: #FFFFFF;
    --accent: #2D6AE0;
    --accent-hover: #2358BE;
    --accent-light: #EBF1FD;
    --border: #E5E5E5;
    --border-light: #F0F0F0;
    --success: #16A34A;
    --success-bg: #DEF7EC;
    --success-text: #065F46;
    --warning: #F59E0B;
    --warning-bg: #FEF3C7;
    --warning-text: #92400E;
    --danger: #DC2626;
    --danger-bg: #FEE2E2;
    --danger-text: #991B1B;
    --info-bg: #DBEAFE;
    --info-text: #1E40AF;
    --indigo-bg: #E0E7FF;
    --indigo-text: #3730A3;
    --gray-bg: #F3F4F6;
    --gray-text: #4B5563;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --sidebar-width: 240px;
    --topbar-height: 64px;
    --font: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --transition: 0.15s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 14px; }
body {
    font-family: var(--font);
    background: var(--bg-page);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ── LAYOUT ── */
.app-layout {
    display: flex;
    min-height: 100vh;
}
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    color: var(--text-white);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 50;
    transition: transform 0.25s ease;
}
.main-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.topbar {
    height: var(--topbar-height);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 40;
}
.main-content {
    flex: 1;
    padding: 28px;
}

/* ── SIDEBAR ── */
.sidebar-logo {
    padding: 24px 20px 28px;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
}
.sidebar-logo span {
    background: var(--accent);
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}
.sidebar-nav { flex: 1; padding: 0 12px; }
.nav-section-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: rgba(255,255,255,0.3);
    padding: 20px 12px 8px;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    color: rgba(255,255,255,0.55);
    text-decoration: none;
    font-size: 13px;
    font-weight: 400;
    margin-bottom: 2px;
    transition: all var(--transition);
    cursor: pointer;
}
.nav-item:hover {
    background: rgba(255,255,255,0.07);
    color: rgba(255,255,255,0.85);
}
.nav-item.active {
    background: rgba(255,255,255,0.12);
    color: #fff;
    font-weight: 500;
}
.nav-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.7;
}
.nav-item.active svg { opacity: 1; }

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
    margin: 0 12px;
}
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: var(--radius-md);
}
.sidebar-user .avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    flex-shrink: 0;
}
.sidebar-user .user-info { overflow: hidden; }
.sidebar-user .user-name {
    font-size: 13px;
    color: #fff;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-user .user-role {
    font-size: 11px;
    color: rgba(255,255,255,0.4);
}

/* ── TOPBAR ── */
.topbar-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}
.topbar-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
}

/* ── CARDS ── */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}
.card-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ── STAT CARDS ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
}
.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 400;
    margin-bottom: 6px;
}
.stat-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    line-height: 1.1;
}
.stat-value.success { color: var(--success); }
.stat-value.accent { color: var(--accent); }
.stat-value.warning { color: var(--warning); }
.stat-value.danger { color: var(--danger); }
.stat-change {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ── BADGES ── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}
.badge-green  { background: var(--success-bg);  color: var(--success-text); }
.badge-red    { background: var(--danger-bg);   color: var(--danger-text); }
.badge-amber  { background: var(--warning-bg);  color: var(--warning-text); }
.badge-blue   { background: var(--info-bg);     color: var(--info-text); }
.badge-indigo { background: var(--indigo-bg);   color: var(--indigo-text); }
.badge-gray   { background: var(--gray-bg);     color: var(--gray-text); }
.badge-dark   { background: var(--bg-sidebar);  color: var(--text-white); }
.badge-accent { background: var(--accent-light); color: var(--accent); }

/* ── ROLE TAGS ── */
.role-admin {
    background: var(--bg-sidebar);
    color: var(--text-white);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}
.role-ejecutor {
    background: var(--accent);
    color: var(--text-white);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

/* ── BUTTONS ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    font-family: var(--font);
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
    line-height: 1;
}
.btn:active { transform: scale(0.97); }
.btn svg { width: 16px; height: 16px; }

.btn-primary {
    background: var(--bg-sidebar);
    color: var(--text-white);
}
.btn-primary:hover { background: #1e1e38; }

.btn-accent {
    background: var(--accent);
    color: var(--text-white);
}
.btn-accent:hover { background: var(--accent-hover); }

.btn-outline {
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border);
}
.btn-outline:hover { background: var(--bg-page); }

.btn-danger {
    background: var(--danger-bg);
    color: var(--danger-text);
}
.btn-danger:hover { background: #fdd; }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 14px; }

/* ── TABLES ── */
.table-wrapper {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.data-table th {
    text-align: left;
    padding: 12px 16px;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 12px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-surface);
    white-space: nowrap;
}
.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
    vertical-align: middle;
}
.data-table tbody tr:hover { background: #FAFAFA; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table .td-bold { font-weight: 500; }
.data-table .td-muted { color: var(--text-secondary); }
.data-table .td-right { text-align: right; }
.data-table .td-center { text-align: center; }

/* ── FORMS ── */
.form-group { margin-bottom: 16px; }
.form-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 9px 12px;
    font-size: 13px;
    font-family: var(--font);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    color: var(--text-primary);
    transition: border-color var(--transition);
    outline: none;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(45,106,224,0.1);
}
.form-textarea { resize: vertical; min-height: 100px; }
.form-input::placeholder,
.form-textarea::placeholder { color: var(--text-muted); }
.form-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ── LOGIN PAGE ── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-page);
    padding: 20px;
}
.login-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 400px;
}
.login-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    margin-bottom: 8px;
}
.login-logo span {
    background: var(--bg-sidebar);
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-logo span svg { width: 20px; height: 20px; }
.login-subtitle {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 28px;
}
.login-error {
    background: var(--danger-bg);
    color: var(--danger-text);
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 12px;
    margin-bottom: 16px;
}
.login-btn {
    width: 100%;
    padding: 11px;
    font-size: 14px;
    margin-top: 8px;
}

/* ── EMPTY STATE ── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}
.empty-state svg { width: 48px; height: 48px; margin-bottom: 16px; opacity: 0.3; }
.empty-state p { font-size: 14px; margin-bottom: 16px; }

/* ── TOAST / ALERTS ── */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    z-index: 999;
    animation: toastIn 0.3s ease;
    max-width: 360px;
}
.toast-success { background: var(--success-bg); color: var(--success-text); border: 1px solid #BBF7D0; }
.toast-error   { background: var(--danger-bg);  color: var(--danger-text);  border: 1px solid #FECACA; }
.toast-info    { background: var(--info-bg);    color: var(--info-text);    border: 1px solid #93C5FD; }

@keyframes toastIn {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── UTILITIES ── */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.text-muted { color: var(--text-secondary); }
.text-sm { font-size: 12px; }
.font-medium { font-weight: 500; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

/* ── RESPONSIVE ── */
.mobile-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
}
.mobile-toggle svg { width: 22px; height: 22px; }
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 45;
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay.open { display: block; }
    .main-wrapper { margin-left: 0; }
    .mobile-toggle { display: block; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .grid-2 { grid-template-columns: 1fr; }
    .main-content { padding: 16px; }
    .topbar { padding: 0 16px; }
    .hide-mobile { display: none !important; }
}

/* ── TOGGLE SWITCH (fixed) ── */
.toggle {
    position: relative;
    width: 44px;
    height: 24px;
    cursor: pointer;
    display: inline-block;
    flex-shrink: 0;
}
.toggle input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    z-index: 2;
    margin: 0;
}
.toggle .track {
    position: absolute;
    inset: 0;
    background: var(--border);
    border-radius: 12px;
    transition: background 0.2s;
}
.toggle input:checked + .track {
    background: var(--accent);
}
.toggle .thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    transition: left 0.2s;
    pointer-events: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.toggle input:checked ~ .thumb {
    left: 23px;
}

/* ── CONFIG INTEGRATION CARDS ── */
.config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}
.config-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
}
.config-card:hover {
    border-color: var(--accent);
    background: #FAFAFE;
}
.config-card.configured {
    border-color: var(--success);
}
.config-card .cc-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    margin-bottom: 12px;
}
.config-card .cc-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}
.config-card .cc-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}
.config-card .cc-status {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border);
}
.config-card.configured .cc-status {
    background: var(--success);
}

/* ── MODAL OVERLAY (config popups) ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-overlay.hidden { display: none; }
.modal-box {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 560px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 28px;
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.modal-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
}
.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
}
.modal-close:hover { background: var(--bg-page); }

