:root {
  color-scheme: dark;
  --bg: #313338;
  --rail: #1e1f22;
  --sidebar: #2b2d31;
  --panel: #383a40;
  --panel-soft: #34363c;
  --panel-deep: #232428;
  --border: #1f2024;
  --text: #f2f3f5;
  --muted: #b5bac1;
  --faint: #80848e;
  --accent: #5865f2;
  --accent-hover: #4752c4;
  --danger: #da373c;
  --ok: #23a559;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

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

button,
select,
input {
  border: 0;
  border-radius: 4px;
}

button {
  min-height: 36px;
  padding: 0 12px;
  background: #4e5058;
  color: var(--text);
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

button:hover {
  background: #5b5d66;
}

button.primary {
  background: var(--accent);
}

button.primary:hover {
  background: var(--accent-hover);
}

button:disabled,
select:disabled,
input:disabled {
  cursor: wait;
  opacity: .65;
}

input,
select {
  width: 100%;
  min-height: 38px;
  padding: 0 10px;
  background: #1e1f22;
  color: var(--text);
  outline: 1px solid transparent;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--accent);
}

label {
  display: block;
  margin: 12px 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.app-shell {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  min-height: 100vh;
}

.server-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  background: var(--rail);
}

.server-badge,
.rail-button {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 16px;
}

.server-badge {
  background: var(--accent);
  color: white;
  font-weight: 900;
}

.rail-button {
  padding: 0;
  font-size: 18px;
}

.class-switcher {
  display: grid;
  gap: 8px;
}

.class-button {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 900;
}

.class-button.available {
  color: var(--text);
}

.class-button.active {
  background: var(--accent);
  color: #fff;
}

.class-button:disabled {
  opacity: .45;
}

.topbar h2,
.brand-mark,
.pane-head h3 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h2 {
  font-size: 20px;
}

.brand-mark {
  margin: 0;
  color: #8ea1e1;
  font-size: 32px;
  font-weight: 900;
  line-height: 1;
}

.pane-head h3 {
  max-width: 100%;
  overflow: hidden;
  color: var(--text);
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pane-head h3.selected-title {
  display: inline-block;
  max-width: 100%;
  padding: 3px 8px;
  background: var(--accent);
  border-radius: 4px;
  color: #fff;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--faint);
  font-size: 12px;
  font-weight: 800;
  overflow-wrap: anywhere;
  text-transform: uppercase;
}

.state-pill {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 5px 8px;
  background: var(--danger);
  color: white;
  font-size: 11px;
  font-weight: 800;
}

.state-pill.saved {
  background: var(--ok);
}

.character-state {
  background: var(--panel-soft);
  color: var(--muted);
}

.character-state.selected {
  background: var(--accent);
  color: #fff;
}

.bungie-live-state {
  align-self: center;
  min-height: 0;
  border: 0;
  background: #4e5058;
  cursor: default;
  white-space: nowrap;
}

.bungie-live-state.connected {
  background: var(--ok);
}

.bungie-live-state.disconnected {
  background: var(--danger);
  cursor: pointer;
}

.bungie-live-state.disconnected:hover,
.bungie-live-state.disconnected:focus-visible {
  background: #f04747;
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.home-button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
  background: #4e5058;
  border-radius: 4px;
  color: var(--text);
  font-weight: 700;
}

.home-button:hover {
  background: #5b5d66;
}

.settings-card,
.profile-card {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding: 16px;
  background: linear-gradient(180deg, #3a3c43 0%, var(--panel-soft) 100%);
  border: 1px solid #202126;
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, .18), inset 0 1px 0 rgba(255, 255, 255, .04);
}

.message-box {
  padding: 12px;
  background: rgba(218, 55, 60, .14);
  border: 1px solid rgba(218, 55, 60, .45);
  border-radius: 6px;
  color: #ffd9dc;
  font-size: 13px;
  line-height: 1.4;
}

.global-message {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  max-width: min(520px, calc(100vw - 36px));
  box-shadow: 0 14px 42px rgba(0, 0, 0, .35);
}

.message-box.ok {
  background: rgba(35, 165, 89, .14);
  border-color: rgba(35, 165, 89, .45);
  color: #d7ffe7;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.state-dot {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 4px 7px;
  background: #4e5058;
  color: var(--muted);
  font-size: 10px;
  text-transform: none;
}

.state-dot.connected {
  background: var(--ok);
  color: white;
}

.secret-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  gap: 8px;
}

.icon-button {
  min-height: 38px;
  padding: 0;
}

.button-row,
.actions,
.compact-actions {
  display: flex;
  gap: 8px;
}

.button-row {
  margin-top: 10px;
}

.file-row {
  margin-top: 8px;
}

.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.file-label {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  margin: 0;
  padding: 0 10px;
  background: #4e5058;
  border-radius: 4px;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  text-transform: none;
  cursor: pointer;
}

.file-label:hover {
  background: #5b5d66;
}

.channel {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: auto;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 4px;
  color: var(--muted);
  background: transparent;
  text-align: center;
  white-space: nowrap;
}

.channel:hover,
.channel.active {
  background: #404249;
  color: var(--text);
}

.channel.active {
  box-shadow: inset 0 -2px 0 var(--accent);
  color: #fff;
  font-weight: 700;
}

.workspace {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  height: 100vh;
  min-height: 0;
  overflow: hidden;
}

.settings-workspace {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  height: 100vh;
  min-height: 0;
  overflow: hidden;
  background: var(--bg);
}

.workspace[hidden],
.settings-workspace[hidden] {
  display: none;
}

.topbar {
  display: grid;
  grid-template-rows: auto auto;
  gap: 10px;
  padding: 10px 18px 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.topbar-main,
.source-toolbar {
  display: grid;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.topbar-main {
  grid-template-columns: minmax(0, 1fr) auto;
}

.source-toolbar {
  grid-template-columns: minmax(190px, auto) minmax(0, 1fr) auto;
}

.topbar-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.topbar-status {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.topbar-title .eyebrow {
  margin: 0;
}

.source-tabs {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  min-width: 0;
  overflow-x: auto;
  padding: 2px;
  background: #2b2d31;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.source-toolbar .source-tabs {
  grid-column: 1 / 3;
}

.primary-actions,
.source-actions {
  justify-content: flex-end;
  min-width: 0;
}

.source-actions button,
.primary-actions button,
.primary-actions .home-button {
  min-height: 34px;
}

.source-actions button {
  padding: 0 10px;
}

.source-actions .clear-filters {
  background: var(--danger);
}

.source-actions #copyFilteredResults {
  background: var(--ok);
}

.source-actions #copyFilteredResults:hover {
  background: #1a8f4c;
}

.source-actions .clear-filters:hover {
  background: #f04747;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  gap: 12px;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  padding: 12px;
}

.left-stack {
  display: grid;
  grid-template-rows: minmax(220px, 1fr) minmax(260px, .9fr);
  gap: 12px;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.content-grid.compare-mode .left-stack {
  grid-template-rows: minmax(180px, .9fr) minmax(230px, .8fr) minmax(220px, .9fr);
}

.settings-page {
  min-height: 0;
  overflow: auto;
  padding: 18px;
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 680px);
  justify-content: center;
  gap: 16px;
  align-items: stretch;
  align-content: start;
  width: 100%;
}

.connection-card {
  gap: 18px;
}

.connection-intro {
  padding: 16px;
  background: var(--panel-deep);
  border-radius: 6px;
}

.connection-intro p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.config-file-row {
  margin: 0;
}

.config-upload {
  min-height: 52px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 800;
}

.config-upload:hover,
.config-upload:focus-visible {
  background: var(--accent-hover);
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.settings-grid .profile-card {
  grid-column: auto;
  max-width: none;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgb(0 0 0 / 58%);
}

.modal-backdrop[hidden] {
  display: none;
}

.context-menu {
  position: fixed;
  z-index: 40;
  display: grid;
  gap: 4px;
  width: 220px;
  padding: 6px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 18px 50px rgb(0 0 0 / 42%);
}

.context-menu[hidden] {
  display: none;
}

.context-menu button {
  justify-content: flex-start;
  width: 100%;
  min-height: 34px;
  padding: 0 10px;
  text-align: left;
}

.modal-panel {
  display: grid;
  grid-template-rows: auto minmax(0, auto) minmax(0, 1fr);
  gap: 14px;
  width: min(920px, 100%);
  max-height: min(880px, calc(100vh - 48px));
  overflow: hidden;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 18px 60px rgb(0 0 0 / 42%);
}

.filter-modal-panel {
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  width: min(980px, 100%);
}

.filter-help {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.filter-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 8px;
  min-width: 0;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel-deep);
}

.filter-group legend {
  padding: 0 5px;
  color: var(--text);
  font-weight: 800;
}

.filter-option {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  margin: 0;
  padding: 6px 10px;
  border-radius: 999px;
  background: #404249;
  color: var(--muted);
  cursor: pointer;
  text-transform: none;
}

.filter-option:has(input:checked) {
  background: var(--accent);
  color: #fff;
}

.filter-option input {
  width: 16px;
  min-height: 16px;
  margin: 0;
  accent-color: var(--accent);
}

.filter-empty {
  color: var(--faint);
  font-size: 13px;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
}

.modal-head h2 {
  margin: 0;
  font-size: 22px;
}

.analysis-form,
.analysis-result {
  min-height: 0;
  overflow: auto;
}

.form-grid {
  display: grid;
  grid-template-columns: minmax(145px, .42fr) minmax(0, 1fr);
  gap: 10px 20px;
  align-items: center;
  margin-bottom: 14px;
}

.form-grid label {
  margin: 0;
}

.analysis-form textarea,
.analysis-result textarea {
  width: 100%;
  min-height: 110px;
  resize: vertical;
  border: 0;
  border-radius: 4px;
  padding: 10px;
  background: var(--panel-deep);
  color: var(--text);
}

.analysis-result textarea {
  min-height: 260px;
  max-height: 42vh;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.analysis-note {
  margin: 12px 0 0;
  padding: 12px;
  background: #2b2d31;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.top-home {
  min-height: 36px;
}

.items-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
  background: var(--panel-soft);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.wanted-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
  background: var(--panel-soft);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.wanted-title {
  padding-bottom: 8px;
}

.wanted-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 0 10px 10px;
}

.wanted-search input {
  min-width: 0;
}

.wanted-list {
  min-height: 0;
  overflow: auto;
  padding: 0 8px 10px;
}

.wanted-summary {
  display: grid;
  gap: 2px;
  width: 100%;
  min-height: 44px;
  margin-bottom: 6px;
  overflow: hidden;
  background: #2f3136;
  border: 1px solid #202126;
  border-radius: 5px;
  color: var(--text);
  text-align: left;
}

.wanted-summary:hover {
  background: #404249;
}

.wanted-summary-name,
.wanted-summary-type {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wanted-summary-name {
  font-size: 13px;
  font-weight: 800;
}

.wanted-summary-type {
  color: var(--muted);
  font-size: 11px;
}

.wanted-card {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 10px;
  margin-bottom: 8px;
  padding: 9px;
  background: #2f3136;
  border: 1px solid #202126;
  border-left: 4px solid #747f8d;
  border-radius: 6px;
}

.wanted-detail-pane {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
}

.wanted-detail-hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.wanted-detail-grid {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  height: auto;
  flex: 0 1 auto;
  min-height: 0;
  max-height: 100%;
  overflow: auto;
  padding: 2px;
}

.wanted-detail-grid .wanted-card {
  flex: 0 0 clamp(300px, 24vw, 360px);
  margin-bottom: 0;
}

.wanted-card.rarity-5 {
  border-left-color: #8e44ad;
}

.wanted-card.rarity-6 {
  border-left-color: #ceae33;
}

.wanted-card.damage-2 {
  box-shadow: inset 0 0 0 1px rgba(85, 170, 255, .18);
}

.wanted-card.damage-3 {
  box-shadow: inset 0 0 0 1px rgba(255, 148, 66, .18);
}

.wanted-card.damage-4 {
  box-shadow: inset 0 0 0 1px rgba(177, 109, 255, .18);
}

.wanted-card.damage-6 {
  box-shadow: inset 0 0 0 1px rgba(125, 210, 255, .18);
}

.wanted-card.damage-7 {
  box-shadow: inset 0 0 0 1px rgba(73, 210, 144, .18);
}

.wanted-icon {
  width: 52px;
  height: 52px;
  border-radius: 4px;
  background: var(--panel-deep);
  object-fit: cover;
}

.wanted-card-body {
  min-width: 0;
}

.wanted-card h4 {
  margin: 0 0 6px;
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wanted-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 6px;
}

.wanted-meta span {
  max-width: 100%;
  overflow: hidden;
  padding: 2px 6px;
  background: #1e1f22;
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wanted-card p {
  display: -webkit-box;
  margin: 0 0 8px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.wanted-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.wanted-card-actions button {
  min-height: 30px;
  padding: 0 9px;
  font-size: 12px;
}

.danger-button {
  background: var(--danger);
}

.danger-button:hover {
  background: #f04747;
}

.panel-title {
  display: flex;
  justify-content: space-between;
  padding: 12px 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.item-list,
.compare-list {
  overflow: auto;
}

.item-list {
  min-height: 0;
  padding: 0 8px 12px;
}

.item-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px;
  align-items: center;
  gap: 6px;
  width: 100%;
  margin-bottom: 4px;
}

.item-main {
  display: block;
  width: 100%;
  min-height: 42px;
  overflow: hidden;
  background: transparent;
  color: var(--muted);
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.compare-trigger {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border-radius: 4px;
  color: var(--muted);
  background: transparent;
  font-size: 16px;
}

.compare-trigger:hover {
  background: #5b5d66;
  color: var(--text);
}

.item-row.compare-active .compare-trigger {
  background: var(--accent);
  color: #fff;
}

.item-row.compare-active .compare-trigger:hover {
  background: var(--accent-hover);
}

.item-row:hover .item-main,
.compare-option:hover {
  background: #404249;
  color: var(--text);
}

.item-row.active .item-main,
.compare-option.active {
  background: var(--accent);
  color: #fff;
}

.item-row.active:hover .item-main,
.compare-option.active:hover {
  background: var(--accent-hover);
  color: #fff;
}

.compare-option {
  display: block;
  width: 100%;
  min-height: 40px;
  margin-bottom: 4px;
  overflow: hidden;
  background: transparent;
  color: var(--muted);
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty {
  padding: 14px;
  color: var(--muted);
}

.detail-pane {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.detail-pane.wanted-detail-pane {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
}

.detail-pane.wanted-detail-pane .wanted-detail-grid {
  flex: 0 0 auto;
}

.details-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.details-grid.compare-mode {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.primary-detail,
.secondary-detail {
  min-height: 0;
}

.compare-select-pane {
  min-height: 0;
  overflow: hidden;
}

.compare-select-pane .pane-head {
  align-items: stretch;
}

.compare-select-pane .pane-head > div:first-child {
  flex: 1 1 auto;
  min-width: 0;
}

.compare-select-pane .pane-head h3 {
  display: -webkit-box;
  max-height: 2.6em;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.compare-select-pane .compact-actions {
  flex: 0 0 auto;
  align-items: flex-start;
}

.pane-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.pane-head > div:first-child {
  min-width: 0;
}

.compare-list {
  min-height: 0;
  padding: 6px;
  background: #2b2d31;
  border-radius: 4px;
}

textarea {
  width: 100%;
  min-width: 0;
  min-height: 0;
  resize: none;
  border: 0;
  border-radius: 4px;
  padding: 12px;
  background: var(--panel-deep);
  color: var(--text);
  font-family: Consolas, "Cascadia Mono", monospace;
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

textarea[hidden] {
  display: none;
}

[hidden] {
  display: none !important;
}

.overlay {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  background: rgba(0, 0, 0, .42);
  z-index: 20;
}

.overlay.show {
  display: grid;
}

.loader {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 240px;
  padding: 16px 18px;
  background: var(--panel-deep);
  border-radius: 6px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, .45);
}

.loader span {
  width: 18px;
  height: 18px;
  border: 3px solid #6d6f78;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

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

@media (max-width: 1050px) {
  .app-shell {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .topbar-main,
  .source-toolbar {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .source-tabs {
    justify-content: flex-start;
  }

  .source-toolbar .source-tabs {
    grid-column: auto;
  }

  .topbar-status,
  .primary-actions,
  .source-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .content-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .details-grid.compare-mode {
    grid-template-columns: 1fr;
  }

  .content-grid {
    padding: 12px;
  }

  .settings-grid .profile-card {
    grid-column: auto;
    max-width: none;
  }

  .left-stack {
    grid-template-rows: minmax(260px, 1fr) minmax(260px, 1fr);
  }

  .content-grid.compare-mode .left-stack {
    grid-template-rows: 260px 260px 260px;
  }

  .detail-pane {
    min-height: 420px;
  }

  .compare-select-pane {
    min-height: 260px;
  }
}

@media (max-width: 760px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .workspace,
  .settings-workspace {
    grid-column: 1;
    grid-row: auto;
  }

  .server-rail {
    display: none;
  }

  .pane-head {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-title,
  .actions {
    flex-wrap: wrap;
  }

  .button-row button,
  .actions button,
  .compact-actions button,
  .pane-head > button {
    flex: 1 1 auto;
  }

  .modal-backdrop {
    padding: 10px;
  }

  .modal-panel {
    max-height: calc(100vh - 20px);
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .filter-groups {
    grid-template-columns: 1fr;
  }

  .detail-pane {
    min-height: 380px;
  }

  .wanted-search {
    grid-template-columns: 1fr;
  }

  .wanted-card {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .wanted-icon {
    width: 44px;
    height: 44px;
  }
}
