.ai-scan-agent {
  --agent-ink: #eefbf6;
  --agent-muted: #a9c7bd;
  --agent-panel: #102b27;
  --agent-panel-deep: #091c1a;
  --agent-mint: #56e0b0;
  --agent-coral: #ff7468;
  --agent-gold: #f4c96b;
  position: relative;
  overflow: hidden;
  margin: 0 0 24px;
  padding: clamp(22px, 4vw, 38px);
  border: 1px solid rgba(86, 224, 176, 0.26);
  border-radius: 30px;
  color: var(--agent-ink);
  background:
    radial-gradient(circle at 92% 8%, rgba(86, 224, 176, 0.19), transparent 31%),
    radial-gradient(circle at 7% 92%, rgba(255, 116, 104, 0.12), transparent 28%),
    linear-gradient(145deg, var(--agent-panel), var(--agent-panel-deep));
  box-shadow: 0 24px 70px rgba(7, 31, 27, 0.16);
}

.ai-scan-agent::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.28;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(to bottom, #000, transparent 88%);
}

.ai-agent-head,
.ai-agent-grid,
.ai-agent-actions,
.ai-agent-foot {
  position: relative;
  z-index: 1;
}

.ai-agent-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 24px;
}

.ai-agent-kicker {
  margin: 0 0 8px;
  color: var(--agent-mint);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.ai-agent-head h2 {
  margin: 0;
  max-width: 720px;
  color: #fff;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.75rem, 3.4vw, 3rem);
  line-height: 0.98;
}

.ai-agent-head p:not(.ai-agent-kicker) {
  max-width: 680px;
  margin: 12px 0 0;
  color: var(--agent-muted);
  line-height: 1.55;
}

.ai-agent-state {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 9px;
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 999px;
  color: var(--agent-muted);
  background: rgba(0, 0, 0, 0.17);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
}

.ai-agent-state span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #7c8f89;
  box-shadow: 0 0 0 5px rgba(124, 143, 137, 0.12);
}

.ai-agent-state[data-state="watching"] span,
.ai-agent-state[data-state="waiting"] span {
  background: var(--agent-gold);
  box-shadow: 0 0 0 5px rgba(244, 201, 107, 0.13);
  animation: ai-agent-pulse 1.4s ease-in-out infinite;
}

.ai-agent-state[data-state="ready"] {
  color: #dfffee;
  border-color: rgba(86, 224, 176, 0.34);
}

.ai-agent-state[data-state="ready"] span {
  background: var(--agent-mint);
  box-shadow: 0 0 0 5px rgba(86, 224, 176, 0.14);
}

.ai-agent-state[data-state="error"] span {
  background: var(--agent-coral);
}

.ai-agent-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 18px;
}

.ai-agent-console,
.ai-quality-card {
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 22px;
  background: rgba(2, 16, 14, 0.42);
}

.ai-agent-console {
  display: grid;
  grid-template-columns: 164px 1fr;
  gap: 20px;
  align-items: center;
  padding: 20px;
}

.ai-agent-orbit {
  position: relative;
  width: 150px;
  aspect-ratio: 1;
  margin: auto;
  border: 1px dashed rgba(86, 224, 176, 0.4);
  border-radius: 50%;
}

.ai-orbit-object {
  position: absolute;
  inset: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  color: #0a2721;
  background: linear-gradient(145deg, #f0fff9, #9aebcd);
  font: 800 2.6rem/1 Georgia, serif;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.22);
}

.ai-agent-orbit i {
  --angle: calc(var(--step) * 30deg - 90deg);
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 10px;
  margin: -5px;
  border: 2px solid #31524b;
  border-radius: 50%;
  background: #102b27;
  transform: rotate(var(--angle)) translateX(74px);
  transition: transform 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.ai-agent-orbit i.done {
  border-color: var(--agent-mint);
  background: var(--agent-mint);
}

.ai-agent-orbit i.current {
  border-color: #fff;
  background: var(--agent-coral);
  box-shadow: 0 0 0 6px rgba(255, 116, 104, 0.17);
  transform: rotate(var(--angle)) translateX(74px) scale(1.28);
}

.ai-agent-message span,
.ai-next-view span,
.ai-score-row span {
  display: block;
  margin-bottom: 6px;
  color: var(--agent-muted);
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.13em;
}

.ai-agent-message strong {
  display: block;
  color: #fff;
  font-size: clamp(1.15rem, 2.3vw, 1.7rem);
  line-height: 1.15;
}

.ai-agent-message small {
  display: block;
  margin-top: 9px;
  color: var(--agent-muted);
  line-height: 1.45;
}

.ai-next-view {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
}

.ai-next-view span {
  margin: 0;
}

.ai-next-view strong {
  color: var(--agent-mint);
}

.ai-quality-card {
  padding: 20px;
}

.ai-score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.ai-score-row > div:first-child > strong {
  color: #fff;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 3rem;
}

.ai-score-ring {
  --score: 0;
  display: grid;
  width: 68px;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--agent-mint) calc(var(--score) * 1%), rgba(255, 255, 255, 0.09) 0);
}

.ai-score-ring::before {
  content: "";
  position: absolute;
  width: 54px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #0d2521;
}

.ai-score-ring span {
  position: relative;
  z-index: 1;
  margin: 0;
  color: #fff;
  font-size: 0.76rem;
}

.ai-metric-list {
  display: grid;
  gap: 13px;
}

.ai-metric > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  color: var(--agent-muted);
  font-size: 0.78rem;
}

.ai-metric b {
  color: #fff;
}

.ai-metric progress {
  display: block;
  width: 100%;
  height: 6px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.ai-metric progress::-webkit-progress-bar {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.ai-metric progress::-webkit-progress-value {
  border-radius: 999px;
  background: linear-gradient(90deg, var(--agent-coral), var(--agent-gold), var(--agent-mint));
}

.ai-metric progress::-moz-progress-bar {
  border-radius: 999px;
  background: linear-gradient(90deg, var(--agent-coral), var(--agent-gold), var(--agent-mint));
}

.ai-agent-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
}

.ai-agent-actions button {
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 13px;
  font: inherit;
  font-weight: 850;
  cursor: pointer;
}

.ai-agent-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.ai-agent-actions .ai-primary {
  color: #08241e;
  background: var(--agent-mint);
}

.ai-agent-actions .ai-capture {
  color: #fff;
  background: var(--agent-coral);
}

.ai-agent-actions .ai-vision {
  color: #302207;
  background: var(--agent-gold);
}

.ai-agent-actions .ai-quiet {
  color: var(--agent-ink);
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
}

.ai-auto-toggle {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 13px;
  color: var(--agent-muted);
  background: rgba(0, 0, 0, 0.12);
  font-size: 0.8rem;
  font-weight: 750;
}

.ai-auto-toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--agent-mint);
}

.ai-agent-foot {
  display: flex;
  gap: 7px;
  margin-top: 17px;
  padding-top: 15px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--agent-muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.ai-cloud-result {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 5px;
  margin-top: 14px;
  padding: 15px 17px;
  border: 1px solid rgba(244, 201, 107, 0.22);
  border-radius: 16px;
  background: rgba(244, 201, 107, 0.07);
}

.ai-cloud-result > span {
  color: var(--agent-gold);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.14em;
}

.ai-cloud-result > strong {
  color: #fff;
  font-size: 0.94rem;
}

.ai-cloud-result > small {
  color: var(--agent-muted);
  line-height: 1.4;
}

.ai-cloud-result[data-state="working"] {
  border-color: rgba(244, 201, 107, 0.45);
}

.ai-cloud-result[data-state="ready"] {
  border-color: rgba(86, 224, 176, 0.42);
  background: rgba(86, 224, 176, 0.08);
}

.ai-cloud-result[data-state="error"] {
  border-color: rgba(255, 116, 104, 0.45);
  background: rgba(255, 116, 104, 0.08);
}

.ai-prediction-studio {
  position: relative;
  z-index: 1;
  margin-top: 24px;
  padding: clamp(18px, 3vw, 28px);
  border: 1px solid rgba(86, 224, 176, 0.2);
  border-radius: 24px;
  background:
    radial-gradient(circle at 100% 0, rgba(244, 201, 107, 0.12), transparent 30%),
    rgba(0, 0, 0, 0.16);
}

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

.ai-prediction-head h3 {
  margin: 0;
  color: #fff;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.5rem, 3vw, 2.35rem);
  line-height: 1.05;
}

.ai-prediction-head p:not(.ai-agent-kicker) {
  max-width: 720px;
  margin: 10px 0 0;
  color: var(--agent-muted);
  line-height: 1.5;
}

.ai-prediction-badge {
  flex: 0 0 auto;
  padding: 9px 12px;
  border: 1px solid rgba(244, 201, 107, 0.3);
  border-radius: 999px;
  color: var(--agent-gold);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  background: rgba(244, 201, 107, 0.07);
}

.ai-prediction-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.72fr) minmax(0, 1.28fr);
  gap: 18px;
}

.ai-prediction-form,
.ai-prediction-result {
  min-width: 0;
  padding: 19px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 19px;
  background: rgba(3, 18, 16, 0.5);
}

.ai-prediction-form {
  display: grid;
  gap: 13px;
}

.ai-prediction-form label {
  display: grid;
  gap: 6px;
  color: var(--agent-muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.ai-prediction-form label > span small {
  font-weight: 500;
  opacity: 0.72;
}

.ai-prediction-form input,
.ai-prediction-form select,
.ai-prediction-form textarea {
  width: 100%;
  min-height: 44px;
  box-sizing: border-box;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 12px;
  outline: none;
  color: #fff;
  background: #102b27;
  font: inherit;
  font-weight: 600;
}

.ai-prediction-form input,
.ai-prediction-form select {
  padding: 0 12px;
}

.ai-prediction-form textarea {
  min-height: 92px;
  padding: 11px 12px;
  resize: vertical;
  line-height: 1.45;
}

.ai-prediction-form input:focus,
.ai-prediction-form select:focus,
.ai-prediction-form textarea:focus {
  border-color: var(--agent-mint);
  box-shadow: 0 0 0 3px rgba(86, 224, 176, 0.12);
}

.ai-form-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.ai-prediction-form .ai-prediction-consent {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-weight: 600;
  line-height: 1.4;
}

.ai-prediction-consent input {
  flex: 0 0 auto;
  width: 18px;
  min-height: 18px;
  margin-top: 1px;
  accent-color: var(--agent-mint);
}

.ai-predict-button {
  min-height: 48px;
  border: 0;
  border-radius: 13px;
  color: #09251f;
  background: linear-gradient(100deg, var(--agent-mint), #a9f0d7);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.ai-predict-button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.ai-prediction-warning {
  color: #d9b979;
  line-height: 1.4;
}

.ai-prediction-result {
  align-content: start;
  display: grid;
  gap: 12px;
}

.ai-prediction-result[data-state="empty"] {
  min-height: 230px;
  place-content: center;
  text-align: center;
}

.ai-prediction-result[data-state="working"] {
  min-height: 230px;
  place-content: center;
  border-color: rgba(244, 201, 107, 0.35);
}

.ai-prediction-result[data-state="error"] {
  min-height: 180px;
  place-content: center;
  border-color: rgba(255, 116, 104, 0.4);
}

.ai-result-kicker {
  color: var(--agent-mint);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.15em;
}

.ai-prediction-result h4 {
  margin: 0;
  color: #fff;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.35rem, 2.6vw, 2rem);
}

.ai-prediction-result > p,
.ai-prediction-result section p {
  margin: 0;
  color: var(--agent-muted);
  line-height: 1.55;
}

.ai-prediction-result section {
  padding: 12px 14px;
  border-left: 3px solid rgba(86, 224, 176, 0.48);
  border-radius: 0 12px 12px 0;
  background: rgba(255, 255, 255, 0.035);
}

.ai-prediction-result section h5 {
  margin: 0 0 6px;
  color: #fff;
  font-size: 0.83rem;
}

.ai-prediction-result section ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 18px;
  color: var(--agent-muted);
  line-height: 1.45;
}

.ai-result-disclaimer,
.ai-result-model {
  display: block;
  color: #d9b979;
  line-height: 1.45;
}

.ai-result-model {
  color: var(--agent-muted);
}

.ai-prediction-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
  margin-top: 13px;
}

.ai-prediction-actions button {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 11px;
  color: var(--agent-ink);
  background: rgba(255, 255, 255, 0.06);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 850;
  cursor: pointer;
}

.ai-prediction-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.ai-prediction-actions span {
  color: var(--agent-muted);
  font-size: 0.76rem;
}

.ai-agent-foot strong {
  flex: 0 0 auto;
  color: var(--agent-gold);
}

@keyframes ai-agent-pulse {
  50% { transform: scale(0.72); opacity: 0.62; }
}

@media (max-width: 760px) {
  .ai-scan-agent {
    margin-inline: -2px;
    padding: 20px 16px;
    border-radius: 23px;
  }

  .ai-agent-head,
  .ai-agent-grid,
  .ai-prediction-head,
  .ai-prediction-layout {
    display: grid;
    grid-template-columns: 1fr;
  }

  .ai-agent-state {
    justify-self: start;
  }

  .ai-agent-console {
    grid-template-columns: 112px 1fr;
    gap: 14px;
    padding: 16px;
  }

  .ai-agent-orbit {
    width: 104px;
  }

  .ai-orbit-object {
    inset: 25px;
    border-radius: 17px;
    font-size: 1.8rem;
  }

  .ai-agent-orbit i {
    transform: rotate(var(--angle)) translateX(51px);
  }

  .ai-agent-orbit i.current {
    transform: rotate(var(--angle)) translateX(51px) scale(1.22);
  }

  .ai-next-view {
    align-items: flex-start;
    flex-direction: column;
  }

  .ai-agent-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .ai-agent-actions button,
  .ai-auto-toggle {
    width: 100%;
  }

  .ai-auto-toggle {
    grid-column: 1 / -1;
  }

  .ai-agent-foot {
    display: block;
  }

  .ai-agent-foot strong {
    display: block;
    margin-bottom: 4px;
  }

  .ai-prediction-badge {
    justify-self: start;
  }
}

@media (max-width: 430px) {
  .ai-agent-console {
    grid-template-columns: 1fr;
  }

  .ai-agent-actions {
    grid-template-columns: 1fr;
  }

  .ai-auto-toggle {
    grid-column: auto;
  }

  .ai-form-pair {
    grid-template-columns: 1fr;
  }
}
