/* =========================================
   XERTECH CRM - Global Stylesheet
   ========================================= */

:root {
    --sidebar-bg: #1a2744;
    --sidebar-width: 240px;
    --accent: #2563eb;
    --accent-dark: #1d4ed8;
    --accent-light: #eff6ff;
    --success: #16a34a;
    --success-light: #f0fdf4;
    --warning: #ea580c;
    --warning-light: #fff7ed;
    --danger: #dc2626;
    --danger-light: #fef2f2;
    --bg: #f5f7fa;
    --card-bg: #ffffff;
    --border: #e5e7eb;
    --text: #111827;
    --text-muted: #6b7280;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 24px rgba(0,0,0,0.12);
    --radius: 10px;
    --radius-sm: 6px;
}

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

html { font-size: 15px; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

/* =========================================
   LAYOUT
   ========================================= */

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

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.page-body {
    padding: 24px;
    flex: 1;
}

/* =========================================
   SIDEBAR
   ========================================= */

.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.sidebar-logo {
    padding: 20px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.logo-icon {
    width: 42px;
    height: 42px;
    background: var(--accent);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    font-weight: 900;
    color: #fff;
    flex-shrink: 0;
}

.logo-text strong {
    display: block;
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 1px;
}

.logo-text small {
    color: rgba(255,255,255,0.5);
    font-size: 0.7rem;
}

.sidebar-nav {
    padding: 12px 0;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 18px;
    color: rgba(255,255,255,0.65);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    margin: 1px 0;
}

.nav-item:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
}

.nav-item.active {
    background: rgba(37,99,235,0.25);
    color: #fff;
    border-left-color: var(--accent);
}

.nav-icon {
    font-size: 1.1rem;
    width: 22px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.user-details {
    flex: 1;
    overflow: hidden;
}

.user-details strong {
    display: block;
    color: #fff;
    font-size: 0.82rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-details small {
    color: rgba(255,255,255,0.5);
    font-size: 0.72rem;
}

.logout-btn {
    color: rgba(255,255,255,0.5);
    font-size: 1.1rem;
    text-decoration: none;
    padding: 4px;
    transition: color 0.2s;
}

.logout-btn:hover { color: var(--danger); }

/* =========================================
   HEADER
   ========================================= */

.top-header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.hamburger {
    display: none;
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: var(--text);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
}

.page-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    flex: 1;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-date {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* =========================================
   CARDS
   ========================================= */

.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}

/* =========================================
   METRICS / KPI CARDS
   ========================================= */

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.metric-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.metric-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.metric-icon.blue   { background: #dbeafe; }
.metric-icon.green  { background: #dcfce7; }
.metric-icon.orange { background: #ffedd5; }
.metric-icon.purple { background: #f3e8ff; }
.metric-icon.red    { background: #fee2e2; }

.metric-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1.1;
}

.metric-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* =========================================
   TABLES
   ========================================= */

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

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

thead th {
    background: #f9fafb;
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

tbody td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }

tbody tr:hover { background: #f9fafb; }

.table-summary {
    background: #f9fafb;
    font-weight: 700;
    font-size: 0.85rem;
}

/* =========================================
   BUTTONS
   ========================================= */

.btn, button.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #15803d; }

.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #c2410c; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }

.btn-secondary { background: #f3f4f6; color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: #e5e7eb; }

.btn-outline { background: transparent; color: var(--accent); border: 1.5px solid var(--accent); }
.btn-outline:hover { background: var(--accent); color: #fff; }

.btn-sm { padding: 5px 10px; font-size: 0.8rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn-icon { padding: 6px 8px; font-size: 0.85rem; }

.btn-group { display: flex; gap: 6px; flex-wrap: wrap; }

/* =========================================
   FORMS
   ========================================= */

.form-group { margin-bottom: 16px; }

.form-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--text);
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

textarea.form-control { resize: vertical; min-height: 80px; }

select.form-control { cursor: pointer; }

.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

.form-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }

/* =========================================
   BADGES / STATUS
   ========================================= */

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.badge-nuevo       { background: #dbeafe; color: #1d4ed8; }
.badge-contactado  { background: #e0f2fe; color: #0369a1; }
.badge-interesado  { background: #fef3c7; color: #b45309; }
.badge-cotizacion  { background: #ede9fe; color: #7c3aed; }
.badge-negociacion { background: #ffedd5; color: #c2410c; }
.badge-cerrado     { background: #dcfce7; color: #15803d; }
.badge-perdido     { background: #fee2e2; color: #b91c1c; }

.badge-borrador   { background: #f3f4f6; color: #6b7280; }
.badge-enviada    { background: #dbeafe; color: #1d4ed8; }
.badge-aprobada   { background: #dcfce7; color: #15803d; }
.badge-rechazada  { background: #fee2e2; color: #b91c1c; }
.badge-cancelada  { background: #f3f4f6; color: #6b7280; }

.badge-admin       { background: #fef3c7; color: #b45309; }
.badge-colaborador { background: #dbeafe; color: #1d4ed8; }

/* =========================================
   SEARCH / FILTERS
   ========================================= */

.filters-bar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    align-items: center;
}

.search-input {
    flex: 1;
    min-width: 200px;
    max-width: 320px;
    padding: 8px 12px 8px 36px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E") no-repeat 10px center;
    transition: border-color 0.2s;
}

.search-input:focus { outline: none; border-color: var(--accent); }

.filter-select {
    padding: 8px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    background: #fff;
    cursor: pointer;
    min-width: 140px;
}

.filter-select:focus { outline: none; border-color: var(--accent); }

/* =========================================
   TABS
   ========================================= */

.tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 20px;
    overflow-x: auto;
}

.tab-btn {
    padding: 10px 20px;
    background: none;
    border: none;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
    white-space: nowrap;
}

.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

/* =========================================
   MODAL
   ========================================= */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.open { display: flex; }

.modal {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: modalIn 0.2s ease;
}

.modal-lg { max-width: 900px; }
.modal-xl { max-width: 1100px; }
.modal-sm { max-width: 420px; }

@keyframes modalIn {
    from { opacity: 0; transform: translateY(-20px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.modal-title { font-size: 1.05rem; font-weight: 700; }

.modal-close {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
    line-height: 1;
}

.modal-close:hover { background: #f3f4f6; color: var(--text); }

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-shrink: 0;
}

/* =========================================
   TOAST NOTIFICATIONS
   ========================================= */

#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: var(--text);
    color: #fff;
    padding: 13px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: toastIn 0.3s ease;
    min-width: 260px;
    max-width: 380px;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(40px); }
    to   { opacity: 1; transform: translateX(0); }
}

.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }
.toast.warning { background: var(--warning); }
.toast.info    { background: var(--accent); }

/* =========================================
   KANBAN PIPELINE
   ========================================= */

.kanban-board {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    padding-bottom: 16px;
    align-items: flex-start;
}

.kanban-column {
    background: #f3f4f6;
    border-radius: var(--radius);
    min-width: 240px;
    width: 260px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.kanban-col-header {
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: var(--radius) var(--radius) 0 0;
}

.kanban-col-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 6px;
}

.kanban-count {
    background: rgba(0,0,0,0.12);
    color: #374151;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
}

.kanban-cards {
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 80px;
    transition: background 0.2s;
}

.kanban-cards.drag-over {
    background: rgba(37,99,235,0.08);
    border-radius: var(--radius-sm);
}

.prospect-card {
    background: #fff;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    padding: 13px;
    cursor: grab;
    border-left: 3px solid transparent;
    transition: transform 0.15s, box-shadow 0.15s;
}

.prospect-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.prospect-card.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.prospect-card.urgency-green { border-left-color: var(--success); }
.prospect-card.urgency-yellow { border-left-color: #f59e0b; }
.prospect-card.urgency-red { border-left-color: var(--danger); }

.prospect-empresa {
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--text);
    margin-bottom: 4px;
}

.prospect-contacto {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.prospect-value {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 8px;
}

.prospect-days {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.urgency-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.prospect-actions { display: flex; gap: 4px; flex-wrap: wrap; }

.kanban-col-footer {
    padding: 8px 12px;
    background: rgba(0,0,0,0.04);
    border-radius: 0 0 var(--radius) var(--radius);
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
}

/* =========================================
   CHARTS
   ========================================= */

.chart-wrap {
    position: relative;
    height: 220px;
    width: 100%;
}

.charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

/* =========================================
   QUOTE FORM
   ========================================= */

.partidas-table-wrap {
    overflow-x: auto;
    margin-bottom: 12px;
}

.partidas-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.83rem;
    min-width: 900px;
}

.partidas-table th {
    background: #f9fafb;
    padding: 8px 10px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

.partidas-table td {
    padding: 6px 6px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.partidas-table input, .partidas-table select {
    width: 100%;
    padding: 5px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.82rem;
    font-family: inherit;
}

.partidas-table input:focus, .partidas-table select:focus {
    outline: none;
    border-color: var(--accent);
}

.quote-summary {
    background: #f9fafb;
    border-radius: var(--radius);
    padding: 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.summary-section h4 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 12px;
    font-weight: 700;
}

.summary-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border);
}

.summary-line:last-child { border-bottom: none; }
.summary-line.total { font-weight: 800; font-size: 1.05rem; }

.margin-indicator {
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    text-align: center;
    font-weight: 700;
    margin-top: 12px;
}

.margin-green  { background: var(--success-light); color: var(--success); }
.margin-yellow { background: var(--warning-light); color: var(--warning); }
.margin-red    { background: var(--danger-light); color: var(--danger); }

/* =========================================
   PIPELINE FUNNEL (REPORTES)
   ========================================= */

.funnel-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 0;
}

.funnel-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.85rem;
}

.funnel-label {
    width: 110px;
    text-align: right;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 600;
}

.funnel-track {
    flex: 1;
    height: 28px;
    background: #f3f4f6;
    border-radius: 4px;
    overflow: hidden;
}

.funnel-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
    transition: width 0.8s ease;
    min-width: 30px;
}

.funnel-count {
    width: 40px;
    font-weight: 700;
    color: var(--text);
}

/* =========================================
   ACTIVITY TABLE
   ========================================= */

.activity-icon {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}

/* =========================================
   COMMUNICATIONS
   ========================================= */

.comm-type-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 0.9rem;
}

.comm-email    { background: #dbeafe; }
.comm-whatsapp { background: #dcfce7; }
.comm-llamada  { background: #fef3c7; }
.comm-visita   { background: #f3e8ff; }
.comm-nota     { background: #f3f4f6; }

/* =========================================
   LOGIN PAGE
   ========================================= */

.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #1a2744 0%, #2563eb 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.2);
    padding: 48px 40px;
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-logo h1 {
    font-size: 2.4rem;
    font-weight: 900;
    color: #1a2744;
    letter-spacing: 3px;
}

.login-logo p {
    color: var(--text-muted);
    margin-top: 4px;
    font-size: 0.9rem;
}

.login-logo {
    margin-bottom: 32px;
}

.login-form .form-group {
    text-align: left;
}

.login-btn {
    width: 100%;
    padding: 13px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 8px;
    transition: background 0.2s;
}

.login-btn:hover { background: var(--accent-dark); }

.login-error {
    background: var(--danger-light);
    color: var(--danger);
    border: 1px solid #fecaca;
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 0.875rem;
    margin-bottom: 16px;
    text-align: left;
}

.login-hint {
    background: #f9fafb;
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin-top: 20px;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: left;
}

.login-hint code { font-family: monospace; color: var(--accent); display: block; margin-top: 4px; }

/* =========================================
   EMPTY STATE
   ========================================= */

.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}

.empty-state-icon { font-size: 3rem; margin-bottom: 12px; display: block; }
.empty-state h3 { font-size: 1.1rem; color: var(--text); margin-bottom: 6px; }
.empty-state p { font-size: 0.875rem; margin-bottom: 20px; }

/* =========================================
   QUICK ACTIONS
   ========================================= */

.quick-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* =========================================
   DETAIL VIEW
   ========================================= */

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.detail-item label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 700;
    display: block;
    margin-bottom: 2px;
}

.detail-item span {
    font-size: 0.9rem;
    color: var(--text);
    font-weight: 500;
}

/* =========================================
   SECTION DIVIDER
   ========================================= */

.section-divider {
    height: 1px;
    background: var(--border);
    margin: 20px 0;
}

.section-title {
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

/* =========================================
   OVERLAY (sidebar mobile)
   ========================================= */

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
}

/* =========================================
   RESPONSIVE
   ========================================= */

@media (max-width: 1024px) {
    .metrics-grid { grid-template-columns: repeat(2, 1fr); }
    .charts-grid { grid-template-columns: 1fr; }
    .quote-summary { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay.open {
        display: block;
    }

    .hamburger { display: block; }

    .main-content { margin-left: 0; }

    .page-body { padding: 16px; }

    .metrics-grid { grid-template-columns: 1fr 1fr; gap: 12px; }

    .metric-card { padding: 14px; }

    .metric-value { font-size: 1.2rem; }

    .kanban-board { flex-direction: column; }
    .kanban-column { width: 100%; min-width: unset; }

    .filters-bar { flex-direction: column; align-items: stretch; }

    .search-input { max-width: 100%; }

    .modal { max-width: 100%; max-height: 95vh; margin: 10px; width: calc(100% - 20px); }

    .form-row-2, .form-row-3 { grid-template-columns: 1fr; }

    .top-header { padding: 0 16px; }

    .card { padding: 16px; }

    .tabs { overflow-x: auto; }

    #toast-container { bottom: 16px; right: 16px; left: 16px; }
    .toast { min-width: unset; max-width: 100%; }
}

@media (max-width: 480px) {
    .metrics-grid { grid-template-columns: 1fr; }
    .btn-group { flex-direction: column; }
}

/* =========================================
   PRINT STYLES
   ========================================= */

@media print {
    .sidebar, .top-header, .btn, .modal-overlay { display: none !important; }
    .main-content { margin-left: 0; }
    .card { box-shadow: none; border: 1px solid #ddd; }
    body { background: #fff; }
}

/* =========================================
   UTILITIES
   ========================================= */

.text-muted  { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-right  { text-align: right; }
.text-center { text-align: center; }

.font-bold { font-weight: 700; }
.font-mono { font-family: monospace; }

.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }

.mb-0 { margin-bottom: 0; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }

.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }

.w-100 { width: 100%; }

.nowrap { white-space: nowrap; }

.hidden { display: none !important; }

.loading {
    opacity: 0.6;
    pointer-events: none;
}

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Top colored bar per column */
.kanban-col-nuevo        .kanban-col-header { border-top: 3px solid #6366f1; border-radius: var(--radius) var(--radius) 0 0; }
.kanban-col-contactado   .kanban-col-header { border-top: 3px solid #0ea5e9; }
.kanban-col-interesado   .kanban-col-header { border-top: 3px solid #f59e0b; }
.kanban-col-cotizacion   .kanban-col-header { border-top: 3px solid #8b5cf6; }
.kanban-col-negociacion  .kanban-col-header { border-top: 3px solid var(--warning); }
.kanban-col-cerrado      .kanban-col-header { border-top: 3px solid var(--success); }
.kanban-col-perdido      .kanban-col-header { border-top: 3px solid var(--danger); }
