:root {
  --bg: #eef2ff;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #4f46e5;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 0%, rgba(79,70,229,.18), transparent 32%),
    radial-gradient(circle at 90% 20%, rgba(15,118,110,.14), transparent 30%),
    linear-gradient(180deg, #f8fafc, #eef2ff);
}

.app { min-height: 100vh; padding-bottom: 84px; }
.topbar { padding: 18px 18px 8px; }
.brand { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.brand h1 { margin: 0; font-size: 22px; letter-spacing: -.03em; }

.status, .hero-badge {
  display: inline-flex;
  width: fit-content;
  border-radius: 999px;
  padding: 6px 9px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .04em;
  color: var(--accent);
  background: rgba(79,70,229,.10);
  border: 1px solid rgba(79,70,229,.16);
}

main { padding: 8px 16px 24px; }

.card {
  background: rgba(255,255,255,.90);
  border: 1px solid rgba(148,163,184,.25);
  border-radius: 24px;
  padding: 18px;
  box-shadow: 0 18px 50px rgba(15,23,42,.08);
  overflow: hidden;
}

.card h2 { margin: 8px 0 8px; font-size: 24px; letter-spacing: -.03em; }
.card p { color: var(--muted); line-height: 1.45; }

.settings-label {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.settings-label span,
.query-controls label span,
.footer-label {
  font-size: 11px;
  font-weight: 900;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .07em;
}

textarea, input, select {
  width: 100%;
  border: 1px solid rgba(148,163,184,.35);
  border-radius: 16px;
  padding: 13px;
  background: rgba(255,255,255,.96);
  color: var(--text);
  font-size: 15px;
}

textarea { min-height: 118px; resize: vertical; }

.row, .button-row { display: flex; flex-wrap: wrap; gap: 10px; }

button {
  border: 0;
  border-radius: 999px;
  padding: 11px 14px;
  background: var(--accent);
  color: white;
  font-weight: 900;
  font-size: 14px;
}

button.ghost, button.secondary {
  background: rgba(15,23,42,.06);
  color: var(--text);
  border: 1px solid rgba(148,163,184,.24);
}

.nav {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  padding: 8px;
  border-radius: 22px;
  background: rgba(255,255,255,.92);
  box-shadow: 0 14px 40px rgba(15,23,42,.18);
  backdrop-filter: blur(14px);
}

.nav button {
  padding: 10px 4px;
  font-size: 11px;
  background: transparent;
  color: var(--muted);
  border-radius: 16px;
}

.nav button.active {
  background: rgba(79,70,229,.12);
  color: var(--accent);
}

.query-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

.query-controls label { display: grid; gap: 6px; }

.privacy-warning {
  margin: 12px 0;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(245,158,11,.10);
  border: 1px solid rgba(245,158,11,.22);
  color: #78350f;
  font-size: 13px;
  line-height: 1.4;
}

.query-output { margin-top: 16px; overflow-x: hidden; }

/* PM_PROGRESS_CSS_BEGIN */
.pm-progress-card {
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,250,252,.96));
  border: 1px solid rgba(148,163,184,.28);
  border-radius: 22px;
  padding: 16px;
  box-shadow: 0 16px 42px rgba(15,23,42,.08);
}

.pm-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.pm-progress-head strong {
  font-size: 15px;
}

.pm-progress-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.pm-progress-bar {
  position: relative;
  width: 100%;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(148,163,184,.22);
}

.pm-progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 45%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(79,70,229,.85), rgba(15,118,110,.85));
  animation: pmProgressSlide 1.25s ease-in-out infinite;
}

@keyframes pmProgressSlide {
  0% { transform: translateX(-110%); }
  50% { transform: translateX(80%); }
  100% { transform: translateX(230%); }
}

.pm-progress-stage {
  margin-top: 12px;
  font-weight: 900;
  color: var(--text);
  line-height: 1.35;
}

.pm-progress-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 12px;
}

.pm-progress-steps span {
  text-align: center;
  border-radius: 999px;
  padding: 6px 4px;
  background: rgba(79,70,229,.08);
  color: var(--accent);
  font-size: 11px;
  font-weight: 900;
}

.pm-progress-note {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}
/* PM_PROGRESS_CSS_END */


pre {
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.report-page {
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,250,252,.96));
  border: 1px solid rgba(148,163,184,.28);
  border-radius: 24px;
  padding: 20px;
  box-shadow: 0 18px 48px rgba(15,23,42,.10);
  overflow: hidden;
}

.report-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(148,163,184,.28);
}

.kicker {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .10em;
  color: var(--accent);
  font-weight: 900;
}

.report-header h2 { margin: 4px 0 0; font-size: 24px; letter-spacing: -.03em; }

.stamp {
  max-width: 45%;
  border: 1px solid rgba(15,118,110,.22);
  background: rgba(240,253,250,.90);
  color: #0f766e;
  border-radius: 999px;
  padding: 8px 11px;
  font-size: 12px;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.report-body { padding: 16px 0 4px; font-size: 16px; line-height: 1.58; }
.report-body p { margin: 0 0 12px; overflow-wrap: anywhere; }
.bullet { margin: 8px 0; line-height: 1.5; overflow-wrap: anywhere; }

.report-footer {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(148,163,184,.28);
  display: grid;
  gap: 10px;
}

.candidate-buttons { display: flex; flex-wrap: wrap; gap: 8px; }

.candidate-panel {
  display: grid;
  gap: 10px;
}

.candidate-grid-caption {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.candidate-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
  align-items: center;
}

.candidate-detail-actions button {
  padding: 9px 12px;
  font-size: 12px;
}


.candidate-btn {
  border: 1px solid rgba(15,118,110,.22);
  background: rgba(15,118,110,.08);
  color: #0f766e;
  border-radius: 16px;
  padding: 8px 11px;
  font-size: 12px;
  font-weight: 900;
  display: grid;
  gap: 2px;
  min-width: 94px;
  text-align: left;
}

.candidate-key {
  font-size: 13px;
  line-height: 1.1;
}

.candidate-date-small {
  font-size: 10px;
  color: rgba(15,118,110,.82);
  line-height: 1.15;
  font-weight: 800;
}

.candidate-btn.used {
  background: rgba(79,70,229,.10);
  color: var(--accent);
  border-color: rgba(79,70,229,.24);
}

.candidate-btn.active {
  background: #0f766e;
  color: white;
  border-color: #0f766e;
}

.candidate-card {
  margin-top: 12px;
  background: rgba(255,255,255,.92);
  border: 1px solid rgba(148,163,184,.30);
  border-radius: 18px;
  padding: 14px;
  overflow: hidden;
}

.candidate-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.candidate-head span,
.candidate-reasons,
.report-note,
.muted,
.retrieval-details {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.candidate-subject {
  font-weight: 900;
  margin-bottom: 10px;
  overflow-wrap: anywhere;
}

.candidate-meta {
  display: grid;
  gap: 5px;
  margin: 8px 0 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(15,118,110,.07);
  border: 1px solid rgba(15,118,110,.16);
  color: #0f766e;
  font-size: 12px;
  line-height: 1.35;
}

.candidate-meta span { overflow-wrap: anywhere; }

.candidate-body { font-size: 14px; line-height: 1.48; overflow-wrap: anywhere; }

.retrieval-summary {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(15,118,110,.08);
  border: 1px solid rgba(15,118,110,.16);
  color: #0f766e;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.retrieval-details summary { cursor: pointer; font-weight: 900; }
.retrieval-details div { margin-top: 6px; line-height: 1.35; }

.item {
  background: rgba(255,255,255,.85);
  border: 1px solid rgba(148,163,184,.24);
  border-radius: 18px;
  padding: 14px;
  margin-top: 12px;
}

@media (max-width: 520px) {
  .query-controls { grid-template-columns: 1fr; }
  .report-header { display: grid; gap: 10px; }
  .stamp { max-width: 100%; width: fit-content; }
  .report-page { padding: 16px; border-radius: 20px; }
  .report-body { font-size: 15px; }
}
