:root {
    color-scheme:dark;
    --bg:#0d1814;
    --panel:#14231d;
    --line:#2b4035;
    --ink:#edf5f0;
    --muted:#a7b6ad;
    --lime:#b8e58c;
    --mint:#62c8a5;
    --amber:#e6b980;
    --purple:#ada5de;
}

* {
    box-sizing:border-box;
}

[hidden] {
    display:none!important;
}

body {
    margin:0;
    min-height:100vh;
    background:radial-gradient(ellipse at 15% 0,#203c2d 0,transparent 42rem),var(--bg);
    color:var(--ink);
    font-family:Inter,ui-sans-serif,system-ui,-apple-system,sans-serif;
    font-size:14px;
}

a {
    color:inherit;
    text-decoration:none;
}

button,input,select {
    font:inherit;
}

button,.button {
    border:1px solid transparent;
    border-radius:8px;
    background:var(--lime);
    color:#19271c;
    padding:11px 16px;
    font-weight:700;
    cursor:pointer;
    display:inline-block;
}

button:hover,.button:hover {
    filter:brightness(1.1);
}

button:disabled {
    opacity:.5;
    cursor:wait;
}

button.secondary {
    background:#192b22;
    border-color:var(--line);
    color:var(--ink);
}

button.quiet,.quiet {
    color:var(--muted);
    background:transparent;
    padding:10px;
    border:0;
}

button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible {
    outline:2px solid var(--lime);
    outline-offset:3px;
}

.shell {
    max-width:1280px;
    margin:auto;
    padding:24px 36px 32px;
}

.topbar {
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding-bottom:38px;
}

.brand {
    display:flex;
    align-items:center;
    gap:10px;
    font-weight:750;
}

.brand-mark {
    display:grid;
    place-items:center;
    background:var(--lime);
    color:#17241b;
    width:31px;
    height:31px;
    border-radius:9px;
    font-size:23px;
}

.topbar nav {
    display:flex;
    align-items:center;
    gap:24px;
    color:var(--muted);
    font-size:13px;
}

.heading {
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:20px;
    margin:10px 0 22px;
}

.eyebrow {
    color:var(--lime);
    font-size:10px;
    letter-spacing:.16em;
    font-weight:800;
    margin:0 0 12px;
}

h1 {
    font-size:clamp(32px,4vw,49px);
    letter-spacing:-.055em;
    line-height:1.06;
    margin:0 0 13px;
    font-weight:650;
}

.subtitle {
    color:var(--muted);
    margin:0;
    font-size:14px;
}

.currency,.pill {
    border:1px solid #3a5141;
    border-radius:99px;
    padding:7px 12px;
    font-size:11px;
    color:#d0ddcf;
    white-space:nowrap;
}

.currency {
    align-self:flex-end;
    margin-bottom:3px;
}

#notice {
    color:var(--amber);
    line-height:1.5;
}

#notice:empty {
    display:none;
}

#gate {
    display:flex;
    gap:12px;
    align-items:center;
    margin-top:25px;
}

.overview {
    display:grid;
    grid-template-columns:1.75fr 1fr;
    gap:16px;
    margin-bottom:20px;
}

.net-card {
    border:1px solid #49673d;
    background:linear-gradient(115deg,#29402b,#1a3024);
    border-radius:15px;
    padding:26px 30px;
}

.card-top {
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:15px;
}

.card-top .eyebrow {
    margin:0;
}

.net-value {
    font-size:clamp(36px,5vw,64px);
    font-weight:600;
    letter-spacing:-.055em;
    margin-top:12px;
    overflow-wrap:anywhere;
}

.net-card>p {
    color:#b3c5b5;
    font-size:12px;
    margin:5px 0 24px;
}

.balance-track {
    height:7px;
    border-radius:8px;
    background:var(--amber);
    overflow:hidden;
}

.balance-track>div {
    height:100%;
    background:var(--lime);
    width:0;
}

.balance-caption {
    display:flex;
    justify-content:space-between;
    gap:12px;
    margin-top:11px;
    font-size:11px;
    color:#b5c4b6;
}

.balance-caption strong {
    color:var(--ink);
    margin-left:6px;
    font-weight:500;
}

.side-metrics {
    display:grid;
    gap:14px;
}

.metric {
    display:flex;
    align-items:center;
    gap:18px;
    background:var(--panel);
    border:1px solid var(--line);
    border-radius:13px;
    padding:20px 24px;
}

.metric-icon {
    width:38px;
    height:38px;
    display:grid;
    place-items:center;
    background:#243d2e;
    color:var(--lime);
    border-radius:50%;
    font-size:21px;
}

.metric.debt .metric-icon {
    background:#3a3024;
    color:var(--amber);
}

.metric p {
    color:var(--muted);
    font-size:12px;
    margin:0 0 4px;
}

.metric strong {
    display:block;
    font-weight:600;
    font-size:28px;
    letter-spacing:-.035em;
    overflow-wrap:anywhere;
}

.metric small {
    color:var(--muted);
    font-size:11px;
    display:block;
    margin-top:5px;
}

.insights {
    display:grid;
    grid-template-columns:1.2fr 1fr;
    gap:20px;
    margin-bottom:24px;
}

.panel {
    border:1px solid var(--line);
    border-radius:14px;
    background:var(--panel);
    padding:24px;
}

h2 {
    font-size:18px;
    font-weight:600;
    letter-spacing:-.025em;
    margin:0;
}

.section-heading {
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:16px;
}

.allocation-body {
    display:flex;
    align-items:center;
    gap:30px;
    margin:24px 0;
}

.donut {
    width:158px;
    height:158px;
    flex-shrink:0;
    border-radius:50%;
    background:var(--line);
    display:grid;
    place-items:center;
}

.donut>div {
    width:128px;
    height:128px;
    background:var(--panel);
    border-radius:50%;
    display:flex;
    align-items:center;
    justify-content:center;
    flex-direction:column;
    padding:8px;
    text-align:center;
}

.donut span {
    font-size:10px;
    color:var(--muted);
    margin-bottom:7px;
}

.donut strong {
    font-size:16px;
    overflow-wrap:anywhere;
    max-width:110px;
}

.legend {
    flex:1;
    min-width:0;
}

.legend-row {
    padding:9px 0;
    border-bottom:1px solid var(--line);
}

.legend-row:last-child {
    border:0;
}

.legend-line {
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:10px;
    font-size:12px;
}

.legend-row small {
    color:var(--muted);
    display:block;
    font-size:11px;
    margin:4px 0 0 16px;
}

.swatch {
    display:inline-block;
    width:7px;
    height:7px;
    border-radius:50%;
    margin-right:8px;
}

.footnote {
    font-size:11px;
    line-height:1.65;
    color:var(--muted);
    margin:0;
}

.registration-bars {
    margin:27px 0 23px;
    display:grid;
    gap:21px;
}

.bar-label {
    display:flex;
    justify-content:space-between;
    gap:10px;
    font-size:12px;
    margin-bottom:10px;
}

.track {
    height:5px;
    border-radius:5px;
    background:#23382c;
    overflow:hidden;
}

.fill {
    height:100%;
    border-radius:5px;
}

.holdings {
    padding:24px 0 0;
    overflow:hidden;
}

.holdings>.section-heading {
    padding:0 24px 23px;
}

.count {
    margin-left:6px;
    font-size:11px;
    border-radius:5px;
    background:#2a4031;
    color:var(--muted);
    padding:3px 7px;
    vertical-align:middle;
}

.actions {
    display:flex;
    gap:9px;
    align-items:center;
}

.actions button {
    font-size:12px;
}

.toolbar {
    padding:16px 24px;
    border-top:1px solid var(--line);
    border-bottom:1px solid var(--line);
    display:flex;
    align-items:center;
    gap:16px;
    flex-wrap:wrap;
}

.tabs {
    display:flex;
    padding:3px;
    background:#0d1b14;
    border-radius:7px;
}

.tabs button {
    font-size:11px;
    padding:7px 10px;
    background:transparent;
    color:var(--muted);
}

.tabs button[aria-pressed=true] {
    background:#2a4031;
    color:var(--ink);
}

input,select {
    color:var(--ink);
    background:#102018;
    border:1px solid var(--line);
    border-radius:7px;
    padding:10px;
    min-width:0;
}

input::placeholder {
    color:#82958a;
}

.search-label {
    flex:1;
    min-width:180px;
}

.search-label input {
    width:100%;
    font-size:11px;
}

.group-control {
    display:flex;
    gap:8px;
    align-items:center;
    font-size:11px;
    color:var(--muted);
}

.group-control select {
    font-size:11px;
}

.group-summary {
    padding:16px 24px;
    display:flex;
    gap:8px;
    flex-wrap:wrap;
}

.summary-chip {
    font-size:10px;
    color:var(--muted);
    border:1px solid var(--line);
    border-radius:6px;
    padding:7px 10px;
}

.summary-chip strong {
    color:var(--ink);
    margin-left:8px;
    font-weight:500;
}

.entry-group {
    padding:0 24px 12px;
}

.group-heading {
    display:flex;
    justify-content:space-between;
    gap:14px;
    padding:10px 12px;
    background:#1b2e23;
    border-radius:6px;
    font-size:12px;
}

.group-heading h3 {
    font-size:12px;
    margin:0;
    font-weight:650;
}

.group-heading span {
    font-size:11px;
    color:var(--muted);
}

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

th {
    font-weight:500;
    font-size:10px;
    text-transform:uppercase;
    letter-spacing:.05em;
    color:#90a296;
    text-align:left;
    padding:14px 12px 6px;
}

td {
    padding:14px 12px;
    border-bottom:1px solid #24392d;
}

td:first-child {
    width:32%;
}

td small {
    display:block;
    font-size:10px;
    color:var(--muted);
    margin-top:5px;
}

td .entry-name {
    font-weight:600;
    overflow-wrap:anywhere;
}

td.amount,th.amount {
    text-align:right;
    white-space:nowrap;
}

td .edit-button {
    background:transparent;
    color:var(--muted);
    font-size:11px;
    padding:6px 9px;
    border-color:var(--line);
}

.debt-value {
    color:var(--amber);
}

.tag {
    font-size:10px;
    color:#b6c5b9;
}

.table-footer {
    padding:15px 24px;
    border-top:1px solid var(--line);
    display:flex;
    justify-content:space-between;
    gap:15px;
    color:var(--muted);
    font-size:10px;
}

.page-footer {
    text-align:center;
    color:#8ca393;
    font-size:11px;
    line-height:1.6;
    padding:22px;
}

.empty {
    text-align:center;
    padding:42px 24px;
    color:var(--muted);
    line-height:1.7;
}

.empty strong {
    display:block;
    color:var(--ink);
    font-size:17px;
    margin-bottom:6px;
}

dialog {
    color:var(--ink);
    background:var(--panel);
    border:1px solid #49614f;
    border-radius:16px;
    padding:28px;
    width:min(560px,calc(100% - 28px));
    max-height:90vh;
    overflow:auto;
    box-shadow:0 20px 100px #0008;
}

dialog::backdrop {
    background:#020b08b8;
    backdrop-filter:blur(5px);
}

.form-grid {
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:17px;
}

.form-grid label {
    font-size:12px;
    display:flex;
    flex-direction:column;
    gap:8px;
    color:#d3ded5;
}

.form-grid .full {
    grid-column:1/-1;
}

.form-note {
    color:var(--muted);
    font-size:12px;
    line-height:1.6;
    margin:18px 0;
}

.optional {
    display:contents;
    color:var(--muted);
}

.dialog-actions {
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
    margin-top:24px;
}

.dialog-actions>.actions {
    margin-left:auto;
}

#form-error,#delete-error,.danger {
    color:#ffac97!important;
}

#form-error:empty {
    display:none;
}

.sr-only {
    position:absolute;
    width:1px;
    height:1px;
    overflow:hidden;
    clip-path:inset(50%);
}

@media(min-width:1400px) {
    .shell {
        padding-top:32px;
    }
}

@media(max-width:1000px) {
    .shell {
        padding:22px;
    }
    .allocation-body {
        gap:16px;
    }
    .donut {
        width:132px;
        height:132px;
    }
    .donut>div {
        width:106px;
        height:106px;
    }
    .donut strong {
        font-size:14px;
        max-width:95px;
    }
    .insights {
        gap:16px;
    }
    .panel {
        padding:20px;
    }
    .holdings {
        padding:20px 0 0;
    }
    .metric {
        padding:18px;
    }
    .metric strong {
        font-size:25px;
    }
}

@media(max-width:760px) {
    .overview,.insights {
        grid-template-columns:1fr;
    }
    .side-metrics {
        grid-template-columns:1fr 1fr;
    }
    .metric {
        gap:10px;
        padding:16px 12px;
    }
    .metric-icon {
        display:none;
    }
    .metric strong {
        font-size:23px;
    }
    .heading {
        align-items:start;
    }
    .currency {
        display:none;
    }
    .topbar nav {
        gap:12px;
        font-size:11px;
    }
    .topbar {
        padding-bottom:24px;
    }
    .shell {
        padding:18px 14px;
    }
    .net-card {
        padding:22px;
    }
    .balance-caption strong {
        display:block;
        margin:4px 0 0;
    }
    .holdings>.section-heading {
        align-items:start;
        flex-direction:column;
        padding:0 16px 18px;
    }
    .holdings .actions {
        flex-wrap:wrap;
    }
    .toolbar {
        padding:14px 16px;
        gap:12px;
    }
    .search-label {
        min-width:100%;
        order:3;
    }
    .group-control {
        margin-left:auto;
        flex-wrap:wrap;
    }
    .entry-group {
        padding:0 12px 14px;
    }
    .group-summary {
        padding:14px 16px;
    }
    .table-scroll {
        overflow-x:auto;
    }
    table {
        min-width:550px;
    }
    th,td {
        padding:12px 8px;
    }
    .table-footer {
        flex-direction:column;
        gap:7px;
        padding:14px 16px;
    }
    .page-footer {
        padding:18px 5px;
    }
    .allocation-body {
        justify-content:center;
        gap:24px;
    }
    .legend {
        max-width:320px;
    }
    .form-grid {
        gap:14px;
    }
    .group-heading {
        flex-direction:column;
        gap:4px;
    }
    .heading h1 {
        font-size:36px;
    }
    .subtitle {
        line-height:1.5;
    }
}

@media(prefers-reduced-motion:no-preference) {
    button,a {
        transition:filter .15s;
    }
    .fill,#asset-share {
        transition:width .3s;
    }
}

.table-scroll {
    position: relative;
}

.insights > .panel {
    min-width: 0;
}

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

.form-grid label {
    min-width: 0;
}

.form-grid input, .form-grid select {
    width: 100%;
}

@media (max-width: 760px) {
    .table-scroll {
        overflow: visible;
    }
    table {
        min-width: 0;
    }
    thead {
        display: none;
    }
    tbody, table {
        display: block;
    }
    tbody tr {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        border-bottom: 1px solid var(--line);
        padding: 12px 4px;
    }
    td {
        border: 0;
        padding: 5px 4px;
        min-width: 0;
    }
    td:first-child {
        width: auto;
        grid-column: 1;
        grid-row: 1;
    }
    td:nth-child(2) {
        grid-column: 1;
        grid-row: 2;
        color: var(--muted);
    }
    td:nth-child(3) {
        grid-column: 1;
        grid-row: 3;
    }
    td:nth-child(3) small {
        display: inline;
        margin-left: 8px;
    }
    td:nth-child(4) {
        grid-column: 2;
        grid-row: 1;
    }
    td:nth-child(5) {
        grid-column: 2;
        grid-row: 2;
        text-align: right;
    }
}

@media (max-width: 360px) {
    .allocation-body {
        flex-direction: column;
    }
    .legend {
        width: 100%;
    }
    .form-grid {
        grid-template-columns: 1fr;
    }
    .card-top {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }
}
.liquidity-types {
    list-style: none;
    margin: 10px 0 0 16px;
    padding: 0 0 0 12px;
    border-left: 1px solid var(--line);
    font-size: 11px;
    color: var(--muted);
}
.liquidity-types li { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; }
.liquidity-types li span:last-child { white-space: nowrap; }
.token-toggle { display: flex; align-items: center; gap: 8px; margin: 20px 0 0; font-size: 13px; }
.token-toggle input { accent-color: var(--lime); width: 17px; height: 17px; }
.token-row { border: 1px solid var(--line); border-radius: 9px; padding: 12px; margin: 10px 0; }
.token-inputs { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, .8fr) minmax(0, 1fr) 26px; gap: 8px; align-items: end; }
.token-inputs label { font-size: 11px; color: var(--muted); min-width: 0; }
.token-inputs input { display: block; width: 100%; margin-top: 6px; font-size: 12px; }
.token-inputs button { padding: 10px 4px; }
.token-row small { display: block; font-size: 11px; color: var(--muted); margin-top: 10px; overflow-wrap: anywhere; }
.token-actions { flex-wrap: wrap; margin: 15px 0; }
.token-total { display: flex; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); padding-top: 16px; font-size: 12px; }
.token-total strong { color: var(--lime); text-align: right; }
#token-status { overflow-wrap: anywhere; }
#crypto-editor .footnote a { text-decoration: underline; }
.token-details { margin-top: 10px; font-size: 11px; overflow-wrap: anywhere; }
.token-details summary { cursor: pointer; color: var(--mint); }
.token-details > div { padding: 10px 0; border-bottom: 1px solid var(--line); }
.token-details > small { line-height: 1.6; }
input:read-only { color: var(--muted); background: #1b2e23; }
@media (max-width: 480px) {
    .token-inputs { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 26px; }
    .token-inputs label:first-child { grid-column: 1 / 3; }
    .token-inputs label:nth-child(2) { grid-column: 1; grid-row: 2; }
    .token-inputs label:nth-child(3) { grid-column: 2; grid-row: 2; }
    .token-inputs button { grid-column: 3; grid-row: 2; }
}
.history-panel { margin-bottom: 24px; }
.history-readout { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 24px; }
.history-readout span, .history-readout small { display: block; color: var(--muted); font-size: 12px; }
.history-readout strong { display: block; font-size: 26px; margin-top: 6px; letter-spacing: -.04em; }
.history-readout small { margin-top: 6px; }
#history-svg { display: block; width: 100%; height: auto; margin-top: 12px; touch-action: pan-y; }
#history-svg text { fill: var(--muted); font: 12px ui-sans-serif, system-ui, sans-serif; }
.history-grid { stroke: var(--line); stroke-width: 1; }
.history-filled { fill: none; stroke: var(--muted); stroke-width: 2; stroke-dasharray: 5 5; }
.history-saved { fill: none; stroke: var(--lime); stroke-width: 3; }
.history-dot { fill: var(--lime); }
.history-cursor { stroke: var(--mint); stroke-width: 1; opacity: .7; }
.history-slider { display: flex; align-items: center; gap: 14px; font-size: 11px; color: var(--muted); }
.history-slider input { flex: 1; min-width: 0; accent-color: var(--lime); padding: 0; }
.history-legend { display: flex; gap: 20px; flex-wrap: wrap; margin: 16px 0 12px; font-size: 11px; color: var(--muted); }
.history-legend span:first-child { color: var(--lime); }
@media (max-width: 760px) {
    .history-panel .section-heading, .history-readout { align-items: flex-start; flex-direction: column; }
    #history-svg { min-height: 155px; }
    #history-svg text { font-size: 28px; }
    .history-readout strong { font-size: 24px; }
}
.subcategory-percent { color: var(--ink); margin-left: 5px; font-variant-numeric: tabular-nums; }
