:root {
  --color-navy: #0A2540;
  --color-blue: #00D4FF;
  --color-violet: #9B5BFF;
  --color-white: #FFFFFF;
  --color-text-primary: #0A2540;
  --color-text-secondary: #5B6B7C;
  --color-surface-light: #F5F7FA;
  --color-border-light: #E6ECF2;
  --color-border-strong: #C9D4E0;
  --gradient-brand: linear-gradient(135deg, #00D4FF 0%, #9B5BFF 100%);
  --font-sans: "Inter", "Satoshi", system-ui, -apple-system, sans-serif;
  --shadow-soft: 0 8px 24px rgba(10, 37, 64, 0.08);
  --shadow-medium: 0 12px 32px rgba(10, 37, 64, 0.12);
  
  /* SOP Colors */
  --status-match: #92D050;
  --status-warning: #FFC000;
  --status-gap: #FF6B6B;
  --status-critical: #FF0000;
  --status-info: #BDD7EE;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--color-surface-light);
  color: var(--color-text-primary);
  line-height: 1.6;
}

/* Header */
header {
  background-color: rgba(10, 37, 64, 0.95);
  backdrop-filter: blur(10px);
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--color-white);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo-text {
  font-size: 24px;
  font-weight: 500;
  color: var(--color-white);
  letter-spacing: 0.02em;
}

.logo-text .gradient-text {
  font-weight: 700;
}

.gradient-text {
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.badge {
  background: rgba(255,255,255,0.1);
  padding: 4px 12px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Main Layout */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 24px;
}

/* Hero */
.hero {
  text-align: center;
  margin-bottom: 64px;
  animation: fadeInUp 0.8s ease backwards;
}

.hero h1 {
  font-size: 56px;
  font-weight: 700;
  line-height: 1.1;
  margin: 16px 0;
}

.hero .subtitle {
  font-size: 18px;
  color: var(--color-text-secondary);
  max-width: 600px;
  margin: 0 auto 32px;
}

.project-info {
  display: inline-flex;
  gap: 24px;
  background: var(--color-white);
  padding: 16px 32px;
  border-radius: 9999px;
  box-shadow: var(--shadow-soft);
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-secondary);
}

/* Steps Indicator */
.steps-indicator {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 800px;
  margin: 0 auto 64px;
}

.step-dot {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 500;
  color: var(--color-text-secondary);
  transition: all 0.3s ease;
}

.step-dot span {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

.step-dot.active {
  color: var(--color-navy);
}

.step-dot.active span {
  background: var(--gradient-brand);
  color: var(--color-white);
  box-shadow: 0 4px 12px rgba(0, 212, 255, 0.3);
}

.step-connector {
  flex: 1;
  height: 2px;
  background: var(--color-border-light);
  margin: 0 24px;
}

/* Sections */
.section {
  background: var(--color-white);
  border-radius: 24px;
  padding: 48px;
  box-shadow: var(--shadow-soft);
  margin-bottom: 48px;
  animation: fadeInUp 0.8s ease backwards;
}

.section h2 {
  font-size: 32px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.step-number {
  font-size: 20px;
  color: var(--color-text-secondary);
  font-weight: 400;
}

.section-desc {
  color: var(--color-text-secondary);
  margin-bottom: 32px;
  font-size: 16px;
}

/* Buttons */
button {
  cursor: pointer;
  font-family: var(--font-sans);
  border-radius: 12px;
  font-weight: 600;
  font-size: 16px;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
}

.btn-primary {
  background: var(--gradient-brand);
  color: var(--color-white);
  box-shadow: 0 4px 12px rgba(0, 212, 255, 0.2);
}

.btn-primary:hover {
  box-shadow: 0 8px 24px rgba(0, 212, 255, 0.4);
  transform: translateY(-2px);
}

.btn-primary:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.btn-large {
  padding: 16px 32px;
  font-size: 18px;
}

.btn-secondary {
  background: var(--color-white);
  color: var(--color-navy);
  border: 1px solid var(--color-border-strong);
}

.btn-secondary:hover {
  background: var(--color-surface-light);
}

.btn-ghost {
  background: transparent;
  color: var(--color-navy);
}

.btn-ghost:hover {
  background: var(--color-surface-light);
}

/* PDF Cards */
.pdf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
}

.pdf-card {
  border: 1px solid var(--color-border-light);
  border-radius: 16px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: all 0.3s ease;
}

.pdf-card:hover {
  border-color: var(--color-blue);
  box-shadow: var(--shadow-medium);
  transform: translateY(-4px);
}

.pdf-icon {
  width: 64px;
  height: 64px;
  background: var(--color-surface-light);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  color: #E74C3C;
}

.pdf-price {
  font-size: 24px;
  font-weight: 700;
  margin: 16px 0;
  color: var(--color-navy);
}

/* Analysis Section */
.analyze-container {
  display: flex;
  justify-content: center;
  padding: 48px 0;
}

.processing {
  text-align: center;
  padding: 48px 0;
}

.processing-orb {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00D4FF, #9B5BFF, #00D4FF);
  background-size: 200% 200%;
  margin: 0 auto 32px;
  animation: pulse 1.5s infinite ease-in-out, gradientShift 3s infinite linear;
  box-shadow: 0 0 40px rgba(155, 91, 255, 0.4);
}

.processing-step {
  font-family: monospace;
  font-size: 14px;
  color: var(--color-text-secondary);
  margin-bottom: 8px;
  animation: slideIn 0.3s ease forwards;
}

/* Results Table */
.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.legend {
  display: flex;
  gap: 16px;
  font-size: 14px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-item::before {
  content: '';
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.legend-item.match::before { background: var(--status-match); }
.legend-item.warning::before { background: var(--status-warning); }
.legend-item.gap::before { background: var(--status-gap); }
.legend-item.critical::before { background: var(--status-critical); }

.table-container {
  overflow-x: auto;
  border: 1px solid var(--color-border-light);
  border-radius: 12px;
  margin-bottom: 32px;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th, td {
  padding: 16px 24px;
  border-bottom: 1px solid var(--color-border-light);
}

th {
  background: var(--color-surface-light);
  font-weight: 600;
  color: var(--color-text-secondary);
}

tbody tr {
  transition: background 0.2s;
  background: var(--color-white);
}

tbody tr:hover {
  background: var(--color-surface-light);
}

.row-match { box-shadow: inset 4px 0 0 var(--status-match); }
.row-warning { box-shadow: inset 4px 0 0 var(--status-warning); }
.row-gap { box-shadow: inset 4px 0 0 var(--status-gap); }
.row-critical { box-shadow: inset 4px 0 0 var(--status-critical); }
.row-info { box-shadow: inset 4px 0 0 var(--status-info); }

.status-pill {
  padding: 4px 12px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
  display: inline-block;
}

.pill-match { background: #EAF7E2; color: #2E7D32; }
.pill-warning { background: #FFF4CC; color: #B28900; }
.pill-gap { background: #FFEEEE; color: #D32F2F; }
.pill-critical { background: var(--status-critical); color: white; }
.pill-info { background: #EAF4FC; color: #1976D2; }

/* Risk Card */
.risk-card {
  background: var(--color-surface-light);
  border-radius: 16px;
  padding: 32px;
  border: 1px solid var(--color-border-light);
}

.risk-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.risk-badge {
  background: #FFEEEE;
  color: #D32F2F;
  padding: 6px 16px;
  border-radius: 9999px;
  font-weight: 700;
  font-size: 14px;
}

.risk-body p {
  margin-bottom: 16px;
}

.risk-body strong {
  color: var(--color-navy);
}

/* Actions Step */
.actions-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}

.card {
  border: 1px solid var(--color-border-light);
  border-radius: 16px;
  padding: 32px;
  background: var(--color-white);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.email-preview {
  background: var(--color-surface-light);
  padding: 24px;
  border-radius: 12px;
  font-family: monospace;
  font-size: 14px;
  white-space: normal;
  border: 1px solid var(--color-border-light);
}

.export-card {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.export-note {
  font-size: 14px;
  color: var(--color-text-secondary);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 32px;
  right: 32px;
  background: var(--color-navy);
  color: white;
  padding: 16px 24px;
  border-radius: 12px;
  box-shadow: var(--shadow-medium);
  font-weight: 500;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  z-index: 1000;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* Animations */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes pulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(155, 91, 255, 0.4); }
  50% { transform: scale(1.05); box-shadow: 0 0 40px rgba(155, 91, 255, 0.6); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(155, 91, 255, 0.4); }
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

footer {
  text-align: center;
  padding: 24px;
  color: var(--color-text-secondary);
  font-size: 14px;
}

@media (max-width: 760px) {
  body {
    background: var(--color-white);
  }

  header {
    position: static;
    padding: 14px 18px;
    gap: 10px;
    flex-wrap: wrap;
  }

  header > div:nth-child(2) {
    order: 3;
    width: 100%;
    font-size: 13px;
    color: rgba(255,255,255,0.76);
  }

  .logo-text {
    font-size: 21px;
  }

  header .badge {
    font-size: 11px;
    padding: 4px 10px;
  }

  main {
    padding: 24px 14px 32px;
  }

  .hero {
    text-align: left;
    margin-bottom: 28px;
  }

  .hero h1 {
    font-size: 38px;
    line-height: 1.08;
    margin: 14px 0;
  }

  .hero .subtitle {
    font-size: 16px;
    line-height: 1.55;
    margin-bottom: 22px;
  }

  .hero > div[style*="max-width: 400px"] {
    max-width: none !important;
    margin: 24px 0 !important;
  }

  #project-selector {
    min-height: 48px;
    border-radius: 10px !important;
  }

  .project-info {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    width: 100%;
    padding: 16px;
    border-radius: 14px;
    font-size: 13px;
  }

  .steps-indicator {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch;
    gap: 8px;
    margin: 0 0 24px;
  }

  .step-dot {
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    gap: 8px;
    padding: 10px 6px;
    border: 1px solid var(--color-border-light);
    border-radius: 12px;
    background: var(--color-white);
    font-size: 12px;
    line-height: 1.25;
    text-align: center;
  }

  .step-dot span {
    width: 26px;
    height: 26px;
    font-size: 12px;
  }

  .step-connector {
    display: none;
  }

  .section {
    border-radius: 0;
    padding: 28px 0;
    box-shadow: none;
    border-top: 1px solid var(--color-border-light);
    margin-bottom: 0;
  }

  .section h2 {
    align-items: flex-start;
    font-size: 24px;
    line-height: 1.18;
    gap: 10px;
    padding: 0 2px;
  }

  .step-number {
    font-size: 14px;
    padding-top: 4px;
  }

  .section-desc {
    font-size: 15px;
    margin-bottom: 20px;
    padding: 0 2px;
  }

  .pdf-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .pdf-card {
    align-items: stretch;
    text-align: left;
    padding: 18px;
    border-radius: 14px;
  }

  .pdf-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
  }

  .pdf-price {
    margin: 12px 0 16px;
  }

  .pdf-card button,
  .btn-large,
  .export-card .btn-primary {
    min-height: 46px;
  }

  .analyze-container,
  .processing {
    padding: 28px 0;
  }

  .btn-large {
    width: 100%;
    font-size: 16px;
  }

  .processing-steps {
    text-align: left;
  }

  .processing-step {
    font-size: 12px;
    line-height: 1.45;
  }

  .results-header,
  .risk-header,
  .card-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .legend {
    flex-wrap: wrap;
    gap: 8px 14px;
    font-size: 12px;
  }

  .table-container {
    border: 0;
    border-radius: 0;
    overflow: visible;
  }

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
  }

  thead {
    display: none;
  }

  tbody tr {
    margin-bottom: 14px;
    border: 1px solid var(--color-border-light);
    border-radius: 14px;
    overflow: hidden;
  }

  tbody tr:hover {
    background: var(--color-white);
  }

  td {
    display: grid;
    grid-template-columns: minmax(96px, 38%) 1fr;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--color-border-light);
    font-size: 14px;
    overflow-wrap: anywhere;
  }

  td::before {
    content: attr(data-label);
    color: var(--color-text-secondary);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
  }

  td:first-child {
    grid-template-columns: 1fr;
    background: var(--color-surface-light);
    font-size: 15px;
  }

  td:first-child::before {
    margin-bottom: -4px;
  }

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

  .risk-card,
  .card,
  .email-preview {
    padding: 18px;
    border-radius: 14px;
  }

  .risk-body p {
    font-size: 14px;
  }

  .actions-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .email-preview {
    max-height: 420px;
    overflow: auto;
    font-size: 12px;
    line-height: 1.55;
  }

  .export-card {
    gap: 16px;
  }

  .toast {
    right: 14px;
    bottom: 14px;
    left: 14px;
    text-align: center;
  }
}

@media (max-width: 390px) {
  .hero h1 {
    font-size: 34px;
  }

  td {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}
