/* K-Wired Site Scan — FLYNN handoff tokens */
:root {
  --kw-bg-deep: #0c1f3a;
  --kw-bg-mid: #153a6b;
  --kw-surface: rgba(255, 255, 255, 0.08);
  --kw-surface-solid: #f7f9fc;
  --kw-text: #f0f4fa;
  --kw-text-dark: #1a2332;
  --kw-accent: #2d8cff;
  --kw-accent-hover: #1a6fd4;
  --kw-success: #22c55e;
  --kw-warn: #eab308;
  --kw-danger: #ef4444;
  --kw-muted: #94a3b8;
  --kw-radius: 12px;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

body.kw-page {
  margin: 0;
  min-height: 100vh;
  color: var(--kw-text);
  background: #000;
}

.kw-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.kw-header__inner {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.kw-logo {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
}

.kw-tagline {
  margin: 0.25rem 0 0;
  color: var(--kw-muted);
  font-size: 0.95rem;
}

.kw-back {
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
}

.kw-back:hover {
  color: rgba(255, 255, 255, 0.85);
}

.kw-header__actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

/* Subtle Premium login — header only */
.kw-login-link {
  color: var(--kw-muted);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  white-space: nowrap;
}

.kw-login-link:hover {
  color: var(--kw-text);
  background: rgba(255, 255, 255, 0.06);
}

.kw-logo-link {
  color: inherit;
  text-decoration: none;
}

.kw-logo-link:hover {
  color: #fff;
}

.kw-logo--premium {
  color: #fff;
}

.kw-premium-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.kw-list {
  margin: 0.75rem 0 1rem;
  padding-left: 1.25rem;
  color: var(--kw-text);
}

.kw-list li {
  margin-bottom: 0.35rem;
}

.kw-small {
  font-size: 0.85rem;
}

.kw-brand-link {
  display: inline-block;
  line-height: 0;
  text-decoration: none;
}

.kw-brand-link:hover {
  opacity: 0.88;
}

.kw-brand-logo {
  display: block;
  height: 28px;
  width: auto;
  max-width: 180px;
}

.kw-footer .kw-brand-logo {
  height: 24px;
}

.kw-footer__powered {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin: 0;
}

.kw-footer__powered .kw-brand-link {
  vertical-align: middle;
}

.kw-main {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.5rem;
}

.kw-card {
  background: var(--kw-surface);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--kw-radius);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.kw-card--accent {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
}

/* In-card links and accents — white on black (not blue) */
.kw-card a:not(.kw-btn) {
  color: #fff;
}

.kw-card a:not(.kw-btn):hover {
  color: rgba(255, 255, 255, 0.85);
}

.kw-card--muted {
  opacity: 0.95;
}

.kw-form label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 600;
}

.kw-terms {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0.25rem 0 1rem;
  font-weight: 400;
  font-size: 0.9rem;
  color: var(--kw-muted);
  cursor: pointer;
}

.kw-terms input[type="checkbox"] {
  margin-top: 0.2rem;
  flex-shrink: 0;
  width: 1rem;
  height: 1rem;
  accent-color: var(--kw-accent);
}

.kw-terms span {
  line-height: 1.45;
}

.kw-terms-wrap[hidden] {
  display: none !important;
}

/* Dark inputs — home URL + Premium auth (FLYNN: match #url) */
.kw-form .kw-input,
.kw-form input#url,
.kw-form input[type="url"],
.kw-form input[type="text"],
.kw-form input[type="email"],
.kw-form input[type="password"] {
  display: block;
  width: 100%;
  max-width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.2);
  color: var(--kw-text);
  font-size: 1rem;
  line-height: 1.4;
  margin-bottom: 1rem;
  box-sizing: border-box;
}

.kw-form .kw-input::placeholder,
.kw-form input#url::placeholder,
.kw-form input[type="email"]::placeholder,
.kw-form input[type="text"]::placeholder,
.kw-form input[type="password"]::placeholder {
  color: rgba(240, 244, 250, 0.45);
}

.kw-form .kw-input:focus,
.kw-form input#url:focus,
.kw-form input[type="url"]:focus,
.kw-form input[type="text"]:focus,
.kw-form input[type="email"]:focus,
.kw-form input[type="password"]:focus {
  outline: none;
  border-color: var(--kw-accent);
  box-shadow: 0 0 0 2px rgba(45, 140, 255, 0.25);
}

/* Premium auth — not full card width; field-specific caps */
.kw-form--premium {
  max-width: 28rem;
}

.kw-form--premium .kw-input--email {
  max-width: 26rem;
}

.kw-form--premium .kw-input--user {
  max-width: 22rem;
}

.kw-form--premium .kw-input--company {
  max-width: 24rem;
}

/* Password field — eye toggle inside input (right), border-matched gray icon */
.kw-form--premium .kw-password-field {
  max-width: 28rem;
  margin-bottom: 0;
}

.kw-form--premium .kw-password-field > label {
  display: block;
}

.kw-form--premium .kw-password-field__wrap {
  position: relative;
  display: block;
  width: 100%;
  max-width: 20rem;
  margin-bottom: 1rem;
}

.kw-form--premium .kw-password-field__wrap .kw-input--password {
  display: block;
  width: 100%;
  max-width: none;
  margin-bottom: 0;
  padding-right: 2.5rem;
  box-sizing: border-box;
}

/* Suppress browser password reveal (Edge/Chrome) — use our toggle only */
.kw-form--premium .kw-password-field__wrap .kw-input--password::-ms-reveal,
.kw-form--premium .kw-password-field__wrap .kw-input--password::-ms-clear {
  display: none;
  width: 0;
  height: 0;
}

.kw-form--premium .kw-password-field__wrap .kw-input--password::-webkit-textfield-decoration-container,
.kw-form--premium .kw-password-field__wrap .kw-input--password::-webkit-credentials-auto-fill-button,
.kw-form--premium .kw-password-field__wrap .kw-input--password::-webkit-contacts-auto-fill-button {
  display: none !important;
  visibility: hidden;
  pointer-events: none;
  width: 0;
  height: 0;
  margin: 0;
}

.kw-form--premium .kw-password-field__wrap button.kw-password-toggle {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 2.5rem;
  height: auto;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0 8px 8px 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.2);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  font: inherit;
  appearance: none;
  -webkit-appearance: none;
  box-shadow: none;
  z-index: 2;
}

.kw-form--premium .kw-password-field__wrap button.kw-password-toggle:hover {
  color: rgba(255, 255, 255, 0.45);
  background: transparent;
}

.kw-form--premium .kw-password-field__wrap button.kw-password-toggle:focus-visible {
  color: rgba(255, 255, 255, 0.55);
  background: transparent;
  outline: 2px solid var(--kw-accent);
  outline-offset: -2px;
}

.kw-form--premium .kw-password-field__wrap button.kw-password-toggle .kw-password-toggle__svg {
  display: block;
  width: 1.125rem;
  height: 1.125rem;
  pointer-events: none;
}

.kw-form--premium .kw-password-field__wrap button.kw-password-toggle .kw-password-toggle__svg--hide {
  display: none;
}

.kw-form--premium .kw-password-field__wrap button.kw-password-toggle.kw-password-toggle--visible .kw-password-toggle__svg--show {
  display: none;
}

.kw-form--premium .kw-password-field__wrap button.kw-password-toggle.kw-password-toggle--visible .kw-password-toggle__svg--hide {
  display: block;
}

.kw-btn {
  display: inline-block;
  padding: 0.75rem 1.25rem;
  background: var(--kw-accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.kw-btn:hover {
  background: var(--kw-accent-hover);
}

.kw-btn--ghost {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.35);
}

.kw-muted {
  color: var(--kw-muted);
}

.kw-small {
  font-size: 0.85rem;
}

.kw-progress {
  text-align: center;
  padding: 1.5rem;
}

.kw-spinner {
  width: 40px;
  height: 40px;
  margin: 0 auto 1rem;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--kw-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.kw-error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid var(--kw-danger);
  padding: 1rem;
  border-radius: 8px;
  margin-top: 1rem;
}

.kw-card h2,
.kw-card h3 {
  margin-top: 0;
}

.kw-scanned-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem 1.25rem;
}

.kw-scanned-info {
  flex: 1 1 12rem;
  min-width: 0;
}

.kw-scanned-info h2 {
  margin-bottom: 0.5rem;
}

.kw-scanned-url {
  font-size: 1.1rem;
  word-break: break-all;
  font-weight: 600;
  margin: 0 0 0.35rem;
}

.kw-btn--scan-another {
  flex: 0 0 auto;
  align-self: center;
  margin-top: 0;
  background: #fff;
  color: #000;
  white-space: nowrap;
}

.kw-btn--scan-another:hover {
  background: #e8e8e8;
  color: #000;
}

.kw-score-card {
  text-align: center;
}

.kw-score-line {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.kw-score-num {
  font-size: 3rem;
  font-weight: 800;
  line-height: 1;
}

.kw-score-grade {
  display: inline;
  font-size: 2.25rem;
  font-weight: 700;
  color: #fff;
  line-height: 1;
}

.kw-pillar {
  margin-bottom: 0.75rem;
}

.kw-pillar__head {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}

.kw-pillar__bar {
  height: 10px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 6px;
  overflow: hidden;
}

.kw-pillar__fill {
  height: 100%;
  border-radius: 6px;
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.15);
}

.kw-pillar--0 .kw-pillar__fill {
  background: linear-gradient(90deg, #3b82f6, #60a5fa, #93c5fd);
}

.kw-pillar--1 .kw-pillar__fill {
  background: linear-gradient(90deg, #22c55e, #4ade80, #86efac);
}

.kw-pillar--2 .kw-pillar__fill {
  background: linear-gradient(90deg, #a855f7, #c084fc, #e9d5ff);
}

.kw-pillar--3 .kw-pillar__fill {
  background: linear-gradient(90deg, #f97316, #fb923c, #fdba74);
}

.kw-pillar--4 .kw-pillar__fill {
  background: linear-gradient(90deg, #ec4899, #f472b6, #fbcfe8);
}

.kw-pillar--5 .kw-pillar__fill {
  background: linear-gradient(90deg, #06b6d4, #22d3ee, #67e8f9);
}

@media (max-width: 520px) {
  .kw-scanned-row {
    flex-direction: column;
  }

  .kw-btn--scan-another {
    align-self: stretch;
    text-align: center;
  }
}

.kw-print-title {
  display: none;
}

.kw-card--issues > h2 {
  margin-bottom: 0.75rem;
}

.kw-card--issues {
  margin-bottom: 2.25rem;
}

.kw-issues-group {
  margin-top: 0.25rem;
  padding-left: 1rem;
  border-left: 2px solid rgba(255, 255, 255, 0.12);
}

.kw-issue-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.kw-issue-item {
  margin: 0;
  padding: 0.85rem 1rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-left-width: 4px;
  border-radius: var(--kw-radius);
}

.kw-issue-item.kw-sev-critical {
  border-left-color: var(--kw-danger);
}

.kw-issue-item.kw-sev-high {
  border-left-color: #f97316;
}

.kw-issue-item.kw-sev-medium {
  border-left-color: var(--kw-warn);
}

.kw-issue-item.kw-sev-low {
  border-left-color: var(--kw-muted);
}

.kw-issue-item p {
  margin: 0.35rem 0 0;
}

.kw-cta--final {
  text-align: center;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.22);
}

.kw-limit-msg {
  font-size: 1.15rem;
  line-height: 1.5;
}

/* Daily cap — premium upsell */
.kw-card--limit-daily {
  max-width: 100%;
}

.kw-limit-premium {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 1.25rem;
  margin: 1.5rem 0 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.kw-limit-premium__copy {
  flex: 1 1 220px;
  min-width: 0;
}

.kw-limit-premium__lead {
  margin: 0;
  font-size: 1rem;
  line-height: 1.55;
  color: var(--kw-text);
}

.kw-limit-premium__lead strong {
  color: #fff;
}

.kw-limit-premium__terms {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: var(--kw-muted);
}

.kw-limit-premium__terms a {
  color: var(--kw-accent);
  text-decoration: underline;
}

.kw-premium-card {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-width: 168px;
  padding: 1.25rem 1.5rem;
  text-align: center;
  text-decoration: none;
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--kw-radius);
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.kw-premium-card:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.32);
  transform: translateY(-1px);
}

.kw-premium-card__badge {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--kw-accent);
}

.kw-premium-card__price {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.2;
}

.kw-premium-card__detail {
  font-size: 0.85rem;
  color: var(--kw-muted);
  line-height: 1.35;
  margin-bottom: 0.5rem;
}

.kw-premium-card__cta {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.55rem 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  background: var(--kw-accent);
  border-radius: 8px;
}

.kw-limit-actions {
  text-align: center;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.kw-limit-actions p {
  margin: 0.75rem 0 0;
}

.kw-limit-contact {
  color: #fff;
  text-decoration: underline;
}

.kw-limit-contact:hover {
  color: var(--kw-accent);
}

@media (max-width: 560px) {
  .kw-limit-premium {
    flex-direction: column;
  }

  .kw-premium-card {
    width: 100%;
    max-width: 280px;
    margin: 0 auto;
  }
}

.kw-footer {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--kw-muted);
  font-size: 0.85rem;
}

.kw-footer a {
  color: var(--kw-accent);
}

.kw-dev-note,
.kw-warn {
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

@media print {
  body.kw-page {
    background: #fff !important;
    color: var(--kw-text-dark) !important;
  }

  .kw-print-title {
    display: block;
    margin: 0 0 1rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--kw-text-dark) !important;
    text-align: center;
  }

  .kw-issues-group {
    border-left-color: #ccc !important;
  }

  .kw-card {
    background: #fff !important;
    border: 1px solid #ccc !important;
    border-radius: 16px !important;
    color: var(--kw-text-dark) !important;
    break-inside: avoid;
  }

  .kw-issue-item {
    background: #fff !important;
    border-color: #ccc !important;
    border-radius: 14px !important;
  }

  .kw-no-print {
    display: none !important;
  }

  .kw-muted {
    color: #555 !important;
  }

  .kw-pillar__bar {
    background: #eee !important;
  }

  a {
    color: #153a6b !important;
  }
}
