/* Base: how plain HTML looks in a Yesian app, with no classes needed.
   Write semantic markup (<form><label><input>, <table>, <article>, <dialog>,
   <nav><ul><li>, <details>) and it is styled; everything is built on the
   --app-* tokens of theme.css, in light and dark.

   Contents: reset · type · layout · links · buttons · forms · tables · cards ·
   nav · details and dropdowns · dialogs · busy · tooltips.

   The hooks apps use (keep them when changing this file):
     button / [role=button]   .secondary .contrast .outline   .small
     [role=switch]  [role=group]  [aria-invalid]  [aria-busy=true]
     details.dropdown   dialog > article > header|footer   [rel=prev] (close)
     [data-tooltip] [data-placement]   .grid  .container  .container-fluid
     .overflow-auto                                                        */

/* --- reset ---------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Every size below is in rem: 16px, and 17px on screens from laptop width up. */
html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

@media (min-width: 1024px) { html { font-size: 106.25%; } }

body {
  margin: 0;
  background: var(--app-bg);
  color: var(--app-text);
  font-family: var(--app-font);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  overflow-wrap: break-word;
}

[hidden] {
  display: none !important;
}

img,
svg,
video,
canvas {
  max-width: 100%;
  height: auto;
  vertical-align: middle;
}

/* --- type ----------------------------------------------------------------- */

h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0 0 var(--app-space);
  color: var(--app-text);
  font-weight: 700;
  line-height: 1.2;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

:where(p, ul, ol, dl, pre, table, blockquote, figure, address) {
  margin: 0 0 var(--app-space);
}

:where(ul, ol) {
  padding-left: 1.25rem;
}

:where(ul, ol) :where(ul, ol) {
  margin: 0.25rem 0 0;
}

li {
  margin-bottom: 0.25rem;
}

/* A heading with a line under it: the line is quieter and close. */
hgroup {
  margin: 0 0 var(--app-space);
}

hgroup > * {
  margin: 0;
}

hgroup > :not(:first-child) {
  color: var(--app-muted);
}

small {
  font-size: 0.875em;
}

b,
strong {
  font-weight: 700;
}

hr {
  height: 0;
  margin: var(--app-space) 0;
  border: 0;
  border-top: 1px solid var(--app-border);
}

blockquote {
  padding: 0.5rem 1rem;
  border-left: 0.25rem solid var(--app-border);
  color: var(--app-muted);
}

mark {
  padding: 0.1rem 0.25rem;
  background: var(--app-warning-soft);
  color: inherit;
}

code,
kbd,
samp,
pre {
  font-family: var(--app-font-mono);
  font-size: 0.875em;
}

:where(code, kbd) {
  padding: 0.15rem 0.35rem;
  border-radius: 0.3rem;
  background: var(--app-subtle);
}

pre {
  padding: 0.9rem 1rem;
  overflow: auto;
  border-radius: var(--app-radius);
  background: var(--app-subtle);
}

pre code {
  padding: 0;
  background: none;
  font-size: inherit;
}

/* --- layout --------------------------------------------------------------- */

body > header,
body > main,
body > footer {
  padding-block: var(--app-space);
}

.container,
.container-fluid {
  width: 100%;
  margin-inline: auto;
  padding-inline: var(--app-space);
}

@media (min-width: 576px) { .container { max-width: 510px; padding-inline: 0; } }
@media (min-width: 768px) { .container { max-width: 700px; } }
@media (min-width: 1024px) { .container { max-width: 950px; } }
@media (min-width: 1280px) { .container { max-width: 1200px; } }
@media (min-width: 1536px) { .container { max-width: 1450px; } }

/* .grid: equal columns from tablet width up, one column below. */
.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--app-space);
  margin: 0;
}

@media (min-width: 768px) {
  .grid {
    grid-template-columns: repeat(auto-fit, minmax(0%, 1fr));
  }
}

.grid > * {
  min-width: 0;
}

.overflow-auto {
  overflow: auto;
}

/* --- links ---------------------------------------------------------------- */

/* Hover changes the --link variable, not the colour itself: a component that
   sets its own colour on a link keeps it on hover. Buttons do the same. */
a,
[role="link"] {
  --link: var(--app-accent-tone);
  color: var(--link);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--link) 40%, transparent);
  text-underline-offset: 0.125em;
  cursor: pointer;
  transition: color 0.15s, text-decoration-color 0.15s, background-color 0.15s;
}

a:is(:hover, :active, :focus-visible),
[role="link"]:is(:hover, :active, :focus-visible) {
  --link: var(--app-accent-hover);
  text-decoration-color: currentColor;
}

a:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--app-accent-tone) 45%, transparent);
  outline-offset: 2px;
  border-radius: 0.2rem;
}

a.secondary:not([role="button"]) {
  --link: var(--app-muted);
}

a.secondary:not([role="button"]):is(:hover, :active, :focus-visible),
a.contrast:not([role="button"]) {
  --link: var(--app-text);
}

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

button,
[type="submit"],
[type="button"],
[type="reset"],
[role="button"] {
  --btn-bg: var(--app-accent-tone);
  --btn-hover: var(--app-accent-hover);
  --btn-color: var(--app-on-accent);
  --btn-now: var(--btn-bg);
  display: inline-block;
  margin: 0;
  /* Lower than a field: a button is a label to click, not a box to type in. */
  padding: 0.45rem 0.95rem;
  border: 1px solid var(--btn-now);
  border-radius: var(--app-radius);
  background: var(--btn-now);
  color: var(--btn-color);
  font: inherit;
  font-weight: 400;
  line-height: 1.5;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}

:is(button, [type="submit"], [type="button"], [type="reset"], [role="button"]):is(:hover, :active) {
  --btn-now: var(--btn-hover);
}

/* A ring that is plain to see on any button, whatever its own colours. */
:is(button, [type="submit"], [type="button"], [type="reset"], [role="button"]):focus-visible {
  outline: 2px solid var(--app-accent-tone);
  outline-offset: 2px;
}

:is(button, [type="submit"], [type="button"], [type="reset"], [role="button"]):is([disabled], [aria-disabled="true"]) {
  opacity: 0.5;
  pointer-events: none;
}

:is(button, [type="submit"], [type="button"], [type="reset"], [role="button"]).secondary {
  --btn-bg: var(--app-secondary);
  --btn-hover: var(--app-secondary-hover);
  --btn-color: #ffffff;
}

:is(button, [type="submit"], [type="button"], [type="reset"], [role="button"]).contrast {
  --btn-bg: var(--app-text);
  --btn-hover: color-mix(in srgb, var(--app-text) 82%, var(--app-bg));
  --btn-color: var(--app-bg);
}

/* .outline: the variant's colour as border and text. */
:is(button, [type="submit"], [type="button"], [type="reset"], [role="button"]).outline {
  background: color-mix(in srgb, var(--btn-now) var(--btn-tint, 0%), transparent);
  color: var(--btn-now);
}

:is(button, [type="submit"], [type="button"], [type="reset"], [role="button"]).outline:is(:hover, :active) {
  --btn-tint: 8%;
}

:is(button, [role="button"]).outline.secondary {
  --btn-bg: var(--app-muted);
  --btn-hover: var(--app-text);
  border-color: color-mix(in srgb, var(--btn-now) 55%, transparent);
}

/* --- forms ---------------------------------------------------------------- */

form {
  margin: 0;
}

fieldset {
  min-width: 0;
  margin: 0 0 var(--app-space);
  padding: 0;
  border: 0;
}

legend {
  padding: 0;
  margin-bottom: 0.375rem;
  font-weight: 600;
}

label {
  display: block;
  margin-bottom: 0.375rem;
}

input,
select,
textarea {
  font: inherit;
  line-height: 1.5;
  color: var(--app-text);
}

input:not([type="checkbox"], [type="radio"], [type="range"], [type="file"], [type="submit"], [type="button"], [type="reset"], [type="color"], [type="hidden"]),
select,
textarea {
  display: block;
  width: 100%;
  margin: 0 0 var(--app-space);
  padding: 0.75rem 1rem;
  border: 1px solid var(--app-border-strong);
  border-radius: var(--app-radius);
  background-color: var(--app-surface);
  box-shadow: none;
  appearance: none;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}

/* One-line controls share a height, so fields and selects line up in a row. */
input:not([type="checkbox"], [type="radio"], [type="range"], [type="file"], [type="submit"], [type="button"], [type="reset"], [type="color"], [type="hidden"]),
select:not([multiple], [size]) {
  height: calc(1.5rem + 1.5rem + 2px);
}

/* A control inside its label sits a little below the label's text. */
label > :where(input, select, textarea) {
  margin-top: 0.25rem;
}

:is(input, select, textarea):focus {
  border-color: var(--app-accent-tone);
  box-shadow: 0 0 0 0.1875rem color-mix(in srgb, var(--app-accent-tone) 25%, transparent);
}

::placeholder {
  color: var(--app-muted);
  opacity: 1;
}

:is(input, select, textarea, button):disabled,
:is(input, textarea)[readonly] {
  opacity: 0.6;
}

:is(input, textarea)[readonly] {
  background-color: var(--app-subtle);
}

textarea {
  resize: vertical;
}

select:not([multiple], [size]) {
  padding-right: 2.5rem;
  background-image: var(--app-icon-chevron);
  background-position: center right 0.75rem;
  background-size: 1rem auto;
  background-repeat: no-repeat;
}

/* The open list of a select: readable in both themes, whatever the select's own colour. */
option,
optgroup {
  background-color: var(--app-surface);
  color: var(--app-text);
}

input[type="search"] {
  padding-left: 2.5rem;
  border-radius: 5rem;
  background-image: var(--app-icon-search);
  background-position: center left 1.125rem;
  background-size: 1rem auto;
  background-repeat: no-repeat;
}

input[type="search"]::-webkit-search-cancel-button {
  appearance: none;
}

/* Hint or error under a control. */
:where(input, select, textarea, fieldset, .grid, [role="group"]) + small {
  display: block;
  width: 100%;
  margin-top: calc(var(--app-space) * -0.75);
  margin-bottom: var(--app-space);
  color: var(--app-muted);
}

label > :where(input, select, textarea) + small {
  margin-bottom: 0.5rem;
}

/* Beside a checkbox or switch the hint is a line under its label, not pulled up to a field's edge. */
label > :where([type="checkbox"], [type="radio"]) + small {
  margin-top: 0.3rem;
}

/* Validation state (ys.js sets aria-invalid on fields with errors). */
:is(input, select, textarea)[aria-invalid="true"] {
  border-color: var(--app-danger);
}

:is(input, select, textarea)[aria-invalid="true"]:focus {
  box-shadow: 0 0 0 0.1875rem color-mix(in srgb, var(--app-danger) 25%, transparent);
}

:is(input, select, textarea)[aria-invalid="true"] + small {
  color: var(--app-danger);
}

:is(input, select, textarea)[aria-invalid="false"] {
  border-color: var(--app-success);
}

/* Checkboxes, radios, switches. */
[type="checkbox"],
[type="radio"] {
  appearance: none;
  flex: none;
  width: 1.25em;
  height: 1.25em;
  margin: -0.125em 0.5em 0 0;
  border: 1px solid var(--app-border-strong);
  border-radius: 0.3rem;
  background: var(--app-surface) no-repeat center / 0.75em auto;
  vertical-align: middle;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, box-shadow 0.15s;
}

[type="radio"] {
  border-radius: 50%;
}

:is([type="checkbox"], [type="radio"]):focus-visible {
  outline: none;
  border-color: var(--app-accent-tone);
  box-shadow: 0 0 0 0.1875rem color-mix(in srgb, var(--app-accent-tone) 25%, transparent);
}

[type="checkbox"]:checked {
  border-color: var(--app-accent-tone);
  background-color: var(--app-accent-tone);
  background-image: var(--app-icon-check);
}

[type="radio"]:checked {
  border-color: var(--app-accent-tone);
  background: radial-gradient(circle, var(--app-on-accent) 0 30%, var(--app-accent-tone) 34%);
}

[type="checkbox"][role="switch"] {
  width: 2.25em;
  border-radius: 1.25em;
  border-color: var(--app-border-strong);
  background: var(--app-border-strong);
  background-image: none;
}

[type="checkbox"][role="switch"]::before {
  content: "";
  display: block;
  height: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: margin 0.12s ease-in-out;
}

[type="checkbox"][role="switch"]:checked {
  border-color: var(--app-accent-tone);
  background: var(--app-accent-tone);
}

[type="checkbox"][role="switch"]:checked::before {
  margin-inline-start: calc(2.25em - 1.25em);
}

label:has(> [type="checkbox"], > [type="radio"]) {
  cursor: pointer;
}

/* File inputs: the "Choose" part looks like a secondary button. */
[type="file"] {
  display: block;
  width: 100%;
  margin: 0 0 var(--app-space);
  color: var(--app-muted);
}

[type="file"]::file-selector-button {
  margin-right: 0.75rem;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--app-secondary);
  border-radius: var(--app-radius);
  background: var(--app-secondary);
  color: #ffffff;
  font: inherit;
  cursor: pointer;
}

[type="file"]::file-selector-button:hover {
  border-color: var(--app-secondary-hover);
  background: var(--app-secondary-hover);
}

/* [role=group]: controls joined in one row (a field with its button). */
[role="group"] {
  display: flex;
  width: 100%;
  margin: 0 0 var(--app-space);
}

[role="group"] > * {
  margin: 0;
  border-radius: 0;
}

[role="group"] > :where(input, select) {
  flex: 1 1 auto;
  min-width: 0;
}

[role="group"] > :not(:first-child) {
  margin-left: -1px;
}

[role="group"] > :first-child {
  border-top-left-radius: var(--app-radius);
  border-bottom-left-radius: var(--app-radius);
}

[role="group"] > :last-child {
  border-top-right-radius: var(--app-radius);
  border-bottom-right-radius: var(--app-radius);
}

[role="group"] > :focus {
  position: relative;
  z-index: 1;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  text-indent: 0;
}

th,
td {
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--app-border);
  text-align: start;
}

th {
  font-weight: 600;
}

thead th {
  border-bottom-width: 0.1875rem;
}

tfoot :is(th, td) {
  border-top: 1px solid var(--app-border);
  border-bottom: 0;
}

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

article {
  margin: 0 0 var(--app-space);
  padding: var(--app-space);
  border-radius: var(--app-radius);
  background: var(--app-surface);
  box-shadow: var(--app-shadow);
}

article > header,
article > footer {
  margin-inline: calc(var(--app-space) * -1);
  padding: calc(var(--app-space) * 0.66) var(--app-space);
  background: var(--app-subtle);
}

article > header {
  margin-top: calc(var(--app-space) * -1);
  margin-bottom: var(--app-space);
  border-bottom: 1px solid var(--app-border);
  border-top-left-radius: var(--app-radius);
  border-top-right-radius: var(--app-radius);
}

article > footer {
  margin-top: var(--app-space);
  margin-bottom: calc(var(--app-space) * -1);
  border-top: 1px solid var(--app-border);
  border-bottom-left-radius: var(--app-radius);
  border-bottom-right-radius: var(--app-radius);
}

article > header > :last-child,
article > footer > :last-child,
article > :last-child:not(header, footer) {
  margin-bottom: 0;
}

/* --- nav ------------------------------------------------------------------ */

nav,
nav ul {
  display: flex;
}

nav {
  justify-content: space-between;
}

nav ul {
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
}

nav > ul:first-of-type {
  margin-left: -0.5rem;
}

nav > ul:last-of-type {
  margin-right: -0.5rem;
}

nav li {
  display: inline-block;
  margin: 0;
  padding: 1rem 0.5rem;
}

nav li :where(a, [role="link"]) {
  display: inline-block;
  margin: -0.5rem;
  padding: 0.5rem;
  border-radius: var(--app-radius);
  text-decoration: none;
}

nav li :where(a, [role="link"]):is(:hover, [aria-current]:not([aria-current="false"])) {
  text-decoration: underline;
}

nav li :is(button, [role="button"], input, select) {
  margin: 0;
}

/* --- details and dropdowns -------------------------------------------------- */

details {
  margin: 0 0 var(--app-space);
}

summary {
  cursor: pointer;
  list-style: none;
  line-height: 1.5;
  min-height: 1.5rem;
}

summary::-webkit-details-marker {
  display: none;
}

summary::after {
  content: "";
  float: right;
  width: 1rem;
  height: 1.5em;
  margin-inline-start: 0.5rem;
  background: var(--app-icon-chevron) no-repeat center / 1rem auto;
  transform: rotate(-90deg);
  transition: transform 0.15s;
}

details[open] > summary::after {
  transform: rotate(0);
}

/* (Not for dropdowns: their summary must not move when the menu opens.) */
details[open]:not(.dropdown) > summary {
  margin-bottom: 0.5rem;
}

summary:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--app-accent-tone) 45%, transparent);
  outline-offset: 2px;
  border-radius: 0.2rem;
}

/* details.dropdown: a menu under its summary (ui.js closes it after a
   choice or a click elsewhere). <ul dir="rtl"> aligns it to the right edge. */
details.dropdown {
  position: relative;
  margin: 0;
}

details.dropdown > summary {
  display: block;
  padding: 0.75rem 1rem;
  border: 1px solid var(--app-border-strong);
  border-radius: var(--app-radius);
  background: var(--app-surface);
  color: var(--app-text);
  white-space: nowrap;
  user-select: none;
}

details.dropdown > summary::after {
  transform: rotate(0);
}

nav details.dropdown > summary {
  margin: -0.5rem 0;
  padding: 0.35rem 0.6rem;
}

details.dropdown > ul {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 99;
  display: flex;
  flex-direction: column;
  min-width: 100%;
  margin: 0.25rem 0 0;
  padding: 0.25rem 0;
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  background: var(--app-surface);
  box-shadow: 0 8px 24px rgba(17, 24, 39, 0.12);
  list-style: none;
}

details.dropdown > ul[dir="rtl"] {
  right: 0;
  left: auto;
}

details.dropdown > ul li {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

details.dropdown > ul li :is(a, button) {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0.5rem 1rem;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--app-text);
  text-align: start;
  text-decoration: none;
  white-space: nowrap;
}

details.dropdown > ul li :is(a, button):is(:hover, :focus-visible) {
  background: var(--app-subtle);
  color: var(--app-text);
  text-decoration: none;
}

/* --- dialogs -------------------------------------------------------------- */

dialog {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: color-mix(in srgb, var(--app-overlay) 55%, transparent);
  backdrop-filter: blur(0.25rem);
  color: var(--app-text);
}

dialog:not([open]) {
  display: none;
}

dialog::backdrop {
  background: none;
}

dialog > article {
  width: 100%;
  max-width: 510px;
  max-height: calc(100vh - 2rem);
  max-height: calc(100dvh - 2rem);
  margin: var(--app-space);
  overflow: auto;
  box-shadow: 0 16px 48px rgba(17, 24, 39, 0.22);
}

@media (min-width: 768px) {
  dialog > article {
    max-width: 700px;
  }

  /* A dialog with much side by side (permission checkboxes): <dialog class="wide">. */
  dialog.wide > article {
    max-width: 860px;
  }
}

dialog > article > header > :is(h1, h2, h3, h4, h5, h6, p) {
  margin-bottom: 0;
}

/* The × in a dialog's header: <button rel="prev" data-modal-close>. */
dialog > article > header > [rel="prev"] {
  float: right;
  /* At least 24px to hit (WCAG 2.5.8); the cross itself stays 1rem. */
  width: 1.75rem;
  height: 1.75rem;
  margin: -0.05rem -0.35rem 0 1rem;
  padding: 0;
  border: 0;
  border-radius: 0.3rem;
  background: var(--app-icon-close) no-repeat center / 1rem auto;
  opacity: 0.65;
}

dialog > article > header > [rel="prev"]:is(:hover, :focus-visible) {
  background-color: transparent;
  opacity: 1;
  box-shadow: none;
}

/* Buttons at the end of a dialog (the article's footer, or a form's). */
dialog footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
}

dialog form > footer {
  margin-top: var(--app-space);
  padding-top: var(--app-space);
  border-top: 1px solid var(--app-border);
}

/* --- busy ----------------------------------------------------------------- */

/* aria-busy="true": a spinner before the content (ys.js sets it on the
   element that started an action, templates on placeholders). */
[aria-busy="true"]:not(input, select, textarea, html, form)::before {
  content: "";
  display: inline-block;
  width: 1em;
  height: 1em;
  border: 0.1875em solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  vertical-align: -0.125em;
  opacity: 0.75;
  animation: app-spin 0.75s linear infinite;
}

[aria-busy="true"]:not(input, select, textarea, html, form):not(:empty)::before {
  margin-inline-end: 0.5em;
}

:is(button, [role="button"], a)[aria-busy="true"] {
  pointer-events: none;
}

/* A tooltip is drawn in ::before (see [data-tooltip]): while busy, the tooltip
   stays away and the spinner is drawn in ::after, else the spinner's look
   would land on the tooltip's bubble. An icon-only button shows the spinner
   in place of its icon, so it keeps its size. */
[data-tooltip][aria-busy="true"]::before {
  display: none;
}

[data-tooltip][aria-busy="true"]:not(input, select, textarea, html, form)::after {
  content: "";
  display: inline-block;
  width: 1em;
  height: 1em;
  margin-inline-start: 0.5em;
  border: 0.1875em solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  vertical-align: -0.125em;
  opacity: 0.75;
  animation: app-spin 0.75s linear infinite;
}

:is(button, [role="button"], a)[aria-busy="true"]:has(> svg:only-child) > svg {
  display: none;
}

:is(button, [role="button"], a)[data-tooltip][aria-busy="true"]:has(> svg:only-child)::after {
  margin-inline-start: 0;
}

@keyframes app-spin {
  to {
    transform: rotate(360deg);
  }
}

/* --- tooltips ------------------------------------------------------------- */

/* data-tooltip="Text" (data-placement="bottom|left|right"; default top). */
[data-tooltip] {
  position: relative;
}

[data-tooltip]:not(a, button, input, [role="button"]) {
  border-bottom: 1px dotted;
  cursor: help;
}

[data-tooltip]::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 0.4rem);
  left: 50%;
  z-index: 99;
  transform: translate(-50%, 0.25rem);
  padding: 0.25rem 0.5rem;
  border-radius: 0.35rem;
  background: var(--app-tooltip);
  color: var(--app-tooltip-text);
  font-size: 0.875rem;
  font-style: normal;
  font-weight: 400;
  line-height: 1.4;
  text-decoration: none;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s, transform 0.12s;
}

[data-tooltip]:is(:hover, :focus-visible)::before {
  opacity: 1;
  transform: translate(-50%, 0);
}

[data-tooltip][data-placement="bottom"]::before {
  top: calc(100% + 0.4rem);
  bottom: auto;
}

[data-tooltip][data-placement="left"]::before {
  top: 50%;
  right: calc(100% + 0.4rem);
  bottom: auto;
  left: auto;
  transform: translate(0.25rem, -50%);
}

[data-tooltip][data-placement="left"]:is(:hover, :focus-visible)::before {
  transform: translate(0, -50%);
}

[data-tooltip][data-placement="right"]::before {
  top: 50%;
  bottom: auto;
  left: calc(100% + 0.4rem);
  transform: translate(-0.25rem, -50%);
}

[data-tooltip][data-placement="right"]:is(:hover, :focus-visible)::before {
  transform: translate(0, -50%);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }

  [aria-busy="true"]::before {
    animation-duration: 1.5s !important;
  }
}
