/* ==========================================================================
   CrewMiners UI — app.css
   Design tokens, layout & components. BEM-ish naming.
   Theme: data-theme="dark" (default) / "dim" / "light" on <html>.
   Accent: --accent overridable at runtime (see app.js).
   ========================================================================== */

/* ---- Fonts ---- */
/* Fonts loaded via <link> in app.blade.php to avoid render-blocking @import */

/* ---- Tokens ---- */
:root{
  --bg:#0a0c0e; --bg-2:#0d1013; --surface:#14181d; --surface-2:#191e25; --surface-3:#222932;
  --border:#23292f; --border-2:#2f3742; --hair:#1b2025;
  --text:#eef1f3; --text-2:#a4adb8; --text-3:#69727d;
  --accent:#aef23f; --accent-line:#aef23f; --accent-soft:rgba(174,242,63,.13); --accent-ink:#0a0c0e;
  --up:#56e08a; --up-soft:rgba(86,224,138,.13); --down:#ff5d6c; --down-soft:rgba(255,93,108,.12);
  --warn:#f6c044; --warn-soft:rgba(246,192,68,.13); --info:#62a0ff; --info-soft:rgba(98,160,255,.13);
  --shadow:0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.5);
  --shadow-lg:0 24px 64px -24px rgba(0,0,0,.7);
  --r-sm:9px; --r:12px; --r-lg:16px; --r-xl:18px;
  --sidebar-w:238px; --sidebar-w-collapsed:86px;
  --font:'Geist',ui-sans-serif,system-ui,-apple-system,sans-serif;
  --mono:'Geist Mono',ui-monospace,'SF Mono',Menlo,monospace;
}
html[data-theme="dim"]{
  --bg:#161b22; --bg-2:#1c222b; --surface:#1f2630; --surface-2:#252d38; --surface-3:#2e3742;
  --border:#333d49; --border-2:#414d5b; --hair:#2a323c;
  --text:#eef1f3; --text-2:#a4adb8; --text-3:#7b8492;
  --accent:#aef23f; --accent-line:#aef23f; --accent-soft:rgba(174,242,63,.13); --accent-ink:#0a0c0e;
  --up:#56e08a; --up-soft:rgba(86,224,138,.13); --down:#ff5d6c; --down-soft:rgba(255,93,108,.12);
  --warn:#f6c044; --warn-soft:rgba(246,192,68,.13); --info:#62a0ff; --info-soft:rgba(98,160,255,.13);
  --shadow:0 1px 2px rgba(0,0,0,.3), 0 8px 24px -12px rgba(0,0,0,.4);
  --shadow-lg:0 24px 64px -24px rgba(0,0,0,.6);
}
html[data-theme="light"]{
  --bg:#f3f5f1; --bg-2:#ffffff; --surface:#ffffff; --surface-2:#f6f8f3; --surface-3:#eef1ea;
  --border:#e5e9e0; --border-2:#d6dccd; --hair:#edf0e8;
  --text:#10141a; --text-2:#5b636e; --text-3:#8a929d;
  --accent:#9ad62f; --accent-line:#5f9e00; --accent-soft:rgba(120,180,20,.14); --accent-ink:#0c1207;
  --up:#16a34a; --up-soft:rgba(22,163,74,.12); --down:#e23744; --down-soft:rgba(226,55,68,.10);
  --warn:#c98a00; --warn-soft:rgba(201,138,0,.13); --info:#2f6fed; --info-soft:rgba(47,111,237,.12);
  --shadow:0 1px 2px rgba(16,20,26,.04), 0 8px 24px -14px rgba(16,20,26,.18);
  --shadow-lg:0 24px 64px -24px rgba(16,20,26,.28);
}

/* ---- Reset & base ---- */
*{box-sizing:border-box;}
html,body{margin:0;padding:0;}
body{
  background:var(--bg); color:var(--text);
  font-family:var(--font); font-size:14px; line-height:1.45;
  -webkit-font-smoothing:antialiased;
}
h1,h2,h3,h4,p{margin:0;}
a{color:inherit;text-decoration:none;}
button{font-family:inherit;}
img{max-width:100%;display:block;}
.mono{font-family:var(--mono);font-variant-numeric:tabular-nums;}
.muted{color:var(--text-3);}
.dim{color:var(--text-2);}
.up{color:var(--up);} .down{color:var(--down);} .warn{color:var(--warn);} .accent{color:var(--accent-line);}
::-webkit-scrollbar{width:10px;height:10px;}
::-webkit-scrollbar-thumb{background:var(--border-2);border-radius:10px;border:3px solid var(--bg);}
::-webkit-scrollbar-track{background:transparent;}
input,select,textarea{font-family:inherit;}
input:focus,select:focus,textarea:focus{outline:none;border-color:var(--accent)!important;}
input::placeholder,textarea::placeholder{color:var(--text-3);}

/* ---- Keyframes ---- */
@keyframes cm-pulse{0%,100%{opacity:1}50%{opacity:.35}}
@keyframes cm-in{from{transform:translateY(8px)}to{transform:none}}
@keyframes cm-toast{from{opacity:0;transform:translateX(16px)}to{opacity:1;transform:none}}
@keyframes cm-grow{from{opacity:0;transform:scale(.96)}to{opacity:1;transform:none}}
@keyframes cm-spin{to{transform:rotate(360deg)}}
.cm-view{animation:cm-in .3s ease both;}
@media (prefers-reduced-motion:reduce){.cm-view{animation:none;}}

/* ==========================================================================
   App shell
   ========================================================================== */
.app{display:flex;height:100vh;height:100dvh;width:100%;overflow:hidden;background:var(--bg);}

/* ---- Sidebar ---- */
.sidebar{
  width:var(--sidebar-w);flex:none;background:var(--bg-2);border-right:1px solid var(--hair);
  display:flex;flex-direction:column;transition:width .2s;
}
.sidebar.is-collapsed{width:var(--sidebar-w-collapsed);}
.sidebar.is-collapsed .nav__label,
.sidebar.is-collapsed .brand__text,
.sidebar.is-collapsed .user-chip__text,
.sidebar.is-collapsed .nav__badge{display:none;}
.sidebar.is-collapsed .nav__item{justify-content:center;}
.sidebar__head{display:flex;align-items:center;gap:8px;padding:18px 10px 14px;}
.brand__mark{
  width:32px;height:32px;border-radius:var(--r-sm);background:var(--accent);display:grid;place-items:center;flex:none;
  color:var(--accent-ink);font-weight:700;font-size:17px;line-height:1;
  box-shadow:0 0 0 1px var(--accent-soft),0 4px 16px -6px var(--accent);
}
.brand__text{display:flex;flex-direction:column;line-height:1.1;min-width:0;}
.brand__name{font-weight:700;font-size:15px;letter-spacing:-.02em;}
.brand__sub{font-size:10px;color:var(--text-3);letter-spacing:.14em;font-weight:600;}
.sidebar__collapse{
  margin-left:auto;width:26px;height:26px;border-radius:8px;border:1px solid var(--border);
  background:var(--surface);color:var(--text-2);display:grid;place-items:center;cursor:pointer;flex:none;
}
.sidebar.is-collapsed .sidebar__collapse{margin-left:0;}
.nav{display:flex;flex-direction:column;gap:3px;padding:6px 12px;flex:1;overflow-y:auto;}
.nav__item{
  display:flex;align-items:center;gap:12px;padding:9px 11px;border-radius:11px;border:none;cursor:pointer;
  font-size:13px;font-weight:500;text-align:left;width:100%;background:transparent;color:var(--text-2);transition:all .15s;
}
.nav__item:hover{background:var(--surface-2);color:var(--text);}
.nav__item.is-active{background:var(--accent-soft);color:var(--accent-line);font-weight:600;}
.nav__icon{display:grid;place-items:center;width:22px;height:22px;flex:none;}
.nav__label{white-space:nowrap;}
.nav__badge{margin-left:auto;font-family:var(--mono);font-size:10px;font-weight:600;background:var(--accent-soft);color:var(--accent-line);padding:1px 6px;border-radius:20px;}
.sidebar__foot{padding:12px;border-top:1px solid var(--hair);}
.user-chip{display:flex;align-items:center;gap:10px;padding:8px;border-radius:var(--r);cursor:pointer;}
.user-chip:hover{background:var(--surface-2);}
.user-chip__avatar{width:32px;height:32px;border-radius:50%;overflow:hidden;flex:none;}
.user-chip__text{display:flex;flex-direction:column;line-height:1.2;overflow:hidden;}
.user-chip__name{font-weight:600;font-size:13px;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;}
.user-chip__role{font-size:11px;color:var(--text-3);white-space:nowrap;}

/* avatar helper (initials) */
.avatar-fallback{width:100%;height:100%;display:grid;place-items:center;background:linear-gradient(135deg,var(--accent),#6fb800);color:var(--accent-ink);font-weight:700;}

/* ---- Main / topbar ---- */
.main{flex:1;display:flex;flex-direction:column;min-width:0;background:var(--bg);}
.topbar{display:flex;align-items:center;gap:14px;padding:14px 24px;border-bottom:1px solid var(--hair);background:var(--bg-2);flex:none;z-index:5;}
.topbar__title{font-size:17px;font-weight:600;letter-spacing:-.02em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0;}
.topbar__sub{font-size:12px;color:var(--text-3);white-space:nowrap;}
.search{margin-left:18px;flex:1;max-width:340px;display:flex;align-items:center;gap:9px;padding:8px 12px;background:var(--surface);border:1px solid var(--border);border-radius:11px;color:var(--text-3);}
.search input{border:none;background:transparent;color:var(--text);width:100%;}
.topbar__actions{margin-left:auto;display:flex;align-items:center;gap:10px;flex-shrink:0;}
.balance-pill{display:flex;align-items:center;gap:10px;padding:7px 12px 7px 14px;background:var(--surface);border:1px solid var(--border);border-radius:11px;cursor:pointer;}
.balance-pill__col{display:flex;flex-direction:column;line-height:1.15;align-items:flex-end;}
.balance-pill__label{font-size:10px;color:var(--text-3);font-weight:600;letter-spacing:.04em;}
.balance-pill__val{font-family:var(--mono);font-size:13px;font-weight:600;}
.topbar__balance-mobile{display:none;}

.icon-btn{position:relative;width:38px;height:38px;border-radius:11px;border:1px solid var(--border);background:var(--surface);color:var(--text-2);display:grid;place-items:center;cursor:pointer;transition:background .15s,border-color .15s;}
.icon-btn:hover{background:var(--surface-3);border-color:var(--border-2);}
.icon-btn__dot{position:absolute;top:7px;right:8px;min-width:16px;height:16px;padding:0 4px;border-radius:8px;background:var(--down);color:#fff;font-size:9.5px;font-weight:700;display:grid;place-items:center;box-shadow:0 0 0 2px var(--bg-2);font-family:var(--mono);}
.swatch{position:relative;overflow:hidden;display:grid;place-items:center;}
.swatch__chip{width:17px;height:17px;border-radius:6px;background:var(--accent);box-shadow:0 0 0 1px rgba(0,0,0,.12) inset;}
.swatch input[type=color]{position:absolute;inset:-4px;opacity:0;cursor:pointer;border:none;padding:0;}

/* scroll area & page padding */
.scroll{flex:1;overflow-y:auto;overflow-x:hidden;-webkit-overflow-scrolling:touch;overscroll-behavior-y:contain;}
.page{padding:26px 28px;max-width:1340px;margin:0 auto;}

/* ---- Bottom nav (mobile) ---- */
.bottom-nav{display:none;position:fixed;bottom:0;left:0;right:0;z-index:30;background:var(--bg-2);border-top:1px solid var(--border);padding:9px 6px calc(9px + env(safe-area-inset-bottom));justify-content:space-around;}
.bottom-nav__item{display:flex;flex-direction:column;align-items:center;gap:5px;flex:1;border:none;background:transparent;cursor:pointer;padding:4px;color:var(--text-3);font-size:11.5px;font-weight:500;}
.bottom-nav__item.is-active{color:var(--accent-line);}

/* ==========================================================================
   Primitives
   ========================================================================== */
.card{background:var(--surface);border:1px solid var(--border);border-radius:var(--r-lg);transition:border-color .18s,transform .18s,box-shadow .18s;}
.card--pad{padding:18px;}
.card--lift:hover{border-color:var(--border-2);transform:translateY(-2px);box-shadow:var(--shadow);cursor:pointer;}

.btn{display:inline-flex;align-items:center;justify-content:center;gap:7px;border-radius:11px;border:1px solid transparent;cursor:pointer;font-weight:600;font-size:13px;padding:10px 16px;transition:filter .15s,background .15s,border-color .15s,transform .08s;}
.btn:active{transform:translateY(1px);}
.btn--primary{background:var(--accent);color:var(--accent-ink);}
.btn--primary:hover{filter:brightness(1.06);}
.btn--soft{background:var(--surface);color:var(--text);border-color:var(--border);}
.btn--soft:hover{background:var(--surface-3);border-color:var(--border-2);}
.btn--ghost{background:transparent;color:var(--text-2);border-color:var(--border);}
.btn--ghost:hover{background:var(--surface-2);border-color:var(--border-2);}
.btn--danger{background:var(--down);color:#fff;}
.btn--danger-soft{background:var(--down-soft);color:var(--down);}
.btn--block{width:100%;}
.btn--sm{padding:7px 12px;font-size:12px;border-radius:9px;}
.btn--lg{padding:13px 18px;font-size:14px;border-radius:12px;}

.badge{display:inline-flex;align-items:center;gap:5px;font-size:10.5px;font-weight:600;padding:2px 8px;border-radius:20px;text-transform:capitalize;}
.badge__dot{width:6px;height:6px;border-radius:50%;background:currentColor;}
.badge--online,.badge--active{color:var(--up);background:var(--up-soft);}
.badge--listed{color:var(--info);background:var(--info-soft);}
.badge--offline{color:var(--text-3);background:var(--surface-3);}
.badge--pending,.badge--unverified,.badge--warn{color:var(--warn);background:var(--warn-soft);}

.pill{font-size:10.5px;font-weight:600;padding:2px 9px;border-radius:20px;text-transform:capitalize;}
.pill--completed{color:var(--up);background:var(--up-soft);}
.pill--processing,.pill--pending{color:var(--warn);background:var(--warn-soft);}
.pill--failed{color:var(--down);background:var(--down-soft);}
.pill--new{color:var(--accent-line);background:var(--accent-soft);font-size:9.5px;font-weight:700;padding:1px 7px;}

.delta{display:inline-flex;align-items:center;gap:3px;font-size:12px;font-weight:600;font-family:var(--mono);}
.delta--up{color:var(--up);} .delta--down{color:var(--down);}

/* segmented control */
.seg{display:inline-flex;gap:2px;padding:3px;background:var(--surface-2);border-radius:10px;border:1px solid var(--border);}
.seg__btn{border:none;cursor:pointer;font-size:12px;font-weight:600;padding:5px 11px;border-radius:8px;white-space:nowrap;background:transparent;color:var(--text-2);transition:all .15s;}
.seg__btn.is-active{background:var(--accent);color:var(--accent-ink);}

/* switch */
.switch{position:relative;width:42px;height:24px;border-radius:20px;border:none;cursor:pointer;background:var(--surface-3);flex:none;transition:background .15s;}
.switch__knob{position:absolute;top:3px;left:3px;width:18px;height:18px;border-radius:50%;background:#fff;box-shadow:0 1px 2px rgba(0,0,0,.3);transition:transform .15s;}
.switch.is-on{background:var(--accent);}
.switch.is-on .switch__knob{transform:translateX(18px);}

/* form fields */
.field{display:flex;flex-direction:column;}
.field__label{font-size:12px;font-weight:600;color:var(--text-2);margin-bottom:8px;}
.field__label--up{font-size:11px;letter-spacing:.04em;text-transform:uppercase;color:var(--text-3);margin-bottom:9px;}
.input,.select,.textarea{width:100%;padding:11px 13px;background:var(--surface-2);border:1px solid var(--border);border-radius:11px;color:var(--text);}
.select{-webkit-appearance:none;appearance:none;cursor:pointer;background-image:none;}
.field__hint{font-size:11.5px;color:var(--text-3);margin-top:8px;}
.input--mono{font-family:var(--mono);}

/* iOS Safari auto-zooms the whole page on focus if a form control's rendered
   font-size is under 16px, and does not reliably zoom back out on blur — this
   is a browser behavior, not something fixable with JS. The only permanent
   fix is guaranteeing every input/select/textarea renders at 16px+ everywhere.
   !important is required: a per-page inline font-size (which is exactly what
   caused this bug in production — see marketplace/show.blade.php) otherwise
   wins over any class-based rule regardless of specificity or source order.
   Do not remove, and do not add a competing font-size to any input/select/
   textarea inline style or scoped page <style> block — it will be ignored
   and only creates a misleading landmine for the next person editing it. */
input,select,textarea{font-size:16px!important;}

/* progress bar */
.bar{height:6px;border-radius:6px;background:var(--surface-2);overflow:hidden;}
.bar--lg{height:8px;border-radius:8px;}
.bar__fill{height:100%;border-radius:inherit;background:var(--accent-line);}

/* charts */
.chart{width:100%;height:100%;}
.chart svg{display:block;width:100%;height:100%;}
.spark{width:64px;height:30px;}
.donut{position:relative;width:118px;height:118px;flex:none;}
.donut__center{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;}

/* grids */
.grid{display:grid;gap:14px;}
/* Reusable KPI-tile grid: 4-up by default, override per-instance with
   style="--kpi-cols:N" for a different desktop count (e.g. 3 or 6) — always
   collapses to 2-up on mobile regardless, no per-page CSS needed. */
.grid--kpi{grid-template-columns:repeat(var(--kpi-cols,4),1fr);gap:var(--kpi-gap,14px);}
.grid--2{grid-template-columns:1fr 1fr;}
.grid--3{grid-template-columns:repeat(3,1fr);}
.grid--5{grid-template-columns:repeat(5,1fr);}
.grid--main{grid-template-columns:1.85fr 1fr;}
.grid--detail{grid-template-columns:1.55fr 1fr;}
.grid--cards{grid-template-columns:repeat(auto-fill,minmax(300px,1fr));}
.grid--cards-sm{grid-template-columns:repeat(auto-fill,minmax(280px,1fr));}

/* generic flex helpers */
.row{display:flex;align-items:center;gap:10px;}
.row--between{justify-content:space-between;}
.row--wrap{flex-wrap:wrap;}
.stack{display:flex;flex-direction:column;}
.spacer{margin-left:auto;}
.mt-14{margin-top:14px;} .mt-16{margin-top:16px;} .mb-14{margin-bottom:14px;} .mb-16{margin-bottom:16px;}

/* section heading inside cards */
.sec-title{font-size:14px;font-weight:600;}
.sec-sub{font-size:12px;color:var(--text-3);margin-top:2px;}

/* ==========================================================================
   Composite components
   ========================================================================== */
/* KPI */
.kpi{display:flex;flex-direction:column;gap:13px;padding:16px 17px;}
.kpi__top{display:flex;align-items:center;justify-content:space-between;}
.kpi__label{font-size:12px;color:var(--text-2);font-weight:500;}
.kpi__icon{width:30px;height:30px;border-radius:9px;background:var(--surface-2);display:grid;place-items:center;}
.kpi__value{font-family:var(--mono);font-size:25px;font-weight:600;letter-spacing:-.02em;}
.kpi__foot{display:flex;align-items:center;justify-content:space-between;gap:8px;}
.kpi__sub{font-size:11px;color:var(--text-3);white-space:nowrap;}

/* mini stat block */
.stat{padding:13px 16px;background:var(--surface-2);border-radius:var(--r);}
.stat__label{font-size:11px;color:var(--text-3);}
.stat__value{font-family:var(--mono);font-size:18px;font-weight:600;margin-top:3px;}

/* glyph tile (icon in a rounded square) */
.glyph{width:40px;height:40px;border-radius:11px;background:var(--surface-2);display:grid;place-items:center;color:var(--accent-line);flex:none;}
.glyph--sm{width:34px;height:34px;border-radius:9px;}
.glyph--lg{width:52px;height:52px;border-radius:13px;}

/* list rows */
.list__item{display:flex;align-items:center;gap:12px;padding:12px 0;border-bottom:1px solid var(--hair);}
.list__item:last-child{border-bottom:none;}
.list__item--pad{padding:12px 18px;}
.list__item--link{cursor:pointer;}
.list__item--link:hover{background:var(--surface-2);}
.list__title{font-size:13px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.list__meta{font-size:11px;color:var(--text-3);}

/* data table (revenue distributions etc.) */
.dtable__head,.dtable__row{display:grid;gap:8px;padding:11px 18px;align-items:center;}
.dtable__head{font-size:10.5px;color:var(--text-3);font-weight:600;letter-spacing:.04em;border-top:1px solid var(--hair);border-bottom:1px solid var(--hair);}
.dtable__row{border-bottom:1px solid var(--hair);}

/* hero / banner */
.banner{position:relative;overflow:hidden;background:linear-gradient(120deg,var(--surface),var(--surface-2));border:1px solid var(--border);border-radius:var(--r-xl);padding:24px;}
.banner__glow{position:absolute;right:-60px;top:-60px;width:240px;height:240px;border-radius:50%;background:var(--accent-soft);pointer-events:none;}
.banner__inner{position:relative;}

/* empty state */
.empty{background:var(--surface);border:1px dashed var(--border-2);border-radius:var(--r-lg);padding:22px;text-align:center;font-size:12.5px;color:var(--text-3);}

/* tabs (text underline style, used on profile) */
.tabs{display:flex;gap:22px;border-bottom:1px solid var(--hair);overflow-x:auto;}
.tabs__btn{background:none;border:none;cursor:pointer;font-size:13px;font-weight:600;color:var(--text-3);padding:0 0 12px;border-bottom:2px solid transparent;white-space:nowrap;display:flex;align-items:center;gap:7px;}
.tabs__btn.is-active{color:var(--accent-line);border-bottom-color:var(--accent-line);}

/* ---- Marketplace / miner cards ---- */
.miner-card{padding:18px;display:flex;flex-direction:column;gap:14px;}
.miner-card__head{display:flex;align-items:flex-start;justify-content:space-between;gap:10px;}
.miner-card__id{display:flex;align-items:center;gap:11px;min-width:0;}
.miner-card__title{font-size:14px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.miner-card__sub{font-family:var(--mono);font-size:11px;color:var(--text-3);}
.specs{display:grid;grid-template-columns:1fr 1fr;gap:11px 14px;}
.spec__k{font-size:10.5px;color:var(--text-3);}
.spec__v{font-family:var(--mono);font-size:13px;font-weight:600;margin-top:1px;}
.miner-card__foot{display:flex;align-items:center;justify-content:space-between;border-top:1px solid var(--hair);padding-top:14px;}
.price{font-family:var(--mono);font-size:16px;font-weight:600;color:var(--accent-line);}
.price--lg{font-size:20px;color:var(--text);}

/* ---- Profile header ---- */
.profile-hero{display:flex;gap:22px;align-items:center;flex-wrap:wrap;padding:24px;}
.profile-hero__avatar{position:relative;flex:none;}
.profile-hero__avatar .avatar{width:92px;height:92px;border-radius:50%;overflow:hidden;border:3px solid var(--accent);box-shadow:0 0 0 4px var(--accent-soft);}
.profile-hero__cam{position:absolute;bottom:-6px;left:50%;transform:translateX(-50%);display:flex;align-items:center;gap:5px;font-size:10.5px;font-weight:600;background:var(--surface);border:1px solid var(--border-2);color:var(--text);padding:4px 9px;border-radius:20px;cursor:pointer;white-space:nowrap;box-shadow:var(--shadow);}
.profile-hero__cam input{display:none;}
.profile-hero__name{font-size:24px;font-weight:700;letter-spacing:-.02em;}
.profile-hero__meta{display:flex;align-items:center;gap:18px;flex-wrap:wrap;margin-top:14px;font-size:12px;color:var(--text-2);}
.profile-hero__meta span{display:flex;align-items:center;gap:6px;}

/* ---- Modal ---- */
.modal-overlay{position:fixed;inset:0;z-index:60;background:rgba(4,6,8,.62);backdrop-filter:blur(3px);display:none;align-items:center;justify-content:center;padding:20px;}
.modal-overlay.is-open{display:flex;animation:cm-grow .18s ease;}
.modal{width:100%;max-width:440px;max-height:92vh;overflow-y:auto;background:var(--surface);border:1px solid var(--border-2);border-radius:var(--r-xl);box-shadow:var(--shadow-lg);}
.modal--md{max-width:480px;} .modal--sm{max-width:420px;}
.modal__head{padding:20px 22px 14px;border-bottom:1px solid var(--hair);}
.modal__title{font-size:16px;font-weight:600;}
.modal__sub{font-size:12.5px;color:var(--text-2);margin-top:3px;}
.modal__body{padding:18px 22px 22px;display:flex;flex-direction:column;gap:14px;}
.kv{border:1px solid var(--border);border-radius:13px;overflow:hidden;}
.kv__row{display:flex;justify-content:space-between;padding:11px 14px;font-size:13px;border-bottom:1px solid var(--hair);}
.kv__row:last-child{border-bottom:none;}
.kv__row b{font-family:var(--mono);font-weight:600;}
.note{display:flex;gap:9px;padding:11px 13px;border-radius:11px;font-size:12px;}
.note--info{background:var(--info-soft);color:var(--text-2);}
.note--ok{background:var(--up-soft);color:var(--up);}
.note--warn{background:var(--warn-soft);color:var(--warn);}
.total-row{display:flex;justify-content:space-between;align-items:center;padding:14px 16px;background:var(--accent-soft);border-radius:13px;}
.total-row__amt{font-family:var(--mono);font-size:20px;font-weight:600;color:var(--accent-line);}

/* QR placeholder */
.qr{width:118px;height:118px;border-radius:12px;background:#fff;padding:9px;}
.qr__inner{width:100%;height:100%;border-radius:3px;background:#fff;background-image:repeating-linear-gradient(0deg,#0a0c0e 0 5px,transparent 5px 10px),repeating-linear-gradient(90deg,#0a0c0e 0 5px,#fff 5px 10px);}

/* ---- Toast ---- */
.toast-wrap{position:fixed;top:18px;right:18px;z-index:9999;display:flex;flex-direction:column;gap:10px;}
.toast{display:flex;align-items:center;gap:11px;padding:12px 16px;max-width:360px;background:var(--surface);border:1px solid var(--border-2);border-radius:13px;box-shadow:var(--shadow-lg);animation:cm-toast .26s cubic-bezier(.2,.8,.2,1);}
.toast__icon{width:24px;height:24px;border-radius:50%;flex:none;display:grid;place-items:center;background:var(--accent-soft);color:var(--accent-line);}
.toast--error .toast__icon{background:var(--down-soft);color:var(--down);}
.toast__msg{font-size:13px;font-weight:500;}

/* ---- Notifications dropdown ---- */
.notif-pop{position:absolute;top:48px;right:0;width:340px;max-width:86vw;z-index:200;background:var(--surface);border:1px solid var(--border-2);border-radius:15px;box-shadow:var(--shadow-lg);overflow:hidden;animation:cm-grow .16s ease;}
.notif-pop__head{display:flex;align-items:center;justify-content:space-between;padding:14px 16px;border-bottom:1px solid var(--hair);}
.notif-pop__list{max-height:344px;overflow-y:auto;}
.notif-item{display:flex;gap:11px;padding:12px 16px;border-bottom:1px solid var(--hair);}
.notif-item--link{cursor:pointer;}
.notif-item--link:hover{background:var(--surface-2);}
.notif-item__body{font-size:11.5px;color:var(--text-2);line-height:1.45;margin-top:2px;}
.notif-item__time{font-size:10.5px;color:var(--text-3);margin-top:4px;}
.notif-pop__foot{width:100%;padding:12px;border:none;border-top:1px solid var(--hair);background:var(--surface-2);color:var(--text);font-weight:600;font-size:12.5px;cursor:pointer;}
.backdrop{position:fixed;inset:0;z-index:40;}

/* range slider */
input[type=range]{width:100%;accent-color:var(--accent);cursor:pointer;}

/* link */
.link{color:var(--accent-line);font-weight:600;cursor:pointer;}

/* ==========================================================================
   Auth pages
   ========================================================================== */
.auth{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:24px;background:
  radial-gradient(900px 500px at 80% -10%,var(--accent-soft),transparent 60%),var(--bg);}
.auth__card{width:100%;max-width:420px;background:var(--surface);border:1px solid var(--border);border-radius:var(--r-xl);padding:32px;box-shadow:var(--shadow-lg);}
.auth__brand{display:flex;align-items:center;gap:10px;margin-bottom:24px;}
.auth__title{font-size:22px;font-weight:700;letter-spacing:-.02em;}
.auth__sub{font-size:13px;color:var(--text-2);margin-top:4px;}
.auth__foot{margin-top:20px;text-align:center;font-size:12.5px;color:var(--text-3);}
.otp-inputs{display:flex;gap:10px;justify-content:space-between;}
.otp-inputs input{width:100%;aspect-ratio:1;text-align:center;font-family:var(--mono);font-size:20px;font-weight:600;background:var(--surface-2);border:1px solid var(--border);border-radius:12px;color:var(--text);}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width:980px){
  .sidebar{display:none;}
  .bottom-nav{display:flex;}
  .scroll{padding-bottom:84px;}
  .hide-mobile{display:none!important;}
  .page{padding:18px 16px;}
  .grid--main,.grid--detail{grid-template-columns:1fr;}
  .topbar__balance-mobile{display:inline-flex;align-items:center;font-family:var(--mono);font-size:11px;font-weight:700;color:var(--accent);background:var(--surface);border:1px solid var(--border);border-radius:20px;padding:3px 8px;text-decoration:none;white-space:nowrap;flex-shrink:0;}

  /* Topbar on phone widths: a long page title must never push into the
     action icons — it truncates (see base .topbar__title overflow rule)
     instead, and everything in the actions cluster shrinks together so
     the whole row comfortably fits without crowding or wrapping. */
  .topbar{padding:12px 14px;gap:8px;}
  .topbar__title{font-size:15px;}
  .topbar__actions{gap:6px;}
  .topbar__actions .icon-btn{width:33px;height:33px;border-radius:10px;}
  .topbar__actions .icon-btn svg{width:17px;height:17px;}
  .topbar__actions .swatch__chip{width:15px;height:15px;}
  .topbar__actions .btn{padding:8px 10px;}
  .topbar__actions .btn svg{width:15px;height:15px;}
}
@media (max-width:680px){
  .grid--5,.grid--3,.grid--2{grid-template-columns:1fr;}
  .specs{grid-template-columns:1fr 1fr;}
}

/* Cancel/Transfer buttons on the miner detail page: one row, Cancel (or List
   for sale) on the left, Transfer revenue pushed to the right via its own
   margin-left:auto — never let their labels wrap onto a second line. */
.miner-hero__actions .btn{white-space:nowrap;}
@media (max-width:900px){
  .grid--kpi{grid-template-columns:repeat(2,1fr)!important;}
}

/* ── Password reveal toggle ─────────────────────────────────────────────── */
.pw-wrap{position:relative;}
.pw-wrap .input{padding-right:44px;}
.pw-eye{position:absolute;right:12px;top:50%;transform:translateY(-50%);background:none;border:none;cursor:pointer;color:var(--text-3);padding:4px;line-height:0;transition:color .12s;}
.pw-eye:hover{color:var(--text);}

/* ── Pull to refresh (global, touch only — see initPullToRefresh in app.js) ── */
/* Small drag-progress arrow — visible only while actively dragging. */
.ptr-pull{position:fixed;top:10px;left:50%;transform:translate(-50%,0);width:32px;height:32px;border-radius:50%;background:var(--surface);border:1px solid var(--border);color:var(--text-2);display:flex;align-items:center;justify-content:center;opacity:0;z-index:9999;pointer-events:none;box-shadow:0 4px 14px rgba(0,0,0,.18);}
.ptr-pull svg{transition:transform .05s linear;}
.ptr-pull.ptr-ready{color:var(--accent-line);border-color:var(--accent-line);}

/* Shimmer — the loading state itself, shown while fresh content is fetched
   in the background (no real navigation, so #cm-preloader never flashes).
   It's a live clone of whatever page it's covering (see buildShimmer() in
   app.js): same cards, same grid, same spacing as the real content — just
   with text/icons blanked out and a shimmer sweep animating on top, so it
   reads as "this page, loading" rather than an unrelated fixed shape. */
.ptr-shimmer{position:fixed;z-index:9998;overflow:hidden;background:var(--bg);opacity:0;pointer-events:none;transition:opacity .2s ease;}
.ptr-shimmer.is-visible{opacity:1;pointer-events:auto;}
.ptr-shimmer::after{content:'';position:absolute;inset:0;background:linear-gradient(100deg,transparent 30%,rgba(255,255,255,.09) 50%,transparent 70%);background-size:200% 100%;animation:ptr-shimmer-sweep 1.4s ease-in-out infinite;}
@keyframes ptr-shimmer-sweep{0%{background-position:200% 0;}100%{background-position:-200% 0;}}
.ptr-skeleton, .ptr-skeleton *{color:transparent!important;text-shadow:none!important;caret-color:transparent!important;animation:none!important;}
.ptr-skeleton input::placeholder,.ptr-skeleton textarea::placeholder{color:transparent!important;}
.ptr-skeleton svg,.ptr-skeleton img,.ptr-skeleton canvas{filter:grayscale(1) brightness(.5) opacity(.5);}
