/* Design tokens, app layout and the shared design-system classes.
   Inside Telegram, colours come from the theme params Telegram sets as --tg-theme-*;
   in a browser the [data-theme] fallbacks apply (set by core/telegram.js). */

:root {
  color-scheme: light dark;
  --font:
    system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    sans-serif;

  --text-xs: 12px;
  --text-sm: 13px;
  --text-md: 15px;
  --text-lg: 17px;
  --text-xl: 22px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 20px;
  --tap: 44px;
  --gutter: 16px;
  --content-width: 720px;
  --tab-bar-height: 60px;
  --safe-bottom: max(
    env(safe-area-inset-bottom, 0px),
    var(--tg-safe-area-inset-bottom, 0px)
  );
  /* What covers the top of the page: a home-screen app's status bar, or in Telegram
     the screen edge and its controls when they float over the page (0 when expanded). */
  --safe-top: calc(
    max(env(safe-area-inset-top, 0px), var(--tg-safe-area-inset-top, 0px)) +
      var(--tg-content-safe-area-inset-top, 0px)
  );
  --duration: 180ms;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);

  /* Fallback palette (dark). */
  --fallback-bg: #111114;
  --fallback-text: #f1f1f4;
  --fallback-muted: #9b9ba8;
  --fallback-accent: #7b6cf6;
  --fallback-on-accent: #ffffff;
  --fallback-link: #a99dff;
  --fallback-danger: #ff6369;
  --success: #3ccf8e;
  --warning: #f2b84b;
  /* Text on filled toasts: the light dark-theme tones need dark text. */
  --on-success: #04261a;
  --on-warning: #261a00;
  --on-danger: #2a0a0c;
  --info: #6aa8ff;
  --shadow: 0 12px 32px rgb(0 0 0 / 0.45);
  --overlay: rgb(0 0 0 / 0.55);
}

/* Before JS sets data-theme (and on the sign-in page) follow the OS preference. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    color-scheme: light;
    --fallback-bg: #f5f5f8;
    --fallback-text: #17171c;
    --fallback-muted: #6b6b78;
    --fallback-accent: #5a49d6;
    --fallback-on-accent: #ffffff;
    --fallback-link: #4b3bc9;
    --fallback-danger: #d3343b;
    --success: #117a48;
    --warning: #9a6200;
    --on-success: #ffffff;
    --on-warning: #ffffff;
    --on-danger: #ffffff;
    --info: #2563c9;
    --shadow: 0 12px 32px rgb(20 20 40 / 0.16);
    --overlay: rgb(10 10 20 / 0.4);
  }
}

:root[data-theme="light"] {
  color-scheme: light;
  --fallback-bg: #f5f5f8;
  --fallback-text: #17171c;
  --fallback-muted: #6b6b78;
  --fallback-accent: #5a49d6;
  --fallback-on-accent: #ffffff;
  --fallback-link: #4b3bc9;
  --fallback-danger: #d3343b;
  --success: #117a48;
  --warning: #9a6200;
  --on-success: #ffffff;
  --on-warning: #ffffff;
  --on-danger: #ffffff;
  --info: #2563c9;
  --shadow: 0 12px 32px rgb(20 20 40 / 0.16);
  --overlay: rgb(10 10 20 / 0.4);
}

:root[data-theme="dark"] {
  color-scheme: dark;
}

:root {
  --bg: var(--tg-theme-bg-color, var(--fallback-bg));
  --text: var(--tg-theme-text-color, var(--fallback-text));
  --muted: var(--tg-theme-hint-color, var(--fallback-muted));
  --accent: var(--tg-theme-button-color, var(--fallback-accent));
  --on-accent: var(--tg-theme-button-text-color, var(--fallback-on-accent));
  --link: var(--tg-theme-link-color, var(--fallback-link));
  --danger: var(--tg-theme-destructive-text-color, var(--fallback-danger));
  /* Surfaces are derived from bg/text so every Telegram theme gets readable contrast. */
  --surface: color-mix(in srgb, var(--text) 6%, var(--bg));
  --surface-2: color-mix(in srgb, var(--text) 11%, var(--bg));
  --border: color-mix(in srgb, var(--text) 13%, transparent);
  --accent-soft: color-mix(in srgb, var(--accent) 16%, transparent);
  --danger-soft: color-mix(in srgb, var(--danger) 14%, transparent);
  --focus-ring: 0 0 0 3px color-mix(in srgb, var(--accent) 45%, transparent);
}

@supports not (color: color-mix(in srgb, red 50%, blue)) {
  :root {
    --surface: rgb(128 128 128 / 0.1);
    --surface-2: rgb(128 128 128 / 0.18);
    --border: rgb(128 128 128 / 0.28);
    --accent-soft: rgb(123 108 246 / 0.18);
    --danger-soft: rgb(255 99 105 / 0.16);
    --focus-ring: 0 0 0 3px rgb(123 108 246 / 0.45);
  }
}

/* Reset ------------------------------------------------------------------ */

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

[hidden],
.hidden {
  display: none !important;
}

html,
body {
  height: 100%;
}

/* A home-screen app added with a translucent status bar (as the old app asked for) is
   laid out one status bar short by iOS 26, leaving an unpainted strip at the bottom,
   until the page is at least as tall as the screen. With an opaque bar the top inset
   is 0 and this changes nothing. */
@media (display-mode: standalone) {
  html {
    min-height: min(100lvh, calc(100% + env(safe-area-inset-top, 0px)));
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 var(--text-md) / 1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  text-size-adjust: 100%;
}

h1,
h2,
h3,
p,
ul,
ol,
figure {
  margin: 0;
}

h1 {
  font-size: var(--text-xl);
  line-height: 1.2;
  font-weight: 700;
}

h2 {
  font-size: var(--text-lg);
  line-height: 1.3;
  font-weight: 650;
}

h3 {
  font-size: var(--text-md);
  font-weight: 650;
}

a {
  color: var(--link);
}

img {
  display: block;
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.icon {
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: middle;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

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

/* No app header: each tab has its own title. Each child names its row, as the jobs
   panel leaves the grid while hidden (when idle) and children placed by order would
   slide up, putting the tab bar in the panes' row. */
.app {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  grid-template-areas: "main" "jobs" "tabs";
  height: var(--app-height, 100dvh);
  overflow: hidden;
  /* viewport-fit=cover: keep clear of the notch in landscape. */
  padding-inline: env(safe-area-inset-left, 0px) env(safe-area-inset-right, 0px);
}

.app-main {
  grid-area: main;
  position: relative;
  overflow: hidden;
}

#jobs-root {
  grid-area: jobs;
}

.pane {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: var(--space-4) var(--gutter) var(--space-6);
  /* Below whatever covers the top, with room for the blur iOS 26 draws a little past
     a status bar over the page (the min() adds nothing when nothing covers it). */
  padding-top: calc(
    var(--space-4) + var(--safe-top) + min(var(--safe-top), var(--space-4))
  );
}

/* In a browser a pull past the top stays in the pane: no pull-to-refresh, no bouncing
   the whole app. Inside Telegram it has to reach Telegram, as swiping down from the top
   is how the app is closed. */
[data-host="browser"] .pane {
  overscroll-behavior: contain;
}

.pane > * {
  max-width: var(--content-width);
  margin-inline: auto;
}

.pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.pane-header h1 {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.pane-header h1 .icon {
  color: var(--accent);
}

.pane-loading,
.pane-error {
  display: grid;
  justify-items: center;
  gap: var(--space-3);
  padding: var(--space-6) var(--space-4);
  color: var(--muted);
  text-align: center;
}

.tab-bar {
  grid-area: tabs;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  padding: 0 var(--space-1) var(--safe-bottom);
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: var(--tab-bar-height);
  padding: var(--space-2) var(--space-1);
  border: 0;
  background: none;
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 600;
  transition: color var(--duration) var(--ease);
}

.tab[aria-selected="true"] {
  color: var(--accent);
}

.tab:focus-visible {
  outline-offset: -4px;
  border-radius: var(--radius);
}

/* Layout helpers --------------------------------------------------------- */

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--gap, var(--space-3));
}

.row {
  display: flex;
  align-items: center;
  gap: var(--gap, var(--space-2));
  min-width: 0;
}

.row-wrap {
  flex-wrap: wrap;
}

.row > .grow,
.stack > .grow {
  flex: 1 1 auto;
  min-width: 0;
}

.row-end {
  justify-content: flex-end;
}

.row-between {
  justify-content: space-between;
}

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

.small {
  font-size: var(--text-sm);
}

.truncate {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.tabular {
  font-variant-numeric: tabular-nums;
}

/* Buttons ---------------------------------------------------------------- */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--tap);
  padding: 0 var(--space-4);
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  font-size: var(--text-md);
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
  transition:
    background-color var(--duration) var(--ease),
    opacity var(--duration) var(--ease),
    transform 80ms ease;
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn:disabled,
.icon-btn:disabled,
.chip:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn[aria-busy="true"] {
  cursor: progress;
}

.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
}

.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.btn-block {
  width: 100%;
}

/* Small buttons keep a 44px hit area through ::after. */
.btn-sm {
  min-height: 36px;
  padding: 0 var(--space-3);
  border-radius: 10px;
  font-size: var(--text-sm);
}

.btn-sm::after,
.chip::after {
  content: "";
  position: absolute;
  inset: -4px 0;
}

.icon-btn {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: none;
  width: var(--tap);
  height: var(--tap);
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: inherit;
  transition: background-color var(--duration) var(--ease);
}

.icon-btn[aria-pressed="true"],
.icon-btn[aria-expanded="true"] {
  color: var(--accent);
  background: var(--accent-soft);
}

@media (hover: hover) {
  .btn:hover:not(:disabled) {
    filter: brightness(1.08);
  }

  .icon-btn:hover:not(:disabled),
  .chip:hover:not(:disabled) {
    background: var(--surface-2);
  }
}

/* Forms ------------------------------------------------------------------ */

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.label {
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: 600;
}

/* 16px font keeps iOS from zooming into focused inputs. */
.input {
  width: 100%;
  min-width: 0;
  min-height: var(--tap);
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
  line-height: 1.3;
  transition:
    border-color var(--duration) var(--ease),
    box-shadow var(--duration) var(--ease);
}

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

.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

.input[aria-invalid="true"] {
  border-color: var(--danger);
}

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

.select {
  position: relative;
  display: block;
}

.select > select.input {
  appearance: none;
  padding-right: 40px;
}

.select > .icon {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%) rotate(90deg);
  color: var(--muted);
  pointer-events: none;
}

.search-field {
  position: relative;
  display: block;
}

.search-field > .icon {
  position: absolute;
  top: 50%;
  left: 12px;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.search-field > .input {
  padding-left: 40px;
  padding-right: var(--tap);
}

.search-field > .icon-btn {
  position: absolute;
  top: 0;
  right: 0;
  color: var(--muted);
}

/* The clear button appears only when the field has text. */
.search-field > .input:placeholder-shown + .icon-btn {
  display: none;
}

.hint {
  color: var(--muted);
  font-size: var(--text-sm);
}

/* role="switch" checkbox; the thumb is a gradient so no pseudo-elements are needed. */
.switch {
  flex: none;
  appearance: none;
  width: 46px;
  height: 28px;
  margin: 8px 0;
  border-radius: 999px;
  background: radial-gradient(circle at 14px 50%, #fff 10px, transparent 11px)
    var(--surface-2);
  cursor: pointer;
  transition: background-color var(--duration) var(--ease);
}

.switch:checked {
  background: radial-gradient(
      circle at calc(100% - 14px) 50%,
      #fff 10px,
      transparent 11px
    )
    var(--accent);
}

.switch:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: var(--tap);
  cursor: pointer;
}

/* Surfaces --------------------------------------------------------------- */

.card {
  padding: var(--space-4);
  border-radius: 16px;
  background: var(--surface);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: var(--text-xs);
  font-weight: 700;
  line-height: 1;
}

.badge-soft {
  background: var(--surface-2);
  color: var(--muted);
}

.chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 var(--space-3);
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: var(--text-sm);
  font-weight: 600;
}

.chip[aria-pressed="true"] {
  border-color: transparent;
  background: var(--accent-soft);
  color: var(--accent);
}

.status {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--surface);
  font-size: var(--text-sm);
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.status[data-tone="info"] {
  background: color-mix(in srgb, var(--info) 12%, transparent);
}

.status[data-tone="success"] {
  background: color-mix(in srgb, var(--success) 14%, transparent);
  color: color-mix(in srgb, var(--success) 70%, var(--text));
}

.status[data-tone="warning"] {
  background: color-mix(in srgb, var(--warning) 16%, transparent);
  color: color-mix(in srgb, var(--warning) 65%, var(--text));
}

.status[data-tone="error"] {
  background: var(--danger-soft);
  color: color-mix(in srgb, var(--danger) 55%, var(--text));
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tab-bar-height) + var(--safe-bottom) + var(--space-4));
  z-index: 1000;
  width: max-content;
  max-width: min(480px, calc(100vw - 2 * var(--gutter)));
  padding: 12px 16px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--text) 90%, var(--bg));
  color: var(--bg);
  box-shadow: var(--shadow);
  font-size: var(--text-sm);
  font-weight: 600;
  text-align: center;
  transform: translateX(-50%);
  animation: toast-in var(--duration) var(--ease);
}

.toast[data-tone="error"] {
  background: var(--danger);
  color: var(--on-danger);
}

.toast[data-tone="success"] {
  background: var(--success);
  color: var(--on-success);
}

.toast[data-tone="warning"] {
  background: var(--warning);
  color: var(--on-warning);
}

.empty {
  display: grid;
  justify-items: center;
  gap: var(--space-3);
  padding: var(--space-6) var(--space-4);
  color: var(--muted);
  text-align: center;
}

.empty > .icon {
  color: var(--muted);
  opacity: 0.7;
}

/* Lists ------------------------------------------------------------------ */

.list {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.list-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  min-height: 60px;
  padding: var(--space-2);
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: inherit;
  text-align: left;
  transition: background-color var(--duration) var(--ease);
}

button.list-item:active,
label.list-item:active {
  background: var(--surface-2);
}

.list-item[aria-pressed="true"],
.list-item[aria-checked="true"],
.list-item.is-selected,
.list-item:has(> input:checked) {
  background: var(--accent-soft);
}

@media (hover: hover) {
  button.list-item:hover,
  label.list-item:hover {
    background: var(--surface);
  }
}

.list-item-text {
  display: grid;
  flex: 1 1 auto;
  min-width: 0;
  gap: 2px;
}

.list-item-title {
  overflow: hidden;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.list-item-meta {
  overflow: hidden;
  color: var(--muted);
  font-size: var(--text-sm);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.list-item-aside {
  flex: none;
  display: grid;
  justify-items: end;
  gap: 2px;
  color: var(--muted);
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
}

/* Cover art with a music-note placeholder underneath. */
.cover {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: var(--cover-size, 44px);
  height: var(--cover-size, 44px);
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--muted);
}

.cover > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cover-lg {
  --cover-size: 96px;
  border-radius: var(--radius);
}

/* Infinite-scroll sentinel: tall and pulled up so the next page loads early. */
.load-more {
  height: 480px;
  margin-top: -480px;
  pointer-events: none;
  visibility: hidden;
}

/* Feedback --------------------------------------------------------------- */

.spinner {
  display: inline-block;
  flex: none;
  width: 18px;
  height: 18px;
  border: 2px solid color-mix(in srgb, currentColor 25%, transparent);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.icon-spin {
  animation: spin 0.9s linear infinite;
}

.skeleton {
  display: block;
  min-height: 14px;
  border-radius: var(--radius-sm);
  background: linear-gradient(
      90deg,
      transparent,
      color-mix(in srgb, var(--text) 6%, transparent),
      transparent
    )
    var(--surface);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}

/* htmx.config.includeIndicatorStyles is off (CSP), so the indicator rules live here. */
.htmx-indicator {
  opacity: 0;
  transition: opacity 200ms ease-in;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  opacity: 1;
}

/* Dialogs: .sheet is a bottom sheet on phones and a centred panel on wide screens;
   .modal is a small centred dialog. Both are <dialog> opened with showModal(). */
.sheet,
.modal {
  width: 100%;
  max-width: 640px;
  /* Clear of whatever covers the top, like the panes (0 when nothing does). */
  max-height: calc(
    var(--app-height, 100dvh) - var(--space-5) - var(--safe-top)
  );
  padding: 0;
  border: 0;
  background: var(--bg);
  color: var(--text);
  box-shadow: var(--shadow);
}

.sheet[open],
.modal[open] {
  display: flex;
  flex-direction: column;
}

.sheet {
  margin: auto auto 0;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  animation: sheet-in 220ms var(--ease);
}

.modal {
  max-width: 420px;
  margin: auto;
  border-radius: var(--radius-lg);
  animation: modal-in var(--duration) var(--ease);
}

.sheet::backdrop,
.modal::backdrop {
  background: var(--overlay);
}

@media (min-width: 720px) {
  .sheet {
    margin: auto;
    border-radius: var(--radius-lg);
    animation-name: modal-in;
  }
}

.sheet-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 56px;
  padding: var(--space-2) var(--space-2) var(--space-2) var(--space-4);
  border-bottom: 1px solid var(--border);
}

.sheet-header h2 {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.sheet-header > .icon-btn:first-child {
  margin-left: calc(-1 * var(--space-2));
}

.sheet-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--space-4);
}

.sheet-footer {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4)
    calc(var(--space-3) + var(--safe-bottom));
  border-top: 1px solid var(--border);
}

.sheet-footer > .btn {
  flex: 1 1 0;
}

/* Feedback sits in the always-visible footer, next to the buttons that caused it. */
.sheet-footer > .status {
  flex: 1 0 100%;
}

/* A sheet's content (often a <form>) fills the dialog so only .sheet-body scrolls. */
.sheet-content {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
}

.sheet-loading,
.sheet-error {
  display: grid;
  justify-items: center;
  gap: var(--space-3);
  padding: var(--space-6) var(--space-4);
  color: var(--muted);
  text-align: center;
}

.checkbox {
  flex: none;
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.cover-picker {
  position: relative;
  flex: none;
  display: block;
  border-radius: var(--radius);
  cursor: pointer;
}

.cover-picker-badge {
  position: absolute;
  right: 4px;
  bottom: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgb(0 0 0 / 0.65);
  color: #fff;
  font-size: var(--text-xs);
  font-weight: 600;
}

.cover-picker:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.section-title {
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: 650;
}

.divider {
  height: 1px;
  margin: var(--space-2) 0;
  border: 0;
  background: var(--border);
}

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

@keyframes shimmer {
  from {
    background-position: 200% 0;
  }
  to {
    background-position: -200% 0;
  }
}

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

@keyframes modal-in {
  from {
    transform: scale(0.97);
    opacity: 0;
  }
}

@keyframes toast-in {
  from {
    transform: translate(-50%, 8px);
    opacity: 0;
  }
}

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

  .spinner,
  .icon-spin {
    animation: spin 2s linear infinite !important;
  }
}

/* Sign-in page ----------------------------------------------------------- */

.login-page {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: calc(var(--space-5) + var(--safe-top))
    calc(var(--gutter) + env(safe-area-inset-right, 0px))
    calc(var(--space-5) + env(safe-area-inset-bottom, 0px))
    calc(var(--gutter) + env(safe-area-inset-left, 0px));
}

.login {
  --gap: var(--space-4);
  width: min(100%, 380px);
  padding: var(--space-5);
}

.login-heading {
  --gap: var(--space-1);
}

.login-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--accent);
  color: var(--on-accent);
}
