/* ============================================================
   SocialAdrace CRM — application styles
   Design tokens: primary #2563EB, sidebar #111827
   ============================================================ */

:root {
	--sar-primary: #2563eb;
	--sar-primary-dark: #1e40af;
	--sar-sidebar: #111827;
	--sar-sidebar-hover: #1f2937;
	--sar-sidebar-text: #9ca3af;
	--sar-body-bg: #f3f4f6;
	--sar-card-radius: 0.75rem;
	--sar-orange: #f97316;
	--sar-purple: #8b5cf6;
}

body {
	background: var(--sar-body-bg);
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
	font-size: 0.925rem;
}

a { color: var(--sar-primary); text-decoration: none; }
a:hover { color: var(--sar-primary-dark); }

.btn-primary {
	--bs-btn-bg: var(--sar-primary);
	--bs-btn-border-color: var(--sar-primary);
	--bs-btn-hover-bg: var(--sar-primary-dark);
	--bs-btn-hover-border-color: var(--sar-primary-dark);
	--bs-btn-active-bg: var(--sar-primary-dark);
	--bs-btn-active-border-color: var(--sar-primary-dark);
}
.text-primary { color: var(--sar-primary) !important; }

/* ---------- Layout shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
	width: 240px;
	min-width: 240px;
	background: var(--sar-sidebar);
	color: #fff;
	position: sticky;
	top: 0;
	height: 100vh;
	overflow-y: auto;
	z-index: 1030;
}
.brand { height: 60px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.brand-text { font-weight: 700; font-size: 1rem; color: #fff; }
.brand-mark {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border-radius: 8px;
	background: var(--sar-primary);
	color: #fff;
	font-size: 1rem;
}
.brand-mark-lg { width: 52px; height: 52px; font-size: 1.5rem; border-radius: 12px; }

.side-link {
	color: var(--sar-sidebar-text);
	display: flex;
	align-items: center;
	gap: 0.65rem;
	padding: 0.55rem 1rem;
	border-left: 3px solid transparent;
	font-size: 0.9rem;
}
.side-link i { font-size: 1.05rem; width: 20px; text-align: center; }
.side-link:hover { color: #fff; background: var(--sar-sidebar-hover); }
.side-link.active {
	color: #fff;
	background: var(--sar-sidebar-hover);
	border-left-color: var(--sar-primary);
}
.side-section {
	color: #6b7280;
	font-size: 0.7rem;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	padding: 0.9rem 1rem 0.25rem;
}
.side-footer { border-top: 1px solid rgba(255, 255, 255, 0.08); }

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
	height: 60px;
	background: #fff;
	border-bottom: 1px solid #e5e7eb;
	position: sticky;
	top: 0;
	z-index: 1020;
}
.topbar-search { width: 340px; }

.avatar {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	background: var(--sar-primary);
	color: #fff;
	font-size: 0.8rem;
	font-weight: 600;
}

.content { flex: 1; }

/* Mobile sidebar */
@media (max-width: 991.98px) {
	.sidebar { position: fixed; left: -240px; transition: left 0.2s ease; }
	.sidebar.open { left: 0; }
}

/* ---------- Cards & KPIs ---------- */
.card {
	border: 1px solid #e5e7eb;
	border-radius: var(--sar-card-radius);
	box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}
.card-header { border-radius: var(--sar-card-radius) var(--sar-card-radius) 0 0 !important; font-weight: 600; font-size: 0.9rem; }

.kpi-card .kpi-value { font-size: 1.35rem; font-weight: 700; line-height: 1.2; }
.kpi-card .kpi-label { font-size: 0.78rem; color: #6b7280; }
.kpi-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	border-radius: 10px;
	font-size: 1.15rem;
	flex-shrink: 0;
}

/* ---------- Stage badges & track ---------- */
.stage-badge { font-weight: 600; }
.stage-new { background: #e5e7eb; color: #374151; }
.stage-contacted { background: #cffafe; color: #155e75; }
.stage-qualified { background: #dbeafe; color: #1e40af; }
.stage-meeting { background: #fef3c7; color: #92400e; }
.stage-proposal { background: #ffedd5; color: #9a3412; }
.stage-negotiation { background: #ede9fe; color: #5b21b6; }
.stage-won { background: #dcfce7; color: #166534; }
.stage-lost { background: #fee2e2; color: #991b1b; }

.stage-track { flex-wrap: wrap; gap: 0.25rem; }
.stage-step {
	border: 1px solid #e5e7eb;
	background: #fff;
	color: #6b7280;
	font-size: 0.78rem;
	padding: 0.3rem 0.7rem;
	border-radius: 999px;
	cursor: pointer;
	transition: all 0.12s ease;
}
.stage-step:hover:not(:disabled) { border-color: var(--sar-primary); color: var(--sar-primary); }
.stage-step.done { background: #eff6ff; border-color: #bfdbfe; color: var(--sar-primary-dark); }
.stage-step.current { background: var(--sar-primary); border-color: var(--sar-primary); color: #fff; font-weight: 600; cursor: default; }
.stage-step.stage-lost:hover:not(:disabled) { border-color: #dc2626; color: #dc2626; }
.stage-step.current.stage-lost { background: #dc2626; border-color: #dc2626; }

/* ---------- Kanban ---------- */
.kanban-wrap { overflow-x: auto; padding-bottom: 0.75rem; }
.kanban { min-width: 1400px; align-items: flex-start; }
.kanban-col { width: 250px; min-width: 250px; }
.kanban-col-head {
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-weight: 600;
	font-size: 0.85rem;
	padding: 0.5rem 0.75rem;
	border-radius: 8px 8px 0 0;
}
.kanban-cards {
	background: #e9ecef66;
	border-radius: 0 0 8px 8px;
	padding: 0.5rem;
	min-height: 320px;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}
.kanban-cards.drag-over { outline: 2px dashed var(--sar-primary); outline-offset: -4px; background: #eff6ff; }
.kanban-card {
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	padding: 0.55rem 0.65rem;
	box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
	cursor: grab;
}
.kanban-card:active { cursor: grabbing; }
.kanban-card.dragging { opacity: 0.5; }
.kanban-empty { text-align: center; padding: 1rem 0; }

/* ---------- Timeline ---------- */
.tl-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	background: #f3f4f6;
	color: #6b7280;
	flex-shrink: 0;
	font-size: 0.9rem;
}
.tl-won { background: #dcfce7; color: #166534; }
.tl-lost { background: #fee2e2; color: #991b1b; }
.tl-created, .tl-assigned { background: #dbeafe; color: #1e40af; }
.tl-call, .tl-whatsapp, .tl-email { background: #cffafe; color: #155e75; }
.tl-meeting { background: #fef3c7; color: #92400e; }
.tl-proposal { background: #ffedd5; color: #9a3412; }

/* ---------- Notifications ---------- */
.notif-menu { width: 340px; }
.notif-list { max-height: 360px; overflow-y: auto; }
.notif-unread { background: #eff6ff; }
.notif-item { border-bottom: 1px solid #f3f4f6; }
.notif-item:last-child { border-bottom: 0; }

/* ---------- Tables & misc ---------- */
.leads-table th, .table thead th {
	font-size: 0.75rem;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: #6b7280;
	font-weight: 600;
	white-space: nowrap;
}
.detail-list dt { color: #6b7280; font-weight: 500; }
.detail-list dd { margin-bottom: 0.35rem; word-break: break-word; }

/* ---------- Auth ---------- */
.auth-body { background: linear-gradient(160deg, var(--sar-sidebar) 0%, #1e3a8a 100%); }
.auth-card { width: 100%; max-width: 430px; border-radius: 1rem; }
