@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-color: #f8fafc; /* Slate 50 */
    --text-primary: #0f172a; /* Slate 900 */
    --text-secondary: #64748b; /* Slate 500 */
    --accent-color: #4f46e5; /* Indigo 600 */
    --accent-hover: #4338ca;
    --accent-light: #eef2ff;
    --danger-color: #ef4444;
    --success-color: #10b981;
    --whats-color: #16a34a;
    --whats-hover: #15803d;
    
    --glass-bg: rgba(255, 255, 255, 0.98);
    --glass-border: #e2e8f0;
    --glass-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
    
    --card-bg: #ffffff;
    --card-border: #e2e8f0;
    --card-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.03);
    --card-shadow-hover: 0 10px 20px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
    
    --highlight-color: rgba(250, 204, 21, 0.3);
    --highlight-text: #854d0e;
    --doubt-color: rgba(239, 68, 68, 0.1);
    --doubt-border: #ef4444;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   APP CONTAINER & FULL-WIDTH RESPONSIVE LAYOUT
   ========================================================================== */
.app-container {
    width: 100%;
    max-width: 1720px;
    margin: 0 auto;
    padding: 1.25rem 2rem;
}

.hidden {
    display: none !important;
}

/* ==========================================================================
   HEADER & TOP NAVIGATION
   ========================================================================== */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1.25rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--glass-border);
    flex-wrap: wrap;
}

.header-brand-group {
    display: flex;
    align-items: center;
    gap: 1.75rem;
    flex-wrap: wrap;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
}

.logo-icon {
    font-size: 1.75rem;
    color: #ffffff;
    background: linear-gradient(135deg, #4f46e5, #3b82f6);
    padding: 0.35rem;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(79, 70, 229, 0.25);
}

.logo-text {
    font-weight: 800;
    font-size: 1.35rem;
    color: #0f172a;
    letter-spacing: -0.5px;
}

.logo-sub {
    font-weight: 500;
    font-size: 0.95rem;
    color: #64748b;
}

/* Nav Tabs Switcher */
.nav-tabs-pill {
    display: flex;
    gap: 0.35rem;
    background: #f1f5f9;
    padding: 0.3rem;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.nav-tab {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1.15rem;
    border: none;
    border-radius: 9px;
    background: transparent;
    color: #64748b;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    white-space: nowrap;
}

.nav-tab .material-icons-round {
    font-size: 1.2rem;
}

.nav-tab:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.6);
}

.nav-tab.active {
    background: #ffffff;
    color: var(--accent-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.tab-badge {
    background: #e0e7ff;
    color: var(--accent-color);
    font-size: 0.75rem;
    font-weight: 800;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
}

.nav-tab.active .tab-badge {
    background: var(--accent-color);
    color: #ffffff;
}

/* Search Bar */
.search-bar {
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 0.55rem 1rem;
    flex: 1;
    min-width: 260px;
    max-width: 480px;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.search-bar:focus-within {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.search-bar input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    outline: none;
    width: 100%;
    margin-left: 0.65rem;
    font-family: inherit;
    font-size: 0.9rem;
}

.search-bar input::placeholder {
    color: #94a3b8;
}

.search-icon {
    color: #94a3b8;
    font-size: 1.25rem;
}

.search-kbd {
    background: #f1f5f9;
    color: #94a3b8;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
    font-family: inherit;
}

/* Top Actions */
.actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.tab-actions-group {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.55rem 1.15rem;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    text-decoration: none;
    border: 1px solid transparent;
    white-space: nowrap;
}

.btn.primary {
    background-color: var(--accent-color);
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(79, 70, 229, 0.2);
}

.btn.primary:hover {
    background-color: var(--accent-hover);
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
    transform: translateY(-1px);
}

.btn.primary.action-highlight {
    background: linear-gradient(135deg, #4f46e5, #4338ca);
}

.btn.outline {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    color: #475569;
}

.btn.outline:hover {
    border-color: #cbd5e1;
    background-color: #f8fafc;
    color: var(--text-primary);
}

.btn.whats-btn-settings:hover {
    border-color: #22c55e;
    color: #16a34a;
    background: #f0fdf4;
}

.btn.small {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    border-radius: 8px;
}

.btn.full {
    width: 100%;
}

.btn.icon-only {
    padding: 0.55rem;
    border-radius: 10px;
    color: var(--danger-color);
    border-color: #fee2e2;
}

.btn.icon-only:hover {
    background: #fef2f2;
    border-color: var(--danger-color);
}

/* ==========================================================================
   LEADS MASTER TOOLBAR & STATS
   ========================================================================== */
.leads-toolbar-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 0.85rem 1.25rem;
    margin-bottom: 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.25rem;
    flex-wrap: wrap;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.lead-type-filters {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.chip-filter {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #475569;
    padding: 0.45rem 0.95rem;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.chip-filter:hover {
    border-color: #cbd5e1;
    background: #ffffff;
}

.chip-filter.active {
    background: #0f172a;
    color: #ffffff;
    border-color: #0f172a;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.15);
}

.chip-filter.active .material-icons-round {
    color: #ffffff !important;
}

/* View Mode Toggle */
.view-mode-toggle {
    display: flex;
    background: #f1f5f9;
    padding: 0.25rem;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

.mode-btn {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    border: none;
    background: transparent;
    border-radius: 7px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: all 0.15s;
}

.mode-btn.active {
    background: #ffffff;
    color: var(--accent-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Stats Cards in Toolbar */
.leads-metrics-cards {
    display: flex;
    gap: 0.85rem;
    align-items: center;
    flex-wrap: wrap;
}

.mini-stat-card {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 0.4rem 0.85rem;
    border-radius: 12px;
}

.mini-stat-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.mini-stat-info {
    display: flex;
    flex-direction: column;
}

.mini-stat-label {
    font-size: 0.7rem;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.mini-stat-val {
    font-size: 0.95rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.2;
}

/* ==========================================================================
   KANBAN BOARD FULL-WIDTH GRID LAYOUT
   ========================================================================== */
.kanban-wrapper {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 1.5rem;
}

.kanban-wrapper::-webkit-scrollbar {
    height: 10px;
}

.kanban-wrapper::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 6px;
}

.kanban-wrapper::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 6px;
}

.kanban-board {
    display: grid;
    grid-template-columns: repeat(7, minmax(250px, 1fr));
    gap: 1rem;
    min-width: 1800px; /* Ensures all 7 columns stay legible and never collapse */
    align-items: flex-start;
}

.kanban-column {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 280px);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.kanban-column.drag-over {
    background: var(--col-bg-subtle, #f1f5f9);
    border: 2px dashed var(--col-accent, #4f46e5);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.05);
}

.column-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.85rem;
    padding-bottom: 0.65rem;
    border-bottom: 2px solid var(--col-accent, #cbd5e1);
}

.col-title-group {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.col-accent-badge {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.col-title-group h3 {
    font-size: 0.9rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

.col-count-pill {
    background: #ffffff;
    color: #475569;
    border: 1px solid #e2e8f0;
    font-size: 0.72rem;
    font-weight: 800;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
}

.col-header-actions {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.col-value-sum {
    font-size: 0.75rem;
    font-weight: 700;
    color: #64748b;
}

.col-quick-add {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: #64748b;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    line-height: 1;
    transition: all 0.15s;
}

.col-quick-add:hover {
    background: var(--accent-color);
    color: #ffffff;
    border-color: var(--accent-color);
}

.kanban-cards-track {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    overflow-y: auto;
    min-height: 140px;
    flex: 1;
}

/* Empty column placeholder */
.kanban-empty-cta {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 0.75rem;
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
    text-align: center;
    color: #94a3b8;
    background: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    transition: all 0.2s;
}

.kanban-empty-cta:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
    background: #ffffff;
}

.kanban-empty-cta .material-icons-round {
    font-size: 1.5rem;
    margin-bottom: 0.35rem;
}

.kanban-empty-cta span {
    font-size: 0.75rem;
    font-weight: 600;
}

/* ==========================================================================
   KANBAN CARD DESIGN (COMPACT & DENSE)
   ========================================================================== */
.lead-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 0.65rem 0.8rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    cursor: grab;
    position: relative;
}

.lead-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px -3px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.03);
    border-color: #cbd5e1;
}

.lead-card.dragging {
    opacity: 0.4;
    cursor: grabbing;
}

.card-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.4rem;
}

.lead-badge {
    font-size: 0.65rem;
    font-weight: 800;
    padding: 0.15rem 0.45rem;
    border-radius: 5px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.lead-badge.seller {
    background: #eef2ff;
    color: #4338ca;
    border: 1px solid #c7d2fe;
}

.lead-badge.buyer {
    background: #fef3c7;
    color: #b45309;
    border: 1px solid #fde68a;
}

.inactivity-badge {
    font-size: 0.68rem;
    display: flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.1rem 0.35rem;
    border-radius: 5px;
    font-weight: 700;
}

.inactivity-badge.warning {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.inactivity-badge.ok {
    color: #94a3b8;
    background: #f8fafc;
}

.card-client-name {
    font-weight: 800;
    font-size: 0.88rem;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.card-client-name .client-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #f1f5f9;
    color: #475569;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
}

.card-vehicle-box {
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    border-radius: 8px;
    padding: 0.35rem 0.55rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.card-vehicle-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.25;
}

.card-tags-row {
    display: flex;
    gap: 0.25rem;
    align-items: center;
    flex-wrap: wrap;
}

.card-tag {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    padding: 0.08rem 0.35rem;
    border-radius: 4px;
    font-size: 0.68rem;
    font-weight: 700;
    color: #475569;
}

.card-tag.plate {
    background: #1e293b;
    color: #ffffff;
    border-color: #0f172a;
    font-family: monospace;
    letter-spacing: 0.5px;
}

.card-price-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0;
}

.card-price-label {
    font-size: 0.72rem;
    color: #64748b;
    font-weight: 500;
}

.card-price-val {
    font-size: 0.95rem;
    font-weight: 800;
    color: #059669;
}

/* Card Photo Thumbnail (Compact) */
.card-thumb-container {
    position: relative;
    border-radius: 6px;
    overflow: hidden;
    height: 62px;
    background: #f1f5f9;
}

.card-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s;
}

.lead-card:hover .card-thumb-img {
    transform: scale(1.04);
}

.card-thumb-count {
    position: absolute;
    bottom: 3px;
    right: 3px;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(4px);
    color: #ffffff;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
}

/* Card Action Buttons (Compact) */
.card-actions-bar {
    display: flex;
    gap: 0.3rem;
    align-items: center;
    margin-top: 0.1rem;
    padding-top: 0.4rem;
    border-top: 1px solid #f1f5f9;
}

.btn-card-whats {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    background: #16a34a;
    color: #ffffff;
    border: none;
    padding: 0.32rem 0.55rem;
    border-radius: 6px;
    font-size: 0.76rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
}

.btn-card-whats:hover {
    background: #15803d;
    transform: translateY(-1px);
}

.btn-card-action {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: #64748b;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-card-action:hover {
    background: #f8fafc;
    color: var(--accent-color);
    border-color: var(--accent-color);
    transform: translateY(-1px);
}

/* ==========================================================================
   TABLE VIEW (LISTA COMPACTA DE LEADS)
   ========================================================================== */
.leads-table-container {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    overflow-x: auto;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.leads-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.85rem;
}

.leads-table th {
    background: #f8fafc;
    color: #64748b;
    font-weight: 700;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.leads-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    color: #1e293b;
    vertical-align: middle;
}

.leads-table tr:hover td {
    background: #f8fafc;
}

.table-client-cell {
    display: flex;
    flex-direction: column;
}

.table-client-name {
    font-weight: 700;
    color: #0f172a;
}

.table-client-phone {
    font-size: 0.78rem;
    color: #64748b;
}

.table-vehicle-cell {
    display: flex;
    flex-direction: column;
}

.table-vehicle-title {
    font-weight: 700;
}

.table-vehicle-year {
    font-size: 0.78rem;
    color: #64748b;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
}

/* ==========================================================================
   PASTE ZONE & PHOTO DROPZONE (CTRL+V SUPPORT)
   ========================================================================== */
.paste-zone {
    border: 2px dashed #cbd5e1;
    border-radius: 10px;
    padding: 0.85rem 1rem;
    background: #f8fafc;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    outline: none;
}

.paste-zone:hover, .paste-zone:focus {
    border-color: var(--accent-color);
    background: #f5f3ff;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.paste-zone.dragover {
    border-color: #10b981;
    background: #ecfdf5;
}

.compact-paste-zone {
    padding: 0.45rem 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    text-align: left;
    border: 1.5px dashed #cbd5e1;
    border-radius: 8px;
}

.paste-icon-sm {
    font-size: 1.4rem;
    color: var(--accent-color);
    flex-shrink: 0;
}

.paste-text-compact {
    font-size: 0.75rem;
    color: #475569;
    line-height: 1.3;
}

.paste-text-compact kbd {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08);
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    font-size: 0.72rem;
    color: var(--accent-color);
    font-weight: 800;
}

.photos-preview-gallery-sm {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-top: 0.35rem;
}

.photo-preview-item {
    position: relative;
    width: 52px;
    height: 52px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.photo-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-remove-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(15, 23, 42, 0.85);
    color: #ffffff;
    border: none;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s;
}

.photo-remove-btn:hover {
    background: #ef4444;
}

/* ==========================================================================
   MODALS & COMPACT LEAD MODAL WITH FIXED FOOTER
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--glass-shadow);
    width: 100%;
    position: relative;
    animation: modalScale 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalScale {
    from { opacity: 0; transform: scale(0.97) translateY(8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal.auth-modal {
    max-width: 400px;
    text-align: center;
}

.modal.quick-modal {
    max-width: 520px;
}

.modal.long-modal {
    max-width: 740px;
}

/* Compact Lead Modal with Fixed Bottom Footer */
.modal.lead-modal {
    max-width: 660px;
    max-height: 88vh;
    padding: 1.15rem 1.35rem 0.85rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 16px;
}

.modal-header-compact {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.65rem;
    padding-right: 2rem;
    flex-shrink: 0;
}

.modal-icon-badge-sm {
    background: #eef2ff;
    color: var(--accent-color);
    padding: 0.35rem;
    border-radius: 8px;
    font-size: 1.25rem;
}

.lead-form-compact {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.modal-scrollable-body {
    flex: 1;
    overflow-y: auto;
    padding-right: 0.35rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.modal-scrollable-body::-webkit-scrollbar {
    width: 4px;
}

.modal-scrollable-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.compact-row {
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: #f1f5f9;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    cursor: pointer;
    transition: all 0.15s;
    z-index: 2;
}

.close-btn:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.lead-type-toggle {
    display: flex;
    background: #f1f5f9;
    padding: 0.2rem;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.type-btn {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.3rem 0.65rem;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 700;
    color: #64748b;
    cursor: pointer;
    transition: all 0.15s;
}

.type-btn.active {
    background: #ffffff;
    color: var(--accent-color);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    margin-bottom: 0.4rem;
    text-align: left;
}

.input-group label {
    font-size: 0.76rem;
    font-weight: 700;
    color: #475569;
}

.input-group input, .input-group select, .input-group textarea {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 0.42rem 0.65rem;
    font-family: inherit;
    font-size: 0.85rem;
    color: #0f172a;
    outline: none;
    transition: all 0.15s;
}

.input-group input:focus, .input-group select:focus, .input-group textarea:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.input-group-row {
    display: flex;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-icon .input-icon {
    position: absolute;
    left: 0.65rem;
    pointer-events: none;
    font-size: 1.05rem;
}

.input-with-icon input {
    padding-left: 2.1rem !important;
    width: 100%;
}

/* Modal Fixed Footer (Pinned at Bottom) */
.modal-footer-actions.fixed-footer {
    position: sticky;
    bottom: 0;
    background: #ffffff;
    padding-top: 0.65rem;
    margin-top: 0.4rem;
    border-top: 1px solid #e2e8f0;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 10;
}

/* ==========================================================================
   WHATSAPP TEMPLATES & SETTINGS
   ========================================================================== */
.dynamic-tags-bar {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-bottom: 0.65rem;
}

.tag-chip {
    background: #eef2ff;
    color: var(--accent-color);
    border: 1px solid #c7d2fe;
    padding: 0.25rem 0.55rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 800;
    font-family: monospace;
    cursor: pointer;
    transition: all 0.15s;
}

.tag-chip:hover {
    background: var(--accent-color);
    color: #ffffff;
}

.templates-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 220px;
    overflow-y: auto;
    margin-bottom: 1.25rem;
    padding-right: 0.25rem;
}

.template-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 0.85rem 1.15rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.template-item-info {
    flex: 1;
}

.template-item-title {
    font-weight: 800;
    font-size: 0.95rem;
    color: #0f172a;
    margin-bottom: 0.25rem;
}

.template-item-preview {
    font-size: 0.82rem;
    color: #64748b;
    line-height: 1.4;
}

.template-item-actions {
    display: flex;
    gap: 0.35rem;
}

.template-editor-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 1.25rem;
}

/* ==========================================================================
   NOTES GRID & CATEGORIES
   ========================================================================== */
.categories-bar {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.chip {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: #475569;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.chip.active {
    background: #0f172a;
    color: #ffffff;
    border-color: #0f172a;
}

.notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 1.5rem;
}

.note-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 1.25rem;
    box-shadow: var(--card-shadow);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
    min-height: 190px;
}

.note-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--card-shadow-hover);
    border-color: #cbd5e1;
}

.note-card.important {
    border-left: 5px solid #eab308;
}

.note-card.reminder-active {
    border: 2px solid var(--danger-color);
    animation: pulseBorder 1.5s infinite;
}

@keyframes pulseBorder {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.note-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.note-type {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.note-title {
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.note-content-preview {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    flex: 1;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
}

.note-footer {
    display: flex;
    align-items: center;
    margin-top: 1rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.category-tag {
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    color: #ffffff;
    font-weight: 600;
}

.note-actions {
    display: flex;
    gap: 0.4rem;
}

.action-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.2rem;
    border-radius: 4px;
    transition: all 0.15s;
}

.action-btn:hover {
    color: var(--text-primary);
    background: #f1f5f9;
}

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

/* Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: .3s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
}

input:checked + .slider {
    background-color: var(--accent-color);
}

input:checked + .slider:before {
    transform: translateX(16px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Toasts */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 9999;
}

.toast {
    background: #ffffff;
    border-left: 4px solid var(--accent-color);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.12), 0 8px 10px -6px rgba(0, 0, 0, 0.06);
    border-radius: 10px;
    padding: 0.85rem 1.15rem;
    min-width: 320px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: slideInRight 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.fade-out {
    animation: fadeOutRight 0.3s ease forwards;
}

.toast-content {
    display: flex;
    flex-direction: column;
}

.toast-title {
    font-weight: 700;
    color: #0f172a;
    font-size: 0.9rem;
}

.toast-message {
    color: #64748b;
    font-size: 0.82rem;
    margin-top: 0.2rem;
}

.toast-dismiss {
    background: #f1f5f9;
    border: none;
    color: #64748b;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.toast-dismiss:hover {
    background: #fee2e2;
    color: var(--danger-color);
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOutRight {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* Responsive */
@media (max-width: 900px) {
    .app-container {
        padding: 1rem;
    }
    header {
        flex-direction: column;
        align-items: stretch;
    }
    .search-bar {
        max-width: 100%;
    }
    .leads-toolbar-card {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 768px) {
    /* Kanban Mobile Experience */
    .kanban-board {
        display: flex;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        padding-bottom: 1rem;
        gap: 1rem;
        -webkit-overflow-scrolling: touch;
    }
    
    .kanban-column {
        flex: 0 0 85vw;
        min-width: 85vw;
        max-width: 85vw;
        scroll-snap-align: center;
    }

    /* Modals Full Screen */
    .modal {
        width: 100% !important;
        max-width: 100% !important;
        height: 100% !important;
        max-height: 100% !important;
        border-radius: 0;
        overflow-y: auto;
        margin: 0;
        padding: 1.5rem;
        padding-bottom: 5rem; /* Space for sticky footer if any */
    }

    .modal-overlay {
        padding: 0;
        align-items: flex-start;
    }

    /* Forms & Inputs */
    .form-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .input-group input, 
    .input-group select, 
    .input-group textarea {
        font-size: 16px; /* Prevents iOS auto-zoom */
        padding: 0.85rem;
    }
    
    .btn {
        padding: 0.85rem 1.25rem;
        font-size: 1rem;
    }

    .btn.small {
        padding: 0.65rem 1rem;
    }

    .lead-card {
        padding: 1rem;
    }

    .card-actions-bar {
        flex-wrap: wrap;
    }

    .card-actions-bar .btn-card-whats {
        flex: 1;
        justify-content: center;
    }
}
