/* Coldkey — dark, Ledger-Live-inspired, v1.1 */
:root {
  --bg: #0f1012; --bg-2: #17181b; --bg-3: #1f2124; --bg-4: #27292d;
  --line: rgba(255,255,255,.06); --line-2: rgba(255,255,255,.12);
  --text: #ffffff; --text-2: #9a9da3; --text-3: #6b6e74;
  --accent: #8b7cff; --accent-2: #bbb0ff;
  --up: #5fd07a; --down: #ff5a6a;
  --btc: #f7931a; --eth: #627eea;
  --radius: 10px; --radius-lg: 14px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", Consolas, monospace;
  --shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 10px 30px rgba(0,0,0,.35);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button, input { font: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--text-2); margin: 0 0 14px; }
.muted.small { font-size: 12.5px; }
.label { font-size: 12px; font-weight: 500; color: var(--text-2); letter-spacing: .02em; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.row.gap { justify-content: flex-start; margin-top: 12px; }
.num { font-variant-numeric: tabular-nums; }

/* ---- shell ---- */
.app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; position: relative; isolation: isolate; }
.glow { position: fixed; inset: 0; pointer-events: none; z-index: -1;
  background: radial-gradient(900px 500px at 15% -10%, rgba(139,124,255,.16), transparent 60%),
              radial-gradient(700px 400px at 100% 100%, rgba(98,126,234,.10), transparent 60%); }
.sidebar { background: var(--bg-2); border-right: 1px solid var(--line); padding: 22px 14px; display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100vh; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; letter-spacing: -.01em; padding: 0 8px; }
.logo-mark { width: 22px; height: 22px; border-radius: 6px; background: var(--text); position: relative; box-shadow: 0 0 0 4px rgba(255,255,255,.04); }
.logo-mark::after { content: ""; position: absolute; left: 6px; top: 6px; width: 10px; height: 10px; border-radius: 2px; background: var(--bg-2); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item { appearance: none; border: 0; background: transparent; color: var(--text-2); text-align: left; padding: 10px 12px; border-radius: var(--radius); display: flex; align-items: center; gap: 12px; cursor: pointer; font-weight: 500; transition: background .15s, color .15s; }
.nav-item svg { width: 18px; height: 18px; fill: currentColor; opacity: .9; }
.nav-item:hover { background: var(--bg-3); color: var(--text); }
.nav-item.on { background: linear-gradient(90deg, rgba(139,124,255,.18), rgba(139,124,255,.06)); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.device { margin-top: auto; border: 1px solid var(--line-2); border-radius: var(--radius); padding: 12px; display: grid; gap: 6px; background: rgba(255,255,255,.02); }
.device-row { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; }
.device-sub { font-size: 12px; color: var(--text-2); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.dot.on { background: var(--up); box-shadow: 0 0 0 3px rgba(95,208,122,.18); }

.main { padding: 26px 32px 60px; display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.topbar h1 { margin: 0; font-size: 24px; font-weight: 600; letter-spacing: -.02em; }
.topbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sync { font-size: 12.5px; color: var(--text-2); display: inline-flex; align-items: center; gap: 7px; }
.sync-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); }
.sync.ok .sync-dot { background: var(--up); }
.sync.busy .sync-dot { background: var(--accent-2); animation: pulse 1s ease-in-out infinite; }
.sync.err .sync-dot { background: var(--down); }
.sync.err { color: var(--down); }
@keyframes pulse { 50% { opacity: .3; } }
.icon-btn { appearance: none; border: 1px solid var(--line-2); background: transparent; color: var(--text-2); width: 32px; height: 32px; border-radius: var(--radius); display: inline-grid; place-items: center; cursor: pointer; }
.icon-btn:hover { background: var(--bg-3); color: var(--text); }
.icon-btn svg { width: 16px; height: 16px; fill: currentColor; }
.app[data-hidden="false"] .eye-off { display: none; }
.app[data-hidden="true"] .eye-open { display: none; }
.app[data-hidden="true"] .icon-btn { color: var(--accent-2); border-color: rgba(139,124,255,.4); }

/* ---- buttons ---- */
.btn { appearance: none; border: 1px solid transparent; border-radius: var(--radius); padding: 10px 16px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; text-decoration: none; line-height: 1.2; transition: transform .08s, background .15s; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--text); color: #000; }
.btn.primary:hover { background: #e6e6e6; }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line-2); }
.btn.ghost:hover { background: var(--bg-3); }
.btn.small { padding: 7px 12px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.link { appearance: none; background: none; border: 0; color: var(--accent-2); font-weight: 500; cursor: pointer; padding: 0; font-size: 13px; }
.link:hover { text-decoration: underline; }
.seg { display: inline-flex; background: var(--bg-3); border-radius: var(--radius); padding: 3px; gap: 2px; }
.seg button { appearance: none; border: 0; background: transparent; color: var(--text-2); padding: 6px 12px; border-radius: 7px; font-weight: 600; font-size: 12.5px; cursor: pointer; }
.seg button.on { background: var(--bg); color: var(--text); }

/* ---- cards ---- */
.view { display: none; flex-direction: column; gap: 18px; }
.view.on { display: flex; animation: fadeUp .25s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.card { background: linear-gradient(180deg, rgba(255,255,255,.025), rgba(255,255,255,0)) , var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px 22px; box-shadow: var(--shadow); }
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }

/* skeleton */
.skel { display: inline-block; height: 1em; border-radius: 6px; background: linear-gradient(90deg, var(--bg-3) 25%, var(--bg-4) 50%, var(--bg-3) 75%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; vertical-align: middle; }
.skel.w-lg { width: 220px; height: 1.1em; } .skel.w-md { width: 140px; height: .9em; } .skel.w-sm { width: 80px; }
.skel.block { display: block; width: 100%; height: 44px; border-radius: 10px; margin: 8px 0; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* balance + chart */
.balance-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.total { font-size: 40px; font-weight: 600; letter-spacing: -.025em; line-height: 1.1; margin-top: 4px; font-variant-numeric: tabular-nums; }
.delta { font-size: 13px; color: var(--text-2); margin-top: 6px; font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 8px; }
.delta .chip { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; font-weight: 600; font-size: 12px; }
.delta.up .chip { background: rgba(95,208,122,.14); color: var(--up); } .delta.down .chip { background: rgba(255,90,106,.14); color: var(--down); }
.ranges { display: inline-flex; gap: 4px; background: var(--bg-3); padding: 3px; border-radius: var(--radius); }
.ranges button { appearance: none; border: 0; background: transparent; color: var(--text-2); padding: 6px 10px; border-radius: 7px; font-weight: 600; font-size: 12.5px; cursor: pointer; }
.ranges button.on { background: var(--bg); color: var(--text); }
.chart { position: relative; margin-top: 16px; height: 220px; cursor: crosshair; }
.chart svg { width: 100%; height: 100%; display: block; }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-3); font-size: 13px; }
/* axis labels and end point live in HTML so they never stretch with the SVG */
.axis { position: absolute; left: 0; right: 0; bottom: 0; height: 18px; font-size: 11px; color: var(--text-3); pointer-events: none; font-variant-numeric: tabular-nums; }
.axis span { position: absolute; top: 0; white-space: nowrap; transform: translateX(-50%); }
.axis span.first { transform: none; } .axis span.last { transform: translateX(-100%); }
.end-dot { position: absolute; width: 8px; height: 8px; border-radius: 50%; background: #bbb0ff; box-shadow: 0 0 0 4px rgba(139,124,255,.22); transform: translate(-50%, -50%); pointer-events: none; }
.end-dot.down { background: #ff8a95; box-shadow: 0 0 0 4px rgba(255,90,106,.22); }
.crosshair { position: absolute; top: 0; bottom: 26px; width: 0; pointer-events: none; }
.ch-line { position: absolute; top: 0; bottom: 0; left: 0; border-left: 1px dashed rgba(255,255,255,.25); }
.ch-dot { position: absolute; width: 10px; height: 10px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 0 4px rgba(139,124,255,.25); left: -5px; }
.tooltip { position: absolute; top: 8px; transform: translateX(-50%); background: rgba(15,16,18,.92); border: 1px solid var(--line-2); border-radius: 8px; padding: 6px 10px; pointer-events: none; white-space: nowrap; }
.tt-val { font-weight: 600; font-variant-numeric: tabular-nums; font-size: 13px; }
.tt-date { color: var(--text-2); font-size: 11.5px; }

/* allocation */
.alloc-wrap { display: grid; grid-template-columns: 120px minmax(0,1fr); gap: 20px; align-items: center; }
.donut { width: 120px; height: 120px; position: relative; }
.donut svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.donut .center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; font-size: 11px; color: var(--text-2); line-height: 1.2; }
.donut .center b { display: block; color: var(--text); font-size: 14px; font-variant-numeric: tabular-nums; }
.alloc { display: grid; gap: 12px; }
.alloc-row { display: grid; gap: 6px; }
.alloc-top { display: flex; justify-content: space-between; font-size: 13px; font-variant-numeric: tabular-nums; }
.alloc-top b { font-weight: 600; }
.alloc-top .sw { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 8px; vertical-align: 1px; }
.alloc-bar { height: 6px; background: var(--bg-3); border-radius: 3px; overflow: hidden; }
.alloc-bar i { display: block; height: 100%; border-radius: 3px; transition: width .6s cubic-bezier(.2,.8,.2,1); }

/* market */
.market { display: grid; gap: 4px; }
.mk { display: grid; grid-template-columns: 30px minmax(0,1fr) 90px auto; gap: 12px; align-items: center; font-variant-numeric: tabular-nums; padding: 8px 6px; border-radius: 10px; }
.mk:hover { background: rgba(255,255,255,.03); }
.mk .mk-name { font-weight: 600; line-height: 1.2; } .mk .mk-name span { color: var(--text-2); font-weight: 500; margin-left: 6px; font-size: 12px; }
.mk .mk-sub { font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.mk .mk-price { text-align: right; font-weight: 600; } .mk .mk-price small { display: block; font-size: 12px; font-weight: 500; }
.spark { width: 90px; height: 30px; display: block; }
.up { color: var(--up); } .down { color: var(--down); }
.mk-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.mk-stats div { font-size: 11.5px; color: var(--text-3); }
.mk-stats b { display: block; color: var(--text-2); font-weight: 600; font-size: 12.5px; font-variant-numeric: tabular-nums; }

.coin-ic { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff; box-shadow: 0 0 0 1px rgba(255,255,255,.08) inset; }
.coin-ic.btc { background: radial-gradient(circle at 35% 30%, #ffb35c, var(--btc) 60%); } .coin-ic.eth { background: radial-gradient(circle at 35% 30%, #8ea0ff, var(--eth) 60%); }
.coin-ic.big { width: 40px; height: 40px; font-size: 17px; }

/* accounts */
.acct-list { display: flex; flex-direction: column; }
.acct { display: grid; grid-template-columns: 40px minmax(0, 1fr) 100px auto 16px; gap: 14px; align-items: center; padding: 14px 6px; border-top: 1px solid var(--line); cursor: pointer; border-radius: 10px; transition: background .15s; }
.acct:first-child { border-top: 0; }
.acct:hover { background: rgba(255,255,255,.03); }
.acct .a-name { font-weight: 600; } .acct .a-sub { color: var(--text-2); font-size: 12.5px; font-family: var(--mono); }
.acct .a-bal { text-align: right; font-variant-numeric: tabular-nums; } .acct .a-bal b { font-weight: 600; display: block; } .acct .a-bal span { color: var(--text-2); font-size: 12.5px; }
.acct .chev { color: var(--text-3); font-size: 16px; transition: transform .2s; }
.acct.open .chev { transform: rotate(90deg); }
.acct .a-err { color: var(--down); font-size: 12px; }
@media (max-width: 720px) { .acct { grid-template-columns: 40px minmax(0,1fr) auto 16px; } .acct .spark { display: none; } }
.acct-detail { display: none; padding: 4px 6px 16px 60px; border-top: 1px dashed var(--line); }
.acct-detail.open { display: grid; gap: 12px; animation: fadeUp .2s ease both; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 14px; font-size: 13px; }
.kv dt { color: var(--text-2); } .kv dd { margin: 0; overflow-wrap: anywhere; }
.tokens { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; font-size: 13px; }
.tk { display: grid; grid-template-columns: minmax(0,1fr) auto auto; gap: 12px; padding: 8px 12px; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.tk:first-child { border-top: 0; background: var(--bg-3); color: var(--text-2); font-size: 12px; font-weight: 600; }
.tk span:nth-child(3) { color: var(--text-2); }

/* activity */
.activity { display: flex; flex-direction: column; }
.act-day { font-size: 12px; font-weight: 600; color: var(--text-3); letter-spacing: .04em; text-transform: uppercase; padding: 14px 6px 6px; }
.act { display: grid; grid-template-columns: 36px minmax(0,1fr) auto; gap: 14px; align-items: center; padding: 11px 6px; border-radius: 10px; text-decoration: none; }
.act:hover { background: rgba(255,255,255,.03); }
.act-ic { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-size: 15px; font-weight: 700; }
.act-ic.in { background: rgba(95,208,122,.14); color: var(--up); } .act-ic.out { background: rgba(255,90,106,.12); color: var(--down); }
.act .t { font-weight: 600; } .act .s { color: var(--text-2); font-size: 12.5px; font-family: var(--mono); }
.act .amt { text-align: right; font-variant-numeric: tabular-nums; } .act .amt b { display: block; font-weight: 600; } .act .amt span { color: var(--text-2); font-size: 12.5px; }
.act .pend { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 999px; background: rgba(224,166,74,.15); color: #e0a64a; margin-left: 6px; vertical-align: 1px; }
.act-empty { padding: 36px 10px; text-align: center; color: var(--text-3); }

/* receive */
.receive .recv-body { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 24px; align-items: start; margin-top: 18px; }
@media (max-width: 720px) { .receive .recv-body { grid-template-columns: 1fr; } }
.qr-wrap { padding: 6px; border-radius: 16px; background: linear-gradient(135deg, rgba(139,124,255,.5), rgba(98,126,234,.2)); }
.qr { width: 196px; height: 196px; background: #fff; padding: 12px; border-radius: 12px; display: grid; place-items: center; }
.qr img, .qr canvas { display: block; }
.addr-full { font-size: 14px; margin: 6px 0 4px; overflow-wrap: anywhere; }

/* hidden balances */
.app[data-hidden="true"] .money { filter: blur(0); }
.masked { letter-spacing: .12em; color: var(--text-2); }

/* ---- lock screen ---- */
.app[data-locked="true"] .sidebar, .app[data-locked="true"] .main { filter: blur(6px); pointer-events: none; user-select: none; opacity: .35; }
.lock { position: fixed; inset: 0; display: grid; place-items: center; z-index: 40; padding: 24px; background: rgba(15,16,18,.55); }
.app[data-locked="false"] .lock { display: none; }
.lock-card { width: min(520px, 100%); background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 18px; padding: 36px 36px 30px; text-align: center; box-shadow: 0 30px 80px rgba(0,0,0,.55); animation: fadeUp .3s ease both; }
.usb-art { width: 220px; margin: 0 auto 18px; position: relative; }
.usb-art svg { width: 100%; display: block; position: relative; }
.orb { position: absolute; left: 50%; top: 50%; width: 260px; height: 160px; transform: translate(-50%,-50%); background: radial-gradient(closest-side, rgba(139,124,255,.35), transparent); filter: blur(10px); animation: breathe 3.2s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .55; transform: translate(-50%,-50%) scale(1.06); } }
@keyframes led { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
.usb-led { animation: led 1.6s ease-in-out infinite; }
.lock-card h2 { margin: 0 0 8px; font-size: 22px; font-weight: 600; letter-spacing: -.02em; }
.lock-card p { margin: 0 auto 22px; color: var(--text-2); max-width: 40ch; }
.lock-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.lock-hint { margin-top: 18px; font-size: 12px; color: var(--text-3); }
.lock-error { margin-top: 14px; font-size: 13px; color: var(--down); background: rgba(255,90,106,.1); border: 1px solid rgba(255,90,106,.3); border-radius: var(--radius); padding: 10px 12px; }

.drop { position: fixed; inset: 12px; z-index: 50; border: 2px dashed var(--accent); border-radius: 16px; display: grid; place-items: center; font-weight: 600; font-size: 20px; color: var(--accent-2); background: rgba(15,16,18,.85); pointer-events: none; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--text); color: #000; padding: 10px 16px; border-radius: var(--radius); font-weight: 500; font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 60; }
.toast.show { opacity: 1; }

@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; flex-wrap: wrap; }
  .nav { flex-direction: row; flex-wrap: wrap; } .device { margin-top: 0; margin-left: auto; }
  .main { padding: 18px 16px 48px; }
  .total { font-size: 32px; }
  .alloc-wrap { grid-template-columns: 1fr; } .donut { margin: 0 auto; }
  .mk { grid-template-columns: 30px minmax(0,1fr) auto; } .mk .spark { display: none; }
}
@media (prefers-reduced-motion: reduce) { .usb-led, .orb, .sync-dot, .skel { animation: none; } .view.on, .lock-card, .acct-detail.open { animation: none; } .alloc-bar i, .toast, .acct .chev { transition: none; } }
