/* ==========================================================================
 * The kit: CorpProfit's own controls.
 *
 * Loaded after app.css and drawn from the same tokens, so both themes and
 * all three densities carry through without a rule here naming either.
 *
 * The shapes follow the console: a control is a 10px-cornered field on the
 * page and a pill in a toolbar; anything that floats is a 14px-cornered
 * sheet with the popover shadow; the accent blue marks what is chosen and
 * nothing else.
 * ========================================================================== */

:root {
  --kit-h: 40px;
  --kit-h-sm: 36px;
  --kit-pop-r: 14px;
  --kit-item-r: 9px;
  --kit-t0: #2f5cf0;
  --kit-t1: #7c5cff;
  --kit-t2: #e08a00;
  --kit-t3: #0fa98a;
  --kit-t4: #ff6b4a;
}

/* The native control stays in the page for forms and for page code, out of
   sight and out of the tab order. */
.kit-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  min-width: 0 !important;
  padding: 0 !important;
  margin: -1px !important;
  border: 0 !important;
  overflow: hidden !important;
  clip-path: inset(50%) !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* --- the field a dropdown or a date sits in -------------------------------- */

.kit-select,
.kit-date {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  height: var(--kit-h);
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink);
  font: 400 14px var(--sans);
  text-align: left;
  cursor: pointer;
  transform: none;
  box-shadow: none;
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}

.kit-date {
  justify-content: flex-start;
}

.kit-select:hover,
.kit-date:hover {
  border-color: color-mix(in srgb, var(--ink) 28%, var(--line));
  background: var(--surface);
  transform: none;
  box-shadow: none;
}

.kit-select:focus-visible,
.kit-date:focus-visible,
.kit-select[aria-expanded='true'],
.kit-date[aria-expanded='true'] {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 22%, transparent);
}

.kit-select:disabled,
.kit-date:disabled {
  background: var(--surface-muted);
  color: var(--ink-subtle);
  cursor: not-allowed;
}

.kit-select .icon,
.kit-date .icon {
  flex: none;
  width: 16px;
  height: 16px;
  color: var(--ink-subtle);
}

.kit-select > .icon {
  transition: transform 0.2s var(--ease);
}

.kit-select[aria-expanded='true'] > .icon {
  transform: rotate(180deg);
}

.kit-select-value {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.kit-select-value > span,
.kit-date > span:not(.kit-clear) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kit-select-value .icon {
  color: var(--accent);
}

.kit-select.placeholder,
.kit-date.placeholder {
  color: var(--ink-subtle);
}

.kit-date > span:not(.kit-clear) {
  font-variant-numeric: tabular-nums;
}

.kit-clear {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  margin: 0 -4px 0 auto;
  border-radius: 999px;
  color: var(--ink-subtle);
}

.kit-clear:hover,
.kit-clear:focus-visible {
  background: color-mix(in srgb, var(--ink) 10%, transparent);
  color: var(--ink);
  outline: none;
}

.kit-clear .icon {
  width: 12px;
  height: 12px;
  color: inherit;
}

/* In a toolbar a filter is a pill, and one that is narrowing the list says
   so by taking the accent. */
.toolbar .kit-select,
.toolbar .kit-date {
  width: auto;
  min-width: 132px;
  height: var(--kit-h-sm);
  border-radius: 999px;
  padding: 0 12px 0 14px;
  font-size: var(--density-text-sm);
}

.toolbar .kit-select.has-value,
.toolbar .kit-date.has-value {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 500;
}

.toolbar .kit-select.has-value .icon,
.toolbar .kit-date.has-value .icon {
  color: var(--accent);
}

/* --- anything that floats --------------------------------------------------- */

.kit-pop {
  position: fixed;
  inset: auto;
  z-index: 200;
  margin: 0;
  padding: 6px;
  max-width: calc(100vw - 16px);
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: var(--kit-pop-r);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-popover);
  font: 400 14px var(--sans);
  transform-origin: top center;
  animation: kit-pop-in 0.16s var(--ease);
}

.kit-pop[data-side='top'] {
  transform-origin: bottom center;
}

@keyframes kit-pop-in {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }
}

.kit-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--ink-subtle);
}

.kit-dot.pass { background: var(--pass); }
.kit-dot.hold { background: var(--hold); }
.kit-dot.block { background: var(--block); }
.kit-dot.note { background: var(--note); }
.kit-dot.accent { background: var(--accent); }

/* --- dropdown list ---------------------------------------------------------- */

.kit-list {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  max-height: 340px;
}

.kit-list-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-subtle);
}

.kit-list-search .icon {
  flex: none;
  width: 15px;
  height: 15px;
  color: var(--ink-subtle);
}

.kit-list-search input,
.kit-list-search input:focus {
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  font-size: 14px;
}

/* `flex: 1` means a basis of zero, and in a list that only has a maximum
   height older iOS WebKit then sizes the options to nothing: the dropdown
   opened as an empty sliver. The options take their own height and shrink
   (and scroll) only when the list is capped. */
.kit-options {
  flex: 0 1 auto;
  min-height: 0;
  padding: 6px;
  overflow: auto;
  outline: none;
}

.kit-option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 6px 10px;
  border-radius: var(--kit-item-r);
  cursor: pointer;
  user-select: none;
}

.kit-option.active {
  background: var(--surface-muted);
}

.kit-option[aria-selected='true'] {
  color: var(--accent);
  font-weight: 500;
}

.kit-option[aria-disabled='true'] {
  color: var(--ink-subtle);
  cursor: not-allowed;
}

.kit-option .icon {
  flex: none;
  width: 16px;
  height: 16px;
  color: var(--ink-muted);
}

.kit-option[aria-selected='true'] .icon {
  color: var(--accent);
}

.kit-option-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.kit-option-text small {
  color: var(--ink-subtle);
  font-size: 12px;
  font-weight: 400;
}

.kit-none {
  padding: 16px 12px;
  color: var(--ink-subtle);
  font-size: 13px;
  text-align: center;
}

/* --- calendar ---------------------------------------------------------------- */

.kit-cal {
  padding: 12px;
  width: max-content;
}

.kit-cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.kit-cal-title {
  display: flex;
  gap: 2px;
  font-weight: 600;
  padding: 0 4px;
}

.kit-cal-nav,
.kit-cal-jump,
.kit-day,
.kit-cal-pick {
  border: 0;
  background: transparent;
  color: var(--ink);
  box-shadow: none;
  transform: none;
  cursor: pointer;
  font: inherit;
}

.kit-cal-nav {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 9px;
  color: var(--ink-muted);
}

.kit-cal-nav .icon {
  width: 16px;
  height: 16px;
}

.kit-cal-jump {
  height: 32px;
  padding: 0 8px;
  border-radius: 8px;
  font-weight: 600;
}

.kit-cal-nav:hover,
.kit-cal-jump:hover,
.kit-cal-pick:hover {
  background: var(--surface-muted);
  color: var(--ink);
  transform: none;
  box-shadow: none;
}

.kit-cal-days,
.kit-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 36px);
  row-gap: 2px;
}

.kit-cal-days span {
  height: 28px;
  display: grid;
  place-items: center;
  color: var(--ink-subtle);
  font-size: 11.5px;
  font-weight: 500;
}

.kit-day {
  position: relative;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 10px;
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}

.kit-day:hover:not(:disabled):not(.selected) {
  background: var(--surface-muted);
  transform: none;
  box-shadow: none;
}

.kit-day.today:not(.selected)::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 5px;
  width: 4px;
  height: 4px;
  margin-left: -2px;
  border-radius: 999px;
  background: var(--accent);
}

.kit-day.selected,
.kit-day.selected:hover,
.kit-cal-pick.selected {
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
}

.kit-day.in-range {
  border-radius: 0;
  background: var(--accent-soft);
  color: var(--accent);
}

.kit-day.range-start:not(.range-end) {
  border-radius: 10px 0 0 10px;
}

.kit-day.range-end:not(.range-start) {
  border-radius: 0 10px 10px 0;
}

.kit-day:disabled {
  color: var(--ink-subtle);
  opacity: 0.45;
  cursor: not-allowed;
}

.kit-day:focus-visible,
.kit-cal-nav:focus-visible,
.kit-cal-jump:focus-visible,
.kit-cal-pick:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

.kit-cal-jumps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  width: 252px;
}

.kit-cal-pick {
  height: 40px;
  border-radius: 10px;
}

.kit-cal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line-subtle);
}

.kit-cal-hint {
  color: var(--ink-subtle);
  font-size: 12.5px;
}

.kit-cal-range {
  display: flex;
  padding: 0;
}

.kit-cal-main {
  padding: 12px;
}

.kit-presets {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 6px;
  border-right: 1px solid var(--line-subtle);
  background: color-mix(in srgb, var(--surface-muted) 55%, transparent);
}

.kit-presets button {
  height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-2);
  box-shadow: none;
  font: 400 13px var(--sans);
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}

.kit-presets button:hover {
  background: var(--surface);
  color: var(--accent);
  transform: none;
  box-shadow: none;
}

@media (max-width: 520px) {
  .kit-cal-range {
    flex-direction: column;
  }

  .kit-presets {
    flex-direction: row;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line-subtle);
    scrollbar-width: none;
  }
}

/* --- tabs --------------------------------------------------------------------- */

/* Sideways only. The marker under the chosen tab used to hang one pixel
   below the row, which was enough for a phone to let the row be dragged up
   and down as well. */
.kit-tabs {
  position: relative;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  box-shadow: inset 0 -1px 0 var(--line);
}

.kit-tabs::-webkit-scrollbar {
  display: none;
}

.kit-tabs [role='tab'] {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px 10px 0 0;
  background: transparent;
  color: var(--ink-muted);
  box-shadow: none;
  font: 500 14px var(--sans);
  white-space: nowrap;
  cursor: pointer;
  transform: none;
  transition: color 0.15s, background-color 0.15s;
}

.kit-tabs [role='tab']:hover {
  background: var(--surface-muted);
  color: var(--ink);
  transform: none;
  box-shadow: none;
}

.kit-tabs [role='tab'][aria-selected='true'] {
  color: var(--accent);
}

.kit-tabs [role='tab']:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.kit-tabs [role='tab'] .icon {
  width: 16px;
  height: 16px;
}

.kit-tab-count {
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--ink-muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

[aria-selected='true'] > .kit-tab-count {
  background: var(--accent-soft);
  color: var(--accent);
}

.kit-tab-bar {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--accent);
  transition: transform 0.28s var(--ease), width 0.28s var(--ease);
  pointer-events: none;
}

/* The same control as a segmented switch. */
.kit-tabs.pills {
  display: inline-flex;
  gap: 2px;
  padding: 4px;
  box-shadow: none;
  border-radius: 12px;
  background: var(--surface-muted);
  max-width: 100%;
}

.kit-tabs.pills [role='tab'] {
  position: relative;
  z-index: 1;
  height: 32px;
  padding: 0 12px;
  border-radius: 9px;
  font-size: 13px;
}

.kit-tabs.pills [role='tab']:hover {
  background: transparent;
}

.kit-tabs.pills [role='tab'][aria-selected='true'] {
  color: var(--ink);
}

.kit-tabs.pills .kit-tab-bar {
  top: 4px;
  bottom: auto;
  height: 32px;
  border-radius: 9px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(11, 27, 58, 0.12), 0 0 0 1px var(--line-subtle);
}

.panel > .kit-tabs {
  padding: 0 var(--density-padding);
}

.panel > .kit-tabs .kit-tab-bar {
  margin-left: 0;
}

/* --- menu ---------------------------------------------------------------------- */

.kit-menu {
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.kit-menu [role='menuitem'] {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 36px;
  padding: 6px 10px;
  border: 0;
  border-radius: var(--kit-item-r);
  background: transparent;
  color: var(--ink);
  box-shadow: none;
  font: 400 14px var(--sans);
  text-align: left;
  cursor: pointer;
  transform: none;
}

.kit-menu [role='menuitem']:hover,
.kit-menu [role='menuitem']:focus-visible {
  background: var(--surface-muted);
  outline: none;
  transform: none;
  box-shadow: none;
}

.kit-menu [role='menuitem'] .icon {
  flex: none;
  width: 16px;
  height: 16px;
  color: var(--ink-muted);
}

.kit-menu [role='menuitem'].danger,
.kit-menu [role='menuitem'].danger .icon {
  color: var(--block);
}

.kit-menu [role='menuitem'].danger:hover,
.kit-menu [role='menuitem'].danger:focus-visible {
  background: var(--block-soft);
  color: var(--on-block-soft);
}

.kit-menu [role='menuitem']:disabled {
  color: var(--ink-subtle);
  cursor: not-allowed;
  background: transparent;
}

.kit-menu-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.kit-menu-text small {
  color: var(--ink-subtle);
  font-size: 12px;
}

.kit-menu-gap {
  width: 16px;
}

.kit-menu-sep {
  height: 1px;
  margin: 5px 4px;
  background: var(--line-subtle);
}

.kit-menu-head {
  padding: 8px 10px 4px;
  color: var(--ink-subtle);
  font-size: 12px;
  font-weight: 500;
}

.kit-menu kbd {
  margin-left: auto;
  color: var(--ink-subtle);
  font: 400 11.5px var(--mono);
}

.kit-more {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-muted);
  box-shadow: none;
  cursor: pointer;
  transform: none;
}

.kit-more:hover,
.kit-more[aria-expanded='true'] {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
  transform: none;
  box-shadow: var(--shadow-card);
}

.kit-more:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

.kit-more .icon {
  width: 18px;
  height: 18px;
}

/* A row's actions: the one that matters, then the rest behind "more". */
td.row-actions {
  white-space: nowrap;
}

td.row-actions > .kit-more {
  vertical-align: middle;
  margin-left: 4px;
}

@media (max-width: 699px) {
  table.as-cards td.row-actions {
    flex-wrap: nowrap;
    gap: 8px;
  }

  table.as-cards td.row-actions > .btn-sm {
    flex: 1 1 auto;
    margin: 0;
  }

  table.as-cards td.row-actions > .kit-more {
    width: 44px;
    height: 44px;
    margin: 0;
    border-color: var(--line);
    border-radius: 12px;
  }

  .toolbar .kit-select,
  .toolbar .kit-date {
    flex: 1 1 140px;
  }

  .toolbar input[type='search'] {
    flex: 1 1 100%;
  }

  .toolbar > span:has(> .kit-date) {
    display: flex;
    flex: 1 1 140px;
  }
}

/* --- avatars -------------------------------------------------------------------- */

.kit-avatar {
  --tone: var(--kit-t0);
  --s: 36px;
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: none;
  width: var(--s);
  height: var(--s);
  border-radius: 999px;
  background: color-mix(in srgb, var(--tone) 16%, var(--surface));
  color: color-mix(in srgb, var(--tone) 82%, var(--ink));
  font: 600 calc(var(--s) * 0.38) / 1 var(--sans);
  letter-spacing: 0.2px;
  user-select: none;
}

.kit-avatar.square { border-radius: 28%; }
.kit-avatar.xs { --s: 24px; }
.kit-avatar.sm { --s: 30px; }
.kit-avatar.lg { --s: 44px; }
.kit-avatar.xl { --s: 60px; }
.kit-avatar.t1 { --tone: var(--kit-t1); }
.kit-avatar.t2 { --tone: var(--kit-t2); }
.kit-avatar.t3 { --tone: var(--kit-t3); }
.kit-avatar.t4 { --tone: var(--kit-t4); }

.kit-avatar img {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
}

.kit-avatar.more {
  background: var(--surface-muted);
  color: var(--ink-muted);
}

.kit-avatar-status {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 30%;
  height: 30%;
  min-width: 8px;
  min-height: 8px;
  border: 2px solid var(--surface);
  border-radius: 999px;
  background: var(--ink-subtle);
  box-sizing: content-box;
}

.kit-avatar-status.pass { background: var(--pass); }
.kit-avatar-status.hold { background: var(--hold); }
.kit-avatar-status.block { background: var(--block); }

.kit-avatars {
  display: inline-flex;
}

.kit-avatars .kit-avatar {
  box-shadow: 0 0 0 2px var(--surface);
}

.kit-avatars .kit-avatar + .kit-avatar {
  margin-left: calc(var(--s) * -0.28);
}

.kit-person {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.kit-person > span:last-child {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.3;
}

.kit-person small {
  color: var(--ink-subtle);
  font-size: 12px;
}

/* --- value field ---------------------------------------------------------------- */

.kit-value {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.kit-value-label {
  color: var(--ink-muted);
  font-size: 12.5px;
  font-weight: 500;
}

.kit-value-text {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.kit-value-text.mono {
  font-family: var(--mono);
  font-size: 13.5px;
  font-weight: 400;
}

.kit-value-hint {
  color: var(--ink-subtle);
  font-size: 12px;
}

.kit-values {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
  gap: 20px 24px;
}

.kit-copy {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-subtle);
  box-shadow: none;
  cursor: pointer;
  transform: none;
}

.kit-copy:hover {
  background: var(--surface-muted);
  color: var(--accent);
  transform: none;
  box-shadow: none;
}

.kit-copy .icon {
  width: 14px;
  height: 14px;
}

/* --- toasts ----------------------------------------------------------------------- */

.toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  left: auto;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(400px, calc(100vw - 32px));
  pointer-events: none;
}

.toast,
.toast.pass,
.toast.block {
  --tone: var(--accent);
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  max-width: none;
  padding: 14px 12px 14px 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-toast);
  font-size: 14px;
  pointer-events: auto;
  animation: kit-toast-in 0.3s var(--ease) backwards;
}

.toast.pass { --tone: var(--pass); }
.toast.block { --tone: var(--block); }
.toast.hold { --tone: var(--hold); }
.toast.note { --tone: var(--note); }

.toast.leaving {
  opacity: 0;
  transform: translateX(16px);
  transition: opacity 0.2s, transform 0.2s;
}

@keyframes kit-toast-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }
}

.toast-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: color-mix(in srgb, var(--tone) 14%, transparent);
  color: var(--tone);
}

.toast-icon .icon {
  width: 16px;
  height: 16px;
}

.toast-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 4px;
  line-height: 1.4;
}

.toast-text strong {
  font-weight: 500;
}

.toast-text span {
  color: var(--ink-muted);
  font-size: 13px;
}

.toast-action,
.toast-close {
  flex: none;
  border: 0;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  transform: none;
}

.toast-action {
  height: 28px;
  padding: 0 10px;
  border-radius: 8px;
  color: var(--accent);
  font: 500 13px var(--sans);
}

.toast-close {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 8px;
  color: var(--ink-subtle);
}

.toast-action:hover,
.toast-close:hover {
  background: var(--surface-muted);
  color: var(--ink);
  transform: none;
  box-shadow: none;
}

.toast-close .icon {
  width: 14px;
  height: 14px;
}

.toast-life {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--tone);
  transform-origin: left center;
  animation: kit-toast-life linear forwards;
}

.toast:hover .toast-life {
  animation-play-state: paused;
}

@keyframes kit-toast-life {
  to {
    transform: scaleX(0);
  }
}

@media (max-width: 860px) {
  .toasts {
    right: 16px;
    bottom: 84px;
  }
}

/* --- pagination ---------------------------------------------------------------------- */

.kit-pager {
  display: flex;
  align-items: center;
  gap: 12px 20px;
  flex-wrap: wrap;
  padding: 12px var(--density-padding);
  border-top: 1px solid var(--line-subtle);
  color: var(--ink-muted);
  font-size: var(--density-text-sm);
}

.kit-pager[hidden] {
  display: none;
}

.kit-pager-info b {
  color: var(--ink);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.kit-pager-size {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.kit-pager-size .kit-select {
  width: auto;
  min-width: 72px;
  height: 32px;
  padding: 0 8px 0 12px;
  font-size: 13px;
}

.kit-pages {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.kit-pages button {
  display: grid;
  place-items: center;
  min-width: 32px;
  height: 32px;
  padding: 0 6px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-2);
  box-shadow: none;
  font: 500 13px var(--sans);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transform: none;
}

.kit-pages button:hover:not(:disabled) {
  border-color: var(--line);
  background: var(--surface);
  transform: none;
  box-shadow: none;
}

.kit-pages button[aria-current='page'] {
  background: var(--accent);
  color: var(--on-accent);
}

.kit-pages button[aria-current='page']:hover {
  border-color: transparent;
  background: var(--accent);
}

.kit-pages button:disabled {
  color: var(--ink-subtle);
  opacity: 0.5;
  cursor: not-allowed;
}

.kit-pages button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

.kit-pages .icon {
  width: 16px;
  height: 16px;
}

.kit-pages-gap {
  width: 20px;
  color: var(--ink-subtle);
  text-align: center;
}

.kit-pages-now {
  display: none;
  padding: 0 8px;
  color: var(--ink);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 699px) {
  .kit-pager {
    padding: 12px 14px;
  }

  .kit-pager-size > span {
    display: none;
  }

  /* On a phone: previous, "3 / 8", next. A row of page numbers does not fit
     and is too small to press. */
  .kit-pages button[data-page]:not(:first-child):not(:last-child),
  .kit-pages-gap {
    display: none;
  }

  .kit-pages-now {
    display: inline;
  }

  .kit-pages button {
    min-width: 40px;
    height: 40px;
    border-color: var(--line);
  }
}

/* --- sortable headers ------------------------------------------------------------------ */

.kit-sort {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: auto;
  min-height: 0;
  margin: -4px -6px;
  padding: 4px 6px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: inherit;
  box-shadow: none;
  font: inherit;
  letter-spacing: inherit;
  cursor: pointer;
  transform: none;
}

.kit-sort:hover {
  background: color-mix(in srgb, var(--ink) 7%, transparent);
  color: var(--ink);
  transform: none;
  box-shadow: none;
}

.kit-sort:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 0;
}

.kit-sort {
  position: relative;
}

/* Out of the flow, so making a heading sortable does not widen its column. */
.kit-sort-mark {
  position: absolute;
  left: calc(100% - 3px);
  top: 50%;
  display: grid;
  margin-top: -6.5px;
  opacity: 0;
  transition: opacity 0.15s, transform 0.2s var(--ease);
}

th.num .kit-sort-mark {
  left: auto;
  right: calc(100% - 3px);
}

@media (min-width: 700px) {
  td.has-mono {
    min-width: 190px;
  }
}

.kit-sort-mark .icon {
  width: 13px;
  height: 13px;
}

.kit-sort:hover .kit-sort-mark {
  opacity: 0.4;
}

th[aria-sort='ascending'] .kit-sort,
th[aria-sort='descending'] .kit-sort {
  color: var(--accent);
}

th[aria-sort='ascending'] .kit-sort-mark,
th[aria-sort='descending'] .kit-sort-mark {
  opacity: 1;
}

th[aria-sort='descending'] .kit-sort-mark {
  transform: rotate(180deg);
}

.kit-table-act {
  width: 1%;
  text-align: right;
}

.kit-table > .toolbar {
  padding: var(--density-padding);
  padding-bottom: 12px;
}

/* --- drawer ------------------------------------------------------------------------------ */

dialog.kit-drawer {
  inset: 0 0 0 auto;
  width: min(460px, 100vw);
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 24px 0 0 24px;
  display: flex;
  flex-direction: column;
  animation: kit-drawer-in 0.28s var(--ease);
}

dialog.kit-drawer:not([open]) {
  display: none;
}

dialog.kit-drawer.leaving {
  transform: translateX(100%);
  transition: transform 0.2s var(--ease);
}

@keyframes kit-drawer-in {
  from {
    transform: translateX(100%);
  }
}

dialog.kit-drawer > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.kit-drawer-body {
  flex: 1;
  min-height: 0;
  padding: 20px;
  overflow: auto;
}

@media (max-width: 520px) {
  dialog.kit-drawer {
    border-radius: 0;
  }
}

/* --- form fields ---------------------------------------------------------------------------- */

/* An input with something inside its edge: an icon, a unit, a button. */
.input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.input-group > .icon,
.input-group > .unit {
  position: absolute;
  left: 12px;
  color: var(--ink-subtle);
  pointer-events: none;
}

.input-group > .icon {
  width: 16px;
  height: 16px;
}

.input-group > .unit {
  font-size: 14px;
}

.input-group > .unit.end,
.input-group > .icon.end {
  left: auto;
  right: 12px;
}

.input-group:has(> .icon:not(.end)) > input,
.input-group:has(> .unit:not(.end)) > input {
  padding-left: 38px;
}

.input-group:has(> .end) > input {
  padding-right: 44px;
}

.input-group:focus-within > .icon {
  color: var(--accent);
}

.field.invalid > input,
.field.invalid > textarea,
.field.invalid .kit-select,
.field.invalid .kit-date,
.field.invalid .input-group > input,
input[aria-invalid='true'] {
  border-color: var(--block);
}

.field.invalid input:focus {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--block) 20%, transparent);
}

.field > .help.error,
.field.invalid > .help {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--block);
}

.field > label .req {
  color: var(--block);
}

.field > label .opt {
  color: var(--ink-subtle);
  font-weight: 400;
}

input:disabled,
textarea:disabled {
  background: var(--surface-muted);
  color: var(--ink-subtle);
  cursor: not-allowed;
}

input[readonly] {
  background: var(--surface-muted);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 20px;
}

.form-grid > .wide {
  grid-column: 1 / -1;
}

/* Checkbox and radio. */
.check {
  display: inline-flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.4;
}

.check input {
  appearance: none;
  flex: none;
  width: 18px;
  height: 18px;
  min-width: 0;
  margin: 1px 0 0;
  padding: 0;
  border: 1.5px solid color-mix(in srgb, var(--ink) 30%, var(--line));
  border-radius: 6px;
  background: var(--surface) center / 12px no-repeat;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}

.check input[type='radio'] {
  border-radius: 999px;
}

.check input:checked {
  border-color: var(--accent);
  background-color: var(--accent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
}

.check input[type='radio']:checked {
  background-image: radial-gradient(circle, #fff 0 32%, transparent 36%);
  background-size: 100%;
}

.check input:indeterminate {
  border-color: var(--accent);
  background-color: var(--accent);
  background-image: linear-gradient(#fff, #fff);
  background-size: 10px 2px;
}

.check input:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  box-shadow: none;
}

.check input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.check small {
  display: block;
  color: var(--ink-subtle);
  font-size: 12.5px;
}

.checks {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* A file drop. */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 24px 16px;
  border: 1.5px dashed color-mix(in srgb, var(--ink) 22%, var(--line));
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface-muted) 50%, transparent);
  color: var(--ink-muted);
  font-size: 13.5px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}

.dropzone:hover,
.dropzone.over,
.dropzone:focus-within {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.dropzone .icon {
  width: 22px;
  height: 22px;
  color: var(--accent);
}

.dropzone b {
  color: var(--ink);
  font-weight: 500;
}

.dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

/* --- small things ------------------------------------------------------------------------------ */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 13px;
}

.chip .icon {
  width: 13px;
  height: 13px;
}

.chip button {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-right: -5px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-subtle);
  box-shadow: none;
  cursor: pointer;
  transform: none;
}

.chip button:hover {
  background: var(--surface-muted);
  color: var(--ink);
  transform: none;
  box-shadow: none;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.kit-progress {
  --v: 0;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--track);
}

.kit-progress > i {
  display: block;
  width: calc(var(--v) * 1%);
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.5s var(--ease);
}

.kit-progress.pass > i { background: var(--pass); }
.kit-progress.hold > i { background: var(--hold); }
.kit-progress.block > i { background: var(--block); }

.skeleton {
  display: block;
  height: 14px;
  border-radius: 7px;
  background: linear-gradient(90deg, var(--surface-muted) 25%, color-mix(in srgb, var(--surface-muted) 40%, var(--surface)) 50%, var(--surface-muted) 75%) 0 0 / 200% 100%;
  animation: kit-shimmer 1.4s linear infinite;
}

@keyframes kit-shimmer {
  to {
    background-position: -200% 0;
  }
}

.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--ink-subtle);
  font-size: 13px;
}

.breadcrumb a {
  color: var(--ink-muted);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--accent);
}

.breadcrumb .icon {
  width: 13px;
  height: 13px;
}

.breadcrumb [aria-current] {
  color: var(--ink);
  font-weight: 500;
}

details.kit-acc {
  border-bottom: 1px solid var(--line-subtle);
}

details.kit-acc > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  font-weight: 500;
  list-style: none;
  cursor: pointer;
}

details.kit-acc > summary::-webkit-details-marker {
  display: none;
}

details.kit-acc > summary .icon {
  width: 16px;
  height: 16px;
  color: var(--ink-subtle);
  transition: transform 0.2s var(--ease);
}

details.kit-acc[open] > summary .icon {
  transform: rotate(180deg);
}

details.kit-acc > div {
  padding: 0 0 16px;
  color: var(--ink-muted);
  font-size: 14px;
  line-height: 1.55;
}

.kit-steps {
  display: flex;
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.kit-steps li {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 10px;
  border-top: 3px solid var(--track);
  color: var(--ink-subtle);
  font-size: 13px;
}

.kit-steps li b {
  color: var(--ink-muted);
  font-weight: 500;
}

.kit-steps li.done {
  border-color: var(--pass);
}

.kit-steps li.now {
  border-color: var(--accent);
}

.kit-steps li.now b,
.kit-steps li.done b {
  color: var(--ink);
}

/* A hint on hover or focus, for a control whose label is only an icon. */
[data-tip] {
  position: relative;
}

[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  z-index: 250;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--surface);
  font: 400 12px/1.3 var(--sans);
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, 4px);
  pointer-events: none;
  transition: opacity 0.15s, transform 0.15s var(--ease);
}

[data-tip]:hover::after,
[data-tip]:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* --- a card that ends in a decision --------------------------------------------------------------- */

.kit-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  border: 1px solid var(--line-subtle);
  border-radius: var(--r-2xl);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.2s var(--ease), transform 0.2s var(--ease);
}

.kit-card:hover {
  box-shadow: var(--shadow-lift);
}

.kit-card-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.kit-card-head > div {
  flex: 1;
  min-width: 0;
}

.kit-card-head strong {
  display: block;
  font-size: 15px;
  font-weight: 600;
}

.kit-card-head small {
  color: var(--ink-subtle);
  font-size: 12.5px;
}

.kit-card p {
  margin: 0;
  color: var(--ink-muted);
  font-size: 14px;
  line-height: 1.5;
}

.kit-card-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 4px;
}

.kit-card-foot .spacer {
  margin-left: auto;
}

/* --- a twelve-column grid ---------------------------------------------------------------------------- */

.kit-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--bento-gap);
}

.kit-grid > * { grid-column: span 12; min-width: 0; }

@media (min-width: 700px) {
  .kit-grid > .span-3 { grid-column: span 6; }
  .kit-grid > .span-4 { grid-column: span 6; }
  .kit-grid > .span-6 { grid-column: span 6; }
  .kit-grid > .span-8 { grid-column: span 12; }
}

@media (min-width: 1100px) {
  .kit-grid > .span-3 { grid-column: span 3; }
  .kit-grid > .span-4 { grid-column: span 4; }
  .kit-grid > .span-6 { grid-column: span 6; }
  .kit-grid > .span-8 { grid-column: span 8; }
  .kit-grid > .span-9 { grid-column: span 9; }
}

/* --- the components page itself ------------------------------------------------------------------------ */

.kit-demo {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}

.kit-demo.col {
  flex-direction: column;
  align-items: stretch;
}

.kit-demo-note {
  margin: 0 0 16px;
  color: var(--ink-muted);
  font-size: 13.5px;
  line-height: 1.5;
  max-width: 68ch;
}

.kit-swatch {
  display: block;
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--ink-subtle);
  font-size: 12.5px;
  text-align: center;
  background: color-mix(in srgb, var(--accent) 5%, transparent);
}

.kit-swatches {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 12px;
}

.kit-colour {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.kit-colour i {
  height: 56px;
  margin-bottom: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.kit-colour b {
  font-size: 13px;
  font-weight: 500;
}

.kit-colour small {
  color: var(--ink-subtle);
  font: 400 11.5px var(--mono);
  overflow-wrap: anywhere;
}

.kit-type {
  display: flex;
  flex-direction: column;
}

.kit-type > div {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  align-items: baseline;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line-subtle);
}

.kit-type > div:last-child {
  border-bottom: 0;
}

.kit-type span {
  color: var(--ink-subtle);
  font-size: 12.5px;
}

.kit-type p {
  margin: 0;
  overflow-wrap: anywhere;
}

.kit-icons {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
}

.kit-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 6px 10px;
  border: 1px solid var(--line-subtle);
  border-radius: 12px;
  color: var(--ink);
}

.kit-icon .icon {
  width: 20px;
  height: 20px;
}

.kit-icon small {
  color: var(--ink-subtle);
  font-size: 11px;
  text-align: center;
  overflow-wrap: anywhere;
}

@media (max-width: 699px) {
  .kit-type > div {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }

  .kit-swatches {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kit-icons {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.kit-index {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.kit-index a {
  text-decoration: none;
}

.kit-index a:hover .chip,
.kit-index a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* --- skeletons ----------------------------------------------------------------
   Drawn by theme.js while a page's figures are being read; each takes the
   shape of what will replace it. One shimmer, two tints: on the page's
   white surfaces, and on the coloured figure blocks where it is a wash of
   the block's own ink. */

:root {
  --sk-a: color-mix(in srgb, var(--ink) 8%, var(--surface));
  --sk-b: color-mix(in srgb, var(--ink) 3%, var(--surface));
}

.stat,
.bento-block {
  --sk-a: color-mix(in srgb, var(--fg, #fff) 14%, transparent);
  --sk-b: color-mix(in srgb, var(--fg, #fff) 30%, transparent);
}

.sk,
html.loading .main .stat-value,
html.loading .main .stat-note:empty,
html.loading .main .gate-sub:empty {
  display: block;
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--sk-a) 25%, var(--sk-b) 50%, var(--sk-a) 75%) 0 0 / 200% 100%;
  animation: kit-shimmer 1.4s linear infinite;
}

.sk.thin { height: 9px; }
.sk-pill { height: 22px; border-radius: 999px; }
.sk-button { height: 36px; border-radius: 10px; }
.sk-tile { flex: none; width: 36px !important; height: 36px; border-radius: 10px; }
.sk-dot { flex: none; width: 18px !important; height: 18px; border-radius: 999px; }
.sk-track { height: 14px; border-radius: 999px; }

.sk-stack {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sk-lead {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 180px;
}

td.num > .sk {
  margin-left: auto;
}

tr.sk-row > td {
  height: 61px;
}

/* A figure, before it is one. */
html.loading .main .stat-value {
  width: 62%;
  max-width: 180px;
  height: 30px;
  margin: 6px 0 2px;
  border-radius: 9px;
  color: transparent !important;
  overflow: hidden;
}

html.loading .main .stat-value > * {
  visibility: hidden;
}

html.loading .main .stat-note:empty {
  width: 74%;
  height: 10px;
  margin-top: 6px;
}

html.loading .main .gate-sub:empty {
  width: 80%;
  height: 10px;
}

html.loading .main .b-capital .stat-value {
  height: 36px;
}

/* Lists. */
.ledger-row.sk-row,
.gate-item.sk-row,
.queue-item.sk-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  animation: none;
}

.ledger-row.sk-row .ledger-when {
  flex: none;
}

.sk-def {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  background: var(--surface);
}

.sk-bars {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.sk-bars > div {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
}

.sk-ring-row {
  display: flex;
  align-items: center;
  gap: 20px;
  padding-top: 8px;
}

.sk-ring {
  flex: none;
  width: 116px !important;
  height: 116px;
  border-radius: 999px;
  -webkit-mask: radial-gradient(circle, transparent 0 36px, #000 37px);
  mask: radial-gradient(circle, transparent 0 36px, #000 37px);
}

.mini-bars > .sk-mini {
  flex: 1;
  max-width: 28px;
  height: calc(var(--h) * 100%);
  border-radius: 8px 8px 3px 3px;
  background: linear-gradient(90deg, var(--sk-a) 25%, var(--sk-b) 50%, var(--sk-a) 75%) 0 0 / 200% 100%;
  opacity: 1;
  animation: kit-shimmer 1.4s linear infinite;
}

.sk-tabs {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 44px;
  padding: 0 var(--density-padding);
  box-shadow: inset 0 -1px 0 var(--line);
  overflow: hidden;
}

.sk-tabs > .sk {
  flex: none;
}

@media (max-width: 699px) {
  /* On a phone the figure tiles are small and the ring loses its legend. */
  html.loading .main .stat-value {
    height: 24px;
  }

  .bento > .b-capital .sk-ring-row > .sk-stack {
    display: none;
  }

  .sk-ring {
    width: 68px !important;
    height: 68px;
    -webkit-mask: radial-gradient(circle, transparent 0 20px, #000 21px);
    mask: radial-gradient(circle, transparent 0 20px, #000 21px);
  }

  .sk-bars > div {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  /* Rows that are cards on a phone are cards while they load. */
  table.as-cards tr.sk-row > td {
    display: block;
    height: auto;
    padding: 12px 0;
  }

  table.as-cards tr.sk-row > td.num > .sk {
    margin-left: 0;
  }

  .sk-lead {
    min-width: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sk,
  .mini-bars > .sk-mini,
  html.loading .main .stat-value,
  html.loading .main .stat-note:empty,
  html.loading .main .gate-sub:empty {
    animation: none;
  }
}

/* --- no zoom on focus, on a phone -----------------------------------------
   An iPhone zooms the whole page in when a field with text smaller than
   16px takes focus, and does not zoom back out when the field goes away:
   opening "More" (which focuses its search box) and closing it left the
   page enlarged. At 16px it has no reason to zoom. */
@media (max-width: 860px), (pointer: coarse) {
  input,
  select,
  textarea,
  .kit-list-search input,
  dialog.palette input,
  .toolbar input[type='search'] {
    font-size: 16px !important;
  }
}

/* --- no zoom on a double tap -----------------------------------------------
   Two quick taps (on a tab, a page number, a row) zoomed the page in on a
   phone. `manipulation` keeps scrolling and the two-finger pinch and drops
   only the double-tap zoom. It is set on every element because iOS reads it
   from the element that was touched, not from its ancestors. */
html,
body,
* {
  touch-action: manipulation;
}

/* --- one radius for a control ----------------------------------------------
   A field in a filter bar was a full pill while the button beside it had a
   10px corner. Fields, dropdowns, date fields and buttons now share it;
   only a status keeps the pill, because a pill there means "a status". */

.toolbar input,
.toolbar select,
.toolbar .kit-select,
.toolbar .kit-date {
  border-radius: var(--r-md);
}

/* --- the scrollbar ----------------------------------------------------------
   One scrollbar for the whole console instead of the browser's grey slab: a
   slim rounded bar with no track behind it, in a tint of the text colour so
   it follows the theme. It thickens under the pointer and turns the accent
   blue while it is being dragged. The page's own bar sits on the charcoal
   frame, so there it is drawn in white. */

::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track,
::-webkit-scrollbar-corner {
  background: transparent;
}

::-webkit-scrollbar-button {
  display: none;
}

::-webkit-scrollbar-thumb {
  min-height: 44px;
  min-width: 44px;
  border: 4px solid transparent;
  border-radius: 999px;
  background-color: color-mix(in srgb, var(--ink) 20%, transparent);
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  border-width: 2px;
  background-color: color-mix(in srgb, var(--ink) 38%, transparent);
}

::-webkit-scrollbar-thumb:active {
  border-width: 2px;
  background-color: var(--accent);
}

@media (min-width: 861px) {
  html:has(body > .topbar)::-webkit-scrollbar-track,
  body:has(> .topbar)::-webkit-scrollbar-track {
    background: var(--frame);
  }

  html:has(body > .topbar)::-webkit-scrollbar-thumb,
  body:has(> .topbar)::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.26);
  }

  html:has(body > .topbar)::-webkit-scrollbar-thumb:hover,
  body:has(> .topbar)::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.5);
  }

  html:has(body > .topbar)::-webkit-scrollbar-thumb:active,
  body:has(> .topbar)::-webkit-scrollbar-thumb:active {
    background-color: #6f95ff;
  }
}

/* Firefox draws its own thin bar and takes only the two colours. */
@supports not selector(::-webkit-scrollbar) {
  * {
    scrollbar-width: thin;
    scrollbar-color: color-mix(in srgb, var(--ink) 26%, transparent) transparent;
  }

  @media (min-width: 861px) {
    html:has(body > .topbar) {
      scrollbar-color: rgba(255, 255, 255, 0.32) var(--frame);
    }
  }
}

/* --- the Filters button and its panel ---------------------------------------
   A list with more ways to narrow it than a bar has room for keeps the two
   used most in the bar and puts the rest behind one button. The button says
   how many are narrowing the list, and takes the accent while any is. */

.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: var(--kit-h-sm);
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink);
  font: 400 var(--density-text-sm) var(--sans);
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}

.filter-btn:hover {
  border-color: color-mix(in srgb, var(--ink) 30%, var(--line));
  filter: none;
}

.filter-btn .icon {
  width: 16px;
  height: 16px;
  color: var(--ink-muted);
}

.filter-btn.has-value {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 500;
}

.filter-btn.has-value .icon {
  color: var(--accent);
}

.filter-btn > b {
  display: grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font: 600 11.5px var(--sans);
  font-variant-numeric: tabular-nums;
}

.filter-btn > b[hidden] {
  display: none;
}

.filter-form {
  display: grid;
  gap: 20px;
}

.filter-form .field > span:has(> .kit-date) {
  display: flex;
}

dialog.kit-drawer > footer {
  display: flex;
  gap: 10px;
  padding: 16px 20px calc(16px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line-subtle);
}

dialog.kit-drawer > footer > button {
  flex: 1 1 0;
}

@media (max-width: 699px) {
  .toolbar .filter-btn {
    flex: 1 1 140px;
    justify-content: center;
    height: 44px;
    border-radius: 12px;
  }
}

/* --- the trail and the way back ----------------------------------------------
   One quiet line above the page: a button back, then where this page sits.
   The button is the same rounded tile as the controls in the top bar; the
   trail is small muted text, with only the page you are on in full ink. */

.crumbs {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  min-height: 34px;
}

.crumb-back {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 34px;
  padding: 0 14px 0 8px;
  border: 0;
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink);
  font: 500 var(--density-text-sm) var(--sans);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}

.crumb-back:hover {
  background: var(--accent);
  color: var(--on-accent);
  filter: none;
}

.crumb-back .icon {
  width: 18px;
  height: 18px;
}

.crumbs ol {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: var(--density-text-sm);
  color: var(--ink-muted);
}

.crumbs li {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  white-space: nowrap;
}

.crumbs li > .icon {
  flex: none;
  width: 14px;
  height: 14px;
  color: var(--ink-subtle);
}

.crumbs a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  margin: 0 -4px;
  border-radius: 8px;
  color: inherit;
  text-decoration: none;
  transition: background-color 0.15s, color 0.15s;
}

.crumbs a .icon {
  width: 15px;
  height: 15px;
}

.crumbs a:hover {
  background: color-mix(in srgb, var(--ink) 7%, transparent);
  color: var(--ink);
}

.crumbs li[aria-current] {
  flex: 0 1 auto;
  color: var(--ink);
  font-weight: 600;
}

.crumbs li[aria-current] span {
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 699px) {
  .crumbs {
    gap: 10px;
  }

  .crumb-back {
    width: 38px;
    height: 38px;
    padding: 0;
    justify-content: center;
    border-radius: 12px;
  }

  .crumb-back span {
    display: none;
  }
}

/* --- a table that keeps its headings and its names in view ------------------
   A long table used to scroll with the page, and by the tenth row the
   headings were gone; a wide one scrolled sideways and took the name with it.
   The table now scrolls inside its own frame, no taller than the window, with
   the heading row held at the top and the first column held at the left.
   From 700px only: on a phone a table is drawn as cards and has neither. */

@media (min-width: 700px) {
  /* Short enough that the frame, the bar above the page and the page
     numbers under the table are all on screen at once; and when something
     scrolls the table into view it stops below that bar, not behind it. */
  .table-scroll {
    max-height: calc(100dvh - 210px);
    overflow: auto;
    scroll-margin-top: 128px;
  }

  .table-scroll thead th {
    z-index: 3;
  }

  .table-scroll thead th:first-child,
  .table-scroll tbody td:first-child:not([colspan]) {
    position: sticky;
    left: 0;
  }

  .table-scroll thead th:first-child {
    z-index: 4;
  }

  .table-scroll tbody td:first-child:not([colspan]) {
    z-index: 2;
    background: var(--surface);
  }

  /* Only once the table has moved sideways: an edge on the held column, so
     what slides under it reads as passing behind. */
  .table-scroll.is-scrolled-x thead th:first-child,
  .table-scroll.is-scrolled-x tbody td:first-child:not([colspan]) {
    box-shadow: 1px 0 0 var(--line), 10px 0 14px -10px rgba(11, 27, 58, 0.22);
  }

  .table-scroll.is-scrolled-y thead th {
    box-shadow: 0 1px 0 var(--line), 0 8px 12px -10px rgba(11, 27, 58, 0.22);
  }

  .table-scroll.is-scrolled-x.is-scrolled-y thead th:first-child {
    box-shadow: 1px 1px 0 var(--line), 10px 8px 14px -10px rgba(11, 27, 58, 0.22);
  }
}

@media (prefers-reduced-motion: reduce) {
  .kit-pop,
  .toast,
  .toast-life,
  .skeleton,
  dialog.kit-drawer {
    animation: none;
  }

  .kit-tab-bar,
  .kit-progress > i {
    transition: none;
  }
}
