:root {
  --tm-bg: #07070a;
  --tm-panel: #111116;
  --tm-panel-2: #15151b;
  --tm-line: rgba(255, 255, 255, 0.1);
  --tm-muted: #98949f;
  --tm-violet: #765dff;
  --tm-violet-soft: #b8a8ff;
  --tm-cyan: #69ddff;
  --tm-magenta: #e64dff;
}

body.treasury-app {
  min-height: 100dvh;
  margin: 0;
  background: var(--tm-bg);
  color: #f7f5fb;
}

.treasury-app *,
.treasury-app *::before,
.treasury-app *::after { box-sizing: border-box; }

.treasury-main { min-height: 100dvh; padding-bottom: 100px; }
.treasury-shell { width: min(1560px, calc(100% - 48px)); margin: 0 auto; }

.treasury-head {
  position: relative;
  min-height: 286px;
  display: grid;
  align-items: end;
  padding: 94px 0 34px;
  overflow: hidden;
  border-bottom: 1px solid var(--tm-line);
  background:
    radial-gradient(circle at 78% 10%, rgba(118, 93, 255, 0.28), transparent 32%),
    linear-gradient(90deg, rgba(5, 5, 8, 0.98), rgba(7, 5, 16, 0.88)),
    url("/assets/otherside-devs/odc-community-wide.jpg") center 42% / cover;
}

.treasury-head::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 120px;
  pointer-events: none;
  background: linear-gradient(transparent, var(--tm-bg));
}

.treasury-head-grid {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 28px;
}

.treasury-identity { min-width: 0; display: flex; align-items: center; gap: 18px; }
.treasury-identity > img { width: 82px; height: 82px; border-radius: 20px; border: 1px solid rgba(184, 168, 255, 0.35); box-shadow: 0 0 44px rgba(118, 93, 255, 0.3); }
.treasury-identity h1 { margin: 0; color: #fff; font: 800 clamp(2.5rem, 5.5vw, 5.6rem)/0.92 var(--sans); letter-spacing: 0; }
.treasury-identity p:last-child { max-width: 720px; margin: 13px 0 0; color: rgba(255, 255, 255, 0.7); font-size: 1rem; line-height: 1.5; }

.treasury-head-stats { flex: 0 0 auto; display: grid; grid-template-columns: repeat(3, auto); gap: 34px; padding-bottom: 8px; }
.treasury-head-stats div { display: grid; gap: 6px; }
.treasury-head-stats span,
.treasury-metric span,
.treasury-donut span { color: var(--tm-muted); font: 700 0.68rem/1.2 var(--mono); text-transform: uppercase; }
.treasury-head-stats strong { color: #fff; font: 800 1.28rem/1 var(--sans); }

.treasury-tabs {
  position: sticky;
  top: 0;
  z-index: 12;
  min-height: 68px;
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--tm-line);
  background: rgba(7, 7, 10, 0.88);
  backdrop-filter: blur(20px);
}
.treasury-tabs::-webkit-scrollbar { display: none; }
.treasury-tabs a { min-height: 68px; display: inline-flex; align-items: center; gap: 8px; padding: 0 18px; color: var(--tm-muted); font: 700 0.8rem/1 var(--mono); white-space: nowrap; border-bottom: 2px solid transparent; }
.treasury-tabs a:hover { color: #fff; }
.treasury-tabs a[aria-current="page"] { color: #fff; border-bottom-color: #fff; }
.treasury-tabs svg { width: 17px; height: 17px; }

.treasury-status { min-height: 68px; display: flex; align-items: center; gap: 10px; color: var(--tm-muted); font: 700 0.76rem/1.4 var(--mono); }
.treasury-status[data-tone="error"] { color: #ffb4be; }
.treasury-status[data-tone="ready"] { min-height: 24px; margin: 14px 0; }
.treasury-spinner { width: 12px; height: 12px; border: 2px solid rgba(184, 168, 255, 0.25); border-top-color: var(--tm-violet-soft); border-radius: 50%; animation: treasury-spin 0.75s linear infinite; }
@keyframes treasury-spin { to { transform: rotate(360deg); } }

.treasury-view { display: grid; gap: 22px; padding-top: 4px; }
.treasury-view[hidden] { display: none !important; }
.treasury-metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1px; overflow: hidden; border: 1px solid var(--tm-line); border-radius: 12px; background: var(--tm-line); }
.treasury-metric { min-height: 118px; display: grid; align-content: center; gap: 10px; padding: 18px; background: var(--tm-panel); }
.treasury-metric strong { color: #fff; font: 800 clamp(1.45rem, 2vw, 2.35rem)/1 var(--sans); letter-spacing: 0; }
.treasury-metric small { color: var(--tm-muted); font-size: 0.75rem; }

.treasury-dashboard-grid { display: grid; grid-template-columns: minmax(0, 2.1fr) minmax(300px, 0.9fr); gap: 22px; }
.treasury-panel { min-width: 0; padding: 22px; border: 1px solid var(--tm-line); border-radius: 12px; background: var(--tm-panel); box-shadow: 0 24px 70px rgba(0, 0, 0, 0.18); }
.treasury-panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 20px; }
.treasury-panel-head .odc-kicker { margin-bottom: 8px; }
.treasury-panel h2,
.treasury-page-intro h2 { margin: 0; color: #fff; font: 800 clamp(1.55rem, 2.8vw, 3rem)/1 var(--sans); letter-spacing: 0; }
.treasury-panel-head p:last-child,
.treasury-page-intro > p:last-child { max-width: 720px; margin: 10px 0 0; color: var(--tm-muted); line-height: 1.55; }
.treasury-asof { color: var(--tm-muted); font: 700 0.68rem/1.4 var(--mono); text-align: right; }
.treasury-asof[data-stale="true"],
.treasury-valuation-age[data-stale="true"] { color: #f0a8ff; }
.treasury-valuation-age { display: block; margin-top: 4px; color: var(--tm-muted); font: 700 0.64rem/1.2 var(--mono); }

.treasury-map { min-height: 410px; display: flex; flex-wrap: wrap; gap: 8px; align-content: stretch; }
.treasury-map-card { position: relative; flex: 1 1 var(--map-basis, 30%); min-width: 150px; min-height: 128px; display: grid; place-items: center; overflow: hidden; border: 1px solid rgba(184, 168, 255, 0.22); border-radius: 10px; background: linear-gradient(145deg, rgba(118, 93, 255, 0.22), rgba(20, 15, 40, 0.8)); }
.treasury-map-card[data-kind="token"] { border-color: rgba(105, 221, 255, 0.2); background: linear-gradient(145deg, rgba(105, 221, 255, 0.14), rgba(13, 26, 36, 0.86)); }
.treasury-map-card[data-status="reserved"] { filter: saturate(0.65); }
.treasury-map-card > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0.16; filter: saturate(0.7); }
.treasury-map-copy { position: relative; z-index: 1; display: grid; justify-items: center; gap: 6px; padding: 20px; text-align: center; }
.treasury-asset-mark { width: 42px; height: 42px; display: grid; place-items: center; overflow: hidden; border: 1px solid rgba(255, 255, 255, 0.15); border-radius: 50%; background: rgba(0, 0, 0, 0.35); color: var(--tm-violet-soft); font: 800 0.72rem/1 var(--mono); }
.treasury-map-copy strong { max-width: 240px; overflow: hidden; text-overflow: ellipsis; color: #fff; font-size: 0.95rem; white-space: nowrap; }
.treasury-map-copy span { color: rgba(255, 255, 255, 0.72); font: 700 0.76rem/1.2 var(--mono); }
.treasury-map-copy em { color: var(--tm-violet-soft); font: 700 0.66rem/1.2 var(--mono); text-transform: uppercase; }

.treasury-mix-panel { display: flex; flex-direction: column; }
.treasury-donut { --nft: 50; width: min(260px, 80%); aspect-ratio: 1; display: grid; place-items: center; margin: 8px auto 20px; border-radius: 50%; background: conic-gradient(var(--tm-magenta) 0 calc(var(--nft) * 1%), var(--tm-violet) 0 100%); position: relative; }
.treasury-donut::before { content: ""; position: absolute; inset: 26px; border-radius: 50%; background: var(--tm-panel); }
.treasury-donut > div { position: relative; z-index: 1; display: grid; justify-items: center; gap: 8px; }
.treasury-donut strong { color: #fff; font-size: 1.55rem; }
.treasury-legend { display: grid; gap: 10px; }
.treasury-legend-row { display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: 10px; color: #fff; }
.treasury-legend-row i { width: 10px; height: 10px; border-radius: 50%; background: var(--tm-violet); }
.treasury-legend-row[data-kind="nft"] i { background: var(--tm-magenta); }
.treasury-legend-row span:last-child { color: var(--tm-muted); font-family: var(--mono); }
.treasury-wallets { display: grid; gap: 8px; margin-top: auto; padding-top: 22px; }
.treasury-wallet { min-width: 0; display: flex; align-items: center; gap: 10px; padding: 11px; border: 1px solid var(--tm-line); border-radius: 9px; color: #fff; background: rgba(255, 255, 255, 0.025); }
.treasury-wallet > div { min-width: 0; display: grid; gap: 3px; }
.treasury-wallet code { overflow: hidden; text-overflow: ellipsis; color: var(--tm-muted); font-size: 0.68rem; white-space: nowrap; }
.treasury-wallet svg { width: 17px; color: var(--tm-cyan); }

.treasury-holdings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.treasury-holdings-grid > section { min-width: 0; overflow: hidden; border: 1px solid var(--tm-line); border-radius: 10px; }
.treasury-subhead { min-height: 64px; display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 16px; border-bottom: 1px solid var(--tm-line); }
.treasury-subhead h3 { margin: 0; color: #fff; font-size: 1rem; }
.treasury-subhead span { color: var(--tm-muted); font: 700 0.72rem/1 var(--mono); }
.treasury-table-wrap { width: 100%; overflow-x: auto; }
.treasury-table { width: 100%; border-collapse: collapse; table-layout: auto; }
.treasury-table th { padding: 12px 14px; color: var(--tm-muted); font: 700 0.65rem/1.2 var(--mono); text-align: left; text-transform: uppercase; white-space: nowrap; }
.treasury-table td { padding: 13px 14px; border-top: 1px solid rgba(255, 255, 255, 0.065); color: #eae7ef; vertical-align: middle; }
.treasury-table tbody tr:hover { background: rgba(255, 255, 255, 0.025); }
.treasury-table a { color: #fff; }
.treasury-table small { display: block; margin-top: 3px; color: var(--tm-muted); white-space: nowrap; }
.treasury-table-empty { color: var(--tm-muted) !important; text-align: center; padding: 28px !important; }
.treasury-asset-name { min-width: 180px; display: flex; align-items: center; gap: 10px; }
.treasury-asset-name .treasury-asset-mark { width: 34px; height: 34px; flex: 0 0 auto; }
.treasury-asset-name strong { display: block; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.treasury-pill { display: inline-flex; align-items: center; justify-content: center; padding: 6px 8px; border: 1px solid rgba(184, 168, 255, 0.25); border-radius: 999px; color: var(--tm-violet-soft); font: 700 0.6rem/1 var(--mono); text-transform: uppercase; white-space: nowrap; }
.treasury-pill[data-status="reserved"] { color: #a6a1ad; border-color: rgba(255, 255, 255, 0.14); }
.treasury-pill[data-status="distributed"] { color: var(--tm-cyan); border-color: rgba(105, 221, 255, 0.24); }
.treasury-pill[data-status="ineligible"] { color: #ffb4be; border-color: rgba(255, 180, 190, 0.25); }

.treasury-page-intro { padding: 38px 0 10px; }
.treasury-page-intro h2 { font-size: clamp(2.3rem, 5vw, 5.5rem); }
.treasury-method-panel { display: grid; grid-template-columns: 1.2fr repeat(3, 1fr); gap: 1px; padding: 1px; background: var(--tm-line); }
.treasury-method-card { padding: 18px; background: var(--tm-panel); }
.treasury-method-card:first-child { background: linear-gradient(145deg, rgba(118, 93, 255, 0.18), var(--tm-panel)); }
.treasury-method-card span { display: block; margin-bottom: 8px; color: var(--tm-violet-soft); font: 700 0.65rem/1 var(--mono); text-transform: uppercase; }
.treasury-method-card strong { display: block; color: #fff; font-size: 1.05rem; line-height: 1.35; }
.treasury-method-card p { margin: 8px 0 0; color: var(--tm-muted); line-height: 1.45; }

.merit-table th:first-child,
.merit-table td:first-child { text-align: center; }
.treasury-score { display: inline-grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; border: 3px solid var(--tm-violet); color: #fff; font-weight: 800; background: rgba(118, 93, 255, 0.12); }
.treasury-developer { min-width: 190px; display: flex; align-items: center; gap: 10px; }
.treasury-developer img,
.treasury-developer .treasury-avatar { width: 36px; height: 36px; flex: 0 0 auto; display: grid; place-items: center; object-fit: cover; border-radius: 50%; background: rgba(118, 93, 255, 0.18); color: var(--tm-violet-soft); font: 700 0.7rem/1 var(--mono); }
.treasury-developer strong { display: block; color: #fff; }
.treasury-developer code { display: block; margin-top: 3px; color: var(--tm-muted); font-size: 0.65rem; }

.treasury-round-list { display: grid; gap: 10px; }
.treasury-round-card { min-width: 0; display: grid; grid-template-columns: minmax(0, 1.6fr) repeat(4, minmax(88px, 0.45fr)) auto; align-items: center; gap: 16px; padding: 16px; border: 1px solid var(--tm-line); border-radius: 10px; color: #fff; background: rgba(255, 255, 255, 0.025); }
.treasury-round-card:hover { border-color: rgba(184, 168, 255, 0.28); background: rgba(118, 93, 255, 0.05); }
.treasury-round-title { min-width: 0; }
.treasury-round-title strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.treasury-round-title span,
.treasury-round-stat span { display: block; margin-top: 5px; color: var(--tm-muted); font: 700 0.65rem/1.3 var(--mono); }
.treasury-round-stat strong { color: #fff; }
.treasury-round-card > svg { color: var(--tm-violet-soft); }
.treasury-empty { padding: 28px; border: 1px dashed var(--tm-line); border-radius: 10px; color: var(--tm-muted); text-align: center; line-height: 1.55; }

.treasury-back { width: max-content; display: inline-flex; align-items: center; gap: 8px; margin: 32px 0 0; color: var(--tm-muted); font: 700 0.75rem/1 var(--mono); }
.treasury-round-hero { display: grid; gap: 16px; padding: 34px 0 10px; }
.treasury-round-hero h2 { margin: 0; color: #fff; font: 800 clamp(2.6rem, 6vw, 6rem)/0.92 var(--sans); letter-spacing: 0; }
.treasury-round-hero > p { max-width: 760px; margin: 0; color: var(--tm-muted); line-height: 1.55; }
.treasury-round-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.treasury-allocation-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.treasury-allocation-list { display: grid; gap: 8px; }
.treasury-allocation-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 13px; border: 1px solid var(--tm-line); border-radius: 9px; }
.treasury-allocation-row strong { color: #fff; }
.treasury-allocation-row p { grid-column: 1 / -1; margin: 4px 0 0; color: var(--tm-muted); line-height: 1.5; }
.treasury-allocation-row span { color: var(--tm-violet-soft); font: 700 0.75rem/1.3 var(--mono); text-align: right; }
.treasury-receipt-link { display: inline-flex; gap: 6px; align-items: center; color: var(--tm-cyan); }

.treasury-admin-actions,
.treasury-admin-actions + p,
.treasury-form-actions { margin-top: 18px; }
.treasury-admin-actions,
.treasury-form-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.treasury-admin-note { color: var(--tm-muted); }
.treasury-admin-note[data-tone="error"] { color: #ffb4be; }
.treasury-admin-note[data-tone="ready"] { color: var(--tm-cyan); }
.treasury-admin-grid { display: grid; gap: 22px; }
.treasury-admin-form { position: relative; }
.treasury-step { color: rgba(184, 168, 255, 0.4); font: 900 2rem/1 var(--mono); }
.treasury-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.treasury-fields label { min-width: 0; display: grid; gap: 7px; color: var(--tm-muted); font: 700 0.68rem/1.2 var(--mono); text-transform: uppercase; }
.treasury-fields label[data-wide] { grid-column: 1 / -1; }
.treasury-fields input,
.treasury-fields select,
.treasury-fields textarea { width: 100%; min-height: 46px; padding: 11px 12px; border: 1px solid var(--tm-line); border-radius: 8px; outline: 0; background: rgba(0, 0, 0, 0.28); color: #fff; font: 600 0.92rem/1.4 var(--body); text-transform: none; }
.treasury-fields input:focus,
.treasury-fields select:focus,
.treasury-fields textarea:focus { border-color: rgba(184, 168, 255, 0.55); box-shadow: 0 0 0 3px rgba(118, 93, 255, 0.1); }
.treasury-fields textarea { min-height: 90px; resize: vertical; }
.treasury-fields textarea.treasury-code { font: 500 0.75rem/1.55 var(--mono); }
.treasury-fields textarea.treasury-code-large { min-height: 220px; }
.treasury-fields .treasury-check { display: flex; align-items: center; grid-template-columns: auto 1fr; }
.treasury-check input { width: 18px; min-height: 18px; }

@media (max-width: 1180px) {
  .treasury-head-grid { display: grid; }
  .treasury-head-stats { width: 100%; grid-template-columns: repeat(3, 1fr); }
  .treasury-dashboard-grid,
  .treasury-holdings-grid { grid-template-columns: 1fr; }
  .treasury-method-panel { grid-template-columns: repeat(2, 1fr); }
  .treasury-round-card { grid-template-columns: minmax(0, 1fr) repeat(2, minmax(80px, 0.35fr)) auto; }
  .treasury-round-card .treasury-round-stat:nth-of-type(n+4) { display: none; }
}

@media (max-width: 900px) {
  .treasury-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .treasury-metric:first-child { grid-column: 1 / -1; }
  .treasury-allocation-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .treasury-main { padding-bottom: 124px; }
  .treasury-shell { width: min(100% - 24px, 720px); }
  .treasury-head { min-height: 380px; padding: 96px 0 34px; }
  .treasury-head-grid { align-items: start; }
  .treasury-identity { display: grid; gap: 14px; }
  .treasury-identity > img { width: 64px; height: 64px; border-radius: 16px; }
  .treasury-identity h1 { font-size: clamp(2.7rem, 13vw, 4.5rem); }
  .treasury-head-stats { gap: 12px; }
  .treasury-head-stats div { min-width: 0; }
  .treasury-head-stats strong { overflow: hidden; text-overflow: ellipsis; font-size: 1rem; }
  .treasury-tabs { position: relative; min-height: 58px; }
  .treasury-tabs a { min-height: 58px; padding: 0 13px; }
  .treasury-status { min-height: 54px; }
  .treasury-panel { padding: 16px; border-radius: 10px; }
  .treasury-panel-head { display: grid; }
  .treasury-asof { text-align: left; }
  .treasury-map { min-height: 360px; }
  .treasury-map-card { min-width: 122px; }
  .treasury-metrics { grid-template-columns: 1fr 1fr; }
  .treasury-metric { min-height: 100px; padding: 14px; }
  .treasury-method-panel { grid-template-columns: 1fr; }
  .treasury-round-card { grid-template-columns: 1fr auto; }
  .treasury-round-card .treasury-round-stat { display: none !important; }
  .treasury-fields { grid-template-columns: 1fr; }
  .treasury-fields label[data-wide] { grid-column: auto; }
  .treasury-table { min-width: 660px; }
  .treasury-page-intro { padding-top: 26px; }
}

@media (max-width: 430px) {
  .treasury-shell { width: calc(100% - 20px); }
  .treasury-head-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .treasury-head-stats span { font-size: 0.55rem; }
  .treasury-metrics { grid-template-columns: 1fr; }
  .treasury-metric:first-child { grid-column: auto; }
  .treasury-map-card { min-width: 100%; min-height: 118px; }
}
