/* iOS building blocks: grouped lists, buttons, fields, segmented controls, switches, sheets,
   alerts, toasts, banners and the loading, empty and error states. */

/* ---- grouped lists ----------------------------------------------------------------------- */

.section {
	margin-top: var(--section-gap);
}
.screen-body > .section:first-child {
	margin-top: 8px;
}
.section-header {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	margin: 0 var(--row-inset) 7px;
	color: var(--muted);
	font-size: var(--text-footnote);
	font-weight: 400;
	text-transform: uppercase;
	letter-spacing: 0.02em;
}
.section-header button {
	color: var(--accent);
	text-transform: none;
	font-size: var(--text-footnote);
	font-weight: 600;
	min-height: 28px;
	letter-spacing: 0;
}
.section-footer {
	margin: 7px var(--row-inset) 0;
	color: var(--muted);
	font-size: var(--text-footnote);
	line-height: var(--leading-foot);
}
.group {
	margin: 0;
	padding: 0;
	list-style: none;
	border-radius: var(--group-radius);
	background: var(--card);
	overflow: hidden;
	box-shadow: var(--shadow-card);
}
.group:empty {
	display: none;
}
.row {
	position: relative;
	display: grid;
	grid-template-columns: auto minmax(0, 1fr) auto;
	align-items: center;
	column-gap: 12px;
	width: 100%;
	min-height: var(--row-height);
	padding: 9px var(--row-inset);
	background: transparent;
	color: var(--text);
	text-align: start;
	font-size: var(--text-body);
	overflow-wrap: anywhere;
}
.row-plain {
	grid-template-columns: minmax(0, 1fr) auto;
}
.row + .row::before,
.group > li + li > .row::before,
.group > li + li > .swipe > .row::before {
	position: absolute;
	top: 0;
	right: 0;
	left: var(--sep-inset, calc(var(--row-inset) + var(--icon-slot) + 12px));
	border-top: 0.5px solid var(--line);
	content: "";
}
.row-plain + .row::before,
.group[data-plain] .row::before {
	--sep-inset: var(--row-inset);
}
.group[data-plain] .row {
	--sep-inset: var(--row-inset);
}
button.row,
a.row,
label.row {
	cursor: pointer;
}
button.row:active,
a.row:active,
.row[data-pressable]:active {
	background: var(--press);
}
@media (hover: hover) and (pointer: fine) {
	button.row:hover,
	a.row:hover {
		background: var(--press);
		text-decoration: none;
	}
}
.row:focus-visible {
	outline-offset: -3px;
	border-radius: var(--group-radius);
}
.row-icon {
	display: grid;
	place-items: center;
	width: var(--icon-slot);
	height: var(--icon-slot);
	border-radius: 8px;
	background: var(--tone, var(--system-blue));
	color: #fff;
}
.row-icon .icon {
	width: 19px;
	height: 19px;
	stroke-width: 2;
}
.row-icon[data-soft] {
	background: var(--soft);
	color: var(--accent);
}
.row-body {
	min-width: 0;
	display: grid;
	gap: 1px;
}
.row-title {
	font-size: var(--text-body);
	line-height: var(--leading-body);
}
.row-title strong {
	font-weight: 600;
}
.row-subtitle {
	color: var(--muted);
	font-size: var(--text-subheadline);
	line-height: var(--leading-sub);
}
.row-subtitle.clamp,
.row-title.clamp {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	overflow: hidden;
}
.row-subtitle.clamp-3 {
	-webkit-line-clamp: 3;
}
.row-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 10px;
	margin-top: 3px;
	color: var(--muted);
	font-size: var(--text-footnote);
}
.row-end {
	display: flex;
	align-items: center;
	gap: 8px;
	color: var(--muted);
	font-size: var(--text-subheadline);
	justify-self: end;
}
.row-value {
	max-width: 46vw;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	color: var(--muted);
}
.row-end .icon.chev {
	width: 15px;
	height: 15px;
	stroke-width: 2.4;
	color: var(--faint);
}
.row-destructive .row-title {
	color: var(--danger);
}
.row-accent .row-title {
	color: var(--accent);
}
.row-center {
	grid-template-columns: 1fr;
	justify-items: center;
	text-align: center;
}

/* Swipe-to-reveal actions on list rows (phones). */
.swipe {
	position: relative;
	overflow: hidden;
	touch-action: pan-y;
}
.swipe > .row {
	background: var(--card);
	transition: transform var(--fast) var(--ease);
	will-change: transform;
}
.swipe[data-dragging] > .row {
	transition: none;
}
.swipe:not([data-active]) .swipe-action {
	visibility: hidden;
}
.swipe-action {
	position: absolute;
	inset: 0 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: flex-end;
	min-width: 88px;
	padding: 0 20px;
	background: var(--system-red);
	color: #fff;
	font-weight: 600;
	font-size: var(--text-subheadline);
}

/* ---- chips, pills, status ---------------------------------------------------------------- */

.chips {
	display: flex;
	gap: 8px;
	margin: 0 calc(-1 * var(--page-inset));
	padding: 2px var(--page-inset) 10px;
	overflow-x: auto;
	scrollbar-width: none;
}
.chips::-webkit-scrollbar {
	display: none;
}
@media (min-width: 960px) {
	.chips {
		flex-wrap: wrap;
		overflow: visible;
		margin-inline: 0;
		padding-inline: 0;
	}
}
.chip {
	flex-shrink: 0;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-height: 34px;
	padding: 0 14px;
	border-radius: 17px;
	background: var(--card);
	box-shadow: inset 0 0 0 0.5px var(--line);
	color: var(--text);
	font-size: var(--text-subheadline);
	font-weight: 500;
	white-space: nowrap;
	transition: background var(--fast), color var(--fast);
}
.chip[aria-pressed="true"] {
	background: var(--text);
	color: var(--bg);
	box-shadow: none;
}
.chip .icon {
	width: 16px;
	height: 16px;
}
.pill {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	min-height: 22px;
	padding: 0 8px;
	border-radius: 11px;
	background: var(--soft);
	color: var(--muted);
	font-size: var(--text-caption);
	font-weight: 600;
	white-space: nowrap;
}
.pill[data-tone="green"] {
	background: var(--success-fill);
	color: var(--success);
}
.pill[data-tone="red"] {
	background: var(--danger-fill);
	color: var(--danger);
}
.pill[data-tone="orange"] {
	background: var(--warning-fill);
	color: var(--warning);
}
.pill[data-tone="blue"] {
	background: var(--tint-fill);
	color: var(--accent);
}
.status-dot {
	display: inline-block;
	width: 9px;
	height: 9px;
	border-radius: 50%;
	background: var(--system-gray);
	flex-shrink: 0;
}
.status-dot[data-tone="green"] {
	background: var(--system-green);
}
.status-dot[data-tone="orange"] {
	background: var(--system-orange);
}
.status-dot[data-tone="red"] {
	background: var(--system-red);
}
.status-dot[data-tone="blue"] {
	background: var(--system-blue);
}

/* ---- buttons ----------------------------------------------------------------------------- */

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 50px;
	padding: 0 22px;
	border-radius: 25px;
	background: var(--fill);
	color: var(--on-accent);
	font-size: var(--text-body);
	font-weight: 600;
	text-align: center;
	transition: transform var(--fast) var(--ease), background var(--fast), opacity var(--fast);
}
.btn:active:not(:disabled) {
	transform: scale(0.97);
}
@media (hover: hover) and (pointer: fine) {
	.btn:hover:not(:disabled) {
		background: var(--fill-strong);
	}
	.btn-tinted:hover:not(:disabled),
	.btn-gray:hover:not(:disabled) {
		background: var(--soft-strong);
	}
	.btn-plain:hover:not(:disabled) {
		background: var(--press);
	}
	.btn-danger:hover:not(:disabled) {
		background: color-mix(in srgb, var(--danger-fill) 80%, var(--danger));
	}
}
.btn:disabled {
	opacity: 0.4;
}
.btn .icon {
	width: 20px;
	height: 20px;
	stroke-width: 2;
}
.btn-block {
	width: 100%;
}
.btn-small {
	min-height: 36px;
	padding: 0 14px;
	border-radius: 18px;
	font-size: var(--text-subheadline);
}
.btn-tinted {
	background: var(--tint-fill);
	color: var(--accent);
}
.btn-gray {
	background: var(--soft);
	color: var(--text);
}
.btn-plain {
	background: transparent;
	color: var(--accent);
}
/* Destructive actions are tinted, not white-on-red: the solid variant fails contrast in dark. */
.btn-danger {
	background: var(--danger-fill);
	color: var(--danger);
}
.btn-success {
	background: var(--success-fill);
	color: var(--success);
}
.btn-row {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}
.btn-row > .btn {
	flex: 1 1 140px;
}
.btn[data-busy] {
	pointer-events: none;
}
.btn[data-busy] > :not(.spinner) {
	opacity: 0;
}
.btn[data-busy] {
	position: relative;
}
.btn[data-busy] > .spinner {
	position: absolute;
}
.icon-btn {
	display: inline-grid;
	place-items: center;
	width: var(--touch);
	height: var(--touch);
	border-radius: 50%;
	color: var(--accent);
	transition: background var(--fast), transform var(--fast) var(--ease);
}
.icon-btn:active {
	transform: scale(0.9);
}
@media (hover: hover) and (pointer: fine) {
	.icon-btn:hover {
		background: var(--press);
	}
}
.link-btn {
	color: var(--accent);
	font-weight: 600;
	min-height: var(--touch);
	padding: 0 4px;
}
.spinner {
	width: 20px;
	height: 20px;
	border-radius: 50%;
	border: 2.25px solid currentColor;
	border-right-color: transparent;
	animation: spin 0.8s linear infinite;
	opacity: 0.8;
}
@keyframes spin {
	to {
		transform: rotate(360deg);
	}
}

/* ---- fields ------------------------------------------------------------------------------ */

.field {
	display: grid;
	gap: 6px;
}
.field + .field {
	margin-top: 14px;
}
.field > label,
.field-label {
	margin: 0 4px;
	color: var(--muted);
	font-size: var(--text-footnote);
	font-weight: 500;
}
.input,
.textarea,
.select {
	width: 100%;
	min-height: 48px;
	padding: 12px 14px;
	border: 0;
	border-radius: var(--control-radius);
	background: var(--card);
	box-shadow: inset 0 0 0 0.5px var(--line);
	color: var(--text);
	font-size: var(--text-body);
	line-height: var(--leading-body);
	transition: box-shadow var(--fast);
	-webkit-appearance: none;
	appearance: none;
}
.sheet .input,
.sheet .textarea,
.sheet .select {
	background: var(--card);
}
.input::placeholder,
.textarea::placeholder {
	color: var(--faint);
}
.input:focus-visible,
.textarea:focus-visible,
.select:focus-visible {
	outline: none;
	box-shadow: inset 0 0 0 2px var(--system-blue);
}
.input[aria-invalid="true"],
.textarea[aria-invalid="true"] {
	box-shadow: inset 0 0 0 2px var(--system-red);
}
.textarea {
	min-height: 110px;
	resize: vertical;
}
.select {
	padding-right: 38px;
	background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
	background-position: calc(100% - 20px) 52%, calc(100% - 15px) 52%;
	background-size: 5px 5px;
	background-repeat: no-repeat;
}
.field-hint {
	margin: 0 4px;
	color: var(--muted);
	font-size: var(--text-footnote);
	line-height: var(--leading-foot);
}
.field-error {
	margin: 0 4px;
	color: var(--danger);
	font-size: var(--text-footnote);
	font-weight: 500;
}
.field-error:empty {
	display: none;
}
.input-wrap {
	position: relative;
	display: flex;
	align-items: center;
}
.input-wrap .input {
	padding-right: 50px;
}
.input-wrap .icon-btn {
	position: absolute;
	right: 2px;
	color: var(--muted);
}

/* iOS search field. */
.search {
	position: relative;
	display: flex;
	align-items: center;
	margin-bottom: 12px;
}
.search > .icon {
	position: absolute;
	left: 10px;
	width: 18px;
	height: 18px;
	color: var(--muted);
	pointer-events: none;
}
.search input {
	width: 100%;
	min-height: 40px;
	padding: 8px 40px 8px 36px;
	border: 0;
	border-radius: 20px;
	background: var(--soft);
	color: var(--text);
	font-size: var(--text-body);
	-webkit-appearance: none;
	appearance: none;
}
.search input::-webkit-search-cancel-button {
	display: none;
}
.search input:focus-visible {
	outline: none;
	box-shadow: inset 0 0 0 2px var(--system-blue);
}
.search input::placeholder {
	color: var(--muted);
}
.search .clear {
	position: absolute;
	right: 4px;
	width: 34px;
	height: 34px;
	display: grid;
	place-items: center;
	border-radius: 50%;
	color: var(--muted);
}
.search .clear .icon {
	width: 16px;
	height: 16px;
	stroke-width: 2.4;
}

/* Segmented control. */
.segmented {
	display: flex;
	gap: 2px;
	margin-bottom: 14px;
	padding: 2px;
	border-radius: 11px;
	background: var(--soft);
}
.segmented button {
	flex: 1 1 0;
	min-width: 0;
	min-height: 34px;
	padding: 4px 8px;
	border-radius: 9px;
	color: var(--text);
	font-size: var(--text-footnote);
	font-weight: 500;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	transition: background var(--fast), box-shadow var(--fast);
}
.segmented button[aria-pressed="true"] {
	background: var(--elevated);
	box-shadow: 0 2px 6px #0000001f, 0 0 0 0.5px #0000000a;
	font-weight: 600;
}
.segmented button:focus-visible {
	outline-offset: -2px;
}

/* Switch. */
.switch {
	position: relative;
	display: inline-block;
	width: 51px;
	height: 31px;
	flex-shrink: 0;
}
.switch input {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	opacity: 0;
	cursor: pointer;
	z-index: 1;
}
.switch span {
	position: absolute;
	inset: 0;
	border-radius: 16px;
	background: var(--soft-strong);
	transition: background var(--fast);
}
.switch span::after {
	position: absolute;
	top: 2px;
	left: 2px;
	width: 27px;
	height: 27px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 3px 8px #00000026, 0 1px 1px #00000029;
	content: "";
	transition: transform var(--medium) var(--ease-spring);
}
.switch input:checked + span {
	background: var(--system-green);
}
.switch input:checked + span::after {
	transform: translateX(20px);
}
.switch input:focus-visible + span {
	outline: 3px solid var(--system-blue);
	outline-offset: 2px;
}
.switch input:disabled + span {
	opacity: 0.5;
}

/* ---- sheets and alerts ------------------------------------------------------------------- */

.sheet {
	position: fixed;
	inset: auto 0 0;
	width: 100%;
	max-width: none;
	max-height: calc(var(--app-height, 100dvh) - var(--safe-top) - 24px);
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: var(--sheet-radius) var(--sheet-radius) 0 0;
	/* Elevated surfaces inside: in dark mode a sheet is lighter than the page, as on iOS. */
	--bg: var(--sheet-bg);
	--card: var(--sheet-card);
	background: var(--bg);
	color: var(--text);
	overflow: hidden;
	overscroll-behavior: contain;
	box-shadow: 0 -10px 40px #0000002e;
}
.sheet[open] {
	display: flex;
	flex-direction: column;
	animation: sheet-up var(--medium) var(--ease) both;
}
.sheet[data-closing] {
	animation: sheet-down 200ms ease-in both;
}
.sheet::backdrop {
	background: var(--sheet-backdrop);
	animation: fade-in var(--medium) ease-out both;
}
.sheet[data-closing]::backdrop {
	animation: fade-out 200ms ease-in both;
}
@keyframes sheet-up {
	from {
		transform: translateY(100%);
	}
}
@keyframes sheet-down {
	to {
		transform: translateY(100%);
	}
}
@keyframes fade-out {
	to {
		opacity: 0;
	}
}
.sheet-grabber {
	flex-shrink: 0;
	width: 36px;
	height: 5px;
	margin: 6px auto 0;
	border-radius: 3px;
	background: var(--soft-strong);
}
.sheet-head {
	flex-shrink: 0;
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
	align-items: center;
	gap: 8px;
	min-height: 52px;
	padding: 0 10px;
}
.sheet-head h2 {
	grid-column: 2;
	font-size: var(--text-headline);
	font-weight: 600;
	text-align: center;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	max-width: 60vw;
}
.sheet-head .start {
	grid-column: 1;
	justify-self: start;
}
.sheet-head .end {
	grid-column: 3;
	justify-self: end;
}
.sheet-head .link-btn {
	font-weight: 400;
	font-size: var(--text-body);
	padding: 0 8px;
}
.sheet-head .end .link-btn {
	font-weight: 600;
}
.sheet-body {
	flex: 1;
	min-height: 0;
	overflow-y: auto;
	padding: 4px max(var(--page-inset), var(--safe-right)) calc(24px + var(--safe-bottom)) max(var(--page-inset), var(--safe-left));
}
/* Forms in sheets: one rhythm between fields, hints and actions. */
.sheet-body > form,
.sheet-body > div {
	display: grid;
	gap: 14px;
}
.sheet-body .field + .field {
	margin-top: 0;
}
.sheet-body .section {
	margin-top: 10px;
}
.sheet-body .section:first-child {
	margin-top: 0;
}
.sheet-body .cron-reading {
	margin-top: -8px;
}
/* One picture over the whole window: a dark ground whatever the theme, as in Photos. */
.viewer {
	position: fixed;
	inset: 0;
	width: 100%;
	max-width: none;
	height: 100%;
	max-height: none;
	margin: 0;
	padding: 0;
	border: 0;
	background: #000;
	color: #fff;
	overflow: hidden;
}
.viewer[open] {
	display: flex;
	flex-direction: column;
	animation: fade-in var(--fast) ease-out both;
}
.viewer[data-closing] {
	animation: fade-out 180ms ease-in both;
}
.viewer::backdrop {
	background: #000;
}
.viewer-bar {
	flex-shrink: 0;
	display: grid;
	grid-template-columns: 44px minmax(0, 1fr) 44px;
	align-items: center;
	gap: 4px;
	min-height: 52px;
	padding: var(--safe-top) max(8px, var(--safe-right)) 0 max(8px, var(--safe-left));
}
.viewer-title {
	overflow: hidden;
	color: #fff;
	font-size: var(--text-subheadline);
	font-weight: 600;
	text-align: center;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.viewer-actions {
	display: flex;
	justify-content: flex-end;
}
.viewer-btn {
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	color: #fff;
}
.viewer-btn .icon {
	width: 22px;
	height: 22px;
}
.viewer-btn:active {
	background: #ffffff29;
}
.viewer-btn[aria-busy="true"] {
	opacity: 0.5;
}
.viewer-btn:focus-visible {
	outline: 2px solid #fff;
	outline-offset: -4px;
}
.viewer-stage {
	flex: 1;
	display: flex;
	min-height: 0;
	padding: 4px max(4px, var(--safe-right)) max(12px, var(--safe-bottom)) max(4px, var(--safe-left));
	overflow: auto;
	overscroll-behavior: contain;
}
/* Fitted to the window; a tap shows it at its own size, and the stage scrolls. */
.viewer-image {
	max-width: 100%;
	max-height: 100%;
	margin: auto;
	object-fit: contain;
	cursor: zoom-in;
	-webkit-user-select: none;
	user-select: none;
}
.viewer-image[data-zoom] {
	max-width: none;
	max-height: none;
	cursor: zoom-out;
}
@media (hover: hover) {
	.viewer-btn:hover {
		background: #ffffff1f;
	}
}
.sheet-body > p.lead {
	margin: 0 4px 16px;
	color: var(--muted);
	font-size: var(--text-subheadline);
}
@media (min-width: 700px) {
	.sheet {
		inset: 0;
		width: min(560px, calc(100% - 48px));
		max-height: min(760px, calc(100dvh - 64px));
		margin: auto;
		border-radius: var(--sheet-radius);
		box-shadow: 0 24px 80px #00000040;
	}
	.sheet[open] {
		animation: pop-up var(--medium) var(--ease) both;
	}
	.sheet[data-closing] {
		animation: fade-out 160ms ease-in both;
	}
	.sheet-grabber {
		display: none;
	}
	.sheet-head {
		min-height: 58px;
	}
	.sheet-body {
		padding-bottom: 24px;
	}
}
@keyframes pop-up {
	from {
		transform: scale(0.96);
		opacity: 0;
	}
}

/* Alert: centred, two or three stacked actions, as in iOS. */
.alert {
	width: min(300px, calc(100% - 48px));
	padding: 0;
	border: 0;
	border-radius: 18px;
	background: var(--elevated);
	color: var(--text);
	box-shadow: 0 20px 60px #00000040;
	text-align: center;
	overflow: hidden;
}
.alert[open] {
	animation: pop-up 200ms var(--ease) both;
}
.alert::backdrop {
	background: var(--sheet-backdrop);
}
.alert-copy {
	padding: 20px 18px 16px;
}
.alert-copy h2 {
	font-size: var(--text-headline);
	font-weight: 600;
}
.alert-copy p {
	margin-top: 4px;
	color: var(--text);
	font-size: var(--text-footnote);
	line-height: var(--leading-foot);
	overflow-wrap: anywhere;
}
.alert-actions {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: 1fr;
	border-top: 0.5px solid var(--line);
}
.alert-actions button {
	min-height: 46px;
	color: var(--accent);
	font-size: var(--text-body);
}
.alert-actions button + button {
	border-left: 0.5px solid var(--line);
}
.alert-actions button[data-role="cancel"] {
	font-weight: 400;
}
.alert-actions button[data-role="confirm"] {
	font-weight: 600;
}
.alert-actions button[data-role="destructive"] {
	color: var(--danger);
	font-weight: 600;
}
.alert-actions button:active {
	background: var(--press);
}

/* Action sheet: list of choices from the bottom. */
.action-list {
	display: grid;
	gap: 8px;
}
.action-list .group .row {
	justify-items: start;
}

/* ---- toasts and banners ------------------------------------------------------------------ */

.toast-layer {
	position: fixed;
	z-index: 90;
	left: 0;
	right: 0;
	bottom: calc(20px + var(--safe-bottom));
	display: grid;
	justify-items: center;
	gap: 8px;
	pointer-events: none;
}
/* Above the tab bar (and the approvals banner) on phones; above the composer in a chat. */
:root:has(.app[data-tabbar]) .toast-layer {
	bottom: calc(var(--tabbar-height) + 26px + var(--safe-bottom));
}
:root:has(.app[data-tabbar][data-banner]) .toast-layer {
	bottom: calc(var(--tabbar-height) + 94px + var(--safe-bottom));
}
:root:has(.chat-screen) .toast-layer {
	bottom: calc(76px + var(--safe-bottom));
}
@media (min-width: 960px) {
	:root:root .toast-layer {
		bottom: 28px;
	}
}
.toast {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	max-width: min(92vw, 420px);
	padding: 11px 16px;
	border-radius: 22px;
	background: color-mix(in srgb, var(--elevated) 86%, transparent);
	background: var(--glass);
	box-shadow: inset 0 0 0 0.5px var(--glass-line), var(--glass-shadow);
	-webkit-backdrop-filter: blur(24px) saturate(180%);
	backdrop-filter: blur(24px) saturate(180%);
	color: var(--text);
	font-size: var(--text-subheadline);
	font-weight: 500;
	pointer-events: auto;
	animation: toast-in var(--medium) var(--ease-spring) both;
}
.toast[data-leaving] {
	animation: fade-out 180ms ease-in both;
}
.toast .icon {
	width: 18px;
	height: 18px;
	stroke-width: 2.2;
}
.toast[data-tone="success"] .icon {
	color: var(--system-green);
}
.toast[data-tone="error"] .icon {
	color: var(--system-red);
}
/* A toast with one button ("Geri qaytar"): the button is a full touch target inside the pill. */
.toast[data-action] {
	padding-block: 0;
	padding-inline-end: 6px;
}
.toast-action {
	flex: none;
	min-height: var(--touch);
	margin-inline-start: 4px;
	padding: 0 12px;
	border-radius: 16px;
	color: var(--accent);
	font-size: var(--text-subheadline);
	font-weight: 600;
	white-space: nowrap;
}
.toast-action:active {
	opacity: 0.55;
}
@keyframes rise-in {
	from {
		transform: translate(-50%, 30px);
		opacity: 0;
	}
}
@keyframes toast-in {
	from {
		transform: translateY(16px) scale(0.96);
		opacity: 0;
	}
}

/* Pending approvals, visible on every screen. */
/* Like the Music mini player: just above the tab bar, so it never covers a title. Without a tab
   bar (a conversation) it sits under the navigation bar. */
.approval-banner {
	position: absolute;
	z-index: 25;
	bottom: calc(var(--tabbar-height) + 18px + var(--safe-bottom));
	left: 50%;
	display: flex;
	align-items: center;
	gap: 10px;
	width: min(calc(100% - 24px), 520px);
	min-height: 52px;
	padding: 8px 10px 8px 12px;
	border-radius: 18px;
	background: var(--glass);
	box-shadow: inset 0 0 0 0.5px var(--glass-line), var(--glass-shadow);
	-webkit-backdrop-filter: blur(24px) saturate(180%);
	backdrop-filter: blur(24px) saturate(180%);
	color: var(--text);
	text-align: start;
	transform: translateX(-50%);
	animation: rise-in var(--medium) var(--ease-spring) both;
}
.approval-banner .row-icon {
	--tone: var(--system-orange);
}
.approval-banner .banner-text {
	flex: 1;
	min-width: 0;
}
.approval-banner strong,
.approval-banner small {
	display: block;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.approval-banner strong {
	font-size: var(--text-subheadline);
	font-weight: 600;
}
.approval-banner small {
	color: var(--muted);
	font-size: var(--text-footnote);
}
.approval-banner .icon.chev {
	width: 16px;
	height: 16px;
	color: var(--faint);
	stroke-width: 2.4;
}
.app:not([data-tabbar]) .approval-banner {
	bottom: auto;
	top: calc(var(--safe-top) + var(--navbar-height) + 6px);
}
.app[data-banner][data-tabbar] {
	--banner-space: 68px;
}
/* Phones without a tab bar (conversation, setup): the banner sits under the navigation bar and
   the scroll area starts below it, so at rest it covers nothing; the composer is never under it. */
@media (max-width: 959px) {
	.app[data-banner]:not([data-tabbar]) .screen-scroll {
		padding-top: 64px;
	}
}
.side-banner {
	display: none;
}
@media (min-width: 960px) {
	/* Wide screens: in the sidebar, in the flow, under "New chat". */
	.banner-slot > .approval-banner {
		display: none;
	}
	.app[data-banner][data-tabbar] {
		--banner-space: 0px;
	}
	.side-banner {
		display: block;
		padding: 0 12px 6px;
	}
	.side-banner:empty {
		display: none;
	}
	.side-banner .approval-banner {
		position: static;
		width: 100%;
		min-height: 48px;
		padding: 6px 8px 6px 10px;
		border-radius: 12px;
		transform: none;
		background: var(--warning-fill);
		box-shadow: none;
		animation: fade-in var(--fast) ease-out both;
		-webkit-backdrop-filter: none;
		backdrop-filter: none;
	}
	.side-banner .approval-banner .row-icon {
		width: 26px;
		height: 26px;
	}
	.side-banner .approval-banner strong {
		font-size: var(--text-footnote);
	}
	.side-banner .approval-banner small {
		font-size: var(--text-caption);
	}
}

/* ---- loading, empty, error --------------------------------------------------------------- */

.state {
	display: grid;
	justify-items: center;
	gap: 10px;
	max-width: 360px;
	margin: 12vh auto 0;
	padding: 0 24px 24px;
	text-align: center;
}
.state-compact {
	margin-top: 32px;
}
.state-icon {
	display: grid;
	place-items: center;
	width: 64px;
	height: 64px;
	margin-bottom: 4px;
	border-radius: 20px;
	background: var(--soft);
	color: var(--muted);
}
.state-icon .icon {
	width: 30px;
	height: 30px;
	stroke-width: 1.6;
}
.state[data-tone="error"] .state-icon {
	background: var(--warning-fill);
	color: var(--warning);
}
.state h2 {
	font-size: var(--text-title3);
	font-weight: 700;
	letter-spacing: -0.01em;
}
.state p {
	color: var(--muted);
	font-size: var(--text-subheadline);
	line-height: var(--leading-sub);
}
.state .btn {
	margin-top: 8px;
}

/* Skeleton rows instead of spinners: the layout is there at once. */
.skeleton .row {
	pointer-events: none;
}
.bone {
	display: block;
	height: 12px;
	border-radius: 6px;
	background: linear-gradient(90deg, var(--soft) 0%, var(--soft-strong) 40%, var(--soft) 80%);
	background-size: 300% 100%;
	animation: shimmer 1.4s ease-in-out infinite;
}
.bone + .bone {
	margin-top: 8px;
}
.bone-icon {
	width: var(--icon-slot);
	height: var(--icon-slot);
	border-radius: 8px;
}
@keyframes shimmer {
	from {
		background-position: 100% 0;
	}
	to {
		background-position: 0 0;
	}
}

.more-row {
	display: grid;
	place-items: center;
	min-height: 56px;
	color: var(--muted);
}

/* The first paint: luminous dots (kept from the pai Mini App), then the app. */
.launch {
	position: fixed;
	inset: 0;
	z-index: 200;
	display: grid;
	place-content: center;
	justify-items: center;
	gap: 16px;
	background: var(--bg);
	color: var(--muted);
	font-size: var(--text-subheadline);
	transition: opacity 240ms ease-out;
}
.launch[data-done] {
	opacity: 0;
	pointer-events: none;
}
.loader-orb {
	display: grid;
	place-items: center;
	isolation: isolate;
	width: 96px;
	aspect-ratio: 1;
	background: radial-gradient(circle, var(--loader-halo), transparent 72%);
}
.loader-orbit {
	position: relative;
	width: 64px;
	aspect-ratio: 1;
	animation: orbit 8.6s ease-in-out infinite alternate;
}
.loader-orbit i {
	position: absolute;
	inset: calc(50% + var(--y)) auto auto calc(50% + var(--x));
	mix-blend-mode: screen;
	animation: sway var(--xp) var(--xo) infinite alternate ease-in-out;
}
.loader-orbit i::before {
	position: absolute;
	inset: calc(var(--w) / -2) auto auto calc(var(--w) / -2);
	width: var(--w);
	aspect-ratio: 1;
	border-radius: 50%;
	background: radial-gradient(circle, color-mix(in srgb, var(--dot) 72%, transparent) 0%, color-mix(in srgb, var(--dot) 25%, transparent) 50%, transparent 72%);
	filter: blur(3px);
	content: "";
	animation: rise var(--yp) var(--yo) infinite ease-in-out;
}
.loader-orbit i:nth-child(1) { --dot: #72ffd7; --x: -17px; --y: -9px; --w: 46px; --xp: 5.6s; --xo: -1.6s; --yp: 2.8s; --yo: -0.4s; }
.loader-orbit i:nth-child(2) { --dot: #62cfff; --x: -7px; --y: -17px; --w: 42px; --xp: 4.3s; --xo: -2.3s; --yp: 6.1s; --yo: -2s; }
.loader-orbit i:nth-child(3) { --dot: #a694ff; --x: 12px; --y: -10px; --w: 44px; --xp: 6.4s; --xo: -4.3s; --yp: 3.2s; --yo: -0.8s; }
.loader-orbit i:nth-child(4) { --dot: #c992ff; --x: 17px; --y: 7px; --w: 38px; --xp: 3.8s; --xo: -2.2s; --yp: 5.4s; --yo: -3.4s; }
.loader-orbit i:nth-child(5) { --dot: #ff93d5; --x: 4px; --y: 17px; --w: 49px; --xp: 7.1s; --xo: -1.9s; --yp: 4.7s; --yo: -2.9s; }
.loader-orbit i:nth-child(6) { --dot: #ffc18e; --x: -14px; --y: 12px; --w: 43px; --xp: 4.9s; --xo: -3.7s; --yp: 6.7s; --yo: -1.8s; }
@keyframes orbit {
	from {
		transform: rotate(-8deg) scale(0.92, 0.98);
	}
	to {
		transform: rotate(11deg) scale(1.08, 0.9);
	}
}
@keyframes sway {
	from {
		transform: translateX(-12px);
	}
	to {
		transform: translateX(12px);
	}
}
@keyframes rise {
	0%,
	100% {
		transform: translateY(-10px);
	}
	55% {
		transform: translateY(10px);
	}
}
@media (prefers-reduced-motion: reduce) {
	.loader-orbit,
	.loader-orbit i,
	.loader-orbit i::before,
	.bone,
	.spinner {
		animation: none !important;
	}
	.spinner {
		border-right-color: currentColor;
		opacity: 0.4;
	}
}

/* Key-value facts in a group. */
.facts {
	margin: 0;
}
.fact {
	position: relative;
	display: grid;
	grid-template-columns: minmax(96px, 34%) minmax(0, 1fr);
	gap: 12px;
	padding: 12px var(--row-inset);
	font-size: var(--text-subheadline);
}
.fact + .fact::before {
	position: absolute;
	top: 0;
	right: 0;
	left: var(--row-inset);
	border-top: 0.5px solid var(--line);
	content: "";
}
.fact dt {
	color: var(--muted);
}
.fact dd {
	margin: 0;
	overflow-wrap: anywhere;
}
.prose-card {
	padding: 14px var(--row-inset);
	font-size: var(--text-body);
	line-height: 1.45;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
}

/* An inline warning block (invalid policy file and the like). */
.notice {
	display: grid;
	gap: 4px;
	margin-top: 8px;
	padding: 12px var(--row-inset);
	border-radius: var(--group-radius);
	background: var(--warning-fill);
	color: var(--warning);
	font-size: var(--text-footnote);
	line-height: var(--leading-foot);
}
.notice strong {
	font-size: var(--text-subheadline);
}
.notice code {
	color: var(--text);
	overflow-wrap: anywhere;
}
