/* =========================================================
   Check Nhà — dashboard UI
   ========================================================= */

:root {
	--bg:           #f5f6f8;
	--surface:      #ffffff;
	--border:       #eef0f3;
	--border-2:     #e5e7eb;
	--text:         #1f2937;
	--text-2:       #6b7280;
	--text-3:       #9ca3af;

	--green:   #16a34a;  --green-bg:   #e7f7ee;
	--blue:    #2563eb;  --blue-bg:    #e8f0fe;
	--purple:  #7c3aed;  --purple-bg:  #f1ecfe;
	--orange:  #ea580c;  --orange-bg:  #fdeee1;
	--teal:    #0d9488;  --teal-bg:    #e3f6f3;
	--amber:   #d97706;  --amber-bg:   #fdf0db;
	--rose:    #e11d48;  --rose-bg:    #fde7ec;
	--indigo:  #4f46e5;  --indigo-bg:  #ebebfe;

	--brand:        #0f766e;
	--brand-bg:     #e3f6f3;
	--pro-1:        #6366f1;
	--pro-2:        #8b5cf6;

	--radius:       16px;
	--radius-sm:    12px;
	--shadow:       0 1px 2px rgba(16,24,40,.04), 0 1px 3px rgba(16,24,40,.06);
	--shadow-md:    0 4px 16px rgba(16,24,40,.08);
	--sidebar-w:    248px;
	--font:         "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
	margin: 0;
	font-family: var(--font);
	background: var(--bg);
	color: var(--text);
	font-size: 15px;
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 700; }
ul { margin: 0; padding: 0; list-style: none; }
button { font-family: inherit; cursor: pointer; }

.icon { width: 20px; height: 20px; flex: 0 0 auto; }

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

/* ---------- Sidebar ---------- */
.sidebar {
	width: var(--sidebar-w);
	flex: 0 0 var(--sidebar-w);
	background: var(--surface);
	border-right: 1px solid var(--border);
	padding: 20px 16px;
	display: flex;
	flex-direction: column;
	gap: 4px;
	position: sticky;
	top: 0;
	height: 100vh;
	overflow-y: auto;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; }
.brand-logo {
	width: 40px; height: 40px; border-radius: 12px;
	background: var(--brand-bg); color: var(--brand);
	display: grid; place-items: center;
}
.brand-logo .icon { width: 22px; height: 22px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 17px; color: var(--text); }
.brand-text small { font-size: 11px; color: var(--text-3); }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-section {
	margin: 14px 8px 4px; font-size: 11px; font-weight: 600;
	letter-spacing: .06em; text-transform: uppercase; color: var(--text-3);
}
.nav-divider { height: 1px; background: var(--border); margin: 10px 8px; }

.nav-item {
	display: flex; align-items: center; gap: 11px;
	padding: 9px 10px; border-radius: 10px;
	color: var(--text-2); font-size: 14px; font-weight: 500;
	transition: background .15s, color .15s;
}
.nav-item .icon { width: 18px; height: 18px; color: var(--text-3); }
.nav-item:hover { background: #f7f8fa; color: var(--text); }
.nav-item:hover .icon { color: var(--text-2); }
.nav-item.is-active { background: var(--brand-bg); color: var(--brand); font-weight: 600; }
.nav-item.is-active .icon { color: var(--brand); }

/* PRO promo box */
.pro-box {
	margin-top: auto;
	background: linear-gradient(150deg, var(--pro-1), var(--pro-2));
	color: #fff; border-radius: var(--radius); padding: 16px;
}
.pro-box > strong { font-size: 15px; }
.pro-box ul { margin: 10px 0 14px; display: flex; flex-direction: column; gap: 7px; }
.pro-box li { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: rgba(255,255,255,.92); }
.pro-box li .icon { width: 15px; height: 15px; color: #fff; }
.pro-box-btn {
	display: block; text-align: center; background: #fff; color: var(--pro-1);
	font-weight: 600; font-size: 13.5px; padding: 9px; border-radius: 10px;
}
.pro-box-btn:hover { background: #f3f1ff; }

.user { display: flex; align-items: center; gap: 10px; padding: 14px 6px 4px; margin-top: 12px; border-top: 1px solid var(--border); }
.user-avatar {
	width: 36px; height: 36px; border-radius: 50%;
	background: linear-gradient(135deg, #60a5fa, #6366f1); color: #fff;
	display: grid; place-items: center; font-size: 13px; font-weight: 600;
}
.user-meta { display: flex; flex-direction: column; gap: 2px; }
.user-meta strong { font-size: 13.5px; }
.badge { display: inline-block; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 6px; }
.badge-free { background: #f1f2f4; color: var(--text-2); width: max-content; }

/* ---------- Main ---------- */
.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.topbar {
	position: sticky; top: 0; z-index: 20;
	display: flex; align-items: center; gap: 16px;
	padding: 14px 32px; background: var(--bg);
	border-bottom: 1px solid var(--border);
}
.searchbar {
	flex: 1 1 auto; max-width: 520px;
	display: flex; align-items: center; gap: 10px;
	background: var(--surface); border: 1px solid var(--border-2);
	border-radius: 12px; padding: 0 14px; height: 44px;
}
.searchbar .icon { color: var(--text-3); width: 18px; height: 18px; }
.searchbar input { flex: 1; border: none; outline: none; background: none; font-size: 14px; color: var(--text); }
.searchbar input::placeholder { color: var(--text-3); }

.topbar-right { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.icon-btn {
	position: relative; width: 42px; height: 42px; border-radius: 12px;
	border: 1px solid var(--border-2); background: var(--surface); color: var(--text-2);
	display: grid; place-items: center;
}
.icon-btn:hover { background: #f7f8fa; }
.badge-dot {
	position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px;
	padding: 0 4px; border-radius: 9px; background: #ef4444; color: #fff;
	font-size: 11px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--bg);
}
.btn-pro {
	display: inline-flex; align-items: center; gap: 7px;
	background: linear-gradient(135deg, var(--pro-1), var(--pro-2)); color: #fff;
	font-weight: 600; font-size: 14px; padding: 11px 18px; border-radius: 12px;
	box-shadow: 0 6px 16px rgba(99,102,241,.32);
}
.btn-pro:hover { filter: brightness(1.05); }
.btn-pro .icon { width: 16px; height: 16px; fill: #fff; stroke: #fff; }

.content { padding: 32px; max-width: 1400px; width: 100%; margin: 0 auto; }

/* ---------- Hero ---------- */
/* ---------- Hero CTA banner ---------- */
.hero-cta {
	display: flex; align-items: center; gap: 22px; margin-bottom: 30px;
	background: linear-gradient(135deg, #f0fdf4, var(--surface) 60%);
	border: 1px solid var(--green-bg); border-radius: var(--radius);
	padding: 24px 26px; box-shadow: var(--shadow);
}
.hero-cta-ic {
	flex: none; width: 56px; height: 56px; border-radius: 16px;
	display: inline-flex; align-items: center; justify-content: center;
	background: var(--green-bg); color: var(--green);
}
.hero-cta-ic .icon { width: 28px; height: 28px; }
.hero-cta-text { flex: 1; min-width: 0; }
.hero-eyebrow {
	display: block; font-size: 12px; font-weight: 700; letter-spacing: .06em;
	text-transform: uppercase; color: var(--green); margin-bottom: 6px;
}
.hero-cta h1 { font-size: 26px; line-height: 1.25; letter-spacing: -.01em; }
.hero-cta .hl { color: var(--green); }
.hero-cta p { margin: 8px 0 0; color: var(--text-2); font-size: 15px; }
.hero-cta-btn {
	flex: none; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
	background: linear-gradient(135deg, #22c55e, var(--green)); color: #fff;
	font-weight: 700; font-size: 15px; padding: 14px 24px; border-radius: 999px;
	box-shadow: 0 8px 20px rgba(22,163,74,.30);
	transition: transform .15s, filter .15s;
}
.hero-cta-btn .icon { width: 18px; height: 18px; transition: transform .15s; }
.hero-cta-btn:hover { filter: brightness(1.04); transform: translateY(-1px); }
.hero-cta-btn:hover .icon { transform: translateX(3px); }

/* Pulse "kích thích click" — nhẹ nhàng, dễ chịu */
.hero-cta-btn.pulse { animation: cn-pulse 2.2s ease-in-out infinite; }
@keyframes cn-pulse {
	0%, 100% { box-shadow: 0 8px 20px rgba(22,163,74,.30), 0 0 0 0 rgba(22,163,74,.40); }
	50%      { box-shadow: 0 10px 24px rgba(22,163,74,.40), 0 0 0 10px rgba(22,163,74,0); }
}
@media (prefers-reduced-motion: reduce) {
	.hero-cta-btn.pulse { animation: none; }
}

/* ---------- Tool cards ---------- */
.tools {
	display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 18px;
	margin-bottom: 30px;
}
.tool-card {
	background: var(--surface); border: 1px solid var(--border);
	border-radius: var(--radius); padding: 22px 18px; text-align: center;
	box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center;
	transition: transform .15s, box-shadow .15s;
}
.tool-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.tool-icon {
	width: 60px; height: 60px; border-radius: 16px;
	display: grid; place-items: center; margin-bottom: 14px;
	background: var(--accent-bg); color: var(--accent);
}
.tool-icon .icon { width: 28px; height: 28px; }
.tool-card h3 { font-size: 16px; color: var(--accent); }
.tool-card p { margin: 8px 0 16px; font-size: 13px; color: var(--text-2); flex: 1; }
.tool-cta {
	display: block; width: 100%; padding: 11px; border-radius: 10px;
	background: var(--accent-bg); color: var(--accent); font-weight: 600; font-size: 13.5px;
	transition: filter .15s;
}
.tool-cta:hover { filter: brightness(.97); }

/* accent helpers */
.accent-green  { --accent: var(--green);  --accent-bg: var(--green-bg); }
.accent-blue   { --accent: var(--blue);   --accent-bg: var(--blue-bg); }
.accent-purple { --accent: var(--purple); --accent-bg: var(--purple-bg); }
.accent-orange { --accent: var(--orange); --accent-bg: var(--orange-bg); }
.accent-teal   { --accent: var(--teal);   --accent-bg: var(--teal-bg); }
.accent-amber  { --accent: var(--amber);  --accent-bg: var(--amber-bg); }
.accent-rose   { --accent: var(--rose);   --accent-bg: var(--rose-bg); }
.accent-indigo { --accent: var(--indigo); --accent-bg: var(--indigo-bg); }

/* ---------- Panels ---------- */
.panel {
	background: var(--surface); border: 1px solid var(--border);
	border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow);
}
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.panel-head h2 { font-size: 18px; }
.link-all { color: var(--blue); font-size: 13.5px; font-weight: 600; }
.link-all:hover { text-decoration: underline; }

.dash-row { display: grid; grid-template-columns: minmax(0,1fr) 320px; gap: 22px; margin-bottom: 30px; }

/* ---------- Project cards ---------- */
.project-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.project-card { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); transition: box-shadow .15s; }
.project-card:hover { box-shadow: var(--shadow-md); }
.project-thumb { position: relative; height: 130px; display: grid; place-items: center; color: rgba(255,255,255,.85); overflow: hidden; }
.project-thumb .thumb-ic { width: 34px; height: 34px; }
.project-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.project-thumb.is-checking { background: linear-gradient(135deg, #e0e7ff, #c7d2fe); color: var(--brand); }
.thumb-loader { display: flex; flex-direction: column; align-items: center; gap: 9px; }
.thumb-spinner { width: 30px; height: 30px; border: 3px solid rgba(99,102,241,.28); border-top-color: var(--brand); border-radius: 50%; animation: cn-spin .8s linear infinite; }
.thumb-loading-text { font-size: 12.5px; font-weight: 600; color: var(--brand); }
@keyframes cn-spin { to { transform: rotate(360deg); } }
.tone-warm { background: linear-gradient(135deg, #d9a679, #b27d50); }
.tone-cool { background: linear-gradient(135deg, #aab6c4, #7e8ea1); }
.tone-dark { background: linear-gradient(135deg, #4b5563, #2d333d); }
.project-body { padding: 14px; }
.project-body h3 { font-size: 14.5px; }
.project-sub { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 8px 0 12px; }
.project-sub > span:first-child { font-size: 12px; color: var(--text-3); }
.status { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 20px; white-space: nowrap; }
.status-done { background: var(--green-bg); color: var(--green); }
.status-progress { background: var(--orange-bg); color: var(--orange); }
.project-stats { display: flex; gap: 16px; padding-top: 12px; border-top: 1px solid var(--border); }
.project-stats span { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--text-2); }
.project-stats .icon { width: 15px; height: 15px; color: var(--text-3); }

/* ---------- Insights ---------- */
.insight-list { display: flex; flex-direction: column; }
.insight-list li {
	display: grid; grid-template-columns: 38px auto 1fr; align-items: center; gap: 12px;
	padding: 13px 0; border-bottom: 1px solid var(--border);
}
.insight-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-bg); color: var(--accent); }
.insight-icon .icon { width: 19px; height: 19px; }
.insight-value { font-size: 20px; font-weight: 700; }
.insight-label { font-size: 13px; color: var(--text-2); }
.insight-total { margin: 16px 0 0; font-size: 13.5px; color: var(--text-2); }
.insight-total strong { color: var(--text); }

/* ---------- Library ---------- */
.library-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; }
.library-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; background: #fbfbfc; transition: box-shadow .15s, transform .15s; }
.library-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); background: #fff; }
.library-card h3 { font-size: 14px; }
.library-card p { margin: 8px 0 14px; font-size: 12.5px; color: var(--text-2); min-height: 50px; }
.library-count { font-size: 13.5px; font-weight: 700; color: var(--orange); }

/* ---------- Mobile sidebar toggle ---------- */
.sidebar-toggle {
	display: none; position: fixed; top: 16px; left: 16px; z-index: 60;
	width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--border-2);
	background: var(--surface); flex-direction: column; gap: 4px; align-items: center; justify-content: center;
}
.sidebar-toggle span { width: 20px; height: 2px; background: var(--text); border-radius: 2px; }
.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 40; }
body.nav-open .sidebar-backdrop { display: block; }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
	.tools, .library-grid { grid-template-columns: repeat(3, 1fr); }
	.dash-row { grid-template-columns: 1fr; }
	.insights { order: -1; }
}
@media (max-width: 900px) {
	.content, .topbar { padding-left: 20px; padding-right: 20px; }
	.project-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
	.sidebar-toggle { display: flex; }
	.sidebar {
		position: fixed; left: 0; top: 0; z-index: 50;
		transform: translateX(-100%); transition: transform .25s ease;
		box-shadow: var(--shadow-md);
	}
	body.nav-open .sidebar { transform: translateX(0); }
	.topbar { padding-left: 72px; }
	.tools, .library-grid { grid-template-columns: repeat(2, 1fr); }
	.hero-cta { flex-direction: column; align-items: flex-start; gap: 16px; padding: 20px; }
	.hero-cta h1 { font-size: 22px; }
	.hero-cta-btn { width: 100%; justify-content: center; }
}
@media (max-width: 560px) {
	.tools { grid-template-columns: repeat(2, 1fr); gap: 12px; }
	.library-grid, .project-grid { grid-template-columns: 1fr; }
	.tool-card { padding: 16px 12px; }
	.tool-icon { width: 50px; height: 50px; border-radius: 14px; margin-bottom: 10px; }
	.tool-icon .icon { width: 24px; height: 24px; }
	.tool-card h3 { font-size: 14.5px; }
	.tool-card p { font-size: 12px; margin: 6px 0 12px; }
	.tool-cta { padding: 9px; font-size: 12.5px; }
	.score-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
	.score-card { padding: 11px 10px; gap: 10px; }
	.score-ic { width: 36px; height: 36px; border-radius: 10px; }
	.score-ic .icon { width: 18px; height: 18px; }
	.score-val { font-size: 18px; }
	.score-label { font-size: 11.5px; }
	.analysis-grid, .material-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
	.cat-cols { grid-template-columns: 1fr; gap: 10px; }
	.cat-score { font-size: 16px; }
	.d3-time { grid-template-columns: 1fr; }
	.d3-cc-list li { flex-direction: column; gap: 4px; }
	.d3-cc-lb { flex-basis: auto; align-self: flex-start; }
	.d3-cost-list li { flex-direction: column; gap: 3px; }
	.d3-cost-list b { max-width: none; text-align: left; }
	.btn-pro span, .btn-pro { font-size: 0; gap: 0; padding: 11px; }
	.btn-pro .icon { width: 18px; height: 18px; }
}

/* =========================================================
   Trang module (views)
   ========================================================= */

.tool-card { color: inherit; }

/* Breadcrumb + page header */
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-3); margin-bottom: 14px; }
.breadcrumb a { color: var(--text-2); }
.breadcrumb a:hover { color: var(--text); }
.breadcrumb .icon { width: 14px; height: 14px; }

.page-head { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.page-icon { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: var(--accent-bg); color: var(--accent); flex: 0 0 auto; }
.page-icon .icon { width: 26px; height: 26px; }
.page-head-text { flex: 1; min-width: 0; }
.page-head-text h1 { font-size: 24px; }
.page-head-text p { margin: 6px 0 0; color: var(--text-2); font-size: 14px; }
.badge-free-lg { align-self: flex-start; background: var(--green-bg); color: var(--green); font-size: 12px; font-weight: 700; padding: 5px 12px; border-radius: 20px; white-space: nowrap; }

/* Layout 2 cột check */
.check-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 22px; align-items: start; }
.check-main { display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.check-side { display: flex; flex-direction: column; gap: 18px; }

.side-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.side-card h3 { font-size: 15px; margin-bottom: 12px; }
.side-text { font-size: 13px; color: var(--text-2); margin: 0; }
.tick-list { display: flex; flex-direction: column; gap: 9px; }
.tick-list li { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: var(--text-2); }
.tick-list .icon { width: 16px; height: 16px; color: var(--green); flex: 0 0 auto; margin-top: 1px; }

.process-list { display: flex; flex-direction: column; gap: 10px; counter-reset: step; }
.process-list li { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-2); }
.process-no { width: 22px; height: 22px; border-radius: 50%; background: var(--brand-bg); color: var(--brand); font-size: 12px; font-weight: 700; display: grid; place-items: center; flex: 0 0 auto; }

/* Dropzone */
.dropzone {
	background: var(--surface); border: 2px dashed var(--border-2); border-radius: var(--radius);
	padding: 36px 24px; text-align: center; transition: border-color .15s, background .15s;
}
.dropzone.is-drag { border-color: var(--brand); background: var(--brand-bg); }
.dropzone-icon { width: 56px; height: 56px; border-radius: 50%; background: var(--brand-bg); color: var(--brand); display: grid; place-items: center; margin: 0 auto 14px; }
.dropzone-icon .icon { width: 26px; height: 26px; }
.dropzone-title { font-size: 16px; font-weight: 600; margin: 0; }
.dropzone-sub { font-size: 13px; color: var(--text-3); margin: 6px 0 16px; }
.dropzone-files { font-size: 13px; color: var(--brand); font-weight: 600; margin: 12px 0 0; }
.dropzone-note { font-size: 12px; color: var(--text-3); margin: 14px 0 0; }

.btn-primary {
	display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
	background: linear-gradient(135deg, var(--pro-1), var(--pro-2)); color: #fff;
	font-weight: 600; font-size: 14px; padding: 11px 20px; border: none; border-radius: 12px;
	box-shadow: 0 6px 16px rgba(99,102,241,.28);
}
.btn-primary:hover { filter: brightness(1.05); }
.btn-primary .icon { width: 17px; height: 17px; }

/* Result cards */
.result-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.section-title { font-size: 16px; margin-bottom: 16px; }
.result-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 24px; color: var(--text-3); }
.result-empty .icon { width: 30px; height: 30px; }
.result-empty p { margin: 0; font-size: 13.5px; max-width: 440px; }
.result-hint { font-size: 13px; color: var(--text-3); margin: 14px 0 0; }

/* Score grid */
.score-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.score-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; display: flex; flex-direction: row; align-items: center; gap: 12px; background: #fbfbfc; }
.score-ic { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; flex: 0 0 auto; }
.score-ic .icon { width: 21px; height: 21px; }
.score-body { display: flex; flex-direction: column; min-width: 0; }
.score-val { font-size: 22px; font-weight: 700; color: var(--text-2); line-height: 1.1; }
.score-val small { font-size: 12px; color: var(--text-3); font-weight: 500; }
.score-label { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.score-card.tone-good .score-ic { background: var(--green-bg); color: var(--green); }
.score-card.tone-warn .score-ic { background: var(--amber-bg); color: var(--amber); }
.score-card.tone-risk .score-ic { background: var(--rose-bg); color: var(--rose); }

/* Tables */
.table-wrap { overflow-x: auto; }
.compare-table, .history-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.compare-table th, .compare-table td, .history-table th, .history-table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.compare-table thead th, .history-table thead th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); background: #fafbfc; }
.compare-table tbody th { font-weight: 600; }
.compare-table tbody th.crit-cell { white-space: nowrap; }
.compare-table .crit-inner { display: inline-flex; align-items: center; gap: 9px; }
.compare-table tbody th .cell-ic { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; background: var(--brand-bg); color: var(--brand); vertical-align: middle; flex: 0 0 auto; }
.compare-table tbody th .cell-ic .icon { width: 14px; height: 14px; }
.compare-table .cell-label { line-height: 1.3; }
.compare-table td { color: var(--text-3); }
/* Màu theo cột: đơn vị A xanh dương, B xanh lá... — nhận xét AI đỏ */
.compare-table .u-0 { color: var(--blue); font-weight: 500; }
.compare-table .u-1 { color: var(--green); font-weight: 500; }
.compare-table .u-2 { color: var(--purple); font-weight: 500; }
.compare-table .u-3 { color: var(--orange); font-weight: 500; }
.compare-table .u-4 { color: var(--teal); font-weight: 500; }
.compare-table thead th.u-0, .compare-table thead th.u-1, .compare-table thead th.u-2, .compare-table thead th.u-3, .compare-table thead th.u-4, .compare-table thead th.note-col { font-weight: 700; }
.compare-table .note-col { color: #dc2626; }
.history-tool { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--brand); }
.history-tool .icon { width: 16px; height: 16px; }

/* Analysis grid */
.analysis-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.analysis-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; background: #fbfbfc; }
.analysis-ic { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-bg); color: var(--brand); }
.analysis-ic .icon { width: 20px; height: 20px; }
.analysis-card h3 { font-size: 14.5px; margin: 12px 0 6px; }
.analysis-card p { font-size: 12.5px; color: var(--text-2); margin: 0 0 12px; }
.analysis-state { font-size: 11.5px; font-weight: 600; color: var(--text-3); background: #f1f2f4; padding: 3px 10px; border-radius: 20px; }

/* Checklist */
.checklist { display: flex; flex-direction: column; gap: 10px; }
.checklist-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fbfbfc; }
.checklist-ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-bg); color: var(--brand); flex: 0 0 auto; }
.checklist-ic .icon { width: 18px; height: 18px; }
.checklist-item div { flex: 1; display: flex; flex-direction: column; }
.checklist-item strong { font-size: 14px; }
.checklist-item span { font-size: 12.5px; color: var(--text-2); }
.checklist-state { font-size: 18px; color: var(--text-3); font-weight: 700; }

/* Material grid */
.material-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.material-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; background: #fbfbfc; }
.material-tag { display: inline-block; font-weight: 700; font-size: 13px; color: var(--teal); background: var(--teal-bg); padding: 4px 12px; border-radius: 8px; margin-bottom: 10px; }
.material-card p { font-size: 12.5px; color: var(--text-2); margin: 0; }

/* Error library */
.errlib-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.errlib-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.errlib-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.errlib-ic { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; background: var(--accent-bg); color: var(--accent); }
.errlib-ic .icon { width: 21px; height: 21px; }
.errlib-head h3 { font-size: 15.5px; }
.errlib-list { display: flex; flex-direction: column; gap: 10px; }
.errlib-list li { display: flex; align-items: center; gap: 9px; font-size: 13.5px; color: var(--text-2); }
.errlib-list .icon { width: 16px; height: 16px; color: var(--accent); flex: 0 0 auto; }

/* Chat (Hỏi AI) */
.chat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 16px; }
.chat-thread { display: flex; flex-direction: column; gap: 14px; min-height: 220px; }
.chat-msg { display: flex; gap: 10px; max-width: 80%; }
.chat-ai { align-self: flex-start; }
.chat-user { align-self: flex-end; flex-direction: row-reverse; }
.chat-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-bg); color: var(--brand); display: grid; place-items: center; flex: 0 0 auto; }
.chat-avatar .icon { width: 18px; height: 18px; }
.chat-bubble { background: #f4f5f7; border-radius: 14px; padding: 11px 15px; font-size: 14px; line-height: 1.55; }
.chat-user .chat-bubble { background: var(--brand); color: #fff; }
.chat-suggest { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: var(--surface); border: 1px solid var(--border-2); border-radius: 20px; padding: 8px 14px; font-size: 13px; color: var(--text-2); cursor: pointer; transition: background .15s, border-color .15s; }
.chip:hover { background: var(--brand-bg); border-color: var(--brand); color: var(--brand); }
.chat-input { display: flex; gap: 10px; }
.chat-input input { flex: 1; border: 1px solid var(--border-2); border-radius: 12px; padding: 0 16px; height: 46px; font-size: 14px; outline: none; }
.chat-input input:focus { border-color: var(--brand); }
.chat-note { font-size: 12px; color: var(--text-3); margin: 0; text-align: center; }

/* Saved questions */
.saved-list { display: flex; flex-direction: column; }
.saved-list li { display: flex; align-items: center; gap: 12px; padding: 14px 4px; border-bottom: 1px solid var(--border); }
.saved-list li:last-child { border-bottom: 0; }
.saved-ic { width: 34px; height: 34px; border-radius: 10px; background: var(--purple-bg); color: var(--purple); display: grid; place-items: center; flex: 0 0 auto; }
.saved-ic .icon { width: 17px; height: 17px; }
.saved-q { flex: 1; font-size: 14px; }
.saved-go { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 600; color: var(--brand); white-space: nowrap; }
.saved-go .icon { width: 15px; height: 15px; }

/* Toolbar dự án */
.projects-toolbar { display: flex; justify-content: flex-end; margin-bottom: 18px; }
.project-grid-wide { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

@media (max-width: 1100px) {
	.check-layout { grid-template-columns: 1fr; }
	.check-side { flex-direction: row; flex-wrap: wrap; }
	.check-side > * { flex: 1 1 240px; }
}
@media (max-width: 600px) {
	.page-head { flex-wrap: wrap; }
	.check-side { flex-direction: column; }
	.chat-msg { max-width: 95%; }
}

/* =========================================================
   Kết quả demo (spec) — điểm, cảnh báo, CTA, thư viện, PRO
   ========================================================= */

/* Nhãn demo */
.demo-badge { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: #5b6470; background: var(--indigo-bg); border: 1px solid #e0e0fb; border-radius: 10px; padding: 9px 14px; margin: 0; }
.demo-badge .icon { width: 16px; height: 16px; color: var(--indigo); flex: 0 0 auto; }

/* Tổng điểm + rủi ro */
.score-hero { display: flex; align-items: center; gap: 20px; padding-bottom: 18px; margin-bottom: 18px; border-bottom: 1px solid var(--border); }
.score-hero-num { display: flex; align-items: baseline; gap: 2px; }
.score-hero-num strong { font-size: 44px; line-height: 1; }
.score-hero-num span { font-size: 18px; color: var(--text-3); }
.score-hero-meta { display: flex; flex-direction: column; gap: 8px; }
.score-hero-label { font-size: 13px; color: var(--text-3); }
.risk-badge, .sev-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; padding: 5px 12px; border-radius: 20px; width: fit-content; }
.risk-badge .icon { width: 15px; height: 15px; }
.risk-badge.tone-good, .sev-badge.tone-good { background: var(--green-bg); color: var(--green); }
.risk-badge.tone-warn, .sev-badge.tone-warn { background: var(--amber-bg); color: var(--amber); }
.risk-badge.tone-risk, .sev-badge.tone-risk { background: var(--rose-bg); color: var(--rose); }

/* Danh sách cảnh báo chi tiết */
.warning-list { list-style: none; display: flex; flex-direction: column; gap: 14px; padding: 0; margin: 0; }
.warn-item { display: block; border: 1px solid var(--border); border-left: 4px solid var(--border-2); border-radius: var(--radius-sm); padding: 16px 18px; background: #fff; }
.warn-item.lvl-cao { border-left-color: #dc2626; }
.warn-item.lvl-tb { border-left-color: var(--amber); }
.warn-item.lvl-thap { border-left-color: #ca8a04; }
.warn-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.warn-muc { font-size: 12px; font-weight: 700; color: #374151; background: #eef0f3; padding: 3px 11px; border-radius: 20px; }
.warn-lvl { font-size: 11.5px; font-weight: 700; padding: 3px 11px; border-radius: 20px; }
.warn-lvl.lvl-cao { background: #fee2e2; color: #dc2626; }
.warn-lvl.lvl-tb { background: var(--amber-bg); color: var(--amber); }
.warn-lvl.lvl-thap { background: #fef9c3; color: #a16207; }
.warn-quote { font-style: italic; color: var(--text-2); background: #f6f7f9; border-radius: 8px; padding: 9px 12px; margin: 0 0 12px; font-size: 13px; line-height: 1.5; }
.warn-field { display: block; font-size: 13.5px; color: #b91c1c; margin: 0 0 9px; line-height: 1.55; }
.warn-field .warn-label { font-weight: 700; color: #dc2626; }
.warn-ask { display: flex; align-items: flex-start; gap: 8px; font-size: 13.5px; color: #075985; background: #e0f2fe; border-radius: 8px; padding: 11px 13px; margin: 12px 0 0; line-height: 1.55; }
.warn-ask-ic { flex: 0 0 auto; }
.warn-ask-ic .icon { display: block; width: 16px; height: 16px; margin-top: 1px; color: #0284c7; }
.warn-ask-body { flex: 1 1 auto; min-width: 0; }
.warn-ask-label { font-weight: 700; color: #0284c7; }
.tick-list-lg li { font-size: 14px; align-items: flex-start; }
.tick-list-lg .icon { margin-top: 2px; }

/* Check báo giá — phân tích chi tiết theo hạng mục */
.cat-list { display: flex; flex-direction: column; gap: 16px; }
.cat-block { border: 1px solid var(--border); border-left: 4px solid var(--border-2); border-radius: var(--radius-sm); padding: 16px 18px; background: #fff; }
.cat-block.tone-good { border-left-color: var(--green); }
.cat-block.tone-warn { border-left-color: var(--amber); }
.cat-block.tone-risk { border-left-color: #dc2626; }
.cat-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cat-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: #f1f2f4; color: var(--text-2); flex: 0 0 auto; }
.cat-block.tone-good .cat-ic { background: var(--green-bg); color: var(--green); }
.cat-block.tone-warn .cat-ic { background: var(--amber-bg); color: var(--amber); }
.cat-block.tone-risk .cat-ic { background: var(--rose-bg); color: var(--rose); }
.cat-ic .icon { width: 18px; height: 18px; }
.cat-title { font-size: 15px; font-weight: 700; }
.cat-score { margin-left: auto; font-size: 18px; font-weight: 800; color: var(--text); }
.cat-score small { font-size: 12px; font-weight: 600; color: var(--text-3); }
.cat-level { font-size: 11.5px; font-weight: 700; padding: 4px 11px; border-radius: 20px; }
.cat-level.tone-good { background: var(--green-bg); color: var(--green); }
.cat-level.tone-warn { background: var(--amber-bg); color: var(--amber); }
.cat-level.tone-risk { background: #fee2e2; color: #dc2626; }
.cat-summary { margin: 12px 0 0; font-size: 13.5px; color: var(--text-2); line-height: 1.55; }
.cat-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.cat-col { border-radius: 10px; padding: 12px 14px; }
.cat-clear { background: #f0fdf4; border: 1px solid #dcfce7; }
.cat-missing { background: #fffbeb; border: 1px solid #fef3c7; }
.cat-col h4 { display: flex; align-items: center; gap: 7px; font-size: 13px; margin: 0 0 8px; }
.cat-col h4 .icon { width: 15px; height: 15px; }
.cat-clear h4 { color: #15803d; }
.cat-clear h4 .icon { color: var(--green); }
.cat-missing h4 { color: #b45309; }
.cat-missing h4 .icon { color: var(--amber); }
.cat-col ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cat-col li { position: relative; padding-left: 14px; font-size: 13px; color: var(--text); line-height: 1.5; }
.cat-col li::before { content: ""; position: absolute; left: 2px; top: 8px; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .45; }
.cat-field { display: block; font-size: 13.5px; margin: 12px 0 0; line-height: 1.55; }
.cat-risk { color: #b91c1c; }
.cat-flabel { font-weight: 700; color: #dc2626; }
.cat-ask { display: flex; align-items: flex-start; gap: 8px; font-size: 13.5px; color: #075985; background: #e0f2fe; border-radius: 8px; padding: 11px 13px; margin: 12px 0 0; line-height: 1.55; }
.cat-ask-ic { flex: 0 0 auto; }
.cat-ask-ic .icon { display: block; width: 16px; height: 16px; margin-top: 1px; color: #0284c7; }
.cat-ask-body { flex: 1 1 auto; min-width: 0; }
.cat-ask-label { font-weight: 700; color: #0284c7; }

/* Check 3D V2 — khảo sát gia đình + phân tích theo người sử dụng */
.survey-card { background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; }
.survey-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.survey-ic { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: var(--purple-bg); color: var(--purple); flex: 0 0 auto; }
.survey-ic .icon { width: 20px; height: 20px; }
.survey-head-text h3 { font-size: 15px; margin: 0 0 3px; }
.survey-head-text p { font-size: 13px; color: var(--text-2); margin: 0; line-height: 1.5; }
.survey-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.survey-field { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--text-2); font-weight: 600; }
.survey-field select, .survey-field input { font-size: 13.5px; font-weight: 500; color: var(--text); padding: 9px 11px; border: 1px solid var(--border-2); border-radius: 10px; background: #fff; outline: none; }
.survey-field select:focus, .survey-field input:focus { border-color: var(--brand); }

.d3-design { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; }
.d3-chip { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text); background: #f6f7f9; border: 1px solid var(--border); border-radius: 20px; padding: 6px 13px; }
.d3-chip b { font-weight: 600; color: var(--text-3); }
.d3-mat { font-size: 12.5px; font-weight: 600; color: var(--purple); background: var(--purple-bg); border-radius: 20px; padding: 6px 12px; }

.aud-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.aud-item { border-top: 1px dashed var(--border-2); padding-top: 12px; }
.aud-item:first-child { border-top: 0; padding-top: 0; }
.aud-issue { font-size: 14px; font-weight: 600; color: var(--text); margin: 0 0 5px; line-height: 1.5; }
.aud-risk { font-size: 13.5px; color: #b91c1c; margin: 0 0 6px; line-height: 1.5; }
.aud-risk span { font-weight: 700; color: #dc2626; }
.aud-fix { display: flex; align-items: flex-start; gap: 7px; font-size: 13.5px; color: #15803d; margin: 0; line-height: 1.5; }
.aud-fix .icon { width: 16px; height: 16px; margin-top: 1px; color: var(--green); flex: 0 0 auto; }

.d3-secs { display: flex; flex-direction: column; gap: 14px; }
.d3-sec { border: 1px solid var(--border); border-left: 4px solid var(--border-2); border-radius: var(--radius-sm); padding: 14px 16px; }
.d3-sec.tone-good { border-left-color: var(--green); }
.d3-sec.tone-warn { border-left-color: var(--amber); }
.d3-sec.tone-risk { border-left-color: #dc2626; }
.d3-sec-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.d3-sec-title { font-size: 14.5px; font-weight: 700; }
.d3-sec-score { margin-left: auto; font-size: 15px; font-weight: 800; }
.d3-sec-score small { font-size: 11px; font-weight: 600; color: var(--text-3); }
.d3-sec.tone-good .d3-sec-score { color: var(--green); }
.d3-sec.tone-warn .d3-sec-score { color: var(--amber); }
.d3-sec.tone-risk .d3-sec-score { color: #dc2626; }
.d3-sec ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.d3-sec li { position: relative; padding-left: 15px; font-size: 13.5px; color: var(--text); line-height: 1.5; }
.d3-sec li::before { content: ""; position: absolute; left: 3px; top: 8px; width: 5px; height: 5px; border-radius: 50%; background: var(--text-3); }

.d3-cost-est { display: flex; align-items: flex-start; gap: 9px; font-size: 14px; color: var(--text); line-height: 1.55; margin: 0 0 14px; }
.d3-cost-ic { width: 30px; height: 30px; border-radius: 9px; background: var(--green-bg); color: var(--green); display: grid; place-items: center; flex: 0 0 auto; }
.d3-cost-ic .icon { width: 16px; height: 16px; }
.d3-cost-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.d3-cost-list li { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; font-size: 13.5px; padding: 10px 13px; background: #fafbfc; border: 1px solid var(--border); border-radius: 10px; }
.d3-cost-list li > span { font-weight: 600; color: var(--text); flex: 1 1 auto; line-height: 1.45; }
.d3-cost-list b { font-weight: 600; color: var(--orange); text-align: right; flex: 0 1 auto; max-width: 52%; line-height: 1.4; }
.d3-cost-note { display: flex; align-items: flex-start; gap: 8px; margin: 12px 0 0; font-size: 12.5px; color: var(--text-2); line-height: 1.5; font-style: italic; }
.d3-cost-note .icon { width: 15px; height: 15px; margin-top: 1px; color: var(--text-3); flex: 0 0 auto; }

.d3-time { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.d3-time-col { background: #fafbfc; border: 1px solid var(--border); border-radius: 10px; padding: 12px 13px; }
.d3-time-lb { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; color: var(--brand); margin-bottom: 6px; }
.d3-time-lb .icon { width: 14px; height: 14px; }
.d3-time-col p { font-size: 13px; color: var(--text-2); margin: 0; line-height: 1.5; }
.d3-weak-label { font-size: 13px; font-weight: 700; color: var(--text-2); margin: 14px 0 8px; }
.d3-weak { display: flex; flex-wrap: wrap; gap: 8px; }
.d3-weak span { font-size: 12.5px; font-weight: 600; color: #b45309; background: #fffbeb; border: 1px solid #fef3c7; border-radius: 20px; padding: 5px 12px; }

.d3-regret-card { border-left: 3px solid var(--amber); }
.d3-regrets { margin: 0; padding-left: 0; list-style: none; counter-reset: rg; display: flex; flex-direction: column; gap: 10px; }
.d3-regrets li { counter-increment: rg; position: relative; padding-left: 38px; font-size: 14px; color: var(--text); line-height: 1.55; min-height: 26px; display: flex; align-items: center; }
.d3-regrets li::before { content: counter(rg); position: absolute; left: 0; top: 0; width: 26px; height: 26px; border-radius: 8px; background: var(--amber-bg); color: var(--amber); font-weight: 800; font-size: 13px; display: grid; place-items: center; }

.d3-cc-list { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.d3-cc-list li { display: flex; gap: 12px; align-items: baseline; }
.d3-cc-lb { flex: 0 0 120px; font-size: 12.5px; font-weight: 700; padding: 4px 11px; border-radius: 8px; text-align: center; }
.d3-cc-list li.tone-good .d3-cc-lb { background: var(--green-bg); color: var(--green); }
.d3-cc-list li.tone-warn .d3-cc-lb { background: var(--amber-bg); color: var(--amber); }
.d3-cc-list li.tone-risk .d3-cc-lb { background: #fee2e2; color: #dc2626; }
.d3-cc-tx { flex: 1; font-size: 14px; color: var(--text); line-height: 1.55; font-weight: 600; }
.d3-verdict { padding: 13px 15px; background: var(--brand-bg); border-radius: 10px; }

/* Kết luận */
.result-conclusion { border-left: 3px solid var(--blue); }
.result-conclusion p { font-size: 14px; line-height: 1.6; color: var(--text); margin: 0; font-weight: 700; }
.compare-table .cell-note { color: #dc2626; font-style: italic; font-weight: 500; }

/* CTA + nút phụ */
.cta-row { display: flex; flex-wrap: wrap; gap: 10px; }
.btn-ghost { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; background: var(--surface); border: 1px solid var(--border-2); color: var(--text-2); font-weight: 600; font-size: 14px; padding: 10px 18px; border-radius: 12px; }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn-ghost .icon { width: 16px; height: 16px; }
.btn-sm { padding: 7px 12px; font-size: 12.5px; border-radius: 10px; }
.btn-sm .icon { width: 14px; height: 14px; }

/* Check vật liệu: ô tìm kiếm + chi tiết */
.material-search { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border-2); border-radius: 14px; padding: 8px 8px 8px 16px; box-shadow: var(--shadow); }
.material-search > .icon { width: 18px; height: 18px; color: var(--text-3); flex: 0 0 auto; }
.material-search input { flex: 1; border: 0; outline: none; font-size: 14px; height: 40px; background: transparent; }
.muted-line { font-size: 13px; color: var(--text-3); margin: 12px 2px 0; }
.inline-link { color: var(--brand); font-weight: 600; cursor: pointer; }
.material-detail-head p { margin: 10px 0 0; font-size: 14px; color: var(--text-2); }
.procon { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; margin-top: 16px; }
.procon-col h4 { display: flex; align-items: center; gap: 7px; font-size: 13.5px; margin-bottom: 8px; }
.procon-col h4 .icon { width: 16px; height: 16px; }
.procon-col:nth-child(1) h4 .icon, .procon-col:nth-child(3) h4 .icon { color: var(--green); }
.procon-col:nth-child(2) h4 .icon, .procon-col:nth-child(4) h4 .icon { color: var(--rose); }
.procon-col ul { display: flex; flex-direction: column; gap: 6px; }
.procon-col li { font-size: 13px; color: var(--text-2); padding-left: 14px; position: relative; }
.procon-col li::before { content: "•"; position: absolute; left: 0; color: var(--text-3); }
.material-warn { display: flex; align-items: flex-start; gap: 8px; margin: 18px 0 0; padding: 12px 14px; background: var(--rose-bg); color: #9f1239; border-radius: 10px; font-size: 13.5px; font-weight: 500; }
.material-warn .icon { width: 17px; height: 17px; flex: 0 0 auto; margin-top: 1px; }

/* Thư viện vật liệu / phụ kiện */
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.lib-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.lib-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.lib-ic { width: 36px; height: 36px; border-radius: 10px; background: var(--amber-bg); color: var(--amber); display: grid; place-items: center; flex: 0 0 auto; }
.lib-ic .icon { width: 18px; height: 18px; }
.lib-card-head h3 { font-size: 15px; }
.lib-brand { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); font-weight: 600; margin: 0 0 8px; }
.lib-brand .icon { width: 14px; height: 14px; color: var(--amber); flex: 0 0 auto; }
.lib-desc { font-size: 13px; color: var(--text-2); margin: 0 0 12px; }
.lib-meta { display: flex; flex-direction: column; gap: 6px; }
.lib-use, .lib-avoid { display: flex; align-items: center; gap: 6px; font-size: 12.5px; }
.lib-use { color: var(--green); }
.lib-avoid { color: var(--rose); }
.lib-use .icon, .lib-avoid .icon { width: 14px; height: 14px; flex: 0 0 auto; }

/* Trang PRO */
.pro-lead { font-size: 15px; color: var(--text-2); margin: 0 0 22px; }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; max-width: 760px; }
.plan-card { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.plan-card-pro { border: 2px solid var(--brand); }
.plan-flag { position: absolute; top: -11px; left: 26px; background: var(--brand); color: #fff; font-size: 11.5px; font-weight: 700; padding: 4px 12px; border-radius: 20px; }
.plan-head { margin-bottom: 18px; }
.plan-head h3 { font-size: 18px; }
.plan-price { font-size: 30px; font-weight: 800; margin: 8px 0 0; }
.plan-price span { font-size: 14px; font-weight: 500; color: var(--text-3); }
.plan-list { display: flex; flex-direction: column; gap: 11px; margin-bottom: 22px; flex: 1; }
.plan-list li { display: flex; align-items: flex-start; gap: 9px; font-size: 14px; color: var(--text-2); }
.plan-list .icon { width: 17px; height: 17px; color: var(--green); flex: 0 0 auto; margin-top: 1px; }
.plan-btn { width: 100%; justify-content: center; }

/* Thư viện lỗi: filter + thẻ lỗi */
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.chip-on, .chip-on:hover { background: var(--brand); border-color: var(--brand); color: #fff; }
.error-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.error-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.error-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.error-cat { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--brand); background: var(--brand-bg); padding: 3px 10px; border-radius: 20px; }
.error-card h3 { font-size: 15.5px; margin-bottom: 14px; }
.error-meta { display: flex; flex-direction: column; gap: 10px; margin: 0 0 14px; }
.error-meta div { display: flex; flex-direction: column; gap: 2px; }
.error-meta dt { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--text-3); }
.error-meta dd { font-size: 13px; color: var(--text-2); margin: 0; }
.error-q { display: flex; align-items: flex-start; gap: 7px; font-size: 13px; color: var(--text-2); background: #fafbfc; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin: 0 0 14px; }
.error-q .icon { width: 15px; height: 15px; color: var(--brand); flex: 0 0 auto; margin-top: 1px; }
.error-actions { display: flex; gap: 8px; margin-top: auto; }

/* Khung kết quả động + loading */
.dropzone .btn-ghost { margin-top: 4px; }
.dropzone-analyze { margin-top: 14px; }
.cn-source { font-size: 12.5px; color: var(--text-3); margin: 14px 2px; display: flex; align-items: center; gap: 6px; }
.cn-result { display: flex; flex-direction: column; gap: 22px; transition: opacity .2s; }
.cn-result.is-loading { opacity: .45; pointer-events: none; }
button[disabled] { opacity: .6; cursor: progress; }

/* Danh bạ "Đơn vị đạt chuẩn" cuối báo cáo (phương án A) */
.units-cta { border: 1px solid #c7d2fe; background: linear-gradient(135deg, #eef2ff, #f5f3ff); border-radius: var(--radius); padding: 22px; }
.units-cta-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 18px; }
.units-cta-ic { width: 46px; height: 46px; border-radius: 12px; background: var(--brand); color: #fff; display: grid; place-items: center; flex: 0 0 auto; }
.units-cta-ic .icon { width: 24px; height: 24px; }
.units-cta-head h3 { font-size: 17px; margin: 0; }
.units-cta-head p { font-size: 13px; color: var(--text-2); margin: 6px 0 0; line-height: 1.55; }
.unit-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.unit-card { position: relative; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 18px; display: flex; flex-direction: column; }
.unit-card.is-featured { border-color: var(--brand); box-shadow: 0 4px 14px rgba(99,102,241,.12); }
.unit-flag { position: absolute; top: -10px; left: 16px; background: var(--brand); color: #fff; font-size: 11px; font-weight: 700; padding: 3px 11px; border-radius: 20px; }
.unit-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 12px; }
.unit-logo { width: 44px; height: 44px; border-radius: 12px; background: var(--brand-bg); color: var(--brand); font-weight: 800; font-size: 18px; display: grid; place-items: center; flex: 0 0 auto; }
.unit-id { min-width: 0; }
.unit-id h4 { font-size: 15.5px; margin: 0; }
.unit-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 700; color: var(--green); background: var(--green-bg); padding: 2px 9px; border-radius: 20px; margin-top: 5px; }
.unit-badge .icon { width: 12px; height: 12px; }
.unit-meta { font-size: 12.5px; color: var(--text-3); margin: 7px 0 0; }
.unit-commit { display: flex; flex-direction: column; gap: 7px; margin: 0 0 14px; }
.unit-commit li { display: flex; gap: 7px; align-items: flex-start; font-size: 12.5px; color: var(--text-2); }
.unit-commit .icon { width: 14px; height: 14px; color: var(--green); flex: 0 0 auto; margin-top: 2px; }
.unit-cta-btn { width: 100%; justify-content: center; margin-top: auto; }
.unit-lead { margin-top: 12px; }

/* Form lead (trong thẻ đơn vị) */
.lead-form { display: flex; flex-direction: column; gap: 10px; }
.lead-form input { height: 44px; border: 1px solid var(--border-2); border-radius: 12px; padding: 0 14px; font-size: 14px; background: #fff; }
.lead-form input:focus { border-color: var(--brand); outline: none; }
.lead-form button { width: 100%; justify-content: center; }
.lead-result { margin: 10px 0 0; font-size: 13px; font-weight: 600; }
.lead-result:empty { display: none; }
.lead-result.is-ok { color: var(--green); }
.lead-result.is-err { color: var(--rose); }

@media (max-width: 600px) {
	.score-hero { flex-wrap: wrap; gap: 12px; }
	.material-search { flex-wrap: wrap; }
	.material-search input { width: 100%; }
}
