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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 13px;
    color: #1f2d3d;
    background: #f8f9fb;
    line-height: 1.5;
}

/* ========== HEADER ========== */
.app-header {
    background: #1b1c4e;
    color: #fff;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.app-header .logo {
    width: 28px;
    height: 28px;
    background: #714dff;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}

.app-header h1 {
    font-size: 14px;
    font-weight: 600;
}

.app-header .partner-badge {
    margin-left: auto;
    background: rgba(255,255,255,0.15);
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
}

.app-header .partner-badge.found {
    background: rgba(72, 199, 142, 0.3);
}

/* ========== TABS ========== */
.tabs {
    display: flex;
    background: #fff;
    border-bottom: 1px solid #e8e8e8;
    padding: 0 8px;
}

.tab-btn {
    padding: 10px 16px;
    border: none;
    background: none;
    color: #6e7c87;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: #1b1c4e;
}

.tab-btn.active {
    color: #1b1c4e;
    border-bottom-color: #714dff;
}

.tab-btn .badge {
    background: #e8e8e8;
    color: #6e7c87;
    padding: 1px 6px;
    border-radius: 10px;
    font-size: 11px;
    margin-left: 4px;
}

.tab-btn.active .badge {
    background: #714dff;
    color: #fff;
}

/* ========== CONTENT ========== */
.tab-content {
    display: none;
    padding: 16px;
    overflow-y: auto;
    max-height: calc(100vh - 100px);
}

.tab-content.active {
    display: block;
}

/* ========== CONTACT INFO ========== */
.contact-card {
    background: #fff;
    border-radius: 8px;
    padding: 16px;
    border: 1px solid #e8e8e8;
}

.contact-card .contact-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.contact-card .avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #714dff;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 600;
}

.contact-card .contact-name {
    font-size: 15px;
    font-weight: 600;
}

.contact-card .contact-company {
    font-size: 12px;
    color: #6e7c87;
}

.contact-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 12px;
}

.field-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.field-label {
    font-size: 11px;
    color: #6e7c87;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.field-value {
    font-size: 13px;
    color: #1f2d3d;
    word-break: break-all;
}

/* ========== SALES TABLE ========== */
.sales-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sale-card {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    padding: 12px 16px;
    cursor: pointer;
    transition: box-shadow 0.2s;
}

.sale-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.sale-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.sale-name {
    font-weight: 600;
    font-size: 13px;
    color: #1b1c4e;
}

.sale-total {
    font-weight: 700;
    font-size: 14px;
    color: #1f2d3d;
}

.sale-meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: #6e7c87;
}

.sale-lines {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #f0f0f0;
    display: none;
}

.sale-card.expanded .sale-lines {
    display: block;
}

.sale-line {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 12px;
    color: #3c4858;
}

.sale-line .qty {
    color: #6e7c87;
}

/* ========== STATUS BADGES ========== */
.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
}

.status-badge.draft { background: #f0f0f0; color: #6e7c87; }
.status-badge.sent { background: #e3f2fd; color: #1976d2; }
.status-badge.sale { background: #e8f5e9; color: #388e3c; }
.status-badge.done { background: #e8f5e9; color: #2e7d32; }
.status-badge.cancel { background: #fce4ec; color: #c62828; }
.status-badge.new { background: #fff3e0; color: #e65100; }
.status-badge.won { background: #e8f5e9; color: #388e3c; }
.status-badge.lost { background: #fce4ec; color: #c62828; }

/* ========== LEADS LIST ========== */
.lead-card {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 8px;
}

.lead-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.lead-name {
    font-weight: 600;
    font-size: 13px;
    color: #1b1c4e;
}

.lead-meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: #6e7c87;
}

.lead-probability {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 6px;
}

.probability-bar {
    flex: 1;
    height: 4px;
    background: #e8e8e8;
    border-radius: 2px;
    overflow: hidden;
}

.probability-fill {
    height: 100%;
    background: #714dff;
    border-radius: 2px;
    transition: width 0.3s;
}

.probability-text {
    font-size: 11px;
    color: #6e7c87;
    width: 35px;
    text-align: right;
}

/* ========== CREATE LEAD FORM ========== */
.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #3c4858;
    margin-bottom: 4px;
}

.form-group label .required {
    color: #e53935;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    color: #1f2d3d;
    background: #fff;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #714dff;
    box-shadow: 0 0 0 3px rgba(113, 77, 255, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 70px;
}

.btn {
    padding: 8px 20px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: #714dff;
    color: #fff;
}

.btn-primary:hover {
    background: #5c3dd4;
}

.btn-primary:disabled {
    background: #b8a8f5;
    cursor: not-allowed;
}

.btn-secondary {
    background: #e8e8e8;
    color: #3c4858;
}

.form-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

/* ========== STATES ========== */
.state-message {
    text-align: center;
    padding: 40px 20px;
    color: #6e7c87;
}

.state-message .icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.state-message .title {
    font-size: 14px;
    font-weight: 600;
    color: #3c4858;
    margin-bottom: 4px;
}

.state-message .subtitle {
    font-size: 12px;
}

.spinner {
    width: 28px;
    height: 28px;
    border: 3px solid #e8e8e8;
    border-top-color: #714dff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin: 0 auto 12px;
}

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

/* ========== ALERT ========== */
.alert {
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 12px;
    font-size: 12px;
}

.alert-success {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

.alert-error {
    background: #fce4ec;
    color: #c62828;
    border: 1px solid #f8bbd0;
}

.alert-info {
    background: #e3f2fd;
    color: #1565c0;
    border: 1px solid #bbdefb;
}

/* ========== SEARCH SECTION ========== */
.search-section {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 12px;
}

.search-section h3 {
    font-size: 12px;
    font-weight: 600;
    color: #3c4858;
    margin-bottom: 8px;
}

.chatwoot-info {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.chatwoot-info .chip {
    background: #f0edff;
    color: #714dff;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar {
    width: 5px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #d0d5dd;
    border-radius: 3px;
}
