:root {
  color-scheme: light dark;
  --bg: #0b0d17;
  --surface: rgba(19, 22, 35, 0.85);
  --surface-strong: #15192c;
  --surface-light: rgba(255, 255, 255, 0.04);
  --border: rgba(255, 255, 255, 0.08);
  --text: #f5f7ff;
  --muted: rgba(245, 247, 255, 0.65);
  --primary: #7c5cff;
  --primary-strong: #6242ef;
  --danger: #ff6b6b;
  --success: #42d392;
  --shadow: 0 20px 45px rgba(10, 15, 35, 0.35);
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

body {
  min-height: 100vh;
  background: radial-gradient(circle at 10% 20%, rgba(124, 92, 255, 0.18), transparent 40%),
    radial-gradient(circle at 90% 0%, rgba(66, 211, 146, 0.15), transparent 45%),
    linear-gradient(160deg, #06070f 0%, #12152b 55%, #080912 100%);
  color: var(--text);
}

.app-shell {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100vh;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2.5rem clamp(1.5rem, 4vw, 4rem) 1.5rem;
}

.brand {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.brand-icon {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border-radius: 0.9rem;
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.6), rgba(66, 211, 146, 0.45));
  font-size: 1.4rem;
  font-weight: 700;
}

.brand h1 {
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  letter-spacing: -0.02em;
}

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

.user-area {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.95rem;
  color: var(--muted);
}

.user-area .avatar {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  background: var(--surface-light);
  display: grid;
  place-items: center;
  font-weight: 600;
  color: var(--text);
  border: 1px solid var(--border);
}

.user-area button {
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 500;
  transition: color 0.2s ease;
}

.user-area button:hover {
  color: var(--text);
}

.app-main {
  padding: 0 clamp(1.5rem, 4vw, 4rem);
}

.view {
  display: none;
  animation: fadeIn 0.3s ease;
}

.view.active {
  display: block;
}

.auth-card {
  max-width: 420px;
  margin: 4rem auto;
  padding: 2.75rem;
  background: var(--surface);
  border-radius: 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: var(--shadow);
}

.auth-card h2 {
  font-size: 1.8rem;
  margin-bottom: 0.5rem;
}

.subtitle {
  color: var(--muted);
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.95rem;
}

.field span {
  color: var(--muted);
}

input,
textarea,
select {
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  padding: 0.85rem 1rem;
  color: var(--text);
  font: inherit;
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: rgba(124, 92, 255, 0.7);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.2);
}

textarea {
  resize: vertical;
}

.btn {
  border: none;
  border-radius: 0.9rem;
  padding: 0.75rem 1.3rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

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

.btn.primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: white;
  box-shadow: 0 12px 25px rgba(124, 92, 255, 0.35);
}

.btn.primary:hover {
  box-shadow: 0 16px 35px rgba(124, 92, 255, 0.45);
}

.btn.secondary {
  background: rgba(124, 92, 255, 0.15);
  color: var(--text);
  border: 1px solid rgba(124, 92, 255, 0.25);
}

.btn.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.btn.icon {
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  background: rgba(124, 92, 255, 0.1);
  color: var(--text);
}

.btn.danger {
  background: rgba(255, 107, 107, 0.12);
  color: #ff8a8a;
  border: 1px solid rgba(255, 107, 107, 0.35);
}

.btn.full {
  width: 100%;
}

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

.login-hint {
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.login-hint code {
  background: var(--surface-strong);
  padding: 0.2rem 0.5rem;
  border-radius: 0.5rem;
}

.form-error {
  color: #ff8a8a;
  text-align: center;
  min-height: 1.2rem;
}

.dashboard {
  max-width: 1120px;
  margin: 0 auto 4rem;
}

.dashboard-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.5rem;
}

.project-card {
  background: var(--surface);
  border-radius: 1.3rem;
  padding: 1.75rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  cursor: pointer;
  transition: transform 0.2s ease, border 0.2s ease;
}

.project-card:hover {
  transform: translateY(-4px);
  border-color: rgba(124, 92, 255, 0.35);
}

.project-card-title {
  font-size: 1.2rem;
  margin-bottom: 0.4rem;
}

.project-card-description {
  color: var(--muted);
  line-height: 1.5;
  min-height: 3.6rem;
}

.project-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: rgba(124, 92, 255, 0.15);
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 500;
}

.badge.light {
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
}

.empty-state {
  max-width: 540px;
  margin: 4rem auto;
  text-align: center;
  color: var(--muted);
  display: grid;
  gap: 1rem;
}

.empty-state img {
  width: min(280px, 60%);
  margin: 0 auto 1rem;
  opacity: 0.8;
}

.hidden {
  display: none !important;
}

.project-shell {
  max-width: 1200px;
  margin: 0 auto 4rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.project-toolbar {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  justify-content: space-between;
}

.project-meta h2 {
  font-size: 1.8rem;
  margin-bottom: 0.25rem;
}

.project-meta p {
  color: var(--muted);
}

.project-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.5rem;
  min-height: 540px;
}

.collection {
  background: var(--surface);
  border-radius: 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.collection-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.request-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.request-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.8rem;
  align-items: center;
  background: var(--surface-strong);
  border: 1px solid transparent;
  border-radius: 1rem;
  padding: 0.85rem 1rem;
  cursor: pointer;
  transition: border 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.request-item:hover,
.request-item.active {
  border-color: rgba(124, 92, 255, 0.35);
  background: rgba(124, 92, 255, 0.12);
  transform: translateX(2px);
}

.request-item .method {
  font-weight: 700;
  font-size: 0.85rem;
  color: rgba(66, 211, 146, 0.95);
}

.request-item .request-info p {
  font-weight: 600;
}

.request-item .request-info small {
  color: var(--muted);
}

.request-workspace {
  background: var(--surface);
  border-radius: 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.request-form-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.request-name {
  flex: 1;
  font-size: 1.4rem;
  font-weight: 600;
  border-radius: 1rem;
  background: var(--surface-strong);
}

.request-actions {
  display: flex;
  gap: 0.75rem;
}

.request-row {
  display: grid;
  grid-template-columns: 140px 1fr auto;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.method-select {
  text-transform: uppercase;
  font-weight: 600;
}

.response-panel {
  background: var(--surface-strong);
  border-radius: 1.2rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 1.5rem;
  display: grid;
  gap: 0.85rem;
}

.response-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.response-meta {
  display: flex;
  gap: 0.5rem;
}

.response-body {
  background: rgba(8, 10, 18, 0.6);
  border-radius: 1rem;
  padding: 1.25rem;
  max-height: 260px;
  overflow: auto;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.85rem;
  color: rgba(224, 229, 255, 0.95);
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(3, 5, 12, 0.7);
  backdrop-filter: blur(12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 20;
  padding: 1.5rem;
}

.modal[aria-hidden='false'] {
  opacity: 1;
  pointer-events: all;
}

.modal-content {
  width: min(420px, 100%);
  background: var(--surface);
  border-radius: 1.5rem;
  padding: 2rem;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: var(--shadow);
  display: grid;
  gap: 1rem;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  color: var(--text);
  font-size: 1.2rem;
  cursor: pointer;
}

.app-footer {
  padding: 2rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

  .collection {
    flex-direction: column;
  }
}

@media (max-width: 720px) {
  .app-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .auth-card {
    margin: 2rem auto 4rem;
    padding: 2rem;
  }

  .request-form-header {
    flex-direction: column;
    align-items: stretch;
  }

  .request-actions {
    justify-content: flex-end;
  }

  .request-row {
    grid-template-columns: 1fr;
  }
}
