:root {
    font: 16px/1.5 "Segoe UI", system-ui, sans-serif;
    color: #202d29;
    background: #f4f6f2;
    --green:#195740;
    --line:#d5dfd7
}

* { box-sizing: border-box }

body { margin: 0 }
#qrImage { display: block; margin: auto; max-width: 100%; height: auto; image-rendering: pixelated }

header {
    background: #153c30;
    color: white
}

.bar, main {
    max-width: 1080px;
    margin: auto;
    padding: 18px 32px
}

.heading, .section-title, footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px
}

.brand {
    color: white;
    text-decoration: none;
    font-size: 21px;
    font-weight: 650
}

.brand { display: inline-flex; align-items: center; gap: 8px }

.bar {
    display: grid;
    grid-template-columns: repeat(3,auto);
    justify-content: end;
    align-items: center;
    gap: 8px;
}
.bar select, .bar button {
    min-height: 44px;
    border-color: #54816d;
    border-radius: 10px;
}
.bar select { background: #204b3c; color: white; color-scheme: dark }
.bar select:disabled { opacity: 1; -webkit-text-fill-color: #e0eee6 }
.bar button { background: #def5a7; color: #173425; border-color: transparent }
.bar button:hover { background: #cee992 }
.brand img { border-radius: 7px }
.wallet-address { display: flex; gap: 4px; align-items: center }
.wallet-address #address { margin: 0 }
#copyAddress {
    width: 44px; height: 44px; padding: 0;
    color: var(--green); background: transparent; border-color: transparent;
}
#copyAddress:hover { background: #d9e7da }
#copyAddress svg { vertical-align: middle }
#mobileProof:not([hidden]) { display: inline-block; text-decoration: none; background:#def5a7; color:#173425; text-align:center }

button, select, input, a.primary {
    font: inherit;
    border: 1px solid #bacac0;
    border-radius: 7px;
    padding: 9px 13px;
    background: white;
    color: #243d31
}

button {
    cursor: pointer;
    font-weight: 600
}

#mobileApprove { text-decoration: none; font-weight: 600; text-align: center }
button:hover { background: #edf4ed }

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

.primary, a.primary {
    color: white;
    background: var(--green);
    border-color: var(--green)
}

.primary:hover { background: #0e4632 }

main { padding-top: 36px }
#networkNote { margin:0 0 20px; padding:12px 16px; border-left:4px solid var(--green); background:#e6f0db; color:#183d2d }

h1 {
    font-size: clamp(32px, 5vw, 48px);
    letter-spacing: -.045em;
    line-height: 1.12;
    margin: 4px 0 20px
}

h2 {
    font-size: 21px;
    letter-spacing: -.03em;
    margin: 0
}

.eyebrow, small, .section-title span { color: #53695e }

.eyebrow {
    font-size: 13px;
    margin: 0
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #eaf0e8
}

.stats > div { padding: 16px 20px }

.stats > div + div { border-left: 1px solid var(--line) }

.stats small, .stats strong { display: block }

.stats strong {
    font: 600 20px/1.5 ui-monospace, monospace;
    margin-top: 7px
}

section {
    background: white;
    border: 1px solid var(--line);
    border-radius: 10px;
    margin: 18px 0;
    overflow: hidden
}

.section-title, .row {
    padding: 16px 20px;
    border-bottom: 1px solid #ebefeb
}

.section-title span, .row small { font-size: 12px }

.row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap
}

.row small { display: block }
.token-identity { display: inline-flex; align-items: center; gap: 10px; overflow-wrap: anywhere }
.token-identity img { border-radius: 50%; object-fit: contain; flex: none }

.empty {
    padding: 24px 20px;
    color: #596d60
}

a { color: var(--green) }

#notice:empty { display: none }

#notice {
    padding: 10px 16px;
    border-left: 3px solid #55785b;
    background: #eef1df
}

dialog {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 24px;
    width: min(500px, 94vw);
    box-shadow: 0 25px 90px #102b2330
}

dialog::backdrop { background: #102b235f }

label {
    display: block;
    margin: 14px 0
}

input {
    display: block;
    width: 100%;
    margin-top: 4px
}

footer {
    justify-content: flex-end;
    margin-top: 24px
}

.sr {
    position: absolute;
    clip-path: inset(100%)
}

dt {
    font-size: 12px;
    color: #526659
}

dd {
    margin: 2px 0 12px;
    overflow-wrap: anywhere
}

#actions {
    display: grid;
    gap: 8px
}

.visibility-switch {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    min-height: 44px; cursor: pointer;
}
.visibility-switch input {
    appearance: none; flex: none; width: 44px; height: 26px; min-height: 0;
    margin: 0; padding: 2px; border: 1px solid #53695e; border-radius: 20px;
    background: #647269; cursor: pointer;
}
.visibility-switch input::before {
    content: ""; display: block; width: 20px; height: 20px;
    border-radius: 50%; background: white;
}
.visibility-switch input:checked { background: #19543f }
.visibility-switch input:checked::before { transform: translateX(18px) }

#historyNav:not([hidden]) {
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px; padding: 12px; border-top: 1px solid #dae2da;
}

button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid #6dac86 }

@media (max-width: 650px) {
    .bar, main { padding: 14px }

    .heading {
        align-items: flex-start;
        flex-wrap: wrap
    }

    .stats { grid-template-columns: 1fr 1fr }

    .stats > div:last-child {
        grid-column: span 2;
        border-top: 1px solid var(--line)
    }

    .stats > div { padding: 10px }

    .bar {
        grid-template-columns: repeat(2,minmax(0,1fr));
        grid-template-areas: "network provider" "action action";
        gap: 12px 8px;
    }
    .brand { grid-area: brand; font-size: 19px }
    #connect { grid-area: action; justify-self: end }
    #network { grid-area: network }
    #walletProvider { grid-area: provider }
    .bar select { width: 100% }
    main { padding-top: 22px }
    .heading { align-items: center; margin-bottom: 16px }
    .heading h1 { margin-bottom: 0 }
    .stats > div:last-child { border-left: 0 }

    .section-title, .row { padding: 12px }
}
#importForm { padding: 0 16px 16px }
#logoPreview { max-width: 96px; height: auto }

/* Token workspace */
.app-shell { background:#f6f7f2; min-height:100vh; font-family:"Segoe UI",system-ui,sans-serif }
.app-shell header { background:#fff; color:#173d32; border-bottom:1px solid #dee4db }
.app-shell nav.topnav { max-width:1120px; min-height:62px }
.app-shell .compact-links summary { border-color:#d2dcd2; font-size:.88rem }
.workspace { --card-inset:20px; max-width:960px; padding:22px 28px 48px }
.dashboard section,#wallet { background:white; border:1px solid #d7dfd7; border-radius:16px; margin:0 0 20px; scroll-margin-top:12px }
#wallet { background:linear-gradient(100deg,#f2f8ef,#fff 78%); padding:10px 20px 14px; border-left:4px solid #377255 }
.wallet-heading,.wallet-summary { display:flex; align-items:center; gap:10px }
.wallet-heading h2 { font-size:1.05rem }
#networkName { padding:3px 9px; border-radius:16px; background:#e9f3df; color:#355f46; font-size:.78rem; font-weight:600 }
#walletToggle { margin-left:auto; padding:8px 12px; min-height:44px; background:transparent; border-color:transparent; color:var(--green) }
#walletToggle::after { content:""; display:inline-block; width:6px; height:6px; margin:0 2px 3px 8px; border:solid currentColor; border-width:0 1.5px 1.5px 0; transform:rotate(45deg) }
#walletToggle[aria-expanded=true]::after { transform:rotate(225deg); vertical-align:-3px }
.wallet-summary { flex-wrap:wrap; justify-content:space-between; color:#385549; font-size:.93rem }
.wallet-address { min-height:24px; overflow-wrap:anywhere }
.wallet-address strong,#solBalance { font-variant-numeric:tabular-nums }
#solBalance { color:#385549; font-size:.88rem }
#copyStatus:empty { display:none }
#copyStatus:not(:empty) { flex-basis:100% }
#walletSettings { border-top:1px solid var(--line); margin-top:10px; padding-top:14px }
#wallet .bar { display:flex; flex-wrap:wrap; gap:8px; padding:0; margin:0; justify-content:start }
#wallet .bar select { flex:1 1 105px; min-width:0; width:auto; color:#274839; background:#fafbf8; color-scheme:light; border-color:#bfcec2 }
#wallet .bar select:disabled { -webkit-text-fill-color:#506359 }
#wallet .bar button,#mobileProof:not([hidden]) { background:#1c513f; color:white }
#mobileProof:not([hidden]) { margin-top:12px }
#wallet #networkNote { font-size:.82rem; margin:12px 0 0; padding:8px 12px; border:0; border-radius:8px; background:#eff5e7 }
.dashboard .section-title { background:#fafcf9; padding:18px var(--card-inset); flex-wrap:wrap }
#library h1 { display:flex; align-items:center; gap:7px; margin:0; font-size:clamp(1.35rem,3vw,1.8rem) }
#total { background:#edf3e9; color:#355f46; border-radius:20px; padding:3px 8px; font:600 .85rem/1.3 system-ui }
#new { border-radius:10px; min-height:44px }
#pending:not([hidden]) { display:block; padding:10px 20px; background:#eff5e7 }
.token-row { display:flex; align-items:center; justify-content:space-between; gap:12px; text-align:left; width:100%; min-height:60px; padding:12px 20px; border:0; border-bottom:1px solid #ebefeb; border-radius:0 }
.token-row small { display:block; font-weight:400 }
.token-row::after { content:""; flex:none; width:7px; height:7px; border:solid #718579; border-width:1.5px 1.5px 0 0; transform:rotate(45deg) }
.library-tools { display:grid; justify-items:start; gap:4px; background:#f6f9f5; padding:14px var(--card-inset) 10px }
#hiddenFilter { min-height:44px; max-width:100%; margin:0 0 4px; padding:8px 14px; background:#e4eee4; border:1px solid #c9d9cb; color:#244e3b; border-radius:12px; font-size:.92rem }
#hiddenFilter:hover { background:#d7e7d9; border-color:#a9c4af }
.import-token { width:100% }
.import-token summary { padding:10px 0; min-height:44px; color:var(--green); cursor:pointer; font-weight:600 }
#importForm { padding:0 0 12px }
#importForm label { margin-top:0 }
.library-tools > p { margin:0; font-size:.85rem }
.library-tools > p a { display:inline-flex; align-items:center; min-height:44px; color:#496557; text-underline-offset:3px }
.empty { margin:0; padding:22px 20px }
@media(max-width:650px) {
    .workspace { --card-inset:14px; padding:12px 12px 32px }
    #wallet { padding:7px 12px 10px }
    .dashboard section,#wallet { margin-bottom:14px }
    .dashboard .section-title { gap:8px; padding:12px var(--card-inset) }
    #new { font-size:.88rem; padding:8px 10px }
    .token-row { padding:10px var(--card-inset) }
}
