/* ABVME web — mirrors the desktop app's styles.qss (VS Code-like dark theme). */

:root,
[data-bs-theme="dark"] {
  --abv-bg: #1e1e1e;
  --abv-text: #cccccc;
  --abv-panel: #252526;
  --abv-alt: #2d2d30;
  --abv-header: #323232;
  --abv-border: #454545;
  --abv-border-strong: #555555;
  --abv-grid: #333333;
  --abv-button: #3c3c3c;
  --abv-button-hover: #505050;
  --abv-accent: #007acc;
  --abv-accent-dark: #005f9e;
  --abv-accent-light: #4fc3f7;
  --abv-select: #094771;
  --abv-menubar: #333333;
  --abv-status: #3c3c3c;
  --abv-changed: #7dcea0;
  --abv-dim: #808080;
  --abv-disabled: #6a6a6a;
  --abv-preview-bg: #1f1f1f;
  --abv-preview-border: #616161;
  --abv-font: "Segoe UI", Roboto, system-ui, -apple-system, "Noto Sans Thai", sans-serif;
  --abv-row-h: 26px;

  --bs-body-bg: var(--abv-bg);
  --bs-body-color: var(--abv-text);
  --bs-body-font-family: var(--abv-font);
  --bs-body-font-size: 13px;
  --bs-border-color: var(--abv-border);
  --bs-link-color: var(--abv-accent-light);
  --bs-link-hover-color: #8fdcff;
  --bs-link-color-rgb: 79, 195, 247;
  --bs-link-hover-color-rgb: 143, 220, 255;
  --bs-emphasis-color: #ffffff;
  --bs-secondary-color: #9d9d9d;
  --bs-tertiary-bg: var(--abv-panel);
}

html,
body {
  height: 100%;
}

body {
  background: var(--abv-bg);
  color: var(--abv-text);
  font-family: var(--abv-font);
  font-size: 13px;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

.d-none-important {
  display: none !important;
}

/* ---------- scrollbars ---------- */
* {
  scrollbar-width: thin;
  scrollbar-color: #424242 var(--abv-bg);
}
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
  background: var(--abv-bg);
}
::-webkit-scrollbar-thumb {
  background: #424242;
  border-radius: 5px;
}
::-webkit-scrollbar-thumb:hover {
  background: #686868;
}
::-webkit-scrollbar-corner {
  background: var(--abv-bg);
}

/* ---------- buttons (QPushButton) ---------- */
.btn-abv {
  --bs-btn-padding-x: 12px;
  --bs-btn-padding-y: 6px;
  --bs-btn-font-size: 13px;
  --bs-btn-color: #ffffff;
  --bs-btn-bg: var(--abv-button);
  --bs-btn-border-color: var(--abv-border-strong);
  --bs-btn-border-radius: 4px;
  --bs-btn-hover-color: #ffffff;
  --bs-btn-hover-bg: var(--abv-button-hover);
  --bs-btn-hover-border-color: var(--abv-accent);
  --bs-btn-active-color: #ffffff;
  --bs-btn-active-bg: #252526;
  --bs-btn-active-border-color: var(--abv-accent-dark);
  --bs-btn-disabled-color: #666666;
  --bs-btn-disabled-bg: #2b2b2b;
  --bs-btn-disabled-border-color: #333333;
  --bs-btn-disabled-opacity: 1;
  --bs-btn-focus-box-shadow: 0 0 0 1px var(--abv-accent);
  min-width: 80px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  line-height: 1.3;
}
.btn-abv .ico {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}
.btn-abv:disabled .ico {
  opacity: 0.35;
}
.btn-abv.btn-primary-abv {
  --bs-btn-bg: #0e639c;
  --bs-btn-border-color: #1177bb;
  --bs-btn-hover-bg: #1177bb;
}
.btn-flat {
  color: #9d9d9d;
  background: transparent;
  border: none;
  padding: 6px 12px;
}
.btn-flat:hover {
  color: var(--abv-text);
}
.ico {
  display: inline-block;
  width: 16px;
  height: 16px;
  vertical-align: -3px;
  pointer-events: none;
}

/* ---------- form controls ---------- */
.form-control,
.form-select {
  background-color: var(--abv-button);
  border: 1px solid var(--abv-border-strong);
  border-radius: 4px;
  color: #d4d4d4;
  font-size: 13px;
  padding: 5px 10px;
}
.form-control:focus,
.form-select:focus {
  background-color: var(--abv-button);
  color: #d4d4d4;
  border-color: var(--abv-accent);
  box-shadow: none;
}
.form-select:hover,
.form-control:hover {
  border-color: var(--abv-accent);
}
.form-select {
  --bs-form-select-bg-img: url("../icons/angle-down-solid.svg");
  background-size: 12px 12px;
  background-position: right 10px center;
  padding-right: 30px;
}
.form-select option {
  background: var(--abv-panel);
  color: var(--abv-text);
}
.form-control::placeholder {
  color: #808080;
}
.form-control:disabled,
.form-select:disabled {
  background-color: #2b2b2b;
  color: #666;
  border-color: #333;
}
.form-check-input {
  width: 13px;
  height: 13px;
  margin-top: 0.22em;
  border: 1px solid #8a8a8a;
  border-radius: 2px;
  background-color: var(--abv-bg);
}
.form-check-input:hover {
  border-color: var(--abv-text);
}
.form-check-input:checked {
  border-color: var(--abv-accent-light);
  background-color: var(--abv-accent);
}
.form-check-input:focus {
  box-shadow: none;
  border-color: var(--abv-accent-light);
}
.form-label {
  margin-bottom: 4px;
}
.help-tip {
  cursor: help;
  color: #9d9d9d;
  margin-left: 4px;
}

/* ---------- app shell ---------- */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}

/* QMenuBar */
.menubar {
  display: flex;
  align-items: stretch;
  background: var(--abv-menubar);
  color: var(--abv-text);
  height: 26px;
  flex: 0 0 auto;
  padding: 0 2px;
  user-select: none;
  position: relative;
  z-index: 1030;
}
.menubar .menu-btn {
  background: transparent;
  color: var(--abv-text);
  border: 0;
  padding: 0 9px;
  font-size: 13px;
  line-height: 26px;
  border-radius: 0;
  white-space: nowrap;
}
.menubar .menu-btn:hover,
.menubar .menu-btn.show {
  background: var(--abv-button-hover);
}
.menubar .menu-btn:disabled {
  color: var(--abv-disabled);
}
/* Account button: grey person for a guest, blue once signed in (a shield for admins) */
#userMenuBtn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 100%; /* keeps the icon centred when the name is hidden (phones) */
}
#userMenuBtn .user-ico {
  width: 13px;
  height: 13px;
  flex: 0 0 13px;
  background-color: #9d9d9d;
  -webkit-mask: url("../icons/user-solid.svg") no-repeat center / contain;
  mask: url("../icons/user-solid.svg") no-repeat center / contain;
}
#userMenuBtn.signed-in .user-ico {
  background-color: var(--abv-accent-light);
}
/* the name is shown only when all of it fits the menu bar (fitMenubar in main.js) */
#userMenuBtn.no-name #userName {
  display: none;
}
#menuMore .menu-btn {
  display: inline-flex;
  align-items: center;
  height: 100%;
}
#menuMore .ico {
  width: 11px;
  height: 11px;
  opacity: 0.8;
}
#userMenuBtn.admin .user-ico {
  -webkit-mask-image: url("../icons/user-shield-solid.svg");
  mask-image: url("../icons/user-shield-solid.svg");
  width: 15px;
  flex-basis: 15px;
}
.menubar .menubar-right {
  margin-left: auto;
  display: flex;
  align-items: stretch;
  min-width: 0;
}
.menubar .workspace-name {
  color: #9d9d9d;
  padding: 0 10px;
  line-height: 26px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 40vw;
}

/* QMenu */
.dropdown-menu.qmenu {
  --bs-dropdown-bg: var(--abv-panel);
  --bs-dropdown-color: var(--abv-text);
  --bs-dropdown-border-color: var(--abv-border);
  --bs-dropdown-border-radius: 0;
  --bs-dropdown-padding-y: 2px;
  --bs-dropdown-padding-x: 2px;
  --bs-dropdown-font-size: 13px;
  --bs-dropdown-link-color: var(--abv-text);
  --bs-dropdown-link-hover-color: #ffffff;
  --bs-dropdown-link-hover-bg: var(--abv-select);
  --bs-dropdown-link-active-bg: var(--abv-select);
  --bs-dropdown-link-disabled-color: var(--abv-disabled);
  --bs-dropdown-divider-bg: var(--abv-border);
  --bs-dropdown-divider-margin-y: 3px;
  min-width: 220px;
  margin-top: 0 !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}
.qmenu .dropdown-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px 3px 6px;
  border: 1px solid transparent;
  border-radius: 3px;
  white-space: nowrap;
  cursor: default;
}
.qmenu .dropdown-item:hover,
.qmenu .dropdown-item:focus-visible {
  background: var(--abv-select);
  border-color: var(--abv-accent);
  color: #ffffff;
}
/* A click leaves the focus on the item (Bootstrap highlights :focus): the highlight follows the pointer only. */
.qmenu .dropdown-item:focus:not(:focus-visible):not(:hover):not(:active) {
  background: transparent;
  border-color: transparent;
  color: var(--abv-text);
}
.qmenu .dropdown-item.disabled,
.qmenu .dropdown-item:disabled {
  color: var(--abv-disabled);
  background: transparent;
  border-color: transparent;
}
.qmenu .dropdown-item .ico,
.qmenu .dropdown-item .ico-space {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}
.qmenu .dropdown-item.disabled .ico {
  opacity: 0.35;
}
.qmenu .dropdown-item .label {
  flex: 1 1 auto;
}
.qmenu .dropdown-item .shortcut {
  margin-left: 24px;
  color: #9d9d9d;
  font-size: 12px;
}
.qmenu .dropdown-item:hover .shortcut {
  color: #d0d0d0;
}
.qmenu .check {
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
  margin: 0 2px;
  border: 1px solid #8a8a8a;
  border-radius: 2px;
  background: var(--abv-bg) no-repeat center / 9px 9px;
}
.qmenu .checked .check {
  border-color: var(--abv-accent-light);
  background-color: transparent;
  background-image: url("../icons/check-solid.svg");
}
.qmenu .dropdown-item:hover .check {
  border-color: #ffffff;
}
.qmenu .submenu {
  position: relative;
}
.qmenu .submenu > .dropdown-item::after {
  content: "";
  margin-left: 16px;
  border: solid #cccccc;
  border-width: 0 1.5px 1.5px 0;
  padding: 3px;
  transform: rotate(-45deg);
}
.qmenu .submenu > .dropdown-menu {
  top: -3px;
  left: 100%;
  display: none;
  position: absolute;
}
.qmenu .submenu.open > .dropdown-menu {
  display: block;
}
/* Touch screens keep :hover after a tap, which would stop a tap from collapsing the submenu. */
@media (hover: hover) {
  .qmenu .submenu:hover > .dropdown-menu {
    display: block;
  }
}
/* Touch screens leave :hover and :focus on a tapped item. Highlight it only while the finger is down. */
@media (hover: none) {
  .qmenu .dropdown-item:hover,
  .qmenu .dropdown-item:focus {
    background: transparent;
    border-color: transparent;
    color: var(--abv-text);
  }
  .qmenu .dropdown-item:not(.checked):hover .check {
    border-color: #8a8a8a;
  }
  .qmenu .dropdown-item.checked:hover .check {
    border-color: var(--abv-accent-light);
  }
  .qmenu .dropdown-item:active:not(.disabled) {
    background: var(--abv-select);
    border-color: var(--abv-accent);
    color: #ffffff;
  }
}
.qmenu .dropdown-header {
  color: #e0e0e0;
  font-weight: 600;
  padding: 3px 8px;
  font-size: 13px;
}

/* Announcement / maintenance message from the admin pages */
.notice-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 5px 8px 5px 12px;
  background: var(--abv-select);
  color: #e6f4ff;
  border-bottom: 1px solid var(--abv-accent-dark);
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.notice-bar .text {
  flex: 1 1 auto;
  min-width: 0;
}
.notice-bar .btn-close {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  margin-top: 4px;
  background-size: 10px;
}
.notice-bar.maintenance .btn-close {
  display: none;
}
.notice-bar.maintenance {
  background: #5a4a14;
  color: #fff3c4;
  border-bottom-color: #8a6d1a;
}

.main {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
  padding: 9px 9px 6px;
  gap: 0;
  position: relative;
}
.panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 0 5px;
}
.left-panel {
  flex: 0 0 var(--left-width, 50%);
  min-width: 350px;
}
.right-panel {
  flex: 1 1 0;
  min-width: 210px;
}
.panel-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  flex: 0 0 auto;
}
.panel-toolbar .spacer {
  flex: 1 1 auto;
}

/* QSplitter handle */
.splitter {
  flex: 0 0 10px;
  background: var(--abv-grid);
  cursor: col-resize;
  touch-action: none;
  border-radius: 1px;
}
.splitter:hover,
.splitter.dragging {
  background: var(--abv-accent);
}

/* ---------- asset table (QTableWidget + FilterHeader) ---------- */
.asset-table {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  border: 1px solid var(--abv-border);
  border-radius: 4px;
  background: var(--abv-panel);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.asset-table .scroller {
  flex: 1 1 auto;
  overflow: scroll;
  position: relative;
  outline: none;
  overscroll-behavior: contain;
}
.asset-table .thead {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: var(--cols);
  width: max-content;
  min-width: 100%;
  background: var(--abv-header);
  height: 24px;
  user-select: none;
}
.asset-table .th {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 4px;
  color: #e0e0e0;
  font-weight: 700;
  border-bottom: 1px solid var(--abv-accent);
  border-right: 1px solid #3a3a3a;
  white-space: nowrap;
  overflow: hidden;
  cursor: default;
}
.asset-table .th:hover {
  background: #3a3a3a;
}
.asset-table .th .th-label {
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1 1 auto;
}
.asset-table .th.filtered::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: #0078d7;
}
.asset-table .sort-ind {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  flex: 0 0 auto;
  opacity: 0.9;
}
.asset-table .sort-ind.asc {
  border-bottom: 5px solid #cccccc;
}
.asset-table .sort-ind.desc {
  border-top: 5px solid #cccccc;
}
/* Filter button: always in the tab order; with a mouse it only shows on
   header hover, keyboard focus, or while the column is filtered. */
.asset-table .filter-btn {
  display: inline-block;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  padding: 2px;
  border: 0;
  border-radius: 2px;
  background: transparent url("../icons/filter-solid.svg") no-repeat center / 10px 10px;
  opacity: 0;
}
.asset-table .th:hover .filter-btn {
  opacity: 0.55;
}
.asset-table .th.filtered .filter-btn,
.asset-table .filter-btn:focus-visible {
  opacity: 1;
}
.asset-table .filter-btn:focus-visible {
  outline: 1px solid var(--abv-accent);
}
@media (pointer: coarse) {
  .asset-table .filter-btn {
    opacity: 0.55;
  }
}
.asset-table .resizer {
  position: absolute;
  right: -3px;
  top: 0;
  bottom: 0;
  width: 7px;
  cursor: col-resize;
  z-index: 3;
  touch-action: none;
}
.asset-table .tbody {
  position: relative;
  width: max-content;
  min-width: 100%;
}
.asset-table .tr {
  position: absolute;
  left: 0;
  display: grid;
  grid-template-columns: var(--cols);
  width: max-content;
  min-width: 100%;
  height: var(--abv-row-h);
  background: var(--abv-panel);
  user-select: none;
}
.asset-table .tr.alt {
  background: var(--abv-alt);
}
.asset-table .td {
  padding: 0 4px;
  line-height: calc(var(--abv-row-h) - 1px);
  border-right: 1px solid var(--abv-grid);
  border-bottom: 1px solid var(--abv-grid);
  white-space: pre;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--abv-text);
}
.asset-table .tr.changed .td {
  color: var(--abv-changed);
}
.asset-table .td.is-placeholder,
.asset-table .tr.changed .td.is-placeholder {
  color: var(--abv-dim);
}
.asset-table .tr.selected {
  background: var(--abv-select);
}
.asset-table .tr.selected .td {
  color: #ffffff;
}
.asset-table .tr.selected.changed .td {
  color: var(--abv-changed);
}
.asset-table .tr.cursor .td:first-child {
  box-shadow: inset 2px 0 0 var(--abv-accent);
}
.asset-table .empty-state {
  position: absolute;
  inset: 24px 0 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #8a8a8a;
  padding: 24px;
  pointer-events: none;
}
.asset-table .empty-state .hint {
  font-size: 12px;
  color: #6f6f6f;
  margin-top: 6px;
}
/* The empty state lets clicks through to the table, except on its links. */
.asset-table .empty-state a {
  pointer-events: auto;
}
.asset-table .empty-state .guest-hint {
  margin-top: 14px;
}
.table-footer {
  display: flex;
  gap: 8px;
  color: #8a8a8a;
  font-size: 12px;
  padding: 4px 2px 0;
  min-height: 20px;
  flex: 0 0 auto;
}
.table-footer .spacer {
  flex: 1 1 auto;
}

/* Header filter popup (QMenu with widgets) */
.filter-menu {
  position: fixed;
  z-index: 1060;
  background: var(--abv-panel);
  border: 1px solid var(--abv-border);
  padding: 2px;
  min-width: 200px;
  max-width: min(420px, 92vw);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
}
.filter-menu .fm-title {
  font-weight: 700;
  padding: 2px 5px;
  border: 1px solid #323232;
  margin-bottom: 2px;
}
.filter-menu .fm-list {
  max-height: min(360px, 55vh);
  overflow: auto;
}
.filter-menu .fm-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 3px;
  border: 1px solid transparent;
  white-space: nowrap;
  cursor: default;
}
.filter-menu .fm-item:hover {
  background: var(--abv-select);
  border-color: var(--abv-accent);
  color: #ffffff;
}
.filter-menu .fm-item .form-check-input {
  margin: 0;
  flex: 0 0 auto;
}
.filter-menu .fm-sep {
  height: 1px;
  background: var(--abv-border);
  margin: 3px 0;
}
.filter-menu .fm-text {
  padding: 8px;
}
.filter-menu .fm-input {
  position: relative;
}
.filter-menu .fm-input .form-control {
  padding-right: 28px;
}
.filter-menu .fm-clear {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  border: 0;
  background: transparent;
  color: #ff3b3b;
  font-weight: 700;
  font-size: 16px;
  line-height: 16px;
  padding: 0;
}

/* ---------- preview (QTabWidget + QStackedWidget) ---------- */
.qtabs {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}
.qtabs .tabbar {
  display: flex;
  gap: 0;
  flex: 0 0 auto;
}
.qtabs .tab {
  background: var(--abv-button);
  color: var(--abv-text);
  border: 1px solid var(--abv-border);
  border-bottom: none;
  padding: 5px 14px;
  font-size: 13px;
  margin-right: -1px;
}
.qtabs .tab.active {
  background: var(--abv-panel);
  position: relative;
  z-index: 1;
  margin-bottom: -1px;
  padding-bottom: 6px;
}
.qtabs .tab:not(.active):hover {
  color: #ffffff;
}
.qtabs .tabbar .tab-info {
  margin-left: auto;
  align-self: center;
  color: #8a8a8a;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-left: 8px;
}
.qtabs .pane {
  flex: 1 1 auto;
  min-height: 0;
  border: 1px solid var(--abv-border);
  background: var(--abv-panel);
  display: none;
  padding: 2px;
}
.qtabs .pane.active {
  display: flex;
  flex-direction: column;
}
.preview-stack {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  border: 1px solid var(--abv-preview-border);
  border-radius: 4px;
  background: var(--abv-preview-bg);
  overflow: hidden;
}
.preview-stack > .view {
  position: absolute;
  inset: 0;
  display: none;
}
.preview-stack > .view.active {
  display: block;
}
/* Mesh preview: a WebGL canvas filling the preview area (frontend/js/mesh-viewer.js) */
.preview-stack > .mesh-view.active {
  display: block;
}
.mesh-view {
  position: relative;
}
.mesh-view canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}
.mesh-view canvas:active {
  cursor: grabbing;
}
.mesh-tools {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 6px;
}
.mesh-tools .btn-abv[aria-pressed="true"] {
  border-color: var(--abv-accent);
  background-color: rgba(0, 122, 204, 0.35);
}
.mesh-hint {
  position: absolute;
  left: 8px;
  bottom: 6px;
  right: 8px;
  color: #808080;
  font-size: 11px;
  pointer-events: none;
}

/* AudioClip preview: a player in the middle of the preview area */
.preview-stack > .audio-view.active {
  display: flex;
}
.audio-view {
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.audio-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: min(420px, 100%);
}
.audio-box .audio-title {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #fff;
}
.audio-box audio {
  width: 100%;
}
.audio-box .audio-meta {
  color: #9d9d9d;
  font-size: 12px;
  text-align: center;
}
.preview-placeholder {
  display: none;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 16px;
  white-space: pre-wrap;
}
.preview-placeholder.active {
  display: flex !important;
}
.text-view,
.dump-view {
  width: 100%;
  height: 100%;
  margin: 0;
  border: 0;
  resize: none;
  background: var(--abv-button);
  color: #d4d4d4;
  font-family: "Segoe UI", Roboto, sans-serif;
  font-size: 13px;
  padding: 4px 6px;
  outline: none;
  white-space: pre-wrap;
  overflow: auto;
  tab-size: 4;
}
.text-view {
  background: transparent;
}
.dump-view {
  font-family: Consolas, "Cascadia Mono", Menlo, monospace;
  font-size: 12.5px;
  white-space: pre;
  border: 1px solid var(--abv-grid);
  border-radius: 4px;
}
.dump-view:empty::before {
  content: attr(data-placeholder);
  color: #808080;
}
/* Top-left note on a reduced (not actual size) image preview: styled like the
   coordinates readout, a little brighter so it is noticed. */
.preview-note {
  position: absolute;
  left: 6px;
  top: 4px;
  max-width: calc(100% - 12px);
  font-size: 12px;
  color: #e0e0e0;
  background: rgba(30, 30, 30, 0.82);
  padding: 1px 6px;
  border-radius: 3px;
  pointer-events: none;
}
.view-banner {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  background: rgba(30, 30, 30, 0.88);
  border: 1px solid var(--abv-border);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 12px;
  color: #d8b35a;
  pointer-events: none;
}

/* PhotoViewer: a checkerboard behind the image shows its transparent parts */
.photo-viewer {
  background-color: #1e1e1e;
  background-image: conic-gradient(#2b2b2b 25%, transparent 0 50%, #2b2b2b 0 75%, transparent 0);
  background-size: 20px 20px;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}
.photo-viewer.dragging {
  cursor: grabbing;
}
.photo-viewer img {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
  image-rendering: auto;
  user-select: none;
  -webkit-user-drag: none;
  max-width: none;
}
.photo-viewer.pixelated img {
  image-rendering: pixelated;
}
.photo-viewer .coords {
  position: absolute;
  right: 6px;
  bottom: 4px;
  font-size: 11px;
  color: #9d9d9d;
  background: rgba(30, 30, 30, 0.7);
  padding: 0 4px;
  border-radius: 3px;
  pointer-events: none;
}
.loading-spinner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #9d9d9d;
  background: rgba(31, 31, 31, 0.6);
  z-index: 3;
}
.spin {
  width: 18px;
  height: 18px;
  border: 2px solid #555;
  border-top-color: var(--abv-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- context menu ---------- */
.ctx-menu {
  position: fixed;
  z-index: 1200; /* above stacked dialogs */
  display: block;
}

/* ---------- status bar (QStatusBar) ---------- */
.statusbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 24px;
  background: var(--abv-status);
  color: #ffffff;
  padding: 2px 10px;
  font-size: 13px;
}
.statusbar .status-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--abv-text);
}
.statusbar .status-text.temp {
  color: #ffffff;
}
.statusbar .status-text.warn {
  color: #f0c674;
}
.statusbar .status-text.error {
  color: #ff8a80;
}
.statusbar .status-text a {
  color: var(--abv-accent-light);
}
.qprogress {
  position: relative;
  width: min(33vw, 300px);
  height: 14px;
  border: 1px solid var(--abv-border-strong);
  border-radius: 2px;
  background: #2b2b2b;
  overflow: hidden;
  flex: 0 0 auto;
}
.qprogress .bar {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: #06b025;
  transition: width 0.2s;
}
.qprogress.busy .bar {
  width: 30%;
  animation: busy 1.2s ease-in-out infinite;
}
@keyframes busy {
  from {
    left: -30%;
  }
  to {
    left: 100%;
  }
}
.qprogress .label {
  position: absolute;
  inset: 0;
  text-align: center;
  font-size: 10px;
  line-height: 12px;
  color: #ffffff;
  text-shadow: 0 0 2px #000;
}
/* Service status: just a coloured dot (click for System Status). */
.backend-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 22px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
}
.backend-dot:hover,
.backend-dot:focus-visible {
  background: rgba(255, 255, 255, 0.12);
  outline: none;
}
.backend-dot::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #8a8a8a;
}
.backend-dot.ok::before {
  background: #4caf50;
}
.backend-dot.down::before {
  background: #f44336;
}
.backend-dot.checking::before {
  background: #f0c674;
}

/* ---------- drop overlay ---------- */
.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
  padding: 70px 48px 0;
  color: #ffffff;
  text-shadow: 0 1px 16px rgba(0, 0, 0, 0.82);
}
.drop-overlay.show {
  display: flex;
}
.drop-overlay.open {
  background: rgba(117, 180, 255, 0.67);
}
.drop-overlay.replace {
  background: rgba(112, 212, 112, 0.67);
}
.drop-overlay.reject {
  background: rgba(255, 97, 97, 0.67);
}
.drop-overlay .do-title {
  font-size: 42px;
  font-weight: 800;
  white-space: nowrap;
}
.drop-overlay .do-body {
  margin: auto 0;
  padding-bottom: 12vh;
  font-size: 24px;
  font-weight: 600;
  text-align: center;
  max-width: 100%;
}
.drop-overlay .do-body > div {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- dialogs (QDialog / QMessageBox) ---------- */
.modal {
  --bs-modal-bg: var(--abv-bg);
  --bs-modal-color: var(--abv-text);
  --bs-modal-border-color: var(--abv-border);
  --bs-modal-border-radius: 6px;
  --bs-modal-header-padding: 6px 8px 6px 12px;
  --bs-modal-header-border-color: var(--abv-border);
  --bs-modal-footer-border-color: transparent;
  --bs-modal-padding: 12px;
  --bs-backdrop-opacity: 0.45;
}
.modal-header {
  background: #2b2b2b;
  border-top-left-radius: 6px;
  border-top-right-radius: 6px;
}
.modal-title {
  font-size: 13px;
  font-weight: 400;
  display: flex;
  align-items: center;
  gap: 8px;
}
.modal-title img {
  width: 16px;
  height: 16px;
}
.modal-footer {
  padding: 8px 12px 12px;
  gap: 6px;
}
.modal-footer > * {
  margin: 0;
}
.btn-close {
  --bs-btn-close-color: #ffffff;
  filter: invert(1) grayscale(100%) brightness(200%);
  opacity: 0.7;
  font-size: 11px;
}
.msgbox-body {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  min-height: 48px;
  white-space: pre-wrap;
  word-break: break-word;
}
.msgbox-icon {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 20px;
  color: #ffffff;
}
.msgbox-icon.question,
.msgbox-icon.information {
  background: #1e88e5;
}
.msgbox-icon.warning {
  background: #f9a825;
  border-radius: 4px;
  color: #1e1e1e;
}
.msgbox-icon.critical {
  background: #e53935;
}
.msgbox-details {
  max-height: 180px;
  overflow: auto;
  background: var(--abv-panel);
  border: 1px solid var(--abv-border);
  border-radius: 4px;
  padding: 6px 8px;
  margin-top: 8px;
  font-size: 12px;
  white-space: pre-wrap;
}

/* QListWidget (save dialog) */
.qlist {
  background: var(--abv-panel);
  border: 1px solid var(--abv-border);
  border-radius: 4px;
  overflow: auto;
  user-select: none;
  outline: none;
}
.qlist .item {
  padding: 5px;
  white-space: nowrap;
  cursor: default;
}
.qlist .item:nth-child(even) {
  background: var(--abv-alt);
}
.qlist .item:hover {
  background: #3e3e42;
  color: #ffffff;
}
.qlist .item.changed {
  color: var(--abv-changed);
}
.qlist .item.selected {
  background: var(--abv-select);
  color: #ffffff;
}
.qlist .item.selected.changed {
  color: var(--abv-changed);
}
.qlist .item.is-placeholder {
  color: #8a8a8a;
}
.qlist .item.is-placeholder:hover {
  background: transparent;
  color: #8a8a8a;
}
.qlist .item .meta {
  color: #8a8a8a;
  margin-left: 8px;
  font-size: 12px;
}
.qlist .item.error {
  color: #ff8a80;
}

.save-dialog .modal-body {
  display: flex;
  gap: 12px;
  min-height: 380px;
}
.save-dialog .file-list {
  flex: 3 1 0;
  min-width: 0;
}
.save-dialog .controls {
  flex: 1 1 0;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.save-dialog .controls .btn-abv {
  width: 100%;
}
.toggle-btn {
  background: transparent;
  border: 0;
  color: var(--abv-text);
  padding: 2px 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}
.toggle-btn .arrow {
  width: 0;
  height: 0;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 6px solid var(--abv-text);
  transition: transform 0.12s;
}
.toggle-btn[aria-expanded="true"] .arrow {
  transform: rotate(90deg);
}
.save-results .item {
  display: flex;
  align-items: center;
  gap: 8px;
}
.save-results .item .name {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Files Needed Again */
.refetch-list .item .name {
  min-width: 0;
  white-space: nowrap;
}
.refetch-list .item .meta {
  flex: 0 0 auto;
  color: #8a8a8a;
}
.refetch-list .st {
  flex: 0 0 auto;
  font-size: 12px;
  padding: 1px 8px;
  border-radius: 10px;
  border: 1px solid var(--abv-border);
  color: #9e9e9e;
  white-space: nowrap;
}
.refetch-list .st.ok {
  color: var(--abv-changed);
  border-color: #3d6b52;
}
.refetch-list .st.bad {
  color: #d8b35a;
  border-color: #7a6431;
}
@media (max-width: 767.98px) {
  .refetch-list .item {
    flex-wrap: wrap;
    row-gap: 2px;
  }
  .refetch-list .item .name {
    flex-basis: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
  }
}
.btn-abv.icon-btn {
  min-width: 0;
  width: 30px;
  height: 28px;
  padding: 0;
  flex: 0 0 auto;
}
.btn-abv.icon-btn .ico {
  width: 14px;
  height: 14px;
}

/* Texture Replace Options */
.texture-dialog .modal-body {
  display: flex;
  gap: 16px;
  min-height: 480px;
}
.texture-dialog .previews {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.texture-dialog .tex-preview {
  flex: 1 1 0;
  min-height: 160px;
  background: var(--abv-panel) center / contain no-repeat;
  border: 1px solid var(--abv-border-strong);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #8a8a8a;
}
.texture-dialog .new-file {
  color: #888888;
  font-size: 11px;
}
.texture-dialog .options {
  flex: 0 0 300px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.texture-dialog .opt-row {
  display: grid;
  grid-template-columns: 113px 175px;
  gap: 12px;
  align-items: center;
}
.texture-dialog .opt-row > label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.texture-dialog .opt-row .value-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.texture-dialog .sep {
  border-top: 1px solid var(--abv-border);
  margin: 4px 0;
}

/* About */
.about-head {
  text-align: center;
  padding: 4px 0 12px;
}
.about-head img {
  width: 48px;
  height: 48px;
}
.about-head .app-name {
  font-size: 24px;
  font-weight: 700;
  margin-top: 6px;
}
.about-head .app-version {
  color: #888888;
}
.about-panel {
  background: #323232;
  border-radius: 4px;
  padding: 10px 12px;
}
.about-grid {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 14px;
}
.about-grid .k {
  color: #9d9d9d;
}
/* About > Credits */
.credits {
  overflow: auto;
}
.credits-list {
  margin: 0 0 10px;
  padding-left: 18px;
}
.credits-list li span {
  color: #9d9d9d;
  margin-left: 4px;
}

/* generic dark table for dialogs */
.table-abv {
  --bs-table-bg: var(--abv-panel);
  --bs-table-color: var(--abv-text);
  --bs-table-border-color: var(--abv-grid);
  --bs-table-striped-bg: var(--abv-alt);
  --bs-table-striped-color: var(--abv-text);
  --bs-table-hover-bg: #3e3e42;
  --bs-table-hover-color: #ffffff;
  font-size: 13px;
  margin: 0;
}
.table-abv th {
  background: var(--abv-header);
  color: #e0e0e0;
  border-bottom: 1px solid var(--abv-accent);
  white-space: nowrap;
}
.table-abv td,
.table-abv th {
  padding: 4px 8px;
  vertical-align: middle;
}
.table-abv .current-row td {
  color: var(--abv-changed);
}
.dialog-scroll {
  max-height: 55vh;
  overflow: auto;
  border: 1px solid var(--abv-border);
  border-radius: 4px;
}
.badge-abv {
  background: #3c3c3c;
  border: 1px solid var(--abv-border-strong);
  color: var(--abv-text);
  font-weight: 400;
}

/* ---------- login ---------- */
.login-view {
  height: 100vh;
  height: 100dvh;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: radial-gradient(circle at 50% 20%, #252526 0, var(--abv-bg) 60%);
}
.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--abv-panel);
  border: 1px solid var(--abv-border);
  border-radius: 6px;
  padding: 24px 22px 18px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
}
.login-card .brand {
  text-align: center;
  margin-bottom: 18px;
}
.login-card .brand img {
  width: 48px;
  height: 48px;
}
.login-card .brand h1 {
  font-size: 24px;
  font-weight: 700;
  margin: 8px 0 2px;
  color: #ffffff;
}
.login-card .brand p {
  color: #9d9d9d;
  margin: 0;
  font-size: 12px;
}
.login-card .btn-abv {
  width: 100%;
}
.login-card .switch {
  text-align: center;
  margin-top: 12px;
  color: #9d9d9d;
}
.pw-wrap {
  position: relative;
}
.pw-wrap .form-control {
  padding-right: 58px;
}
.pw-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--abv-accent-light);
  font-size: 12px;
  padding: 4px 8px;
}
.alert-abv {
  background: rgba(229, 57, 53, 0.12);
  border: 1px solid rgba(229, 57, 53, 0.5);
  color: #ff8a80;
  border-radius: 4px;
  padding: 6px 10px;
  font-size: 12.5px;
}
.alert-abv.info {
  background: rgba(0, 122, 204, 0.12);
  border-color: rgba(0, 122, 204, 0.5);
  color: #9cd3ff;
}
.boot-splash {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #9d9d9d;
}


/* ---------- phone list (compact rows, search bar, selection bar) ---------- */
.m-listbar,
.m-selbar {
  display: none;
}
.save-actions,
.tex-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.tex-actions {
  gap: 8px;
}
.asset-table.compact {
  --abv-row-h: 64px;
}
.asset-table.compact .thead {
  display: none;
}
.asset-table.compact .tr {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-width: 0;
  padding: 0 10px;
  border-bottom: 1px solid var(--abv-grid);
}
.asset-table.compact .tbody {
  width: 100%;
}
.asset-table.compact .scroller {
  overflow-x: hidden;
}
.asset-table .m-cell {
  flex: 1 1 auto;
  min-width: 0;
  line-height: 1.25;
}
.asset-table .m-cell > div {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.asset-table .m-name {
  font-size: 14.5px;
  color: var(--abv-text);
}
.asset-table .m-meta {
  font-size: 12px;
  color: #a0a0a0;
  margin-top: 2px;
}
.asset-table .m-sub {
  font-size: 11.5px;
  color: #7a7a7a;
}
.asset-table .tr.changed .m-name {
  color: var(--abv-changed);
}
.asset-table .m-name.is-placeholder {
  color: var(--abv-dim);
}
.asset-table .tr.selected .m-name {
  color: #ffffff;
}
.asset-table .tr.selected.changed .m-name {
  color: var(--abv-changed);
}
.asset-table .tr.selected .m-meta,
.asset-table .tr.selected .m-sub {
  color: #c6d8e8;
}
.asset-table .m-check {
  display: none;
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  border: 1.5px solid #8a8a8a;
  border-radius: 50%;
}
.asset-table.select-mode .m-check {
  display: block;
}
.asset-table .tr.selected .m-check {
  border-color: var(--abv-accent-light);
  background: var(--abv-accent) url("../icons/check-solid.svg") no-repeat center / 12px 12px;
}
.asset-table.compact .tr.cursor .td:first-child {
  box-shadow: none;
}
.m-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--abv-accent);
  color: #ffffff;
  font-size: 11px;
  line-height: 17px;
  text-align: center;
}

/* ---------- mobile ---------- */
.mobile-only {
  display: none !important;
}
.mobile-tabs {
  display: none;
}

@media (max-width: 767.98px) {
  /* iOS zooms into inputs below 16px */
  .form-control,
  .form-select {
    font-size: 16px;
  }
  .btn-abv {
    min-height: 32px;
  }
  .modal-footer .btn-abv {
    min-width: 76px;
    min-height: 34px;
  }
  .m-listbar {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
  }
  .m-search {
    flex: 1 1 auto;
    min-width: 0;
  }
  .m-search .form-control {
    height: 32px;
    padding-top: 2px;
    padding-bottom: 2px;
  }
  .m-icon {
    position: relative;
    width: 38px;
    height: 32px;
    padding: 0;
    flex: 0 0 auto;
  }
  /* Counts on their own row, then the selection buttons */
  .m-selbar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0 2px;
  }
  .m-selbar .spacer {
    flex: 1 1 auto;
  }
  .m-selbar .btn-abv {
    padding: 4px 9px;
  }
  /* Room for the longer label so the button keeps its width when it flips */
  #mSelectAllBtn {
    min-width: 7.6em;
  }
  .save-actions,
  .tex-actions {
    position: sticky;
    bottom: -12px;
    background: var(--abv-bg);
    margin: 0 -12px -12px;
    padding: 10px 12px calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--abv-border);
    z-index: 2;
  }
  .save-dialog .controls {
    gap: 8px;
  }
  .statusbar {
    padding-bottom: calc(2px + env(safe-area-inset-bottom));
  }
  .filter-menu .fm-item {
    padding: 9px 10px;
  }
  .filter-menu {
    min-width: 240px;
  }
  .ctx-menu .dropdown-item {
    padding: 9px 12px;
  }
  /* Wide dialog tables become one card per row */
  .table-cards thead {
    display: none;
  }
  .table-cards tbody tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 12px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--abv-grid);
  }
  .table-cards tbody tr:nth-child(even) {
    background: var(--abv-alt);
  }
  .table-cards td {
    display: block;
    padding: 0;
    border: 0;
    background: transparent !important;
    box-shadow: none !important;
    min-width: 0;
    overflow-wrap: anywhere;
  }
  .table-cards td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: 11px;
    color: #8a8a8a;
  }
  .table-cards td.cell-title {
    grid-column: 1 / -1;
    font-size: 15px;
  }
  /* Actions sit in the card's top-right corner, next to the title. */
  .table-cards tbody tr {
    position: relative;
  }
  .table-cards td.cell-actions {
    position: absolute;
    top: 6px;
    right: 8px;
    width: auto;
    min-width: 0;
  }
  .table-cards td.cell-actions:empty {
    display: none;
  }
  .table-cards td.cell-actions .icon-btn {
    width: 38px;
    height: 34px;
  }
  .table-cards td.cell-actions .icon-btn .ico {
    width: 16px;
    height: 16px;
  }
  .table-cards tr:has(.row-actions) td.cell-title {
    padding-right: calc(3 * 38px + 2 * 4px + 8px);
    min-height: 34px;
  }
  .dialog-scroll {
    max-height: none;
  }
  .mobile-only {
    display: inline-flex !important;
  }
  .desktop-only {
    display: none !important;
  }
  :root {
    --abv-row-h: 34px;
  }
  .main {
    padding: 6px 4px 4px;
  }
  .splitter {
    display: none;
  }
  .left-panel,
  .right-panel {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0 2px;
  }
  .app[data-mobile-view="list"] .right-panel,
  .app[data-mobile-view="preview"] .left-panel {
    display: none;
  }
  .btn-abv {
    min-width: 0;
    padding: 4px 10px;
  }
  .btn-abv .txt-long {
    display: none;
  }
  .menubar {
    height: 34px;
  }
  .menubar .menu-btn {
    line-height: 34px;
    /* a little tighter on narrow phones; what still does not fit goes in the arrow menu */
    padding: 0 clamp(6px, calc((100vw - 300px) / 10), 10px);
    font-size: 14px;
  }
  .menubar .workspace-name {
    display: none;
  }
  .qmenu .dropdown-item {
    padding: 8px 10px 8px 8px;
    font-size: 14px;
  }
  .qmenu .dropdown-item .shortcut {
    display: none;
  }
  /* A submenu opens in place: its parent turns bold and its items sit in an indented, slightly
     shaded panel with a bright rule on the left, so levels can be told apart at a glance. */
  /* The item whose submenu is open keeps its own background and gets the outline a hovered item has. */
  .qmenu .submenu.open > .dropdown-item {
    font-weight: 600;
    background: transparent;
    border-color: var(--abv-accent);
  }
  .qmenu .submenu.open > .dropdown-item:active {
    background: var(--abv-select);
  }
  .qmenu .submenu > .dropdown-menu {
    position: static;
    margin: 0 0 4px 14px;
    padding: 2px 0 2px 4px;
    border: 0;
    border-left: 2px solid var(--abv-select);
    border-radius: 0 4px 4px 0;
    box-shadow: none;
    background: rgba(255, 255, 255, 0.015);
  }
  /* Items of a submenu start further in than the item that opened it. */
  .qmenu .submenu > .dropdown-menu > li > .dropdown-item {
    padding-left: 24px;
  }
  /* The rule takes the menu's highlight colour and brightens with each level, like the shade behind it. */
  .qmenu .submenu > .dropdown-menu .submenu > .dropdown-menu {
    border-left-color: color-mix(in srgb, var(--abv-select) 75%, #ffffff);
  }
  .qmenu .submenu > .dropdown-item::after {
    transform: rotate(45deg);
  }
  .qmenu .submenu.open > .dropdown-item::after {
    transform: rotate(-135deg);
  }
  .dropdown-menu.qmenu {
    max-height: calc(100dvh - 60px);
    overflow: auto;
  }
  .statusbar .qprogress {
    width: 90px;
  }
  .qtabs .tab {
    padding: 4px 14px;
  }
  .qtabs .tab.active {
    padding-bottom: 5px;
  }
  .save-dialog .modal-body,
  .texture-dialog .modal-body {
    flex-direction: column;
    min-height: 0;
  }
  .save-dialog .file-list {
    min-height: 220px;
    max-height: 40vh;
  }
  .texture-dialog .previews {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .texture-dialog .previews > .cap {
    flex: 0 0 calc(50% - 3px);
    order: 0;
  }
  .texture-dialog .tex-preview {
    flex: 0 0 calc(50% - 3px);
    min-height: 120px;
    height: 28vw;
    order: 1;
  }
  .texture-dialog .options {
    flex: 1 1 auto;
  }
  .texture-dialog .opt-row {
    grid-template-columns: 1fr 1.4fr;
  }
  .drop-overlay .do-title {
    font-size: 30px;
  }
  .drop-overlay .do-body {
    font-size: 18px;
  }
  /* Every dialog keeps a gap to the screen edges (and to the notch). The gap is padding on
     .modal rather than margin on .modal-dialog, so it also holds for the full-screen and
     max-width dialogs, which would otherwise fill the whole width. */
  .modal {
    --abv-modal-gap: 16px;
    --bs-modal-margin: 0px;
    padding: max(var(--abv-modal-gap), env(safe-area-inset-top)) max(var(--abv-modal-gap), env(safe-area-inset-right))
      max(var(--abv-modal-gap), env(safe-area-inset-bottom)) max(var(--abv-modal-gap), env(safe-area-inset-left));
  }
  .modal-dialog {
    margin: 0 auto;
  }
  /* Bootstrap's "fullscreen below md" would fill the screen; keep it a tall dialog inside the gap. */
  .modal-dialog.modal-fullscreen-md-down {
    width: 100%;
    height: 100%;
    margin: 0 auto;
  }
  .modal-fullscreen-md-down .modal-content {
    border: var(--bs-modal-border-width) solid var(--bs-modal-border-color);
    border-radius: var(--bs-modal-border-radius);
  }
  .modal-fullscreen-md-down .modal-header {
    border-radius: var(--bs-modal-inner-border-radius) var(--bs-modal-inner-border-radius) 0 0;
  }
  .modal-fullscreen-md-down .modal-footer {
    border-radius: 0 0 var(--bs-modal-inner-border-radius) var(--bs-modal-inner-border-radius);
  }
}

/* ---------- guest mode ---------- */
.guest-mode .user-only,
body:not(.guest-mode) .guest-only {
  display: none !important;
}
.quota-badge {
  font-size: 12px;
  color: #bdbdbd;
  white-space: nowrap;
  cursor: pointer;
}
.quota-badge.low {
  color: #f0c674;
}
.quota-badge.out {
  color: #ff8a80;
}
.dialog-note {
  font-size: 12px;
  color: #9e9e9e;
}
/* Tools > Game Files */
.game-target {
  display: grid;
  grid-template-columns: 1fr 1fr 1.4fr;
  gap: 8px;
}
@media (max-width: 575.98px) {
  .game-target {
    grid-template-columns: 1fr 1fr;
  }
  .game-target .game-method {
    grid-column: 1 / -1;
  }
}
.game-target .form-label {
  font-size: 12px;
  color: #9e9e9e;
}
.game-search {
  display: flex;
  gap: 8px;
}
.game-case {
  /* A square as tall as the search box (taller on phones, where inputs use 16px text). */
  --game-case-size: 32px;
  flex: 0 0 auto;
  align-self: flex-start;
  width: var(--game-case-size);
  min-width: 0;
  height: var(--game-case-size);
  padding: 0;
}
@media (max-width: 767.98px) {
  .game-case {
    --game-case-size: 36px;
  }
}
.game-case .ico {
  width: 24px;
  height: 24px;
}
.game-case[aria-pressed="true"] {
  border-color: var(--abv-accent);
  background-color: rgba(0, 122, 204, 0.35);
}
.game-list {
  min-height: 140px;
  /* Dragging over rows chooses them; it must not select the text. */
  user-select: none;
}
.game-list .empty {
  /* The hint or "Searching..." sits in the middle of the list area. */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 138px;
  padding: 12px;
  text-align: center;
  color: #8a8a8a;
  white-space: normal;
}
.game-list .item .name {
  flex: 1 1 auto;
}
.game-list .item .meta {
  max-width: 55%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.game-footer .game-summary {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 12px;
  color: #9e9e9e;
}
@media (max-width: 767.98px) {
  .game-footer {
    flex-wrap: wrap;
  }
  .game-footer .game-summary {
    flex-basis: 100%;
  }
  .game-list .item .meta {
    max-width: 100%;
  }
}
.login-card .hint {
  font-size: 12px;
  color: #9e9e9e;
  margin-top: 4px;
}
.turnstile-box {
  display: flex;
  justify-content: center;
}
/* Kept rendered (off screen) while hidden so the widget keeps working; shown
   centred only when Turnstile needs the user. */
.verify-popup {
  position: fixed;
  top: 0;
  left: -200vw;
  width: 100vw;
  height: 100dvh;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  pointer-events: none;
}
.verify-popup.show {
  left: 0;
  opacity: 1;
  pointer-events: auto;
}
.verify-card {
  position: relative;
  max-width: 100%;
  padding: 28px 16px 16px;
  border: 1px solid var(--abv-border);
  border-radius: 6px;
  background: var(--abv-panel);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}
.verify-card .btn-close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 10px;
  height: 10px;
}

/* ---------- form dialogs (Change password, Add user, Reset password) ---------- */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.section-head h6 {
  margin: 0;
}
.form-dialog .modal-dialog {
  max-width: 420px;
}
.form-dialog .modal-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.form-dialog .form-label {
  margin: 6px 0 0;
}
.form-dialog .form-label:first-child {
  margin-top: 0;
}
.form-dialog .form-note {
  margin: 0 0 4px;
  color: #c8c8c8;
}
.form-dialog .form-error {
  margin-top: 8px;
}

/* ---------- action column in dialog tables ---------- */
/* Three icon buttons wide; rows with more actions use a "more" menu. */
.table-abv .col-actions {
  width: calc(3 * 30px + 2 * 4px + 16px);
  min-width: calc(3 * 30px + 2 * 4px + 16px);
}
.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
}
.qmenu .dropdown-item.danger:not(.disabled) .label {
  color: #ff8a80;
}

/* Stacked dialogs: only the top dialog's backdrop is drawn, so the dialogs
   below it are dimmed like the page. */
.modal-backdrop {
  transition: opacity 0.15s linear;
}
.modal-backdrop.backdrop-under {
  opacity: 0 !important;
}

/* Option help tooltips: one line per choice */
.abv-tooltip .tooltip-inner {
  white-space: pre-line;
  text-align: left;
  max-width: 320px;
}

/* Donation links */
.support-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
}
.support-links a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.support-links .ico {
  width: 14px;
  height: 14px;
}
.asset-table .empty-state .support-hint {
  margin-top: 14px;
}
.support-hint .ico {
  width: 12px;
  height: 12px;
  opacity: 0.6;
  margin-right: 5px;
  vertical-align: -1px;
}

/* ---------- Atlas Toolkit panel (an iframe of /atlas-toolkit/) ---------- */
/* Under Bootstrap's modals (1055) so ABVME's own dialogs show on top. */
.atk-panel {
  position: fixed;
  inset: 0;
  z-index: 1045;
  display: flex;
  flex-direction: column;
  background: var(--abv-bg);
}
.atk-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 4px 8px 4px 12px;
  background: var(--abv-menubar);
  border-bottom: 1px solid var(--abv-border);
  white-space: nowrap;
}
.atk-head .atk-title {
  font-weight: 600;
  color: #fff;
}
.atk-head .atk-version {
  color: #9d9d9d;
  font-size: 0.85em;
}
.atk-head .atk-name {
  color: #9d9d9d;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.atk-head .atk-status {
  color: var(--abv-accent-light);
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.atk-body {
  flex: 1 1 auto;
  min-height: 0;
  background: #2b2b2b; /* Atlas Toolkit's own background: no white while the frame loads */
}
.atk-body.atk-loading iframe {
  visibility: hidden; /* until Atlas Toolkit's styles are in (frontend/js/atlas-toolkit.js) */
}
.atk-body iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}
.atk-head .spacer {
  flex: 1 1 auto;
}

/* Tools > Atlas Toolkit: choose an atlas. The atlas name on top, its file
   under it (both cut with … when long: the full text is in the tooltip), the
   status on the right. */
.atlas-list {
  overflow-x: hidden;
}
.atlas-list .item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 10px;
  row-gap: 1px;
  align-items: center;
  padding: 5px 8px;
  cursor: pointer;
}
.atlas-list .item .name,
.atlas-list .item .meta {
  grid-column: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.atlas-list .item .name {
  grid-row: 1;
}
.atlas-list .item .meta {
  grid-row: 2;
  margin-left: 0;
  font-size: 12px;
}
.atlas-list .item.selected .meta {
  color: #c5d5e6;
}
.atlas-list .item.selected {
  background: var(--abv-select);
  color: #fff;
}
.atlas-list .item.disabled {
  cursor: default;
  color: #8a8a8a;
}
.atlas-list .item:focus-visible {
  outline: 1px solid var(--abv-accent);
  outline-offset: -1px;
}
.atlas-list .st {
  grid-column: 2;
  grid-row: 1 / span 2;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.atlas-list .st.warn {
  color: #d8b35a;
  border-color: #7a6431;
}
.atlas-list .st.err {
  color: #ff8a80;
  border-color: #7a3a36;
}
.atlas-list .empty {
  padding: 12px;
  color: #9d9d9d;
}
@media (max-width: 767.98px) {
  /* phones: the name may wrap, the status goes under the file */
  .atlas-list .item {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 3px;
  }
  .atlas-list .item .name {
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .atlas-list .st {
    grid-column: 1;
    grid-row: 3;
    justify-self: start;
    max-width: 100%;
    white-space: normal;
  }
}

/* A line of text in a menu (e.g. Tools for guests) */
.qmenu .menu-note {
  padding: 4px 12px 6px;
  font-size: 12px;
  color: #9d9d9d;
  white-space: nowrap;
}

/* File > Open Recent: long names are cut, the full list is in the tooltip */
#recentList {
  max-width: min(460px, 92vw);
}
#recentList .dropdown-item .label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
