:root {
    --bg: #f3f4f6;
    --card: #ffffff;
    --border: #e5e7eb;
    --field-bg: #f3f4f6;
    --text: #111827;
    --text-dim: #6b7280;
    --placeholder: #9ca3af;
    --required: #ef4444;
    --black: #111111;
}

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

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    background-image: linear-gradient(var(--border) 1px, transparent 1px),
                       linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 32px 32px;
    color: var(--text);
    min-height: 100vh;
    padding: 40px 20px;
}

.ltf-wrap { 
    max-width: 1200px; 
    margin: 0 auto; 
}

/* ========================================
   HEADER
   ======================================== */
.ltf-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.ltf-header-icon {
    width: 48px; 
    height: 48px; 
    min-width: 48px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    display: flex; 
    align-items: center; 
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.ltf-header-icon svg { 
    width: 20px; 
    height: 20px; 
}

.ltf-header h1 { 
    font-size: 22px; 
    font-weight: 900; 
    margin-bottom: 2px; 
}

.ltf-header p { 
    font-size: 14px; 
    color: var(--text-dim); 
}

/* ========================================
   CARDS
   ======================================== */
.ltf-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 36px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.04);
}

.ltf-leads-card {
    padding: 24px 28px;
}

/* ========================================
   TOP ACTIONS (Buttons/Links)
   ======================================== */
.ltf-actions-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 16px;
    flex-wrap: wrap;
}

.ltf-view-leads-btn,
.ltf-back-btn,
.ltf-refresh-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--black);
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    padding: 10px 20px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.ltf-view-leads-btn:hover,
.ltf-back-btn:hover,
.ltf-refresh-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.ltf-back-btn {
    background: #6b7280;
}

.ltf-refresh-btn {
    background: #059669;
}

.ltf-badge {
    background: #f3f4f6;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: #6b7280;
}

/* ========================================
   FORM GRID (EXISTING)
   ======================================== */
.ltf-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px 24px;
}

.ltf-field { 
    display: flex; 
    flex-direction: column; 
    gap: 8px; 
}

.ltf-field.full { 
    grid-column: 1 / -1; 
}

.ltf-field label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.ltf-field label .req { 
    color: var(--required); 
    margin-left: 2px; 
}

.ltf-field input,
.ltf-field textarea {
    width: 100%;
    background: var(--field-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    font-family: inherit;
    font-size: 14px;
    color: var(--text);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.ltf-field input::placeholder,
.ltf-field textarea::placeholder { 
    color: var(--placeholder); 
}

.ltf-field input:focus,
.ltf-field textarea:focus {
    border-color: #111827;
    box-shadow: 0 0 0 3px rgba(17,24,39,0.08);
}

.ltf-field textarea { 
    resize: vertical; 
    min-height: 90px; 
    font-family: inherit; 
}

.ltf-field.invalid input,
.ltf-field.invalid textarea { 
    border-color: var(--required); 
}

.ltf-error {
    font-size: 12px;
    color: var(--required);
    min-height: 14px;
}

/* ========================================
   DIVIDER & ACTIONS
   ======================================== */
.ltf-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 28px 0 20px;
}

.ltf-actions { 
    display: flex; 
    justify-content: flex-end; 
}

.ltf-submit {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--black);
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.ltf-submit:hover:not(:disabled) { 
    transform: translateY(-1px); 
}

.ltf-submit:disabled { 
    opacity: 0.6; 
    cursor: not-allowed; 
    transform: none; 
}

/* ========================================
   SPINNER
   ======================================== */
.ltf-spinner {
    width: 14px; 
    height: 14px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: ltf-spin 0.7s linear infinite;
    display: none;
}

.ltf-submit.loading .ltf-spinner { 
    display: inline-block; 
}

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

/* ========================================
   TABLE STYLES (NEW)
   ======================================== */
.ltf-table-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.ltf-controls-left {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
    flex: 1;
}

.ltf-controls-left input[type="text"] {
    flex: 1;
    min-width: 200px;
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    background: var(--field-bg);
    outline: none;
    transition: border-color 0.2s;
}

.ltf-controls-left input[type="text"]:focus {
    border-color: var(--black);
    box-shadow: 0 0 0 3px rgba(17,24,39,0.08);
}

.ltf-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    white-space: nowrap;
}

.ltf-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--black);
}

.ltf-table-scroll {
    overflow-x: auto;
    max-height: 600px;
    overflow-y: auto;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.ltf-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.ltf-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.ltf-table th {
    background: #f3f4f6;
    padding: 12px 14px;
    text-align: left;
    font-weight: 700;
    color: var(--text);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ltf-table td {
    padding: 12px 14px;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
      white-space: nowrap;         
    max-width: 150px;            
    overflow: hidden;
    text-overflow: ellipsis;   
}


.ltf-table tbody tr:hover {
    background: #f9fafb;
}

/* Duplicate Row Highlight */
.ltf-table .duplicate-row {
    background: #fef3c7 !important;
    border-left: 3px solid #f59e0b;
}

.ltf-table .duplicate-row:hover {
    background: #fde68a !important;
}

/* Status Badges */
.ltf-table .status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.ltf-table .status-success {
    background: #d1fae5;
    color: #065f46;
}

.ltf-table .status-duplicate {
    background: #fef3c7;
    color: #92400e;
}

.ltf-table .status-error {
    background: #fee2e2;
    color: #991b1b;
}

/* View Button */
.ltf-table .view-btn {
    display: inline-block;
    padding: 5px 14px;
    background: var(--black);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    text-decoration: none;
    transition: opacity 0.2s;
}

.ltf-table .view-btn:hover {
    opacity: 0.8;
}

/* Duplicate Badge */
.ltf-table .duplicate-badge {
    display: inline-block;
    background: #f59e0b;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 6px;
}

/* Loading State */
.ltf-loading-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-dim);
}

.ltf-loader {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--black);
    border-radius: 50%;
    animation: ltf-spin 0.7s linear infinite;
    margin: 0 auto 16px;
}

/* Empty State */
.ltf-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-dim);
}

.ltf-empty-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    opacity: 0.4;
}

.ltf-toast {
    position: fixed;
    top: 24px; 
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 20px;
    display: flex; 
    align-items: center; 
    gap: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.12);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 2000;
    font-size: 14px;
    font-weight: 600;
}

.ltf-toast.show { 
    opacity: 1; 
    transform: translateX(-50%) translateY(0); 
}

.ltf-toast.success { 
    border-left: 4px solid #16a34a; 
}

.ltf-toast.error { 
    border-left: 4px solid var(--required); 
}

.ltf-toast-icon { 
    width: 20px; 
    height: 20px; 
    flex-shrink: 0; 
}

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

.ltf-modal-overlay.show {
    display: flex;
}

.ltf-modal {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 18px;
    padding: 28px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0,0,0,.2);
    animation: modalIn .25s ease;
}

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

.ltf-modal-icon {
    font-size: 42px;
    margin-bottom: 12px;
}

.ltf-modal h3 {
    margin: 0 0 10px;
    font-size: 22px;
    color: #111827;
}

.ltf-modal p {
    margin: 0;
    color: #6b7280;
    line-height: 1.6;
}

.ltf-modal-actions {
    margin-top: 24px;
    display: flex;
    gap: 12px;
}

.ltf-modal-actions button {
    flex: 1;
    border: none;
    border-radius: 10px;
    padding: 12px;
    cursor: pointer;
    font-weight: 600;
}

.ltf-btn-secondary {
    background: #f3f4f6;
}

.ltf-btn-primary {
    background: #111827;
    color: #fff;
}

@media (max-width: 1024px) {
    .ltf-wrap { 
        max-width: 100%; 
    }
}

/* Mobile Devices */
@media (max-width: 768px) {
    /* Form */
    .ltf-grid { 
        grid-template-columns: 1fr; 
    }
    
    .ltf-card { 
        padding: 20px; 
    }
    
    .ltf-actions { 
        justify-content: stretch; 
    }
    
    .ltf-submit { 
        width: 100%; 
        justify-content: center; 
    }
    
    /* Table Controls */
    .ltf-table-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .ltf-controls-left {
        flex-direction: column;
        align-items: stretch;
    }
    
    .ltf-controls-left input[type="text"] {
        width: 100%;
        min-width: unset;
    }
    
    .ltf-checkbox-label {
        white-space: normal;
    }
    
    /* Top Actions */
    .ltf-actions-top {
        flex-direction: column;
        align-items: stretch;
    }
    
    .ltf-actions-top a,
    .ltf-actions-top button {
        width: 100%;
        justify-content: center;
    }
    
    /* Table */
    .ltf-table {
        font-size: 12px;
    }
    
    .ltf-table th,
    .ltf-table td {
        padding: 8px 10px;
    }
    
    .ltf-table .view-btn {
        padding: 4px 10px;
        font-size: 11px;
    }
    
    /* Header */
    .ltf-header h1 { 
        font-size: 18px; 
    }
    
    .ltf-header p { 
        font-size: 13px; 
    }
    
    .ltf-header-icon {
        width: 40px;
        height: 40px;
        min-width: 40px;
    }
    
    .ltf-header-icon svg {
        width: 18px;
        height: 18px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 16px 10px;
    }
    
    .ltf-card {
        padding: 16px;
        border-radius: 14px;
    }
    
    .ltf-leads-card {
        padding: 16px;
    }
    
    .ltf-table-scroll {
        max-height: 400px;
    }
    
    .ltf-table th,
    .ltf-table td {
        padding: 6px 8px;
        font-size: 11px;
    }
    
    .ltf-modal {
        padding: 20px;
        max-width: 95%;
    }
    
    .ltf-modal h3 {
        font-size: 18px;
    }
    
    .ltf-modal-icon {
        font-size: 32px;
    }
}

@media print {
    .ltf-actions-top,
    .ltf-table-controls,
    .ltf-actions,
    .ltf-toast,
    .ltf-modal-overlay {
        display: none !important;
    }
    
    .ltf-card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
    
    .ltf-table-scroll {
        max-height: none !important;
        overflow: visible !important;
        border: none !important;
    }
    
    .ltf-table th {
        background: #f3f4f6 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    
    .ltf-table .duplicate-row {
        background: #fef3c7 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
}

.ltf-view-modal {
  max-width: 600px;
  text-align: left;
  padding: 0;
  overflow: hidden;
}

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

.ltf-modal-header h3 {
  margin: 0;
  font-size: 18px;
  color: var(--text);
}

.ltf-modal-close {
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: var(--text-dim);
  padding: 0 4px;
  line-height: 1;
  transition: color 0.2s;
}

.ltf-modal-close:hover {
  color: var(--text);
}

.ltf-modal-body {
  padding: 24px;
  max-height: 500px;
  overflow-y: auto;
}

.ltf-modal-body .detail-row {
  display: flex;
  padding: 10px 0;
  border-bottom: 1px solid #f3f4f6;
}

.ltf-modal-body .detail-row:last-child {
  border-bottom: none;
}

.ltf-modal-body .detail-label {
  font-weight: 600;
  width: 140px;
  min-width: 140px;
  color: var(--text-dim);
  font-size: 13px;
}

.ltf-modal-body .detail-value {
  flex: 1;
  font-size: 14px;
  color: var(--text);
  word-break: break-word;
}

.ltf-modal-body .detail-value .status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.ltf-modal-footer {
  display: flex;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: #fafafa;
  justify-content: flex-end;
}

.ltf-modal-footer .ltf-btn-primary {
  background: var(--black);
  color: #fff;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  text-decoration: none;
  font-size: 14px;
  transition: opacity 0.2s;
}

.ltf-modal-footer .ltf-btn-primary:hover {
  opacity: 0.8;
}

@media (max-width: 640px) {
  .ltf-view-modal {
    max-width: 95%;
    margin: 10px;
  }
  
  .ltf-modal-body .detail-row {
    flex-direction: column;
    gap: 4px;
  }
  
  .ltf-modal-body .detail-label {
    width: auto;
    min-width: auto;
  }
}