/* biome-ignore-all lint/style/noDescendingSpecificity: the shell in reading order, wider screens after the phone */
/* The signed-in app (change account-app): the shell of site/templates/_app.html around the
   account page's sections. Nothing of the app shows until the page knows someone is signed
   in (body[data-signed], set by sections.js); before that the page is the sign-in card under
   a slim bar with the logo and the languages. Extends site.css and account.css. */
.app {
	min-height: 100vh;
}
.app-side,
.app-tabs,
.app-chip,
.app-top__me {
	display: none;
}
.visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}
.app-ico {
	width: 20px;
	height: 20px;
	flex: none;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
}

/* ---------- the top bar: the logo and the languages, or on a phone the chip and the person */
.app-top {
	position: sticky;
	top: 0;
	z-index: 30;
	display: flex;
	align-items: center;
	gap: 12px;
	min-height: 64px;
	padding: 0 var(--gut);
	border-bottom: 1px solid var(--line);
	background: rgba(11, 12, 29, 0.92);
	backdrop-filter: blur(12px);
}
.app-top .brand {
	margin-right: auto;
}
.app-top__langs {
	display: flex;
	gap: 4px;
}
.app-chip {
	align-items: center;
	gap: 8px;
	min-height: 36px;
	padding: 0 12px;
	border: 1px solid var(--line-2);
	border-radius: 999px;
	background: var(--s1);
	color: var(--text);
	font: 600 14px / 1 var(--ff-b);
	text-decoration: none;
	white-space: nowrap;
}
.app-chip i {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--cyan);
}
/* (shown only where the shell shows a person: the top bar's while signed in, the sidebar's) */
.app-ava {
	place-items: center;
	flex: none;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: var(--grad);
	color: var(--ink);
	font: 700 15px / 1 var(--ff-d);
	text-decoration: none;
}
.app .phead {
	padding-top: 32px;
}
body[data-signed] .acct__head .kicker {
	display: none;
}
/* the card that asks for Telegram belongs to Баланс */
body[data-section="settings"] #link-required {
	display: none;
}

/* ---------- signed in, on a phone: the chip, the person and the tab bar */
body[data-signed] .app-top__langs {
	display: none;
}
body[data-signed] .app-chip:not([hidden]) {
	display: inline-flex;
}
body[data-signed] .app-top__me:not([hidden]) {
	display: grid;
}
body[data-signed] .app-tabs {
	position: fixed;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 30;
	display: grid;
	grid-auto-columns: 1fr;
	grid-auto-flow: column;
	padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
	border-top: 1px solid var(--line);
	background: rgba(11, 12, 29, 0.96);
	backdrop-filter: blur(12px);
}
.app-tabs a {
	display: grid;
	justify-items: center;
	gap: 4px;
	min-height: 52px;
	padding: 6px 0;
	border-radius: 12px;
	color: var(--dim);
	font: 600 12px / 1.1 var(--ff-b);
	text-decoration: none;
}
.app-tabs a[aria-current="page"] {
	color: var(--text);
}
.app-tabs a[aria-current="page"] .app-ico,
.app-nav a[aria-current="page"] .app-ico {
	stroke: var(--pink);
}
body[data-signed] .acct {
	padding-bottom: calc(96px + env(safe-area-inset-bottom));
}
@media (max-width: 359px) {
	.app-top .brand__name {
		display: none;
	}
}

/* ---------- signed in, from 960 px: the sidebar, and no bar over the top of the page (a
   part of a page that sticks under the bar reads --bar for where it sticks) */
@media (min-width: 960px) {
	body[data-signed] {
		--bar: 0px;
	}
	body[data-signed] .app {
		display: grid;
		grid-template-columns: 256px minmax(0, 1fr);
		background: linear-gradient(90deg, var(--deep) 256px, transparent 256px);
	}
	body[data-signed] .app-top,
	body[data-signed] .app-tabs {
		display: none;
	}
	body[data-signed] .app-side {
		position: sticky;
		top: 0;
		grid-row: 1 / span 2;
		display: flex;
		flex-direction: column;
		gap: 22px;
		height: 100vh;
		padding: 22px 16px 18px;
		border-right: 1px solid var(--line);
		background: var(--deep);
	}
	body[data-signed] .acct {
		padding-bottom: var(--sec);
	}
	.app-side .brand {
		padding: 0 8px;
	}
	.app-nav {
		display: grid;
		gap: 4px;
	}
	.app-nav a {
		display: flex;
		align-items: center;
		gap: 12px;
		min-height: 46px;
		padding: 0 12px;
		border-radius: 12px;
		color: var(--muted);
		font: 600 15px / 1 var(--ff-b);
		text-decoration: none;
		transition:
			background 0.2s,
			color 0.2s;
	}
	.app-nav a:hover {
		background: var(--s1);
		color: var(--text);
	}
	.app-nav a[aria-current="page"] {
		background: var(--s3);
		color: var(--text);
	}
	.app-side__low {
		display: grid;
		gap: 12px;
		margin-top: auto;
	}
	.app-bal:not([hidden]) {
		display: grid;
		gap: 10px;
		padding: 16px;
		border: 1px solid var(--line-2);
		border-radius: var(--r-m);
		background: linear-gradient(
			160deg,
			rgba(138, 127, 249, 0.22),
			rgba(217, 135, 245, 0.08)
		);
		color: var(--muted);
		font-size: 13px;
		text-decoration: none;
	}
	.app-bal__plan b {
		margin-right: 4px;
		color: var(--text);
		font: 700 15px / 1 var(--ff-d);
	}
	.app-bal__row {
		display: flex;
		justify-content: space-between;
		align-items: baseline;
		gap: 8px;
		font-size: 14px;
	}
	.app-bal__row b {
		color: var(--text);
		font: 700 16px / 1 var(--ff-d);
	}
	.app-bal__bar {
		height: 6px;
		border-radius: 999px;
		background: var(--s3);
		overflow: hidden;
	}
	.app-bal__bar i {
		display: block;
		height: 100%;
		border-radius: inherit;
		background: var(--grad);
	}
	.app-link {
		display: flex;
		align-items: center;
		gap: 10px;
		min-height: 40px;
		padding: 0 12px;
		border-radius: 10px;
		color: var(--muted);
		font: 600 14px / 1 var(--ff-b);
		text-decoration: none;
	}
	.app-link:hover {
		color: var(--text);
	}
	.app-user:not([hidden]) {
		display: flex;
		align-items: center;
		gap: 10px;
		padding: 12px 8px 0;
		border-top: 1px solid var(--line);
		color: var(--text);
		text-decoration: none;
	}
	.app-user .app-ava,
	.app-user__who {
		display: grid;
		min-width: 0;
	}
	.app-user b {
		overflow: hidden;
		font: 600 14px / 1.3 var(--ff-b);
		text-overflow: ellipsis;
		white-space: nowrap;
	}
	.app-user small {
		overflow: hidden;
		color: var(--dim);
		font-size: 13px;
		text-overflow: ellipsis;
		white-space: nowrap;
	}
}
