/* 表单项：标签 → 说明 → 错误 → 控件；控件高度与按钮一致（36px）。默认值参考 Pico CSS（MIT）。 */
.form-stack {
  display: grid;
  gap: var(--距-4);
}

.field {
  display: grid;
  gap: var(--距-1);
  min-width: 0;
}

.field-label {
  font-size: var(--字号-正文);
  font-weight: var(--字重-中);
  color: var(--色-文字);
}

.field-label-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--距-1);
}

/* 折叠说明：标签旁的「?」，点开才显示，避免表单啰嗦 */
.hint-trigger {
  display: inline-grid;
  place-items: center;
  width: 1rem;
  height: 1rem;
  border: 1px solid var(--色-边线-控件);
  border-radius: var(--角-圆);
  color: var(--色-文字-弱);
  font-size: 0.6875rem;
  font-weight: var(--字重-粗);
  line-height: 1;
  list-style: none;
}

.hint-trigger::-webkit-details-marker {
  display: none;
}

.hint[open] > .hint-trigger {
  background: var(--色-品牌-浅);
  border-color: var(--色-品牌);
  color: var(--色-品牌-浅上文字);
}

.hint-body {
  position: absolute;
  left: 0;
  top: calc(100% + var(--距-1));
  z-index: var(--层-菜单);
  max-width: 18rem;
  padding: var(--距-2) var(--距-3);
  border: 1px solid var(--色-边线);
  border-radius: var(--角-中);
  background: var(--色-表面);
  box-shadow: var(--影-中);
  font-size: var(--字号-小);
  color: var(--色-文字-次);
}

.field-req {
  margin-left: 0.2em;
  color: var(--色-危险-文字);
}

.field-help {
  font-size: var(--字号-小);
  color: var(--色-文字-弱);
}

.field > .input,
.field > .check-group,
.field > .check {
  margin-top: var(--距-1);
}

.input {
  display: block;
  width: 100%;
  min-height: var(--高-控件);
  padding: 0.25rem 0.625rem;
  border: 1px solid var(--色-边线-控件);
  border-radius: var(--角-中);
  background: var(--色-表面);
  color: var(--色-文字);
  line-height: 1.5;
  transition: border-color var(--时-快) var(--缓动), box-shadow var(--时-快) var(--缓动);
}

.input:hover {
  border-color: var(--色-边线-控件-悬停);
}

.input:focus-visible,
.input:focus {
  outline: none;
  border-color: var(--色-焦点);
  box-shadow: 0 0 0 3px rgb(79 110 71 / 0.22);
}

.input:disabled {
  background: var(--色-禁用-底);
  border-color: var(--色-边线);
  color: var(--色-文字-禁用);
  cursor: not-allowed;
}

.field--invalid .input,
.input[aria-invalid="true"] {
  border-color: var(--色-危险);
}

.field--invalid .input:focus {
  box-shadow: 0 0 0 3px rgb(179 57 47 / 0.2);
}

.textarea {
  min-height: 5.5rem;
  resize: vertical;
  line-height: var(--行高-正文);
}

.select {
  appearance: none;
  padding-right: 2.25rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2356645c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.625rem center;
  background-size: 1rem;
}

.file {
  padding: 0.25rem;
  cursor: pointer;
}

.file::file-selector-button {
  margin-right: var(--距-3);
  min-height: calc(var(--高-控件) - 0.625rem);
  padding: 0 var(--距-3);
  border: 1px solid var(--色-边线-控件);
  border-radius: var(--角-小);
  background: var(--色-表面-凹);
  color: var(--色-文字);
  font: inherit;
  font-weight: var(--字重-中);
  cursor: pointer;
}

.file:hover::file-selector-button {
  background: var(--色-表面-悬停);
}

/* 勾选与单选 */
.check-group {
  display: grid;
  gap: var(--距-2);
}

.check-group--row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--距-2) var(--距-6);
}

.check {
  display: flex;
  align-items: flex-start;
  gap: var(--距-2);
}

.check-input {
  flex: none;
  width: 1rem;
  height: 1rem;
  margin-top: calc((1lh - 1rem) / 2);
  accent-color: var(--色-品牌);
  cursor: pointer;
}

.check-label {
  display: grid;
  cursor: pointer;
}

.check-help {
  font-size: var(--字号-小);
  color: var(--色-文字-弱);
}

.field-help--check {
  padding-left: 1.5rem;
}

/* 折叠备注 */
.note {
  border-top: 1px dashed var(--色-边线);
  padding-top: var(--距-2);
}

.note-summary {
  display: inline-flex;
  align-items: center;
  gap: var(--距-1);
  padding: var(--距-1) 0;
  color: var(--色-品牌-文字);
  font-weight: var(--字重-中);
  list-style: none;
}

.note-summary::-webkit-details-marker {
  display: none;
}

.note-summary::before {
  content: "+";
  display: inline-grid;
  place-items: center;
  width: 1.125rem;
  height: 1.125rem;
  border: 1px solid currentColor;
  border-radius: var(--角-小);
  font-size: var(--字号-小);
  line-height: 1;
}

.note[open] > .note-summary::before {
  content: "−";
}

.note-body {
  padding-top: var(--距-2);
}
