:root {
	--primary: #007cf0;
	--primary-dark: #0056b3;
	--dark: #0f172a;
	--sidebar: #111827;
	--surface: #ffffff;
	--bg: #f1f5f9;
	--border: #e2e8f0;
	--muted: #64748b;
	--success: #059669;
	--warning: #d97706;
	--danger: #dc2626;
	--font: Inter, system-ui, sans-serif;
	--mono: "JetBrains Mono", monospace;
	--sidebar-w: 240px;
}

* { box-sizing: border-box; }

body {
	margin: 0;
	font-family: var(--font);
	background: var(--bg);
	color: var(--dark);
	-webkit-font-smoothing: antialiased;
}

.demo-bar {
	background: var(--dark);
	color: #94a3b8;
	font-size: 0.75rem;
	padding: 8px 16px;
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}

.demo-bar a { color: #fff; text-decoration: none; font-weight: 600; }
.demo-bar a:hover { color: var(--primary); }
.demo-bar span { opacity: 0.35; }

/* Login */
.login-page { min-height: 100vh; display: flex; flex-direction: column; }

.login-wrap {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px 16px;
}

.login-card {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 12px;
	padding: clamp(24px, 5vw, 40px);
	width: 100%;
	max-width: 400px;
	box-shadow: 0 8px 24px rgba(0,0,0,.06);
}

.login-logo {
	font-family: var(--mono);
	font-weight: 700;
	font-size: 1rem;
	margin: 0 0 16px;
}

.login-logo span { color: var(--primary); }

.login-card h1 { margin: 0 0 8px; font-size: 1.5rem; }
.login-sub { color: var(--muted); font-size: 0.9rem; margin: 0 0 24px; line-height: 1.5; }

.login-form label { display: block; margin-bottom: 16px; }
.login-form label span { display: block; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 6px; }
.login-form input {
	width: 100%; padding: 12px 14px; border: 1px solid var(--border);
	border-radius: 8px; font: inherit; background: var(--bg);
}

.login-hint { font-size: 0.8rem; color: var(--muted); text-align: center; margin: 20px 0 0; }

/* App shell */
.app-shell { display: flex; min-height: calc(100vh - 36px); }

.sidebar-toggle {
	display: none;
	position: fixed;
	bottom: 16px;
	left: 16px;
	z-index: 200;
	width: 48px;
	height: 48px;
	border: none;
	border-radius: 12px;
	background: var(--primary);
	color: #fff;
	font-size: 1.25rem;
	cursor: pointer;
	box-shadow: 0 4px 16px rgba(0,124,240,.4);
}

.sidebar {
	width: var(--sidebar-w);
	background: var(--sidebar);
	color: #94a3b8;
	display: flex;
	flex-direction: column;
	padding: 20px 16px;
	flex-shrink: 0;
	position: sticky;
	top: 0;
	height: calc(100vh - 36px);
}

.sidebar-logo {
	font-family: var(--mono);
	font-weight: 700;
	color: #fff;
	text-decoration: none;
	font-size: 1rem;
	margin-bottom: 28px;
	display: block;
}

.sidebar-logo span { color: var(--primary); }

.sidebar-nav { display: grid; gap: 4px; flex: 1; align-content: start; }

.sidebar-nav a {
	color: #94a3b8;
	text-decoration: none;
	padding: 7px 12px;
	border-radius: 8px;
	font-weight: 500;
	font-size: 0.875rem;
	min-height: 36px;
	display: flex;
	align-items: center;
}

.sidebar-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar-nav a.is-active { background: var(--primary); color: #fff; }

.sidebar-foot { border-top: 1px solid rgba(255,255,255,.08); padding-top: 16px; }
.sidebar-user { margin: 0 0 8px; font-size: 0.875rem; color: #fff; font-weight: 600; }
.sidebar-logout { color: #94a3b8; font-size: 0.8125rem; }

.main { flex: 1; padding: clamp(16px, 4vw, 32px); min-width: 0; }

.page-header h1 { margin: 0 0 24px; font-size: clamp(1.35rem, 4vw, 1.75rem); font-weight: 700; }

/* Stats */
.stats-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr));
	gap: 12px;
	margin-bottom: 24px;
}

.stat-card {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 10px;
	padding: 16px;
}

.stat-label { display: block; font-size: 0.7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 6px; }
.stat-value { font-size: clamp(1.25rem, 3vw, 1.5rem); font-weight: 800; color: var(--dark); }

.panel-grid {
	display: grid;
	grid-template-columns: 1.5fr 1fr;
	gap: 16px;
}

.panel {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 10px;
	padding: clamp(16px, 3vw, 24px);
	margin-bottom: 16px;
}

.panel-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 16px;
	flex-wrap: wrap;
}

.panel-head h2 { margin: 0; font-size: 1rem; font-weight: 700; }
.panel-link { color: var(--primary); text-decoration: none; font-size: 0.875rem; font-weight: 600; }
.panel-note { font-size: 0.8125rem; color: var(--muted); line-height: 1.6; margin: 16px 0 0; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.data-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; min-width: 480px; }
.data-table th {
	text-align: left;
	font-size: 0.7rem;
	text-transform: uppercase;
	letter-spacing: .05em;
	color: var(--muted);
	padding: 7px 12px;
	border-bottom: 1px solid var(--border);
}
.data-table td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table small { color: var(--muted); }

.badge {
	display: inline-block;
	font-size: 0.65rem;
	font-weight: 700;
	text-transform: uppercase;
	padding: 4px 8px;
	border-radius: 4px;
}

.badge-success { background: #ecfdf5; color: var(--success); }
.badge-warning { background: #fffbeb; color: var(--warning); }
.badge-danger { background: #fef2f2; color: var(--danger); }
.badge-muted { background: #f1f5f9; color: var(--muted); }

.pipeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.pipeline li { display: grid; grid-template-columns: 70px 1fr 40px; align-items: center; gap: 10px; font-size: 0.875rem; }
.pipeline-bar { height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.pipeline-fill { height: 100%; border-radius: 4px; }
.fill-success { background: var(--success); }
.fill-warning { background: var(--warning); }
.fill-danger { background: var(--danger); }

.btn {
	display: inline-flex; align-items: center; justify-content: center;
	padding: 10px 18px; border-radius: 8px; font-weight: 600; font-size: 0.875rem;
	border: none; cursor: pointer; font-family: inherit; text-decoration: none;
	transition: .2s;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-sm { padding: 8px 14px; font-size: 0.8125rem; }
.btn-block { width: 100%; }

.btn-link { background: none; border: none; color: var(--primary); cursor: pointer; font: inherit; padding: 0; }
.btn-link.danger { color: var(--danger); }

.inline-form {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
	gap: 10px;
	margin-bottom: 16px;
	padding: 16px;
	background: var(--bg);
	border-radius: 8px;
}

.inline-form input, .inline-form select {
	padding: 7px 12px; border: 1px solid var(--border); border-radius: 8px; font: inherit;
}

.status-form select {
	padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; font: inherit; font-size: 0.8125rem;
}

.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 0.875rem; }
.alert-error { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
.alert-success { background: #ecfdf5; color: var(--success); border: 1px solid #a7f3d0; }

@media (max-width: 921px) {
	.panel-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
	.sidebar-toggle { display: flex; align-items: center; justify-content: center; }

	.sidebar {
		position: fixed;
		left: 0;
		top: 36px;
		z-index: 150;
		transform: translateX(-100%);
		transition: transform .25s ease;
		box-shadow: 4px 0 24px rgba(0,0,0,.2);
	}

	.sidebar.is-open { transform: translateX(0); }

	.main { padding-bottom: 80px; }

	.data-table { min-width: 560px; }
}

/* ─── WhatsApp floating action button ───────────────────── */
.jr-whatsapp-fab {
	position: fixed;
	bottom: 24px;
	right: 24px;
	z-index: 99999;
	width: 56px;
	height: 56px;
	border-radius: 50%;
	background: #25d366;
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	text-decoration: none;
	box-shadow: 0 4px 16px rgba(37,211,102,.45);
	transition: transform 0.2s, box-shadow 0.2s;
}

.jr-whatsapp-fab:hover {
	transform: scale(1.1);
	box-shadow: 0 6px 24px rgba(37,211,102,.6);
	color: #fff;
}

.jr-whatsapp-fab::before {
	content: '';
	position: absolute;
	inset: 0;
	border-radius: 50%;
	background: #25d366;
	animation: wa-pulse 2.4s ease-out infinite;
	z-index: -1;
}

@keyframes wa-pulse {
	0%   { transform: scale(1);   opacity: 0.6; }
	70%  { transform: scale(1.5); opacity: 0; }
	100% { transform: scale(1.5); opacity: 0; }
}
