@layer components {
.form { display: flex; flex-direction: column; gap: 14px; }
.fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.fgrid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fld { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.fld > label, .fld > .lab { font-size: var(--fs-11-5); color: var(--fg-3); font-weight: 500; display: flex; gap: 6px; align-items: center; }
.fld .req { color: var(--bad); }
.fld .hint { font-size: var(--fs-11); color: var(--fg-4); }
.fld .err, .err { font-size: var(--fs-11-5); color: var(--bad); display: flex; gap: 6px; align-items: center; }

.input {
  height: 36px; background: var(--bg-1); border: 1px solid var(--line-2); border-radius: var(--r-9); padding: 0 12px;
  outline: none; width: 100%; min-width: 0; transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.input:hover { border-color: var(--fg-4); }
.input:focus { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.input.bad, .input.invalid { border-color: color-mix(in srgb, var(--bad) 60%, transparent); }
textarea.input { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; line-height: 1.55; }
.input::placeholder, textarea::placeholder { color: var(--fg-4); }

.input-wrap { display: flex; align-items: center; background: var(--bg-1); border: 1px solid var(--line-2); border-radius: var(--r-9); height: 36px; padding: 0 4px 0 12px; gap: 8px; color: var(--fg-3); }
.input-wrap:focus-within { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.input-wrap input { flex: 1; background: none; border: 0; outline: none; min-width: 0; height: 100%; color: var(--fg); }

.select { height: 36px; background: var(--bg-1); border: 1px solid var(--line-2); border-radius: var(--r-9); padding: 0 10px 0 12px; display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; color: var(--fg); }
.select:hover { border-color: var(--fg-4); }
.select .v { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; white-space: nowrap; overflow: hidden; }
.select .i { color: var(--fg-3); }

.checkrow { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: var(--r-9); cursor: pointer; text-align: left; width: 100%; }
.checkrow:hover { background: var(--bg-3); }
.checkrow .cb { margin-top: 1px; }
.checkrow b { font-weight: 500; display: block; }
.checkrow .d { font-size: var(--fs-11-5); color: var(--fg-3); }

.cb { width: 16px; height: 16px; border-radius: var(--r-4); border: 1.5px solid var(--fg-4); display: grid; place-items: center; color: transparent; flex: none; }
.cb:hover { border-color: var(--fg-2); }
.cb.on, .sel .cb { background: var(--accent); border-color: var(--accent); color: var(--fg-on-accent); }
.cb.ok { background: var(--ok); border-color: var(--ok); color: var(--fg-on-accent); }

.swatches { display: flex; gap: 8px; }
.swatches button { width: 24px; height: 24px; border-radius: var(--r-7); background: var(--c); box-shadow: inset 0 0 0 1px rgb(var(--white-rgb) / 0.1); }
.swatches button.on { box-shadow: 0 0 0 2px var(--bg-2), 0 0 0 4px var(--c); }

.datebox { height: 36px; background: var(--bg-1); border: 1px solid var(--line-2); border-radius: var(--r-9); padding: 0 12px; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }

.mini-cal { display: grid; grid-template-columns: repeat(7, 32px); gap: 3px; font-size: var(--fs-11-5); text-align: center; }
.mini-cal .h { color: var(--fg-4); font-size: var(--fs-10); padding: 2px 0; }
.mini-cal span { height: 28px; display: grid; place-items: center; border-radius: var(--r-7); color: var(--fg-2); }
.mini-cal span.o { color: var(--fg-4); }
.mini-cal span.in { background: var(--accent-soft); border-radius: 0; }
.mini-cal span.st { background: var(--accent); color: var(--fg-on-accent); font-weight: 700; border-radius: var(--r-7) 0 0 var(--r-7); }
.mini-cal span.en { background: var(--accent); color: var(--fg-on-accent); font-weight: 700; border-radius: 0 var(--r-7) var(--r-7) 0; }
.mini-cal span.td { box-shadow: inset 0 0 0 1px var(--fg-3); }

.notice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r-10); font-size: var(--fs-12); color: var(--fg-2); background: color-mix(in srgb, var(--warn) 7%, transparent); border: 1px solid color-mix(in srgb, var(--warn) 25%, transparent); }
.notice .i { color: var(--warn); margin-top: 1px; }
.notice.info { background: var(--accent-soft); border-color: var(--accent-line); }
.notice.info .i { color: var(--accent); }
.notice.bad { background: color-mix(in srgb, var(--bad) 7%, transparent); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.notice.bad .i { color: var(--bad); }
.notice.ok { background: color-mix(in srgb, var(--ok) 7%, transparent); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.notice.ok .i { color: var(--ok); }

.drop { border: 1.5px dashed var(--line-2); border-radius: var(--r-11); padding: 14px; text-align: center; color: var(--fg-3); font-size: var(--fs-12); display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; }
.drop.over { border-color: var(--accent-line); background: var(--accent-soft); color: var(--fg); }

.validation-message { font-size: var(--fs-11-5); color: var(--bad); }

@media (max-width: 820px) { .fgrid, .fgrid.three { grid-template-columns: 1fr; } }

/* Toggle chips in a row, with a small free-text chip at the end (Reopen "Failed on"). */
.chip-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.chip-input { height: 28px; width: 110px; padding: 0 10px; border-radius: var(--r-pill); border: 1px dashed var(--line-2); background: none; color: var(--fg-2); font-size: var(--fs-12); outline: none; }
.chip-input:focus { border-color: var(--accent-line); border-style: solid; }

/* "Drop or paste files here" hint inside dialogs */
.paste, .held { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px dashed var(--line-2); border-radius: var(--r-9); font-size: var(--fs-11-5); color: var(--fg-3); }
.held { margin-top: 10px; border-style: solid; }
.held.muted { border-style: dashed; color: var(--fg-4); }
.form.narrow { max-width: 640px; }
.form-actions { display: flex; gap: 8px; margin-top: 24px; }
.fgrid.key-col { grid-template-columns: minmax(0, 1fr) 140px; }
.input.tall { min-height: 80px; }
}
