@font-face { font-family: 'Inter'; font-weight: 300; font-style: normal; src: url('/fonts/Inter-Light.ttf') format('truetype'); }
@font-face { font-family: 'Inter'; font-weight: 500; font-style: normal; src: url('/fonts/Inter-Medium.ttf') format('truetype'); }
@font-face { font-family: 'Inter'; font-weight: 600; font-style: normal; src: url('/fonts/Inter-SemiBold.ttf') format('truetype'); }

:root {
  --bg: #111114;
  --bg-card: #1a1a1f;
  --bg-input: #151518;
  --border: #2a2a32;
  --border-hover: #3a3a45;
  --text: #ededf0;
  --text-secondary: #9a9aa6;
  --text-dim: #62626e;
  --accent: #fff;
  --accent-glow: rgba(255, 255, 255, 0.08);
  --green: #34d399;
  --green-dim: rgba(52, 211, 153, 0.1);
  --red: #f87171;
  --red-dim: rgba(248, 113, 113, 0.1);
  --yellow: #fbbf24;
  --yellow-dim: rgba(251, 191, 36, 0.1);
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --shadow-xs: 0 1px 3px rgba(0, 0, 0, 0.16);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.14), 0 1px 2px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.18), 0 2px 4px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.22), 0 4px 8px rgba(0, 0, 0, 0.1);
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --duration-fast: 150ms;
  --duration-normal: 200ms;
  --duration-slow: 300ms;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--text-secondary); text-decoration: none; transition: color var(--duration-normal) var(--ease); }
a:hover { color: var(--text); }

::selection { background: rgba(255, 255, 255, 0.15); }

/* ─── Focus ─── */
a:focus-visible,
.btn:focus-visible,
.form-input:focus-visible,
.nav-link:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.2);
  outline-offset: 2px;
}

/* ─── Keyframes ─── */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes toastSlideIn {
  from { opacity: 0; transform: translateY(12px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastSlideOut {
  to { opacity: 0; transform: translateY(8px) scale(0.95); }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
@keyframes slideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

/* ─── Nav ─── */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  height: 56px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(17, 17, 20, 0.85);
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
  animation: fadeInDown 0.5s var(--ease) both;
}
.nav-logo {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transition: opacity var(--duration-normal) var(--ease);
}
.nav-logo:hover { opacity: 0.7; color: var(--text); }
.nav-links { display: flex; gap: 2px; align-items: center; }
.nav-link {
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: color var(--duration-normal) var(--ease), background var(--duration-normal) var(--ease);
  position: relative;
}
.nav-link:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); }
.nav-link.active { color: var(--text); }
.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 14px;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
}
.nav-sep {
  width: 1px;
  height: 16px;
  background: var(--border);
  margin: 0 6px;
}
.nav-balance {
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  color: var(--green);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
  cursor: pointer;
}
.nav-balance:hover {
  border-color: rgba(52, 211, 153, 0.3);
  box-shadow: 0 0 16px rgba(52, 211, 153, 0.06);
  color: var(--green);
}
.nav-burger {
  display: none;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text);
  border-radius: var(--radius-sm);
  transition: background var(--duration-fast) var(--ease);
}
.nav-burger:hover { background: rgba(255, 255, 255, 0.04); }

/* ─── Mobile Drawer ─── */
.nav-drawer {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
}
.nav-drawer-overlay {
  flex: 1;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.nav-drawer-panel {
  width: 260px;
  background: var(--bg);
  border-left: 1px solid var(--border);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  animation: slideInRight 0.25s var(--ease) both;
  overflow-y: auto;
}
.nav-drawer .nav-link {
  padding: 12px 16px;
  font-size: 14px;
  border-radius: var(--radius-sm);
  display: block;
}
.nav-drawer .nav-link.active::after { display: none; }
.nav-drawer .nav-balance {
  margin: 8px 0;
  text-align: center;
  display: block;
}
.nav-drawer .nav-sep {
  width: 100%;
  height: 1px;
  margin: 8px 0;
}

/* ─── Layout ─── */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 28px;
  position: relative;
  z-index: 1;
  animation: fadeInUp 0.5s var(--ease) both;
  animation-delay: 0.08s;
}
.container-sm {
  max-width: 400px;
  margin: 0 auto;
  padding: 0 28px;
  position: relative;
  z-index: 1;
  animation: fadeInUp 0.5s var(--ease) both;
  animation-delay: 0.08s;
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  transition: all var(--duration-normal) var(--ease);
  white-space: nowrap;
  color: var(--text);
}
.btn-primary {
  background: #fff;
  color: #09090b;
  border-color: #fff;
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(255, 255, 255, 0.12);
}
.btn-primary:active { transform: translateY(0); box-shadow: none; }
.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}
.btn-secondary:hover {
  border-color: var(--border-hover);
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
}
.btn-danger { background: var(--red-dim); color: var(--red); border-color: transparent; }
.btn-danger:hover { background: var(--red); color: #fff; transform: translateY(-1px); }
.btn-danger:active { transform: translateY(0); }
.btn-ai {
  background: rgba(99, 102, 241, 0.12);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.25);
}
.btn-ai:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: rgba(99, 102, 241, 0.4);
  transform: translateY(-1px);
}
.btn-ai:active { transform: translateY(0); }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-lg { padding: 11px 26px; font-size: 14px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.35; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

/* ─── Cards ─── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-xs);
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.card-title { font-size: 12px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.06em; }

/* ─── Forms ─── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-dim);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.form-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  transition: border-color var(--duration-normal) var(--ease), box-shadow var(--duration-normal) var(--ease);
}
.form-input:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.25);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.04);
}
.form-input::placeholder { color: var(--text-dim); }
.form-error { font-size: 13px; color: var(--red); margin-top: 6px; }

/* ─── Stats ─── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-xs);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), border-color 0.25s var(--ease);
  animation: fadeInUp 0.5s var(--ease) both;
}
.stat-card:nth-child(1) { animation-delay: 0.06s; }
.stat-card:nth-child(2) { animation-delay: 0.12s; }
.stat-card:nth-child(3) { animation-delay: 0.18s; }
.stat-card:nth-child(4) { animation-delay: 0.24s; }
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-hover);
}
.stat-label {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.stat-value {
  font-size: 26px;
  font-weight: 600;
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.stat-value.green { color: var(--green); }
.stat-value.accent { color: var(--accent); }

/* ─── Tables ─── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left;
  padding: 11px 14px;
  background: var(--bg-card);
  color: var(--text-dim);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}
td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
  transition: background var(--duration-fast) var(--ease);
}
tr:last-child td { border-bottom: none; }
tr:nth-child(even) td { background: rgba(255, 255, 255, 0.015); }
tr:hover td { background: rgba(255, 255, 255, 0.03); }

/* ─── Badges ─── */
.badge {
  display: inline-flex;
  padding: 3px 9px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.badge-green { background: var(--green-dim); color: var(--green); }
.badge-red { background: var(--red-dim); color: var(--red); }
.badge-yellow { background: var(--yellow-dim); color: var(--yellow); }
.badge-muted { background: rgba(107, 107, 128, 0.12); color: var(--text-dim); }

/* ─── Page ─── */
.page-header { padding: 36px 0 28px; }
.page-title { font-size: 22px; font-weight: 600; letter-spacing: -0.025em; }
.page-desc { color: var(--text-dim); font-size: 13px; margin-top: 5px; }

/* ─── Skeleton ─── */
.skeleton {
  background: var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
}
.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.04) 50%, transparent 100%);
  animation: shimmer 1.5s infinite;
}
.skeleton-text { height: 14px; width: 60%; border-radius: 3px; }
.skeleton-card { height: 80px; border-radius: var(--radius); }
.skeleton-row { height: 44px; margin-bottom: 1px; border-radius: 0; }

/* ─── Empty State ─── */
.empty-state {
  padding: 48px 24px;
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.empty-state-icon {
  width: 40px;
  height: 40px;
  opacity: 0.3;
  margin-bottom: 12px;
  color: var(--text-dim);
}
.empty-state-action { margin-top: 16px; }

/* ─── Highlight Row ─── */
.highlight-row {
  background: rgba(251, 191, 36, 0.06);
  margin: 0 -8px;
  padding: 10px 8px;
  border-radius: 4px;
}

/* ─── Toast ─── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 11px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  animation: toastSlideIn 0.35s var(--ease-out);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}
.toast-success { border-color: var(--green); color: var(--green); }
.toast-error { border-color: var(--red); color: var(--red); }

/* ─── QR ─── */
.qr-box {
  background: #fff;
  padding: 14px;
  border-radius: var(--radius);
  display: inline-block;
  box-shadow: var(--shadow-sm);
}
.qr-box img { display: block; width: 200px; height: 200px; }

/* ─── Spinner ─── */
.spinner {
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--border);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* ─── Utils ─── */
.text-center { text-align: center; }
.text-muted { color: var(--text-secondary); }
.text-dim { color: var(--text-dim); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mb-16 { margin-bottom: 16px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.hidden { display: none !important; }
.mono { font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace; font-size: 12px; }

/* ─── Responsive ─── */
@media (max-width: 640px) {
  .nav { padding: 0 16px; height: 52px; }
  .nav-links { display: none; }
  .nav-burger { display: flex; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .page-header { padding: 22px 0 18px; }
  .container, .container-sm { padding: 0 16px; }
}
