/*
 * Flarian MCP: стекло на цветном фоне, как в Flarian Staffing, только в сиренево-розовой гамме.
 * Без скриптов: тема - по настройке системы, меню на узком экране - строкой над страницей.
 */

@font-face {
	font-family: Inter;
	font-weight: 100 900;
	font-style: normal;
	font-display: swap;
	src: url('/static/fonts/inter-cyrillic-wght-normal.woff2') format('woff2-variations');
	unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
	font-family: Inter;
	font-weight: 100 900;
	font-style: normal;
	font-display: swap;
	src: url('/static/fonts/inter-latin-wght-normal.woff2') format('woff2-variations');
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
	color-scheme: light dark;
	--font: Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
	--ground: #f7f1fc;
	--blob-1: #c084fc;
	--blob-2: #f9a8d4;
	--blob-3: #a78bfa;
	--blob-4: #fbcfe8;
	--text: #22162f;
	--muted: #75678a;
	--line: rgb(60 20 90 / 9%);
	--primary: #a855f7;
	--accent: #ec4899;
	--primary-soft: rgb(168 85 247 / 12%);
	--glass-bg: rgb(255 255 255 / 58%);
	--glass-bg-strong: rgb(255 255 255 / 80%);
	--glass-border: rgb(255 255 255 / 78%);
	--glass-edge: rgb(60 20 90 / 7%);
	--glass-highlight: inset 0 1px 0 rgb(255 255 255 / 90%);
	--glass-shadow: 0 1px 2px rgb(40 10 60 / 4%), 0 18px 48px -20px rgb(130 40 170 / 30%);
	--field-bg: rgb(255 255 255 / 70%);
	--ok: #15803d;
	--bad: #e11d48;
	--warn: #b45309;
	--radius-sm: 10px;
	--radius-md: 14px;
	--radius-lg: 22px;
	--radius-xl: 28px;
	--ease: cubic-bezier(0.22, 1, 0.36, 1);
}

@media (prefers-color-scheme: dark) {
	:root {
		--ground: #0e0915;
		--blob-1: #6d28d9;
		--blob-2: #9d174d;
		--blob-3: #4c1d95;
		--blob-4: #701a75;
		--text: #f4eefb;
		--muted: #ab9dc0;
		--line: rgb(255 255 255 / 9%);
		--primary: #c084fc;
		--accent: #f472b6;
		--primary-soft: rgb(192 132 252 / 16%);
		--glass-bg: rgb(30 20 44 / 55%);
		--glass-bg-strong: rgb(34 24 50 / 82%);
		--glass-border: rgb(255 255 255 / 9%);
		--glass-edge: rgb(255 255 255 / 6%);
		--glass-highlight: inset 0 1px 0 rgb(255 255 255 / 8%);
		--glass-shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 24px 60px -24px rgb(0 0 0 / 70%);
		--field-bg: rgb(0 0 0 / 22%);
		--ok: #4ade80;
		--bad: #fb7185;
		--warn: #fbbf24;
	}
}

* {
	box-sizing: border-box;
}

html {
	font-family: var(--font);
	font-size: 16px;
	font-feature-settings: 'cv11', 'ss01';
	-webkit-font-smoothing: antialiased;
	background: var(--ground);
}

body {
	min-height: 100vh;
	margin: 0;
	color: var(--text);
	line-height: 1.5;
}

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

a:hover {
	text-decoration: underline;
}

/* Цветные пятна под стеклом: без них размывать нечего. */
.ground {
	pointer-events: none;
	position: fixed;
	z-index: -1;
	inset: 0;
	overflow: hidden;
}

.ground span {
	position: absolute;
	aspect-ratio: 1;
	width: var(--size);
	background: radial-gradient(closest-side, var(--color), transparent);
	filter: blur(40px) saturate(120%);
	border-radius: 50%;
	animation: breathe var(--duration) ease-in-out infinite;
}

.ground span:nth-child(1) { --color: var(--blob-1); --size: 48vmax; --duration: 16s; top: -22vmax; left: -22vmax; }
.ground span:nth-child(2) { --color: var(--blob-2); --size: 42vmax; --duration: 19s; top: -18vmax; right: -20vmax; animation-delay: -5s; }
.ground span:nth-child(3) { --color: var(--blob-3); --size: 44vmax; --duration: 21s; bottom: -24vmax; right: -18vmax; animation-delay: -9s; }
.ground span:nth-child(4) { --color: var(--blob-4); --size: 40vmax; --duration: 17s; bottom: -20vmax; left: -16vmax; animation-delay: -3s; }

@keyframes breathe {
	50% { transform: scale(1.08) translate(1.5vmax, 1vmax); }
}

@media (prefers-reduced-motion: reduce) {
	.ground span { animation: none; }
}

/* Стекло: полупрозрачный фон, размытие подложки, светлая кромка сверху и мягкая тень. */
.glass {
	background: var(--glass-bg);
	backdrop-filter: blur(22px) saturate(170%);
	border: 1px solid var(--glass-border);
	box-shadow: var(--glass-highlight), 0 0 0 1px var(--glass-edge), var(--glass-shadow);
}

/* --- Каркас: меню слева, страница справа --- */

.shell {
	display: grid;
	grid-template-columns: 272px minmax(0, 1fr);
	min-height: 100vh;
}

.sidebar {
	position: sticky;
	top: 0.75rem;
	display: flex;
	flex-direction: column;
	gap: 1.25rem;
	align-self: start;
	height: calc(100vh - 1.5rem);
	margin: 0.75rem 0 0.75rem 0.75rem;
	padding: 1.25rem 0.875rem 0.875rem;
	border-radius: var(--radius-xl);
}

.brand {
	display: flex;
	gap: 0.625rem;
	align-items: center;
	padding: 0 0.5rem;
	font-size: 1.0625rem;
	font-weight: 700;
	color: var(--text);
	letter-spacing: -0.01em;
}

.brand:hover { text-decoration: none; }

.logo {
	display: grid;
	place-items: center;
	width: 34px;
	height: 34px;
	color: #fff;
	background: linear-gradient(135deg, var(--primary), var(--accent));
	border-radius: 11px;
	box-shadow: 0 6px 16px -6px var(--accent);
}

.nav {
	display: grid;
	gap: 0.25rem;
	overflow-y: auto;
}

.nav-label {
	margin: 0.875rem 0.75rem 0.25rem;
	font-size: 0.6875rem;
	font-weight: 600;
	color: var(--muted);
	text-transform: uppercase;
	letter-spacing: 0.06em;
}

.nav a {
	display: flex;
	gap: 0.75rem;
	align-items: center;
	padding: 0.625rem 0.75rem;
	font-size: 0.9375rem;
	font-weight: 500;
	color: var(--muted);
	border-radius: var(--radius-md);
	transition: color 0.2s var(--ease), background-color 0.2s var(--ease);
}

.nav a:hover {
	color: var(--text);
	text-decoration: none;
	background: color-mix(in srgb, var(--text), transparent 94%);
}

.nav a.active {
	color: var(--text);
	background: color-mix(in srgb, var(--primary), transparent 86%);
}

.nav a.active svg { color: var(--primary); }

.me {
	display: flex;
	gap: 0.625rem;
	align-items: center;
	margin-top: auto;
	padding: 0.75rem;
	background: color-mix(in srgb, var(--text), transparent 95%);
	border-radius: var(--radius-md);
}

.avatar {
	display: grid;
	flex-shrink: 0;
	place-items: center;
	width: 34px;
	height: 34px;
	font-size: 0.875rem;
	font-weight: 600;
	color: #fff;
	text-transform: uppercase;
	background: linear-gradient(135deg, var(--accent), var(--primary));
	border-radius: 50%;
}

.me-text {
	display: grid;
	min-width: 0;
}

.me-text strong {
	overflow: hidden;
	font-size: 0.8125rem;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.me-text a {
	font-size: 0.75rem;
	color: var(--muted);
}

.content {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.topbar {
	display: flex;
	flex-wrap: wrap;
	gap: 1rem;
	align-items: flex-end;
	justify-content: space-between;
	padding: 1.75rem clamp(1rem, 3vw, 2.25rem) 1rem;
}

.crumb {
	font-size: 0.8125rem;
	color: var(--muted);
}

.crumb a { color: var(--muted); }

h1 {
	margin: 0.125rem 0 0;
	font-size: clamp(1.5rem, 2.4vw, 2rem);
	font-weight: 700;
	letter-spacing: -0.02em;
}

h2 {
	margin: 0 0 0.25rem;
	font-size: 1.0625rem;
	font-weight: 600;
}

.page {
	display: grid;
	gap: 1.25rem;
	align-content: start;
	padding: 0.25rem clamp(1rem, 3vw, 2.25rem) 2.5rem;
}

@media (width <= 900px) {
	.shell { grid-template-columns: minmax(0, 1fr); }

	.sidebar {
		position: static;
		height: auto;
		margin: 0.75rem 0.75rem 0;
		gap: 0.75rem;
	}

	.nav {
		display: flex;
		flex-wrap: wrap;
		gap: 0.25rem;
	}

	.nav-label { display: none; }
	.me { margin-top: 0; }
}

/* --- Блоки --- */

.card {
	display: grid;
	gap: 0.75rem;
	align-content: start;
	min-width: 0;
	padding: 1.25rem 1.375rem;
	border-radius: var(--radius-lg);
}

.card-head {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	align-items: center;
	justify-content: space-between;
}

.grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	gap: 1rem;
}

.kpis {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 1rem;
}

@media (width <= 1200px) {
	.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.kpi-head {
	display: flex;
	gap: 0.625rem;
	align-items: center;
	font-size: 0.8125rem;
	font-weight: 500;
	color: var(--muted);
}

.kpi-icon {
	display: grid;
	place-items: center;
	width: 32px;
	height: 32px;
	color: var(--primary);
	background: var(--primary-soft);
	border-radius: 10px;
}

.kpi-value {
	font-size: 1.875rem;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	line-height: 1.1;
	letter-spacing: -0.03em;
}

.hint, .muted {
	font-size: 0.875rem;
	color: var(--muted);
}

.hint { margin: 0; }

.badge {
	display: inline-flex;
	gap: 0.3rem;
	align-items: center;
	padding: 0.125rem 0.55rem;
	font-size: 0.75rem;
	font-weight: 600;
	white-space: nowrap;
	border-radius: 999px;
}

.badge.ok { color: var(--ok); background: color-mix(in srgb, var(--ok), transparent 88%); }
.badge.bad { color: var(--bad); background: color-mix(in srgb, var(--bad), transparent 88%); }
.badge.warn { color: var(--warn); background: color-mix(in srgb, var(--warn), transparent 88%); }
.badge.brand { color: var(--primary); background: var(--primary-soft); }
.badge.plain { color: var(--muted); background: color-mix(in srgb, var(--text), transparent 93%); }

.ok { color: var(--ok); }
.bad { color: var(--bad); }

.flash {
	padding: 0.875rem 1.125rem;
	border-radius: var(--radius-md);
}

.flash.notice { border-left: 4px solid var(--primary); }
.flash.error { border-left: 4px solid var(--bad); }

.tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 0.375rem;
	width: fit-content;
	padding: 0.3rem;
	border-radius: var(--radius-md);
}

.tabs a {
	padding: 0.45rem 0.9rem;
	font-size: 0.875rem;
	font-weight: 500;
	color: var(--muted);
	border-radius: 10px;
}

.tabs a:hover { color: var(--text); text-decoration: none; }

.tabs a.active {
	color: var(--text);
	background: var(--glass-bg-strong);
	box-shadow: 0 1px 3px rgb(40 10 60 / 10%);
}

dl.facts {
	display: grid;
	grid-template-columns: max-content 1fr;
	gap: 0.5rem 1.25rem;
	margin: 0;
}

dl.facts dt { font-size: 0.875rem; color: var(--muted); }
dl.facts dd { margin: 0; }

code {
	padding: 0.1rem 0.4rem;
	font-family: ui-monospace, 'SF Mono', Menlo, monospace;
	font-size: 0.8125rem;
	word-break: break-all;
	background: color-mix(in srgb, var(--text), transparent 93%);
	border-radius: 6px;
}

pre {
	margin: 0;
	padding: 0.75rem 0.875rem;
	overflow: auto;
	font-family: ui-monospace, 'SF Mono', Menlo, monospace;
	font-size: 0.75rem;
	white-space: pre-wrap;
	word-break: break-word;
	background: color-mix(in srgb, var(--text), transparent 94%);
	border-radius: var(--radius-sm);
}

details pre { max-height: 320px; margin-top: 0.4rem; }
details summary { cursor: pointer; font-size: 0.8125rem; color: var(--primary); }

/* --- Формы и кнопки --- */

form { display: grid; gap: 0.875rem; margin: 0; }
form.inline { display: inline; }

label { display: grid; gap: 0.35rem; font-size: 0.875rem; font-weight: 500; }
label.check { display: inline-flex; gap: 0.5rem; align-items: center; font-weight: 400; }

input[type='text'], input[type='email'], input[type='password'], input[type='url'], input[type='date'], select {
	width: 100%;
	max-width: 520px;
	padding: 0.6rem 0.8rem;
	font: inherit;
	font-size: 0.9375rem;
	color: var(--text);
	background: var(--field-bg);
	border: 1px solid var(--line);
	border-radius: var(--radius-sm);
	outline: none;
	transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

input:focus, select:focus {
	border-color: var(--primary);
	box-shadow: 0 0 0 3px var(--primary-soft);
}

input[type='checkbox'] { width: 1.05rem; height: 1.05rem; accent-color: var(--primary); }

.checks {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	gap: 0.625rem 1rem;
}

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

.btn, button {
	display: inline-flex;
	gap: 0.5rem;
	align-items: center;
	justify-content: center;
	width: fit-content;
	padding: 0.6rem 1.1rem;
	font: inherit;
	font-size: 0.9375rem;
	font-weight: 600;
	color: #fff;
	cursor: pointer;
	background: linear-gradient(135deg, var(--primary), var(--accent));
	border: 0;
	border-radius: var(--radius-md);
	box-shadow: 0 8px 20px -10px var(--accent);
	transition: transform 0.2s var(--ease), box-shadow 0.3s var(--ease), filter 0.3s var(--ease);
}

.btn:hover, button:hover {
	text-decoration: none;
	filter: brightness(1.06) saturate(1.1);
	box-shadow: 0 12px 26px -10px var(--accent);
}

.btn:active, button:active { transform: translateY(1px); }

.btn.ghost, button.ghost {
	color: var(--text);
	background: var(--glass-bg-strong);
	border: 1px solid var(--line);
	box-shadow: none;
}

.btn.danger, button.danger {
	color: var(--bad);
	background: transparent;
	border: 1px solid color-mix(in srgb, var(--bad), transparent 70%);
	box-shadow: none;
}

.btn.small, button.small { padding: 0.35rem 0.75rem; font-size: 0.8125rem; }

/* --- Таблицы --- */

.table-wrap { overflow-x: auto; }

table {
	width: 100%;
	font-size: 0.875rem;
	border-collapse: collapse;
}

th {
	padding: 0.5rem 0.625rem;
	font-size: 0.75rem;
	font-weight: 600;
	color: var(--muted);
	text-align: left;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	border-bottom: 1px solid var(--line);
}

td {
	padding: 0.7rem 0.625rem;
	vertical-align: top;
	border-bottom: 1px solid var(--line);
}

tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in srgb, var(--primary), transparent 95%); }

.when { color: var(--muted); white-space: nowrap; }
.request { display: block; margin-top: 0.25rem; color: var(--muted); }

.filters {
	display: flex;
	flex-wrap: wrap;
	gap: 0.875rem 1rem;
	align-items: end;
}

.filters label { min-width: 160px; }

.pager {
	display: flex;
	gap: 1rem;
	align-items: center;
	justify-content: space-between;
	font-size: 0.875rem;
}

/* --- Вход и простые страницы без меню --- */

.solo {
	display: grid;
	place-items: center;
	min-height: 100vh;
	padding: 1.5rem;
}

.solo .card {
	gap: 1rem;
	max-width: 520px;
	padding: 2rem;
	border-radius: var(--radius-xl);
}

.solo .brand { padding: 0; }

.prose { max-width: 760px; }
.prose ul { margin: 0; padding-left: 1.25rem; }
.prose p { margin: 0; }
