body {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  color: #223144;
  background:
    radial-gradient(circle at top left, rgba(175, 212, 224, 0.5), transparent 30%),
    radial-gradient(circle at top right, rgba(241, 214, 176, 0.45), transparent 28%),
    #f8f2e6;
}

a {
  color: #0f6b8b;
}

.page {
  width: min(1180px, calc(100% - 48px));
  margin: 36px auto;
}

.shell {
  display: grid;
  gap: 24px;
  grid-template-columns: 300px 1fr;
  align-items: start;
}

.panel {
  background: rgba(255, 251, 244, 0.86);
  border: 1px solid rgba(214, 198, 168, 0.82);
  border-radius: 28px;
  padding: 28px;
  box-shadow: 0 28px 60px rgba(146, 125, 85, 0.12);
}

.hero-title,
.section-title {
  margin: 0 0 16px;
  color: #263244;
}

.hero-title {
  font-size: 3rem;
  line-height: 0.95;
}

.lede {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.55;
  color: #53657d;
}

.card-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-top: 28px;
}

.stat-card {
  padding: 18px 20px;
  border-radius: 20px;
  background: #fff;
  border: 1px solid rgba(214, 198, 168, 0.82);
}

.stat-card h3,
.path-card h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.8rem;
  color: #6a7c94;
}

.status-ok {
  color: #1d6d4a;
  font-weight: 700;
}

.status-warn {
  color: #9b5e13;
  font-weight: 700;
}

.path-list {
  display: grid;
  gap: 14px;
}

.entity-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  align-items: start;
}

.run-grid {
  display: grid;
  gap: 16px;
}

.entity-panel {
  padding-top: 22px;
  padding-bottom: 24px;
}

.entity-panel .section-title {
  margin-bottom: 14px;
}

.entity-panel .entity-grid {
  margin-top: 4px;
}

.path-card {
  padding: 18px 20px;
  border-radius: 18px;
  background: #fff;
  border: 1px solid rgba(214, 198, 168, 0.82);
}

.path-card code {
  display: block;
  margin-top: 6px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #f5efe2;
  overflow-wrap: anywhere;
}

.archive-search-form {
  display: grid;
  gap: 16px;
  grid-template-columns: 2fr minmax(220px, 320px) auto;
  align-items: end;
}

.archive-search-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 2px;
}

.archive-search-summary {
  margin: 14px 0 18px;
}

.archive-browser-layout {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  align-items: start;
}

.archive-result-list {
  display: grid;
  gap: 12px;
}

.archive-result-card {
  display: grid;
  gap: 8px;
  text-decoration: none;
  color: inherit;
  padding: 16px 18px;
  border-radius: 18px;
  background: #fff;
  border: 1px solid rgba(214, 198, 168, 0.82);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.archive-result-card:hover {
  border-color: rgba(15, 107, 139, 0.45);
  box-shadow: 0 14px 28px rgba(146, 125, 85, 0.1);
  transform: translateY(-1px);
}

.archive-result-card-active {
  border-color: rgba(15, 107, 139, 0.55);
  box-shadow: 0 16px 32px rgba(15, 107, 139, 0.1);
}

.archive-result-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  flex-wrap: wrap;
}

.archive-result-source,
.archive-result-date,
.archive-result-from {
  color: #607289;
  font-size: 0.94rem;
}

.archive-result-subject {
  font-size: 1.05rem;
  font-weight: 700;
  color: #223144;
}

.archive-result-excerpt {
  color: #41536c;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.archive-detail-panel {
  position: sticky;
  top: 24px;
}

.archive-detail-card {
  display: grid;
  gap: 16px;
}

.archive-detail-head {
  display: flex;
  gap: 16px;
  justify-content: space-between;
  align-items: flex-start;
}

.archive-detail-head h3 {
  margin-bottom: 0;
}

.archive-detail-meta {
  display: grid;
  gap: 8px 16px;
  grid-template-columns: 1fr;
}

.archive-detail-meta-extended {
  margin-top: 12px;
}

.archive-body-preview {
  padding: 14px 16px;
  border-radius: 16px;
  background: #fdfaf4;
  border: 1px solid rgba(214, 198, 168, 0.82);
  line-height: 1.6;
  color: #223144;
  white-space: pre-wrap;
  word-break: break-word;
}

.archive-raw-preview {
  margin: 12px 0 0;
  padding: 14px 16px;
  border-radius: 16px;
  background: #f5efe2;
  border: 1px solid rgba(214, 198, 168, 0.82);
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.92rem;
  line-height: 1.45;
}

.archive-hash,
.archive-path {
  overflow-wrap: anywhere;
}

.action-list {
  margin: 0;
  padding-left: 20px;
  line-height: 1.7;
}

.form-stack {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 8px;
}

.field label {
  font-weight: 700;
  color: #41536c;
}

.field input {
  padding: 15px 18px;
  border-radius: 18px;
  border: 1px solid rgba(214, 198, 168, 0.95);
  background: rgba(232, 241, 255, 0.75);
  font-size: 1rem;
}

.field select,
.binding-form select {
  padding: 13px 16px;
  border-radius: 16px;
  border: 1px solid rgba(214, 198, 168, 0.95);
  background: rgba(232, 241, 255, 0.75);
  font-size: 0.98rem;
  color: #223144;
}

.button,
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 20px;
  border-radius: 18px;
  border: 1px solid #0b708f;
  background: linear-gradient(135deg, #0b7695, #12607f);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
}

.button-link {
  width: fit-content;
}

.button-secondary {
  border-color: rgba(214, 198, 168, 0.95);
  background: #fff;
  color: #223144;
}

.inline-form {
  margin-top: 12px;
}

.source-flags {
  margin: 12px 0 0;
}

.source-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
  align-items: center;
}

.binding-box {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  background: #f9f4ea;
  border: 1px solid rgba(214, 198, 168, 0.7);
}

.binding-label {
  margin: 0 0 10px;
}

.binding-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.flash-list {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1200;
  display: grid;
  gap: 10px;
  width: min(420px, calc(100vw - 32px));
  pointer-events: none;
}

.flash {
  pointer-events: auto;
  padding: 14px 16px;
  border-radius: 16px;
  font-weight: 600;
  box-shadow: 0 20px 44px rgba(34, 49, 68, 0.18);
  border: 1px solid rgba(214, 198, 168, 0.95);
  transition: opacity 0.24s ease, transform 0.24s ease;
}

.flash-success {
  background: rgba(214, 243, 224, 0.88);
  color: #1d6d4a;
}

.flash-error {
  background: rgba(248, 219, 210, 0.9);
  color: #8d3122;
}

.flash-hidden {
  opacity: 0;
  transform: translateY(8px);
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 22px;
}

.topbar h1 {
  margin: 0;
  font-size: 2.25rem;
}

.compact-topbar {
  margin-bottom: 16px;
}

.compact-topbar .section-title {
  margin-bottom: 6px;
}

.meta-line {
  color: #607289;
  font-size: 0.95rem;
  line-height: 1.45;
}

.run-card {
  display: grid;
  gap: 14px;
}

.run-card-header,
.run-source-header {
  display: flex;
  gap: 16px;
  justify-content: space-between;
  align-items: flex-start;
}

.run-card-header h3 {
  margin-bottom: 4px;
}

.run-uuid {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 700;
  background: #f5efe2;
  border: 1px solid rgba(214, 198, 168, 0.95);
  white-space: nowrap;
}

.status-pill.status-ok {
  background: rgba(214, 243, 224, 0.88);
}

.status-pill.status-warn {
  background: rgba(248, 233, 207, 0.95);
}

.run-metrics,
.run-source-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.metric-pill {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: #f5efe2;
  border: 1px solid rgba(214, 198, 168, 0.82);
  font-size: 0.92rem;
  color: #41536c;
}

.run-meta-grid {
  display: grid;
  gap: 8px 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.run-error {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(248, 219, 210, 0.55);
  border: 1px solid rgba(201, 135, 117, 0.45);
  color: #8d3122;
  font-weight: 600;
}

.run-error-inline {
  margin-top: 8px;
}

.run-details {
  border-top: 1px solid rgba(214, 198, 168, 0.6);
  padding-top: 12px;
}

.run-details summary {
  cursor: pointer;
  font-weight: 700;
  color: #223144;
}

.run-source-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.run-source-card {
  padding: 14px 16px;
  border-radius: 16px;
  background: #fdfaf4;
  border: 1px solid rgba(214, 198, 168, 0.75);
}

.logout-form {
  margin: 0;
}

.forms-shell {
  grid-template-columns: 1fr 1fr;
}

.single-shell {
  grid-template-columns: 1fr;
}

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

  .archive-search-form,
  .archive-browser-layout {
    grid-template-columns: 1fr;
  }

  .archive-search-actions {
    justify-content: flex-start;
    padding-bottom: 0;
  }

  .archive-detail-panel {
    position: static;
  }

  .hero-title {
    font-size: 2.5rem;
  }

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

  .flash-list {
    right: 16px;
    left: 16px;
    bottom: 16px;
    width: auto;
  }
}
