.audit-page {
  background:
    radial-gradient(circle at top left, rgba(124, 58, 237, 0.13), transparent 32%),
    radial-gradient(circle at top right, rgba(236, 72, 153, 0.1), transparent 28%),
    linear-gradient(180deg, #f8faff 0%, #ffffff 100%);
}

.td-audit-page {
  padding: 9.5rem 0 4rem;
}

.td-audit-hero-shell,
.td-audit-app,
.td-audit-overview-card,
.td-audit-panel,
.td-audit-history {
  border: 1px solid rgba(99, 102, 241, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 255, 0.9));
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.08);
  border-radius: 36px;
}

.td-audit-hero-shell {
  padding: 1.45rem;
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
}

.td-audit-hero-copy,
.td-audit-form-card,
.td-audit-progress-card {
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,250,255,0.9));
  border: 1px solid rgba(99, 102, 241, 0.08);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.88);
}

.td-audit-hero-copy {
  padding: 2.5rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.td-audit-kicker,
.td-audit-mini-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  background: rgba(124, 58, 237, 0.08);
  color: #7c3aed;
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.td-audit-hero-copy h1 {
  margin: 1rem 0 0.9rem;
  font-size: clamp(2.65rem, 5vw, 5rem);
  line-height: 0.95;
  letter-spacing: -0.06em;
  color: #111827;
}

.td-audit-hero-copy p,
.td-audit-form-head p,
.td-audit-overview-card p,
.td-audit-side-card p,
.td-audit-status,
.td-audit-panel p {
  color: #60708b;
  font-size: 1rem;
  line-height: 1.7;
}

.td-audit-form-head h2,
.td-audit-panel h3 {
  display: block;
  margin-bottom: 0.6rem;
  color: #111827;
  font-size: 1.55rem;
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.td-audit-workspace {
  padding-top: 1.6rem;
}

.td-audit-app {
  display: grid;
  gap: 1rem;
  padding: 1.2rem;
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
  min-width: 0;
}

.td-audit-form-card,
.td-audit-progress-card {
  padding: 3rem 2rem;
}

.td-audit-form-head {
  text-align: center;
  margin-bottom: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.td-audit-form-head h2 {
  margin-top: 1.2rem;
}

.td-audit-form-head p {
  max-width: 38rem;
  margin: 0;
  color: #60708b;
  font-size: 1rem;
  line-height: 1.7;
}
.td-audit-form {
  display: grid;
  gap: 1rem;
}

.td-audit-input-wrap {
  display: grid;
  gap: 0.55rem;
  color: #192438;
  font-size: 0.9rem;
  font-weight: 700;
}

.td-audit-input-shell {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 72px;
  padding: 0 1rem 0 1.1rem;
  border-radius: 24px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(255,255,255,0.94);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.78);
}

.td-audit-input-shell svg {
  color: #7c3aed;
  flex: 0 0 auto;
}

.td-audit-input-shell input {
  width: 100%;
  border: 0;
  background: transparent;
  outline: none;
  color: #10182b;
  font-size: 1rem;
  font-weight: 700;
}


.td-audit-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.td-audit-submit,
.td-audit-pdf-btn {
  min-width: 220px;
}

.td-audit-status {
  margin: 0;
}

.td-audit-status-error {
  color: #b42318;
}

.td-audit-status-success {
  color: #0f766e;
}

.td-audit-progress-card[hidden],
.td-audit-results[hidden] {
  display: none !important;
}

.td-audit-progress-head {
  display: grid;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.td-audit-progress-head strong {
  color: #111827;
  font-size: 1.35rem;
  line-height: 1.2;
}

.td-audit-progress-bar {
  height: 14px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.07);
  overflow: hidden;
}

.td-audit-progress-value {
  width: 12%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #5b36f2, #8b5cf6, #ec4899);
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.35);
  animation: tdAuditProgress 2s ease-in-out infinite;
}

@keyframes tdAuditProgress {
  0% { transform: translateX(-20%); width: 20%; }
  50% { transform: translateX(180%); width: 38%; }
  100% { transform: translateX(420%); width: 20%; }
}

.td-audit-progress-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 1rem;
}

.td-audit-progress-steps span {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
}

.td-audit-list,
.td-audit-plan-list {
  margin: 1rem 0 0;
  padding-left: 1.15rem;
  display: grid;
  gap: 0.8rem;
  color: #334155;
}

.td-audit-results {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.td-audit-results-top {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.td-audit-overview-card {
  flex: 1 1 100%;
  padding: 1.5rem;
  min-width: 0;
  word-break: break-word;
}

.td-audit-overview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.95rem;
}

.td-audit-overview-head h2 {
  margin: 0 0 0.45rem;
  color: #111827;
  font-size: clamp(1.9rem, 4vw, 3rem);
  line-height: 1;
  letter-spacing: -0.06em;
}

.td-audit-score-orb {
  display: grid;
  place-items: center;
  width: 170px;
  min-height: 170px;
  padding: 1rem;
  border-radius: 32px;
  background: linear-gradient(160deg, rgba(91,54,242,0.12), rgba(236,72,153,0.12));
  border: 1px solid rgba(124, 58, 237, 0.14);
  text-align: center;
}

.td-audit-score-orb span {
  color: #64748b;
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.td-audit-score-orb strong {
  color: #111827;
  font-size: 3.35rem;
  line-height: 1;
  letter-spacing: -0.08em;
}

.td-audit-results-actions {
  display: flex;
  align-items: start;
}

.td-audit-source-note {
  margin-top: 1rem;
  padding: 0.95rem 1rem;
  border-radius: 20px;
  background: rgba(15, 23, 42, 0.04);
  color: #475569;
  font-size: 0.92rem;
}

.td-audit-score-grid,
.td-audit-grid-2,
.td-audit-grid-3,
.td-audit-metrics-grid,
.td-audit-history-list {
  display: grid;
  gap: 1rem;
}

.td-audit-score-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.td-audit-grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

.td-audit-metrics-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.td-audit-score-card,
.td-audit-metric-card,
.td-audit-history-item,
.td-audit-rec-item {
  border-radius: 24px;
  border: 1px solid rgba(99, 102, 241, 0.08);
  background: rgba(255,255,255,0.92);
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.04);
  min-width: 0;
  word-break: break-word;
}

.td-audit-score-card {
  padding: 1rem;
}

.td-audit-score-card span,
.td-audit-metric-card span {
  display: block;
  color: #64748b;
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.td-audit-score-card strong,
.td-audit-metric-card strong {
  display: block;
  margin-top: 0.7rem;
  color: #111827;
  font-size: 2.1rem;
  line-height: 1;
  letter-spacing: -0.07em;
}

.td-audit-score-bar {
  height: 10px;
  margin-top: 0.8rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
  overflow: hidden;
}

.td-audit-score-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #22c55e, #84cc16);
}

.td-audit-score-card[data-tone="medium"] .td-audit-score-bar i {
  background: linear-gradient(90deg, #f59e0b, #f97316);
}

.td-audit-score-card[data-tone="bad"] .td-audit-score-bar i {
  background: linear-gradient(90deg, #ef4444, #ec4899);
}

.td-audit-panel {
  padding: 1.35rem;
  min-width: 0;
  word-break: break-word;
}

.td-audit-panel-danger {
  background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(255,245,247,0.95));
}

.td-audit-recommendations {
  display: grid;
  gap: 0.85rem;
  margin-top: 1rem;
}

.td-audit-rec-item {
  padding: 1rem;
}

.td-audit-rec-item strong {
  display: block;
  margin-bottom: 0.45rem;
  color: #111827;
  font-size: 1rem;
}

.td-audit-rec-item p {
  margin: 0;
  color: #55657f;
  font-size: 0.94rem;
  line-height: 1.65;
}

.td-audit-rec-meta {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

.td-audit-priority {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.td-audit-priority-high { background: rgba(239,68,68,0.12); color: #b91c1c; }
.td-audit-priority-medium { background: rgba(245,158,11,0.14); color: #b45309; }
.td-audit-priority-low { background: rgba(34,197,94,0.12); color: #15803d; }

.td-audit-metric-card {
  padding: 1rem;
}

.td-audit-metric-card em {
  display: block;
  margin-top: 0.45rem;
  color: #64748b;
  font-style: normal;
  font-size: 0.92rem;
}

.td-audit-panel-cta {
  padding: 0 !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.td-audit-cta-banner {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: 3rem;
  align-items: center;
  padding: 3.5rem;
  border-radius: 36px;
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
  border: 1px solid rgba(99, 102, 241, 0.16);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.35);
  color: #ffffff;
  min-width: 0;
  word-break: break-word;
}

.td-audit-cta-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.td-audit-cta-info h3 {
  color: #ffffff;
  font-size: clamp(1.8rem, 3.5vw, 2.5rem);
  line-height: 1.15;
  letter-spacing: -0.05em;
  font-weight: 900;
  margin: 0.85rem 0 1.1rem;
}

.td-audit-cta-text {
  color: #94a3b8;
  font-size: 1.05rem;
  line-height: 1.65;
  margin: 0 0 2rem;
}

.td-audit-cta-contacts-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.6rem;
  width: 100%;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 1.8rem;
}

.td-audit-contact-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: #cbd5e1;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.22s ease;
}

.td-audit-contact-link svg {
  color: #818cf8;
  flex-shrink: 0;
  transition: transform 0.2s;
}

.td-audit-contact-link:hover {
  color: #a5b4fc;
}

.td-audit-contact-link:hover svg {
  transform: translateY(-2px);
  color: #c7d2fe;
}

.td-audit-cta-actions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
}

.td-audit-cta-actions .btn {
  width: 100% !important;
  min-height: 58px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.02rem;
  font-weight: 800;
  border-radius: 18px;
  transition: all 0.25s ease;
}

.td-audit-cta-actions .btn-primary {
  background: #5b36f2 !important;
  border-color: #5b36f2 !important;
  color: #ffffff !important;
  box-shadow: 0 8px 24px rgba(91, 54, 242, 0.35);
}

.td-audit-cta-actions .btn-primary:hover {
  background: #6d4aff !important;
  border-color: #6d4aff !important;
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(91, 54, 242, 0.45);
}

.td-audit-cta-actions .btn-secondary {
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  color: #ffffff !important;
}

.td-audit-cta-actions .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1) !important;
  border-color: rgba(255, 255, 255, 0.3) !important;
  transform: translateY(-2px);
}



@media (max-width: 1199px) {
  .td-audit-score-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .td-audit-grid-3 {
    grid-template-columns: 1fr;
  }

  .td-audit-cta-banner {
    grid-template-columns: 1fr;
    padding: 2.2rem;
    gap: 2.2rem;
    border-radius: 28px;
  }
}

@media (max-width: 991px) {
  .td-audit-page {
    padding-top: 8.8rem;
  }

  .td-audit-hero-shell,
  .td-audit-grid-2,
  .td-audit-overview-head {
    grid-template-columns: 1fr;
  }

  .td-audit-hero-shell,
  .td-audit-results-top {
    display: grid;
  }

  .td-audit-score-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .td-audit-form-head {
    display: grid;
  }

  .td-audit-results-actions {
    display: block;
  }
}

@media (max-width: 767px) {
  .td-audit-page {
    padding-top: 8rem;
  }

  .td-audit-hero-shell,
  .td-audit-app,
  .td-audit-overview-card,
  .td-audit-panel,
  .td-audit-form-card,
  .td-audit-progress-card {
    border-radius: 28px;
  }

  .td-audit-hero-copy,
  .td-audit-form-card,
  .td-audit-progress-card,
  .td-audit-overview-card,
  .td-audit-panel {
    padding: 1.15rem;
  }

  .td-audit-score-grid,
  .td-audit-metrics-grid {
    grid-template-columns: 1fr;
  }

  .td-audit-input-shell {
    min-height: 64px;
  }

  .td-audit-submit,
  .td-audit-pdf-btn,
  .td-audit-cta-links .btn {
    width: 100%;
  }

  .td-audit-score-orb {
    width: 100%;
    min-height: 120px;
  }

  .td-audit-cta-banner {
    padding: 1.5rem;
    gap: 1.5rem;
    border-radius: 24px;
  }
  .td-audit-cta-contacts-row {
    gap: 1rem;
    padding-top: 1.4rem;
  }
  .td-audit-contact-link {
    font-size: 0.9rem;
  }
  .td-audit-cta-actions .btn {
    min-height: 52px;
    font-size: 0.96rem;
  }
}

@media print {
  body {
    background: #fff !important;
  }
}

/* ==========================================================================
   PDF Template Styles (for html2pdf rendering)
   ========================================================================== */
.td-pdf-template {
  position: absolute;
  top: 0;
  left: 0;
  z-index: -9999;
  width: 794px; /* A4 width at 96 DPI */
  background: #fff;
  color: #111827;
  font-family: 'Inter', sans-serif;
  box-sizing: border-box;
}

.td-pdf-template * {
  box-sizing: border-box;
}

.td-pdf-page {
  width: 794px;
  min-height: 1122px; /* A4 height */
  padding: 48px;
  background: #fff;
  page-break-after: always;
  position: relative;
}

.td-pdf-last {
  page-break-after: auto;
}

/* Header */
.td-pdf-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 40px;
}
.td-pdf-brand {
  font-size: 24px;
  letter-spacing: -0.04em;
}
.td-pdf-brand strong {
  font-weight: 900;
  color: #111827;
}
.td-pdf-brand span {
  font-weight: 900;
  color: #5B36F2;
}
.td-pdf-badge {
  background: #F3EEFF;
  color: #5B36F2;
  padding: 8px 16px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.05em;
}

/* Title Box */
.td-pdf-title-box {
  background: #F3EEFF;
  padding: 40px;
  border-radius: 24px;
  margin-bottom: 24px;
}
.td-pdf-title-box h1 {
  font-size: 42px;
  font-weight: 900;
  margin-bottom: 12px;
  line-height: 1.1;
  letter-spacing: -0.05em;
  color: #111827;
}
.td-pdf-title-box p {
  font-size: 16px;
  color: #475569;
  max-width: 400px;
  line-height: 1.6;
}

/* Overall Score */
.td-pdf-overall {
  position: absolute;
  top: 130px;
  right: 80px;
  background: #1C1924;
  color: #fff;
  padding: 24px;
  border-radius: 24px;
  text-align: center;
  min-width: 140px;
}
.td-pdf-overall .td-pdf-label {
  display: block;
  font-size: 10px;
  color: #D2D6DC;
  margin-bottom: 8px;
}
.td-pdf-overall strong {
  display: block;
  font-size: 48px;
  line-height: 1;
}

/* Meta Data */
.td-pdf-meta {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-bottom: 40px;
}
.td-pdf-meta-item {
  border: 1px solid #E2E8F0;
  padding: 20px;
  border-radius: 16px;
}
.td-pdf-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}
.td-pdf-meta-item strong {
  font-size: 15px;
  color: #111827;
  word-break: break-word;
}

/* Scores Grid */
.td-pdf-scores {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 40px;
}
.td-pdf-score-item {
  background: #F3EEFF;
  padding: 24px;
  border-radius: 16px;
}
.td-pdf-score-item strong {
  display: block;
  font-size: 32px;
  color: #111827;
  margin-top: 8px;
}

/* Columns */
.td-pdf-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.td-pdf-col {
  border: 1px solid #E2E8F0;
  padding: 24px;
  border-radius: 16px;
}
.td-pdf-col.td-pdf-danger {
  background: #FEF2F2;
  border-color: #FECACA;
}
.td-pdf-col-title {
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 16px;
}
.td-pdf-good { color: #5B36F2; }
.td-pdf-bad { color: #B91C1C; }

.td-pdf-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.td-pdf-col li {
  font-size: 13px;
  color: #475569;
  margin-bottom: 12px;
  position: relative;
  padding-left: 16px;
  line-height: 1.5;
}
.td-pdf-col li::before {
  content: '•';
  position: absolute;
  left: 0;
  top: 0;
  color: #94A3B8;
}
.td-pdf-danger li::before {
  color: #F87171;
}

/* Recs Page */
.td-pdf-h2 {
  font-size: 32px;
  font-weight: 900;
  margin-bottom: 8px;
  letter-spacing: -0.03em;
}
.td-pdf-sub {
  font-size: 16px;
  color: #64748b;
  margin-bottom: 32px;
}
.td-pdf-rec-item {
  border: 1px solid #E2E8F0;
  padding: 24px;
  border-radius: 16px;
  margin-bottom: 16px;
  position: relative;
  page-break-inside: avoid;
}
.td-pdf-rec-title {
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 8px;
  max-width: 80%;
}
.td-pdf-rec-priority {
  position: absolute;
  top: 24px;
  right: 24px;
  padding: 6px 12px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 800;
}
.td-pdf-priority-high { background: #FEF2F2; color: #B91C1C; }
.td-pdf-priority-medium { background: #FFF7ED; color: #C2410C; }
.td-pdf-priority-low { background: #ECFDF5; color: #047857; }

.td-pdf-rec-exp {
  font-size: 13px;
  color: #475569;
  margin-bottom: 12px;
  line-height: 1.5;
}
.td-pdf-rec-how {
  font-size: 13px;
  color: #111827;
  font-weight: 500;
  background: #F8FAFC;
  padding: 12px;
  border-radius: 8px;
  line-height: 1.5;
}

/* CTA Page */
.td-pdf-cta-box {
  background: #F3EEFF;
  border-radius: 24px;
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  padding: 40px;
  gap: 32px;
  margin-top: 40px;
}
.td-pdf-cta-left strong {
  font-size: 24px;
  font-weight: 900;
  color: #111827;
  display: block;
  margin-bottom: 16px;
}
.td-pdf-cta-left p {
  font-size: 14px;
  color: #475569;
  line-height: 1.6;
  margin-bottom: 32px;
}
.td-pdf-contacts {
  border-top: 1px solid rgba(15, 23, 42, 0.1);
  padding-top: 24px;
}
.td-pdf-contacts span {
  display: block;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 12px;
}
.td-pdf-contacts p {
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #111827;
}

.td-pdf-cta-right {
  background: #fff;
  border-radius: 24px;
  padding: 32px;
  border: 1px solid #E2E8F0;
  display: flex;
  flex-direction: column;
}
.td-pdf-cta-right strong {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 12px;
  line-height: 1.3;
}
.td-pdf-cta-right p {
  font-size: 13px;
  color: #64748b;
  margin-bottom: 32px;
  line-height: 1.5;
}
.td-pdf-btn {
  background: #5B36F2;
  color: #fff;
  padding: 16px;
  border-radius: 16px;
  text-align: center;
  font-weight: 800;
  font-size: 14px;
  margin-top: auto;
}
