/* ============================================================
   SONYA App Shell — App Library panel, app icons, workspaces.
   Pairs with app-shell.js. Every rule is scoped to .sx-* classes or
   to html.sx-shell, so pages that don't load the shell are unaffected.

   Material: SONYA's own glass (sign-in card / home-screen pills).
   Light: #2D2D2F / #97979A / #C8C8C8 · dark: #010102 / #06060D /
   #0B0D14 / #171719. No hue accents and no warm tones — colour lives
   only inside the app icons.

   Light theme: styles.css forces `color:#0a0a0a !important` on every
   element, so every text colour here is set explicitly with !important
   on a component selector (same pattern as .acct-drop-*).
   ============================================================ */

:root {
	--sx-ease-out: cubic-bezier(0.23, 1, 0.32, 1);
	--sx-ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
	--sx-bevel: inset -21.48px -21.48px 10.74px -21.48px rgba(179, 179, 179, 0.62),
		inset 21.48px 21.48px 10.74px -21.48px rgba(179, 179, 179, 0.62);
	--sx-bevel-soft: inset -14px -14px 8px -14px rgba(179, 179, 179, 0.32),
		inset 14px 14px 8px -14px rgba(179, 179, 179, 0.32);
	--sx-panel-w: 352px;
	--sx-edge: 20px;
}

/* Native button chrome off for pages without styles.css (opencut.html).
   Zero specificity: every component rule below still wins. */
:where(button.sx-toggle, .sx-library button) { -webkit-appearance: none; appearance: none; margin: 0; padding: 0; border: 0; background: none; font: inherit; color: inherit; cursor: pointer; }

/* ─────────────── Library control (top-left) ─────────────── */
.sx-toggle {
	position: fixed;
	top: var(--sx-edge);
	left: var(--sx-edge);
	z-index: 21;
	width: 44px;
	height: 44px;
	display: grid;
	place-items: center;
	border-radius: 999px;
	background: rgba(8, 8, 10, 0.55);
	box-shadow: var(--sx-bevel-soft);
	backdrop-filter: blur(18px) saturate(130%);
	-webkit-backdrop-filter: blur(18px) saturate(130%);
	-webkit-tap-highlight-color: transparent;
	transition: background-color 0.25s ease, box-shadow 0.25s ease, transform 0.16s var(--sx-ease-out), opacity 0.2s ease;
}
.sx-toggle svg { width: 17px; height: 17px; }
.sx-toggle rect { fill: rgba(255, 255, 255, 0.58); transition: fill 0.2s ease; }
.sx-toggle .sx-toggle-hot { fill: #fff; }
@media (hover: hover) and (pointer: fine) {
	.sx-toggle:hover {
		background: rgba(18, 18, 22, 0.7);
		box-shadow: inset -21.48px -21.48px 10.74px -21.48px rgba(179, 179, 179, 0.55),
			inset 21.48px 21.48px 10.74px -21.48px rgba(179, 179, 179, 0.55);
	}
	.sx-toggle:hover rect { fill: #fff; }
}
.sx-toggle:active { transform: scale(0.94); }
.sx-lib-open .sx-toggle { opacity: 0; transform: scale(0.92); pointer-events: none; }
body.sonya-auth-open .sx-toggle { opacity: 0 !important; pointer-events: none !important; }

/* Existing chrome that sat where the control now lives moves aside. */
.sx-shell .app-container.v2 .page:not(#page-source) .page-header.compact {
	/* .app-container is centred at max 1180px (+28px padding): only push the
	   back button right by as much as the control would actually overlap. */
	left: clamp(18px, calc(48px - (100vw - 1180px) / 2), 70px);
}
.sx-shell[data-sx-page="streamer"] .sm-topbar {
	/* Topbar is centred at max 1040px: pad only as much as the control
	   actually overlaps it (76px when flush left, 24px once there's room). */
	padding-left: clamp(24px, calc(84px - (100vw - 1040px) / 2), 76px);
}

/* ─────────────── Scrim ─────────────── */
.sx-scrim {
	position: fixed;
	inset: 0;
	z-index: 8000;
	background: rgba(1, 1, 2, 0.42);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.22s ease;
}
[data-theme="light"] .sx-scrim { background: rgba(45, 45, 47, 0.14); }
.sx-lib-open .sx-scrim { opacity: 1; pointer-events: auto; transition-duration: 0.32s; }

/* ─────────────── Panel — SONYA glass ───────────────
   Same material as the sign-in card: a puffy top highlight in the fill,
   a crisp rim light, the diagonal inset bevel, two-step ambient shadow.
   Palette — light: #2D2D2F / #97979A / #C8C8C8 (milky gray glass);
   dark: #010102 / #06060D / #0B0D14 / #171719 (graphite glass).
   No hue anywhere: colour belongs to the app icons only. */
.sx-library {
	--sx-text: #F2F2F3;
	--sx-muted: rgba(242, 242, 243, 0.6);
	--sx-dim: rgba(242, 242, 243, 0.4);
	/* Cold graphite glass only (#171719 → #0B0D14 → #06060D / #010102):
	   no neutral white-on-grey wash, which read as a warm #282829. */
	--sx-well:
		radial-gradient(120% 60% at 50% -10%, rgba(200, 205, 225, 0.07), transparent 62%),
		linear-gradient(180deg, rgba(23, 23, 25, 0.62) 0%, rgba(11, 13, 20, 0.72) 100%);
	--sx-well-shadow:
		inset 0 1px 0 rgba(220, 224, 240, 0.1),
		inset 0 0 0 1px rgba(200, 205, 225, 0.06),
		inset 0 -14px 28px -16px rgba(1, 1, 2, 0.75),
		0 14px 32px -16px rgba(1, 1, 2, 0.8);
	--sx-cell-on:
		radial-gradient(120% 80% at 50% -20%, rgba(210, 215, 235, 0.14), transparent 62%),
		linear-gradient(180deg, rgba(23, 23, 25, 0.9) 0%, rgba(11, 13, 20, 0.92) 100%);
	--sx-cell-on-shadow:
		inset 0 1px 0 rgba(225, 229, 245, 0.2),
		inset 0 0 0 1px rgba(200, 205, 225, 0.08),
		inset 0 -10px 18px -10px rgba(1, 1, 2, 0.7),
		0 10px 22px -10px rgba(1, 1, 2, 0.85);
	--sx-ring: 0 0 0 1.5px rgba(242, 242, 243, 0.85), 0 0 0 5px rgba(255, 255, 255, 0.07), 0 0 24px rgba(255, 255, 255, 0.16);
	--sx-dot: #F2F2F3;

	position: fixed;
	top: 10px;
	bottom: 10px;
	left: 10px;
	z-index: 8001;
	width: var(--sx-panel-w);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	isolation: isolate;
	border-radius: 32px;
	color: var(--sx-text);
	background:
		radial-gradient(140% 55% at 50% -10%, rgba(255, 255, 255, 0.12), transparent 62%),
		linear-gradient(180deg, rgba(23, 23, 25, 0.6) 0%, rgba(11, 13, 20, 0.6) 55%, rgba(6, 6, 13, 0.66) 100%);
	backdrop-filter: blur(34px) saturate(140%);
	-webkit-backdrop-filter: blur(34px) saturate(140%);
	box-shadow:
		inset 0 1px 0 rgba(255, 255, 255, 0.24),
		inset -21.48px -21.48px 10.74px -21.48px rgba(200, 200, 200, 0.5),
		inset 21.48px 21.48px 10.74px -21.48px rgba(200, 200, 200, 0.5),
		0 10px 40px rgba(1, 1, 2, 0.45),
		0 30px 80px rgba(1, 1, 2, 0.55);
	transform: translate3d(calc(-100% - 24px), 0, 0);
	visibility: hidden;
	/* Exit: quicker than the entrance, still ease-out (system responding). */
	transition: transform 0.22s var(--sx-ease-out), visibility 0s linear 0.22s;
	will-change: transform;
	touch-action: pan-y;
}
.sx-lib-open .sx-library {
	transform: translate3d(0, 0, 0);
	visibility: visible;
	transition: transform 0.36s var(--sx-ease-drawer), visibility 0s;
}
.sx-dragging .sx-library { transition: none; }
[data-theme="light"] .sx-library {
	--sx-text: #2D2D2F;
	--sx-muted: rgba(45, 45, 47, 0.62);
	--sx-dim: rgba(45, 45, 47, 0.44);
	--sx-well: rgba(255, 255, 255, 0.3);
	--sx-well-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), inset 0 -10px 24px -16px rgba(45, 45, 47, 0.2), inset 0 0 0 1px rgba(255, 255, 255, 0.25);
	--sx-cell-on: rgba(255, 255, 255, 0.46);
	--sx-cell-on-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 6px 16px -8px rgba(45, 45, 47, 0.28);
	--sx-ring: 0 0 0 1.5px rgba(45, 45, 47, 0.55), 0 0 0 5px rgba(255, 255, 255, 0.55), 0 10px 22px -8px rgba(45, 45, 47, 0.4);
	--sx-dot: #2D2D2F;
	color: #2D2D2F !important;
	background:
		radial-gradient(140% 55% at 50% -10%, rgba(255, 255, 255, 0.72), transparent 62%),
		linear-gradient(180deg, rgba(200, 200, 200, 0.5) 0%, rgba(151, 151, 154, 0.42) 100%);
	box-shadow:
		inset 0 1px 0 rgba(255, 255, 255, 0.85),
		inset -21.48px -21.48px 10.74px -21.48px rgba(45, 45, 47, 0.14),
		inset 21.48px 21.48px 10.74px -21.48px rgba(255, 255, 255, 0.65),
		0 10px 40px rgba(45, 45, 47, 0.14),
		0 30px 80px rgba(45, 45, 47, 0.18);
}
/* ── Backdrop artwork behind frosted ("шершавое") glass ──
   ::before carries the artwork (silver galaxy in light, monochrome
   nebula in dark) pushed through #sx-frost — a displacement filter that
   ripples it like pebbled glass (defined in app-shell.js). It overscans
   by 24px so the displaced edges never show a gap.
   ::after is the glass itself: a milky (light) / smoky (dark) tint.
   Content sits above both (z-index 1). */
.sx-library::before {
	content: '';
	position: absolute;
	inset: -24px;
	z-index: 0;
	pointer-events: none;
	background: #0B0D14 url('/assets/apps/library-bg-dark.jpg') center / cover no-repeat;
	filter: url(#sx-frost);
}
[data-theme="light"] .sx-library::before {
	background: #dcdce0 url('/assets/apps/library-bg-light.jpg') center / cover no-repeat;
	filter: url(#sx-frost-fine);
}
/* The artwork fully covers the sheet, so its own backdrop blur would
   be wasted GPU work. */
.sx-library { backdrop-filter: none; -webkit-backdrop-filter: none; }
.sx-library::after {
	content: '';
	position: absolute;
	inset: 0;
	z-index: 0;
	pointer-events: none;
	border-radius: inherit;
	background:
		radial-gradient(140% 50% at 50% -8%, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0) 60%),
		linear-gradient(180deg, rgba(1, 1, 2, 0.22) 0%, rgba(6, 6, 13, 0.36) 60%, rgba(1, 1, 2, 0.5) 100%);
}
/* Light: a milky-gray veil that tones the bright silver artwork down
   (#C8C8C8 / #97979A family), with a soft white dome on top. */
[data-theme="light"] .sx-library::after {
	background:
		radial-gradient(140% 50% at 50% -8%, rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0) 60%),
		linear-gradient(180deg, rgba(214, 214, 218, 0.5) 0%, rgba(200, 200, 204, 0.52) 55%, rgba(176, 176, 182, 0.56) 100%);
}
.sx-lib-sheen { display: none; }

.sx-lib-head {
	position: relative;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 20px 16px 6px 26px;
}
.sx-lib-mark {
	font-family: 'Unbounded', 'Sora', system-ui, sans-serif;
	font-weight: 300;
	font-size: 15px;
	letter-spacing: 0.38em;
	color: var(--sx-text) !important;
	user-select: none;
}
.sx-lib-close {
	width: 36px;
	height: 36px;
	display: grid;
	place-items: center;
	border-radius: 999px;
	background: var(--sx-well);
	box-shadow: var(--sx-well-shadow);
	-webkit-tap-highlight-color: transparent;
	transition: background-color 0.2s ease, transform 0.16s var(--sx-ease-out);
}
.sx-lib-close svg { width: 13px; height: 13px; stroke: var(--sx-muted); stroke-width: 1.7; stroke-linecap: round; fill: none; }
.sx-lib-close:hover svg { stroke: var(--sx-text); }
.sx-lib-close:active { transform: scale(0.92); }

.sx-lib-scroll {
	position: relative;
	z-index: 1;
	flex: 1;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 0 16px 22px;
	scrollbar-width: thin;
	scrollbar-color: rgba(151, 151, 154, 0.4) transparent;
}

.sx-lib-label {
	margin: 24px 10px 12px;
	font-family: 'Onest', system-ui, sans-serif;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--sx-dim) !important;
}

/* Keyboard focus: a neutral ring in the panel's own language. */
.sx-library a:focus-visible,
.sx-library button:focus-visible,
.sx-toggle:focus-visible {
	outline: 2px solid rgba(242, 242, 243, 0.8) !important;
	outline-offset: 2px;
}
[data-theme="light"] .sx-library a:focus-visible,
[data-theme="light"] .sx-library button:focus-visible {
	outline-color: rgba(45, 45, 47, 0.6) !important;
}

/* ─────────────── App grid — the dock ───────────────
   A recessed glass tray the icons rest on (like the iPhone dock).
   Cell radius = tray radius − padding, so the corners stay concentric. */
.sx-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 4px;
	margin: 0;
	padding: 10px;
	list-style: none;
	border-radius: 30px;
	background: var(--sx-well);
	box-shadow: var(--sx-well-shadow);
	backdrop-filter: blur(14px) saturate(140%);
	-webkit-backdrop-filter: blur(14px) saturate(140%);
}
.sx-app {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
	padding: 12px 2px 15px;
	border-radius: 20px;
	text-decoration: none;
	-webkit-tap-highlight-color: transparent;
	transition: background-color 0.22s ease, box-shadow 0.22s ease;
}
.sx-app-name {
	position: relative;
	font-family: 'Onest', system-ui, sans-serif;
	font-size: 13px;
	font-weight: 500;
	line-height: 1;
	letter-spacing: 0.01em;
	color: var(--sx-muted) !important;
	transition: color 0.2s ease;
}
/* "Open" indicator — a dock-style dot. */
.sx-app-dot {
	position: absolute;
	bottom: 6px;
	left: 50%;
	width: 4px;
	height: 4px;
	margin-left: -2px;
	border-radius: 50%;
	background: var(--sx-dot);
	opacity: 0;
	transform: scale(0.4);
	transition: opacity 0.2s ease, transform 0.24s var(--sx-ease-out);
}
@media (hover: hover) and (pointer: fine) {
	.sx-app:hover { background: rgba(151, 151, 154, 0.12); }
	.sx-app:hover .sx-icon { transform: translateY(-2px) scale(1.03); box-shadow: var(--sx-icon-lift); }
	.sx-app:hover .sx-app-name { color: var(--sx-text) !important; }
}
.sx-app:active .sx-icon { transform: scale(0.94); transition-duration: 0.1s; }

.sx-app.is-active { background: var(--sx-cell-on); box-shadow: var(--sx-cell-on-shadow); }
.sx-app.is-active .sx-app-name { color: var(--sx-text) !important; }
.sx-app.is-active .sx-app-dot { opacity: 0.9; transform: scale(1); }
.sx-app.is-active .sx-icon::before { opacity: 1; transform: scale(1); }
.sx-app.is-active .sx-icon { box-shadow: var(--sx-icon-lift); }

/* ─────────────── App icon ───────────────
   The owner's finished artwork carries its own glass and tile — the
   container adds nothing on top of it: no background, no overlay, no
   filter. It clips the square file to the tile's squircle (28%) and
   gives it a soft neutral shadow to sit on. */
.sx-icon {
	--sx-icon-rest: 0 1px 2px rgba(1, 1, 2, 0.22), 0 8px 18px -8px rgba(1, 1, 2, 0.55);
	--sx-icon-lift: 0 2px 4px rgba(1, 1, 2, 0.22), 0 16px 28px -10px rgba(1, 1, 2, 0.6);
	position: relative;
	display: block;
	flex: none;
	width: 64px;
	height: 64px;
	border-radius: 28%;
	box-shadow: var(--sx-icon-rest);
	transition: transform 0.24s var(--sx-ease-out), box-shadow 0.26s ease;
}
[data-theme="light"] .sx-icon {
	--sx-icon-rest: 0 1px 2px rgba(45, 45, 47, 0.16), 0 8px 18px -8px rgba(45, 45, 47, 0.4);
	--sx-icon-lift: 0 2px 4px rgba(45, 45, 47, 0.16), 0 16px 28px -10px rgba(45, 45, 47, 0.45);
}
.sx-icon img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: inherit;
	user-select: none;
	-webkit-user-drag: none;
	/* Placeholder while the file decodes — matches the artwork's base. */
	background: #0B0D14;
}
[data-theme="light"] .sx-icon img { background: #C8C8C8; }
/* Active halo — a milky ring just outside the tile. */
.sx-icon::before {
	content: '';
	position: absolute;
	inset: -5px;
	border-radius: 31%;
	box-shadow: var(--sx-ring, 0 0 0 1.5px rgba(242, 242, 243, 0.85));
	opacity: 0;
	transform: scale(0.94);
	transition: opacity 0.24s ease, transform 0.3s var(--sx-ease-out);
	pointer-events: none;
}
.sx-icon--sm { width: 44px; height: 44px; }
.sx-icon--sm::before { inset: -4px; }
.sx-icon--xs { width: 30px; height: 30px; }
.sx-icon--xl {
	width: 112px;
	height: 112px;
	--sx-icon-rest: 0 2px 6px rgba(1, 1, 2, 0.3), 0 24px 50px -16px rgba(1, 1, 2, 0.6);
}

/* ─────────────── Library rows (Работы / Справочник) ───────────────
   Same recessed well as the dock; rows inside it, no card per row. */
.sx-shelf {
	display: flex;
	flex-direction: column;
	gap: 2px;
	margin: 0;
	padding: 6px;
	list-style: none;
	border-radius: 26px;
	background: var(--sx-well);
	box-shadow: var(--sx-well-shadow);
	backdrop-filter: blur(14px) saturate(140%);
	-webkit-backdrop-filter: blur(14px) saturate(140%);
}
.sx-shelf-item {
	display: flex;
	align-items: center;
	gap: 14px;
	width: 100%;
	padding: 8px 12px 8px 8px;
	border-radius: 20px;
	text-align: left;
	cursor: default;
	-webkit-tap-highlight-color: transparent;
	transition: background-color 0.2s ease;
}
@media (hover: hover) and (pointer: fine) {
	.sx-shelf-item:hover { background: rgba(151, 151, 154, 0.12); }
}
.sx-shelf-name {
	flex: 1;
	font-family: 'Onest', system-ui, sans-serif;
	font-size: 14px;
	font-weight: 500;
	color: var(--sx-text) !important;
}
/* "Скоро" — a hairline tag, lighter than the content it labels. */
.sx-soon {
	flex: none;
	padding: 4px 9px;
	border-radius: 999px;
	font-size: 10.5px;
	font-weight: 500;
	letter-spacing: 0.03em;
	line-height: 1;
	color: var(--sx-dim) !important;
	box-shadow: inset 0 0 0 1px rgba(151, 151, 154, 0.4);
}
.sx-shelf-item.is-nudged { animation: sxNudge 0.32s var(--sx-ease-out); }
@keyframes sxNudge {
	30% { transform: translateX(3px); }
	60% { transform: translateX(-2px); }
}

/* ─────────────── Open choreography ───────────────
   Panel slides on the drawer curve; contents settle in a short stagger
   behind it. Transitions (not keyframes) so a fast open→close retargets. */
.sx-library .sx-grid > li,
.sx-library .sx-shelf > li,
.sx-library .sx-lib-label {
	opacity: 0;
	transform: translate3d(-6px, 0, 0);
	transition: opacity 0.14s ease, transform 0.14s ease;
}
.sx-lib-open .sx-library .sx-grid > li,
.sx-lib-open .sx-library .sx-shelf > li {
	opacity: 1;
	transform: none;
	transition: opacity 0.3s ease, transform 0.36s var(--sx-ease-out);
	transition-delay: calc(70ms + var(--sx-i, 0) * 26ms);
}
.sx-lib-open .sx-library .sx-lib-label {
	opacity: 1;
	transform: none;
	transition: opacity 0.3s ease 90ms, transform 0.36s var(--sx-ease-out) 90ms;
}

/* ─────────────── Workspaces (views hosted by index.html) ─────────────── */
html[data-sx-page="cut"]:not([data-sx-app="cut"]) .app-container,
html[data-sx-page="cut"]:not([data-sx-app="cut"]) .processing-cloth-host { display: none !important; }

.sx-workspace {
	position: fixed;
	inset: 0;
	z-index: 2;
}
.sx-workspace[hidden] { display: none; }

.sx-ws-bar {
	position: absolute;
	top: var(--sx-edge);
	left: 76px;
	height: 44px;
	display: flex;
	align-items: center;
	gap: 11px;
}
.sx-ws-title {
	margin: 0;
	font-family: 'Unbounded', 'Sora', system-ui, sans-serif;
	font-weight: 400;
	font-size: 15px;
	letter-spacing: 0.08em;
	color: #fff !important;
	text-shadow: 0 2px 18px rgba(0, 0, 0, 0.35);
	outline: none;
}
/* Focused programmatically when an app opens (tabindex=-1): never draw a ring. */
.sx-shell .sx-ws-title:focus, .sx-shell .sx-ws-title:focus-visible { outline: none !important; box-shadow: none !important; border: 0 !important; }
.sx-ws-title span { font-weight: 300; color: rgba(255, 255, 255, 0.6) !important; }
[data-theme="light"] .sx-ws-title { color: #0a0a0a !important; text-shadow: none; }
[data-theme="light"] .sx-ws-title span { color: rgba(10, 10, 10, 0.5) !important; }

/* The app's canvas — empty on purpose in Phase 1. */
.sx-ws-canvas {
	position: absolute;
	top: 80px;
	left: var(--sx-edge);
	right: var(--sx-edge);
	bottom: 42px;
	display: grid;
	place-items: center;
	border-radius: 32px;
	background:
		radial-gradient(140% 60% at 50% -12%, rgba(255, 255, 255, 0.1), transparent 62%),
		linear-gradient(180deg, rgba(23, 23, 25, 0.5) 0%, rgba(6, 6, 13, 0.56) 100%);
	backdrop-filter: blur(26px) saturate(140%);
	-webkit-backdrop-filter: blur(26px) saturate(140%);
	box-shadow:
		inset 0 1px 0 rgba(255, 255, 255, 0.22),
		inset -21.48px -21.48px 10.74px -21.48px rgba(200, 200, 200, 0.5),
		inset 21.48px 21.48px 10.74px -21.48px rgba(200, 200, 200, 0.5),
		0 30px 80px rgba(1, 1, 2, 0.4);
}
[data-theme="light"] .sx-ws-canvas {
	background:
		radial-gradient(140% 60% at 50% -12%, rgba(255, 255, 255, 0.7), transparent 62%),
		linear-gradient(180deg, rgba(200, 200, 200, 0.38) 0%, rgba(151, 151, 154, 0.3) 100%);
	box-shadow:
		inset 0 1px 0 rgba(255, 255, 255, 0.82),
		inset -21.48px -21.48px 10.74px -21.48px rgba(45, 45, 47, 0.14),
		inset 21.48px 21.48px 10.74px -21.48px rgba(255, 255, 255, 0.65),
		0 30px 80px rgba(45, 45, 47, 0.16);
}

/* App module states: the mark breathes while the app's code loads. */
.sx-ws-canvas.is-loading .sx-icon--xl { animation: sxBreath 1.4s ease-in-out infinite; }
@keyframes sxBreath { 50% { opacity: 0.55; transform: scale(0.97); } }
.sx-ws-error { display: flex; flex-direction: column; align-items: center; gap: 10px; max-width: 34ch; padding: 0 16px; text-align: center; font-size: 14px; color: rgba(255, 255, 255, 0.75) !important; }
[data-theme="light"] .sx-ws-error { color: rgba(16, 22, 34, 0.7) !important; }
.sx-ws-error p { margin: 0; color: inherit !important; }
.sx-ws-error-title { font-size: 16px; font-weight: 600; }
.sx-ws-error-text { line-height: 1.5; opacity: 0.8; }
.sx-ws-error-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 8px; }
.sx-ws-retry, .sx-ws-back { min-height: 44px; padding: 0 18px; border: 0; border-radius: 999px; font: inherit; font-weight: 600; background: rgba(255, 255, 255, 0.12); color: inherit !important; cursor: pointer; }
.sx-ws-back { background: transparent; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.24); }
[data-theme="light"] .sx-ws-retry { background: rgba(16, 22, 34, 0.08); }
[data-theme="light"] .sx-ws-back { box-shadow: inset 0 0 0 1px rgba(16, 22, 34, 0.2); }

/* Workspace switch: the incoming app resolves out of a slight blur.
   Cut (whose tree contains position:fixed layers) gets opacity only —
   a transform/filter on .app-container would re-anchor those layers. */
.sx-switching .sx-workspace:not([hidden]) .sx-ws-canvas { animation: sxCanvasIn 0.42s var(--sx-ease-out) both; }
.sx-switching .sx-workspace:not([hidden]) .sx-ws-bar { animation: sxBarIn 0.36s var(--sx-ease-out) both; }
.sx-switching[data-sx-app="cut"] .app-container { animation: sxFade 0.32s ease both; }
@keyframes sxCanvasIn {
	from { opacity: 0; transform: translate3d(0, 10px, 0) scale(0.985); filter: blur(6px); }
}
@keyframes sxBarIn {
	from { opacity: 0; transform: translate3d(-6px, 0, 0); }
}
@keyframes sxFade {
	from { opacity: 0; }
}

/* ─────────────── Mobile ─────────────── */
@media (max-width: 380px) {
	.sx-ws-title span { display: none; }
}
@media (max-width: 560px) {
	:root { --sx-edge: 16px; --sx-panel-w: min(88vw, 352px); }
	.sx-library { top: 8px; bottom: 8px; left: 8px; border-radius: 26px; }
	.sx-lib-head { padding: 16px 14px 2px 22px; }
	.sx-lib-scroll { padding: 0 10px 18px; }
	.sx-icon:not(.sx-icon--sm):not(.sx-icon--xs):not(.sx-icon--xl) { width: 58px; height: 58px; }
	.sx-app { padding: 10px 2px 13px; }
	/* Leave room for the account + theme buttons on the right. */
	.sx-ws-bar { left: 70px; right: 124px; }
	.sx-ws-title { font-size: 14px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
	.sx-ws-canvas { top: 74px; left: 10px; right: 10px; bottom: 38px; border-radius: 24px; }
	.sx-ws-bar .sx-icon--xs { flex: none; }
	.sx-icon--xl { width: 92px; height: 92px; }
}
.sx-lib-open body { overflow: hidden; }

/* ─────────────── Reduced motion ───────────────
   Keep the fades that explain what changed; drop travel and blur. */
@media (prefers-reduced-motion: reduce) {
	.sx-library,
	.sx-lib-open .sx-library { transform: none; opacity: 0; transition: opacity 0.18s ease, visibility 0s linear 0.18s; }
	.sx-lib-open .sx-library { opacity: 1; transition: opacity 0.18s ease, visibility 0s; }
	.sx-library .sx-grid > li,
	.sx-library .sx-shelf > li,
	.sx-library .sx-lib-label { transform: none !important; transition-delay: 0s !important; }
	.sx-icon, .sx-icon::before, .sx-app-dot { transition: opacity 0.18s ease; }
	.sx-ws-canvas.is-loading .sx-icon--xl { animation: none; }
	.sx-app:hover .sx-icon, .sx-app:active .sx-icon { transform: none !important; }
	.sx-shelf-item.is-nudged { animation: none; }
}

/* Dark theme hover tints — cold, not neutral grey (reads warm on graphite). */
html:not([data-theme="light"]) .sx-app:hover,
html:not([data-theme="light"]) .sx-shelf-item:hover { background: rgba(170, 178, 210, 0.07); }
html:not([data-theme="light"]) .sx-app.is-active:hover { background: var(--sx-cell-on); }

/* Openable shelf rows — Справочник in «Библиотека», SONYA Pipeline in
   «Для бизнеса»: same row as the library shelf, but a real link with a
   short line and a chevron. */
.sx-shelf .sx-app--row {
	flex-direction: row;
	align-items: center;
	gap: 14px;
	padding: 8px 12px 8px 8px;
	border-radius: 20px;
	text-decoration: none;
	cursor: pointer;
}
.sx-shelf .sx-shelf-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.sx-shelf .sx-shelf-desc { font-size: 12px; line-height: 1.3; color: var(--sx-dim) !important; }
.sx-shelf .sx-shelf-go { font-size: 11px; color: var(--sx-dim) !important; transition: transform 0.2s ease; }
.sx-shelf .sx-app--row:hover .sx-shelf-go { transform: translateX(2px); }
.sx-shelf .sx-app--row.is-active { background: var(--sx-cell-on); box-shadow: var(--sx-cell-on-shadow); }
.sx-shelf .sx-app-dot { display: none; }
