.visually-hidden {
  position: absolute;
  clip-path: inset(50%);
  overflow: hidden;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  white-space: nowrap;
}

.kb-tool-card {
  max-width: 48rem;
  width: 100%;
  margin: 0 auto;
  background: #ffffff;
  border: 1px solid var(--color-border, #e7e5e4);
  border-radius: 20px;
  padding: 1.75rem;
  box-shadow: var(--shadow-lg, 0 20px 25px -5px rgba(0, 0, 0, 0.05));
  text-align: left;
}

.kb-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

@media (max-width: 640px) {
  .kb-tool-card {
    padding: 1.25rem;
  }
  .kb-form-grid {
    grid-template-columns: 1fr;
  }
}

.kb-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.kb-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.kb-label {
  font-size: 0.925rem;
  font-weight: 700;
  color: var(--color-primary, #1c1917);
}

.kb-quality-pill {
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  font-size: 0.85rem;
  font-weight: 800;
}

.kb-hint {
  font-size: 0.8125rem;
  color: var(--color-text-secondary, #57534e);
}

.kb-input {
  font: inherit;
  font-size: max(1rem, 1em);
  min-height: 48px;
  padding: 0.65rem 0.85rem;
  border: 1.5px solid #767676;
  border-radius: 10px;
  width: 100%;
  background: #ffffff;
  color: #1c1917;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.kb-range {
  width: 100%;
  min-height: 48px;
  cursor: pointer;
  accent-color: var(--color-accent, #f97316);
}

.kb-input:focus-visible,
.kb-radio:focus-visible,
.kb-range:focus-visible,
.kb-dropzone:focus-visible,
.kb-table-wrapper:focus-visible,
.kb-faq-summary:focus-visible,
.kb-action-btn:focus-visible {
  outline: 2px solid #ea580c;
  outline-offset: 2px;
}

.kb-input[aria-invalid="true"] {
  border-color: #dc2626;
  background: #fef2f2;
}

.kb-field-error {
  color: #b91c1c;
  font-size: 0.85rem;
  font-weight: 600;
  min-height: 1.15rem;
}

.kb-fieldset {
  border: 1px solid #e7e5e4;
  border-radius: 12px;
  padding: 0.9rem 1rem;
  margin-bottom: 1.25rem;
  background: #fcf9f6;
}

.kb-fieldset legend {
  font-size: 0.875rem;
  font-weight: 700;
  color: #1c1917;
  padding: 0 0.35rem;
}

.kb-radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin-top: 0.35rem;
}

.kb-radio-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 48px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #292524;
  cursor: pointer;
}

.kb-radio {
  width: 1.15rem;
  height: 1.15rem;
  cursor: pointer;
  accent-color: var(--color-accent, #f97316);
}

@supports not (accent-color: #f97316) {
  .kb-radio {
    appearance: none;
    -webkit-appearance: none;
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid #767676;
    border-radius: 50%;
    display: inline-grid;
    place-content: center;
    background: #ffffff;
  }
  .kb-radio::before {
    content: "";
    width: 0.65rem;
    height: 0.65rem;
    border-radius: 50%;
    transform: scale(0);
    transition: 120ms transform ease-in-out;
    background: #f97316;
  }
  .kb-radio:checked::before {
    transform: scale(1);
  }
  .kb-range {
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
  }
  .kb-range::-webkit-slider-runnable-track {
    height: 0.45rem;
    border-radius: 999px;
    background: #e7e5e4;
  }
  .kb-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 50%;
    background: #f97316;
    margin-top: -0.4rem;
  }
}

@media (pointer: coarse) {
  .kb-input,
  .kb-radio-label,
  .kb-action-btn {
    min-height: 52px;
  }
}

.kb-dropzone {
  border: 2px dashed #a8a29e;
  border-radius: 16px;
  background: #fcf9f6;
  padding: 2rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.kb-dropzone:hover,
.kb-dropzone.is-dragover {
  border-color: #f97316;
  background: #fff7ed;
}

.kb-drop-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 12px;
  background: #ffedd5;
  color: #ea580c;
  margin-bottom: 0.75rem;
}

.kb-drop-title {
  font-family: var(--font-display, "Manrope", sans-serif);
  font-size: 1.25rem;
  font-weight: 700;
  color: #1c1917;
  margin-bottom: 0.35rem;
}

.kb-drop-sub {
  font-size: 0.925rem;
  color: #57534e;
  margin-bottom: 1.15rem;
}

.kb-privacy-note {
  margin-top: 0.85rem;
  font-size: 0.8125rem;
  color: #57534e;
}

.kb-progress-wrap {
  margin-top: 1.25rem;
  padding: 1rem;
  border-radius: 12px;
  background: #fcf9f6;
  border: 1px solid #e7e5e4;
}

.kb-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: #1c1917;
}

.kb-progress {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 0.75rem;
  border: 1px solid #d6d3d1;
  border-radius: 999px;
  overflow: hidden;
  background-color: #f5f5f4;
  display: block;
}

.kb-progress::-webkit-progress-bar {
  background-color: #f5f5f4;
  border-radius: 999px;
}

.kb-progress::-webkit-progress-value {
  background-color: #f97316;
  border-radius: 999px;
  transition: width 0.2s ease;
}

.kb-progress::-moz-progress-bar {
  background-color: #f97316;
  border-radius: 999px;
}

.kb-status-live {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: #1c1917;
  min-height: 1.35rem;
}

.kb-status-live.is-error {
  color: #b91c1c;
}

.kb-results {
  margin-top: 1.5rem;
  border-top: 1px solid #e7e5e4;
  padding-top: 1.25rem;
}

.kb-summary-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border-radius: 12px;
  background: #fcf9f6;
  border: 1px solid #e7e5e4;
  margin-bottom: 1rem;
}

.kb-summary-metrics {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: #1c1917;
}

.kb-badge-saved {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: #d1fae5;
  color: #065f46;
  font-size: 0.825rem;
  font-weight: 700;
}

.kb-badge-info {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: #ffedd5;
  color: #9a3412;
  font-size: 0.825rem;
  font-weight: 700;
}

.kb-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.kb-action-btn {
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  min-height: 44px;
  padding: 0.5rem 1rem;
  border-radius: 10px;
  border: 1.5px solid #1c1917;
  background: #1c1917;
  color: #ffffff;
  cursor: pointer;
}

.kb-action-btn.is-secondary {
  background: #ffffff;
  color: #1c1917;
  border-color: #767676;
}

.kb-action-btn.is-accent {
  background: #f97316;
  border-color: #f97316;
  color: #ffffff;
}

.kb-file-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.kb-file-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  padding: 0.85rem;
  border: 1px solid #e7e5e4;
  border-radius: 12px;
  background: #ffffff;
}

.kb-file-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
  flex: 1 1 14rem;
}

.kb-thumb {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid #e7e5e4;
  flex-shrink: 0;
  background: #f5f5f4;
}

.kb-file-meta {
  min-width: 0;
}

.kb-file-name {
  font-weight: 700;
  color: #1c1917;
  font-size: 0.95rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 18rem;
}

.kb-file-stats {
  font-size: 0.84rem;
  color: #57534e;
  margin-top: 0.2rem;
}

/* Content sections */
.kb-content-section {
  max-width: 64rem;
  margin: 0 auto;
  padding: 3.5rem 1.5rem;
}

.kb-content-section h2 {
  font-family: var(--font-display, "Manrope", sans-serif);
  font-size: clamp(1.6rem, 2.6vw, 2.1rem);
  font-weight: 800;
  color: #1c1917;
  margin-bottom: 1rem;
  line-height: 1.25;
}

.kb-section-intro {
  font-size: 1.05rem;
  color: #57534e;
  max-width: 48rem;
  margin-bottom: 2rem;
  line-height: 1.7;
}

.kb-steps-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
}

.kb-prose-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
}

@media (max-width: 768px) {
  .kb-steps-grid,
  .kb-prose-grid {
    grid-template-columns: 1fr;
  }
}

.kb-card {
  background: #ffffff;
  border: 1px solid #e7e5e4;
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: var(--shadow-sm, 0 1px 2px rgba(0, 0, 0, 0.05));
}

.kb-card h3 {
  font-family: var(--font-display, "Manrope", sans-serif);
  font-size: 1.15rem;
  font-weight: 700;
  color: #1c1917;
  margin-bottom: 0.65rem;
}

.kb-card p {
  color: #57534e;
  line-height: 1.7;
  font-size: 0.975rem;
}

.kb-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #c2410c;
  font-weight: 800;
  font-size: 0.9rem;
  margin-bottom: 0.85rem;
}

/* Responsive table with container queries */
.kb-table-wrapper {
  container-type: inline-size;
  overflow-x: auto;
  border: 1px solid #e7e5e4;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: var(--shadow-sm, 0 1px 2px rgba(0, 0, 0, 0.05));
}

.kb-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.95rem;
}

.kb-table thead th {
  position: sticky;
  top: 0;
  background: #fcf9f6;
  z-index: 2;
  padding: 0.95rem 1.1rem;
  font-weight: 700;
  color: #1c1917;
  border-bottom: 2px solid #e7e5e4;
  white-space: nowrap;
}

.kb-table tbody th {
  position: sticky;
  left: 0;
  background: #ffffff;
  z-index: 1;
  padding: 0.95rem 1.1rem;
  font-weight: 700;
  color: #1c1917;
  border-bottom: 1px solid #f5f5f4;
}

.kb-table tbody td {
  padding: 0.95rem 1.1rem;
  color: #44403c;
  border-bottom: 1px solid #f5f5f4;
}

@container (width < 600px) {
  .kb-table thead {
    position: absolute;
    clip-path: inset(50%);
    width: 1px;
    height: 1px;
    overflow: hidden;
  }
  .kb-table,
  .kb-table tbody,
  .kb-table tr,
  .kb-table th,
  .kb-table td {
    display: block;
    width: 100%;
  }
  .kb-table tbody tr {
    padding: 0.95rem 1rem;
    border-bottom: 2px solid #e7e5e4;
  }
  .kb-table tbody th {
    position: static;
    padding: 0 0 0.5rem 0;
    border-bottom: none;
    font-size: 1.05rem;
  }
  .kb-table tbody td {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    padding: 0.45rem 0;
    border-bottom: 1px dashed #e7e5e4;
    text-align: right;
  }
  .kb-table tbody td:last-child {
    border-bottom: none;
  }
  .kb-table tbody td::before {
    content: attr(data-label);
    font-weight: 700;
    color: #57534e;
    text-align: left;
    flex-shrink: 0;
  }
}

/* Native details/summary FAQ */
.kb-faq-list {
  max-width: 52rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  text-align: left;
}

.kb-faq-item {
  background: #ffffff;
  border: 1px solid #e7e5e4;
  border-radius: 14px;
  overflow: hidden;
}

.kb-faq-summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 54px;
  padding: 1rem 1.25rem;
  font-weight: 700;
  font-size: 1.05rem;
  color: #1c1917;
  cursor: pointer;
}

.kb-faq-summary::-webkit-details-marker {
  display: none;
}

.kb-faq-summary::after {
  content: "+";
  font-size: 1.4rem;
  color: #f97316;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
}

.kb-faq-item[open] .kb-faq-summary::after {
  content: "−";
}

.kb-faq-answer {
  padding: 0 1.25rem 1.2rem;
  color: #57534e;
  line-height: 1.75;
  font-size: 0.975rem;
}
