.app-body {
  min-height: 100vh;
}

.app-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--line);
  padding: 24px 18px;
  background: rgba(5, 7, 13, 0.92);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sidebar-label {
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  margin: 8px 0 0;
  text-transform: uppercase;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.sidebar-link {
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--muted);
  padding: 10px 12px;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.sidebar-link:hover,
.sidebar-link.is-active {
  border-color: var(--line);
  color: var(--text);
  background: rgba(17, 26, 45, 0.72);
}

.sidebar-footer {
  margin-top: auto;
}

.app-main {
  padding: 28px clamp(20px, 4vw, 48px) 64px;
}

.app-header {
  margin-bottom: 28px;
}

.page-lead {
  color: var(--muted);
  max-width: 62ch;
}

.app-content .grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.app-content .card {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 22px;
  background: linear-gradient(180deg, rgba(17, 26, 45, 0.88), rgba(8, 12, 20, 0.92));
}

.app-content .card h2 {
  margin-top: 0;
}

.app-content .metric {
  color: var(--accent);
  font-size: 1.8rem;
  font-weight: 800;
  margin: 8px 0;
}

/* Toast notification system */
.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-family: var(--mono, monospace);
  color: #fff;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  animation: toast-in 0.25s ease-out;
  max-width: 380px;
  word-break: break-word;
}

.toast.toast-success {
  background: #0d2818;
  border: 1px solid #4caf88;
}

.toast.toast-error {
  background: #2a0a0a;
  border: 1px solid #E24B4A;
}

.toast.toast-info {
  background: #0d0d2a;
  border: 1px solid #5b6aff;
}

.toast.toast-warning {
  background: #2a1a0a;
  border: 1px solid #EF9F27;
}

.toast-close {
  background: none;
  border: none;
  color: #888;
  cursor: pointer;
  font-size: 1rem;
  padding: 0 0 0 8px;
  margin-left: auto;
  line-height: 1;
}

.toast-close:hover {
  color: #fff;
}

.toast.toast-exit {
  animation: toast-out 0.2s ease-in forwards;
}

@keyframes toast-in {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes toast-out {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

@media (max-width: 900px) {
  .app-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--line);
    z-index: 100;
  }

  .sidebar-toggle {
    display: flex;
  }

  .sidebar-label,
  .sidebar-nav,
  .sidebar-footer {
    display: none;
  }

  .sidebar.is-open .sidebar-label,
  .sidebar.is-open .sidebar-nav,
  .sidebar.is-open .sidebar-footer {
    display: flex;
  }

  .sidebar.is-open .sidebar-label {
    display: block;
  }

  .sidebar.is-open .sidebar-nav {
    flex-direction: column;
  }

  .sidebar.is-open {
    height: auto;
    max-height: 100vh;
    overflow-y: auto;
  }
}
