:root {
  --bg: #111418;
  --panel: #171c21;
  --panel-2: #1c2329;
  --panel-3: #24303a;
  --border: #313b44;
  --text: #e8edf2;
  --muted: #9eabb6;
  --green: #52c41a;
  --yellow: #f5c542;
  --red: #ff5a5f;
  --blue: #56a8ff;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

body {
  min-height: 100vh;
}

.app {
  max-width: 1380px;
  margin: 0 auto;
  padding: 14px;
}

.card,
.pattern-card,
.summary-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 16px;
}

.pattern-card-compact {
  padding-top: 14px;
  padding-bottom: 14px;
}

.pattern-header {
  margin-bottom: 12px;
}

.pattern-card-compact .pattern-header {
  margin-bottom: 10px;
}

.pattern-header h2 {
  margin: 0 0 4px 0;
}

.pattern-card-compact .pattern-header h2 {
  margin-bottom: 2px;
}

.pattern-subtext {
  color: var(--muted);
  font-size: 14px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.summary-panel h3 {
  margin: 0 0 12px 0;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.stat {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
}

.stat-label {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
}

.stat-value {
  font-size: 24px;
  font-weight: 800;
}

.compact-stat {
  font-size: 18px;
}

.top-command-header {
  position: sticky;
  top: 0;
  z-index: 60;
  display: grid;
  grid-template-columns: minmax(220px, 1.1fr) minmax(260px, 1fr) auto;
  gap: 16px;
  align-items: center;
  background: rgba(18, 22, 26, 0.96);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px 16px;
  margin-bottom: 16px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(10px);
}

.top-command-left {
  min-width: 0;
}

.top-command-title {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.1;
}

.top-command-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.nav-pill {
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 999px;
  padding: 9px 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.nav-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.16);
}

.nav-pill-active {
  border-color: var(--green);
  box-shadow: 0 0 0 1px rgba(82, 196, 26, 0.25);
}

.nav-pill-disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.top-command-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}

.header-status {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted);
  white-space: nowrap;
  font-size: 13px;
  font-weight: 700;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-header h2 {
  margin: 0;
}

.pattern-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.pattern-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.pattern-grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.pattern-tile {
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 14px;
  padding: 16px;
  text-align: left;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.pattern-tile:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.18);
}

.pattern-tile.active {
  border-color: var(--green);
  box-shadow: 0 0 0 1px rgba(82, 196, 26, 0.25);
}

.pattern-tile.disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.pattern-tile-compact {
  padding: 12px 14px;
  min-height: 0;
}

.pattern-tile-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  text-align: left;
}

.pattern-icon {
  font-size: 26px;
  line-height: 1;
  margin-bottom: 8px;
}

.pattern-tile-compact .pattern-icon {
  flex: 0 0 auto;
  margin: 0;
  font-size: 22px;
  line-height: 1.1;
}

.pattern-copy {
  min-width: 0;
  flex: 1 1 auto;
}

.pattern-title {
  font-size: 17px;
  font-weight: 800;
  margin: 0 0 6px 0;
}

.pattern-tile-compact .pattern-title {
  margin: 0 0 4px 0;
  line-height: 1.15;
}

.pattern-desc {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  margin: 0;
}

.pattern-tile-compact .pattern-desc {
  line-height: 1.25;
}

.users-card {
  padding-top: 14px;
  padding-bottom: 14px;
}

.users-grid {
  display: grid;
  gap: 12px;
  align-items: end;
}

.users-grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.sticky-filters {
  position: sticky;
  top: 84px;
  z-index: 40;
  margin-bottom: 16px;
}

.filters-card h2 {
  margin-bottom: 10px;
}

.filters-card.collapsed .mode-selector,
.filters-card.collapsed .filters-grid,
.filters-card.collapsed .bundle-settings,
.filters-card.collapsed .check-row,
.filters-card.collapsed .exclusion-bar {
  display: none;
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.filters-grid .wide-field {
  grid-column: span 2;
}

.top-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.mode-selector.hidden,
.bundle-settings.hidden,
.hidden {
  display: none !important;
}

.check-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 10px;
}

.exclusion-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
}

.pill {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
}

.pill.saved-flash {
  border-color: var(--yellow);
  box-shadow: 0 0 0 1px rgba(245, 197, 66, 0.35);
}

label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
}

.button {
  border: 1px solid transparent;
  background: var(--green);
  color: #0e1a0f;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 800;
  cursor: pointer;
}

.button:hover {
  filter: brightness(1.02);
}

.button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.button-secondary {
  background: var(--panel-2);
  color: var(--text);
  border-color: var(--border);
}

.button-small {
  padding: 8px 12px;
  font-size: 13px;
}

.button-danger {
  background: var(--red);
  color: #fff;
}

.button-saved {
  background: rgba(82, 196, 26, 0.18);
  color: var(--text);
  border-color: var(--green);
}

.loading-status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.loading-text.active {
  color: var(--text);
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.18);
  border-top-color: var(--green);
  border-radius: 50%;
  display: none;
}

.spinner.active {
  display: inline-block;
  animation: spin 0.8s linear infinite;
}

.cache-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.cache-strip-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
}

.cache-strip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.cache-strip-name {
  font-size: 16px;
  font-weight: 800;
  min-width: 0;
  overflow-wrap: anywhere;
}

.cache-strip-readiness {
  font-size: 20px;
  font-weight: 900;
  color: var(--green);
  white-space: nowrap;
}

.cache-strip-body {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cache-mini-gauge {
  --gauge-percent: 0;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: conic-gradient(var(--green) calc(var(--gauge-percent) * 1%), var(--panel-3) 0);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 1px var(--border);
}

.cache-mini-gauge-inner {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--panel);
  border: 1px solid var(--border);
}

.cache-strip-meta {
  display: grid;
  gap: 4px;
  color: var(--text);
  font-size: 13px;
}

.trade-list {
  display: grid;
  gap: 12px;
}

.trade-item {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, opacity 0.2s ease, transform 0.2s ease;
}

.trade-item.saved {
  border-color: var(--green);
  box-shadow: 0 0 0 1px rgba(82, 196, 26, 0.25);
}

.trade-item.hiding {
  opacity: 0;
  transform: scale(0.98);
}

.trade-title {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 8px;
}

.trade-meta {
  color: var(--text);
  line-height: 1.5;
}

.trade-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.score-badge {
  display: inline-block;
  margin-top: 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 800;
}

.nft-badge-score {
  border-color: var(--border);
}

.nft-empty-state {
  background: var(--panel);
  border: 1px dashed var(--border);
  border-radius: 14px;
  padding: 18px;
  color: var(--muted);
  text-align: center;
  line-height: 1.45;
}

.nft-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.nft-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.nft-card-media {
  height: 150px;
  background: linear-gradient(135deg, var(--panel-3), var(--panel-2));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-weight: 700;
  font-size: 14px;
  padding: 10px;
  border-bottom: 1px solid var(--border);
}

.nft-card-media-small {
  height: 120px;
  border-bottom: none;
  border-radius: 12px;
}

.nft-preview-placeholder {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.nft-card-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1 1 auto;
}

.nft-card-title {
  font-size: 16px;
  font-weight: 800;
  line-height: 1.3;
  margin: 0;
}

#nftValueManagerDetails {
  margin-top: 16px;
}

#nftValueManagerDetails summary {
  font-size: 16px;
}

.nft-card-meta {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  display: grid;
  gap: 4px;
}

.nft-card-meta strong {
  color: var(--text);
}

.nft-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 2px;
}

.nft-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
}

.nft-badge-overpay {
  border-color: var(--red);
  background: rgba(255, 90, 95, 0.14);
}

.nft-badge-slight-overpay {
  border-color: var(--yellow);
  background: rgba(245, 197, 66, 0.14);
}

.nft-badge-target-favor {
  border-color: var(--blue);
  background: rgba(86, 168, 255, 0.14);
}

.nft-badge-fair {
  border-color: var(--green);
  background: rgba(82, 196, 26, 0.14);
}

.nft-badge-score {
  border-color: var(--border);
}

.nft-value-stack {
  display: grid;
  gap: 6px;
}

.nft-value-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  padding: 8px 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.nft-value-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.nft-value-number {
  color: var(--text);
  font-size: 18px;
  font-weight: 900;
  text-align: right;
}

.nft-note-box {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.nft-score-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-top: 2px;
}

.nft-score-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
}

.nft-trade-media-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.01);
}

.nft-trade-media-side {
  min-width: 0;
}

.nft-trade-media-label {
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.nft-valuation-panel .summary-panel {
  margin-bottom: 0;
}

.nft-valuation-card {
  background: var(--panel);
}

.nft-valuation-card .nft-card-media {
  height: 110px;
}

.nft-valuation-card .nft-card-body {
  padding: 10px;
  gap: 8px;
}

.nft-valuation-card-collapsed .nft-card-body {
  gap: 8px;
}

.nft-valuation-card-collapsed .nft-card-title {
  margin-bottom: 2px;
}

.nft-empty-state {
  background: var(--panel);
  border: 1px dashed var(--border);
  border-radius: 14px;
  padding: 18px;
  color: var(--muted);
  text-align: center;
  line-height: 1.45;
}

.nft-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.nft-table th,
.nft-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.nft-table th {
  background: var(--panel-2);
  font-size: 13px;
  color: var(--muted);
}

.nft-table tr:last-child td {
  border-bottom: none;
}

.hybrid-asset-list {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.hybrid-asset-chip {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
}

.muted {
  color: var(--muted);
}

details {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px 16px;
  margin-bottom: 16px;
}

summary {
  cursor: pointer;
  font-weight: 800;
}

.details-content {
  margin-top: 12px;
}

#proposalGroups .trade-item {
  overflow: visible;
  height: auto;
  max-height: none;
}

#proposalGroups,
#proposalGroups > div,
#proposalGroups .trade-meta {
  overflow: visible;
}

#proposalGroups .trade-actions {
  flex-wrap: wrap;
}

.proposal-group-card {
  position: relative;
}

.proposal-source-sticky {
  position: sticky;
  top: 12px;
  z-index: 20;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(6px);
}

.proposal-source-sticky-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.proposal-source-group-status {
  white-space: nowrap;
}

.proposal-source-note {
  margin: 10px 0 12px 0;
  text-align: center;
}

.proposal-source-details {
  margin-bottom: 6px;
  text-align: center;
}

.proposal-source-label {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 10px;
}

.proposal-source-item {
  margin: 10px 0 14px 0;
}

.proposal-source-address {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.25;
}

.proposal-source-link {
  margin-top: 6px;
  font-size: 15px;
  font-weight: 700;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.proposal-group-options {
  overflow: visible;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 1100px) {
  .top-command-header {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .top-command-nav {
    justify-content: flex-start;
  }

  .top-command-actions {
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .top-controls,
  .filters-grid,
  .pattern-grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pattern-grid-3 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .users-grid-2,
  .summary-grid,
  .stat-grid,
  .pattern-grid,
  .filters-grid,
  .top-controls,
  .cache-strip {
    grid-template-columns: 1fr;
  }

  .filters-grid .wide-field {
    grid-column: span 1;
  }

  .nft-value-line,
  .nft-score-line {
    flex-direction: column;
    align-items: flex-start;
  }

  .nft-value-number {
    text-align: left;
  }
}

@media (max-width: 800px) {
  .proposal-source-sticky-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .proposal-source-group-status {
    white-space: normal;
  }

  .proposal-source-address {
    font-size: 18px;
  }
}

@media (max-width: 700px) {
  .pattern-tile-row {
    gap: 10px;
  }

  .pattern-tile-compact .pattern-icon {
    font-size: 20px;
  }

  .top-command-title {
    font-size: 24px;
  }

  .cache-strip-body {
    align-items: flex-start;
  }

  .nft-card-grid {
    grid-template-columns: 1fr;
  }

  .nft-trade-media-split {
    grid-template-columns: 1fr;
  }
}

.proposal-property-link {
  color: #f5c542;
  text-decoration: none;
  font-weight: 800;
}

.proposal-property-link:hover {
  text-decoration: underline;
}

.proposal-property-stats {
  margin-top: 6px;
  font-size: 14px;
  color: #c8d2da;
  line-height: 1.45;
}
