:root {
  --bg: #050505;
  --panel: #101010;
  --panel-2: #171717;
  --ink: #f5f5f5;
  --muted: #b3b3b3;
  --line: #2a2a2a;
  --brand: #ef4444;
  --brand-dark: #991b1b;
  --accent: #7f1d1d;
  --danger: #f87171;
  --safe: #e5e7eb;
  --shadow: 0 26px 60px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "IBM Plex Sans", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top right, rgba(239, 68, 68, 0.18), transparent 24%),
    radial-gradient(circle at top left, rgba(127, 29, 29, 0.22), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 40%),
    var(--bg);
}

.page-shell {
  width: min(1240px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  padding: 36px;
  border-radius: 28px;
  background:
    radial-gradient(circle at top right, rgba(248, 113, 113, 0.24), transparent 24%),
    linear-gradient(135deg, #090909, #140909 55%, #3f0a0a);
  color: white;
  box-shadow: var(--shadow);
  border: 1px solid rgba(248, 113, 113, 0.16);
}

.hero h1,
.panel h2,
.panel h3 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
}

.eyebrow,
.section-kicker,
.chat-role,
.hero-card span {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  font-weight: 700;
}

.subtitle {
  max-width: 720px;
  margin: 12px 0 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 1.05rem;
}

.hero-card {
  min-width: 180px;
  padding: 20px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(248, 113, 113, 0.16);
  backdrop-filter: blur(10px);
}

.hero-card strong {
  display: block;
  margin-top: 6px;
  font-size: 3rem;
  line-height: 1;
}

.hero-card small {
  display: block;
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.82);
}

.tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 24px 0;
}

.tab-bar a,
.ghost-button,
.suggestion-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid rgba(248, 113, 113, 0.12);
  text-decoration: none;
  color: var(--ink);
  background: rgba(16, 16, 16, 0.82);
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.tab-bar a:hover,
.ghost-button:hover,
.suggestion-button:hover,
button:hover {
  transform: translateY(-1px);
}

.tab-bar .is-active {
  background: linear-gradient(135deg, rgba(127, 29, 29, 0.88), rgba(239, 68, 68, 0.78));
  border-color: rgba(248, 113, 113, 0.4);
}

.content-grid {
  display: grid;
  gap: 20px;
}

.panel {
  padding: 24px;
  border-radius: 24px;
  background: var(--panel);
  box-shadow: var(--shadow);
  border: 1px solid rgba(248, 113, 113, 0.08);
}

.panel-wide {
  padding-bottom: 28px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: start;
  margin-bottom: 20px;
}

.section-kicker {
  margin: 0 0 6px;
  color: var(--brand);
}

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

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

label {
  display: grid;
  gap: 8px;
  font-size: 0.95rem;
  color: var(--muted);
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #151515;
  color: var(--ink);
}

input:focus,
select:focus,
textarea:focus {
  outline: 1px solid rgba(248, 113, 113, 0.6);
  border-color: rgba(248, 113, 113, 0.6);
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.08);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 28px;
}

.checkbox-row input {
  width: auto;
}

.form-actions {
  display: flex;
  align-items: end;
}

button {
  border: none;
  border-radius: 16px;
  padding: 12px 18px;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  color: white;
  cursor: pointer;
}

.ghost-button {
  border: 1px solid var(--line);
  background: #161616;
}

.alert {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 16px;
}

.alert.error {
  background: rgba(127, 29, 29, 0.22);
  color: #fecaca;
  border: 1px solid rgba(248, 113, 113, 0.24);
}

.analysis-shell {
  margin-top: 20px;
  display: grid;
  gap: 18px;
}

.score-card {
  padding: 18px;
  border-radius: 22px;
}

.score-card span,
.score-card small {
  display: block;
}

.score-card strong {
  display: block;
  font-size: 3rem;
  line-height: 1;
  margin: 10px 0 6px;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.pill,
.chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 700;
}

.chip {
  background: #2b1111;
  color: #fecaca;
}

.chip-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.two-col {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.signal-list {
  margin: 0;
  padding-left: 18px;
}

.signal-list.danger li {
  color: var(--danger);
}

.signal-list.safe li {
  color: var(--safe);
}

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

.stats-grid article {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel-2);
}

.stats-grid span,
.stats-grid small {
  display: block;
  color: var(--muted);
}

.stats-grid strong {
  display: block;
  margin-top: 8px;
  font-size: 1.8rem;
}

.table-shell {
  margin-top: 20px;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 700px;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 0.85rem;
}

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

.chart-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #111111;
  min-height: 320px;
  padding: 8px;
}

.empty-state {
  padding: 18px;
  border-radius: 18px;
  border: 1px dashed #3f3f46;
  background: #121212;
  color: var(--muted);
}

.suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.suggestions form {
  margin: 0;
}

.chat-shell {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.chat-bubble {
  padding: 16px;
  border-radius: 20px;
}

.chat-bubble.user {
  background: #2b1111;
}

.chat-bubble.assistant {
  background: #151515;
  border: 1px solid rgba(248, 113, 113, 0.08);
}

details summary {
  cursor: pointer;
  color: #fca5a5;
}

.chat-bubble p {
  margin: 8px 0 0;
  white-space: pre-wrap;
}

.rag-form {
  display: grid;
  gap: 12px;
}

details {
  margin-top: 10px;
}

@media (max-width: 768px) {
  .page-shell {
    width: min(100vw - 20px, 1240px);
  }

  .hero {
    padding: 24px;
    align-items: start;
    flex-direction: column;
  }

  .panel {
    padding: 18px;
  }
}
