:root {
  color-scheme: dark;
  --bg: #0b1220;
  --bg-2: #0f1728;
  --panel: #121d31;
  --panel-2: #17243a;
  --border: rgba(255,255,255,.08);
  --text: #f3f6fb;
  --muted: #97a6ba;
  --accent: #56a8ff;
  --accent-2: rgba(86,168,255,.18);
  --good: #59d189;
  --bad: #ff7878;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: linear-gradient(180deg, var(--bg), var(--bg-2));
  color: var(--text);
  font-family: Inter, system-ui, sans-serif;
  min-height: 100%;
}
button, input, select { font: inherit; }
button { cursor: pointer; }

.app-shell {
  max-width: 760px;
  margin: 0 auto;
  padding: 18px 16px 110px;
}
.app-hidden { visibility: hidden; }
.hidden { display: none !important; }

.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at top, rgba(86,168,255,.12), transparent 32%), linear-gradient(180deg, #0a101c, #0f1728);
}
.loading-screen.hidden { display: none !important; }
.loading-card {
  width: min(100%, 420px);
  background: rgba(18,29,49,.94);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 28px;
  padding: 24px;
  box-shadow: 0 20px 70px rgba(0,0,0,.35);
}
.loading-eyebrow, .eyebrow {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .1em;
}
.loading-title {
  font-size: 34px;
  font-weight: 800;
  margin-top: 10px;
}
.loading-text {
  margin-top: 14px;
  color: var(--text);
  font-size: 16px;
}
.progress-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  overflow: hidden;
  margin-top: 18px;
}
.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(86,168,255,.72), rgba(113,191,255,1));
  box-shadow: 0 0 24px rgba(86,168,255,.4);
  transition: width .22s ease;
}
.loading-percent {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}
.loading-hint {
  margin-top: 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.topbar, .section-head, .toolbar, .drawer-head, .detail-actions, .pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.topbar { margin-bottom: 16px; }
h1, h2, h3 { margin: 0; }
h1 { font-size: 30px; }
h2 { font-size: 22px; }
h3 { font-size: 17px; }
.updated-at { color: var(--muted); font-size: 13px; margin-top: 8px; }

.view { display: none; }
.view.active { display: block; }
.stack { display: grid; gap: 12px; }
.section-block { margin-top: 20px; }
.section-block.first-section { margin-top: 0; }
.section-block.compact { margin-top: 16px; }

.status-card, .summary-card, .row-card, .detail-hero, .info-card, .warning-banner {
  background: rgba(18,29,49,.94);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 14px;
}

.warning-banner {
  background: linear-gradient(180deg, rgba(86,168,255,.16), rgba(86,168,255,.06));
  border-color: rgba(86,168,255,.24);
}
.warning-title { font-weight: 700; margin-bottom: 6px; }
.warning-text { color: var(--muted); font-size: 14px; line-height: 1.45; }

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 16px;
}
.summary-value { font-size: 24px; font-weight: 800; margin-top: 8px; }
.summary-label, .meta, .muted, .page-info { color: var(--muted); }

.row-card { display: grid; gap: 12px; }
.row-top, .row-bottom, .offer-row, .market-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.row-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.avatar {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: var(--panel-2);
  display: grid;
  place-items: center;
  overflow: hidden;
  flex: 0 0 46px;
  font-size: 20px;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.title { font-weight: 750; }
.meta { font-size: 13px; line-height: 1.35; }
.price { font-weight: 800; font-size: 18px; white-space: nowrap; }
.good { color: var(--good); }
.bad { color: var(--bad); }

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: max(12px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(760px, calc(100% - 20px));
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 24px;
  background: rgba(10,16,28,.92);
  backdrop-filter: blur(16px);
  z-index: 40;
}
.bottom-tab, .ghost-btn, .primary-btn, .chip {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px 14px;
  background: var(--panel);
  color: var(--text);
}
.bottom-tab {
  display: grid;
  place-items: center;
  gap: 4px;
  padding: 10px 8px;
  min-height: 62px;
  background: transparent;
}
.bottom-tab.active, .primary-btn {
  background: linear-gradient(180deg, rgba(86,168,255,.20), rgba(86,168,255,.08));
  border-color: rgba(86,168,255,.34);
}
.bottom-icon { font-size: 18px; line-height: 1; }
.ghost-btn { background: var(--panel-2); }

.toolbar {
  margin-bottom: 12px;
  align-items: stretch;
}
.search-input, .select-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(18,29,49,.94);
  color: var(--text);
  padding: 12px 14px;
}
.select-input { max-width: 220px; }
.pager { margin-top: 12px; }

.drawer {
  position: fixed;
  inset: 0;
  z-index: 50;
}
.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.55);
}
.drawer-panel {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: min(720px, 100%);
  background: linear-gradient(180deg, var(--bg), var(--bg-2));
  border-left: 1px solid var(--border);
  padding: 18px;
  overflow: auto;
}
.detail-hero {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}
.detail-actions { margin-bottom: 12px; }
.market-links { display: grid; gap: 8px; }
.market-link {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(18,29,49,.94);
}
.chip { padding: 8px 12px; border-radius: 999px; font-size: 13px; }
.empty-state {
  padding: 18px;
  border-radius: 20px;
  border: 1px dashed var(--border);
  color: var(--muted);
  text-align: center;
  background: rgba(18,29,49,.45);
}

@media (max-width: 640px) {
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .toolbar { flex-direction: column; }
  .select-input { max-width: none; }
  .detail-actions { flex-direction: column; align-items: stretch; }
  .row-top, .row-bottom, .offer-row { align-items: flex-start; }
}

.composer-card {
  background: rgba(18,29,49,.96);
  border: 1px solid rgba(86,168,255,.24);
  border-radius: 22px;
  padding: 14px;
  margin-top: 14px;
}
.form-grid { display: grid; gap: 12px; margin-top: 10px; }
.form-row-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.field-block { display: grid; gap: 8px; }
.field-label {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.full-width { max-width: none; width: 100%; }
.compact-stack { gap: 8px; }
.search-result-card {
  width: 100%;
  text-align: left;
  background: rgba(23,36,58,.92);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 12px;
  color: var(--text);
}
.selected-collection { margin-top: 2px; }
.selected-head {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 8px;
}
.compact-card { padding: 12px; }
.composer-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}
.alert-meta-grid {
  display: grid;
  gap: 8px;
  border-top: 1px solid rgba(255,255,255,.06);
  border-bottom: 1px solid rgba(255,255,255,.06);
  padding: 10px 0;
}
.meta-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}
.meta-key { color: var(--muted); }
.action-group {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.danger-btn {
  border-color: rgba(255,120,120,.32);
  background: linear-gradient(180deg, rgba(255,120,120,.18), rgba(255,120,120,.08));
}
@media (max-width: 640px) {
  .form-row-two {
    grid-template-columns: 1fr;
  }
}
