:root {
  color-scheme: dark light;
}

body.agent-page {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #0f172a;
  color: #e2e8f0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.skip-link {
  position: absolute;
  top: -40px;
  left: 16px;
  background: #38bdf8;
  color: #0f172a;
  padding: 8px 16px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 16px;
}

.agent-page a {
  color: #38bdf8;
}

.muted {
  color: #94a3b8;
}

.error {
  color: #f87171;
}

.agent-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  padding: 2rem clamp(1.5rem, 4vw, 3rem) 1rem;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(15, 23, 42, 0.95));
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
}

.agent-header__brand h1 {
  margin: 0;
  font-size: clamp(1.6rem, 3vw, 2.3rem);
}

.agent-header__brand p {
  margin: 0.25rem 0 0;
  color: #94a3b8;
}

.agent-main {
  flex: 1;
  padding: clamp(1.5rem, 4vw, 3rem);
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.agent-section {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 18px;
  padding: clamp(1.5rem, 3vw, 2rem);
  margin-bottom: clamp(1.5rem, 3vw, 2.5rem);
  box-shadow: 0 24px 60px -40px rgba(30, 64, 175, 0.6);
}

.section-heading {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.section-heading h2 {
  margin: 0;
  font-size: clamp(1.2rem, 2.5vw, 1.7rem);
}

.section-heading p {
  margin: 0;
  color: #94a3b8;
}

.doc-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
}

.doc-card {
  border-radius: 16px;
  padding: 1.25rem;
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.18);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.doc-card__title {
  font-size: 1.05rem;
  margin: 0;
  color: #f8fafc;
}

.doc-card__meta {
  font-size: 0.85rem;
  color: #94a3b8;
}

.doc-card__link {
  align-self: flex-start;
  text-decoration: none;
  font-weight: 600;
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #38bdf8;
  transition: transform 0.2s ease, background 0.2s ease;
}

.doc-card__link:hover,
.doc-card__link:focus {
  transform: translateY(-1px);
  background: rgba(56, 189, 248, 0.25);
}

.doc-preview {
  background: rgba(15, 23, 42, 0.6);
  border: 1px dashed rgba(148, 163, 184, 0.25);
  border-radius: 14px;
  padding: 1.5rem;
  margin-top: 1rem;
}

.doc-preview__title {
  margin: 0 0 1rem;
  font-size: 1.1rem;
}

.doc-preview__content {
  max-height: 420px;
  overflow-y: auto;
  font-size: 0.95rem;
  line-height: 1.65;
  color: #cbd5f5;
  white-space: pre-wrap;
}

.doc-preview__placeholder {
  color: #64748b;
  font-size: 0.95rem;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
}

.meta-card {
  background: rgba(30, 41, 59, 0.85);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(148, 163, 184, 0.16);
  color: #cbd5f5;
  font-size: 0.9rem;
}

.meta-card strong {
  display: block;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #94a3b8;
  margin-bottom: 0.2rem;
}

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

  .doc-preview__content {
    max-height: 320px;
  }
}
