/* 2doIT PWA - Mobile-First CSS (rewrite 2026-02-09)
   Scanner viewport: 320×405 CSS-px. Mobile-first, desktop scales up. */

/* === VARIABLES === */
:root {
    --c-primary: #3D65D7;
    --c-primary-dark: #2B4BA8;
    --c-success: #2D9D4D;
    --c-danger: #DD2D2D;
    --c-warning: #F0A500;
    --c-info: #00A3E9;
    --c-text: #1A2838;
    --c-text-light: #64748b;
    --c-text-muted: #94a3b8;
    --c-border: #E0E4EA;
    --c-bg: #F8FAFB;
    --c-card: #FFFFFF;
    --c-white: #fff;
    --c-accent: #EDF2FF;
    --g-primary: linear-gradient(135deg, #3D65D7 0%, #2B4BA8 100%);
    --g-success: linear-gradient(135deg, #2D9D4D 0%, #1F7A38 100%);
    --g-danger: linear-gradient(135deg, #DD2D2D 0%, #B91C1C 100%);
    --g-warning: linear-gradient(135deg, #F0A500 0%, #D49000 100%);
    --g-info: linear-gradient(135deg, #00A3E9 0%, #0086C5 100%);
    --g-dark: linear-gradient(135deg, #2B4BA8 0%, #1E3477 100%);
    --radius: 0.5rem;
    --radius-lg: 0.75rem;
    --shadow: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.1);
    --font: 'Inter', system-ui, -apple-system, sans-serif;
}

/* === RESET === */
* { -webkit-tap-highlight-color: transparent; box-sizing: border-box; }
body { font-family: var(--font); background: var(--g-primary); min-height: 100vh; margin: 0; padding: 0; font-size: 14px; color: var(--c-text); }

/* === GLOBAL FORM ELEMENTS (mobile-first, single source of truth) === */
input[type="text"], input[type="number"], input[type="email"],
input[type="password"], input[type="search"], input[type="tel"],
input[type="url"], input[type="date"], select, textarea,
.form-control, .form-select, .form-control-sm, .form-select-sm,
.form-control-lg, .form-select-lg,
.scan-input, .warehouse-select, .location-select {
    font-family: var(--font);
    font-size: 14px;
    padding: 8px 10px;
    min-height: 38px;
    height: auto;
    color: var(--c-text);
    border: 1.5px solid var(--c-border);
    border-radius: var(--radius);
    background-color: var(--c-white);
    box-shadow: none;
    outline: none;
    line-height: 1.4;
    width: 100%;
    appearance: none;
    -webkit-appearance: none;
    transition: border-color 0.2s;
}
input:focus, select:focus, textarea:focus,
.form-control:focus, .form-select:focus, .scan-input:focus {
    border-color: var(--c-primary);
    box-shadow: 0 0 0 2px rgba(0,124,186,0.15);
    outline: none;
}
input::placeholder, textarea::placeholder { color: var(--c-text-muted); opacity: 1; }

/* Select dropdown arrow */
select, .form-select, .form-select-sm, .warehouse-select, .location-select {
    padding-right: 32px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236b7280' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
}
/* Select placeholder color via JS class */
select.placeholder-shown, .form-select.placeholder-shown { color: var(--c-text-muted); }
select.value-selected, .form-select.value-selected { color: var(--c-text); }
select option, .form-select option { color: var(--c-text); }

/* Input groups (antal + stk) */
.input-group { display: flex; }
.input-group .form-control, .input-group input {
    border-top-right-radius: 0; border-bottom-right-radius: 0; border-right: none;
}
.input-group .input-group-text {
    font-family: var(--font); font-size: 14px; font-weight: 600;
    color: var(--c-primary); padding: 8px 10px; background: var(--c-white);
    border: 1.5px solid var(--c-border); border-left: none;
    border-top-left-radius: 0; border-bottom-left-radius: 0;
    border-top-right-radius: var(--radius); border-bottom-right-radius: var(--radius);
    display: flex; align-items: center;
}

/* Labels */
label, .form-label, .field-label {
    font-size: 13px; font-weight: 600; color: #1f2937;
    margin-bottom: 3px; display: flex; align-items: center; gap: 4px;
}
label i, .form-label i, .field-label i { font-size: 14px; color: var(--c-primary); }

/* === PRIMARY ACTION BUTTONS (all pages) === */
.btn-add-inventory, .btn-transfer, .btn-add-project, .btn-add-count, .btn-add-line,
.btn-add-to-order, .btn-create-sales-order, .btn-create-purchase-order,
.btn-start-count,
.d-grid .btn, .d-grid .btn-primary, .d-grid button[type="submit"] {
    background: var(--g-primary); border: none; color: var(--c-white);
    padding: 12px 16px; font-size: 14px; font-weight: 600;
    border-radius: var(--radius); width: 100%;
    display: flex; align-items: center; justify-content: center; gap: 6px;
    box-shadow: 0 2px 8px rgba(0,124,186,0.25);
    cursor: pointer; transition: opacity 0.2s;
    font-family: var(--font); text-decoration: none;
}
.btn-add-inventory:hover, .btn-transfer:hover, .btn-add-project:hover, .btn-add-count:hover,
.btn-add-line:hover, .btn-add-to-order:hover,
.btn-create-sales-order:hover, .btn-create-purchase-order:hover,
.btn-start-count:hover { opacity: 0.9; }

/* Secondary/danger buttons */
.btn-clear-lines {
    background: var(--c-white); border: 2px solid #fecaca; color: #dc2626;
    padding: 10px 16px; font-size: 14px; font-weight: 600;
    border-radius: var(--radius); width: 100%; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-clear-lines:hover { background: #fef2f2; }

/* Bootstrap btn overrides */
.btn { font-family: var(--font); font-size: 14px; border-radius: var(--radius); }
.btn-primary { background: var(--g-primary); border: none; }
.btn-success { background: var(--g-success); border: none; }
.btn-success:hover { background: linear-gradient(135deg, #059669 0%, #047857 100%); }
.receive-all-card .btn-primary { background: linear-gradient(135deg, #1976d2 0%, #1565c0 100%); border: none; font-weight: 600; }
.save-changes-card .btn-success { background: linear-gradient(135deg, #43a047 0%, #2e7d32 100%); border: none; font-weight: 600; }
.btn-outline-secondary { font-size: 14px; }

/* === LAYOUT CONTAINERS (all pages share same pattern) === */
.menu-container, .transfer-container, .project-container, .invcount-container,
.order-line-container, .sales-order-container, .purchase-order-container,
.historik-container, .goods-receipt-container, .goods-dispatch-container, .print-label-container,
.countlist-container {
    max-width: 500px; margin: 0 auto; padding: 8px;
}

/* White cards */
.card, .transfer-form-card, .project-form-card, .invcount-form-card, .order-line-form-card,
.customer-form-card, .add-item-form-card, .order-lines-card,
.receipt-card, .dispatch-card, .label-card, .scans-table-card, .order-lines-table-card,
.countlist-form-card {
    background: var(--c-white); border-radius: var(--radius-lg);
    box-shadow: var(--shadow); margin-bottom: 10px; overflow: hidden;
}
.transfer-form-card, .project-form-card, .invcount-form-card, .order-line-form-card,
.customer-form-card, .add-item-form-card, .order-lines-card,
.countlist-form-card { padding: 12px; }
.scans-table-card, .order-lines-table-card { padding: 10px; }

/* Card headers (GoodsReceipt, GoodsDispatch, PrintLabel) */
.receipt-card .card-header, .dispatch-card .card-header, .label-card .card-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 8px 12px; font-weight: 600; font-size: 14px;
    border-bottom: 1px solid #dee2e6;
}
.receipt-card .card-body, .dispatch-card .card-body, .label-card .card-body { padding: 10px 12px; }

/* === INFO BOXES (item info, customer info, stock info) === */
.item-info-box, .customer-info-box {
    background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
    border: 1.5px solid #e5e7eb; border-radius: var(--radius);
    padding: 8px; margin-top: 6px;
}
.info-row { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; font-size: 13px; }
.info-row:last-child { margin-bottom: 0; }
.item-info-box i, .customer-info-box i { color: var(--c-primary); font-size: 14px; }
.item-info-box span, .customer-info-box span { color: var(--c-text); font-weight: 500; }

.stock-info-section {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border: 1.5px solid #93c5fd; border-radius: var(--radius); padding: 8px; margin-top: 6px;
}
.stock-info-section .stock-title { color: #1e40af; font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 4px; margin-bottom: 4px; }
.stock-info-section .stock-item { color: #1e40af; font-size: 13px; padding: 2px 0; }

/* Klikbare stock-matrix rækker */
.stock-row-clickable {
    cursor: pointer;
    transition: background-color 0.15s ease;
}
.stock-row-clickable:hover {
    background-color: rgba(59, 130, 246, 0.15) !important;
}
.stock-row-clickable:active {
    background-color: rgba(59, 130, 246, 0.25) !important;
}

/* === EMPTY STATE === */
.empty-state-box {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border: 2px dashed #93c5fd; border-radius: var(--radius-lg);
    padding: 24px 16px; text-align: center;
}
.empty-state-box i { font-size: 2.5rem; color: #3b82f6; opacity: 0.5; margin-bottom: 8px; display: block; }
.empty-state-box p { color: #1e40af; font-weight: 500; margin: 0; font-size: 13px; }

/* === PAGE TITLE (Settings, UserSettings, UserAdmin — white text on blue body) === */
.page-title {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 10px; padding: 6px 10px;
    background: rgba(255,255,255,0.1); border-radius: var(--radius);
}
.page-title h4, .page-title h5 { color: var(--c-white); margin: 0; }
.page-title small { color: rgba(255,255,255,0.75); }
.page-title .btn-outline-light { font-size: 13px; padding: 4px 10px; }

/* === SECTION HEADERS (Index, ProjectScan, AddOrderLine) === */
.section-header, .project-scans-header, .order-lines-header, .recent-scans-header {
    font-size: 15px; font-weight: 700; color: var(--c-white);
    margin: 12px 0 8px; padding: 6px 10px;
    display: flex; align-items: center; gap: 6px;
    background: rgba(255,255,255,0.1); border-radius: var(--radius);
}
.section-header i, .project-scans-header i, .order-lines-header i { font-size: 16px; }


/* === HISTORY LIST ITEMS (on blue background) === */
#historyList .list-group-item {
    background: rgba(255,255,255,0.12); color: var(--c-white);
    border: 1px solid rgba(255,255,255,0.15); border-radius: var(--radius);
    margin-bottom: 6px; padding: 10px 12px;
}
#historyList .list-group-item strong { color: var(--c-white); }
#historyList .list-group-item .text-muted { color: rgba(255,255,255,0.7) !important; }
#historyList .list-group-item .btn-outline-danger {
    color: #fca5a5; border-color: rgba(252,165,165,0.4);
}
#historyList .list-group-item .btn-outline-danger:hover {
    background: rgba(239,68,68,0.3); color: #fff; border-color: #ef4444;
}
#historyList .empty-state-box {
    background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.2);
}
#historyList .empty-state-box i { color: rgba(255,255,255,0.4); }
#historyList .empty-state-box p { color: rgba(255,255,255,0.7); }

/* === INDEX MENU CARDS === */
.card-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 8px; }
.card-grid.full-width { grid-template-columns: 1fr; }
.menu-card {
    background: var(--c-white); border-radius: var(--radius-lg);
    padding: 16px 8px; text-decoration: none; color: inherit;
    box-shadow: var(--shadow); display: flex; flex-direction: column;
    align-items: center; justify-content: center; min-height: 100px;
    position: relative; overflow: hidden; border: none; transition: transform 0.2s;
}
.menu-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.menu-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px;
    background: var(--card-gradient, var(--g-primary));
}
.menu-card.primary { --card-gradient: var(--g-primary); }
.menu-card.success { --card-gradient: var(--g-success); }
.menu-card.info { --card-gradient: var(--g-info); }
.menu-card.warning { --card-gradient: var(--g-warning); }
.menu-card.danger { --card-gradient: var(--g-danger); }
.menu-card.secondary { --card-gradient: linear-gradient(135deg, #6b7280 0%, #4b5563 100%); }
.menu-card .icon {
    font-size: 2rem; margin-bottom: 6px;
    background: var(--card-gradient, var(--g-primary));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.menu-card h5 { font-size: 13px; font-weight: 600; margin: 0; text-align: center; color: #1f2937; }
.menu-card p { font-size: 11px; color: var(--c-text-light); margin: 4px 0 0; text-align: center; }
.badge-new {
    position: absolute; top: 6px; right: 6px;
    background: var(--g-danger); color: var(--c-white);
    padding: 2px 6px; border-radius: 10px; font-size: 10px; font-weight: 700;
}

/* === TABLES (ProjectScan, AddOrderLine, InventoryCount) === */
.scans-table, .order-lines-table, .table { font-size: 12px; margin: 0; }
.scans-table thead, .order-lines-table thead { background: #f8f9fa; }
.scans-table thead th, .order-lines-table thead th { border: none; color: var(--c-text); font-weight: 600; padding: 6px 4px; font-size: 11px; }
.scans-table tbody td, .order-lines-table tbody td { border-color: #f3f4f6; padding: 6px 4px; vertical-align: middle; }
.project-badge { font-size: 11px; font-weight: 600; color: var(--c-primary); }
.btn-delete {
    background: var(--c-white); border: 1.5px solid #fecaca; color: #dc2626;
    padding: 4px 8px; border-radius: var(--radius); cursor: pointer; font-size: 12px;
}
.btn-delete:hover { background: #fef2f2; }

/* === FAB MENU (burger menu — all screen sizes) === */
.badge-employee {
    background: rgba(255,255,255,0.2); color: var(--c-white);
    padding: 6px 10px; font-size: 13px; font-weight: 600;
    border-radius: 20px; border: 1.5px solid rgba(255,255,255,0.3);
    display: inline-flex; align-items: center; gap: 6px;
}
.badge-employee i { font-size: 14px; }
.fab-menu-toggle {
    position: fixed; top: 8px; right: 8px; z-index: 1100;
    width: 40px; height: 40px; border-radius: var(--radius);
    background: var(--g-dark); border: none; color: var(--c-white);
    font-size: 20px; cursor: pointer; display: flex;
    align-items: center; justify-content: center;
    box-shadow: var(--shadow-lg);
}
.fab-menu-toggle.hidden { display: none; }
.fab-menu-overlay {
    position: fixed; inset: 0; z-index: 1099;
    background: rgba(0,0,0,0.5); display: none;
}
.fab-menu-overlay.open { display: block; }
.fab-menu-panel {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 1100;
    background: var(--c-white); border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
    transform: translateY(100%); transition: transform 0.25s ease-out;
    max-height: 60vh; overflow-y: auto;
}
.fab-menu-panel.open { transform: translateY(0); }
.fab-menu-items { padding: 12px; }
.fab-menu-top-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.fab-menu-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px; font-size: 14px; font-weight: 500;
    color: var(--c-text); text-decoration: none;
    border-radius: var(--radius); border: none; background: none;
    width: 100%; cursor: pointer; font-family: var(--font);
}
.fab-menu-item:hover { background: var(--c-bg); }
.fab-menu-item i { font-size: 18px; color: var(--c-primary); width: 24px; text-align: center; }
.fab-menu-close {
    width: 36px; height: 36px; border-radius: var(--radius); border: none;
    background: var(--c-bg); color: var(--c-text-light); font-size: 16px;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.fab-menu-footer {
    border-top: 1px solid #e5e7eb; margin-top: 8px; padding-top: 8px;
    display: flex; justify-content: space-between; align-items: center;
}
.fab-menu-logout {
    background: var(--g-danger) !important; color: var(--c-white) !important;
    border-radius: var(--radius) !important; padding: 8px 14px !important;
}
.fab-menu-logout i { color: var(--c-white) !important; }

/* === LOGIN PAGE === */
.login-container {
    width: 100%; max-width: 450px; padding: 4px; margin: 0 auto;
    display: flex; align-items: flex-start; justify-content: center;
    min-height: 100vh; padding-top: 4px;
}
.login-card {
    background: var(--c-white); border-radius: var(--radius-lg);
    padding: 12px; box-shadow: var(--shadow-lg); width: 100%;
}
.login-header {
    text-align: left; margin-bottom: 8px; display: flex;
    align-items: center; gap: 8px; padding: 4px 0;
}
.login-header .logo {
    width: 32px; height: 32px; min-width: 32px;
    background: var(--g-primary); border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    color: var(--c-white); font-size: 1rem;
}
.login-header-text { flex: 1; }
.login-header h1 {
    font-size: 1rem; font-weight: 700; margin: 0; line-height: 1.1;
    background: var(--g-primary); -webkit-background-clip: text;
    -webkit-text-fill-color: transparent; background-clip: text;
}
.login-header p { color: var(--c-text-light); font-size: 11px; margin: 0; }
.btn-login {
    background: var(--g-primary); border: none; color: var(--c-white);
    padding: 10px; font-size: 14px; font-weight: 600;
    border-radius: var(--radius); width: 100%; cursor: pointer;
}
.login-card .input-icon { position: relative; }
.login-card .input-icon i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--c-text-muted); font-size: 14px; }
.login-card .input-icon .form-control { padding-left: 32px; }
.login-card .mb-3 { margin-bottom: 8px !important; }
.login-card .mb-4 { margin-bottom: 10px !important; }
.login-card .alert { padding: 6px 10px; font-size: 12px; margin-bottom: 8px !important; }
.login-card .bg-light { padding: 8px !important; margin-bottom: 8px !important; }
.login-card .bg-light small { font-size: 11px; }
.login-card .text-center.mt-4 { margin-top: 8px !important; }
.login-card .text-center.mt-4 small { font-size: 11px; }
.login-card .form-check-input { width: 16px; height: 16px; }
.login-card .form-check-input:checked { background-color: var(--c-primary); border-color: var(--c-primary); }
.login-card .form-check-label { font-size: 12px; }

/* === UTILITIES === */
.loading-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    display: none; align-items: center; justify-content: center; z-index: 9999;
}
.loading-overlay.active { display: flex; }
.loading-overlay .spinner {
    width: 48px; height: 48px; border: 3px solid rgba(255,255,255,0.3);
    border-top-color: var(--c-white); border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

#offlineBanner {
    position: fixed; top: 0; left: 0; right: 0; z-index: 1080;
    display: none; background: var(--g-warning); color: var(--c-white);
    padding: 10px; text-align: center; font-weight: 600; font-size: 13px;
}

.alert { border-radius: var(--radius); border: none; font-size: 13px; padding: 8px 10px; }
.alert-danger { background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%); color: #991b1b; }
.alert-success { background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%); color: #065f46; }
.alert-info { background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%); color: #1e40af; }
#statusAlert.alert-success { background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%); border: 1px solid #81c784; color: #2e7d32; }
#statusAlert.alert-danger { background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%); border: 1px solid #e57373; color: #c62828; }
#statusAlert.alert-info { background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%); border: 1px solid #64b5f6; color: #1565c0; }

/* === GOODS RECEIPT SPECIFIC === */
.order-header-card {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    padding: 10px 12px;
}
.order-header-card h5 { font-size: 14px; color: #1565c0; margin-bottom: 4px; }
.scan-card .card-header { background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%); color: #2e7d32; }
.scanned-item-box {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border: 1px solid #64b5f6; border-radius: var(--radius-lg);
    padding: 8px; margin-top: 8px; animation: fadeIn 0.2s ease-out;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }
.scanned-item-box .item-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.scanned-item-box #scannedItemName { font-weight: 600; font-size: 13px; color: #1565c0; }
.scanned-item-box .item-number-badge { background: #1565c0; color: var(--c-white); padding: 2px 6px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.scanned-item-box .item-details { display: flex; flex-wrap: wrap; gap: 8px; font-size: 12px; color: #37474f; }
.scanned-item-box .detail-item { display: flex; align-items: center; gap: 4px; }
.scanned-item-box .detail-item i { color: #1976d2; font-size: 13px; }

.warehouse-location-row { display: flex; gap: 8px; margin-top: 8px; padding: 8px; background: #f5f5f5; border-radius: var(--radius); border: 1px solid #e0e0e0; }
.warehouse-field, .location-field { flex: 1; }

.serial-batch-row { margin-top: 8px; padding: 8px; background: linear-gradient(135deg, #fce4ec 0%, #f8bbd0 100%); border-radius: var(--radius); border: 1px solid #f48fb1; }
.serial-batch-row .field-label { color: #880e4f; }

.sb-input-group { display: flex; gap: 6px; align-items: stretch; }
.sb-input-group .form-control { flex: 1; min-width: 0; }
.sb-input-group .sb-browse-btn { flex-shrink: 0; padding: 0 12px; }

.order-line-card { padding: 8px 10px; border-bottom: 1px solid #eee; }
.order-line-card:last-child { border-bottom: none; }
.order-line-card.fully-received, .order-line-card.fully-dispatched { background: #e8f5e9; opacity: 0.7; }
.order-line-card.hidden-line { display: none; }
.order-line-card .item-name { font-weight: 600; font-size: 13px; color: #333; }
.order-line-card .item-number { font-size: 11px; color: #666; }
.order-line-card .qty-info { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; }
.order-line-card .qty-badge { font-size: 12px; padding: 2px 6px; border-radius: 4px; }
.qty-remaining { background: #fff3e0; color: #e65100; }
.qty-received { background: #e8f5e9; color: #2e7d32; }
.qty-done { background: #c8e6c9; color: #1b5e20; }
.btn-receive-line, .btn-undo-line { padding: 3px 6px; font-size: 11px; }
.btn-group-line { display: flex; gap: 4px; align-items: center; }

.order-results { border-top: 1px solid #dee2e6; padding-top: 8px; }
.results-header { font-size: 12px; color: var(--c-text-light); margin-bottom: 6px; }
.order-result-item { padding: 8px; border: 1px solid #dee2e6; border-radius: var(--radius); margin-bottom: 6px; cursor: pointer; }
.order-result-item:hover { background: #e3f2fd; border-color: #2196f3; }
.order-result-item .order-num { font-weight: 600; color: #1565c0; font-size: 13px; }
.order-result-item .creditor { font-size: 12px; color: #666; }
.order-result-item .progress-info { font-size: 11px; color: #888; }

/* Order list (nyt layout til varemodtagelse) */
.orders-list { max-height: 60vh; overflow-y: auto; }
.order-list-item { padding: 10px 12px; border: 1px solid #dee2e6; border-radius: var(--radius); margin-bottom: 8px; cursor: pointer; background: var(--c-white); transition: all 0.2s; }
.order-list-item:hover { background: #e3f2fd; border-color: #2196f3; transform: translateY(-1px); box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.order-list-item.new { border-left: 4px solid #6c757d; }
.order-list-item.partial { border-left: 4px solid #ffc107; background: linear-gradient(90deg, #fffde7 0%, #fff 10%); }
.order-list-item.complete { border-left: 4px solid #4caf50; background: #e8f5e9; }
.order-list-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.order-list-item .order-num { font-weight: 700; font-size: 15px; color: #1565c0; }
.order-list-item .order-date { font-size: 11px; color: #888; }
.order-list-item .creditor { font-size: 13px; color: #333; margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.order-list-progress { display: flex; align-items: center; gap: 8px; }
.order-list-progress .progress { margin: 0; }
.order-list-progress .progress-text { font-size: 11px; color: #666; min-width: 60px; text-align: right; }

/* Complete receipt/dispatch section */
.complete-receipt-section, .complete-dispatch-section { margin-top: 12px; padding: 12px; background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%); border-radius: var(--radius); }

/* Serial number modal */
.serial-numbers-list { max-height: 200px; overflow-y: auto; background: #f8f9fa; border-radius: var(--radius); padding: 8px; margin-top: 8px; }
.serial-number-item { background: var(--c-white); padding: 6px 10px; border-radius: 4px; box-shadow: 0 1px 2px rgba(0,0,0,0.1); }
.serial-number-item .btn-remove-serial { padding: 2px 6px; }

/* Serial select modal (GoodsDispatch - vælg fra lager) */
.available-serials-list { max-height: 250px; overflow-y: auto; }
.available-serial-item { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; margin-bottom: 6px; background: #f8f9fa; border: 1px solid #dee2e6; border-radius: 6px; cursor: pointer; transition: all 0.15s; }
.available-serial-item:hover { background: #e9ecef; border-color: #adb5bd; }
.available-serial-item.selected { background: #d1e7dd; border-color: #198754; }
.available-serial-item .serial-info { flex: 1; }
.available-serial-item .serial-number { font-weight: 600; font-family: monospace; }
.available-serial-item .serial-location { font-size: 0.85em; color: #6c757d; }
.available-serial-item .serial-check { width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; border-radius: 50%; border: 2px solid #dee2e6; color: transparent; flex-shrink: 0; }
.available-serial-item.selected .serial-check { background: #198754; border-color: #198754; color: white; }
.selected-serials-list { display: flex; flex-wrap: wrap; gap: 6px; }
.selected-serial-tag { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; background: #198754; color: white; border-radius: 16px; font-size: 0.9em; }
.selected-serial-tag .remove-btn { cursor: pointer; opacity: 0.8; }
.selected-serial-tag .remove-btn:hover { opacity: 1; }
.no-serials-message { text-align: center; padding: 20px; color: #6c757d; }

/* Order line card clickable cursor */
.order-line-card:not(.fully-received):not(.fully-dispatched) { cursor: pointer; }
.order-line-card:not(.fully-received):not(.fully-dispatched):hover { background: #f5f5f5; }

.receive-all-card, .dispatch-all-card { padding: 10px 12px; background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%); }
.save-changes-section { position: fixed; bottom: 0; left: 0; right: 0; z-index: 1000; padding: 10px; background: linear-gradient(180deg, transparent 0%, rgba(255,255,255,0.95) 20%); }
.save-changes-card { max-width: 500px; margin: 0 auto; background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%); border: 2px solid #4caf50; border-radius: var(--radius-lg); padding: 10px 12px; box-shadow: 0 -4px 16px rgba(0,0,0,0.15); }
.locked-field { background-color: #f5f5f5 !important; opacity: 0.8; cursor: not-allowed; }
.lock-message { width: 100%; text-align: center; font-size: 11px; color: #e65100; margin-top: 4px; padding: 4px; background: #fff3e0; border-radius: 4px; }
.order-line-card.has-pending-changes { border-left: 4px solid #ff9800; background: linear-gradient(135deg, #fff8e1 0%, #ffecb3 100%); }

/* Registrerede serienumre på linjer */
.registered-serials { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.registered-serials small { margin-right: 2px; }
.serial-tag { display: inline-block; font-size: 11px; padding: 2px 6px; border-radius: 3px; font-family: monospace; }
.serial-tag.saved { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7; }
.serial-tag.pending { background: #fff3e0; color: #e65100; border: 1px solid #ffcc80; }

/* Gem nu knap sektion */
.save-now-section { margin-top: 12px; padding: 10px; background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%); border-radius: var(--radius); border: 1px solid #ff9800; }

/* === PRINT LABEL === */
.label-card .card-header.item-header-blue { background: linear-gradient(135deg, #1976d2 0%, #1565c0 100%); color: var(--c-white); }
.item-info-grid { display: flex; flex-direction: column; gap: 6px; }
.info-row.main-info { margin-bottom: 4px; }
.item-number-badge { background: #1565c0; color: var(--c-white); padding: 3px 6px; border-radius: 4px; font-size: 12px; font-weight: 600; }
.item-name { font-weight: 600; font-size: 14px; color: #333; }
.info-label { font-size: 12px; color: #666; min-width: 80px; }
.info-label i { color: #1976d2; margin-right: 4px; }
.info-value { font-size: 13px; color: #333; }
.search-results { position: absolute; left: 0; right: 0; background: var(--c-white); border: 1px solid #dee2e6; border-radius: 0 0 var(--radius) var(--radius); max-height: 200px; overflow-y: auto; z-index: 1000; box-shadow: var(--shadow-lg); }
.search-result-item { padding: 6px 10px; border-bottom: 1px solid #eee; cursor: pointer; }
.search-result-item:hover { background: #e3f2fd; }
.search-result-item:last-child { border-bottom: none; }
.search-result-item .result-item-no { font-weight: 600; color: #1565c0; font-size: 13px; }
.search-result-item .result-item-name { font-size: 12px; color: #666; }
.printer-status-card { background: #f8f9fa; border: 1px solid #dee2e6; border-radius: var(--radius); padding: 6px 10px; font-size: 12px; }
.printer-status-card.status-ok { background: #e8f5e9; border-color: #81c784; color: #2e7d32; }
.printer-status-card.status-error { background: #ffebee; border-color: #e57373; color: #c62828; }
.printer-status-card.status-warning { background: #fff3e0; border-color: #ffb74d; color: #e65100; }

/* === PURCHASE HISTORY === */
.historik-order-card { background: var(--c-white); border-radius: var(--radius-lg); box-shadow: var(--shadow); margin-bottom: 8px; padding: 12px; }
.historik-order-card .order-number { font-weight: 700; color: var(--c-primary); font-size: 14px; }
.historik-order-card .order-info { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.historik-order-card .order-info-item { font-size: 12px; color: var(--c-text-light); }
.btn-view-order { font-size: 13px; }
.historik-empty-state { text-align: center; padding: 32px 16px; color: var(--c-text-light); }

/* === ORDER BUILDER (CreateSalesOrder, CreatePurchaseOrder shared) === */
.line-count-badge {
    background: var(--c-primary); color: var(--c-white);
    padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; margin-left: 6px;
}

/* Order active banner (trin 2 header) */
.order-active-banner {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border: 2px solid #10b981; border-radius: var(--radius-lg);
    padding: 10px 12px; margin-bottom: 10px;
}
.order-banner-number { font-weight: 700; font-size: 15px; color: #065f46; }
.order-banner-party { font-size: 13px; color: #047857; margin-top: 2px; }

/* Order line cards (mobile-first, no tables) */
.order-line-item {
    background: var(--c-white); border-bottom: 1px solid #f3f4f6;
    padding: 8px 0;
}
.order-line-item:last-child { border-bottom: none; }
.order-line-top {
    display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 4px;
}
.order-line-itemno {
    font-weight: 700; font-size: 13px; color: var(--c-primary);
    background: #eff6ff; padding: 1px 6px; border-radius: 4px; margin-right: 6px;
}
.order-line-name { font-weight: 600; font-size: 13px; color: var(--c-text); }
.order-line-details {
    display: flex; flex-wrap: wrap; gap: 8px; font-size: 12px; color: var(--c-text-light); margin-top: 2px;
}
.order-line-serial { font-size: 11px; color: #880e4f; }
.order-line-serial i { margin-right: 3px; }

/* Add-lines link in order list cards */
.btn-add-lines-link {
    display: inline-flex; align-items: center; gap: 4px;
    background: var(--g-primary); color: var(--c-white);
    padding: 6px 12px; border-radius: var(--radius); font-size: 13px; font-weight: 600;
    text-decoration: none; transition: opacity 0.2s;
}
.btn-add-lines-link:hover { opacity: 0.9; color: var(--c-white); }

/* Finish order button */
.btn-finish-order {
    background: var(--g-success); border: none; color: var(--c-white);
    padding: 12px 16px; font-size: 14px; font-weight: 600;
    border-radius: var(--radius); width: 100%;
    display: flex; align-items: center; justify-content: center; gap: 6px;
    box-shadow: 0 2px 8px rgba(16,185,129,0.25);
    cursor: pointer; transition: opacity 0.2s;
    font-family: var(--font); text-decoration: none;
}
.btn-finish-order:hover { opacity: 0.9; color: var(--c-white); }

/* === USER SETTINGS === */
.usersettings-container { padding: 8px; }
.usersettings-title { display: none; }

/* === SPACING OVERRIDES FOR MOBILE === */
.mb-4 { margin-bottom: 10px !important; }
.mb-3 { margin-bottom: 8px !important; }
.py-4 { padding-top: 8px !important; padding-bottom: 8px !important; }
.container-fluid { padding-left: 8px; padding-right: 8px; }
small, .small, .text-muted { font-size: 12px !important; }

/* =========================================================
   DESKTOP OVERRIDES (≥481px)
   ========================================================= */
@media (min-width: 481px) {
    /* No top header on desktop either — FAB menu used everywhere */

    /* Bigger containers */
    .menu-container { max-width: 900px; padding: 16px; }
    .transfer-container, .project-container, .invcount-container, .order-line-container,
    .sales-order-container, .purchase-order-container, .historik-container,
    .countlist-container { max-width: 900px; padding: 16px; }
    .goods-receipt-container, .print-label-container { max-width: 600px; padding: 16px; }

    /* Larger form elements */
    input[type="text"], input[type="number"], input[type="email"],
    input[type="password"], input[type="search"], input[type="tel"],
    input[type="url"], input[type="date"], select, textarea,
    .form-control, .form-select, .scan-input, .warehouse-select, .location-select {
        font-size: 15px; padding: 10px 12px; min-height: 42px; border-radius: 10px;
    }
    select, .form-select, .warehouse-select, .location-select { padding-right: 36px; }
    .input-group .input-group-text { font-size: 15px; padding: 10px 12px; border-top-right-radius: 10px; border-bottom-right-radius: 10px; }
    label, .form-label, .field-label { font-size: 15px; margin-bottom: 6px; }
    label i, .form-label i { font-size: 16px; }

    /* Larger buttons */
    .btn-add-inventory, .btn-transfer, .btn-add-project, .btn-add-count, .btn-add-line,
    .btn-add-to-order, .btn-create-sales-order, .btn-create-purchase-order,
    .btn-start-count,
    .d-grid .btn, .d-grid .btn-primary, .d-grid button[type="submit"] {
        padding: 14px 24px; font-size: 16px; border-radius: 10px;
    }
    .btn { font-size: 15px; }

    /* Larger cards */
    .transfer-form-card, .project-form-card, .invcount-form-card, .order-line-form-card,
    .customer-form-card, .add-item-form-card, .order-lines-card,
    .countlist-form-card { padding: 24px; border-radius: 16px; }
    .card { border-radius: 16px; }

    /* Larger menu cards */
    .card-grid { gap: 16px; margin-bottom: 16px; }
    .menu-card { padding: 24px 16px; min-height: 150px; border-radius: 16px; }
    .menu-card .icon { font-size: 3rem; margin-bottom: 10px; }
    .menu-card h5 { font-size: 15px; }
    .menu-card p { font-size: 13px; }

    /* Section headers */
    .section-header, .project-scans-header, .order-lines-header, .recent-scans-header {
        font-size: 18px; margin: 24px 0 12px; padding: 8px 12px;
    }

    /* Tables */
    .scans-table, .order-lines-table, .table { font-size: 14px; }
    .scans-table thead th, .order-lines-table thead th { padding: 10px 8px; font-size: 13px; }
    .scans-table tbody td, .order-lines-table tbody td { padding: 8px; }

    /* Info boxes */
    .item-info-box, .customer-info-box { padding: 12px; }
    .info-row { font-size: 14px; gap: 8px; margin-bottom: 6px; }

    /* Spacing */
    .mb-4 { margin-bottom: 24px !important; }
    .mb-3 { margin-bottom: 16px !important; }
    .py-4 { padding-top: 24px !important; padding-bottom: 24px !important; }
    .container-fluid { padding-left: 16px; padding-right: 16px; }
    small, .small, .text-muted { font-size: 14px !important; }

    /* UserSettings */
    .usersettings-title { display: flex; }
    .usersettings-container { padding: 16px; }

    /* Empty state */
    .empty-state-box { padding: 40px 32px; }
    .empty-state-box i { font-size: 4rem; }
    .empty-state-box p { font-size: 15px; }

    /* Alerts */
    .alert { font-size: 14px; padding: 12px 16px; }

    /* Order line items */
    .order-line-item { padding: 10px 0; }
    .order-line-itemno { font-size: 14px; }
    .order-line-name { font-size: 14px; }
    .order-line-details { font-size: 13px; gap: 12px; }

    /* Order active banner */
    .order-active-banner { padding: 14px 16px; }
    .order-banner-number { font-size: 17px; }

    /* Add-lines link */
    .btn-add-lines-link { font-size: 14px; padding: 8px 16px; }

    /* Finish order button */
    .btn-finish-order { padding: 14px 24px; font-size: 16px; border-radius: 10px; }

    /* History cards */
    .historik-order-card { padding: 16px; }
    .historik-order-card .order-number { font-size: 16px; }
    .historik-order-card .order-info-item { font-size: 14px; }

    /* Field skip */
    .unlock-field-btn { font-size: 12px; padding: 8px 10px; }
}

/* === FIELD SKIP (smart tab-skip for default-felter) === */
.field-skip-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}
.field-skip-wrap > select,
.field-skip-wrap > input {
    flex: 1;
    min-width: 0;
}
.field-skipped {
    background-color: #f0fdf4 !important;
    border-left: 3px solid #10b981 !important;
    opacity: 0.85;
}
.unlock-field-btn {
    padding: 6px 8px;
    font-size: 11px;
    color: var(--c-primary);
    background: transparent;
    border: 1px dashed var(--c-border);
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-family: var(--font);
    white-space: nowrap;
    flex-shrink: 0;
}
.unlock-field-btn:hover {
    background: #eff6ff;
    border-color: var(--c-primary);
}

/* === jQuery UI Autocomplete === */
.ui-autocomplete { border-radius: var(--radius); max-height: 50vh; overflow-y: auto; box-shadow: var(--shadow-lg); z-index: 1200 !important; }
.ui-menu-item-wrapper { padding: 8px 10px; min-height: 36px; display: flex; align-items: center; font-size: 13px; line-height: 1.3; }
.ui-state-active { background: var(--c-primary) !important; border-color: var(--c-primary) !important; }
@media (min-width: 481px) {
    .ui-menu-item-wrapper { padding: 10px 12px; font-size: 14px; }
}

/* === PRINT (hide non-essential) === */
@media print { .fab-menu-toggle, .fab-menu-overlay, .fab-menu-panel, #offlineBanner { display: none !important; } }

/* ============================================
   COUNT LIST (cl- prefix scoped styles)
   ============================================ */

/* Phase 2 layout */
.cl-phase2 { padding: 0; }

/* Header */
.cl-sticky-header {
    background: #fff;
    border-bottom: 1px solid #dee2e6;
}

.cl-session-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0.75rem;
    background: #007CBA;
    color: #fff;
    font-size: 0.85rem;
}
.cl-session-info i { margin-right: 0.3rem; }
.cl-session-divider { margin: 0 0.4rem; opacity: 0.5; }

/* Scan area */
.cl-scan-area {
    padding: 0.5rem 0.75rem;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}
.cl-scan-row {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}
.cl-scan-input-wrap {
    flex: 1;
    position: relative;
}
.cl-scan-input-wrap .form-control {
    padding-left: 2.2rem;
    height: 42px;
}
.cl-scan-icon {
    position: absolute;
    left: 0.7rem;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    font-size: 1rem;
    z-index: 2;
}
.cl-scan-qty-wrap {
    width: 65px;
}
.cl-scan-qty-wrap .form-control {
    height: 42px;
    font-weight: 600;
}
.cl-scan-btn {
    height: 42px;
    width: 42px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.cl-scan-msg {
    margin-top: 0.3rem;
    font-size: 0.82rem;
}

/* Filter tabs */
.cl-tabs {
    display: flex;
    background: #fff;
    border-bottom: 2px solid #dee2e6;
    padding: 0 0.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.cl-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    padding: 0.6rem 0.5rem 0.5rem;
    border: none;
    background: transparent;
    color: #6c757d;
    font-size: 0.78rem;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all 0.15s;
    white-space: nowrap;
    min-width: 0;
    font-family: var(--font);
}
.cl-tab:hover { background: #f8f9fa; }
.cl-tab.active { color: #212529; font-weight: 600; }
.cl-tab-white.active { border-bottom-color: #6c757d; }
.cl-tab-green.active { border-bottom-color: #198754; color: #198754; }
.cl-tab-yellow.active { border-bottom-color: #cc9a06; color: #cc9a06; }
.cl-tab-red.active { border-bottom-color: #dc3545; color: #dc3545; }
.cl-tab-all.active { border-bottom-color: #007CBA; color: #007CBA; }
.cl-tab-count { font-weight: 700; font-size: 1.1rem; line-height: 1; }
.cl-tab-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.03em; }

/* Grid */
.cl-grid-wrap {
    background: #fff;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    overflow: hidden;
    margin: 0;
    padding: 0;
}
.cl-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.cl-table thead {
    position: sticky;
    top: 0;
    z-index: 1;
}
.cl-table th {
    background: #f1f3f5;
    padding: 0.45rem 0.5rem;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
}
.cl-th-check { width: 32px; text-align: center; }
.cl-th-item { }
.cl-th-qty { width: 60px; text-align: right; }
.cl-table td {
    padding: 0.4rem 0.5rem;
    vertical-align: middle;
    border-bottom: 1px solid #eee;
}
.cl-table tr { transition: background 0.1s; }

/* Status rows with left-border accent */
.cl-table tr.status-green { background: #e8f5e9; border-left: 3px solid #198754; }
.cl-table tr.status-green:hover { background: #c8e6c9; }
.cl-table tr.status-yellow { background: #fff8e1; border-left: 3px solid #ffc107; }
.cl-table tr.status-yellow:hover { background: #ffecb3; }
.cl-table tr.status-red { background: #ffebee; border-left: 3px solid #dc3545; }
.cl-table tr.status-red:hover { background: #ffcdd2; }
.cl-table tr.status-white { background: #fff; border-left: 3px solid #dee2e6; }
.cl-table tr.status-white:hover { background: #f5f5f5; }

/* Status dot indicator */
.cl-status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.4rem;
    flex-shrink: 0;
}
.cl-dot-green { background: #198754; }
.cl-dot-yellow { background: #ffc107; }
.cl-dot-red { background: #dc3545; }
.cl-dot-white { background: #adb5bd; }

.cl-item-info {
    display: flex;
    align-items: flex-start;
}
.cl-item-details {
    min-width: 0;
}
.cl-item-no {
    font-weight: 600;
    font-size: 0.85rem;
    color: #212529;
}
.cl-item-name {
    font-size: 0.8rem;
    color: #495057;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 250px;
}
.cl-item-loc, .cl-item-sb {
    font-size: 0.70rem;
    color: #0d6efd;
    line-height: 1.2;
}
.cl-item-loc i, .cl-item-sb i { font-size: 0.65rem; margin-right: 0.15rem; }

.cl-qty {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.cl-qty-zero { color: #adb5bd; }
.cl-qty-counted { color: #007CBA; }

/* Filter: hide rows */
.cl-filter-active tr.cl-filtered-out { display: none; }

/* Empty state */
.cl-empty-state {
    text-align: center;
    padding: 2rem 1rem;
    color: #adb5bd;
}
.cl-empty-state i { font-size: 2.5rem; display: block; margin-bottom: 0.5rem; }
.cl-empty-state p { margin: 0; }

/* Phase 3 */
.cl-phase3 {
    padding: 1rem 0.75rem;
    background: var(--c-white); border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.cl-phase3-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

/* Summary card */
.cl-summary-card {
    background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
}
.cl-summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}
.cl-summary-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: rgba(255,255,255,0.8);
    border-radius: 8px;
    font-size: 0.85rem;
}
.cl-summary-item i { font-size: 1.1rem; }
.cl-summary-num { font-weight: 700; font-size: 1.1rem; margin-right: 0.2rem; }

/* Review sections */
.cl-review-section {
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 0.75rem;
    border: 1px solid #dee2e6;
}
.cl-review-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0.75rem;
    font-size: 0.9rem;
}
.cl-review-yellow { background: #fff3cd; border-bottom: 1px solid #ffecb3; }
.cl-review-red { background: #f8d7da; border-bottom: 1px solid #f5c2c7; }
.cl-review-white { background: #e9ecef; border-bottom: 1px solid #dee2e6; }

.cl-review-body { max-height: 200px; overflow-y: auto; }

.cl-review-table {
    width: 100%;
    font-size: 0.82rem;
    border-collapse: collapse;
}
.cl-review-table th {
    background: #f8f9fa;
    padding: 0.3rem 0.6rem;
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #6c757d;
    border-bottom: 1px solid #dee2e6;
}
.cl-review-table td {
    padding: 0.35rem 0.6rem;
    border-bottom: 1px solid #f0f0f0;
}
.cl-review-actions {
    padding: 0.6rem 0.75rem;
    background: #f8f9fa;
    border-top: 1px solid #eee;
}

/* Post section */
.cl-post-section {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 2px solid #dee2e6;
}

/* Loading */
.cl-loading {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(255,255,255,0.85);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cl-loading-inner { text-align: center; }

/* Count List responsive: small mobile */
@media (max-width: 480px) {
    .cl-scan-input-wrap .form-control { height: 38px; font-size: 0.9rem; }
    .cl-scan-qty-wrap { width: 55px; }
    .cl-scan-qty-wrap .form-control { height: 38px; }
    .cl-scan-btn { height: 38px; width: 38px; }
    .cl-tab { font-size: 0.72rem; padding: 0.5rem 0.3rem 0.4rem; }
    .cl-tab-count { font-size: 0.95rem; }
    .cl-tab-label { font-size: 0.62rem; }
    .cl-table { font-size: 0.78rem; }
    .cl-table th { font-size: 0.68rem; padding: 0.3rem 0.35rem; }
    .cl-table td { padding: 0.3rem 0.35rem; }
    .cl-th-qty { width: 48px; }
    .cl-item-name { max-width: 160px; }
    .cl-session-bar { font-size: 0.78rem; padding: 0.3rem 0.5rem; }
    .cl-phase3 { padding: 0.5rem; }
    .cl-summary-grid { grid-template-columns: 1fr; }
}

@media (min-width: 481px) and (max-width: 767px) {
    .cl-item-name { max-width: 200px; }
}

@media (min-width: 768px) {
    .cl-item-name { max-width: 350px; }
    .cl-table { font-size: 0.9rem; }
}

/* ============================================
   CRM SAAS LAYOUT — FeltCRM Design System
   ============================================ */

.crm-body {
    background: var(--c-bg);
    min-height: 100vh;
    overflow-x: hidden;
    font-family: var(--font);
}

/* --- Topbar --- */
.crm-topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 56px;
    background: var(--c-card);
    color: var(--c-text);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    z-index: 1040;
    border-bottom: 1px solid var(--c-border);
}
.crm-topbar-left { display: flex; align-items: center; gap: 0.75rem; }
.crm-topbar-center { flex: 1; display: flex; justify-content: center; padding: 0 1rem; }
.crm-topbar-right { display: flex; align-items: center; gap: 0.75rem; }
.crm-topbar-brand {
    color: var(--c-text);
    text-decoration: none;
    font-weight: 700;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.crm-topbar-brand:hover { color: var(--c-primary); }
.crm-topbar-logo {
    width: 32px; height: 32px;
    border-radius: 8px;
    background: var(--c-primary);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.85rem; font-weight: 700;
}
.crm-topbar-search {
    position: relative;
    width: 280px;
    max-width: 100%;
}
.crm-topbar-search input {
    width: 100%;
    height: 36px;
    padding: 0 2.5rem 0 2.2rem;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    background: var(--c-bg);
    font-size: 0.85rem;
    color: var(--c-text);
    font-family: var(--font);
}
.crm-topbar-search input::placeholder { color: var(--c-text-muted); }
.crm-topbar-search input:focus { border-color: var(--c-primary); outline: none; box-shadow: 0 0 0 2px rgba(61,101,215,0.15); }
.crm-topbar-search .search-icon {
    position: absolute; left: 0.65rem; top: 50%; transform: translateY(-50%);
    color: var(--c-text-muted); font-size: 0.9rem; pointer-events: none;
}
.crm-topbar-search .search-shortcut {
    position: absolute; right: 0.65rem; top: 50%; transform: translateY(-50%);
    font-size: 0.7rem; color: var(--c-text-muted); background: var(--c-card);
    border: 1px solid var(--c-border); border-radius: 4px; padding: 1px 5px;
    pointer-events: none;
}
.crm-topbar-company {
    font-size: 0.8rem;
    color: var(--c-text-muted);
    font-weight: 500;
}
.crm-topbar-notification {
    position: relative;
    background: none; border: none; color: var(--c-text-light);
    font-size: 1.2rem; padding: 0.3rem; cursor: pointer;
    border-radius: var(--radius); display: flex; align-items: center;
}
.crm-topbar-notification:hover { color: var(--c-text); background: var(--c-bg); }
.crm-topbar-notification .notif-badge {
    position: absolute; top: 0; right: 0;
    width: 16px; height: 16px; border-radius: 50%;
    background: var(--c-danger); color: #fff;
    font-size: 0.6rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}
.crm-topbar-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--c-accent); color: var(--c-primary);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.75rem; font-weight: 700;
    cursor: pointer;
}
.crm-topbar-btn {
    background: none;
    border: none;
    color: var(--c-text-light);
    font-size: 1.1rem;
    padding: 0.3rem 0.5rem;
    cursor: pointer;
    border-radius: var(--radius);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}
.crm-topbar-btn:hover { color: var(--c-text); background: var(--c-bg); }
.crm-sidebar-toggle {
    background: none;
    border: none;
    color: var(--c-text);
    font-size: 1.3rem;
    padding: 0.2rem 0.4rem;
    cursor: pointer;
    border-radius: 4px;
    display: none;
}
.crm-sidebar-toggle:hover { background: var(--c-bg); }

/* --- Sidebar --- */
.crm-sidebar {
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 0;
    width: 220px;
    background: var(--c-card);
    border-right: 1px solid var(--c-border);
    overflow-y: auto;
    z-index: 1030;
    transition: transform 0.25s ease;
}
.crm-sidebar-nav {
    display: flex;
    flex-direction: column;
    padding: 0.75rem 0;
}
.crm-nav-group-label {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--c-text-muted);
    padding: 1rem 1.25rem 0.35rem;
}
.crm-nav-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.5rem 1.25rem;
    color: var(--c-text-light);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 0;
    transition: all 0.15s ease;
}
.crm-nav-item:hover {
    color: var(--c-text);
    background: var(--c-accent);
}
.crm-nav-item.active {
    color: var(--c-primary);
    background: var(--c-accent);
    font-weight: 600;
}
.crm-nav-item i { font-size: 1rem; width: 18px; text-align: center; }
.crm-nav-divider {
    height: 1px;
    background: var(--c-border);
    margin: 0.5rem 1rem;
}
.crm-sidebar-overlay {
    display: none;
    position: fixed;
    top: 56px; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1025;
}

/* --- Main Content --- */
.crm-main {
    margin-left: 220px;
    margin-top: 56px;
    padding: 1.5rem;
    min-height: calc(100vh - 56px);
    background: var(--c-bg);
}

/* ===== FeltCRM COMPONENT CLASSES ===== */

/* --- fc-page-header --- */
.fc-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}
.fc-page-header h1 {
    margin: 0;
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--c-text);
    line-height: 1.3;
}
.fc-page-header .fc-subtitle {
    font-size: 0.875rem;
    color: var(--c-text-muted);
    margin-top: 0.15rem;
    font-weight: 400;
}
.fc-page-header .fc-actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }

/* --- fc-stat-card --- */
.fc-stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}
@media (min-width: 768px) { .fc-stat-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1200px) { .fc-stat-grid { grid-template-columns: repeat(5, 1fr); } }

.fc-stat-card {
    background: var(--c-card);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    transition: box-shadow 0.15s;
}
.fc-stat-card:hover { box-shadow: var(--shadow-lg); }
.fc-stat-card .stat-content { display: flex; flex-direction: column; }
.fc-stat-card .stat-title {
    font-size: 0.8rem;
    color: var(--c-text-muted);
    font-weight: 500;
    margin-bottom: 0.3rem;
}
.fc-stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--c-text);
    line-height: 1.2;
}
.fc-stat-card .stat-sub {
    font-size: 0.75rem;
    color: var(--c-text-muted);
    margin-top: 0.2rem;
}
.fc-stat-card .stat-trend {
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
}
.fc-stat-card .stat-trend.up { color: var(--c-success); }
.fc-stat-card .stat-trend.down { color: var(--c-danger); }

/* --- fc-icon-box --- */
.fc-icon-box {
    width: 36px; height: 36px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}
.fc-icon-box.primary { background: rgba(61,101,215,0.1); color: var(--c-primary); }
.fc-icon-box.success { background: rgba(45,157,77,0.1); color: var(--c-success); }
.fc-icon-box.danger { background: rgba(221,45,45,0.1); color: var(--c-danger); }
.fc-icon-box.warning { background: rgba(240,165,0,0.1); color: var(--c-warning); }
.fc-icon-box.info { background: rgba(0,163,233,0.1); color: var(--c-info); }
.fc-icon-box.muted { background: rgba(148,163,184,0.1); color: var(--c-text-muted); }

/* --- fc-alert-banner --- */
.fc-alert-banner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-radius: var(--radius-lg);
    border: 1px solid;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
    font-size: 0.875rem;
}
.fc-alert-banner:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.fc-alert-banner .alert-content { flex: 1; min-width: 0; }
.fc-alert-banner .alert-title { font-weight: 600; }
.fc-alert-banner .alert-sub { font-size: 0.75rem; opacity: 0.8; }
.fc-alert-banner.destructive { border-color: rgba(221,45,45,0.3); background: rgba(221,45,45,0.05); color: var(--c-danger); }
.fc-alert-banner.destructive:hover { background: rgba(221,45,45,0.1); }
.fc-alert-banner.warning { border-color: rgba(240,165,0,0.3); background: rgba(240,165,0,0.05); color: #92400e; }
.fc-alert-banner.warning:hover { background: rgba(240,165,0,0.1); }
.fc-alert-banner.info { border-color: rgba(0,163,233,0.3); background: rgba(0,163,233,0.05); color: #0c4a6e; }
.fc-alert-banner.info:hover { background: rgba(0,163,233,0.1); }

/* --- fc-card --- */
.fc-card {
    background: var(--c-card);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.fc-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--c-border);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--c-text);
}
.fc-card-body { padding: 1rem; }
.fc-card-body.p-0 { padding: 0; }

/* --- fc-divide-y --- */
.fc-divide-y > * + * { border-top: 1px solid var(--c-border); }

/* --- fc-filter-bar --- */
.fc-filter-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}
.fc-filter-bar .form-control,
.fc-filter-bar .form-select {
    font-size: 0.85rem;
    height: 36px;
    border-color: var(--c-border);
    border-radius: var(--radius);
}
.fc-filter-bar .form-control { max-width: 250px; }
.fc-filter-bar .form-select { max-width: 160px; }
.fc-filter-bar .fc-search-wrap {
    position: relative;
    flex: 0 1 250px;
}
.fc-filter-bar .fc-search-wrap i {
    position: absolute; left: 0.65rem; top: 50%; transform: translateY(-50%);
    color: var(--c-text-muted); font-size: 0.85rem; pointer-events: none;
}
.fc-filter-bar .fc-search-wrap input { padding-left: 2rem; }

/* --- fc-filter-btn --- */
.fc-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.85rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--c-text-light);
    background: var(--c-card);
    border: 1px solid var(--c-border);
    border-radius: 100px;
    cursor: pointer;
    transition: all 0.15s;
    font-family: var(--font);
    white-space: nowrap;
}
.fc-filter-btn:hover { background: var(--c-bg); border-color: var(--c-text-muted); }
.fc-filter-btn.active {
    background: var(--c-primary);
    color: #fff;
    border-color: var(--c-primary);
}
.fc-filter-btn .count {
    background: rgba(0,0,0,0.1);
    padding: 0 0.4rem;
    border-radius: 100px;
    font-size: 0.7rem;
    font-weight: 600;
}
.fc-filter-btn.active .count { background: rgba(255,255,255,0.25); }

/* --- fc-badge --- */
.fc-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.15rem 0.55rem;
    border-radius: 100px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
}
.fc-badge-primary { background: rgba(61,101,215,0.1); color: var(--c-primary); }
.fc-badge-success { background: rgba(45,157,77,0.1); color: var(--c-success); }
.fc-badge-warning { background: rgba(240,165,0,0.1); color: #92400e; }
.fc-badge-danger { background: rgba(221,45,45,0.1); color: var(--c-danger); }
.fc-badge-info { background: rgba(0,163,233,0.1); color: #0c4a6e; }
.fc-badge-muted { background: rgba(148,163,184,0.1); color: var(--c-text-muted); }

/* --- fc-table (improved crm-table) --- */
.fc-table {
    width: 100%;
    font-size: 0.875rem;
    border-collapse: collapse;
}
.fc-table th {
    background: var(--c-bg);
    font-weight: 600;
    color: var(--c-text-light);
    padding: 0.6rem 0.75rem;
    white-space: nowrap;
    border-bottom: 1px solid var(--c-border);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-align: left;
}
.fc-table th.sortable { cursor: pointer; user-select: none; }
.fc-table th.sortable:hover { color: var(--c-primary); }
.fc-table th .sort-icon { font-size: 0.65rem; margin-left: 0.3rem; opacity: 0.5; }
.fc-table th.sorted .sort-icon { opacity: 1; color: var(--c-primary); }
.fc-table td {
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid var(--c-border);
    vertical-align: middle;
    color: var(--c-text);
}
.fc-table tbody tr { transition: background 0.1s; }
.fc-table tbody tr:hover { background: rgba(61,101,215,0.03); }
.fc-table tbody tr:last-child td { border-bottom: none; }
.fc-table .td-muted { color: var(--c-text-muted); font-size: 0.8rem; }
.fc-table .td-link { color: var(--c-text); text-decoration: none; font-weight: 500; }
.fc-table .td-link:hover { color: var(--c-primary); }

/* --- fc-activity-card (FeltCRM style) --- */
.fc-activity-card {
    display: flex;
    flex-direction: column;
    background: var(--c-card);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    transition: box-shadow 0.15s;
}
.fc-activity-card:hover { box-shadow: var(--shadow); }
.fc-activity-card.overdue { border-color: rgba(221,45,45,0.4); background: rgba(221,45,45,0.02); }
.fc-activity-card .fc-act-main {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
}
.fc-activity-card .fc-act-time {
    font-size: 0.75rem;
    color: var(--c-text-muted);
    white-space: nowrap;
    min-width: 45px;
    padding-top: 0.1rem;
}
.fc-activity-card .fc-act-body { flex: 1; min-width: 0; }
.fc-activity-card .fc-act-line1 {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    font-size: 0.85rem;
}
.fc-activity-card .fc-act-type {
    font-weight: 600;
    color: var(--c-text);
}
.fc-activity-card .fc-act-customer a {
    color: var(--c-primary);
    text-decoration: none;
    font-weight: 500;
}
.fc-activity-card .fc-act-customer a:hover { text-decoration: underline; }
.fc-activity-card .fc-act-summary {
    font-size: 0.8rem;
    color: var(--c-text-muted);
    margin-top: 0.2rem;
    line-height: 1.4;
}
.fc-activity-card .fc-act-nextstep {
    margin-top: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--c-accent);
    border-radius: var(--radius);
    font-size: 0.8rem;
    color: var(--c-primary);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.fc-activity-card .fc-act-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-top: 1px solid var(--c-border);
}
.fc-activity-card .fc-act-actions .btn {
    font-size: 0.75rem;
    padding: 0.25rem 0.65rem;
    border-radius: var(--radius);
}

/* --- fc-kanban-card --- */
.fc-kanban-card {
    background: var(--c-card);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    cursor: grab;
    transition: box-shadow 0.15s, transform 0.15s;
}
.fc-kanban-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-1px);
}
.fc-kanban-card.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
}
.fc-kanban-card .card-name {
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 0.3rem;
    line-height: 1.3;
}
.fc-kanban-card .card-name a { color: var(--c-text); text-decoration: none; }
.fc-kanban-card .card-name a:hover { color: var(--c-primary); }
.fc-kanban-card .card-amount {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--c-text);
}
.fc-kanban-card .card-meta {
    font-size: 0.75rem;
    color: var(--c-text-muted);
    margin-top: 0.15rem;
}
.fc-kanban-card .card-progress {
    margin-top: 0.5rem;
    height: 4px;
    background: var(--c-border);
    border-radius: 2px;
    overflow: hidden;
}
.fc-kanban-card .card-progress-bar {
    height: 100%;
    background: var(--c-primary);
    border-radius: 2px;
    transition: width 0.3s;
}
.fc-kanban-card .card-progress-text {
    display: flex;
    justify-content: space-between;
    font-size: 0.65rem;
    color: var(--c-text-muted);
    margin-top: 0.2rem;
}

/* --- fc-visit-card --- */
.fc-visit-card {
    background: var(--c-card);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 0.85rem 1rem;
    margin-bottom: 0.5rem;
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    transition: box-shadow 0.15s;
}
.fc-visit-card:hover { box-shadow: var(--shadow); }
.fc-visit-card .visit-grip {
    color: var(--c-text-muted);
    cursor: grab;
    padding: 0.2rem;
    font-size: 1rem;
}
.fc-visit-card .visit-body { flex: 1; min-width: 0; }
.fc-visit-card .visit-name { font-weight: 600; font-size: 0.875rem; color: var(--c-text); }
.fc-visit-card .visit-meta {
    font-size: 0.8rem;
    color: var(--c-text-muted);
    margin-top: 0.15rem;
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.fc-visit-card .visit-note {
    margin-top: 0.4rem;
    padding: 0.4rem 0.6rem;
    background: var(--c-bg);
    border-radius: var(--radius);
    font-size: 0.75rem;
    color: var(--c-text-muted);
}
.fc-visit-card .visit-actions {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
}

/* --- fc-timeline --- */
.fc-timeline {
    position: relative;
    padding-left: 2rem;
}
.fc-timeline::before {
    content: '';
    position: absolute;
    left: 0.55rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--c-border);
}
.fc-timeline-item {
    position: relative;
    padding-bottom: 1.25rem;
}
.fc-timeline-item:last-child { padding-bottom: 0; }
.fc-timeline-dot {
    position: absolute;
    left: -1.65rem;
    top: 0.15rem;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    border: 2px solid var(--c-border);
    background: var(--c-card);
}
.fc-timeline-dot.primary { border-color: var(--c-primary); background: rgba(61,101,215,0.1); color: var(--c-primary); }
.fc-timeline-dot.success { border-color: var(--c-success); background: rgba(45,157,77,0.1); color: var(--c-success); }
.fc-timeline-dot.warning { border-color: var(--c-warning); background: rgba(240,165,0,0.1); color: #92400e; }
.fc-timeline-dot.danger { border-color: var(--c-danger); background: rgba(221,45,45,0.1); color: var(--c-danger); }
.fc-timeline-dot.info { border-color: var(--c-info); background: rgba(0,163,233,0.1); color: var(--c-info); }
.fc-timeline-date {
    font-size: 0.7rem;
    color: var(--c-text-muted);
    font-weight: 600;
    margin-bottom: 0.25rem;
}
.fc-timeline-content {
    background: var(--c-card);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 0.75rem;
    font-size: 0.85rem;
}

/* --- Legacy CRM class compatibility (backward compat) --- */
.crm-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}
.crm-page-header h1 {
    margin: 0;
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--c-text);
}
.crm-page-header h4 {
    margin: 0;
    font-weight: 700;
    font-size: 1.3rem;
    color: var(--c-text);
}
.crm-page-header h4 i { color: var(--c-text-light); margin-right: 0.4rem; }

/* --- KPI Grid (legacy compat) --- */
.crm-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.crm-kpi-card {
    background: var(--c-card);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.crm-kpi-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.15rem;
    flex-shrink: 0;
}
.crm-kpi-body { display: flex; flex-direction: column; }
.crm-kpi-value { font-size: 1.4rem; font-weight: 700; color: var(--c-text); line-height: 1.2; }
.crm-kpi-label { font-size: 0.75rem; color: var(--c-text-light); font-weight: 500; }

/* --- Empty state --- */
.crm-empty-state {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--c-text-muted);
    font-size: 0.9rem;
}

/* --- CRM Cards --- */
.crm-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

/* --- CRM List Table (legacy, maps to fc-table) --- */
.crm-table {
    width: 100%;
    font-size: 0.875rem;
}
.crm-table th {
    background: var(--c-bg);
    font-weight: 600;
    color: var(--c-text-light);
    padding: 0.5rem 0.75rem;
    white-space: nowrap;
    border-bottom: 1px solid var(--c-border);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.crm-table td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--c-border);
    vertical-align: middle;
}
.crm-table tbody tr:hover { background: rgba(61,101,215,0.03); }
.crm-table tbody tr { cursor: pointer; }

/* --- CRM Search Bar --- */
.crm-search-bar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.crm-search-bar .form-control {
    max-width: 350px;
}

/* --- CRM Detail sections --- */
.crm-detail-header {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}
.crm-detail-avatar {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-lg);
    background: var(--c-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    flex-shrink: 0;
}
.crm-detail-info { flex: 1; min-width: 200px; }
.crm-detail-info h5 { margin: 0 0 0.25rem; font-weight: 700; }
.crm-detail-info p { margin: 0; color: var(--c-text-light); font-size: 0.85rem; }
.crm-detail-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.crm-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.5rem 1.5rem;
    margin-bottom: 1rem;
}
.crm-info-item label {
    font-size: 0.75rem;
    color: var(--c-text-light);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.1rem;
    display: block;
}
.crm-info-item span { font-size: 0.9rem; color: var(--c-text); }

/* --- CRM Tabs --- */
.crm-tabs {
    border-bottom: 2px solid var(--c-border);
    display: flex;
    gap: 0;
    margin-bottom: 1rem;
    overflow-x: auto;
}
.crm-tab {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--c-text-light);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
    cursor: pointer;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    font-family: var(--font);
}
.crm-tab:hover { color: var(--c-text); }
.crm-tab.active { color: var(--c-primary); border-bottom-color: var(--c-primary); }

/* --- CRM Badge (legacy compat) --- */
.crm-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
}
.crm-badge-success { background: rgba(45,157,77,0.1); color: var(--c-success); }
.crm-badge-danger { background: rgba(221,45,45,0.1); color: var(--c-danger); }
.crm-badge-warning { background: rgba(240,165,0,0.1); color: #92400e; }
.crm-badge-info { background: rgba(0,163,233,0.1); color: #0c4a6e; }

/* --- Modal tweaks for CRM --- */
.crm-modal .modal-header { background: var(--c-primary); color: #fff; }
.crm-modal .modal-header .btn-close { filter: brightness(0) invert(1); }

/* --- CRM Buttons --- */
.btn-fc-primary {
    background: var(--c-primary); color: #fff; border: none;
    padding: 0.5rem 1rem; font-size: 0.875rem; font-weight: 600;
    border-radius: var(--radius); font-family: var(--font);
    cursor: pointer; transition: background 0.15s;
    display: inline-flex; align-items: center; gap: 0.4rem;
}
.btn-fc-primary:hover { background: var(--c-primary-dark); color: #fff; }
.btn-fc-outline {
    background: var(--c-card); color: var(--c-text); border: 1px solid var(--c-border);
    padding: 0.5rem 1rem; font-size: 0.875rem; font-weight: 500;
    border-radius: var(--radius); font-family: var(--font);
    cursor: pointer; transition: all 0.15s;
    display: inline-flex; align-items: center; gap: 0.4rem;
}
.btn-fc-outline:hover { background: var(--c-bg); border-color: var(--c-text-muted); }
.btn-fc-ghost {
    background: none; color: var(--c-text-light); border: none;
    padding: 0.4rem 0.65rem; font-size: 0.8rem; font-weight: 500;
    border-radius: var(--radius); font-family: var(--font);
    cursor: pointer; transition: all 0.15s;
    display: inline-flex; align-items: center; gap: 0.35rem;
}
.btn-fc-ghost:hover { background: var(--c-bg); color: var(--c-text); }
.btn-fc-danger {
    background: var(--c-danger); color: #fff; border: none;
    padding: 0.5rem 1rem; font-size: 0.875rem; font-weight: 600;
    border-radius: var(--radius); font-family: var(--font);
    cursor: pointer; transition: background 0.15s;
    display: inline-flex; align-items: center; gap: 0.4rem;
}
.btn-fc-danger:hover { background: #c12626; color: #fff; }
.btn-fc-success {
    background: var(--c-success); color: #fff; border: none;
    padding: 0.5rem 1rem; font-size: 0.875rem; font-weight: 600;
    border-radius: var(--radius); font-family: var(--font);
    cursor: pointer; transition: background 0.15s;
    display: inline-flex; align-items: center; gap: 0.4rem;
}
.btn-fc-success:hover { background: #248a42; color: #fff; }
.btn-fc-sm {
    padding: 0.3rem 0.65rem;
    font-size: 0.8rem;
}

/* ============================================
   CRM RESPONSIVE
   ============================================ */

@media (max-width: 991px) {
    .crm-sidebar {
        transform: translateX(-100%);
    }
    .crm-sidebar.open {
        transform: translateX(0);
    }
    .crm-sidebar-overlay.open {
        display: block;
    }
    .crm-sidebar-toggle {
        display: block;
    }
    .crm-main {
        margin-left: 0;
    }
    .crm-topbar-company { display: none; }
    .crm-topbar-search { display: none; }
    .crm-topbar-employee span { display: none; }
}

@media (max-width: 576px) {
    .crm-main { padding: 1rem 0.75rem; }
    .crm-kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
    .crm-kpi-card { padding: 0.75rem; }
    .crm-kpi-value { font-size: 1.15rem; }
    .crm-page-header h4 { font-size: 1.1rem; }
    .crm-card-grid { grid-template-columns: 1fr; }
    .crm-search-bar .form-control { max-width: 100%; }
    .crm-detail-header { gap: 0.75rem; }
}

/* === DASHBOARD KPI CLICKABLE === */
.crm-kpi-clickable {
    transition: transform 0.15s, box-shadow 0.15s;
    cursor: pointer;
}
.crm-kpi-clickable:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* === PIPELINE KANBAN === */
.crm-pipeline-summary {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    align-items: center;
    padding: 0.75rem 0;
}
.crm-pipeline-summary .summary-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.crm-pipeline-summary .summary-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--c-primary-dark);
}
.crm-pipeline-summary .summary-label {
    font-size: 0.75rem;
    color: var(--c-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.crm-kanban-board {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding-bottom: 1rem;
    min-height: 400px;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
}
.crm-kanban-board::-webkit-scrollbar { height: 6px; }
.crm-kanban-board::-webkit-scrollbar-track { background: transparent; }
.crm-kanban-board::-webkit-scrollbar-thumb { background: var(--c-border); border-radius: 3px; }

.crm-kanban-column {
    min-width: 250px;
    max-width: 280px;
    flex: 0 0 250px;
    background: var(--c-bg);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    scroll-snap-align: start;
}
.crm-kanban-column-header {
    padding: 0.75rem;
    border-bottom: 3px solid var(--c-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 0.85rem;
}
.crm-kanban-column-header .badge {
    font-size: 0.7rem;
    font-weight: 600;
}
.crm-kanban-column-body {
    padding: 0.5rem;
    flex: 1;
    overflow-y: auto;
    max-height: 60vh;
    min-height: 60px;
    transition: background 0.15s;
}
.crm-kanban-column-body.drag-over {
    background: rgba(0, 124, 186, 0.08);
    outline: 2px dashed var(--c-primary);
    outline-offset: -4px;
    border-radius: var(--radius);
}
.crm-kanban-column-footer {
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    color: var(--c-text-muted);
    border-top: 1px solid var(--c-border);
    text-align: right;
}

.crm-kanban-card {
    background: var(--c-white);
    border-radius: var(--radius);
    padding: 0.65rem 0.75rem;
    margin-bottom: 0.5rem;
    box-shadow: var(--shadow);
    cursor: grab;
    transition: box-shadow 0.15s, transform 0.15s;
    border-left: 3px solid transparent;
    user-select: none;
}
.crm-kanban-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-1px);
}
.crm-kanban-card.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
}
.crm-kanban-card .card-name {
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.crm-kanban-card .card-name a {
    color: var(--c-text);
    text-decoration: none;
}
.crm-kanban-card .card-name a:hover { color: var(--c-primary); }
.crm-kanban-card .card-meta {
    font-size: 0.75rem;
    color: var(--c-text-muted);
}
.crm-kanban-card .card-meta i { margin-right: 0.25rem; }
.crm-kanban-card .card-value {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--c-primary);
    margin-top: 0.25rem;
}
.crm-kanban-card .card-move { margin-top: 0.25rem; }
.crm-kanban-card .card-move-select {
    font-size: 0.72rem;
    padding: 0.15rem 1.5rem 0.15rem 0.4rem;
    height: auto;
    color: var(--c-text-muted);
    border-color: var(--c-border);
    background-size: 12px;
}

/* Pipeline view toggle */
.crm-view-toggle .btn { font-size: 0.8rem; padding: 0.3rem 0.75rem; }
.crm-view-toggle .btn.active { background: var(--c-primary); color: white; border-color: var(--c-primary); }

/* Pipeline list view */
.crm-pipeline-list .stage-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
}

@media (max-width: 768px) {
    .crm-kanban-column { min-width: 220px; flex: 0 0 220px; }
    .crm-kanban-column-body { max-height: 50vh; }
    .crm-pipeline-summary { gap: 1rem; }
}

/* ===== ACTIVITIES PAGE (redesign 2026-02) ===== */

/* Toolbar */
.crm-toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}
.crm-toolbar .form-control,
.crm-toolbar .form-select {
    font-size: 0.8rem;
    height: 34px;
}
.crm-toolbar .form-control { max-width: 200px; }
.crm-toolbar .form-select { max-width: 160px; }
.crm-toolbar .btn { font-size: 0.8rem; white-space: nowrap; }

/* Group headers */
.crm-activity-group-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
    margin-top: 0.75rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #64748b;
    cursor: default;
}
.crm-activity-group-header::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e2e8f0;
}
.crm-activity-group-header .group-count {
    font-weight: 600;
    color: #94a3b8;
}
.crm-activity-group-header.overdue { color: #dc2626; }
.crm-activity-group-header.overdue::after { background: #fecaca; }
.crm-activity-group-header.today { color: var(--c-primary); }
.crm-activity-group-header.today::after { background: #bae6fd; }
.crm-activity-group-header.completed { color: #94a3b8; }
.crm-activity-group-header.clickable { cursor: pointer; }
.crm-activity-group-header.clickable:hover { color: var(--c-primary); }

/* Activity card */
.crm-activity-card {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    background: #fff;
    border-radius: 8px;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    transition: box-shadow 0.15s, transform 0.15s;
    border-left: 3px solid transparent;
}
.crm-activity-card:hover {
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    transform: translateY(-1px);
}
.crm-activity-card.overdue { border-left-color: #ef4444; }
.crm-activity-card.today { border-left-color: var(--c-primary); }
.crm-activity-card.completed {
    opacity: 0.65;
    border-left-color: #10b981;
}

/* Icon circle */
.crm-activity-icon-circle {
    width: 38px;
    height: 38px;
    min-width: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1rem;
    flex-shrink: 0;
}
.crm-activity-icon-circle.phone { background: #3b82f6; }
.crm-activity-icon-circle.visit { background: #10b981; }
.crm-activity-icon-circle.meeting { background: #8b5cf6; }
.crm-activity-icon-circle.email { background: #f97316; }
.crm-activity-icon-circle.sales { background: #14b8a6; }
.crm-activity-icon-circle.demo { background: #06b6d4; }
.crm-activity-icon-circle.default { background: #94a3b8; }

/* Card body */
.crm-activity-body {
    flex: 1;
    min-width: 0;
}
.crm-activity-body .activity-line1 {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}
.crm-activity-body .activity-name {
    font-weight: 600;
    font-size: 0.88rem;
    color: #1e293b;
}
.crm-activity-body .activity-name a {
    color: inherit;
    text-decoration: none;
}
.crm-activity-body .activity-name a:hover { color: var(--c-primary); }
.crm-activity-body .activity-line2 {
    font-size: 0.78rem;
    color: #64748b;
    margin-top: 0.15rem;
}
.crm-activity-body .activity-line2 a {
    color: #64748b;
    text-decoration: none;
}
.crm-activity-body .activity-line2 a:hover { color: var(--c-primary); text-decoration: underline; }
.crm-activity-body .activity-text {
    font-size: 0.78rem;
    color: #94a3b8;
    margin-top: 0.2rem;
    line-height: 1.4;
}
.crm-activity-body .activity-text .expand-btn {
    color: var(--c-primary);
    cursor: pointer;
    font-weight: 500;
    border: none;
    background: none;
    padding: 0;
    font-size: inherit;
}

/* Metadata badges */
.crm-activity-meta {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-top: 0.3rem;
}
.crm-activity-meta .meta-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.7rem;
    font-weight: 500;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    background: #f1f5f9;
    color: #475569;
}
.crm-activity-meta .meta-badge.amount { background: #ecfdf5; color: #065f46; }
.crm-activity-meta .meta-badge.probability { background: #eff6ff; color: #1e40af; }
.crm-activity-meta .meta-badge.dctype-customer { background: #dbeafe; color: #1e40af; }
.crm-activity-meta .meta-badge.dctype-prospect { background: #fef3c7; color: #92400e; }

/* Right side (date + actions) */
.crm-activity-right {
    text-align: right;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.3rem;
}
.crm-activity-right .activity-date {
    font-size: 0.78rem;
    font-weight: 600;
    color: #475569;
    white-space: nowrap;
}
.crm-activity-right .activity-date.overdue { color: #dc2626; }
.crm-activity-right .badge-overdue {
    font-size: 0.65rem;
    padding: 0.15rem 0.35rem;
    border-radius: 4px;
    background: #fef2f2;
    color: #dc2626;
    font-weight: 600;
}
.crm-activity-actions {
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity 0.15s;
}
.crm-activity-card:hover .crm-activity-actions { opacity: 1; }
.crm-activity-actions .btn {
    font-size: 0.7rem;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
}

/* Completed section toggle */
.crm-completed-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
    cursor: pointer;
    color: #94a3b8;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    user-select: none;
}
.crm-completed-toggle:hover { color: #64748b; }
.crm-completed-toggle::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e2e8f0;
}
.crm-completed-toggle .toggle-icon {
    transition: transform 0.2s;
}
.crm-completed-toggle.expanded .toggle-icon {
    transform: rotate(90deg);
}

/* Responsive */
@media (max-width: 768px) {
    .crm-toolbar { gap: 0.35rem; }
    .crm-toolbar .form-control,
    .crm-toolbar .form-select { max-width: none; flex: 1 1 auto; min-width: 0; }
    .crm-activity-card { padding: 0.6rem; gap: 0.5rem; }
    .crm-activity-icon-circle { width: 32px; height: 32px; min-width: 32px; font-size: 0.85rem; }
    .crm-activity-actions { opacity: 1; }
    .crm-activity-right .activity-date { font-size: 0.72rem; }
}
@media (max-width: 480px) {
    .crm-toolbar .btn-new-followup-text { display: none; }
    .crm-activity-body .activity-line1 { font-size: 0.82rem; }
}
