/* ============================================================================
   Free tools panel: the Brand Consistency Quiz and the three calculators.
   One dialog over the page, in the Kalakaari Monkey look. Nothing here
   touches the engine, the sections or the chat.
   ========================================================================== */

.kt {
  position: fixed; inset: 0; z-index: 95;
  display: grid; place-items: center;
  padding: 24px 16px;
  background: hsl(24 8% 8% / 0.58);
  font-family: "Inter", system-ui, sans-serif;
  color: var(--km-ink);
}
.kt[hidden] { display: none; }
html.tool-open { overflow: hidden; }
.kt :focus-visible { outline: 2px solid var(--km-ink); outline-offset: 3px; }
.kt [tabindex="-1"]:focus { outline: none; }
:where(.kt) :where(button, input, select) { font: inherit; color: inherit; }

.kt-panel {
  position: relative;
  width: min(480px, 100%);
  max-height: min(880px, calc(100dvh - 48px));
  display: flex; flex-direction: column; overflow: hidden;
  border-radius: 22px; background: #FFFFFF;
  box-shadow: 0 40px 90px -30px hsl(24 8% 8% / 0.7);
}
.kt.is-open .kt-panel { animation: kt-in 320ms var(--sc-ease-out) both; }
@keyframes kt-in { from { opacity: 0; transform: translateY(18px) scale(0.97); } to { opacity: 1; transform: none; } }

/* header: the monkey stands on its bottom edge, like the chat's */
.kt-head {
  flex: none; position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 10px 14px 16px;
  background: var(--km-sun);
}
.kt-head__monkey { flex: none; align-self: flex-end; height: 76px; width: auto; max-width: none; margin: -12px 0 -16px 0; }
.kt-head__text { flex: 1; min-width: 0; }
.kt-head__title { margin: 0; font: 800 17px/1.15 "Roboto Slab", Georgia, serif; }
.kt-head__sub { margin: 2px 0 0; font-size: 12.5px; line-height: 1.3; }
.kt-pill { flex: none; padding: 5px 11px; border-radius: 999px; background: var(--km-ink); color: var(--km-paper); font-size: 12.5px; font-weight: 700; }
.kt-pill[hidden] { display: none; }
.kt-close {
  flex: none; width: 44px; height: 44px; border: 0; border-radius: 50%;
  display: grid; place-items: center; background: transparent; cursor: pointer;
  transition: transform 240ms var(--spring), background-color 160ms var(--sc-ease-out);
}
.kt-close svg { width: 20px; height: 20px; }
@media (hover: hover) and (pointer: fine) { .kt-close:hover { transform: translateY(-2px); background: hsl(24 8% 8% / 0.1); } }
.kt-close:active { transform: scale(0.92); }

.kt-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.kt-screen {
  box-sizing: border-box; min-height: 100%;
  display: flex; flex-direction: column; gap: 14px;
  padding: 26px 28px 24px;
}
.kt-screen--flush { padding: 0; gap: 0; }
.kt-screen__in { flex: 1; display: flex; flex-direction: column; gap: 16px; padding: 28px 28px 22px; }
.kt.is-open .kt-screen { animation: kt-fade 260ms var(--sc-ease-out) both; }
@keyframes kt-fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* type */
.kt-kicker { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: #8A4E26; }
.kt-h1 { margin: 0; font: 900 34px/1.04 "Roboto Slab", Georgia, serif; letter-spacing: -0.02em; text-wrap: balance; }
.kt-h2 { margin: 0; font: 800 24px/1.16 "Roboto Slab", Georgia, serif; letter-spacing: -0.01em; text-wrap: balance; }
.kt-p { margin: 0; font-size: 15.5px; line-height: 1.55; text-wrap: pretty; }
.kt-p--sm { font-size: 14px; line-height: 1.45; }
.kt-small { margin: 0; font-size: 12.5px; line-height: 1.45; color: #5A5653; }
.kt-small--end { margin-top: auto; text-align: center; }
.kt-sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.kt-figure { margin: 0; font: 800 20px/1.2 "Roboto Slab", Georgia, serif; }
.kt-big { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.1; }
.kt-big__num { font: 900 34px/1.05 "Roboto Slab", Georgia, serif; color: #8A4E26; }
.kt-big__num--ink { font-size: 30px; color: var(--km-ink); }
.kt-stack { display: flex; flex-direction: column; gap: 4px; }

/* forms */
.kt-form { display: flex; flex-direction: column; gap: 14px; margin: 0; }
.kt-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.kt-field[hidden] { display: none; }
.kt-label { margin: 0; font-size: 13px; font-weight: 600; }
.kt-label--lg { font-size: 14px; line-height: 1.4; }
.kt-hint { margin: 0; font-size: 12px; line-height: 1.4; color: #5A5653; }
.kt-input {
  box-sizing: border-box; width: 100%; min-height: 48px;
  padding: 11px 14px; border: 0; border-radius: 12px;
  background: #FFFFFF; box-shadow: inset 0 0 0 1.5px rgba(59, 57, 55, 0.4);
  font-size: 16px; /* 16px or more: iOS Safari will not zoom the page */
}
.kt-input:focus-visible { outline-offset: 1px; }
.kt-input[aria-invalid="true"] { box-shadow: inset 0 0 0 2px #B3261E; }
.kt-affix { position: relative; display: flex; align-items: center; }
.kt-affix__pre, .kt-affix__suf { position: absolute; font-size: 15px; color: #5A5653; pointer-events: none; }
.kt-affix__pre { left: 13px; }
.kt-affix__suf { right: 13px; }
.kt-input--prefix { padding-left: 30px; }
.kt-input--suffix { padding-right: 48px; }
.kt-err { margin: 0; font-size: 13px; font-weight: 600; color: #B3261E; }
.kt-err:empty { display: none; }
.kt-pair { display: grid; grid-template-columns: minmax(0, 1fr) 104px; gap: 8px; align-items: end; }
.kt-pair--budget { grid-template-columns: minmax(0, 1fr) 128px; }
.kt-hp { position: absolute; left: -5000px; width: 1px; height: 1px; overflow: hidden; }

/* buttons: everything pressable lifts and lights up, like the rest of the site */
.kt-btn {
  box-sizing: border-box; min-height: 52px; padding: 0 22px;
  display: flex; align-items: center; justify-content: center;
  border: 0; border-radius: 999px; cursor: pointer;
  background: var(--km-ink); color: var(--km-paper);
  font-weight: 700; font-size: 16px; text-align: center; text-decoration: none;
  transition: transform 240ms var(--spring), background-color 160ms var(--sc-ease-out), color 160ms var(--sc-ease-out), box-shadow 220ms var(--sc-ease-out);
}
.kt-btn--ghost { min-height: 44px; background: #FFFFFF; color: var(--km-ink); box-shadow: inset 0 0 0 1.5px rgba(59, 57, 55, 0.4); font-weight: 600; font-size: 14px; }
.kt-btn:disabled { opacity: 0.6; cursor: default; }
@media (hover: hover) and (pointer: fine) {
  .kt-btn:not(:disabled):hover { transform: translateY(-3px); background: var(--km-sun); color: var(--km-ink); box-shadow: 0 10px 20px -10px hsl(24 8% 8% / 0.5); }
}
.kt-btn:not(:disabled):active { transform: translateY(1px) scale(0.98); transition-duration: 90ms; }
.kt-actions { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding-top: 4px; }

/* quiz answers and segmented choices */
.kt-opts { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.kt-opt, .kt-seg {
  border: 0; border-radius: 14px; cursor: pointer;
  background: #F4F4F4; box-shadow: inset 0 0 0 2px rgba(59, 57, 55, 0);
  transition: transform 220ms var(--spring), background-color 160ms var(--sc-ease-out), box-shadow 160ms var(--sc-ease-out);
}
.kt-opt { width: 100%; min-height: 56px; padding: 14px 16px; text-align: left; font-size: 15px; font-weight: 500; line-height: 1.4; }
.kt-segs { display: grid; gap: 8px; }
.kt-segs--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kt-segs--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kt-seg { min-height: 50px; padding: 8px 6px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; }
.kt-seg__main { font-weight: 700; font-size: 14.5px; }
.kt-seg__sub { font-size: 12px; }
@media (hover: hover) and (pointer: fine) {
  .kt-opt:hover, .kt-seg:hover { transform: translateY(-2px); box-shadow: inset 0 0 0 2px var(--km-ink); }
}
.kt-opt[aria-pressed="true"], .kt-seg[aria-pressed="true"] { background: var(--km-sun); box-shadow: inset 0 0 0 2px var(--km-ink); }
.kt-opt:active, .kt-seg:active { transform: scale(0.98); }
.kt-row { margin-top: auto; display: flex; align-items: center; min-height: 44px; }
.kt-row__end { margin-left: auto; }
.kt-back { min-height: 44px; padding: 0 4px; border: 0; background: transparent; font-weight: 600; font-size: 14px; cursor: pointer; }
.kt-progress { flex: none; height: 5px; background: #ECE9E4; }
.kt-progress span { display: block; height: 5px; background: var(--km-ink); transition: width 300ms var(--sc-ease-out); }

/* boxes */
.kt-box { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border-radius: 16px; background: #F4F4F4; }
.kt-box--tight { gap: 3px; padding: 12px 14px; border-radius: 14px; }
.kt-box--line { background: #FFFFFF; box-shadow: inset 0 0 0 1.5px rgba(59, 57, 55, 0.4); gap: 6px; }
.kt-box__label { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.kt-tick { margin: 0; display: flex; align-items: center; gap: 10px; font-size: 14.5px; }
.kt-tick::before { content: ""; flex: none; width: 14px; height: 8px; margin: -3px 2px 0; border-left: 2.5px solid var(--km-ink); border-bottom: 2.5px solid var(--km-ink); transform: rotate(-45deg); }
.kt-duo { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.kt-win { display: flex; flex-direction: column; gap: 4px; padding: 13px 16px; border-radius: 14px; background: var(--km-sun); }
.kt-win__label { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.kt-win__text { margin: 0; font-size: 14.5px; line-height: 1.45; }

/* results */
.kt-score { display: flex; align-items: center; gap: 18px; }
.kt-score__text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.kt-ring {
  flex: none; width: 108px; height: 108px; border-radius: 50%;
  display: grid; place-items: center;
  background: conic-gradient(var(--fill, #3B3937) var(--deg, 0deg), #ECE9E4 0deg);
}
.kt-ring__in { width: 84px; height: 84px; border-radius: 50%; background: #FFFFFF; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.kt-ring__big { font: 900 28px/1 "Roboto Slab", Georgia, serif; }
.kt-ring__small { font-size: 11.5px; color: #5A5653; }
.kt-bars { display: flex; flex-direction: column; gap: 9px; }
.kt-bar { display: flex; flex-direction: column; gap: 5px; }
.kt-bar__top { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; }
.kt-bar__name { font-weight: 600; }
.kt-meter { height: 10px; border-radius: 99px; overflow: hidden; background: #ECE9E4; }
.kt-meter span { display: block; height: 100%; border-radius: 99px; transition: width 360ms var(--sc-ease-out); }
.kt-hbar { display: grid; grid-template-columns: 112px minmax(0, 1fr) 40px; gap: 10px; align-items: center; font-size: 13.5px; }
.kt-hbar__name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kt-hbar__val { text-align: right; }
.kt-range { width: 100%; min-height: 32px; accent-color: var(--km-ink); }
.kt-range__ends { display: flex; justify-content: space-between; font-size: 12px; color: #5A5653; margin-top: -6px; }
.kt-stackbar { display: flex; height: 18px; border-radius: 99px; overflow: hidden; background: #ECE9E4; }
.kt-stackbar span { display: block; height: 100%; box-shadow: inset -1px 0 0 #FFFFFF; }
.kt-channels { display: flex; flex-direction: column; gap: 8px; }
.kt-channel { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 10px 12px; border-radius: 12px; background: #F4F4F4; }
.kt-channel__swatch { width: 14px; height: 14px; margin-top: 3px; border-radius: 4px; box-shadow: inset 0 0 0 1.5px var(--km-ink); }
.kt-channel__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kt-channel__name { margin: 0; font-size: 14px; font-weight: 700; }
.kt-channel__nums { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.kt-channel__pct { margin: 0; font: 800 17px/1.2 "Roboto Slab", Georgia, serif; }
.kt-channel__amt { margin: 0; font-size: 12.5px; }

/* phones: the panel becomes the whole screen */
@media (max-width: 600px) {
  .kt { padding: 0; place-items: stretch; }
  .kt-panel { width: 100%; max-height: none; height: 100%; height: 100dvh; border-radius: 0; }
  .kt-head { padding-top: max(14px, env(safe-area-inset-top)); padding-right: max(10px, env(safe-area-inset-right)); }
  .kt-screen { padding: 22px 20px max(22px, env(safe-area-inset-bottom)); }
  .kt-screen--flush { padding: 0; }
  .kt-screen__in { padding: 24px 20px max(22px, env(safe-area-inset-bottom)); }
  .kt-h1 { font-size: 30px; }
  .kt-hbar { grid-template-columns: 96px minmax(0, 1fr) 36px; }
}

@media (prefers-reduced-motion: reduce) {
  .kt.is-open .kt-panel, .kt.is-open .kt-screen { animation: none !important; }
  .kt-btn, .kt-close, .kt-opt, .kt-seg, .kt-meter span, .kt-progress span { transition: none !important; }
  .kt-btn:hover, .kt-opt:hover, .kt-seg:hover { transform: none !important; }
}
