:root {
  --ink: #17201b;
  --muted: #64746b;
  --paper: #f7f1e7;
  --panel: #fffaf1;
  --line: #dfd3bf;
  --green: #1d5b43;
  --gold: #c58b32;
  --red: #8f3d2b;
  --shadow: 0 24px 70px rgba(45, 33, 16, 0.14);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 10%, rgba(197, 139, 50, 0.22), transparent 28rem),
    radial-gradient(circle at 90% 0%, rgba(29, 91, 67, 0.18), transparent 25rem),
    linear-gradient(135deg, #f4ead9 0%, #fbf7ed 55%, #efe0c8 100%);
  font-family: Georgia, "Times New Roman", serif;
}

a { color: inherit; text-decoration: none; }

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 56px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 0 32px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 2px solid var(--ink);
  background: var(--green);
  color: #fff9ef;
  font-weight: 900;
  letter-spacing: -0.08em;
  box-shadow: 5px 5px 0 var(--gold);
}

.brand small, .muted, .edition-row small {
  display: block;
  color: var(--muted);
}

nav {
  display: flex;
  gap: 10px;
}

nav a, .actions a, button {
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #fffaf1;
  padding: 10px 14px;
  border-radius: 999px;
  font: inherit;
}

.hero, .detail-hero {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: clamp(24px, 4vw, 48px);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.hero {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 28px;
  align-items: end;
}

.hero::after, .detail-hero::after {
  content: "";
  position: absolute;
  right: -80px;
  top: -80px;
  width: 230px;
  height: 230px;
  border: 28px solid rgba(197, 139, 50, 0.2);
  border-radius: 50%;
}

.eyebrow {
  color: var(--red);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

h1, h2, h3, p { margin-top: 0; }

h1 {
  max-width: 760px;
  font-size: clamp(2.4rem, 7vw, 5.6rem);
  line-height: 0.9;
  letter-spacing: -0.07em;
  margin-bottom: 20px;
}

.hero-copy {
  max-width: 580px;
  color: var(--muted);
  font-size: 1.15rem;
}

.search-card {
  background: #eadcc4;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 18px;
}

.search-card label {
  display: block;
  margin-bottom: 10px;
  font-weight: 700;
}

.search-row {
  display: flex;
  gap: 8px;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 12px 14px;
  background: #fffaf1;
  color: var(--ink);
  font: inherit;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin: 18px 0;
}

.stats-grid article, .panel {
  background: rgba(255, 250, 241, 0.86);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 14px 35px rgba(45, 33, 16, 0.08);
}

.stats-grid article {
  padding: 20px;
}

.stats-grid strong {
  display: block;
  font-size: 2rem;
}

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

.split {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 18px;
}

.panel {
  padding: 20px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
  padding-bottom: 12px;
}

.panel-head h2 {
  margin: 0;
}

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

.cards, .edition-list, .mention-list {
  display: grid;
  gap: 12px;
}

.publication-card, .edition-row, .mention-list article {
  display: block;
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
}

.publication-card {
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.thumb {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  object-position: top;
  border: 1px solid var(--line);
  border-radius: 14px;
  margin-bottom: 12px;
  filter: sepia(0.16) contrast(0.98);
}

.page-preview-link {
  display: grid;
  gap: 8px;
  margin: 14px 0;
  color: var(--green);
  font-weight: 700;
}

.page-preview {
  width: 100%;
  max-height: 780px;
  object-fit: contain;
  object-position: top;
  background: #efe3cf;
  border: 1px solid var(--line);
  border-radius: 18px;
}

.inline-actions {
  margin: 10px 0 16px;
}

.publication-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 35px rgba(45, 33, 16, 0.12);
}

.badge {
  display: inline-block;
  background: rgba(29, 91, 67, 0.12);
  color: var(--green);
  border: 1px solid rgba(29, 91, 67, 0.25);
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 0.8rem;
  margin-bottom: 10px;
}

.meta, .chips, .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.meta span, .chips em {
  background: #efe3cf;
  border-radius: 999px;
  color: var(--muted);
  font-style: normal;
  padding: 5px 9px;
  font-size: 0.85rem;
}

.edition-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.backlink {
  color: var(--red);
  font-weight: 700;
}

.detail-hero {
  margin-bottom: 18px;
}

.facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 12px 0;
}

.facts div {
  background: #efe3cf;
  border-radius: 14px;
  padding: 10px;
}

dt {
  color: var(--muted);
  font-size: 0.82rem;
}

dd {
  margin: 0;
  font-weight: 700;
}

.subject {
  font-size: 1.05rem;
}

pre {
  white-space: pre-wrap;
  background: #1d211f;
  color: #fffaf1;
  border-radius: 14px;
  padding: 14px;
  overflow: auto;
}

.empty {
  color: var(--muted);
  margin: 0;
}

.status-list {
  display: grid;
  gap: 10px;
}

.status-groups {
  display: grid;
  gap: 16px;
}

.status-group {
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 16px;
  position: relative;
  overflow: hidden;
}

.status-group::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 6px;
  background: var(--green);
}

.status-group.status-aviso::before {
  background: repeating-linear-gradient(
    180deg,
    var(--gold),
    var(--gold) 10px,
    rgba(197, 139, 50, 0.45) 10px,
    rgba(197, 139, 50, 0.45) 18px
  );
}

.status-group.status-erro::before {
  background: var(--red);
}

.status-group.status-rodando::before {
  background: linear-gradient(180deg, var(--gold), var(--green));
}

.status-group-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
  margin-bottom: 12px;
}

.status-link {
  display: inline-block;
  margin-left: 8px;
  color: var(--green);
  font-weight: 700;
}

.status-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
}

.status-row p {
  grid-column: 1 / -1;
  color: var(--muted);
  margin: 0;
}

.status-main, .status-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.status-main small {
  display: block;
  color: var(--muted);
}

.status-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 5px rgba(197, 139, 50, 0.16);
}

.status-concluido .status-dot {
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(29, 91, 67, 0.14);
}

.status-erro .status-dot {
  background: var(--red);
  box-shadow: 0 0 0 5px rgba(143, 61, 43, 0.14);
}

.status-aviso .status-dot {
  background: var(--gold);
  box-shadow: 0 0 0 5px rgba(197, 139, 50, 0.16);
}

.status-rodando .status-dot {
  animation: pulse 1.1s ease-in-out infinite;
}

.status-pill {
  border-radius: 999px;
  background: #efe3cf;
  padding: 5px 9px;
  color: var(--muted);
}

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0;
}

.timeline-item {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 10px;
  position: relative;
  padding: 8px 0;
}

.timeline-item:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 24px;
  bottom: -8px;
  width: 2px;
  background: var(--line);
}

.timeline-marker {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--gold);
  margin-top: 4px;
}

.timeline-item.status-concluido .timeline-marker {
  background: var(--green);
}

.timeline-item.status-erro .timeline-marker {
  background: var(--red);
}

.timeline-item.status-aviso .timeline-marker {
  background: var(--gold);
}

.status-aviso .status-pill {
  background: rgba(197, 139, 50, 0.18);
  color: #7b551a;
}

.timeline-item p {
  color: var(--muted);
  margin: 4px 0 0;
}

.live-strip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: #efe3cf;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--muted);
}

.live-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(29, 91, 67, 0.45);
  animation: live-pulse 1.5s infinite;
}

.timeline-item small {
  display: block;
  color: var(--muted);
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.25); opacity: 0.72; }
}

@keyframes live-pulse {
  0% { box-shadow: 0 0 0 0 rgba(29, 91, 67, 0.45); }
  70% { box-shadow: 0 0 0 9px rgba(29, 91, 67, 0); }
  100% { box-shadow: 0 0 0 0 rgba(29, 91, 67, 0); }
}

@media (max-width: 820px) {
  .hero, .split, .stats-grid, .facts {
    grid-template-columns: 1fr;
  }

  .topbar, .edition-row {
    align-items: flex-start;
    flex-direction: column;
  }

  h1 {
    font-size: clamp(2.2rem, 15vw, 4rem);
  }

  .search-row {
    flex-direction: column;
  }

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

  .status-group-head {
    flex-direction: column;
  }
}
