@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
	--bg: #f3f4f8;
	--surface: #ffffff;
	--ink: #1c1f2e;
	--muted: #7a8299;
	--line: #e6e9f2;
	--line-soft: #eef0f6;
	--brand: #3d5afe;
	--brand-deep: #2a43d6;
	--brand-soft: #e8ecff;
	--peach: #ffe8dc;
	--peach-ink: #c45c26;
	--sky: #e3f0ff;
	--sky-ink: #2b6cb0;
	--lilac: #ece8ff;
	--lilac-ink: #5b4bb7;
	--mint: #e4f8ef;
	--mint-ink: #0f6b4c;
	--rose: #ffe4e8;
	--rose-ink: #b42318;
	--navy: #1b2437;
	--radius: 22px;
	--radius-sm: 14px;
	--radius-xs: 10px;
	--shadow: 0 8px 28px rgba(28, 31, 46, 0.06);
	--shadow-soft: 0 2px 10px rgba(28, 31, 46, 0.04);
	--sidebar-w: 260px;
	--topbar-h: 72px;
	--footer-h: 64px;
	--touch: 48px;
	--font: 'Manrope', 'Segoe UI', sans-serif;
	--mono: 'IBM Plex Mono', ui-monospace, monospace;
	--bs-body-font-family: var(--font);
	--bs-font-sans-serif: var(--font);
}

*,
*::before,
*::after { box-sizing: border-box; }

html, body {
	margin: 0;
	min-height: 100%;
	height: auto;
	overflow: auto;
}

body {
	font-family: var(--font);
	color: var(--ink);
	background: var(--bg);
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }

/* ——— Shell ——— */
.app-shell {
	display: flex;
	min-height: 100vh;
	height: auto;
	overflow: visible;
}

.sidebar {
	width: var(--sidebar-w);
	flex-shrink: 0;
	background: var(--surface);
	border-right: 1px solid var(--line-soft);
	padding: 1.25rem 1rem 1rem;
	display: flex;
	flex-direction: column;
	gap: 1rem;
	position: sticky;
	top: 0;
	height: 100vh;
	z-index: 1040;
}

.sidebar-brand {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 0.35rem 0.4rem 0.5rem;
}

.sidebar-logo {
	width: 42px;
	height: 42px;
	border-radius: 14px;
	display: grid;
	place-items: center;
	background: linear-gradient(145deg, var(--brand) 0%, #6b7cff 100%);
	color: #fff;
	font-size: 1.2rem;
	box-shadow: 0 8px 18px rgba(61, 90, 254, 0.28);
}

.sidebar-brand-name {
	font-weight: 800;
	font-size: 1.05rem;
	letter-spacing: -0.02em;
}

.sidebar-brand-tag {
	font-size: 0.72rem;
	color: var(--muted);
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.sidebar-cta {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.45rem;
	min-height: 46px;
	border-radius: 999px;
	background: var(--brand);
	color: #fff !important;
	font-weight: 700;
	font-size: 0.92rem;
	box-shadow: 0 10px 22px rgba(61, 90, 254, 0.28);
	transition: background 0.15s ease, transform 0.15s ease;
}

.sidebar-cta:hover {
	background: var(--brand-deep);
	transform: translateY(-1px);
}

.sidebar-nav {
	display: flex;
	flex-direction: column;
	gap: 0.2rem;
	flex: 1;
	overflow: auto;
	padding-right: 0.15rem;
}

.nav-group-label {
	font-size: 0.68rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--muted);
	margin: 0.85rem 0.65rem 0.35rem;
}

.sidebar-nav .nav-link {
	display: flex;
	align-items: center;
	gap: 0.7rem;
	padding: 0.7rem 0.85rem;
	border-radius: 12px;
	color: #4b556c !important;
	font-weight: 600;
	font-size: 0.92rem;
	min-height: 44px;
	transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-nav .nav-link i {
	width: 1.15rem;
	text-align: center;
	opacity: 0.85;
}

.sidebar-nav .nav-link:hover {
	background: var(--line-soft);
	color: var(--ink) !important;
}

.sidebar-nav .nav-link.active {
	background: var(--brand-soft);
	color: var(--brand-deep) !important;
}

.sidebar-footer {
	margin-top: auto;
	padding-top: 0.5rem;
}

.sidebar-plan {
	background: #f7f8fc;
	border-radius: 16px;
	padding: 0.9rem;
	border: 1px solid var(--line-soft);
}

.sidebar-plan-top {
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-weight: 700;
	font-size: 0.88rem;
}

.plan-badge {
	font-size: 0.68rem;
	font-weight: 800;
	padding: 0.2rem 0.5rem;
	border-radius: 999px;
	background: var(--mint);
	color: var(--mint-ink);
}

.sidebar-plan-bar {
	height: 6px;
	border-radius: 999px;
	background: #e5e8f2;
	margin: 0.65rem 0 0.45rem;
	overflow: hidden;
}

.sidebar-plan-bar span {
	display: block;
	width: 68%;
	height: 100%;
	border-radius: inherit;
	background: linear-gradient(90deg, var(--brand), #8ea0ff);
}

.sidebar-plan-hint {
	font-size: 0.75rem;
	color: var(--muted);
	font-weight: 500;
}

.app-main {
	flex: 1;
	min-width: 0;
	min-height: 100vh;
	display: flex;
	flex-direction: column;
	overflow: visible;
}

.topbar {
	height: var(--topbar-h);
	display: flex;
	align-items: center;
	gap: 0.85rem;
	padding: 0 clamp(1rem, 2.5vw, 1.75rem);
	position: sticky;
	top: 0;
	z-index: 1020;
	background: rgba(243, 244, 248, 0.85);
	backdrop-filter: blur(10px);
}

.sidebar-toggle {
	display: none;
	width: 44px;
	height: 44px;
	border: none;
	border-radius: 12px;
	background: var(--surface);
	box-shadow: var(--shadow-soft);
	color: var(--ink);
	font-size: 1.25rem;
}

.topbar-search {
	flex: 1;
	max-width: 520px;
	display: flex;
	align-items: center;
	gap: 0.55rem;
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: 999px;
	padding: 0.55rem 1rem;
	box-shadow: var(--shadow-soft);
	min-height: 46px;
}

.topbar-search i { color: var(--muted); }
.topbar-search input {
	border: none;
	outline: none;
	width: 100%;
	background: transparent;
	font: inherit;
	font-size: 0.92rem;
	color: var(--ink);
}

.topbar-actions {
	display: flex;
	align-items: center;
	gap: 0.55rem;
	margin-left: auto;
}

.topbar-chip {
	display: none;
	align-items: center;
	gap: 0.35rem;
	background: var(--mint);
	color: var(--mint-ink);
	font-size: 0.78rem;
	font-weight: 700;
	padding: 0.4rem 0.75rem;
	border-radius: 999px;
}

.topbar-icon-btn {
	width: 42px;
	height: 42px;
	border-radius: 50%;
	display: grid;
	place-items: center;
	background: var(--surface);
	border: 1px solid var(--line);
	color: var(--ink);
	box-shadow: var(--shadow-soft);
}

.topbar-avatar {
	width: 42px;
	height: 42px;
	border-radius: 50%;
	display: grid;
	place-items: center;
	background: var(--navy);
	color: #fff;
	font-weight: 800;
	font-size: 0.78rem;
}

.app-content {
	flex: 1 1 auto;
	overflow: visible;
	padding: 0.35rem clamp(1rem, 2.5vw, 1.75rem) 1.25rem;
	width: 100%;
	max-width: none;
}

.app-footer {
	flex: 0 0 auto;
	z-index: 1010;
	border-top: 1px solid var(--line);
	background: var(--surface);
	box-shadow: 0 -6px 24px rgba(28, 31, 46, 0.05);
}

.app-footer-inner {
	display: flex;
	align-items: center;
	min-height: var(--footer-h);
	padding: 0.7rem clamp(1rem, 2.5vw, 1.75rem);
}

.app-footer-tag {
	font-size: 0.7rem;
	font-weight: 600;
	color: var(--muted);
	letter-spacing: 0.02em;
}

.app-footer-copy {
	font-size: 0.76rem;
	font-weight: 600;
	color: var(--muted);
	margin-left: 0.35rem;
}

.sidebar-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(20, 24, 40, 0.35);
	z-index: 1035;
}

/* ——— Page header ——— */
.page-header {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	justify-content: space-between;
	gap: 1rem;
	margin-bottom: 1.25rem;
}

.page-kicker {
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--muted);
	margin-bottom: 0.35rem;
	display: flex;
	align-items: center;
	gap: 0.35rem;
}

.page-title {
	margin: 0;
	font-size: clamp(1.7rem, 3.2vw, 2.15rem);
	font-weight: 800;
	letter-spacing: -0.035em;
	line-height: 1.15;
}

.page-subtitle {
	margin: 0.4rem 0 0;
	color: var(--muted);
	font-size: 0.98rem;
	max-width: 38rem;
	font-weight: 500;
}

.header-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.6rem;
	align-items: center;
}

/* ——— Soft KPI cards ——— */
.stat-row {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 0.85rem;
	min-width: min(100%, 420px);
}

.stat-pill {
	position: relative;
	border-radius: 20px;
	padding: 1.05rem 1.1rem 1.15rem;
	border: none;
	box-shadow: var(--shadow-soft);
	overflow: hidden;
	min-height: 110px;
}

.stat-pill.valid { background: var(--mint); }
.stat-pill.invalid { background: var(--peach); }
.stat-pill.total { background: var(--sky); }

.stat-pill .label {
	font-size: 0.82rem;
	font-weight: 700;
	color: var(--ink);
	opacity: 0.75;
}

.stat-pill .value {
	font-size: clamp(1.7rem, 3vw, 2.1rem);
	font-weight: 800;
	letter-spacing: -0.03em;
	margin-top: 0.35rem;
	line-height: 1;
}

.stat-pill.valid .value { color: var(--mint-ink); }
.stat-pill.invalid .value { color: var(--peach-ink); }
.stat-pill.total .value { color: var(--sky-ink); }

.stat-pill::after {
	content: '';
	position: absolute;
	right: 0.9rem;
	bottom: 0.9rem;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.55);
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.7);
}

/* ——— Panels ——— */
.panel {
	background: var(--surface);
	border: 1px solid var(--line-soft);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	overflow: hidden;
	display: flex;
	flex-direction: column;
}

.panel-head {
	padding: 1.1rem 1.25rem 0.95rem;
	border-bottom: 1px solid var(--line-soft);
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 0.85rem;
	flex-wrap: wrap;
	background: transparent;
}

.panel-head h2 {
	margin: 0;
	font-size: 1.08rem;
	font-weight: 800;
	letter-spacing: -0.02em;
}

.panel-head .hint {
	margin: 0.2rem 0 0;
	font-size: 0.84rem;
	color: var(--muted);
	font-weight: 500;
}

.panel-body { padding: 1.2rem 1.25rem; flex: 1; }
.panel-body.p-0 { padding: 0; }

/* ——— Buttons / forms ——— */
.btn-primary,
.btn-primary:focus {
	background: var(--brand) !important;
	border-color: var(--brand) !important;
	font-weight: 700;
	min-height: var(--touch);
	padding-inline: 1.25rem;
	border-radius: 999px !important;
	box-shadow: 0 8px 18px rgba(61, 90, 254, 0.22);
}

.btn-primary:hover {
	background: var(--brand-deep) !important;
	border-color: var(--brand-deep) !important;
}

.btn-outline-secondary,
.btn-outline-primary,
.btn-outline-danger {
	min-height: var(--touch);
	padding-inline: 1.1rem;
	border-radius: 999px !important;
	font-weight: 700;
}

.btn-outline-secondary {
	border: 1.5px solid var(--line) !important;
	color: var(--ink) !important;
	background: #fff !important;
}

.btn-outline-primary {
	color: var(--brand-deep);
	border-color: #c5ceff;
}

.btn-outline-primary:hover {
	background: var(--brand-soft);
	color: var(--brand-deep);
	border-color: var(--brand);
}

.form-control, .form-select {
	border-radius: var(--radius-xs);
	border-color: var(--line);
	min-height: 44px;
	font-weight: 500;
}

.form-control:focus, .form-select:focus {
	border-color: var(--brand);
	box-shadow: 0 0 0 .2rem rgba(61, 90, 254, .15);
}

.form-label { font-weight: 700; color: var(--ink); font-size: .88rem; }

/* ——— Tables ——— */
.table-wrap {
	position: relative;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.table {
	margin: 0;
	width: 100%;
}

.table thead th {
	font-size: .72rem;
	text-transform: uppercase;
	letter-spacing: .04em;
	color: var(--muted);
	font-weight: 700;
	background: #f7f8fc;
	border-bottom-color: var(--line);
	white-space: nowrap;
	padding: 0.85rem 1rem;
}

.table td {
	vertical-align: middle;
	white-space: nowrap;
	padding: 0.8rem 1rem;
	font-size: 0.9rem;
	font-weight: 500;
}

.table tbody tr:hover { background: #fafbff; }

.table-mono {
	font-family: var(--mono);
	font-size: 0.82rem;
}

.empty-state {
	padding: 2.75rem 1.25rem;
	text-align: center;
	color: var(--muted);
}

.empty-state i {
	font-size: 2rem;
	opacity: 0.4;
	display: block;
	margin-bottom: 0.5rem;
}

.empty-state strong {
	display: block;
	color: var(--ink);
	font-weight: 800;
	margin-bottom: 0.2rem;
}

.pagination-bar {
	display: flex;
	justify-content: space-between;
	align-items: center;
	flex-wrap: wrap;
	gap: 0.75rem;
	padding: 0.95rem 1.2rem;
	border-top: 1px solid var(--line-soft);
	background: #fbfbfd;
}

.pagination-bar .btn {
	min-height: 40px;
	border-radius: 999px !important;
	font-weight: 700;
}

.th-pager {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: .65rem;
	padding: 0.95rem 1.2rem;
	border-top: 1px solid var(--line-soft);
	background: #fbfbfd;
}

.th-pager-btn {
	display: inline-flex;
	align-items: center;
	gap: .25rem;
	min-height: 44px;
	padding: .4rem .95rem;
	border-radius: 12px;
	font-weight: 700;
	font-size: .88rem;
	color: var(--brand-deep);
	background: var(--brand-soft);
	text-decoration: none;
	border: 1px solid transparent;
}

.th-pager-btn:hover { background: #dce3ff; color: var(--brand-deep); }

.th-pager-btn.is-disabled {
	opacity: .45;
	pointer-events: none;
	color: var(--muted);
	background: #eef0f6;
}

.th-pager-pages {
	display: flex;
	flex-wrap: wrap;
	gap: .3rem;
	justify-content: center;
	flex: 1;
}

.th-page-dot {
	min-width: 2.25rem;
	height: 2.25rem;
	padding: 0 .4rem;
	border-radius: 999px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-weight: 800;
	font-size: .85rem;
	color: var(--ink);
	background: transparent;
	text-decoration: none;
}

.th-page-dot:hover { background: var(--line-soft); }
.th-page-dot.active {
	background: var(--brand);
	color: #fff;
}
.th-page-ellipsis {
	display: inline-flex;
	align-items: center;
	color: var(--muted);
	font-weight: 700;
	padding: 0 .2rem;
}

.pager-meta {
	font-size: 0.84rem;
	color: var(--muted);
	font-weight: 650;
}

/* ——— Login (QC mq-login) ——— */
.mq-login-page {
	margin: 0;
	min-height: 100vh;
	font-family: var(--font);
	background:
		radial-gradient(900px 480px at 0% 0%, rgba(61, 90, 254, .12), transparent 55%),
		radial-gradient(700px 420px at 100% 0%, rgba(236, 232, 255, .8), transparent 50%),
		var(--bg);
}

.mq-login-shell {
	display: grid;
	grid-template-columns: 1.05fr .95fr;
	min-height: 100vh;
}

.mq-login-hero {
	display: flex;
	align-items: flex-end;
	padding: 2.5rem;
	background:
		linear-gradient(160deg, rgba(27, 36, 55, .88), rgba(61, 90, 254, .72)),
		linear-gradient(145deg, #1b2437, #3d5afe);
	color: #fff;
}

.mq-login-lead {
	font-size: clamp(1.35rem, 2.4vw, 1.8rem);
	max-width: 18ch;
	font-weight: 800;
	letter-spacing: -.03em;
	line-height: 1.2;
	margin-top: 1.75rem;
}

.mq-login-panel { display: grid; place-items: center; padding: 2rem; }

.mq-login-form {
	width: 100%;
	max-width: 420px;
	background: var(--surface);
	border: 1px solid var(--line-soft);
	border-radius: var(--radius);
	padding: 2rem;
	box-shadow: var(--shadow);
}

.mq-login-form h1 {
	font-size: 1.7rem;
	font-weight: 800;
	letter-spacing: -.03em;
	color: var(--ink);
	margin: 0 0 .25rem;
}

.mq-brand { display: flex; gap: .8rem; align-items: center; }

.mq-brand-lg .mq-brand-mark {
	width: 56px;
	height: 56px;
	border-radius: 16px;
	background: linear-gradient(145deg, var(--brand) 0%, #6b7cff 100%);
	color: #fff;
	font-weight: 800;
	display: grid;
	place-items: center;
	font-size: 1.1rem;
	box-shadow: 0 8px 18px rgba(61, 90, 254, .28);
}

.mq-brand-name { font-weight: 800; font-size: 1.05rem; letter-spacing: -.02em; }
.mq-brand-lg .mq-brand-name { font-size: 1.35rem; color: #fff; }
.mq-brand-tag {
	font-size: .72rem;
	color: var(--muted);
	font-weight: 600;
	letter-spacing: .04em;
	text-transform: uppercase;
}
.mq-brand-lg .mq-brand-tag { color: rgba(255, 255, 255, .75); }

@media (max-width: 991px) {
	.sidebar {
		position: fixed;
		left: 0;
		top: 0;
		bottom: 0;
		transform: translateX(-105%);
		transition: transform .2s ease;
		height: 100vh;
	}
	body.sidebar-open .sidebar { transform: translateX(0); }
	.sidebar-toggle { display: grid; place-items: center; }
	.app-main { width: 100%; }
	.mq-login-shell { grid-template-columns: 1fr; }
	.mq-login-hero { min-height: 220px; align-items: center; }
	.stat-row { grid-template-columns: 1fr; min-width: 0; width: 100%; }
	.topbar-chip { display: none; }
	.topbar-search { display: none; }
	.th-pager { flex-direction: column; align-items: stretch; }
	.th-pager-pages { order: -1; }
}

@media (min-width: 992px) {
	.topbar-chip { display: inline-flex; }
}

@media (max-width: 575px) {
	.page-title { font-size: 1.45rem; }
	.mq-login-form { padding: 1.5rem; }
	.mq-login-panel { padding: 1.25rem; }
}
