.btn {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 15px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-12);
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease, color 150ms ease;
}

.btn:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn.primary {
  color: var(--paper);
  background: var(--ink);
  border-color: var(--ink);
}

.btn.primary:hover {
  /* Наведение уводит подложку ДАЛЬШЕ от текста, а не в фиксированный
     тёмный: в тёмной теме «чернила» светлые, и жёсткий тёмный гасил надпись. */
  background: color-mix(in srgb, var(--ink) 88%, var(--muted));
}

.btn.accent {
  color: white;
  background: var(--accent);
  border-color: var(--accent);
}

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

.btn.ghost {
  background: transparent;
  box-shadow: none;
}

.btn.soft {
  color: var(--accent-dark);
  background: var(--accent-soft);
  border-color: transparent;
}

.btn.small {
  min-height: 34px;
  padding: 0 11px;
  font-size: 12px;
}

.btn.icon-only {
  width: 40px;
  padding: 0;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: .42;
}

.icon-btn {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  /* Браузерный padding кнопки (1px 6px) остаётся, если его не снять: у мелкой
     кнопки поле содержимого выходит УЖЕ иконки, и grid перестаёт её
     центрировать — иконка липнет к левому краю. На кнопке 28px это давало 7px
     слева против 3px справа. */
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-8);
  transition: color 150ms ease, background 150ms ease, border-color 150ms ease;
}

.icon-btn:hover {
  color: var(--ink);
  background: color-mix(in srgb, var(--surface) 62%, transparent);
  border-color: var(--line);
}

.view-close {
  /* The shell workbench is the containing block. Keeping the control outside
   * the route scroller makes it persistent while normal-flow alerts stay above. */
  position: absolute;
  z-index: 16;
  top: max(16px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  width: 40px;
  height: 40px;
  color: var(--ink-2);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border-color: var(--line);
  backdrop-filter: blur(14px);
}

.view-close:hover,
.view-close:focus-visible {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line-strong);
  outline: 0;
}

button.panel-collapse-button[data-panel-side] {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-8);
  transition:
    color 140ms ease,
    background 140ms ease,
    border-color 140ms ease;
}

button.panel-collapse-button[data-panel-side]:hover,
button.panel-collapse-button[data-panel-side]:focus-visible {
  color: var(--ink);
  background: var(--paper);
  border-color: var(--line-strong);
}

button.panel-collapse-button[data-panel-side] .icon {
  width: 14px;
  height: 14px;
  transition: transform 180ms cubic-bezier(.2, .8, .2, 1);
}

button.panel-collapse-button[data-panel-side="left"][data-collapsed="false"] .icon,
button.panel-collapse-button[data-panel-side="right"][data-collapsed="true"] .icon {
  transform: rotate(180deg);
}

button.panel-collapse-button[data-panel-side="left"][data-collapsed="true"] .icon,
button.panel-collapse-button[data-panel-side="right"][data-collapsed="false"] .icon {
  transform: rotate(0);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.chip {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  color: var(--muted);
  background: color-mix(in srgb, var(--surface) 42%, transparent);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  font-size: 11px;
  white-space: nowrap;
}

.chip.active,
button.chip:hover {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line-strong);
}

.chip.accent {
  color: var(--accent-dark);
  background: var(--accent-soft);
  border-color: transparent;
}

.chip.success {
  color: var(--success);
  background: var(--success-soft);
  border-color: transparent;
}

.tag {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  padding: 0 7px;
  color: var(--muted);
  background: color-mix(in srgb, var(--surface) 68%, transparent);
  border: 1px solid rgba(25, 25, 25, .09);
  border-radius: var(--radius-8);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.select {
  min-height: 38px;
  padding: 0 34px 0 12px;
  color: var(--ink);
  background-color: color-mix(in srgb, var(--surface) 58%, transparent);
  border: 1px solid var(--line);
  border-radius: var(--radius-8);
  outline: none;
}

.select:hover,
.select:focus {
  background-color: var(--surface);
  border-color: var(--line-strong);
}

.search-field {
  position: relative;
  display: flex;
  align-items: center;
}

.search-field > .icon {
  position: absolute;
  left: 13px;
  color: var(--muted);
  pointer-events: none;
}

.search-field input {
  width: 100%;
  height: 42px;
  padding: 0 14px 0 40px;
  background: color-mix(in srgb, var(--surface) 52%, transparent);
  border: 1px solid var(--line);
  border-radius: var(--radius-12);
  outline: none;
}

.search-field input:focus {
  background: var(--surface);
  border-color: var(--line-strong);
}

.field label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 40px;
  padding: 9px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-8);
  outline: 0;
}

.field textarea {
  min-height: 210px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  line-height: 1.55;
}

.divider {
  height: 1px;
  margin: 24px 0;
  background: var(--line);
}

.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  color: var(--muted);
  background: color-mix(in srgb, var(--surface) 55%, transparent);
  border: 1px solid var(--line);
  border-radius: var(--radius-12);
  font-size: 12px;
}

.notice.accent {
  color: var(--accent-dark);
  background: var(--accent-soft);
  border-color: transparent;
}

.notice.success {
  color: var(--success);
  background: var(--success-soft);
  border-color: transparent;
}

.panel {
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  border: 1px solid var(--line);
  border-radius: var(--radius-12);
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.panel-head strong {
  font-size: 13px;
}

.panel-body {
  padding: 20px;
}

.avatar {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: white;
  background: var(--accent);
  border-radius: 50%;
  font-size: 10px;
  font-weight: 750;
}

.avatar.has-photo {
  background-position: center;
  background-size: cover;
}

.avatar.alt {
  background: #395466;
}

.avatar.gold {
  background: #b27b28;
}

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  border: 1.5px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: primitive-spin .8s linear infinite;
}

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

.toggle {
  position: relative;
  width: 40px;
  height: 23px;
  margin-left: auto;
  padding: 0;
  background: var(--surface-2);
  border-radius: var(--radius-pill);
}

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation-duration: 1.8s;
  }
}

.toggle::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 17px;
  height: 17px;
  background: white;
  border-radius: 50%;
  content: "";
  transition: transform 180ms ease, background 180ms ease;
}

.mode-switch {
  --corner-outer: var(--radius-12);
  --corner-gap: var(--radius-4);
  display: inline-flex;
  padding: 4px;
  background: color-mix(in srgb, var(--surface) 54%, transparent);
  border: 1px solid var(--line);
}

.mode-switch button {
  min-height: 32px;
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
  font-size: 11px;
}

.mode-switch button.active {
  color: var(--paper);
  background: var(--ink);
}

.toggle.on {
  background: var(--success);
}

.toggle.on::after {
  transform: translateX(17px);
}

.table-scroll {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 13px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.data-table th {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.data-table td {
  font-size: 12px;
}

.data-table tr:hover td {
  background: color-mix(in srgb, var(--surface) 45%, transparent);
}

.modal-backdrop {
  position: fixed;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(25, 25, 25,.54);
  backdrop-filter: blur(8px);
  animation: fade-in 160ms ease both;
  inset: 0;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

.modal-sheet {
  --corner-outer: var(--radius-24);
  --corner-gap: var(--radius-8);
  width: min(760px, 100%);
  max-height: min(760px, calc(100svh - 40px));
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--surface) 50%, transparent);
  overflow: auto;
  animation: modal-in 280ms cubic-bezier(.2,.8,.2,1) both;
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(18px) scale(.98);
  }
}

.modal-head {
  position: sticky;
  z-index: 2;
  top: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.modal-head strong {
  font-size: 15px;
}

.modal-head .icon-btn {
  margin-left: auto;
}

.modal-body {
  padding: 20px;
}

.profile-popover {
  --corner-outer: var(--radius-16);
  --corner-gap: var(--radius-8);
  position: fixed;
  z-index: 90;
  bottom: 14px;
  left: calc(var(--rail-w) + 12px);
  width: 300px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  animation: modal-in 220ms ease both;
}

.profile-status {
  display: flex;
  min-height: 54px;
  align-items: center;
  gap: 11px;
  margin: 8px 0 4px;
  padding: 8px 9px;
  color: var(--ink-2);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-8);
}

.profile-status > .icon {
  width: 17px;
  height: 17px;
  color: var(--accent);
}

.profile-status span {
  display: grid;
  gap: 2px;
}

.profile-status small {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.profile-status strong {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.profile-status.warning {
  color: var(--warning);
  background: var(--warning-soft);
  border-color: color-mix(in srgb, var(--warning) 28%, var(--line));
}

.profile-theme-quick {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 5px 0;
  padding: 5px 7px 5px 9px;
}

.profile-theme-quick-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 680;
  letter-spacing: .02em;
}

.profile-theme-quick-controls {
  display: flex;
  gap: 3px;
  padding: 3px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-12);
}

.profile-theme-quick-controls .icon-btn {
  width: 30px;
  height: 30px;
  color: var(--muted);
  border-color: transparent;
  border-radius: var(--radius-8);
}

.profile-theme-quick-controls .icon-btn:hover {
  color: var(--ink);
  background: var(--surface-2);
}

.profile-theme-quick-controls .icon-btn.active {
  color: var(--accent-dark);
  background: var(--surface);
  border-color: var(--line);
}

.profile-head {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 7px 7px 14px;
  border-bottom: 1px solid var(--line);
}

.profile-head strong {
  display: block;
}

.profile-head small {
  display: block;
  color: var(--muted);
  font-size: 10px;
}

.profile-item {
  display: flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  gap: 10px;
  padding: 0 9px;
  color: inherit;
  background: transparent;
  border-radius: var(--radius-8);
  text-align: left;
  text-decoration: none;
}

.profile-item:hover {
  background: var(--paper);
}

.ui-tooltip {
  position: fixed;
  z-index: 150;
  width: max-content;
  max-width: min(240px, calc(100vw - 16px));
  padding: 5px 7px;
  color: var(--surface);
  background: color-mix(in srgb, var(--ink) 92%, transparent);
  border: 1px solid color-mix(in srgb, var(--surface) 12%, transparent);
  border-radius: var(--radius-4);
  font-size: 10px;
  font-weight: 620;
  line-height: 1.25;
  pointer-events: none;
  animation: tooltip-in 90ms ease both;
}

@keyframes tooltip-in {
  from { opacity: 0; transform: translateY(2px); }
  to { opacity: .96; transform: translateY(0); }
}

.notification-popover {
  --corner-outer: var(--radius-16);
  --corner-gap: var(--radius-8);
  position: fixed;
  z-index: 90;
  bottom: 14px;
  left: calc(var(--rail-w) + 12px);
  width: min(390px, calc(100vw - var(--rail-w) - 32px));
  max-height: min(680px, calc(100svh - 28px));
  background: var(--surface);
  border: 1px solid var(--line);
  animation: modal-in 220ms ease both;
  overflow: hidden;
}

.notification-inbox {
  display: grid;
  max-height: inherit;
  grid-template-rows: auto minmax(0, 1fr);
}

.notification-inbox-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.notification-inbox-head > div:first-child {
  display: grid;
  gap: 4px;
}

.notification-inbox-head strong {
  font-size: 17px;
}

.notification-inbox-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.notification-inbox-actions .text-btn {
  color: var(--muted);
  font-size: 10px;
}

.notification-inbox-list {
  min-height: 0;
  padding: 8px;
  overflow-y: auto;
}

.notification-row {
  display: grid;
  width: 100%;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  color: var(--ink-2);
  border-radius: var(--radius-8);
  text-align: left;
  text-decoration: none;
}

.notification-row:hover,
.notification-row:focus-visible {
  background: var(--paper);
}

.notification-row.read {
  opacity: .62;
}

.notification-marker {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  color: var(--accent-dark);
  background: var(--accent-soft);
  border-radius: var(--radius-8);
}

.notification-row.success .notification-marker {
  color: var(--success);
  background: var(--success-soft);
}

.notification-row.error .notification-marker,
.notification-row.critical .notification-marker {
  color: var(--danger-ink);
  background: color-mix(in srgb, var(--danger-ink) 12%, transparent);
}

.notification-row.system .notification-marker {
  color: var(--warning);
  background: var(--warning-soft);
}

.notification-marker .icon,
.notification-row > .icon {
  width: 15px;
  height: 15px;
}

.notification-row > .icon {
  color: var(--muted-2);
}

.notification-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.notification-copy strong,
.notification-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
}

.notification-copy strong {
  font-size: 11px;
  white-space: nowrap;
}

.notification-copy small {
  color: var(--muted);
  font-size: 9px;
  line-height: 1.4;
}

.notification-inbox-empty {
  display: grid;
  place-items: center;
  padding: 42px 22px;
  color: var(--muted);
  text-align: center;
}

.notification-inbox-empty > .icon {
  width: 24px;
  height: 24px;
  margin-bottom: 10px;
  color: var(--success);
}

.notification-inbox-empty strong {
  color: var(--ink-2);
  font-size: 12px;
}

.notification-inbox-empty p {
  max-width: 260px;
  margin: 7px 0 0;
  font-size: 10px;
  line-height: 1.5;
}

.toast {
  position: fixed;
  z-index: 200;
  right: 24px;
  bottom: 24px;
  max-width: min(360px, calc(100vw - 48px));
  padding: 12px 15px;
  color: var(--paper);
  background: var(--ink);
  border: 1px solid color-mix(in srgb, var(--surface) 12%, transparent);
  border-radius: var(--radius-12);
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.has-action {
  display: flex;
  align-items: center;
  gap: 14px;
  pointer-events: auto;
}

.toast-copy {
  min-width: 0;
  flex: 1;
}

.toast-action {
  flex: 0 0 auto;
  padding: 4px 0;
  color: inherit;
  border-bottom: 1px solid currentColor;
  font: inherit;
  font-weight: 800;
}

.toast.cursor-toast {
  right: auto;
  bottom: auto;
  width: max-content;
  max-width: min(280px, calc(100vw - 24px));
  pointer-events: none;
  transform: translate(-50%, 8px);
}

.toast.cursor-toast.show {
  transform: translate(-50%, 0);
}

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

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

.toast[data-kind="error"] {
  background: var(--accent-dark);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

body.ui-overlay-open {
  overflow: hidden;
}

.author-bio-sheet {
  width: min(620px, calc(100vw - 32px));
}

.author-bio {
  display: grid;
  gap: 18px;
  padding: clamp(24px, 4vw, 42px);
}

.author-bio h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(32px, 5vw, 58px);
  font-weight: 500;
  line-height: .96;
}

.author-bio h2 a {
  color: inherit;
  text-decoration: none;
}

.author-bio h2 a:hover,
.author-bio h2 a:focus-visible,
.author-bio-copy a {
  color: var(--accent);
}

.author-bio-copy {
  display: grid;
  gap: 12px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}

.author-bio-copy p {
  margin: 0;
}

.author-bio-copy a {
  text-underline-offset: 3px;
}

.author-bio .btn {
  justify-self: start;
}

.download-dialog-sheet {
  width: min(720px, calc(100vw - 32px));
}

.download-dialog {
  display: grid;
  gap: 22px;
  padding: clamp(22px, 4vw, 38px);
}

.download-dialog > header {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 6px 18px;
}

.download-dialog > header .eyebrow {
  grid-column: 1;
}

.download-dialog > header h2 {
  grid-column: 1;
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(28px, 5vw, 46px);
  font-weight: 500;
  line-height: 1;
}

.download-dialog > header .icon-btn {
  grid-row: 1 / 3;
  grid-column: 2;
}

.download-variants {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.download-variant {
  display: grid;
  min-width: 0;
  min-height: 154px;
  align-content: end;
  gap: 5px;
  padding: 18px;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-12);
  text-align: left;
  transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
}

.download-variant:hover:not(:disabled),
.download-variant:focus-visible {
  background: var(--paper);
  border-color: var(--line-strong);
  transform: translateY(-2px);
}

.download-variant:disabled {
  opacity: .46;
}

.download-variant > span {
  margin-bottom: auto;
  color: var(--accent);
}

.download-variant > span svg {
  width: 25px;
  height: 25px;
}

.download-variant strong,
.download-variant small {
  display: block;
}

.download-variant strong {
  font-size: 13px;
}

.download-variant small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.download-progress {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px 10px;
  padding: 12px 14px;
  background: var(--paper);
  border-radius: var(--radius-12);
}

.download-progress > span {
  width: 11px;
  height: 11px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: ui-spin 800ms linear infinite;
}

.download-progress > strong {
  font-size: 11px;
}

.download-progress > i {
  grid-column: 1 / -1;
  height: 3px;
  overflow: hidden;
  background: var(--line);
  border-radius: var(--radius-4);
}

.download-progress > i b {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width 160ms ease;
}

.download-progress > i.indeterminate b {
  width: 34% !important;
  animation: download-indeterminate 1.2s ease-in-out infinite;
}

.download-progress.error {
  color: var(--accent);
}

@keyframes download-indeterminate {
  from { transform: translateX(-110%); }
  to { transform: translateX(310%); }
}

.upload-dialog-sheet {
  width: min(620px, calc(100vw - 32px));
}

.upload-dialog {
  display: grid;
  gap: 16px;
  padding: clamp(22px, 4vw, 38px);
}

.upload-dialog > header {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 6px 18px;
}

.upload-dialog > header > :not(.icon-btn) {
  grid-column: 1;
}

.upload-dialog > header h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(26px, 4.4vw, 40px);
  font-weight: 500;
  line-height: 1;
}

.upload-dialog > header .icon-btn {
  grid-row: 1 / -1;
  grid-column: 2;
}

.upload-dropzone {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 34px 22px;
  color: inherit;
  background: var(--paper);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-16);
  text-align: center;
  transition: border-color 160ms ease, background 160ms ease;
}

/* Подсветка зоны считается счётчиком вложенности в bindFileDrop, но dragleave
   с потомков до него доходить и не должен: потомки для мыши прозрачны. */
.upload-dropzone > * {
  pointer-events: none;
}

.upload-dropzone:hover:not(:disabled),
.upload-dropzone:focus-visible {
  background: var(--surface);
  border-color: var(--ink);
}

.upload-dropzone:disabled {
  opacity: .46;
}

.upload-dropzone > span {
  color: var(--accent);
}

.upload-dropzone > span svg {
  width: 26px;
  height: 26px;
}

.upload-dropzone strong {
  font-size: 14px;
}

.upload-dropzone small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.upload-dialog.is-drop .upload-dropzone {
  background: var(--accent-soft);
  border-style: solid;
  border-color: var(--accent);
}

.upload-note,
.upload-failure {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
}

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

.upload-failure {
  color: var(--danger-ink);
}

.upload-files {
  display: grid;
  gap: 6px;
  max-height: 270px;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.upload-files li {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 5px 6px;
  background: var(--paper);
  border-radius: var(--radius-8);
}

.upload-file-thumb {
  width: 34px;
  height: 34px;
  color: var(--muted);
  background: var(--surface-2);
  border-radius: var(--radius-4);
  object-fit: cover;
}

span.upload-file-thumb {
  display: grid;
  place-items: center;
}

.upload-file-thumb svg {
  width: 16px;
  height: 16px;
}

.upload-files strong {
  overflow: hidden;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.upload-files small {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.upload-progress {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  background: var(--paper);
  border-radius: var(--radius-12);
}

.upload-progress > strong {
  font-size: 11px;
}

.upload-progress > i {
  height: 3px;
  overflow: hidden;
  background: var(--line);
  border-radius: var(--radius-4);
}

.upload-progress > i b {
  display: block;
  width: 34%;
  height: 100%;
  background: var(--accent);
  animation: upload-indeterminate 1.2s ease-in-out infinite;
}

/* Известная доля отправленного показывается шириной: бегущая полоса рядом с
   «40 из 120» противоречила бы числу. */
.upload-progress.is-measured > i b {
  width: 0;
  animation: none;
  transition: width 180ms ease;
}

@keyframes upload-indeterminate {
  from { transform: translateX(-110%); }
  to { transform: translateX(310%); }
}

.upload-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.upload-actions .btn {
  min-width: 128px;
  justify-content: center;
}

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

@media (max-width: 620px) {
  .download-variants {
    grid-template-columns: 1fr;
  }

  .download-variant {
    min-height: 104px;
  }

  .upload-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .upload-actions .btn {
    min-width: 0;
  }
}
