/* ==========================================================
   Travel CRM — panel theme (on top of Bootstrap 5)
   ========================================================== */
:root {
    --crm-primary: #4f46e5;
    --crm-primary-dark: #4338ca;
    --crm-primary-soft: #eef2ff;
    --crm-sidebar: #0f172a;
    --crm-sidebar-2: #1e293b;
    --crm-sidebar-text: #94a3b8;
    --crm-bg: #f4f6fb;
    --crm-border: #e5e7eb;
    --crm-text: #0f172a;
    --crm-muted: #64748b;
    --crm-radius: 12px;
    --sidebar-w: 260px;
    --bs-primary: #4f46e5;
    --bs-primary-rgb: 79, 70, 229;
    --bs-link-color: #4f46e5;
    --bs-link-hover-color: #4338ca;
    --bs-body-font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

body { background: var(--crm-bg); color: var(--crm-text); font-size: .9rem; }
a { text-decoration: none; }

/* ---------- Buttons ---------- */
.btn { border-radius: 8px; font-weight: 500; font-size: .875rem; }
.btn-primary { --bs-btn-bg: var(--crm-primary); --bs-btn-border-color: var(--crm-primary);
    --bs-btn-hover-bg: var(--crm-primary-dark); --bs-btn-hover-border-color: var(--crm-primary-dark);
    --bs-btn-active-bg: var(--crm-primary-dark); --bs-btn-disabled-bg: var(--crm-primary); --bs-btn-disabled-border-color: var(--crm-primary); }
.btn-outline-primary { --bs-btn-color: var(--crm-primary); --bs-btn-border-color: var(--crm-primary);
    --bs-btn-hover-bg: var(--crm-primary); --bs-btn-hover-border-color: var(--crm-primary); --bs-btn-active-bg: var(--crm-primary); }
.btn-soft { background: var(--crm-primary-soft); color: var(--crm-primary); border: 0; }
.btn-soft:hover { background: #e0e7ff; color: var(--crm-primary-dark); }
.btn-icon { width: 32px; height: 32px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.text-primary { color: var(--crm-primary) !important; }
.bg-primary { background-color: var(--crm-primary) !important; }

/* ---------- Layout ---------- */
.crm-sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); background: var(--crm-sidebar);
    color: var(--crm-sidebar-text); display: flex; flex-direction: column; z-index: 1040; transition: transform .2s;
}
.crm-brand { padding: 18px 20px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid rgba(255,255,255,.06); }
.crm-brand img { max-height: 34px; max-width: 150px; object-fit: contain; }
.crm-brand .logo-box { width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg,#6366f1,#22d3ee);
    display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 1.1rem; flex-shrink: 0; }
.crm-brand .name { color: #fff; font-weight: 600; line-height: 1.15; font-size: .95rem; }
.crm-brand .sub { font-size: .7rem; color: var(--crm-sidebar-text); }
.crm-nav { flex: 1; overflow-y: auto; padding: 12px 12px 24px; }
.crm-nav::-webkit-scrollbar { width: 4px; } .crm-nav::-webkit-scrollbar-thumb { background: #334155; border-radius: 4px; }
.crm-nav .nav-section { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: #64748b; padding: 16px 12px 6px; font-weight: 600; }
.crm-nav a { display: flex; align-items: center; gap: 11px; padding: 8px 12px; border-radius: 8px; color: var(--crm-sidebar-text);
    font-weight: 500; margin-bottom: 2px; transition: all .15s; }
.crm-nav a i { font-size: 1.05rem; width: 20px; text-align: center; }
.crm-nav a:hover { background: var(--crm-sidebar-2); color: #fff; }
.crm-nav a.active { background: var(--crm-primary); color: #fff; box-shadow: 0 4px 12px rgba(79,70,229,.35); }
.crm-nav a .badge { margin-left: auto; font-size: .68rem; }

.crm-main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.crm-topbar { height: 64px; background: #fff; border-bottom: 1px solid var(--crm-border); display: flex; align-items: center;
    padding: 0 24px; gap: 16px; position: sticky; top: 0; z-index: 1030; }
.crm-topbar .page-title { font-weight: 600; font-size: 1.05rem; margin: 0; }
.crm-content { padding: 24px; flex: 1; }
.crm-footer { padding: 14px 24px; color: var(--crm-muted); font-size: .78rem; }

.impersonate-bar { background: #fef3c7; color: #92400e; padding: 8px 24px; font-size: .85rem; display: flex; align-items: center; gap: 12px; }

@media (max-width: 991.98px) {
    .crm-sidebar { transform: translateX(-100%); }
    .crm-sidebar.show { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.4); }
    .crm-main { margin-left: 0; }
    .crm-content { padding: 16px; }
    .sidebar-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 1035; display: none; }
    .sidebar-backdrop.show { display: block; }
}

/* ---------- Cards ---------- */
.card { border: 1px solid var(--crm-border); border-radius: var(--crm-radius); box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.card-header { background: #fff; border-bottom: 1px solid var(--crm-border); padding: 14px 18px; font-weight: 600;
    border-radius: var(--crm-radius) var(--crm-radius) 0 0 !important; display: flex; align-items: center; gap: 8px; }
.card-body { padding: 18px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { font-size: 1.35rem; font-weight: 700; margin: 0; }
.page-head p { color: var(--crm-muted); margin: 2px 0 0; font-size: .85rem; }

.stat-card { padding: 18px; display: flex; gap: 14px; align-items: center; height: 100%; }
.stat-card .icon { width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; flex-shrink: 0; }
.stat-card .value { font-size: 1.5rem; font-weight: 700; line-height: 1.1; }
.stat-card .label { color: var(--crm-muted); font-size: .78rem; font-weight: 500; }
.ic-indigo { background: #eef2ff; color: #4f46e5; } .ic-green { background: #dcfce7; color: #16a34a; }
.ic-amber { background: #fef3c7; color: #d97706; } .ic-red { background: #fee2e2; color: #dc2626; }
.ic-sky { background: #e0f2fe; color: #0284c7; } .ic-pink { background: #fce7f3; color: #db2777; }
.ic-violet { background: #f3e8ff; color: #9333ea; } .ic-slate { background: #f1f5f9; color: #475569; }

/* ---------- Tables ---------- */
.table-crm { margin: 0; }
.table-crm thead th { background: #f8fafc; color: var(--crm-muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .04em;
    font-weight: 600; border-bottom: 1px solid var(--crm-border); padding: 10px 14px; white-space: nowrap; }
.table-crm td { padding: 11px 14px; vertical-align: middle; border-color: #f1f5f9; }
.table-crm tbody tr:hover { background: #fafbff; }
.table-crm .thumb { width: 54px; height: 40px; object-fit: cover; border-radius: 6px; background: #f1f5f9; }
.table-crm .thumb-empty { width: 54px; height: 40px; border-radius: 6px; background: #f1f5f9; display: flex; align-items: center; justify-content: center; color: #cbd5e1; }
.drag-handle { cursor: grab; color: #94a3b8; } .drag-handle:active { cursor: grabbing; }
.sortable-ghost { opacity: .4; background: var(--crm-primary-soft) !important; }

/* ---------- Badges / pills ---------- */
.badge-soft { padding: .35em .65em; border-radius: 6px; font-weight: 600; font-size: .72rem; }
.stage-pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 20px; font-size: .74rem; font-weight: 600; white-space: nowrap; }
.stage-pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.prio-low { background: #f1f5f9; color: #64748b; } .prio-medium { background: #e0f2fe; color: #0369a1; }
.prio-high { background: #fef3c7; color: #b45309; } .prio-hot { background: #fee2e2; color: #b91c1c; }
.avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; background: var(--crm-primary-soft); color: var(--crm-primary);
    display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: .8rem; flex-shrink: 0; }
.avatar-lg { width: 64px; height: 64px; font-size: 1.4rem; }
.avatar-sm { width: 24px; height: 24px; font-size: .65rem; }
.stars { color: #f59e0b; letter-spacing: 1px; white-space: nowrap; }
.score-bar { height: 5px; background: #e2e8f0; border-radius: 4px; width: 60px; overflow: hidden; }
.score-bar span { display: block; height: 100%; border-radius: 4px; }

/* ---------- Forms ---------- */
.form-label { font-weight: 500; font-size: .82rem; color: #334155; margin-bottom: 5px; }
.form-control, .form-select { border-radius: 8px; border-color: #d9dee7; font-size: .875rem; padding: .5rem .75rem; }
.form-control:focus, .form-select:focus { border-color: #a5b4fc; box-shadow: 0 0 0 3px rgba(99,102,241,.15); }
.form-text { font-size: .75rem; }
.form-check-input:checked { background-color: var(--crm-primary); border-color: var(--crm-primary); }
.form-switch .form-check-input { width: 2.4em; height: 1.25em; cursor: pointer; }
.required::after { content: ' *'; color: #dc2626; }
.form-section-title { font-weight: 600; font-size: .95rem; margin: 6px 0 2px; }

.image-field { display: flex; gap: 14px; align-items: flex-start; }
.image-preview { width: 120px; height: 84px; border-radius: 10px; border: 2px dashed #cbd5e1; background: #f8fafc;
    display: flex; align-items: center; justify-content: center; overflow: hidden; flex-shrink: 0; color: #94a3b8; font-size: 1.6rem; }
.image-preview img { width: 100%; height: 100%; object-fit: cover; }
.image-preview.contain img { object-fit: contain; padding: 6px; }
.gallery-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.gallery-item { position: relative; width: 110px; height: 80px; border-radius: 8px; overflow: hidden; border: 1px solid var(--crm-border); }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; }
.gallery-item .form-check { position: absolute; top: 4px; left: 4px; background: rgba(255,255,255,.9); border-radius: 6px; padding: 2px 4px 2px 26px; margin: 0; font-size: .7rem; }
.gallery-item.removed img { opacity: .25; filter: grayscale(1); }

.repeater-row { border: 1px solid var(--crm-border); border-radius: 10px; padding: 14px; background: #fafbfc; position: relative; margin-bottom: 10px; }
.repeater-row .row-actions { position: absolute; top: 8px; right: 8px; }
.sticky-actions { position: sticky; bottom: 0; background: rgba(244,246,251,.95); backdrop-filter: blur(6px);
    padding: 14px 0; border-top: 1px solid var(--crm-border); margin-top: 20px; z-index: 5; }

/* ---------- Tabs ---------- */
.nav-tabs-crm { border-bottom: 1px solid var(--crm-border); gap: 4px; flex-wrap: nowrap; overflow-x: auto; }
.nav-tabs-crm .nav-link { border: 0; border-bottom: 2px solid transparent; color: var(--crm-muted); font-weight: 500;
    padding: 10px 14px; white-space: nowrap; border-radius: 0; }
.nav-tabs-crm .nav-link:hover { color: var(--crm-text); }
.nav-tabs-crm .nav-link.active { color: var(--crm-primary); border-bottom-color: var(--crm-primary); background: none; }
.nav-tabs-crm .nav-link .badge { font-size: .65rem; }

/* ---------- Kanban ---------- */
.kanban { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; min-height: calc(100vh - 220px); }
.kanban-col { flex: 0 0 290px; background: #eef1f6; border-radius: 12px; display: flex; flex-direction: column; max-height: calc(100vh - 210px); }
.kanban-col-head { padding: 12px 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; border-top: 3px solid; border-radius: 12px 12px 0 0; }
.kanban-col-head .count { margin-left: auto; background: #fff; border-radius: 20px; padding: 1px 9px; font-size: .74rem; color: var(--crm-muted); }
.kanban-list { padding: 4px 10px 12px; overflow-y: auto; flex: 1; min-height: 80px; }
.kanban-card { background: #fff; border-radius: 10px; padding: 11px 12px; margin-bottom: 8px; box-shadow: 0 1px 2px rgba(0,0,0,.06);
    cursor: grab; border: 1px solid transparent; display: block; color: inherit; }
.kanban-card:hover { border-color: #c7d2fe; color: inherit; }
.kanban-card .ref { font-size: .7rem; color: var(--crm-muted); }
.kanban-card .name { font-weight: 600; }
.kanban-card .meta { font-size: .75rem; color: var(--crm-muted); display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }

/* ---------- Timeline ---------- */
.timeline { position: relative; padding-left: 28px; }
.timeline::before { content: ''; position: absolute; left: 11px; top: 4px; bottom: 4px; width: 2px; background: #e2e8f0; }
.tl-item { position: relative; padding-bottom: 18px; }
.tl-item .tl-icon { position: absolute; left: -28px; top: 0; width: 24px; height: 24px; border-radius: 50%; background: #fff;
    border: 2px solid #e2e8f0; display: flex; align-items: center; justify-content: center; font-size: .7rem; color: var(--crm-muted); }
.tl-item .tl-head { font-size: .78rem; color: var(--crm-muted); }
.tl-item .tl-body { background: #f8fafc; border-radius: 8px; padding: 8px 12px; margin-top: 4px; white-space: pre-line; }
.tl-note .tl-icon { border-color: #fde68a; color: #d97706; } .tl-call .tl-icon { border-color: #bbf7d0; color: #16a34a; }
.tl-whatsapp .tl-icon { border-color: #bbf7d0; color: #16a34a; } .tl-status_changed .tl-icon { border-color: #c7d2fe; color: #4f46e5; }
.tl-email .tl-icon { border-color: #bae6fd; color: #0284c7; }

.info-list { display: grid; grid-template-columns: 130px 1fr; gap: 8px 12px; font-size: .86rem; }
.info-list dt { color: var(--crm-muted); font-weight: 500; }
.info-list dd { margin: 0; word-break: break-word; }

/* ---------- Login ---------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-hero { background: linear-gradient(135deg, #312e81 0%, #4f46e5 45%, #0ea5e9 100%); color: #fff; padding: 56px;
    display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-hero::after { content: ''; position: absolute; width: 520px; height: 520px; border-radius: 50%; background: rgba(255,255,255,.07); right: -160px; bottom: -160px; }
.auth-hero h2 { font-weight: 700; font-size: 2.1rem; line-height: 1.2; }
.auth-hero .feature { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; opacity: .95; }
.auth-hero .feature i { width: 36px; height: 36px; border-radius: 10px; background: rgba(255,255,255,.15); display: flex; align-items: center; justify-content: center; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: #fff; }
.auth-form .box { width: 100%; max-width: 400px; }
.auth-form .form-control { padding: .7rem .9rem; }
@media (max-width: 991.98px) { .auth-wrap { grid-template-columns: 1fr; } .auth-hero { display: none; } }

/* ---------- Misc ---------- */
.empty-state { text-align: center; padding: 48px 20px; color: var(--crm-muted); }
.empty-state i { font-size: 2.6rem; color: #cbd5e1; display: block; margin-bottom: 10px; }
.code-box { background: #0f172a; color: #e2e8f0; border-radius: 10px; padding: 14px 16px; font-family: ui-monospace, Menlo, Consolas, monospace;
    font-size: .8rem; overflow-x: auto; white-space: pre; }
.copy-input { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .8rem; background: #f8fafc !important; }
.toast-container { z-index: 1090; }
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filter-bar .form-control, .filter-bar .form-select { width: auto; min-width: 140px; }
.dropdown-menu { border-radius: 10px; border-color: var(--crm-border); box-shadow: 0 10px 30px rgba(15,23,42,.1); font-size: .875rem; }
.pagination { margin: 0; } .page-link { color: var(--crm-primary); }
.active > .page-link, .page-link.active { background-color: var(--crm-primary); border-color: var(--crm-primary); }
.text-truncate-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cursor-pointer { cursor: pointer; }
.modal-content { border-radius: 14px; border: 0; }

/* ---------- Notification bell ---------- */
.notif-menu { width: 340px; max-width: calc(100vw - 24px); }
.notif-list { max-height: 380px; overflow-y: auto; }
.notif-item { display: flex; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--crm-border); color: inherit; text-decoration: none; }
.notif-item:hover { background: #f8fafc; }
.notif-item.unread { background: #eef2ff; }
.notif-item .ic { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.notif-item .t { font-weight: 600; font-size: .85rem; line-height: 1.25; }
.notif-item .b { font-size: .78rem; color: var(--crm-muted); }
.notif-item .tm { font-size: .7rem; color: var(--crm-muted); margin-top: 2px; }
