/* ══════════════════════════════════════════════════════════
   BRITO CRM — Component Styles
   Hereda los design tokens y TODO el layout + responsive desde
   el <style> de index.html (única fuente de verdad del layout).
   Aquí viven SOLO componentes (botones, formularios, tablas,
   tarjetas, modales, toasts…). No definir aquí sidebar, topbar,
   .view, .kanban-board ni media queries: eso lo gobierna index.html.
   ══════════════════════════════════════════════════════════ */

/* ══════════ RESET EXTRAS ══════════ */
input, select, textarea, button { font-family: inherit; font-size: 14px; }
a { text-decoration: none; color: inherit; }

/* ══════════ BUTTONS ══════════ */
.btn-primary {
    background: var(--accent, #4F46E5); color: #fff; border: none; border-radius: 7px;
    padding: 10px 20px; font-weight: 700; cursor: pointer; font-size: 13px;
    transition: all 140ms cubic-bezier(0.16,1,0.3,1); letter-spacing: -0.1px;
    display: inline-flex; align-items: center; gap: 7px;
    box-shadow: 0 2px 8px rgba(79,70,229,0.25);
}
.btn-primary:hover { background: var(--accent-hover, #4338CA); transform: translateY(-1px); box-shadow: 0 8px 20px rgba(79,70,229,0.32); }
.btn-primary:active { transform: scale(0.97); }

.btn-outline {
    background: #fff; color: #111; border: 1.5px solid #dedede;
    border-radius: 7px; padding: 10px 20px; font-weight: 600; cursor: pointer;
    font-size: 13px; transition: all 140ms cubic-bezier(0.16,1,0.3,1);
    display: inline-flex; align-items: center; gap: 7px;
}
.btn-outline:hover { border-color: #c2c2c2; background: #f7f7f7; }
.btn-outline:active { transform: scale(0.97); }

.btn-danger {
    background: #fff1f2; color: #991b1b; border: 1px solid #fecdd3;
    border-radius: 7px; padding: 9px 16px; font-weight: 700; cursor: pointer;
    font-size: 12px; transition: all 140ms cubic-bezier(0.16,1,0.3,1);
    display: inline-flex; align-items: center; gap: 6px;
}
.btn-danger:hover { background: #991b1b; color: #fff; border-color: #991b1b; }
.btn-danger:active { transform: scale(0.97); }
.btn-sm { padding: 7px 14px; font-size: 12px; }
.btn-full { width: 100%; padding: 13px; justify-content: center; }

/* ══════════ FORM ELEMENTS ══════════ */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block; font-size: 11px; font-weight: 700; color: #717171;
    margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.7px;
}
.form-group input, .form-group select, .form-group textarea {
    width: 100%; border: 1.5px solid #dedede; border-radius: 11px;
    padding: 10px 14px; background: #fafafa; color: #111; outline: none;
    transition: all 220ms cubic-bezier(0.16,1,0.3,1);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    border-color: var(--accent, #4F46E5); background: #fff; box-shadow: 0 0 0 3px rgba(79,70,229,0.12);
}
.form-group input[readonly] { background: #f3f3f3; cursor: default; color: #717171; }
.field-hint { display: block; font-size: 11px; color: #9a9a9a; margin-top: 4px; }
textarea { resize: vertical; min-height: 82px; }

.filter-select {
    border: 1.5px solid #e8e8e8; border-radius: 7px;
    padding: 8px 12px; background: #fff; color: #111; outline: none;
    font-size: 13px; cursor: pointer;
    transition: all 140ms cubic-bezier(0.16,1,0.3,1);
}
.filter-select:focus { border-color: var(--accent, #4F46E5); box-shadow: 0 0 0 3px rgba(79,70,229,0.10); }
.filter-input {
    border: 1.5px solid #e8e8e8; border-radius: 7px;
    padding: 8px 12px; background: #fff; color: #111; outline: none;
    font-size: 13px; min-width: 240px;
    transition: all 140ms cubic-bezier(0.16,1,0.3,1);
}
.filter-input:focus { border-color: var(--accent, #4F46E5); box-shadow: 0 0 0 3px rgba(79,70,229,0.10); }
.filter-checkbox-label {
    display: flex; align-items: center; gap: 8px; font-size: 13px;
    font-weight: 600; color: #717171; cursor: pointer; white-space: nowrap; padding: 0 8px;
}
.filter-checkbox-label input { width: 16px; height: 16px; accent-color: #000; cursor: pointer; }
.filter-select-sm {
    border: 1px solid #e8e8e8; border-radius: 7px; padding: 5px 8px;
    font-size: 12px; background: #fff; color: #111; outline: none;
}
.full-select { width: 100%; margin-top: 8px; }

/* ══════════ VIEW TOOLBAR ══════════ */
.view-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 20px; gap: 12px; flex-wrap: wrap;
}
.toolbar-filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar-right { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.count-badge { font-size: 12px; color: #717171; font-weight: 500; }

/* ══════════ STATUS BADGES ══════════ */
.status-badge {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 10.5px; font-weight: 700; padding: 3px 10px;
    border-radius: 99px; text-transform: uppercase; letter-spacing: 0.5px;
    white-space: nowrap;
}

/* ══════════ DASHBOARD ══════════ */
.kpi-row {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
    gap: 14px; margin-bottom: 22px;
}
.kpi-card {
    background: #fff; border-radius: 16px; border: 1px solid #efefef;
    padding: 22px; display: flex; align-items: center; gap: 16px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    transition: all 220ms cubic-bezier(0.16,1,0.3,1);
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(0,0,0,0.07); border-color: #e8e8e8; }
.kpi-icon {
    width: 44px; height: 44px; border-radius: 7px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; flex-shrink: 0;
}
.kpi-value { font-size: 28px; font-weight: 900; line-height: 1; letter-spacing: -1.5px; font-variant-numeric: tabular-nums; }
.kpi-label { font-size: 11.5px; color: #9a9a9a; margin-top: 4px; font-weight: 600; }
.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.full-width { grid-column: 1/-1; }
.chart-card, .card {
    background: #fff; border-radius: 16px; border: 1px solid #efefef;
    padding: 24px; box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    transition: all 220ms cubic-bezier(0.16,1,0.3,1);
}
.chart-card:hover, .card:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(0,0,0,0.07); border-color: #e8e8e8; }
.card-header {
    display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px;
}
.card-header h3 { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 1.2px; color: #111; }
.chart-container { height: 220px; position: relative; }

/* Activity */
.activity-list { display: flex; flex-direction: column; gap: 0; }
.activity-item {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 12px 0; border-bottom: 1px solid #efefef;
    transition: background 140ms;
}
.activity-item:last-child { border-bottom: none; }
.activity-dot { width: 7px; height: 7px; background: #111; border-radius: 50%; margin-top: 6px; flex-shrink: 0; }
.activity-text { font-size: 13px; flex: 1; line-height: 1.5; }
.activity-text strong { font-weight: 700; }
.activity-time { font-size: 11px; color: #9a9a9a; flex-shrink: 0; margin-top: 2px; }

/* ══════════ KANBAN (solo componentes internos; el layout del board está en index.html) ══════════ */
.kanban-col-header {
    padding: 13px 16px; border-radius: 16px 16px 0 0;
    border: 1px solid #efefef; border-bottom: none;
    background: #fff; display: flex; align-items: center; justify-content: space-between;
}
.col-title { font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.8px; color: #2e2e2e; }
.col-count {
    font-size: 10.5px; background: #f7f7f7; border: 1px solid #efefef;
    padding: 2px 8px; border-radius: 99px; font-weight: 700; color: #717171;
}
.kanban-col-body.drag-over { background: #f0f0f0; }

.lead-card.dragging { opacity: 0.5; transform: rotate(1.5deg); }
.lead-card-name { font-weight: 700; font-size: 13px; margin-bottom: 4px; color: #111; }
.lead-card-phone { font-size: 12px; color: #717171; margin-bottom: 8px; }
.lead-card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.lead-card-rep {
    font-size: 10.5px; background: #f7f7f7; border: 1px solid #efefef;
    padding: 2px 8px; border-radius: 99px; font-weight: 600; color: #717171;
}
.lead-card-date { font-size: 10.5px; color: #9a9a9a; }
.lead-card-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 6px; }
.tag { font-size: 10px; padding: 2px 7px; border-radius: 99px; font-weight: 700; }

/* ══════════ TABLE ══════════ */
.table-wrapper { overflow-x: auto; border-radius: 16px; border: 1px solid #efefef; background: #fff; -webkit-overflow-scrolling: touch; }
.leads-table { width: 100%; border-collapse: collapse; }
.leads-table th {
    background: #fafafa; padding: 12px 18px; text-align: left;
    font-size: 10.5px; font-weight: 800; text-transform: uppercase;
    letter-spacing: 0.8px; color: #9a9a9a; border-bottom: 1px solid #efefef;
    white-space: nowrap;
}
.leads-table td {
    padding: 13px 18px; border-bottom: 1px solid #efefef;
    font-size: 13.5px; vertical-align: middle; color: #111;
    transition: background 120ms;
}
.leads-table tr:last-child td { border-bottom: none; }
.leads-table tr:hover td { background: #fafafa; }
.leads-table tr { cursor: pointer; }

/* ══════════ LEAD FORM ══════════ */
.form-card {
    max-width: 820px; background: #fff; border-radius: 22px;
    border: 1px solid #efefef; padding: 36px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.form-title { font-size: 20px; font-weight: 800; margin-bottom: 28px; letter-spacing: -0.5px; }
.form-section { margin-bottom: 28px; padding-bottom: 24px; border-bottom: 1px solid #efefef; }
.form-section:last-of-type { border-bottom: none; }
.form-section-title { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: 1.5px; color: #9a9a9a; margin-bottom: 16px; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-actions { display: flex; justify-content: flex-end; gap: 12px; padding-top: 16px; }

/* ══════════ SEGUIMIENTOS ══════════ */
.seguimientos-header { margin-bottom: 20px; }
.seg-tabs {
    display: flex; gap: 4px; background: #fff; border: 1.5px solid #e8e8e8;
    border-radius: 11px; padding: 4px; width: fit-content;
}
.seg-tab {
    border: none; background: none; padding: 7px 16px; border-radius: 7px;
    cursor: pointer; font-size: 12.5px; font-weight: 700; color: #717171;
    transition: all 140ms cubic-bezier(0.16,1,0.3,1);
}
.seg-tab.active { background: var(--accent, #4F46E5); color: #fff; box-shadow: 0 2px 8px rgba(79,70,229,0.28); }
.seg-tab:hover:not(.active) { color: #111; background: #f3f3f3; }

.seguimientos-list { display: flex; flex-direction: column; gap: 10px; }
.seg-item {
    background: #fff; border-radius: 11px; border: 1px solid #efefef;
    border-left: 4px solid #111; padding: 16px 20px;
    display: flex; align-items: center; gap: 16px; cursor: pointer;
    transition: all 140ms cubic-bezier(0.16,1,0.3,1);
}
.seg-item:hover { box-shadow: 0 8px 24px rgba(0,0,0,0.07); transform: translateY(-1px); }
.seg-item.overdue { border-left-color: #991b1b; background: #fff8f8; }
.seg-item.today { border-left-color: #92400e; background: #fffdf5; }
.seg-item-name { font-weight: 700; font-size: 14px; color: #111; }
.seg-item-sub { font-size: 12px; color: #717171; margin-top: 2px; }
.seg-item-date { margin-left: auto; font-size: 12px; font-weight: 700; color: #717171; text-align: right; flex-shrink: 0; }
.seg-item-date .seg-label { display: block; font-size: 10px; color: #9a9a9a; font-weight: 500; }

/* ══════════ ANALYTICS ══════════ */
.analytics-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.chart-card.large { grid-column: 1/-1; }
.ranking-list { display: flex; flex-direction: column; gap: 12px; }
.ranking-item { display: flex; align-items: center; gap: 12px; }
.ranking-pos { font-size: 14px; font-weight: 900; color: #9a9a9a; width: 24px; text-align: center; flex-shrink: 0; }
.ranking-name { font-weight: 700; font-size: 13px; flex: 1; }
.ranking-bar-wrap { flex: 2; background: #f3f3f3; border-radius: 99px; height: 6px; overflow: hidden; }
.ranking-bar { height: 100%; background: #111; border-radius: 99px; transition: width 0.6s cubic-bezier(0.16,1,0.3,1); }
.ranking-count { font-weight: 700; font-size: 13px; color: #717171; min-width: 30px; text-align: right; }

/* ══════════ EQUIPO ══════════ */
.equipo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.equipo-card {
    background: #fff; border-radius: 22px; border: 1px solid #efefef;
    padding: 28px; display: flex; flex-direction: column;
    align-items: center; gap: 12px; box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    transition: all 220ms cubic-bezier(0.16,1,0.3,1);
}
.equipo-card:hover { transform: translateY(-3px); box-shadow: 0 14px 36px rgba(0,0,0,0.08); border-color: #e8e8e8; }
.equipo-avatar {
    width: 66px; height: 66px; background: #111; color: #fff;
    border-radius: 50%; display: flex; align-items: center;
    justify-content: center; font-size: 26px; font-weight: 900;
    font-family: 'Outfit', sans-serif;
}
.equipo-name { font-size: 16px; font-weight: 800; letter-spacing: -0.3px; color: #111; }
.equipo-role { font-size: 10.5px; color: #9a9a9a; font-weight: 700; text-transform: uppercase; letter-spacing: 1.2px; }
.equipo-stats { display: flex; gap: 24px; margin-top: 8px; }
.equipo-stat { text-align: center; }
.equipo-stat-val { font-size: 22px; font-weight: 900; letter-spacing: -1px; font-family: 'Outfit', sans-serif; }
.equipo-stat-lbl { font-size: 10px; color: #9a9a9a; font-weight: 600; margin-top: 2px; }

/* ══════════ ACTIVITY FULL ══════════ */
.activity-list-full {
    display: flex; flex-direction: column; gap: 0; background: #fff;
    border-radius: 16px; border: 1px solid #efefef; overflow: hidden;
}
.activity-full-item {
    display: flex; align-items: flex-start; gap: 14px;
    padding: 14px 20px; border-bottom: 1px solid #efefef;
    transition: background 120ms;
}
.activity-full-item:last-child { border-bottom: none; }
.activity-full-item:hover { background: #fafafa; }
.af-avatar {
    width: 32px; height: 32px; border-radius: 50%; background: #111; color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700; flex-shrink: 0;
}
.af-content { flex: 1; }
.af-text { font-size: 13px; line-height: 1.5; }
.af-meta { font-size: 11px; color: #9a9a9a; margin-top: 3px; }

/* ══════════ MODALS (componentes; el .modal base está en index.html) ══════════ */
.modal-card {
    background: #fff; border-radius: 22px;
    box-shadow: 0 36px 72px rgba(0,0,0,0.18), 0 14px 28px rgba(0,0,0,0.08);
    position: relative; width: 100%; max-height: 92vh;
    overflow: hidden; display: flex; flex-direction: column;
    animation: scaleIn 0.28s cubic-bezier(0.16,1,0.3,1);
}
.modal-close {
    position: absolute; top: 16px; right: 16px; background: none;
    border: none; font-size: 17px; cursor: pointer; color: #9a9a9a;
    z-index: 10; width: 32px; height: 32px; border-radius: 7px;
    display: flex; align-items: center; justify-content: center;
    transition: all 140ms cubic-bezier(0.16,1,0.3,1);
}
.modal-close:hover { background: #f3f3f3; color: #111; }

/* Lead modal */
.modal-lead { max-width: 900px; }
.modal-lead-header {
    padding: 28px 32px 22px; border-bottom: 1px solid #efefef;
    display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; flex-shrink: 0;
}
.modal-lead-header h2 { font-size: 22px; font-weight: 800; letter-spacing: -0.5px; }
.lead-modal-meta { font-size: 12px; color: #717171; margin-top: 4px; }
.lead-modal-status-badge { flex-shrink: 0; }
.modal-lead-body { display: grid; grid-template-columns: 1fr 340px; flex: 1; overflow: hidden; }
.lead-panel-left { padding: 24px 28px; overflow-y: auto; border-right: 1px solid #efefef; }
.lead-panel-right { padding: 24px; overflow-y: auto; background: #fafafa; }
.lead-panel-right h4, .lead-panel-left h4 {
    font-size: 10.5px; font-weight: 800; text-transform: uppercase;
    letter-spacing: 0.7px; margin-bottom: 14px; color: #9a9a9a;
}

.info-section { margin-bottom: 24px; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 20px; }
.info-row { padding: 6px 0; font-size: 13px; }
.info-label { color: #9a9a9a; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; }
.info-value { font-weight: 600; color: #111; }

.action-section { }
.followup-row { margin-top: 10px; margin-bottom: 8px; }
.followup-row label { display: block; font-size: 10.5px; font-weight: 700; color: #9a9a9a; text-transform: uppercase; margin-bottom: 6px; }
.followup-row input {
    width: 100%; border: 1.5px solid #e8e8e8; border-radius: 11px;
    padding: 9px 12px; font-size: 13px; outline: none;
    transition: all 220ms cubic-bezier(0.16,1,0.3,1);
}
.followup-row input:focus { border-color: var(--accent, #4F46E5); box-shadow: 0 0 0 3px rgba(79,70,229,0.12); }
.modal-actions-row { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.delete-zone { margin-top: 20px; padding-top: 16px; border-top: 1px solid #fff1f2; }

/* Activity log */
.lead-activity-log { display: flex; flex-direction: column; gap: 12px; }
.log-entry { display: flex; gap: 10px; }
.log-dot { width: 7px; height: 7px; border-radius: 50%; background: #111; flex-shrink: 0; margin-top: 5px; }
.log-body { }
.log-msg { font-size: 13px; line-height: 1.5; }
.log-time { font-size: 10px; color: #9a9a9a; margin-top: 2px; }

/* Confirm modal */
.modal-confirm { max-width: 400px; padding: 36px; text-align: center; }
.modal-confirm p { font-size: 15px; font-weight: 600; margin-bottom: 20px; }
.modal-confirm .modal-actions-row { justify-content: center; }

/* ══════════ TOAST ══════════ */
.toast-container {
    position: fixed; bottom: 24px; right: 24px;
    display: flex; flex-direction: column; gap: 8px; z-index: 9999;
}
.toast {
    background: #111; color: #fff;
    padding: 13px 18px; border-radius: 11px; font-size: 13px; font-weight: 500;
    box-shadow: 0 12px 32px rgba(0,0,0,0.2), 0 4px 12px rgba(0,0,0,0.1);
    opacity: 0; transform: translateY(10px) scale(0.95);
    transition: all 300ms cubic-bezier(0.16,1,0.3,1); max-width: 360px;
}
.toast.show { opacity: 1; transform: translateY(0) scale(1); }
.toast.toast-success { background: #052e16; border-left: 3px solid #15803d; }
.toast.toast-error   { background: #450a0a; border-left: 3px solid #991b1b; }
.toast.toast-info    { background: #0c1a2e; border-left: 3px solid #1e3a5f; }

/* ══════════ UTILS ══════════ */
.hidden { display: none !important; }
.text-muted { color: #717171; }
.text-sm { font-size: 12px; }
.mt-4 { margin-top: 16px; }
.empty-state { text-align: center; padding: 64px 20px; color: #9a9a9a; }
.empty-state .empty-icon { font-size: 40px; margin-bottom: 12px; opacity: 0.5; }
.empty-state p { font-size: 14px; font-weight: 500; }

/* ══════════ APPOINTMENT ALERTS ══════════ */
.seg-item.status-today  { border-left: 4px solid #15803d; background: #f5fdf8; }
.seg-item.status-overdue { border-left: 4px solid #991b1b; background: #fff8f8; }
.today-tag {
    font-size: 9.5px; background: #111; color: #fff;
    padding: 2px 7px; border-radius: 99px; margin-left: 6px;
    font-weight: 800; letter-spacing: 0.5px;
}

/* ══════════ WHATSAPP BTN ══════════ */
.btn-whatsapp {
    display: flex; align-items: center; gap: 8px;
    background: #25D366; color: #fff; border: none;
    padding: 9px 16px; border-radius: 7px; font-weight: 700;
    cursor: pointer; transition: all 140ms cubic-bezier(0.16,1,0.3,1); font-size: 13.5px;
}
.btn-whatsapp:hover { background: #128C7E; transform: translateY(-1px); box-shadow: 0 6px 16px rgba(37,211,102,0.25); }
.btn-whatsapp:active { transform: scale(0.97); }

/* ══════════ MINI BADGE ══════════ */
.mini-badge {
    font-size: 9.5px; font-weight: 800; color: #fff;
    padding: 2px 7px; border-radius: 99px;
    margin-left: 8px; text-transform: uppercase;
    display: inline-block; vertical-align: middle; letter-spacing: 0.4px;
}

/* ══════════ KEYFRAMES (por si componentes se pintan antes de index.html) ══════════ */
@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-10px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.96) translateY(8px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25%       { transform: translateX(-7px); }
    75%       { transform: translateX(7px); }
}
