* {
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
  scrollbar-width: thin;
}

*::-webkit-scrollbar {
  width: 11px;
  height: 11px;
}

*::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}

*::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border: 3px solid var(--scrollbar-track);
  border-radius: 999px;
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

body.modal-open {
  overflow: hidden;
}

.drawer-back {
  pointer-events: none;
}

.drawer-back.open {
  pointer-events: auto;
}

.drawer:not(.open) {
  pointer-events: none;
}

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

:where(button, a, input, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

input[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border-color: var(--blocker);
}

textarea,
.resize-none {
  resize: none;
}

button:active:not(:disabled),
.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn[aria-busy="true"]::after {
  content: "";
  width: 0.85em;
  height: 0.85em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: busy-spin 0.7s linear infinite;
}

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

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

.boot-card {
  width: min(420px, 100%);
  min-height: 210px;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 12px;
  padding: 32px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--panel-radius);
}

.boot-card h1 {
  margin: 8px 0 0;
  font-size: 20px;
}

.boot-card p {
  margin: 0;
}

.secret-field {
  position: relative;
  display: block;
  color: inherit;
  font-size: inherit;
  letter-spacing: normal;
  text-transform: none;
}

.secret-field input {
  min-height: 48px;
  padding-right: 92px;
  background: var(--control-bg);
  border-color: var(--line-strong);
}

.secret-toggle {
  position: absolute;
  top: 50%;
  right: 5px;
  min-height: 32px;
  transform: translateY(-50%);
  padding: 4px 8px;
  color: var(--accent-2);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
}

.secret-toggle:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--accent);
  background: var(--control-hover);
}

.theme-toggle {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding-inline: 11px;
}

.theme-toggle [data-theme-icon] {
  width: 1.1em;
  color: var(--accent-2);
  font-size: 15px;
  line-height: 1;
  text-align: center;
}

.login-theme {
  min-width: 132px;
  background: var(--control-bg);
  border-color: var(--line-strong);
  box-shadow: none;
}

.login-submit.btn.primary {
  background: #0a0d0c;
  border-color: #0a0d0c;
  color: #f5f8f6;
}

.login-submit.btn.primary:hover:not(:disabled) {
  background: #111614;
  border-color: #111614;
}

html[data-theme="dark"] .login-panel {
  background:
    radial-gradient(circle at 28% 18%, rgba(46, 230, 166, 0.16), transparent 36%),
    linear-gradient(180deg, #111614, #0a0d0c 78%);
}

html[data-theme="dark"] .login-card {
  border-color: rgba(46, 230, 166, 0.28);
}

html[data-theme="dark"] .login-submit.btn.primary {
  background: var(--brand-mint);
  border-color: var(--brand-mint);
  color: var(--brand-ink);
  box-shadow: 0 0 34px rgba(46, 230, 166, 0.18);
}

html[data-theme="dark"] .login-submit.btn.primary:hover:not(:disabled) {
  background: #63f0bf;
  border-color: #63f0bf;
  box-shadow: 0 0 42px rgba(46, 230, 166, 0.24);
}

.secret-toggle:active {
  transform: translateY(calc(-50% + 1px));
}

.icon {
  width: 32px;
  height: 32px;
}

.list li {
  position: relative;
  padding: 0;
  cursor: default;
}

.list li:hover {
  background: transparent;
}

.list li.on {
  background: var(--panel-2);
}

.row-select {
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  color: inherit;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
}

.row-select:hover {
  background: var(--panel-2);
}

.list li.on .row-select {
  background: var(--accent-soft);
}

.list li .del {
  width: 32px;
  min-height: 32px;
  flex: none;
  opacity: 0.62;
  border-radius: 7px;
}

.list li:hover .del,
.list li .del:focus-visible {
  opacity: 1;
}

.static-row {
  min-height: 34px;
  align-items: center;
  padding: 7px 9px !important;
}

.drawer-form {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.drop {
  cursor: default;
}

.thumb {
  padding: 0;
  color: inherit;
}

.thumb-wrap {
  position: relative;
  width: 118px;
  height: 84px;
}

.thumb-wrap .thumb {
  width: 100%;
  height: 100%;
}

.thumb-wrap .x {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 0;
  background: var(--photo-control);
  color: var(--white);
  cursor: pointer;
  line-height: 1;
  padding: 0;
}

.search-field {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  width: min(240px, 100%);
}

.toolbar #q {
  width: 100%;
  padding-right: 10px;
}

#q::-webkit-search-cancel-button {
  appearance: none;
}

.search-clear {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.search-clear:hover {
  color: var(--text);
  background: var(--panel);
}

.search-clear:active {
  transform: translateY(1px);
}

.issue-empty {
  grid-column: 1 / -1;
  min-height: 260px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  text-align: center;
}

.issue-empty h2,
.issue-empty p {
  margin: 0;
}

.card-title {
  min-width: 0;
  padding: 0;
  color: inherit;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
}

.card-actions button {
  min-width: 32px;
  min-height: 32px;
}

dialog.modal {
  width: min(460px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 0;
  overflow: auto;
  color: var(--text);
  background: transparent;
  border: 0;
}

dialog.modal::backdrop {
  background: var(--overlay);
  backdrop-filter: blur(2px);
}

.modal-card {
  display: grid;
  margin: 0;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--panel-radius);
  box-shadow: 0 22px 70px var(--shadow-heavy);
}

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

.modal-head h2 {
  flex: 1;
  margin: 0;
  font-size: 17px;
}

.modal-body {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.modal-body p {
  margin: 0;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px;
  background: var(--panel-2);
  border-top: 1px solid var(--line);
  border-radius: 0 0 var(--panel-radius) var(--panel-radius);
}

.normal-case {
  font-size: 12px;
  text-transform: none;
  letter-spacing: normal;
}

.btn.danger.solid {
  color: var(--danger-on);
  font-weight: 600;
  background: var(--danger-solid);
  border-color: var(--danger-solid);
}

.btn.danger.solid:hover:not(:disabled) {
  color: var(--danger-on);
  background: var(--danger-hover);
}

dialog.lightbox {
  inset: 0;
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 24px;
  color: var(--white);
  background: transparent;
  border: 0;
}

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

dialog.lightbox[open] {
  display: grid;
  place-items: center;
}

dialog.lightbox::backdrop {
  background: var(--overlay-strong);
}

.lightbox-close {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  z-index: 1;
  width: 40px;
  height: 40px;
  padding: 0;
  color: var(--white);
  background: var(--photo-control);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  cursor: pointer;
}

.toast[data-tone="error"] {
  border-color: var(--blocker);
}

.bulk-bar {
  min-height: 52px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 14px;
  padding: 8px 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 11px;
}

.bulk-select-all {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 7px;
  border-radius: 7px;
  cursor: pointer;
  user-select: none;
}

.bulk-select-all:hover {
  background: var(--panel-2);
}

.bulk-select-all input,
.card-check input {
  width: 18px;
  height: 18px;
  flex: none;
  margin: 0;
  padding: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.bulk-count {
  min-width: 88px;
  color: var(--accent-2);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.bulk-actions {
  flex: 1 0 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.bulk-action-group,
.bulk-top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.bulk-top-actions {
  margin-left: auto;
}

.bulk-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.bulk-status,
.bulk-severity,
.bulk-delete,
.bulk-clear {
  min-height: 36px;
  padding: 6px 12px;
  color: var(--text);
  background: var(--control-bg);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: none;
}

.bulk-status:hover:not(:disabled),
.bulk-severity:hover:not(:disabled),
.bulk-delete:hover:not(:disabled),
.bulk-clear:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--accent-2);
  background: var(--control-hover);
}

.bulk-status:active:not(:disabled),
.bulk-severity:active:not(:disabled),
.bulk-delete:active:not(:disabled),
.bulk-clear:active:not(:disabled) {
  background: var(--surface-pressed);
  box-shadow: none;
}

.bulk-status[data-bulk-status="open"] span {
  color: var(--major);
}

.bulk-status.success {
  color: var(--minor);
  border-color: var(--minor-border);
  background: var(--minor-soft);
}

.bulk-status.muted-action,
.bulk-clear {
  color: var(--text-soft);
}

.bulk-severity.sev-crap,
.card-cycle.sev-crap {
  color: var(--crap);
  border-color: var(--crap-border);
  background: var(--crap-soft);
}

.bulk-severity.sev-blocker,
.card-cycle.sev-blocker {
  color: var(--blocker);
  border-color: var(--blocker-border);
  background: var(--blocker-soft);
}

.bulk-severity.sev-major,
.card-cycle.sev-major {
  color: var(--major);
  border-color: var(--major-border);
  background: var(--major-soft);
}

.bulk-severity.sev-minor,
.card-cycle.sev-minor {
  color: var(--minor);
  border-color: var(--minor-border);
  background: var(--minor-soft);
}

.bulk-severity.sev-idea,
.card-cycle.sev-idea {
  color: var(--idea);
  border-color: var(--idea-border);
  background: var(--idea-soft);
}

.bulk-delete {
  color: var(--blocker);
  border-color: var(--blocker-border);
  background: var(--blocker-soft);
}

.bulk-delete:hover:not(:disabled) {
  color: var(--blocker);
  border-color: var(--blocker);
  background: var(--blocker-soft-strong);
}

.bulk-status:disabled,
.bulk-severity:disabled,
.bulk-delete:disabled,
.bulk-clear:disabled,
.bulk-select-all:has(input:disabled) {
  opacity: 0.36;
  cursor: default;
  box-shadow: none;
}

.bulk-error {
  flex: 1 0 100%;
  color: var(--blocker);
  font-size: 12px;
}

.bulk-error:empty {
  display: none;
}

.card {
  position: relative;
  cursor: pointer;
  transition: border-color 120ms ease, background-color 120ms ease, box-shadow 120ms ease;
}

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

.card.selected {
  background: var(--card-selected);
  box-shadow: 0 0 0 2px var(--accent) inset;
}

.card.done {
  opacity: 1;
}

.card.done .card-title,
.card.done .card-text,
.card.done .thumbs {
  opacity: 0.58;
}

.card .thumbs {
  flex: 0 0 auto;
  max-height: 146px;
  overflow: hidden;
}

.card .thumb {
  flex: 0 0 auto;
}

.card .thumb:nth-child(n + 7) {
  display: none;
}

.card-open-hit {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: inherit;
  cursor: pointer;
}

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

.card > :not(.card-open-hit) {
  position: relative;
  z-index: 2;
  pointer-events: none;
}

.card :is(button:not(.card-open-hit), input, select, label, a) {
  position: relative;
  z-index: 3;
  pointer-events: auto;
}

h3.card-title {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
}

.card-check {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  flex: none;
  margin: -6px -3px -5px -5px;
  border-radius: 7px;
  cursor: pointer;
}

.card-check:hover {
  background: var(--panel-2);
}

.card-actions {
  align-items: center;
}

.card-actions button {
  width: 32px;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  background: var(--control-bg);
  border: 1px solid var(--line-strong);
}

.card-actions button:hover {
  color: var(--blocker);
  border-color: var(--blocker-border);
  background: var(--blocker-soft);
}

.card-cycle {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 10px;
  color: var(--text-soft);
  background: var(--control-bg);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 650;
  box-shadow: none;
}

.card-cycle:hover:not(:disabled) {
  color: var(--text);
  border-color: currentColor;
  background: var(--control-hover);
  box-shadow: 0 0 0 1px currentColor;
}

.card-cycle:active:not(:disabled) {
  background: var(--surface-pressed);
  box-shadow: none;
}

.card-cycle:disabled {
  opacity: 0.45;
  cursor: default;
}

.card-cycle.st-open {
  color: var(--major);
  border-color: var(--major-border);
  background: var(--major-soft);
}

.card-cycle.st-fixed {
  color: var(--minor);
  border-color: var(--minor-border);
  background: var(--minor-soft);
}

.card-cycle.st-wontfix {
  color: var(--muted);
}

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

@media (max-width: 720px) {
  .login {
    grid-template-columns: 1fr;
    min-height: 100%;
  }

  .login-brand {
    min-height: 260px;
    padding: 24px 20px 26px;
  }

  .login-pattern {
    right: -24px;
    top: 24px;
    width: 220px;
  }

  .login-brand-copy {
    padding-top: 52px;
  }

  .login-brand h1 {
    font-size: clamp(46px, 16vw, 72px);
  }

  .login-brand-copy p:not(.login-kicker) {
    font-size: 15px;
  }

  .login-lines {
    width: 118px;
    margin-top: 20px;
  }

  .login-panel {
    min-height: auto;
    padding: 18px 20px 32px;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .login-theme-row {
    justify-content: flex-start;
  }

  .login-card {
    justify-self: stretch;
    padding-block: 24px 0;
  }

  .login-card h2 {
    font-size: 38px;
  }

  .toolbar {
    align-items: stretch;
  }

  .topbar .theme-toggle {
    width: 38px;
    padding: 0;
  }

  .topbar .theme-toggle [data-theme-label] {
    display: none;
  }

  .search-field {
    width: 100%;
  }

  .chips {
    max-width: 100%;
    overflow-x: auto;
    padding: 2px;
  }

  .bulk-bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .bulk-select-all {
    min-width: 0;
  }

  .bulk-count {
    justify-self: end;
  }

  .bulk-actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    margin-left: 0;
    padding-top: 8px;
  }

  .bulk-action-group {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .bulk-action-group .bulk-label {
    grid-column: 1 / -1;
  }

  .bulk-status,
  .bulk-severity {
    min-width: 0;
    padding-inline: 7px;
  }

  .bulk-top-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }

  .bulk-error {
    grid-column: 1 / -1;
  }

  .issues {
    grid-template-columns: 1fr;
    grid-auto-rows: 320px;
  }

  .card {
    min-height: 0;
    height: 100%;
  }

  .card-text {
    max-height: 92px;
  }

  .card-text.scroll {
    max-height: 108px;
  }

  .card .thumbs {
    max-height: 68px;
  }

  .card .thumb:nth-child(n + 4) {
    display: none;
  }

  .drawer {
    width: 100vw;
  }

  dialog.modal {
    width: min(100vw - 20px, 460px);
    max-height: calc(100dvh - 20px);
  }

  .modal-foot {
    flex-wrap: wrap;
  }
}

@media (max-width: 390px) {
  .login-brand,
  .login-panel {
    padding-inline: 16px;
  }

  .login-brand h1,
  .login-card h2 {
    letter-spacing: 0.035em;
  }

  .secret-field input {
    padding-right: 84px;
  }

  .secret-toggle {
    right: 4px;
    padding-inline: 6px;
    font-size: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important; /* Accessibility override: motion must stop globally. */
    animation-duration: 0.01ms !important; /* Accessibility override: preserve state without visible animation. */
    animation-iteration-count: 1 !important; /* Accessibility override. */
    transition-duration: 0.01ms !important; /* Accessibility override. */
  }
}

@media (forced-colors: active) {
  * {
    scrollbar-color: auto;
  }

  .dot {
    box-shadow: none;
  }

  :where(button, a, input, textarea, [tabindex]):focus-visible {
    outline-color: Highlight;
  }
}
