/* MultiSig Vault — shared styles */
:root {
  --bg: #0a0b12;
  --bg-elev: #12131d;
  --bg-card: #151725;
  --bg-card-2: #1a1d2e;
  --border: #262a3d;
  --border-soft: #1f2333;
  --text: #e9ebf5;
  --text-dim: #9aa0b8;
  --text-faint: #656b85;
  --accent: #1877f2;        /* Facebook blue */
  --accent-2: #4599ff;
  --accent-grad: linear-gradient(120deg, #1877f2 0%, #4599ff 100%);
  --good: #34d399;
  --bad: #f87171;
  --warn: #fbbf24;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.7);
  --mono: "SF Mono", "JetBrains Mono", "Fira Code", ui-monospace, Menlo, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

body {
  min-height: 100vh;
  background-image:
    radial-gradient(900px 500px at 15% -10%, rgba(24, 119, 242, 0.16), transparent 60%),
    radial-gradient(800px 500px at 100% 0%, rgba(66, 153, 251, 0.10), transparent 55%);
  background-attachment: fixed;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.dim { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.good { color: var(--good); }
.bad { color: var(--bad); }

/* --- Top bar --- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(10, 11, 18, 0.72);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 1.06rem;
}
.brand .logo {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--accent-grad);
  display: grid;
  place-items: center;
  box-shadow: 0 6px 18px -6px rgba(24, 119, 242, 0.7);
}
.brand .logo svg { width: 17px; height: 17px; }
.brand small {
  font-weight: 500;
  color: var(--text-faint);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  display: block;
  margin-top: -3px;
}

.nav-actions { display: flex; align-items: center; gap: 12px; }
.nav-actions .who { color: var(--text-dim); font-size: 0.88rem; }
.nav-actions .who b { color: var(--text); font-weight: 600; }

.pill {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.pill.admin { color: #bcd8ff; border-color: rgba(24, 119, 242, 0.5); background: rgba(24, 119, 242, 0.12); }

/* --- Layout --- */
.wrap { max-width: 1080px; margin: 0 auto; padding: 34px 28px 80px; }
.wrap-narrow { max-width: 440px; }

.page-head { margin-bottom: 26px; }
.page-head h1 {
  margin: 0 0 6px;
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.page-head p { margin: 0; color: var(--text-dim); }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card-2);
  color: var(--text);
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  transition: transform 0.08s ease, border-color 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}
.btn:hover { border-color: #3a4060; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.primary {
  background: var(--accent-grad);
  border: none;
  color: #0a0b12;
  font-weight: 700;
  box-shadow: 0 10px 26px -12px rgba(24, 119, 242, 0.9);
}
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { background: transparent; }
.btn.small { padding: 7px 12px; font-size: 0.82rem; }
.btn.danger { color: var(--bad); border-color: rgba(248, 113, 113, 0.4); background: rgba(248, 113, 113, 0.08); }
.btn.block { width: 100%; }

/* --- Cards --- */
.card {
  background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-elev) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card.pad { padding: 24px; }

/* --- Forms --- */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 7px;
}
.input {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #0d0e17;
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(24, 119, 242, 0.18);
}
.input.mono { font-family: var(--mono); }

.notice {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  margin-bottom: 16px;
  display: none;
}
.notice.show { display: block; }
.notice.error { background: rgba(248, 113, 113, 0.12); border: 1px solid rgba(248, 113, 113, 0.35); color: #fecaca; }
.notice.success { background: rgba(52, 211, 153, 0.12); border: 1px solid rgba(52, 211, 153, 0.35); color: #bbf7d0; }

.auth-switch { margin-top: 20px; text-align: center; color: var(--text-dim); font-size: 0.9rem; }
.auth-switch a { color: var(--accent-2); font-weight: 600; }

/* --- Dashboard --- */
.total-card {
  padding: 28px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}
.total-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(500px 200px at 90% 0%, rgba(24, 119, 242, 0.18), transparent 60%);
  pointer-events: none;
}
.total-card .label {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 8px;
}
.total-card .value {
  font-family: var(--mono);
  font-size: 2.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.total-card .sub { color: var(--text-dim); font-size: 0.9rem; margin-top: 4px; }

.asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.asset {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.asset-top { display: flex; align-items: center; gap: 12px; }
.coin {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  overflow: hidden;
}
.coin svg { width: 100%; height: 100%; display: block; }
.coin.fallback { font-weight: 800; font-size: 0.72rem; color: #0a0b12; }
.coin.sm { width: 22px; height: 22px; }
.asset .name { font-weight: 600; }
.asset .ticker { color: var(--text-faint); font-size: 0.78rem; }
.asset .amount { font-family: var(--mono); font-size: 1.35rem; font-weight: 700; }
.asset .worth { color: var(--text-dim); font-size: 0.88rem; font-family: var(--mono); }
.asset .price { margin-left: auto; text-align: right; color: var(--text-faint); font-size: 0.76rem; font-family: var(--mono); }

/* --- Table (admin) --- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; min-width: 780px; }
thead th {
  text-align: left;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 700;
  padding: 14px 16px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td { padding: 14px 16px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(255, 255, 255, 0.015); }
.u-name { font-weight: 600; }
.u-email { color: var(--text-dim); font-size: 0.85rem; }
.bal-input {
  width: 108px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #0d0e17;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.86rem;
  outline: none;
}
.bal-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(24, 119, 242, 0.16); }
.bal-input.dirty { border-color: var(--warn); }
.row-total { font-family: var(--mono); font-weight: 700; }

.stat-row { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.stat {
  flex: 1;
  min-width: 160px;
  padding: 18px 20px;
}
.stat .label { font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-faint); }
.stat .num { font-family: var(--mono); font-size: 1.7rem; font-weight: 700; margin-top: 4px; }

/* --- Landing --- */
.hero { max-width: 720px; margin: 90px auto 0; text-align: center; padding: 0 24px; }
.hero .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-2);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 26px;
}
.hero h1 {
  font-size: clamp(2.4rem, 6vw, 3.8rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin: 0 0 20px;
  font-weight: 800;
}
.hero h1 .grad {
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero p { font-size: 1.12rem; color: var(--text-dim); margin: 0 auto 34px; max-width: 560px; }
.hero .cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.feature-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  max-width: 900px;
  margin: 70px auto 0;
  padding: 0 24px;
}
.feature { padding: 22px; }
.feature .ic {
  width: 40px; height: 40px; border-radius: 11px;
  background: var(--bg-card-2); border: 1px solid var(--border);
  display: grid; place-items: center; margin-bottom: 14px;
  color: var(--accent-2);
}
.feature h3 { margin: 0 0 6px; font-size: 1rem; }
.feature p { margin: 0; color: var(--text-dim); font-size: 0.9rem; }

.center-screen { min-height: calc(100vh - 66px); display: grid; place-items: center; padding: 40px 20px; }

.demo-hint {
  margin-top: 18px;
  font-size: 0.8rem;
  color: var(--text-faint);
  text-align: center;
  line-height: 1.6;
}
.demo-hint code { color: var(--accent-2); font-family: var(--mono); }

.empty {
  padding: 50px 20px;
  text-align: center;
  color: var(--text-dim);
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 0.9rem;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { border-color: rgba(52, 211, 153, 0.5); }
.toast.error { border-color: rgba(248, 113, 113, 0.5); }

@media (max-width: 640px) {
  .topbar { padding: 14px 18px; }
  .wrap { padding: 24px 18px 60px; }
  .total-card .value { font-size: 2rem; }
  .nav-actions .who { display: none; }
}

/* --- Animated background (Higgsfield-generated video + CSS fallback) --- */
.app-bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  background:
    radial-gradient(1100px 600px at 12% -10%, rgba(24, 119, 242, 0.22), transparent 60%),
    radial-gradient(900px 600px at 100% 0%, rgba(69, 153, 255, 0.14), transparent 55%),
    linear-gradient(180deg, #070b16 0%, #0a0b12 100%);
  background-size: 200% 200%;
  animation: bgdrift 24s ease-in-out infinite alternate;
}
@keyframes bgdrift {
  0% { background-position: 0% 0%; }
  100% { background-position: 100% 100%; }
}
.app-bg video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 1.2s ease;
}
.app-bg video.ready { opacity: 0.72; }
/* Legibility veil over the moving background */
.app-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(1200px 700px at 50% -5%, transparent 0%, rgba(7, 9, 16, 0.28) 70%),
    linear-gradient(180deg, rgba(7, 9, 16, 0.28) 0%, rgba(7, 9, 16, 0.6) 100%);
}
@media (prefers-reduced-motion: reduce) {
  .app-bg { animation: none; }
  .app-bg video { display: none; }
}

/* --- Connect wallet --- */
.wallet-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.wallet-btn .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.18);
}
.wallet-btn.connected {
  border-color: rgba(52, 211, 153, 0.4);
  background: rgba(52, 211, 153, 0.08);
}
.wallet-address { font-family: var(--mono); font-size: 0.82rem; }

/* --- Modal --- */
.modal-scrim {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(5, 7, 14, 0.62);
  backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.modal-scrim.show { opacity: 1; pointer-events: auto; }
.modal {
  width: 100%;
  max-width: 400px;
  background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-elev) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  transform: translateY(10px) scale(0.98);
  transition: transform 0.2s ease;
}
.modal-scrim.show .modal { transform: translateY(0) scale(1); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.modal-head h3 { margin: 0; font-size: 1.15rem; }
.modal-head .x {
  background: none; border: none; color: var(--text-faint);
  font-size: 1.4rem; line-height: 1; cursor: pointer; padding: 4px 8px; border-radius: 8px;
}
.modal-head .x:hover { color: var(--text); background: var(--bg-card-2); }
.modal .sub { color: var(--text-dim); font-size: 0.88rem; margin: 0 0 18px; }
.wallet-list { display: flex; flex-direction: column; gap: 10px; }
.wallet-option {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  padding: 13px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card-2);
  color: var(--text);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, transform 0.08s ease, background 0.15s ease;
}
.wallet-option:hover { border-color: var(--accent); background: rgba(24, 119, 242, 0.08); }
.wallet-option:active { transform: translateY(1px); }
.wallet-option .wicon {
  width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
  display: grid; place-items: center; overflow: hidden;
}
.wallet-option .wicon svg { width: 100%; height: 100%; }
.wallet-option .meta { display: flex; flex-direction: column; line-height: 1.2; }
.wallet-option .meta small { color: var(--text-faint); font-weight: 500; font-size: 0.76rem; }
.wallet-option .chev { margin-left: auto; color: var(--text-faint); }
.modal .fineprint { margin: 16px 0 0; font-size: 0.76rem; color: var(--text-faint); text-align: center; line-height: 1.5; }

/* --- Transactions --- */
.filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.filter-row .spacer { flex: 1; }
.chips { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card-2);
  color: var(--text-dim);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.chip:hover { color: var(--text); }
.chip.active {
  color: #fff;
  border-color: transparent;
  background: var(--accent-grad);
}
.seg {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card-2);
}
.seg button {
  border: none;
  background: none;
  color: var(--text-dim);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 13px;
  border-radius: 999px;
  cursor: pointer;
}
.seg button.active { background: rgba(24, 119, 242, 0.16); color: #cfe1ff; }

.tx-asset { display: inline-flex; align-items: center; gap: 9px; }
.tx-asset .coin { width: 26px; height: 26px; }
.tx-asset .lbl { display: flex; flex-direction: column; line-height: 1.2; font-weight: 600; }
.tx-asset .lbl small { color: var(--text-faint); font-size: 0.74rem; font-weight: 500; }

.tx-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.tx-badge::before {
  content: "";
  width: 6px; height: 6px; border-radius: 50%;
}
.tx-badge.deposit { color: #a7f3d0; background: rgba(52, 211, 153, 0.12); border: 1px solid rgba(52, 211, 153, 0.3); }
.tx-badge.deposit::before { background: var(--good); }
.tx-badge.withdrawal { color: #fecaca; background: rgba(248, 113, 113, 0.12); border: 1px solid rgba(248, 113, 113, 0.3); }
.tx-badge.withdrawal::before { background: var(--bad); }

.tx-amount { font-family: var(--mono); font-weight: 700; white-space: nowrap; }
.tx-amount.pos { color: var(--good); }
.tx-amount.neg { color: var(--bad); }
.tx-amount .usd { display: block; color: var(--text-faint); font-weight: 500; font-size: 0.76rem; }
.tx-note { color: var(--text-dim); font-size: 0.85rem; }
.tx-badge.pending { color: #fde68a; background: rgba(251, 191, 36, 0.12); border: 1px solid rgba(251, 191, 36, 0.3); }
.tx-badge.pending::before { background: var(--warn); }

/* --- Signatories --- */
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin: 34px 0 16px;
}
.section-head h2 { margin: 0; font-size: 1.25rem; letter-spacing: -0.01em; }
.section-head p { margin: 4px 0 0; font-size: 0.9rem; }

.signatory-card { padding: 6px 4px; }
.signatory {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-soft);
}
.signatory:last-child { border-bottom: none; }
.signatory .avatar {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center;
  font-size: 0.82rem; font-weight: 700; color: #fff;
  background: var(--accent-grad);
}
.req-row.flash { animation: reqflash 2s ease 1; border-radius: 10px; }
@keyframes reqflash {
  0%, 30% { background: rgba(24, 119, 242, 0.16); }
  100% { background: transparent; }
}
@media (prefers-reduced-motion: reduce) { .req-row.flash { animation: none; } }
.sig-meta { min-width: 0; }
.sig-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sig-sub { color: var(--text-faint); font-size: 0.8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.signatory .tx-badge { margin-left: auto; flex-shrink: 0; }
.sig-actions { display: flex; gap: 8px; flex-shrink: 0; }

@media (max-width: 560px) {
  .signatory { flex-wrap: wrap; }
  .signatory .tx-badge { margin-left: 52px; }
  .sig-actions { margin-left: 52px; }
}

/* --- Invite acceptance page --- */
.invite-card { max-width: 460px; margin: 0 auto; text-align: center; padding: 34px 30px; }
.invite-card .big-avatar {
  width: 66px; height: 66px; border-radius: 50%; margin: 0 auto 18px;
  display: grid; place-items: center; font-size: 1.5rem; font-weight: 700; color: #fff;
  background: var(--accent-grad); box-shadow: 0 10px 30px -10px rgba(24, 119, 242, 0.8);
}
.invite-card h1 { font-size: 1.5rem; margin: 0 0 10px; }
.invite-card p { color: var(--text-dim); margin: 0 0 22px; }
.invite-card .who-b { color: var(--text); font-weight: 700; }
