/* Admin Economy pane — built on tokens.css. Reuses .btn from buttons.css for
   all action buttons; this file only adds layout / subtab styling. */

.adm-eco-subtabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.adm-eco-subtab {
  padding: 6px 12px;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  color: var(--muted);
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
}
.adm-eco-subtab:hover {
  background: linear-gradient(180deg, #322a23, var(--surface-2));
  color: var(--text);
}
.adm-eco-subtab.active {
  background: linear-gradient(180deg, var(--accent-soft), var(--accent));
  color: var(--text);
  border-color: rgba(70,110,95,0.55);
}

.adm-eco-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.adm-eco-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px;
  box-shadow: var(--shadow-card);
}
.adm-eco-card h3 { margin: 0 0 8px; font-size: 14px; color: var(--text); }

.adm-eco-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.adm-eco-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-card);
}
.adm-eco-form h3 { margin: 0 0 6px; font-size: 14px; color: var(--text); }
.adm-eco-form label {
  font-size: 13px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.adm-eco-form input,
.adm-eco-form select {
  padding: 6px 10px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  font: inherit;
  font-size: 13px;
  min-width: 0;
  flex: 1;
}
.adm-eco-form input:focus,
.adm-eco-form select:focus {
  outline: none;
  border-color: var(--accent-soft);
}
.adm-eco-form input[type="checkbox"] {
  flex: 0 0 auto;
  width: 16px; height: 16px;
}

.adm-eco-tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.adm-eco-tbl.wide td, .adm-eco-tbl.wide th { white-space: nowrap; }
.adm-eco-tbl th {
  color: var(--muted);
  font-weight: 500;
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-2);
}
.adm-eco-tbl td {
  color: var(--text);
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
}
.adm-eco-tbl code {
  color: var(--muted);
  font-size: 12px;
}

/* adm-eco-btn = compact .btn variant. Matches token palette and inherits
   the same look/feel as the global .btn (buttons.css). */
.adm-eco-btn {
  padding: 6px 12px;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  color: var(--text);
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  margin: 0 2px;
  box-shadow: var(--shadow-btn);
  transition: background 0.12s ease, transform 0.06s ease;
}
.adm-eco-btn:hover { background: linear-gradient(180deg, #322a23, var(--surface-2)); }
.adm-eco-btn:active { transform: translateY(1px); }
.adm-eco-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.adm-eco-btn.danger {
  background: linear-gradient(180deg, #b95c43 0%, #883a26 100%);
  color: #fff;
  border-color: rgba(213,106,82,0.55);
}
.adm-eco-btn.danger:hover { background: linear-gradient(180deg, #c96e54 0%, #98442e 100%); }

.ae-pack-row.is-hidden {
  opacity: 0.55;
  background: rgba(213,106,82,0.05);
}

/* Admin account-picker dropdown (datalist replacement). */
.acc-picker-menu {
  position: absolute;
  z-index: 10000;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-card);
  max-height: 280px;
  overflow-y: auto;
  font-size: 13px;
}
.acc-picker-item {
  padding: 6px 10px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.acc-picker-item:last-child { border-bottom: none; }
.acc-picker-item:hover { background: var(--surface-2); }
.acc-picker-name { color: var(--text); font-weight: 500; }
.acc-picker-meta { color: var(--muted); font-size: 11px; margin-top: 2px; }
.acc-picker-empty { padding: 8px 10px; color: var(--muted); }

/* History ledger — delta column color hints. */
.ae-delta-pos { color: var(--ok); }
.ae-delta-neg { color: var(--danger); }

/* ── Marketplace log (Журнал рынка) ───────────────────────────────────── */
.ae-ml-tbl td { vertical-align: middle; }
/* Source-ledger badge */
.ae-ml-src {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  border: 1px solid var(--border);
}
.ae-ml-src-pluses    { background: rgba(120,170,220,0.16); color: #8fc1ec; }
.ae-ml-src-artifact  { background: rgba(200,160,90,0.16);  color: #e0c089; }
.ae-ml-src-inventory { background: rgba(150,200,170,0.16); color: #9ad8b6; }
/* Action (reason) tag */
.ae-ml-reason-tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 6px;
  font-size: 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
}
.ae-ml-r-market_buy            { border-color: rgba(120,170,220,0.5); }
.ae-ml-r-market_sell           { border-color: rgba(150,200,170,0.5); }
.ae-ml-r-ad_package_buy        { border-color: rgba(214,200,154,0.5); }
.ae-ml-r-artifact_buy_refunded { border-color: var(--danger); color: var(--danger); }
.ae-ml-r-list_cancel,
.ae-ml-r-sell_rejected_refund  { color: var(--muted); }
.ae-ml-rollback { font-size: 12px; padding: 2px 8px; }

/* Account reference — shows login; raw id lives in the title tooltip. */
.acct-ref {
  border-bottom: 1px dotted var(--border);
  cursor: help;
}

/* ── Mobile / touch adaptive ─────────────────────────────────────────────── */

/* Wide table: scroll wrapper on narrow screens instead of reflow */
@media (max-width: 640px) {
  .adm-eco-tbl.wide {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* Subtab + action buttons: 44px tap target on mobile */
@media (max-width: 600px) {
  .adm-eco-subtab {
    min-height: 44px;
    min-width: 44px;
    padding: 8px 12px;
    box-sizing: border-box;
  }
  .adm-eco-btn {
    min-height: 44px;
    min-width: 44px;
    padding: 8px 12px;
    box-sizing: border-box;
  }
}

/* Pack rows: wrap to stack on narrow screens */
@media (max-width: 640px) {
  .ae-pack-row {
    flex-wrap: wrap !important;
  }
  .ae-pack-row > div:first-child {
    flex-basis: 100%;
    min-width: 0;
  }
}

/* Account picker: clamp to viewport width */
.acc-picker-menu {
  max-width: calc(100vw - 16px);
}
