:root {
  --bg: #f2efe7;
  --ink: #19140f;
  --card: #fffaf2;
  --line: #d6c4ac;
  --accent: #cf4a1a;
  --ok: #286c42;
  --bad: #8d2f1f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 20% 15%, #ffcf8e 0%, transparent 25%),
    radial-gradient(circle at 80% 0%, #ffd7bc 0%, transparent 20%),
    var(--bg);
}

.shell {
  width: min(1120px, 92vw);
  margin: 2rem auto 3rem;
}

.hero {
  padding: 1.5rem;
  border: 2px solid var(--line);
  background: var(--card);
  border-radius: 16px;
}

.hero h1 {
  margin: 0;
  font-size: clamp(1.4rem, 2.4vw, 2.2rem);
}

.hero button {
  margin-top: 0.8rem;
  border: 0;
  background: var(--accent);
  color: #fff;
  padding: 0.65rem 1rem;
  border-radius: 10px;
  cursor: pointer;
}

.hero-actions {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.hero-actions button {
  margin-top: 0.8rem;
}

.auto-refresh-note {
  margin-top: 0.5rem;
  margin-bottom: 0.2rem;
  font-size: 0.92rem;
  opacity: 0.85;
}

.prompt-editor textarea {
  width: 100%;
  margin-top: 0.75rem;
  border: 2px solid var(--line);
  border-radius: 10px;
  padding: 0.75rem;
  font-family: "Space Grotesk", sans-serif;
  background: #fff;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(25, 20, 15, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 30;
  overflow-y: auto;
}

.modal-backdrop.open {
  display: flex;
}

.modal-card {
  width: min(860px, 96vw);
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
  box-shadow: 0 20px 46px rgba(0, 0, 0, 0.23);
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
}

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

.modal-header h2 {
  margin: 0;
}

.modal-close {
  margin-top: 0;
  min-width: 36px;
  min-height: 36px;
  border-radius: 999px;
  background: #4d392c;
  color: #fff;
}

.modal-card textarea {
  width: 100%;
  margin-top: 0.75rem;
  border: 2px solid var(--line);
  border-radius: 10px;
  padding: 0.75rem;
  font-family: "Space Grotesk", sans-serif;
  background: #fff;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
}

.poll-status {
  margin-top: 1rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.3rem 1rem;
}

.poll-error {
  color: var(--bad);
}

.poll-history {
  margin-top: 0.8rem;
  display: grid;
  gap: 0.45rem;
}

.poll-row {
  display: grid;
  grid-template-columns: 62px 1fr 90px 90px 52px;
  gap: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.45rem 0.55rem;
  background: #fff;
  font-size: 0.9rem;
}

.cards {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
}

.card {
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
  animation: rise 400ms ease;
}

.card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.card h2 {
  margin: 0;
  font-size: 1.05rem;
}

.status {
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  font-size: 0.8rem;
  background: #eee;
}

.status-sent {
  background: #d6f7e3;
  color: var(--ok);
}

.status-rejected {
  background: #ffe2de;
  color: var(--bad);
}

.actions {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.6rem;
}

.card-links {
  display: flex;
  gap: 0.55rem;
  margin: 0.7rem 0;
  flex-wrap: wrap;
}

.link-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 9px;
  padding: 0.45rem 0.65rem;
  cursor: pointer;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.88rem;
}

.link-button:hover {
  background: #f6e6d2;
}

.actions button {
  border: 0;
  border-radius: 10px;
  padding: 0.55rem 0.8rem;
  cursor: pointer;
}

.actions .send {
  background: var(--ok);
  color: white;
}

.actions .reject {
  background: var(--bad);
  color: white;
}

pre {
  white-space: pre-wrap;
  background: #f7e8d5;
  padding: 0.75rem;
  border-radius: 10px;
}

.project-modal-card {
  width: min(980px, 97vw);
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
}

@keyframes rise {
  from {
    transform: translateY(12px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
