/*
 * Sukud design system - forms
 * Every control is drawn by the system; no native browser chrome shows.
 * Shared floating panels (.sk-popover) live here because select, date,
 * time and menu all use them.
 */

/* ======================================================================
 * Field: label, control, hint, error
 * ====================================================================== */
.sk-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.sk-field__top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.sk-label {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--sk-text-sm);
  line-height: var(--sk-leading-sm);
  font-weight: var(--sk-weight-semibold);
  color: var(--sk-fg);
}
.sk-label__req { color: var(--sk-red-9); font-weight: var(--sk-weight-bold); }
.sk-label__opt { color: var(--sk-fg-subtle); font-weight: var(--sk-weight-regular); font-size: var(--sk-text-xs); }
.sk-field__aside { font-size: var(--sk-text-xs); color: var(--sk-fg-subtle); }
.sk-hint { font-size: var(--sk-text-xs); line-height: 1.45; color: var(--sk-fg-muted); }
.sk-error {
  display: flex; align-items: flex-start; gap: 5px;
  font-size: var(--sk-text-xs);
  line-height: 1.45;
  font-weight: var(--sk-weight-medium);
  color: var(--sk-red-11);
  animation: sk-rise var(--sk-dur-base) var(--sk-ease-out);
}
.sk-error .sk-icon { width: 14px; height: 14px; margin-top: 1px; }
/* Invisible carrier for a custom control's value: unlike type=hidden it
 * takes part in required validation. Never focusable or announced. */
.sk-proxy { position: absolute; left: 12px; bottom: 0; width: 1px; height: 1px; padding: 0; border: 0; opacity: 0; pointer-events: none; }
fieldset.sk-field { position: relative; }
.sk-field__counter { font-size: var(--sk-text-2xs); color: var(--sk-fg-subtle); font-variant-numeric: tabular-nums; }
.sk-field__counter.is-over { color: var(--sk-red-11); font-weight: var(--sk-weight-semibold); }

/* ======================================================================
 * Input box (text, search, password, select trigger, date trigger ...)
 * ====================================================================== */
.sk-input {
  --h: var(--sk-control-md);
  --ipx: 12px;
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  min-height: var(--h);
  border: 1px solid var(--sk-border);
  border-radius: var(--sk-radius-control);
  background: var(--sk-surface);
  box-shadow: var(--sk-shadow-xs);
  color: var(--sk-fg);
  text-align: start;
  transition: border-color var(--sk-dur-fast) var(--sk-ease-out), box-shadow var(--sk-dur-base) var(--sk-ease-out), background-color var(--sk-dur-fast);
}
.sk-input:hover { border-color: var(--sk-border-strong); }
.sk-input:focus-within, .sk-input.is-open {
  border-color: var(--sk-focus);
  box-shadow: var(--sk-focus-ring), var(--sk-shadow-xs);
}
.sk-input--sm { --h: var(--sk-control-sm); --ipx: 10px; border-radius: var(--sk-radius-sm); }
.sk-input--lg { --h: var(--sk-control-lg); --ipx: 14px; border-radius: 12px; }
.sk-input--sunken { background: var(--sk-surface-sunken); box-shadow: none; border-color: transparent; }
.sk-input--sunken:hover { border-color: var(--sk-border); }

.sk-input__control {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  height: calc(var(--h) - 2px);
  padding: 0 var(--ipx);
  border: 0;
  background: transparent;
  color: inherit;
  font-size: var(--sk-text-md);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  text-overflow: ellipsis;
}
.sk-input__control::placeholder { color: var(--sk-fg-subtle); opacity: 1; }
.sk-input__control::-webkit-search-cancel-button,
.sk-input__control::-webkit-search-decoration,
.sk-input__control::-ms-reveal,
.sk-input__control::-ms-clear { display: none; -webkit-appearance: none; }
.sk-input__control::-webkit-outer-spin-button,
.sk-input__control::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.sk-input__control[type="number"] { -moz-appearance: textfield; }
.sk-input__control:-webkit-autofill { -webkit-box-shadow: 0 0 0 40px var(--sk-surface) inset; -webkit-text-fill-color: var(--sk-fg); }

/* Phones zoom into anything smaller than 16px on focus. */
@media (pointer: coarse), (max-width: 639.98px) {
  .sk-input__control, .sk-textarea__control { font-size: 16px; }
}

.sk-input__icon {
  display: grid; place-items: center;
  padding-inline-start: var(--ipx);
  margin-inline-end: calc(var(--ipx) * -0.4);
  color: var(--sk-fg-subtle);
  pointer-events: none;
  transition: color var(--sk-dur-fast);
}
.sk-input__icon .sk-icon { width: 17px; height: 17px; }
.sk-input:focus-within .sk-input__icon { color: var(--sk-focus); }
.sk-input__addon {
  display: flex; align-items: center;
  align-self: stretch;
  padding: 0 11px;
  background: var(--sk-surface-sunken);
  color: var(--sk-fg-muted);
  font-size: var(--sk-text-sm);
  font-weight: var(--sk-weight-medium);
  white-space: nowrap;
}
.sk-input__addon:first-child { border-start-start-radius: inherit; border-end-start-radius: inherit; }
.sk-input__addon:last-child { border-start-end-radius: inherit; border-end-end-radius: inherit; }
.sk-input__end { display: flex; align-items: center; gap: 2px; padding-inline-end: 5px; flex-shrink: 0; }
.sk-input__end .sk-kbd { margin-inline-end: 4px; }
.sk-input__action {
  display: grid; place-items: center;
  width: 28px; height: 28px;
  border-radius: var(--sk-radius-full);
  color: var(--sk-fg-subtle);
  transition: background-color var(--sk-dur-fast), color var(--sk-dur-fast), transform var(--sk-dur-base) var(--sk-ease-spring);
}
.sk-input__action:hover { background: var(--sk-surface-hover); color: var(--sk-fg); }
.sk-input__action:active { transform: scale(0.9); }
.sk-input__action .sk-icon { width: 16px; height: 16px; }

.sk-input.is-invalid, .is-invalid > .sk-input { border-color: var(--sk-red-8); }
.sk-input.is-invalid:focus-within, .is-invalid > .sk-input:focus-within, .is-invalid > .sk-input.is-open { border-color: var(--sk-red-9); box-shadow: 0 0 0 3px rgb(var(--sk-red-rgb) / 0.2); }
.sk-input.is-valid { border-color: var(--sk-green-8); }
.sk-input.is-disabled, .sk-input:has(.sk-input__control:disabled) {
  background: var(--sk-surface-sunken);
  color: var(--sk-fg-disabled);
  box-shadow: none;
  cursor: not-allowed;
}
.sk-input.is-disabled:hover, .sk-input:has(.sk-input__control:disabled):hover { border-color: var(--sk-border); }
.sk-input__control:disabled { cursor: not-allowed; }
.sk-field.is-invalid .sk-input, .sk-field.is-invalid .sk-textarea { animation: sk-shake 0.4s var(--sk-ease-in-out) 1; }

/* Textarea */
.sk-textarea { position: relative; align-items: stretch; flex-direction: column; min-height: auto; }
.sk-textarea__control {
  display: block;
  width: 100%;
  min-height: calc(var(--rows, 3) * 1.5em + 20px);
  max-height: 420px;
  padding: 9px var(--ipx);
  border: 0;
  background: transparent;
  color: inherit;
  font-size: var(--sk-text-md);
  line-height: 1.5;
  resize: none;
  outline: none;
  field-sizing: content;
}
.sk-textarea__control::placeholder { color: var(--sk-fg-subtle); }

/* ======================================================================
 * Floating panel shared by select, date, time and menus
 * ====================================================================== */
.sk-popover {
  position: fixed;
  z-index: var(--sk-z-popover);
  top: 0; left: 0;
  min-width: 180px;
  max-width: min(360px, calc(100vw - 16px));
  max-height: min(340px, var(--avail, 340px));
  overflow: auto;
  overscroll-behavior: contain;
  padding: 5px;
  border: 1px solid var(--sk-border);
  border-radius: 12px;
  background: var(--sk-surface-raised);
  box-shadow: var(--sk-shadow-lg), var(--sk-bevel);
  transform-origin: var(--origin, top center);
  animation: sk-drop var(--sk-dur-base) var(--sk-ease-out);
}
.sk-popover[data-side="top"] { --origin: bottom center; }
.sk-popover.is-leaving { animation: sk-scale-out var(--sk-dur-fast) var(--sk-ease-in) forwards; }

/* On phones the same panel becomes a bottom sheet with big rows. */
.sk-sheet-scrim {
  position: fixed; inset: 0;
  z-index: calc(var(--sk-z-popover) - 1);
  background: var(--sk-scrim);
  animation: sk-fade-in var(--sk-dur-base) var(--sk-ease-out);
}
.sk-popover.is-sheet {
  top: auto !important; left: 0 !important; right: 0; bottom: 0;
  width: 100% !important; max-width: none; min-width: 0;
  max-height: min(78dvh, 560px);
  padding: 8px 8px calc(12px + var(--sk-safe-bottom));
  border-radius: 20px 20px 0 0;
  border-width: 1px 0 0;
  transform: none !important;
  animation: sk-sheet-in var(--sk-dur-slow) var(--sk-ease-out);
}
.sk-popover.is-sheet.is-leaving { animation: sk-sheet-out var(--sk-dur-base) var(--sk-ease-in) forwards; }
.sk-popover__handle { display: none; }
.sk-popover.is-sheet .sk-popover__handle {
  display: block;
  width: 38px; height: 4px;
  margin: 2px auto 10px;
  border-radius: 99px;
  background: var(--sk-border-strong);
}
.sk-popover__title { display: none; }
.sk-popover.is-sheet .sk-popover__title {
  display: block;
  padding: 0 10px 8px;
  font-family: var(--sk-font-display);
  font-size: var(--sk-text-xl);
  font-weight: var(--sk-weight-bold);
  letter-spacing: -0.015em;
}

.sk-popover__search { position: sticky; top: -5px; z-index: 1; margin: -5px -5px 5px; padding: 5px; background: var(--sk-surface-raised); border-bottom: 1px solid var(--sk-border-subtle); }
.sk-popover.is-sheet .sk-popover__search { top: -8px; margin: 0 0 6px; border-bottom: 0; }
.sk-popover__empty { padding: 18px 10px; text-align: center; color: var(--sk-fg-subtle); font-size: var(--sk-text-sm); }
.sk-popover__group { padding: 8px 10px 4px; font-size: var(--sk-text-2xs); font-weight: var(--sk-weight-bold); letter-spacing: var(--sk-tracking-caps); text-transform: uppercase; color: var(--sk-fg-subtle); }
.sk-popover__sep { height: 1px; margin: 5px -5px; background: var(--sk-border-subtle); }

.sk-option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--sk-fg);
  font-size: var(--sk-text-md);
  text-align: start;
  cursor: pointer;
  user-select: none;
  transition: background-color var(--sk-dur-instant);
}
.sk-popover.is-sheet .sk-option { min-height: 48px; padding: 10px 12px; font-size: var(--sk-text-lg); border-radius: 12px; }
.sk-option > .sk-icon { width: 17px; height: 17px; color: var(--sk-fg-muted); }
.sk-option__text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.sk-option__desc { font-size: var(--sk-text-xs); color: var(--sk-fg-muted); }
.sk-option__check {
  flex-shrink: 0;
  width: 16px; height: 16px;
  background: var(--sk-brand-9);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / contain no-repeat;
  opacity: 0;
  transform: scale(0.5);
  transition: opacity var(--sk-dur-fast), transform var(--sk-dur-base) var(--sk-ease-spring);
}
.sk-option.is-active { background: var(--sk-surface-hover); }
.sk-option[aria-selected="true"] { color: var(--sk-brand-11); font-weight: var(--sk-weight-semibold); }
.sk-option[aria-selected="true"] .sk-option__check { opacity: 1; transform: scale(1); }
.sk-option[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
.sk-option__swatch { width: 10px; height: 10px; border-radius: 50%; background: var(--swatch, var(--t-solid)); flex-shrink: 0; }

/* ======================================================================
 * Select trigger
 * ====================================================================== */
.sk-select { position: relative; width: 100%; min-width: 0; }
.sk-select__trigger { cursor: pointer; padding-inline-end: 8px; gap: 8px; }
.sk-select__value {
  flex: 1 1 auto;
  min-width: 0;
  padding-inline-start: var(--ipx);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--sk-text-md);
}
.sk-select__trigger .sk-input__icon + .sk-select__value { padding-inline-start: calc(var(--ipx) * 0.6); }
.sk-select__value.is-placeholder { color: var(--sk-fg-subtle); }
.sk-select__chevron { color: var(--sk-fg-subtle); transition: transform var(--sk-dur-base) var(--sk-ease-spring); }
.sk-select__chevron .sk-icon { width: 16px; height: 16px; }
.sk-select__trigger.is-open .sk-select__chevron { transform: rotate(180deg); color: var(--sk-focus); }
.sk-select__tags { display: flex; flex-wrap: wrap; gap: 4px; flex: 1 1 auto; min-width: 0; padding: 4px 0 4px 6px; }
.sk-select__tags .sk-badge { --bh: 24px; font-size: var(--sk-text-xs); }

/* ======================================================================
 * Checkbox, radio, switch
 * ====================================================================== */
.sk-check, .sk-radio, .sk-switch {
  position: relative;
  display: inline-flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.sk-check input, .sk-radio input, .sk-switch input {
  position: absolute;
  opacity: 0;
  width: 1px; height: 1px;
  margin: 0;
  pointer-events: none;
}
.sk-check__text, .sk-radio__text, .sk-switch__text { display: flex; flex-direction: column; gap: 1px; min-width: 0; padding-top: 0; }
.sk-check__label, .sk-radio__label, .sk-switch__label { font-size: var(--sk-text-md); line-height: 20px; color: var(--sk-fg); font-weight: var(--sk-weight-medium); }
.sk-check__desc, .sk-radio__desc, .sk-switch__desc { font-size: var(--sk-text-xs); line-height: 1.45; color: var(--sk-fg-muted); }

.sk-check__box, .sk-radio__dot {
  position: relative;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 18px; height: 18px;
  margin-top: 1px;
  border: 1.5px solid var(--sk-ink-7);
  background: var(--sk-surface);
  transition: background-color var(--sk-dur-fast), border-color var(--sk-dur-fast), box-shadow var(--sk-dur-base) var(--sk-ease-out), transform var(--sk-dur-base) var(--sk-ease-spring);
}
.sk-check__box { border-radius: 5.5px; }
.sk-radio__dot { border-radius: 50%; }
.sk-check:hover .sk-check__box, .sk-radio:hover .sk-radio__dot { border-color: var(--t-border-strong); }
.sk-check:active .sk-check__box, .sk-radio:active .sk-radio__dot { transform: scale(0.88); }
.sk-check input:focus-visible + .sk-check__box,
.sk-radio input:focus-visible + .sk-radio__dot,
.sk-switch input:focus-visible + .sk-switch__track { outline: 2px solid var(--sk-focus); outline-offset: 2px; }

.sk-check__box svg { width: 12px; height: 12px; stroke: var(--t-on); stroke-width: 3.2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.sk-check__tick { stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset var(--sk-dur-base) var(--sk-ease-out) 40ms; }
.sk-check__dash { opacity: 0; }
.sk-check input:checked + .sk-check__box,
.sk-check input:indeterminate + .sk-check__box {
  background: var(--t-solid);
  border-color: var(--t-solid);
  box-shadow: 0 1px 3px rgb(var(--t-rgb) / 0.35);
}
.sk-check input:checked + .sk-check__box .sk-check__tick { stroke-dashoffset: 0; }
.sk-check input:indeterminate + .sk-check__box .sk-check__tick { opacity: 0; }
.sk-check input:indeterminate + .sk-check__box .sk-check__dash { opacity: 1; }

.sk-radio__dot::after {
  content: '';
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--t-on);
  transform: scale(0);
  transition: transform var(--sk-dur-base) var(--sk-ease-spring);
}
.sk-radio input:checked + .sk-radio__dot { background: var(--t-solid); border-color: var(--t-solid); box-shadow: 0 1px 3px rgb(var(--t-rgb) / 0.35); }
.sk-radio input:checked + .sk-radio__dot::after { transform: scale(1); }

.sk-switch { align-items: center; }
.sk-switch__track {
  --tw: 36px; --th: 20px; --pad: 2px;
  position: relative;
  flex-shrink: 0;
  width: var(--tw); height: var(--th);
  border-radius: 99px;
  background: var(--sk-ink-6);
  box-shadow: inset 0 1px 2px rgb(0 0 0 / 0.08);
  transition: background-color var(--sk-dur-base) var(--sk-ease-out);
}
.sk-switch--sm .sk-switch__track { --tw: 30px; --th: 17px; }
@media (pointer: coarse) { .sk-switch__track { --tw: 44px; --th: 26px; } }
.sk-switch__thumb {
  position: absolute;
  top: var(--pad); left: var(--pad);
  width: calc(var(--th) - var(--pad) * 2);
  height: calc(var(--th) - var(--pad) * 2);
  border-radius: 99px;
  background: #fff;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.18), 0 2px 6px -1px rgb(0 0 0 / 0.16);
  transition: transform var(--sk-dur-slow) var(--sk-ease-spring), width var(--sk-dur-base) var(--sk-ease-out);
}
.sk-switch:active .sk-switch__thumb { width: calc(var(--th) - var(--pad) * 2 + 5px); }
.sk-switch input:checked + .sk-switch__track { background: var(--t-solid); }
.sk-switch input:checked + .sk-switch__track .sk-switch__thumb { transform: translateX(calc(var(--tw) - var(--th))); }
.sk-switch:active input:checked + .sk-switch__track .sk-switch__thumb { transform: translateX(calc(var(--tw) - var(--th) - 5px)); }
.sk-switch--between { display: flex; justify-content: space-between; width: 100%; flex-direction: row-reverse; }

.sk-check:has(input:disabled), .sk-radio:has(input:disabled), .sk-switch:has(input:disabled) { cursor: not-allowed; opacity: 0.5; }

/* Groups of checks / radios */
.sk-choice-group { display: flex; flex-direction: column; gap: 10px; border: 0; margin: 0; padding: 0; min-width: 0; }
.sk-choice-group--row { flex-direction: row; flex-wrap: wrap; gap: 10px 20px; }
.sk-choice-group > legend { padding: 0; margin-bottom: 8px; }

/* ======================================================================
 * Choice card (radio or checkbox shaped as a card)
 * ====================================================================== */
.sk-choice-cards { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(var(--min, 200px), 100%), 1fr)); border: 0; padding: 0; margin: 0; min-width: 0; }
.sk-choice {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--sk-border);
  border-radius: 14px;
  background: var(--sk-surface);
  box-shadow: var(--sk-shadow-xs);
  cursor: pointer;
  transition: border-color var(--sk-dur-fast), background-color var(--sk-dur-fast), box-shadow var(--sk-dur-base) var(--sk-ease-out), transform var(--sk-dur-base) var(--sk-ease-spring);
}
.sk-choice:hover { border-color: var(--sk-border-strong); }
.sk-choice:active { transform: scale(0.985); }
.sk-choice input { position: absolute; opacity: 0; pointer-events: none; }
.sk-choice__head { display: flex; align-items: center; gap: 8px; min-width: 0; padding-right: 26px; }
.sk-choice__icon { display: inline-flex; flex-shrink: 0; color: var(--t-text); transition: transform var(--sk-dur-slow) var(--sk-ease-spring); }
.sk-choice__icon .sk-icon { width: 20px; height: 20px; }
.sk-choice__title { font-weight: var(--sk-weight-semibold); color: var(--sk-fg); line-height: 1.3; }
.sk-choice__desc { font-size: var(--sk-text-sm); line-height: 1.45; color: var(--sk-fg-muted); }
.sk-choice__mark {
  position: absolute; top: 14px; right: 14px;
  display: grid; place-items: center;
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 1.5px solid var(--sk-ink-7);
  color: var(--t-on);
  transition: background-color var(--sk-dur-fast), border-color var(--sk-dur-fast), transform var(--sk-dur-base) var(--sk-ease-spring);
}
.sk-choice__mark .sk-icon { width: 12px; height: 12px; stroke-width: 3.2; transform: scale(0); transition: transform var(--sk-dur-base) var(--sk-ease-spring); }
.sk-choice:has(input:checked) {
  border-color: var(--t-solid);
  background: var(--t-subtle);
  box-shadow: 0 0 0 1px var(--t-solid), 0 4px 14px -6px rgb(var(--t-rgb) / 0.4);
}
.sk-choice:has(input:checked) .sk-choice__mark { background: var(--t-solid); border-color: var(--t-solid); }
.sk-choice:has(input:checked) .sk-choice__mark .sk-icon { transform: scale(1); }
.sk-choice:has(input:checked) .sk-choice__icon { transform: rotate(-10deg) scale(1.12); }
.sk-choice:has(input:focus-visible) { outline: 2px solid var(--sk-focus); outline-offset: 2px; }
.sk-choice:has(input:disabled) { opacity: 0.5; cursor: not-allowed; }
.sk-choice--center { align-items: center; text-align: center; padding: 18px 30px; }
.sk-choice--center .sk-choice__head { padding-right: 0; justify-content: center; }

/* ======================================================================
 * Segmented control (sliding thumb positioned by sukud-ui.js)
 * ====================================================================== */
.sk-segmented {
  position: relative;
  display: inline-flex;
  padding: 3px;
  border-radius: var(--sk-radius-full);
  background: var(--sk-surface-sunken);
  border: 1px solid var(--sk-border-subtle);
  isolation: isolate;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.sk-segmented::-webkit-scrollbar { display: none; }
.sk-segmented--block { display: flex; width: 100%; }
.sk-segmented--block .sk-segmented__item { flex: 1 1 0; }
.sk-segmented__thumb {
  position: absolute;
  z-index: -1;
  top: 3px; bottom: 3px; left: 0;
  width: var(--w, 0);
  transform: translateX(var(--x, 0));
  border-radius: var(--sk-radius-full);
  background: var(--sk-surface);
  box-shadow: var(--sk-shadow-sm), 0 0 0 1px var(--sk-border-subtle);
  transition: transform 420ms cubic-bezier(0.3, 1.3, 0.5, 1), width 420ms cubic-bezier(0.3, 1.3, 0.5, 1);
}
[data-theme="dark"] .sk-segmented__thumb { background: var(--sk-surface-active); }
.sk-segmented:not(.is-ready) .sk-segmented__thumb { transition: none; }
.sk-segmented__item {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: calc(var(--sk-control-md) - 8px);
  padding: 0 14px;
  border-radius: var(--sk-radius-full);
  color: var(--sk-fg-muted);
  font-size: var(--sk-text-sm);
  font-weight: var(--sk-weight-semibold);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: color var(--sk-dur-fast);
}
.sk-segmented__item:hover { color: var(--sk-fg); }
.sk-segmented__item input { position: absolute; opacity: 0; pointer-events: none; }
.sk-segmented__item .sk-icon { width: 15px; height: 15px; }
.sk-segmented__item:has(input:checked), .sk-segmented__item[aria-selected="true"] { color: var(--sk-fg); }
.sk-segmented__item:has(input:focus-visible) { outline: 2px solid var(--sk-focus); outline-offset: -2px; }
.sk-segmented__item:active { transform: scale(0.96); }
.sk-segmented__item { transition: color var(--sk-dur-fast), transform var(--sk-dur-base) var(--sk-ease-spring); }
.sk-segmented--sm .sk-segmented__item { height: calc(var(--sk-control-sm) - 8px); padding: 0 10px; font-size: var(--sk-text-xs); }

/* ======================================================================
 * Number stepper
 * ====================================================================== */
.sk-stepper { width: auto; padding: 3px; gap: 2px; border-radius: var(--sk-radius-full); }
.sk-stepper .sk-input__control { width: 5ch; flex: 0 0 auto; padding: 0 4px; text-align: center; font-weight: var(--sk-weight-semibold); font-variant-numeric: tabular-nums; }
.sk-stepper__btn {
  display: grid; place-items: center;
  width: calc(var(--h) - 8px); height: calc(var(--h) - 8px);
  border-radius: var(--sk-radius-full);
  color: var(--sk-fg-muted);
  transition: background-color var(--sk-dur-fast), color var(--sk-dur-fast), transform var(--sk-dur-base) var(--sk-ease-spring);
}
.sk-stepper__btn:hover:not(:disabled) { background: var(--sk-surface-hover); color: var(--sk-fg); }
.sk-stepper__btn:active:not(:disabled) { transform: scale(0.88); }
.sk-stepper__btn:disabled { opacity: 0.35; cursor: not-allowed; }
.sk-stepper__btn .sk-icon { width: 16px; height: 16px; stroke-width: 2.4; }
.sk-stepper__unit {
  display: flex; align-items: center;
  align-self: stretch;
  margin: -3px -3px -3px 2px;
  padding: 0 14px 0 10px;
  border-radius: 0 var(--sk-radius-full) var(--sk-radius-full) 0;
  background: var(--sk-surface-sunken);
  color: var(--sk-fg-muted);
  font-size: var(--sk-text-sm);
  font-weight: var(--sk-weight-semibold);
}
.sk-stepper.is-bumped .sk-input__control { animation: sk-pop var(--sk-dur-slow) var(--sk-ease-spring); }

/* ======================================================================
 * Calendar (date picker panel)
 * ====================================================================== */
.sk-popover--calendar { width: 300px; max-height: none; padding: 10px; }
.sk-popover--calendar.is-sheet { padding-inline: 14px; }
.sk-cal { display: flex; flex-direction: column; gap: 8px; }
.sk-cal__head { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.sk-cal__title {
  display: inline-flex; align-items: center; gap: 4px;
  height: 32px; padding: 0 10px;
  border-radius: var(--sk-radius-full);
  font-family: var(--sk-font-display);
  font-size: var(--sk-text-lg);
  font-weight: var(--sk-weight-bold);
  letter-spacing: -0.01em;
}
.sk-cal__title:hover { background: var(--sk-surface-hover); }
.sk-cal__nav { display: flex; gap: 2px; }
.sk-cal__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.sk-cal__dow { height: 26px; display: grid; place-items: center; font-size: var(--sk-text-2xs); font-weight: var(--sk-weight-bold); letter-spacing: 0.04em; color: var(--sk-fg-subtle); text-transform: uppercase; }
.sk-cal__day {
  position: relative;
  display: grid; place-items: center;
  aspect-ratio: 1;
  min-height: 34px;
  border-radius: var(--sk-radius-full);
  font-size: var(--sk-text-md);
  font-weight: var(--sk-weight-medium);
  font-variant-numeric: tabular-nums;
  color: var(--sk-fg);
  transition: background-color var(--sk-dur-instant), color var(--sk-dur-instant), transform var(--sk-dur-base) var(--sk-ease-spring);
}
.sk-cal__day:hover:not(:disabled) { background: var(--sk-surface-hover); }
.sk-cal__day:active:not(:disabled) { transform: scale(0.9); }
.sk-cal__day.is-outside { color: var(--sk-fg-disabled); }
.sk-cal__day.is-today { color: var(--sk-brand-11); font-weight: var(--sk-weight-bold); }
.sk-cal__day.is-today::after { content: ''; position: absolute; bottom: 5px; width: 4px; height: 4px; border-radius: 50%; background: currentColor; }
.sk-cal__day.is-active { box-shadow: inset 0 0 0 2px var(--sk-focus); }
.sk-cal__day.is-selected {
  background: var(--sk-brand-9);
  color: #fff;
  font-weight: var(--sk-weight-bold);
  box-shadow: 0 2px 8px -2px rgb(var(--sk-brand-rgb) / 0.6);
  animation: sk-pop var(--sk-dur-slow) var(--sk-ease-spring);
}
.sk-cal__day.is-selected::after { background: #fff; }
.sk-cal__day:disabled { color: var(--sk-fg-disabled); cursor: not-allowed; text-decoration: line-through; text-decoration-color: var(--sk-border-strong); }
.sk-cal__months { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.sk-cal__month { height: 40px; border-radius: var(--sk-radius-full); font-weight: var(--sk-weight-semibold); font-size: var(--sk-text-sm); }
.sk-cal__month:hover { background: var(--sk-surface-hover); }
.sk-cal__month.is-selected { background: var(--sk-brand-9); color: #fff; }
.sk-cal__foot { display: flex; justify-content: space-between; gap: 6px; padding-top: 8px; border-top: 1px solid var(--sk-border-subtle); }
.sk-popover.is-sheet .sk-cal__day { min-height: 42px; font-size: var(--sk-text-lg); }

/* Time picker: two scrolling columns */
.sk-popover--time { width: 220px; padding: 6px; }
.sk-time { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.sk-time--ampm { grid-template-columns: 1fr 1fr 0.8fr; }
.sk-time__col { display: flex; flex-direction: column; gap: 2px; max-height: 232px; overflow-y: auto; scroll-snap-type: y proximity; scrollbar-width: none; padding: 2px; }
.sk-time__col::-webkit-scrollbar { display: none; }
.sk-time__head { position: sticky; top: -2px; padding: 4px 0 6px; background: var(--sk-surface-raised); text-align: center; font-size: var(--sk-text-2xs); font-weight: var(--sk-weight-bold); letter-spacing: var(--sk-tracking-caps); text-transform: uppercase; color: var(--sk-fg-subtle); }
.sk-time__opt { flex-shrink: 0; height: 34px; border-radius: var(--sk-radius-full); font-variant-numeric: tabular-nums; font-weight: var(--sk-weight-medium); scroll-snap-align: center; }
.sk-time__opt:hover { background: var(--sk-surface-hover); }
.sk-time__opt.is-selected { background: var(--sk-brand-9); color: #fff; font-weight: var(--sk-weight-bold); }
.sk-popover.is-sheet .sk-time__col { max-height: 46dvh; }
.sk-popover.is-sheet .sk-time__opt { height: 44px; font-size: var(--sk-text-lg); }

/* ======================================================================
 * File dropzone
 * ====================================================================== */
.sk-dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 28px 20px;
  border: 1.5px dashed var(--sk-border-strong);
  border-radius: 16px;
  background: var(--sk-surface);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--sk-dur-fast), background-color var(--sk-dur-fast), transform var(--sk-dur-base) var(--sk-ease-spring);
}
.sk-dropzone:hover { border-color: var(--sk-brand-8); background: var(--sk-brand-2); }
.sk-dropzone:focus-within { outline: 2px solid var(--sk-focus); outline-offset: 2px; }
.sk-dropzone.is-dragging { border-color: var(--sk-brand-9); border-style: solid; background: var(--sk-brand-3); transform: scale(1.01); }
.sk-dropzone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.sk-dropzone__icon {
  display: grid; place-items: center;
  width: 48px; height: 48px;
  border-radius: var(--sk-radius-full);
  background: var(--sk-brand-3);
  color: var(--sk-brand-11);
  box-shadow: inset 0 0 0 1px var(--sk-brand-5);
  animation: sk-float 3s var(--sk-ease-in-out) infinite;
}
.sk-dropzone.is-dragging .sk-dropzone__icon { animation: sk-bounce 0.6s var(--sk-ease-out) infinite; }
.sk-dropzone__icon .sk-icon { width: 22px; height: 22px; }
.sk-dropzone__title { font-weight: var(--sk-weight-semibold); }
.sk-dropzone__title b { color: var(--sk-brand-11); }
.sk-dropzone--compact { flex-direction: row; text-align: start; padding: 14px 16px; }
.sk-dropzone--compact .sk-dropzone__icon { width: 40px; height: 40px; animation: none; }

.sk-files { display: flex; flex-direction: column; gap: 8px; }
.sk-file {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--sk-border);
  border-radius: 12px;
  background: var(--sk-surface);
  animation: sk-rise var(--sk-dur-slow) var(--sk-ease-out);
}
.sk-file__icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: var(--sk-radius-full); background: var(--t-soft); color: var(--t-text); flex-shrink: 0; }
.sk-file__icon .sk-icon { width: 18px; height: 18px; }
.sk-file__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.sk-file__name { font-weight: var(--sk-weight-semibold); font-size: var(--sk-text-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sk-file__meta { font-size: var(--sk-text-xs); color: var(--sk-fg-muted); font-variant-numeric: tabular-nums; }

/* ======================================================================
 * Form layout
 * ====================================================================== */
.sk-form { display: flex; flex-direction: column; gap: var(--gap, 18px); min-width: 0; }
.sk-form-grid { display: grid; gap: 16px; grid-template-columns: 1fr; container-type: inline-size; }
.sk-form-grid__inner { display: grid; gap: 16px 14px; grid-template-columns: 1fr; }
@container (min-width: 440px) {
  .sk-form-grid__inner { grid-template-columns: 1fr 1fr; }
  .sk-form-grid__inner > .sk-span-2 { grid-column: span 2; }
}
.sk-form-section { container-type: inline-size; }
.sk-form-section__inner { display: grid; gap: 16px 32px; grid-template-columns: 1fr; padding-block: 24px; border-top: 1px solid var(--sk-border-subtle); }
.sk-form-section:first-child .sk-form-section__inner { border-top: 0; padding-top: 0; }
.sk-form-section__head { display: flex; flex-direction: column; gap: 4px; }
.sk-form-section__title { font-size: var(--sk-text-lg); font-weight: var(--sk-weight-semibold); letter-spacing: var(--sk-tracking-tight); }
.sk-form-section__desc { font-size: var(--sk-text-sm); color: var(--sk-fg-muted); line-height: 1.5; max-width: 42ch; }
.sk-form-section__body { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
@container (min-width: 760px) {
  .sk-form-section__inner { grid-template-columns: minmax(200px, 1fr) 2fr; }
}
.sk-form-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; padding-top: 6px; }
.sk-form-actions--sticky {
  position: sticky; bottom: 0; z-index: var(--sk-z-sticky);
  margin-inline: calc(var(--sk-gutter) * -1);
  padding: 12px var(--sk-gutter) calc(12px + var(--sk-safe-bottom));
  background: var(--sk-canvas);
  background: color-mix(in srgb, var(--sk-canvas) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--sk-border-subtle);
}
@container (max-width: 480px) {
  /* Narrow sticky bars keep their buttons side by side, sharing the width. */
  .sk-form-actions--sticky > .sk-btn { flex: 1 1 0; }
  .sk-form-actions:not(.sk-form-actions--sticky) { flex-direction: column-reverse; }
  .sk-form-actions:not(.sk-form-actions--sticky) > .sk-btn { width: 100%; }
}

/* ======================================================================
 * Step-by-step form (ui.form_steps, ui.form_step)
 * ====================================================================== */
.sk-steps-form { display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.sk-steps-form__top { position: sticky; top: calc(var(--sk-topbar-h, 0px) + 8px); z-index: 2; display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-radius: 16px; background: var(--sk-surface); box-shadow: var(--sk-shadow-sm), 0 0 0 1px var(--sk-border-subtle); }
.sk-steps-form__count { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: var(--sk-text-xs); color: var(--sk-fg-muted); }
.sk-steps-form__count b { color: var(--sk-fg); font-variant-numeric: tabular-nums; }
.sk-steps-form__name { font-weight: var(--sk-weight-semibold); color: var(--sk-brand-11); text-align: end; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sk-steps-form__bar { height: 6px; border-radius: 99px; background: var(--sk-surface-sunken); overflow: hidden; }
.sk-steps-form__bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--sk-brand-9), var(--sk-brand-11)); transition: width 500ms var(--sk-ease-glide); }
.sk-steps-form__steps { display: flex; flex-direction: column; gap: 28px; }
.sk-steps-form__step { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
[x-data] > .sk-steps-form__steps > .sk-steps-form__step { animation: sk-rise var(--sk-dur-slow) var(--sk-ease-out); }
.sk-steps-form__head { display: flex; align-items: flex-start; gap: 12px; }
.sk-steps-form__icon { display: grid; place-items: center; flex-shrink: 0; width: 38px; height: 38px; border-radius: 12px; background: var(--sk-brand-3); color: var(--sk-brand-11); }
.sk-steps-form__title { font-family: var(--sk-font-display); font-size: var(--sk-text-xl); font-weight: var(--sk-weight-bold); letter-spacing: var(--sk-tracking-tight); line-height: 1.2; }
.sk-steps-form__desc { margin-top: 4px; font-size: var(--sk-text-sm); color: var(--sk-fg-muted); line-height: 1.5; }
.sk-steps-form__body { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.sk-steps-form__nav { display: flex; align-items: center; gap: 10px; padding-top: 4px; }
@media (max-width: 480px) { .sk-steps-form__next { flex: 1 1 auto; } }

/* Photos attached to an answer (camera or gallery) */
.sk-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; margin-top: 10px; }
.sk-photos__item { position: relative; margin: 0; aspect-ratio: 1; border-radius: 14px; overflow: visible; animation: sk-pop var(--sk-dur-slow) var(--sk-ease-spring); }
.sk-photos__item img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; box-shadow: 0 0 0 1px var(--sk-border-subtle); cursor: zoom-in; }
.sk-photos__remove { position: absolute; top: -7px; right: -7px; display: grid; place-items: center; width: 26px; height: 26px; border: 0; border-radius: 50%; background: var(--sk-surface-inverse); color: var(--sk-fg-inverse); box-shadow: var(--sk-shadow-md); cursor: pointer; }
.sk-photos__remove:hover { background: var(--sk-red-9); color: #fff; }
label.sk-btn { cursor: pointer; }
label.sk-btn.is-disabled { opacity: 0.5; pointer-events: none; }

/* Colour and icon pickers (ui.color_picker, ui.icon_picker) */
.sk-swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.sk-swatch { position: relative; display: inline-grid; cursor: pointer; }
.sk-swatch input[type=radio] { position: absolute; opacity: 0; pointer-events: none; }
.sk-swatch__dot { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--swatch); color: #fff; box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.08); transition: transform var(--sk-dur-base) var(--sk-ease-spring), box-shadow var(--sk-dur-fast); }
.sk-swatch__dot .sk-icon { opacity: 0; transform: scale(0.5); transition: opacity var(--sk-dur-fast), transform var(--sk-dur-base) var(--sk-ease-spring); filter: drop-shadow(0 1px 1px rgb(0 0 0 / 0.3)); }
.sk-swatch:hover .sk-swatch__dot { transform: scale(1.08); }
.sk-swatch:has(input[type=radio]:checked) .sk-swatch__dot { box-shadow: 0 0 0 2px var(--sk-surface), 0 0 0 4px var(--swatch); }
.sk-swatch:has(input[type=radio]:checked) .sk-swatch__dot .sk-icon { opacity: 1; transform: scale(1); }
.sk-swatch:has(input:focus-visible) .sk-swatch__dot { outline: 2px solid var(--sk-focus); outline-offset: 4px; }
.sk-swatch--custom .sk-swatch__dot { background: conic-gradient(from 0deg, #ef4444, #f59e0b, #84cc16, #10b981, #06b6d4, #3b82f6, #8b5cf6, #ec4899, #ef4444); }
.sk-swatch--custom:has(input[type=radio]:checked) .sk-swatch__dot { background: var(--swatch); }
.sk-swatch--custom .sk-swatch__dot .sk-icon { opacity: 1; transform: none; }
/* Your own colour: a hex code typed in, previewed beside it. */
.sk-swatch-hex { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.sk-swatch-hex__preview { width: 34px; height: 34px; border-radius: 10px; box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.1); flex-shrink: 0; transition: background-color var(--sk-dur-fast); }
.sk-swatch-hex .sk-input { width: 130px; }
.sk-swatch-hex .sk-input__control { font-family: var(--sk-font-mono); text-transform: uppercase; }
.sk-icon-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 6px; }
.sk-icon-pick { position: relative; display: grid; place-items: center; aspect-ratio: 1; border-radius: 12px; border: 1.5px solid var(--sk-border-subtle); background: var(--sk-surface); color: var(--sk-fg-muted); cursor: pointer; transition: border-color var(--sk-dur-fast), background-color var(--sk-dur-fast), color var(--sk-dur-fast), transform var(--sk-dur-base) var(--sk-ease-spring); }
.sk-icon-pick input { position: absolute; opacity: 0; pointer-events: none; }
.sk-icon-pick:hover { border-color: var(--sk-border-strong); color: var(--sk-fg); }
.sk-icon-pick:active { transform: scale(0.94); }
.sk-icon-pick:has(input:checked) { border-color: var(--sk-brand-9); background: var(--sk-brand-2); color: var(--sk-brand-11); box-shadow: 0 0 0 1px var(--sk-brand-9); }
.sk-icon-pick:has(input:focus-visible) { outline: 2px solid var(--sk-focus); outline-offset: 2px; }

/* A fieldset that groups controls under a label, without the browser's box. */
.sk-fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.sk-fieldset > legend { padding: 0; margin-bottom: 8px; }

/* Files: a failed upload, and a saved file marked for removal. */
.sk-file.is-failed { border-color: var(--sk-red-7); }
.sk-file:has([data-sk-file-remove] input:checked) { background: var(--sk-surface-sunken); }
.sk-file:has([data-sk-file-remove] input:checked) .sk-file__name { text-decoration: line-through; color: var(--sk-fg-muted); }
.sk-file .sk-progress { margin-top: 2px; }

/* List editor (ui.list_editor) */
.sk-list-editor { gap: 8px; }
.sk-list-editor__items { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }
.sk-list-editor__item { display: flex; align-items: center; gap: 10px; padding: 4px 6px 4px 10px; border: 1px solid var(--sk-border); border-radius: 12px; background: var(--sk-surface); transition: border-color var(--sk-dur-fast), box-shadow var(--sk-dur-fast); animation: sk-rise var(--sk-dur-base) var(--sk-ease-out); }
.sk-list-editor__item:focus-within { border-color: var(--sk-brand-8); box-shadow: var(--sk-focus-ring); }
.sk-list-editor__mark { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--t-soft); color: var(--t-text); flex-shrink: 0; }
.sk-list-editor__input { flex: 1; min-width: 0; height: 34px; border: 0; background: transparent; color: var(--sk-fg); font: inherit; font-size: var(--sk-text-md); outline: none; }
.sk-list-editor__input::placeholder { color: var(--sk-fg-subtle); }
.sk-list-editor__remove { display: grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 8px; background: transparent; color: var(--sk-fg-muted); cursor: pointer; flex-shrink: 0; }
.sk-list-editor__remove:hover { background: var(--sk-surface-hover); color: var(--sk-fg); }
.sk-list-editor__remove:focus-visible { outline: none; box-shadow: var(--sk-focus-ring); }
.sk-list-editor > .sk-btn { align-self: flex-start; }

/* A native progress bar drawn like ui.progress, for scripts that set .value
   (the GCE PDF upload). */
progress.sk-meter { appearance: none; -webkit-appearance: none; width: 100%; height: 8px; border: 0; border-radius: var(--sk-radius-full); background: var(--sk-ink-3); overflow: hidden; color: var(--sk-brand-9); }
progress.sk-meter::-webkit-progress-bar { background: var(--sk-ink-3); border-radius: var(--sk-radius-full); }
progress.sk-meter::-webkit-progress-value { background: var(--sk-brand-9); border-radius: var(--sk-radius-full); transition: width var(--sk-dur-base) var(--sk-ease-out); }
progress.sk-meter::-moz-progress-bar { background: var(--sk-brand-9); border-radius: var(--sk-radius-full); }
