@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&display=swap");

/* ── Qt Fusion window chrome ── */
.qt-app {
  font-family: var(--qt-font);
  font-size: 13px;
  color: var(--qt-text);
  background: var(--qt-base);
  height: 100svh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  user-select: none;
}

/* Title bar */
.qt-titlebar {
  height: 32px;
  background: var(--qt-dark);
  border-bottom: 1px solid var(--qt-midlight);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0 0 12px;
  flex-shrink: 0;
}

.qt-titlebar__brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--qt-text);
}

.qt-titlebar__icon {
  width: 16px;
  height: 16px;
  position: relative;
}

.qt-titlebar__icon::before {
  content: "";
  position: absolute;
  inset: 2px;
  border: 1px solid var(--qt-highlight);
  border-radius: 1px;
}

.qt-titlebar__icon::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 3px;
  bottom: 3px;
  width: 1px;
  background: var(--qt-highlight);
  transform: translateX(-50%);
}

.qt-titlebar__title {
  font-size: 12px;
  font-weight: 600;
}

.qt-titlebar__home {
  font-size: 11px;
  color: var(--qt-text-muted);
  text-decoration: none;
  padding: 0 12px;
}

.qt-titlebar__home:hover {
  color: var(--qt-highlight);
}

.qt-titlebar__controls {
  display: flex;
  height: 100%;
}

.qt-titlebar__btn {
  width: 46px;
  height: 100%;
  border: none;
  background: transparent;
  color: var(--qt-text-muted);
  font-size: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qt-titlebar__btn:hover {
  background: var(--qt-alt-base);
  color: var(--qt-text);
}

.qt-titlebar__btn--close:hover {
  background: #e74c3c;
  color: white;
}

/* Menu bar */
.qt-menubar {
  height: 28px;
  background: var(--qt-alt-base);
  border-bottom: 1px solid var(--qt-midlight);
  display: flex;
  align-items: center;
  padding: 0 8px;
  gap: 2px;
  flex-shrink: 0;
}

.qt-menu-item {
  padding: 4px 10px;
  font-size: 12px;
  color: var(--qt-text);
  border-radius: var(--qt-radius);
  cursor: default;
}

.qt-menu-item:hover {
  background: var(--qt-highlight-dim);
}

/* Main layout */
.qt-body {
  flex: 1;
  display: flex;
  min-height: 0;
}

/* Sidebar tree */
.qt-sidebar {
  width: 240px;
  background: var(--qt-dark);
  border-right: 1px solid var(--qt-midlight);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.qt-sidebar__header {
  padding: 10px 12px;
  font-family: var(--bl-font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--qt-text-muted);
  border-bottom: 1px solid var(--qt-midlight);
}

.qt-tree {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
}

.qt-tree-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px 5px 8px;
  font-size: 12px;
  cursor: pointer;
  color: var(--qt-text);
}

.qt-tree-item:hover {
  background: var(--qt-highlight-dim);
}

.qt-tree-item.active {
  background: var(--qt-highlight);
  color: var(--qt-highlight-text, #fff);
}

.qt-tree-item__arrow {
  width: 12px;
  font-size: 8px;
  color: var(--qt-text-muted);
  text-align: center;
  flex-shrink: 0;
}

.qt-tree-item__icon {
  width: 14px;
  text-align: center;
  font-size: 11px;
  flex-shrink: 0;
}

.qt-tree-item--child {
  padding-left: 28px;
}

.qt-tree-item--child2 {
  padding-left: 44px;
}

.qt-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.qt-status-dot--closed { background: var(--qt-danger); }
.qt-status-dot--open { background: var(--qt-success); }
.qt-status-dot--warn { background: var(--qt-warning); }

/* Content area */
.qt-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--qt-base);
}

/* Tab bar */
.qt-tabs {
  display: flex;
  background: var(--qt-alt-base);
  border-bottom: 1px solid var(--qt-midlight);
  padding: 0 8px;
  flex-shrink: 0;
}

.qt-tab {
  padding: 8px 16px;
  font-size: 12px;
  color: var(--qt-text-muted);
  border: none;
  background: transparent;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-family: var(--qt-font);
}

.qt-tab:hover {
  color: var(--qt-text);
}

.qt-tab.active {
  color: var(--qt-text);
  background: var(--qt-base);
  border: 1px solid var(--qt-midlight);
  border-bottom-color: var(--qt-base);
  border-radius: var(--qt-radius) var(--qt-radius) 0 0;
}

/* Toolbar */
.qt-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--qt-alt-base);
  border-bottom: 1px solid var(--qt-midlight);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.qt-toolbar__sep {
  width: 1px;
  height: 20px;
  background: var(--qt-midlight);
  margin: 0 4px;
}

.qt-input {
  height: 28px;
  padding: 0 10px;
  background: var(--qt-dark);
  border: 1px solid var(--qt-mid);
  border-radius: var(--qt-radius);
  color: var(--qt-text);
  font-family: var(--qt-font);
  font-size: 12px;
  min-width: 200px;
}

.qt-input:focus {
  outline: none;
  border-color: var(--qt-highlight);
}

.qt-select {
  height: 28px;
  padding: 0 8px;
  background: var(--qt-dark);
  border: 1px solid var(--qt-mid);
  border-radius: var(--qt-radius);
  color: var(--qt-text);
  font-family: var(--qt-font);
  font-size: 12px;
}

.qt-btn {
  height: 28px;
  padding: 0 14px;
  background: var(--qt-button);
  border: 1px solid var(--qt-mid);
  border-radius: var(--qt-radius);
  color: var(--qt-text);
  font-family: var(--qt-font);
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.qt-btn:hover {
  border-color: var(--qt-highlight);
}

.qt-btn--primary {
  background: var(--qt-highlight);
  border-color: var(--qt-highlight);
  color: #fff;
}

.qt-btn--primary:hover {
  background: #5cc4f5;
}

/* Panel workspace */
.qt-workspace {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
}

.qt-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.qt-panel--detail {
  width: 340px;
  flex: none;
  border-left: 1px solid var(--qt-midlight);
  background: var(--qt-dark);
}

/* Data table */
.qt-table-wrap {
  flex: 1;
  overflow: auto;
}

.qt-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.qt-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
}

.qt-table th {
  background: var(--qt-dark);
  border-bottom: 1px solid var(--qt-midlight);
  border-right: 1px solid var(--qt-midlight);
  padding: 8px 12px;
  text-align: left;
  font-weight: 600;
  color: var(--qt-text);
  white-space: nowrap;
  cursor: pointer;
}

.qt-table th:hover {
  background: var(--qt-alt-base);
}

.qt-table th.sorted {
  color: var(--qt-highlight);
}

.qt-table td {
  padding: 7px 12px;
  border-bottom: 1px solid var(--qt-midlight);
  border-right: 1px solid rgba(58, 63, 68, 0.5);
  white-space: nowrap;
}

.qt-table tbody tr {
  cursor: pointer;
}

.qt-table tbody tr:nth-child(even) {
  background: rgba(49, 54, 59, 0.45);
}

.qt-table tbody tr:hover {
  background: var(--qt-highlight-dim);
}

.qt-table tbody tr.selected {
  background: rgba(61, 174, 233, 0.25);
}

.qt-table .mono {
  font-family: var(--bl-font-mono);
  font-size: 11px;
}

.qt-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--qt-radius);
  font-size: 10px;
  font-family: var(--bl-font-mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.qt-badge--closed {
  background: rgba(231, 76, 60, 0.2);
  color: #e74c3c;
  border: 1px solid rgba(231, 76, 60, 0.4);
}

.qt-badge--open {
  background: rgba(39, 174, 96, 0.2);
  color: #27ae60;
  border: 1px solid rgba(39, 174, 96, 0.4);
}

.qt-badge--sell {
  background: rgba(61, 174, 233, 0.15);
  color: var(--qt-highlight);
  border: 1px solid rgba(61, 174, 233, 0.35);
}

.qt-badge--buy {
  background: rgba(243, 156, 18, 0.15);
  color: var(--qt-warning);
  border: 1px solid rgba(243, 156, 18, 0.35);
}

.qt-badge--sold {
  background: rgba(156, 163, 175, 0.12);
  color: var(--qt-text-muted);
  border: 1px solid rgba(156, 163, 175, 0.35);
}

.qt-listing--sold {
  opacity: 0.82;
}

.qt-listing--sold:hover {
  border-color: var(--qt-mid);
}

.qt-listing__parties {
  font-size: 11px;
  color: var(--qt-text-muted);
  margin-top: 6px;
}

.qt-listing__source {
  font-size: 10px;
  color: var(--qt-text-muted);
  margin-top: 8px;
  line-height: 1.45;
  font-style: italic;
}

.qt-market-note {
  margin: 0;
  padding: 10px 16px;
  font-size: 11px;
  color: var(--qt-text-muted);
  border-bottom: 1px solid var(--qt-midlight);
  line-height: 1.5;
}

/* Detail panel */
.qt-detail {
  padding: 16px;
  overflow-y: auto;
  height: 100%;
}

.qt-detail__title {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 4px;
}

.qt-detail__sub {
  font-family: var(--bl-font-mono);
  font-size: 10px;
  color: var(--qt-text-muted);
  margin-bottom: 16px;
}

.qt-detail__group {
  margin-bottom: 16px;
}

.qt-detail__label {
  font-family: var(--bl-font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--qt-text-muted);
  margin-bottom: 4px;
}

.qt-detail__value {
  font-size: 13px;
  line-height: 1.5;
}

.qt-detail__divider {
  height: 1px;
  background: var(--qt-midlight);
  margin: 16px 0;
}

/* Cards grid (basins view) */
.qt-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  padding: 16px;
  overflow-y: auto;
  flex: 1;
}

.qt-card {
  background: var(--qt-alt-base);
  border: 1px solid var(--qt-midlight);
  border-radius: var(--qt-radius);
  padding: 16px;
}

.qt-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.qt-card__title {
  font-size: 13px;
  font-weight: 600;
  margin: 0;
}

.qt-card__meta {
  font-family: var(--bl-font-mono);
  font-size: 10px;
  color: var(--qt-text-muted);
  margin-top: 4px;
}

.qt-card__stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--qt-midlight);
}

.qt-card__stat-label {
  font-size: 10px;
  color: var(--qt-text-muted);
  font-family: var(--bl-font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.qt-card__stat-value {
  font-size: 14px;
  font-weight: 600;
  margin-top: 2px;
}

/* Market listings */
.qt-listings {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
}

.qt-listing {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 14px 16px;
  background: var(--qt-alt-base);
  border: 1px solid var(--qt-midlight);
  border-radius: var(--qt-radius);
  margin-bottom: 8px;
  cursor: pointer;
}

.qt-listing:hover {
  border-color: var(--qt-highlight);
}

.qt-listing__type {
  width: 48px;
  text-align: center;
}

.qt-listing__title {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 4px;
}

.qt-listing__desc {
  font-size: 12px;
  color: var(--qt-text-muted);
  line-height: 1.45;
}

.qt-listing__meta {
  text-align: right;
  font-family: var(--bl-font-mono);
  font-size: 11px;
}

/* Reference content */
.qt-ref {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
  max-width: 720px;
  line-height: 1.6;
}

.qt-ref h2 {
  font-size: 16px;
  font-weight: 600;
  margin: 24px 0 8px;
  color: var(--qt-highlight);
}

.qt-ref h2:first-child {
  margin-top: 0;
}

.qt-ref p,
.qt-ref li {
  font-size: 13px;
  color: var(--qt-text-muted);
}

.qt-ref ol {
  padding-left: 20px;
}

.qt-ref li {
  margin-bottom: 8px;
}

.qt-ref .notice {
  background: rgba(243, 156, 18, 0.1);
  border: 1px solid rgba(243, 156, 18, 0.3);
  border-radius: var(--qt-radius);
  padding: 12px 14px;
  font-size: 12px;
  color: var(--qt-warning);
  margin-bottom: 20px;
}

/* Status bar */
.qt-statusbar {
  height: 24px;
  background: var(--qt-dark);
  border-top: 1px solid var(--qt-midlight);
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 16px;
  flex-shrink: 0;
  font-family: var(--bl-font-mono);
  font-size: 10px;
  color: var(--qt-text-muted);
}

.qt-statusbar__item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.qt-statusbar__sep {
  width: 1px;
  height: 12px;
  background: var(--qt-midlight);
}

/* View panes */
.qt-view {
  display: none;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.qt-view.active {
  display: flex;
}

/* Pro banner */
.qt-pro-banner {
  background: linear-gradient(90deg, rgba(61, 174, 233, 0.12) 0%, transparent 100%);
  border-bottom: 1px solid rgba(61, 174, 233, 0.25);
  padding: 8px 16px;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.qt-pro-banner a {
  color: var(--qt-highlight);
  text-decoration: none;
}

@media (max-width: 900px) {
  .qt-sidebar {
    display: none;
  }

  .qt-panel--detail {
    display: none;
  }
}

.qt-sidebar__footer {
  margin-top: auto;
  padding: 12px;
  border-top: 1px solid var(--qt-midlight);
  font-size: 11px;
}

.qt-sidebar__footer a {
  color: var(--qt-link);
  text-decoration: none;
}

.qt-market-empty {
  padding: 24px;
  color: var(--qt-text-muted);
  font-size: 13px;
}

.qt-toast {
  position: fixed;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  max-width: min(480px, 90vw);
  padding: 10px 16px;
  background: var(--qt-alt-base);
  border: 1px solid var(--qt-highlight);
  border-radius: var(--qt-radius);
  font-size: 12px;
  color: var(--qt-text);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 200;
}

.qt-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.qt-btn--pro[disabled] {
  opacity: 0.85;
}

