/* 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);
}
.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 {
  background: var(--abv-select);
  border-color: var(--abv-accent);
  color: #ffffff;
}
.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:hover > .dropdown-menu,
.qmenu .submenu.open > .dropdown-menu {
  display: block;
}
.qmenu .dropdown-header {
  color: #e0e0e0;
  font-weight: 600;
  padding: 3px 8px;
  font-size: 13px;
}

.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;
}
.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;
}
.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 */
.photo-viewer {
  background: #1e1e1e;
  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;
}
.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;
}
.license-text {
  white-space: pre-wrap;
  font-size: 12px;
  max-height: 260px;
  overflow: auto;
  background: var(--abv-panel);
  margin: 0;
  padding: 8px;
}

/* 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: 38px;
  }
  .modal-footer .btn-abv {
    min-width: 76px;
    min-height: 40px;
  }
  .m-listbar {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
  }
  .m-search {
    flex: 1 1 auto;
    min-width: 0;
  }
  .m-search .form-control {
    height: 38px;
  }
  .m-icon {
    position: relative;
    width: 40px;
    height: 38px;
    padding: 0;
    flex: 0 0 auto;
  }
  .app.select-mode .m-selbar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 0 2px;
  }
  .app.select-mode .table-footer {
    display: none;
  }
  .m-selcount {
    flex: 1 1 auto;
    color: var(--abv-text);
  }
  .m-selbar .btn-abv {
    padding: 6px 12px;
  }
  .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: 7px 10px;
  }
  .btn-abv .txt-long {
    display: none;
  }
  .menubar {
    height: 34px;
  }
  .menubar .menu-btn {
    line-height: 34px;
    padding: 0 10px;
    font-size: 14px;
  }
  .menubar .workspace-name,
  .menubar #userName {
    display: none;
  }
  .qmenu .dropdown-item {
    padding: 8px 10px 8px 8px;
    font-size: 14px;
  }
  .qmenu .dropdown-item .shortcut {
    display: none;
  }
  .qmenu .submenu > .dropdown-menu {
    position: static;
    border: 0;
    box-shadow: none;
    padding-left: 18px;
    background: transparent;
  }
  .qmenu .submenu > .dropdown-item::after {
    transform: rotate(45deg);
  }
  .dropdown-menu.qmenu {
    max-height: calc(100dvh - 60px);
    overflow: auto;
  }
  .statusbar .qprogress {
    width: 90px;
  }
  .qtabs .tab {
    padding: 7px 16px;
  }
  .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;
  }
  .modal-dialog {
    margin: 8px;
  }
  /* Full-screen dialogs are already 100vw wide; a margin would push them off-screen. */
  .modal-dialog.modal-fullscreen-md-down {
    margin: 0;
  }
  .modal-fullscreen-md-down .modal-content,
  .modal-fullscreen-md-down .modal-header {
    border-radius: 0;
  }
  .modal-fullscreen-md-down .modal-header {
    padding-top: calc(6px + env(safe-area-inset-top));
  }
}

/* ---------- guest mode ---------- */
.guest-mode .user-only,
body:not(.guest-mode) .guest-only {
  display: none !important;
}
.guest-badge {
  font-size: 12px;
  color: #bdbdbd;
  white-space: nowrap;
  cursor: pointer;
}
.guest-badge.low {
  color: #f0c674;
}
.guest-badge.out {
  color: #ff8a80;
}
.dialog-note {
  font-size: 12px;
  color: #9e9e9e;
}
.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;
}
