:root {
  --tp-bg: #ffffff;
  --tp-bg-soft: #fbf7fa;
  --tp-bg-tint: #f8eef4;
  --tp-text: #1d2440;
  --tp-text-strong: #11182f;
  --tp-text-muted: #7d7890;
  --tp-accent-red: #c72f55;
  --tp-accent-pink: #d84870;
  --tp-accent-blue: #132a83;
  --tp-accent-purple: #5d2b91;
  --tp-border: #eadde7;
  --tp-border-strong: #d8c5d3;
  --tp-card: #ffffff;
  --tp-card-soft: #fff8fb;
  --tp-gradient-main: linear-gradient(135deg, #d43762 0%, #7c2f91 48%, #122b82 100%);
  --tp-gradient-soft: linear-gradient(135deg, rgba(212, 55, 98, 0.12), rgba(18, 43, 130, 0.1));
  --tp-success-bg: #edf8f1;
  --tp-success-text: #20754a;
  --tp-success-border: #bfe7cf;
  --tp-warning-bg: #fff7e8;
  --tp-warning-text: #9a6415;
  --tp-warning-border: #f0d29a;
  --tp-error-bg: #fff0f3;
  --tp-error-text: #b42346;
  --tp-error-border: #f0b8c4;
  --tp-info-bg: #eef3ff;
  --tp-info-text: #183a91;
  --tp-info-border: #c8d6ff;
  --tp-neutral-bg: #f6f2f6;
  --tp-neutral-text: #6d6475;
  --tp-neutral-border: #e3d8e2;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--tp-bg);
}

body {
  margin: 0;
  font-family: Inter, Manrope, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--tp-text);
  background:
    radial-gradient(circle at 8% 0%, rgba(216, 72, 112, 0.08), transparent 30%),
    linear-gradient(180deg, #fff 0%, #fff 62%, #fbf7fa 100%);
}

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

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

.shell {
  width: min(1160px, calc(100% - 48px));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--tp-border);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
}

.brand-logo {
  font-weight: 800;
  letter-spacing: 0;
  color: var(--tp-accent-red);
}

.brand-product {
  color: var(--tp-text-muted);
  font-size: 14px;
  font-weight: 700;
}

.nav,
.actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.nav a {
  color: var(--tp-accent-blue);
  font-size: 14px;
  font-weight: 800;
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(380px, 480px);
  gap: 48px;
  align-items: center;
  padding: 76px 0 64px;
}

.bg-word {
  position: absolute;
  left: -20px;
  top: 42px;
  z-index: 0;
  color: rgba(199, 47, 85, 0.07);
  font-size: clamp(72px, 15vw, 180px);
  font-weight: 800;
  line-height: 0.8;
  pointer-events: none;
  user-select: none;
}

.hero-copy,
.input-card,
.page-heading,
.panel,
.summary-card,
.empty-state {
  position: relative;
  z-index: 1;
}

.eyebrow,
.card-kicker,
label > span,
dt,
.metric-card span {
  margin: 0;
  color: var(--tp-accent-blue);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.3;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  color: var(--tp-accent-red);
  font-weight: 800;
  letter-spacing: 0;
}

h1 {
  max-width: 760px;
  font-size: clamp(38px, 6vw, 72px);
  line-height: 0.98;
}

h2 {
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1;
}

.hero-subtitle,
.page-heading p,
.muted,
.helper {
  color: var(--tp-text-muted);
}

.hero-subtitle {
  max-width: 650px;
  margin: 24px 0;
  font-size: 18px;
}

.accent-line {
  width: 96px;
  height: 3px;
  margin-top: 24px;
  border-radius: 999px;
  background: var(--tp-gradient-main);
}

.input-card,
.summary-card,
.panel,
.empty-state {
  border: 1px solid var(--tp-border);
  border-radius: 28px;
  background: var(--tp-card);
  box-shadow: 0 24px 80px rgba(29, 36, 64, 0.08);
}

.input-card {
  display: grid;
  gap: 18px;
  padding: 28px;
}

.form-head {
  display: grid;
  gap: 8px;
}

.field,
.summary-meta div,
.details-grid div {
  display: grid;
  gap: 8px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field-grid--three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.input,
.textarea,
.select {
  width: 100%;
  border: 1px solid var(--tp-border-strong);
  border-radius: 18px;
  background: #fff;
  color: var(--tp-text);
  outline: none;
  padding: 14px 16px;
  font-size: 15px;
  line-height: 1.5;
}

.textarea {
  min-height: 154px;
  resize: vertical;
}

.input:focus,
.textarea:focus,
.select:focus {
  border-color: var(--tp-accent-red);
  box-shadow: 0 0 0 4px rgba(199, 47, 85, 0.12);
}

.textarea::placeholder {
  color: #b7a8b7;
}

.helper {
  margin: -6px 0 0;
  font-size: 14px;
}

.mode-notes {
  display: grid;
  gap: 10px;
}

.alert {
  border-radius: 18px;
  padding: 14px 16px;
  font-size: 14px;
}

.alert-info {
  border: 1px solid var(--tp-info-border);
  background: var(--tp-info-bg);
  color: var(--tp-info-text);
}

.alert-warning {
  border: 1px solid var(--tp-warning-border);
  background: var(--tp-warning-bg);
  color: var(--tp-warning-text);
}

.alert-error {
  border: 1px solid var(--tp-error-border);
  background: var(--tp-error-bg);
  color: var(--tp-error-text);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: 999px;
  padding: 12px 20px;
  font-weight: 800;
  line-height: 1;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
  cursor: pointer;
}

.btn-primary {
  border: 0;
  background: var(--tp-gradient-main);
  color: #fff;
  box-shadow: 0 14px 34px rgba(122, 47, 145, 0.22);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 42px rgba(122, 47, 145, 0.28);
}

.btn-secondary {
  border: 1px solid var(--tp-border-strong);
  background: #fff;
  color: var(--tp-accent-blue);
}

.btn-small {
  min-height: 36px;
  padding: 9px 14px;
  font-size: 13px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: max-content;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.03em;
  line-height: 1;
  text-transform: uppercase;
}

.badge--neutral,
.badge--queued {
  border: 1px solid var(--tp-neutral-border);
  background: var(--tp-neutral-bg);
  color: var(--tp-neutral-text);
}

.badge--running {
  border: 1px solid var(--tp-info-border);
  background: var(--tp-info-bg);
  color: var(--tp-info-text);
}

.badge--done {
  border: 1px solid var(--tp-success-border);
  background: var(--tp-success-bg);
  color: var(--tp-success-text);
}

.badge--failed {
  border: 1px solid var(--tp-error-border);
  background: var(--tp-error-bg);
  color: var(--tp-error-text);
}

.page-stack {
  display: grid;
  gap: 28px;
  padding: 54px 0 64px;
}

.page-heading,
.summary-card,
.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.page-heading h1,
.summary-card h1 {
  margin: 8px 0 14px;
}

.panel,
.empty-state {
  padding: 24px;
}

.empty-state {
  display: grid;
  justify-items: start;
  gap: 14px;
  background: linear-gradient(135deg, #fff, var(--tp-card-soft));
}

.summary-card {
  display: grid;
  gap: 24px;
  padding: 28px;
}

.result-summary {
  gap: 22px;
}

.summary-main {
  display: grid;
  gap: 10px;
}

.result-note,
.section-subtitle {
  max-width: 760px;
  margin: 0;
  color: var(--tp-text-muted);
}

.summary-meta,
.details-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.summary-meta--user {
  grid-template-columns: 2fr 1fr 1fr;
}

.summary-meta span,
dt {
  color: var(--tp-text-muted);
}

.summary-meta strong,
dd {
  margin: 0;
  color: var(--tp-text-strong);
  overflow-wrap: anywhere;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
}

.metrics-grid--primary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric-card {
  display: grid;
  gap: 8px;
  border: 1px solid var(--tp-border);
  border-radius: 22px;
  background: #fff;
  padding: 18px;
}

.metric-card strong {
  color: var(--tp-accent-red);
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
}

.section-head {
  margin-bottom: 18px;
}

.result-panel {
  display: grid;
  gap: 18px;
}

.result-panel .section-head {
  margin-bottom: 0;
}

.section-title {
  margin-top: 6px;
  font-size: clamp(26px, 3vw, 38px);
  line-height: 1.08;
}

.frequency-note {
  display: grid;
  gap: 4px;
  border: 1px solid var(--tp-info-border);
  border-radius: 18px;
  background: var(--tp-info-bg);
  color: var(--tp-info-text);
  padding: 14px 16px;
}

.frequency-note span {
  font-weight: 800;
}

.frequency-note small {
  color: var(--tp-info-text);
  line-height: 1.45;
}

.file-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.file-grid--technical {
  margin-top: 14px;
}

.file-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--tp-border);
  border-radius: 18px;
  background: #fff;
  padding: 12px 14px;
}

.file-pill span {
  display: grid;
  gap: 2px;
}

.file-pill small {
  color: var(--tp-text-muted);
}

.file-pill em {
  color: var(--tp-accent-blue);
  font-size: 13px;
  font-style: normal;
  font-weight: 800;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--tp-border);
  border-radius: 22px;
  background: #fff;
}

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

th {
  border-bottom: 1px solid var(--tp-border);
  background: var(--tp-bg-soft);
  color: var(--tp-accent-blue);
  padding: 13px 14px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-align: left;
  text-transform: uppercase;
}

td {
  border-bottom: 1px solid var(--tp-border);
  padding: 13px 14px;
  color: var(--tp-text);
  font-size: 14px;
  line-height: 1.45;
  vertical-align: top;
}

tr:last-child td {
  border-bottom: 0;
}

.wide-cell {
  max-width: 340px;
  overflow-wrap: anywhere;
}

.num {
  text-align: right;
  white-space: nowrap;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
}

.score-pill {
  display: inline-flex;
  border-radius: 999px;
  background: var(--tp-gradient-soft);
  color: var(--tp-accent-blue);
  padding: 4px 9px;
  font-weight: 800;
}

.brief-preview {
  max-height: 520px;
  overflow: auto;
  border: 1px solid var(--tp-border);
  border-radius: 18px;
  background: #fff;
  color: var(--tp-text);
  padding: 18px;
  white-space: pre-wrap;
}

.details-panel {
  background: var(--tp-card-soft);
}

.debug-details {
  border: 1px solid var(--tp-border);
  border-radius: 22px;
  background: var(--tp-card-soft);
  padding: 18px 20px;
}

.debug-details summary {
  color: var(--tp-accent-blue);
  font-weight: 800;
  cursor: pointer;
}

.debug-details[open] summary {
  margin-bottom: 16px;
}

.file-details {
  margin-top: 18px;
  background: #fff;
}

.details-wide {
  grid-column: 1 / -1;
}

.error-text {
  color: var(--tp-error-text);
}

.site-footer {
  border-top: 1px solid var(--tp-border);
  color: var(--tp-text-muted);
  padding: 24px 0;
  font-size: 13px;
}

@media (max-width: 920px) {
  .hero,
  .field-grid,
  .field-grid--three,
  .file-grid {
    grid-template-columns: 1fr;
  }

  .summary-meta,
  .summary-meta--user,
  .details-grid,
  .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .shell {
    width: min(100% - 32px, 1160px);
  }

  .header-inner,
  .brand,
  .page-heading,
  .summary-card,
  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .nav,
  .actions {
    align-items: stretch;
  }

  .nav a,
  .btn {
    width: 100%;
  }

  .hero {
    padding: 46px 0;
  }

  .input-card,
  .summary-card,
  .panel,
  .empty-state {
    border-radius: 22px;
    padding: 20px;
  }

  .summary-meta,
  .summary-meta--user,
  .details-grid,
  .metrics-grid {
    grid-template-columns: 1fr;
  }
}
