/* ============================================================
   launch-dash — UI v2
   A modern, opinionated dark UI. Linear / Mercury / Phantom / Vercel.
   Electric-violet accent. Three real surface elevations. Geist-style
   typography. No vendor noise.
   ============================================================ */

*,
*::before,
*::after { box-sizing: border-box; }

/* HTML `hidden` is the load-bearing way panels (gate, topbar, view) get
   shown/hidden by app.js. Anything else must lose. */
[hidden] { display: none !important; }

:root {
  /* ---- surfaces (cool near-black, four elevations) ---- */
  --bg:           #08090C;
  --bg-2:         #0B0D12;       /* between body and panel — subtle */
  --panel:        #0F1117;       /* base panel */
  --panel-elev:   #14171F;       /* hover, raised */
  --panel-pop:    #1B1F2A;       /* popovers, tags, code, inputs in focus */

  /* hairlines */
  --line:         rgba(255, 255, 255, 0.06);
  --line-2:       rgba(255, 255, 255, 0.10);
  --line-strong:  rgba(255, 255, 255, 0.16);
  --line-soft:    rgba(255, 255, 255, 0.04);

  /* ---- text ---- */
  --fg:           #E4E6EC;
  --fg-strong:    #FAFAFC;
  --fg-dim:       #8E94A3;
  --fg-faint:     #5A6072;

  /* ---- accent: electric violet ---- */
  --accent:       #8B5CF6;
  --accent-2:     #A78BFA;
  --accent-3:     #6D28D9;
  --accent-ink:   #FAFAFC;                          /* foreground on a filled accent button */
  --accent-soft:  rgba(139, 92, 246, 0.12);
  --accent-tint:  rgba(139, 92, 246, 0.18);
  --accent-line:  rgba(139, 92, 246, 0.45);
  --accent-glow:  rgba(139, 92, 246, 0.35);

  /* ---- semantic palette: info / success / warn / danger ---- */
  --info:         #60A5FA;
  --info-soft:    rgba(96, 165, 250, 0.10);
  --info-line:    rgba(96, 165, 250, 0.40);

  --success:      #34D399;
  --success-soft: rgba(52, 211, 153, 0.10);
  --success-line: rgba(52, 211, 153, 0.40);

  --warn:         #FBBF24;
  --warn-soft:    rgba(251, 191, 36, 0.10);
  --warn-line:    rgba(251, 191, 36, 0.40);

  --danger:       #F87171;
  --danger-soft:  rgba(248, 113, 113, 0.10);
  --danger-line:  rgba(248, 113, 113, 0.42);

  /* ---- spacing scale ---- */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
  --s7: 48px;

  /* ---- radii ---- */
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;
  --r-pill: 999px;

  /* ---- typography ---- */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-display: "Space Grotesk", "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Geist Mono", "SF Mono", Menlo, Consolas, monospace;

  /* ---- shadows ---- */
  --shadow-sm:  0 1px 2px rgba(0,0,0,0.45);
  --shadow-md:  0 6px 18px -6px rgba(0,0,0,0.55),
                0 1px 0 rgba(255,255,255,0.025) inset;
  --shadow-lg:  0 24px 60px -24px rgba(0,0,0,0.7),
                0 2px 12px -4px rgba(0,0,0,0.4),
                0 1px 0 rgba(255,255,255,0.04) inset;
  --shadow-accent: 0 8px 28px -8px var(--accent-glow);
  --shadow-focus:  0 0 0 3px var(--accent-soft);

  /* ---- motion ---- */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --d1: 120ms;
  --d2: 180ms;
  --d3: 240ms;

  color-scheme: dark;
}

/* ===== global ===== */

html, body { height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(900px 600px at 88% -10%, rgba(139, 92, 246, 0.10), transparent 60%),
    radial-gradient(700px 500px at 10% 110%, rgba(96, 165, 250, 0.06), transparent 60%),
    var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  letter-spacing: -0.005em;
  min-height: 100vh;
  position: relative;
}

/* Subtle grain — keeps the dark surface from looking dead-flat */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.4;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .025 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

#topbar, main, #toast, #gate { position: relative; z-index: 1; }

h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  color: var(--fg-strong);
  letter-spacing: -0.02em;
  margin: 0;
  font-weight: 600;
}
h1 { font-size: 28px; line-height: 1.2; }
h2 {
  font-size: 16px; line-height: 1.3; margin: 0 0 var(--s4);
  font-weight: 600; letter-spacing: -0.015em;
  display: flex; align-items: center; gap: var(--s2);
  font-family: var(--font-display);
  color: var(--fg-strong);
}
h3 {
  font-size: 11px; margin: var(--s5) 0 var(--s3);
  color: var(--fg-dim); text-transform: uppercase;
  letter-spacing: 0.14em; font-weight: 600;
  display: flex; align-items: center; gap: var(--s2);
  font-family: var(--font-sans);
}
h3::before {
  content: "";
  width: 4px; height: 4px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-glow);
}
h3.ok::before, h3.warn::before { background: currentColor; box-shadow: 0 0 8px currentColor; }
h3.ok { color: var(--success); }
h3.warn { color: var(--warn); }
h4 {
  font-size: 12px; color: var(--fg-faint); font-family: var(--font-sans);
  text-transform: uppercase; letter-spacing: 0.12em; font-weight: 600;
}
.panel > h3:first-child, .panel > h2:first-child { margin-top: 0; }

p { margin: 0 0 var(--s3); color: var(--fg); }

a {
  color: var(--accent-2);
  text-decoration: none;
  border-bottom: 1px dotted rgba(167, 139, 250, 0.4);
  transition: color var(--d1) var(--ease), border-color var(--d1) var(--ease);
}
a:hover { color: var(--fg-strong); border-bottom-color: var(--accent); }

code {
  background: var(--panel-pop);
  border: 1px solid var(--line);
  padding: 1px 6px;
  border-radius: var(--r-sm);
  font-size: 12.5px;
  color: var(--fg-strong);
  font-family: var(--font-mono);
}

::selection { background: var(--accent-tint); color: var(--fg-strong); }

/* scrollbars */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--line-2);
  border: 2px solid transparent;
  background-clip: padding-box;
  border-radius: 999px;
}
*::-webkit-scrollbar-thumb:hover { background-color: var(--line-strong); background-clip: padding-box; }

/* ===== brand wordmark ===== */

.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  color: var(--fg-strong);
  letter-spacing: -0.02em;
}
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  line-height: 0;
  filter: drop-shadow(0 4px 14px var(--accent-glow));
}
.brand-word { font-feature-settings: "ss01"; }
.brand-dash {
  display: inline-block;
  color: var(--accent-2);
  margin: 0 2px;
  transform: translateY(-1px);
  font-weight: 700;
  text-shadow: 0 0 12px var(--accent-glow);
}
.brand.brand-lg { font-size: 22px; gap: 12px; }

/* ===== gate / login ===== */

.gate {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  z-index: 50;
  background:
    radial-gradient(800px 500px at 50% 28%, rgba(139, 92, 246, 0.16), transparent 60%),
    radial-gradient(600px 400px at 50% 110%, rgba(96, 165, 250, 0.10), transparent 60%),
    var(--bg);
  padding: var(--s5);
  animation: fadeIn 320ms var(--ease);
}
.gate-aura {
  position: absolute; inset: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .035 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  opacity: 0.6;
  mix-blend-mode: overlay;
}
.gatebox {
  position: relative;
  width: 100%;
  max-width: 420px;
  padding: var(--s6) var(--s6) var(--s5);
  background: linear-gradient(180deg, var(--panel-elev), var(--panel));
  border: 1px solid var(--line-2);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  animation: liftIn 420ms var(--ease-out);
}
/* Gradient hairline border using mask */
.gatebox::before {
  content: "";
  position: absolute; inset: 0;
  border-radius: var(--r-xl);
  padding: 1px;
  background: linear-gradient(180deg, rgba(167, 139, 250, 0.55), rgba(139, 92, 246, 0.0) 55%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
}
.gatebox .brand { margin-bottom: var(--s5); }
.gatebox p {
  color: var(--fg-dim);
  margin: 0 0 var(--s4);
  font-size: 13px;
  line-height: 1.6;
}
.gatebox p code { font-size: 12px; }
.gatebox input { margin-bottom: var(--s3); }
.gatebox button { width: 100%; padding: 11px 14px; font-size: 13.5px; justify-content: center; }
.gate-foot {
  margin-top: var(--s5);
  padding-top: var(--s4);
  border-top: 1px solid var(--line);
  color: var(--fg-faint);
  font-size: 11.5px;
  text-align: center;
  letter-spacing: 0.02em;
}
.gate details { background: transparent; border: 0; }
.gate details summary { padding: 8px 0; }

/* ===== topbar ===== */

#topbar {
  display: flex;
  align-items: center;
  gap: var(--s4);
  padding: 0 var(--s6);
  height: 64px;
  background: rgba(8, 9, 12, 0.78);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: saturate(160%) blur(16px);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
}
#topbar::after {
  /* whisper-thin highlight under the topbar so it floats off the canvas */
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(139, 92, 246, 0.18), transparent);
  pointer-events: none;
}
#topbar .brand {
  padding-right: var(--s5);
  margin-right: var(--s3);
  border-right: 1px solid var(--line);
  height: 64px;
  display: inline-flex;
  align-items: center;
}
#topbar nav {
  display: flex;
  gap: 0;
  flex: 1;
  align-items: center;
  height: 100%;
}
.tab {
  position: relative;
  background: transparent;
  border: none;
  color: var(--fg-dim);
  padding: 0 16px;
  height: 64px;
  cursor: pointer;
  font: 500 13px var(--font-sans);
  letter-spacing: -0.005em;
  transition: color var(--d2) var(--ease);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 0;
  box-shadow: none;
}
.tab:hover { color: var(--fg-strong); background: transparent; box-shadow: none; transform: none; }
.tab:hover::after {
  transform: scaleX(0.5);
  background: var(--line-strong);
  box-shadow: none;
  opacity: 0.7;
}
.tab.active { color: var(--fg-strong); background: transparent; box-shadow: none; }
.tab.active:hover::after {
  transform: scaleX(1);
  background: var(--accent);
  box-shadow: 0 0 16px var(--accent-glow), 0 0 4px var(--accent);
  opacity: 1;
}
.tab::after {
  content: "";
  position: absolute;
  left: 14px; right: 14px;
  bottom: -1px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
  box-shadow: 0 0 16px var(--accent-glow), 0 0 4px var(--accent);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform var(--d2) var(--ease), background var(--d1) var(--ease), box-shadow var(--d1) var(--ease), opacity var(--d1) var(--ease);
  opacity: 0;
}
.tab.active::after { transform: scaleX(1); opacity: 1; }
#lockBtn { margin-left: auto; }

/* ===== main view ===== */

main {
  padding: var(--s6) var(--s5) var(--s7);
  max-width: 1240px;
  margin: 0 auto;
  animation: viewIn 320ms var(--ease-out);
}

@keyframes viewIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn  { from { opacity: 0 } to { opacity: 1 } }
@keyframes liftIn  {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastUp {
  from { opacity: 0; transform: translate(-50%, 18px) scale(0.98); }
  60%  { opacity: 1; transform: translate(-50%, -6px) scale(1.01); }
  to   { opacity: 1; transform: translate(-50%, 0) scale(1); }
}
/* Spinner used by the in-flight bundle-action banner. */
@keyframes spin { to { transform: rotate(360deg) } }
/* When a bundle action is running, disable every button + select under the
   view so the operator can't fire a second action concurrently. The lock
   in bundleAct() is the real guard; this is purely visual feedback so the
   user sees the buttons are dead, not just that nothing happens on click. */
.bundle-busy button:not(.spinner-bypass),
.bundle-busy input,
.bundle-busy select {
  opacity: 0.45;
  pointer-events: none;
  cursor: not-allowed;
}
.bundle-busy .bundle-detail-banner { opacity: 1 !important; pointer-events: auto; }

/* ===== panels ===== */

.panel {
  background: linear-gradient(180deg, var(--panel-elev), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--s5);
  margin-bottom: var(--s4);
  box-shadow: var(--shadow-md);
  position: relative;
  animation: liftIn 280ms var(--ease-out);
}
.panel::before {
  /* top hairline highlight */
  content: "";
  position: absolute; left: 12px; right: 12px; top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.06), transparent);
  pointer-events: none;
}
.panel.dim {
  color: var(--fg-dim);
  background: transparent;
  border-style: dashed;
  border-color: var(--line);
  text-align: center;
  padding: var(--s6) var(--s5);
  box-shadow: none;
}
.panel.warn {
  border-color: var(--danger-line);
  background:
    linear-gradient(180deg, var(--danger-soft), transparent 60%),
    linear-gradient(180deg, var(--panel-elev), var(--panel));
  color: #FCA5A5;
}

/* ===== rows / fields ===== */

.row {
  display: flex;
  gap: var(--s3);
  flex-wrap: wrap;
  align-items: flex-end;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: var(--s3);
  min-width: 0;
  flex: 1 1 200px;
}
.field label {
  color: var(--fg-dim);
  font-size: 11px;
  font-family: var(--font-sans);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
}
.field .hint {
  color: var(--fg-faint);
  font-size: 11.5px;
  font-style: normal;
  margin-top: 2px;
  line-height: 1.45;
}
.row > .field { margin-bottom: 0; }
.row > button { margin-bottom: 0; }

/* ===== form controls ===== */

input, select, textarea {
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg-2);
  color: var(--fg);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  padding: 10px 12px;
  font: 400 13px var(--font-sans);
  letter-spacing: -0.003em;
  line-height: 1.4;
  width: 100%;
  min-width: 0;
  transition: border-color var(--d1) var(--ease),
              box-shadow var(--d1) var(--ease),
              background var(--d1) var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--fg-faint); }
input:hover, select:hover, textarea:hover { border-color: var(--line-strong); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent-line);
  box-shadow: var(--shadow-focus);
  /* background-color, NOT shorthand — the shorthand wipes background-repeat /
     background-size and the select chevron starts tiling across the field. */
  background-color: var(--panel-pop);
}
input[type="password"] { letter-spacing: 0.2em; font-family: var(--font-mono); }
textarea {
  resize: vertical;
  min-height: 90px;
  line-height: 1.55;
  font-family: var(--font-mono);
  font-size: 12.5px;
}
select {
  cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M3 5 L6 8 L9 5' stroke='%238E94A3' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px 12px;
  padding-right: 34px;
}
select:focus {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M3 5 L6 8 L9 5' stroke='%23A78BFA' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
}
select option { background: var(--panel-pop); color: var(--fg); }

input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
  flex: 0 0 16px;
}

/* monospace cells inside inputs (addresses) */
.field input[placeholder*="0x"], .field input[placeholder*="address"], .field input[placeholder*="hash"],
input[id="mAddr"] { font-family: var(--font-mono); font-size: 12.5px; }

/* ===== buttons ===== */

button {
  background: var(--accent);
  color: var(--accent-ink);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  padding: 9px 16px;
  font: 600 13px var(--font-sans);
  letter-spacing: -0.005em;
  cursor: pointer;
  transition: background var(--d1) var(--ease),
              color var(--d1) var(--ease),
              border-color var(--d1) var(--ease),
              transform 80ms var(--ease),
              box-shadow var(--d1) var(--ease);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: var(--shadow-accent), inset 0 1px 0 rgba(255,255,255,0.10);
}
button:hover {
  background: var(--accent-2);
  box-shadow: 0 10px 30px -8px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.15);
  transform: translateY(-1px);
}
button:active { transform: translateY(0) scale(0.985); }
button:focus-visible { outline: none; box-shadow: var(--shadow-focus), inset 0 1px 0 rgba(255,255,255,0.10); }
button:disabled, button[disabled] {
  opacity: 0.45 !important;
  cursor: not-allowed !important;
  background: var(--panel-pop) !important;
  color: var(--fg-dim) !important;
  box-shadow: none !important;
  transform: none !important;
  border-color: var(--line) !important;
}

button.ghost {
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--line-2);
  box-shadow: none;
}
button.ghost:hover {
  color: var(--fg-strong);
  border-color: var(--line-strong);
  background: var(--panel-elev);
  box-shadow: none;
  transform: translateY(-1px);
}

button.small {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: var(--r-sm);
}

button.danger {
  background: var(--danger);
  color: #2A0810;
  box-shadow: 0 8px 24px -8px rgba(248, 113, 113, 0.45),
              inset 0 1px 0 rgba(255,255,255,0.12);
}
button.danger:hover { background: #FB8B8B; }

button.err-btn {
  background: transparent;
  border: 1px solid var(--danger-line);
  color: var(--danger);
  box-shadow: none;
}
button.err-btn:hover {
  background: var(--danger-soft);
  border-color: var(--danger);
  box-shadow: none;
}

/* "required for bundle funding plan" — red border + soft red bg on the
   specific ctor inputs blocking /api/plan-preview. paintPreflight toggles
   this class on Total Supply / Max Tx % when bundle is on but their values
   are empty. Cleared the moment the value lands. */
input.required-for-bundle,
input.required-for-bundle:focus {
  border-color: var(--danger) !important;
  background: var(--danger-soft);
  box-shadow: 0 0 0 1px var(--danger-line);
}
input.required-for-bundle::placeholder { color: var(--danger); opacity: 0.7; }

/* ===== tables ===== */

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  font-family: var(--font-sans);
}
table + table { margin-top: var(--s4); }

thead th, tr:first-child th {
  position: sticky;
  top: 0;
  background: var(--panel);
  z-index: 1;
}
th, td {
  text-align: left;
  padding: 12px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
td.dim {
  font-variant-numeric: tabular-nums;
}
th {
  color: var(--fg-dim);
  font-weight: 600;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border-bottom: 1px solid var(--line-2);
}
tr:nth-child(odd):not(:first-child) td {
  background: rgba(255, 255, 255, 0.012);
}
tr:hover:not(:first-child) td { background: rgba(139, 92, 246, 0.055); }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--d1) var(--ease); }

.mono, td.mono, th.mono {
  font-family: var(--font-mono);
  font-feature-settings: "ss01", "tnum";
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  color: var(--fg-strong);
  font-size: 12.5px;
}
td.mono a { color: var(--fg-strong); border-bottom-color: var(--line-strong); }
td.mono a:hover { color: var(--accent-2); border-bottom-color: var(--accent); }

/* ===== text utilities / semantic ===== */

.dim   { color: var(--fg-dim); }
.ok    { color: var(--success); }
.warn  { color: var(--warn); }
.bad, .err { color: var(--danger); }
.err   { white-space: pre-wrap; margin-top: var(--s2); font-size: 12.5px; line-height: 1.5; }

p.warn,
p.ok,
div.err {
  padding: 10px 12px;
  border-radius: var(--r-md);
  font-size: 13px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
p.warn {
  background: var(--warn-soft);
  border: 1px solid var(--warn-line);
  color: #FCD879;
}
p.ok {
  background: var(--success-soft);
  border: 1px solid var(--success-line);
  color: #6EE7B7;
}
div.err {
  background: var(--danger-soft);
  border: 1px solid var(--danger-line);
  color: #FCA5A5;
  white-space: pre-wrap;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.55;
}

/* ===== tags / chips ===== */

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--panel-pop);
  border: 1px solid var(--line-2);
  border-radius: var(--r-pill);
  padding: 2px 10px;
  font-size: 11.5px;
  font-family: var(--font-sans);
  color: var(--fg);
  font-weight: 500;
  letter-spacing: -0.003em;
  line-height: 1.8;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.tag.warn {
  background: var(--warn-soft);
  border-color: var(--warn-line);
  color: #FCD879;
}
.tag.ok {
  background: var(--success-soft);
  border-color: var(--success-line);
  color: #6EE7B7;
}
.tag.err {
  background: var(--danger-soft);
  border-color: var(--danger-line);
  color: #FCA5A5;
}

td > .tag {
  background: var(--info-soft);
  border-color: var(--info-line);
  color: var(--info);
  font-weight: 600;
}
td.mono > .tag { background: var(--panel-pop); border-color: var(--line-2); color: var(--fg); }

p > .tag,
.row > .tag {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent-2);
}
.row > .tag { background: var(--panel-pop); border-color: var(--line-2); color: var(--fg); }

/* ===== pre / details ===== */

pre {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--s3) var(--s4);
  overflow: auto;
  max-height: 360px;
  font-size: 12px;
  line-height: 1.65;
  color: var(--fg);
  font-family: var(--font-mono);
  margin: var(--s2) 0;
}

details {
  margin: var(--s2) 0;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg-2);
  overflow: hidden;
  transition: border-color var(--d1) var(--ease);
}
details[open] { border-color: var(--line-2); }
details summary {
  cursor: pointer;
  color: var(--fg-dim);
  padding: 10px 14px;
  font-size: 12.5px;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: var(--s2);
  transition: color var(--d1) var(--ease), background var(--d1) var(--ease);
}
details summary::-webkit-details-marker { display: none; }
details summary::before {
  content: "";
  display: inline-block;
  width: 0; height: 0;
  border-style: solid;
  border-width: 4px 0 4px 6px;
  border-color: transparent transparent transparent var(--fg-faint);
  transition: transform 180ms var(--ease), border-color var(--d1) var(--ease);
}
details[open] summary::before {
  transform: rotate(90deg);
  border-left-color: var(--accent-2);
}
details summary:hover { color: var(--fg-strong); background: var(--panel-elev); }
details summary:hover::before { border-left-color: var(--fg); }
details summary.warn { color: #FCD879; }
details[open] summary { border-bottom: 1px solid var(--line); }
details[open] > pre {
  margin: 0;
  border: none;
  border-radius: 0;
  max-height: 440px;
}
details[open] > table { margin: 0; }
details[open] > table th { background: var(--panel-elev); }

/* ===== fn cards (Interact tab) ===== */

.fn {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--s4);
  margin-bottom: var(--s2);
  background: var(--bg-2);
  transition: border-color var(--d1) var(--ease), background var(--d1) var(--ease), transform 120ms var(--ease);
  position: relative;
}
.fn:hover {
  border-color: var(--line-strong);
  background: var(--panel-elev);
}
.fn:focus-within {
  border-color: var(--accent-line);
  background: var(--panel);
}
.fn .fnname {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: -0.005em;
  display: inline-flex;
  align-items: center;
}
.fn .fnname.write { color: var(--warn); }
.fn .fnname.read  { color: var(--info); }
.fn .fnname::before {
  content: "";
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  margin-right: 9px;
  background: currentColor;
  box-shadow: 0 0 10px currentColor;
}
.fn > .field { margin-top: 10px; margin-bottom: 0; }
.fn > .field + .field { margin-top: 8px; }
.fn .row { margin-top: var(--s2); }
.fn button { margin-top: var(--s3); }

.result {
  margin-top: var(--s3);
  font-size: 12px;
  word-break: break-all;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  min-height: 18px;
  font-family: var(--font-mono);
}
.result:empty { display: none; }
.result .ok { color: var(--success); }
.result .err { color: var(--danger); margin-top: 0; }

/* ===== toast ===== */

#toast {
  position: fixed;
  top: 78px;  /* clear the 64px topbar with breathing room */
  left: 50%;
  transform: translate(-50%, 18px);
  background: rgba(20, 23, 31, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line-2);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-md);
  padding: 12px 20px 12px 16px;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-sans);
  color: var(--fg-strong);
  opacity: 0;
  pointer-events: none;
  max-width: 80vw;
  box-shadow: var(--shadow-lg);
  z-index: 100;
  letter-spacing: -0.003em;
  transition: opacity 200ms var(--ease), transform 220ms var(--ease);
}
#toast.show { opacity: 1; animation: toastUp 320ms var(--ease-out); transform: translate(-50%, 0); }
#toast.bad  { border-left-color: var(--danger); color: #FCA5A5; }
#toast.good { border-left-color: var(--success); color: #6EE7B7; }

/* ===== misc ===== */

.help, .hint {
  color: var(--fg-faint);
  font-size: 11.5px;
}

/* dynamic fatal-error box uses inline styles — match font */
#fatal { font-family: var(--font-mono) !important; }

/* ===== progress strip ===== */

.progress {
  display: flex;
  align-items: center;
  gap: 0;
  padding: var(--s4) var(--s5);
  background: linear-gradient(180deg, var(--panel-elev), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  margin-bottom: var(--s4);
  overflow-x: auto;
  position: relative;
  box-shadow: var(--shadow-md);
  justify-content: center;
}
.progress .step {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px 6px 6px;
  border-radius: var(--r-pill);
  background: transparent;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--fg-faint);
  font-family: var(--font-sans);
  position: relative;
  white-space: nowrap;
  transition: color var(--d2) var(--ease);
}
.progress .step + .step::before {
  content: "";
  width: 28px;
  height: 1px;
  background: linear-gradient(90deg, var(--line), var(--line-2));
  margin: 0 6px;
  align-self: center;
}
.progress .step.active { color: var(--fg-strong); }
.progress .step.done   { color: var(--success); }
.progress .step-n {
  display: inline-grid; place-items: center;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--panel-pop);
  border: 1px solid var(--line-2);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--fg-faint);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  transition: all var(--d2) var(--ease);
}
.progress .step.active .step-n {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 0 0 4px var(--accent-soft), 0 6px 16px -6px var(--accent-glow);
  transform: scale(1.06);
}
.progress .step.done .step-n {
  background: var(--success);
  border-color: var(--success);
  color: #062716;
  box-shadow: 0 0 0 4px var(--success-soft);
  font-size: 0;
}
.progress .step.done .step-n::after {
  content: "";
  display: block;
  width: 10px; height: 6px;
  border-left: 2px solid #062716;
  border-bottom: 2px solid #062716;
  transform: rotate(-45deg) translate(1px, -1px);
  font-size: 0;
}
.progress .step + .step.done::before,
.progress .step + .step.active::before { background: linear-gradient(90deg, var(--success-line), var(--line-2)); }

/* ===== address pill ===== */

.addr-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px 3px 10px;
  background: var(--panel-pop);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  font-size: 12px;
  position: relative;
  transition: border-color var(--d1) var(--ease), background var(--d1) var(--ease);
}
.addr-pill:hover { border-color: var(--accent-line); background: var(--panel-elev); }
.addr-pill .mono { color: var(--fg); font-size: 12px; font-variant-numeric: tabular-nums; letter-spacing: 0; }

button.copy {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 2px;
  color: var(--fg-faint);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  box-shadow: none;
  transition: color var(--d1) var(--ease), transform 100ms var(--ease);
}
button.copy:hover { color: var(--accent-2); background: transparent; box-shadow: none; transform: none; }
button.copy:active { transform: scale(0.9); }

/* ===== pre-flight ===== */

.preflight {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: var(--s3) var(--s4);
  margin-top: var(--s3);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  font-size: 12.5px;
}
.preflight.ok  { border-color: var(--success-line); background: linear-gradient(180deg, var(--success-soft), var(--bg-2)); }
.preflight.err { border-color: var(--danger-line);  background: linear-gradient(180deg, var(--danger-soft), var(--bg-2)); }

/* ===== next-steps (post-deploy) ===== */

.next-steps {
  padding: var(--s5);
  background:
    radial-gradient(400px 200px at 80% 0%, var(--accent-soft), transparent 70%),
    linear-gradient(180deg, var(--panel-elev), var(--panel));
  border: 1px solid var(--accent-line);
  border-radius: var(--r-lg);
  margin-top: var(--s3);
  position: relative;
  box-shadow: 0 16px 40px -16px var(--accent-glow);
}
.next-steps::before {
  content: "";
  position: absolute; inset: 0;
  border-radius: var(--r-lg);
  padding: 1px;
  background: linear-gradient(180deg, var(--accent-line), transparent 55%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  pointer-events: none;
}
.next-steps h3 { margin: 0 0 var(--s3) 0; font-size: 13px; color: var(--success); letter-spacing: 0.08em; }
.next-steps h4 { margin: var(--s4) 0 var(--s2) 0; }
.next-steps .row { gap: var(--s2); }

/* ===== source-edit textarea ===== */

textarea.src-edit {
  width: 100%; min-height: 380px;
  font: 12px var(--font-mono);
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--s3);
  resize: vertical;
  white-space: pre;
  tab-size: 2;
  line-height: 1.65;
}
textarea.src-edit:focus {
  outline: none;
  border-color: var(--accent-line);
  box-shadow: var(--shadow-focus);
  background: var(--bg);
}

/* ===== launch-set cards ===== */

.set-card {
  padding: var(--s4) var(--s5);
  margin-top: var(--s3);
  background: linear-gradient(180deg, var(--panel-elev), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  transition: border-color var(--d1) var(--ease);
}
.set-card:hover { border-color: var(--line-2); }
/* Summary line for the collapsible set card. Keep the disclosure arrow
   on the left, but make the whole row layout cleanly so the slug, status,
   total, and archive button align. */
.set-card > summary.set-summary {
  cursor: pointer;
  list-style: revert;
  padding: 4px 0;
  user-select: none;
}
.set-card > summary.set-summary > .row { display: inline-flex; vertical-align: middle; }
.set-card > summary.set-summary .set-title {
  font-size: 11px; font-weight: 600; color: var(--fg-dim);
  text-transform: uppercase; letter-spacing: 0.12em;
}
.set-card > summary.set-summary .set-title .mono {
  color: var(--fg-strong); text-transform: none; letter-spacing: 0; font-size: 13px;
}
/* When collapsed, hide the inline-banner margin so the summary stays compact. */
.set-card:not([open]) .fund-banner { margin: 4px 0 0 0; }
.set-card h3 {
  margin: 0 0 var(--s2) 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-dim);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.set-card h3::before { display: none; }
.set-card h3 .mono { color: var(--fg-strong); text-transform: none; letter-spacing: 0; font-size: 13px; }
.set-card .row { margin-top: var(--s2); }
.set-card.set-unfunded {
  border-color: var(--danger-line);
  background:
    linear-gradient(180deg, var(--danger-soft), transparent 80%),
    linear-gradient(180deg, var(--panel-elev), var(--panel));
}

/* ===== monitor grid ===== */

.monitor-grid {
  display: grid;
  gap: var(--s4);
  grid-template-columns: repeat(auto-fit, minmax(440px, 1fr));
}
.mon-card {
  padding: var(--s5);
  background: linear-gradient(180deg, var(--panel-elev), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  transition: border-color var(--d1) var(--ease), transform var(--d1) var(--ease);
}
.mon-card:hover { border-color: var(--line-2); transform: translateY(-1px); }
.mon-card h3 {
  margin: 0 0 var(--s3) 0;
  font-size: 15px;
  font-family: var(--font-display);
  text-transform: none;
  letter-spacing: -0.015em;
  color: var(--fg-strong);
  font-weight: 600;
}
.mon-card h3::before { display: none; }

/* ===== funding panel ===== */

.panel.funding {
  border-color: var(--warn-line);
  background:
    radial-gradient(500px 200px at 0% 0%, var(--warn-soft), transparent 60%),
    linear-gradient(180deg, var(--panel-elev), var(--panel));
}
.fund-row {
  padding: var(--s4);
  margin-top: var(--s3);
  border-radius: var(--r-md);
  background: var(--bg-2);
  border: 1px solid var(--line);
  transition: border-color var(--d1) var(--ease);
}
.fund-row.ok  {
  border-color: var(--success-line);
  background: linear-gradient(180deg, var(--success-soft), var(--bg-2));
}
.fund-row.err {
  border-color: var(--danger-line);
  background: linear-gradient(180deg, var(--danger-soft), var(--bg-2));
}
.fund-glyph {
  display: inline-grid; place-items: center;
  width: 26px; height: 26px;
  border-radius: 50%;
  font-size: 0;
  line-height: 1;
  position: relative;
  flex: 0 0 26px;
}
.fund-row.ok .fund-glyph {
  background: var(--success);
  color: #062716;
  box-shadow: 0 0 0 4px var(--success-soft);
}
.fund-row.ok .fund-glyph::after {
  content: "";
  width: 10px; height: 6px;
  border-left: 2px solid #062716;
  border-bottom: 2px solid #062716;
  transform: rotate(-45deg) translate(1px, -1px);
}
.fund-row.err .fund-glyph {
  background: var(--danger);
  color: #2A0810;
  box-shadow: 0 0 0 4px var(--danger-soft);
}
.fund-row.err .fund-glyph::after {
  content: "!";
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font-sans);
  color: #2A0810;
  line-height: 1;
}

/* Wallets-tab unfunded banner */
.fund-banner {
  margin: var(--s2) 0 var(--s3) 0;
  padding: 10px 12px;
  background: var(--danger-soft);
  border: 1px solid var(--danger-line);
  border-radius: var(--r-md);
  color: #FCA5A5;
  font-size: 12.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ===== empty states ===== */

.panel > p.dim:only-of-type {
  /* gentle empty-state styling for lone dim paragraphs */
  text-align: center;
  padding: var(--s5) var(--s4);
  color: var(--fg-faint);
  font-size: 13px;
}

/* ===== responsive ===== */

@media (max-width: 980px) {
  main { padding: var(--s5) var(--s4) var(--s6); }
  #topbar { padding: 0 var(--s4); gap: var(--s2); }
  #topbar .brand { padding-right: var(--s3); }
  .monitor-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  main { padding: var(--s4); }
  h1 { font-size: 22px; }
  #topbar {
    padding: 0 var(--s3);
    gap: var(--s2);
    height: auto;
    flex-wrap: wrap;
    padding-top: 10px;
    padding-bottom: 0;
  }
  #topbar .brand { height: auto; padding-right: var(--s2); margin-right: 0; border-right: none; }
  #topbar nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
    border-top: 1px solid var(--line);
    height: 44px;
    gap: 0;
  }
  .tab { height: 44px; padding: 0 10px; font-size: 12.5px; }
  .tab::after { bottom: 0; }
  #lockBtn { margin-left: auto; }
  .panel { padding: var(--s4); }
  .field { flex-basis: 100%; }
  .progress { padding: var(--s3); gap: 0; }
  .progress .step { padding: 4px 8px 4px 4px; font-size: 12px; }
  .progress .step + .step::before { width: 16px; margin: 0 4px; }
  .progress .step-n { width: 22px; height: 22px; font-size: 11px; }
  .gatebox { padding: var(--s5) var(--s5) var(--s4); }
}

/* ===== reduced motion ===== */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* mnemonic reveal + all modals — one-shot, full-screen overlay */
.mnemonic-overlay {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center;
  padding: 24px;
  background: rgba(6, 7, 10, 0.72);
  backdrop-filter: blur(10px) saturate(120%);
  -webkit-backdrop-filter: blur(10px) saturate(120%);
  animation: fadeIn 200ms var(--ease);
}
.mnemonic-card {
  width: 100%; max-width: 640px;
  padding: 26px 28px 22px;
  background: linear-gradient(180deg, var(--panel-elev), var(--panel));
  border: 1px solid var(--line-2);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  position: relative;
  animation: liftIn 280ms var(--ease-out);
}
.mnemonic-card::before {
  /* faint accent rim on the top edge */
  content: "";
  position: absolute; inset: 0;
  border-radius: var(--r-xl);
  padding: 1px;
  background: linear-gradient(180deg, rgba(167, 139, 250, 0.42), rgba(139, 92, 246, 0.0) 50%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  pointer-events: none;
}
.mnemonic-card h2 { margin: 0 0 10px 0; }

/* Close X — every modal places one absolutely top-right. Make it consistent. */
.mnemonic-card > button.ghost.small[onclick*="overlay"],
.mnemonic-card > button.ghost.small:first-of-type {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: var(--r-sm);
  font-size: 16px;
  line-height: 1;
  color: var(--fg-dim);
  background: var(--panel-pop);
  border: 1px solid var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.mnemonic-card > button.ghost.small:first-of-type:hover {
  color: var(--fg-strong);
  border-color: var(--line-strong);
  background: var(--panel-elev);
}

/* Primary action button at the bottom of a modal gets a slightly bigger feel. */
.mnemonic-card > button:not(.ghost):not(.small):not(.copy),
.mnemonic-card > .row > button:not(.ghost):not(.small):not(.copy) {
  width: 100%;
  padding: 12px 16px;
  font-size: 13.5px;
}
.mnemonic-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  margin-top: 14px;
}
.mnemonic-word {
  display: flex; gap: 10px; align-items: center;
  padding: 10px 12px;
  background: var(--panel-pop); border: 1px solid var(--line);
  border-radius: 8px;
  font: 500 14px var(--font-mono);
}
@media (max-width: 720px) { .mnemonic-grid { grid-template-columns: repeat(2, 1fr); } }

/* ============================================================
   Manage page (Tier 3) + ctor tuple block
   ============================================================ */
.ctor-tuple {
  padding: 12px;
  margin-top: 8px;
  border: 1px dashed var(--line-2);
  border-radius: 8px;
  background: var(--panel-pop);
}

.manage-header { display: flex; gap: 16px; justify-content: space-between; flex-wrap: wrap; align-items: center; }
.manage-header h2 { margin: 0; font-size: 18px; }
.manage-header .row { gap: 8px; }
.manage-header select { min-width: 220px; }
.manage-header button.ghost.small { padding: 7px 12px; }

.stat-row {
  display: grid; gap: 10px;
  grid-template-columns: repeat(6, 1fr);
  margin-bottom: 16px;
}
@media (max-width: 1100px) { .stat-row { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 700px)  { .stat-row { grid-template-columns: repeat(2, 1fr); } }
.stat-card {
  padding: 14px 16px 16px;
  background: linear-gradient(180deg, var(--panel-elev), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: border-color var(--d1) var(--ease), transform var(--d1) var(--ease);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 92px;
}
.stat-card::before {
  /* top hairline highlight */
  content: "";
  position: absolute; left: 10px; right: 10px; top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
  pointer-events: none;
}
.stat-card:hover { border-color: var(--line-2); }
.stat-label {
  font-size: 10.5px;
  color: var(--fg-faint);
  text-transform: uppercase;
  letter-spacing: 0.13em;
  font-weight: 600;
}
.stat-value {
  font: 600 20px var(--font-display);
  margin-top: 6px;
  color: var(--fg-strong);
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  word-break: break-word;
}
.stat-sub {
  font-size: 11px;
  color: var(--fg-faint);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
}

.manage-meta { display: block; }

.manage-split {
  display: grid; gap: 16px;
  grid-template-columns: 2.4fr 1fr;
  margin-top: 16px;
}
@media (max-width: 980px) { .manage-split { grid-template-columns: 1fr; } }

.manage-table table { width: 100%; }
.manage-wallet-table th {
  font-size: 10.5px;
  color: var(--fg-faint);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  padding: 10px 10px;
  border-bottom: 1px solid var(--line-2);
}
.manage-wallet-table td {
  padding: 11px 10px;
  vertical-align: middle;
  border-bottom: 1px solid var(--line);
}
.manage-wallet-table tr:last-child td { border-bottom: none; }
.manage-wallet-table tr:hover:not(:first-child) td { background: rgba(139, 92, 246, 0.045); }
/* tabular numerals throughout the wallet table */
.manage-wallet-table td,
.manage-wallet-table td .mono,
.manage-wallet-table td .dim {
  font-variant-numeric: tabular-nums;
}
/* Action button group keeps consistent gap; min-width keeps Buy/Transfer/Sell columns level */
.manage-wallet-table td.row {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: nowrap;
  justify-content: flex-end;
}
.manage-wallet-table td.row button.small {
  min-width: 62px;
  padding: 5px 10px;
  justify-content: center;
}

.manage-right .manage-tabs {
  display: flex; gap: 2px; margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
  position: relative;
}
.manage-tab {
  position: relative;
  background: transparent; border: none;
  padding: 9px 14px; font-size: 12px;
  font-weight: 500;
  color: var(--fg-dim);
  border-bottom: none;
  margin-bottom: -1px;
  cursor: pointer;
  letter-spacing: -0.003em;
  box-shadow: none;
  transition: color var(--d1) var(--ease);
}
.manage-tab::after {
  content: "";
  position: absolute;
  left: 10px; right: 10px;
  bottom: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
  box-shadow: 0 0 12px var(--accent-glow);
  transform: scaleX(0);
  transition: transform var(--d2) var(--ease);
}
.manage-tab:hover { color: var(--fg-strong); background: transparent; transform: none; box-shadow: none; }
.manage-tab.active { color: var(--fg-strong); background: transparent; box-shadow: none; transform: none; }
.manage-tab.active::after { transform: scaleX(1); }

.manage-terminal {
  margin-top: 16px;
  padding: 16px;
  background:
    radial-gradient(280px 120px at 0% 0%, rgba(52, 211, 153, 0.05), transparent 70%),
    linear-gradient(180deg, var(--panel-elev), var(--panel));
}
.manage-terminal-head {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.manage-terminal-head .tag {
  /* the "Transactions" pill in the head — make it feel like a live indicator */
  background: var(--success-soft);
  border-color: var(--success-line);
  color: #6EE7B7;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding-left: 8px;
}
.manage-terminal-head .tag::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success), 0 0 0 0 rgba(52, 211, 153, 0.6);
  animation: termPulse 1.6s ease-in-out infinite;
  flex: 0 0 7px;
}
@keyframes termPulse {
  0%, 100% { box-shadow: 0 0 8px var(--success), 0 0 0 0 rgba(52, 211, 153, 0.6); opacity: 1; }
  50%      { box-shadow: 0 0 12px var(--success), 0 0 0 5px rgba(52, 211, 153, 0); opacity: 0.78; }
}
.manage-terminal-body {
  background: #04050A;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 12px 14px;
  font: 12px var(--font-mono);
  color: var(--fg-dim);
  max-height: 260px;
  overflow-y: auto;
  margin: 0;
  box-shadow: inset 0 1px 0 rgba(0,0,0,0.4);
  font-feature-settings: "ss01";
  scroll-behavior: smooth;
}
/* terminal scrollbar — thinner, dimmer than global */
.manage-terminal-body::-webkit-scrollbar { width: 8px; }
.manage-terminal-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); }
.manage-terminal-body::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.16); }
.term-empty {
  padding: 6px 0;
  font-style: italic;
  font-family: var(--font-mono);
  opacity: 0.7;
}

.empty-state {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
  text-align: center;
  padding: var(--s6) var(--s5);
  color: var(--fg-dim);
}
.empty-state::before {
  /* tiny ghost contract / list illustration drawn in pure CSS — three stacked rules + box */
  content: "";
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background:
    /* three horizontal lines */
    linear-gradient(var(--line-strong), var(--line-strong)) 14px 18px / 28px 2px no-repeat,
    linear-gradient(var(--line-strong), var(--line-strong)) 14px 27px / 20px 2px no-repeat,
    linear-gradient(var(--line-strong), var(--line-strong)) 14px 36px / 24px 2px no-repeat,
    linear-gradient(180deg, var(--panel-elev), var(--panel-pop));
  border: 1px solid var(--line-2);
  box-shadow: var(--shadow-md), 0 0 28px -10px var(--accent-glow);
  opacity: 0.92;
}
.empty-state p.dim {
  margin: 0;
  font-size: 13.5px;
  color: var(--fg-dim);
  max-width: 360px;
  line-height: 1.55;
}
.empty-state button { margin-top: 4px; }

/* Used by the Manage view to toggle right-side sub-tab panels without
 * tearing the DOM down. Applied to whichever sub-panel is inactive so
 * the 10s data poll never has to re-mount. */
.is-hidden { display: none !important; }

/* Terminal lines (Tier 3.4) */
.manage-terminal-body { display: flex; flex-direction: column; gap: 3px; }
.term-line {
  font: 12px var(--font-mono);
  padding: 2px 4px;
  margin: 0 -4px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: baseline;
  border-radius: 4px;
  border-left: 2px solid transparent;
  padding-left: 8px;
  margin-left: -2px;
  transition: background var(--d1) var(--ease);
}
.term-line:hover { background: rgba(255, 255, 255, 0.02); }
.term-line.dim   { color: var(--fg-dim); border-left-color: transparent; }
.term-line.ok    { color: #6EE7B7; border-left-color: var(--success); background: rgba(52, 211, 153, 0.04); }
.term-line.warn  { color: #FCD879; border-left-color: var(--warn); background: rgba(251, 191, 36, 0.04); }
.term-line.err   { color: #FCA5A5; border-left-color: var(--danger); background: rgba(248, 113, 113, 0.05); }
.term-line a { color: inherit; border-bottom-color: currentColor; opacity: 0.85; }
.term-line .dim.mono { opacity: 0.65; }

/* Tier 4 — Sell / Buy / Transfer modal bits */
.preset-btn {
  min-width: 56px;
  font-variant-numeric: tabular-nums;
}
.preset-btn.active {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent-2);
  box-shadow: 0 0 0 1px var(--accent-line) inset, 0 4px 14px -8px var(--accent-glow);
}
.sell-quote {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg-2);
  font-size: 13px;
  line-height: 1.65;
}
.sell-quote > div {
  margin: 0;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-variant-numeric: tabular-nums;
}
.sell-quote > div + div { margin-top: 4px; }
.sell-quote strong { font-family: var(--font-mono); font-weight: 600; }
.sell-advanced {
  margin-top: 10px;
  padding: 12px 14px;
  border: 1px dashed var(--line-2);
  border-radius: var(--r-md);
  background: var(--panel-pop);
}
.sell-advanced .row { margin: 0; gap: var(--s3); }
.sell-advanced .field { margin-bottom: 0; }

/* Empty .err boxes collapse so we don't get the red ribbon under modal forms. */
.err:empty { display: none !important; padding: 0 !important; margin: 0 !important; border: 0 !important; }

/* ============================================================
   Misc small refinements
   ============================================================ */

/* Bundle config host (revealed by the "Bundle this launch" checkbox)
   gets a subtle inset look so it reads as a sub-panel of the Deploy step. */
.bundle-config-host {
  margin-top: var(--s3);
  padding: var(--s4);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg-2);
  position: relative;
}
.bundle-config-host::before {
  content: "";
  position: absolute;
  left: -1px; top: -1px;
  width: 3px; height: 28px;
  background: var(--accent);
  border-radius: var(--r-md) 0 0 0;
  box-shadow: 0 0 12px var(--accent-glow);
}

/* Preflight slot lives just under the bundle config. */
.preflight-slot { margin-top: var(--s3); }
.preflight-slot:empty { display: none; }

/* Pill slot is the deployer wallet balance line. */
.pill-slot { margin-top: var(--s2); }
.pill-slot:empty { display: none; }

/* Contract / liquidity / etherscan hosts on the Manage > Contract sub-panel
   need breathing room between blocks. */
.contract-actions-host:empty,
.liquidity-host:empty,
.etherscan-host:empty,
.wallet-ops-host:empty { display: none; }

/* Source-edit textarea polish — line numbers gutter look. */
textarea.src-edit {
  background:
    linear-gradient(90deg, rgba(255,255,255,0.018) 0 36px, transparent 36px),
    var(--bg);
  padding-left: 44px;
}

/* Tag color refinement — bare tags inside .panel get a touch more contrast */
.tag { color: var(--fg); }
.tag.dim {
  background: var(--panel-pop);
  border-color: var(--line);
  color: var(--fg-faint);
  opacity: 0.85;
}

/* Manage meta panel: token symbol pill + deployer addr line */
.manage-meta {
  padding: var(--s4) var(--s5);
}
.manage-meta .tag {
  font-size: 12px;
  padding: 3px 10px;
  font-weight: 600;
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent-2);
}

/* Set card spacing inside the Wallets > Launch Sets list */
.set-card + .set-card { margin-top: var(--s2); }
.set-card .row { gap: var(--s2); }
.set-card .tag { font-size: 11.5px; }

/* Fund-row: clean horizontal flow */
.fund-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.fund-row .row { align-items: center; }

/* Funding panel "Pre-launch funding" — small wrapper polish */
.panel.funding > h3 { margin-top: 0; }

/* Make `<details><summary>` for "edit muted source" / "rename map" line up nicely */
details > summary {
  font-family: var(--font-sans);
  font-weight: 500;
}

/* The "+ new bundle" type button in the Bundle empty list */
.panel button.ghost.small {
  padding: 6px 12px;
}

/* The .next-steps post-deploy box: tighten copy */
.next-steps h3 { font-size: 12px; }
.next-steps .row + h4 { margin-top: var(--s3); }

/* Wallet table balance column — small mono visual hint */
.manage-wallet-table td .mono { font-size: 12px; }
.manage-wallet-table td .dim { font-size: 11px; }

/* Sub-panel anchor — keep all three sub-panels at the same baseline */
.manage-sub-panel { min-height: 100px; }

/* Trim padding on smaller panels in the manage right column */
.panel.manage-right { padding: var(--s4); }
.panel.manage-meta  { padding: var(--s4) var(--s5); }
.panel.manage-table { padding: var(--s4); }

/* Action buttons inside contract sub-panel — uniform layout */
.contract-actions-host .row { gap: 8px; flex-wrap: wrap; }

/* Mainnet warning sits above the deploy button */
p.warn.is-hidden { display: none !important; }

/* Multi-select batch action bar — sits above the wallet table on Manage */
.batch-bar {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  padding: 10px 12px;
  margin: 0 0 8px 0;
  background: var(--panel-pop);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
}
.batch-bar > .ok { color: var(--accent-2); font-weight: 600; }
.batch-bar button { margin-left: auto; }
.batch-bar button + button { margin-left: 0; }
.batch-bar input[type="checkbox"] { accent-color: var(--accent); }
/* Per-row checkbox column — keep it tight */
.manage-wallet-table td:first-child,
.manage-wallet-table th:first-child {
  width: 28px; padding-right: 0; text-align: center;
}
.manage-wallet-table td:first-child input[type="checkbox"] { accent-color: var(--accent); }

/* Per-field "(?)" tooltip — small accent dot next to the label. Hover or
   keyboard-focus reveals the helper text. The browser's native `title`
   attribute provides a fallback for non-pointer devices. */
.field-tip {
  position: relative;
  display: inline-grid; place-items: center;
  width: 14px; height: 14px;
  margin-left: 6px;
  border-radius: 50%;
  background: var(--panel-pop);
  border: 1px solid var(--line);
  color: var(--fg-faint);
  font-size: 9px; font-weight: 700;
  cursor: help;
  transition: color var(--d1) var(--ease), border-color var(--d1) var(--ease);
}
.field-tip:hover, .field-tip:focus-visible {
  color: var(--accent-2);
  border-color: var(--accent-line);
  outline: none;
}
.field-tip-pop {
  position: absolute; bottom: calc(100% + 8px); left: 50%;
  transform: translateX(-50%);
  width: max-content; max-width: 320px;
  padding: 8px 10px;
  background: var(--panel-elev);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  font: 400 11.5px var(--font-sans);
  color: var(--fg);
  letter-spacing: -0.005em;
  text-transform: none;
  white-space: normal;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--d1) var(--ease);
  z-index: 50;
  box-shadow: var(--shadow-md);
}
.field-tip:hover .field-tip-pop,
.field-tip:focus-visible .field-tip-pop { opacity: 1; }

/* Eye-toggle wrapper for password inputs */
.pw-wrap {
  position: relative;
  display: flex; width: 100%;
}
.pw-wrap input { width: 100%; padding-right: 36px; }
.pw-eye {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 28px; height: 28px;
  padding: 0;
  background: transparent;
  border: 0;
  color: var(--fg-faint);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}
.pw-eye:hover { color: var(--accent-2); }
