/* ═══════════════════════════════════════════
   MicroPayroll — Main Stylesheet
   ═══════════════════════════════════════════ */

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

:root {
  --bg:         #06091a;
  --bg2:        #0b1029;
  --bg3:        #0f1535;
  --sidebar-bg: #080d20;
  --card:       rgba(255, 255, 255, 0.04);
  --card-hov:   rgba(255, 255, 255, 0.07);
  --border:     rgba(255, 255, 255, 0.08);
  --border2:    rgba(255, 255, 255, 0.12);
  --accent:     #00d4ff;
  --accent2:    #7b61ff;
  --success:    #00e676;
  --error:      #ff5252;
  --warn:       #ffab40;
  --txt:        #e8eaf6;
  --txt2:       rgba(232, 234, 246, 0.55);
  --txt3:       rgba(232, 234, 246, 0.25);
  --mono:       'JetBrains Mono', monospace;
  --sans:       'Inter', sans-serif;
  --r:          12px;
  --r-sm:       8px;
  --r-lg:       20px;
  --shadow:     0 8px 40px rgba(0, 0, 0, 0.5);
  --sidebar-w:  240px;
  --topbar-h:   68px;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--txt);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Background ── */
.bg-orbs { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.orb {
  position: absolute; border-radius: 50%;
  filter: blur(80px); opacity: 0.12;
}
.orb-1 { width: 600px; height: 600px; background: var(--accent);  top: -200px; left: -150px; }
.orb-2 { width: 500px; height: 500px; background: var(--accent2); bottom: -150px; right: -100px; }
.orb-3 { width: 400px; height: 400px; background: #00e676;        top: 50%; right: 25%; transform: translateY(-50%); opacity: 0.05; }

#confetti-canvas { position: fixed; inset: 0; z-index: 999; pointer-events: none; }

/* ═══════════════════════════════════════════
   LAYOUT
   ═══════════════════════════════════════════ */
.app-shell {
  position: relative;
  display: flex; min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 50;
}

.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 24px 20px;
  border-bottom: 1px solid var(--border);
}
.logo-mark {
  width: 36px; height: 36px; border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.logo-text { font-size: 17px; font-weight: 800; letter-spacing: -0.5px; }
.logo-text span { color: var(--accent); }

.sidebar-nav {
  flex: 1; padding: 16px 12px;
  display: flex; flex-direction: column; gap: 4px;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--r-sm);
  font-size: 14px; font-weight: 500; color: var(--txt2);
  text-decoration: none; transition: all 0.15s;
  cursor: pointer;
}
.nav-item:hover { background: var(--card); color: var(--txt); text-decoration: none; }
.nav-item.active { background: rgba(0, 212, 255, 0.1); color: var(--accent); border: 1px solid rgba(0,212,255,0.15); }
.nav-icon { font-size: 16px; }

.sidebar-footer {
  padding: 20px;
  border-top: 1px solid var(--border);
}
.network-badge {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 600; color: var(--success);
  margin-bottom: 6px;
}
.dot-green {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
  animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot { 0%,100%{opacity:1} 50%{opacity:0.4} }
.sidebar-version { font-size: 11px; color: var(--txt3); }

/* ── Main Content ── */
.main-content {
  flex: 1; margin-left: var(--sidebar-w);
  display: flex; flex-direction: column;
  min-height: 100vh;
}

/* ── Topbar ── */
.topbar {
  height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 32px;
  border-bottom: 1px solid var(--border);
  background: rgba(6, 9, 26, 0.8);
  backdrop-filter: blur(20px);
  position: sticky; top: 0; z-index: 40;
}
.topbar-right { display: flex; align-items: center; gap: 12px; }
.page-title { font-size: 20px; font-weight: 700; }

/* ── Pages ── */
.page { display: none; padding: 32px; }
.page.active { display: block; }

/* ═══════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--sans); font-size: 14px; font-weight: 600;
  padding: 10px 20px; border-radius: var(--r-sm);
  border: none; cursor: pointer; transition: all 0.2s;
  outline: none; text-decoration: none; white-space: nowrap;
}
.btn:disabled { opacity: 0.35; cursor: not-allowed; transform: none !important; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  box-shadow: 0 4px 20px rgba(0, 212, 255, 0.2);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 28px rgba(0, 212, 255, 0.35);
  text-decoration: none; color: #fff;
}

.btn-ghost {
  background: var(--card); color: var(--txt);
  border: 1px solid var(--border);
}
.btn-ghost:hover:not(:disabled) { background: var(--card-hov); border-color: var(--border2); }

.btn-danger {
  background: rgba(255,82,82,0.1); color: var(--error);
  border: 1px solid rgba(255,82,82,0.2);
}
.btn-danger:hover:not(:disabled) { background: rgba(255,82,82,0.2); }

.btn-sm  { font-size: 12px; padding: 7px 14px; }
.btn-lg  { font-size: 16px; padding: 14px 32px; border-radius: var(--r); }

/* ═══════════════════════════════════════════
   PANELS / CARDS
   ═══════════════════════════════════════════ */
.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 28px;
  backdrop-filter: blur(20px);
  margin-bottom: 24px;
  transition: border-color 0.2s;
}
.panel:hover { border-color: var(--border2); }
.panel-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 24px;
}
.panel-title { font-size: 16px; font-weight: 700; }
.panel-sub { font-size: 13px; color: var(--txt2); margin-top: 3px; }

/* ═══════════════════════════════════════════
   CONNECT BANNER
   ═══════════════════════════════════════════ */
.connect-banner {
  display: flex; align-items: center; justify-content: center;
  min-height: calc(100vh - var(--topbar-h) - 64px);
}
.connect-banner-inner {
  text-align: center; max-width: 480px;
  padding: 48px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-lg); backdrop-filter: blur(20px);
}
.connect-banner-icon {
  font-size: 52px; margin-bottom: 20px;
  display: inline-flex; align-items: center; justify-content: center;
  width: 88px; height: 88px; border-radius: 22px;
  background: linear-gradient(135deg, rgba(0,212,255,0.15), rgba(123,97,255,0.15));
  border: 1px solid rgba(0,212,255,0.2);
}
.connect-banner-inner h2 { font-size: 26px; font-weight: 800; margin-bottom: 12px; }
.connect-banner-inner p { font-size: 15px; color: var(--txt2); margin-bottom: 28px; line-height: 1.6; }
.connect-hint { font-size: 13px; color: var(--txt2); margin-top: 16px; }

/* ═══════════════════════════════════════════
   STATS ROW
   ═══════════════════════════════════════════ */
.stats-row {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r); padding: 20px 24px;
  backdrop-filter: blur(12px); transition: all 0.2s;
}
.stat-card:hover { border-color: var(--border2); transform: translateY(-2px); }
.stat-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; color: var(--txt2); margin-bottom: 8px; }
.stat-value { font-size: 26px; font-weight: 800; letter-spacing: -1px; color: var(--txt); }
.stat-sub { font-size: 12px; color: var(--txt2); margin-top: 4px; }

/* ═══════════════════════════════════════════
   PAYROLL TEAM PREVIEW
   ═══════════════════════════════════════════ */
.payroll-preview-empty {
  text-align: center; padding: 24px;
  color: var(--txt2); font-size: 14px;
  border: 1px dashed var(--border);
  border-radius: var(--r-sm); margin-bottom: 20px;
}

.payroll-member-list {
  display: flex; flex-direction: column; gap: 8px;
  margin-bottom: 20px;
}
.payroll-member-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  background: rgba(0,0,0,0.2); border: 1px solid var(--border);
  border-radius: var(--r-sm); transition: border-color 0.2s;
}
.payroll-member-row.sending  { border-color: rgba(0,212,255,0.4); background: rgba(0,212,255,0.05); }
.payroll-member-row.success  { border-color: rgba(0,230,118,0.4); background: rgba(0,230,118,0.05); }
.payroll-member-row.error    { border-color: rgba(255,82,82,0.4);  background: rgba(255,82,82,0.05); }
.member-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; flex-shrink: 0;
}
.member-meta { flex: 1; min-width: 0; }
.member-name { font-size: 14px; font-weight: 600; }
.member-role { font-size: 11px; color: var(--txt2); }
.member-amount { font-size: 14px; font-weight: 700; color: var(--accent); white-space: nowrap; }
.member-status { flex-shrink: 0; }

/* Status badges */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 20px;
}
.badge-idle    { background: rgba(255,255,255,0.06); color: var(--txt2); border: 1px solid var(--border); }
.badge-sending { background: rgba(0,212,255,0.12);   color: var(--accent); border: 1px solid rgba(0,212,255,0.2); }
.badge-success { background: rgba(0,230,118,0.12);   color: var(--success); border: 1px solid rgba(0,230,118,0.2); }
.badge-error   { background: rgba(255,82,82,0.12);   color: var(--error);   border: 1px solid rgba(255,82,82,0.2); }
.badge-pulse   { animation: blink 1s ease-in-out infinite; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.3} }

/* ═══════════════════════════════════════════
   PROGRESS BAR
   ═══════════════════════════════════════════ */
.progress-header {
  display: flex; justify-content: space-between;
  font-size: 13px; color: var(--txt2); margin-bottom: 8px;
}
.progress-track {
  height: 5px; background: rgba(255,255,255,0.07);
  border-radius: 3px; overflow: hidden; margin-bottom: 20px;
}
.progress-bar {
  height: 100%; border-radius: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  transition: width 0.5s ease;
}

/* ═══════════════════════════════════════════
   RUN PAYROLL BUTTON
   ═══════════════════════════════════════════ */
.payroll-btn {
  width: 100%; padding: 18px 24px;
  font-family: var(--sans); font-size: 16px; font-weight: 700; letter-spacing: 0.3px;
  border-radius: var(--r); border: none; cursor: pointer;
  background: linear-gradient(135deg, #00d4ff 0%, #7b61ff 100%);
  color: #fff;
  position: relative; overflow: hidden;
  box-shadow: 0 4px 40px rgba(0,212,255,0.2), inset 0 1px 0 rgba(255,255,255,0.1);
  transition: all 0.25s;
}
.payroll-btn::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.08), transparent);
  opacity: 0; transition: opacity 0.25s;
}
.payroll-btn:hover:not(:disabled)::after { opacity: 1; }
.payroll-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 8px 48px rgba(0,212,255,0.35); }
.payroll-btn:active:not(:disabled) { transform: translateY(0); }
.payroll-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* ═══════════════════════════════════════════
   TRANSACTION LOG
   ═══════════════════════════════════════════ */
.tx-log {
  max-height: 280px; overflow-y: auto;
}
.tx-log::-webkit-scrollbar { width: 4px; }
.tx-log::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.tx-empty {
  text-align: center; padding: 40px 0;
  color: var(--txt3); font-size: 14px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.tx-empty-icon { font-size: 32px; opacity: 0.4; }

.tx-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,0.04);
  animation: slide-in 0.3s ease;
}
@keyframes slide-in { from{opacity:0;transform:translateY(6px)} to{opacity:1;transform:translateY(0)} }
.tx-item:last-child { border-bottom: none; }

.tx-dot {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0; margin-top: 1px;
}
.tx-dot.ok   { background: rgba(0,230,118,0.12); }
.tx-dot.err  { background: rgba(255,82,82,0.12); }
.tx-dot.spin { background: rgba(0,212,255,0.12); }

.tx-body { flex: 1; min-width: 0; }
.tx-desc { font-size: 13px; font-weight: 500; }
.tx-hash {
  font-family: var(--mono); font-size: 11px; color: var(--accent);
  margin-top: 3px; display: inline-block;
}
.tx-hash:hover { text-decoration: underline; }
.tx-time { font-size: 11px; color: var(--txt3); flex-shrink: 0; padding-top: 2px; }

/* ── Spinner ── */
.spinner {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(0,212,255,0.3);
  border-top-color: var(--accent);
  animation: spin 0.7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════
   TEAM TABLE
   ═══════════════════════════════════════════ */
.team-empty {
  text-align: center; padding: 60px 0;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  color: var(--txt2);
}
.team-empty-icon { font-size: 40px; opacity: 0.4; }
.team-empty p { font-size: 15px; }

.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  font-size: 11px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase;
  color: var(--txt2); padding: 10px 16px; text-align: left;
  border-bottom: 1px solid var(--border);
}
.data-table td { padding: 14px 16px; vertical-align: middle; }
.data-table tbody tr { transition: background 0.15s; border-bottom: 1px solid rgba(255,255,255,0.03); }
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: rgba(255,255,255,0.02); }

.member-cell { display: flex; align-items: center; gap: 12px; }
.mono { font-family: var(--mono); font-size: 12px; }
.amount-cell { font-weight: 700; color: var(--accent); }

/* ═══════════════════════════════════════════
   HISTORY
   ═══════════════════════════════════════════ */
.history-run {
  padding: 20px 0; border-bottom: 1px solid rgba(255,255,255,0.06);
}
.history-run:last-child { border-bottom: none; }
.history-run-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
}
.history-run-title { font-size: 14px; font-weight: 700; }
.history-run-meta { font-size: 12px; color: var(--txt2); }
.history-run-total { font-size: 14px; font-weight: 700; color: var(--success); }

.history-tx-list { display: flex; flex-direction: column; gap: 6px; padding-left: 12px; }
.history-tx-item {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px; padding: 8px 12px; border-radius: var(--r-sm);
  background: rgba(0,0,0,0.2);
}
.history-tx-name { font-weight: 500; }
.history-tx-hash { font-family: var(--mono); font-size: 11px; color: var(--accent); }
.history-tx-amount { font-weight: 600; color: var(--txt2); }

/* ═══════════════════════════════════════════
   MODALS
   ═══════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(6,9,26,0.85); backdrop-filter: blur(16px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.25s;
  padding: 20px;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: var(--r-lg); padding: 32px;
  width: 100%; max-width: 480px;
  transform: translateY(16px) scale(0.98);
  transition: transform 0.28s cubic-bezier(0.34, 1.4, 0.64, 1);
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
}
.modal-overlay.open .modal { transform: translateY(0) scale(1); }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px;
}
.modal-title { font-size: 18px; font-weight: 700; }
.modal-close {
  background: none; border: none; color: var(--txt2);
  font-size: 16px; cursor: pointer; padding: 4px;
  border-radius: 4px; transition: color 0.15s;
}
.modal-close:hover { color: var(--txt); }
.modal-actions { display: flex; gap: 12px; margin-top: 24px; }
.modal-actions .btn { flex: 1; }

/* Receipt Modal */
.modal-receipt { max-width: 520px; text-align: center; }
.receipt-check { font-size: 52px; margin-bottom: 12px; }
.receipt-title { font-size: 22px; font-weight: 800; margin-bottom: 6px; }
.receipt-subtitle { font-size: 14px; color: var(--txt2); margin-bottom: 28px; }
.receipt-table { text-align: left; }
.receipt-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,0.05);
  font-size: 14px;
}
.receipt-row:last-child { border-bottom: none; }
.receipt-row .lbl { color: var(--txt2); }
.receipt-row .val { font-weight: 600; font-family: var(--mono); font-size: 13px; }
.receipt-row .val.green { color: var(--success); }
.modal-receipt .modal-actions { text-align: center; margin-top: 28px; }

/* ═══════════════════════════════════════════
   FORMS
   ═══════════════════════════════════════════ */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block; font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--txt2); margin-bottom: 8px;
}
.form-input {
  width: 100%; background: rgba(0,0,0,0.3);
  border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 11px 14px; color: var(--txt);
  font-family: var(--sans); font-size: 14px;
  outline: none; transition: border-color 0.2s, box-shadow 0.2s;
}
.form-input.mono { font-family: var(--mono); font-size: 12px; }
.form-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,212,255,0.08); }
.form-input::placeholder { color: var(--txt3); }
.input-with-unit { position: relative; }
.input-with-unit .form-input { padding-right: 48px; }
.input-unit {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  font-size: 13px; font-weight: 600; color: var(--txt2); pointer-events: none;
}

/* ═══════════════════════════════════════════
   TOAST
   ═══════════════════════════════════════════ */
#toast {
  position: fixed; bottom: 28px; right: 28px; z-index: 500;
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: 10px; padding: 14px 20px;
  font-size: 14px; font-weight: 500;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
  display: flex; align-items: center; gap: 10px; max-width: 320px;
  transform: translateY(20px); opacity: 0;
  transition: all 0.3s cubic-bezier(0.34,1.4,0.64,1);
  pointer-events: none;
}
#toast.visible { transform: translateY(0); opacity: 1; }

/* ═══════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════ */
@media (max-width: 1100px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar { display: none; }
  .main-content { margin-left: 0; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .page { padding: 20px; }
  .topbar { padding: 0 20px; }
}

@media (max-width: 480px) {
  .stats-row { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════
   YELLOW BELT ADDITIONS — v2.0.0
   Multi-wallet selector, wallet badge, contract status,
   history tabs, on-chain events
   ═══════════════════════════════════════════════════ */

/* ── Wallet Type Badge (topbar) ─────────────────── */
.wallet-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(245, 197, 24, 0.12);
  color: #f5c518;
  border: 1px solid rgba(245, 197, 24, 0.25);
  white-space: nowrap;
}

/* ── Wallet Selector Modal ───────────────────────── */
.modal-wallet-select {
  max-width: 420px;
}

.wallet-select-sub {
  color: var(--txt2);
  font-size: 14px;
  margin: 0 0 20px;
}

.wallet-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.wallet-option-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  text-align: left;
  width: 100%;
  font-family: inherit;
}

.wallet-option-card:hover {
  border-color: var(--accent);
  background: rgba(0, 212, 255, 0.06);
}

.wallet-option-icon {
  font-size: 28px;
  flex-shrink: 0;
}

.wallet-option-body {
  flex: 1;
}

.wallet-option-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--txt1);
  margin-bottom: 2px;
}

.wallet-option-desc {
  font-size: 12px;
  color: var(--txt2);
}

.wallet-option-desc a {
  color: var(--accent);
  text-decoration: none;
}

.wallet-option-arrow {
  font-size: 18px;
  color: var(--txt3);
  flex-shrink: 0;
}

.wallet-select-hint {
  font-size: 12px;
  color: var(--txt3);
  text-align: center;
  margin: 0;
}

/* ── Connect Banner: two wallet buttons ─────────── */
.connect-wallet-options {
  display: flex;
  gap: 12px;
  margin: 20px 0 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.btn-secondary {
  background: rgba(245, 197, 24, 0.12);
  color: #f5c518;
  border: 1px solid rgba(245, 197, 24, 0.3);
}

.btn-secondary:hover {
  background: rgba(245, 197, 24, 0.2);
}

/* ── Contract Status Panel ───────────────────────── */
.contract-status-wrap {
  margin-top: 16px;
  border-radius: 10px;
  overflow: hidden;
}

.contract-status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  font-size: 13px;
  border-radius: 10px;
  border: 1px solid transparent;
}

.contract-status-row code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  background: rgba(255,255,255,0.07);
  padding: 1px 5px;
  border-radius: 4px;
}

.contract-icon { font-size: 16px; flex-shrink: 0; }

.contract-idle {
  background: rgba(255,255,255,0.04);
  border-color: var(--border);
  color: var(--txt2);
}

.contract-pending {
  background: rgba(245, 197, 24, 0.08);
  border-color: rgba(245, 197, 24, 0.25);
  color: #f5c518;
}

.contract-ok {
  background: rgba(0, 230, 118, 0.08);
  border-color: rgba(0, 230, 118, 0.25);
  color: var(--txt1);
}

.contract-ok a {
  color: var(--accent);
  text-decoration: none;
}

.contract-error {
  background: rgba(255, 82, 82, 0.08);
  border-color: rgba(255, 82, 82, 0.25);
  color: #ff5252;
}

.contract-unconfigured {
  background: rgba(255,255,255,0.03);
  border-color: var(--border);
  color: var(--txt3);
  font-size: 12px;
}

/* ── History Tabs ─────────────────────────────────── */
.history-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}

.history-tab {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--txt2);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  border-radius: 4px 4px 0 0;
  transition: color .2s, border-color .2s;
  font-family: inherit;
}

.history-tab:hover { color: var(--txt1); }

.history-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ── Wallet pill in history ──────────────────────── */
.wallet-pill {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(245, 197, 24, 0.12);
  color: #f5c518;
  margin-left: 8px;
  vertical-align: middle;
}

/* ── On-Chain Event Items ─────────────────────────── */
.event-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.event-item:last-child { border-bottom: none; }

.event-topic {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.event-ledger {
  font-size: 12px;
  color: var(--txt3);
  font-family: 'JetBrains Mono', monospace;
}

.event-tx {
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  font-family: 'JetBrains Mono', monospace;
}

.event-data {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--txt2);
  flex-wrap: wrap;
}

.event-data .mono {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
}

/* ══════════════════════════════════════════════════════════════
   ORANGE BELT — Mobile Responsive + Enhancements
   ══════════════════════════════════════════════════════════════ */

/* ── Hamburger button (mobile only) ───────────────────── */
.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  flex-direction: column;
  gap: 5px;
  padding: 4px;
  z-index: 1100;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-primary, #e2e8f0);
  border-radius: 2px;
  transition: transform 0.25s, opacity 0.25s;
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Sidebar overlay (mobile) ─────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 990;
}
.sidebar-overlay.open { display: block; }

/* Hide topbar actions when sidebar is open on mobile */
body.sidebar-open .topbar-actions {
  visibility: hidden;
  pointer-events: none;
}
body.sidebar-open .page-title {
  visibility: hidden;
}

/* ── On-chain stat card (Orange Belt) ────────────────── */
.stat-card.stat-onchain {
  border-color: rgba(0, 230, 118, 0.35);
}
.stat-card.stat-onchain .stat-value {
  color: #00e676;
}

/* ── Loading spinner ──────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.25);
  border-top-color: #00d4ff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Button loading state ─────────────────────────────── */
.btn[aria-busy="true"] { opacity: 0.7; pointer-events: none; }

/* ── Error banner ─────────────────────────────────────── */
.error-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 82, 82, 0.1);
  border: 1px solid rgba(255, 82, 82, 0.3);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 16px;
  color: #ff5252;
  font-size: 0.875rem;
}
.error-banner .error-icon { font-size: 1.1rem; flex-shrink: 0; }
.error-banner .error-dismiss {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  color: #ff5252;
  font-size: 1rem;
  opacity: 0.7;
}
.error-banner .error-dismiss:hover { opacity: 1; }

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE BREAKPOINTS
   ══════════════════════════════════════════════════════════════ */

/* ── Tablet (≤ 900px) ─────────────────────────────────── */
@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    height: 100%;
    width: 260px;
    z-index: 1000;
    transition: left 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 32px rgba(0,0,0,0.5);
  }
  .sidebar.open { left: 0; display: flex; }

  .hamburger { display: flex; }

  .topbar { padding: 14px 16px; gap: 10px; }

  .stats-row {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .main-content { padding: 16px; }

  .panel-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .panel-header > *:last-child { align-self: flex-end; }
}

/* ── Mobile (≤ 600px) ─────────────────────────────────── */
@media (max-width: 600px) {
  .stats-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .stat-card {
    padding: 16px;
  }

  .topbar-actions { gap: 4px; }
  .topbar-actions .btn-sm { font-size: 0.72rem; padding: 5px 8px; }

  .wallet-type-badge { display: none !important; }

  .data-table { font-size: 0.82rem; }
  .data-table th:nth-child(2),
  .data-table td:nth-child(2) { display: none; } /* hide wallet col */

  .modal { width: 95vw; padding: 20px 16px; }

  .payroll-btn { font-size: 1rem; padding: 14px 20px; }

  .receipt-table { font-size: 0.8rem; }

  .history-tabs { gap: 6px; }
  .history-tab { padding: 8px 12px; font-size: 0.8rem; }

  .connect-wallet-options {
    flex-direction: column;
    gap: 10px;
  }
  .connect-wallet-options .btn { width: 100%; justify-content: center; }

  .topbar { padding: 10px 12px; }
  .page-title { font-size: 1.1rem; }

  .sidebar-footer { padding: 12px 16px; }
}

/* ── Very small (≤ 380px) ─────────────────────────────── */
@media (max-width: 380px) {
  .logo-text { display: none; }
  .main-content { padding: 10px; }
  .panel { padding: 14px; }
}
