/* ===================================
   Invictus Quotes CRM - Design System v2
   Unified styling across all modules
   =================================== */

   :root {
    --sidebar-width: 240px;
    --sidebar-collapsed: 0px;
    --topbar-height: 56px;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #eff6ff;
    --primary-rgb: 37, 99, 235;
    --sidebar-bg: #1e293b;
    --sidebar-text: #94a3b8;
    --sidebar-active: #3b82f6;
    --sidebar-hover: #334155;
    --bg-light: #f1f5f9;
    --border-color: #e2e8f0;
    --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    --success: #16a34a;
    --success-light: #f0fdf4;
    --warning: #d97706;
    --warning-light: #fffbeb;
    --danger: #dc2626;
    --danger-light: #fef2f2;
    --info: #0891b2;
    --info-light: #ecfeff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-light);
    color: var(--text-primary);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ===================================
   SIDEBAR
   =================================== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: transform 0.3s ease;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #fff;
}

.sidebar-brand-icon {
    width: 36px;
    height: 36px;
    background: var(--sidebar-active);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #fff;
}

.sidebar-brand-text {
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: -0.02em;
}

.sidebar-toggle-close {
    display: none;
    background: none;
    border: none;
    color: var(--sidebar-text);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
    list-style: none;
    margin: 0;
}

.sidebar-divider {
    padding: 12px 20px 6px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #475569;
    font-weight: 600;
}

.sidebar-item {
    list-style: none;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: all var(--transition-fast);
}

.sidebar-link:hover {
    background: var(--sidebar-hover);
    color: #e2e8f0;
}

.sidebar-item.active .sidebar-link {
    color: #fff;
    background: rgba(59, 130, 246, 0.12);
    border-left-color: var(--sidebar-active);
}

.sidebar-link i {
    font-size: 1.1rem;
    width: 22px;
    text-align: center;
}

.sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 12px;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.04);
}

.sidebar-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: var(--sidebar-active);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
}

.sidebar-user-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: #e2e8f0;
}

.sidebar-user-email {
    font-size: 0.7rem;
    color: var(--sidebar-text);
}

/* ===================================
   TOPBAR
   =================================== */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin 0.3s ease;
}

.topbar {
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-toggle {
    display: none;
    padding: 6px;
    font-size: 1.2rem;
    color: var(--text-secondary);
}

/* === Topbar Search === */
.topbar-search {
    position: relative;
    display: flex;
    align-items: center;
}

.topbar-search i {
    position: absolute;
    left: 10px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.topbar-search input {
    padding-left: 32px;
    width: 220px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-light);
    font-size: 0.85rem;
    transition: all var(--transition-normal);
}

.topbar-search input:focus {
    width: 300px;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.12);
    border-color: var(--primary);
}

.topbar-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
}

/* === Breadcrumb (NEW) === */
.crm-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 0 0;
    margin-bottom: -8px;
    font-size: 0.82rem;
}

.crm-breadcrumb a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.crm-breadcrumb a:hover {
    color: var(--primary);
}

.crm-breadcrumb .separator {
    color: var(--border-color);
    font-size: 0.7rem;
}

.crm-breadcrumb .current {
    color: var(--text-primary);
    font-weight: 600;
}

/* === Notification Bell (NEW) === */
.notification-bell {
    position: relative;
    background: none;
    border: none;
    padding: 6px 8px;
    font-size: 1.15rem;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.notification-bell:hover {
    background: var(--bg-light);
    color: var(--primary);
}

.notification-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    background: var(--danger);
    color: #fff;
    border-radius: 50%;
    font-size: 0.65rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    animation: notifPulse 2s infinite;
}

@keyframes notifPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.15);
    }
}

/* === Notification Dropdown (NEW) === */
.notification-panel {
    position: absolute;
    top: calc(var(--topbar-height) - 4px);
    right: 80px;
    width: 360px;
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-color);
    z-index: 1100;
    display: none;
    animation: slideDown 0.2s ease;
}

.notification-panel.show {
    display: block;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.notification-panel-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.notification-panel-header h6 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 700;
}

.notification-panel-body {
    max-height: 380px;
    overflow-y: auto;
}

.notification-item {
    padding: 12px 18px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 12px;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.notification-item:hover {
    background: var(--bg-light);
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-item.unread {
    background: var(--primary-light);
}

.notification-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.notification-icon.ni-task {
    background: var(--info-light);
    color: var(--info);
}

.notification-icon.ni-deal {
    background: var(--success-light);
    color: var(--success);
}

.notification-icon.ni-offer {
    background: var(--warning-light);
    color: var(--warning);
}

.notification-icon.ni-alert {
    background: var(--danger-light);
    color: var(--danger);
}

.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.notification-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notification-time {
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* ===================================
   PAGE CONTENT
   =================================== */
.page-content {
    padding: 24px;
}

/* ===================================
   GLOBAL BUTTON SYSTEM (NEW)
   =================================== */
.btn {
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.875rem;
    transition: all var(--transition-fast);
    letter-spacing: 0.01em;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn:active:not(:disabled) {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 1px 3px rgba(var(--primary-rgb), 0.3);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    box-shadow: 0 3px 8px rgba(var(--primary-rgb), 0.35);
}

.btn-success {
    box-shadow: 0 1px 3px rgba(22, 163, 74, 0.3);
}

.btn-success:hover {
    box-shadow: 0 3px 8px rgba(22, 163, 74, 0.35);
}

.btn-outline-primary {
    border-width: 1.5px;
}

.btn-sm {
    padding: 5px 12px;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}

.btn-icon.btn-sm {
    width: 30px;
    height: 30px;
}

/* ===================================
   CARDS
   =================================== */
.stat-card {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-color);
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--primary);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.stat-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.stat-card:hover::after {
    opacity: 1;
}

.stat-card .stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.stat-card .stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 8px 0 2px;
    line-height: 1;
}

.stat-card .stat-label {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.stat-card .stat-change {
    font-size: 0.75rem;
    margin-top: 4px;
}

.stat-change.positive {
    color: var(--success);
}

.stat-change.negative {
    color: var(--danger);
}

/* === CRM Card === */
.crm-card {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-color);
    margin-bottom: 24px;
    transition: box-shadow var(--transition-normal);
}

.crm-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.crm-card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.crm-card-header h5 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.crm-card-body {
    padding: 20px;
}

.crm-card-body.p-0 {
    padding: 0;
}

/* ===================================
   PIPELINE KANBAN
   =================================== */
.pipeline-board {
    display: flex;
    gap: 16px;
    padding-bottom: 12px;
    min-height: 400px;
}

.pipeline-column {
    min-width: 280px;
    max-width: 320px;
    flex: 1 0 280px;
    background: var(--bg-light);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
}

.pipeline-column-header {
    padding: 12px 16px;
    font-weight: 600;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 3px solid;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    background: #fff;
}

.pipeline-column-header .badge {
    font-size: 0.7rem;
}

.pipeline-column-body {
    padding: 8px;
    flex: 1;
    overflow-y: auto;
    min-height: 100px;
}

.pipeline-card {
    background: #fff;
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-bottom: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
    border: 1px solid var(--border-color);
    cursor: grab;
    transition: all var(--transition-fast);
}

.pipeline-card:hover {
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
    border-color: var(--primary);
}

.pipeline-card.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
}

.pipeline-card .deal-title {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.pipeline-card .deal-company {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.pipeline-card .deal-value {
    font-weight: 700;
    color: var(--primary);
    font-size: 0.95rem;
}

.pipeline-card .deal-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ===================================
   ACTIVITY TIMELINE
   =================================== */
.activity-timeline {
    position: relative;
    padding-left: 32px;
}

.activity-timeline::before {
    content: '';
    position: absolute;
    left: 14px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-color);
}

.activity-item {
    position: relative;
    margin-bottom: 20px;
    padding: 12px 16px;
    background: #fff;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    transition: all var(--transition-fast);
}

.activity-item:hover {
    border-color: rgba(var(--primary-rgb), 0.3);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.activity-item::before {
    content: '';
    position: absolute;
    left: -24px;
    top: 16px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px var(--border-color);
}

.activity-item .activity-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.activity-item .activity-type {
    font-size: 0.8rem;
    font-weight: 600;
}

.activity-item .activity-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.activity-item .activity-subject {
    font-weight: 600;
    font-size: 0.9rem;
}

.activity-item .activity-desc {
    font-size: 0.85rem;
    color: #475569;
    margin-top: 4px;
}

.activity-item .activity-footer {
    margin-top: 8px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* ===================================
   TASK LIST
   =================================== */
.task-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    transition: all var(--transition-fast);
}

.task-item:hover {
    background: #f8fafc;
}

.task-item:last-child {
    border-bottom: none;
}

.task-item.task-done {
    opacity: 0.6;
}

.task-item.task-done .task-title {
    text-decoration: line-through;
}

.task-item .task-check {
    margin-top: 2px;
    cursor: pointer;
}

.task-item .task-check input {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
}

.task-item .task-content {
    flex: 1;
}

.task-item .task-title {
    font-weight: 600;
    font-size: 0.9rem;
}

.task-item .task-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 2px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.task-item .task-overdue {
    color: var(--danger);
    font-weight: 600;
}

/* ===================================
   CUSTOMER DETAIL
   =================================== */
.customer-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
}

.customer-avatar {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
}

.customer-info h2 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
}

.customer-info .customer-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 4px;
}

/* ===================================
   DATA TABLE OVERRIDES
   =================================== */
.crm-card table.dataTable {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

.crm-card .dataTables_wrapper {
    padding: 12px 0;
}

.crm-card .dataTables_filter input {
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    padding: 4px 10px;
}

/* ===================================
   GLOBAL TOAST SYSTEM (NEW)
   =================================== */
.toast-container {
    position: fixed;
    top: calc(var(--topbar-height) + 12px);
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.crm-toast {
    background: #fff;
    border-radius: var(--radius-md);
    padding: 14px 18px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    border-left: 4px solid var(--primary);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    max-width: 420px;
    pointer-events: auto;
    animation: toastIn 0.35s ease;
}

.crm-toast.toast-out {
    animation: toastOut 0.3s ease forwards;
}

.crm-toast.toast-success {
    border-left-color: var(--success);
}

.crm-toast.toast-warning {
    border-left-color: var(--warning);
}

.crm-toast.toast-danger {
    border-left-color: var(--danger);
}

.crm-toast.toast-info {
    border-left-color: var(--info);
}

.crm-toast .toast-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.crm-toast.toast-success .toast-icon {
    background: var(--success-light);
    color: var(--success);
}

.crm-toast.toast-warning .toast-icon {
    background: var(--warning-light);
    color: var(--warning);
}

.crm-toast.toast-danger .toast-icon {
    background: var(--danger-light);
    color: var(--danger);
}

.crm-toast.toast-info .toast-icon {
    background: var(--info-light);
    color: var(--info);
}

.crm-toast .toast-message {
    flex: 1;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
}

.crm-toast .toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    font-size: 1rem;
    transition: color var(--transition-fast);
}

.crm-toast .toast-close:hover {
    color: var(--text-primary);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(40px);
    }
}

/* ===================================
   GLOBAL SEARCH OVERLAY (NEW)
   =================================== */
.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 15vh;
    backdrop-filter: blur(4px);
}

.search-overlay.show {
    display: flex;
}

.search-box {
    background: #fff;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 600px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: searchIn 0.25s ease;
    overflow: hidden;
}

@keyframes searchIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.search-box-input {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    gap: 12px;
}

.search-box-input i {
    font-size: 1.2rem;
    color: var(--primary);
}

.search-box-input input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1.05rem;
    color: var(--text-primary);
}

.search-box-input .search-shortcut {
    background: var(--bg-light);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 600;
}

.search-results {
    max-height: 400px;
    overflow-y: auto;
}

.search-result-group {
    padding: 8px 0;
}

.search-result-group-label {
    padding: 6px 20px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.search-result-item {
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.search-result-item:hover,
.search-result-item.focused {
    background: var(--primary-light);
}

.search-result-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    background: var(--bg-light);
    color: var(--text-secondary);
}

.search-result-text {
    flex: 1;
}

.search-result-title {
    font-size: 0.88rem;
    font-weight: 600;
}

.search-result-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.search-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
}

/* ===================================
   CONTEXT LINKS & BADGES (NEW)
   Cross-module connection indicators
   =================================== */
.entity-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 4px;
    font-size: 0.78rem;
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition-fast);
    cursor: pointer;
}

.entity-link:hover {
    background: var(--primary);
    color: #fff;
}

.entity-link.el-success {
    background: var(--success-light);
    color: var(--success);
}

.entity-link.el-success:hover {
    background: var(--success);
    color: #fff;
}

.entity-link.el-warning {
    background: var(--warning-light);
    color: var(--warning);
}

.entity-link.el-warning:hover {
    background: var(--warning);
    color: #fff;
}

/* === Status Badges (Enhanced) === */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.status-badge.sb-active {
    background: var(--success-light);
    color: var(--success);
}

.status-badge.sb-pending {
    background: var(--warning-light);
    color: var(--warning);
}

.status-badge.sb-closed {
    background: var(--bg-light);
    color: var(--text-muted);
}

.status-badge.sb-danger {
    background: var(--danger-light);
    color: var(--danger);
}

/* ===================================
   QUICK-VIEW PANEL (NEW)
   Slide-in context panel
   =================================== */
.quick-view-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 420px;
    height: 100vh;
    background: #fff;
    box-shadow: -8px 0 30px rgba(0, 0, 0, 0.15);
    z-index: 1100;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.quick-view-panel.show {
    transform: translateX(0);
}

.quick-view-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.quick-view-header h6 {
    margin: 0;
    font-weight: 700;
}

.quick-view-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.quick-view-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 8px;
}

.quick-view-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 1090;
    display: none;
}

.quick-view-overlay.show {
    display: block;
}

/* ===================================
   UTILITY CLASSES
   =================================== */
.clickable-row {
    cursor: pointer;
}

.clickable-row:hover {
    background: var(--primary-light) !important;
}

.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 12px;
    display: block;
}

.category-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.8rem;
}

.category-badge.cat-a {
    background: #dcfce7;
    color: var(--success);
}

.category-badge.cat-b {
    background: #dbeafe;
    color: var(--primary);
}

.category-badge.cat-c {
    background: #fef3c7;
    color: var(--warning);
}

.category-badge.cat-d {
    background: var(--bg-light);
    color: var(--text-secondary);
}

/* === Section Header (NEW) === */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.section-header h2 {
    font-size: 1.3rem;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-header .section-count {
    background: var(--primary-light);
    color: var(--primary);
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 700;
}

/* === Info Cards (NEW) === */
.info-row {
    display: flex;
    align-items: baseline;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    width: 140px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.info-value {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* === Tabs (Enhanced) === */
.crm-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 20px;
}

.crm-tab {
    padding: 10px 18px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all var(--transition-fast);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}

.crm-tab:hover {
    color: var(--primary);
}

.crm-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.crm-tab .tab-count {
    background: var(--bg-light);
    padding: 1px 7px;
    border-radius: 10px;
    font-size: 0.7rem;
}

.crm-tab.active .tab-count {
    background: var(--primary-light);
    color: var(--primary);
}

/* ===================================
   FORM ENHANCEMENTS
   =================================== */
.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
}

.form-label {
    font-weight: 500;
    font-size: 0.85rem;
    color: #475569;
    margin-bottom: 4px;
}

/* ===================================
   RESPONSIVE
   =================================== */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .sidebar-toggle-close {
        display: block;
    }

    .sidebar-toggle {
        display: block;
    }

    .main-content {
        margin-left: 0;
    }

    .page-content {
        padding: 16px;
    }

    .pipeline-board {
        padding-bottom: 8px;
    }

    .pipeline-column {
        min-width: 260px;
    }

    .quick-view-panel {
        width: 100%;
    }

    .notification-panel {
        right: 12px;
        width: calc(100vw - 24px);
    }

    .search-box {
        margin: 0 16px;
    }
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1035;
    transition: opacity 0.3s ease;
    cursor: pointer;
}

.sidebar-overlay.active {
    display: block;
}

/* === Scrollbar === */
.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 4px;
}

/* === Animations === */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.crm-card {
    animation: fadeIn 0.3s ease;
}

.stat-card {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.96);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Staggered loading for dashboard cards */
.stat-card:nth-child(1) {
    animation-delay: 0s;
}

.stat-card:nth-child(2) {
    animation-delay: 0.05s;
}

.stat-card:nth-child(3) {
    animation-delay: 0.1s;
}

.stat-card:nth-child(4) {
    animation-delay: 0.15s;
}

.stat-card:nth-child(5) {
    animation-delay: 0.2s;
}

/* === Print === */
@media print {

    .sidebar,
    .topbar,
    .sidebar-overlay {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
    }

    .page-content {
        padding: 0 !important;
    }
}

/* ===================================
   LOGIN SCREEN
   =================================== */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    padding: 20px;
}

.login-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    animation: fadeIn 0.4s ease;
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo {
    width: 64px;
    height: 64px;
    background: var(--primary);
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.login-logo i {
    font-size: 1.8rem;
    color: #fff;
}

.login-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.login-header p {
    font-size: 0.9rem;
    margin-bottom: 0;
}

.login-card .form-label {
    font-weight: 500;
    font-size: 0.85rem;
    color: #475569;
}

.login-card .input-group-text {
    background: #f8fafc;
    border-color: var(--border-color);
    color: var(--text-muted);
}

.login-card .form-control {
    border-color: var(--border-color);
    padding: 10px 14px;
}

.login-card .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.15);
}

.login-card .btn-primary {
    padding: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    background: var(--primary);
    border: none;
    border-radius: 8px;
    transition: background 0.2s;
}

.login-card .btn-primary:hover {
    background: var(--primary-dark);
}

.login-card .btn-primary:disabled {
    background: var(--text-muted);
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-4px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(4px);
    }
}

.login-card .alert-danger {
    animation: shake 0.5s ease;
}

/* ===================================
   LEADS PAGE
   =================================== */
#leadsTabs .nav-link {
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    border: 1px solid transparent;
    padding: 8px 16px;
    transition: all var(--transition-fast);
}

#leadsTabs .nav-link:hover {
    color: var(--primary);
    background: var(--primary-light);
}

#leadsTabs .nav-link.active {
    color: var(--primary);
    background: #fff;
    border-color: var(--border-color) var(--border-color) #fff;
}

#leadsTabs .badge {
    font-size: 0.65rem;
    vertical-align: middle;
}

#leadAppTab .card {
    transition: all 0.2s ease;
    border-radius: var(--radius-md);
}

#leadModal .nav-pills .nav-link {
    font-size: 0.8rem;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
}

#leadModal .nav-pills .nav-link.active {
    background: var(--primary);
    color: #fff;
}

#leadModal .form-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 2px;
}

#leadAppImportModal .card-body .form-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* ============================================================
   SELECT FILTER INPUTS
   ============================================================ */
.ss-filter {
    border: 1px dashed var(--border-color, #e2e8f0) !important;
    font-size: 0.78rem !important;
    padding: 3px 8px !important;
    background: #fafbfc !important;
    border-radius: var(--radius-md, 8px) !important;
    color: var(--text-secondary);
    transition: border-color 0.15s, background 0.15s;
}

.ss-filter:focus {
    border-color: var(--primary, #3b82f6) !important;
    border-style: solid !important;
    background: #fff !important;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
    color: var(--text-primary);
}

.ss-filter::placeholder {
    color: #94a3b8;
    font-size: 0.76rem;
}

/* ============================================================
   Document Action Bar (offers.php) — Workflow-Buttons pro Zeile
   ============================================================ */
.doc-action-bar {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    flex-wrap: nowrap;
}

.doc-btn {
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #475569;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
    padding: 0;
    font-size: 0.85rem;
}

.doc-btn:hover {
    background: #f1f5f9;
    color: #1e293b;
    border-color: #cbd5e1;
    transform: translateY(-1px);
}

.doc-btn.active {
    background: #ecfdf5;
    border-color: #34d399;
    color: #047857;
}

.doc-btn.active:hover {
    background: #d1fae5;
}

.doc-btn .tooltip-text {
    visibility: hidden;
    background: #1e293b;
    color: #fff;
    text-align: center;
    border-radius: 4px;
    padding: 4px 8px;
    position: absolute;
    z-index: 10;
    bottom: 130%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.72rem;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.15s, visibility 0.15s;
    pointer-events: none;
}

.doc-btn:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Document-Type-Specific Tinting (subtle hint) */
.doc-btn[data-doctype="offer"].active        { background: #ecfdf5; color: #047857; border-color: #34d399; }
.doc-btn[data-doctype="confirmation"].active { background: #eff6ff; color: #1d4ed8; border-color: #60a5fa; }
.doc-btn[data-doctype="delivery"].active     { background: #fefce8; color: #854d0e; border-color: #facc15; }
.doc-btn[data-doctype="invoice"].active      { background: #f5f3ff; color: #6d28d9; border-color: #a78bfa; }

/* Split-Button (Dropdown für Sprachvarianten) */
.doc-btn-split {
    display: inline-flex;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #fff;
    overflow: hidden;
}

.doc-btn-split .doc-btn {
    border: none;
    border-radius: 0;
}

.doc-btn-split .doc-btn-toggle {
    border-left: 1px solid #e2e8f0;
    width: 18px;
    color: #94a3b8;
}

.doc-btn-split:hover {
    border-color: #cbd5e1;
}

.doc-btn-split.active {
    border-color: #34d399;
    background: #ecfdf5;
}

.doc-btn-split.active .doc-btn { background: transparent; color: #047857; }
.doc-btn-split.active .doc-btn-toggle { border-left-color: #6ee7b7; color: #047857; }

/* Workflow-Schutz Dialog (Bootstrap-Modal) - hervorgehobener Hinweis-Kasten */
.workflow-warning-box {
    background: #fef3c7;
    border-left: 3px solid #f59e0b;
    padding: 8px 12px;
    margin: 12px 0;
    border-radius: 4px;
    text-align: left;
    font-size: 0.85rem;
    color: #92400e;
}

/* Workflow-Dialog: kompaktere ul-Listen im Modal-Body */
#workflowDialogModal .modal-body ul {
    margin: 8px 0;
    padding-left: 20px;
}
#workflowDialogModal .modal-body ul li { margin-bottom: 4px; }
#workflowDialogModal .modal-body p { margin-bottom: 0.6rem; }
#workflowDialogModal .modal-body p:last-child { margin-bottom: 0; }

/* === Dokumenten-Verwaltung Modal === */
#documentManagerModal .table tbody tr.text-muted,
#detailDocMgrModal .table tbody tr.text-muted {
    background-color: rgba(0,0,0,0.02);
}
#documentManagerModal .table tbody tr.text-muted td,
#detailDocMgrModal .table tbody tr.text-muted td {
    opacity: 0.7;
}

/* === Undo-Toast Container === */
#undoToastContainer .toast {
    min-width: 360px;
}
#undoToastContainer .toast a.text-white:hover {
    opacity: 0.85;
}

/* === Status-Badge clickable Indicator (offer_detail) === */
.status-badge[onclick] {
    transition: opacity 0.15s ease;
}
.status-badge[onclick]:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* === Mahnwesen-Abschnitt in Action-Bar === */
.doc-action-separator {
    display: inline-block;
    width: 1px;
    height: 22px;
    background: #cbd5e1;
    margin: 0 6px;
}

/* Mahnungs- und Inkasso-Buttons: dezent abgesetzter Farbton */
.doc-btn-split[data-doctype="reminder1"] .doc-btn,
.doc-btn-split[data-doctype="reminder2"] .doc-btn,
.doc-btn-split[data-doctype="reminder3"] .doc-btn,
.doc-btn-split[data-doctype="collection"] .doc-btn {
    color: #b45309;
}
.doc-btn-split[data-doctype="reminder1"].active .doc-btn,
.doc-btn-split[data-doctype="reminder2"].active .doc-btn,
.doc-btn-split[data-doctype="reminder3"].active .doc-btn,
.doc-btn-split[data-doctype="collection"].active .doc-btn {
    background: #fef3c7;
    border-color: #f59e0b;
    color: #92400e;
}
.doc-btn-split[data-doctype="collection"] .doc-btn {
    color: #b91c1c;
}
.doc-btn-split[data-doctype="collection"].active .doc-btn {
    background: #fee2e2;
    border-color: #ef4444;
    color: #7f1d1d;
}

/* ============================================================
   Offers-Table: Actions-Spalte rechts fixiert + Schatten
   Bei horizontalem Scrollen bleibt die Action-Spalte sichtbar.
   ============================================================ */
#offersTable th.actions-cell,
#offersTable td.actions-cell {
    position: sticky;
    right: 0;
    background: #fff;
    z-index: 2;
    box-shadow: -4px 0 8px -3px rgba(0,0,0,0.08);
}
/* Hover-Background auch in der fixierten Spalte korrekt anzeigen */
#offersTable tbody tr:hover td.actions-cell {
    background: #f8fafc;
}

/* "Dokumente"-Spalte: nowrap, damit Buttons nicht umbrechen */
#offersTable .doc-action-bar {
    flex-wrap: nowrap;
    white-space: nowrap;
}

/* Activity-Spalte: schmal (zeigt meist "—" oder kleines Badge) */
#offersTable th.text-center .bi-activity,
#offersTable th.text-center .bi-heart {
    /* leave alone — Heading mit Icon */
}

/* ============================================================
   Sidebar: Desktop-Collapse zu schmaler Icon-Bar
   ============================================================ */
:root {
    --sidebar-icon-width: 64px;
}
/* Desktop-Toggle in der Topbar (mobile nutzt 'sidebar-toggle' weiterhin) */
.sidebar-collapse-toggle {
    color: var(--text-muted, #6c757d);
    padding: 0 8px;
    font-size: 1.2rem;
    text-decoration: none;
    transition: color 0.15s ease;
}
.sidebar-collapse-toggle:hover { color: var(--text, #0d6efd); }

/* Sidebar im collapsed-State: nur Icons sichtbar, Labels & Section-Labels weg */
@media (min-width: 992px) {
    body.sidebar-collapsed .sidebar {
        width: var(--sidebar-icon-width);
    }
    /* Texte verstecken — die Sidebar-Links nutzen einfach <span> direkt im <a> */
    body.sidebar-collapsed .sidebar-brand-text,
    body.sidebar-collapsed .sidebar-link > span,
    body.sidebar-collapsed .sidebar-divider > span,
    body.sidebar-collapsed .sidebar-user-info,
    body.sidebar-collapsed .sidebar-link .badge,
    body.sidebar-collapsed .sidebar-footer-section {
        display: none !important;
    }
    /* Icon-Bar Layout: Icons zentriert, ohne Text-Padding */
    body.sidebar-collapsed .sidebar-link {
        justify-content: center;
        padding: 12px 0;
        gap: 0;
    }
    body.sidebar-collapsed .sidebar-link i {
        margin-right: 0 !important;
        font-size: 1.25rem;
    }
    /* Divider wird zu einer dünnen Linie */
    body.sidebar-collapsed .sidebar-divider {
        height: 1px;
        padding: 0;
        margin: 8px 12px;
        background: rgba(255,255,255,0.08);
        overflow: hidden;
    }
    /* Brand: nur Icon, zentriert */
    body.sidebar-collapsed .sidebar-brand {
        justify-content: center;
        width: 100%;
        gap: 0;
    }
    body.sidebar-collapsed .sidebar-header {
        padding: 16px 8px;
        justify-content: center;
    }
    /* Main-content shiftet entsprechend */
    body.sidebar-collapsed .main-content {
        margin-left: var(--sidebar-icon-width);
    }
    /* Tooltip-ähnlicher Hover-Effekt: Label rechts neben Icon einblenden */
    body.sidebar-collapsed .sidebar-link {
        position: relative;
    }
    body.sidebar-collapsed .sidebar-link:hover::after {
        content: attr(data-label);
        position: absolute;
        left: 100%;
        top: 50%;
        transform: translateY(-50%);
        background: #0f172a;
        color: white;
        padding: 6px 12px;
        border-radius: 6px;
        font-size: 0.85rem;
        white-space: nowrap;
        margin-left: 8px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.2);
        pointer-events: none;
        z-index: 1100;
    }
    /* Sidebar-User unten: nur Avatar, zentriert */
    body.sidebar-collapsed .sidebar-user {
        justify-content: center;
        padding: 12px 8px;
    }
    body.sidebar-collapsed .sidebar-user-avatar {
        margin-right: 0;
    }
    body.sidebar-collapsed .sidebar-footer {
        padding: 8px 4px;
    }
    /* Sanfter Übergang */
    .sidebar { transition: width 0.25s ease, transform 0.3s ease; }
    .main-content { transition: margin-left 0.25s ease; }

    /* Scrollbar im collapsed-Mode visuell verstecken — frisst sonst Platz
       in der 64px-schmalen Sidebar. Scrolling per Mausrad bleibt erhalten. */
    body.sidebar-collapsed .sidebar-nav {
        scrollbar-width: none;        /* Firefox */
        -ms-overflow-style: none;     /* IE / alte Edge */
    }
    body.sidebar-collapsed .sidebar-nav::-webkit-scrollbar {
        width: 0;
        height: 0;
        display: none;                /* Chrome / Safari / neue Edge */
    }
}

/* ============================================================
   Offers-Page: Karten-Layout (löst Tabelle ab)
   Alle Action-Buttons direkt sichtbar mit flex-wrap, KEIN
   horizontales Scrollen mehr.
   ============================================================ */
.offers-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.offer-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    transition: all 0.15s ease;
    /* overflow: hidden ENTFERNT — würde Dropdowns abschneiden.
       Die border-left-Indikatoren funktionieren auch ohne overflow. */
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
    position: relative;
}
/* Wenn ein Dropdown in der Karte geöffnet ist, Karte über andere heben */
.offer-card:has(.dropdown-menu.show),
.offer-card:focus-within {
    z-index: 10;
}
.offer-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}
.offer-card.is-cancelled { opacity: 0.7; background: #fafafa; }
.offer-card.is-won   { border-left: 3px solid #16a34a; }
.offer-card.is-lost  { border-left: 3px solid #dc2626; opacity: 0.75; }
.offer-card.is-paid  { border-left: 3px solid #0284c7; }

/* === Card Header: Daten === */
.offer-card-header {
    padding: 14px 16px;
    display: grid;
    grid-template-columns: auto auto 1fr auto auto;
    gap: 16px;
    align-items: center;
}
.offer-card-edit {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #2563eb;
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 1rem;
    transition: background 0.15s;
}
.offer-card-edit:hover { background: #1d4ed8; color: white; }

.offer-card-no {
    font-family: ui-monospace, "SF Mono", monospace;
    font-size: 0.95rem;
    font-weight: 600;
    color: #0f172a;
    white-space: nowrap;
}
.offer-card-info {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.offer-card-company {
    font-size: 1rem;
    font-weight: 600;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.offer-card-positions {
    font-size: 0.8rem;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.offer-card-meta {
    font-size: 0.75rem;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 2px;
}
.offer-card-meta .sep { color: #cbd5e1; }
.offer-card-meta .api-badge {
    background: #f1f5f9;
    color: #475569;
    border-radius: 4px;
    padding: 1px 6px;
    font-family: ui-monospace, monospace;
}
.offer-card-meta .kdnr {
    font-family: ui-monospace, monospace;
}

/* Status-Cluster (Win + Pay) */
.offer-status-cluster {
    display: inline-flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-end;
}
.offer-status-row {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
}
.offer-status-row .badge {
    font-size: 0.7rem;
    padding: 2px 7px;
    font-weight: 500;
}
.offer-status-label {
    font-size: 0.65rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 500;
    min-width: 50px;
    text-align: right;
}

.offer-card-amount {
    font-family: ui-monospace, "SF Mono", monospace;
    font-size: 1.1rem;
    font-weight: 600;
    color: #0f172a;
    text-align: right;
    white-space: nowrap;
}
.offer-card-amount.zero { color: #94a3b8; font-weight: 400; }

/* === Card Body: Action-Bar mit flex-wrap === */
.offer-card-actions {
    padding: 10px 16px 12px;
    border-top: 1px solid #f1f5f9;
    background: #fafbfc;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    position: relative;
    /* overflow nicht setzen — Dropdowns müssen rausragen können */
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
}
/* Bootstrap-Dropdown-Menüs immer voll sichtbar (über andere Karten) */
.offer-card-actions .dropdown-menu {
    z-index: 1050;
    min-width: 220px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    border: 1px solid #e2e8f0;
}
/* Like-Grund-Filtermenü in der Angebote-Toolbar über die fixierte Sidebar
   (z-index 1040) heben — es öffnet linksbündig (dropdown-menu-end) und ragt
   sonst unter die Sidebar, wo es dahinter verschwindet. Bleibt unter Modals
   (1055) und Toasts (2000). */
#filterLikedReasonMenu {
    z-index: 1050;
}
.offer-card-actions .doc-btn,
.offer-card-actions .btn-group {
    position: relative;
}
.offer-card-actions .doc-action-bar {
    display: contents;  /* Children flow direkt in den parent flex-Container */
}
.offer-action-separator {
    width: 1px;
    align-self: stretch;
    background: #e2e8f0;
    margin: 0 4px;
}
/* Quick-Action-Buttons (Won/Lost/Copy/Trash) */
.offer-quick-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: #fff;
    border: 1px solid #e2e8f0;
    color: #64748b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.12s ease;
    font-size: 0.95rem;
    padding: 0;
}
.offer-quick-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}
.offer-quick-btn.won:hover { background: #16a34a; color: white; border-color: #16a34a; }
.offer-quick-btn.lost:hover { background: #dc2626; color: white; border-color: #dc2626; }
.offer-quick-btn.copy:hover { background: #2563eb; color: white; border-color: #2563eb; }
.offer-quick-btn.delete:hover { background: #dc2626; color: white; border-color: #dc2626; }
.offer-quick-btn.detail:hover { background: #0f172a; color: white; border-color: #0f172a; }
.offer-quick-btn.won-active   { background: #dcfce7; color: #16a34a; border-color: #86efac; }
.offer-quick-btn.lost-active  { background: #fee2e2; color: #dc2626; border-color: #fca5a5; }

/* Action-Bar: Hover-Effekt für die Karte */
.offer-card:hover .offer-card-actions {
    background: #f1f5f9;
}

/* Responsive: bei schmalem Bildschirm Header neu anordnen */
@media (max-width: 992px) {
    .offer-card-header {
        grid-template-columns: auto 1fr auto;
    }
    .offer-card-no { grid-column: 2; }
    .offer-card-info { grid-column: 1 / -1; order: 3; }
    .offer-status-cluster { grid-column: 1 / 2; order: 4; align-items: flex-start; }
    .offer-card-amount { grid-column: 3; }
}

/* Drucken/PDF-Vorschau: Action-Bar ausblenden */
@media print {
    .offer-card-actions { display: none !important; }
}

/* === Activity / Tasks / Last-Activity Counter pro Karte === */
.offer-card-counters {
    margin-top: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}
.offer-counter {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 500;
    background: #f1f5f9;
    color: #64748b;
    cursor: default;
    transition: all 0.12s ease;
}
.offer-counter i { font-size: 0.78rem; }
.offer-counter.activities { background: #dbeafe; color: #2563eb; }
.offer-counter.tasks { background: #fef3c7; color: #b45309; }
.offer-counter.time {
    background: transparent;
    color: #94a3b8;
    font-weight: 400;
    font-style: italic;
    padding: 2px 4px;
}

/* offer-card-no soll jetzt 2 Zeilen unterbringen (Nr + Status-Badge) */
.offer-card-no {
    align-self: flex-start;
    padding-top: 4px;
}

/* Übersicht: zuletzt geöffnetes Angebot beim Zurückkommen kurz hervorheben */
.offer-card-highlight {
    animation: offerCardPulse 2.2s ease-out;
}
@keyframes offerCardPulse {
    0%   { box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.55); }
    70%  { box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.35); }
    100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}

/* ============================================================
   DataTables in Karten ohne Innenabstand (.crm-card-body.p-0.crm-dt)
   Laenge / Info / Blaettern als Footer mit Abstand zum Kartenrand.
   Opt-in ueber die Klasse .crm-dt — andere Tabellen bleiben unveraendert.
   ============================================================ */
.crm-dt .dataTables_wrapper {
    padding: 0;
}

.crm-dt .crm-dt-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px 16px;
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.crm-dt .crm-dt-footer .dataTables_length,
.crm-dt .crm-dt-footer .dataTables_info,
.crm-dt .crm-dt-footer .dataTables_paginate {
    float: none;
    padding: 0;
    margin: 0;
    color: var(--text-secondary);
}

.crm-dt .crm-dt-footer .dataTables_info {
    margin-right: auto;
}

.crm-dt .crm-dt-footer .dataTables_length select {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 3px 24px 3px 8px;
    margin: 0 4px 0 0;
    background-color: #fff;
    font-size: 0.82rem;
}

.crm-dt .crm-dt-footer .dataTables_paginate .paginate_button {
    border-radius: var(--radius-sm) !important;
    padding: 4px 10px !important;
    margin-left: 2px;
    border: 1px solid transparent !important;
    color: var(--text-secondary) !important;
    background: none !important;
}

.crm-dt .crm-dt-footer .dataTables_paginate .paginate_button:hover:not(.disabled) {
    background: var(--primary-light) !important;
    border-color: transparent !important;
    color: var(--primary) !important;
}

.crm-dt .crm-dt-footer .dataTables_paginate .paginate_button.current,
.crm-dt .crm-dt-footer .dataTables_paginate .paginate_button.current:hover {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #fff !important;
}

.crm-dt .crm-dt-footer .dataTables_paginate .paginate_button.disabled {
    opacity: 0.4;
}

.crm-dt table.dataTable thead th {
    padding-left: 12px;
}

.crm-dt table.dataTable tbody td:first-child,
.crm-dt table.dataTable thead th:first-child {
    padding-left: 20px;
}

/* Suchfeld mit Icon in der Kartenkopfzeile (Kundenliste) */
.kd-search {
    position: relative;
    display: flex;
    align-items: center;
}

.kd-search i {
    position: absolute;
    left: 10px;
    color: var(--text-muted);
    font-size: 0.8rem;
    pointer-events: none;
}

.kd-search input {
    padding-left: 30px;
    width: 260px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

@media (max-width: 576px) {
    .kd-search,
    .kd-search input {
        width: 100%;
    }
}
