:root {
  --bg: #0f1115;
  --card: #171a21;
  --border: #242938;
  --text: #e6e9ef;
  --muted: #9aa3b2;
  --accent: #7c5cff;
  --accent-hover: #6a4df0;
  --radius: 14px;
}

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

body {
  font-family: Inter, system-ui, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 20px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: white;
  border: none;
  padding: 12px 18px;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 500;
  text-decoration: none;
  line-height: 1.2;
  transition: background .2s ease, transform .05s ease, box-shadow .1s ease;
}

.btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(1px);
}

.btn-secondary {
  background: #2a2f3a;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: #343b4a;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: transform .15s ease, box-shadow .15s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.25);
}

.input {
  width: 100%;
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #0c0f14;
  color: var(--text);
  margin-bottom: 12px;
  font: inherit;
}

textarea.input {
  resize: vertical;
  min-height: 120px;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: #111827;
  padding: 24px;
  border-radius: 16px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.modal-heading {
  margin-bottom: 16px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #111827;
  color: white;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  opacity: 0;
  transform: translateY(10px);
  transition: all .25s ease;
  z-index: 9999;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.success {
  border-left: 4px solid #22c55e;
}

.toast.error {
  border-left: 4px solid #ef4444;
}

/* Loading overlay */
.loading {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  transition: opacity .2s ease;
}

.hidden {
  display: none !important;
}

.spinner {
  width: 42px;
  height: 42px;
  border: 4px solid rgba(255,255,255,0.2);
  border-top: 4px solid #7c3aed;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Landing page */
.landing-page {
  background:
    radial-gradient(70% 70% at 50% -10%, rgba(124, 92, 255, 0.18) 0%, rgba(124, 92, 255, 0) 70%),
    var(--bg);
}

.landing-header {
  padding-top: 24px;
  padding-bottom: 12px;
}

.landing-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.brand {
  margin: 0;
  letter-spacing: .4px;
}

.hero-section {
  padding-top: 72px;
  padding-bottom: 56px;
}

.hero-content {
  max-width: 720px;
}

.hero-content h1 {
  font-size: clamp(2rem, 5.6vw, 3rem);
  line-height: 1.08;
  margin-bottom: 16px;
  text-wrap: balance;
}

.hero-content p {
  color: var(--muted);
  font-size: clamp(1rem, 2.4vw, 1.125rem);
  margin-bottom: 28px;
  max-width: 62ch;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.feature-section {
  padding-bottom: 72px;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.feature-card h3 {
  margin-bottom: 8px;
  font-size: 1.125rem;
}

.feature-card p {
  color: var(--muted);
}

.cta-section {
  padding-bottom: 96px;
}

.cta-card {
  text-align: center;
  padding: 48px 24px;
}

.cta-card h2 {
  margin-bottom: 12px;
  line-height: 1.2;
  text-wrap: balance;
}

.cta-card p {
  color: var(--muted);
  margin-bottom: 24px;
}

/* Auth page */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.auth-shell {
  position: relative;
  width: min(420px, 100%);
}

.auth-shell::before {
  content: "";
  position: absolute;
  inset: -42px -28px;
  border-radius: 26px;
  background: radial-gradient(circle at center, rgba(124, 92, 255, 0.36) 0%, rgba(124, 92, 255, 0.14) 48%, rgba(124, 92, 255, 0) 75%);
  filter: blur(22px);
  opacity: .72;
  animation: authPulse 4.8s ease-in-out infinite;
  z-index: 0;
}

.auth-card {
  position: relative;
  z-index: 1;
}

.auth-title {
  margin-bottom: 16px;
}

.auth-submit {
  width: 100%;
}

@keyframes authPulse {
  0%, 100% {
    transform: scale(.97);
    opacity: .58;
  }
  50% {
    transform: scale(1.03);
    opacity: .82;
  }
}

/* Dashboard */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.dashboard-title {
  white-space: nowrap;
}

.dashboard-search {
  flex: 1;
  min-width: 220px;
  max-width: 360px;
  margin-bottom: 0;
}

.dashboard-actions {
  display: flex;
  gap: 10px;
}

.dashboard-note-content {
  min-height: 120px;
}

.dashboard-modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

@media (max-width: 960px) {
  .feature-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .container {
    padding: 24px 16px;
  }

  .landing-header {
    padding-top: 18px;
  }

  .hero-section {
    padding-top: 48px;
    padding-bottom: 40px;
  }

  .feature-section {
    padding-bottom: 48px;
  }

  .cta-section {
    padding-bottom: 64px;
  }

  .cta-card {
    padding: 36px 18px;
  }

  .dashboard-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "title actions"
      "search search";
    align-items: center;
    column-gap: 12px;
    row-gap: 12px;
  }

  .dashboard-title {
    grid-area: title;
    min-width: 0;
  }

  .dashboard-search {
    grid-area: search;
    width: 100%;
    min-width: 0;
    max-width: none;
  }

  .dashboard-actions {
    grid-area: actions;
    width: auto;
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 8px;
  }

  .dashboard-actions .btn {
    white-space: nowrap;
  }
}

@media (max-width: 390px) {
  .dashboard-title {
    font-size: 1.35rem;
  }

  .dashboard-actions .btn {
    padding: 10px 14px;
    font-size: 0.92rem;
  }
}

@media (max-width: 640px) {
  .dashboard-modal-actions {
    flex-direction: column;
  }

  .dashboard-modal-actions .btn {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .landing-nav {
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: center;
  }

  .landing-nav .btn {
    width: auto;
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .hero-actions {
    flex-direction: column;
  }

  .hero-actions .btn {
    width: 100%;
  }

  .feature-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-shell::before {
    animation: none;
  }
}
