﻿/* kc-v2 v1.5.7 -- forms & search */
/* Full class contract and conventions: see README.md and kc-v2-base.css. */

/* ---------------------------------------------------------------------------
 * Forms & Search
 *
 * .kc-v2-field is the scope root a page wraps around one label + control +
 * helper/error text. It exists only so ".validationMessage" (Knockout-
 * Validation's own emitted class -- see README) can be styled scoped rather
 * than unscoped; it carries no layout of its own beyond the stack it already
 * gets from being used with .kc-v2-stack.
 *
 * Error state uses [aria-invalid="true"], not a "--error" modifier class: this
 * is the ARIA-first convention (see README point 4) and costs a page author
 * no more than a class binding would -- e.g. Knockout:
 *   data-bind="attr: { 'aria-invalid': !field.isValid() && field.isModified() }"
 * A screen reader announces the invalid state natively from the attribute;
 * pair it with aria-describedby pointing at the error text's id.
 *
 * font-size is 16px, not the 14px shown in the Figma component sheet --
 * deliberately, per the KENT-55 plan: below 16px, iOS Safari zooms the
 * viewport on every input focus. This is a recorded, intentional deviation
 * from the mockup, not an oversight.
 * ------------------------------------------------------------------------- */

.kc-v2-label,
.kc-v2-legend {
  display: block;
  margin-bottom: var(--kc-v2-space-1);
  padding: 0;
  font-family: var(--kc-v2-font-family);
  font-size: 14px;
  font-weight: 600;
  line-height: 16px;
  color: var(--kc-v2-ink-800);
}

/* Required-field marker inside a label (KENT-57).
 *
 * The asterisk is DECORATIVE. Pages pair it with aria-hidden="true" on this span and the real
 * `required` attribute on the control, so assistive tech reads requiredness from the input rather
 * than from a punctuation mark in the label text.
 *
 * Uses --kc-v2-error-text (#A5271A), not --kc-v2-error (#C0392B): a 13px marker has to clear WCAG
 * 1.4.3's 4.5:1 against the card background, which the brighter red does not.
 *
 * Added because Quarterly's step 1 marks four fields that ko.validation already treats as
 * `required: true` while only one of them carried any visible marker -- so three fields could block
 * Next with no indication they were needed. */
.kc-v2-required {
  margin-left: 2px;
  font-weight: 700;
  color: var(--kc-v2-error-text);
}

.kc-v2-label--spaced {
  margin-bottom: var(--kc-v2-space-2);
}

/* A radio/checkbox group's own reset -- kept as a class rather than left to
   each page's inline style, so the fieldset/legend UA defaults (border,
   padding) are owned by the library like everything else. */
.kc-v2-fieldset {
  border: 0;
  padding: 0;
  margin: 0;
  /* min-width: 0 is NOT redundant on a fieldset (1.5.0, KENT-56).
     <fieldset> carries an intrinsic `min-width: min-content` in every engine, and unlike a div it
     will not shrink below its content no matter what the parent does. So a fieldset wrapping anything
     with a wide min-content -- a .kc-v2-table-wrapper, say -- stops being able to fit its column and
     pushes the PAGE into horizontal scroll instead, taking the scroll away from the wrapper that was
     supposed to own it.
     Measured on the Business License employee-details grids: adding one contractor row widened the
     table's min-content and the enclosing fieldset went to 724px inside a 265px column, overflowing a
     375px viewport. Named by the suite's widestOffender(), which is the only reason it was found --
     a fieldset is the last element anyone suspects. */
  min-width: 0;
}

/* display: block, matching .kc-v2-error-text below. Helper text is an annotation *under*
   whatever it explains, never a run of text inside a sentence -- so it should not depend on
   the element the page happens to choose. Without this a <span class="kc-v2-helper-text">
   rendered inline, trailing the preceding sentence instead of sitting on its own line. */
/* margin-bottom is declared, not inherited: these are usually <p>, and every host has an opinion
   about paragraph margins (UA 1em = 12px here, bootstrap 10px). Leaving it unstated made the gap
   under a field depend on which app the component landed in. KENT-44 audit. */
.kc-v2-helper-text {
  display: block;
  margin-bottom: 0;
  margin-top: var(--kc-v2-space-1);
  font-family: var(--kc-v2-font-family);
  font-size: 12px;
  font-weight: 400;
  line-height: 15px;
  color: var(--kc-v2-ink-500);
}

.kc-v2-field .validationMessage,
.kc-v2-error-text {
  display: block;
  margin-bottom: 0;
  margin-top: var(--kc-v2-space-1);
  font-family: var(--kc-v2-font-family);
  font-size: 12px;
  font-weight: 500;
  line-height: 15px;
  color: var(--kc-v2-error);
}

/* Both of these set `display: block` at (0,1,0), which beats the UA stylesheet's
   `[hidden] { display: none }` -- so `hidden` on either did nothing and the element stayed on
   screen. That matters most for the error: a message that is meant to appear only on failure is the
   NORMAL use of this class, and without the guard it shows permanently.

   THIRD instance of this in the library (after .kc-v2-modal and .kc-v2-alert), so it is worth
   stating as a rule: any component whose base rule declares `display` must restate the hidden case
   explicitly, or the native attribute silently stops working. */
.kc-v2-field .validationMessage[hidden],
.kc-v2-error-text[hidden],
.kc-v2-helper-text[hidden] {
  display: none;
}

/* A note that sits ABOVE what it annotates, such as guidance before a table, needs room beneath it. */
.kc-v2-helper-text--spaced {
  margin-bottom: var(--kc-v2-space-3);
}

/* VERTICAL PADDING IS NOT SHARED, and that is the fix for a bug this library had three times.
   .kc-v2-input and .kc-v2-select both carry a fixed height (43px); .kc-v2-textarea sizes itself from
   min-height and its content. Vertical padding only makes sense for the second kind: combined with a
   fixed height it eats the content box instead of adding to it. With `--kc-v2-space-3` top and bottom
   a 43px control was left 9px of content box for 16px text needing ~19px -- the <select> clipped its
   value visibly, and the <input> only looked right because it centres and overflows rather than
   clipping. A fixed-height control centres its own text with no padding at all, which is what
   .kc-v2-btn already does for the same reason. So the textarea declares its own below. */
.kc-v2-input,
.kc-v2-textarea,
.kc-v2-select {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  padding: 0 14px;
  border: 1px solid var(--kc-v2-ink-300);
  border-radius: var(--kc-v2-radius-md);
  background-color: var(--kc-v2-white);
  font-family: var(--kc-v2-font-family);
  font-size: 16px; /* see file-header note: deviates from Figma's 14px on purpose */
  font-weight: 400;
  line-height: normal;
  color: var(--kc-v2-ink-800);
}

.kc-v2-input {
  height: 43px;
}

/* Same explicit height as .kc-v2-input (1.5.0). The select had none and sized itself from its
   content, which lands taller -- so a City text box and the State dropdown beside it in one
   .kc-v2-field-row did not line up. Stated rather than inherited because an input and a select
   compute their intrinsic height differently. The vertical padding this needs zeroed is handled on
   the shared rule above; see the note there for why it is not shared. */
.kc-v2-select {
  height: 43px;
}

/* ELEMENT-QUALIFIED to survive Returns.css, which every Annual/Quarterly page loads:
     input[type="text"], .quarterly-dd { height: 22px; font-size: 12px; line-height: 12px;
                                         padding: 0 0 0 6px; }
   That attribute selector is (0,1,1) and the class rules above are (0,1,0), so it won them
   outright -- a kc-v2 text input measured 22px tall with 12px type and almost no padding.
   `input.kc-v2-input` is also (0,1,1), which ties, and ties go to whichever loaded last: kc-v2
   is always last (see README). line-height is restated because the host sets 12px and the
   rules above never declared it at all.

   Only `input` is qualified. `select` and `textarea` measured byte-identical in both renders
   during the KENT-44 audit -- the host rule names `input[type="text"]` and `.quarterly-dd`,
   and `.kc-v2-select` is neither -- so qualifying them would be speculative. If a future host
   attacks them, the audit harness will say so. */
input.kc-v2-input {
  height: 43px;
  padding: 0 14px;
  font-size: 16px;
  line-height: normal;
}

.kc-v2-input::placeholder,
.kc-v2-textarea::placeholder {
  color: var(--kc-v2-ink-500);
  opacity: 1;
}

.kc-v2-textarea {
  min-height: 96px;
  resize: vertical;
  /* The only control here whose height comes from its content, so it is the only one that
     wants vertical padding -- see the note on the shared rule above. */
  padding-top: var(--kc-v2-space-3);
  padding-bottom: var(--kc-v2-space-3);
}

/* A textarea that should read as an ordinary one-line field until it is needed. Its height
   still comes from rows + padding rather than a fixed height, so the padding cannot starve the
   content box -- which is exactly what `<textarea class="kc-v2-input">` did: 43px tall with
   `padding: 0 14px`, so the text sat flush against the top edge and clipped. At rows="1":
   1 + 11 + 19 + 11 + 1 = 43px, matching .kc-v2-input exactly. line-height is pinned rather than
   left `normal` so that total is arithmetic and not font-dependent. */
.kc-v2-textarea--input-height {
  min-height: 43px;
  line-height: 19px;
  padding-top: 11px;
  padding-bottom: 11px;
}

.kc-v2-input:hover,
.kc-v2-textarea:hover,
.kc-v2-select:hover {
  border-color: var(--kc-v2-ink-300);
}

.kc-v2-input:focus,
.kc-v2-textarea:focus,
.kc-v2-select:focus {
  border-color: var(--kc-v2-blue);
  outline: none; /* replaced by the explicit focus-visible ring below, per
                     README point 7 -- outline, never box-shadow */
}
.kc-v2-input:focus-visible,
.kc-v2-textarea:focus-visible,
.kc-v2-select:focus-visible {
  outline: var(--kc-v2-focus-ring-width) solid var(--kc-v2-focus-ring-color);
  outline-offset: 1px;
}

/* .kc-v2-select was MISSING from this list until 1.5.0, which made an invalid select completely
   silent: a page could set aria-invalid on one -- as the Business License form does on its nature
   dropdown -- and nothing was painted, so the only control on that step that could block submission
   gave the filer no indication at all. */
.kc-v2-input[aria-invalid="true"],
.kc-v2-select[aria-invalid="true"],
.kc-v2-textarea[aria-invalid="true"] {
  border-color: var(--kc-v2-error);
  background-color: var(--kc-v2-error-bg);
}

.kc-v2-input[readonly],
.kc-v2-textarea[readonly] {
  background-color: var(--kc-v2-ink-50);
  border-color: var(--kc-v2-ink-200);
  color: var(--kc-v2-ink-600);
  cursor: default;
}
.kc-v2-input[readonly]:focus,
.kc-v2-textarea[readonly]:focus {
  border-color: var(--kc-v2-ink-200);
  outline: none;
}

.kc-v2-input:disabled,
.kc-v2-textarea:disabled,
.kc-v2-select:disabled {
  background-color: var(--kc-v2-ink-100);
  border-color: var(--kc-v2-ink-200);
  color: var(--kc-v2-ink-400);
  cursor: not-allowed;
}

/* Chrome/Edge autofill: background-color cannot override the autofill tint,
   only an inset box-shadow the size of the field can. Without this every
   autofilled field on this site (name, address -- all of them) shows pale
   yellow/blue instead of the design's white. */
.kc-v2-input:-webkit-autofill,
.kc-v2-input:-webkit-autofill:hover,
.kc-v2-input:-webkit-autofill:focus {
  -webkit-box-shadow: inset 0 0 0 100px var(--kc-v2-white);
  -webkit-text-fill-color: var(--kc-v2-ink-800);
}

/* Select: appearance:none removes the native arrow; the replacement arrow is
   a border-based chevron on the WRAPPER, not the select itself (::after on
   the select element is unreliable across engines, unlike on a checkbox/
   radio input -- see README point 9 for the general rule). */
.kc-v2-select-wrapper {
  position: relative;
  display: block;
  width: 100%;
}
.kc-v2-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 40px;
  cursor: pointer;
}
.kc-v2-select-wrapper::after {
  content: "";
  position: absolute;
  right: 16px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--kc-v2-ink-500);
  border-bottom: 2px solid var(--kc-v2-ink-500);
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
}

/* ---------------------------------------------------------------------------
 * Select listbox (1.5.7)
 *
 * The open list of a native <select> is drawn by the operating system, not the page: no CSS can
 * put a tick on the chosen row, a hover fill on the others, or this panel around them. So the
 * popup is OURS -- kc-v2.js suppresses the native one and draws this instead.
 *
 * The <select> itself is untouched and still does everything: it holds focus, it is what keyboard
 * and assistive tech drive, it is what Knockout and jQuery read and write, and it is what posts.
 * This panel is a visual layer over that state, which is why it carries aria-hidden -- a screen
 * reader already has the real control and does not need a second copy of the same list.
 *
 * position: fixed, appended to <body>: half these selects sit inside a .kc-v2-table-wrapper or a
 * clamped card, both of which clip an absolutely positioned child. z-dropdown is the honest token
 * -- checked, and no kc-v2 modal in this solution contains a select, so it never has to clear one.
 * ------------------------------------------------------------------------- */
.kc-v2-listbox {
  position: fixed;
  z-index: var(--kc-v2-z-dropdown);
  box-sizing: border-box;
  max-height: 288px;
  margin: 0;
  padding: var(--kc-v2-space-1) 0;
  overflow-y: auto;
  border-radius: var(--kc-v2-radius-md);
  background-color: var(--kc-v2-white);
  box-shadow: 0 10px 30px rgba(13, 36, 56, 0.18);
}
.kc-v2-listbox *,
.kc-v2-listbox *::before,
.kc-v2-listbox *::after {
  box-sizing: border-box;
}

/* Element-qualified: these are <button>s, and every host in this solution styles bare buttons
   (bootstrap padding, site.css sizing), so appearance/border/background are restated rather than
   assumed. */
button.kc-v2-listbox__option {
  appearance: none;
  -webkit-appearance: none;
  display: flex;
  align-items: center;
  gap: var(--kc-v2-space-3);
  width: 100%;
  margin: 0;
  padding: 11px 18px;
  border: 0;
  border-radius: 0;
  background-color: transparent;
  color: var(--kc-v2-ink-800);
  font-family: var(--kc-v2-font-family);
  font-size: 15px;
  font-weight: 400;
  line-height: 22px;
  text-align: start;
  cursor: pointer;
}
.kc-v2-listbox__option[hidden] {
  display: none;
}

.kc-v2-listbox__label {
  flex: 1 1 auto;
  min-width: 0;
}

/* Always in the markup, revealed on the chosen row: a check that appears and disappears would
   change the row width and shift every label as the selection moves. */
.kc-v2-listbox__check {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  color: var(--kc-v2-blue);
  visibility: hidden;
}

/* data-kc-v2-active is the KEYBOARD position, which is not the selection -- arrowing through the
   list moves it before anything is committed. Hover paints the same way, so the two never disagree
   about what "the row under consideration" looks like. */
button.kc-v2-listbox__option:hover:not([aria-disabled="true"]),
button.kc-v2-listbox__option[data-kc-v2-active]:not([aria-disabled="true"]) {
  background-color: var(--kc-v2-ink-50);
}

button.kc-v2-listbox__option[aria-selected="true"] {
  background-color: var(--kc-v2-blue-tint);
  color: var(--kc-v2-ink-900);
  font-weight: 600;
}
button.kc-v2-listbox__option[aria-selected="true"] .kc-v2-listbox__check {
  visibility: visible;
}

/* An option the page has disabled -- a quarter this account cannot file, or the blank that stands
   in for "choose one". It stays visible, because which periods are closed is information. */
button.kc-v2-listbox__option[aria-disabled="true"] {
  color: var(--kc-v2-ink-400);
  font-weight: 400;
  cursor: not-allowed;
}

.kc-v2-listbox__option:focus-visible {
  outline: var(--kc-v2-focus-ring-width) solid var(--kc-v2-focus-ring-color);
  outline-offset: -2px;
}

/* Open state on the control itself: the chevron turns up and blue, and the border takes the same
   blue, so the closed control and its panel read as one object. */
.kc-v2-select-wrapper--open > .kc-v2-select {
  border-color: var(--kc-v2-blue);
}
.kc-v2-select-wrapper--open::after {
  border-right-color: var(--kc-v2-blue);
  border-bottom-color: var(--kc-v2-blue);
  transform: translateY(-25%) rotate(-135deg);
}

/* The label a radio/checkbox sits inside -- min-height keeps the actual
   clickable/tappable area at the 44px touch-target minimum even though the
   visual indicator itself is drawn at Figma's compact 20px (native <label>
   click-through means clicking anywhere in this row, not just the small box,
   already toggles the input; this only ensures that row is tall enough).
   Added during the Phase 6 accessibility audit -- earlier phases used the
   generic .kc-v2-stack--row for this and were 20-24px tall in practice. */
/* The typography here is not decoration -- it is defence. .kc-v2-choice is a
   <label>, and every host in this solution styles bare labels:
     bootstrap.css   label { font-weight: bold; margin-bottom: 5px; }
     site.css        label { color: #808080; }
     Community.css   label, .display-text { line-height: 22px; }
   None of those is more specific than this class, but each sets a property the
   class did not declare, so it landed anyway -- choice labels rendered bold and
   grey instead of normal ink (KENT-59 Phase 0 spike). README rule #5: declare
   every property a host might target. */
.kc-v2-choice {
  display: flex;
  align-items: center;
  gap: var(--kc-v2-space-2);
  min-height: 44px;
  margin: 0;
  padding: 0;
  font-family: var(--kc-v2-font-family);
  font-size: 16px;
  font-weight: 400;
  line-height: normal;
  color: var(--kc-v2-ink-800);
}

/* Radio & checkbox: rendered from the real input via appearance:none + a
   pseudo-element, not an SVG background-image -- a data-URI SVG cannot use
   currentColor/var(), so its color could never follow the token layer or a
   disabled/error state. This does mean a forced-colors override is required
   (below), since the checked fill is a background-color.

   ELEMENT-QUALIFIED (input.kc-v2-radio, not .kc-v2-radio) deliberately, and this
   is load-bearing rather than stylistic. A bare class is (0,1,0); the rules real
   hosts ship for these controls are attribute selectors at (0,1,1) and therefore
   win no matter which stylesheet loads last:

     site.css       input[type="checkbox"] { background: transparent;
                                             border: inherit; width: auto; }
     bootstrap.css  input[type="radio"],
                    input[type="checkbox"]  { margin: 4px 0 0; }

   Measured against the real KentonCountyPublic cascade (KENT-59 Phase 0 spike),
   the bare-class version computed to width:0, border:none, background:transparent
   -- i.e. the control rendered as nothing at all, because the box IS the border.
   Element-qualifying lifts these to (0,1,1) and they win on load order.

   Still contract-legal: README rule #2 bans *unscoped bare element* selectors
   (`input { ... }`), not an element-qualified class. */
input.kc-v2-radio,
input.kc-v2-checkbox {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  box-sizing: border-box;
  width: 20px;
  height: 20px;
  margin: 0;
  padding: 0;
  flex-shrink: 0;
  border: 2px solid var(--kc-v2-ink-300);
  background-color: var(--kc-v2-white);
  background-image: none;
  position: relative;
  cursor: pointer;
}
input.kc-v2-radio {
  border-radius: 50%;
}
input.kc-v2-checkbox {
  border-radius: 6px;
}

.kc-v2-radio:checked,
.kc-v2-checkbox:checked {
  border-color: var(--kc-v2-blue);
  background-color: var(--kc-v2-blue);
}
.kc-v2-radio:checked::after {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background-color: var(--kc-v2-white);
}
.kc-v2-checkbox:checked::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border-right: 2px solid var(--kc-v2-white);
  border-bottom: 2px solid var(--kc-v2-white);
  transform: rotate(45deg);
}

.kc-v2-radio:hover,
.kc-v2-checkbox:hover {
  border-color: var(--kc-v2-blue);
}

.kc-v2-radio:focus-visible,
.kc-v2-checkbox:focus-visible {
  outline: var(--kc-v2-focus-ring-width) solid var(--kc-v2-focus-ring-color);
  outline-offset: var(--kc-v2-focus-ring-offset);
}

.kc-v2-radio:disabled,
.kc-v2-checkbox:disabled {
  border-color: var(--kc-v2-ink-200);
  background-color: var(--kc-v2-ink-100);
  cursor: not-allowed;
}
.kc-v2-radio:disabled:checked,
.kc-v2-checkbox:disabled:checked {
  background-color: var(--kc-v2-ink-300);
  border-color: var(--kc-v2-ink-300);
}

@media (forced-colors: active) {
  /* Element-qualified for the same reason as the base rule above: unqualified this
     is (0,1,0) and loses to site.css's input[type="checkbox"] { border: inherit }.
     The :checked/:hover/:focus-visible/:disabled rules elsewhere in this file are
     already (0,2,0) or higher and need no qualifying. */
  input.kc-v2-radio,
  input.kc-v2-checkbox {
    border-color: ButtonText;
  }
  .kc-v2-radio:checked,
  .kc-v2-checkbox:checked {
    border-color: Highlight;
    background-color: Canvas;
    forced-color-adjust: none;
  }
  .kc-v2-radio:checked::after,
  .kc-v2-checkbox:checked::after {
    background-color: Highlight;
    border-color: Highlight;
  }
}

/* Search: pill radius, icon inline via SVG child (a real element, unlike
   select/checkbox -- so it follows README point 8 directly, no pseudo-element
   trick needed). */
.kc-v2-search {
  position: relative;
  display: block;
  width: 100%;
}
.kc-v2-search .kc-v2-input {
  border-radius: var(--kc-v2-radius-pill);
  padding-left: 44px;
}
.kc-v2-search svg {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--kc-v2-blue);
  pointer-events: none;
}

/* ---------------------------------------------------------------------------
 * Field rows (KENT-44 1.2.0)
 *
 * Puts two or three fields on one line -- City / State / Zip on the filing form, Fiscal Year /
 * Month beside the confirmation alert -- without the page reaching for the host's Bootstrap
 * grid, whose `.form-group { float: left }` in Community.css is exactly the kind of rule kc-v2
 * exists to stop depending on.
 *
 * `flex: 1 1 <basis>` rather than `1 1 0`: a zero basis never wraps, so the row would stay
 * three-across at 375px and force the inputs to a few pixels each. A real basis makes the row
 * wrap to one column when it stops fitting, with no media query.
 *
 * `min-width: 0` is load-bearing. A flex item's default `min-width: auto` refuses to shrink
 * below its content's intrinsic size, and an <input>'s intrinsic width is its `size` attribute
 * (~170px) -- so without this the row overflows its container instead of shrinking, which is
 * the horizontal-scroll bug Checkpoint 1 asserts against.
 * ------------------------------------------------------------------------- */
.kc-v2-field {
  box-sizing: border-box;
  min-width: 0;
}

.kc-v2-field-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--kc-v2-space-3);
}
.kc-v2-field-row > * {
  box-sizing: border-box;
  flex: 1 1 140px;
  min-width: 0;
}
/* State is two characters; a third of the row is absurd for it. Narrow still shrinks (1 on
   flex-shrink) so it cannot cause an overflow. */
.kc-v2-field-row > .kc-v2-field--narrow { flex: 0 1 96px; }
.kc-v2-field-row > .kc-v2-field--wide   { flex: 2 1 220px; }

/* --narrow used to work ONLY as a flex child of .kc-v2-field-row, so a short field standing on its
   own had no way to say so and stretched to the full card width -- a count of employees rendered as
   wide as a business name. The cap makes the modifier mean the same thing in both contexts.
   140px, not the row's 96px flex-basis: a lone field has no siblings competing for the space, and
   96px is too tight for a five-digit number plus a spinner. The existing row consumers are
   unaffected -- their basis is 96px, well under this cap, and they still shrink below it. */
.kc-v2-field--narrow { max-width: 140px; }

/* ---------------------------------------------------------------------------
 * Worksheet rows (KENT-44 1.2.0)
 *
 * A numbered statutory line: "7) Total Gross Receipts (Add Lines 1 through 6)" beside a money
 * field. Schedules G, N, X and Y are each fourteen or so of these.
 *
 * Replaces a Bootstrap `.row > .col-xs-9 + .col-xs-3` pair. The label column has to be fluid rather
 * than a fixed 75%: these labels are long and legally worded, and a percentage split gave the field
 * a third of the width it did not need while the label wrapped.
 *
 * A read-only row (a computed subtotal) is marked with aria-readonly on the row and gets the muted
 * treatment, so "you cannot type here" is conveyed by more than the field's own styling.
 * ------------------------------------------------------------------------- */
.kc-v2-worksheet {
  display: flex;
  flex-direction: column;
}

.kc-v2-worksheet-row {
  display: flex;
  align-items: baseline;
  gap: var(--kc-v2-space-4);
  padding: var(--kc-v2-space-2) 0;
  border-top: 1px solid var(--kc-v2-ink-100);
}
.kc-v2-worksheet-row:first-child {
  border-top: none;
}

.kc-v2-worksheet-row__label {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--kc-v2-ink-800);
  font-family: var(--kc-v2-font-family);
  font-size: 13px;
  line-height: 19px;
}

/* Fixed, because a column of money fields that do not share an edge is much harder to scan --
   and it must not shrink below a figure like 1,234,567.89. */
.kc-v2-worksheet-row__field {
  flex: 0 0 150px;
}

/* A subtotal the sheet computes. Distinguished from an entry field so the reader can see at a
   glance which lines they own. */
.kc-v2-worksheet-row[aria-readonly="true"] .kc-v2-worksheet-row__label {
  color: var(--kc-v2-ink-600);
  font-weight: 600;
}

/* An inline jump to another schedule, e.g. Schedule G line 13 -> Schedule Y. */
.kc-v2-worksheet-row__link {
  flex: 0 0 auto;
  align-self: center;
}

@media (max-width: 640px) {
  /* Stack: at narrow widths a 150px field plus a long label leaves the label a few characters
     wide. The field goes full-width under its own label instead. */
  .kc-v2-worksheet-row {
    flex-wrap: wrap;
    gap: var(--kc-v2-space-2);
  }
  .kc-v2-worksheet-row__field {
    flex: 1 1 100%;
  }
}

/* ---------------------------------------------------------------------------
 * Segmented control (KENT-44 1.2.0)
 *
 * A row of mutually-exclusive choices -- the annual return's Service / Location / Both per city.
 *
 * NOT radio inputs, and not role="radio". The handler behind these TOGGLES: clicking the already
 * selected option deselects it back to "None" (AnnualRenewalDetails.js changeValue). A radio cannot
 * express that -- re-clicking a checked radio leaves it checked -- so these are three toggle
 * buttons and the state hook is aria-pressed, per contract rule 4 (native/ARIA attribute before a
 * modifier class). The previous markup used a `css: { active: ... }` class binding on buttons
 * carrying a `name` attribute, which does nothing on a button: it looked like a radio group to a
 * sighted user and like three unrelated buttons to everything else.
 *
 * Segments are equal-width. That is also why no width-reservation hack is needed: the old
 * .service-type-button used `::after { content: attr(data-text); font-weight: bold; height: 0 }`
 * purely to stop the button resizing when its label went bold on selection.
 * ------------------------------------------------------------------------- */
.kc-v2-segmented {
  display: inline-flex;
  padding: 4px;
  border-radius: var(--kc-v2-radius-md);
  /* ONE ELEMENT. The track is the only thing with an edge: the options inside it are bare labels
     until one is hovered or chosen, and then a pill appears under that one alone. An earlier pass
     gave every option its own border and a gap, which drew three controls where the filer is being
     asked to make one choice. */
  background-color: var(--kc-v2-ink-100);
}

.kc-v2-segmented__option {
  appearance: none;
  -webkit-appearance: none;
  /* 1 0 auto, not 1 1 0: segments still share spare width equally, but none shrinks below its own
     label, which was clipping "Enter Employees". */
  flex: 1 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 84px;
  margin: 0;
  padding: 6px 14px;
  /* No border and no fill at rest: the pill IS the affordance, and it belongs to whichever option
     the pointer is over or the filer has chosen. ink-600 on the ink-100 track measures 8.68:1, so
     an unchosen label is perfectly readable while it waits. */
  border: 0;
  border-radius: calc(var(--kc-v2-radius-md) - 4px);
  background-color: transparent;
  color: var(--kc-v2-ink-600);
  font-family: var(--kc-v2-font-family);
  font-size: 13px;
  font-weight: 500;
  line-height: 18px;
  text-align: center;
  white-space: nowrap;
  cursor: pointer;
}


.kc-v2-segmented__option:hover:not([aria-pressed="true"]):not(:disabled) {
  background-color: var(--kc-v2-white);
  color: var(--kc-v2-ink-900);
}

.kc-v2-segmented__option[aria-pressed="true"] {
  background-color: var(--kc-v2-white);
  color: var(--kc-v2-ink-900);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(13, 36, 56, 0.12);
}

/* The tick, drawn from two borders on a rotated box -- the same technique as the select chevron,
   and the reason this needed no change in any of the four views that render these buttons. */
.kc-v2-segmented__option[aria-pressed="true"]::before {
  content: "";
  flex: 0 0 auto;
  width: 5px;
  height: 9px;
  margin-top: -3px;
  border-right: 2px solid var(--kc-v2-blue);
  border-bottom: 2px solid var(--kc-v2-blue);
  transform: rotate(45deg);
}

/* Focus also has to clear the overlap, or the ring is clipped by the next option. */
.kc-v2-segmented__option:focus-visible {
  position: relative;
  z-index: 2;
}

.kc-v2-segmented__option:focus-visible {
  outline: var(--kc-v2-focus-ring-width) solid var(--kc-v2-focus-ring-color);
  outline-offset: 1px;
}

/* ---------------------------------------------------------------------------
 * Inside a table, at narrow widths, the options STACK (1.5.0, KENT-56)
 *
 * `flex: 1 0 auto` with `min-width: 84px` is deliberate -- flex-shrink 0 is what stopped "Enter
 * Employees" being clipped in 1.4.0 -- but it means three options set a ~260px floor that CANNOT
 * shrink. A column that cannot shrink propagates: a table's width can never go below the sum of its
 * columns' min-content widths, so the cities grid's min-content came out at 569px. The wrapper then
 * scrolls, which is correct for a grid -- but the per-city location sub-form lives in a full-width
 * detail row of that same table, so it inherited the 569px too. On a 375px phone a filer had to
 * scroll sideways to fill in an address, which is not a usable form.
 *
 * Stacking the options collapses the column's min-content width to ONE option instead of three, so
 * the table fits and the detail row with it. No clipping risk: each option is full width here.
 *
 * SCOPED TO TABLES on purpose. The standalone controls on Quarterly (entry mode) and Annual sit in
 * open layout where they have room to sit side by side, and stacking a two-option toggle there would
 * be a change with no problem behind it. `.kc-v2-table .kc-v2-segmented__option` is (0,2,0) and beats
 * the base rule's (0,1,0) without needing an element qualifier.
 * ------------------------------------------------------------------------- */
@media (max-width: 640px) {
  .kc-v2-table .kc-v2-segmented {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
  }

  .kc-v2-table .kc-v2-segmented__option {
    flex: 1 1 100%;
    min-width: 0;
  }
}

.kc-v2-segmented__option:disabled {
  color: var(--kc-v2-ink-400);
  cursor: not-allowed;
}

/* A city already on the license: the pill stays, so which of the three was chosen is still
   readable, but in greys -- nothing here can be changed, and a live-looking control that refuses
   to respond is worse than one that says so. With no selection there is no pill at all, and the
   track reads as three muted labels. */
.kc-v2-segmented__option:disabled[aria-pressed="true"] {
  background-color: var(--kc-v2-ink-200);
  color: var(--kc-v2-ink-500);
  box-shadow: none;
}
.kc-v2-segmented__option:disabled[aria-pressed="true"]::before {
  border-right-color: var(--kc-v2-ink-500);
  border-bottom-color: var(--kc-v2-ink-500);
}

@media (forced-colors: active) {
  /* The selected state is carried by background-color plus a shadow, both of which forced-colors
     mode can strip -- same issue the checkbox fill and the status-pill dot have. The border
     survives, so make it the load-bearing indicator there. */
  .kc-v2-segmented__option[aria-pressed="true"] {
    border: 2px solid currentColor;
  }
}

/* ---------------------------------------------------------------------------
 * Bridge for .error-border (KENT-44)
 *
 * AnnualRenewalDetails.js marks an invalid address/contact field by adding the `error-border` class
 * from a delegated blur handler, matching inputs by their generated `name`. Scoped exactly like
 * `.kc-v2-field .validationMessage` above: the class is emitted by app JS, not by kc-v2, and
 * contract rule 6 allows styling a host-owned class only when scoped.
 *
 * Bridged rather than rewritten to aria-invalid because that JS is one copy of a pattern
 * triplicated across three areas (Annual, BusinessLicenseAdd, BusinessLicenseApplication); the
 * markup conversion here is deliberately isolated to Annual, and changing shared-shaped JS would
 * widen the blast radius for no visual gain. Element-qualified so it beats Returns.css's
 * `#annualBusinessLicense input[type=text]`... it cannot, in fact -- that is (1,0,1) -- but the
 * property it sets is margin-bottom, which this rule does not contest.
 * ------------------------------------------------------------------------- */
input.kc-v2-input.error-border {
  border-color: var(--kc-v2-error);
  background-color: var(--kc-v2-error-bg);
}

/* ---------------------------------------------------------------------------
 * Choice card (KENT-44 1.2.0)
 *
 * A radio or checkbox presented as a selectable card, for a choice that carries enough supporting
 * detail that a one-line label will not do -- the annual return's Individual vs County-Wide license,
 * where the county-wide option shows a price the filer is weighing against a table total.
 *
 * State comes from :has(:checked) with a :checked + sibling fallback, so no class binding is needed.
 * :has() is well supported in the browsers these public pages see, but the fallback means an engine
 * without it still shows the selected state on the input itself rather than losing it entirely.
 * ------------------------------------------------------------------------- */
.kc-v2-choice-card {
  display: flex;
  align-items: flex-start;
  gap: var(--kc-v2-space-3);
  box-sizing: border-box;
  margin: 0;
  padding: var(--kc-v2-space-3);
  border: 1px solid var(--kc-v2-ink-200);
  border-radius: var(--kc-v2-radius-lg);
  background-color: var(--kc-v2-white);
  cursor: pointer;
}
.kc-v2-choice-card:hover {
  border-color: var(--kc-v2-ink-300);
}
.kc-v2-choice-card:has(:checked) {
  border-color: var(--kc-v2-blue);
  background-color: var(--kc-v2-blue-tint);
}
/* Keyboard focus lands on the input, so the ring is drawn around the whole card from there. */
.kc-v2-choice-card:has(:focus-visible) {
  outline: var(--kc-v2-focus-ring-width) solid var(--kc-v2-focus-ring-color);
  outline-offset: 2px;
}
.kc-v2-choice-card:has(:disabled) {
  background-color: var(--kc-v2-ink-50);
  border-color: var(--kc-v2-ink-200);
  cursor: not-allowed;
}

.kc-v2-choice-card__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.kc-v2-choice-card__title {
  color: var(--kc-v2-ink-800);
  font-family: var(--kc-v2-font-family);
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
}
.kc-v2-choice-card__note {
  color: var(--kc-v2-ink-600);
  font-family: var(--kc-v2-font-family);
  font-size: 12.5px;
  line-height: 17px;
}

/* ---------------------------------------------------------------------------
 * Sub-form (KENT-44 1.2.0)
 *
 * A repeated editable sub-record revealed inside a table row -- the per-city address and contact
 * block on the business-license step, where a city can carry several locations.
 *
 * Named structurally rather than for the domain (it was .kc-v2-location first), because what it
 * describes is "a nested group of field columns with a per-record action", not anything about
 * addresses.
 * ------------------------------------------------------------------------- */
.kc-v2-subform {
  display: flex;
  flex-wrap: wrap;
  gap: var(--kc-v2-space-4);
  box-sizing: border-box;
  padding: var(--kc-v2-space-3);
  border: 1px solid var(--kc-v2-ink-200);
  border-radius: var(--kc-v2-radius-md);
  background-color: var(--kc-v2-white);
}
/* Two field columns that collapse to one when they stop fitting. A real flex-basis rather than 0,
   for the same reason .kc-v2-field-row uses one. */
.kc-v2-subform__fields {
  display: flex;
  flex-direction: column;
  gap: var(--kc-v2-space-2);
  flex: 1 1 260px;
  min-width: 0;
}
.kc-v2-subform__actions {
  flex: 0 0 auto;
  align-self: flex-start;
}

/* One column at narrow widths (1.5.0, KENT-56).
 *
 * `flex: 1 1 260px` sets a 260px FLEX BASIS, and a flex basis contributes to the container's
 * min-content width even though flex-shrink is 1. Two of them plus the gap and padding come to about
 * 576px that the container cannot go below.
 *
 * That mattered because of where this component sits on the Business License cities grid: inside a
 * full-width detail row of the table. A table can never be narrower than the sum of its columns'
 * min-content widths, so the sub-form pushed the TABLE to 575px -- and the sub-form then measured
 * 575px wide because it filled the cell it had just widened. Circular, and it meant a filer on a
 * 375px phone had to scroll sideways to type an address. Measured, not inferred: the grid's own three
 * visible columns came to 576px only because the detail row demanded it, and the wrapper's content
 * box at that viewport is 265px.
 *
 * flex-basis: 100% makes each column a full row, so min-content drops to a single field's -- and
 * stacking address above contact is the right layout on a phone regardless. */
@media (max-width: 640px) {
  .kc-v2-subform__fields {
    flex-basis: 100%;
  }
}
.kc-v2-subform__add {
  margin-top: var(--kc-v2-space-3);
}

/* ---------------------------------------------------------------------------
 * Choice with an explanation beneath it (KENT-44 1.3.0)
 *
 * .kc-v2-choice carries min-height: 44px for the touch target. Against a single 19px line of label
 * text that leaves 12.5px of dead space BELOW the text, so an option's description read as
 * detached from its own title -- while consecutive options touched at 0px, giving the group no
 * separation at all. Both measured on the voucher list.
 *
 * The fix moves the space to where it does work: the row tightens, and the gap goes BETWEEN the
 * options. 32px is still comfortably above the 24px minimum target size WCAG 2.5.8 asks for at AA;
 * it gives up the 44px of 2.5.5, which is AAA. Worth naming because it is a real trade, and it is
 * scoped to this modifier so every other .kc-v2-choice keeps the full 44px.
 * ------------------------------------------------------------------------- */
.kc-v2-choice-block {
  margin-bottom: var(--kc-v2-space-3);
}

/* An alert sitting between choices -- e.g. the consequence of the option just selected -- takes the
   same bottom spacing, so the next choice is not flush against it. */
.kc-v2-fieldset .kc-v2-alert {
  margin-bottom: var(--kc-v2-space-3);
}
/* Child + element qualified so these beat .kc-v2-choice / .kc-v2-helper-text whatever the source
   order -- (0,2,1) and (0,2,0) against (0,1,0). Contract rule 11. */
.kc-v2-choice-block > label.kc-v2-choice {
  min-height: 32px;
}
.kc-v2-choice-block > .kc-v2-helper-text {
  /* The label's remaining slack already separates the two lines; 4px on top of it was what made
     the description look like a sibling of the next option rather than a child of this one. */
  margin-top: 0;
}

/* Legal attestation (KENT-44 1.3.0). Italic and error-red at the client's request -- this is the
   perjury declaration, and it should not read as ordinary body text. --kc-v2-error-text rather
   than --kc-v2-error because it is text: #A5271A clears 4.5:1 on white, #C0392B does not.
   Element-qualified to beat .kc-v2-choice's own `margin: 0`. */
label.kc-v2-choice--attestation {
  margin: var(--kc-v2-space-3) 0;
  font-style: italic;
  color: var(--kc-v2-error-text);
}

/* Row holding a styled file-picker trigger, which follows a paragraph of explanatory text.
   space-4, and the whole value comes from here: this row sits inside the upload <form>, so the
   surrounding stack's gap does NOT reach it. Worth stating because the first attempt used space-2
   on the assumption that a 16px stack gap was already contributing -- 16px the harness was showing
   only because it had dropped the <form> and flattened the row into the stack. */
.kc-v2-file-trigger {
  margin-top: var(--kc-v2-space-4);
}

/* The styled trigger follows the INPUT's own disabled state (1.5.4, KENT-69).
   A <label for> pointing at a disabled file input already does nothing when clicked -- the browser
   will not open the picker -- but the label goes on looking like a live button, and the input that
   would have shown the real state is .kc-v2-sr-only. So the only signal a filer has is invisible.
   The Annual Reconciliation upload keeps its input disabled until a tax year is chosen, which is
   the case this exists for.
   Restates .kc-v2-btn--secondary:disabled rather than reaching for a shared rule: the disabled
   look belongs to the variant, and only the variants a trigger actually uses need it. */
.kc-v2-file-trigger > input[type="file"]:disabled + .kc-v2-btn {
  cursor: not-allowed;
}
.kc-v2-file-trigger > input[type="file"]:disabled + .kc-v2-btn--secondary {
  background-color: var(--kc-v2-white);
  border-color: var(--kc-v2-ink-300);
  color: var(--kc-v2-ink-400);
}
