:root {
	--bg: #0A0B10;
	--panel: #12141E;
	--panel-2: #1A1D2A;
	--ink: #E8ECF4;
	--ink-dim: #A6AEC2;
	--ink-faint: #6B7388;
	--accent: #5B8CFF;
	--accent-2: #7C5CFF;
	--mint: #3DE0B0;
	--crit: #FF5470;
	--amber: #FF9F45;
	--line: #232735;

	--radius-sm: 6px;
	--radius: 10px;
	--radius-lg: 16px;

	--sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	--mono: "IBM Plex Mono", ui-monospace, "JetBrains Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
	background: var(--bg);
	color: var(--ink);
	font-family: var(--sans);
	margin: 0;
	padding: 0;
	font-size: 15px;
	line-height: 1.55;
}

a {
	color: var(--accent);
	text-decoration: none;
}
a:hover { text-decoration: underline; }

h1, h2, h3, h4 {
	margin: 0 0 0.5em 0;
	font-weight: 600;
	letter-spacing: -0.01em;
}
h1 { font-size: 1.8rem; }
h2 { font-size: 1.25rem; color: var(--ink); }
h3 { font-size: 1.05rem; color: var(--ink); }

code, pre, .mono { font-family: var(--mono); }

.page {
	max-width: 980px;
	margin: 0 auto;
	padding: 32px 24px 80px;
}

/* --- Top nav --- */
.topnav {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 16px 24px;
	border-bottom: 1px solid var(--line);
	background: var(--bg);
	position: sticky;
	top: 0;
	z-index: 10;
}
.topnav .brand {
	font-family: var(--mono);
	font-weight: 600;
	color: var(--ink);
	letter-spacing: -0.02em;
}
.topnav .brand .dot { color: var(--accent); }
.topnav .spacer { flex: 1; }
.topnav a { color: var(--ink-dim); }
.topnav a:hover { color: var(--ink); text-decoration: none; }
.topnav a.active { color: var(--ink); }

/* --- Flash --- */
.flash {
	background: rgba(61, 224, 176, 0.08);
	border: 1px solid rgba(61, 224, 176, 0.4);
	color: var(--mint);
	padding: 10px 14px;
	border-radius: var(--radius);
	margin: 0 0 20px 0;
	font-size: 0.92rem;
}
.flash.error {
	background: rgba(255, 84, 112, 0.08);
	border-color: rgba(255, 84, 112, 0.4);
	color: var(--crit);
}

/* --- Cards / panels --- */
.panel {
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: var(--radius-lg);
	padding: 20px;
	margin-bottom: 20px;
}
.panel h2 { margin-bottom: 12px; }

/* --- Profile header card (V621 redesign) ---
   Goal: a modern card with a cover banner across the top, the avatar
   half-overlapping the bottom edge of the cover, then name / headline /
   chips below. The .panel padding is overridden because we want the
   cover image to bleed to the card's edges, not float inside padding. */
.profile-head {
	padding: 0;
	overflow: hidden; /* clip the cover banner to the card's rounded corners */
}
.profile-head .profile-cover {
	height: 200px;
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
}
.profile-head .profile-head-body {
	display: flex;
	gap: 20px;
	align-items: flex-start;
	padding: 0 24px 24px 24px;
	/* Pull the body up so the avatar overlaps the cover's bottom edge. */
	margin-top: -48px;
	position: relative;
}
.profile-head .avatar.profile-avatar {
	width: 120px;
	height: 120px;
	border-radius: 50%;
	background: var(--panel-2);
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 600;
	font-size: 2rem;
	color: var(--ink);
	flex-shrink: 0;
	overflow: hidden;
	/* Heavy border so the silhouette pops against any cover photo. */
	border: 4px solid var(--panel);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
.profile-head .avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-head .meta {
	flex: 1;
	/* Push the meta block down so it sits below the avatar's vertical center,
	   making the name align with the avatar's bottom on most viewports. */
	padding-top: 56px;
}
.profile-head .name {
	display: flex;
	align-items: baseline;
	gap: 12px;
	flex-wrap: wrap;
}
.profile-head .name .display { font-size: 1.7rem; font-weight: 600; }
.profile-head .name .handle { color: var(--ink-faint); font-family: var(--mono); }
.profile-head .headline { color: var(--ink-dim); margin-top: 4px; }
.profile-head .chips { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px; }

@media (max-width: 640px) {
	/* On narrow viewports, stack the avatar above the meta. */
	.profile-head .profile-head-body { flex-direction: column; gap: 12px; padding: 0 16px 16px 16px; }
	.profile-head .profile-cover { height: 140px; }
	.profile-head .meta { padding-top: 0; }
	.profile-head .avatar.profile-avatar { width: 96px; height: 96px; font-size: 1.6rem; }
}

/* Color tier accents on the avatar border. The outer ring (white card
   border) stays for separation; the inner ring colors the tier. */
.tier-red    .profile-head .avatar.profile-avatar { box-shadow: 0 0 0 2px var(--crit),    0 4px 12px rgba(0, 0, 0, 0.2); }
.tier-blue   .profile-head .avatar.profile-avatar { box-shadow: 0 0 0 2px var(--accent),  0 4px 12px rgba(0, 0, 0, 0.2); }
.tier-purple .profile-head .avatar.profile-avatar { box-shadow: 0 0 0 2px var(--accent-2),0 4px 12px rgba(0, 0, 0, 0.2); }
.tier-gray   .profile-head .avatar.profile-avatar { box-shadow: 0 0 0 2px var(--line),    0 4px 12px rgba(0, 0, 0, 0.2); }

/* --- Chips --- */
.chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 0.82rem;
	padding: 3px 9px;
	border-radius: 999px;
	background: var(--panel-2);
	border: 1px solid var(--line);
	color: var(--ink-dim);
	white-space: nowrap;
}
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-faint); }
.chip.red    .dot { background: var(--crit); }
.chip.blue   .dot { background: var(--accent); }
.chip.purple .dot { background: var(--accent-2); }
.chip.mint, .chip.verified {
	background: rgba(61, 224, 176, 0.08);
	border-color: rgba(61, 224, 176, 0.35);
	color: var(--mint);
}
.chip.amber, .chip.unverified {
	background: rgba(255, 159, 69, 0.08);
	border-color: rgba(255, 159, 69, 0.35);
	color: var(--amber);
}
.chip.muted { color: var(--ink-faint); }

/* --- Stats strip --- */
.stats {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
	gap: 1px;
	background: var(--line);
	border-radius: var(--radius);
	overflow: hidden;
}
.stats .cell {
	background: var(--panel);
	padding: 14px 16px;
}
.stats .label {
	font-size: 0.78rem;
	color: var(--ink-faint);
	text-transform: uppercase;
	letter-spacing: 0.04em;
}
.stats .value {
	font-size: 1.3rem;
	font-weight: 600;
	color: var(--ink);
	margin-top: 2px;
}

/* --- Specialty bars --- */
.specialty-row {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 10px;
}
.specialty-row:last-child { margin-bottom: 0; }
.specialty-row .label { width: 180px; color: var(--ink-dim); font-size: 0.92rem; }
.specialty-row .bar {
	flex: 1;
	height: 8px;
	background: var(--panel-2);
	border-radius: 999px;
	overflow: hidden;
	position: relative;
}
.specialty-row .fill {
	height: 100%;
	background: linear-gradient(90deg, var(--accent), var(--accent-2));
	border-radius: 999px;
}
.specialty-row .pct {
	width: 44px;
	text-align: right;
	font-family: var(--mono);
	font-size: 0.85rem;
	color: var(--ink-dim);
}

/* --- Lists (contributions, links, certs, etc.) --- */
.row {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 12px 0;
	border-bottom: 1px solid var(--line);
}
.row:last-child { border-bottom: none; }
.row .title { color: var(--ink); font-weight: 500; }
.row .meta { color: var(--ink-faint); font-size: 0.85rem; }
.row .pts {
	font-family: var(--mono);
	color: var(--ink-dim);
	font-size: 0.9rem;
	margin-left: auto;
	white-space: nowrap;
}
.row .kind {
	font-size: 0.75rem;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--ink-faint);
	font-family: var(--mono);
	width: 64px;
	flex-shrink: 0;
}

/* --- Section "view all" link --- */
.section-head {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
}
.section-head a.more {
	font-size: 0.88rem;
	color: var(--ink-dim);
}

/* --- Links list on profile --- */
.links-row {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}
.links-row a.link-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 12px;
	border-radius: var(--radius);
	background: var(--panel-2);
	border: 1px solid var(--line);
	color: var(--ink);
	font-size: 0.88rem;
}
.links-row a.link-btn:hover { background: var(--line); text-decoration: none; }
.links-row .verified-tick { color: var(--mint); }

/* --- Forms --- */
form .field {
	display: flex;
	flex-direction: column;
	gap: 4px;
	margin-bottom: 14px;
}
form label, .field-label {
	font-size: 0.82rem;
	color: var(--ink-dim);
	text-transform: uppercase;
	letter-spacing: 0.04em;
}
form .help {
	color: var(--ink-faint);
	font-size: 0.8rem;
}
input[type="text"],
input[type="url"],
input[type="number"],
input[type="date"],
input[type="file"],
select,
textarea {
	background: var(--panel-2);
	color: var(--ink);
	border: 1px solid var(--line);
	border-radius: var(--radius-sm);
	padding: 8px 10px;
	font-family: var(--sans);
	font-size: 0.95rem;
	width: 100%;
}
textarea { font-family: var(--sans); resize: vertical; min-height: 80px; }
input:focus, select:focus, textarea:focus {
	outline: none;
	border-color: var(--accent);
}

button, .btn {
	background: var(--accent);
	color: white;
	border: none;
	border-radius: var(--radius-sm);
	padding: 8px 14px;
	font-family: var(--sans);
	font-weight: 500;
	font-size: 0.92rem;
	cursor: pointer;
}
button:hover, .btn:hover { background: var(--accent-2); }
button.ghost, .btn.ghost {
	background: transparent;
	border: 1px solid var(--line);
	color: var(--ink-dim);
}
button.ghost:hover, .btn.ghost:hover { color: var(--ink); border-color: var(--ink-faint); }
button.danger {
	background: transparent;
	border: 1px solid var(--line);
	color: var(--crit);
}
button.danger:hover { border-color: var(--crit); }

.row-actions {
	display: flex;
	gap: 8px;
	margin-left: auto;
}

.inline-form { display: inline; }
.inline-form button { font-size: 0.82rem; padding: 4px 8px; }

/* --- Tables (leaderboard) --- */
.leaderboard {
	width: 100%;
	border-collapse: collapse;
}
.leaderboard th, .leaderboard td {
	text-align: left;
	padding: 12px 14px;
	border-bottom: 1px solid var(--line);
}
.leaderboard th {
	font-size: 0.78rem;
	color: var(--ink-faint);
	text-transform: uppercase;
	letter-spacing: 0.04em;
	font-weight: 500;
}
.leaderboard tr:hover td { background: rgba(255, 255, 255, 0.02); }
.leaderboard .rank {
	font-family: var(--mono);
	color: var(--ink-faint);
	width: 50px;
}
.leaderboard .rank.top1 { color: var(--amber); font-weight: 600; }
.leaderboard .rank.top3 { color: var(--mint); font-weight: 600; }
.leaderboard .user-cell { display: flex; align-items: center; gap: 10px; }
.leaderboard .mini-avatar {
	width: 32px; height: 32px; border-radius: 50%;
	display: flex; align-items: center; justify-content: center;
	font-size: 0.85rem; font-weight: 600;
	border: 1px solid var(--line);
	overflow: hidden;
}
.leaderboard .mini-avatar img { width: 100%; height: 100%; object-fit: cover; }
.leaderboard .points { font-family: var(--mono); color: var(--ink); font-weight: 500; }
.leaderboard .breakdown { color: var(--ink-faint); font-size: 0.85rem; }

/* --- Window tabs --- */
.tabs {
	display: flex;
	gap: 4px;
	border-bottom: 1px solid var(--line);
	margin-bottom: 24px;
}
.tabs a {
	padding: 10px 16px;
	color: var(--ink-faint);
	border-bottom: 2px solid transparent;
	margin-bottom: -1px;
}
.tabs a:hover { color: var(--ink-dim); text-decoration: none; }
.tabs a.active {
	color: var(--ink);
	border-bottom-color: var(--accent);
}

/* --- Bio --- */
.bio {
	color: var(--ink-dim);
	line-height: 1.65;
	font-size: 0.96rem;
}

/* --- Empty state --- */
.empty {
	color: var(--ink-faint);
	text-align: center;
	padding: 24px 0;
	font-size: 0.92rem;
}

/* --- Resume cards --- */
.work-entry { padding: 14px 0; border-bottom: 1px solid var(--line); }
.work-entry:last-child { border-bottom: none; }
.work-entry .title { font-weight: 600; color: var(--ink); }
.work-entry .company { color: var(--ink-dim); margin-left: 6px; }
.work-entry .dates { font-family: var(--mono); font-size: 0.85rem; color: var(--ink-faint); margin-top: 2px; }
.work-entry .desc { margin-top: 8px; color: var(--ink-dim); font-size: 0.93rem; line-height: 1.55; }

/* --- Cert cards --- */
.cert-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	gap: 14px;
}
.cert-card {
	background: var(--panel-2);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 14px;
}
.cert-card .name { font-weight: 600; color: var(--ink); }
.cert-card .issuer { color: var(--ink-dim); font-size: 0.88rem; margin-top: 2px; }
.cert-card .dates { font-family: var(--mono); font-size: 0.82rem; color: var(--ink-faint); margin-top: 4px; }
.cert-card .verify { margin-top: 8px; font-size: 0.85rem; }
.cert-card img.cert-image { width: 100%; height: 120px; object-fit: cover; border-radius: var(--radius-sm); margin-top: 10px; }

/* --- Public warning notice --- */
.notice {
	background: rgba(255, 159, 69, 0.06);
	border: 1px solid rgba(255, 159, 69, 0.3);
	border-radius: var(--radius);
	padding: 10px 14px;
	color: var(--amber);
	font-size: 0.88rem;
	margin-bottom: 12px;
}

/* --- Sub form blocks inside settings --- */
.subform {
	border-top: 1px dashed var(--line);
	padding-top: 16px;
	margin-top: 16px;
}

/* --- Two-column row used in settings inline forms --- */
.row-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
}
@media (max-width: 600px) {
	.row-grid { grid-template-columns: 1fr; }
}

/* --- Right-aligned counts column on lists --- */
.count-pill {
	font-family: var(--mono);
	background: var(--panel-2);
	border: 1px solid var(--line);
	border-radius: 999px;
	padding: 1px 8px;
	font-size: 0.78rem;
	color: var(--ink-dim);
}

/* --- Helper utility --- */
.flex { display: flex; gap: 12px; align-items: center; }
.muted { color: var(--ink-faint); }
.mt0 { margin-top: 0; }
.mt8 { margin-top: 8px; }
.mt16 { margin-top: 16px; }
.mb0 { margin-bottom: 0; }
.text-right { text-align: right; }
.w-full { width: 100%; }

/* --- V623: profile-completeness meter ---
   Top-of-settings panel: score percentage, color-shifting progress bar,
   sorted-incomplete-first checklist of the 9 binary items. The whole panel
   is shown until the score hits 100; at 100 the checklist hides and only
   a "Profile complete" message + full bar remain. */
.completeness-score {
	font-size: 1.8rem;
	font-weight: 600;
	color: var(--ink-dim);
}
.completeness-bar {
	height: 10px;
	background: var(--panel-2);
	border-radius: 6px;
	overflow: hidden;
	margin-top: 12px;
}
.completeness-bar-fill {
	height: 100%;
	border-radius: 6px;
	transition: width 220ms ease, background 220ms ease;
}
.completeness-cold     .completeness-bar-fill { background: var(--crit, #E04A4A); }
.completeness-warming  .completeness-bar-fill { background: var(--amber, #E0A04A); }
.completeness-warm     .completeness-bar-fill { background: var(--mint, #4AC07A); }
.completeness-complete .completeness-bar-fill { background: var(--accent, #5B8CFF); }
.completeness-cold     .completeness-score    { color: var(--crit, #E04A4A); }
.completeness-warming  .completeness-score    { color: var(--amber, #E0A04A); }
.completeness-warm     .completeness-score    { color: var(--mint, #4AC07A); }
.completeness-complete .completeness-score    { color: var(--accent, #5B8CFF); }

.completeness-checklist {
	margin-top: 16px;
	display: flex;
	flex-direction: column;
	gap: 6px;
}
.completeness-item {
	display: grid;
	grid-template-columns: 20px 1fr auto;
	gap: 12px;
	align-items: center;
	padding: 8px 10px;
	border-radius: 6px;
	background: var(--panel-2);
}
.completeness-item.done {
	opacity: 0.55;
}
.completeness-dot {
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: var(--crit, #E04A4A);
	display: inline-block;
	margin-left: 5px;
}
.completeness-check {
	color: var(--mint, #4AC07A);
	font-weight: 700;
	font-size: 1.1rem;
	text-align: center;
}
.completeness-label .help {
	color: var(--ink-faint);
	font-size: 0.85rem;
	margin-top: 2px;
}
.completeness-label a {
	color: var(--ink);
	text-decoration: none;
	font-weight: 500;
}
.completeness-label a:hover { text-decoration: underline; }
.completeness-pts {
	font-family: var(--mono);
	font-size: 0.85rem;
	color: var(--ink-dim);
}
