:root {
    --bg-main: #0f172a;
    --bg-sidebar: #1e293b;
    --bg-chat: #0b1120;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
    --msg-user: #1e293b;
    --msg-ai: #3b82f6;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 350px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.chat-list {
    flex: 1;
    overflow-y: auto;
}

.chat-item {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.2s;
}

.chat-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.chat-item.active {
    background-color: rgba(59, 130, 246, 0.1);
    border-left: 4px solid var(--primary);
}

/* Main Chat Area */
.main-chat {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-chat);
}

.chat-header {
    padding: 20px;
    background-color: var(--bg-sidebar);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
}

.status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #22c55e;
    margin-left: 10px;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.5;
}

.message.user {
    align-self: flex-start;
    background-color: var(--msg-user);
    border-bottom-left-radius: 4px;
}

.message.ai {
    align-self: flex-end;
    background-color: var(--msg-ai);
    border-bottom-right-radius: 4px;
}

.msg-time {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 5px;
    text-align: right;
}

/* Input Area */
.chat-input-area {
    padding: 20px;
    background-color: var(--bg-sidebar);
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
}

.chat-input-area input {
    flex: 1;
    background-color: var(--bg-main);
    border: 1px solid var(--border);
    color: white;
    padding: 12px 20px;
    border-radius: 24px;
    outline: none;
    font-family: inherit;
}

.chat-input-area input:focus {
    border-color: var(--primary);
}

.chat-input-area button {
    background-color: var(--primary);
    color: white;
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.chat-input-area button:hover {
    background-color: var(--primary-hover);
}

.chat-input-area button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chat-input-area .chat-tool-btn {
    background-color: transparent;
    color: var(--text-muted);
    font-size: 1.5rem;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
    border-radius: 50%;
}

.chat-input-area .chat-tool-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

emoji-picker {
    --background: var(--bg-sidebar);
    --border-color: var(--border);
    --text-color: var(--text-main);
    --category-font-color: var(--text-muted);
    --button-hover-background: rgba(255,255,255,0.1);
}

.welcome-message {
    text-align: center;
    margin: auto;
    color: var(--text-muted);
}

/* Sidebar Nav */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-top: 15px;
}

.nav-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    text-align: left;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-family: inherit;
    transition: all 0.2s;
}

.nav-btn:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.nav-btn.active {
    background-color: rgba(59, 130, 246, 0.15);
    color: var(--primary);
    font-weight: 600;
}

/* Main Content & Views */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-chat);
    position: relative;
    min-width: 0;
    min-height: 0;
}

.view {
    display: none;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    min-height: 0;
}

.view.active-view {
    display: flex;
}

/* Config Container */
.config-container {
    padding: 40px;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
    overflow-y: auto;
}

.config-group {
    margin-bottom: 25px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.config-group label {
    font-weight: 600;
    color: var(--text-main);
}

.config-group input,
.config-group textarea {
    background-color: var(--bg-main);
    border: 1px solid var(--border);
    color: white;
    padding: 15px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    resize: vertical;
}

.config-group input:focus,
.config-group textarea:focus {
    border-color: var(--primary);
}

.config-group small {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    transition: background 0.2s;
    font-family: inherit;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.alert {
    padding: 15px;
    border-radius: 8px;
    margin-top: 20px;
    font-weight: 500;
}

.alert.hidden {
    display: none;
}

.alert.success {
    background-color: rgba(34, 197, 94, 0.2);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.alert.error {
    background-color: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* ===== GEM TABS ===== */
.gem-tabs {
    display: flex;
    gap: 4px;
    padding: 16px 24px 0;
    border-bottom: 1px solid var(--border);
    background: var(--bg-sidebar);
    flex-shrink: 0;
}

.gem-tab {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 10px 18px;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    font-size: 0.875rem;
    font-family: inherit;
    font-weight: 500;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.gem-tab:hover {
    color: var(--text-main);
    background-color: rgba(255,255,255,0.05);
}

.gem-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

.gem-content {
    flex: 1;
    overflow-y: auto;
}

.gem-panel {
    padding: 32px 40px;
    max-width: 820px;
    margin: 0 auto;
    width: 100%;
}

.gem-panel.active-panel {
    display: block;
}

/* Input Row */
.input-row {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.input-row input {
    flex: 1;
    background-color: var(--bg-main);
    border: 1px solid var(--border);
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
}

.input-row input:focus {
    border-color: var(--primary);
}

.loading-inline {
    font-size: 0.85rem;
    color: var(--text-muted);
    padding: 8px 0;
    animation: pulse 1.5s infinite;
}

.loading-inline.hidden { display: none; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ===== DROPZONE ===== */
.dropzone {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: rgba(255,255,255,0.02);
}

.dropzone:hover, .dropzone.drag-over {
    border-color: var(--primary);
    background: rgba(59, 130, 246, 0.05);
}

.dropzone-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 12px;
}

.dropzone-inner p {
    color: var(--text-muted);
    margin: 0 0 6px;
}

.drop-link {
    color: var(--primary);
    text-decoration: underline;
    cursor: pointer;
}

/* ===== PROGRESS BAR ===== */
.upload-progress {
    margin-top: 12px;
}

.upload-progress.hidden { display: none; }

.progress-bar {
    height: 6px;
    background: var(--border);
    border-radius: 99px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 99px;
    width: 0%;
    transition: width 0.3s;
}

#progressLabel {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 6px;
}

/* ===== KNOWLEDGE LIST ===== */
.knowledge-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 60px;
}

.knowledge-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px;
    transition: border-color 0.2s;
}

.knowledge-item:hover {
    border-color: rgba(59, 130, 246, 0.4);
}

.knowledge-icon {
    font-size: 1.4rem;
    flex-shrink: 0;
}

.knowledge-info {
    flex: 1;
    min-width: 0;
}

.knowledge-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.knowledge-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.knowledge-delete {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 1rem;
    transition: all 0.2s;
    flex-shrink: 0;
}

.knowledge-delete:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

.knowledge-empty {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 20px;
}

code {
    background: rgba(255,255,255,0.08);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85em;
}

/* ═══════════════════════════════════════════
   CRM KANBAN STYLES
═══════════════════════════════════════════ */

.crm-header { justify-content: space-between; }
.crm-header-stats { display: flex; gap: 16px; font-size: 0.8rem; color: var(--text-muted); }
.crm-header-stats span { background: rgba(255,255,255,0.06); padding: 4px 10px; border-radius: 20px; }

/* Kanban Board */
.kanban-wrapper {
    flex: 1;
    overflow: auto;
    padding: 20px;
    display: flex;
    min-width: 0;
    min-height: 0;
}

.kanban-board {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    min-height: 100%;
    padding-bottom: 20px;
}

.kanban-loading {
    color: var(--text-muted);
    padding: 40px;
    font-size: 0.9rem;
}

/* Kanban Column */
.kanban-col {
    width: 260px;
    flex-shrink: 0;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 160px);
}

.kanban-col-header {
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.kanban-col-title {
    font-weight: 600;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.kanban-col-count {
    background: rgba(255,255,255,0.1);
    color: var(--text-muted);
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 99px;
    font-weight: 600;
}

.kanban-col-body {
    padding: 10px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 80px;
}

/* Drag placeholder */
.sortable-ghost {
    opacity: 0.3;
    border: 2px dashed var(--primary);
    background: rgba(59,130,246,0.05) !important;
}

.sortable-drag {
    opacity: 0.95;
    transform: rotate(2deg);
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}

/* Kanban Card */
.kanban-card {
    background: var(--bg-sidebar);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    cursor: grab;
    transition: border-color 0.2s, transform 0.15s, box-shadow 0.15s;
    position: relative;
}

.kanban-card:hover {
    border-color: rgba(59,130,246,0.5);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.kanban-card:active { cursor: grabbing; }

.kanban-card-top {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.kanban-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    color: white; font-weight: bold; font-size: 0.9rem;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

.kanban-card-name { font-weight: 600; font-size: 0.85rem; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kanban-card-phone { font-size: 0.75rem; color: var(--text-muted); }

.kanban-assignee {
    font-size: 0.72rem;
    color: #94a3b8;
    background: rgba(255,255,255,0.05);
    padding: 3px 6px;
    border-radius: 4px;
    margin-bottom: 8px;
    display: inline-block;
}
.kanban-assignee.unassigned { color: #f59e0b; background: rgba(245, 158, 11, 0.1); }

.kanban-card-preview {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 8px;
}

.kanban-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.kanban-tags {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    flex: 1;
}

.kanban-tag {
    font-size: 0.68rem;
    padding: 2px 7px;
    border-radius: 99px;
    background: rgba(59,130,246,0.15);
    color: #93c5fd;
    white-space: nowrap;
}

.kanban-deal {
    font-size: 0.75rem;
    font-weight: 700;
    color: #4ade80;
    white-space: nowrap;
}

/* ═══════════════════════════════════════════
   CRM SIDE PANEL
═══════════════════════════════════════════ */

.crm-panel {
    position: fixed;
    right: 0;
    top: 0;
    height: 100vh;
    width: 420px;
    background: var(--bg-sidebar);
    border-left: 1px solid var(--border);
    z-index: 100;
    display: flex;
    flex-direction: column;
    box-shadow: -8px 0 30px rgba(0,0,0,0.4);
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
}

.crm-panel.hidden {
    transform: translateX(100%);
    display: flex !important;
}

.crm-panel-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.crm-panel-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    color: white;
    flex-shrink: 0;
}

.crm-panel-info { flex: 1; }
.crm-panel-info h3 { font-size: 1rem; font-weight: 700; }
.crm-panel-info span { font-size: 0.8rem; color: var(--text-muted); }

.crm-close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s;
}
.crm-close-btn:hover { background: rgba(255,255,255,0.08); color: var(--text-main); }

/* Stage row */
.crm-stage-row {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    overflow-x: auto;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.crm-stage-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 5px 10px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.75rem;
    font-family: inherit;
    white-space: nowrap;
    transition: all 0.2s;
}

.crm-stage-btn.active, .crm-stage-btn:hover {
    color: white;
    border-color: transparent;
}

/* Panel Tabs */
.crm-panel-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.crm-ptab {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 12px 8px;
    font-family: inherit;
    font-size: 0.8rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.crm-ptab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.crm-ptab:hover { color: var(--text-main); }

/* Chat in panel */
.crm-ptab-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.active-ptab { display: flex !important; }

.crm-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.crm-chat-input {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.crm-chat-input input {
    flex: 1;
    background: var(--bg-main);
    border: 1px solid var(--border);
    color: white;
    padding: 10px 14px;
    border-radius: 22px;
    font-family: inherit;
    font-size: 0.875rem;
    outline: none;
}

.crm-chat-input input:focus { border-color: var(--primary); }

.crm-chat-input button {
    background: var(--primary);
    color: white;
    border: none;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    transition: background 0.2s;
    flex-shrink: 0;
}
.crm-chat-input button:hover { background: var(--primary-hover); }

/* Info form */
.crm-info-form {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow-y: auto;
}

.crm-field { display: flex; flex-direction: column; gap: 6px; }
.crm-field label { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); }
.crm-field input, .crm-field textarea {
    background: var(--bg-main);
    border: 1px solid var(--border);
    color: white;
    padding: 10px 12px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.875rem;
    outline: none;
    resize: none;
}
.crm-field input:focus, .crm-field textarea:focus { border-color: var(--primary); }

/* Activity */
.activity-input-row {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.activity-input-row input {
    flex: 1;
    background: var(--bg-main);
    border: 1px solid var(--border);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.875rem;
    outline: none;
}

.activity-input-row button {
    background: var(--primary);
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: 700;
    transition: background 0.2s;
}

.activity-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.activity-item {
    display: flex;
    gap: 10px;
    font-size: 0.8rem;
}

.activity-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 4px;
    flex-shrink: 0;
}

.activity-dot.nota   { background: var(--primary); }
.activity-dot.etapa  { background: #f59e0b; }
.activity-dot.sistema { background: var(--text-muted); }

.activity-desc { color: var(--text-main); line-height: 1.4; }
.activity-time { color: var(--text-muted); font-size: 0.72rem; margin-top: 2px; }

/* ═══════════════════════════════════════════════
   DASHBOARD STYLES
═══════════════════════════════════════════════ */

.dash-filters {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.dash-date-input {
    background: var(--bg-main);
    border: 1px solid var(--border);
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.8rem;
    margin-left: 6px;
    outline: none;
    color-scheme: dark;
}

.dash-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ── KPI Grid ── */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 14px;
}

.kpi-card {
    background: var(--bg-sidebar);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 20px 18px;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    border-radius: 14px 14px 0 0;
}

.kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.kpi-total::before    { background: #3b82f6; }
.kpi-pipeline::before { background: #8b5cf6; }
.kpi-ganado::before   { background: #22c55e; }
.kpi-perdido::before  { background: #ef4444; }
.kpi-conversion::before { background: #f59e0b; }

.kpi-icon {
    font-size: 1.6rem;
    margin-bottom: 10px;
}

.kpi-value {
    font-size: 1.9rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1;
    margin-bottom: 6px;
}

.kpi-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-sub {
    font-size: 0.8rem;
    color: #4ade80;
    font-weight: 600;
    margin-top: 4px;
}

.kpi-perdido .kpi-sub { color: #f87171; }
.kpi-pipeline .kpi-sub { color: #c4b5fd; }

/* ── Charts ── */
.charts-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;
}

.chart-card {
    background: var(--bg-sidebar);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.chart-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-main);
}

.chart-wrap {
    flex: 1;
    position: relative;
    min-height: 180px;
    max-height: 220px;
}

.chart-wrap canvas {
    width: 100% !important;
    height: 100% !important;
}

/* ── Razones de Pérdida ── */
.razones-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
}

.razones-empty {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
    padding: 20px 0;
}

.razon-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.razon-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-main);
}

.razon-pct {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.razon-bar-track {
    height: 6px;
    background: rgba(255,255,255,0.08);
    border-radius: 99px;
    overflow: hidden;
}

.razon-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #ef4444, #f97316);
    border-radius: 99px;
    transition: width 0.6s ease;
}

/* ═══════════════════════════════════════════════
   MODAL: RAZÓN DE PÉRDIDA
═══════════════════════════════════════════════ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay.hidden { display: none; }

.modal-box {
    background: var(--bg-sidebar);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 32px;
    width: 480px;
    max-width: 95vw;
    box-shadow: 0 25px 60px rgba(0,0,0,0.6);
    animation: modalIn 0.25s cubic-bezier(0.4,0,0.2,1);
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.92) translateY(16px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-box h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.modal-box p {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 20px;
}

.modal-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 16px;
}

.modal-option {
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 11px 14px;
    border-radius: 10px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
    text-align: left;
    transition: all 0.18s;
}

.modal-option:hover { background: rgba(255,255,255,0.09); border-color: rgba(59,130,246,0.5); }
.modal-option.selected { background: rgba(59,130,246,0.2); border-color: var(--primary); color: #93c5fd; }

.modal-otro input {
    width: 100%;
    background: var(--bg-main);
    border: 1px solid var(--border);
    color: white;
    padding: 11px 14px;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.875rem;
    outline: none;
    margin-bottom: 20px;
}

.modal-otro input:focus { border-color: var(--primary); }

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.modal-btn-cancel {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}

.modal-btn-cancel:hover { background: rgba(255,255,255,0.06); color: var(--text-main); }

.modal-btn-confirm {
    background: #ef4444;
    border: none;
    color: white;
    padding: 10px 22px;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    transition: background 0.2s;
}

.modal-btn-confirm:hover { background: #dc2626; }

/* ═══════════════════════════════════════════════
   EQUIPO TABLE STYLES
═══════════════════════════════════════════════ */
.equipo-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--bg-sidebar);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.equipo-table th, .equipo-table td {
    padding: 16px 20px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.equipo-table th {
    background: rgba(0,0,0,0.15);
    font-weight: 600;
    font-size: 0.8rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.equipo-table tr:hover td {
    background: rgba(255,255,255,0.02);
}

.equipo-action-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: 0.2s;
}

.equipo-action-btn:hover {
    background: rgba(255,255,255,0.1);
}
