:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #f1f5f9;
    --secondary-hover: #e2e8f0;
    --text-color: #1e293b;
    --text-light: #64748b;
    --bg-color: #f8fafc;
    --border-color: #cbd5e1;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

header {
    margin-bottom: 2rem;
}

header h1 {
    font-size: 2rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

header p {
    color: var(--text-light);
}

.controls-section {
    background: #fff;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.form-row {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.align-bottom {
    display: flex;
    align-items: flex-end;
    height: 100%;
    margin-bottom: 0;
}

input[type="number"], input[type="text"] {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: inherit;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.country-controls {
    margin-bottom: 0.5rem;
    display: flex;
    gap: 0.5rem;
}

button {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: background-color 0.2s;
}

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

.btn-primary:hover {
    background-color: var(--primary-hover);
}

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

.btn-secondary:hover {
    background-color: var(--secondary-hover);
}

.btn-small {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

.status-panel {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.status-panel h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

#statusText {
    font-weight: 500;
    color: var(--primary-color);
}

#progressText {
    color: var(--text-light);
    font-size: 0.9rem;
}

.results-section {
    background: #fff;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

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

.actions {
    display: flex;
    gap: 1rem;
}

.export-scope {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: inherit;
    background: #fff;
}

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

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th, td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

th {
    background-color: var(--secondary-color);
    font-weight: 600;
    white-space: nowrap;
}

tr:hover {
    background-color: #f8fafc;
}

td a {
    color: var(--primary-color);
    text-decoration: none;
}

td a:hover {
    text-decoration: underline;
}

.filter-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    padding: 0.75rem 1rem;
    background-color: var(--secondary-color);
    border-radius: 6px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.filter-controls .checkbox-item {
    font-weight: 500;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
}

.badge-high {
    background-color: #dcfce7;
    color: #15803d;
}

.badge-medium {
    background-color: #fef9c3;
    color: #a16207;
}

.badge-low {
    background-color: #f1f5f9;
    color: #475569;
}

.wa-link {
    display: inline-block;
    margin-left: 0.5rem;
    font-size: 1.1rem;
    text-decoration: none;
    transition: transform 0.2s ease;
}

.wa-link:hover {
    transform: scale(1.2);
}

/* ---- Discovery section ---- */
.discovery-section {
    margin-bottom: 2rem;
}

.discovery-section > h2 {
    margin-bottom: 0.5rem;
}

.discovery-progress {
    color: var(--primary-color);
    font-weight: 500;
    font-size: 0.9rem;
    min-height: 1.2rem;
    margin-bottom: 1rem;
}

.breakdown-wrap {
    margin-top: 1rem;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    padding: 1rem 1.5rem;
}

.breakdown-wrap summary {
    cursor: pointer;
    font-weight: 600;
}

.breakdown-table {
    margin-top: 1rem;
    font-size: 0.85rem;
}

.breakdown-table th, .breakdown-table td {
    padding: 0.4rem 0.6rem;
}

/* ---- Analytics dashboard ---- */
.dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: #fff;
    padding: 1.25rem 1rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.stat-card-accent {
    background: var(--primary-color);
}

.stat-card-accent .stat-value,
.stat-card-accent .stat-label {
    color: #fff;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--primary-color);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* ---- Filters ---- */
.filter-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 500;
}

.filter-item select {
    padding: 0.3rem 0.4rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: inherit;
}

/* ---- Badges ---- */
.badge-verified {
    background-color: #dcfce7;
    color: #15803d;
}

.badge-partial {
    background-color: #fef9c3;
    color: #a16207;
}

.badge-review {
    background-color: #fee2e2;
    color: #b91c1c;
}

.flag {
    color: #b45309;
    cursor: help;
}

.btn-link {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    padding: 0;
    font: inherit;
    text-decoration: underline;
}

.btn-link-danger { color: #dc2626; }

/* Inline row actions (CRM leads table) */
.row-actions { white-space: nowrap; }
.row-actions .btn-link + .btn-link { margin-left: 0.6rem; }

/* Danger buttons */
.btn-danger {
    background: #dc2626;
    border-color: #dc2626;
    color: #fff;
}
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }

/* Uploaded sheets list */
.upload-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 0.75rem 0;
}
.upload-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
}
.upload-meta { display: flex; flex-direction: column; gap: 0.15rem; }
.upload-meta .muted { font-size: 0.82rem; }

.empty-row {
    text-align: center;
    color: var(--text-light);
    padding: 2rem;
}

/* ---- Modal ---- */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    z-index: 100;
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
    padding: 3rem 1rem;
}

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

.modal {
    background: #fff;
    border-radius: 10px;
    max-width: 720px;
    width: 100%;
    padding: 2rem;
    position: relative;
    box-shadow: 0 10px 40px rgba(0,0,0,0.25);
}

.modal-close {
    position: absolute;
    top: 0.75rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.75rem;
    line-height: 1;
    color: var(--text-light);
    cursor: pointer;
}

.modal h3 {
    margin-bottom: 0.5rem;
}

.modal-section {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.modal-section h4 {
    margin-bottom: 0.5rem;
}

.sources-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
}

.sources-list li {
    color: #15803d;
    font-weight: 500;
}

.modal-contact {
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px dashed var(--border-color);
}

.modal-contact h4 {
    margin-bottom: 0.25rem;
}

.modal-sub {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 0.5rem;
}

.evidence-item {
    margin-top: 0.5rem;
}

.evidence-source {
    font-size: 0.8rem;
    color: var(--text-light);
}

.modal blockquote {
    border-left: 3px solid var(--primary-color);
    margin: 0.25rem 0;
    padding: 0.25rem 0.75rem;
    color: var(--text-color);
    background: var(--secondary-color);
    border-radius: 0 4px 4px 0;
    font-style: italic;
}

.muted {
    color: var(--text-light);
}

/* ---- App nav ---- */
.app-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.nav-tabs {
    display: flex;
    gap: 0.25rem;
}

.nav-tab {
    background: none;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    color: var(--text-light);
    font-weight: 600;
}

.nav-tab:hover {
    background: var(--secondary-color);
}

.nav-tab.active {
    background: var(--primary-color);
    color: #fff;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-user-name {
    font-weight: 500;
    color: var(--text-color);
}

.view-title {
    margin-bottom: 1rem;
}

.view-subtitle {
    margin: 1.5rem 0 0.75rem;
}

/* ---- Auth overlay ---- */
.auth-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--bg-color);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

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

.auth-card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.12);
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
}

.auth-brand {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

.auth-sub {
    color: var(--text-light);
    margin-bottom: 1.5rem;
}

.auth-field input {
    width: 100%;
}

.auth-submit {
    width: 100%;
    padding: 0.6rem;
    margin-top: 0.5rem;
}

.auth-error {
    color: #b91c1c;
    font-size: 0.9rem;
    margin: 0.5rem 0;
}

.auth-toggle {
    margin-top: 1.25rem;
    font-size: 0.9rem;
    color: var(--text-light);
}

/* ---- Status badges ---- */
.badge-status-new { background:#e0f2fe; color:#0369a1; }
.badge-status-contacted { background:#e0e7ff; color:#4338ca; }
.badge-status-followup { background:#fef3c7; color:#b45309; }
.badge-status-interested { background:#dbeafe; color:#1d4ed8; }
.badge-status-meeting { background:#f3e8ff; color:#7e22ce; }
.badge-status-proposal { background:#fae8ff; color:#a21caf; }
.badge-status-negotiation { background:#ffedd5; color:#c2410c; }
.badge-status-customer { background:#dcfce7; color:#15803d; }
.badge-status-lost { background:#fee2e2; color:#b91c1c; }

/* ---- CRM forms ---- */
.crm-input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: inherit;
    background: #fff;
}

textarea.crm-input {
    resize: vertical;
}

.crm-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

.form-group-full {
    grid-column: 1 / -1;
}

.crm-form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.lead-detail p {
    margin-bottom: 0.25rem;
}

.lead-status-row,
.lead-activity-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.lead-activity-row .crm-input {
    width: auto;
}

.lead-activity-row input.crm-input {
    flex: 1;
    min-width: 200px;
}

.import-errors {
    margin: 0.5rem 0 0 1rem;
    color: var(--text-light);
    font-size: 0.85rem;
}

/* ---- Timeline ---- */
.timeline {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.timeline-item {
    border-left: 3px solid var(--primary-color);
    padding: 0.25rem 0.75rem;
    background: var(--secondary-color);
    border-radius: 0 4px 4px 0;
}

.timeline-meta {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    font-size: 0.8rem;
}

.timeline-type {
    font-weight: 600;
    color: var(--primary-color);
}

.timeline-body {
    margin-top: 0.2rem;
}

/* ---- Pipeline grid ---- */
.pipeline-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.75rem;
}

.pipeline-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    align-items: flex-start;
}

.pipeline-count {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary-color);
}

.pipeline-label {
    font-size: 0.8rem;
    color: var(--text-light);
}

/* ---- Outreach ---- */
.modal-wide {
    max-width: 860px;
}

.smtp-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
    border-radius: 6px;
    padding: 0.6rem 0.9rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.smtp-warning code {
    background: rgba(0,0,0,0.06);
    padding: 0 0.25rem;
    border-radius: 3px;
}

/* Connected sending inbox panel (Outreach view) */
.inbox-panel {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
    background: #fef3c7;
    border: 1px solid #fcd34d;
    border-radius: 6px;
    padding: 0.6rem 0.9rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.inbox-panel.inbox-connected {
    background: #ecfdf5;
    border-color: #6ee7b7;
    color: #065f46;
}

.inbox-panel code {
    background: rgba(0,0,0,0.06);
    padding: 0 0.25rem;
    border-radius: 3px;
}

.inbox-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex: 0 0 auto;
}
.inbox-dot.ok { background: #10b981; }
.inbox-dot.warn { background: #f59e0b; }

.inbox-text { flex: 1 1 auto; min-width: 12rem; }
.inbox-sub { display: block; opacity: 0.85; font-size: 0.82rem; margin-top: 0.15rem; }
.inbox-provider { opacity: 0.7; font-size: 0.82rem; }

.btn-connect { text-decoration: none; white-space: nowrap; }

.step-row {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.step-row-head {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.step-day {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--text-light);
    margin-left: auto;
}

.step-day-input {
    width: 70px;
}

.step-readonly {
    border-left: 3px solid var(--primary-color);
    padding: 0.4rem 0.75rem;
    margin-bottom: 0.6rem;
    background: var(--secondary-color);
    border-radius: 0 4px 4px 0;
}

.step-body-preview {
    font-size: 0.85rem;
    color: var(--text-color);
    white-space: pre-wrap;
    margin-top: 0.25rem;
}

.outreach-stats {
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    margin: 1rem 0;
}

.mini-table {
    font-size: 0.88rem;
    margin-top: 0.5rem;
}

.mini-table th, .mini-table td {
    padding: 0.4rem 0.6rem;
}

.recip-actions {
    display: flex;
    gap: 0.6rem;
    white-space: nowrap;
}

.recip-add {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.pick-list {
    max-height: 320px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.5rem;
    margin-bottom: 1rem;
}

.pick-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.25rem;
    font-size: 0.9rem;
}

/* ---- Invoices ---- */
.totals {
    width: 280px;
    margin-left: auto;
    border-collapse: collapse;
    margin-top: 0.5rem;
}

.totals td { padding: 5px 8px; }
.totals td.label { color: var(--text-light); }
.totals td.val { text-align: right; }
.totals tr.grand td {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-color);
    border-top: 2px solid var(--primary-color);
}

.inv-items th, .inv-items td { padding: 0.35rem 0.4rem; }
.inv-items .crm-input { padding: 0.35rem; }
.inv-items .it-qty, .inv-items .it-price { width: 90px; }
.inv-items td.num, .inv-items th.num { text-align: right; }

.inv-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin: 1rem 0;
}

.muted-head {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-light);
    margin-bottom: 0.4rem;
}

.inv-actions {
    flex-wrap: wrap;
}



/* ---------------- Personal Assistant ---------------- */
.assistant-sub { color: var(--muted-color, #6b7280); font-size: 0.9rem; }
.assistant-wrap {
    display: flex; flex-direction: column;
    height: calc(100vh - 220px); min-height: 420px;
    border: 1px solid var(--border-color); border-radius: 10px; overflow: hidden;
    background: #fff;
}
.assistant-messages { flex: 1 1 auto; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: 0.75rem; }
.chat-msg { max-width: 760px; padding: 0.7rem 0.95rem; border-radius: 12px; font-size: 0.92rem; line-height: 1.45; }
.chat-user { align-self: flex-end; background: var(--primary-color, #4f46e5); color: #fff; border-bottom-right-radius: 4px; }
.chat-assistant { align-self: flex-start; background: #f3f4f6; color: #111827; border-bottom-left-radius: 4px; }
.chat-assistant a { color: var(--primary-color, #4f46e5); }
.chat-typing { opacity: 0.7; font-style: italic; }
.chat-reply { margin-bottom: 0.25rem; }
/* Rendered markdown inside assistant replies (ChatGPT/Claude-style formatting). */
.chat-reply p { margin: 0 0 0.55rem; }
.chat-reply p:last-child { margin-bottom: 0; }
.chat-reply ul, .chat-reply ol { margin: 0.2rem 0 0.6rem; padding-left: 1.25rem; }
.chat-reply li { margin: 0.15rem 0; }
.chat-reply .md-h { font-weight: 700; margin: 0.5rem 0 0.3rem; }
.chat-reply code { background: rgba(0,0,0,0.06); padding: 0.05rem 0.3rem; border-radius: 4px; font-size: 0.88em; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.chat-reply strong { font-weight: 700; }
.chat-closing { margin-top: 0.6rem; }

/* Text-style lead/place rows (replaces boxy cards) with inline actions. */
.chat-groups { margin-top: 0.4rem; }
.lead-group { margin: 0.6rem 0; }
.grp-h { font-weight: 700; font-size: 1rem; margin: 0.6rem 0 0.15rem; }
.grp-dist { font-weight: 500; color: #6b7280; font-size: 0.85rem; }
.grp-count { font-weight: 600; color: #16a34a; font-size: 0.8rem; }
.grp-count.short { color: #d97706; }
.grp-char { color: #4b5563; font-size: 0.88rem; margin-bottom: 0.45rem; }
.lead-ul { margin: 0.3rem 0 0.7rem; padding-left: 1.3rem; list-style: disc; }
.lead-li { margin: 0.5rem 0; line-height: 1.5; }
.lead-li::marker { color: #9ca3af; }
.lead-text { font-size: 0.92rem; color: #111827; }
.lead-acts { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.3rem; align-items: center; }
.lead-act { font-size: 0.8rem; padding: 0.18rem 0.5rem; border-radius: 6px; background: #f3f4f6; color: #374151; text-decoration: none; border: 1px solid var(--border-color, #e5e7eb); cursor: pointer; line-height: 1.4; }
.lead-act:hover { background: #e9ebef; }
.lead-act.crm { background: var(--primary-color, #4f46e5); color: #fff; border-color: var(--primary-color, #4f46e5); font-weight: 600; }
.lead-act.crm.biz-added { background: #16a34a; border-color: #16a34a; }
.lead-act.more { background: #fff; }

/* Lead detail side drawer (assistant "More"). */
.drawer-overlay { position: fixed; inset: 0; background: rgba(17,24,39,0.4); opacity: 0; pointer-events: none; transition: opacity 0.2s ease; z-index: 1000; }
.drawer-overlay.open { opacity: 1; pointer-events: auto; }
.lead-drawer { position: fixed; top: 0; right: 0; height: 100%; width: 420px; max-width: 92vw; background: #fff; box-shadow: -6px 0 28px rgba(0,0,0,0.18); transform: translateX(100%); transition: transform 0.25s ease; z-index: 1001; display: flex; flex-direction: column; }
.lead-drawer.open { transform: translateX(0); }
.lead-drawer-close { position: absolute; top: 0.5rem; right: 0.7rem; z-index: 2; }
.lead-drawer-body { padding: 1.5rem 1.25rem; overflow-y: auto; }
.ld-name { font-size: 1.2rem; font-weight: 700; margin: 0 1.5rem 0.4rem 0; line-height: 1.3; }
.ld-rating { color: #b45309; font-weight: 600; margin-bottom: 0.3rem; }
.ld-note { color: #4b5563; font-size: 0.9rem; line-height: 1.5; margin: 0.5rem 0 0.8rem; }
.ld-info { display: flex; flex-direction: column; gap: 0.4rem; }
.ld-row { font-size: 0.9rem; color: #374151; word-break: break-word; }
.ld-row a { color: var(--primary-color, #4f46e5); text-decoration: none; }
.ld-acts { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1rem 0 0.4rem; }
.lead-map { width: 100%; height: 240px; border: 0; border-radius: 10px; margin-top: 0.8rem; }

.biz-list { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.6rem; }
.biz-card { position: relative; background: #fff; border: 1px solid var(--border-color); border-radius: 8px; padding: 0.6rem 0.75rem; }
.biz-name { font-weight: 600; padding-right: 5rem; }
.biz-addr { font-size: 0.83rem; color: #6b7280; margin-top: 0.1rem; }
.biz-person { font-size: 0.83rem; color: #374151; margin-top: 0.15rem; }
.biz-why { font-size: 0.85rem; color: #374151; margin-top: 0.4rem; line-height: 1.4; border-left: 2px solid var(--primary-color, #4f46e5); padding-left: 0.55rem; }
.biz-links { font-size: 0.85rem; margin-top: 0.35rem; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.biz-links a { color: var(--primary-color, #4f46e5); text-decoration: none; }
.biz-dot { color: #d1d5db; }
.biz-source { position: absolute; top: 0.55rem; right: 0.6rem; font-size: 0.68rem; padding: 0.1rem 0.4rem; border-radius: 10px; }
.src-db { background: #ecfdf5; color: #065f46; }
.src-live { background: #eff6ff; color: #1e40af; }

.assistant-input { display: flex; gap: 0.5rem; padding: 0.75rem; border-top: 1px solid var(--border-color); background: #fafafa; }
.assistant-input input { flex: 1 1 auto; padding: 0.6rem 0.8rem; border: 1px solid var(--border-color); border-radius: 8px; font: inherit; }

/* Assistant card "Add to CRM" action */
.biz-actions { margin-top: 0.5rem; display: flex; justify-content: flex-end; }
.biz-actions .btn-small { font-size: 0.78rem; }
.btn-small.biz-added { background: #ecfdf5; color: #065f46; border-color: #6ee7b7; }
.btn-small.biz-added:hover { background: #fee2e2; color: #b91c1c; border-color: #fca5a5; }

/* Assistant result sections (Leads / Hotels / Eat / Do) */
.sec-block { margin-top: 0.75rem; }
.sec-title { font-weight: 700; font-size: 0.82rem; text-transform: uppercase; letter-spacing: .05em; color: #6b7280; margin: 0.25rem 0 0.4rem; }
.biz-rating { color: #b45309; font-weight: 600; }

/* Discover "+ CRM" toggle — green when the lead is in the CRM (click to remove) */
.btn-small.in-crm { background: #ecfdf5; color: #065f46; border-color: #6ee7b7; }
.btn-small.in-crm:hover { background: #fee2e2; color: #b91c1c; border-color: #fca5a5; }

/* CRM schedule-meeting form */
.meeting-form { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.meeting-form .crm-input { width: auto; }
.meeting-opts { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 0.5rem; font-size: 0.85rem; color: var(--text-light); }
.mtg-check { display: inline-flex; align-items: center; gap: 0.35rem; }
.mtg-result { margin-top: 0.6rem; font-size: 0.88rem; }
.mtg-result a { color: var(--primary-color); }
.mtg-ok { color: #065f46; font-weight: 600; }

/* ============================================================ */
/* Minimal UI refresh — visual only. Same palette + same IDs.   */
/* ============================================================ */
:root {
    --radius: 12px;
    --radius-sm: 9px;
    --shadow-sm: 0 1px 2px rgba(15,23,42,.05), 0 1px 3px rgba(15,23,42,.05);
    --shadow: 0 6px 24px rgba(15,23,42,.07);
    --line: #eef1f6;            /* soft separator (neutral, not a brand colour) */
}

body { font-size: 15px; color: #0f172a; -webkit-font-smoothing: antialiased; }
.container { max-width: 1240px; padding: 1.5rem 1.5rem 3rem; }

/* Header */
header { margin-bottom: 1.1rem; }
header h1 { font-size: 1.4rem; font-weight: 600; }
header p { font-size: .92rem; }

/* Sticky, lighter nav with icons */
.app-nav {
    position: sticky; top: .5rem; z-index: 50;
    padding: .45rem .6rem; border: 1px solid var(--line);
    box-shadow: var(--shadow-sm); border-radius: 14px;
    background: rgba(255,255,255,.94); backdrop-filter: saturate(1.1) blur(6px);
}
.nav-tabs { gap: .15rem; flex-wrap: wrap; }
.nav-tab {
    padding: .5rem .8rem; border-radius: 9px; font-weight: 500; font-size: .9rem;
    color: var(--text-light); display: inline-flex; align-items: center; gap: .4rem;
    transition: background .15s, color .15s;
}
.nav-tab:hover { background: var(--secondary-color); color: var(--text-color); }
.nav-tab.active { background: var(--primary-color); color: #fff; box-shadow: 0 2px 10px rgba(37,99,235,.32); }
.nav-icon { font-size: 1.02rem; line-height: 1; }

/* One-line, friendly description under each view title */
.view-help { color: var(--text-light); font-size: .92rem; margin: 0 0 1.25rem; max-width: 72ch; }
.view-title { font-size: 1.25rem; font-weight: 600; margin-bottom: .35rem; }
.view-subtitle { font-size: 1rem; font-weight: 600; }
.results-header h2 { font-size: 1.25rem; font-weight: 600; }

/* Card surfaces */
.controls-section, .results-section, .breakdown-wrap {
    border: 1px solid var(--line); box-shadow: var(--shadow-sm); border-radius: var(--radius);
}
.results-section { padding: 1.1rem 1.3rem 1.3rem; }
.controls-section { padding: 1.4rem 1.5rem; }

/* Buttons — softer, consistent, focus-visible */
button { border-radius: 9px; transition: background .15s, box-shadow .15s, transform .04s; }
button:active { transform: translateY(1px); }
.btn-primary { box-shadow: 0 1px 2px rgba(37,99,235,.3); }
.btn-secondary { background: #fff; }
.btn-secondary:hover { background: var(--secondary-color); }
.btn-small { padding: .3rem .6rem; font-size: .82rem; border-radius: 8px; }
button:focus-visible, a:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: 2px solid var(--primary-color); outline-offset: 2px;
}

/* Inputs — unified */
input[type="text"], input[type="number"], input[type="email"], input[type="password"],
input[type="date"], input[type="time"], input[type="datetime-local"], select, textarea, .crm-input {
    border: 1px solid var(--border-color); border-radius: 9px; padding: .5rem .65rem;
    font-family: inherit; font-size: .9rem; background: #fff; color: var(--text-color);
}
input:focus, select:focus, textarea:focus { border-color: var(--primary-color); }

/* Tables — minimal & airy, sticky header */
.table-container { border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; background: #fff; }
table { font-size: .9rem; }
th {
    background: #f8fafc; color: var(--text-light); font-weight: 600;
    font-size: .76rem; text-transform: uppercase; letter-spacing: .03em;
    border-bottom: 1px solid var(--line); position: sticky; top: 0;
}
td { border-bottom: 1px solid var(--line); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f8fafc; }

/* Header rows + actions wrap nicely on small screens */
.results-header { gap: 1rem; flex-wrap: wrap; align-items: center; }
.actions { gap: .5rem; flex-wrap: wrap; align-items: center; }

/* Filter bar — lighter */
.filter-controls { background: #fff; border: 1px solid var(--line); gap: .9rem 1.25rem; align-items: center; }

/* Stat cards — minimal, gentle hover lift */
.dashboard { gap: .85rem; }
.stat-card {
    border: 1px solid var(--line); box-shadow: var(--shadow-sm); border-radius: var(--radius);
    padding: 1.05rem 1.15rem; transition: box-shadow .15s, transform .15s;
}
.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.stat-value { font-size: 1.55rem; }
.pipeline-card { border: 1px solid var(--line); box-shadow: var(--shadow-sm); transition: box-shadow .15s, transform .15s; }
.pipeline-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }

/* Badges — pill shaped */
.badge { border-radius: 999px; padding: .22rem .6rem; font-size: .72rem; }

/* Modals — softer */
.modal { border-radius: 16px; box-shadow: 0 24px 60px rgba(15,23,42,.28); }
.modal-overlay { background: rgba(15,23,42,.45); backdrop-filter: blur(2px); }

/* Misc */
.status-panel { border-top: 1px solid var(--line); }
.discovery-section > h2 { font-size: 1.1rem; }

/* ============================================================ */
/* DIAMOND PROFESSIONAL — sidebar app shell + design system.    */
/* Authoritative layer (loaded last). Same features, new look.  */
/* ============================================================ */
:root {
    --primary-color: #0a2540;      /* Deep Diamond Blue */
    --primary-hover: #0f335a;
    --secondary-color: #f1f5f9;
    --secondary-hover: #e2e8f0;
    --text-color: #1b1c1e;
    --text-light: #64748b;
    --bg-color: #f8fafc;           /* slate-50 canvas */
    --border-color: #e2e8f0;
    --line: #eef2f7;
    --radius: 12px;                /* cards */
    --radius-btn: 7px;             /* buttons/inputs */
    --shadow-sm: none;             /* cards: stroke not shadow */
    --shadow: 0 4px 12px rgba(10,37,64,.06);
    --shadow-modal: 0 12px 32px rgba(10,37,64,.14);
    --ok-bg:#dcfce7; --ok-fg:#15803d;
    --warn-bg:#fef3c7; --warn-fg:#b45309;
}

body { background: var(--bg-color); color: var(--text-color); font-size: 14px; }
.material-symbols-outlined { font-size: 20px; line-height: 1; vertical-align: middle; }

/* ---- App layout: sidebar + content ---- */
.app-layout { display: flex; min-height: 100vh; align-items: stretch; }
#appShell { min-height: 100vh; }

.sidebar {
    width: 248px; flex: 0 0 248px; background: #fff;
    border-right: 1px solid var(--border-color);
    display: flex; flex-direction: column; gap: .25rem;
    padding: 1.1rem .85rem; position: sticky; top: 0; height: 100vh;
}
.sidebar-brand { display: flex; align-items: center; gap: .6rem; padding: .4rem .5rem 1rem; }
.brand-mark {
    background: var(--primary-color); color: #fff; width: 36px; height: 36px;
    border-radius: 9px; display: grid; place-items: center; font-size: 22px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-weight: 700; font-size: .98rem; color: var(--text-color); }
.brand-sub { font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; color: var(--text-light); }

.sidebar-nav { display: flex; flex-direction: column; gap: .15rem; }
.sidebar-nav .nav-tab {
    display: flex; align-items: center; gap: .7rem; width: 100%;
    padding: .6rem .7rem; border-radius: 8px; border: none; background: none;
    color: var(--text-light); font-weight: 500; font-size: .9rem; text-align: left;
    transition: background .15s, color .15s;
}
.sidebar-nav .nav-tab .material-symbols-outlined { font-size: 21px; }
.sidebar-nav .nav-tab:hover { background: var(--secondary-color); color: var(--text-color); }
.sidebar-nav .nav-tab.active { background: #eaf1fb; color: var(--primary-color); font-weight: 600; }
.sidebar-nav .nav-tab.active .material-symbols-outlined { color: var(--primary-color); }

.sidebar-foot { margin-top: auto; padding-top: .75rem; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: .35rem; }
.sidebar-foot .nav-user-name { font-size: .82rem; color: var(--text-light); padding: 0 .5rem; }
.sidebar-logout {
    display: flex; align-items: center; gap: .6rem; border: none; background: none;
    color: #b91c1c; font-weight: 500; font-size: .9rem; padding: .5rem .7rem; border-radius: 8px;
}
.sidebar-logout:hover { background: #fef2f2; }

/* ---- Content area ---- */
.app-main { flex: 1 1 auto; min-width: 0; overflow-x: hidden; }
.app-main > main { display: block; max-width: 1280px; margin: 0 auto; padding: 1.75rem 2rem 3rem; }

/* ---- Headings / help ---- */
.view-title, .results-header h2, .view > .results-header h2 { font-size: 1.4rem; font-weight: 700; letter-spacing: -.01em; }
.view-help { color: var(--text-light); font-size: .9rem; margin: .15rem 0 1.4rem; max-width: 74ch; }
.view-subtitle, .discovery-section > h2, .results-section h2 { font-weight: 600; }

/* ---- Surfaces ---- */
.controls-section, .results-section, .breakdown-wrap, .filter-controls {
    background: #fff; border: 1px solid var(--border-color); border-radius: var(--radius); box-shadow: none;
}
.controls-section { padding: 1.4rem 1.5rem; }
.results-section { padding: 1.1rem 1.3rem 1.3rem; }

/* ---- Buttons ---- */
button { border-radius: var(--radius-btn); font-weight: 600; transition: background .15s, box-shadow .15s, transform .04s; }
button:active { transform: translateY(1px); }
.btn-primary { background: var(--primary-color); color: #fff; box-shadow: none; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: #fff; color: var(--text-color); border: 1px solid var(--border-color); }
.btn-secondary:hover { background: var(--secondary-color); }
.btn-small { padding: .32rem .6rem; font-size: .82rem; border-radius: 6px; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(10,37,64,.12);
}

/* ---- Inputs ---- */
input[type="text"], input[type="number"], input[type="email"], input[type="password"],
input[type="date"], input[type="time"], input[type="datetime-local"], select, textarea, .crm-input {
    border: 1px solid var(--border-color); border-radius: var(--radius-btn); padding: .5rem .65rem;
    font-family: inherit; font-size: .88rem; background: #fff; color: var(--text-color);
}
input:focus, select:focus, textarea:focus { border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(10,37,64,.1); }

/* ---- Tables: horizontal dividers only, slate header ---- */
.table-container { border: 1px solid var(--border-color); border-radius: var(--radius); overflow: auto; background: #fff; }
table { width: 100%; border-collapse: collapse; font-size: .86rem; }
th {
    background: #f8fafc; color: var(--text-light); font-weight: 600; text-align: left;
    font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; padding: .7rem .9rem;
    border-bottom: 1px solid var(--border-color); position: sticky; top: 0;
}
td { padding: .8rem .9rem; border-bottom: 1px solid var(--line); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f8fafc; }

.results-header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* ---- Filter bar ---- */
.filter-controls { display: flex; flex-wrap: wrap; gap: .85rem 1.2rem; padding: .85rem 1.1rem; margin-bottom: 1.25rem; align-items: center; font-size: .85rem; }

/* ---- Stat cards (no graphs — just numbers) ---- */
.dashboard { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); gap: .9rem; margin-bottom: 1.5rem; }
.stat-card {
    background: #fff; border: 1px solid var(--border-color); border-radius: var(--radius);
    padding: 1.1rem 1.2rem; box-shadow: none; transition: box-shadow .15s, transform .15s;
    display: flex; flex-direction: column; gap: .2rem;
}
.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.stat-value { font-size: 1.7rem; font-weight: 800; color: var(--text-color); letter-spacing: -.02em; order: 2; }
.stat-label { order: 1; font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-light); font-weight: 600; }
.stat-card-accent { background: var(--primary-color); border-color: var(--primary-color); }
.stat-card-accent .stat-value, .stat-card-accent .stat-label { color: #fff; }

.pipeline-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px,1fr)); gap: .65rem; }
.pipeline-card { background: #fff; border: 1px solid var(--border-color); border-radius: 10px; box-shadow: none; padding: .9rem; transition: box-shadow .15s, transform .15s; }
.pipeline-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.pipeline-count { color: var(--primary-color); font-weight: 800; }

/* ---- Badges: full pill, soft semantic ---- */
.badge { display: inline-block; border-radius: 999px; padding: .22rem .62rem; font-size: .7rem; font-weight: 600; letter-spacing: .01em; }

/* ---- Modals ---- */
.modal { border-radius: 14px; box-shadow: var(--shadow-modal); }
.modal-overlay { background: rgba(10,37,64,.4); backdrop-filter: blur(2px); }

/* ---- Status / discovery / panels ---- */
.status-panel { border-top: 1px solid var(--line); }
.discovery-section { background:#fff; border:1px solid var(--border-color); border-radius:var(--radius); padding:1.25rem 1.5rem; margin-bottom:1.5rem; }

/* ---- Assistant chat refinements ---- */
.assistant-wrap { border-radius: var(--radius); border-color: var(--border-color); }
.chat-user { background: var(--primary-color); }

/* ---- Auth: clean professional card ---- */
.auth-card { border-radius: 16px; box-shadow: var(--shadow-modal); border: 1px solid var(--border-color); }
.auth-brand { color: var(--primary-color); font-weight: 800; }
.auth-submit { background: var(--primary-color); }
.auth-submit:hover { background: var(--primary-hover); }

/* ---- Responsive: sidebar -> top bar ---- */
@media (max-width: 880px) {
    .app-layout { flex-direction: column; }
    .sidebar { width: auto; flex: none; height: auto; position: sticky; top: 0; z-index: 50;
        flex-direction: row; align-items: center; gap: .5rem; padding: .55rem .75rem; overflow-x: auto; }
    .sidebar-brand { padding: 0 .5rem 0 0; border-right: 1px solid var(--line); }
    .brand-sub { display: none; }
    .sidebar-nav { flex-direction: row; flex: 1 1 auto; }
    .sidebar-nav .nav-tab span:not(.material-symbols-outlined) { display: none; }   /* icons only on mobile */
    .sidebar-nav .nav-tab { padding: .5rem .6rem; }
    .sidebar-foot { margin: 0; padding: 0 0 0 .5rem; border-top: none; border-left: 1px solid var(--line); flex-direction: row; align-items: center; }
    .sidebar-foot .nav-user-name { display: none; }
    .app-main > main { padding: 1.25rem 1rem 2.5rem; }
}

/* ---- Split-screen auth ---- */
.auth-overlay { padding: 0; background: var(--bg-color); }
.auth-split { display: flex; width: 100%; min-height: 100vh; }
.auth-left {
    flex: 1 1 50%; display: flex; align-items: center; justify-content: center;
    padding: 2rem; background: #f8fafc;
}
.auth-left .auth-card {
    background: #fff; border: 1px solid var(--border-color); border-radius: 16px;
    box-shadow: var(--shadow); padding: 2.5rem; width: 100%; max-width: 400px;
}
.auth-logo { display: flex; align-items: center; gap: .55rem; margin-bottom: .35rem; }
.auth-logo .brand-mark { width: 34px; height: 34px; font-size: 21px; }
.auth-logo .brand-name { font-weight: 800; font-size: 1.1rem; color: var(--text-color); }
.auth-sub { color: var(--text-light); margin-bottom: 1.5rem; font-size: .9rem; }

/* Right marketing panel */
.auth-right {
    flex: 1 1 50%; position: relative; overflow: hidden; color: #fff;
    background: radial-gradient(120% 100% at 80% 0%, #143a63 0%, #0a2540 45%, #061629 100%);
    display: flex; align-items: center; padding: 3.5rem;
}
.auth-right::after {
    content: ''; position: absolute; right: -120px; bottom: -120px; width: 380px; height: 380px;
    border-radius: 50%; background: rgba(176,200,235,.08);
}
.auth-right-inner { position: relative; max-width: 420px; }
.auth-right-brand { display: flex; align-items: center; gap: .5rem; font-weight: 600; font-size: .9rem; color: #b0c8eb; margin-bottom: 1.75rem; }
.auth-right-title { font-size: 2rem; font-weight: 800; line-height: 1.15; letter-spacing: -.02em; margin-bottom: .9rem; }
.auth-right-sub { color: rgba(255,255,255,.72); font-size: 1rem; line-height: 1.55; margin-bottom: 2rem; }
.auth-feature-list { list-style: none; display: flex; flex-direction: column; gap: 1.1rem; }
.auth-feature-list li { display: flex; align-items: flex-start; gap: .85rem; }
.auth-feature-list .material-symbols-outlined {
    background: rgba(176,200,235,.14); color: #cfe0fb; border-radius: 9px;
    width: 38px; height: 38px; display: grid; place-items: center; flex: 0 0 auto; font-size: 21px;
}
.auth-feature-list strong { display: block; font-weight: 600; font-size: .95rem; }
.auth-feature-list span:not(.material-symbols-outlined) { color: rgba(255,255,255,.62); font-size: .85rem; }

@media (max-width: 860px) {
    .auth-right { display: none; }
    .auth-left { flex: 1 1 100%; }
}
