/*
 * Panel de administración de wydy. Mismo sistema visual que la web (tinta mate, papel y un
 * único ocre con peso), con las mismas tipografías servidas desde aquí.
 */
@font-face {
	font-family: 'Bricolage Grotesque Variable';
	src: url('/static/fonts/display.woff2') format('woff2-variations');
	font-weight: 200 800;
	font-display: swap;
}
@font-face {
	font-family: 'Instrument Sans Variable';
	src: url('/static/fonts/text.woff2') format('woff2-variations');
	font-weight: 400 700;
	font-display: swap;
}

:root {
	color-scheme: dark;
	--bg: #141414;
	--surface: #1c1c1c;
	--raised: #272727;
	--line: #3a3a3a;
	--line-strong: #5c5c5c;
	--text: #ffffff;
	--muted: #f1f1f1;
	--accent: #ffd21f;
	--accent-ink: #1a1500;
	--accent-soft: #3b3209;
	--ok: #8bdc98;
	--warn: #ffd21f;
	--danger: #ff6b5a;
	/* Marcas de los gráficos: gris CLARO, bien visible sobre el fondo; "hoy" va en amarillo. */
	--mark: #c4c4c4;
	--radius: 12px;
	--font-display: 'Bricolage Grotesque Variable', 'Instrument Sans Variable', ui-sans-serif, system-ui, sans-serif;
	font: 16px/1.5 'Instrument Sans Variable', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
	font-weight: 450;
}
* {
	box-sizing: border-box;
}
::placeholder {
	color: #c9c9c9;
	opacity: 1;
}
body {
	margin: 0;
	min-height: 100dvh;
	background: var(--bg);
	color: var(--text);
}
a {
	color: var(--text);
	text-decoration-thickness: 1px;
	text-underline-offset: 0.22em;
}
h1,
h2,
h3 {
	font-family: var(--font-display);
	font-weight: 600;
	letter-spacing: -0.015em;
	line-height: 1.15;
}
h1 {
	margin: 0 0 1.2rem;
	font-size: clamp(1.7rem, 4vw, 2.3rem);
	font-variation-settings: 'opsz' 96;
	letter-spacing: -0.03em;
	overflow-wrap: anywhere;
}
h2 {
	margin: 0 0 0.2rem;
	font-size: 1.05rem;
}
h3 {
	margin: 0 0 0.5rem;
	font-size: 0.95rem;
}
main > h2 {
	margin-top: 1.8rem;
	margin-bottom: 0.6rem;
}
p {
	margin: 0.5rem 0;
}
.muted {
	color: var(--muted);
	font-size: 0.88rem;
}
.error {
	color: var(--danger);
}
.ok {
	color: var(--ok);
}
code {
	font-size: 0.85em;
	color: var(--muted);
}
strong,
.n {
	font-variant-numeric: tabular-nums;
}

/* ---- Estructura: barra lateral + contenido ---- */
.brand {
	font-family: var(--font-display);
	font-size: 1.5rem;
	font-weight: 700;
	font-variation-settings: 'opsz' 96;
	letter-spacing: -0.045em;
}
.brand .mark::after {
	content: '';
	display: inline-block;
	width: 0.22em;
	height: 0.22em;
	margin-left: 0.08em;
	border-radius: 50%;
	background: var(--accent);
}
.brand small {
	margin-left: 0.5rem;
	font-family: 'Instrument Sans Variable', sans-serif;
	font-size: 0.72rem;
	font-weight: 500;
	letter-spacing: 0;
	color: var(--muted);
}
.side {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.4rem 1rem;
	padding: 0.7rem 1rem;
	border-bottom: 1px solid var(--line);
	background: var(--surface);
}
.side .brand {
	display: inline-flex;
	align-items: baseline;
}
nav {
	display: flex;
	flex-wrap: wrap;
	gap: 0.15rem;
}
nav a,
.navlink {
	display: inline-flex;
	align-items: center;
	gap: 0.55rem;
	min-height: 40px;
	padding: 0 0.75rem;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: var(--muted);
	font: inherit;
	font-size: 0.92rem;
	font-weight: 400;
	text-decoration: none;
	cursor: pointer;
}
nav a:hover,
.navlink:hover {
	color: var(--text);
	background: var(--raised);
}
nav a[aria-current='page'] {
	color: var(--text);
	background: var(--raised);
	font-weight: 600;
}
nav a[aria-current='page'] svg {
	color: var(--accent);
}
.out {
	margin-left: auto;
}
main {
	width: min(100% - 2rem, 72rem);
	margin: 0 auto;
	padding: 1.4rem 0 4rem;
}
@media (min-width: 900px) {
	body:not(.bare) {
		display: grid;
		grid-template-columns: 14.5rem minmax(0, 1fr);
	}
	.side {
		position: sticky;
		top: 0;
		height: 100dvh;
		flex-direction: column;
		flex-wrap: nowrap;
		align-items: stretch;
		gap: 1.4rem;
		padding: 1.4rem 0.8rem;
		border-bottom: 0;
		border-right: 1px solid var(--line);
	}
	.side .brand {
		padding: 0 0.6rem;
	}
	nav {
		flex-direction: column;
		flex-wrap: nowrap;
	}
	.out {
		margin: auto 0 0;
	}
	.navlink {
		width: 100%;
	}
	main {
		width: min(100% - 4rem, 72rem);
		padding-top: 2rem;
	}
}

/* ---- Pantallas de acceso ---- */
body.bare main {
	display: grid;
	align-content: center;
	gap: 0.6rem;
	min-height: 100dvh;
	width: min(100% - 2.5rem, 26rem);
	padding: 2rem 0;
}
body.bare .brand {
	display: inline-flex;
	align-items: baseline;
	margin-bottom: 1.2rem;
}
body.bare h1 {
	margin-bottom: 0.4rem;
}

/* ---- Fichas de cifras ---- */
.tiles {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr));
	gap: 0.7rem;
}
.tile {
	display: grid;
	gap: 0.1rem;
	align-content: start;
	padding: 0.9rem 1rem 0.8rem;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background: var(--surface);
}
.tile .label {
	font-size: 0.92rem;
	color: var(--text);
}
.tile strong {
	font-family: var(--font-display);
	font-size: 2.1rem;
	font-weight: 600;
	letter-spacing: -0.03em;
	line-height: 1.1;
}
.tile small {
	color: var(--muted);
	font-size: 0.85rem;
}
.spark {
	width: 100%;
	height: 30px;
	margin-top: 0.5rem;
}

/* ---- Paneles y gráficos ---- */
.cols {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr));
	gap: 0.7rem;
	margin-top: 0.7rem;
}
.panel {
	min-width: 0;
	margin-top: 0.7rem;
	padding: 1rem 1.1rem 1.1rem;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background: var(--surface);
}
.cols > .panel {
	margin-top: 0;
}
.panel > .muted {
	margin: 0 0 0.8rem;
}
.chart {
	display: block;
	width: 100%;
	height: auto;
}
.chart .bar,
.spark .bar {
	fill: var(--mark);
}
.track .bar {
	fill: var(--accent);
}
.chart .bar.now,
.spark .bar.now {
	fill: var(--accent);
}
.chart .hit {
	fill: transparent;
}
.chart g:hover .bar {
	fill: var(--text);
}
.chart .base {
	stroke: var(--muted);
	stroke-width: 1;
}
.chart .axis {
	fill: var(--text);
	font-size: 15px;
}
.ranked {
	margin: 0;
	padding: 0;
	list-style: none;
	display: grid;
	gap: 0.55rem;
}
.ranked li {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	gap: 0.15rem 0.8rem;
	align-items: baseline;
	font-size: 0.9rem;
}
.ranked .what {
	overflow-wrap: anywhere;
}
.ranked small {
	color: var(--muted);
	font-size: 0.82rem;
}
.ranked .n {
	font-weight: 600;
}
.track {
	grid-column: 1 / -1;
	display: block;
	width: 100%;
	height: 6px;
	border-radius: 2px;
	background: var(--raised);
}
.votes {
	display: grid;
	gap: 0.25rem;
	min-width: 9rem;
}
.votes .n {
	font-size: 0.78rem;
	color: var(--muted);
}
.track .up {
	fill: var(--ok);
}
.track .down {
	fill: var(--danger);
}

/* ---- Tablas ---- */
table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.9rem;
	display: block;
	overflow-x: auto;
}
th,
td {
	padding: 0.6rem 0.7rem;
	border-bottom: 1px solid var(--line);
	text-align: left;
	vertical-align: middle;
}
th {
	color: var(--muted);
	font-weight: 600;
	font-size: 0.85rem;
	white-space: nowrap;
}
tr:hover td {
	background: var(--surface);
}
.n {
	text-align: right;
}
.ua {
	color: var(--muted);
	font-size: 0.85rem;
	overflow-wrap: anywhere;
}
.who {
	display: inline-flex;
	align-items: center;
	gap: 0.6rem;
	font-weight: 600;
	text-decoration: none;
}
.who:hover {
	text-decoration: underline;
}
.avatar {
	display: grid;
	place-items: center;
	flex: none;
	width: 30px;
	height: 30px;
	border: 1px solid var(--line-strong);
	border-radius: 50%;
	background: var(--raised);
	font-size: 0.8rem;
	font-weight: 600;
}

/* ---- Formularios ---- */
input,
select,
button {
	font: inherit;
	font-size: 16px;
}
input,
select {
	min-height: 44px;
	padding: 0 0.8rem;
	border: 1px solid var(--line);
	border-radius: 8px;
	background: var(--surface);
	color: var(--text);
	min-width: 0;
}
input:focus-visible,
select:focus-visible,
button:focus-visible,
a:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}
button {
	min-height: 44px;
	padding: 0 1.1rem;
	border: 1px solid var(--accent);
	border-radius: 8px;
	background: var(--accent);
	color: var(--accent-ink);
	font-weight: 600;
	cursor: pointer;
}
button:disabled {
	opacity: 0.7;
	cursor: progress;
}
button.warn {
	background: transparent;
	border-color: var(--line-strong);
	color: var(--text);
}
button.warn:hover {
	border-color: var(--warn);
	color: var(--warn);
}
button.danger {
	background: transparent;
	border-color: var(--danger);
	color: var(--danger);
}
button.link {
	min-height: 36px;
	padding: 0 0.4rem;
	border: 0;
	background: transparent;
	color: var(--muted);
	font-weight: 400;
	text-decoration: underline;
}
.card {
	display: grid;
	gap: 0.8rem;
	max-width: 26rem;
	padding: 1.1rem;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background: var(--surface);
}
.card label,
label.card {
	display: grid;
	gap: 0.3rem;
	font-size: 0.85rem;
	color: var(--muted);
}
.search {
	display: flex;
	gap: 0.5rem;
	margin-bottom: 1rem;
}
.search input {
	flex: 1;
}
.inline {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	align-items: center;
}
.inline input[name='reason'],
.inline input[name='confirm'] {
	flex: 1 1 14rem;
}
.actions {
	display: grid;
	gap: 0.7rem;
	padding: 1rem;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background: var(--surface);
}
details {
	margin-top: 0.6rem;
}
summary {
	cursor: pointer;
	color: var(--muted);
}
.facts {
	display: grid;
	grid-template-columns: auto 1fr;
	gap: 0.5rem 1.2rem;
	margin: 0;
	padding: 1rem 1.1rem;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background: var(--surface);
}
.facts dt {
	color: var(--muted);
	font-size: 0.85rem;
}
.facts dd {
	margin: 0;
	overflow-wrap: anywhere;
}

/* ---- Estados ---- */
.badge,
.event {
	display: inline-block;
	padding: 0.1rem 0.6rem;
	border: 1px solid var(--line-strong);
	border-radius: 999px;
	font-size: 0.78rem;
	white-space: nowrap;
}
.badge::before,
.event::before {
	content: '';
	display: inline-block;
	width: 0.5em;
	height: 0.5em;
	margin-right: 0.4em;
	border-radius: 50%;
	background: var(--muted);
}
.badge.active::before,
.event.fine::before {
	background: var(--ok);
}
.badge.suspended::before,
.event.warn::before {
	background: var(--warn);
}
.badge.banned::before,
.badge.deleted::before,
.event.bad::before {
	background: var(--danger);
}
.pager {
	display: flex;
	justify-content: space-between;
}

/* ---- Mapa ---- */
.world {
	width: 100%;
	height: auto;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background: var(--surface);
}
.world .land {
	fill: #4d4d4d;
}
.world .dots circle {
	fill: var(--accent);
	fill-opacity: 0.85;
	stroke: var(--surface);
	stroke-width: 1.5;
}

/* Mapa y ciudades, juntos encima del listado de usuarios. */
.mapbox {
	display: grid;
	gap: 1rem;
	margin: 0 0 1.2rem;
}
.mapbox .world {
	border: 0;
	background: transparent;
}
.cities {
	margin: 0.5rem 0;
	padding: 0;
	list-style: none;
}
.cities li {
	display: flex;
	justify-content: space-between;
	gap: 1rem;
	padding: 0.35rem 0;
	border-bottom: 1px solid var(--line);
}
@media (min-width: 1000px) {
	.mapbox {
		grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr);
		align-items: start;
	}
}

/* ---- Chats ---- */
.msg {
	max-width: 46rem;
	margin: 0.6rem 0;
	padding: 0.7rem 0.9rem;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background: var(--surface);
}
.msg.user {
	margin-left: auto;
	max-width: 34rem;
	background: var(--raised);
}
.msg .who {
	font-size: 0.75rem;
	font-weight: 400;
	color: var(--muted);
}
.msg pre {
	margin: 0.3rem 0 0;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
	font: inherit;
	font-size: 0.9rem;
}
