.kh-tool,
.kh-tool * {
  box-sizing: border-box;
}

.kh-tool {
  --kh-ink: #1a1a1a;
  --kh-muted: #66727a;
  --kh-blue: #0170b9;
  --kh-blue-dark: #005b96;
  --kh-teal: #0f766e;
  --kh-amber: #d97706;
  --kh-line: #dce3e7;
  --kh-soft: #f5f7f8;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  overflow: hidden;
  color: var(--kh-ink);
  background: #ffffff;
  border: 1px solid var(--kh-line);
  border-radius: 8px;
  box-shadow: 0 16px 40px rgba(26, 26, 26, 0.08);
  font-family: "Source Sans Pro", Arial, sans-serif;
  line-height: 1.45;
}

.kh-tool h2,
.kh-tool h3,
.kh-tool p,
.kh-tool dl,
.kh-tool dt,
.kh-tool dd {
  margin: 0;
}

.kh-tool button,
.kh-tool input {
  font: inherit;
  letter-spacing: 0;
}

.kh-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 118px;
  padding: 26px 32px;
  color: #ffffff;
  background: var(--kh-ink);
  border-bottom: 4px solid var(--kh-blue);
}

.kh-header .kh-eyebrow {
  margin-bottom: 5px;
  color: #9fd8f5;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  text-transform: uppercase;
}

.kh-header h2 {
  color: #ffffff;
  font-family: "Poppins", Arial, sans-serif;
  font-size: 28px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0;
}

.kh-badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 11px;
  color: #fff7e6;
  background: rgba(217, 119, 6, 0.2);
  border: 1px solid rgba(245, 158, 11, 0.55);
  border-radius: 4px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.kh-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.72fr) minmax(460px, 1.28fr);
  min-height: 560px;
}

.kh-controls,
.kh-visual {
  min-width: 0;
  padding: 30px 32px;
}

.kh-controls {
  background: var(--kh-soft);
  border-right: 1px solid var(--kh-line);
}

.kh-controls > h3,
.kh-summary h3,
.kh-visual-heading h3 {
  color: var(--kh-ink);
  font-family: "Poppins", Arial, sans-serif;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0;
}

.kh-fields {
  display: grid;
  gap: 20px;
  margin-top: 22px;
}

.kh-field {
  display: grid;
  gap: 8px;
  color: #39434a;
  font-size: 14px;
  font-weight: 600;
}

.kh-field strong {
  color: var(--kh-blue-dark);
  font-family: "Poppins", Arial, sans-serif;
}

.kh-input-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 46px;
  align-items: stretch;
  min-height: 50px;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid #b9c5cb;
  border-radius: 6px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.kh-input-wrap:focus-within {
  border-color: var(--kh-blue);
  box-shadow: 0 0 0 3px rgba(1, 112, 185, 0.14);
}

.kh-tool .kh-input-wrap input {
  width: 100%;
  min-width: 0;
  height: 48px;
  margin: 0;
  padding: 9px 13px;
  color: var(--kh-ink);
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  outline: 0;
  font-family: "Poppins", Arial, sans-serif;
  font-size: 18px;
  font-weight: 600;
  line-height: 1;
}

.kh-input-wrap small {
  display: grid;
  place-items: center;
  color: var(--kh-muted);
  background: #edf1f3;
  border-left: 1px solid var(--kh-line);
  font-size: 13px;
  font-weight: 700;
}

.kh-error {
  margin-top: 14px !important;
  padding: 10px 12px;
  color: #9f2d20;
  background: #fff1ef;
  border-left: 3px solid #c24132;
  font-size: 13px;
}

.kh-summary {
  margin-top: 34px;
  padding-top: 28px;
  border-top: 1px solid var(--kh-line);
}

.kh-summary dl {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-top: 15px;
  border-top: 1px solid var(--kh-line);
  border-left: 1px solid var(--kh-line);
}

.kh-summary dl > div {
  min-width: 0;
  padding: 13px 14px;
  background: #ffffff;
  border-right: 1px solid var(--kh-line);
  border-bottom: 1px solid var(--kh-line);
}

.kh-summary dt {
  color: var(--kh-muted);
  font-size: 12px;
  font-weight: 700;
}

.kh-summary dd {
  margin-top: 4px;
  color: var(--kh-ink);
  font-family: "Poppins", Arial, sans-serif;
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
}

.kh-visual {
  display: flex;
  flex-direction: column;
  background: #ffffff;
}

.kh-visual-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}

.kh-visual-heading p {
  margin-top: 3px;
  color: var(--kh-muted);
  font-size: 13px;
}

.kh-visual-heading > span {
  padding-top: 2px;
  color: var(--kh-teal);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.kh-canvas-wrap {
  position: relative;
  width: 100%;
  min-height: 330px;
  flex: 1 1 auto;
  overflow: hidden;
  border: 1px solid var(--kh-line);
  border-radius: 6px;
  background: #ffffff;
}

.kh-canvas-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 330px;
}

.kh-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 18px;
}

.kh-tool .kh-copy,
.kh-tool .kh-details-toggle {
  min-height: 48px;
  margin: 0;
  padding: 11px 17px;
  border-radius: 5px;
  box-shadow: none;
  cursor: pointer;
  font-family: "Poppins", Arial, sans-serif;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  text-transform: none;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.kh-tool .kh-copy {
  color: #ffffff;
  background: var(--kh-blue);
  border: 1px solid var(--kh-blue);
}

.kh-tool .kh-copy:hover,
.kh-tool .kh-copy:focus-visible {
  color: #ffffff;
  background: var(--kh-blue-dark);
  border-color: var(--kh-blue-dark);
}

.kh-tool .kh-copy.is-copied {
  background: var(--kh-teal);
  border-color: var(--kh-teal);
}

.kh-tool .kh-copy:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.kh-tool .kh-details-toggle {
  color: var(--kh-ink);
  background: #ffffff;
  border: 1px solid #aebbc1;
}

.kh-tool .kh-details-toggle:hover,
.kh-tool .kh-details-toggle:focus-visible {
  color: var(--kh-blue-dark);
  background: #f7fbfd;
  border-color: var(--kh-blue);
}

.kh-tool .kh-copy:active,
.kh-tool .kh-details-toggle:active {
  transform: translateY(1px);
}

.kh-tool button:focus-visible,
.kh-tool input:focus-visible {
  outline: 3px solid rgba(1, 112, 185, 0.24);
  outline-offset: 2px;
}

.kh-status {
  min-height: 21px;
  margin-top: 9px !important;
  color: var(--kh-teal);
  font-size: 13px;
  font-weight: 600;
}

.kh-status.is-error {
  color: #9f2d20;
}

.kh-coordinate-panel {
  margin-top: 8px;
  padding-top: 18px;
  border-top: 1px solid var(--kh-line);
}

.kh-coordinate-panel[hidden] {
  display: none;
}

.kh-table-wrap {
  max-height: 320px;
  overflow: auto;
  border: 1px solid var(--kh-line);
  border-radius: 5px;
}

.kh-coordinate-panel table {
  width: 100%;
  margin: 0;
  border: 0;
  border-collapse: collapse;
  background: #ffffff;
  font-variant-numeric: tabular-nums;
}

.kh-coordinate-panel th,
.kh-coordinate-panel td {
  padding: 9px 12px;
  text-align: right;
  border: 0;
  border-bottom: 1px solid #edf0f2;
  font-size: 13px;
}

.kh-coordinate-panel th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #ffffff;
  background: #3a3a3a;
  font-weight: 700;
}

.kh-coordinate-panel th:first-child,
.kh-coordinate-panel td:first-child {
  width: 62px;
  text-align: center;
}

.kh-coordinate-panel tbody tr:last-child td {
  border-bottom: 0;
}

@media (max-width: 820px) {
  .kh-layout {
    grid-template-columns: 1fr;
  }

  .kh-controls {
    border-right: 0;
    border-bottom: 1px solid var(--kh-line);
  }

  .kh-fields {
    grid-template-columns: 1fr 1fr;
  }

  .kh-canvas-wrap,
  .kh-canvas-wrap canvas {
    min-height: 360px;
  }
}

@media (max-width: 560px) {
  .kh-header {
    align-items: flex-start;
    min-height: 104px;
    padding: 22px 20px;
  }

  .kh-header h2 {
    font-size: 23px;
  }

  .kh-badge {
    font-size: 11px;
  }

  .kh-controls,
  .kh-visual {
    padding: 24px 18px;
  }

  .kh-fields,
  .kh-actions {
    grid-template-columns: 1fr;
  }

  .kh-summary dd {
    font-size: 14px;
  }

  .kh-canvas-wrap,
  .kh-canvas-wrap canvas {
    min-height: 290px;
  }

  .kh-tool .kh-copy,
  .kh-tool .kh-details-toggle {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .kh-tool * {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

