/* Design tokens — the single place the dashboard's look is defined. */
:root {
	--bg: #0a0a0a;
	--fg: #fafafa;
	--card: #171717;
	--mut: #262626;
	--mfg: #a1a1a1;
	--bd: rgba(255, 255, 255, 0.1);
	--pri: #5865f2;
	--ok: #3ecf8e;
	--warn: #f0b429;
	--crit: #d03b3b;
	--r: 10px;
	--sidebar: 256px;
	color-scheme: dark;
}

* {
	box-sizing: border-box;
}

body {
	margin: 0;
	background: var(--bg);
	color: var(--fg);
	font-family: 'Geist', system-ui, 'Segoe UI', sans-serif;
	font-size: 14px;
	-webkit-font-smoothing: antialiased;
}

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

button {
	font: inherit;
}

/* ---------- shell ---------- */

.app {
	display: flex;
	min-height: 100vh;
}

.sb {
	display: flex;
	flex-direction: column;
	width: var(--sidebar);
	flex-shrink: 0;
	background: var(--card);
	border-inline-end: 1px solid var(--bd);
	padding: 10px;
	position: sticky;
	top: 0;
	height: 100vh;
	overflow-y: auto;
}

.srv {
	display: flex;
	align-items: center;
	gap: 9px;
	padding: 6px 6px 12px;
	border-bottom: 1px solid var(--bd);
	margin-bottom: 8px;
}

.back {
	display: grid;
	place-items: center;
	width: 26px;
	height: 26px;
	border-radius: 7px;
	border: 1px solid var(--bd);
	background: transparent;
	color: var(--mfg);
	flex-shrink: 0;
	cursor: pointer;
}

.back:hover {
	color: var(--fg);
}

[dir='rtl'] .back svg {
	transform: scaleX(-1);
}

.sicon {
	width: 30px;
	height: 30px;
	border-radius: 9px;
	flex-shrink: 0;
	display: grid;
	place-items: center;
	font-size: 11px;
	font-weight: 600;
	background: var(--mut);
	color: var(--mfg);
	object-fit: cover;
}

.sname {
	font-size: 13.5px;
	font-weight: 600;
	line-height: 1.25;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.ssub {
	font-size: 11px;
	color: var(--mfg);
}

.nav {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 7px 8px;
	border-radius: 7px;
	color: var(--mfg);
	font-size: 13.5px;
	background: transparent;
	border: 0;
	width: 100%;
	text-align: start;
	cursor: pointer;
}

.nav:hover {
	color: var(--fg);
}

.nav.on {
	background: var(--mut);
	color: var(--fg);
	font-weight: 550;
}

.nav svg {
	flex-shrink: 0;
}

.cnt {
	margin-inline-start: auto;
	font-size: 11px;
	color: var(--mfg);
}

.divider {
	height: 1px;
	background: var(--bd);
	margin: 9px 8px;
}

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

.hdr {
	display: flex;
	align-items: center;
	gap: 10px;
	height: 56px;
	flex-shrink: 0;
	padding: 0 24px;
	border-bottom: 1px solid var(--bd);
	position: sticky;
	top: 0;
	background: var(--bg);
	z-index: 5;
}

.burger {
	display: none;
	background: transparent;
	border: 0;
	color: var(--mfg);
	cursor: pointer;
	padding: 0;
}

.crumb {
	font-size: 13px;
	font-weight: 550;
}

.search {
	display: flex;
	align-items: center;
	gap: 8px;
	width: 220px;
	margin-inline-start: auto;
	padding: 6px 10px;
	border: 1px solid var(--bd);
	border-radius: 8px;
	color: var(--mfg);
	font-size: 12.5px;
}

.search input {
	border: 0;
	background: transparent;
	color: var(--fg);
	font: inherit;
	font-size: 12.5px;
	width: 100%;
	outline: none;
	min-width: 0;
}

/* The language button sits immediately after the search box. */
.lang {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	height: 32px;
	padding: 0 10px;
	border: 1px solid var(--bd);
	border-radius: 8px;
	background: transparent;
	color: var(--mfg);
	font-size: 12px;
	font-weight: 600;
	cursor: pointer;
	flex-shrink: 0;
}

.lang:hover {
	color: var(--fg);
}

.av {
	width: 30px;
	height: 30px;
	border-radius: 50%;
	background: var(--mut);
	display: grid;
	place-items: center;
	font-size: 11px;
	font-weight: 600;
	color: var(--mfg);
	object-fit: cover;
	flex-shrink: 0;
}

.body {
	flex: 1;
	min-height: 0;
	padding: 22px 24px;
	display: flex;
	flex-direction: column;
	gap: 16px;
}

/* ---------- typography ---------- */

.ptitle {
	font-size: 20px;
	font-weight: 600;
	margin: 0;
}

.pdesc {
	margin: 3px 0 0;
	font-size: 13px;
	color: var(--mfg);
}

.phead {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 16px;
	flex-wrap: wrap;
}

/* ---------- cards ---------- */

.card {
	background: var(--card);
	border: 1px solid var(--bd);
	border-radius: var(--r);
}

.chead {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 13px 16px;
	border-bottom: 1px solid var(--bd);
}

.ctitle {
	font-size: 14px;
	font-weight: 600;
}

.cdesc {
	margin-top: 2px;
	font-size: 12.5px;
	color: var(--mfg);
}

.cbody {
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.grid {
	display: grid;
	gap: 14px;
}

.grid.g4 {
	grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid.g3 {
	grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid.g2 {
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stat {
	padding: 15px 16px;
}

.slab {
	display: flex;
	align-items: center;
	justify-content: space-between;
	font-size: 12.5px;
	color: var(--mfg);
}

.sval {
	margin-top: 8px;
	font-size: 24px;
	font-weight: 600;
	line-height: 1.05;
}

.sdelta {
	margin-top: 4px;
	font-size: 11.5px;
	color: var(--mfg);
}

/* ---------- controls ---------- */

.btn {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 6px 12px;
	border: 1px solid var(--bd);
	border-radius: 8px;
	background: transparent;
	color: var(--fg);
	font-size: 12.5px;
	font-weight: 550;
	cursor: pointer;
}

.btn:hover {
	background: var(--mut);
}

.btn.pri {
	background: var(--pri);
	border-color: var(--pri);
	color: #fff;
}

.btn.pri:hover {
	filter: brightness(1.08);
}

.btn.danger {
	color: var(--crit);
	border-color: rgba(208, 59, 59, 0.35);
}

.btn:disabled {
	opacity: 0.55;
	cursor: default;
}

.label {
	display: block;
	font-size: 12.5px;
	font-weight: 550;
	margin-bottom: 6px;
}

.input,
select.input,
textarea.input {
	width: 100%;
	padding: 8px 11px;
	border: 1px solid var(--bd);
	border-radius: 8px;
	background: var(--bg);
	color: var(--fg);
	font: inherit;
	font-size: 13px;
	outline: none;
}

.input:focus {
	border-color: var(--pri);
}

textarea.input {
	resize: vertical;
	min-height: 78px;
}

.help {
	margin-top: 6px;
	font-size: 11.5px;
	color: var(--mfg);
}

.field {
	min-width: 0;
}

.sw {
	width: 36px;
	height: 20px;
	border-radius: 999px;
	background: var(--mut);
	position: relative;
	flex-shrink: 0;
	border: 0;
	cursor: pointer;
	padding: 0;
}

.sw i {
	position: absolute;
	top: 2px;
	inset-inline-start: 2px;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: #6b6b6b;
	display: block;
	transition: inset-inline-start 0.12s ease;
}

.sw.on {
	background: var(--pri);
}

.sw.on i {
	inset-inline-start: 18px;
	background: #fff;
}

.srow {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 13px 16px;
	border-bottom: 1px solid var(--bd);
}

.srow:last-child {
	border-bottom: 0;
}

.srow-t {
	font-size: 13.5px;
	font-weight: 500;
}

.srow-d {
	font-size: 12px;
	color: var(--mfg);
	margin-top: 2px;
}

/* ---------- badges, pills, chips ---------- */

.badge {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 2px 8px;
	border: 1px solid var(--bd);
	border-radius: 999px;
	font-size: 11.5px;
	color: var(--mfg);
	white-space: nowrap;
}

.badge.ok {
	color: var(--ok);
	border-color: rgba(62, 207, 142, 0.3);
	background: rgba(62, 207, 142, 0.08);
}

.badge.warn {
	color: var(--warn);
	border-color: rgba(240, 180, 41, 0.3);
	background: rgba(240, 180, 41, 0.08);
}

.cat {
	display: inline-flex;
	align-items: center;
	padding: 2px 8px;
	border-radius: 6px;
	background: var(--mut);
	font-size: 11.5px;
	color: #c9c9c9;
}

.chips {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 3px 8px;
	border: 1px solid var(--bd);
	border-radius: 999px;
	background: var(--bg);
	font-size: 12px;
	color: var(--fg);
}

.chip button {
	border: 0;
	background: transparent;
	color: var(--mfg);
	cursor: pointer;
	padding: 0;
	line-height: 1;
	font-size: 14px;
}

.chip button:hover {
	color: var(--crit);
}

/* ---------- tables ---------- */

.twrap {
	overflow-x: auto;
}

.thead,
.trow {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 10px 16px;
	min-width: 720px;
}

.thead {
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--mfg);
	border-bottom: 1px solid var(--bd);
}

.trow {
	border-bottom: 1px solid var(--bd);
	cursor: pointer;
	background: transparent;
	border-inline: 0;
	border-top: 0;
	color: inherit;
	text-align: start;
	width: 100%;
	font: inherit;
}

.trow:last-child {
	border-bottom: 0;
}

.trow:hover {
	background: rgba(255, 255, 255, 0.025);
}

.trow.off {
	opacity: 0.55;
}

.cmd {
	font-family: ui-monospace, Menlo, Consolas, monospace;
	font-size: 13px;
	font-weight: 500;
}

.tick {
	display: grid;
	place-items: center;
	width: 20px;
	height: 20px;
	border-radius: 5px;
	margin: 0 auto;
}

.tick.y {
	background: rgba(88, 101, 242, 0.16);
	color: #a3adf5;
}

.tick.n {
	color: #4d4d4d;
}

.rest {
	font-size: 12px;
	color: var(--mfg);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* ---------- filters ---------- */

.filters {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
}

.filter {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 7px 11px;
	border: 1px solid var(--bd);
	border-radius: 8px;
	color: var(--mfg);
	font-size: 12.5px;
	background: var(--card);
}

.filter select,
.filter input {
	border: 0;
	background: transparent;
	color: var(--fg);
	font: inherit;
	font-size: 12.5px;
	outline: none;
}

/* ---------- tabs ---------- */

.tabs {
	display: flex;
	gap: 2px;
	border-bottom: 1px solid var(--bd);
	overflow-x: auto;
	/* Each tab overhangs the border by 1px, which made a vertical scrollbar
	   appear beside the tabs wherever scrollbars take up space. */
	scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
	display: none;
}

.tab {
	padding: 8px 12px;
	font-size: 13px;
	color: var(--mfg);
	border: 0;
	border-bottom: 2px solid transparent;
	background: transparent;
	margin-bottom: -1px;
	cursor: pointer;
	white-space: nowrap;
}

.tab.on {
	color: var(--fg);
	font-weight: 550;
	border-bottom-color: var(--pri);
}

/* ---------- card editor ---------- */

.ed {
	display: grid;
	grid-template-columns: 200px minmax(0, 1fr) 260px;
	min-height: 420px;
	background: var(--card);
	border: 1px solid var(--bd);
	border-radius: var(--r);
	overflow: hidden;
}

/* Card off — the bot sends a plain embed, so there is nothing to design. */
.ed.off,
/* A section something else is driving: readable, but not yours to edit now. */
.inert {
	opacity: 0.4;
	pointer-events: none;
}

.edbar {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
}

/* A tab that hosts several stacked sections of its own. */
.stackcol {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

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

.pane.props {
	overflow: auto;
}

.llist {
	padding: 4px 0;
	overflow: auto;
}

.ladd {
	display: flex;
	gap: 6px;
	margin-top: auto;
	padding: 10px;
	border-top: 1px solid var(--bd);
}

.ptit {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 11px 12px;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: var(--mfg);
	border-bottom: 1px solid var(--bd);
}

.layer {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 7px 9px;
	margin: 2px 6px;
	border-radius: 7px;
	font-size: 12.5px;
	color: #d4d4d4;
	background: transparent;
	border: 0;
	width: calc(100% - 12px);
	text-align: start;
	cursor: pointer;
}

.layer:hover {
	background: var(--mut);
}

.layer.on {
	background: rgba(88, 101, 242, 0.16);
	color: var(--fg);
	box-shadow: inset 0 0 0 1px rgba(88, 101, 242, 0.5);
}

.layer .lt {
	flex: 1;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.stage {
	display: flex;
	flex-direction: column;
	min-width: 0;
	border-inline: 1px solid var(--bd);
	background: var(--bg);
}

/*
 * Flex, not grid: a grid track sizes to the child's max-content, which for a
 * 1024px card made the whole editor wider than the screen.
 */
.cw {
	flex: 1;
	min-width: 0;
	min-height: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 18px;
	background-image: radial-gradient(rgba(255, 255, 255, 0.055) 1px, transparent 1px);
	background-size: 14px 14px;
	overflow: hidden;
}

/*
 * The preview is a real PNG; handles sit on top of it. It always fills the
 * column, capped per card at that card's own pixel size so it fits at any
 * width and never upscales past native.
 */
.canvas-wrap {
	position: relative;
	line-height: 0;
	touch-action: none;
	width: 100%;
}

.canvas-wrap canvas {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 10px;
}

/*
 * The selection layer sits over the canvas rather than being drawn into it, so
 * the preview stays exactly the picture the bot would send - no handles baked
 * into the pixels. It ignores the pointer; only the boxes and grips take it.
 */
.coverlay {
	position: absolute;
	inset: 0;
	pointer-events: none;
}

.cbox {
	position: absolute;
	border: 1.5px dashed rgba(255, 255, 255, 0.45);
	border-radius: 4px;
	cursor: grab;
	pointer-events: auto;
	/* Without this a touch drag scrolls the page instead of moving the layer. */
	touch-action: none;
}

/*
 * The grab area is larger than the outline it draws. A small text layer on a
 * phone can be a few pixels tall, which is not something a finger can catch.
 */
.cbox::after {
	content: '';
	position: absolute;
	inset: -8px;
}

.cbox.on {
	border: 1.5px solid var(--pri);
	background: rgba(88, 101, 242, 0.1);
	/* Selected wins where the enlarged grab areas overlap. */
	z-index: 2;
}

.cgrip {
	position: absolute;
	width: 11px;
	height: 11px;
	margin: -6px;
	border-radius: 3px;
	background: var(--pri);
	border: 1.5px solid #fff;
	pointer-events: auto;
	touch-action: none;
	z-index: 3;
}

.cgrip::after {
	content: '';
	position: absolute;
	inset: -9px;
}

.g-nw { left: 0; top: 0; cursor: nwse-resize; }
.g-n { left: 50%; top: 0; cursor: ns-resize; }
.g-ne { left: 100%; top: 0; cursor: nesw-resize; }
.g-e { left: 100%; top: 50%; cursor: ew-resize; }
.g-se { left: 100%; top: 100%; cursor: nwse-resize; }
.g-s { left: 50%; top: 100%; cursor: ns-resize; }
.g-sw { left: 0; top: 100%; cursor: nesw-resize; }
.g-w { left: 0; top: 50%; cursor: ew-resize; }

@media (pointer: coarse) {
	.cbox::after {
		inset: -14px;
	}

	.cgrip {
		width: 15px;
		height: 15px;
		margin: -8px;
	}

	.cgrip::after {
		inset: -12px;
	}
}

.note.bad {
	border-color: rgba(237, 66, 69, 0.4);
	color: #f3b0b2;
}

.varbar {
	display: flex;
	align-items: center;
	gap: 7px;
	flex-wrap: wrap;
	padding: 9px 12px;
	border-top: 1px solid var(--bd);
	font-size: 11.5px;
	color: var(--mfg);
}

.mono-chip {
	padding: 2px 7px;
	border-radius: 5px;
	background: var(--mut);
	color: #c9c9c9;
	font-size: 11.5px;
	font-family: ui-monospace, Menlo, Consolas, monospace;
}

.grp {
	padding: 12px;
	border-bottom: 1px solid var(--bd);
}

.glab {
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: var(--mfg);
	margin-bottom: 9px;
}

.prow {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 8px;
}

.prow:last-child {
	margin-bottom: 0;
}

.prow .k {
	width: 62px;
	flex-shrink: 0;
	font-size: 11px;
}

/*
 * Narrow: the three columns become one. The preview goes first — it is what
 * you drag — with the properties under it and the layer list last.
 */
@media (max-width: 1100px) {
	.ed {
		grid-template-columns: minmax(0, 1fr);
	}

	.stage {
		order: 1;
		border-inline: 0;
		border-block: 1px solid var(--bd);
	}

	.pane.props {
		order: 2;
		overflow: visible;
	}

	.pane.layers {
		order: 3;
	}

	.llist {
		overflow: visible;
	}

	.ladd {
		margin-top: 0;
	}
}

@media (max-width: 640px) {
	.ed {
		min-height: 0;
	}

	.cw {
		padding: 10px;
	}

	.prow {
		flex-wrap: wrap;
	}

	.prow .k {
		width: 100%;
	}
}

/* ---------- drawer ---------- */

.scrim {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.55);
	z-index: 20;
}

.drawer {
	position: fixed;
	top: 0;
	inset-inline-end: 0;
	height: 100vh;
	width: 420px;
	max-width: 100vw;
	background: var(--card);
	border-inline-start: 1px solid var(--bd);
	z-index: 21;
	display: flex;
	flex-direction: column;
	overflow-y: auto;
}

/* ---------- sign in / chooser ---------- */

.centre {
	display: grid;
	place-items: center;
	min-height: 100vh;
	padding: 24px;
}

.stack {
	display: flex;
	flex-direction: column;
	gap: 18px;
	width: 380px;
	max-width: 100%;
}

.blogo {
	width: 34px;
	height: 34px;
	border-radius: 9px;
	background: var(--pri);
	color: #fff;
	display: grid;
	place-items: center;
	font-size: 12px;
	font-weight: 600;
	flex-shrink: 0;
}

.wrap {
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: 56px 24px;
}

.inner {
	width: 840px;
	max-width: 100%;
}

.pick {
	display: flex;
	align-items: center;
	gap: 12px;
	background: var(--card);
	border: 1px solid var(--bd);
	border-radius: var(--r);
	padding: 14px;
	cursor: pointer;
	text-align: start;
	width: 100%;
	color: inherit;
}

.pick:hover {
	border-color: var(--pri);
}

.note {
	display: flex;
	align-items: center;
	gap: 9px;
	margin-top: 22px;
	padding: 12px 14px;
	border: 1px dashed var(--bd);
	border-radius: var(--r);
	color: var(--mfg);
	font-size: 12.5px;
}

/* ---------- misc ---------- */

.empty {
	display: grid;
	place-items: center;
	gap: 6px;
	padding: 48px 16px;
	color: var(--mfg);
	text-align: center;
}

.toast {
	position: fixed;
	inset-block-end: 20px;
	inset-inline-end: 20px;
	padding: 10px 14px;
	border-radius: 9px;
	background: var(--mut);
	border: 1px solid var(--bd);
	font-size: 13px;
	z-index: 40;
}

.toast.bad {
	border-color: rgba(208, 59, 59, 0.45);
	color: #ffb4b4;
}

.skel {
	background: linear-gradient(90deg, var(--mut), #2f2f2f, var(--mut));
	border-radius: 6px;
	animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
	50% {
		opacity: 0.55;
	}
}

.muted {
	color: var(--mfg);
}

.rowend {
	display: flex;
	justify-content: flex-end;
}

/* ---------- responsive ---------- */

@media (max-width: 1100px) {
	.grid.g4 {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 900px) {
	.sb {
		position: fixed;
		inset-inline-start: 0;
		top: 0;
		z-index: 30;
		transform: translateX(-100%);
		transition: transform 0.18s ease;
	}

	[dir='rtl'] .sb {
		transform: translateX(100%);
	}

	.sb.open {
		transform: translateX(0);
	}

	.burger {
		display: grid;
	}

	.search {
		width: auto;
		flex: 1;
	}

	.grid.g2,
	.grid.g3,
	.grid.g4 {
		grid-template-columns: minmax(0, 1fr);
	}

	.body,
	.hdr {
		padding-inline: 16px;
	}
}

/* ---------- motion ----------
 *
 * Kept short and small: this is feedback, not decoration. Everything below is
 * switched off wholesale for anyone who has asked their system for less motion.
 */

:root {
	--ease: cubic-bezier(0.2, 0.7, 0.3, 1);
	--fast: 0.12s;
	--med: 0.2s;
}

.btn,
.nav,
.tab,
.card,
.pick,
.layer,
.sw,
.chip button,
.cbox,
.cgrip {
	transition:
		background var(--fast) var(--ease),
		border-color var(--fast) var(--ease),
		color var(--fast) var(--ease),
		transform var(--fast) var(--ease),
		box-shadow var(--med) var(--ease);
}

/* A press should feel like one. */
.btn:active:not(:disabled),
.pick:active,
.nav:active,
.tab:active {
	transform: scale(0.97);
}

.card:hover {
	border-color: var(--bd2, var(--bd));
}

.pick:hover {
	transform: translateY(-1px);
}

/* The page itself, on every navigation. */
.body.nav-in {
	animation: page-in 0.22s var(--ease) both;
}

@keyframes page-in {
	from {
		opacity: 0;
		transform: translateY(6px);
	}
}

/* Going back to the server list, or out of a panel, reads as going up a level. */
.back:active {
	transform: translateX(-2px);
}

[dir='rtl'] .back:active {
	transform: translateX(2px);
}

.toast {
	animation: toast-in 0.22s var(--ease) both;
}

@keyframes toast-in {
	from {
		opacity: 0;
		transform: translateY(8px);
	}
}

/* Cards and rows arriving in a freshly drawn page, gently staggered. */
.body.nav-in .card {
	animation: card-in 0.26s var(--ease) both;
}

.body.nav-in .card:nth-child(2) {
	animation-delay: 0.03s;
}

.body.nav-in .card:nth-child(3) {
	animation-delay: 0.06s;
}

.body.nav-in .card:nth-child(4) {
	animation-delay: 0.09s;
}

@keyframes card-in {
	from {
		opacity: 0;
		transform: translateY(8px);
	}
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.001ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.001ms !important;
		scroll-behavior: auto !important;
	}
}

/* ---------- sliding cards ---------- */

.slides {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.slide {
	transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.slide-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 14px;
	padding: 15px 16px;
	border-radius: var(--r);
	user-select: none;
}

.slide-head[role='button'] {
	cursor: pointer;
}

.slide-head[role='button']:hover {
	background: rgba(255, 255, 255, 0.025);
}

.slide-t {
	min-width: 0;
}

.slide-r {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-shrink: 0;
	min-width: 0;
}

.slide-sum {
	max-width: 240px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-size: 12px;
	color: var(--mfg);
}

.chev {
	display: inline-flex;
	color: var(--mfg);
	transition: transform 0.28s ease;
}

.slide.open {
	border-color: color-mix(in srgb, var(--pri) 55%, var(--bd));
	box-shadow: 0 10px 34px rgba(0, 0, 0, 0.4);
}

.slide.open .chev {
	transform: rotate(180deg);
	color: var(--fg);
}

.slide.open .slide-head {
	border-bottom: 1px solid var(--bd);
	border-radius: var(--r) var(--r) 0 0;
}

/* Animating the row height from 0fr to 1fr is what lets the card grow to
   exactly its content without knowing how tall that is. */
.slide-body {
	display: grid;
	grid-template-rows: 0fr;
	transition: grid-template-rows 0.3s ease;
}

.slide.open .slide-body {
	grid-template-rows: 1fr;
}

.slide-inner {
	min-height: 0;
	overflow: hidden;
	visibility: hidden;
	transition: visibility 0s linear 0.3s;
}

.slide.open .slide-inner {
	visibility: visible;
	transition-delay: 0s;
}

.slide-pad {
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.rows {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.rowline {
	display: flex;
	align-items: center;
	gap: 8px;
}

.rowline .input {
	flex: 1;
	min-width: 0;
}

.rowline input[type='number'] {
	flex: 0 0 96px;
}

@media (max-width: 640px) {
	.slide-sum {
		display: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.slide-body,
	.chev,
	.slide {
		transition: none;
	}
}

/* ---------- levels ---------- */

.lvgroup {
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding: 14px;
	border: 1px solid var(--bd);
	border-radius: var(--r);
	background: rgba(255, 255, 255, 0.015);
}

.lvgroup-t {
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	color: var(--mfg);
}

/* What a member will read, so it is set apart from the box it is typed in. */
.lvprev {
	padding: 9px 12px;
	border-inline-start: 3px solid var(--ok);
	border-radius: 4px;
	background: var(--mut);
	font-size: 13px;
	white-space: pre-wrap;
	word-break: break-word;
}

/* ---------- bot sender ---------- */

.sd {
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.sd-actions {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

.seg {
	display: inline-flex;
	border: 1px solid var(--bd);
	border-radius: 8px;
	overflow: hidden;
	align-self: flex-start;
}

.seg button {
	padding: 7px 12px;
	border: 0;
	background: transparent;
	color: var(--mfg);
	font: inherit;
	font-size: 13px;
	cursor: pointer;
}

.seg button.on {
	background: var(--pri);
	color: #fff;
}

.seg button:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

/* The preview is drawn in Discord's own dark palette on purpose: it should look
   like what will be posted, whatever the dashboard theme is. */
.dm {
	display: flex;
	gap: 14px;
	padding: 18px;
	background: #313338;
	border: 1px solid var(--bd);
	border-radius: var(--r);
	color: #dbdee1;
}

.dm-av {
	flex: 0 0 40px;
	width: 40px;
	height: 40px;
	display: grid;
	place-items: center;
	border-radius: 50%;
	background: var(--pri);
	color: #fff;
	font-weight: 700;
}

.dm-main {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.dm-head {
	display: flex;
	align-items: center;
	gap: 8px;
}

.dm-name {
	font-weight: 600;
	color: #f2f3f5;
}

.dm-tag {
	padding: 1px 5px;
	border-radius: 4px;
	background: #5865f2;
	color: #fff;
	font-size: 10px;
	font-weight: 600;
}

.dm-time {
	font-size: 11px;
	color: #949ba4;
}

/* Every piece of text is an input that looks like text until you touch it. */
.dm-in {
	width: 100%;
	padding: 4px 6px;
	border: 1px solid transparent;
	border-radius: 4px;
	outline: none;
	background: transparent;
	color: inherit;
	font: inherit;
}

.dm-in:hover {
	border-color: rgba(255, 255, 255, 0.14);
}

.dm-in:focus {
	border-color: var(--pri);
	background: rgba(0, 0, 0, 0.2);
}

.dm-in::placeholder {
	color: #80848e;
}

.dm-area {
	min-height: 28px;
	overflow: hidden;
	resize: none;
	line-height: 1.4;
}

.dm-content {
	font-size: 15px;
}

.dm-in.title {
	font-size: 16px;
	font-weight: 600;
	color: #00a8fc;
}

.dm-in.sm {
	font-size: 13px;
}

.dm-embed,
.dm-container {
	position: relative;
	display: flex;
	max-width: 620px;
	overflow: hidden;
	border: 1px solid rgba(255, 255, 255, 0.06);
	border-radius: 4px;
	background: #2b2d31;
}

.dm-bar {
	position: relative;
	flex: 0 0 10px;
	background: var(--bar, #4e5058);
	cursor: pointer;
}

.dm-bar input {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	opacity: 0;
	cursor: pointer;
}

.dm-embed-main,
.dm-container-main {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 8px 12px 12px;
}

.dm-embed-top {
	display: flex;
	justify-content: flex-end;
}

.dm-ctls {
	display: inline-flex;
	gap: 4px;
	opacity: 0.5;
	transition: opacity 0.15s;
}

.dm-embed:hover .dm-ctls,
.dm-block:hover > .dm-block-h .dm-ctls,
.dm-ctls:focus-within {
	opacity: 1;
}

.dm-ctl {
	width: 24px;
	height: 24px;
	padding: 0;
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 4px;
	background: #1e1f22;
	color: #b5bac1;
	font-size: 12px;
	line-height: 1;
	cursor: pointer;
}

.dm-ctl:hover {
	color: #fff;
	background: #3a3c42;
}

.dm-author {
	display: flex;
	align-items: center;
	gap: 6px;
}

.dm-author img {
	width: 22px;
	height: 22px;
	border-radius: 50%;
	object-fit: cover;
}

.dm-thumb {
	align-self: flex-start;
	width: 64px;
	height: 64px;
	border-radius: 4px;
	object-fit: cover;
}

.dm-fields {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 8px;
}

.dm-field {
	grid-column: span 3;
	display: flex;
	flex-direction: column;
	gap: 2px;
	padding: 4px;
	border-radius: 4px;
}

.dm-field.inline {
	grid-column: span 1;
}

.dm-field-top {
	display: flex;
	align-items: center;
	gap: 4px;
}

.dm-in.fname {
	font-size: 13px;
	font-weight: 600;
}

.dm-footer {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
}

.dm-footer .dm-in {
	flex: 1;
	min-width: 140px;
	width: auto;
}

.dm-add {
	align-self: flex-start;
	padding: 4px 10px;
	border: 1px dashed rgba(255, 255, 255, 0.2);
	border-radius: 6px;
	background: transparent;
	color: #b5bac1;
	font: inherit;
	font-size: 12.5px;
	cursor: pointer;
}

.dm-add:hover:not(:disabled) {
	color: #fff;
	border-color: rgba(255, 255, 255, 0.4);
}

.dm-add:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

.dm-check {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 12.5px;
	color: #b5bac1;
}

.dm-check .input {
	width: auto;
	padding: 3px 6px;
}

.dm-slot {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.dm-slot-img {
	max-width: 100%;
	max-height: 260px;
	align-self: flex-start;
	border-radius: 4px;
	object-fit: contain;
}

.dm-slot-row {
	display: flex;
	align-items: center;
	gap: 6px;
}

.dm-slot-row .btn {
	padding: 3px 10px;
	font-size: 12px;
}

.dm-more {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding-top: 8px;
	border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.dm-files {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
}

.dm-file {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 4px 6px;
	border-radius: 6px;
	background: #2b2d31;
	font-size: 12px;
}

.dm-file img {
	width: 36px;
	height: 36px;
	border-radius: 4px;
	object-fit: cover;
}

.dm-buttons {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.dm-brow {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
}

.dm-btn {
	display: inline-flex;
	align-items: center;
	gap: 2px;
	padding: 2px 6px;
	border-radius: 4px;
	background: #4e5058;
}

.dm-in.be {
	width: 34px;
	text-align: center;
}

.dm-in.bl {
	width: 110px;
}

.dm-in.bu {
	width: 170px;
	font-size: 12px;
}

/* Components V2 */

.dm-block {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 8px 10px;
	border: 1px dashed rgba(255, 255, 255, 0.14);
	border-radius: 6px;
	background: rgba(0, 0, 0, 0.12);
}

.dm-block-h {
	display: flex;
	align-items: center;
	justify-content: space-between;
	font-size: 11px;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: #949ba4;
}

.dm-container {
	max-width: none;
}

.dm-inline {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 14px;
}

.dm-item {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	align-items: start;
	gap: 6px 8px;
}

/* The picture and its remove button share the first row; the description sits under both. */
.dm-item > .dm-in {
	grid-column: 1 / -1;
}

.dm-accessory {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.dm-menu {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.dm-menu .btn {
	padding: 4px 10px;
	font-size: 12.5px;
}

@media (max-width: 640px) {
	.dm {
		padding: 12px;
	}

	.dm-av {
		display: none;
	}
}

/* ---------- unsaved changes bar ---------- */

.unsaved {
	position: fixed;
	inset-inline: 0;
	bottom: 16px;
	z-index: 40;
	width: min(560px, calc(100vw - 32px));
	margin-inline: auto;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 10px 12px 10px 16px;
	border: 1px solid color-mix(in srgb, var(--warn) 55%, var(--bd));
	border-radius: var(--r);
	background: var(--card);
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
	font-size: 13px;
	animation: unsaved-in 0.25s ease;
}

.unsaved > div {
	display: flex;
	gap: 8px;
}

.unsaved.shake {
	animation: unsaved-shake 0.4s ease;
	border-color: var(--warn);
}

@keyframes unsaved-in {
	from {
		transform: translateY(24px);
		opacity: 0;
	}
}

@keyframes unsaved-shake {
	20%, 60% {
		transform: translateX(-7px);
	}
	40%, 80% {
		transform: translateX(7px);
	}
}

@media (prefers-reduced-motion: reduce) {
	.unsaved,
	.unsaved.shake {
		animation: none;
	}
}

/* ---------- temp voice ---------- */

.rowname {
	flex: 0 0 110px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-size: 13px;
	font-weight: 550;
}

.rowline input[type='checkbox'] {
	flex: 0 0 auto;
	width: 16px;
	height: 16px;
}

.tvp-title {
	font-size: 16px;
	font-weight: 600;
}

.tvp-desc {
	font-size: 13.5px;
	white-space: pre-wrap;
	word-break: break-word;
}

.tvp-foot {
	font-size: 12px;
	color: #b5bac1;
}

/* A colour input styled as a plain text box collapses to a line. */
input[type='color'].input {
	height: 38px;
	padding: 3px;
	cursor: pointer;
}
