:root {
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, Segoe UI, Arial, sans-serif;
  background: radial-gradient(circle at top right, #1a2552 0%, #0b1023 40%, #090d1d 100%);
  color: #eaf0ff;
}

.app-shell {
  max-width: 1300px;
  margin: 0 auto;
  padding: 1rem;
  display: grid;
  gap: 1rem;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

h1, h2, h3 {
  margin: 0;
}

.card {
  background: rgba(13, 19, 44, 0.82);
  border: 1px solid #2b376f;
  border-radius: 14px;
  padding: 1rem;
}

details.card > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  user-select: none;
}

details.card > summary::-webkit-details-marker { display: none; }

details.card > summary::after {
  content: '▸';
  margin-left: auto;
  color: #5a6fad;
  transition: transform 0.2s;
}

details.card[open] > summary::after {
  transform: rotate(90deg);
}

.ingest-section {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #1e2d60;
}

.ingest-section h3 {
  color: #8ea5e0;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.75rem;
  align-items: center;
}

input, button {
  padding: 0.62rem 0.85rem;
  border-radius: 10px;
  border: 1px solid #3c4a8d;
  background: #11183a;
  color: #eaf0ff;
}

input {
  min-width: 220px;
  flex: 1;
}

button {
  cursor: pointer;
  background: #2f5cff;
  border-color: #426bff;
  font-weight: 600;
}

button.ghost {
  background: transparent;
}

.checkline {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: #b8c7ff;
}

.check {
  cursor: pointer;
  position: relative;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  transform: translate3d(0, 0, 0);
}

.check::before {
  content: "";
  position: absolute;
  top: -5px;
  left: -5px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(47, 92, 255, 0.12);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.check svg {
  position: relative;
  z-index: 1;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke: #5a6fad;
  stroke-width: 1.5;
  transform: translate3d(0, 0, 0);
  transition: all 0.2s ease;
}

.check svg path {
  stroke-dasharray: 60;
  stroke-dashoffset: 0;
}

.check svg polyline {
  stroke-dasharray: 22;
  stroke-dashoffset: 66;
}

.check:hover::before {
  opacity: 1;
}

.check:hover svg {
  stroke: #2f5cff;
}

.typeCheck:checked + .check svg {
  stroke: #2f5cff;
}

.typeCheck:checked + .check svg path {
  stroke-dashoffset: 60;
  transition: all 0.3s linear;
}

.typeCheck:checked + .check svg polyline {
  stroke-dashoffset: 42;
  transition: all 0.2s linear;
  transition-delay: 0.15s;
}

.check-text {
  cursor: pointer;
  color: #b8c7ff;
  font-size: 0.9rem;
  user-select: none;
}

.search-layout {
  display: flex;
  gap: 1rem;
  margin-top: 0.75rem;
  align-items: flex-start;
}

.search-inputs {
  flex: 1;
  min-width: 0;
}

.search-inputs .row {
  margin-top: 0.5rem;
}

.search-inputs .row:first-child {
  margin-top: 0;
}

.type-filters {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  background: #0d1430;
  border: 1px solid #2b376f;
  border-radius: 10px;
  min-width: 100px;
}

.filter-label {
  color: #7a8fc0;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status {
  margin: 0.75rem 0 0;
  color: #c2cffd;
}

.pill {
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  border: 1px solid #3f4d95;
  color: #cbd7ff;
  font-size: 0.9rem;
}

.pill.ok {
  border-color: #1f8b5d;
  color: #8ef0c1;
}

.pill.warn {
  border-color: #9c7a1a;
  color: #ffd57a;
}

.content-grid {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 1rem;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.muted {
  color: #9aacdd;
}

.hidden {
  display: none !important;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 20, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal {
  max-width: 520px;
  width: 100%;
  border: 1px solid #6b3b5a;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal h2 {
  margin-top: 0;
}

.modal code {
  background: rgba(255, 255, 255, 0.08);
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
}

.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
  max-height: 65vh;
  overflow: auto;
}

.post-item {
  border: 1px solid #2d3872;
  border-radius: 10px;
  padding: 0.7rem;
  background: #0d1430;
}

.post-item a {
  color: #aac0ff;
  text-decoration: none;
  font-weight: 600;
}

.tag-line {
  font-size: 0.85rem;
  color: #8ea1dd;
  margin-top: 0.35rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.tag {
  background: #1a2550;
  border: 1px solid #29356f;
  border-radius: 4px;
  padding: 0.1rem 0.45rem;
  font-size: 0.78rem;
  color: #8ea1dd;
}

#postBody {
  white-space: pre-wrap;
  word-break: break-word;
  background: #0b122e;
  border: 1px solid #29356f;
  border-radius: 10px;
  padding: 0.75rem;
  min-height: 260px;
}

#postEmbed {
  margin: 0.75rem 0;
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 16/9;
}

#postEmbed iframe {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 10px;
}

#postLinks {
  list-style: disc;
  padding-left: 1.2rem;
}

#postLinks a {
  color: #8bd3ff;
}

@media (max-width: 980px) {
  .content-grid {
    grid-template-columns: 1fr;
  }
}
