:root {
  --bg: #0a0a0a;
  --bg-card: #161616;
  --bg-hover: #1e1e1e;
  --text: #fafafa;
  --text-muted: #888;
  --text-dim: #555;
  --border: #2a2a2a;
  --border-hover: #444;
  --accent: #8b7cf8;
  --accent-text: #fff;
  --accent-secondary: #c5ff6e;
  --accent-secondary-text: #0b5e2d;
  --toast-bg: #161616;
  --radius: 20px;
  --radius-sm: 10px;
}
[data-theme="light"] {
  --bg: #fff;
  --bg-card: rgba(0, 0, 0, 0.03);
  --bg-hover: rgba(0, 0, 0, 0.06);
  --text: #111;
  --text-muted: #666;
  --text-dim: #999;
  --border: rgba(0, 0, 0, 0.12);
  --border-hover: rgba(0, 0, 0, 0.8);
  --accent: #8b7cf8;
  --accent-text: #000;
  --accent-secondary: #c5ff6e;
  --accent-secondary-text: #0b5e2d;
  --toast-bg: #fff;
  --radius: 28px;
  --radius-sm: 12px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  transition:
    background 0.2s,
    color 0.2s;
}
body > nav {
  flex-shrink: 0;
  width: 100%;
}
body > footer {
  flex-shrink: 0;
  margin-top: auto;
  width: 100%;
}

/* Nav */
nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 40px;
  border-bottom: 1px solid var(--border);
}
nav .logo {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
  text-decoration: none;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
nav .logo img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
}
nav .nav-tabs {
  display: flex;
  gap: 8px;
  align-items: center;
}
nav .nav-tabs button {
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  background: none;
  border-radius: 8px;
  transition: all 0.2s;
}
nav .nav-tabs button:hover {
  color: var(--text);
  background: var(--bg-hover);
}
nav .nav-tabs button.active {
  color: var(--text);
  background: var(--bg-hover);
}
nav .nav-tabs a {
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.2s;
}
nav .nav-tabs a:hover {
  color: var(--text);
  background: var(--bg-hover);
}
nav .nav-tabs a.active {
  color: var(--text);
  background: var(--bg-hover);
}
nav .nav-links {
  display: flex;
  gap: 20px;
  align-items: center;
  flex-shrink: 0;
}
nav .nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: color 0.2s;
}
nav .nav-links a:hover {
  color: var(--text);
}
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  color: var(--text-muted);
  transition: all 0.2s;
}
.theme-toggle:hover {
  border-color: var(--border-hover);
  color: var(--text);
}
footer {
  text-align: center;
  padding: 32px;
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 12px;
}

/* Hamburger button — hidden on desktop */
.menu-btn {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 18px;
  line-height: 1;
}
.menu-btn:hover {
  border-color: var(--border-hover);
  color: var(--text);
}

/* Drawer */
.drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
}
.drawer-overlay.open {
  display: block;
}
[data-theme="light"] .drawer-overlay.open {
  background: rgba(0, 0, 0, 0.3);
}
.drawer {
  position: fixed;
  top: 0;
  right: -280px;
  width: 280px;
  height: 100%;
  z-index: 1000;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-left: 1px solid var(--border);
  padding: 20px;
  transition: right 0.25s ease;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.drawer.open {
  right: 0;
}
.drawer-close {
  align-self: flex-end;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 22px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}
.drawer-close:hover {
  color: var(--text);
}
.drawer a,
.drawer button.tab {
  display: block;
  padding: 10px 16px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-radius: 8px;
  transition: all 0.2s;
  border: none;
  background: none;
  text-align: left;
  width: 100%;
  cursor: pointer;
}
.drawer a:hover,
.drawer button.tab:hover {
  color: var(--text);
  background: var(--bg-hover);
}
.drawer a.active,
.drawer button.tab.active {
  color: var(--text);
  background: var(--bg-hover);
}
.drawer .drawer-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 8px 0;
}
.drawer .theme-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  color: var(--text-muted);
  font-size: 14px;
}

/* Skeleton loading */
.skeleton {
  background: var(--bg-hover);
  border-radius: 8px;
  position: relative;
  overflow: hidden;
}
.skeleton::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--bg-card) 50%,
    transparent 100%
  );
  animation: skeleton-shimmer 1.5s infinite;
}
@keyframes skeleton-shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}
.skeleton-text {
  height: 14px;
  margin-bottom: 8px;
}
.skeleton-title {
  height: 28px;
  width: 60%;
  margin-bottom: 12px;
}
.skeleton-card {
  height: 100px;
}
.skeleton-chart {
  height: 200px;
}

/* Toast */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  min-width: 260px;
  max-width: 400px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toast-in 0.3s ease;
  background: var(--toast-bg);
}
.toast-success {
  border: 1px solid #22c55e44;
  color: #22c55e;
}
.toast-error {
  border: 1px solid #f43f5e44;
  color: #f43f5e;
}
.toast-info {
  border: 1px solid #3b82f644;
  color: #3b82f6;
}
.toast-out {
  animation: toast-out 0.3s ease forwards;
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
@keyframes toast-out {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
    transform: translateX(40px);
  }
}

/* Modal (confirm dialog) */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: modal-fade-in 0.2s ease;
}
.modal-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  min-width: 320px;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: modal-pop-in 0.2s ease;
}
.modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}
.modal-message {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 20px;
}
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.modal-btn {
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s;
}
.modal-btn:hover {
  border-color: var(--border-hover);
  background: var(--bg-hover);
}
.modal-btn-confirm {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
}
.modal-btn-confirm:hover {
  filter: brightness(1.1);
  background: var(--accent);
}
.modal-btn-danger {
  background: #f43f5e;
  color: #fff;
  border-color: #f43f5e;
}
.modal-btn-danger:hover {
  background: #e11d48;
  border-color: #e11d48;
}
.modal-out {
  animation: modal-fade-out 0.2s ease forwards;
}
@keyframes modal-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes modal-fade-out {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}
@keyframes modal-pop-in {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Mobile */
@media (max-width: 768px) {
  nav {
    padding: 12px 16px;
  }
  nav .nav-tabs {
    display: none;
  }
  nav .nav-links {
    display: none;
  }
  .menu-btn {
    display: block;
  }
}
