.item-labels-editor {
  border: 1px solid var(--line, #cee3ef);
  border-radius: 12px;
  padding: 16px;
  min-width: 0;
  background: var(--surface, #fff);
}
.item-labels-editor [hidden], .item-label-dialog [hidden] { display: none !important; }
.item-labels-editor .item-labels-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.item-labels-head > div { min-width: 0; }
.item-labels-heading { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.item-labels-heading > strong { font-size: 14px; line-height: 1.5; }
.item-label-count { padding: 2px 8px; border-radius: 20px; background: var(--soft, #f3faff); color: var(--green, #0871b1); font-size: 11px; font-weight: 650; line-height: 1.5; white-space: nowrap; }
.item-labels-editor .item-labels-hint { display: block; font-size: 12px; color: var(--muted, #59788b); line-height: 1.5; margin: 5px 0 0; }
.item-labels-editor button[data-label-toggle] { display: inline-flex; align-items: center; justify-content: center; gap: 8px; flex: none; width: auto; min-width: 0; min-height: 36px; height: auto; padding: 7px 12px; border: 1px solid var(--line, #cee3ef); border-radius: 8px; background: var(--surface, #fff); color: var(--ink, #173b57); font-size: 12px !important; white-space: nowrap; }
.item-labels-editor button[data-label-toggle] > span { font-size: 16px; line-height: 1; }
.item-labels-editor button[data-label-toggle][aria-expanded=true] { border-color: var(--green, #0871b1); color: var(--green, #0871b1); background: var(--soft, #f3faff); }

.item-label-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; min-width: 0; }
.item-label-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; border: 1px solid var(--line, #cee3ef); background: var(--soft, #f3faff); border-radius: 8px; padding: 2px 3px 2px 8px; font-size: 12px; }
.item-label-chip > span:not(.item-label-icon) { overflow-wrap: anywhere; min-width: 0; }
.item-label-chip button { background: transparent; border: 0; width: 32px; height: 32px; flex: none; border-radius: 6px; font-size: 18px; color: var(--muted, #59788b); cursor: pointer; }
.item-label-chip button:hover { background: #dceef8; color: var(--ink, #173b57); }
.item-label-chip img { width: 22px; height: 22px; object-fit: contain; flex: none; }
.item-label-icon { display: inline-flex; align-items: center; justify-content: center; font-size: 16px; flex: none; line-height: 1; letter-spacing: -2px; white-space: nowrap; }

.item-labels-editor .item-label-picker { border-top: 1px solid var(--line, #cee3ef); padding-top: 12px; margin-top: 12px; max-height: none; overflow: visible; }
.item-label-search { display: flex; align-items: center; gap: 9px; min-width: 0; padding: 0 11px; margin-bottom: 10px; border: 1px solid var(--line, #cee3ef); border-radius: 8px; background: var(--surface, #fff); color: var(--muted, #59788b); }
.item-label-search > svg { flex: none; }
.item-labels-editor .item-label-search > input { border: 0; outline: none; box-shadow: none; border-radius: 0; background: transparent; padding: 9px 0; min-width: 0; width: 100%; min-height: 40px; height: 40px; font-size: 13px; color: var(--ink, #173b57); }
.item-label-search input::-webkit-search-cancel-button { display: none; }
.item-label-search > button { width: 32px; height: 32px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: inherit; font-size: 20px; flex: none; cursor: pointer; }
.item-label-search:focus-within { border-color: var(--green, #0871b1); box-shadow: 0 0 0 2px #0871b11a; }
.item-labels-editor .item-label-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 8px; max-height: 272px; overflow-y: auto; overscroll-behavior: contain; padding: 2px; margin: 0 0 10px; }
/* Form labels elsewhere stack their children. Keep each choice a single touch-friendly row. */
.item-labels-editor label.item-label-choice { display: flex !important; flex-direction: row !important; justify-content: flex-start !important; align-items: center; gap: 10px; min-height: 48px; padding: 9px 12px; border: 1px solid var(--line, #cee3ef); border-radius: 8px; font-size: 13px; font-weight: 500; line-height: 1.4; text-align: left; cursor: pointer; min-width: 0; margin: 0 !important; background: var(--surface, #fff); transition: border-color .15s, background .15s; }
.item-labels-editor label.item-label-choice[hidden] { display: none !important; }
.item-label-choice > .item-label-icon { width: 42px; min-width: 42px; }
.item-label-choice > img { width: 42px; height: 26px; object-fit: contain; flex: none; }
.item-label-choice-name { min-width: 0; flex: 1; overflow-wrap: anywhere; }
.item-labels-editor label.item-label-choice:hover { background: var(--soft, #f3faff); border-color: #8cbcd8; }
.item-labels-editor label.item-label-choice:has(input:checked) { background: #eaf5fc; border-color: var(--green, #0871b1); color: var(--ink, #173b57); }
.item-labels-editor .item-label-choice input[type=checkbox] { order: 3; accent-color: var(--green, #0871b1); width: 17px; height: 17px; min-height: 17px; flex: none; margin: 0; }
.item-label-choice:focus-within, .item-label-chip button:focus-visible, .item-label-create:focus-visible { outline: 2px solid var(--green, #0871b1); outline-offset: 2px; }
.item-label-empty { margin: 0 0 12px; padding: 20px 12px; text-align: center; font-size: 13px; color: var(--muted, #59788b); background: var(--soft, #f3faff); border-radius: 8px; }
.item-labels-editor .item-label-create { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 7px 0; border: 0; background: transparent; color: var(--green, #0871b1); font-size: 12px; }

.item-label-dialog { width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: auto; border: 1px solid var(--line, #cee3ef); border-radius: 14px; padding: 24px; color: var(--ink, #173b57); background: white; box-shadow: 0 20px 80px #173b5740; }
.item-label-dialog::backdrop { background: #173b5780; }
.item-label-dialog form { display: grid; gap: 18px; }
.item-label-dialog header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.item-label-dialog h2 { font-size: 20px; margin: 0; }
.item-label-dialog header button { border: 0; border-radius: 50%; width: 36px; height: 36px; flex: none; font-size: 24px; }
.item-label-dialog label { display: grid; gap: 8px; min-width: 0; }
.item-label-dialog input { width: 100%; min-width: 0; }
.item-label-dialog p, .item-label-dialog small { font-size: 13px; line-height: 1.5; color: var(--muted, #59788b); margin: 0; }
.item-label-dialog .item-label-error { color: #b42318; overflow-wrap: anywhere; }
.item-label-dialog footer { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; }
.item-label-preview { width: 96px; height: 96px; object-fit: contain; }
@media (max-width: 600px) {
  .item-labels-editor { padding: 14px; }
  .item-labels-editor .item-labels-head { gap: 10px; }
  .item-labels-editor .item-labels-heading { gap: 5px; }
  .item-labels-editor button[data-label-toggle] { padding: 8px 10px; min-height: 40px; }
  .item-labels-editor .item-labels-hint { font-size: 11px; }
  .item-label-dialog { padding: 18px; }
}
