@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #080b12;
  --bg-elevated: #0c1019;
  --sidebar: #0a0e16;
  --surface: #111827;
  --surface-2: #0d1320;
  --surface-3: #151d2e;
  --border: #1e293b;
  --border-2: #243044;
  --text: #f1f5ff;
  --text-2: #94a3b8;
  --text-3: #64748b;
  --primary: #8b5cf6;
  --primary-soft: rgba(139, 92, 246, 0.14);
  --primary-glow: rgba(139, 92, 246, 0.35);
  --success: #22c55e;
  --success-soft: rgba(34, 197, 94, 0.14);
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.12);
  --warning-border: rgba(245, 158, 11, 0.45);
  --error: #ef4444;
  --error-soft: rgba(239, 68, 68, 0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --font: Inter, system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; }

.shell { display: flex; min-height: 100vh; }

/* ——— Sidebar ——— */
.sidebar {
  width: 248px;
  flex-shrink: 0;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  padding: 1.1rem 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.35rem 0.55rem 1.1rem;
}
.brand-mark {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, #a78bfa, #6366f1);
  display: grid; place-items: center;
  font-weight: 700; font-size: 0.85rem; color: #fff;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.08), 0 8px 20px var(--primary-glow);
}
.brand-text { font-weight: 700; letter-spacing: 0.06em; font-size: 0.95rem; }
.brand-text small {
  display: block;
  font-weight: 400;
  letter-spacing: 0;
  font-size: 0.68rem;
  color: var(--text-3);
  margin-top: 0.15rem;
  max-width: 150px;
  line-height: 1.3;
}

.nav-section {
  margin: 0.55rem 0 0.25rem;
  padding: 0 0.65rem;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text-3);
  text-transform: uppercase;
}
.nav { display: grid; gap: 0.15rem; }
.nav a {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--text-2);
  padding: 0.55rem 0.7rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  position: relative;
  transition: background .15s, color .15s;
}
.nav a svg { width: 17px; height: 17px; opacity: 0.75; flex-shrink: 0; }
.nav a:hover { background: rgba(255,255,255,0.04); color: var(--text); }
.nav a.active {
  background: var(--primary-soft);
  color: var(--text);
}
.nav a.active::before {
  content: "";
  position: absolute;
  left: 0; top: 6px; bottom: 6px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--primary);
}
.nav a.active svg { opacity: 1; color: var(--primary); }

.sidebar-foot {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.user-chip {
  display: flex; align-items: center; gap: 0.65rem;
  padding: 0.55rem 0.5rem;
}
.avatar {
  width: 34px; height: 34px; border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--border-2);
  display: grid; place-items: center;
  font-size: 0.75rem; font-weight: 700; color: var(--text-2);
}
.user-chip strong { display: block; font-size: 0.82rem; }
.user-chip span { font-size: 0.72rem; color: var(--text-3); }
.logout-link {
  display: flex; align-items: center; gap: 0.45rem;
  color: var(--text-3); font-size: 0.8rem;
  padding: 0.4rem 0.55rem; border-radius: 6px;
}
.logout-link:hover { color: var(--error); background: var(--error-soft); }

/* ——— Main ——— */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.header-bar {
  display: flex; justify-content: space-between; align-items: center;
  gap: 1rem; flex-wrap: wrap;
  padding: 0.85rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: rgba(8, 11, 18, 0.85);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 20;
}
.crumbs { display: flex; align-items: center; gap: 0.4rem; color: var(--text-3); font-size: 0.85rem; }
.crumbs strong { color: var(--text); font-weight: 600; }
.crumbs .sep { opacity: 0.5; }
.header-actions { display: flex; align-items: center; gap: 0.65rem; }
.online {
  display: inline-flex; align-items: center; gap: 0.4rem;
  color: var(--text-2); font-size: 0.8rem; font-weight: 500;
}
.online i {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(34,197,94,0.2);
}

.content { padding: 1.35rem 1.5rem 2rem; max-width: 1200px; }

.page-head { margin-bottom: 1.15rem; }
.page-head h1 {
  margin: 0;
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.page-head p {
  margin: 0.35rem 0 0;
  color: var(--text-2);
  font-size: 0.9rem;
}
.page-head-row {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 1rem; flex-wrap: wrap;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
}
.card-muted { background: var(--surface-2); }

.alert {
  display: flex; gap: 0.75rem; align-items: flex-start;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  border: 1px solid var(--warning-border);
  background: var(--warning-soft);
  color: #fde68a;
}
.alert-err {
  border-color: rgba(239,68,68,0.4);
  background: var(--error-soft);
  color: #fecaca;
}
.alert-ok {
  border-color: rgba(34,197,94,0.35);
  background: var(--success-soft);
  color: #bbf7d0;
}
.alert-icon {
  width: 22px; height: 22px; border-radius: 999px;
  display: grid; place-items: center;
  font-size: 0.75rem; font-weight: 700;
  background: rgba(0,0,0,0.25);
  flex-shrink: 0;
}
.alert strong { display: block; margin-bottom: 0.15rem; color: #fff; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  border: 0; border-radius: var(--radius-sm);
  padding: 0.5rem 0.9rem;
  cursor: pointer; font-weight: 600; font-size: 0.85rem;
  color: #fff; background: var(--primary);
  transition: filter .15s, transform .1s;
}
.btn:hover { filter: brightness(1.08); }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border-2);
  color: var(--text-2);
}
.btn-ghost:hover { background: rgba(255,255,255,0.04); color: var(--text); }
.btn-outline {
  background: transparent;
  border: 1px solid var(--border-2);
  color: var(--text);
}

.input, select, textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border-2);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.75rem;
  font-size: 0.875rem;
  outline: none;
}
.input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
label { display: block; font-size: 0.75rem; font-weight: 500; color: var(--text-3); margin-bottom: 0.35rem; }
.form-row { margin-bottom: 0.9rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

.filters {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr auto;
  gap: 0.75rem;
  align-items: end;
}

/* ——— Transaction cards (Nuvlyx-like) ——— */
.tx-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}
.tx {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.05rem;
}
.tx-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 0.75rem; margin-bottom: 0.75rem;
}
.tx-amount {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.badge {
  display: inline-flex; align-items: center;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
}
.badge-ok { background: var(--success-soft); color: var(--success); }
.badge-warn { background: var(--warning-soft); color: var(--warning); }
.badge-muted { background: rgba(148,163,184,0.12); color: var(--text-3); }
.badge-err { background: var(--error-soft); color: var(--error); }

.tx-meta { font-size: 0.84rem; color: var(--text-2); }
.tx-meta p { margin: 0.28rem 0; }
.tx-meta strong { color: var(--text); font-weight: 600; }

.tx-linked {
  margin-top: 0.85rem;
  padding: 0.7rem 0.8rem;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.tx-linked-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-3);
  margin-bottom: 0.35rem;
}
.tx-linked-row {
  display: flex; justify-content: space-between; align-items: center; gap: 0.5rem;
}
.tx-linked-row span { font-size: 0.85rem; font-weight: 500; }
.tx-linked-row em { font-style: normal; font-weight: 700; color: var(--text); }

/* Switches */
.switch-row {
  display: flex; justify-content: space-between; align-items: center;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}
.switch-row:last-child { border-bottom: 0; }
.switch-row strong { display: block; font-size: 0.92rem; margin-bottom: 0.2rem; }
.switch-row .hint { color: var(--text-3); font-size: 0.8rem; }
.switch { position: relative; width: 46px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0; background: #334155; border-radius: 999px; cursor: pointer;
  transition: 0.2s;
}
.slider:before {
  content: ""; position: absolute; height: 20px; width: 20px; left: 3px; top: 3px;
  background: white; border-radius: 50%; transition: 0.2s;
}
.switch input:checked + .slider { background: var(--success); }
.switch input:checked + .slider:before { transform: translateX(20px); }

.flash {
  padding: 0.75rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem;
  font-size: 0.875rem;
}
.flash-ok { background: var(--success-soft); border: 1px solid rgba(34,197,94,0.35); color: #bbf7d0; }
.flash-err { background: var(--error-soft); border: 1px solid rgba(239,68,68,0.35); color: #fecaca; }

.login-page {
  min-height: 100vh; display: grid; place-items: center; padding: 1rem;
  background:
    radial-gradient(800px 400px at 15% 0%, rgba(139,92,246,0.18), transparent 60%),
    var(--bg);
}
.login-card {
  width: min(400px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 20px 50px rgba(0,0,0,0.35);
}
.login-card h1 { margin: 0 0 0.25rem; font-size: 1.25rem; }
.login-card .muted { color: var(--text-2); margin: 0 0 1.25rem; font-size: 0.85rem; }
.muted { color: var(--text-2); }
.empty {
  text-align: center; color: var(--text-3); padding: 2.5rem 1rem;
  border: 1px dashed var(--border); border-radius: var(--radius);
}

@media (max-width: 980px) {
  .tx-grid, .grid-2, .filters { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .shell { display: block; }
  .sidebar { width: auto; height: auto; position: relative; border-right: 0; border-bottom: 1px solid var(--border); }
}
