.q-tool, .q-template {
  box-sizing: border-box;
  min-width: 0;
  color: var(--ink);
  padding: clamp(1.1rem, 3.2vw, 2.4rem);
  border: 1px solid var(--ink);
}
.q-tool { background: var(--tea); }
.q-template { background: var(--lilac); margin: 1.2rem 0; }
.q-tool h2, .q-model-group h2, .q-template h3 {
  font-family: 'Bricolage Grotesque', sans-serif;
  line-height: 1.15;
  margin: 0 0 .75rem;
  color: var(--ink);
}
.q-template h3 { font-size: clamp(1.25rem, 2.7vw, 1.65rem); }
.q-tool p, .q-model-group > p { line-height: 1.55; }
.q-tool p { margin: .65rem 0; }
.q-rate-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr));
  align-items: end;
  gap: 1rem;
  margin: 1.5rem 0 1rem;
}
.q-rate-fields label, .q-template__label, .q-rate-result label {
  display: block;
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.4;
}
.q-tool .q-amount {
  display: flex;
  align-items: center;
  margin-top: .5rem;
  background: var(--paper);
  border: 1px solid var(--ink);
}
.q-amount > span { padding: .5rem .75rem .5rem 0; font-size: .875rem; white-space: nowrap; }
.q-tool input, .q-template textarea {
  box-sizing: border-box;
  border-radius: 0;
  color: var(--ink);
  background: var(--paper);
  font-size: 1rem;
  max-width: 100%;
}
.q-tool input, .q-money, .q-rate-result output {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
}
.q-tool input { min-width: 0; width: 100%; }
.q-tool .q-amount input { border: 0; padding: .8rem .75rem; background: transparent; }
.q-tool input:focus-visible, .q-template textarea:focus-visible, .q-tool-button:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}
.q-tool input[aria-invalid="true"] { box-shadow: inset 0 -3px var(--brick); }
.q-tool .q-error { font-weight: 600; }
.q-error:empty { display: none; }
.q-rate-result {
  border-block: 1px solid var(--ink);
  padding: 1.2rem 0;
  margin: 1.3rem 0 1rem;
}
.q-rate-result output { display: block; font-size: clamp(1.65rem, 4.2vw, 2.7rem); font-weight: 600; overflow-wrap: anywhere; }
.q-formula strong { margin-right: .4em; }
.q-tool .q-explain, .q-feedback { font-size: .93rem; }
.q-tool .q-explain { margin-bottom: 0; }
.q-template__label span { display: block; margin-bottom: .45rem; }
.q-template textarea {
  border: 1px solid var(--ink);
  font-family: inherit;
  font-weight: 400;
  line-height: 1.5;
  padding: .8rem 1rem;
  width: 100%;
  min-height: 6rem;
  resize: vertical;
  display: block;
}
.q-tool-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .65rem 1rem; margin-top: 1rem; }
.q-tool-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  min-height: 2.75rem;
  padding: .65rem 1rem;
  border: 1px solid var(--brick);
  border-radius: 0;
  font: inherit;
  font-weight: 650;
  color: #fff;
  background: var(--brick);
  cursor: pointer;
}
.q-tool-button:hover { background: var(--ink); border-color: var(--ink); }
.q-tool-button:disabled { opacity: .6; cursor: default; }
.q-feedback:empty { display: none; }
.q-cash-table { border-collapse: collapse; width: 100%; margin-top: 1.3rem; table-layout: fixed; }
.q-cash-table caption { font-weight: 650; text-align: left; margin-bottom: .65rem; }
.q-cash-table th, .q-cash-table td {
  border: 0;
  border-bottom: 1px solid var(--ink);
  padding: .65rem .35rem;
  text-align: left;
  overflow-wrap: anywhere;
}
.q-cash-table thead th { font-size: .91rem; line-height: 1.25; vertical-align: bottom; border-top: 1px solid var(--ink); }
.q-cash-table thead th:first-child { width: 14%; }
.q-cash-table tbody th { font-size: 1rem; }
.q-cash-input input { padding: .55rem .35rem; border: 1px solid var(--ink); }
.q-cash-table .q-money { font-size: .94rem; }
.q-cash-table .q-negative { color: #843727; }
.q-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.q-mobile-label { display: none; }
.q-cash { container-type: inline-size; }
@container (max-width: 36rem) {
  .q-cash-table { display: block; }
  .q-cash-table caption { display: block; }
  .q-cash-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .q-cash-table tbody, .q-cash-table tr { display: block; }
  .q-cash-table tr { margin: 1rem 0; }
  .q-cash-table tbody th { display: block; background: var(--ink); color: var(--paper); padding: .55rem .7rem; }
  .q-cash-table td {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    align-items: center;
    gap: .4rem;
    padding: .5rem .15rem;
  }
  .q-mobile-label { display: block; font-size: .91rem; }
  .q-cash-end .q-mobile-label { font-weight: 650; }
}
