/* ==========================================================================
   Stackd
   1. Tokens & base      5. Converter          9. Dialogs & toasts
   2. Layout             6. Trends & chart    10. Forms & auth
   3. Header & nav       7. Juggle            11. Saved & account
   4. Buttons & bits     8. Lists & rows      12. Utilities
   ========================================================================== */

/* 1. Tokens & base ------------------------------------------------------- */
:root {
  --bg: #07051a;
  --screen: #0b0820;
  --panel: #16132d;
  --panel-2: #1c1838;
  --panel-3: #241f44;
  --panel-glass: rgba(22, 19, 45, .62);
  --line: rgba(255, 255, 255, .08);
  --line-2: rgba(255, 255, 255, .14);
  --accent: #5f46f2;
  --accent-hover: #6b54ff;
  --accent-2: #7a63ff;
  --accent-text: #9a88ff;
  --text: #fff;
  --muted: #a7a3c2;
  --faint: #6f6a94;
  --bar: #2a2646;
  --up: #3ddc97;
  --down: #ff6b81;
  --warn: #ffc857;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", Roboto, sans-serif;
  --ease: cubic-bezier(.3, .8, .3, 1);
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background:
    radial-gradient(900px 500px at 20% 0%, rgba(95, 70, 242, .22), transparent 60%),
    radial-gradient(700px 500px at 90% 100%, rgba(95, 70, 242, .14), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
img, svg { display: block; }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
[hidden] { display: none !important; }
h1, h2, h3 { font-weight: 600; letter-spacing: -.2px; line-height: 1.2; }
h1 { font-size: 22px; }
h2 { font-size: 20px; }
h3 { font-size: 17px; }

.icon { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* 2. Layout -------------------------------------------------------------- */
.container { width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 16px; }
.main { flex: 1; padding-top: 14px; padding-bottom: 24px; }

.layout-2col { display: grid; gap: 28px; }
.stack { display: grid; gap: 28px; align-content: start; }
.panel { min-width: 0; }
.panel--card {
  background: var(--panel-glass);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 20px;
}
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 24px 0 14px; }
.panel > .section-head:first-child { margin-top: 0; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin: 6px 0 22px; }
.page-head h1 { font-size: 28px; letter-spacing: -.5px; }
.disclaimer { margin-top: 24px; text-align: center; color: var(--faint); font-size: 12.5px; line-height: 1.5; }

@media (min-width: 768px) {
  .container { padding: 0 24px; }
  .main { padding-top: 32px; padding-bottom: 48px; }
  .panel:not(.panel--card) {
    background: var(--panel-glass);
    border: 1px solid var(--line);
    border-radius: 32px;
    padding: 26px;
  }
  .panel--card { padding: 26px; border-radius: 32px; }
}
@media (min-width: 1000px) {
  .layout-2col { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .layout-2col--wide { grid-template-columns: minmax(0, 1.25fr) minmax(0, .75fr); }
}

/* 3. Header & nav -------------------------------------------------------- */
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--accent); color: #fff; padding: 10px 16px; border-radius: 12px;
}
.skip-link:focus { top: 12px; }

.app-header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(7, 5, 26, .74);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.app-header__inner { height: 64px; display: flex; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 17px; letter-spacing: -.2px; }
.brand:hover { text-decoration: none; }
.brand__mark { width: 36px; height: 36px; border-radius: 11px; }
.brand__name b { font-weight: 700; }
.header-actions { margin-left: auto; display: flex; align-items: center; }
.top-nav { display: none; }

@media (min-width: 768px) {
  .app-header__inner { display: grid; grid-template-columns: 1fr auto 1fr; height: 72px; }
  .header-actions { justify-self: end; }
  .top-nav {
    display: flex; gap: 4px; padding: 5px;
    background: var(--panel); border: 1px solid var(--line); border-radius: 999px;
  }
  .top-nav__link {
    display: flex; align-items: center; gap: 7px; padding: 9px 16px; border-radius: 999px;
    color: var(--muted); font-size: 14px; font-weight: 500; transition: background .2s, color .2s;
  }
  .top-nav__link:hover { color: var(--text); background: var(--panel-2); text-decoration: none; }
  .top-nav__link.is-active { background: var(--accent); color: #fff; box-shadow: 0 6px 20px rgba(95, 70, 242, .45); }
}

.user-menu { position: relative; }
.user-menu > summary { list-style: none; }
.user-menu > summary::-webkit-details-marker { display: none; }
.avatar {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  background: linear-gradient(135deg, #8a74ff, #3b2ab3); border: 2px solid rgba(255, 255, 255, .14);
  font-weight: 600; font-size: 15px;
}
.user-menu__panel {
  position: absolute; right: 0; top: calc(100% + 10px); z-index: 30; width: 260px; padding: 8px;
  background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 18px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .5);
}
.user-menu__who { padding: 10px 12px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.user-menu__who b { display: block; font-size: 15px; }
.user-menu__who small { display: block; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu__panel a,
.user-menu__panel button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 11px 12px; border-radius: 12px;
  background: none; border: 0; color: var(--text); font-size: 14px; text-align: left;
}
.user-menu__panel a:hover,
.user-menu__panel button:hover { background: var(--panel-3); text-decoration: none; }

.bottom-nav {
  position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 25;
  transform: translateX(-50%);
  display: flex; gap: 10px; padding: 8px; border-radius: 40px;
  background: rgba(12, 9, 32, .92); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
}
.bottom-nav__link {
  width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center;
  background: var(--panel-2); border: 1px solid var(--line); color: #fff;
}
.bottom-nav__link.is-active { background: var(--accent); }
@media (min-width: 768px) { .bottom-nav { display: none; } }

.app-footer { color: #7d78a3; font-size: 12px; line-height: 1.6; text-align: center; padding: 24px 0 130px; }
.app-footer p + p { margin-top: 6px; }
.app-footer--compact { padding-bottom: 28px; }
@media (min-width: 768px) { .app-footer { padding-bottom: 32px; } }

/* 4. Buttons & bits ------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 0 20px; border-radius: 16px;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  font-size: 15px; font-weight: 600; white-space: nowrap;
  transition: transform .15s, background .2s, box-shadow .2s, opacity .2s;
}
.btn:hover { text-decoration: none; }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled { opacity: .55; }
.btn--primary { background: var(--accent); border-color: transparent; box-shadow: 0 8px 24px rgba(95, 70, 242, .4); }
.btn--primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn--ghost { background: transparent; border-color: var(--line-2); }
.btn--ghost:hover { background: var(--panel); }
.btn--danger { background: rgba(255, 107, 129, .14); border-color: rgba(255, 107, 129, .35); color: #ffb4c0; }
.btn--danger:hover { background: rgba(255, 107, 129, .22); }
.btn--block { width: 100%; }
.btn--sm { min-height: 40px; padding: 0 14px; border-radius: 12px; font-size: 14px; }

.icon-btn {
  width: 50px; height: 50px; border-radius: 50%; flex: none; position: relative;
  display: grid; place-items: center;
  background: var(--panel); border: 1px solid var(--line); color: #fff;
  transition: transform .15s, border-color .2s;
}
.icon-btn:hover { border-color: var(--line-2); }
.icon-btn:active { transform: scale(.95); }
.icon-btn--sm { width: 40px; height: 40px; }

.fab {
  width: 58px; height: 58px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--accent); border: 0; color: #fff; box-shadow: 0 8px 24px rgba(95, 70, 242, .5);
  transition: transform .3s;
}
.fab:active { transform: scale(.94); }
.fab--spin:active { transform: rotate(180deg); }
.fab:disabled { opacity: .6; cursor: wait; }

.pill-btn {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  background: var(--panel); border: 1px solid var(--line); color: #fff;
  font-size: 13px; padding: 8px 13px; border-radius: 12px;
}
.pill-btn:hover { border-color: var(--accent-2); }
.link-btn { background: none; border: 0; color: var(--accent-text); font-size: 14px; padding: 4px 0; }
.link-btn:hover { text-decoration: underline; }

.badge {
  position: absolute; top: -8px; right: -6px; min-width: 26px; height: 24px; padding: 0 5px;
  display: grid; place-items: center; border-radius: 9px; border: 2px solid var(--screen);
  background: var(--accent); font-size: 11px; font-weight: 600;
}
.is-spinning .icon { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.status-pill {
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  background: var(--panel); border: 1px solid var(--line); color: #fff;
  font-size: 13px; padding: 8px 13px; border-radius: 12px;
}
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--up); box-shadow: 0 0 0 0 rgba(61, 220, 151, .6); animation: pulse 2s infinite; }
.dot.is-error { background: var(--down); animation: none; }
.dot.is-loading { background: var(--warn); animation: none; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(61, 220, 151, 0); } 100% { box-shadow: 0 0 0 0 rgba(61, 220, 151, 0); } }

.alert {
  display: flex; align-items: flex-start; gap: 10px; margin-bottom: 16px;
  padding: 12px 14px; border-radius: 14px; border: 1px solid; font-size: 14px; line-height: 1.45;
}
.alert .icon { margin-top: 1px; }
.alert--error { background: rgba(255, 107, 129, .12); color: #ffb4c0; border-color: rgba(255, 107, 129, .3); }
.alert--success { background: rgba(61, 220, 151, .1); color: #a6f0cf; border-color: rgba(61, 220, 151, .28); }
.alert--info { background: rgba(122, 99, 255, .12); color: #cfc8ff; border-color: rgba(122, 99, 255, .3); }
.alert.is-leaving { opacity: 0; transition: opacity .4s; }

.flag {
  width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex: none;
  display: grid; place-items: center; background: #26224a;
  font-size: 13.5px; font-weight: 700; color: #cfc8ff;
}
.flag--24 { width: 24px; height: 24px; font-size: 8px; }
.flag--32 { width: 32px; height: 32px; font-size: 11px; }
.flag--38 { width: 38px; height: 38px; font-size: 13px; }

.chg { display: inline-block; margin-top: 2px; font-size: 13px; padding: 3px 9px; border-radius: 10px; background: rgba(61, 220, 151, .14); color: var(--up); }
.chg.is-neg { background: rgba(255, 107, 129, .14); color: var(--down); }

/* 5. Converter ----------------------------------------------------------- */
.hero-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.hello { display: flex; align-items: center; gap: 12px; min-width: 0; }
.hello small { display: block; color: var(--muted); font-size: 15px; }
.hello h1 { font-size: 18px; }
.logo-dot {
  width: 50px; height: 50px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: linear-gradient(135deg, #8a74ff, #3b2ab3); border: 2px solid rgba(255, 255, 255, .12);
}

.amount-block { margin-top: 18px; }
.amount-block label { color: var(--muted); font-size: 15px; }
.amount { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.amount__input { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; border-bottom: 2px solid transparent; transition: border-color .2s; }
.amount__input:focus-within { border-bottom-color: rgba(122, 99, 255, .5); }
.amount__input span { font-size: 44px; font-weight: 500; color: var(--muted); letter-spacing: -1px; }
.amount__input input {
  flex: 1; min-width: 0; width: 100%; padding: 0; border: 0; outline: none; background: transparent;
  color: #fff; font-size: 52px; font-weight: 600; letter-spacing: -1.5px; line-height: 1.15;
}
.amount__input.is-long input { font-size: 38px; }
.amount__input.is-xlong input { font-size: 30px; }

.cards2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cc {
  position: relative; display: block; width: 100%; height: 178px; padding: 14px; overflow: hidden;
  border-radius: 26px; border: 1px solid rgba(255, 255, 255, .1); color: #fff; text-align: left;
  transition: border-color .2s, transform .15s;
}
button.cc:hover { border-color: rgba(255, 255, 255, .28); }
button.cc:active { transform: scale(.985); }
.cc--from { background: radial-gradient(120% 120% at 30% 0%, #3d3a52 0%, #1d1b2e 60%, #16142a 100%); }
.cc--to { background: linear-gradient(160deg, #5a41e6, #3f2ab5); border-color: rgba(255, 255, 255, .18); }
.cc__flag { display: block; }
.cc__tag { position: absolute; right: 14px; top: 16px; font-size: 11px; letter-spacing: .8px; text-transform: uppercase; opacity: .7; }
.cc__code { display: block; margin-top: 8px; font-size: 30px; font-weight: 600; letter-spacing: -.5px; line-height: 1; }
.cc__name { display: block; margin-top: 4px; font-size: 13px; color: rgba(255, 255, 255, .7); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc__val { position: absolute; left: 14px; right: 14px; bottom: 12px; font-size: 12px; color: rgba(255, 255, 255, .65); }
.cc__val b { display: block; margin-top: 2px; font-size: 19px; font-weight: 500; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.flash { animation: flash .9s; }
@keyframes flash { 0% { color: #b6a9ff; text-shadow: 0 0 14px rgba(182, 169, 255, .9); } }

.rateline { margin-top: 12px; color: var(--muted); font-size: 13px; text-align: center; line-height: 1.5; min-height: 39px; }
.rateline b { color: #fff; font-weight: 500; }
.rateline .soft { opacity: .7; }
.save-btn { margin-top: 16px; }

.fav-row {
  display: flex; gap: 12px; margin: 0 -16px; padding: 2px 16px;
  overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity;
}
.fav-row::-webkit-scrollbar { display: none; }
.fav {
  position: relative; flex: 0 0 150px; padding: 16px; border-radius: 20px; cursor: pointer;
  background: var(--panel); border: 1px solid var(--line); color: #fff; text-align: left; scroll-snap-align: start;
  transition: border-color .2s;
}
.fav:hover { border-color: var(--line-2); }
.fav.is-on { border-color: var(--accent-2); box-shadow: 0 0 0 1px var(--accent-2) inset; }
.fav .flag { margin-bottom: 18px; }
.fav span { display: block; color: var(--muted); font-size: 15px; }
.fav b { display: block; font-size: 20px; font-weight: 500; letter-spacing: -.3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fav__rm {
  position: absolute; right: 10px; top: 10px; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; background: rgba(255, 255, 255, .06); border: 0; color: var(--muted);
}
.fav__rm:hover { color: #fff; background: rgba(255, 107, 129, .3); }
@media (min-width: 768px) {
  .fav-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); margin: 0; padding: 0; overflow: visible; }
}

/* 6. Trends & chart ------------------------------------------------------ */
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.topbar h1, .topbar h2 { font-size: 20px; }
.pair-pickers { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 18px; }
.pair-chip {
  display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--line); color: #fff; font-size: 15px; font-weight: 600;
}
.pair-chip:hover { border-color: var(--accent-2); }

.seg { margin-top: 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 6px; border-radius: 20px; background: var(--panel); border: 1px solid var(--line); }
.seg button { padding: 14px; border: 0; border-radius: 15px; background: transparent; color: var(--muted); font-size: 16px; transition: .2s; }
.seg button.is-on { background: var(--accent); color: #fff; box-shadow: 0 6px 20px rgba(95, 70, 242, .45); }

.stat-card { margin-top: 18px; padding: 20px 20px 16px; border-radius: 28px; background: var(--panel); border: 1px solid var(--line); }
.stat-card__head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.stat-card small { display: block; color: var(--muted); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-big { font-size: 44px; font-weight: 600; letter-spacing: -1.5px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trend-badge { width: 58px; height: 58px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--panel-2); color: var(--up); }
.trend-badge.is-neg { color: var(--down); }
.trend-badge.is-neg .icon { transform: scaleY(-1); }
.periods { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 14px; }
.periods button { height: 40px; border: 0; border-radius: 20px; background: var(--panel-2); color: var(--muted); font-size: 15px; transition: .2s; }
.periods button.is-on { background: var(--accent); color: #fff; }

.chart { position: relative; margin-top: 22px; height: 200px; padding-left: 56px; }
.chart__grid { position: absolute; inset: 0 0 28px 0; }
.chart__grid div { position: absolute; left: 0; right: 0; border-top: 1px dashed rgba(255, 255, 255, .1); font-size: 12px; color: var(--muted); }
.chart__grid div:nth-child(1) { top: 0; }
.chart__grid div:nth-child(2) { top: 33.333%; }
.chart__grid div:nth-child(3) { top: 66.666%; }
.chart__grid div:nth-child(4) { top: 100%; }
.chart__grid span { position: absolute; left: 0; top: -9px; width: 54px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chart__bars { position: absolute; left: 56px; right: 0; top: 0; bottom: 28px; display: flex; align-items: flex-end; justify-content: space-between; gap: 5px; }
.bar {
  flex: 1; min-height: 4px; padding: 0; border: 0; border-radius: 6px; background: var(--bar);
  transform-origin: bottom; animation: grow .5s var(--ease);
}
.bar:hover { background: #38335e; }
.bar.is-on { background: var(--accent-2); box-shadow: 0 0 20px rgba(122, 99, 255, .5); }
@keyframes grow { from { transform: scaleY(0); } }
.chart__x { position: absolute; left: 56px; right: 0; bottom: 0; display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.chart__msg { position: absolute; inset: 0 0 28px 56px; display: grid; place-items: center; padding: 0 10px; text-align: center; color: var(--muted); font-size: 14px; }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tile { min-width: 0; padding: 16px; border-radius: 22px; background: var(--panel); border: 1px solid var(--line); color: #fff; text-align: left; transition: border-color .2s; }
.tile:hover { border-color: var(--line-2); }
.tile.is-on { border-color: var(--accent-2); }
.tile__top { display: flex; align-items: center; gap: 12px; font-size: 17px; font-weight: 500; }
.tile b { display: block; margin-top: 22px; font-size: 22px; font-weight: 500; letter-spacing: -.4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile small { color: var(--muted); font-size: 13px; }
.hint-text { margin-top: 16px; color: var(--faint); font-size: 13px; }

/* 7. Juggle -------------------------------------------------------------- */
.chips-scroll {
  display: flex; gap: 10px; margin: 0 -16px; padding: 2px 16px;
  overflow-x: auto; scrollbar-width: none;
}
.chips-scroll::-webkit-scrollbar { display: none; }
@media (min-width: 768px) { .chips-scroll { margin: 0; padding: 2px 0; flex-wrap: wrap; } }
.chip-opt {
  flex: 0 0 auto; min-width: 92px; padding: 14px 16px; border-radius: 20px; text-align: left;
  background: var(--panel); border: 1px solid var(--line); color: #fff; transition: border-color .2s, background .2s;
}
.chip-opt:hover { border-color: var(--line-2); }
.chip-opt.is-on { border-color: var(--accent-2); box-shadow: 0 0 0 1px var(--accent-2) inset; background: var(--panel-2); }
.chip-opt span { display: block; color: var(--muted); font-size: 13px; }
.chip-opt b { display: block; margin-top: 6px; font-size: 22px; font-weight: 500; letter-spacing: -.3px; white-space: nowrap; }

.cc--static { cursor: default; }
.cc__big { display: block; margin-top: 14px; font-size: 38px; font-weight: 600; letter-spacing: -1.2px; line-height: 1; }
.cc__big.is-neg { color: #ffd3da; }
.cc__path { display: block; margin-top: 6px; font-size: 12px; line-height: 1.3; color: rgba(255, 255, 255, .78); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.note { margin-top: 24px; padding: 16px; border-radius: 22px; background: var(--panel); border: 1px solid var(--line); color: var(--muted); font-size: 14px; line-height: 1.55; }
.note b { color: #fff; font-weight: 600; }
.note .pos { color: var(--up); }
.note .neg { color: var(--down); }
.note .tiny { display: block; margin-top: 8px; font-size: 12px; opacity: .85; }
.src-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.src-chip { padding: 5px 10px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.src-chip.is-ok { color: var(--up); }
.src-chip.is-bad { color: var(--down); }
[data-page="juggle"].is-busy .chart__bars { opacity: .4; transition: opacity .2s; }

/* 8. Lists & rows -------------------------------------------------------- */
.search {
  width: 100%; margin-bottom: 12px; padding: 14px 16px; border-radius: 16px; outline: none;
  background: var(--panel); border: 1px solid var(--line); color: #fff; font-size: 16px;
}
.search:focus { border-color: var(--accent-2); }
.search::placeholder { color: var(--faint); }
.list { display: grid; gap: 10px; }
.row-item {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 14px; border-radius: 18px;
  background: var(--panel); border: 1px solid var(--line); color: #fff; text-align: left;
  transition: border-color .2s, background .2s;
}
.row-item:hover { border-color: var(--line-2); background: var(--panel-2); }
.row-item.is-on { border-color: var(--accent-2); }
.row-item__meta { flex: 1; min-width: 0; }
.row-item__meta b { display: block; font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-item__meta small { display: block; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-item__meta .warn { color: var(--warn); white-space: normal; margin-top: 2px; font-size: 12px; }
.row-item__right { flex: none; text-align: right; }
.row-item__right b { display: block; font-size: 16px; font-weight: 500; }
.row-item__right small { color: var(--muted); font-size: 12px; }
.empty { width: 100%; padding: 24px 0; text-align: center; color: var(--muted); font-size: 14px; }

/* 9. Dialogs & toasts ---------------------------------------------------- */
dialog { color: var(--text); }
dialog::backdrop { background: rgba(4, 3, 15, .72); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }

.sheet {
  width: 100%; max-width: 100%; height: 92dvh; max-height: 92dvh; margin: auto auto 0;
  padding: 20px 16px 12px; border: 1px solid var(--line); border-bottom: 0; border-radius: 28px 28px 0 0;
  background: var(--screen); flex-direction: column;
}
.sheet[open] { display: flex; animation: sheet-up .32s var(--ease); }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }
.sheet__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.sheet__list { flex: 1; overflow-y: auto; overscroll-behavior: contain; display: grid; gap: 10px; align-content: start; padding-bottom: 12px; }
@media (min-width: 768px) {
  .sheet { margin: auto; max-width: 520px; height: min(720px, 86vh); padding: 24px; border-bottom: 1px solid var(--line); border-radius: 28px; }
}

.modal {
  width: calc(100% - 32px); max-width: 420px; margin: auto; padding: 28px 24px 20px;
  border: 1px solid var(--line-2); border-radius: 28px; background: var(--panel-2);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
}
.modal[open] { animation: pop .25s var(--ease); }
@keyframes pop { from { transform: scale(.96); opacity: 0; } }
.modal__body { text-align: center; }
.modal__body h2 { font-size: 22px; }
.modal__body p { margin: 8px 0 20px; color: var(--muted); font-size: 15px; line-height: 1.5; }
.modal__icon {
  width: 58px; height: 58px; margin: 0 auto 14px; border-radius: 50%;
  display: grid; place-items: center; background: rgba(95, 70, 242, .22); color: #c4b8ff;
}
.modal__actions { display: grid; gap: 10px; }

.toast-stack {
  position: fixed; left: 50%; top: 80px; z-index: 60; transform: translateX(-50%);
  display: grid; gap: 10px; width: min(420px, calc(100% - 32px)); pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 16px; pointer-events: auto;
  background: var(--panel-3); border: 1px solid var(--line-2); box-shadow: 0 14px 40px rgba(0, 0, 0, .5);
  font-size: 14px; animation: toast-in .25s ease;
}
.toast span { flex: 1; }
.toast--success .icon { color: var(--up); }
.toast--error .icon { color: var(--down); }
.toast__action { font-weight: 600; }
.toast.is-leaving { opacity: 0; transform: translateY(-6px); transition: .3s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }

/* 10. Forms & auth ------------------------------------------------------- */
.auth-top { padding-top: 22px; display: flex; justify-content: center; }
.auth-body .main { display: grid; place-items: start center; padding: 28px 16px 24px; }
.auth-shell { width: 100%; max-width: 440px; }
.auth-card {
  padding: 30px 22px; border-radius: 32px;
  background: rgba(22, 19, 45, .78); border: 1px solid var(--line); box-shadow: 0 30px 80px rgba(0, 0, 0, .4);
}
@media (min-width: 480px) { .auth-card { padding: 36px 34px; } }
.auth-card__head { text-align: center; margin-bottom: 24px; }
.auth-card__head h1 { margin-top: 4px; font-size: 26px; letter-spacing: -.5px; }
.auth-card__head p { margin-top: 6px; }
.auth-card__foot { margin-top: 18px; text-align: center; color: var(--muted); font-size: 14px; }
.auth-card__foot + .auth-card__foot { margin-top: 8px; }
.muted-link { color: var(--muted); }

.form { display: grid; gap: 16px; }
.form > .btn:not(.btn--block) { justify-self: start; }
.field { display: grid; gap: 7px; }
.field__label { font-size: 14px; font-weight: 500; color: #dcd8f5; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap__icon { position: absolute; left: 15px; color: var(--faint); pointer-events: none; }
.input {
  width: 100%; height: 52px; padding: 0 16px; border-radius: 16px; outline: none;
  background: var(--panel); border: 1px solid var(--line-2); color: #fff; font-size: 16px;
  transition: border-color .2s, box-shadow .2s;
}
.input-wrap--icon .input { padding-left: 44px; }
.input-wrap--toggle .input { padding-right: 52px; }
.input:focus { border-color: var(--accent-2); box-shadow: 0 0 0 4px rgba(122, 99, 255, .18); }
.has-error .input { border-color: rgba(255, 107, 129, .6); }
.input-wrap__toggle {
  position: absolute; right: 6px; width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center; border: 0; background: transparent; color: var(--muted);
}
.input-wrap__toggle:hover { color: #fff; background: var(--panel-2); }
.field__hint { color: var(--muted); font-size: 13px; line-height: 1.45; }
.field__error { color: #ffb4c0; font-size: 13px; }
.check { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.check.has-error { color: #ffb4c0; }
.hp { position: absolute !important; left: -10000px !important; width: 1px; height: 1px; overflow: hidden; }

.strength { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: -8px; }
.strength i { height: 5px; border-radius: 3px; background: var(--panel-3); transition: background .2s; }
.strength[data-score="1"] i:nth-child(-n+1) { background: var(--down); }
.strength[data-score="2"] i:nth-child(-n+2) { background: var(--warn); }
.strength[data-score="3"] i:nth-child(-n+3) { background: #9be36d; }
.strength[data-score="4"] i { background: var(--up); }

.secure-note { display: flex; gap: 8px; align-items: flex-start; color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.secure-note .icon { margin-top: 2px; color: var(--up); }

/* 11. Saved & account ---------------------------------------------------- */
.count-pill { padding: 3px 10px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.saved-list { list-style: none; display: grid; gap: 10px; }
.saved-item { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 20px; background: var(--panel); border: 1px solid var(--line); }
.saved-item__flags { display: flex; flex: none; }
.saved-item__flags .flag + .flag { margin-left: -10px; box-shadow: 0 0 0 2px var(--panel); }
.saved-item__main { flex: 1; min-width: 0; color: #fff; }
.saved-item__main:hover { text-decoration: none; }
.saved-item__main:hover b { color: var(--accent-text); }
.saved-item__main b { display: block; font-size: 15.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.saved-item__main small { display: block; margin-top: 2px; color: var(--muted); font-size: 13px; }
.saved-item__main .delta.pos { color: var(--up); }
.saved-item__main .delta.neg { color: var(--down); }
.saved-item__note { font-style: italic; }
.saved-item__gain { flex: none; font-weight: 600; font-size: 15px; }

.empty-state { display: grid; justify-items: center; gap: 8px; padding: 26px 10px; text-align: center; }
.empty-state__icon { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: rgba(95, 70, 242, .18); color: #c4b8ff; margin-bottom: 4px; }
.empty-state p { max-width: 320px; color: var(--muted); font-size: 14px; line-height: 1.5; margin-bottom: 8px; }

.settings-grid { display: grid; gap: 20px; }
@media (min-width: 1000px) { .settings-grid { grid-template-columns: 1fr 1fr; align-items: start; } }
.panel__intro { margin: -4px 0 18px; color: var(--muted); font-size: 14px; line-height: 1.55; }
.panel__intro--after { margin: 14px 0 0; }
.panel--danger { border-color: rgba(255, 107, 129, .28) !important; }
.event-list { list-style: none; }
.event-list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.event-list li:last-child { border-bottom: 0; }
.event-list b { display: block; font-size: 14px; font-weight: 500; }
.event-list small { color: var(--muted); font-size: 12.5px; }
.event-list__icon { width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center; background: rgba(61, 220, 151, .12); color: var(--up); }
.event-list__icon.is-warn { background: rgba(255, 200, 87, .12); color: var(--warn); }

.error-page { max-width: 480px; margin: 8vh auto; display: grid; justify-items: center; gap: 12px; text-align: center; }
.error-page__code {
  font-size: 76px; font-weight: 700; letter-spacing: -3px; line-height: 1;
  background: linear-gradient(135deg, #c4b8ff, #5f46f2); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.error-page .btn { margin-top: 10px; }
.debug { max-width: 100%; overflow: auto; padding: 12px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); text-align: left; white-space: pre-wrap; font-size: 12px; }

/* 12. Utilities ---------------------------------------------------------- */
.muted { color: var(--muted); }
.min0 { min-width: 0; }
.pos { color: var(--up); }
.neg { color: var(--down); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
