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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

/* Navigation */
.navbar {
    background-color: #2c3e50;
    color: white;
    padding: 0 2rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    min-height: 3.5rem;
    position: relative;
}

.nav-brand {
    display: flex;
    align-items: center;
    height: 3.5rem;
    flex: 1;
}

.nav-brand a {
    color: white;
    text-decoration: none;
    font-size: 1.25rem;
    font-weight: 600;
}

/* Hamburger — always visible */
.nav-toggle {
    display: flex;
    align-items: center;
    height: 3.5rem;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    line-height: 1;
}

/* Nav links: hidden by default, shown as a drawer when open */
.nav-links {
    display: none;
    list-style: none;
    flex-direction: column;
    width: 100%;
    gap: 0;
    padding: 0.5rem 0 1rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.navbar.nav-open .nav-links {
    display: flex;
}

.nav-links li {
    width: 100%;
}

.nav-links a {
    display: block;
    color: #bdc3c7;
    text-decoration: none;
    font-size: 0.95rem;
    padding: 0.55rem 0.5rem;
    transition: color 0.15s, background 0.15s;
}

.nav-links a:hover {
    color: white;
    background: rgba(255,255,255,0.07);
    border-radius: 4px;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1.5rem;
}

.alert-error {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-success {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

/* Headings */
h1 {
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
    color: #2c3e50;
}

/* Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.stat-card h3 {
    font-size: 0.875rem;
    text-transform: uppercase;
    color: #7f8c8d;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 600;
    color: #2c3e50;
}

/* Tables */
.data-table {
    width: 100%;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border-collapse: collapse;
    overflow: hidden;
}

.data-table th,
.data-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.data-table th {
    background-color: #f9fafb;
    font-weight: 600;
    font-size: 0.875rem;
    color: #4b5563;
}

.data-table tr:hover {
    background-color: #f9fafb;
}

/* Forms */
.form-card {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    max-width: 500px;
}

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

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

.form-group input[type="text"],
.form-group input[type="file"] {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.875rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1.25rem;
    border: none;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.2s;
}

.btn-primary {
    background-color: #3498db;
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-secondary {
    background-color: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

.btn-danger {
    background-color: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background-color: #c0392b;
}

/* Cards */
.card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
}

.card h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: #2c3e50;
}

/* CTA grid */
.cta-grid {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 2rem;
}

/* Definition list */
.dl-inline {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.5rem 1.5rem;
}

.dl-inline dt {
    font-weight: 600;
    color: #4b5563;
}

.dl-inline dd {
    color: #1f2937;
}

/* Form enhancements */
.form-group input[type="text"],
.form-group input[type="file"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.875rem;
    background: white;
}

.form-group input[type="checkbox"] {
    margin-right: 0.5rem;
}

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

/* Toolbar */
.toolbar {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    background: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.toolbar .form-group {
    margin-bottom: 0;
    flex: 1;
    min-width: 150px;
}

.toolbar .btn {
    margin-bottom: 0;
}

/* Pagination */
.pagination {
    display: flex;
    gap: 0.25rem;
    align-items: center;
    margin-top: 1.5rem;
}

.pagination a,
.pagination span {
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.875rem;
}

.pagination a {
    background: white;
    color: #3498db;
    border: 1px solid #e5e7eb;
}

.pagination a:hover {
    background: #f3f4f6;
}

.pagination .current {
    background: #3498db;
    color: white;
}

.pagination .disabled {
    color: #9ca3af;
}

/* Preview table */
.preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    margin: 1rem 0;
}

.preview-table th,
.preview-table td {
    padding: 0.5rem;
    border: 1px solid #e5e7eb;
    text-align: left;
}

.preview-table th {
    background: #f9fafb;
    font-weight: 600;
}

/* Column mapping */
.column-mapping {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.mapping-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: white;
    padding: 0.75rem;
    border-radius: 4px;
    border: 1px solid #e5e7eb;
}

.mapping-row label {
    font-weight: 500;
    min-width: 120px;
}

.mapping-row select {
    flex: 1;
}

/* Progress */
.progress-container {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    max-width: 600px;
    margin: 0 auto;
}

.progress-bar {
    width: 100%;
    height: 1.5rem;
    background: #e5e7eb;
    border-radius: 9999px;
    overflow: hidden;
    margin: 1rem 0;
}

.progress-bar-fill {
    height: 100%;
    background: #3498db;
    transition: width 0.3s ease;
}

.progress-stage {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: #6b7280;
}

.progress-stage.active {
    color: #2c3e50;
    font-weight: 600;
}

/* Detail view */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

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

.detail-section h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: #2c3e50;
}

.detail-field {
    margin-bottom: 0.75rem;
}

.detail-field label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #7f8c8d;
    margin-bottom: 0.25rem;
}

.detail-field .value {
    color: #1f2937;
}

/* Raw lead table */
.raw-lead {
    background: #f9fafb;
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.raw-lead h4 {
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    color: #4b5563;
}

/* Settings */
.settings-section {
    margin-bottom: 2rem;
}

.settings-section h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: #2c3e50;
}

.domain-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.5rem 0;
}

.domain-tag {
    background: #e5e7eb;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.domain-tag button {
    background: none;
    border: none;
    cursor: pointer;
    color: #6b7280;
}

/* Export preview */
.export-preview {
    overflow-x: auto;
    margin: 1rem 0;
}

/* Checkbox grid */
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.5rem;
    margin: 0.5rem 0;
}

.checkbox-grid label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
}

.badge-pending {
    background-color: #fef3c7;
    color: #92400e;
}

.badge-confirmed {
    background-color: #d1fae5;
    color: #065f46;
}

.badge-rejected {
    background-color: #fee2e2;
    color: #991b1b;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: #6b7280;
}

.empty-state a {
    color: #3498db;
    text-decoration: none;
}

.empty-state a:hover {
    text-decoration: underline;
}

/* Review queue */
.cluster-row:hover {
    background-color: #f3f4f6;
}

.cluster-muted {
    opacity: 0.7;
}

.preview-cell {
    font-size: 0.875rem;
    max-width: 300px;
}

.preview-line {
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.score-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 600;
}

.score-high {
    background-color: #d1fae5;
    color: #065f46;
}

.score-med {
    background-color: #fef3c7;
    color: #92400e;
}

.score-low {
    background-color: #fee2e2;
    color: #991b1b;
}

.badge-email {
    background-color: #dbeafe;
    color: #1e40af;
}

.badge-phone {
    background-color: #dcfce7;
    color: #166534;
}

.badge-name_company {
    background-color: #fef3c7;
    color: #92400e;
}

.badge-phonetic {
    background-color: #f3e8ff;
    color: #6b21a8;
}

.btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
}

/* Side-by-side review */
.review-progress {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
}

.progress-text {
    font-size: 0.875rem;
    color: #4b5563;
    margin-bottom: 0.5rem;
    display: block;
}

.comparison-table-wrapper {
    overflow-x: auto;
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.comparison-table th,
.comparison-table td {
    padding: 0.5rem 0.75rem;
    border: 1px solid #e5e7eb;
    text-align: left;
}

.comparison-table th {
    background-color: #f9fafb;
    font-weight: 600;
    white-space: nowrap;
}

.comparison-table td:first-child {
    font-weight: 500;
    background-color: #f9fafb;
    white-space: nowrap;
}

.row-diff {
    background-color: #fef3c7;
}

.row-diff td:first-child {
    background-color: #fde68a;
}

.canonical-badge {
    display: inline-block;
    background: #d1fae5;
    color: #065f46;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-size: 0.75rem;
    margin-left: 0.5rem;
}

.match-pair {
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    background: #f9fafb;
    border-radius: 4px;
}

.review-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.review-actions .btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

.review-actions kbd {
    background: rgba(255,255,255,0.2);
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
    font-family: monospace;
    font-size: 0.875rem;
}

/* Audit log */
.audit-row-rejected {
    background-color: #fee2e2;
}

.audit-row-confirmed {
    background-color: #d1fae5;
}

/* Error pages */
.error-page {
    text-align: center;
    padding: 4rem 2rem;
}

.error-page h1 {
    font-size: 4rem;
    color: #e5e7eb;
    margin-bottom: 1rem;
}

.error-page p {
    color: #6b7280;
    margin-bottom: 2rem;
}

.error-detail {
    background: #f3f4f6;
    padding: 1rem;
    border-radius: 4px;
    text-align: left;
    overflow-x: auto;
    margin-bottom: 2rem;
    font-size: 0.875rem;
}

code {
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.8rem;
    background: #f3f4f6;
    padding: 0.125rem 0.25rem;
    border-radius: 3px;
}

pre {
    font-family: 'Monaco', 'Menlo', monospace;
}

/* CRM Summary Strip */
.crm-summary-strip {
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
    padding: 0.75rem 1.5rem;
    margin: -1rem -2rem 1.5rem -2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.crm-strip-stage {
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.95rem;
}

.crm-strip-confidence {
    color: #4b5563;
    font-size: 0.875rem;
}

.crm-strip-days {
    color: #6b7280;
    font-size: 0.875rem;
}

/* Tag Pills */
.tag-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 500;
    margin-right: 0.5rem;
    margin-bottom: 0.25rem;
}

.tag-pill button {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0;
    margin-left: 0.25rem;
    opacity: 0.8;
}

.tag-pill button:hover {
    opacity: 1;
}

/* CRM Panel */
.crm-panel h2 {
    margin-bottom: 1.5rem;
}

.crm-subsection {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.crm-subsection:last-child {
    border-bottom: none;
}

.crm-subsection h3 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Inline Forms */
.crm-inline-form {
    background: #f9fafb;
    padding: 1rem;
    border-radius: 6px;
    margin: 0.75rem 0;
}

.crm-inline-form.hidden,
.hidden {
    display: none !important;
}

.crm-collapsible {
    max-height: 500px;
    overflow-y: auto;
}

.crm-collapsible.hidden {
    display: none;
}

/* Activity Items */
.activity-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f3f4f6;
    font-size: 0.875rem;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-direction {
    color: #6b7280;
    text-transform: lowercase;
    font-size: 0.8rem;
}

.activity-summary {
    flex: 1;
    color: #1f2937;
}

.activity-date {
    color: #9ca3af;
    font-size: 0.8rem;
    white-space: nowrap;
}

/* Task Items */
.task-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f3f4f6;
    font-size: 0.875rem;
}

.task-item:last-child {
    border-bottom: none;
}

.task-title {
    flex: 1;
    font-weight: 500;
}

.task-due {
    color: #6b7280;
    font-size: 0.8rem;
    white-space: nowrap;
}

.task-priority {
    text-transform: uppercase;
    font-size: 0.75rem;
    font-weight: 600;
    color: #4b5563;
}

.task-overdue .task-due {
    color: #dc2626;
    font-weight: 600;
}

.task-done .task-title {
    text-decoration: line-through;
    color: #9ca3af;
}

/* Badges */
.badge-email {
    background-color: #dbeafe;
    color: #1e40af;
}

.badge-call {
    background-color: #dcfce7;
    color: #166534;
}

.badge-meeting {
    background-color: #fef3c7;
    color: #92400e;
}

.badge-note {
    background-color: #f3e8ff;
    color: #6b21a8;
}

.badge-open {
    background-color: #fef3c7;
    color: #92400e;
}

.badge-done {
    background-color: #d1fae5;
    color: #065f46;
}

.badge-danger {
    background-color: #fee2e2;
    color: #991b1b;
}

.badge-pipeline {
    background-color: #e0e7ff;
    color: #3730a3;
}

/* Pipeline Table */
.row-warning {
    background-color: #fffbeb;
}

.row-inactive {
    opacity: 0.7;
}

.warning-icon {
    color: #f59e0b;
    margin-left: 0.25rem;
}

.inactive-icon {
    margin-left: 0.25rem;
}

.text-danger {
    color: #dc2626;
}

.text-muted {
    color: #6b7280;
    font-size: 0.9rem;
    font-weight: normal;
}

/* Navigation badge */
.nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e74c3c;
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.35rem;
    border-radius: 9999px;
    margin-left: 0.25rem;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 0.5rem;
}

.tab {
    padding: 0.5rem 1rem;
    color: #6b7280;
    text-decoration: none;
    border-radius: 4px 4px 0 0;
    font-weight: 500;
}

.tab:hover {
    color: #2c3e50;
    background: #f3f4f6;
}

.tab-active {
    color: #2c3e50;
    border-bottom: 2px solid #3498db;
    margin-bottom: -0.6rem;
}

/* Owner badge */
.owner-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 9999px;
    background: #e0e7ff;
    color: #3730a3;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.owner-unassigned {
    background: #f3f4f6;
    color: #9ca3af;
}

/* Utility */
.btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
}

/* Overlays / Modals */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.overlay-content {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.overlay-content h3 {
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

/* Side Panel */
.side-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 400px;
    max-width: 90%;
    height: 100vh;
    background: white;
    box-shadow: -2px 0 8px rgba(0,0,0,0.15);
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.side-panel-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.side-panel-header h3 {
    font-size: 1.1rem;
    margin: 0;
}

.side-panel-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

/* Today View */
.task-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.task-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: #f9fafb;
    border-radius: 6px;
    border-left: 3px solid #d1d5db;
}

.task-row.task-overdue {
    border-left-color: #dc2626;
    background: #fef2f2;
}

.task-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.task-company {
    font-weight: 600;
    color: #2c3e50;
    text-decoration: none;
}

.task-company:hover {
    text-decoration: underline;
}

.task-title {
    color: #4b5563;
}

.task-meta {
    font-size: 0.8rem;
    color: #9ca3af;
}

.task-actions {
    display: flex;
    gap: 0.5rem;
}

.hot-leads-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.hot-lead-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: #f9fafb;
    border-radius: 6px;
}

.hot-lead-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.hot-lead-name {
    font-weight: 600;
    color: #2c3e50;
    text-decoration: none;
}

.hot-lead-name:hover {
    text-decoration: underline;
}

.hot-lead-confidence {
    font-weight: 600;
    color: #059669;
}

.hot-lead-meta {
    font-size: 0.8rem;
    color: #9ca3af;
}

.hot-lead-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.section-overdue {
    color: #dc2626;
}

.all-clear {
    padding: 4rem 2rem;
}

.all-clear-icon {
    font-size: 4rem;
    color: #059669;
    margin-bottom: 1rem;
}

/* Bulk Action Bar */
.bulk-bar {
    position: sticky;
    top: 0;
    background: #2c3e50;
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    z-index: 100;
    flex-wrap: wrap;
}

.bulk-bar select {
    padding: 0.35rem 0.5rem;
    border-radius: 4px;
    border: none;
    font-size: 0.875rem;
}

.bulk-bar .btn {
    font-size: 0.8rem;
}

/* Inline Stage Select */
.stage-select-inline {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    border: 1px solid #d1d5db;
    font-size: 0.8rem;
    background: white;
}

/* Action Dropdown */
.action-dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    position: absolute;
    right: 0;
    top: 100%;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    min-width: 140px;
    z-index: 50;
}

.dropdown-menu a {
    display: block;
    padding: 0.5rem 1rem;
    color: #374151;
    text-decoration: none;
    font-size: 0.875rem;
}

.dropdown-menu a:hover {
    background: #f3f4f6;
}

/* Log Action Bar */
.log-action-bar {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 0.75rem 1.5rem;
    border-radius: 9999px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    gap: 0.75rem;
    z-index: 100;
}

/* Reports Bar Chart */
.bar-cell {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.bar-fill {
    height: 1rem;
    background: #3498db;
    border-radius: 2px;
    min-width: 2px;
}

/* Contact unlinked row */
.row-unlinked {
    background-color: #fffbeb;
}

/* Activity list in side panel */
.activity-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Outcome banner */
.outcome-banner {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-weight: 500;
}
.outcome-won {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}
.outcome-lost {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* Recurring badge */
.badge-recurring {
    background: #e0e7ff;
    color: #3730a3;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

/* Inbox unread row */
.row-unread {
    font-weight: 600;
}

.unread-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    background: #3498db;
    border-radius: 50%;
    margin-right: 0.5rem;
    vertical-align: middle;
}

.badge-snoozed {
    background: #fef3c7;
    color: #92400e;
    font-size: 0.7rem;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
}

.row-dead {
    opacity: 0.6;
}

/* Inbox actions column */
.inbox-actions {
    white-space: nowrap;
}

.inbox-actions .btn {
    margin-right: 0.25rem;
}

/* Detail panel row */
.detail-panel-row {
    background: #f8fafc;
}

.detail-panel-cell {
    padding: 0;
}

.detail-panel {
    padding: 1rem;
}

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

.detail-panel-section {
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.detail-panel-section:last-child {
    border-bottom: none;
}

.detail-panel-section h4 {
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
    color: #2c3e50;
}

/* Inbox presets bar */
.inbox-presets-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.inbox-presets-bar select {
    padding: 0.35rem 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.875rem;
}

/* Activity feed */
.activity-auto {
    background: #f0f9ff;
    border-left: 3px solid #3498db;
}

.activity-company {
    font-weight: 500;
    color: #2c3e50;
    text-decoration: none;
}

.activity-company:hover {
    text-decoration: underline;
}

.activity-contact {
    color: #6b7280;
    font-size: 0.85rem;
    margin: 0 0.25rem;
}

.qn-check {
    color: #059669;
    margin-left: 0.25rem;
}

/* ── Responsive — tablet & phone ──────────────────────────────────────── */
@media (max-width: 768px) {

    .navbar {
        padding: 0 1rem;
    }

    /* Container */
    .container {
        padding: 0 1rem;
        margin: 1rem auto;
    }

    /* Fix crm-summary-strip negative margins to match reduced container padding */
    .crm-summary-strip {
        margin: -1rem -1rem 1.5rem -1rem;
    }

    /* Tables: horizontal scroll rather than overflow */
    .data-table,
    .preview-table,
    .comparison-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* 3-column inbox detail panel → single column */
    .detail-panel-grid {
        grid-template-columns: 1fr;
    }

    /* Column mapping: allow single column on narrow screens */
    .column-mapping {
        grid-template-columns: 1fr;
    }

    /* mapping-row label: remove min-width so it can wrap */
    .mapping-row {
        flex-wrap: wrap;
    }

    .mapping-row label {
        min-width: unset;
        width: 100%;
    }

    /* Side panel: full-width on small screens */
    .side-panel {
        width: 100%;
        max-width: 100%;
    }

    /* Export column-rename inputs */
    .col-rename-input {
        width: 100%;
        font-size: 0.8rem;
    }

    /* Profile fill-rate bar: full width instead of fixed 200px */
    .profile-fill-bar {
        width: 100%;
        max-width: 200px;
    }

    /* Form card: remove max-width constraint so it fills narrow screens */
    .form-card {
        max-width: 100%;
    }

    /* Toolbar: stack vertically */
    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar .form-group {
        min-width: unset;
    }

    /* Review actions: stack buttons */
    .review-actions {
        flex-direction: column;
    }

    /* Log action bar: span full width */
    .log-action-bar {
        left: 1rem;
        right: 1rem;
        width: auto;
        transform: none;
        border-radius: 8px;
        flex-wrap: wrap;
        justify-content: center;
    }

    /* Bulk bar: wrap */
    .bulk-bar {
        flex-wrap: wrap;
    }

    /* Tabs: scrollable row */
    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        padding-bottom: 0.25rem;
    }

    /* Stat cards: two per row minimum */
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    }

    /* Detail grid: single column */
    .detail-grid {
        grid-template-columns: 1fr;
    }

    /* Overlay content: full width */
    .overlay-content {
        width: 95%;
        padding: 1.25rem;
    }

    /* Hot-lead and task rows: stack info and actions */
    .hot-lead-row,
    .task-row {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .hot-lead-actions,
    .task-actions {
        width: 100%;
        justify-content: flex-end;
    }

    /* Pagination: wrap */
    .pagination {
        flex-wrap: wrap;
    }
}

/* ── Phone-only adjustments ───────────────────────────────────────────── */
@media (max-width: 480px) {
    h1 {
        font-size: 1.4rem;
    }

    .stat-value {
        font-size: 1.6rem;
    }

    /* Export form card full-bleed */
    .form-card[style*="max-width"] {
        max-width: 100% !important;
    }

    /* inbox-actions: let buttons wrap */
    .inbox-actions {
        white-space: normal;
    }

    .inbox-actions .btn {
        margin-bottom: 0.25rem;
    }
}
