/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  /* Arcane Blocks design tokens — synced with landing (Linear-like) */
  --bg-0: #08090a;
  --bg-1: #0f1011;
  --bg-2: #141516;
  --bg-3: #1a1b1c;
  --bg-card: rgba(255,255,255,0.02);
  --border: rgba(255,255,255,0.08);
  --border-soft: rgba(255,255,255,0.05);
  --border-hover: rgba(255,255,255,0.14);
  --primary: #5e6ad2;
  --primary-hover: #828fff;
  --primary-dim: rgba(94,106,210,0.15);
  --accent: #7170ff;
  --purple: #a8aef5;
  --green: #10b981;
  --yellow: #fbbf24;
  --red: #f87171;
  --text-1: #f7f8f8;
  --text-2: #d0d6e0;
  --text-3: #8a8f98;
  --text-4: #62666d;
  --radius: 12px;
  --radius-sm: 6px;
  --shadow: 0 4px 24px rgba(0,0,0,0.5);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
html, body {
  height: 100%;
  background: var(--bg-0);
  color: var(--text-1);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv01", "ss03";
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ── Login Page ───────────────────────────────────────────────────────────── */
.login-root {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}
.login-bg { position: fixed; inset: 0; z-index: 0; }
.bg-orb {
  position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.18;
  animation: float 8s ease-in-out infinite;
}
.bg-orb-1 { width: 500px; height: 500px; background: #5e6ad2; top: -150px; left: -100px; animation-delay: 0s; }
.bg-orb-2 { width: 400px; height: 400px; background: #7170ff; bottom: -100px; right: -100px; animation-delay: 3s; }
.bg-orb-3 { width: 300px; height: 300px; background: #3b4299; top: 50%; right: 20%; animation-delay: 5s; }
.grid-lines {
  position: absolute; inset: 0;
  background-image: linear-gradient(rgba(94,106,210,0.04) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(94,106,210,0.04) 1px, transparent 1px);
  background-size: 50px 50px;
}
@keyframes float { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-20px)} }

.login-card {
  position: relative; z-index: 1;
  background: rgba(15,16,17,0.88);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px;
  width: 100%; max-width: 420px;
  box-shadow: 0 0 60px rgba(94,106,210,0.08), var(--shadow);
  backdrop-filter: blur(20px);
  animation: slideUp 0.4s ease;
}
@keyframes slideUp { from{opacity:0;transform:translateY(20px)} to{opacity:1;transform:translateY(0)} }

.login-brand {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 28px;
}
.brand-icon { display: flex; align-items: center; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-size: 15px; font-weight: 590; letter-spacing: -0.03em; color: var(--text-1); }
.brand-sub { font-size: 10px; color: var(--text-4, var(--text-3)); letter-spacing: 0.08em; text-transform: uppercase; font-weight: 500; }
/* Brand mark: pre-raster monogram G (crisp at 16–32px, no SVG stroke glitch) */
.brand-mark {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: grid; place-items: center;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  flex-shrink: 0;
  overflow: hidden;
  color: var(--text-1);
  box-sizing: border-box;
}
.brand-mark svg {
  width: 18px; height: 18px;
  display: block;
  overflow: visible;
}
.brand-mark img {
  width: 18px; height: 18px;
  display: block;
  object-fit: contain;
  filter: none;
  image-rendering: -webkit-optimize-contrast;
}
/* Same 32px chrome as logout button so sidebar top/bottom stay aligned */
.brand-mark-sm {
  width: 32px; height: 32px;
  border-radius: 8px;
}
.brand-mark-sm svg,
.brand-mark-sm img {
  width: 18px; height: 18px;
}

.login-title { font-size: 22px; font-weight: 700; color: var(--text-1); margin-bottom: 6px; }
.login-desc { color: var(--text-2); font-size: 13px; margin-bottom: 28px; }
.login-footer { text-align: center; color: var(--text-3); font-size: 11px; margin-top: 24px; }

/* Alerts. NOTE: this is deliberately `display:block`, not flex. With flex every
   text node and every <strong>/<em> inside becomes its own flex item, so prose
   alerts get shredded into narrow one-word-per-line columns. Icons are aligned
   inline instead. */
.alert { padding: 10px 14px; border-radius: var(--radius-sm); font-size: 12px; line-height: 1.65; display: block; margin-bottom: 16px; transition: opacity 0.5s; }
.alert > svg { vertical-align: -3px; margin-right: 6px; }
.alert strong { font-weight: 600; }
.alert-title { display: block; font-weight: 600; margin-bottom: 5px; }
.alert-list { margin: 0; padding-left: 16px; }
.alert-list li { margin: 2px 0; }
.alert-error { background: rgba(248,113,113,0.12); border: 1px solid rgba(248,113,113,0.3); color: #fca5a5; }
.alert-warning { background: rgba(251,191,36,0.1); border: 1px solid rgba(251,191,36,0.25); color: #fde68a; }
.alert-success { background: rgba(16,185,129,0.10); border: 1px solid rgba(16,185,129,0.25); color: #6ee7b7; }
.alert-info { background: rgba(94,106,210,0.1); border: 1px solid rgba(94,106,210,0.2); color: var(--primary); }

.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 12px; font-weight: 500; color: var(--text-2); margin-bottom: 6px; letter-spacing: 0.5px; text-transform: uppercase; }
.form-hint { font-size: 11px; color: var(--text-3); display: block; margin-top: 4px; }
.input-wrap { position: relative; }
.input-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.form-input {
  width: 100%; padding: 10px 14px 10px 38px;
  background: rgba(255,255,255,0.04); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-1); font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s; outline: none;
}
.form-input:not(.input-wrap .form-input) { padding: 10px 14px; }
select.form-input { padding: 10px 14px; cursor: pointer; }
select.form-input option {
  background: #1a1a2e;
  color: #e0e0e0;
}
textarea.form-input { resize: vertical; }
.form-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(94,106,210,0.18); }
.form-input:read-only { opacity: 0.6; cursor: default; }
.mono { font-family: 'JetBrains Mono', monospace; font-size: 12px; }
.toggle-pw { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--text-3); padding: 4px; }
.toggle-pw:hover { color: var(--primary); }

.form-row { margin-bottom: 16px; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.checkbox-label { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13px; color: var(--text-2); }
.checkbox-input { display: none; }
.checkbox-custom {
  width: 16px; height: 16px; border-radius: 4px; border: 1px solid var(--border);
  background: var(--bg-2); flex-shrink: 0; position: relative; transition: all 0.2s;
}
.checkbox-input:checked + .checkbox-custom { background: var(--primary); border-color: var(--primary); }
.checkbox-input:checked + .checkbox-custom::after {
  content: ''; position: absolute; left: 4px; top: 1px;
  width: 5px; height: 9px; border: 2px solid #000; border-top: none; border-left: none;
  transform: rotate(45deg);
}

.btn-login {
  width: 100%; padding: 12px 20px;
  background: var(--primary);
  border: none; border-radius: var(--radius-sm); color: #fff; font-weight: 510; font-size: 14px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: opacity 0.2s, transform 0.1s; margin-top: 8px; position: relative;
}
.btn-login:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-login:active { transform: translateY(0); }
.btn-login.loading { opacity: 0.7; pointer-events: none; }
.hidden { display: none !important; }
.spin { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn-arrow { transition: transform 0.2s; }
.btn-login:hover .btn-arrow { transform: translateX(3px); }

/* ── App Layout ───────────────────────────────────────────────────────────── */
.app-root {
  display: flex; height: 100vh; overflow: hidden; position: relative;
  background:
    radial-gradient(ellipse 55% 35% at 50% -8%, rgba(94,106,210,0.14), transparent 60%),
    radial-gradient(ellipse 35% 25% at 90% 10%, rgba(113,112,255,0.05), transparent 50%),
    var(--bg-0);
}
.app-root > * { position: relative; z-index: 1; }

/* Sidebar */
.sidebar {
  width: 220px; flex-shrink: 0; background: var(--bg-1);
  border-right: 1px solid var(--border); display: flex; flex-direction: column;
  transition: transform 0.3s; z-index: 100;
}
.sidebar-brand { padding: 14px 14px 14px 12px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--border); }
.brand-icon-sm { display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.sidebar-brand-name {
  font-size: 13px; font-weight: 590; letter-spacing: -0.02em; color: var(--text-1); flex: 1; min-width: 0;
  display: flex; flex-direction: column; line-height: 1.15;
}
.sidebar-brand-name .brand-subline {
  font-size: 10px; font-weight: 500; color: var(--text-4, var(--text-3));
  letter-spacing: 0.08em; text-transform: uppercase;
}
.sidebar-close {
  display: none; background: none; border: none; color: var(--text-2);
  padding: 6px; border-radius: 6px; margin-left: auto;
}
.sidebar-close:hover { color: var(--text-1); background: rgba(255,255,255,0.06); }
.sidebar-nav { padding: 12px 8px; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: var(--radius-sm); color: var(--text-2); font-size: 13px; font-weight: 500;
  transition: all 0.15s; cursor: pointer;
}
.nav-item:hover { color: var(--text-1); background: rgba(255,255,255,0.05); }
.nav-item.active { color: #fff; background: var(--primary); box-shadow: 0 0 0 1px rgba(94,106,210,0.25); }
.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: 56px;
}
.user-pill { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.user-avatar {
  width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0;
  background: rgba(94,106,210,0.18);
  border: 1px solid rgba(113,112,255,0.28);
  color: var(--purple); font-weight: 600; font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  box-sizing: border-box;
}
.user-name { font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Logout chip — same 32px system as brand-mark + avatar (no size mismatch) */
.logout-btn {
  width: 32px; height: 32px;
  color: var(--text-3);
  padding: 0; border-radius: 8px;
  display: grid; place-items: center;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  flex-shrink: 0;
  line-height: 0;
  box-sizing: border-box;
  text-decoration: none;
}
.logout-btn svg {
  width: 16px; height: 16px;
  display: block;
  flex-shrink: 0;
  pointer-events: none;
}
.logout-btn:hover {
  color: #fca5a5;
  background: rgba(248,113,113,0.12);
  border-color: rgba(248,113,113,0.35);
}
.logout-btn:active {
  transform: scale(0.96);
}

/* Main */
.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  height: 54px; border-bottom: 1px solid var(--border); background: var(--bg-1);
  display: flex; align-items: center; gap: 12px; padding: 0 20px; flex-shrink: 0;
}
.sidebar-toggle { background: none; border: none; color: var(--text-2); display: none; padding: 6px; }
.topbar-title { font-weight: 600; font-size: 15px; flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.live-badge { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); font-family: 'JetBrains Mono', monospace; }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 6px var(--green); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.4} }
.icon-btn { background: none; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-2); padding: 6px 8px; display: flex; align-items: center; transition: all 0.15s; }
.icon-btn:hover { border-color: var(--primary); color: var(--primary); }

/* Tab panels */
.tab-panel { display: none; flex: 1; overflow-y: auto; padding: 20px; }
.tab-panel.active { display: block; }

/* Cards grid */
.cards-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
  backdrop-filter: blur(12px);
}
.stat-card:hover { border-color: var(--border-hover); background: rgba(255,255,255,0.035); transform: translateY(-1px); }
.stat-label { font-size: 11px; font-weight: 500; color: var(--text-3); letter-spacing: 0.5px; text-transform: uppercase; margin-bottom: 8px; }
.stat-value { font-size: 26px; font-weight: 700; color: var(--text-1); font-family: 'JetBrains Mono', monospace; line-height: 1; margin-bottom: 4px; }
.stat-sub { font-size: 11px; color: var(--text-3); }
.accent-purple { color: var(--purple); }
.accent-green { color: var(--green); }
.accent-orange { color: var(--yellow); }
/* Locked / escrowed funds: same hue family as .accent-orange but a distinct
   class so the locked card can be restyled without touching cBTC. */
.accent-amber { color: var(--yellow); }
.accent-blue { color: var(--accent); }
.accent-cyan { color: var(--primary); }

/* Hero cards — Total Balance + PnL, span top row with subtle emphasis */
.stat-card-hero {
  background: linear-gradient(135deg, rgba(94,106,210,0.10), rgba(255,255,255,0.02));
  border-color: rgba(94,106,210,0.28);
}
.stat-card-hero .stat-value { font-size: 30px; }
.pnl-up   { color: var(--green); }
.pnl-down { color: var(--red); }


/* Section headers */
.section-header { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; margin-top: 6px; }
.section-header h2 { font-size: 14px; font-weight: 600; color: var(--text-1); }
.badge { background: rgba(94,106,210,0.12); color: var(--purple); border: 1px solid rgba(113,112,255,0.22); border-radius: 999px; padding: 2px 8px; font-size: 11px; font-weight: 510; }
.filter-row { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* Action grid */
.action-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 24px; }
.action-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; display: flex; align-items: center; gap: 14px;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease; text-align: left; cursor: pointer;
  backdrop-filter: blur(12px);
}
.action-card:hover { border-color: var(--border-hover); background: rgba(255,255,255,0.035); transform: translateY(-1px); }
.action-card-all { border-color: var(--accent); background: rgba(251,146,60,0.06); }
.action-card-all:hover { border-color: #f59e0b; background: rgba(251,146,60,0.12); transform: translateY(-1px); }
.spinner-sm { display: inline-block; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--text-3); border-top-color: var(--text-1); animation: spin 0.6s linear infinite; vertical-align: middle; margin-right: 6px; }
.action-icon { width: 40px; height: 40px; border-radius: 9px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; border: 1px solid var(--border); }
.action-icon-green { background: rgba(16,185,129,0.10); color: var(--green); border-color: rgba(16,185,129,0.22); }
.action-icon-cyan { background: rgba(94,106,210,0.12); color: var(--accent); border-color: rgba(113,112,255,0.22); }
.action-icon-blue { background: rgba(168,174,245,0.10); color: var(--purple); border-color: rgba(168,174,245,0.22); }
.action-icon-red { background: rgba(248,113,113,0.10); color: var(--red); border-color: rgba(248,113,113,0.22); }
.action-icon-purple { background: rgba(168,174,245,0.10); color: var(--accent); border-color: rgba(168,174,245,0.22); }
.action-text { display: flex; flex-direction: column; gap: 2px; }
.action-title { font-size: 13px; font-weight: 600; color: var(--text-1); }
.action-desc { font-size: 11px; color: var(--text-3); }

/* Tables */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  padding: 10px 14px; text-align: left; font-size: 11px; font-weight: 500;
  color: var(--text-3); text-transform: uppercase; letter-spacing: 0.5px;
  background: rgba(255,255,255,0.02); border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td { padding: 10px 14px; border-bottom: 1px solid rgba(255,255,255,0.04); color: var(--text-2); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: rgba(255,255,255,0.02); }
.data-table .loading-row td { text-align: center; padding: 40px; color: var(--text-3); }
.mono-cell { font-family: 'JetBrains Mono', monospace; font-size: 12px; }
.num-cell { font-family: 'JetBrains Mono', monospace; text-align: right; }

/* Token status badges */
.tok-ok     { color: var(--green); font-size: 11px; font-weight: 600; }
.tok-soon   { color: var(--yellow); font-size: 11px; font-weight: 600; }
.tok-exp    { color: var(--red); font-size: 11px; font-weight: 600; }
.tok-none   { color: var(--text-3); font-size: 11px; }
.tok-ref    { color: var(--primary); font-size: 11px; font-weight: 600; }
.st-active  { color: var(--green); font-weight: 600; }
.st-other   { color: var(--yellow); }
.val-pos    { color: var(--primary); font-weight: 600; }

/* Subscription column */
.sub-ok   { color: var(--green); font-size: 11px; font-weight: 600; font-family: 'JetBrains Mono', monospace; white-space: nowrap; }
.sub-warn { color: var(--yellow); font-size: 11px; font-weight: 600; font-family: 'JetBrains Mono', monospace; white-space: nowrap; }
.sub-crit { color: var(--red); font-size: 11px; font-weight: 700; font-family: 'JetBrains Mono', monospace; white-space: nowrap; }
.sub-bad  { color: var(--red); font-size: 11px; font-weight: 600; font-family: 'JetBrains Mono', monospace; white-space: nowrap; }
.sub-none { color: var(--text-3); font-size: 11px; font-family: 'JetBrains Mono', monospace; }

/* Quest status badges */
.quest-cell { white-space: nowrap; font-size: 11px; }
.qst-badge { display: inline-flex; align-items: center; gap: 1px; padding: 1px 5px; border-radius: 4px; font-size: 10px; font-weight: 600; font-family: 'JetBrains Mono', monospace; margin-right: 2px; }
.qst-done   { background: rgba(34,197,94,0.12); color: var(--green); }
.qst-avail  { background: rgba(234,179,8,0.12); color: var(--yellow); }
.qst-none   { background: rgba(148,163,184,0.08); color: var(--text-3); }

/* Account cards in Accounts tab */
.accounts-list { display: flex; flex-direction: column; gap: 12px; }
.account-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; display: flex; align-items: center; gap: 14px;
  backdrop-filter: blur(12px); transition: border-color 0.2s;
}
.account-card:hover { border-color: var(--border-hover); }
.account-avatar {
  width: 36px; height: 36px; border-radius: 9px; flex-shrink: 0;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; color: #fff;
}
.account-info { flex: 1; min-width: 0; }
.account-id { font-size: 13px; font-weight: 600; color: var(--text-1); font-family: 'JetBrains Mono', monospace; }
.account-email { font-size: 11px; color: var(--text-3); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-meta { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.account-actions { display: flex; gap: 6px; align-items: center; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px;
  border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; border: none;
  transition: all 0.15s; cursor: pointer; font-family: inherit;
}
.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #fca5a5; }
/* Middle tier between primary and danger — for "runs repeatedly but stoppable". */
.btn-warning { background: rgba(251,191,36,0.16); border: 1px solid rgba(251,191,36,0.45); color: var(--yellow); }
.btn-warning:hover { background: rgba(251,191,36,0.26); }
.btn-ghost { background: rgba(255,255,255,0.02); border: 1px solid var(--border); color: var(--text-2); }
.btn-ghost:hover { background: rgba(255,255,255,0.05); color: var(--text-1); }
.btn-outline-cyan { background: transparent; border: 1px solid rgba(113,112,255,0.35); color: var(--accent); font-size: 11px; padding: 4px 8px; border-radius: 6px; }
.btn-outline-cyan:hover { background: rgba(94,106,210,0.12); }
.btn-outline-red { background: transparent; border: 1px solid rgba(248,113,113,0.4); color: var(--red); font-size: 11px; padding: 4px 8px; border-radius: 6px; cursor: pointer; }
.btn-outline-red:hover:not(:disabled) { background: rgba(248,113,113,0.1); }
.btn-outline-red:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:disabled { opacity: 0.5; pointer-events: none; }

/* Spinner */
.spinner { width: 18px; height: 18px; border: 2px solid rgba(94,106,210,0.2); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.7s linear infinite; display: inline-block; }

/* Empty state */
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 60px 20px; color: var(--text-3); text-align: center; }
.empty-state p { font-size: 14px; }

/* Activity */
.kind-claim { color: var(--green); font-weight: 600; }
.kind-send { color: var(--yellow); font-weight: 600; }
.kind-approve { color: var(--purple); font-weight: 600; }
.kind-import { color: var(--primary); font-weight: 600; }
.kind-token { color: var(--purple); font-weight: 600; }
.kind-other { color: var(--text-2); }
/* Activity log: full date + time */
.activity-time {
  font-size: 11px;
  color: var(--text-3);
  white-space: nowrap;
  min-width: 132px;
}
.st-dot-ok { color: var(--green); }
.st-dot-err { color: var(--red); }
.st-dot-dry { color: var(--yellow); }

/* Modals */
.modal-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  z-index: 1000; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.modal-backdrop.open { display: flex; }
/* Confirm sits above form modals (e.g. Send All → Confirm) */
#modal-confirm { z-index: 1100; }
.modal {
  background: var(--bg-1); border: 1px solid var(--border); border-radius: 16px;
  width: 100%; max-width: 460px; max-height: 90vh; overflow-y: auto;
  animation: slideUp 0.25s ease; box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}
.modal-lg { max-width: 580px; }
.modal-confirm { max-width: 420px; }
.modal-header { padding: 18px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { font-size: 15px; font-weight: 600; }
.modal-close { background: none; border: none; color: var(--text-3); font-size: 20px; line-height: 1; cursor: pointer; padding: 2px 6px; border-radius: 6px; }
.modal-close:hover { color: var(--text-1); background: rgba(255,255,255,0.05); }
.modal-body { padding: 20px; display: flex; flex-direction: column; gap: 0; }
.modal-footer { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.modal-info { font-size: 12px; color: var(--text-2); margin-bottom: 16px; line-height: 1.6; }
.modal-info ul { margin: 8px 0 0; padding-left: 16px; }
.modal-info li { margin: 3px 0; }
.modal-info .kv { display: flex; flex-wrap: wrap; gap: 4px 8px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); font-size: 11px; }
.modal-info .kv span { white-space: nowrap; }
.modal-info code { font-family: 'JetBrains Mono', monospace; background: rgba(255,255,255,0.06); padding: 1px 5px; border-radius: 4px; font-size: 11px; }

/* Token guide (Add Account) */
.token-guide {
  margin-top: 8px;
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  border-radius: 10px;
  background: rgba(255,255,255,0.03);
  overflow: hidden;
}
.token-guide > summary {
  cursor: pointer;
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
  list-style: none;
  user-select: none;
}
.token-guide > summary::-webkit-details-marker { display: none; }
.token-guide > summary::before {
  content: '▸';
  display: inline-block;
  margin-right: 8px;
  color: var(--primary);
  transition: transform 0.15s ease;
}
.token-guide[open] > summary::before { transform: rotate(90deg); }
.token-guide-body {
  padding: 0 14px 14px 14px;
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.65;
}
.token-guide-body ol { margin: 0 0 0 18px; padding: 0; }
.token-guide-body li { margin: 6px 0; }
.token-guide-body ul { margin: 6px 0 0 16px; padding: 0; }
.token-guide-body code {
  font-family: 'JetBrains Mono', monospace;
  background: rgba(255,255,255,0.06);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 11px;
  word-break: break-all;
}
.token-guide-body a { color: var(--primary); text-decoration: none; }
.token-guide-body a:hover { text-decoration: underline; }
.token-guide-tip {
  margin: 12px 0 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(94,106,210,0.1);
  border: 1px solid rgba(94,106,210,0.2);
  color: var(--text-2);
  font-size: 11px;
}
#new-refresh-token, #new-token-json { resize: vertical; min-height: 64px; }

/* Import tab toggle */
.tab-toggle { display: flex; gap: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; margin-bottom: 16px; }
.tab-toggle-btn { flex: 1; padding: 8px; background: none; border: none; color: var(--text-3); font-size: 12px; font-weight: 500; cursor: pointer; transition: all 0.15s; }
.tab-toggle-btn.active { background: rgba(94,106,210,0.12); color: var(--primary); }

/* Select */
.select-sm { background: rgba(255,255,255,0.04); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-2); font-size: 12px; padding: 5px 8px; cursor: pointer; outline: none; }
.select-sm option { background: #1a1a2e; color: #e0e0e0; }

/* Toast */
#toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 12px 18px; border-radius: 10px; font-size: 13px; font-weight: 500;
  display: flex; align-items: center; gap: 8px; min-width: 260px; max-width: 380px;
  animation: toastIn 0.3s ease; box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
.toast-success { background: rgba(16,185,129,0.12); border: 1px solid rgba(16,185,129,0.28); color: var(--green); }
.toast-error   { background: rgba(248,113,113,0.15); border: 1px solid rgba(248,113,113,0.3); color: var(--red); }
.toast-info    { background: rgba(94,106,210,0.12);  border: 1px solid rgba(113,112,255,0.25); color: var(--accent); }
.toast-warning { background: rgba(251,191,36,0.1);   border: 1px solid rgba(251,191,36,0.25); color: var(--yellow); }
@keyframes toastIn { from{opacity:0;transform:translateX(20px)} to{opacity:1;transform:translateX(0)} }

/* Responsive */
@media (max-width: 900px) {
  .cards-grid { grid-template-columns: repeat(2, 1fr); }
  .action-grid { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    transform: translateX(-100%);
    box-shadow: none;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 8px 0 32px rgba(0,0,0,0.45);
  }
  .sidebar-toggle { display: flex; align-items: center; }
  .sidebar-close { display: flex; align-items: center; }
  .sidebar-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 90;
    border: none; padding: 0; margin: 0;
    -webkit-tap-highlight-color: transparent;
  }
  .sidebar-backdrop.show { display: block; }
  .cards-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .modal { margin: 0 12px; }
}
@media (min-width: 681px) {
  .sidebar-backdrop { display: none !important; }
}

/* ── Daily Convert asset picker ─────────────────────────────────── */
.asset-select { display: flex; flex-wrap: wrap; gap: 8px; }
.asset-opt {
  display: flex; align-items: center; gap: 6px; padding: 8px 12px;
  background: rgba(255,255,255,0.03); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-2); cursor: pointer;
  font-size: 13px; transition: all 0.15s; font-family: inherit;
}
.asset-opt:hover { border-color: var(--border-hover); background: rgba(255,255,255,0.06); color: var(--text-1); }
.asset-opt.active { border-color: var(--primary); background: rgba(94,106,210,0.15); color: var(--text-1); }
.asset-opt .asset-sym { font-weight: 600; }
.asset-opt .asset-usd { font-size: 11px; color: var(--text-3); }

/* ── Asset list rows — replica of the Modulo app "Select asset" sheet ──
   Each row: round token badge, symbol on line 1, estimated payout + USD on
   line 2, fee on line 3. Selected row gets a primary ring. */
.asset-list { display: flex; flex-direction: column; gap: 8px; }
.asset-row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 12px 14px; text-align: left; cursor: pointer;
  background: var(--bg-3); border: 1px solid transparent;
  border-radius: 14px; color: var(--text-2); font-family: inherit;
  transition: all 0.15s;
}
.asset-row:hover { background: #1f2021; border-color: var(--border-hover); }
.asset-row.active { border-color: var(--primary); background: rgba(94,106,210,0.12); }
.asset-row:disabled { opacity: 0.45; cursor: not-allowed; }
.asset-ico {
  flex: 0 0 34px; width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; letter-spacing: -0.3px;
  font-family: 'JetBrains Mono', monospace;
}
.asset-ico-CBTC  { background: #e2703c; color: #fff6e6; }
.asset-ico-CC    { background: #0a0c00; color: #e6f28f; border: 1px solid #4c5327; }
.asset-ico-CETH  { background: #dfea9d; color: #1a1c08; }
.asset-ico-MOD   { background: #5a37e8; color: #fff9ff; }
.asset-ico-USDCX { background: #2c46b8; color: #f2feff; }
.asset-ico-DEF   { background: var(--bg-2); color: var(--text-2); border: 1px solid var(--border); }
.asset-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.asset-meta .a-sym { font-size: 14px; font-weight: 600; color: var(--text-1); display: flex; align-items: center; gap: 6px; }
.asset-meta .a-badge {
  font-size: 10px; font-weight: 700; line-height: 1.4;
  padding: 1px 5px; border-radius: 4px;
  color: var(--green); background: color-mix(in srgb, var(--green) 15%, transparent);
}
.asset-meta .a-est { font-size: 12px; color: var(--text-2); font-family: 'JetBrains Mono', monospace; }
.asset-meta .a-fee { font-size: 11px; color: var(--text-3); }
.asset-check { flex: 0 0 auto; color: var(--primary); font-size: 15px; opacity: 0; }
.asset-row.active .asset-check { opacity: 1; }
.convert-summary {
  margin-top: 16px; padding: 14px; background: rgba(255,255,255,0.02);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.convert-row { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; font-size: 13px; color: var(--text-2); }
.convert-row strong { color: var(--text-1); }
.convert-hint { margin-top: 10px; font-size: 11px; color: var(--text-3); line-height: 1.5; }

/* ── Run Daily Quests selection ─────────────────────────────────── */
.quest-select { display: flex; flex-direction: column; gap: 8px; }
.quest-check {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  background: rgba(255,255,255,0.02); border: 1px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer; font-size: 13px; color: var(--text-2);
}
.quest-check:hover { border-color: var(--border-hover); color: var(--text-1); }
.quest-check input { accent-color: var(--primary); width: 16px; height: 16px; cursor: pointer; }

/* ── Daily Quests run log ───────────────────────────────────────── */
.quest-log {
  max-height: 340px; overflow-y: auto; padding: 12px 14px;
  background: #0a0b0c; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-family: 'JetBrains Mono', monospace; font-size: 12px; line-height: 1.6;
}
.qlog-line { color: var(--text-2); white-space: pre-wrap; word-break: break-word; padding: 1px 0; }
.qlog-ts { color: var(--text-3); margin-right: 6px; }
.qlog-acc { color: var(--accent); font-weight: 600; }
.qlog-head { color: var(--text-1); font-weight: 600; margin-top: 4px; }
.qlog-ok   { color: #6ee7b7; }
.qlog-skip { color: var(--text-3); }
.qlog-err  { color: #fca5a5; }
.qlog-warn { color: #fde68a; }
.qlog-wait { color: var(--text-3); font-style: italic; }
.qlog-info { color: var(--text-2); }

/* Screening table: muted cells for the done/todo slug lists. */
.text-2 { color: var(--text-2); font-size: 12px; }
.text-3 { color: var(--text-3); }

/* Delivery-check tally badge: green when everything landed, amber otherwise. */
.badge-ok   { background: rgba(110, 231, 183, .12); color: #6ee7b7; border-color: rgba(110, 231, 183, .3); }
.badge-warn { background: rgba(253, 230, 138, .12); color: #fde68a; border-color: rgba(253, 230, 138, .3); }

/* ── Account select grid (transfer modal) ─────────────────────────── */
.account-select-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
}
.acc-check {
  display: flex; align-items: center; gap: 8px; padding: 6px 10px;
  background: rgba(255,255,255,0.02); border: 1px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer; font-size: 12px; color: var(--text-2);
  transition: all 0.12s;
}
.acc-check:hover { border-color: var(--border-hover); color: var(--text-1); background: rgba(255,255,255,0.04); }
.acc-check input { accent-color: var(--primary); width: 15px; height: 15px; cursor: pointer; }
.acc-check .acc-name { font-weight: 600; color: var(--text-1); }
.acc-check .acc-email { font-size: 10px; color: var(--text-3); }
.acc-check .acc-bal { font-size: 10px; color: var(--text-3); margin-left: auto; white-space: nowrap; }

/* ── Cauri wallet tab ──────────────────────────────────────────────── */
.cauri-party-strip {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); backdrop-filter: blur(12px);
}
.cauri-party-label {
  font-size: 10px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-3); background: rgba(94,106,210,0.12); border: 1px solid rgba(113,112,255,0.22);
  border-radius: 999px; padding: 2px 8px; flex-shrink: 0;
}
.cauri-party-id {
  flex: 1; min-width: 0; font-size: 11px; color: var(--text-2);
  word-break: break-all; line-height: 1.5;
}

.cauri-asset-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 10px;
}
.cauri-asset {
  display: flex; align-items: center; gap: 10px; padding: 11px 13px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  transition: border-color 0.16s ease, background 0.16s ease;
}
.cauri-asset.is-empty { opacity: 0.55; }
.cauri-asset:hover { border-color: var(--border-hover); background: rgba(255,255,255,0.035); }
.cauri-asset.is-active { border-color: rgba(113,112,255,0.45); background: rgba(94,106,210,0.10); }
.cauri-asset-icon {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  background: rgba(255,255,255,0.05); object-fit: cover;
}
.cauri-asset-body { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.cauri-asset-sym {
  font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--text-3);
}
.cauri-asset-bal {
  font-family: 'JetBrains Mono', monospace; font-size: 15px; font-weight: 600;
  color: var(--text-1); line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cauri-asset-usd { font-size: 10px; color: var(--text-3); font-family: 'JetBrains Mono', monospace; }

.cauri-panel {
  padding: 16px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); backdrop-filter: blur(12px);
}
.cauri-builder { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cauri-count-pill {
  margin-left: 6px; font-size: 10px; font-weight: 600; font-family: 'JetBrains Mono', monospace;
  color: var(--purple); background: rgba(94,106,210,0.12); border: 1px solid rgba(113,112,255,0.22);
  border-radius: 999px; padding: 1px 7px; text-transform: none; letter-spacing: 0;
}
.cauri-link {
  background: none; border: none; padding: 0; font-size: 11px; color: var(--primary);
  cursor: pointer; font-family: inherit;
}
.cauri-link:hover { color: var(--primary-hover); text-decoration: underline; }
.cauri-warn-text { color: var(--yellow); }
.cauri-err-text { color: var(--red); }
.cauri-res {
  display: inline-flex; align-items: center; padding: 1px 7px; border-radius: 4px;
  font-family: 'JetBrains Mono', monospace; font-size: 10px; font-weight: 600;
  max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cauri-res-ok  { background: rgba(34,197,94,0.12); color: var(--green); }
.cauri-res-err { background: rgba(239,68,68,0.12); color: var(--red); }

.cauri-log-progress {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px; color: var(--text-3); margin-left: 8px;
}
.cauri-progress-track {
  height: 4px; border-radius: 3px; background: var(--bg-3);
  overflow: hidden; margin: 0 0 8px;
}
.cauri-progress-bar {
  height: 100%; width: 0%; border-radius: 3px;
  background: linear-gradient(90deg, var(--primary), var(--green));
  transition: width .35s ease;
}

@media (max-width: 900px) {
  .cauri-asset-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}

/* ── Enable Tokens modal ── */
.enable-tally { display: flex; flex-wrap: wrap; gap: 6px; }
.enable-tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 5px;
  background: var(--bg-3); border: 1px solid var(--border);
  font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 11px;
  color: var(--text-2);
}
.enable-tag b { color: var(--yellow); font-weight: 600; }

