:root {
	--ink: #304c5a;
	--muted: #5f6f78;
	--accent: #e1523e;
	--accent-dark: #c54434;
	--accent-soft: #fde6e2;
	--paper: #ffffff;
	--card: #ffffff;
	--border: #e5e7eb;
	--green: #47a23f;
	--cyan: #3ccbda;
	--yellow: #fdc649;
}
* { box-sizing: border-box; }
body {
	margin: 0;
	font-family: "Roboto", "Arial", sans-serif;
	color: var(--ink);
	background: #ffffff;
}
.brand-bar {
	position: sticky;
	top: 0;
	z-index: 2000;
	background: var(--ink);
	color: #fefcf7;
	padding: 10px 32px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	font-size: 12px;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}
.brand-links {
	display: flex;
	align-items: center;
	gap: 16px;
}
.menu-toggle {
	display: none;
	background: transparent;
	border: 1px solid rgba(255, 255, 255, 0.35);
	color: inherit;
	padding: 6px 10px;
	border-radius: 999px;
	font-size: 11px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}
.brand-link {
	color: inherit;
	text-decoration: none;
	font-weight: 600;
	display: inline-flex;
	align-items: center;
	gap: 10px;
}
.brand-link span {
	display: inline-flex;
	align-items: center;
	gap: 4px;
}
.brand-link span::after {
	content: "";
	display: inline-block;
	width: 12px;
	height: 12px;
	background-size: contain;
	background-repeat: no-repeat;
	background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23ffffff' d='M2 12h5l2-5 4 11 2-6h7v-3h-5l-2 6-4-11-2 5H2z'/></svg>");
}
.brand-logo {
	width: 26px;
	height: 26px;
	display: inline-block;
}
header h1 {
	margin: 0 0 6px;
	font-size: 28px;
	letter-spacing: 0.4px;
	font-family: "Roboto", "Arial", sans-serif;
}
header p {
	margin: 0;
	color: var(--muted);
	font-size: 14px;
}
.header-meta {
	margin-top: 4px;
	color: var(--muted);
	font-size: 12px;
}
.site-footer {
	text-align: center;
	padding: 18px 16px 28px;
	color: var(--muted);
	font-size: 12px;
}
.fullpage-map {
	width: 100%;
	height: calc(100vh - 86px);
	min-height: 520px;
}
.map-shell {
	position: relative;
}
.map-legend {
	position: absolute;
	right: 20px;
	top: 20px;
	background: #ffffff;
	border: 1px solid var(--border);
	border-radius: 12px;
	padding: 10px 12px;
	font-size: 12px;
	color: var(--muted);
	display: grid;
	gap: 6px;
	box-shadow: 0 12px 26px rgba(17, 24, 39, 0.08);
	z-index: 500;
}
.legend-dot {
	display: inline-block;
	width: 10px;
	height: 10px;
	border-radius: 999px;
	margin-right: 6px;
}
.legend-green { background: #47a23f; }
.legend-amber { background: #fdc649; }
.legend-red { background: #e1523e; }
.card {
	background: var(--card);
	border: 1px solid var(--border);
	border-radius: 16px;
	padding: 18px 20px;
	box-shadow: 0 20px 40px rgba(31, 41, 55, 0.06);
}
.card h2 {
	margin: 0 0 12px;
	font-size: 20px;
}
.thread {
	display: block;
	padding: 12px;
	border-radius: 12px;
	text-decoration: none;
	color: inherit;
	border: 1px solid transparent;
	transition: border 0.2s ease, background 0.2s ease;
}
.thread + .thread { margin-top: 10px; }
.thread:hover { border-color: var(--border); background: #f5f6f2; }
.thread.active { border-color: var(--accent); background: var(--accent-soft); }
.thread-title { font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.thread-meta { font-size: 12px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; }
.thread-badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 999px; font-size: 11px; background: #f3f4f6; color: var(--muted); }
.channel-pill { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 999px; background: #f3f4f6; color: var(--muted); }
.channel-pill svg { width: 14px; height: 14px; fill: currentColor; flex-shrink: 0; }

.sidebar {
\tmax-height: calc(100vh - 140px);
\toverflow: auto;
}
.content {
\tmin-height: 420px;
}
.thread-header { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.thread-header h2 { margin: 0; font-size: 22px; }
.thread-header .summary { font-size: 14px; color: var(--muted); }
.empty-state { text-align: center; padding: 80px 20px; color: var(--muted); }
.muted { color: var(--muted); }

.timeline { position: relative; margin-top: 18px; padding-left: 24px; }
.timeline::before { content: ""; position: absolute; left: 9px; top: 4px; bottom: 4px; width: 2px; background: #d1d5db; }
.timeline-item { position: relative; padding: 14px 16px; border: 1px solid var(--border); border-radius: 14px; background: #fbfaf6; margin-bottom: 14px; }
.item-header { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--muted); margin-bottom: 8px; flex-wrap: wrap; }
.item-title { font-weight: 600; color: var(--ink); font-size: 15px; margin-bottom: 6px; }
.item-content { font-size: 14px; line-height: 1.5; white-space: pre-wrap; }

.meta-chip { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; background: #f3f4f6; font-size: 11px; color: var(--muted); gap: 6px; }
.meta-chip svg { width: 14px; height: 14px; fill: currentColor; flex-shrink: 0; }
.meta-chip.split { gap: 4px; }
.meta-chip .divider { width: 1px; height: 12px; background: currentColor; opacity: 0.25; }
.channel-badge { background: var(--accent-soft); color: var(--accent-dark); }

.member-link, .staff-link, .thread-link { color: inherit; text-decoration: none; border-bottom: 1px solid transparent; }
.member-link:hover, .staff-link:hover, .thread-link:hover { border-color: var(--accent); color: var(--accent-dark); }
.member-link.plain { border-bottom: none; }
.member-link.plain:hover { border-bottom: none; color: inherit; }

.member-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; font-size: 14px; }
.member-grid strong { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.member-hero { display: grid; grid-template-columns: 150px 1fr 220px; gap: 18px; align-items: center; }
.member-photo { width: 150px; height: 150px; border-radius: 18px; object-fit: cover; border: 1px solid var(--border); box-shadow: 0 12px 24px rgba(11, 91, 59, 0.18); background: #f3f1ea; }
.map-card { border: 1px solid var(--border); border-radius: 16px; padding: 12px; background: #fbfaf6; text-align: center; }
.map-canvas { width: 100%; height: 160px; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); background: #fff; }
#memberMap { height: 160px; width: 100%; min-height: 160px; max-height: 160px; }
.leaflet-container img { max-width: none !important; }
#memberMap.leaflet-container { position: relative; }
#memberMap .leaflet-pane { top: 0; left: 0; height: 100% !important; }
#memberMap .leaflet-map-pane,
#memberMap .leaflet-tile-pane,
#memberMap .leaflet-overlay-pane { height: 100% !important; }
.map-label { margin-top: 8px; font-size: 12px; color: var(--muted); }

.stats-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.stat-card { padding: 16px; border: 1px solid var(--border); border-radius: 14px; background: #fbfaf6; }
.stat-title { font-size: 12px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); margin-bottom: 10px; }
.chart-shell { height: 120px; }
.chart-canvas { width: 100%; height: 120px; max-height: 120px; display: block; }
.chart-shell-lg { height: 180px; }
.chart-canvas-lg { height: 180px; max-height: 180px; }
.health-card { display: flex; flex-direction: column; gap: 12px; }
.health-score { display: flex; align-items: baseline; gap: 10px; }
.health-score .value { font-size: 36px; font-weight: 600; color: var(--accent); }
.health-score .label { font-size: 14px; color: var(--muted); }
.health-breakdown { font-size: 13px; color: var(--muted); display: grid; gap: 6px; }

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid #e5ede5; }
.table th { color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; font-size: 11px; }
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); font-size: 11px; color: var(--accent-dark); }
.badge.score-green { background: rgba(71, 162, 63, 0.18); color: #2f7a2c; }
.badge.score-amber { background: rgba(253, 198, 73, 0.22); color: #9a6b00; }
.badge.score-red { background: rgba(225, 82, 62, 0.2); color: #b63a2d; }
.badge.score-grey { background: rgba(48, 76, 90, 0.12); color: #3b4b57; }
.score-green { color: #2f7a2c; }
.score-amber { color: #9a6b00; }
.score-red { color: #b63a2d; }

.metric { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; background: #fbfaf6; }
.metric .label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.metric .value { font-size: 24px; font-weight: 600; color: var(--accent); }
.metric .spark { height: 38px; margin-top: 6px; }
.metric .spark canvas { width: 100%; height: 38px; display: block; }

.timeline-link { display: block; text-decoration: none; color: inherit; border: 1px solid transparent; border-radius: 14px; padding: 0; }
.timeline-link:hover .timeline-item { border-color: var(--accent); box-shadow: 0 14px 26px rgba(11, 91, 59, 0.12); }

.word-cloud {
	display: flex;
	flex-wrap: wrap;
	gap: 10px 14px;
	padding: 12px;
	border: 1px solid var(--border);
	border-radius: 12px;
	background: #fbfaf6;
	min-height: 120px;
	align-content: flex-start;
}

.word-cloud span {
	line-height: 1;
	font-weight: 600;
}

.risk-list {
	display: grid;
	gap: 8px;
	margin-top: 8px;
}
.risk-item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 8px 10px;
	border: 1px solid var(--border);
	border-radius: 10px;
	background: #fbfaf6;
	font-size: 14px;
}
.risk-item .badge {
	white-space: nowrap;
}

.alert-list {
	display: grid;
	gap: 10px;
	margin-top: 10px;
}
.alert-item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 10px 12px;
	border-radius: 12px;
	border: 1px solid rgba(225, 82, 62, 0.2);
	background: rgba(225, 82, 62, 0.08);
}

.trend-bar {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 8px;
}
.trend-bar .bar-track {
	flex: 1;
	height: 8px;
	background: #eef2f4;
	border-radius: 999px;
	overflow: hidden;
}
.trend-bar .bar-fill {
	height: 100%;
	background: var(--accent);
	border-radius: 999px;
	min-width: 6px;
}

.word-cloud-positive span {
	color: var(--green);
}

.word-cloud-negative span {
	color: var(--accent);
}

.af-toast {
	position: fixed;
	right: 24px;
	top: 24px;
	background: #ffffff;
	border: 1px solid var(--border);
	border-radius: 12px;
	box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
	padding: 14px 16px 10px;
	min-width: 260px;
	display: none;
	z-index: 1050;
}
.af-toast.show {
	display: block;
}
.af-toast-body {
	font-size: 14px;
	color: var(--ink);
	margin-bottom: 10px;
}
.af-toast-timer {
	height: 4px;
	background: #f0f2f4;
	border-radius: 999px;
	overflow: hidden;
}
.af-toast-timer span {
	display: block;
	height: 100%;
	width: 100%;
	background: var(--green);
	transition: width 5s linear;
}

.tabulator {
	font-family: "Roboto", sans-serif;
	background: #fff;
	border: 1px solid rgba(48, 76, 90, 0.12);
	border-radius: 12px;
	box-shadow: 0 12px 28px rgba(48, 76, 90, 0.06);
}

.tabulator .tabulator-header {
	background: #f5f7f8;
	border-bottom: 1px solid rgba(48, 76, 90, 0.12);
}

.tabulator .tabulator-header .tabulator-col {
	border-right: 1px solid rgba(48, 76, 90, 0.08);
}

.tabulator .tabulator-header .tabulator-col:last-child {
	border-right: none;
}

.tabulator .tabulator-row {
	border-bottom: 1px solid rgba(48, 76, 90, 0.08);
}

.tabulator .tabulator-row.tabulator-row-even {
	background: #fafbfc;
}

.tabulator .tabulator-cell {
	color: var(--primary);
}

@media (max-width: 980px) {
	.member-grid { grid-template-columns: 1fr; }
	.member-hero { grid-template-columns: 1fr; }
	.member-photo { width: 120px; height: 120px; }
	.stats-grid { grid-template-columns: 1fr; }
	.sidebar { max-height: none; }
	.brand-bar { padding: 10px 16px; }
	.menu-toggle { display: inline-flex; }
	.brand-links {
		position: fixed;
		top: 56px;
		right: 16px;
		background: #ffffff;
		color: var(--ink);
		border: 1px solid var(--border);
		border-radius: 14px;
		padding: 12px;
		display: none;
		flex-direction: column;
		align-items: flex-start;
		gap: 10px;
		box-shadow: 0 16px 30px rgba(15, 23, 42, 0.2);
		z-index: 2100;
		text-transform: none;
		letter-spacing: 0.02em;
	}
	body.menu-open .brand-links { display: flex; }
}
