/* portal-tagfield.css — the pill tag field drawn by portal-tagfield.js.
   Served from /static to BOTH surfaces, so it must not assume either
   one's stylesheet. Every colour reads a public theme token with a
   control-panel fallback: a theme (light or dark) recolours the field
   through its own tokens, and the control panel, which defines none of
   them, falls through to the Tailwind palette vars — which its dark
   skin (a theme's control.css) already remaps, so the field follows
   that too. The literal hexes are the last resort if neither exists. */

/* the wrap is the positioning context for the suggestion menu, so the
   menu can overlay whatever follows the field instead of shoving it. */
.tagfield__wrap {
    position: relative;
}

.tagfield {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem;
    width: 100%;
    margin-top: 0.25rem;
    padding: 0.3125rem 0.5rem;
    border: 1px solid var(--border-strong, var(--color-stone-300, #d6d3d1));
    border-radius: var(--radius-sm, 0.375rem);
    background: var(--surface, var(--color-stone-50, #ffffff));
    cursor: text;
}

.tagfield:focus-within {
    border-color: var(--accent, var(--color-orange-600, #ea580c));
    box-shadow: 0 0 0 1px var(--accent, var(--color-orange-600, #ea580c));
}

.tagfield__pill {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.125rem 0.25rem 0.125rem 0.5rem;
    border-radius: 999px;
    background: var(--surface-2, var(--color-stone-100, #f5f5f4));
    color: var(--text, var(--color-stone-900, #1c1917));
    font-size: 0.8125rem;
    line-height: 1.5;
    white-space: nowrap;
}

.tagfield__remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.125rem;
    height: 1.125rem;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--text-subtle, var(--color-stone-500, #78716c));
    font-size: 0.875rem;
    line-height: 1;
    cursor: pointer;
}

.tagfield__remove:hover {
    background: var(--danger-soft, var(--color-red-50, #fef2f2));
    color: var(--danger, var(--color-red-700, #b91c1c));
}

/* the entry grows into whatever room the pills leave, and wraps to its
   own line once that room runs out — a tag being typed should never be
   squeezed into three visible characters. */
.tagfield__entry {
    flex: 1 1 8rem;
    min-width: 8rem;
    padding: 0.125rem 0;
    border: 0;
    background: transparent;
    color: var(--text, var(--color-stone-900, #1c1917));
    font: inherit;
    font-size: 0.875rem;
}

.tagfield__entry:focus {
    outline: none;
}

.tagfield__menu {
    position: absolute;
    z-index: 30;
    top: calc(100% + 0.25rem);
    left: 0;
    right: 0;
    max-height: 14rem;
    overflow-y: auto;
    padding: 0.25rem;
    border: 1px solid var(--border-strong, var(--color-stone-300, #d6d3d1));
    border-radius: var(--radius-sm, 0.375rem);
    background: var(--surface, var(--color-stone-50, #ffffff));
    box-shadow: 0 8px 24px rgb(0 0 0 / 0.12);
}

.tagfield__menu[hidden] {
    display: none;
}

.tagfield__option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm, 0.375rem);
    color: var(--text, var(--color-stone-900, #1c1917));
    font-size: 0.8125rem;
    cursor: pointer;
}

.tagfield__option.is-active {
    background: var(--surface-2, var(--color-stone-100, #f5f5f4));
}

.tagfield__count {
    color: var(--text-subtle, var(--color-stone-500, #78716c));
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
}
